problem_id stringlengths 6 6 | user_id stringlengths 10 10 | time_limit float64 1k 8k | memory_limit float64 262k 1.05M | problem_description stringlengths 48 1.55k | codes stringlengths 35 98.9k | status stringlengths 28 1.7k | submission_ids stringlengths 28 1.41k | memories stringlengths 13 808 | cpu_times stringlengths 11 610 | code_sizes stringlengths 7 505 |
|---|---|---|---|---|---|---|---|---|---|---|
p02768 | u840310460 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['n, a, b = [int(i) for i in input().split()]\n\np = 10 ** 9 + 7\nN = 10 ** 9\nfact = [1, 1]\nfactinv = [1, 1]\ninv = [0, 1]\n\nfor i in range(2, N+1):\n fact.append((fact[-1]*i)%p)\n inv.append((-inv[p%i] * (p//i)) % p) \n factinv.append(factinv[-1] * inv[-1] % p)\n \ndef comb(n, r, p):\n if r < 0 or n < r:\n return 0\n \n r = min(r, n-r)\n return fact[n] * factinv[r] * factinv[n-r] % p\n \nprint(pow(2, n, p) -1 -comb(n, a, p) - comb(n, b, p))', 'n, a, b = [int(i) for i in input().split()]\nmod = 10**9+7\n\ndef func_156d(n, r):\n numerator = 1\n denominator = 1\n for i in range(r):\n numerator = numerator * (n-i) % mod\n denominator = denominator * (i+1) % mod\n return numerator * pow(denominator, mod-2, mod) %mod\n\nprint((pow(2, n, mod) -1 - func_156d(n,a) - func_156d(n,b)) %mod )'] | ['Time Limit Exceeded', 'Accepted'] | ['s938183978', 's285754856'] | [225920.0, 3064.0] | [2123.0, 151.0] | [458, 358] |
p02768 | u840974625 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['n, a, b = map(int, input().split())\n\nmod = 10**9 + 7\nres = (2**n - 1) % mod\n\ndef cmb(n, r, mod):\n r = min(n-r, r)\n if r == 0:\n return 1\n over, under = 1, 1\n for i in range(1, r+1):\n over = over * (n-i+1) % mod\n under = under * i % mod\n inv = pow(under, mod-2, mod)\n return over * inv % mod\n\n\nA = cmb(n, a, mod)\nB = cmb(n, b, mod)\n\nprint((res - A - B - 1) % mod)\n', 'n, a, b = map(int, input().split())\nres = 0\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nfrom functools import lru_cache\n\n@lru_cache(maxsize=1000)\ndef c(n,k): \n return 1 if(k<=0 or n<=k) else ( c(n-1, k-1) + c(n-1, k) ) %4\n\nmod = 10**9+7 \n#N = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, n + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n \nres = 2 ** (n - 1)\n\nres -= cmb(n,a,mod)\nres -= cmb(n,b,mod)\n\nprint(res)', 'n, a, b = map(int, input().split())\nres = 2 ** n - 1\nmod = 10**9 + 7\n\ndef cmb(n, r, mod):\n r = min(n-r, r)\n if r == 0:\n return 1\n over, under = 1, 1\n for i in range(1, r+1):\n over = over * (n-i+1) % mod\n under = under * i % mod\n inv = pow(under, mod-2, mod)\n return over * inv % mod\n\nres -= cmb(n,a,mod)\nres -= cmb(n,b,mod)\n\nprint(res // mod)\n', 'n, a, b = map(int, input().split())\nres = 0\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \n#N = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, n + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\n \n#res = cmb(n,3,mod)\nfor i in range(1, n+1):\n res += cmb(n,i,mod)\nres -= cmb(n,a,mod)\nres -= cmb(n,b,mod)\n\nprint(res)', 'n, a, b = map(int, input().split())\n#res = 2 ** n - 1\nres = pow(2, n, mod)\nmod = 10**9 + 7\n\ndef cmb(n, r, mod):\n r = min(n-r, r)\n if r == 0:\n return 1\n over, under = 1, 1\n for i in range(1, r+1):\n over = over * (n-i+1) % mod\n under = under * i % mod\n inv = pow(under, mod-2, mod)\n return over * inv % mod\n\nres -= cmb(n,a,mod)\nres -= cmb(n,b,mod)\n\nprint(res % mod)\n', 'n, a, b = map(int, input().split())\nres = 0\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nfrom functools import lru_cache\n\n@lru_cache(maxsize=1000)\ndef c(n,k): \n return 1 if(k<=0 or n<=k) else ( c(n-1, k-1) + c(n-1, k) ) %4\n\nmod = 10**9+7 \n#N = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, n + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n \nres = 2 ** n - 1\n\nres -= cmb(n,a,mod)\nres -= cmb(n,b,mod)\n\nprint(res)\n', 'n, a, b = map(int, input().split())\nres = 0\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nfrom functools import lru_cache\n\n@lru_cache(maxsize=1000)\ndef c(n,k): \n return 1 if(k<=0 or n<=k) else ( c(n-1, k-1) + c(n-1, k) ) %4\n\nmod = 10**9+7 \n#N = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, n + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n \nres = 2 * (n - 1)\n\nres -= cmb(n,a,mod)\nres -= cmb(n,b,mod)\n\nprint(res)', 'n, a, b = map(int, input().split())\nres = 2 ** n - 1\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nres -= cmb(n,a,mod)\nres -= cmb(n,b,mod)\n\nprint(res)', 'n, a, b = map(int, input().split())\n\nmod = 10**9 + 7\nres = pow(2, n, mod)\n\ndef cmb(n, r, mod):\n r = min(n-r, r)\n if r == 0:\n return 1\n over, under = 1, 1\n for i in range(1, r+1):\n over = over * (n-i+1) % mod\n under = under * i % mod\n inv = pow(under, mod-2, mod)\n return over * inv % mod\n\n\nA = cmb(n, a, mod)\nB = cmb(n, b, mod)\n\nprint((res - A - B - 1) % mod)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Time Limit Exceeded', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s043535825', 's151274784', 's251706015', 's561108150', 's592749029', 's612818541', 's630502405', 's766948369', 's695061932'] | [199380.0, 209708.0, 199388.0, 228828.0, 3064.0, 213996.0, 223728.0, 199380.0, 3064.0] | [2106.0, 2118.0, 2107.0, 2119.0, 18.0, 2118.0, 2119.0, 2107.0, 141.0] | [401, 717, 382, 628, 403, 716, 716, 563, 399] |
p02768 | u857330600 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['mod=10**9+7\nors=[n]\nrev=[1]\n\ndef ie(n,r,mod):\n if r==1:\n return n\n elif r%2==0:\n return (ie(n,r//2,mod)**2)%mod\n else:\n return n*((ie(n,(r-1)//2,mod))**2)%mod\n \nfor i in range(1,b):\n ors.append(ors[-1]*(n-i)%mod)\n rev.append(rev[-1]*(i+1)%mod) \nN=ie(2,n,mod)\nA=ors[a-1]*ie(rev[a-1],mod-2,mod)\nB=ors[b-1]*ie(rev[b-1],mod-2,mod)\nprint((N-A-B-1)%mod)', 'n,a,b=map(int,input().split())\nmod=10**9+7\nors=[n]\nrev=[1]\n\ndef ie(n,r,mod):\n if r==1:\n return n\n elif r%2==0:\n return (ie(n,r//2,mod)**2)%mod\n else:\n return n*((ie(n,(r-1)//2,mod))**2)%mod\n \n \nfor i in range(1,b):\n ors.append(ors[-1]*(n-i)%mod)\n rev.append(rev[-1]*(i+1)%mod) \nN=ie(2,n,mod)\nA=ors[a-1]*ie(rev[a-1],mod-2,mod)\nB=ors[b-1]*ie(rev[b-1],mod-2,mod)\nprint((N-A-B-1)%mod)'] | ['Runtime Error', 'Accepted'] | ['s165575890', 's609485676'] | [3064.0, 18892.0] | [17.0, 150.0] | [363, 399] |
p02768 | u860002137 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['from functools import reduce\nMOD = 10**9 + 7\n\n\ndef cmb(N, A):\n num = reduce(lambda x, y: x * y % MOD, range(N, N - A, -1))\n den = reduce(lambda x, y: x * y % MOD, range(1, A + 1))\n return num * pow(den, MOD - 2, MOD) % MOD\n\n\nn, a, b = map(int, input().split())\na %= MOD\nb %= MOD\n\n\nprint((pow(2, n, MOD) - cmb(n, a) - cmb(n, b)) % MOD)', 'from functools import reduce\nMOD = 10**9 + 7\n\n\ndef cmb(N, A):\n num = reduce(lambda x, y: x * y % MOD, range(N, N - A, -1))\n den = reduce(lambda x, y: x * y % MOD, range(1, A + 1))\n return num * pow(den, MOD - 2, MOD) % MOD\n\n\nn, a, b = map(int, input().split())\na %= MOD\nb %= MOD\n\n\nprint((pow(2, n, MOD) - 1 - cmb(n, a) - cmb(n, b)) % MOD)'] | ['Wrong Answer', 'Accepted'] | ['s130701126', 's934519135'] | [3684.0, 3572.0] | [159.0, 160.0] | [343, 347] |
p02768 | u871509659 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['import math\n\nz = 10**9 + 7\n\nn, a, b = [int(i) for i in input().split()]\n\nr = pow(2, n, z)\n\ndef c(m):\n x = 1\n for i in range(n-m+1, n+1):\n x = x*i % z\n \n return (x * pow(math.factorial(m), z-2, z)) % z\n\nr = (r - c(a) - c(b)) % z\n\nprint(r)', 'import math\n\nz = 10**9 + 7\n\nn, a, b = [int(i) for i in input().split()]\n\nr = pow(2, n, z) - 1\n\ndef c(m):\n x = 1\n for i in range(n-m+1, n+1):\n x = x*i % z\n \n return (x * pow(math.factorial(m), z-2, z)) % z\n\nr = (r - c(a) - c(b)) % z\n\nprint(r)'] | ['Wrong Answer', 'Accepted'] | ['s407082561', 's718632444'] | [5452.0, 5464.0] | [1489.0, 1489.0] | [244, 248] |
p02768 | u880480312 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['m=10**9+7\nn,a,b=map(int,input().split())\n\ndef comb(n,r,m):\n x,y=1,1\n for i in range(r):\n x*=n-1\n y*=n+1\n x%=m\n y%=m\n return int(x * pow(y, m-2, m))\nans = pow(2, n, m)-comb(n, a, m) - comb(n, b, m)\nprint(ans%m)', 'm=10**9+7\nn,a,b=map(int,input().split())\n\ndef comb(n,r,m):\n x,y=1,1\n for i in range(r):\n x*=n-i\n y*=i+1\n x%=m\n y%=m\n return int(x * pow(y, m-2, m))\nans = pow(2, n, m)-1-comb(n, a, m) - comb(n, b, m)\nprint(ans%m)'] | ['Wrong Answer', 'Accepted'] | ['s232018694', 's747901361'] | [3064.0, 3064.0] | [151.0, 147.0] | [246, 248] |
p02768 | u893063840 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['n, a, b = map(int, input().split())\nmod = 10 ** 9 + 7\n\nans = pow(2, n, mod)\nans -= 1\nans += 2 * mod\n\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[r-1] * g2[r] % mod\n\nmod = 10**9+7 \nN = 2 * 10 ** 5\ng1 = [n % mod] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブ\n\nfor i in range( 2, N + 1 ):\n g1.append((g1[-1] * (n - i + 1)) % mod)\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nans -= cmb(n, a, mod)\nans -= cmb(n, b, mod)\nans %= mod\n\nprint(ans)\n', 'n, a, b = map(int, input().split())\nmod = 10 ** 9 + 7\n\nans = pow(2, n, mod)\nans -= 1\n\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[r-1] * g2[r] % mod\n\nmod = 10**9+7 \nN = 2 * 10 ** 5\ng1 = [n % mod] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブ\n\nfor i in range( 2, N + 1 ):\n g1.append((g1[-1] * (n - i + 1)) % mod)\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nans -= cmb(n, a, mod)\nans -= cmb(n, b, mod)\nans %= mod\n\nprint(ans)\n', 'n, a, b = map(int, input().split())\n\nmod = 10 ** 9 + 7\nMAX = 2 * 10 ** 5\n\nfact = [1] * (MAX + 1)\nfor i in range(1, MAX + 1):\n fact[i] = (fact[i-1] * i) % mod\n\ninv = [1] * (MAX + 1)\nfor i in range(2, MAX + 1):\n inv[i] = inv[mod % i] * (mod - mod // i) % mod\n\nans = pow(2, n, mod) - 1\n\n\ndef comb(k):\n ret = 1\n for i in range(1, k + 1):\n ret *= n - i + 1\n ret %= mod\n ret *= inv[i]\n ret %= mod\n\n return ret\n\n\nans -= comb(a)\nans -= comb(b)\nans %= mod\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s201359536', 's621776869', 's375040862'] | [27052.0, 27076.0, 18804.0] | [280.0, 278.0, 318.0] | [631, 616, 501] |
p02768 | u895558682 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['from math import comb\n\nM = 10**9 + 7\nn,a,b = map(int, input().split())\n\nprint(pow(2, n, M) - comb(n, a) % M - comb(n, b) % M)\n', 'M = 10**9 + 7\nn,a,b = map(int, input().split())\n\ndef modinv(n):\n return pow(n, M-2, M)\n\ndef comb(n, r):\n num = denom = 1\n for i in range(1,r+1):\n num = (num*(n+1-i))%M\n denom = (denom*i)%M\n return num * modinv(denom) % M\n\nprint((pow(2, n, M) - comb(n, a) - comb(n, b) - 1) % M)'] | ['Runtime Error', 'Accepted'] | ['s674428792', 's423059519'] | [2940.0, 3064.0] | [17.0, 149.0] | [126, 303] |
p02768 | u898967808 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['n,a,b = map(int,input().split())\n\nMOD = 10**9 + 7\nm = 2*10**5\nmm = 2** m\n\nans = 1\nfor _ in range(n // m):\n ans = (ans * mm) % MOD\n\nans = (ans * 2**(n % m)) % MOD \n \nans = (ans - 1) % MOD\n\nans = (ans - cmb(n,a,MOD))%MOD\nans = (ans - cmb(n,b,MOD))%MOD\n\nprint(ans)', 'n,a,b = map(int,input().split())\n\nMOD = 10**9+7\n\ndef cmb(n,r,mod): \n ret=1\n div = min(r,n-r)\n for i in range(div): \n ret=ret*(n-i)*pow(div-i,mod-2,mod)%mod\n \n return ret % mod\n\nans = 1\nans = ans * pow(2,n,MOD)\nans = (ans - 1) % MOD\n\nans = (ans - cmb(n,a,MOD))%MOD\nans = (ans - cmb(n,b,MOD))%MOD\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s437605437', 's872974443'] | [3064.0, 3064.0] | [517.0, 1525.0] | [266, 346] |
p02768 | u909991537 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['n, a, b = (int(i) for i in input().split()) \nmod = 1000000007\nimport math\n\ndef combinations_count(n, r):\n if n <= 1:\n return 0\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n \nlis = [n]\nans = n\nbef = n\nfor i in range(2, math.floor(n/2) + 1):\n add = bef * (bef-1) * (1/i)\n if i == math.floor(n/2) and n % 2 == 0:\n ans *= 2\n ans += add + 1\n elif i == math.floor(n/2) and n % 2 != 0:\n ans += add\n ans *= 2\n ans += 1\n else:\n ans += add\n \n lis.append(add)\n\n \nprint(int(ans % mod))\n \n\n ', 'n, a, b = (int(i) for i in input().split()) \nmod = 1000000007\nimport math\n\ndef combinations_mod(n, r, mod=1000000007):\n """Returns nCr in mod."""\n r = min(r, n - r)\n combs = 1\n for i, j in zip(range(n - r + 1, n + 1), range(1, r + 1)):\n combs *= (i % mod) * pow(j, mod - 2, mod)\n combs %= mod\n return combs\n\nprint((pow(2, n, mod) - 1 - combinations_mod(n, a) - combinations_mod(n, b))%mod)\n \n \n '] | ['Wrong Answer', 'Accepted'] | ['s248598994', 's581432102'] | [85932.0, 3064.0] | [2112.0, 1516.0] | [560, 430] |
p02768 | u920204936 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['n,a,b = map(int,input().split())\nmod = 10**9 + 7\naue,bue = 1,1\nfor i in range(a):\n aue = aue * (n-i) % mod\nfor i in range(b):\n bue = bue * (n-i) % mod\nasita,bsita = 1,1\nfor i in range(1,a+1):\n asita = asita*i %mod\nfor i in range(1,b+1):\n bsita = bsita*i %mod\nat = aue * pow(asita,mod-2,mod)\nbt = bue * pow(bsita,mod-2,mod)\n\nprint(at)\nans = (pow(2,n,mod) - 1 -at -bt)%mod\nprint(ans)', 'n,a,b = map(int,input().split())\nmod = 10**9 + 7\naue,bue = 1,1\nfor i in range(a):\n aue = aue * (n-i) % mod\nfor i in range(b):\n bue = bue * (n-i) % mod\nasita,bsita = 1,1\nfor i in range(1,a+1):\n asita = asita*i %mod\nfor i in range(1,b+1):\n bsita = bsita*i %mod\nat = aue * pow(asita,mod-2,mod)\nbt = bue * pow(bsita,mod-2,mod)\n\nans = (pow(2,n,mod) - 1 -at -bt)%mod\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s561604207', 's672823128'] | [3064.0, 3064.0] | [182.0, 189.0] | [393, 383] |
p02768 | u921168761 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['mod = 1e9 + 7\n\ndef pw(x, n):\n if n == 0: return 1\n elif n == 1: return x\n elif n % 2 == 0:\n return pw(x, n // 2) ** 2 % mod\n else:\n return x * pw(x, n // 2) ** 2 % mod\n\ndef dv(x, y):\n return x * pw(y, mod - 2) % mod\n\ndef comb(n, r):\n v = 1\n if n < r or n < 0 or r < 0: return 0\n r = min(r, n - r)\n for i in range(r):\n v = v * dv(n - i, i + 1) % mod\n return v\n\nn, a, b = map(int, input().split())\nans = pw(2, n) - 1 + mod * 10\nif a <= n: ans -= comb(n, a)\nif b <= n: ans -= comb(n, b)\nprint(ans % mod)', 'def dv(x, y, mod):\n \n return x * pow(y, mod - 2, mod) % mod\n\ndef comb(n, r, mod):\n \n p, q = 1, 1\n if n < r or n < 0 or r < 0: return 0\n for i in range(r):\n p = p * (n - i) % mod\n q = q * (i + 1) % mod\n return dv(p, q, mod)\n\nmod = 1000000007\nn, a, b = map(int, input().split())\n\nans = pow(2, n, mod) - 1\nif 0 <= n: ans -= comb(n, a, mod)\nif 0 <= n: ans -= comb(n, b, mod)\nprint(ans % mod)'] | ['Wrong Answer', 'Accepted'] | ['s713845702', 's894929189'] | [3064.0, 3064.0] | [2108.0, 143.0] | [551, 511] |
p02768 | u922487073 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['\nn,a,b = map(int, input().split())\nMOD = 10**9 + 7\nallpair = pow(2,n,MOD)\n\ndef combo(n,k):\n c = 1\n for i in range(k):\n c *= n - i\n c %= MOD\n\n d = 1\n for i in range(1, k+1):\n d *= i\n d %= MOD\n\n return (c * pow(d, mod-2, MOD)) % MOD\n\nprint((allpair - combo(n, a) - combo(n, b) - 1) % MOD)\n', 'n,a,b = map(int, input().split())\nMOD = 10**9 + 7\nallpair = pow(2,n,MOD)\n\ndef combo(n,k):\n c = 1\n for i in range(k):\n c *= n - i\n c %= MOD\n\n d = 1\n for i in range(1, k+1):\n d *= i\n d %= MOD\n\n return (c * pow(d, MOD-2, MOD)) % MOD\n\nprint((allpair - combo(n, a) - combo(n, b) - 1) % MOD)\n'] | ['Runtime Error', 'Accepted'] | ['s721922595', 's901587396'] | [9128.0, 9060.0] | [73.0, 124.0] | [330, 329] |
p02768 | u934099192 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['MAX_NUM = 10**9+1\nMOD = 10**9+7\n\nfac = [0 for _ in range(MAX_NUM)]\nfinv = [0 for _ in range(MAX_NUM)]\ninv = [0 for _ in range(MAX_NUM)]\n\nfac[0] = fac[1] = 1\nfinv[0] = finv[1] = 1\ninv[1] = 1\n\nfor i in range(2,MAX_NUM):\n fac[i] = fac[i-1] * i % MOD\n inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD\n finv[i] = finv[i-1] * inv[i] % MOD\n\ndef combinations(n,k):\n if n < k:\n return 0\n if n < 0 or k < 0:\n return 0\n return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD\n\n\ndef power_func(a,n,p):\n bi=str(format(n,"b"))\n res=1\n for i in range(len(bi)):\n res=(res*res) %p\n if bi[i]=="1":\n res=(res*a) %p\n return res\n\nn, a, b = map(int, input().split())\n\nX = combinations(n,a)\nY = combinations(n,b)\nZ = power_func(2,n,MOD) - 1\nprint(Z - X - Y)\n', "def binary(n):\n return bin(n)[2:]\n\ndef pow_by_binary_exponentiation(a, x, n): \n x = [int(b) for b in binary(x)]\n y = a\n for i in range(1, len(x)):\n y = (y**2) % n\n if x[i] == 1:\n y = (y * a) % n\n return y\n\n \ndef modinv(a, m):\n g, x, y = egcd(a, m)\n if g != 1:\n raise Exception('modular inverse does not exist')\n else:\n return x % m\n\ndef egcd(a, b):\n if a == 0:\n return b, 0, 1\n else:\n g, y, x = egcd(b % a, a)\n return g, x - (b // a) * y, y\n\n\n# nCr mod m\n\n\ndef combination(n, r, mod=10**9 + 7):\n r = min(r, n - r)\n res = 1\n for i in range(r):\n res = res * (n - i) * modinv(i + 1, mod) % mod\n return res\nn, a, b = map(int, input().split())\n\n\nmod = 10**9 + 7\nX = combination(n,a)\nY = combination(n,b)\nZ = pow_by_binary_exponentiation(2,n,mod) - 1\nW = (Z - X - Y) % mod\nif W < 0:\n W += mod\nprint(W % mod)\n"] | ['Time Limit Exceeded', 'Accepted'] | ['s016781428', 's496956458'] | [486552.0, 3064.0] | [2132.0, 1480.0] | [775, 1022] |
p02768 | u941753895 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\ndd=[(-1,0),(0,1),(1,0),(0,-1)]\nddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef I(): return int(sys.stdin.readline())\ndef LS(): return sys.stdin.readline().split()\ndef S(): return input()\n\ndef cmb(n, r, p):\n a=1\n for i in range(r):\n a*=n\n a%=mod\n n-=1\n b=1\n for i in range(1,r+1):\n b*=i\n b%=mod\n\n inv_b=mod_inv(b,mod)\n # print(a,inv_b)\n return a*inv_b\n\ndef pow_k(x, n):\n \n if n == 0:\n return 1\n\n K = 1\n while n > 1:\n if n % 2 != 0:\n K *= x\n K%=mod\n x *= x\n n //= 2\n x%=mod\n\n return (K * x)%mod\n\ndef extgcd(a,b):\n r = [1,0,a]\n w = [0,1,b]\n while w[2]!=1:\n q = r[2]//w[2]\n r2 = w\n w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]\n r = r2\n w = w2\n #[x,y]\n return [w[0],w[1]]\n\ndef mod_inv(a,m):\n x = extgcd(a,m)[0]\n return (m+x%m)%m\n\ndef main():\n n,a,b=LI()\n if n==2:\n return 0\n\n ans=pow_k(2,n)\n\n ans-=(cmb(n,a,mod)%mod)\n ans-=(cmb(n,b,mod)%mod)\n\n if ans<0:\n ans+=mod\n\n return ans\n\n# main()\nprint(main())\n', 'import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy\n\nsys.setrecursionlimit(10**7)\ninf=10**20\nmod=10**9+7\ndd=[(-1,0),(0,1),(1,0),(0,-1)]\nddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]\n\ndef LI(): return [int(x) for x in sys.stdin.readline().split()]\ndef I(): return int(sys.stdin.readline())\ndef LS(): return sys.stdin.readline().split()\ndef S(): return input()\n\n# n^p(mod m) -- START --\ndef powMod(n,p,m):\n if p==0:\n return 1\n if p%2==0:\n t=powMod(n,p//2,m)\n return t*t%m\n return n*powMod(n,p-1,m)%m\n# n^p(mod m) --- END ---\n\ndef main():\n n,a,b=LI()\n\n ans=powMod(2,n,mod)\n ans-=1\n ans%=mod\n\n pattern_a1=1\n for i in range(a):\n pattern_a1*=n-i\n pattern_a1%=mod\n pattern_a2=1\n for i in range(1,a+1):\n pattern_a2*=i\n pattern_a2%=mod\n pattern_a=pattern_a1*pow(pattern_a2,mod-2,mod)\n\n pattern_b1=1\n for i in range(b):\n pattern_b1*=n-i\n pattern_b1%=mod\n pattern_b2=1\n for i in range(1,b+1):\n pattern_b2*=i\n pattern_b2%=mod\n pattern_b=pattern_b1*pow(pattern_b2,mod-2,mod)\n\n ans-=pattern_a\n ans%=mod\n if ans<0:\n ans+=mod\n ans-=pattern_b\n ans%=mod\n if ans<0:\n ans+=mod\n\n return ans\n\n# main()\nprint(main())\n'] | ['Wrong Answer', 'Accepted'] | ['s378144525', 's537721384'] | [5172.0, 5304.0] | [166.0, 158.0] | [1287, 1191] |
p02768 | u944643608 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['import math\nrom scipy.special import comb\nt = comb(n, a, exact=True)\nk = comb(n, b, exact=True)\nn, a, b = map(int,input().split())\nif n == 2:\n print(0)\nelse:\n total = 2 ** n -1\n total = total - t - k\n print(total % (10 ** 9 + 7))\n', 'import math\nN, a, b = map(int,input().split())\np = 10 ** 9 +7\nA = math.factorial(a)\nB = math.factorial(b)\na_c = 1\nb_c = 1\na_m = 1\nb_m = 1\nfor i in range(a):\n a_c = a_c * (N-i) % p\n a_m = a_m * (i+1) % p\n m_a = a_c * pow(a_m, p-2, p) % p\nfor j in rnage(b):\n b_c = b_c * (N-j) % p\n b_m = b_m * (j+1) % p\n m_b = b_c * pow(b_m,p-2,p) % p\nprint((pow(2,N, p) - 1 - m_a - m_b) % p)\n', 'import math\nN, a, b = map(int,input().split())\np = 10 ** 9 +7\nA = math.factorial(a)\nB = math.factorial(b)\nn_c_a = 1\nn_c_b = 1\nfor i in range(a):\n n_c_a *= N-i\nfor j in rnage(b):\n n_c_b *= N-j\nm_a = (n_c_a*pow(A,p-2))% p\nm_b = (n_c_b*pow(B,p-2))% p\nprint((pow(2,N) - 1 - m_a - m_b) % p)\n', 'import math\nn, a, b = map(int,input().split())\nif n == 2:\n print(0)\nelse:\n total = 2 ** n -1\n total = total - math.factorial(n)//(math.factorial(a)*math.factorial(n-a)) -math.factorial(n) //(math.factorial(b) * math.factorial(n-b))\n print(total // (10 ** 9 + 7))', 'import math\nN, a, b = map(int,input().split())\np = 10 ** 9 +7\na_c = 1\nb_c = 1\na_m = 1\nb_m = 1\nfor i in range(a):\n a_c = a_c * (N-i) % p\n a_m = a_m * (i+1) % p\n m_a = a_c * pow(a_m, p-2, p) % p\nfor j in rnage(b):\n b_c = b_c * (N-j) % p\n b_m = b_m * (j+1) % p\n m_b = b_c * pow(b_m,p-2,p) % p\nprint((pow(2,N, p) - 1 - m_a - m_b) % p)\n', 'import math\nN, a, b = map(int,input().split())\np = pow(10,9) + 7\na_c = 1\nb_c = 1\na_m = 1\nb_m = 1\nfor i in range(a):\n a_c = a_c * (N-i) % p\n a_m = a_m * (i+1) % p\nm_a = a_c * pow(a_m, p-2, p) % p\nfor j in rnage(b):\n b_c = b_c * (N-j) % p\n b_m = b_m * (j+1) % p\nm_b = b_c * pow(b_m,p-2,p) % p\nprint((pow(2,N, p) - 1 - m_a - m_b) % p)\n', 'import math\nn, a, b = map(int,input().split())\nscore = 1\ntotal = 0\nif n % 2 == 1:\n for i in range(1,n//2+1):\n score = score * (n-i+1) // i\n if i != a and i != b and i != n-a and i != n-b:\n total += 2 * score\n else:\n total += score\nelse:\n for i in range(1,n//2):\n score = score * (n-i+1) // i\n if i != a and i != b and i != n-a and i != n-b:\n total += 2 * score\n else:\n total += score\n k = n//2 \n if k != a and k != b and k != n-a and K != n-b:\n total + score * (n-k+1) // k\nprint(total % (10**9 + 7))\n', 'import math\nn, a, b = map(int,input().split())\nscore = 1\ntotal = 0\nif n % 2 == 1:\n for i in range(1,n//2+1):\n score = score * (n-i+1) // i\n if i != a and i != b and i != n-a and i != n-b:\n total += 2 * score\n else:\n total += score\nelse:\n for i in range(1,n//2):\n score = score * (n-i+1) // i\n if i != a and i != b and i != n-a and i != n-b:\n total += 2 * score\n else:\n total += score\n k = n//2 \n if k != a and k != b and k != n-a and K != n-b:\n total += score * (n-k+1) // k\nprint(total % (10**9 + 7))\n', 'import math\nn, a, b = map(int,input().split())\nscore = 1\ntotal = 0\nfor i in range(1,a):\n score = score * (n-i+1) // i\n total += score\nscore = score * (n-a+1)//a\nfor j in range(a,b):\n score =score * (n-j+1) // j\n total += score\nscore =score * (n-b+1) // b\nfor k in range(b,n//2 +1):\n score = score * (n-k+1) // k\n total += score\n if n % 2 == 1:\n total += score * (n-n//2) // (n//2 + 1)\nprint(total % (10**9 + 7))\n', 'import math\nn, a, b = map(int,input().split())\nscore = 1\ntotal = 0\nif n % = 1:\n for i in range(1,n//2+1):\n score = score * (n-i+1) // i\n if i != a and i != b and i != n-a and i != n-b:\n total += 2 * score\n else:\n total += score\nelse:\n for i in range(1,n//2):\n score = score * (n-i+1) // i\n if i != a and i != b and i != n-a and i != n-b:\n total += 2 * score\n else:\n total += score\n k = n//2 \n if k != a and k != b and k != n-a and K != n-b:\n total + score * (n-k+1) // k\nprint(total % (10**9 + 7))\n', 'import math\nN, a, b = map(int,input().split())\np = 10 ** 9 +7\ndef fc(t,k):\n if t == 0:\n return 1\n elif t % 2 == 1:\n return (fc(t//2,k)) **2 * k\n else:\n return (fc(t//2,k)) ** 2\nA = math.factorial(a)\nB = math.factorial(b)\nn_c_a = 1\nn_c_b = 1\nfor i in range(a):\n n_c_a *= n-i\nfor j in rnage(b):\n n_c_b *= n-j\nm_a = fc(p-2,A) * n_c_a % p\nm_b = fc(p-2,B) * n_c_b % p\nprint((fc(N,2) - 1 - m_a - m_b)%2)', 'import math\nn, a, b = map(int,input().split())\nscore = 1\ntotal = 0\nfor i in range(1,n//2+1):\n score = score * (n-i+1) // i\n total += 2 * score\n if n % 2 == 1:\n total += score * (n-n//2) // (n//2 + 1)\n total = total - math.factorial(n)//(math.factorial(a)*math.factorial(n-a)) -math.factorial(n) //(math.factorial(b) * math.factorial(n-b))\nprint(total % (10**9 + 7))\n', 'import math\nN, a, b = map(int,input().split())\np = 10 ** 9 +7\ndef fc(t):\n if t == 0:\n return 1\n elif t % 2 == 1:\n return ((fc(t//2)) **2 )* 2\n else:\n return (fc(t//2)) ** 2\nA = math.factorial(a)\nB = math.factorial(b)\nn_c_a = 1\nn_c_b = 1\nfor i in range(a):\n n_c_a *= n-i\nfor j in rnage(b):\n n_c_b *= n-j\nm_a = (n_c_a // A)% p\nm_b = (n_c_b // A) % p\nprint((fc(N) - 1 - m_a - m_b) % p)\n', 'import math\nN, a, b = map(int,input().split())\np = 10 ** 9 +7\ndef fc(t):\n if t == 0:\n return 1\n elif t % 2 == 1:\n return ((fc(t//2)) **2 )* 2\n else:\n return (fc(t//2)) ** 2\nA = math.factorial(a)\nB = math.factorial(b)\nn_c_a = 1\nn_c_b = 1\nfor i in range(a):\n n_c_a *= n-i\nfor j in rnage(b):\n n_c_b *= n-j\nm_a = (n_c_a*pow(A,p-2))% p\nm_b = (n_c_b*pow(B,p-2))% p\nprint((pow(2,N) - 1 - m_a - m_b) % p)\n', 'import math\nn, a, b = map(int,input().split())\nscore = 1\ntotal = 0\nif n % 2 = 1:\n for i in range(1,n//2+1):\n score = score * (n-i+1) // i\n if i != a and i != b and i != n-a and i != n-b:\n total += 2 * score\n else:\n total += score\nelse:\n for i in range(1,n//2):\n score = score * (n-i+1) // i\n if i != a and i != b and i != n-a and i != n-b:\n total += 2 * score\n else:\n total += score\n k = n//2 \n if k != a and k != b and k != n-a and K != n-b:\n total + score * (n-k+1) // k\nprint(total % (10**9 + 7))\n', 'import math\nN, a, b = map(int,input().split())\np = 10 ** 9 +7\ndef fc(t,k):\n if t == 0:\n return 1\n elif t % 2 == 1:\n return (fc(t//2,k)) **2 * k\n else:\n return (fc(t//2,k)) ** 2\nA = math.factorial(a)\nB = math.factorial(b)\nn_c_a = 1\nn_c_b = 1\nfor i in range(a):\n n_c_a *= n-i\nfor j in rnage(b):\n n_c_b *= n-j\nm_a = n_c_a // A % p\nm_b = n_c_b // A % p\nprint((fc(N,2) - 1 - m_a - m_b) % p)\n', 'N, a, b = map(int,input().split())\np = pow(10,9) + 7\ndef comb(n,r):\n bunshi = 1\n for i in range(n-r+1, n+1):\n bunshi =bunshi * i % p\n bunbo = 1\n for i in range(1, r+1):\n bunbo = bunbo * i % p\n return bunshi * pow(bunbo, p-2, p)\nprint((pow(2,N, p) - 1 - comb(N,a) - comb(N,b)) % p)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s077993943', 's134795948', 's141214352', 's160558394', 's425867661', 's461009593', 's480989439', 's543449773', 's584349309', 's588555631', 's617900406', 's713729657', 's799251332', 's852382429', 's878974333', 's888323838', 's507325114'] | [2940.0, 5912.0, 5796.0, 199372.0, 3064.0, 3064.0, 3064.0, 3264.0, 3304.0, 2940.0, 5904.0, 9072.0, 5804.0, 5904.0, 2940.0, 5788.0, 3064.0] | [17.0, 2104.0, 2104.0, 2107.0, 838.0, 98.0, 17.0, 2104.0, 2104.0, 17.0, 1437.0, 2104.0, 1432.0, 1434.0, 17.0, 1434.0, 116.0] | [235, 381, 288, 267, 337, 336, 526, 531, 422, 523, 411, 374, 397, 411, 525, 400, 291] |
p02768 | u951480280 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['n,a,b=map(int,input().split())\n\n \ndef combination(n, r, mod=10**9+7):\n n1, r = n+1, min(r, n-r)\n numer = denom = 1\n for i in range(1, r+1):\n numer = (numer*(n1-i)) % mod\n denom = (denom*i) % mod\n return numer * pow(denom, mod-2, mod) % mod\n\nmod=10**9+7\n\nprint((pow(2,n,mod) - combination(n,a,mod) - combination(n,b,mod))%mod)', 'n,a,b=map(int,input().split())\n\n \ndef combination(n, r, mod=10**9+7):\n n1, r = n+1, min(r, n-r)\n numer = denom = 1\n for i in range(1, r+1):\n numer = (numer*(n1-i)) % mod\n denom = (denom*i) % mod\n return numer * pow(denom, mod-2, mod) % mod\n\nmod=10**9+7\n\nprint((pow(2,n,mod)- 1 - combination(n,a,mod) - combination(n,b,mod))%mod)'] | ['Wrong Answer', 'Accepted'] | ['s935614021', 's072571812'] | [3064.0, 3064.0] | [130.0, 131.0] | [351, 354] |
p02768 | u959340534 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['n, a, b = map(int, input().split())\n\nfrom operator import mul\nfrom functools import reduce\nimport math\n\nflg = (a == n-b)\nrep = math.ceil(n/2)\nMOD = 10**9+7\nmemo = 0\n\ndef modpow(a: int, p: int, mod: int) -> int:\n \n if p == 0:\n return 1\n if p % 2 == 0:\n half = modpow(a, p//2, mod)\n return half*half % mod\n else:\n return a * modpow(a, p-1, mod) % mod\n\n\nfrom operator import mul\nfrom functools import reduce\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mod_mul, range(n, n - r, -1), 1)\n denom = reduce(mod_mul, range(1, r + 1), 1)\n return numer*pow(denom, MOD-2, MOD)%MOD\n \ndef mod_mul(a, b):\n return mul(a%MOD, b%MOD)%MOD\n\ns = 0\nans = modpow(2, n, MOD)\nif flg:\n ans = ans - combinations_count(n, a)\nelse:\n ans = (ans - combinations_count(n,a))%MOD - combinations_count(n,b)\nprint(ans%MOD)', 'n, a, b = map(int, input().split())\n\nfrom operator import mul\nfrom functools import reduce\nimport math\n\nflg = (a == n-b)\nrep = math.ceil(n/2)\nMOD = 10**9+7\nmemo = 0\n\ndef modpow(a: int, p: int, mod: int) -> int:\n \n if p == 0:\n return 1\n if p % 2 == 0:\n half = modpow(a, p//2, mod)\n return half*half % mod\n else:\n return a * modpow(a, p-1, mod) % mod\n\n\nfrom operator import mul\nfrom functools import reduce\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mod_mul, range(n, n - r, -1), 1)\n denom = reduce(mod_mul, range(1, r + 1), 1)\n return numer*pow(denom, MOD-2, MOD)%MOD\n \ndef mod_mul(a, b):\n return mul(a%MOD, b%MOD)%MOD\n\ns = 0\nans = modpow(2, n, MOD)-1\nif flg:\n ans = ans - combinations_count(n, a)\nelse:\n ans = (ans - combinations_count(n,a))%MOD - combinations_count(n,b)\nprint(ans%MOD)', 'n, a, b = map(int, input().split())\n\nfrom operator import mul\nfrom functools import reduce\nimport math\n\nflg = (a == n-b)\nrep = math.ceil(n/2)\nMOD = 10**9+7\nmemo = 0\n\ndef modpow(a: int, p: int, mod: int) -> int:\n \n if p == 0:\n return 1\n if p % 2 == 0:\n half = modpow(a, p//2, mod)\n return half*half % mod\n else:\n return a * modpow(a, p-1, mod) % mod\n\n\nfrom operator import mul\nfrom functools import reduce\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mod_mul, range(n, n - r, -1), 1)\n denom = reduce(mod_mul, range(1, r + 1), 1)\n return numer*pow(denom, MOD-2, MOD)%MOD\n \ndef mod_mul(a, b):\n return mul(a%MOD, b%MOD)%MOD\n\ns = 0\nans = modpow(2, n, MOD)+1\nif flg:\n ans = ans - combinations_count(n, a)\nelse:\n ans = (ans - combinations_count(n,a))%MOD - combinations_count(n,b)\nprint(ans%MOD)', 'n, a, b = map(int, input().split())\n\nfrom operator import mul\nfrom functools import reduce\nimport math\n\nflg = (a == n-b)\nrep = math.ceil(n/2)\nMOD = 10**9+7\nmemo = 0\n\ndef modpow(a: int, p: int, mod: int) -> int:\n \n if p == 0:\n return 1\n if p % 2 == 0:\n half = modpow(a, p//2, mod)\n return half*half % mod\n else:\n return a * modpow(a, p-1, mod) % mod\n\n\nfrom operator import mul\nfrom functools import reduce\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mod_mul, range(n, n - r, -1), 1)\n denom = reduce(mod_mul, range(1, r + 1), 1)\n return numer*pow(denom, MOD-2, MOD)%MOD\n \ndef mod_mul(a, b):\n return mul(a%MOD, b%MOD)%MOD\n\ns = 0\nans = modpow(2, n, MOD)-1\nif flg:\n ans = ans - 2*combinations_count(n, a)%MOD\nelse:\n ans = (ans - combinations_count(n,a))%MOD - combinations_count(n,b)\nprint(ans%MOD)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s236508102', 's386214145', 's830811455', 's816698823'] | [3688.0, 3572.0, 3688.0, 3572.0] | [254.0, 251.0, 252.0, 254.0] | [895, 897, 897, 903] |
p02768 | u970197315 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['# ABC 156 D\nsi = lambda: input()\nni = lambda: int(input())\nnm = lambda: map(int, input().split())\nnms = lambda: map(str, input().split())\nnl = lambda: list(map(int, input().split()))\n\n# a = 1\n\n# a *= i\n# a %= mod\n# return a\n\n\n# return 0\n# fact_n = factorial_mod(n, mod)\n# fact_k = factorial_mod(k, mod)\n# fact_n_k = factorial_mod(n - k, mod)\n\ndef cmb(n, r):\n if n - r < r: r = n - r\n if r == 0: return 1\n if r == 1: return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n\n for p in range(2,r+1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n for k in range(p-1,r,p):\n numerator[k - offset] /= pivot\n denominator[k] /= pivot\n\n result = 1\n for k in range(r):\n if numerator[k] > 1:\n result *= int(numerator[k])\n\n return result\ndef spow(x, n,mod):\n ans = 1\n while(n > 0):\n if(bin(n & 1) == bin(1)):\n ans = ans*x%mod\n x = x*x%mod\n n = n >> 1 \n return ans\nn,a,b=nm()\nMOD = 10**9 + 7\ncn=spow(2,n,MOD)\nca=cmb(n,a)\ncb=cmb(n,b)', 'def combmod(n,k,mod):\n a = 1\n b = 1\n for i in range(k):\n a = a * (n-i) % mod\n b = b * (i+1) % mod\n return a * pow(b, mod-2, mod) % mod\nn,a,b=map(int,input().split())\nmod=10**9+7\ncn=pow(2,n,mod)-1\nca=combmod(n,a,mod)\ncb=combmod(n,b,mod)\nprint((cn-ca-cb)%mod)\n\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s863124833', 's694809941'] | [28080.0, 3064.0] | [2106.0, 143.0] | [1389, 287] |
p02768 | u975039852 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['n, a, b = map(int, input().split())\nmod = 10**9+7\ndef inv(x):\n return pow(x, mod-2, mod)\ndef fact(x):\n f = 1\n for i in range(1, x + 1):\n f *= i\n f %= mod\n return f\ndef comb(n, r):\n return (fact(n) * inv(fact(n-r)) * inv(fact(r))) % mod\nprint((pow(2, n) - comb(n, a) - comb(n, b)) % mod)', 'n, a, b = map(int, input().split())\nmod = 10 ** 9 + 7\n\ndef comb(n, x):\n numerator = 1\n for i in range(n - x + 1, n + 1):\n numerator = numerator * i % mod\n denominator = 1\n for j in range(1, x + 1):\n denominator = denominator * j % mod\n d = pow(denominator, mod - 2, mod)\n return numerator * d\nprint((pow(2, n, mod) - comb(n, a) - comb(n, b) - 1) % mod)\n'] | ['Wrong Answer', 'Accepted'] | ['s101069110', 's221790715'] | [199372.0, 3064.0] | [2108.0, 117.0] | [297, 385] |
p02768 | u981332890 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['from operator import mul\nfrom functools import reduce\n\ndef cmb(n,r):\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\n\ndef main():\n mod = (10 ** 9) + 7\n n, a, b = map(int, input().split())\n\n ans = 0\n\n if n % 2 == 0:\n for i in range(0, (n//2)):\n tmp = cmb(n, i)\n if (a != i) and (b != i):\n ans += (tmp % mod)\n if (a != (n - i)) and (b != (n - i)):\n ans += (tmp % mod)\n ans -= 1\n if (a != (n//2)) and (b != (n//2)):\n ans += cmb(n, n//2)\n else:\n for i in range(0, (n//2)+1):\n tmp = cmb(n, i)\n if (a != i) and (b != i):\n ans += (tmp % mod)\n if (a != (n - i)) and (b != (n - i)):\n ans += (tmp % mod)\n ans -= 1\n\n print(ans)\n return 0', "import math\ndef main():\n m = (10 ** 9) + 7\n n, a, b = map(int, input().split())\n\n a_k = math.factorial(a)\n b_k = math.factorial(b)\n\n \n a_k = pow(a_k, m - 2, m)\n b_k = pow(b_k, m - 2, m)\n\n n_a = 1\n for i in range(n-a+1, n+1):\n n_a = (n_a * i) % m\n\n n_b = 1\n for i in range(n-b+1, n+1):\n n_b = (n_b * i) % m\n\n n_C_a = a_k * n_a\n n_C_b = b_k * n_b\n\n n_C_a = n_C_a % m\n n_C_b = n_C_b % m\n\n p = pow(2, n, m)\n\n print((p - n_C_a - n_C_b - 1)%m)\n return 0\n\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s091286764', 's328127442'] | [3572.0, 5804.0] | [24.0, 1485.0] | [923, 584] |
p02768 | u981931040 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['def modinv(a, m):\n b = m\n u = 1\n v = 0\n while b:\n t = a // b\n a -= t * b\n a, b = b, a\n u -= t * v\n u, v = v, u\n u %= m\n if u < 0:\n u += m\n return u\n\ndef nCk(N, k, mod):\n ret_val = 1\n for i in range(k):\n ret_val *= (N - i)\n ret_val %= mod\n ret_val *= modinv(i + 1, mod)\n ret_val %= mod\n return ret_val\n\n\nn, a, b = map(int, input().split())\nMOD = 10 ** 9 + 7\nall_cnt = pow(2, n, MOD) - 1\na_cnt = nCk(n, a, MOD)\nb_cnt = nCk(n, b, MOD)\nans = all_cnt - a_cnt - b_cnt\nprint(ans\u3000% MOD)\n', 'def modinv(a, m):\n b = m\n u = 1\n v = 0\n while b:\n t = a // b\n a -= t * b\n a, b = b, a\n u -= t * v\n u, v = v, u\n u %= m\n if u < 0:\n u += m\n return u\n\ndef nCk(N, k, mod):\n ret_val = 1\n for i in range(k):\n ret_val *= (N - i)\n ret_val %= mod\n ret_val *= modinv(i + 1, mod)\n ret_val %= mod\n return ret_val\n\n\nn, a, b = map(int, input().split())\nMOD = 10 ** 9 + 7\nall_cnt = pow(2, n, MOD) - 1\na_cnt = nCk(n, a, MOD)\nb_cnt = nCk(n, b, MOD)\nans = all_cnt - a_cnt - b_cnt\nprint(ans % MOD)'] | ['Runtime Error', 'Accepted'] | ['s472146978', 's510217231'] | [8900.0, 9140.0] | [29.0, 804.0] | [581, 578] |
p02768 | u983109611 | 2,000 | 1,048,576 | Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet. | ['N, a, b = map(int, input().split())\n \ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n \nmod = 10**9+7 \nX = 10**9\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n \nfor i in range( 2, X + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n \nax = cmb(N, a, mod)\nbx = cmb(N, b, mod)\n \nprint((pow(2, N) - ax - bx - 1)%mod)', 'N, a, b = map(int, input().split())\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nX = 2 * 10**5\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, X + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nax = cmb(N, a, mod)\nbx = cmb(N, b, mod)\n\nprint((pow(2, N) - ax - bx - 1)%(10**9 + 7))', 'N, a, b = map(int, input().split())\n\nsum = pow(2, N)\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nX = 2 * 10**5\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, X + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nax = cmb(N, a, mod)\nbx = cmb(N, b, mod)\n\nprint((sum - ax - bx - 1)%(10**9+7))', 'N, a, b = map(int, input().split())\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nX = 2 * (10**5)\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, X + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nax = cmb(N, a, mod)\nbx = cmb(N, b, mod)\n\nprint((pow(2, N) - ax - bx - 1)%(10**9 + 7))', 'N, a, b = map(int, input().split())\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nX = 2 * (10**5)\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, X + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nax = cmb(N, a, mod)\nbx = cmb(N, b, mod)\n\nprint(pow(2, N)%mod - ax - bx - 1)', 'N, a, b = map(int, input().split())\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n \nmod = 10**9+7 \nX = 2 * 10**5\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n \nfor i in range( 2, X + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n \nax = cmb(N, a, mod)\nbx = cmb(N, b, mod)\n \nprint((pow(2, N) - ax - bx - 1))', 'N, a, b = map(int, input().split())\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nX = 2 * (10**5)\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, X + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nax = cmb(N, a, mod)\nbx = cmb(N, b, mod)\n\nprint((pow(2, N) - ax - bx - 1)%mod)', 'N, a, b = map(int, input().split())\n\nsum = pow(2, N)\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \n#N = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nax = cmb(N, a, mod)\nbx = cmb(N, b, mod)\n\nprint((sum - ax - bx - 1)%(10**9+7))', 'N, a, b = map(int, input().split())\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nX = 2 * (10**5)\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, X + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nax = cmb(N, a, mod)\nbx = cmb(N, b, mod)\n\nprint((pow(2, N) - ax - bx - 1)%(10**9 + 7))', 'N, a, b = map(int, input().split())\n\nsum = pow(2, N)\n\ndef cmb(n, r, p):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n-r] % p\n\np = 10 ** 9 + 7\nX = 2 * 10 ** 5 \nfact = [1, 1] # fact[n] = (n! mod p)\nfactinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)\ninv = [0, 1] \n \nfor i in range(2, X + 1):\n fact.append((fact[-1] * i) % p)\n inv.append((-inv[p % i] * (p // i)) % p)\n factinv.append((factinv[-1] * inv[-1]) % p)\n\nax = cmb(N, a, mod)\nbx = cmb(N, b, mod)\n\nprint((sum - ax - bx - 1)%(10**9+7))', 'N, a, b = map(int, input().split())\n\nMOD = 10**9+7\n\ndef modcmb(n, r, m):\n x = 1\n y = n\n for i in range(2,r+1):\n x *= i\n x %= MOD\n y *= n-i+1\n y %= MOD\n return y * pow(x, m-2, m) % m\n\nans = pow(2, N, MOD) - modcmb(N, a, MOD) - modcmb(N, b, MOD) - 1\nprint(ans % MOD)'] | ['Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s065798532', 's360659395', 's379334116', 's438656903', 's622026178', 's667607699', 's701528548', 's715182878', 's742235775', 's876041013', 's439065171'] | [216900.0, 27092.0, 199380.0, 27092.0, 27092.0, 27152.0, 27092.0, 199380.0, 27092.0, 199328.0, 3064.0] | [2118.0, 260.0, 2106.0, 267.0, 266.0, 283.0, 262.0, 2112.0, 277.0, 2106.0, 159.0] | [577, 584, 593, 586, 576, 576, 578, 590, 586, 616, 304] |
p02769 | u021548497 | 2,000 | 1,048,576 | There is a building with n rooms, numbered 1 to n. We can move from any room to any other room in the building. Let us call the following event a **move** : a person in some room i goes to another room j~ (i \neq j). Initially, there was one person in each room in the building. After that, we know that there were exactly k moves happened up to now. We are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible? Find the count modulo (10^9 + 7). | ['n, k = map(int, input().split())\nmod = 10**9+7\n\nk = min([k, n-1])\n\n\nans = 0\nkey = 1\n\nfor i in range(k):\n ans += key\n ans %= mod\n key = (((key*(n-i)%mod)*(n-i-1)%mod)*pow(pow(i+1, mod-2, mod), 2, mod))%mod\nprint(ans)', 'n, k = map(int, input().split())\nmod = 10**9+7\n\nk = min([k, n-1])\n\n\nans = 0\nkey = 1\n\nfor i in range(k+1):\n ans += key\n ans %= mod\n key = (((key*(n-i)%mod)*(n-i-1)%mod)*pow(pow(i+1, mod-2, mod), 2, mod))%mod\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s898951135', 's072407676'] | [3064.0, 3064.0] | [1028.0, 1033.0] | [224, 226] |
p02769 | u162612857 | 2,000 | 1,048,576 | There is a building with n rooms, numbered 1 to n. We can move from any room to any other room in the building. Let us call the following event a **move** : a person in some room i goes to another room j~ (i \neq j). Initially, there was one person in each room in the building. After that, we know that there were exactly k moves happened up to now. We are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible? Find the count modulo (10^9 + 7). | ['n, k = list(map(int, input().split()))\n\nmod = 10**9 + 7\n\n\ndef modinv(x):\n return pow(x, mod-2)\n\n\n\n\n\nmax_len = 2 * n - 1 \n\nfactori_table = [1] * (max_len + 1)\nfactori_inv_table = [1] * (max_len + 1)\nfor i in range(1, max_len + 1):\n factori_table[i] = factori_table[i-1] * (i) % mod\n factori_inv_table[i] = modinv(factori_table[i])\n\ndef binomial_coefficients(n, k):\n # n! / (k! * (n-k)! )\n if k <= 0 or k >= n:\n return 1\n return (factori_table[n] * factori_inv_table[k] * factori_inv_table[n-k]) % mod\n\nif k >= n-1:\n # nHn = 2n-1 C n\n print(binomial_coefficients(2 * n - 1, n))\nelse:\n \n \n \n ans = 0\n for j in range(k+1):\n if j == 0:\n ans += 1\n else:\n ans += binomial_coefficients(n, j) * binomial_coefficients(n-1, j) \n ans %= mod\n print(ans)\n', "n, k = list(map(int, input().split()))\n\nmax_len = 2 * n - 1 \nmod = 10**9 + 7\n\n\ndef modinv(x):\n \n return pow(x, mod-2, mod)\n\n\n\n\n\nmodinv_table = [-1] * (max_len + 1)\nmodinv_table[0] = None \nfactori_table = [1] * (max_len + 1)\nfactori_inv_table = [1] * (max_len + 1)\nfor i in range(1, max_len + 1):\n factori_table[i] = factori_table[i-1] * (i) % mod\n\nmodinv_table[1] = 1\n\nfor i in range(2, max_len + 1):\n modinv_table[i] = (-modinv_table[mod % i] * (mod // i)) % mod\n factori_inv_table[i] = factori_inv_table[i-1] * modinv_table[i] % mod\n\n\ndef binomial_coefficients(n, k):\n \n if not 0 <= k <= n:\n return None\n return (factori_table[n] * factori_inv_table[k] * factori_inv_table[n-k]) % mod\n\n\ndef binomial_coefficients2(n, k):\n '''\n (n * (n-1) * ... * (n-k+1)) / (1 * 2 * ... * k)\n '''\n ans = 1\n for i in range(k):\n ans *= n-i\n ans *= modinv_table[i + 1]\n ans %= mod\n return ans\n\n\n\nif k >= n-1:\n # nHn = 2n-1 C n\n print(binomial_coefficients(2 * n - 1, n))\nelse:\n \n \n \n ans = 0\n for j in range(k+1):\n if j == 0:\n ans += 1\n else:\n ans += binomial_coefficients(n, j) * binomial_coefficients(n-1, j) \n ans %= mod\n print(ans)\n"] | ['Time Limit Exceeded', 'Accepted'] | ['s997558940', 's407037293'] | [172092.0, 50536.0] | [2111.0, 740.0] | [1423, 2279] |
p02769 | u461454424 | 2,000 | 1,048,576 | There is a building with n rooms, numbered 1 to n. We can move from any room to any other room in the building. Let us call the following event a **move** : a person in some room i goes to another room j~ (i \neq j). Initially, there was one person in each room in the building. After that, we know that there were exactly k moves happened up to now. We are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible? Find the count modulo (10^9 + 7). | ['#input\nn, k = map(int, input().split())\n\n#output\nmod = pow(10, 9) + 7\n\ndef cmb(n, r):\n res = 1\n fac = 1\n for i in range(r):\n res *= (n-i)\n res %= mod\n fac *= (i+1)\n fac %= mod\n return res*pow(fac, mod-2, mod) % mod\n\nif n <= k-1:\n print(cmb(2*n-1, n))\nelse:\n answer = 0\n for m in range(k+1):\n answer += cmb(n, m)*cmb(n-1, a) % mod\n\nprint(answer % mod)', '#input\nn, k = map(int, input().split())\n\n#output\nmod = pow(10, 9) + 7\n\ndef cmb(n, r):\n res = 1\n fac = 1\n for i in range(r):\n res *= (n-i)\n res %= mod\n fac *= (i+1)\n fac %= mod\n return res*pow(fac, mod-2, mod) % mod\n\nif n <= k-1:\n print(cmb(2*n-1, m))\nelse:\n answer = 0\n for m in range(k+1):\n answer += cmb(n, m)*cmb(n-1, a) % mod\n\nprint(answer % mod)', '#input\nn, k = map(int, input().split())\n\n#output\nmod = pow(10, 9) + 7\n\nn_ = 4*10**5 + 5\nfun = [1]*(n_+1)\nfor i in range(1,n_+1):\n fun[i] = fun[i-1]*i%mod\nrev = [1]*(n_+1)\nrev[n_] = pow(fun[n_],mod-2,mod)\nfor i in range(n_-1,0,-1):\n rev[i] = rev[i+1]*(i+1)%mod\ndef cmb(n,r):\n if n <= 0 or r < 0 or r > n: return 0\n return fun[n]*rev[r]%mod*rev[n-r]%mod\n\nif n <= k-1:\n print(cmb(2*n-1, n))\nelse:\n answer = 0\n for m in range(k+1):\n answer += cmb(n, m)*cmb(n-1, m) % mod\n answer %= mod\n print(answer)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s220899185', 's417488342', 's630970418'] | [3064.0, 3064.0, 34676.0] | [88.0, 17.0, 610.0] | [406, 406, 534] |
p02769 | u482789362 | 2,000 | 1,048,576 | There is a building with n rooms, numbered 1 to n. We can move from any room to any other room in the building. Let us call the following event a **move** : a person in some room i goes to another room j~ (i \neq j). Initially, there was one person in each room in the building. After that, we know that there were exactly k moves happened up to now. We are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible? Find the count modulo (10^9 + 7). | ["from functools import lru_cache\n\n\nCHECK = False\n\nN, K = list(map(int, input().split()))\n\nMOD = 10 ** 9 + 7\n\n\n@lru_cache(maxsize=None)\ndef modInverse(a, p):\n # Fermat's little theorem, a**(p-1) = 1 mod p\n return pow(a, p - 2, p)\n\n\nif CHECK:\n fact = [1]\n for i in range(1, 2 * N + 1):\n fact.append((fact[-1] * i) % MOD)\n\n def nCr(n, r, p=MOD):\n \n return (fact[n] * modInverse(fact[r], p) * modInverse(fact[n - r], p)) % p\n\n\nif N - 1 <= K:\n # Any combo is achievable so this is stars and bars\n # N people into N rooms, which means N - 1 dividers\n stars = N\n bars = N - 1\n print(nCr(stars + bars, bars))\nelse:\n # Group by number of empty rooms\n # With K moves there can only be at most K empty rooms\n # Max of N - 1 empty rooms in general\n assert K + 1 < N\n tot = 0\n comb1 = 1\n comb2 = 1\n for numEmpty in range(K + 1):\n way3 = comb1 * comb2\n if CHECK:\n numNonEmpty = N - numEmpty\n stars = numEmpty # Everyone moving into an occupied room\n bars = numNonEmpty - 1 # Number of dividers\n way1 = nCr(stars + bars, bars) * nCr(N, numEmpty)\n\n way2 = nCr(N, numEmpty) * nCr(N - 1, numEmpty)\n\n assert way1 % MOD == way2 % MOD == way3 % MOD\n tot += way3\n\n j = numEmpty + 1\n invJ = modInverse(j, MOD)\n comb1 = (N + 1 - j) * comb1 * invJ % MOD\n comb2 = (N - j) * comb2 * invJ % MOD\n print(tot % MOD)\n", "from functools import lru_cache\n\n\nCHECK = False\n\nN, K = list(map(int, input().split()))\n\nMOD = 10 ** 9 + 7\n\n\n@lru_cache(maxsize=None)\ndef modInverse(a, p):\n # Fermat's little theorem, a**(p-1) = 1 mod p\n return pow(a, p - 2, p)\n\n\nif N - 1 <= K or CHECK:\n fact = [1]\n for i in range(1, 2 * N + 1):\n fact.append((fact[-1] * i) % MOD)\n\n def nCr(n, r, p=MOD):\n \n return (fact[n] * modInverse(fact[r], p) * modInverse(fact[n - r], p)) % p\n\n\nif N - 1 <= K:\n # Any combo is achievable so this is stars and bars\n # N people into N rooms, which means N - 1 dividers\n stars = N\n bars = N - 1\n print(nCr(stars + bars, bars))\nelse:\n # Group by number of empty rooms\n # With K moves there can only be at most K empty rooms\n # Max of N - 1 empty rooms in general\n assert K + 1 < N\n tot = 0\n comb1 = 1\n comb2 = 1\n for numEmpty in range(K + 1):\n way3 = comb1 * comb2\n if CHECK:\n numNonEmpty = N - numEmpty\n stars = numEmpty # Everyone moving into an occupied room\n bars = numNonEmpty - 1 # Number of dividers\n way1 = nCr(stars + bars, bars) * nCr(N, numEmpty)\n\n way2 = nCr(N, numEmpty) * nCr(N - 1, numEmpty)\n\n assert way1 % MOD == way2 % MOD == way3 % MOD\n tot += way3\n\n j = numEmpty + 1\n invJ = modInverse(j, MOD)\n comb1 = (N + 1 - j) * comb1 * invJ % MOD\n comb2 = (N - j) * comb2 * invJ % MOD\n print(tot % MOD)\n"] | ['Runtime Error', 'Accepted'] | ['s497531236', 's995453914'] | [60580.0, 60580.0] | [1664.0, 1699.0] | [1509, 1523] |
p02769 | u497046426 | 2,000 | 1,048,576 | There is a building with n rooms, numbered 1 to n. We can move from any room to any other room in the building. Let us call the following event a **move** : a person in some room i goes to another room j~ (i \neq j). Initially, there was one person in each room in the building. After that, we know that there were exactly k moves happened up to now. We are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible? Find the count modulo (10^9 + 7). | ["class Combinatorics:\n def __init__(self, N, mod):\n '''\n Preprocess for calculating binomial coefficients nCr (0 <= r <= n, 0 <= n <= N)\n over the finite field Z/(mod)Z.\n Input:\n N (int): maximum n\n mod (int): a prime number. The order of the field Z/(mod)Z over which nCr is calculated.\n '''\n self.mod = mod\n self.fact = {i: None for i in range(N+1)} # n!\n self.inverse = {i: None for i in range(1, N+1)} # inverse of n in the field Z/(MOD)Z\n self.fact_inverse = {i: None for i in range(N+1)} # inverse of n! in the field Z/(MOD)Z\n \n # preprocess\n self.fact[0] = self.fact[1] = 1\n self.fact_inverse[0] = self.fact_inverse[1] = 1\n self.inverse[1] = 1\n for i in range(2, N+1):\n self.fact[i] = i * self.fact[i-1] % self.mod\n q, r = divmod(self.mod, i)\n self.inverse[i] = (- (q % self.mod) * self.inverse[r]) % self.mod\n self.fact_inverse[i] = self.inverse[i] * self.fact_inverse[i-1] % self.mod\n \n def perm(self, n, r):\n '''\n Calculate nPr = n! / (n-r)! % mod\n '''\n if n < r or n < 0 or r < 0:\n return 0\n else:\n return (self.fact[n] * self.fact_inverse[n-r]) % self.mod\n \n def binom(self, n, r):\n '''\n Calculate nCr = n! /(r! (n-r)!) % mod\n '''\n if n < r or n < 0 or r < 0:\n return 0\n else:\n return self.fact[n] * (self.fact_inverse[r] * self.fact_inverse[n-r] % self.mod) % self.mod\n \n def hom(self, n, r):\n '''\n Calculate nHr = {n+r-1}Cr % mod.\n Assign r objects to one of n classes.\n Arrangement of r circles and n-1 partitions:\n o o o | o o | | | o | | | o o | | o\n '''\n if n == 0 and r > 0:\n return 0\n if n >= 0 and r == 0:\n return 1\n return self.binom(n + r - 1, r)\n \nMOD = 10**9 + 7\nN, K = map(int, input().split())\ncom = Combinatorics(N, MOD)\nans = 0\nfor i in range(max(0, N - K), N+1):\n ans += (com.binom(N, i) * com.hom(N-i, i)) % MOD\n ans %= MOD\nprint(ans)", "class Combinatorics:\n def __init__(self, N, mod):\n '''\n Preprocess for calculating binomial coefficients nCr (0 <= r <= n, 0 <= n <= N)\n over the finite field Z/(mod)Z.\n Input:\n N (int): maximum n\n mod (int): a prime number. The order of the field Z/(mod)Z over which nCr is calculated.\n '''\n self.mod = mod\n self.fact = {i: None for i in range(N+1)} # n!\n self.inverse = {i: None for i in range(1, N+1)} # inverse of n in the field Z/(MOD)Z\n self.fact_inverse = {i: None for i in range(N+1)} # inverse of n! in the field Z/(MOD)Z\n \n # preprocess\n self.fact[0] = self.fact[1] = 1\n self.fact_inverse[0] = self.fact_inverse[1] = 1\n self.inverse[1] = 1\n for i in range(2, N+1):\n self.fact[i] = i * self.fact[i-1] % self.mod\n q, r = divmod(self.mod, i)\n self.inverse[i] = (- (q % self.mod) * self.inverse[r]) % self.mod\n self.fact_inverse[i] = self.inverse[i] * self.fact_inverse[i-1] % self.mod\n \n def perm(self, n, r):\n '''\n Calculate nPr = n! / (n-r)! % mod\n '''\n if n < r or n < 0 or r < 0:\n return 0\n else:\n return (self.fact[n] * self.fact_inverse[n-r]) % self.mod\n \n def binom(self, n, r):\n '''\n Calculate nCr = n! /(r! (n-r)!) % mod\n '''\n if n < r or n < 0 or r < 0:\n return 0\n else:\n return self.fact[n] * (self.fact_inverse[r] * self.fact_inverse[n-r] % self.mod) % self.mod\n \n def hom(self, n, r):\n '''\n Calculate nHr = {n+r-1}Cr % mod.\n Assign r objects to one of n classes.\n Arrangement of r circles and n-1 partitions:\n o o o | o o | | | o | | | o o | | o\n '''\n if n == 0 and r > 0:\n return 0\n if n >= 0 and r == 0:\n return 1\n return self.binom(n + r - 1, r)\n \nMOD = 10**9 + 7\nN, K = map(int, input().split())\ncom = Combinatorics(N, MOD)\nans = 0\nfor i in range(min(K, N-1) + 1):\n ans += (com.binom(N, i) * com.hom(N-i, i)) % MOD\n ans %= MOD\nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s950537447', 's397806325'] | [78060.0, 78060.0] | [872.0, 871.0] | [2182, 2179] |
p02769 | u511379665 | 2,000 | 1,048,576 | There is a building with n rooms, numbered 1 to n. We can move from any room to any other room in the building. Let us call the following event a **move** : a person in some room i goes to another room j~ (i \neq j). Initially, there was one person in each room in the building. After that, we know that there were exactly k moves happened up to now. We are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible? Find the count modulo (10^9 + 7). | ['n,k=map(int,input().split())\nMOD=10**9+7\nans=1\n\n#Combination 1 O()\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = MOD \nN = 10**6\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nif k>=n:\n k=n-1\n\nfor i in range(1,k+1):\n ans+=(cmb(n,i,MOD)*cmb(n-1,i,MOD))%MOD\n\nprint(ans&MOD)', 'n,k=map(int,input().split())\nMOD=10**9+7\nans=1\n#Combination 1 O()\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = MOD \nN = 10**6\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nif n-1<=k:\n print(cmb(2*n-1,n,MOD)%MOD)\n\nelse:\n for i in range(1,k+1):\n ans+=(cmb(n,i,MOD)*cmb(n-1,i,MOD))\n ans%=MOD\n print(ans&MOD)', 'n,k=map(int,input().split())\nMOD=10**9+7\nans=1\n#Combination 1 O()\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = MOD \nN = 10**6\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\n\nif n-1<=k:\n print(cmb(2*n-1,n,MOD)%MOD)\n\nelse:\n for i in range(1,k+1):\n ans+=(cmb(n,i,MOD)*cmb(n-1,i,MOD))\n print(ans&MOD)', 'n,k=map(int,input().split())\nmod=10**9+7\nans=1\n#Combination 1 O()\nclass Combination:\n \n def __init__(self, n_max, mod=10**9+7):\n self.mod = mod\n self.modinv = self.make_modinv_list(n_max)\n self.fac, self.facinv = self.make_factorial_list(n_max)\n\n def __call__(self, n, r):\n return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n-r] % self.mod\n\n def make_factorial_list(self, n):\n \n \n fac = [1]\n facinv = [1]\n for i in range(1, n+1):\n fac.append(fac[i-1] * i % self.mod)\n facinv.append(facinv[i-1] * self.modinv[i] % self.mod)\n return fac, facinv\n\n def make_modinv_list(self, n):\n \n modinv = [0] * (n+1)\n modinv[1] = 1\n for i in range(2, n+1):\n modinv[i] = self.mod - self.mod//i * modinv[self.mod%i] % self.mod\n return modinv\n\ncomb=Combination(10**6)\n\nif n-1<=k:\n print(comb(2*n-1,n)%mod)\n\nelse:\n for i in range(1,k+1):\n ans+=(comb(n,i)*comb(n-1,i))\n ans%=mod\n print(ans%mod)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s402886996', 's408154822', 's586705747', 's356212969'] | [122040.0, 123888.0, 122016.0, 121852.0] | [1749.0, 1625.0, 1601.0, 1509.0] | [622, 675, 658, 1505] |
p02769 | u606045429 | 2,000 | 1,048,576 | There is a building with n rooms, numbered 1 to n. We can move from any room to any other room in the building. Let us call the following event a **move** : a person in some room i goes to another room j~ (i \neq j). Initially, there was one person in each room in the building. After that, we know that there were exactly k moves happened up to now. We are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible? Find the count modulo (10^9 + 7). | ['Point = complex\n\n\nN, *XY = map(int, open(0).read().split())\n\nP = [Point(x, y) for x, y in zip(*[iter(XY)] * 2)]\n\ndef max_distance(center):\n return max(abs(center - p) for p in P)\n\ndef ternary_search(f, left, right, MAX_ITER=100):\n for _ in range(MAX_ITER):\n m1 = (left * 2 + right) / 3\n m2 = (left + right * 2) / 3\n if f(m1) < f(m2):\n right = m2\n else:\n left = m1\n return f(left)\n\ndef g(x):\n return ternary_search(lambda y: max_distance(Point(x, y)), -1000, 1000)\n\nprint(ternary_search(g, -1000, 1000))', 'mod = 10 ** 9 + 7\n\nclass ModComb:\n def __init__(self, MAX, mod=10 ** 9 + 7):\n fac = [1, 1]\n finv = [1, 1]\n inv = [0, 1]\n for i in range(2, MAX):\n fac.append(fac[i - 1] * i % mod)\n inv.append(mod - inv[mod % i] * (mod // i) % mod)\n finv.append(finv[i - 1] * inv[i] % mod)\n self.fac, self.finv, self.mod = fac, finv, mod\n\n def nCk(self, n, k):\n if n < k or n < 0 or k < 0:\n return 0\n fac, finv, mod = self.fac, self.finv, self.mod\n return fac[n] * (finv[k] * finv[n - k] % mod) % mod\n\n\nN, K = map(int, input().split())\n\nmc = ModComb(2 * N)\n\nans = mc.nCk(2 * N - 1, N - 1)\nif K + 1 < N:\n ans += sum((mod - mc.nCk(N, i)) * mc.nCk(N - 1, i) % mod for i in range(K + 1, N)) % mod\n\nprint(ans % mod)'] | ['Runtime Error', 'Accepted'] | ['s300697479', 's432433867'] | [3064.0, 50776.0] | [18.0, 704.0] | [564, 800] |
p02769 | u699008198 | 2,000 | 1,048,576 | There is a building with n rooms, numbered 1 to n. We can move from any room to any other room in the building. Let us call the following event a **move** : a person in some room i goes to another room j~ (i \neq j). Initially, there was one person in each room in the building. After that, we know that there were exactly k moves happened up to now. We are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible? Find the count modulo (10^9 + 7). | ['n, k = map( int, input().split() )\nmod = 10 ** 9 + 7\n\nnumer = [ 1 ] * ( n + 1 )\ndemon = [ 1 ] * ( n + 1 )\n\nfor i in range( 1, n + 1 ):\n numer[ i + 1 ] = ( numer[ i ] * i ) % mod\n\ndemon[ n ] = pow( numer[ n ], mod - 2, mod )\nfor i in range( n, 0, -1 ):\n demon[ i - 1 ] = ( demon[ i ] * i ) % mod\n \ndef nCr( n, r ):\n if r < 1:\n return 0\n return ( numer[ n ] * demon[ r ] % mod ) * demon[ n - r ] % mod\n\nans = 0\nfor i in range( min( k, n - 1 ) + 1 ):\n ans = ( ans + nCr( n, i ) * nCr( n -1, i ) % mod\nprint( ans )\n', 'n, k = map( int, input().split() )\nmod = 10 ** 9 + 7\n\nnumer = [ 1 ] * ( n + 1 )\ndemon = [ 1 ] * ( n + 1 )\n\nfor i in range( 1, n + 1 ):\n numer[ i ] = numer[ i - 1 ] * i % mod\n\ndemon[ n ] = pow( numer[ n ], mod - 2, mod )\nfor i in range( n, 0, -1 ):\n demon[ i + 1 ] = ( demon[ i ] * i ) % mod\n\ndef nCr( n, r ):\n if r < 1:\n return 1\n return ( numer[ n ] * demon[ r ] % mod ) * demon[ n - r ] % mod\n\nans = 0\nfor i in range( max( k, n - 1) + 1 ):\n ans = ans + nCr( n, i ) * nCr( n - 1, i - 1 )\nprint( ans )', 'n, k = map( int, input().split() )\nmod = 10 ** 9 + 7\n \nnumer = [ 1 ] * ( n + 1 )\ndemon = [ 1 ] * ( n + 1 )\n \nfor i in range( 1, n + 1 ):\n numer[ i ] = numer[ i - 1 ] * i % mod\n\ndemon[ n ] = pow( numer[ n ], mod - 2, mod )\nfor i in range( n, 0, -1 ):\n demon[ i + 1 ] = ( demon[ i - 1 ] * i ) % mod\n\ndef nCr( n, r ):\n if r < 1:\n return 1\n return ( numer[ n ] * demon[ r ] % mod ) * demon[ n - r ] % mod\n \nans = 0\nfor i in range( max( k, n - 1) + 1 ):\n ans = ans + nCr( n, i ) * nCr( n - 1, i - 1 )\nprint( ans )', 'n, k = map( int, input().split() )\nmod = 10 ** 9 + 7\n\nf = [ 1 ] * ( n + 1 ) \ninv = [ 1 ] * ( n + 1 )\n\nfor i in range( 1, n + 1 ):\n f[ i ] = ( f[ i - 1 ] * i ) % mod\n \ninv[ n ] = pow( f[ n ], mod - 2, mod )\nfor i in range( n, 0, - 1 ):\n inv[ i - 1 ] = ( inv[ i ] * i ) % mod\n \ndef nCr( n, r ):\n if r < 1:\n return 1\n return ( f[ n ] * inv[ r ] % mod ) * inv[ n - r ] % mod\n\nans = 0\nfor i in range( min( k, n - 1 ) + 1 ):\n ans = ( ans + nCr( n, i ) * nCr( n - 1, i ) ) % mod\n \nprint( ans )\n\n\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s268980418', 's473150427', 's901512281', 's576197649'] | [3064.0, 12404.0, 12404.0, 18804.0] | [17.0, 89.0, 83.0, 390.0] | [520, 509, 516, 500] |
p02769 | u747602774 | 2,000 | 1,048,576 | There is a building with n rooms, numbered 1 to n. We can move from any room to any other room in the building. Let us call the following event a **move** : a person in some room i goes to another room j~ (i \neq j). Initially, there was one person in each room in the building. After that, we know that there were exactly k moves happened up to now. We are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible? Find the count modulo (10^9 + 7). | ['def modinv(a,m):\n return pow(a,m-2,m)\n\n\nn,k = map(int,input().split())\nP = 10**9+7\n\nif n-1 <= k:\n\n ans = 1\n for i in range(1,n):\n ans = ans*(N+1-i)*modinv(i,P)%P\n\nelse:\n ans = 0\n nCl = 1\n n1Cl = 1\n for l in range(1,k+1):\n nCl = nCl*(n+1-l)*modinv(l,P)%P\n n1Cl = n1Cl*(n-l)*modinv(l,P)%P\n ans = (ans+nCl*n1Cl)%P\n\nprint((ans+1)%P)\n\n', 'def comb_list(n, r, mod):\n ret = [1]\n for i in range(1, r+1):\n ret.append(ret[-1] * (n+1-i) * pow(i, mod-2, mod) % mod)\n return ret\n\nn,k = map(int,input().split())\nmod = 10**9+7\n\nr = min(k,n-1)\nans = 0\nnCl = comb_list(n, r, mod)\nn1Cl = comb_list(n-1, r, mod)\n\nfor i in range(r+1):\n ans = (ans + nCl[i] * n1Cl[i]) % mod\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s508138689', 's418325925'] | [3064.0, 18960.0] | [1612.0, 1645.0] | [379, 350] |
p02769 | u784022244 | 2,000 | 1,048,576 | There is a building with n rooms, numbered 1 to n. We can move from any room to any other room in the building. Let us call the following event a **move** : a person in some room i goes to another room j~ (i \neq j). Initially, there was one person in each room in the building. After that, we know that there were exactly k moves happened up to now. We are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible? Find the count modulo (10^9 + 7). | ['N,K=map(int, input().split())\ndef cmb(n, r, p):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n-r] % p\n\np = 10 ** 9 + 7\nn= 2*10 ** 5 \nfact = [1, 1] \nfactinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)\ninv = [0, 1] \n \nfor i in range(2, n + 1):\n fact.append((fact[-1] * i) % p)\n inv.append((-inv[p % i] * (p // i)) % p)\n factinv.append((factinv[-1] * inv[-1]) % p)\n\n\n\nzeros=min(K, N-1)\nans=0\nfor i in range(1,zeros+1):\n ans+=(cmb(N,i,p)*cmb(i+N-i-1, i, p))%p\n #print(pow(N-i, i, p))\n ans%=p\n\nprint(ans)', 'N,K=map(int, input().split())\ndef cmb(n, r, p):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n-r] % p\n\np = 10 ** 9 + 7\nn= 2*10 ** 5 \nfact = [1, 1] \nfactinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)\ninv = [0, 1] \n \nfor i in range(2, n + 1):\n fact.append((fact[-1] * i) % p)\n inv.append((-inv[p % i] * (p // i)) % p)\n factinv.append((factinv[-1] * inv[-1]) % p)\n\n\n\nzeros=min(K, N-1)\nans=1\nfor i in range(1,zeros+1):\n ans+=(cmb(N,i,p)*cmb(i+N-i-1, i, p))%p\n #print(pow(N-i, i, p))\n ans%=p\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s082771250', 's276985608'] | [27116.0, 27116.0] | [614.0, 636.0] | [672, 672] |
p02769 | u922449550 | 2,000 | 1,048,576 | There is a building with n rooms, numbered 1 to n. We can move from any room to any other room in the building. Let us call the following event a **move** : a person in some room i goes to another room j~ (i \neq j). Initially, there was one person in each room in the building. After that, we know that there were exactly k moves happened up to now. We are interested in the number of people in each of the n rooms now. How many combinations of numbers of people in the n rooms are possible? Find the count modulo (10^9 + 7). | ['def factorial(n, mod=10**9+7):\n a = 1\n for i in range(1,n+1):\n a = a * i % mod\n return a\n\n\ndef power(n, r, mod=10**9+7):\n if r == 0: return 1\n if r%2 == 0:\n return power(n*n % mod, r//2, mod) % mod\n if r%2 == 1:\n return n * power(n, r-1, mod) % mod\n\n\ndef comb(n, k, mod=10**9+7):\n if n < k or k < 0:\n result = 0\n else:\n a = factorial(n, mod=mod)\n b = factorial(k, mod=mod)\n c = factorial(n-k, mod=mod)\n result = (a * power(b, mod-2, mod=mod) * power(c, mod-2, mod=mod)) % mod\n return result\n\nn, k = map(int, input().split())\nMOD = 10**9 + 7\n\nif k >= n:\n print(comb(2*n-1, n))\n quit()\n\ndef power(n, r, mod=10**9+7):\n if r == 0: return 1\n if r%2 == 0:\n return power(n*n % mod, r//2, mod) % mod\n if r%2 == 1:\n return n * power(n, r-1, mod) % mod\n\n\nfl = [-1]*(k+1)\nfl[0] = 1\ndef f(i):\n global fl\n if fl[i] > 0: return fl[i]\n else:\n if i <= n//2:\n res = f(i-1)*(n-i+1)*(n-i)\n t = power(i, MOD-2)\n res *= t\n res %= MOD\n res *= t\n res %= MOD\n fl[i] = res\n return res\n else:\n res = f(n-i) * (n-i)\n res *= power(i, MOD-2)\n res %= MOD\n fl[i] = res\n return res\n\n\nif k <= n//2:\n fl = [-1]*(k+1)\n fl[0] = 1\n def f(i):\n global fl\n if fl[i] > 0: return fl[i]\n else:\n res = f(i-1)*(n-i+1)*(n-i)\n t = power(i, MOD-2)\n res *= t\n res %= MOD\n res *= t\n res %= MOD\n fl[i] = res\n return res\n\n ans = 0\n for i in range(k+1):\n ans += f(i)\n ans %= MOD\nelse:\n fl = [-1]*(n+1)\n fl[0] = comb(n, k) * comb(n-1, k) % MOD\n def f(i):\n global fl\n if fl[i-k] > 0: return fl[i-k]\n else:\n res = f(i-1)*(n-i+1)*(n-i)\n t = power(i, MOD-2)\n res *= t\n res %= MOD\n res *= t\n res %= MOD\n fl[i-k] = res\n return res\n \n ans = 0\n for i in range(k+1, n+1):\n ans += f(i)\n ans %= MOD\n ans = comb(2*n-1, n) - ans\n ans %= M0D\n\n\nprint(ans % MOD)', 'def factorial(n, mod=10**9+7):\n a = 1\n for i in range(1,n+1):\n a = a * i % mod\n return a\n\ndef power(n, r, mod=10**9+7):\n if r == 0: return 1\n if r%2 == 0:\n return power(n*n % mod, r//2, mod) % mod\n if r%2 == 1:\n return n * power(n, r-1, mod) % mod\n\ndef comb(n, k, mod=10**9+7):\n if n < k or k < 0:\n result = 0\n else:\n a = factorial(n, mod=mod)\n b = factorial(k, mod=mod)\n c = factorial(n-k, mod=mod)\n result = (a * power(b, mod-2, mod=mod) * power(c, mod-2, mod=mod)) % mod\n return result\n\nn, k = map(int, input().split())\nk = min(n, k)\nMOD = 10**9 + 7\nfl = [-1]*(n+1)\nfl[0] = 1\ndef f(i):\n global fl\n if fl[i] > 0: return fl[i]\n else:\n res = f(i-1)*(n-i+1)*(n-i)\n t = power(i, MOD-2)\n res *= t**2\n res %= MOD\n fl[i] = res\n return res\n\nif k <= n//2:\n ans = 0\n for i in range(k+1):\n ans += f(i)\n ans %= MOD\nelse:\n fl[k] = comb(n, k) * comb(n-1, k) % MOD\n ans = 0\n for i in range(k+1, n+1):\n ans += f(i)\n ans %= MOD\n ans = comb(2*n-1, n) - ans\n ans %= MOD\n\nprint(ans % MOD)'] | ['Runtime Error', 'Accepted'] | ['s326550799', 's387272068'] | [6352.0, 6188.0] | [1168.0, 1126.0] | [1997, 1093] |
p02770 | u044220565 | 2,000 | 1,048,576 | We have a sequence of k numbers: d_0,d_1,...,d_{k - 1}. Process the following q queries in order: * The i-th query contains three integers n_i, x_i, and m_i. Let a_0,a_1,...,a_{n_i - 1} be the following sequence of n_i numbers: \begin{eqnarray} a_j = \begin{cases} x_i & ( j = 0 ) \\\ a_{j - 1} + d_{(j - 1)~\textrm{mod}~k} & ( 0 < j \leq n_i - 1 ) \end{cases}\end{eqnarray} Print the number of j~(0 \leq j < n_i - 1) such that (a_j~\textrm{mod}~m_i) < (a_{j + 1}~\textrm{mod}~m_i). Here (y~\textrm{mod}~z) denotes the remainder of y divided by z, for two integers y and z~(z > 0). | ['# coding: utf-8\nimport sys\n#from operator import itemgetter\nsysread = sys.stdin.readline\n#from heapq import heappop, heappush\n#from collections import defaultdict\nsys.setrecursionlimit(10**7)\n#import math\n#from itertools import combinations\nimport numpy as np\ndef run():\n k,q = map(int, sysread().split())\n d = list(map(int,sysread().split()))\n d = np.array(d, dtype=np.uint32)\n\n def check(n ,x, m):\n _d = d % m\n d0 = d % m == 0\n # n_step\n n_d = (n-1) // k\n n_rest = (n-1) % k\n x %= m\n _d_rest, d0_rest = 0, 0\n if n_rest != 0:\n _d_rest = _d[:n_rest].sum()\n d0_rest = d0[:n_rest].sum()\n\n a_last = x + n_d * _d.sum() + _d_rest\n n_step = a_last // m\n # n_same\n n_same = n_d * d0.sum() + d0_rest\n\n return n-1 - n_same - n_step\n\n\n for _ in range(q):\n n,x,m = map(int, sysread().split())\n print(check(n, x, m))\n\nif __name__ == "__main__":\n run()', '# coding: utf-8\nimport sys\n#from operator import itemgetter\nsysread = sys.stdin.readline\n#from heapq import heappop, heappush\n#from collections import defaultdict\nsys.setrecursionlimit(10**7)\n#import math\n#from itertools import combinations\nimport numpy as np\ndef run():\n k,q = map(int, sysread().split())\n d = list(map(int,sysread().split()))\n d = np.array(d, dtype=np.uint64)\n\n def check(n ,x, m):\n _d = d % m\n d0 = d % m == 0\n # n_step\n n_d = (n-1) // k\n n_rest = (n-1) % k\n x %= m\n _d_rest, d0_rest = 0, 0\n if n_rest != 0:\n _d_rest = _d[:n_rest].sum()\n d0_rest = d0[:n_rest].sum()\n\n a_last = x + n_d * _d.sum() + _d_rest\n n_step = a_last // m\n # n_same\n n_same = n_d * d0.sum() + d0_rest\n\n return n-1 - n_same - n_step\n\n\n for _ in range(q):\n n,x,m = map(int, sysread().split())\n print(int(check(n, x, m)))\n\nif __name__ == "__main__":\n run()'] | ['Wrong Answer', 'Accepted'] | ['s267423748', 's752135970'] | [12828.0, 24752.0] | [920.0, 1082.0] | [984, 989] |
p02770 | u207850265 | 2,000 | 1,048,576 | We have a sequence of k numbers: d_0,d_1,...,d_{k - 1}. Process the following q queries in order: * The i-th query contains three integers n_i, x_i, and m_i. Let a_0,a_1,...,a_{n_i - 1} be the following sequence of n_i numbers: \begin{eqnarray} a_j = \begin{cases} x_i & ( j = 0 ) \\\ a_{j - 1} + d_{(j - 1)~\textrm{mod}~k} & ( 0 < j \leq n_i - 1 ) \end{cases}\end{eqnarray} Print the number of j~(0 \leq j < n_i - 1) such that (a_j~\textrm{mod}~m_i) < (a_{j + 1}~\textrm{mod}~m_i). Here (y~\textrm{mod}~z) denotes the remainder of y divided by z, for two integers y and z~(z > 0). | ['k, q = map(int, input().split())\nd = list(map(int, input().split()))\nqueries = [tuple(map(int, input().split())) for _ in range(q)]\n\nfor n, x, m in queries:\n x_mod = x % m\n d_mod = [elem % m for elem in d]\n\n rem = n % k\n rem_d_mod = d_mod[-rem:]\n\n print(n - (x + sum(d_mod) * (n // k) + sum(rem_d_mod)) // m - d_mod.count(0) * (n // k) - rem_d_mod.count(0))\n', 'import numpy as np\n\n\nk, q = map(int, input().split())\nd = np.array(list(map(int, input().split()))).astype(np.int64)\nqueries = [tuple(map(int, input().split())) for _ in range(q)]\n\nfor n, x, m in queries:\n d_mod = d % m\n quotient, rem = divmod(n - 1, k)\n rem_d_mod = d_mod[:rem]\n print(quotient * np.count_nonzero(d_mod) + np.count_nonzero(rem_d_mod)\n - (x % m + quotient * d_mod.sum() + rem_d_mod.sum()) // m)\n'] | ['Wrong Answer', 'Accepted'] | ['s356228346', 's524213031'] | [4500.0, 15072.0] | [2104.0, 789.0] | [373, 432] |
p02770 | u211706121 | 2,000 | 1,048,576 | We have a sequence of k numbers: d_0,d_1,...,d_{k - 1}. Process the following q queries in order: * The i-th query contains three integers n_i, x_i, and m_i. Let a_0,a_1,...,a_{n_i - 1} be the following sequence of n_i numbers: \begin{eqnarray} a_j = \begin{cases} x_i & ( j = 0 ) \\\ a_{j - 1} + d_{(j - 1)~\textrm{mod}~k} & ( 0 < j \leq n_i - 1 ) \end{cases}\end{eqnarray} Print the number of j~(0 \leq j < n_i - 1) such that (a_j~\textrm{mod}~m_i) < (a_{j + 1}~\textrm{mod}~m_i). Here (y~\textrm{mod}~z) denotes the remainder of y divided by z, for two integers y and z~(z > 0). | ['import sys\nimport numpy as np\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nk,q=map(int,readline().split())\nD=list(map(int,readline().split()))\nNXM = map(int, read().split())\n\nNXM=iter(NXM)\nNXM=zip(NXM,NXM,NXM)\n\nfor n,x,m in NXM:\n tmpD=D%m\n SD=np.array([0]+tmpD,dtype=np.int64)\n SD=np.cumsum(SD)\n n-=1\n x=x%m\n x+=SD[-1]*(n//k)\n x+=SD[n%k]\n count=tmpD.count(0)*(n//k)\n count+=tmpD[:n%k].count(0)\n ans=n-x//m-count\n print(ans)', 'k,q=map(int,input().split())\nD=list(map(int,input().split()))\nNXM = map(int, open(0).read().split())\n\nNXM=iter(NXM)\nNXM=zip(NXM,NXM,NXM)\n\nfor n,x,m in NXM:\n tmpD=list(map(lambda x:x%m,D))\n SD=[0]+tmpD\n n-=1\n for i in range(1,k):\n SD[i+1]+=SD[i]\n x=x%m\n x+=SD[-1]*(n//k)\n x+=SD[n%k]\n count=tmpD.count(0)*(n//k)\n count+=tmpD[:n%k].count(0)\n ans=n-x//m-count\n print(ans)', 'import sys\nimport numpy as np\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nk,q=map(int,readline().split())\nD=np.array(readline().split(),dtype=np.int64)\nNXM = map(int, read().split())\n\nNXM=iter(NXM)\nNXM=zip(NXM,NXM,NXM)\n\nfor n,x,m in NXM:\n tmpD=D%m\n SD=np.hstack((np.zeros(1,dtype=np.int64), tmpD))\n SD=np.cumsum(SD)\n n-=1\n x=x%m\n x+=SD[-1]*(n//k)\n x+=SD[n%k]\n count=(k-np.count_nonzero(tmpD))*(n//k)\n count+=n%k-np.count_nonzero(tmpD[:n%k])\n ans=n-x//m-count\n print(ans)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s271406966', 's600972742', 's382969649'] | [13260.0, 4848.0, 13324.0] | [155.0, 2104.0, 849.0] | [517, 407, 572] |
p02770 | u581187895 | 2,000 | 1,048,576 | We have a sequence of k numbers: d_0,d_1,...,d_{k - 1}. Process the following q queries in order: * The i-th query contains three integers n_i, x_i, and m_i. Let a_0,a_1,...,a_{n_i - 1} be the following sequence of n_i numbers: \begin{eqnarray} a_j = \begin{cases} x_i & ( j = 0 ) \\\ a_{j - 1} + d_{(j - 1)~\textrm{mod}~k} & ( 0 < j \leq n_i - 1 ) \end{cases}\end{eqnarray} Print the number of j~(0 \leq j < n_i - 1) such that (a_j~\textrm{mod}~m_i) < (a_{j + 1}~\textrm{mod}~m_i). Here (y~\textrm{mod}~z) denotes the remainder of y divided by z, for two integers y and z~(z > 0). | ['\nimport numpy as np\ndef resolve():\n K, Q = map(int, input().split())\n D = np.array(input().split(), dtype=np.int64)\n\n\n for _ in range(Q):\n n, x, m = map(int, input().split())\n \n \n E = D % m\n acc_E = np.cumsum(E)\n\n \n loop, rem = divmod(n - 1, K)\n tot = x % m + acc_E[-1] * loop\n\n \n zero = [int(e == 0) for e in E]\n zero_acc = np.cumsum(zero)\n tot_zero = zero_acc[-1] * loop\n\n if rem > 0:\n tot += acc_E[rem-1]\n tot_zero += zero_acc[rem - 1]\n dame = tot // m\n print(n - 1 - dame - tot_zero)\n\nif __name__ == "__main__":\n \nimport numpy as np\ndef resolve():\n K, Q = map(int, input().split())\n D = np.array(input().split(), dtype=np.int64)\n\n\n for _ in range(Q):\n n, x, m = map(int, input().split())\n \n \n E = D % m\n acc_E = np.cumsum(E)\n\n \n loop, rem = divmod(n - 1, K)\n tot = x % m + acc_E[-1] * loop\n\n \n zero = [int(e == 0) for e in E]\n zero_acc = np.cumsum(zero)\n tot_zero = zero_acc[-1] * loop\n\n if rem > 0:\n tot += acc_E[rem-1]\n tot_zero += zero_acc[rem - 1]\n dame = tot // m\n print(n - 1 - dame - tot_zero)\n\nif __name__ == "__main__":\n resolve()\n', '\nimport sys\nsys.setrecursionlimit(10 ** 7)\nread = sys.stdin.buffer.read \ninp = sys.stdin.buffer.readline\n\nimport numpy as np\ndef resolve():\n K, Q = map(int, inp().split())\n D = np.array(inp().split(), dtype=np.int64)\n nxm = [list(map(int, inp().split())) for _ in range(Q)]\n\n for n, x, m in nxm:\n \n \n E = D % m\n acc_E = np.cumsum(E)\n\n \n loop, rem = divmod(n - 1, K)\n tot = x % m + acc_E[-1] * loop\n\n \n zero_acc = np.cumsum(E == 0).astype(np.int64)\n tot_zero = zero_acc[-1] * loop\n\n if rem > 0:\n tot += acc_E[rem-1]\n tot_zero += zero_acc[rem - 1]\n dame = tot // m\n print(n - 1 - dame - tot_zero)\n\nif __name__ == "__main__":\n resolve()'] | ['Runtime Error', 'Accepted'] | ['s730991032', 's751763586'] | [9088.0, 28248.0] | [26.0, 502.0] | [1838, 1019] |
p02770 | u671455949 | 2,000 | 1,048,576 | We have a sequence of k numbers: d_0,d_1,...,d_{k - 1}. Process the following q queries in order: * The i-th query contains three integers n_i, x_i, and m_i. Let a_0,a_1,...,a_{n_i - 1} be the following sequence of n_i numbers: \begin{eqnarray} a_j = \begin{cases} x_i & ( j = 0 ) \\\ a_{j - 1} + d_{(j - 1)~\textrm{mod}~k} & ( 0 < j \leq n_i - 1 ) \end{cases}\end{eqnarray} Print the number of j~(0 \leq j < n_i - 1) such that (a_j~\textrm{mod}~m_i) < (a_{j + 1}~\textrm{mod}~m_i). Here (y~\textrm{mod}~z) denotes the remainder of y divided by z, for two integers y and z~(z > 0). | ['import numpy as np\n\nk, q = map(int, input().split())\nd = np.array(list(map(int, input().split())))\n\nfor i in range(q):\n n, x, m = map(int, input().split())\n mod_d = d % m\n modsum_d = mod_d.cumsum()\n _q, _m = divmod(n - 1, k)\n \n ans = modsum_d[k - 1] * _q\n if _m > 0:\n ans += modsum_d[_m - 1]\n ans = n - (ans + x % m) // m - np.count_nonzero(mod_d == 0) * _q\n if _m > 0:\n ans -= np.count_nonzero(mod_d[0 : _m] == 0)\n print(ans)', 'import numpy as np\n\nk, q = map(int, input().split())\nd = np.array(list(map(int, input().split())))\n\nfor i in range(q):\n n, x, m = map(int, input().split())\n mod_d = d % m\n modsum_d = mod_d.cumsum()\n _q, _m = divmod(n - 1, k)\n \n ans = modsum_d[k - 1] * _q\n if _m > 0:\n ans += modsum_d[_m - 1]\n ans = n - 1 - (ans + x % m) // m - np.count_nonzero(mod_d == 0) * _q\n if _m > 0:\n ans -= np.count_nonzero(mod_d[0 : _m] == 0)\n print(ans)'] | ['Wrong Answer', 'Accepted'] | ['s233562519', 's214088964'] | [22060.0, 12620.0] | [866.0, 864.0] | [442, 446] |
p02770 | u711693740 | 2,000 | 1,048,576 | We have a sequence of k numbers: d_0,d_1,...,d_{k - 1}. Process the following q queries in order: * The i-th query contains three integers n_i, x_i, and m_i. Let a_0,a_1,...,a_{n_i - 1} be the following sequence of n_i numbers: \begin{eqnarray} a_j = \begin{cases} x_i & ( j = 0 ) \\\ a_{j - 1} + d_{(j - 1)~\textrm{mod}~k} & ( 0 < j \leq n_i - 1 ) \end{cases}\end{eqnarray} Print the number of j~(0 \leq j < n_i - 1) such that (a_j~\textrm{mod}~m_i) < (a_{j + 1}~\textrm{mod}~m_i). Here (y~\textrm{mod}~z) denotes the remainder of y divided by z, for two integers y and z~(z > 0). | ["def main():\n import numpy as np\n k, q = map(int, input().split())\n d = np.array(list(map(int, input().split())))\n for i in range(q):\n n, x, m = map(int, input().split())\n x %= m\n d_mod = d % m\n zero_d = k - np.count_nonzero(d_mod)\n d_mod_sum = np.sum(d_mod) + m * zero_d\n rep = (n-1) // k\n rem = (n-1) % k\n zero_rem = len(d_mod[:rem]) - np.count_nonzero(d_mod[:rem])\n rem_sum = np.sum(d_mod[:rem]) + m * zero_rem\n ans = n - 1 - (x + d_mod_sum * rep + rem_sum) // m\n print(ans)\n print(rem_sum)\nif __name__ == '__main__':\n main()", "def main():\n import numpy as np\n k, q = map(int, input().split())\n d = np.array(list(map(int, input().split())))\n for i in range(q):\n n, x, m = map(int, input().split())\n x %= m\n d_mod = d % m\n zero_d = k - np.count_nonzero(d_mod)\n d_mod_sum = np.sum(d_mod) + m * zero_d\n rep = (n-1) // k\n rem = (n-1) % k\n zero_rem = len(d_mod[:rem]) - np.count_nonzero(d_mod[:rem])\n rem_sum = np.sum(d_mod[:rem]) + m * zero_rem\n ans = n - 1 - (x + d_mod_sum * rep + rem_sum) // m\n print(ans)\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s158462977', 's142937738'] | [21928.0, 12592.0] | [908.0, 897.0] | [568, 549] |
p02771 | u000085263 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a, b, c = map(int, input)\nif a==b or b==c or c==a:\n print("Yes")\nelse:\n print("No")', 'a, b, c = map(int, input().split())\nif a==b and b==c:\n print("No")\nelif a==b or b==c or c==a:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s561860710', 's634057247'] | [8972.0, 9084.0] | [23.0, 28.0] | [85, 131] |
p02771 | u000297744 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["a,b,c = map(int,input().split())\n\nif (a==b && a!=c) || (a==c&&a!=b) ||(b==c&&b!=a):\n print('yes')\nelse:\n print('no')", "a,b,c = map(int,input().split())\n\nif (a==b && a!=c) || (a==c&&a!=b) ||(b==c&&b!=a):\n print('Yes')\nelse:\n print('No')", "a,b,c = map(int,input().split())\n\nif (a==b and a!=c) or (a==c and a!=b) or (b==c and b!=a):\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s316233542', 's485476800', 's658100445'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [122, 122, 130] |
p02771 | u002438394 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a,b,c=map(int,input().split())\nif(a==b and b==c):\n print("Yes")\nelse:\n print("No"', 'a,b,c=map(int,input().split())\nif(a==b and b==c):\n print("No")\nelif(a==b or b==c or c==a):\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s379542142', 's347035142'] | [2940.0, 3060.0] | [17.0, 17.0] | [83, 132] |
p02771 | u003475507 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['n=int(input())\na = [input() for i in range(n)]\nb = sorted(list(set(a)))\nd = {}\nfor i in b:\n t = a.count(i)\n d.setdefault(t,[])\n d[t].append(i)\n\nfor i in d[max(d.keys())]:\n print(i)\n', "b = list(map(int,input().split()))\n\nif len(set(b)) == 2:\n print('Yes')\nelse:\n print('No')\n"] | ['Runtime Error', 'Accepted'] | ['s081078598', 's240927761'] | [2940.0, 2940.0] | [17.0, 17.0] | [193, 96] |
p02771 | u003899575 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["a, b, c = input().split()\n\nif a == b and a != c:\n print('Yes')\nelif b == c and b != a:\n print('Yes')\nelif c == a and c != b:\n print('Yes')\nelse:\n print('No)", "a, b, c = input().split()\n \nif a == b and a != c:\n print('Yes')\nelif b == c and b != a:\n print('Yes')\nelif c == a and c != b:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s043722277', 's946712732'] | [2940.0, 2940.0] | [17.0, 17.0] | [160, 162] |
p02771 | u004823354 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a,b,c = map(int,input().split())\nif a==b==c:\n print("No")\nelif a==b or b==c or a==c:\n print("No")\nelse:\n print("Yes")', 'a,b,c = map(int,input().split())\nif a==b==c:\n print("No")\nelif a!=b and b!=c and a!=c:\n print("No")\nelse:\n print("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s676415810', 's067317807'] | [9068.0, 9132.0] | [28.0, 26.0] | [120, 122] |
p02771 | u005899289 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["A, B, C = map(int, input().split())\nif A == B and B == C:\n print('Yes')\nelse:\n print('No')", "A, B, C = map(int, input().split())\nif A == B and B == C:\n print('No')\nelif A != B and B !=C and C != A:\n print('No')\nelse:\n print('Yes')"] | ['Wrong Answer', 'Accepted'] | ['s473452817', 's585163154'] | [9144.0, 9128.0] | [25.0, 29.0] | [96, 146] |
p02771 | u006425112 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a, b, c = map(int, input().split())\n\ns = set([a,b,c])\nif len(s) == 2:\n print("YES")\nelse:\n print("NO")', 'a, b, c = map(int, input().split())\n\ns = set([a,b,c])\nif len(s) == 2:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s302471655', 's530102791'] | [2940.0, 2940.0] | [17.0, 17.0] | [108, 108] |
p02771 | u006883624 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['#from math import sqrt\n#from heapq import heappush, heappop\n#from collections import deque\n\na, b, c = [int(v) for v in input().split()]\n\nif a == b and a != c:\n print("YES")\n exit()\n\nif b == c and b != a:\n print("YES")\n exit()\n\nif c == a and c != b:\n print("YES")\n exit()\n\nprint("NO")\n', '#from math import sqrt\n#from heapq import heappush, heappop\n#from collections import deque\n\na, b, c = [int(v) for v in input().split()]\n\nif a == b and b != c:\n print("Yes")\n exit()\n\nif b == c and c != a:\n print("Yes")\n exit()\n\nif c == a and a != b:\n print("Yes")\n exit()\n\nprint("No")\n'] | ['Wrong Answer', 'Accepted'] | ['s008923033', 's561020021'] | [2940.0, 2940.0] | [18.0, 19.0] | [302, 302] |
p02771 | u007738720 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["a,b,c=input().split()\nif a==b==c or a!=b!=c:\n print('No')\nelse:\n print('Yes')", "a,b,c=input().split()\nif a==b==c or a!=b!=c!=a:\n print('No')\nelse:\n print('Yes')"] | ['Wrong Answer', 'Accepted'] | ['s326890026', 's900210468'] | [2940.0, 2940.0] | [18.0, 17.0] | [79, 82] |
p02771 | u007808656 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a,b,c=input().split()\nif (a==b and b==c) or (a!=b and b!=c):\n print("No")\nelse:\n print("Yes")', 'a,b,c=input().split()\nif (a==b and b==c) or (a!=b and b!=c and c!=a):\n print("No")\nelse:\n print("Yes")\n'] | ['Wrong Answer', 'Accepted'] | ['s531378927', 's461701763'] | [2940.0, 2940.0] | [18.0, 17.0] | [95, 105] |
p02771 | u012955130 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["list_num = input().split(' ')\nif len(set(list_num))==2:\n print('YES')\nelse:\n print('NO')", "list_num = input().split(' ')\nif len(set(list_num))==2:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s712751313', 's169472822'] | [2940.0, 2940.0] | [17.0, 18.0] | [95, 95] |
p02771 | u014960543 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['n=int(input())\nL={}\nc=0\nfor i in range (n):\n s=input()\n if s in L:\n L[s]+=1\n else:\n L.update({s:1})\n c+=1\nM=list(L.values())\nC=list(L.keys())\nb=max(M)\nF=[]\nfor i in range(c):\n if M[i]==b:\n F+=[C[i]]\nF.sort()\nfor i in F:\n print(i)\n \n \n', 'A,B,C=map(int,input().split())\nprint((A==B and B!=C or A==C and C!=B or B==C and B!=A) and "Yes" or "No")\n'] | ['Runtime Error', 'Accepted'] | ['s274844514', 's734684383'] | [3192.0, 2940.0] | [17.0, 17.0] | [287, 106] |
p02771 | u015467545 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a,b,c=map(int,input().split())\nif a==b and a!=c:\n print("yes")\nelif a==c and a!=b:\n print("yes")\nelif c==b and a!=c:\n print("yes")\nelse:\n print("no")', 'a,b,c=map(int,input().split())\nif a==b and a!=c:\n print("Yes")\nelif a==c and a!=b:\n print("Yes")\nelif c==b and a!=c:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s954471028', 's237902796'] | [3060.0, 3064.0] | [18.0, 17.0] | [153, 153] |
p02771 | u015490689 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['#include <bits/stdc++.h>\nusing namespace std;\n\n\n\n\n#define FORE(i, b) for(auto &i:b)\n#define REP(i, b) FOR(i, 0, b)\n#define REPN(i, b) FORN(i, 0, b)\n#define SQ(i) (i*i)\n#define ALL(a) a.begin(), a.end()\n#define ALLA(a,n) a, a+n\n#define SORT(a) sort(ALL(a))\n#define SORTA(a, n) sort(ALLA(a, n))\n#define REV(a) reverse(ALL(a))\n#define REVA(a, n) reverse(ALLA(a, n))\n#define MAX(a, b) a = max(a, b)\n#define MIN(a, b) a = min(a, b)\n#define IN(a, b) (a.find(b) != a.end())\n#define BACK(a) a.back(); a.RB()\n#define QBACK(a) a.top(); a.pop()\n#define PRINT(a) FORE(i, a) cout << i << " "; cout << endl\n\n\n#define RB pop_back\n#define RF pop_front\n#define INS insert\n#define F first\n#define S second\n\n\n\n\n#define IO ios_base::sync_with_stdio(false); cin.tie(NULL)\n\ntypedef long long ll;\ntypedef unsigned long long ull;\n\ntypedef vector<int> vi;\ntypedef vector<double> vd;\ntypedef vector<ll> vll;\ntypedef pair<int,int> pi;\ntypedef pair<double,double> pd;\ntypedef pair<ll,ll> pll;\ntypedef queue<int> qi;\ntypedef queue<double> qd;\ntypedef queue<ll> qll;\ntypedef US<int> si;\ntypedef US<double> sd;\ntypedef US<ll> sll;\ntypedef vector<vi> mi;\ntypedef vector<vd> md;\ntypedef vector<vll> mll;\ntypedef vector<pi> vpi;\ntypedef vector<pd> vpd;\ntypedef vector<pll> vpll;\n\nint main(){\n IO; ll t; sll V;\n REP(i,3){cin >> t; V.INS(t);}\n cout << (V.size() == 2 ? "Yes":"No");\n}\n', 'v = set(map(int, input().strip().split()))\nprint("Yes" if len(v) == 2 else "No")\n'] | ['Runtime Error', 'Accepted'] | ['s410148531', 's969420462'] | [2940.0, 2940.0] | [17.0, 17.0] | [1604, 81] |
p02771 | u016901717 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['n=int(input())\nA=list(map(int,input().split()))\nans="APPROVED"\nfor i in A:\n if i%2==0:\n if i%3!=0 and i%5!=0:\n ans="DENIED"\n \n break\nprint(ans)\n \n', 'l=set(map(int,input().split()))\nif len(l)==2:\n print("Yes")\nelse:\n print("No")\n\n'] | ['Runtime Error', 'Accepted'] | ['s620151144', 's073597223'] | [2940.0, 2940.0] | [17.0, 17.0] | [199, 86] |
p02771 | u018679195 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a = int(input())\nb = int(input())\nc = int(input())\n\nif a==b or b==c or a==c:\n print("Yes")\nelse:\n print("No")\n', '#include<stdio.h>\nvoid main( )\n{\nint e,f,g;\nscanf("%d%d%d", &e, &f, &g);\nint count = 0;\nif( e==f && f!=g)\ncount=1;\nif( f==g && g!=f)\ncount=1;\nif( g==e && e!=f)\ncount=1;\n\nif(count==1)\n{\n printf("Yes");\n}\nelse\n{\nprintf("No");\n}\n}', 'def poor(a,b,c):\n if (a==b and a!=c) or (b==c and b!=a) or (a==c&&a!=b):\n print("Yes")\n else:\n print("No")\n \nA,B,C = input().split()\na = A\nb = B\nc = C\nd = poor(a,b,c)\nprint(d)', 'a=int(input())\nb=int(input())\nc=int(input())\nif a==b or b==c or a==c:\n if not(a==b and b==c):\n print("Yes")\n else:\n print("No")\nelse:\n print("No")', '#include <stdio.h>\n\nint main()\n{\n int a,b,c;\n scanf("%d %d %d", &a, &b, &c);\n if((a==b && a != c) || (a==c && a != b) || (c==b && a != c))\n printf("Yes");\n else\n printf("No");\n\n return 0;\n}', "a,b,c=input().split()\na=int(a)\nb=int(b)\nc=int(c)\nif a==b:\n if b==c: \n print('NO')\n else:\n print('YES')\nelif b==c:\n if a==c: \n print('NO')\n else:\n print('YES')\nelif a==c:\n if b==c:\n print('NO')\n else:\n print('YES')\nelse:\n print('NO')\n\n\n", "triple = input().split()\ntriple.sort()\nif (triple [0] == triple [2]) :\n print('No')\nelif (triple[0] == triple [1] or triple[1] == triple [2]) :\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s042204417', 's348034294', 's355750321', 's578230585', 's784236620', 's920742757', 's842288144'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0] | [116, 227, 202, 169, 210, 298, 185] |
p02771 | u019113646 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['n = list(map(int, input().split()))\nif n[0] !== n[1]:\n print("Yes")\n exit(0)\nif n[0] !== n[2]:\n print("Yes")\n exit(0)\nprint("No")', 'n = list(map(int, input().split()))\nif n[0] == n[1]:\n if n[0] == n[2]:\n print("Yes")\n exit()\nprint("No")', 'n = list(map(int, input().split()))\nif n[0] == n[1]:\n if n[0] == n[2]:\n print("Yes")\nprint("No")', 'n = list(map(int, input().split()))\nif n[0] == n[1] == n[2]:\n print("Yes")\nprint("No")', 'n = list(map(int, input().split()))\nif n[0] == n[1]:\n if n[0] == n[2]:\n print("Yes")\nprint("No")', 'n = list(map(int, input().split()))\nif n[0] !== n[1]:\n print("Yes")\n return\nif n[0] !== n[2]:\n print("Yes")\n return\nprint("No")', 'n = list(map(int, input().split()))\nif n[0] != n[1]:\n if n[1] == n[2]:\n print("Yes")\n exit()\n if n[0] == n[2]:\n print("Yes")\n exit()\n if n[0] != n[2]:\n print("No")\n exit()\nif n[0] == n[1]:\n if n[0] != n[2]:\n print("Yes")\n exit()\nprint("No")'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s202795217', 's316745200', 's435490265', 's639670672', 's779267419', 's979270196', 's117786899'] | [2940.0, 2940.0, 3064.0, 2940.0, 2940.0, 2940.0, 3064.0] | [17.0, 17.0, 19.0, 17.0, 17.0, 18.0, 17.0] | [141, 121, 106, 89, 102, 139, 308] |
p02771 | u021763820 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['# -*- coding: utf-8 -*-\nA, B, C = map(int, input().split())\ns = {A, B, C}\nif len(s) == 2:\n print("YES")\nelse:\n print("No")', '# -*- coding: utf-8 -*-\nA, B, C = map(int, input().split())\ns = {A, B, C}\nif len(s) == 2:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s750154321', 's291951551'] | [3064.0, 2940.0] | [20.0, 17.0] | [128, 128] |
p02771 | u022562184 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["a, b, c = map(int, input().split())\nif a == b and b != c:\n print('Yes')\n exit()\nif b == c and c != a:\n print('Yes')\n exit()\nprint('No')\n", "a, b, c = map(int, input().split())\nif a == b and b != c:\n print('Yes')\n exit()\nif b == c and c != a:\n print('Yes')\n exit()\nif c == a and b != a:\n print('Yes')\n exit()\nprint('No')"] | ['Wrong Answer', 'Accepted'] | ['s054298248', 's087537900'] | [2940.0, 2940.0] | [17.0, 17.0] | [148, 197] |
p02771 | u024782094 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['list=[int(input()) for i in range(3)]\nprint(len(set(list)))', 'list=[int(input()) for i in range(3)]\nprint("Yes" if len(set(list))=2 else "No")', 's=list(set(input().split()))\nif len(s)==2:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s280908985', 's796222007', 's561265357'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [59, 80, 77] |
p02771 | u025241948 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a,b,c=input()\n\nif a==b and a!=c:\n print("Yes")\nelif a==c and a!=b:\n print("Yes")\nelif b==c and a!=b:\n print("Yes")\nelse:\n print("No")', 'a,b,c=input().split()\n\nif a==b and a!=c:\n print("Yes")\nelif a==c and a!=b:\n print("Yes")\nelif b==c and a!=b:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s524666276', 's925624905'] | [3064.0, 2940.0] | [17.0, 17.0] | [145, 153] |
p02771 | u025389922 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["i=list(map(int, input().split()))\n \nif i[0]==i[1] | i[0]==i[2] | i[1]==i[2]:\n if i[0]==i[1] & i[0]==i[2] & i[1]==i[2]:\n\tprint('No')\n else:\n\tprint('Yes')\nelse:\n print('No')", "if A==B & A==C:\n\tprint('NO')\nif A==B | A==C | B==C:\n\tprint('YES')\nelse:\n print('NO')", "i=list(map(int, input().split()))\n\nif i[0]==i[1] | i[0]==i[2] | i[1]==i[2]:\n if i[0]==i[1] & i[0]==i[2]:\n\tprint('No')\n else:\n\tprint('Yes')\nelse:\n print('No')", "i=list(map(int, input().split()))\n \nif i[0]==i[1] | i[0]==i[2] | i[1]==i[2]:\n\tif i[0]==i[1] & i[0]==i[2]:\n\t\tprint('No')\n\telse:\n\t\tprint('Yes')\nelse:\n print('No')", "i=list(map(int, input().split()))\n \nif i[0]==i[1] | i[0]==i[2] | i[1]==i[2]:\n\tif i[0]==i[1] & i[0]==i[2] & i[1]==i[2]:\n \tprint('No')\n\telse:\n\t\tprint('Yes')\nelse:\n\tprint('No')", "i=list(map(int, input().split()))\nif i[0]==i[1] & i[0]==i[2]:\n\tprint('No')\nif i[0]==i[1] | i[0]==i[2] | i[1]==i[2]:\n\tprint('Yes')\nelse:\n print('No')", "i=list(map(int, input().split()))\n \nif i[0]==i[1] or i[0]==i[2] or i[1]==i[2]:\n\tif i[0]==i[1] and i[0]==i[2]:\n\t\tprint('No')\n\telse:\n\t\tprint('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s356794215', 's435244901', 's775432319', 's796202480', 's797388634', 's873084366', 's634222019'] | [2940.0, 2940.0, 2940.0, 3064.0, 2940.0, 3060.0, 3060.0] | [19.0, 17.0, 17.0, 18.0, 19.0, 17.0, 17.0] | [177, 87, 162, 163, 177, 151, 167] |
p02771 | u025501820 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['nums = list(map(int, input.split(" ")))\nif len(set(nums)) == 2:\n print("Yes")\nelse:\n print("No")\n', 'nums = list(map(int, input().split(" ")))\nif len(set(nums)) == 2:\n print("Yes")\nelse:\n print("No")\n'] | ['Runtime Error', 'Accepted'] | ['s880754388', 's091496025'] | [2940.0, 2940.0] | [16.0, 17.0] | [103, 105] |
p02771 | u026862065 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a, b, c = map(int, input().split())\nif a == b == c or a != b != c:\n print("No")\nelse:\n print("Yes")', 'l = set(map(int, input().split()))\nif len(l) == 2:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s492680039', 's520938295'] | [2940.0, 2940.0] | [17.0, 18.0] | [105, 89] |
p02771 | u030278108 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a,b,c = list(map(int, input().split()))\n\nif(a==b and a!=c) or (a==c and a!=b) or (c==b and a!=c):\n print("yes")\nelse:\n print("no")', 'a,b,c =list(map(int, input().split()))\n\nif(a==b and a!=c):\n print("yes")\nelif(a==c and b!=c):\n print("yes")\nelif (b==c and b!=a):\n print("yes")\nelse:\n print("no")', 'n = int(input())\n\nA = list(map(int, input().split()))\n\nfor A in range(n):\n if A%3==0 or A%5==0:\n print("APPROVED")\n else:\n print("DENIED")', 'n = int(input())\n\nA = list(map(int, input().split()))\n\nfor A in range(n):\n if A == A/3 or A == A/5:\n print("APPROVED")\n else:\n print("DENIED")', 'n = int(input())\n\nA = list(map(int, input().split()))\nfor i in range(n):\n if A[i]%2 == 0 and A[i]%3 == 0:\n print("APPROVED")\n elif A[i]%2 == 0 and A[i]%5 == 0:\n print("APPROVED")\n else:\n print("DENIED")', 'n = int(input())\n\nA = list(map(int, input().split()))\n\nfor A in range(n):\n if A == A//3 or A == A//5:\n print("APPROVED")\n else:\n print("DENIED")', 'n = int(input())\n\nfor A in range(n):\n A = list(map(int, input().split()))\n if A % 3 == 0 or A % 5 == 0:\n print("APPROVED")\n else:\n print("DENIED")', 'a,b,c =map(int, input().split())\n\nif(a==b and a!=c) or (a==c and a!=b) or (c==b and a!=c)\n print("yes")\nelse:\n print("no")', 'L = list(map(int, input().split().split()))\n\nif L[0] == L[1] == L[2]:\n print("no")\nelse:\n print("yes")', 'A, B, C = map(int, input().split().split())\n\nif A==B==C:\n print("no")\nelse:\n print("yes")', "n = int(input())\nA = list(map(int, input().split()))\n\nfor i in range(n):\n if A[i]%2 == 0 and A[i]%3 != 0:\n print('DENIED')\n elif A[i]%2 == 0 and A[i]%5 != 0:\n print('DENIED')\n else:\n print('APPROVED')", 'L = list(map(int, input().split().split()))\n\nif L[0]==L[1]==L[2]:\n print("no")\nelse:\n print("yes")', 'a,b,c = list(map(int, input().split()))\n\nif a == b:\n if a != c:\n print("yes")\nelse:\n print("no")', 'a,b,c =list(map(int, input().split()))\n\nif(a==b and a!=c) or (a==c and a!=b) or (c==b and a!=c):\n print("yes")\nelse:\n print("no")', 'a, b, c= map(int, input().split())\n\nif(a==b and a!=c):\n print("yes")\nelif(a==c and b!=c):\n print("yes")\nelif (b==c and b!=a):\n print("yes")\nelse:\n print("no")', 'a,b,c =map(int, input().split())\n\nif(a==b and a!=c) or (a==c and a!=b) or (c==b and a!=c):\n print("yes")\nelse:\n print("no")', 'a,b,c =map(int, input().split())\n\nif(a==b and a!=c) or (a==c and a!=b) or (c==b and a!=c)\n print("yes")\nelse:\n print("no")', 'a, b, c =map(int, input().split())\n\nif(a==b and a!=c):\n print("yes")\nelif(a==c and b!=c):\n print("yes")\nelif (b==c and b!=a):\n print("yes")\nelse:\n print("no")', 'a,b,c=map(int,input().split())\n\nif a==b and a!=c:\n print("Yes")\nelif a==c and a!=b:\n print("Yes")\nelif b==c and b!=a:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s016980993', 's167951513', 's323712067', 's346051532', 's395937659', 's441330338', 's580077354', 's601524090', 's617157718', 's637441084', 's752784242', 's769706694', 's828963711', 's897141136', 's935497295', 's951594292', 's962488541', 's980388493', 's670461793'] | [2940.0, 2940.0, 2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3064.0, 2940.0, 2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 3060.0, 3060.0] | [17.0, 17.0, 20.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 17.0, 19.0, 17.0, 17.0, 28.0, 17.0, 17.0, 17.0, 17.0] | [136, 174, 158, 162, 232, 164, 185, 128, 108, 95, 230, 104, 109, 135, 170, 129, 128, 170, 162] |
p02771 | u030410515 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['A,B,C=map(int,input().split())\n\nif (A==B and B==C):\n print("No")\nelif(A!=B and B!=C):\n print("No")\nelse:\n print("Yes")\n', 'A,B,C=map(int,input().split())\n\nif(A==B and (B==C and A==C)):\n print("No")\n\nelif(A!=B and (B!=C and A!=C)):\n print("No")\nelse:\n print("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s322279939', 's565822590'] | [2940.0, 3060.0] | [18.0, 17.0] | [128, 149] |
p02771 | u032955959 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a,b,c=int(input().split())\nif a==b and a!=c:\n print("Yes")\nelif b==c and b!=a:\n print("Yes")\nelif c==a and c!=b:\n print("Yes")\nelse:\n print("No")\n \n', 'A,B,C=int(input())\nif A==B and A!=C:\n print("Yes")\nelif B==C and B!=A:\n print("Yes")\nelif C==A and C!=B:\n print("Yes")\nelse:\n print("No")\n \n', 'A,B,C=int(input())\nif A=B and A!=C:\n print("Yes")\nelif B=C and B!=A:\n print("Yes")\nelif C=A and C!=B:\n print("Yes")\nelse:\n print("No")\n ', 'a,b,c=int(input())\nif a==b and a!=c:\n print("Yes")\nelif b==c and b!=a:\n print("Yes")\nelif c==a and c!=b:\n print("Yes")\nelse:\n print("No")\n \n', 'a,b,c=map(int(input().split()))\nif a==b and a!=c:\n print("Yes")\nelif b==c and b!=a:\n print("Yes")\nelif c==a and c!=b:\n print("Yes")\nelse:\n print("No")\n \n', 'A,B,C=int(input())\nif A==B,A!=C: \n print("Yes")\n elif B==C,B!=A:\n print("Yes")\n elif C==A,C!=B:\n print("Yes")\n else:\n print("No")\n ', 'a,b,c=map(int,input().split())\nif a==b and a!=c:\n print("Yes")\nelif b==c and b!=a:\n print("Yes")\nelif c==a and c!=b:\n print("Yes")\nelse:\n print("No")\n \n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s206529318', 's366444412', 's466951723', 's569448617', 's922928200', 's959708100', 's503224892'] | [2940.0, 3064.0, 2940.0, 2940.0, 3064.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0, 17.0, 19.0, 17.0] | [153, 145, 141, 145, 158, 153, 157] |
p02771 | u033642300 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["def main():\n a, b, c = map(int, input().split())\n if (a == b and b != c) or (b == c and a != b):\n print('Yes')\n else:\n print('No')\nmain()", "def main():\n a, b, c = map(int, input().split())\n if (a == b and b != c) or (b == c and a != b) or (a == c and a != b):\n print('Yes')\n else:\n print('No')\nmain()"] | ['Wrong Answer', 'Accepted'] | ['s433670534', 's322892743'] | [9172.0, 9096.0] | [27.0, 29.0] | [160, 183] |
p02771 | u036340997 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["n = int(input())\ndic = {}\nm = 0\nfor i in range(n):\n s = input()\n if s in dic:\n dic[s] += 1\n m = max(m, dic[s])\n else:\n dic[s] = 1\n m = max(m, dic[s])\nans = []\nfor s in dic:\n if dic[s] == m:\n ans.append(s)\nprint('\\n'.join(ans.sort()))", "print('Yes' if len(set(input().split()))==2 else 'No')"] | ['Runtime Error', 'Accepted'] | ['s664159549', 's566569369'] | [3064.0, 2940.0] | [18.0, 17.0] | [252, 54] |
p02771 | u036492525 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a=list(map(int,input().split()))\nif a[0]==a[1]:\n\tif a[1] == a[2]:\n\t\tprint("No")\n\telse:\n\t\tprint("Yes")\nelse:\n\tif a[1] == a[2]:\n\t\tprint("Yes")\n\telse:\n\t\tprint("No")\n', 'a=sorted(list(map(int,input().split())))\nif a[0]==a[1]:\n\tif a[1] == a[2]:\n\t\tprint("No")\n\telse:\n\t\tprint("Yes")\nelse:\n\tif a[1] == a[2]:\n\t\tprint("Yes")\n\telse:\n\t\tprint("No")'] | ['Wrong Answer', 'Accepted'] | ['s942570134', 's638642097'] | [2940.0, 3060.0] | [18.0, 17.0] | [163, 170] |
p02771 | u038819082 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["A=map(list(int,input().split()))\nB=len(set(A))\nif B==2:\n print('Yes')\nelse:\n print('No')", "N=int(input())\nA=list(map(int,input().split()))\ng='APPROVED'\nfor i in range(N):\n if A[i]%2 == 0:\n if A[i]%3 != 0 and A[i]%5 != 0:\n g='DENIED'\n break\nprint(g)", "N=int(input())\nA=list(map(int,input().split()))\ng='APPROVED'\nfor i in A:\n if i%2 == 0:\n if i%3 != 0 and i%5 != 0:\n g='DENIED'\n break\nprint(g)", "A=list(map(int,input().split()))\nB=len(set(A))\nif B==2:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s248595345', 's618700486', 's674207191', 's087485447'] | [2940.0, 2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0, 17.0] | [94, 189, 173, 94] |
p02771 | u041046014 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a=list(map(int,input().split()))\nprint(a)\nif not(a[0]==a[1]==a[2]) and (a[0]==a[1] or a[1]==a[2] or a[0]==a[2]):\n print("YES")\nelse:\n print("NO")\n', 'a=list(map(int,input().split()))\na.sort()\nif (a[0]==a[1] and a[1]!=a[2]):\n print("YES")\nelse:\n print("NO")', 'a=list(map(int,input().split()))\nprint(a)\nif a[0]==a[1]==a[2] or a[0]!=a[1]!=a[2]:\n print("No")\nelse:\n print("Yes")\n', 'a=list(map(int,input().split()))\na.sort()\nif (a[0]==a[1] or a[1]==[2]) and not(a[0]==a[1]==a[2]):\n print("YES")\nelse:\n print("NO")', 'a=list(map(int,input().split()))\nif a[0]==a[1]==a[2] or a[0]!=a[1]!=a[2]:\n print("No")\nelse:\n print("Yes")', 'a=list(map(int,input().split()))\na.sort()\nif a[0]==a[1]==a[2] or a[0]!=a[1]!=a[2]:\n print("No")\nelse:\n print("Yes")'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s055673195', 's555967053', 's674581487', 's703252104', 's751222985', 's568801538'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0, 17.0, 17.0, 17.0] | [148, 108, 118, 132, 108, 117] |
p02771 | u041401317 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["def main():\n num = list(map(int,input().split()))\n if num.count(num[0]) == 2 or num.count(num[1]) == 2:\n print('YES')\n return\n\n print('NO')\n\n\nmain()\n", "def main():\n num = list(map(int,input().split()))\n if num.count(num[0]) == 2 or num.count(num[1]) == 2:\n print('Yes')\n return\n\n print('No')\n\n\nmain()\n"] | ['Wrong Answer', 'Accepted'] | ['s063126707', 's009519412'] | [2940.0, 2940.0] | [17.0, 18.0] | [172, 172] |
p02771 | u041529470 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['x, y, z = input().split(" ")\na = int(x)\nb = int(y)\nc = int(z)\npoor = False\nif a == b == c:\n print(\'no\')\nelse:\n if a == b:\n poor = not poor\n\n if a == c:\n poor = not poor\n\n if b == c:\n poor = not poor\n\n if poor:\n print(\'yes\')\n else:\n print(\'no\')', 'x, y, z = input().split(" ")\na = int(x)\nb = int(y)\nc = int(z)\npoor = False\nif a == b == c:\n print(\'No\')\nelse:\n if a == b:\n poor = not poor\n\n if a == c:\n poor = not poor\n\n if b == c:\n poor = not poor\n\n if poor:\n print(\'Yes\')\n else:\n print(\'No\')'] | ['Wrong Answer', 'Accepted'] | ['s535351559', 's000169286'] | [3060.0, 3060.0] | [17.0, 17.0] | [296, 296] |
p02771 | u043964516 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a=input()\nb=input()\nc=input()\nif(a==b and a == c):\n print("No")\nelif(a != b and b == c):\n print("Yes")\nelif(a != b and a == c):\n print("Yes")\nelif(a!=c and a == b):\n print("Yes")\nelse:\n print("No")', 'a=input()\nb=a[2]\nc=a[4]\na=a[0]\nif(a==b and a == c):\n print("No")\nelif(a != b and b == c):\n print("Yes")\nelif(a != b and a == c):\n print("Yes")\nelif(a!=c and a == b):\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s770320862', 's805939623'] | [3060.0, 3060.0] | [18.0, 17.0] | [202, 203] |
p02771 | u044459372 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["def equ(a,b):\n return 1*(a==b)\na,b,c = map(input().split())\nans = equ(a,b)+equ(b,c) +equ(c,a)\nprint('Yes' if ans ==1 else 'No')\n", "def equ(a,b):\n return 1*(a==b)\na,b,c = map(int,input().split())\nans = equ(a,b)+equ(b,c) +equ(c,a)\nprint('Yes' if ans ==1 else 'No')"] | ['Runtime Error', 'Accepted'] | ['s698030587', 's676948146'] | [2940.0, 2940.0] | [18.0, 18.0] | [129, 132] |
p02771 | u045235021 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['n = input().split()\nn= [int(i) for i in n]\nn.sort()\n\n\nif n[1] == n[0]:\n if n[2]== n[1]:\n print("No")\n \nelif n[2] == n[1]: print("Yes")\nelse: print("No")\n', 'n = input().split()\nn= [int(i) for i in n]\nn.sort()\n\nif n[1] == n[0]:\n if n[2]==n[1]:\n print("No")\n else:\n print("Yes")\nelif n[2] == n[1]:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s823167200', 's474799559'] | [2940.0, 3064.0] | [17.0, 19.0] | [160, 197] |
p02771 | u047197186 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a, b, c = [int(elem) for elem in input().split()]\n\nif a == b and a != c:\n return "Yes"\nif a == c and a != b:\n return "Yes"\nif b == c and a != b:\n return "Yes"\nelse:\n return "No"', 'a, b, c = [int(elem) for elem in input().split()]\n\nif a == b and a != c:\n print("Yes")\nelif a == c and a != b:\n print("Yes")\nelif b == c and a != b:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s127167285', 's286279579'] | [3064.0, 3060.0] | [19.0, 17.0] | [181, 185] |
p02771 | u047816928 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["print('Yes' if set(map(int, input().split()))==2 else 'No')", "print('Yes' if len(set(map(int, input().split())))==2 else 'No')"] | ['Wrong Answer', 'Accepted'] | ['s953377558', 's832139692'] | [2940.0, 2940.0] | [17.0, 17.0] | [59, 64] |
p02771 | u048956777 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a, b ,c = map(int, input().split())\n\nif (a == b == c) or (a != b != c):\n print("No")\nelse:\n print("Yes")', 'a, b ,c = map(int, input().split())\n\nif (a == b == c) or (a != b and b != c and a!= c):\n print("No")\nelse:\n print("Yes")'] | ['Wrong Answer', 'Accepted'] | ['s112479101', 's010769109'] | [2940.0, 2940.0] | [17.0, 17.0] | [110, 126] |
p02771 | u049725710 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a,b,c=map(map(int,input().split()))\ns=set(a,b,c)\nif len(s)==2:\n print("Yes")\nelse:\n print("No")', 'import sys\nmyset=set()\nfor n in range(3):\n\tmyset[n-1].add(sys.argv[n])\nif len(myset)==2:\n\tprint("Yes")\nelse:\n\tprint("No")', 'a,b,c=map(int,input().split())\ns=set([a,b,c])\nif len(s)==2:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s126633042', 's624135335', 's033786804'] | [2940.0, 2940.0, 2940.0] | [18.0, 19.0, 18.0] | [97, 121, 94] |
p02771 | u050706842 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['A, B, C = list(map(int, input().split()))\n\nif A == B and A != C:\n print("YES")\nelif A == C and A != B:\n print("YES")\nelif B == C and A != B:\n print("YES")\nelse:\n print("NO")', 'A, B, C = list(map(int, input().split()))\n\nif A == B and A != C:\n print("Yes")\nelif A == C and A != B:\n print("Yes")\nelif B == C and A != B:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s473459316', 's522430245'] | [3060.0, 3060.0] | [18.0, 17.0] | [185, 185] |
p02771 | u054514819 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["L = set(list(map(int, input().split())))\nif len(L)==2:\n print('YES')\nelse:\n print('NO')", "L = set(list(map(int, input().split())))\nif len(L)==2:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s351619956', 's155859944'] | [2940.0, 2940.0] | [17.0, 17.0] | [89, 89] |
p02771 | u054622560 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['print(sys.stdin)', 'if len(set(input().split())) == 2:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s587805813', 's836326160'] | [2940.0, 2940.0] | [17.0, 17.0] | [16, 69] |
p02771 | u057325497 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['x = input().split()\n\nif x[0]== x[1] != x[2]:\n print("yes")\nelif x[1] == x[2] != x[0]:\n print("yes")\nelif x[2] == x[0] != x[1]:\n print("yes")\nelse:\n print("No")', 'x = input().split(\' \')\n\nif x[0] == x[1] != x[2]:\n print("yes")\nelif x[1] == x[2] != x[0]:\n print("yes")\nelif x[2] == x[0] != x[1]:\n print("yes")\nelse:\n print("No")', 'A = input()\nB = input()\nC = input()\n\nif A == B != C:\n print("yes")\nelif B == C != A:\n print("yes")\nelif C == A != B:\n print("yes")\nelse:\n print("No")', 'x = input().split()\n\nif x[0]== x[1] != x[2]:\n print("yes")\nelif x[1] == x[2] != x[0]:\n print("yes")\nelif x[2] == x[0] != x[1]:\n print("yes")\nelse:\n print("No")', 'ABC = input().split()\n\nif ABC[0] == ABC[1] != ABC[2]:\n print("yes")\nelif ABC[1] == ABC[2] != ABC[0]:\n print("yes")\nelif ABC[2] == ABC[0] != ABC[1]:\n print("yes")\nelse:\n print("No")', 'x = input().split(\' \')\n\nif x[0] == x[1] != x[2]:\n print("yes")\nelif x[1] == x[2] != x[0]:\n print("yes")\nelif x[2] == x[0] != x[1]:\n print("yes")\nelse:\n print("No")', 'x = input().split()\nA = x[0]\nB = x[1]\nC = x[2]\n\nif int(A) == int(B) != int(C):\n print("yes")\nelif int(B) == int(C) != int(A):\n print("yes")\nelif int(C) == int(A) != int(B):\n print("yes")\nelse:\n print("No")', 'x = input().split(\' \')\n\nif x[0] == x[1] != x[2]:\n print("yes")\nelif x[1] == x[2] != x[0]:\n print("yes")\nelif x[2] == x[0] != x[1]:\n print("yes")\nelse:\n print("No")', 'x = input().split()\nA = x[0]\nB = x[1]\nC = x[2]\n\nif int(A) == int(B) != int(C):\n print("yes")\nelif int(B) == int(C) != int(A):\n print("yes")\nelif int(C) == int(A) != int(B):\n print("yes")\nelse:\n print("No")', 'ABC = input().split(\' \')\n\nif ABC[0] == ABC[1] != ABC[2]:\n print("yes")\nelif ABC[1] == ABC[2] != ABC[0]:\n print("yes")\nelif ABC[2] == ABC[0] != ABC[1]:\n print("yes")\nelse:\n print("No")', 'x = input().split(\' \')\n\nif x[0] == x[1] != x[2]:\n print("Yes")\nelif x[1] == x[2] != x[0]:\n print("Yes")\nelif x[2] == x[0] != x[1]:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s039222009', 's078586813', 's185787214', 's202459025', 's264565009', 's413774437', 's646027605', 's739867246', 's740603840', 's831402367', 's028541205'] | [3060.0, 3060.0, 2940.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0, 20.0, 17.0, 17.0, 20.0, 17.0, 17.0, 17.0, 17.0] | [172, 176, 161, 172, 193, 176, 218, 176, 218, 196, 176] |
p02771 | u057362336 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["a,b,c=map(int,input())\nif (a!=b and b!=c and c!=a) or (a==b and b==c):\n print('No')\nelse:\n print('Yes')\n", "a,b,c=map(int,input().split())\nif (a!=b and b!=c and c!=a) or (a==b and b==c):\n print('No')\nelse:\n print('Yes')"] | ['Runtime Error', 'Accepted'] | ['s413281077', 's455276817'] | [9148.0, 9156.0] | [26.0, 31.0] | [106, 113] |
p02771 | u057415180 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["a, b, c = map(int, input().split())\nans = 'No'\nif a == b and b == c:\n ans = 'No'\nelif a != b and b != c:\n ans ='No'\nelse:\n ans ='Yes'\nprint(ans)", "a = set(map(int, input().split()))\nif len(a) == 2:\n print('Yes')\nelse:\n print('No')"] | ['Wrong Answer', 'Accepted'] | ['s141446924', 's342595357'] | [2940.0, 2940.0] | [18.0, 17.0] | [153, 89] |
p02771 | u057964173 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['import sys\ndef input(): return sys.stdin.readline().strip()\nfrom collections import Counter\ndef resolve():\n n=int(input())\n l=[input() for i in range(n)]\n l.sort()\n c=Counter(l)\n maxl=[]\n syutugenmax=max(c.values())\n for name,kazu in c.items():\n if kazu==syutugenmax:\n maxl.append(name)\n maxl.sort()\n for i in maxl:\n print(i)\nresolve()', "a,b,c=map(int,input().split())\nif a==b!=c:\n print('Yes')\nelif a==c!=b:\n print('Yes')\nelif b==c!=a:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s972047607', 's774459422'] | [3316.0, 3060.0] | [21.0, 17.0] | [387, 143] |
p02771 | u059684599 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["N = int(input())\nA = list(map(int,input().split()))\nans = 'APPROVED'\nfor a in A:\n if a % 2 == 0:\n if a % 3 != 0 and a % 5 != 0:\n ans = 'DENIED'\n exit()\nprint(ans)", 'print("Yes" if len(set(map(int, input().split())))==2 else "No")'] | ['Runtime Error', 'Accepted'] | ['s826579970', 's795725550'] | [3060.0, 2940.0] | [20.0, 17.0] | [194, 64] |
p02771 | u060012100 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['A = map(int,input().split())\nif len(set(A)) == 2:\n print("yes")\nelse:\n print("No")', 'A = map(int, input().split())\nif len(set(A)) == 2:\n print("yes")\nelse:\n print("No")', 'A = map(int, input().split())\nif len(set(A) == 2):\n print("yes")\nelse:\n print("No")', 'A = map(int,input().split())\nif len(set(A)) == 2:\n print("yes")\nelse:\n print("No")', 'A = map(int,input().split())\nif len(set(A) ) == 2:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s138988203', 's442244659', 's511330560', 's845135698', 's619461902'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [20.0, 17.0, 17.0, 17.0, 17.0] | [84, 85, 85, 84, 89] |
p02771 | u061539997 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['a = input().split()\nif a[0] == a[1] and a[0] != a[2]:\n print("No")\nelif a[0] == a[2] and a[0] != a[1]:\n print("No")\nelif a[1] == a[2] and a[1] != a[0]:\n print("No")\nelse:\n print("Yes")', 'a = input().split()\nif a[0] == a[1] and a[0] != a[2]:\n print("Yes")\nelif a[0] == a[2] and a[0] != a[1]:\n print("Yes")\nelif a[1] == a[2] and a[1] != a[0]:\n print("Yes")\nelse:\n print("No")'] | ['Wrong Answer', 'Accepted'] | ['s608146164', 's303822850'] | [3060.0, 3060.0] | [17.0, 17.0] | [196, 198] |
p02771 | u063346608 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['A,B,C = map(int,input().split())\n\nif A == B and A != C :\n\tanswer\u3000= "Yes"\n \nelif A == C and A != B :\n\tanswer\u3000= "Yes"\n \nelif B == C and B != A :\n\tanswer\u3000= "Yes"\nelse:\n\tanswer = "No"\n\nprint(answer)\n ', 'A,B,C = map(int,input().split())\n\nif (A==B) and A !=C:\n\tprint("Yes")\nelif (B==C ) and B !=A:\n\tprint("Yes")\nelif (C==A ) and C !=B:\n\tprint("Yes")\nelse:\n\tprint("No")'] | ['Runtime Error', 'Accepted'] | ['s023416271', 's105987283'] | [3064.0, 9096.0] | [23.0, 30.0] | [211, 163] |
p02771 | u064445353 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['import collections\n\nn = int(input())\ns = [input() for i in range(n)]\n\nc = collections.Counter(s).most_common()\nans = [k for k, v in c if c[0][1] == v]\nans.sort()\n\nfor i in ans:\n print(i)', 'a, b, c = input().split()\na = int(a)\nb = int(b)\nc = int(c)\n\nif a == b and a != c:\n print("Yes")\nelif a == c and a != b:\n print("Yes")\nelif b == c and b != a:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s766257666', 's537403298'] | [3316.0, 3060.0] | [21.0, 19.0] | [189, 202] |
p02771 | u065994196 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['arr=list(map(int,input().strip().split()))[:3]\nif(arr[0]==arr[1] and arr[0]!=arr[2]):\n print("Yes")\nelif(arr[1]==arr[2] and arr[1]!=arr[0]):\n print("Yes")\nelif(arr1[0]==arr[2] and arr1[0]!=arr[1]):\n print("Yes")\nelse:\n print("No")', 'arr=list(map(int,input().strip().split()))[:3]\ndict1={}\nfor i in arr:\n if i in dict1:\n dict1[i]+=1\n else:\n dict1[i]=1\nif(len(dict1)==2):\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s430532223', 's713052730'] | [3064.0, 3064.0] | [17.0, 17.0] | [234, 195] |
p02771 | u067694718 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['n = int(input())\ns_list = [input() for i in range(n)]\ns_set = set(s)\nmax = 0\nmax_elements = []\nfor i in s_set:\n c = s_list.count(i)\n if c > max:\n max = c\n max_elements = [i]\n if c == max and i not in max_elements:\n max_elements.append(i)\n\nfor i in sorted(max_elements):\n print(i)\n', 'n = int(input())\ns_list = [input() for i in range(n)]\ns_set = set(s_list)\nmax = 0\nmax_elements = []\nfor i in s_set:\n c = s_list.count(i)\n if c > max:\n max = c\n max_elements = [i]\n if c == max and i not in max_elements:\n max_elements.append(i)\n\nfor i in sorted(max_elements):\n print(i)\n', 'n = int(input())\na = [int(i) for i in input().split() if i % 2 == 0]\nfor i in a:\n if i % 3 != 0 and i % 5 != 0:\n print("DENIED")\n exit()\nprint("APPROVED")', 'print("Yes" if(len(set(input().split())) == 2) else "No")'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s237278832', 's320113488', 's575263433', 's472004349'] | [3060.0, 3060.0, 2940.0, 2940.0] | [17.0, 18.0, 18.0, 17.0] | [313, 318, 179, 57] |
p02771 | u068142202 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['from collections import Counter\n\nn = int(input())\ns = [input() for _ in range(n)]\nans = []\n\ncharctor_count = Counter(s)\nmax_count = max(charctor_count.values())\nfor k, v in charctor_count.items():\n if v == max_count:\n ans.append( k)\nprint("\\n".join(sorted(ans)))', 'a, b ,c = map(int,input().split())\nif a == b and b == c and a == c:\n print("No")\nelif a == b or b == c or a == c:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Accepted'] | ['s127151975', 's642623193'] | [3316.0, 3060.0] | [21.0, 18.0] | [266, 150] |
p02771 | u071361440 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ['lst=set(map(int,input().split(" ")))\nif len(set)==2:\n print("Yes")\nelse:print("No")', '#!/usr/bin/env python\nn=int(input())\nlst=list(map(int,input().split()))\n\nfor i in range(0,n):\n if lst[i]%2==0:\n if lst[i]%3==0 or lst[i]%5==0:\n x=1\n \n else: x=0\nif x==1:print("APPROVED")\nelse: print("DENIED")', 'ans=[]\nfor i in range(0,3):\n ele=int(input())\n ans.append(ele)\n \nanns=set(ans)\nif len(anns)==2:\n print("Yes")\nelse: print("No")', 'a=set(map(int,input().split()))\nif len(set)==2:\n print("Yes")\nelse:\n print("No")\n ', 'a=set(map(int,input().split()))\nif len(a)==2:\n print("Yes")\nelse:\n print("No")'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s126695603', 's433557074', 's855440949', 's965534011', 's857190774'] | [2940.0, 3060.0, 3060.0, 2940.0, 2940.0] | [17.0, 22.0, 18.0, 17.0, 17.0] | [84, 247, 139, 85, 84] |
p02771 | u074687136 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["A, B, C = input().rstrip().split('')\n\nif A == B == C:\n print('No')\nelif A == B or B == C or C == A:\n print('Yes')\nelse:\n print('No')", "A, B, C = input().rstrip().split(' ')\n\nif A == B == C:\n print('No')\nelif A == B or B == C or C == A:\n print('Yes')\nelse:\n print('No')"] | ['Runtime Error', 'Accepted'] | ['s747746147', 's601919097'] | [2940.0, 2940.0] | [17.0, 17.0] | [135, 136] |
p02771 | u076306174 | 2,000 | 1,048,576 | A triple of numbers is said to be _poor_ when two of those numbers are equal but the other number is different from those two numbers. You will be given three integers A, B, and C. If this triple is poor, print `Yes`; otherwise, print `No`. | ["A,B,C=list(map(int, input().split()))\n\nif A==B and B==C or A!=B and B!=C and C!=A:\n print('No')\nelse\n print('Yes')\n", "A,B,C=list(map(int, input().split()))\n\nif A==B and B==C or A!=B and B!=C and C!=A:\n print('No')\nelse:\n print('Yes')"] | ['Runtime Error', 'Accepted'] | ['s435228519', 's556113282'] | [2940.0, 2940.0] | [17.0, 17.0] | [121, 121] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.