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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02729 | u806403461 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\n\nN, M = map(int, input().split())\nif M <= 1 and N <= 1:\n print(0)\nelif N == 0:\n print(int((math.factorial(M)/(2*math.factorial(M-2)))))\nelif M == 0:\n print(int((math.factorial(N)/(2*math.factorial(N-2)))))\nelse:\n print(int((math.factorial(N)/(2*math.factorial(N-2))) + (math.factorial(M)/(2*math.factorial(M-2)))))', 'N, M = map(int, input().split())\n\nfrom 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\nif M == 0:\n print(cmb(N, 2))\nelif N == 0:\n print(cmb(M, 2))\nelif M <= 1 and N <= 1:\n print(0)\nelse:\n a = cmb(M, 2)\n b = cmb(N, 2)\n print(a + b)', 'N, M = map(int, input().split())\n\nfrom 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\nif M <= 1 and N <= 1:\n print(0)\nelif M == 0:\n print(cmb(N, 2))\nelif N == 0:\n print(cmb(M, 2))\nelse:\n a = cmb(M, 2)\n b = cmb(N, 2)\n print(a + b)', 'N, M = map(int, input().split())\n\nfrom 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\nif M == 0 and N == 0:\n print(0)\nelif M == 0:\n print(cmb(N, 2))\nelif N == 0:\n print(cmb(M, 2))\nelif M <= 1 and N <= 1:\n print(0)\nelse:\n a = cmb(M, 2)\n b = cmb(N, 2)\n print(a + b)', 'N, M = map(int, input().split())\n\nfrom 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\nif M <= 1 and N <= 1:\n print(0)\nelif M == 2 and N == 2:\n print(2)\nelif M == 2:\n print(cmb(N, 2)+1)\nelif N == 2:\n print(cmb(M, 2)+1)\nelif M == 0:\n print(cmb(N, 2))\nelif N == 0:\n print(cmb(M, 2))\nelse:\n a = cmb(M, 2)\n b = cmb(N, 2)\n print(a + b)', 'N, M = map(int, input().split())\n\nfrom 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\nif M == 0 and N == 0:\n print(0)\nelif M == 1 and N == 1:\n print(0)\nelif M <= 1:\n print(cmb(N, 2))\nelif N <= 1:\n print(cmb(M, 2))\nelse:\n a = cmb(M, 2)\n b = cmb(N, 2)\n print(a + b)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s555626170', 's768256690', 's781328351', 's855331788', 's998284731', 's309290271'] | [3064.0, 3572.0, 3688.0, 3572.0, 3700.0, 3572.0] | [18.0, 23.0, 23.0, 24.0, 25.0, 23.0] | [338, 417, 417, 454, 526, 454] |
p02729 | u808585569 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import sys\nN=int(sys.stdin.readline())\nL=list(map(int,sys.stdin.readline().split()))\ncount=[0]*N\nC=list(set(L))\nx=0\nd=[0]*len(C)\ne=[0]*N\nfor i in range(len(C)):\n d[i] = int((L.count(C[i]))*(L.count(C[i])-1)/2)\n x += d[i] \nfor K in range(N):\n e[K] = L.count(L[K])-1\n print(x-e[K])\n', 'N,M=map(int,input().split())\nprint(int(N*(N-1)/2+M*(M-1)/2))'] | ['Runtime Error', 'Accepted'] | ['s094453900', 's699141615'] | [3064.0, 2940.0] | [17.0, 17.0] | [285, 60] |
p02729 | u810356688 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['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\nn,m=map(int,input().split())\nif n>=2 and m>=2:print(cmb(n,2)+cmb(m,2))\nelif n>=2:print(cmb(m,2))\nelif m>=2:print(cmb(n,2))\nelse:print(0)', '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\nn,m=map(int,input().split())\nif n>=2 and m>=2:print(cmb(n,2)+cmb(m,2))\nelif n=>2:print(cmb(m,2))\nelif m>=2:print(cmb(n,2))\nelse:print(0)', '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\nn,m=map(int,input().split())\nif n>=2 and m>=2:print(cmb(n,2)+cmb(m,2))\nelif n>=2:print(cmb(n,2))\nelif m>=2:print(cmb(m,2))\nelse:print(0)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s011057178', 's345186786', 's010962567'] | [3572.0, 3064.0, 3572.0] | [23.0, 17.0, 22.0] | [358, 358, 358] |
p02729 | u813125722 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['ST = input().split()\nN = int(ST[0])\nM = int(ST[1])\nprint((N*(N-1)+(M*(M-1)))/2)', 'ST = input().split()\nN = ST[0]\nM = ST[1]\nprint((N*(N-1)+(M*(M-1)))/2)', 'ST = input().split()\nN = int(ST[0])\nM = int(ST[1])\nprint(int((N*(N-1)+(M*(M-1)))/2))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s459491729', 's721139483', 's667170619'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [79, 69, 84] |
p02729 | u813405587 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["N,M = map(int,input().split())\nwhile N > 0:\n A = N - 1\n A += A\n N -= N\nwhile M > 0:\n B = M - 1\n B += B\n M -= M\nelse:\n print('A + B')\n\n", "N,M = map(int,input().split())\nwhile N > 0:\n A = N - 1\n A += A\n N -= N\nwhile M > 0:\n B = M - 1\n B += B\n M -= M\nelse:\n print(str('A + B'))\n ", 'N,M = map(int,input().split())\nprint(N * (N -1) //\u30002 + M * (M - 1) // 2', 'N,M = map(int,input().split())\nprint(N * (N -1) //\u30002 + M * (M - 1) // 2)\n', 'N,M = map(int,input().split())\nprint(N*(N-1)//2+M*(M-1)//2)'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s547065166', 's827080730', 's896422029', 's981405555', 's260517894'] | [2940.0, 2940.0, 2940.0, 3064.0, 2940.0] | [18.0, 17.0, 17.0, 18.0, 18.0] | [141, 146, 73, 75, 59] |
p02729 | u813993459 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\n\nnums = map(int,input().split())\n\nans=0\nfor n in nums:\n ans+=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))\nprint(ans)', 'import math\n\nnums = map(int,input().split())\n\nans=0\nfor n in nums:\n if n<2:\n \tcontinue\n ans+=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s993139195', 's386756326'] | [2940.0, 3060.0] | [17.0, 44.0] | [151, 177] |
p02729 | u819593641 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import itertools\n\nn,m = map(int,input().split())\ncomb = itertools.combinations\nprint(comb(n,2)+comb(m,2))', 'import itertools\n\nn,m = map(int,input().split())\ncomb = lambda x:x*(x-1)/2 if x >= 1 else 0\nprint(int(comb(n)+comb(m)))\n'] | ['Runtime Error', 'Accepted'] | ['s624816999', 's050681237'] | [3060.0, 3060.0] | [17.0, 17.0] | [105, 120] |
p02729 | u819910751 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['from math import factorial\n\nN, M = map(int, input().split())\n\nif N == 0:\n combN = 0\nelse:\n combN = factorial(N) // (factorial(N - 2) * factorial(2))\n\nif M == 0:\n combM = 0\nelse:\n combM = factorial(M) // (factorial(M - 2) * factorial(2))\n\nprint(combN + combM)\n', 'from math import factorial\n\nN, M = map(int, input().split())\n\nif N <= 1:\n combN = 0\nelse:\n combN = factorial(N) // (factorial(N - 2) * factorial(2))\n\nif M <= 1:\n combM = 0\nelse:\n combM = factorial(M) // (factorial(M - 2) * factorial(2))\n\nprint(combN + combM)\n'] | ['Runtime Error', 'Accepted'] | ['s805116877', 's349507350'] | [9188.0, 9020.0] | [27.0, 29.0] | [271, 271] |
p02729 | u821251381 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M=map(int,input().split())\nprint(M//2+N)\n', 'M,N=map(int,input().split())\nprint(M//2+N)', 'M,N=map(int,input().split())\nprint(M*(M-1)//2+N*(N-1)//2)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s006497361', 's317141273', 's421258314'] | [9056.0, 8908.0, 9144.0] | [29.0, 26.0, 31.0] | [43, 42, 58] |
p02729 | u821775079 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M = map(int,input().split())\n\nprint(N*(N-1)/2)', 'N,M = map(int,input().split())\n\nprint(N*(N-1)/2+M*(M-1)/2)', 'N,M = map(int,input().split())\n\nprint(N*(N-1)//2+M*(M-1)//2)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s174817895', 's202327236', 's699739682'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [48, 58, 60] |
p02729 | u823885866 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\n\nprint(N*(N-1)/2 + M*(M-1)/2)', 'import math\n\nN, M = map(int, input().split())\n\nprint(N*(N-1)/2 + M*(M-1)/2)', 'N, M = map(int, input().split())\nif N >= 2 and M >= 2:\n print(N*(N-1)/2 + M*(M-1)/2)\nelif N <= 1:\n print(M*(M-1)/2)\nelse:\n print(N*(N-1)/2)', 'N = int(input())\nM = int(input())\n\nprint(N*(N-1)/2 + M*(M-1)/2)', 'a = list(map(int, input().split()))\nN = a[0]\nM = a[1]\n\nN = N*(N-1)/2\nM = M*(M-1)/2\nprint(N+M)', 'N, M = map(int, input().split())\n\nprint(N*(N-1)/2 + M*(M-1)/2)', 'import sys\nN, M = map(int, sys.stdin.readline().split())\n\nprint(N*(N-1)//2 + M*(M-1)//2)\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s008904912', 's233902837', 's307548007', 's425531130', 's678418954', 's935496812', 's962651993'] | [2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 2940.0, 3064.0] | [17.0, 18.0, 17.0, 17.0, 18.0, 17.0, 17.0] | [62, 75, 142, 63, 93, 62, 89] |
p02729 | u825769322 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m = map(int,input().split())\na = [0]*n\nb = [1]*m\nans = a+b\ncount = 0\nfor i in range(0,n+m):\n for j in range(i+1,n+m):\n if (ans[i]+ans[j])%2==0:\n count += 1\n print(ans[i],ans[j],i,j)\nprint(count)', 'n,m = map(int,input().split())\na = [0]*n\nb = [1]*m\nans = a+b\ncount = 0\nfor i in range(0,n+m):\n for j in range(i+1,n+m):\n if (ans[i]+ans[j])%2==0:\n count += 1\nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s353699983', 's408160122'] | [3664.0, 3060.0] | [39.0, 21.0] | [228, 191] |
p02729 | u827261928 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['def kai(n):\n a=1\n for i in range(1,n+1):\n a=a*i\n return a\n\nN,M=map(int,input().split())\nif N==0 or N==1:\n g=0\nelse:\n g=kai(N)/(kai(N-2)*2)\nif M==0 or M==1:\n k=0\nelse:\n k=kai(M)/(kai(M-2)*2)\nprint(g+k)', 'def kai(n):\n a=1\n for i in range(1,n+1):\n a=a*i\n return a\n\nN,M=map(int,input().split())\nif N==0 or N==1:\n g=0\nelse:\n g=kai(N)/(kai(N-2)*2)\nif M==0 or M==1:\n k=0\nelse:\n k=kai(M)/(kai(M-2)*2)\nprint(g,k)', 'def kai(n):\n a=1\n for i in range(1,n+1):\n a=a*i\n return a\n\nN,M=map(int,input().split())\nif N==0 or N==1:\n g=0\nelse:\n g=kai(N)/(kai(N-2)*2)\nif M==0 or M==1:\n k=0\nelse:\n k=kai(M)/(kai(M-2)*2)\nprint(int(g+k))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s380408141', 's874345189', 's594921097'] | [9136.0, 9204.0, 9188.0] | [28.0, 26.0, 30.0] | [228, 228, 233] |
p02729 | u830881690 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\n\np = n * (n - 1) / 2 + m * (m - 1) / 2\n\nprint(p)', 'n, m = map(int, input().split())\n\nif n = 0:\n pn = 0\n \nif m = 0:\n pm = 0\n\nelse:\n pn = n*(n-1) // 2\n pm = m*(m-1) // 2\n\np = pn + pm\nprint(p)', 'n, m = map(int, input().split())\n\npn = n*(n-1) / 2\npm = m*(m-1) / 2\n\np = pn + pm\nprint(p)', 'n, m = map(int, input().split())\nimport math\npn = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))\npm = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))\nprint(pn + pm)', 'n, m = map(int, input().split())\nimport math\nif n <= 1:\n pn = 0\n if m <= 1:\n pm = 0\n else:\n pm = math.factorial(m) // (math.factorial(m-2) * math.factorial(2))\nelif m >= 2:\n pn = math.factorial(n) // (math.factorial(n-2) * math.factorial(2))\n pm = math.factorial(m) // (math.factorial(m-2) * math.factorial(2))\n\np = pn + pm\nprint(p)', 'n, m = map(int, input().split())\nimport math\npn = math.factorial(n) // (math.factorial(n-2) * math.factorial(2))\npm = math.factorial(m) // (math.factorial(m-2) * math.factorial(2))\np = pn + pm\nprint(p)', 'n, m = map(int, input().split())\n\np = n * (n - 1) // 2 + m * (m - 1) // 2\n\nprint(p)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s363911785', 's605996123', 's718171350', 's726037197', 's770458875', 's948032825', 's732452164'] | [2940.0, 2940.0, 2940.0, 3060.0, 3060.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 19.0, 17.0, 17.0, 17.0] | [81, 143, 89, 193, 343, 201, 83] |
p02729 | u831752983 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['def cmb(n,k):\n x,y=n,k\n for i in range(1,k):\n x*=n-i\n y*=k-i\n return x//y\n\nn,m=[int(x) for x in input().split()]\nN=cmb(m,2) if n>=2 else 0\nM=cmb(n,2) if m>=2 eles 0\nprint(N+M)', 'def cmb(n,k):\n x,y=n,k\n for i in range(1,k):\n x*=n-i\n y*=k-i\n return x//y\n\nn,m=[int(x) for x in input().split()]\nN=cmb(n,2) if n>=2 else 0\nM=cmb(m,2) if m>=2 else 0\nprint(N+M)\n'] | ['Runtime Error', 'Accepted'] | ['s969075386', 's287257821'] | [3064.0, 3060.0] | [17.0, 17.0] | [184, 185] |
p02729 | u834120237 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import sys\ninput = sys.stdin.readline\n\nN, M = map(int, input().split())\n\nprint(N*(N-1) + M*(M-1))', 'import sys\ninput = sys.stdin.readline\n\nN, M = map(int, input().split())\n\nprint((N*(N-1) + M*(M-1))//2)'] | ['Wrong Answer', 'Accepted'] | ['s040336775', 's329799084'] | [2940.0, 2940.0] | [17.0, 17.0] | [97, 102] |
p02729 | u837340160 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\n\nprint(N(N - 1) // 2 + M(M - 1) // 2)\n', 'N, M = map(int, input().split())\n\nprint(N * (N - 1) // 2 + M * (M - 1) // 2)\n'] | ['Runtime Error', 'Accepted'] | ['s193391695', 's521416835'] | [2940.0, 2940.0] | [17.0, 17.0] | [71, 77] |
p02729 | u837673618 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input())\nprint(N*(N-1)//2+M*(M-1)//2)\n', 'N, M = input()\nprint(N*(N-1)//2+M*(M-1)//2)', 'N, M = map(int, input().split())\nprint(N*(N-1)//2+M*(M-1)//2)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s223876196', 's703898233', 's679020831'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [54, 43, 62] |
p02729 | u840958781 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['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\nn,m=map(int,input().split())\nif n<2 and m<2:\n print(0)\n quit()\nif n==0:\n print(cmb(m,2))\n quit()\nelif m==0:\n print(cmb(n,2))\n quit()\nprint(cmb(n,2)+cmb(m,2))', 'n,m=map(int,input().split())\nprint((n*(n-1))//2+(m*(m-1))//2)'] | ['Runtime Error', 'Accepted'] | ['s619769605', 's136441002'] | [3572.0, 2940.0] | [23.0, 17.0] | [396, 61] |
p02729 | u841599623 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['A,B=map(int, input().split())\nimport math\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nprint(comb(A,2)+comb(B,2))', 'A,B=map(int, input().split())\nimport math\ndef comb(n, r):\n if n < 2:\n return 0\n else:\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nprint(comb(A,2)+comb(B,2))'] | ['Runtime Error', 'Accepted'] | ['s789534894', 's094913973'] | [2940.0, 3060.0] | [18.0, 17.0] | [160, 193] |
p02729 | u843830192 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = input().split()\n\n\nprint(N*(N-1)/2 + M*(M-1)/2)', 'N, M = list(map(int, input().split()))\n\nsum = 0\n\nif N > 0:\n sum += N*(N-1)/2\n\nif M > 0:\n sum += M*(M-1)/2\n\nprint(int(sum))'] | ['Runtime Error', 'Accepted'] | ['s781004340', 's273796656'] | [2940.0, 2940.0] | [17.0, 17.0] | [53, 128] |
p02729 | u845148770 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nN,M = map(int, input().split())\n\nif(N == 1 and M == 1):\n\tans = 0\nelif(N != 0 and M != 0): \n\tans = combinations_count(N, 2)\n\tans += combinations_count(M, 2)\nelif(N == 1 and M != 1):\n ans = combinations_count(M, 2)\nelif(N != 1 and M == 1):\n ans = combinations_count(N, 2)\nelif(N == 1 and M ==1 ):\n ans = 0\nelif(N == 0 and M != 0):\n ans = combinations_count(M, 2)\nelif(N != 0 and M == 0):\n ans = combinations_count(N, 2)\n \nprint(ans)\n', 'N,M = map(int, input().split())\n\nansA = 0\n\nif N < 2 and M < 2:\n ansA = 0\nif N >=2:\n ansA += ((N * (N-1)) / 2)\nif M >= 2:\n ansA += ((M * (M-1)) / 2)\n\nprint(int(ansA))'] | ['Runtime Error', 'Accepted'] | ['s598102678', 's184724898'] | [3064.0, 3060.0] | [18.0, 17.0] | [557, 174] |
p02729 | u845847173 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\nans = 0\nans += N * (N - 1) / 2\nans += M * (M - 1) / 2\nprint(ans)', 'N, M = map(int, input().split())\nans = 0\nans += (N * (N - 1)) // 2\nans += (M * (M - 1)) // 2\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s847489927', 's821918900'] | [2940.0, 2940.0] | [17.0, 17.0] | [97, 103] |
p02729 | u845937249 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['\nimport sys\nimport os\nif sys.platform=="darwin":\n\tbase = os.path.dirname(os.path.abspath(__file__))\n\tname = os.path.normpath(os.path.join(base, \'../atcoder/input.txt\'))\n\t#print(name)\n\tsys.stdin = open(name)\n\nfrom math import factorial\n\ndef combinations_count(n,r):\n if n <= r:\n return 0\n else:\n return factorial(n) // ( factorial(n-r) * factorial(r))\n\nn,m = map(int,input().split())\n\n#print(combinations_count(n,2))\n#print(combinations_count(m,2))\n\nprint(combinations_count(n,2) + combinations_count(m,2))\n\n\n\n\n', '\nimport sys\nimport os\nif sys.platform=="darwin":\n\tbase = os.path.dirname(os.path.abspath(__file__))\n\tname = os.path.normpath(os.path.join(base, \'../atcoder/input.txt\'))\n\t#print(name)\n\tsys.stdin = open(name)\n\nfrom math import factorial\n\ndef combinations_count(n,r):\n if n < r:\n return 0\n else:\n return factorial(n) // ( factorial(n-r) * factorial(r))\n\nn,m = map(int,input().split())\n\n#print(combinations_count(n,2))\n#print(combinations_count(m,2))\n\n#print(factorial(0))\n\nprint(combinations_count(n,2) + combinations_count(m,2))\n\n\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s619430232', 's770168086'] | [9184.0, 9188.0] | [29.0, 28.0] | [552, 573] |
p02729 | u846385882 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["s=list(input())\n#s=['l','e','l','v','l','e','l']\nL=int((len(s)-1)/2)\nf1=0\nfor i in range(L):\n# print(s[0+i])\n # print(s[len(s)-i-1])\n if s[0+i]==s[len(s)-i-1]:\n pass\n # print('here1')\n else:\n f1+=1\n # print('here2')\n \nLL=L//2\nf2=0\nif f1==0:\n for j in range(LL):\n # print(s[0+j])\n \n if s[0+j]==s[L-j-1]:\n pass\n # print('here3')\n else:\n f2+=1\n # print('here4')\nelse:\n f2=1\nif f1==0 and f2==0:\n print('Yes')\nelse:\n print('No')\n", 'N,M= map(int,input().split())\n\nK=(N+M)*(N+M-1)/2-N*M\nprint(K)', 'N,M= map(int,input().split())\nK=(N+M)*(N+M-1)/2-N*M\nprint(int(K))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s081314644', 's847213043', 's513562353'] | [3064.0, 3060.0, 2940.0] | [17.0, 19.0, 18.0] | [565, 61, 65] |
p02729 | u846652026 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m=map(int, input().split())\n\nprint(n*(n-1)/2+m*(m-1)/2)', 'n,m=map(int, input().split())\n\nprint(int(n*(n-1)/2+m*(m-1)/2))\n'] | ['Wrong Answer', 'Accepted'] | ['s469724013', 's801557715'] | [2940.0, 2940.0] | [19.0, 17.0] | [57, 63] |
p02729 | u849229491 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M=map(int,input().split())\na=N*(N-1)/2\nb=M*(M-1)/2\nif N<1.5 and M>1.5:\n print(int(b))\nelif M<1.5 and N>1.5:\n print(a)\nelif N<1.5 and N<1.5:\n print(int(0))\nelse:\n print(int(a+b))', 'N,M=map(int,input().split())\na=N*(N-1)/2\nb=M*(M-1)/2\nprint(int(a+b))'] | ['Wrong Answer', 'Accepted'] | ['s947738252', 's748269935'] | [3064.0, 2940.0] | [17.0, 17.0] | [191, 68] |
p02729 | u849756457 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['\nN, M = map(int, readline().split())\n\nprint(N * (N - 1) / 2 + M * (M - 1) /2)', 'N, M = map(int, input().split())\n \nprint(int(N * (N - 1) / 2 + M * (M - 1) /2))'] | ['Runtime Error', 'Accepted'] | ['s598749154', 's024263465'] | [9088.0, 9160.0] | [22.0, 25.0] | [77, 79] |
p02729 | u853064660 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\n\nX = (N * (N-1) / 2) + (M * (M-1) / 2)\n\nprint(X)', 'N, M = map(int, input().split())\n\nX = int((N * (N-1) / 2) + (M * (M-1) / 2))\n\nprint(X)'] | ['Wrong Answer', 'Accepted'] | ['s521192446', 's035498389'] | [2940.0, 2940.0] | [18.0, 17.0] | [81, 86] |
p02729 | u853728588 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\n\neven = n * (n-1)/2\nodd = m * (m-1)/2\n\nprint(even + odd)\n', 'N, M = map(int, input().split())\n\na = N * (N - 1)/2\nb = M * (M - 1)/2\n\nprint(a + b)', 'n, m = map(int, input().split())\n \neven = n * (n-1)/2\nodd = m * (m-1)/2\n \nprint(int(even + odd))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s154316261', 's756302980', 's702194395'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [90, 83, 96] |
p02729 | u854612823 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m = map(int,input().split())\n\nn1 = n*(n-1)/2\n\nm1 = m*(m-1)/2\n##print\nprint(n1 + m1)\n', 'n,m = map(int,input().split())\n\nn1 = n*(n-1)/2\n\nm1 = m*(m-1)/2\n##print\nans = int(n1 + m1)\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s328629204', 's001231451'] | [2940.0, 2940.0] | [19.0, 17.0] | [126, 141] |
p02729 | u856282038 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N = int(input())\nM = int(input())\na = N*(N-1)//2 + M*(M-1)//2\nprint(a)', 'N,M = map(int,input().split())\nprint(N*(N-1)//2 + M*(M-1)//2)'] | ['Runtime Error', 'Accepted'] | ['s222118482', 's378036418'] | [2940.0, 2940.0] | [17.0, 17.0] | [70, 61] |
p02729 | u857673087 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\n\nprint(N*(N-1)+M*(M-1))', 'N, M = map(int, input().split())\n \nprint((N*(N-1)+M*(M-1))//2)'] | ['Wrong Answer', 'Accepted'] | ['s599541803', 's144470453'] | [2940.0, 2940.0] | [17.0, 17.0] | [56, 62] |
p02729 | u858464419 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\nprint((n*(n-1) + m*(m-1))/2)', 'n, m = map(int, input().split())\nprint(round((n*(n-1) + m*(m-1))/2))\n'] | ['Wrong Answer', 'Accepted'] | ['s831183087', 's928042624'] | [2940.0, 2940.0] | [17.0, 17.0] | [61, 69] |
p02729 | u860657719 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['def main():\n import numpy as np\n inf = 100100100\n ans = inf\n H, W, K = map(int, input().split())\n S = []\n for _ in range(H):\n S.append([int(x) for x in input()])\n S = np.array(S)\n for i in range(2**(H-1)):\n group = [0]\n g = 0\n for j in range(H-1):\n if (i >> j) & 1:\n g += 1\n group.append(g)\n group = np.array(group)\n g += 1\n c = np.array([[0]*W]*g)\n for j in range(H):\n for k in range(W):\n c[group[j],k] += S[j,k]\n num = g-1\n now = np.zeros(g)\n def large(now):\n for n in now:\n if n > K:\n return True\n else:\n return False\n for k in range(W):\n now += c[:,k]\n if large(now):\n now = c[:,k]\n num += 1\n if large(now):\n num = inf\n break\n ans = min(ans, num)\n print(ans)\nmain()\n', 'N, M = map(int, input().split())\nprint(int(N*(N-1)/2) + int(M*(M-1)/2))\n'] | ['Runtime Error', 'Accepted'] | ['s694312385', 's228701326'] | [12508.0, 2940.0] | [150.0, 17.0] | [1027, 72] |
p02729 | u860966226 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['data = input().split()\n\na = int(data[0])\nb = int(data[1])\n\nprint(a*(a-1)/2+b*(b-1)/2)\n', 'data = input().split()\n \na = int(data[0])\nb = int(data[1])\nans = (a*(a-1)+b*(b-1))/2\nprint(int(ans))\n'] | ['Wrong Answer', 'Accepted'] | ['s962835021', 's735037922'] | [2940.0, 2940.0] | [17.0, 18.0] | [86, 101] |
p02729 | u861469253 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["A = list(map(int, input().strip().split(' ')))\nans = A[0] * (A[0] - 1) + A[1] * (A[1] - 1)\nprint(ans)", "A = list(map(int, input().strip().split(' ')))\nans = (A[0] * (A[0] - 1)) / 2 + ((A[1] * (A[1] - 1)) / 2)\nprint(ans)", "A = list(map(int, input().strip().split(' ')))\nans = (A[0] * (A[0] - 1)) // 2 + ((A[1] * (A[1] - 1)) // 2)\nprint(ans)"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s176321772', 's978621277', 's958170599'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0] | [101, 115, 117] |
p02729 | u863150907 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['\n\nN,M = map(int,input().split())\n\nans = 0\n# even + even\nif N>0:\n\tans += N*(N-1)/2\n\nif M>0:\n\tans += M*(M-1)/2\n\nprint(ans)', '\n\nN,M = map(int,input().split())\n\nans = 0\n# even + even\nif N>0:\n\tans += N*(N-1)/2\n\nif M>0:\n\tans += M*(M-1)/2\n\nprint(int(ans))\n'] | ['Wrong Answer', 'Accepted'] | ['s748154464', 's123445464'] | [2940.0, 2940.0] | [17.0, 17.0] | [154, 160] |
p02729 | u864989756 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nN,M = map(int, input().split())\n\nprint(combinations_count(N, 2)+combinations_count(M, 2))', 'N,M = map(int, input().split())\nans = N*(N-1)//2 + M*(M-1)//2\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s471840965', 's619780530'] | [3056.0, 2940.0] | [17.0, 17.0] | [209, 72] |
p02729 | u865222833 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["def tmp(n):\n return n * (n - 1) / 2\n\n\ndef main():\n line = input().strip()\n n, m = [int(v) for v in line.split(' ')]\n\n ans_n = tmp(n) if n > 1 else 0\n ans_m = tmp(m) if m > 1 else 0\n ans = ans_n + ans_m\n print(ans)\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n line = input().strip()\n n, m = [int(v) for line.split(' ')]\n\n ans_n = n * (n - 1) if n > 1 else 0\n ans_m = m * (m - 1) if m > 1 else 0\n ans = ans_n + ans_m\n return ans\n\n\nif __name__ == '__main__':\n main()\n", "def main():\n line = input().strip()\n n, m = [int(v) for v in line.split(' ')]\n\n ans_n = n * (n - 1) if n > 1 else 0\n ans_m = m * (m - 1) if m > 1 else 0\n ans = ans_n + ans_m\n return ans\n\n\nif __name__ == '__main__':\n main()\n", "def tmp(n):\n return n * (n - 1) / 2\n\n\ndef main():\n line = input().strip()\n n, m = [int(v) for v in line.split(' ')]\n\n ans_n = tmp(n) if n > 1 else 0\n ans_m = tmp(m) if m > 1 else 0\n ans = ans_n + ans_m\n print(int(ans))\n\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s252046056', 's653011929', 's689231567', 's972607182'] | [3060.0, 2940.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0, 17.0] | [275, 239, 244, 280] |
p02729 | u867616076 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m = map(int,input().split())\nans = 0\nif(n >= 2):\n ans += n*(n-1)/2\nif(m >= 2):\n ans += m*(m-1)/2\nprint(ans)\n', 'n,m = map(int,raw_input().split())\nans = 0\nif(n >= 2):\n ans += n*(n-1)//2\n \nif(m >= 2):\n ans += m*(m-1)//2\nprint(ans)\n', 'n,m = map(int,input().split())\nans = 0\nif(n >= 2):\n ans += n*(n-1)/2\n \nif(m >= 2):\n ans += m*(m-1)/2\nprint(ans)\n', 'n,m = map(int,input().split())\nans = 0\nif(n >= 2):\n ans += n*(n-1)//2\n \nif(m >= 2):\n ans += m*(m-1)//2\nprint(ans)\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s126143649', 's132089927', 's792465248', 's757670282'] | [9020.0, 9028.0, 9044.0, 9160.0] | [26.0, 27.0, 26.0, 29.0] | [116, 127, 121, 123] |
p02729 | u867826040 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\nn,m = map(int,input().split())\nprint(((math.factorial(n) // math.factorial(n - 2))//2)+ ((math.factorial(m) // math.factorial(m - 2))//2))', 'import itertools\nn,m = map(int,input().split())\no = 0\no += len(list(itertools.permutations([i for i in range(n)], 2)))/2\no += len(list(itertools.permutations([i for i in range(m)], 2)))/2\nprint(int(o))'] | ['Runtime Error', 'Accepted'] | ['s832729069', 's748821813'] | [3060.0, 3700.0] | [18.0, 19.0] | [150, 201] |
p02729 | u873736356 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\n\na = N * (N-1) / 2\nb = M * (M-1) / 2\nprint(a+b)\n', 'N, M = map(int, input().split())\n\na = N * (N-1) // 2\nb = M * (M-1) // 2\nprint(a+b)\n'] | ['Wrong Answer', 'Accepted'] | ['s080357138', 's379387183'] | [2940.0, 2940.0] | [18.0, 17.0] | [81, 83] |
p02729 | u873839198 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['a = list(map(int, input().split()))\n\nb = a[0] * a[0]-1 / 2 + a[1] * a[1] -1 / 2\n\nprint(b)', 'a = list(map(int, input().split()))\n\nb = a[0] * (a[0] - 1) // 2 + a[1] * (a[1] - 1) // 2\n\nprint(b)'] | ['Wrong Answer', 'Accepted'] | ['s027554740', 's095494997'] | [2940.0, 2940.0] | [18.0, 18.0] | [89, 98] |
p02729 | u875449556 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['S = input()\nN = len(S)\na = S[1:int((N-1)/2+1)]\nb = S[int((N+3)/2):]\n\ndef kaibun(l):\n for i in range(len(l)):\n if l[i] != l[-i]:\n return(False)\n return(True)\n\nif kaibun(S) & kaibun(a) & kaibun(b):\n print("Yes")\nelse:\n print("No")\n ', 'N,M = map(int, input().split())\nprint((N*(N-1)/2)+(M*(M-1)/2))', 'S = input()\nN = len(S)\na = S[1:(N-1)//2+1]\nb = S[(N+3)//2:]\n\ndef kaibun(l):\n for i in range(len(l)):\n if l[i] != l[len(l)-1-i]:\n return(False)\n return(True)\n\nprint(kaibun("abccba"))\n\nif kaibun(S) & kaibun(a) & kaibun(b):\n print("Yes")\nelse:\n print("No")\n ', 'S = input()\nN = len(S)\na = S[1:(N-1)//2+1]\nb = S[(N+3)//2:]\n\ndef kaibun(l):\n for i in range(len(l)):\n if l[i] != l[len(l)-1-i]:\n return(False)\n return(True)\n\nif kaibun(S) & kaibun(a) & kaibun(b):\n print("Yes")\nelse:\n print("No")\n ', 'N = int(input())\nL = list(map(int, input().split()))\n\nfrom collections import Counter\n\nc = Counter(L)\nd = {}\nsum = 0\n\nfor i in c:\n k = c(i)\n sum += k * (k-1) //2\nfor i in range(N):\n print(int(sum - c[L[i]] + 1))', 'N = int(input())\nL = list(map(int, input().split()))\n\nfrom collections import Counter\n\nc = Counter(L)\nd = {}\nsum = 0\n\nfor i in c:\n k = c[i]\n sum += k * (k-1) //2\nfor i in range(N):\n print(int(sum - c[L[i]] + 1))', 'S = input()\nN = len(S)\na = S[1:(N-1)//2]\nb = S[(N+3)//2:]\n\ndef kaibun(l):\n for i in range(len(l)):\n if l[i] != l[len(l)-1-i]:\n return(False)\n return(True)\n\nprint(kaibun(S))\nprint(kaibun(a))\nprint(kaibun(b))\n \nif kaibun(S) & kaibun(a) & kaibun(b):\n print("Yes")\nelse:\n print("No")\n ', 'N,M = map(int, input().split())\nprint(int(N*(N-1)/2)+int(M*(M-1)/2))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s135791724', 's244301791', 's327135011', 's395131511', 's565142531', 's664518189', 's775218154', 's062139684'] | [3064.0, 2940.0, 3064.0, 3060.0, 3064.0, 3060.0, 3064.0, 2940.0] | [18.0, 17.0, 17.0, 18.0, 17.0, 17.0, 17.0, 17.0] | [271, 62, 296, 271, 220, 220, 323, 68] |
p02729 | u877428733 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\n\nN = int(input())\nM = int(input())\n\n\ndef combinations_count(n, r):\n if n <= 1:\n return 0\n else:\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn = combinations_count(N, 2)\nm = combinations_count(M, 2)\n\nprint(n+m)', 'import math\n\nN,M = map(int,input().split())\n\n\n\ndef combinations_count(n, r):\n if n <= 1:\n return 0\n else:\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn = combinations_count(N, 2)\nm = combinations_count(M, 2)\n\nprint(n+m)'] | ['Runtime Error', 'Accepted'] | ['s231312954', 's446336097'] | [3060.0, 3060.0] | [17.0, 18.0] | [271, 269] |
p02729 | u878212264 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['integer = int(input().split())\nconbi = ((integer[0] * (integer[0] - 1) + integer[1] * (integer[1] -1 )) / 2\nprint(conbi)', 's = input()\nn = len(s)\nnum = int((n-1)/2)-1\nfor i in range(num):\n if s[i] != s[n-1-i]:\n print("No")\n exit()\n \nnum = int(num /2 -1)\nfor i in range(num):\n if s[i] != s[n-1-i]:\n print("No")\n exit()\n\nnum = int(len(s) * 0.5 - 1.5)\nindex = int((n + 3) /2 -1 )\nfor i in range(num):\n if s[index+i] != s[n-1-i]:\n print("No")\n exit()\n \n \nprint("Yes")\n\n \n\n \n ', 'integer = int(input().split())\nconbi = (integer[0] * (integer[0] - 1) + integer[1] * (integer[1] -1 )) / 2\nprint(conbi)', 'integer = list(map(int, input().split())) \nconbi = (integer[0] * (integer[0] - 1) + integer[1] * (integer[1] -1 ) ) / 2\nprint(int(conbi))'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s007251772', 's363857432', 's441156673', 's628894418'] | [2940.0, 3064.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [120, 384, 119, 137] |
p02729 | u878291720 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\n\nprint(N*(N-1)/2 + M*(M-1)/2)', 'N, M = map(int, input().split())\ns = int(N*(N-1)/2 + M*(M-1)/2)\nprint(s)'] | ['Wrong Answer', 'Accepted'] | ['s065929968', 's511416796'] | [2940.0, 2940.0] | [17.0, 17.0] | [62, 72] |
p02729 | u878545651 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["def main():\n N, M = map(int, input().split())\n\n e = N*(N-1)/2\n o = M*(M-1)/2\n\n ans = int(e + o)\n print(e, o, ans)\n\n\nif __name__ == '__main__':\n main()", "def main():\n N, M = map(int, input().split())\n\n e = N*(N-1)/2\n o = M*(M-1)/2\n\n ans = int(e + o)\n print(ans)\n\n\nif __name__ == '__main__':\n main()"] | ['Wrong Answer', 'Accepted'] | ['s212682204', 's813969494'] | [9136.0, 9076.0] | [26.0, 27.0] | [168, 162] |
p02729 | u881116515 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['a,b = map(int,input().split())\nprint(a*(a-1)/2+b*(b-1)/2)', 'a,b = map(int,input().split())\nprint(a*(a-1)//2+b*(b-1)//2)\n'] | ['Wrong Answer', 'Accepted'] | ['s991041125', 's203531701'] | [2940.0, 2940.0] | [17.0, 18.0] | [57, 60] |
p02729 | u883307604 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['def combination(n, k):\n\treturn fact(n) / ( fact(n-k) * fact(k) )\n\ndef fact(n):\n\tif n < 0:\n\t\treturn 0\n\tif n == 0:\n\t\treturn 1\n\tif n == 1:\n\t\treturn 1\n\treturn fact(n-1)\n\nn, m = [int(x) for x in input().split()]\nanswer = combination(n, 2) + combination(m, 2)\nprint(answer)', 'def fact(n):\n if n < 0:\n return 0\n if n == 0:\n return 1\n if n == 1:\n return 1\n return fact(n-1)\n\ndef combination(n, k):\n if n < k:\n return 0\n return fact(n) / ( fact(n-k) * fact(k))\n\nn, m = [int(x) for x in input().split()]\nanswer = combination(n, 2) + combination(m, 2)\nprint(answer)', 'def fact(n):\n if n < 0:\n return 0\n if n == 0:\n return 1\n if n == 1:\n return 1\n return n * fact(n-1)\n\ndef combination(n, k):\n if n < k:\n return 0\n return fact(n) / ( fact(n-k) * fact(k))\n\nn, m = [int(x) for x in input().split()]\nanswer = int(combination(n, 2) + combination(m, 2))\nprint(answer)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s144649502', 's938960563', 's704438938'] | [3060.0, 3064.0, 3060.0] | [17.0, 17.0, 17.0] | [267, 330, 339] |
p02729 | u884582911 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\n\ndef comb(n, r):\n if r >= n:\n return 0\n else: \n return math.factorial(n) // (math.factorial(r)*math.factorial(n - r))\n \nn, m = map(int, input().split())\nprint(int(comb(n,2) + comb(m,2)))', 'import math\ndef permutations_count(n, r):\n return math.factorial(n) // math.factorial(n - r)\n \nm, n = map(int, input().split())\nprint(permutations_count(m,2)+permutations_count(n,2))', 'def comb(n, r):\n if r > n:\n return 0\n else: \n return math.factorial(n)*math.factorial(r) // math.factorial(n - r)\n \nm, n = map(int, input().split())\nprint(int(comb(m,2) + comb(n,2)))', 'def comb(n, r):\n if r >= n:\n return 0\n else: \n return math.factorial(n) // (math.factorial(r)*math.factorial(n - r))\n \nn, m = map(int, input().split())\nprint(int(comb(n,2) + comb(m,2)))', 'n, m = map(int, input().split())\nprint(int(n*(n-1)//2 + m*(m-1)//2))'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s000402024', 's134659775', 's705016715', 's926597364', 's173292071'] | [3060.0, 2940.0, 3056.0, 3060.0, 2940.0] | [18.0, 19.0, 17.0, 19.0, 17.0] | [226, 186, 210, 213, 68] |
p02729 | u884601206 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["n=list(input())\ndef kaibun(l):\n flg=False\n for i in range(int((len(l)-1)/2)):\n \n if l[i] != l[len(l)-1-i]:\n flg=True\n return(int(flg))\n\nc=kaibun(n)\nm=n[:int((len(n)-1)/2)]\nd=kaibun(m)\np=n[int((len(n)+1)/2):]\ne=kaibun(p)\nif c+d+e == 0:\n print('Yes')\nelse:\n print('No')\n ", 'n, m = map(int,input().split())\nif n==0:\n c=m*(m-1)\nelif m==0:\n c=n*(n-1)\nelse:\n c=n*(n-1)+m*(m-1)\n\nprint(c)\n', "n=list(input())\ndef kaibun(l):\n flg=False\n for i in range(int((len(l)-1)/2)):\n \n if l[i] != l[len(l)-1-i]:\n flg=True\n return(int(flg))\n\nc=kaibun(n)\nm=n[:int((len(n)-1)/2)]\nd=kaibun(m)\np=n[int((len(n)+1)/2):]\ne=kaibun(p)\nif c+d+e == 0:\n print('Yes')\nelse:\n print('No')\n ", 'n, m = map(int,input().split())\nif n==0:\n c=m*(m-1)/2\nelif m==0:\n c=n*(n-1)/2\nelse:\n c=n*(n-1)/2+m*(m-1)/2\n\nprint(int(c))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s665412978', 's805493145', 's824386164', 's435704628'] | [3064.0, 2940.0, 3064.0, 2940.0] | [17.0, 17.0, 19.0, 17.0] | [285, 112, 285, 125] |
p02729 | u886861641 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | [' nm = [int(i) for i in input().split()]\n 2\n 3 result = (nm[0] * (nm[0] - 1)) // 2\n 4 result += (nm[1] * (nm[1] - 1)) // 2\n 5\n 6 print(result)', 'nm = [int(i) for i in input().split()]\n\nresult = (nm[0] * (nm[0] - 1)) // 2\nresult += (nm[1] * (nm[1] - 1)) // 2\n\nprint(result)'] | ['Runtime Error', 'Accepted'] | ['s528185568', 's207304040'] | [2940.0, 2940.0] | [17.0, 17.0] | [146, 127] |
p02729 | u886878171 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M = input().split()\nresult = int(N*(N-1)/2) + int(M*(M-1)/2)\nprint(result)', 'ab = input().split()\na,b = int(ab[0]), int(ab[1])\nresult = a*(a-1)//2 + b*(b-1)//2\nprint(result)'] | ['Runtime Error', 'Accepted'] | ['s830105887', 's485357794'] | [2940.0, 2940.0] | [17.0, 17.0] | [76, 96] |
p02729 | u888933875 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\nprint(N*(N-1)/2 + M*(M-1)/2))\n', 'N, M = map(int, input().split())\nprint(N*(N-1)//2 + M*(M-1)//2))', 'N, M = map(int, input().split())\nprint(N*(N-1)/2 + M*(M-1)/2)', 'test', 'N, M = map(int, input().split())\nprint(N*(N-1)/2 + M*(M-1)/2))', 'N, M = map(int, input().split())\nprint(N*(N-1)//2 + M*(M-1)//2)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s352920545', 's372054040', 's401550578', 's608532149', 's761527845', 's887624549'] | [8956.0, 8976.0, 9152.0, 9132.0, 9032.0, 9140.0] | [23.0, 25.0, 27.0, 22.0, 23.0, 27.0] | [63, 64, 61, 4, 62, 63] |
p02729 | u889390649 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["def is_kaibunn(str): return 1 if str == str[::-1] else 0\nword_front = input()\nflag = 0\nnum = len(word)\nword_back = word_front\nwhile num > 1:\n if is_kaibunn(word_front) and is_kaibunn(word_back):\n flag = 1\n else:\n flag = 0\n break;\n \n if num%2 == 1:\n num_flag = 1\n else:\n num_flag = 0\n num = int(num/2)\n if num_flag == 1:\n word_front = word_front[0:num]\n word_back = word_back[num+1:]\n else:\n word_front = word_front[0:num]\n word_back = word_back[num:] \nif flag:\n print('Yes')\nelse:\n print('No')\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\n\neven,odd = map(int,input().split())\nif even != 1 or odd != 1:\n numa = cmb(even,2)\n numb = cmb(odd,2)\n if even == 1 or even == 0:\n numa = 0\n if odd == 1 or odd == 0:\n numb = 0\n print(numa+numb)\nelse:\n print(0)\n\n\n\n'] | ['Runtime Error', 'Accepted'] | ['s464955171', 's390903528'] | [3064.0, 3064.0] | [18.0, 17.0] | [593, 801] |
p02729 | u889695981 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m = map(int,input().split())\nprint(n*(n-1)+m*(m-1))', 'n,m = map(int,input().split())\nx=(n*(n-1))//2\ny=(m*(m-1))//2\nprint(x+y)'] | ['Wrong Answer', 'Accepted'] | ['s815283410', 's426697654'] | [2940.0, 2940.0] | [17.0, 17.0] | [53, 71] |
p02729 | u891202624 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['S=list(input())\ncountA=0\ncountB=0\nfor i in range(3):\n if S[i]=="A":\n countA+=1\n else:\n countB+=1\nif countA!=0 and countB!=0:\n print("Yes")\nelse:\n print("No") ', 'N,M=map(int,(input().split()))\nprint(int(N*(N-1)/2+M*(M-1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s642648374', 's623039925'] | [8948.0, 9160.0] | [27.0, 29.0] | [187, 62] |
p02729 | u894521144 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import collections\nimport math\n\n#****************************************************************\ndef comb(n):\n if n < 2:\n return 0\n else:\n return math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))\n#****************************************************************\n\nN = int(input())\nA = list(map(int, input().split()))\n\nc = collections.Counter(A)\ndict_ans = {i:0 for i in c.keys()}\nfull_ans = sum(list(map(comb, c.values())))\n\nfor i in c.keys():\n target = c.copy()\n target[i] -= 1\n if target[i] == 0:\n dict_ans[i] = full_ans\n else:\n dict_ans[i] = sum(list(map(comb, target.values())))\n\nfor i in A:\n print(dict_ans[i])\n', "N, M = list(map(int, input().split(' ')))\n\nans = int((N + M) * (N + M - 1) / 2 - N * M)\nprint(ans)\n"] | ['Runtime Error', 'Accepted'] | ['s575060697', 's286637278'] | [3444.0, 2940.0] | [23.0, 17.0] | [680, 99] |
p02729 | u898109279 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\n\ng = 0 if N < 2 else (N * N - 1) / 2\nk = 0 if M < 2 else (M * M - 1) / 2\n\nprint(g + k)', 'N, M = map(int, input().split())\n \ng = 0 if N < 2 else (N * (N - 1)) / 2\nk = 0 if M < 2 else (M * (M - 1)) / 2\n \nprint(int(g + k))'] | ['Wrong Answer', 'Accepted'] | ['s060967772', 's543722246'] | [9032.0, 9112.0] | [29.0, 25.0] | [119, 130] |
p02729 | u901060001 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = (int(x) for x in input().split())\nA = N * (N - 1) / 2\nB = M * (M - 1) / 2\nprint(A+B)', 'N, M = (int(x) for x in input().split())\nA = N * (N-1)/2 + M*(M-1)/2\nprint(A)', 'N, M = (int(x) for x in input().split())\nA = N * (N - 1) / 2\nB = M * (M - 1) / 2\nprint(int(A+B))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s304109613', 's970492960', 's582314340'] | [2940.0, 2940.0, 2940.0] | [27.0, 17.0, 17.0] | [91, 77, 97] |
p02729 | u905220966 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["n,m=map(int,input().split())\nif m%2:\n\tprint('0')\nelse\t:\n\tprint('1')", 'n,m=map(int,input().split())\nprint((n*(n-1))//2 + (m*(m-1))//2)'] | ['Wrong Answer', 'Accepted'] | ['s563679660', 's170448661'] | [2940.0, 2940.0] | [17.0, 19.0] | [67, 63] |
p02729 | u907403674 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['a= str(input())\nkaibun = list(a)\nn = int(len(kaibun))\nanswer = "No"\nstrongn1 = int((n-1)/2)\nstrongn2 = int((n+3)/2)\nfor i in reversed(range((int((n+1)/2)),n)):\n if kaibun[i] == kaibun[n-i-1]:\n answer = "Yes"\n else:\n answer = "No"\n break;\nif answer == "Yes":\n for i in range(int(strongn1/2)):\n if kaibun[i] == kaibun[strongn1-i-1]:\n answer = "Yes"\n else:\n answer="No"\n break;\nif answer =="Yes":\n for i in reversed(range(strongn2,(n-strongn2)//2)):\n if kaibun[i] == kaibun[strongn2-2-i+n]:\n answer = "Yes"\n else:\n answer = "No"\nprint(answer)\n', 'm,n = map(int,input().split())\na=(m*(m-1))/2+(n*(n-1))/2\nprint(int(a))'] | ['Wrong Answer', 'Accepted'] | ['s543923280', 's895972377'] | [3064.0, 2940.0] | [18.0, 18.0] | [656, 70] |
p02729 | u907414670 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\ndef combinations(n ,r):\n return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))\nn, m = map(int, input().split())\nprint(combinations(n, 2) + combinations(m , 2))', 'n, m = map(int, input().split())\nprint(n*(n-1)//2 + m*(m-1)//2)'] | ['Runtime Error', 'Accepted'] | ['s959147838', 's202355208'] | [3060.0, 2940.0] | [19.0, 17.0] | [190, 63] |
p02729 | u907446975 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['l = int(input())\nprint((l / 3) ** 3)', 'n,m=map(int,input().split())\n# print((n*m)-m)\nn=n-1\nm=m-1\nprint((n*(n+1))//2+(m*(m+1))//2)\n'] | ['Runtime Error', 'Accepted'] | ['s493260328', 's964083766'] | [2940.0, 2940.0] | [18.0, 18.0] | [36, 91] |
p02729 | u909616675 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['def cmb(n):\n\tif n<=1:\n\t\treturn 0\n\telse:\n\t\treturn int(n*(n-1)*0.5)\nN = int(input())\nA = [int(x) for x in input().split()]\nans=[0]*N\nlists={}\nk=0\nfor i in range(N):\n if not A[i] in lists:\n l=cmb(A.count(A[i]))\n m=cmb(A.count(A[i])-1)-l\n k+=l\n lists[A[i]]=m\n ans[i]=m\n else:\n ans[i]=lists[A[i]]\n \nfor i in range(N):\n ans[i]+=k\n print(ans[i])', 'a,b=map(int,input().split())\nans=0\nif a>=2:\n ans+=a*(a-1)*0.5\nif b>=2:\n ans+=b*(b-1)*0.5\nans=int(ans)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s866303919', 's985831484'] | [3064.0, 2940.0] | [17.0, 17.0] | [363, 114] |
p02729 | u912650255 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M = map(int,input().split())\n\nprint(N(N-1)//2+M(M-1)//2)\n', 'N,M = map(int,input().split())\n\nprint(N*(N-1)//2+M*(M-1)//2)\n'] | ['Runtime Error', 'Accepted'] | ['s892859969', 's912651814'] | [2940.0, 2940.0] | [18.0, 17.0] | [59, 61] |
p02729 | u914671452 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int,input().split())\nanswer = 0\nanswer += (N ** 2 - N) / 2\nanswer += (M ** 2 - M) / 2\nprint(answer)', 'N, M = map(int,input().split())\nanswer = 0\nanswer += (N ** 2 - N) / 2\nanswer += (M ** 2 - M) / 2\nprint(int(answer))\n'] | ['Wrong Answer', 'Accepted'] | ['s561538295', 's564754408'] | [3064.0, 2940.0] | [18.0, 17.0] | [110, 116] |
p02729 | u917444023 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['l=int(input())\nn=l/3\nprint(n*n*n)', 'n,m=map(int,input().split())\nprint(n*(n-1)//2 + m*(m-1)//2)'] | ['Runtime Error', 'Accepted'] | ['s279676603', 's094476700'] | [2940.0, 3064.0] | [18.0, 18.0] | [33, 59] |
p02729 | u920204936 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M = map(int,input().split())\nprint(N(N+1)/2+M(M+1)/2)', 'N,M = map(int,input().split())\nprint(int(N*(N+1)/2+M*(M+1)/2))', 'N,M = map(int,input().split())\nprint(int(N*(N-1)/2+M*(M-1)/2))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s278577208', 's777259255', 's066423131'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [55, 62, 62] |
p02729 | u924182136 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M = map(int,input().split())\n\n# tmpN,tmpM = 0,0\n# if N != 2:\n\n# ue *= N-i\n\n\n# if M != 2:\n\n# uee *= N-i\n\n\n\n# print(tmpN+tmpM)\n\nans = N*int(N/2) + M*int(M/2)\nprint(ans)\n', 'N,M = map(int,input().split())\n\n# tmpN,tmpM = 0,0\n# if N != 2:\n\n# ue *= N-i\n\n\n# if M != 2:\n\n# uee *= N-i\n\n\n\n# print(tmpN+tmpM)\n\nans = N*(N-1)/2 + M*(M-1)/2\n\nprint(int(ans))'] | ['Wrong Answer', 'Accepted'] | ['s051217343', 's221373179'] | [9116.0, 9064.0] | [26.0, 29.0] | [355, 358] |
p02729 | u924783770 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['from collections import Counter\nfrom operator import mul\nfrom functools import reduce\n\ndef combinations_count2(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\n#\nN=int(input())\nA=list(map(int,input().split()))\n#\nhoge=Counter(A)\nans1=0\nfor i in hoge.values():\n if i==1:\n continue\n else:\n ans1+=combinations_count2(i,2)\n\nans2=[]\nfor i in A:\n ans2.append(A.count(i)-1)\n\nfor k in range(N):\n print(ans1-ans2[k])', 'import math\nN,M=map(int,input().split())\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nx=0\ny=0\nif N>=2:\n x=combinations_count(N, 2)\nif M>=2:\n y=combinations_count(M, 2)\n\nprint(x+y)\n'] | ['Runtime Error', 'Accepted'] | ['s801169532', 's665233864'] | [3564.0, 3060.0] | [23.0, 17.0] | [530, 249] |
p02729 | u924828749 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m = [int(x) for x in input().split()]\nprint((n * (n-1) / 2) + (m * (m-1) / 2))', 'n,m = [int(x) for x in input().split()]\nprint(n * (n-1) / 2 + m * (m-1) / 2)', 'n,m = [int(x) for x in input().split()]\nprint((n * (n-1) // 2) + (m * (m-1) // 2))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s082216276', 's086700480', 's595000055'] | [9080.0, 9088.0, 9140.0] | [29.0, 28.0, 27.0] | [80, 76, 82] |
p02729 | u925156829 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\ndef comb(n, r):\n\treturn math.factorial(n) / (math.factorial(n - r) * math.factorial(r))\nprint(comb(n + m, 2) - n * m)\n', 'import math\ndef comb(a, b):\n return math.factorial(a) / (math.factorial(a - b) * math.factorial(b))\nprint(comb(n + m, 2) - n * m)\n', ' import math\n def comb(n, r):\n \treturn math.factorial(n) / (math.factorial(n - r) * math.factorial(r))\n base = comb(n+m, n * 2) + comb(n+m, m * 2)\n print(base)\n', ' import math\n def comb(n, r):\n \treturn math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n base = comb(n+m, n * 2) + comb(n+m, m * 2)\n print(base)\n', 'n, m = map(int, input().split())\nimport math\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nprint(comb(n + m, 2) - n * m)\n\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s450572930', 's455020195', 's560110585', 's860832731', 's260050947'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 19.0, 17.0, 17.0, 18.0] | [130, 131, 165, 161, 166] |
p02729 | u929768294 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['sum = int(input())\nprint((sum/3)*(sum/3)*(sum/3))', 'import math\ndef comb(n,r):\n if n<2:\n return 0\n else:\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\na, b = map(int, input().split())\nprint(comb(a,2)+comb(b,2))'] | ['Runtime Error', 'Accepted'] | ['s457629131', 's183690965'] | [2940.0, 3060.0] | [17.0, 18.0] | [49, 206] |
p02729 | u931173291 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['a = list(map(int,input().split()))\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nx = a[0]\ny = a[1]\nz = 1\nif(x is not z){\n c = (combinations_count(x, 2));\n}\nelse{\n c = 0;\n}\nif(y is not z){\n d = (combinations_count(y, 2));\n}\nelse{\n d = 0;\n}\nprint(c + d)', 'a = list(map(int,input().split()))\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nx = a[0]\ny = a[1]\nz = 1\nif (x != z)\n c = (combinations_count(x, 2)) \nelse \n c = 0\nif (y != z)\n d = (combinations_count(y, 2))\nelse \n d = 0\nprint(c + d)', 'a = list(map(int,input().split()))\nfrom operator import mul\nfrom functools import reduce\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\nx = a[0]\ny = a[1]\nif(x != 1) and (x != 0):\n c = (combinations_count(x, 2))\nelse:\n c = 0\nif(y != 1) and (y != 0):\n d = (combinations_count(y, 2))\nelse:\n d = 0\nprint(c + d)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s230950883', 's838231684', 's403619562'] | [2940.0, 2940.0, 3572.0] | [17.0, 17.0, 22.0] | [323, 304, 442] |
p02729 | u932370518 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\nimport itertools\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nif __name__ == "__main__":\n N, M = map(int, input().split())\n ret = 0\n if M != 0:\n ret += combinations_count(M, 2)\n else:\n pass\n if N != 0:\n ret += combinations_count(N, 2)\n else:\n pass\n print(ret)\n', 'import math\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nif __name__ == "__main__":\n N, M = map(int, input().split())\n ret = 0\n if M >= 2:\n ret += combinations_count(M, 2)\n else:\n pass\n if N >= 2:\n ret += combinations_count(N, 2)\n else:\n pass\n print(ret)\n'] | ['Runtime Error', 'Accepted'] | ['s736202326', 's760430768'] | [3060.0, 3060.0] | [18.0, 17.0] | [384, 367] |
p02729 | u932937501 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M=map(int,input().split())\nfrom operator import mul\nfrom functools import reduce\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\n\nprint(combinations_count(N,2)+combinations_count(M,2))', 'N,M=map(int,input().split())\nimport math\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nprint(combinations_count(N,2)+combinations_count(M,2))', 'N,M=map(int,input().split())\nfrom operator import mul\nfrom functools import reduce\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\n\nif N>=2:\n a=combinations_count(N,2)\nelse:\n a=0\nif M>=2:\n b=combinations_count(M,2)\nelse:\n b=0\nprint(a+b)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s069893130', 's282166635', 's525533322'] | [3828.0, 3056.0, 3828.0] | [105.0, 17.0, 29.0] | [309, 202, 371] |
p02729 | u933193704 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['L, R = map(int,input().split())\nsum = L+R\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\n\naaa = cmb(L,2) + cmb(R,2)\nprint(aaa)', 'import itertools\nL, R = map(int,input().split())\na = len(list(itertools.combinations(range(L), 2))) + len(list(itertools.combinations(range(R), 2)))\nprint(a)'] | ['Wrong Answer', 'Accepted'] | ['s568627939', 's254372748'] | [3064.0, 3444.0] | [17.0, 18.0] | [634, 157] |
p02729 | u935840914 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\nprint(n*(n-1)/2 + m*(m-1)/2)', 'n, m = map(int, input().split())\nans = (n * (n - 1)) // 2 + (m * (m - 1) // 2)\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s417619125', 's007061529'] | [2940.0, 2940.0] | [18.0, 18.0] | [61, 90] |
p02729 | u936285815 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\n\nc = 0\nc += N(N-2)/2\nc += M(M-2)/2\n\nprint(c)', 'N, M = map(int, input().split())\n\nc = 0\nc += N(N-2)/2\nc += M(M-2)/2\n\nprint(c)\n\n', 'N, M = map(int, input().split())\n\nc = 0\nc += (N*(N-1))/2\nc += (M*(M-1))/2\n\nprint(int(c))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s536792650', 's781683398', 's242472717'] | [2940.0, 2940.0, 2940.0] | [18.0, 17.0, 18.0] | [77, 79, 88] |
p02729 | u938227748 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['line = input().split()\nn = int(line[0])\nm = int(line[1])\n\n\neeCount = n * (n - 1)\n\n\nooCount = m * (m - 1)\n\nprint(eeCount + ooCount)', "def checkKaibun(str):\n print(str)\n for i in range(int((len(str) - 1) / 2)):\n if str[i] != str[-i - 1]:\n return False\n return True\n \ns = input()\nn = len(s)\nc2e = int((n - 1) / 2)\nc3s = int((n + 3) / 2) - 1\nif not checkKaibun(s):\n print('No')\nelif not checkKaibun(s[0:c2e]):\n print('No')\nelif not checkKaibun(s[c3s:n]):\n print('No')\nelse:\n print('Yes')", "def checkKaibun(str):\n for i in range(int((len(str) - 1) / 2)):\n if str[i] != str[-i - 1]:\n return False\n return True\n \ns = input()\nn = len(s)\nc2e = int((n - 1) / 2)\nc3s = int((n + 3) / 2) - 1\nif not checkKaibun(s):\n print('No')\nelif not checkKaibun(s[0:c2e]):\n print('No')\nelif not checkKaibun(s[c3s:n]):\n print('No')\nelse :\n print('Yes') ", "def checkKaibun(str):\n for i in range(int((len(str) - 1) / 2)):\n if str[i] != str[-i - 1]:\n return False\n return True\n \ns = input()\nn = len(s)\nc2e = int((n - 1) / 2)\nc3s = int((n + 3) / 2)\nif not checkKaibun(s):\n print('No')\nelif not checkKaibun(s[0:c2e]):\n print('No')\nelif not checkKaibun(s[c3s:n]):\n print('No')\nelse :\n print('Yes')\n \n ", 'line = input().split()\nn = int(line[0])\nm = int(line[1])\n\n\neeCount = n * (n - 1) / 2\n\n\nooCount = m * (m - 1) / 2\n\nprint(int(eeCount + ooCount))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s366323039', 's620738799', 's663041986', 's732635237', 's096449463'] | [2940.0, 3064.0, 3064.0, 3064.0, 2940.0] | [17.0, 17.0, 17.0, 17.0, 17.0] | [194, 389, 381, 386, 207] |
p02729 | u938718404 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m=map(int,input().split())\nk=n*(n-1)/2\nl=m*(m-1)/2\nif n>=2 and m>=2:\n print(k+l)\nelif n>=2 and m<2:\n print(k)\nelif n<2 and m>=2:\n print(l)\nelse:\n print(0)', 'n,m=map(int,input().split())\nif n>=2 and m>=2:\n print(n*(n-1)/2+m*(m-1)/2)\nelif n>=2 and m<2:\n print(n*(n-1)/2)\nelif n<2 and m>=2:\n print(m*(m-1)/2)\nelse:\n print(0)', 'n,m=map(int,input().split())\nk=n*(n-1)/2\nl=m*(m-1)/2\nk=int(k)\nl=int(l)\nif n>=2 and m>=2:\n print(k+l)\nelif n>=2 and m<2:\n print(k)\nelif n<2 and m>=2:\n print(l)\nelse:\n print(0)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s588046408', 's742312174', 's174715405'] | [3060.0, 3060.0, 3060.0] | [17.0, 19.0, 17.0] | [168, 176, 186] |
p02729 | u939913920 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["N,M=(int(x) for x in input('Enter N and M:').split())\nprint(N)\nprint(M)\nif not 0 <= N <= 100:\n print('N is not appropreate')\nelif not 0 <= M <= 100:\n print('M is not appropreate')\nelif N+M < 2:\n print('num of ball is too small')\nelse:\n print(int((N*(N-1)+M*(M-1))/2))\n", "N,M=(int(x) for x in input().split())\nif not 0 <= N <= 100:\n print('N is not appropreate')\nelif not 0 <= M <= 100:\n print('M is not appropreate')\nelif N+M < 2:\n print('num of ball is too small')\nelse:\n print(int((N*(N-1)+M*(M-1))/2))"] | ['Wrong Answer', 'Accepted'] | ['s916885929', 's828003494'] | [2940.0, 3060.0] | [23.0, 18.0] | [280, 245] |
p02729 | u941022948 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['def factorial(n):\n if n == 1:\n return 1\n else:\n return n * factorial(n-1)\na,b=map(int, input().split())\ncnt=0\nif a>1:\n cnt=(factorial(a)/((factorial(a-2))*2))\nif b>1:\n cnt=(factorial(b)/((factorial(b-2))*2))+cnt\nprint(int(cnt))', 'def factorial(n):\n if n == 1:\n return 1\n else:\n return n * factorial(n-1)\na,b=map(int, input().split())\ncnt=0\nif a>0:\n cnt=(factorial(a)/((factorial(a-2))*2))\nif b>0:\n cnt=(factorial(b)/((factorial(b-2))*2))+cnt\nprint(int(cnt))', 'def factorial(n):\n if n == 1:\n return 1\n else:\n return n * factorial(n-1)\na,b=map(int, input().split())\ncnt=0\nif a==2:\n cnt=1\nelif a>1:\n cnt=(factorial(a)/((factorial(a-2))*2))\nif b==2:\n cnt=cnt+1\nelif b>1:\n cnt=(factorial(b)/((factorial(b-2))*2))+cnt\nprint(int(cnt))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s378671021', 's529758454', 's152629500'] | [3892.0, 3888.0, 3064.0] | [72.0, 72.0, 17.0] | [253, 253, 299] |
p02729 | u941645670 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\na=0\nb=3\nanswer = 0\n\n\nif a != 0:\n answer += math.factorial(a) / (math.factorial(a - 2)*2)\n\n\nif b != 0:\n answer += math.factorial(b) / (math.factorial(b - 2)*2)\n\nprint(int(answer))', 'import math\na,b=map(int, input().split())\n\nanswer = 0\n\n\nanswer += math.factorial(a) / (math.factorial(a - 2)*2)\n\n\nanswer += math.factorial(b) / (math.factorial(b - 2)*2)\n\nprint(int(answer))', 'import math\na=4\nb=3\nanswer = 0\n\n\nif a > 1 :\n answer += math.factorial(a) / (math.factorial(a - 2)*2)\n\n\nif b > 1:\n answer += math.factorial(b) / (math.factorial(b - 2)*2)\n\nprint(int(answer))', 'import math\na=2\nb=2\nanswer = 0\n\n\nif a > 1 :\n answer += math.factorial(a) / (math.factorial(a - 2))\n\n\nif b > 1:\n answer += math.factorial(b) / (math.factorial(b - 2))\n\nprint(int(answer))', 'a,b=map(int, input().split())\nanswer = 0\n\n\nif a > 1 :\n answer += math.factorial(a) / (math.factorial(a - 2)*2)\n\n\nif b > 1:\n answer += math.factorial(b) / (math.factorial(b - 2)*2)\n\nprint(int(answer))', 'import math\na,b=map(int, input().split())\nanswer = 0\n\nif a > 1 :\n answer += math.factorial(a) / (math.factorial(a - 2)*2)\n\nif b > 1:\n answer += math.factorial(b) / (math.factorial(b - 2)*2)\n\nprint(int(answer))'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s198999121', 's366170229', 's414430147', 's526710409', 's876365944', 's036433634'] | [3060.0, 3064.0, 3060.0, 3060.0, 3060.0, 3060.0] | [18.0, 17.0, 17.0, 17.0, 17.0, 17.0] | [212, 205, 211, 207, 221, 215] |
p02729 | u944886577 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['l=int(input())\nans=0\nsum=0\n \nfor i in range(l):\n for j in range(l-i):\n sum=i*j*(l-i-j)\n if ans<sum:\n ans=sum\nprint(ans)', 'n,m=map(input().split())\n\na=n*(n-1)/2+m*(m-1)/2\n\nprint(str(a))\n ', 'n,m=map(int, input().split())\n \na=n*(n-1)/2+m*(m-1)/2\n \nprint(str(int(a)))\n '] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s069215927', 's089437673', 's174008833'] | [9084.0, 9100.0, 9108.0] | [22.0, 29.0, 30.0] | [128, 65, 77] |
p02729 | u946346344 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n = int(input())\nm = int(input())\nsum = 0\nsum = n*(n-1)/2 + m*(m-1)/2\nprint(sum)', 'n, m = map(int, input().split())\nsum = n*(n-1)//2 + m*(m-1)//2\nprint(sum)'] | ['Runtime Error', 'Accepted'] | ['s088398704', 's814015160'] | [2940.0, 2940.0] | [17.0, 17.0] | [80, 73] |
p02729 | u949234226 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['\nimport math\ncharacter = input()\nre_character = character[::-1]\n \nnum = int(len(character))\nmiddle = math.ceil(num/2.0)\n\nif (character[0:num] == re_character[0:num]):\n if (character[0:middle-1] == re_character[middle:num]):\n print("Yes")\nelse:\n print("No")\n', '\nN, M = map(int, input().split())\nprint(int((N*(N-1)/2)+(M*(M-1)/2)))\n'] | ['Wrong Answer', 'Accepted'] | ['s439170009', 's955174039'] | [3060.0, 3060.0] | [18.0, 19.0] | [283, 70] |
p02729 | u951814007 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['a, b = map(int, input().split())\n\nk = 0\n\nif a%2 == 0:\n k = k + a*(a-1)/2\nelse:\n k = k\n \nif b%2 == 0:\n k = k + b*(b-1)/2\nelse:\n k = k\n \nprint(k)\n', 'a, b = map(int, input().split())\n \nk = 0\n \nif a != 1:\n k = k + a*(a-1)/2\nelse:\n k = k\n \nif b != 1:\n k = k + b*(b-1)/2\nelse:\n k = k\n \nprint(int(k))'] | ['Wrong Answer', 'Accepted'] | ['s917455070', 's446497415'] | [2940.0, 3060.0] | [17.0, 19.0] | [150, 152] |
p02729 | u951985579 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['from scipy.special import comb\nn, m = map(int, input().split())\nprint(n * m + comb(n, 1, exact=True) + comb(m, 1, exact=True))', 'n, m = map(int, input().split())\na = n*(n-1) // 2\nb = m*(m-1) // 2\nprint(a+b)'] | ['Wrong Answer', 'Accepted'] | ['s020033754', 's850429752'] | [42324.0, 9164.0] | [184.0, 24.0] | [126, 77] |
p02729 | u953499988 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M=map(int,input().split())\nif N<=1 and M<=1:\n print(0)\nelif N<=1:\n print(M*(M-1)/2)\nelif M<=1:\n print(N*(N-1)/2)\nelse:\n print(N*(N-1)/2+M*(M-1)/2)', 'def a(N,M):\n if N<=1 and M<=1:\n return 0\n elif N<=1:\n return M*(M-1)/2\n elif M<=1:\n return N*(N-1)/2\n else:\n return N*(N-1)/2+M*(M-1)/2\n ', 'N,M=map(int,input().split())\nif N<=1 and M<=1:\n print(0)\nelif N<=1:\n print(M*(M-1)//2)\nelif M<=1:\n print(N*(N-1)//2)\nelse:\n print(N*(N-1)//2+M*(M-1)//2)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s407711467', 's976560112', 's984859041'] | [3064.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0] | [152, 154, 156] |
p02729 | u953855545 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import scipy.optimize\n\nL = int(input())\n\nfunc = lambda x: -1 * (x[0] * x[1] * (L - x[0] - x[1]))\n\nres = scipy.optimize.minimize(func, (0.1 ,0.2), bounds = ((0, None), (0, None)), tol=1e-6)\n\nprint(-1 * res.fun)', 'import math\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n \nn, m = input().split(" ")\n \nprint(comb(n, 2) + comb(m, 2))', 'L = int(input())\nprint(L/3 * L/3 * L/3)', 'import math\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn, m = input().split(" ")\n\nreturn comb(n, 2) + comb(m, 2)', 'import math\n\ndef comb(n, r):\n try: \n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n except:\n return 0\n\nraw = input()\nn, m = [int(i) for i in raw.split(" ")]\n \nprint(comb(n, 2) + comb(m, 2))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s153691891', 's380960487', 's522899529', 's919450427', 's858101404'] | [35340.0, 3056.0, 2940.0, 2940.0, 3060.0] | [633.0, 17.0, 17.0, 18.0, 17.0] | [209, 164, 39, 162, 235] |
p02729 | u955474478 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\nc = 0\nif n >= 2:\n c += n*(n-1) /2\nif m >= 2:\n c += n*(n-1) /2\nprint(c)', 'n, m = map(int, unput().split())\nc = 0\nif n >= 2:\n c += n*(n-1) /2\nif m >= 2:\n c += n*(n-1) /2\nprint(c)', 'n, m = map(int, input().split())\nc = 0\nif n >= 2:\n c += n*(n-1) /2\nif m >= 2:\n c += m*(m-1) /2\nprint(int(c))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s065575976', 's408895963', 's494201591'] | [9164.0, 8964.0, 9096.0] | [27.0, 29.0, 31.0] | [105, 105, 110] |
p02729 | u956547804 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m=map(int,input().split())\nresult=0\nn1=1\nm1=1\nfor i in range(n-1,n+1):\n n1*=i\nfor k in range(m-1,m+1):\n m1*=k\nprint((n1+m1)/2)', 'n,m=map(int,input().split())\nresult=0\nn1=1\nm1=1\nfor i in range(n-1,n+1):\n n1*=i\nfor k in range(m-1,m+1):\n m1*=k\nprint(int((n1+m1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s168773032', 's919188981'] | [3060.0, 3060.0] | [17.0, 17.0] | [134, 139] |
p02729 | u956811090 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import sys\ninput = sys.stdin.readline\nN = int(input())\nA = list(map(int, input().split()))\nc = [A.count(i + 1) for i in range(N)]\nans = [c[i] * (c[i] - 1) // 2 for i in range(N)]\ns = sum(ans)\n\nfor val in A:\n m = c[val - 1] - 1\n print(s - m)', 'N, M = map(int, input().split())\nNM = N + M\nprint(NM * (NM - 1) // 2 - N * M)'] | ['Runtime Error', 'Accepted'] | ['s933088063', 's317872709'] | [3064.0, 2940.0] | [19.0, 19.0] | [242, 77] |
p02729 | u957098479 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int,input().split())\n\nreturn(N*(N-1)//2 + M*(M-1)//2)', 'N, M = map(int,input().split())\n\nprint(N*(N-1)//2 + M*(M-1)//2)'] | ['Runtime Error', 'Accepted'] | ['s792302675', 's467434842'] | [2940.0, 2940.0] | [17.0, 17.0] | [64, 63] |
p02729 | u957669641 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["n,m = (int(x) for x in input('').split(''))\nsum = (n * (n - 1) / 2) + (m * (m - 1) / 2)\nprint(sum)", 'n, m = (int(x) for x in input().split())\nsum = (n * (n - 1) / 2) + (m * (m - 1) / 2)\nprint(sum)', 'sum = 0\nn, m = (int(x) for x in input().split())\nif (n != 1):\n sum = (n * (n - 1) / 2) \nif (m != 1):\n sum = sum + (m * (m - 1) / 2)\nprint(sum)', 'n,m=(int(x) for x in input().split())\nsum=int((n*(n-1)/2)+(m*(m-1)/2))\nprint(sum)\n'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s804817577', 's829472565', 's832569997', 's314859769'] | [2940.0, 2940.0, 3060.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [98, 95, 144, 82] |
p02729 | u957957759 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m=map(int,input().split())\nprint(n*(n-1)/2+m*(m-1)/2)', 'n,m=map(int,input().split())\nprint(int(n*(n-1)/2+m*(m-1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s920344382', 's726995065'] | [2940.0, 2940.0] | [17.0, 17.0] | [55, 60] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.