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 | u487288850 | 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(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)', 'n,m=map(int,input().split())\nprint(int(n*(n-1)/2+m*(m-1)/2))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s730500859', 's954063762', 's336523928'] | [9120.0, 8756.0, 8936.0] | [29.0, 22.0, 25.0] | [60, 59, 60] |
p02729 | u492295443 | 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())\nanswer = (N*(N-1) / 2) + (M*(M-1) / 2)\n\nprint(int(answer))', 'a = input().split()\nN = int(a[0])\nM = int(a[1])\n\nanswer = (N*(N-1) / 2) + (M*(M-1) / 2)\n\nprint(int(answer))'] | ['Runtime Error', 'Accepted'] | ['s208620073', 's931952799'] | [2940.0, 3060.0] | [17.0, 17.0] | [92, 107] |
p02729 | u493318999 | 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())\noddsum = n*(n-1)/2 + m*(m-1)/2\nprint(oddsum)', 'n,m = map(int,input().split())\nevensum = int(n*(n-1)/2 + m*(m-1)/2)\nprint(evensum)'] | ['Wrong Answer', 'Accepted'] | ['s779231167', 's717777708'] | [2940.0, 2940.0] | [17.0, 17.0] | [75, 82] |
p02729 | u494295478 | 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( )\nN=int(N)\nM=int(M)\n\nM2=(M*(M-1))/2 #MC2\nN2=(N*(N-1))/2\nA=M2+N2\nA', 'N,M=input().split( )\nN=int(N)\nM=int(M)\n\nM2=(M*(M-1))/2 #MC2\nN2=(N*(N-1))/2\nA=M2+N2\nA=int(A)', 'N,M=input().split( )\nN=int(N)\nM=int(M)\n\nM2=(M*(M-1))/2 #MC2\nN2=(N*(N-1))/2\nA=M2+N2\nA=int(A)\nprint(A)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s692616752', 's753123258', 's403807401'] | [2940.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0] | [84, 91, 100] |
p02729 | u496184631 | 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 = list(map(int, input().split()))\nresult = math.factorial(A[0])/2/math.factorial(A[0]-2)+math.factorial(A[1])/2/math.factorial(A[1]-2)\nprint (result)', 'import math\ndef com(a):\n if a == 0 or a == 1:\n return 0\n elif a == 2:\n return 1\n else:\n return math.factorial(a)/2/math.factorial(a-2)\nA = list(map(int, input().split()))\nresult = int(com(A[0])+com(A[1]))\nprint (result)'] | ['Runtime Error', 'Accepted'] | ['s567150337', 's580388068'] | [3060.0, 3060.0] | [18.0, 17.0] | [164, 250] |
p02729 | u500990280 | 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)\na = ((N * (N-1)) + (M * (M-1)))/2\nprint(a)', 'N,M = map(int,input().split)\nprint((((N * (N-1)) + ((M *(M-1)))/2)\n', 'N,M = map(int,input().split)\na = int((N * (N-1) + M * (M-1)) / 2)\nprint(a)\n', 'N, M = map(int,input().split())\na = int((N * (N-1) + M * (M-1)) / 2)\nprint(a)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s196693996', 's869190245', 's877508963', 's917825577', 's842180402'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0, 17.0, 17.0] | [63, 71, 67, 75, 78] |
p02729 | u502200133 | 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. | ['list = input().rstrip().split(" ")\nkisu = int(list[1])\ngusu = int(list[0])\n\nkiki = kisu * (kisu - 1\n', 'even, odd = map(int,input().split())\nprint((even*~-even // 2) + (odd*=~-odd // 2))', 'even, odd = map(int,input().split())\nprint((even*~-n // 2) + (odd*=~-odd // 2))', 'even, odd = map(int,input().split())\nprint((even*~-even // 2) + (odd*~-odd // 2))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s078964368', 's255368280', 's946887612', 's485293860'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [144, 82, 79, 81] |
p02729 | u502841298 | 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()))\nresp = (n*(n-1))/2 + (m*(m-1))/2\nprint(resp)', 'n, m = map(int, (input().split()))\nresp = (n*(n-1))/2 + (m*(m-1))/2\nprint(int(resp))'] | ['Wrong Answer', 'Accepted'] | ['s256699379', 's412201201'] | [2940.0, 2940.0] | [17.0, 17.0] | [79, 84] |
p02729 | u508061226 | 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. | ['o, e = input().split()\no = int(o);\ne = int(e);\n\nnum1 = o * (o-1) / 2;\nnum2 = e * (e-1) / 2;\n\nprint(num1+num2)', 'o, e = input().split()\no = int(o);\ne = int(e);\n\nnum1 = o * (o-1) / 2;\nnum2 = e * (e-1) / 2;\n\nprint(int(num1+num2))\n'] | ['Wrong Answer', 'Accepted'] | ['s114803951', 's140111784'] | [2940.0, 2940.0] | [17.0, 17.0] | [109, 115] |
p02729 | u508426820 | 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, input().split())\nprint(N * (N - 1) + M * (M - 1))\n', '\nN, M = map(int, input().split())\nprint(N * (N - 1) / 2 + M * (M - 1) / 2)\n', '\nN, M = map(int, input().split())\nprint(int(N * (N - 1) / 2 + M * (M - 1) / 2))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s155477650', 's760349904', 's795929520'] | [2940.0, 3060.0, 2940.0] | [17.0, 19.0, 17.0] | [139, 147, 152] |
p02729 | u513081876 | 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))', '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))', 'import math\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(abs(n - r)) * math.factorial(r))\n\nN, M = map(int, input().split())\n\nprint(combinations_count(N, 2) + combinations_count(M, 2))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s215310508', 's733918795', 's268639334'] | [2940.0, 3056.0, 2940.0] | [17.0, 17.0, 17.0] | [212, 212, 217] |
p02729 | u514118270 | 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 = list(map(int,input().split()))\nimport math\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nC = combinations_count(A, 2)\nD = combinations_count(B, 2)\nprint(C+D)', 'A,B = list(map(int,input().split()))\nimport math\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nif A == 0:\n D = combinations_count(B, 2)\n print(D)\n exit()\nelif B == 0:\n C = combinations_count(A, 2)\n exit()\nC = combinations_count(A, 2)\nD = combinations_count(B, 2)\nprint(C+D)', 'if A != 0 and B == 0:\n C = math.factorial(A-2)\n E = math.factorial(A) // 2// C\n print(E)\n exit()\nif A == 0 and B == 0:\n print(0)\n exit()\nelif A == 1 and B != 1:\n D = math.factorial(B-2)\n F = math.factorial(B) // 2// D\n print(F)\n exit()\nelif A != 1 and B == 1:\n C = math.factorial(A-2)\n E = math.factorial(A) // 2// C\n print(E)\n exit()\nelif A == 1 and B == 1:\n print(0)\n exit()\nC = math.factorial(A-2)\nD = math.factorial(B-2)\nE = math.factorial(A) // 2// C\nF = math.factorial(B) // 2// D\nprint(E+F)', 'def combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nif A == 0:\n D = combinations_count(B, 2)\n print(D)\n exit()\nelif B == 0:\n C = combinations_count(A, 2)\n exit()\nC = combinations_count(A, 2)\nD = combinations_count(B, 2)\nprint(C+D)', 'A,B = list(map(int,input().split()))\nimport math\nif A == 0 and B != 0:\n D = math.factorial(B-2)\n F = math.factorial(B) // 2// D\n print(F)\n exit()\nif A != 0 and B == 0:\n C = math.factorial(A-2)\n E = math.factorial(A) // 2// C\n print(E)\n exit()\nif A == 0 and B == 0:\n print(0)\n exit()\nC = math.factorial(A-2)\nD = math.factorial(B-2)\nE = math.factorial(A) // 2// C\nF = math.factorial(B) // 2// D\nprint(E+F)', 'A,B = list(map(int,input().split()))\nimport math\nif A == 0 and B != 0:\n D = math.factorial(B-2)\n F = math.factorial(B) // 2// D\n print(F)\n exit()\nif A != 0 and B == 0:\n C = math.factorial(A-2)\n E = math.factorial(A) // 2// C\n print(E)\n exit()\nif A == 0 and B == 0:\n print(0)\n exit()\nelif A == 1 and B != 1:\n D = math.factorial(B-2)\n F = math.factorial(B) // 2// D\n print(F)\n exit()\nelif A != 1 and B == 1:\n C = math.factorial(A-2)\n E = math.factorial(A) // 2// C\n print(E)\n exit()\nelif A == 1 and B == 1:\n print(0)\n exit()\nC = math.factorial(A-2)\nD = math.factorial(B-2)\nE = math.factorial(A) // 2// C\nF = math.factorial(B) // 2// D\nprint(E+F)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s003849181', 's659126057', 's671838314', 's892852463', 's893060911', 's801860509'] | [3060.0, 3064.0, 3064.0, 3060.0, 3064.0, 3064.0] | [17.0, 17.0, 17.0, 17.0, 17.0, 18.0] | [221, 336, 513, 287, 413, 663] |
p02729 | u516678561 | 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. | ["list_input_str = input().split(' ')\nn, m = map(int, list_input_str)\n\n\ndef p(_n, _r):\n \n ret = 1\n for i in range(_r):\n ret = ret * (_n - i)\n return ret\n\n\ndef c(_n, _r):\n over = p(_n, _r)\n under = p(_r, _r)\n return over / under\n\n\nprint(c(n, 2) + c(m, 2))\n", "from operator import mul \nfrom functools import reduce \n\nn, m = map(int, input().split(' '))\n\n\ndef p(_n, _r):\n \n return reduce(mul, list(range(_n, _n - _r, -1))) \n\n\ndef c(_n, _r):\n \n over = p(_n, _r)\n under = p(_r, _r)\n return over / under\n\n\nprint(int((c(n, 2)) + c(m, 2)))\n"] | ['Wrong Answer', 'Accepted'] | ['s646676354', 's252224415'] | [2940.0, 3572.0] | [17.0, 23.0] | [301, 606] |
p02729 | u519968172 | 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,m=map(int,input().split())\nprint(n*(n-1)//2+m*(m-1)//2)'] | ['Runtime Error', 'Accepted'] | ['s963071640', 's672797612'] | [9064.0, 9008.0] | [24.0, 26.0] | [49, 57] |
p02729 | u520331522 | 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 = 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))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s577632320', 's591253244', 's841229925'] | [2940.0, 3064.0, 2940.0] | [17.0, 17.0, 17.0] | [32, 64, 74] |
p02729 | u520680626 | 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. | ['# 200322 A\nnCr = {}\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n,r) in nCr: return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n return nCr[(n,r)]\n \nif __name__ == "__main__":\n N,M = list(map(int,input().split()))\n print(cmb(N,2)+cmb(M,2))\n\n\n\n \n \n', '# 200322 A\n\nnCr = {}\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n,r) in nCr: return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n return nCr[(n,r)]\n \nif __name__ == "__main__":\n N,M = list(map(int,input().split()))\n print(cmb(N,2)+cmb(M,2))\n\n\n\n \n \n', '# 200322 A\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\nif __name__ == "__main__":\n N,M = list(map(int,input().split()))\n print(cmb(N,2)+cmb(M,2))\n\n\n\n \n \n', '# 200322 A\n\nnCr = {}\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n,r) in nCr: return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n return nCr[(n,r)]\n\nN,M = list(map(int,input().split()))\n\nprint(cmb(N,2)+cmb(M,2))\n\n\n\n \n \n', '# 200322 A\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\nif __name__ == "__main__":\n N,M = list(map(int,input().split()))\n \n if N <= 1:\n Nc = 0\n else:\n Nc = cmb(N,2)\n \n if M < 2:\n Mc = 0\n else:\n Mc = cmb(M,2)\n print(Nc + Mc)\n\n\n\n \n \n'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s354248999', 's426239054', 's598648854', 's666569029', 's260611979'] | [3936.0, 3936.0, 3064.0, 3932.0, 3064.0] | [72.0, 72.0, 18.0, 72.0, 19.0] | [316, 317, 682, 279, 805] |
p02729 | u520843951 | 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(n*(n-1)//2 + m*(m-1)//2)'] | ['Wrong Answer', 'Accepted'] | ['s002326127', 's748347985'] | [2940.0, 2940.0] | [17.0, 17.0] | [62, 64] |
p02729 | u523957440 | 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())\nif N >= 2 or M >= 2:\n print(N*(N-1)/2+M*(M-1)/2)\nelse:\n print(0)', 'N,M=map(int,input().split())\nprint(int(N*(N-1)/2+M*(M-1)/2))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s592666450', 's605402284', 's663310007'] | [2940.0, 3060.0, 2940.0] | [17.0, 19.0, 18.0] | [55, 95, 60] |
p02729 | u525008368 | 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\na+=(m*(m-1))/2\nprint (a)', 'n,m=map(int,input().split())\na=(n*(n-1))>>1\na+=(m*(m-1))>>1\nprint (a)'] | ['Wrong Answer', 'Accepted'] | ['s824886420', 's952391416'] | [9112.0, 9168.0] | [27.0, 30.0] | [67, 69] |
p02729 | u531599639 | 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'] | ['Wrong Answer', 'Accepted'] | ['s559246871', 's757919747'] | [2940.0, 2940.0] | [17.0, 17.0] | [61, 67] |
p02729 | u534338602 | 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\n n,m = map(int,input().split())\n\n su = combinations_count(n+m, 2)\n mm = n*m\n ans = su-mm\n\n print(str(ans))', '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\nsu = combinations_count(n+m, 2)\nmm = n*m\nans = su-mm\n\nprint(str(ans))'] | ['Runtime Error', 'Accepted'] | ['s864705892', 's490639460'] | [3060.0, 3060.0] | [17.0, 17.0] | [231, 223] |
p02729 | u535803878 | 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. | ['\nfrom functools import lru_cache\nprint(0)', 'n, m = [int(c) for c in input().split()]\nprint(n*(n-1)/2 + m*(m-1)/2)', 'n, m = input().split(" ")\nprint(n*(n-1)/2 + m*(m-1)/2)', 'n, m = [int(c) for c in input().split()]\nprint(int(n*(n-1)/2 + m*(m-1)/2))'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s506920217', 's740687430', 's928740916', 's122676001'] | [3572.0, 2940.0, 2940.0, 2940.0] | [23.0, 17.0, 17.0, 18.0] | [41, 69, 54, 74] |
p02729 | u537142137 | 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. | ['I = input().split()\n\nN = int(I[0])\nM = int(I[1])\n\nprint( N*(N-1)/2 + M*(M-1)/2 )\n', 'I = input().split()\n\nN = int(I[0])\nM = int(I[1])\n\nprint( int(N*(N-1)/2) + int(M*(M-1)/2) )\n'] | ['Wrong Answer', 'Accepted'] | ['s278049330', 's943941409'] | [2940.0, 2940.0] | [18.0, 17.0] | [81, 91] |
p02729 | u538632589 | 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 > 1:\n ans += N*(N-1)/2\nif M > 1:\n ans += M*(M-1)/2\nprint(ans)\n', 'N, M = map(int, input().split())\nans = 0\nif N > 1:\n ans += N*(N-1)/2\nif M > 1:\n ans += M*(M-1)/2\nprint(int(ans))\n'] | ['Wrong Answer', 'Accepted'] | ['s111436765', 's373776097'] | [2940.0, 2940.0] | [17.0, 18.0] | [114, 119] |
p02729 | u540761833 | 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 comb(a,b):\n import math\n return math.factorial(a)/(math.factorial(a-b)*math.factorial(b))\nN,M = map(int,input().split())\nans = 0\nif N > 1:\n ans += comb(N,2)\nif M > 1:\n ans += comb(M,2)\n\nprint(ans)\n', 'def comb(a,b):\n import math\n return math.factorial(a)//(math.factorial(a-b)*math.factorial(b))\nN,M = map(int,input().split())\nans = 0\nif N > 1:\n ans += comb(N,2)\nif M > 1:\n ans += comb(M,2)\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s211156234', 's347284092'] | [2940.0, 2940.0] | [17.0, 17.0] | [213, 214] |
p02729 | u542267798 | 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. | ['num_list = [int(i) for i in input().split()]\nsum = 0\nfor i in num_list:\n if i != 1:\n sum += i*(i-1)/2\n\nprint(sum)', 'num_list = [int(i) for i in input().split()]\nsum = 0\nfor i in num_list:\n if i > 1:\n sum += i*(i-1)/2\n\nprint(int(sum))'] | ['Wrong Answer', 'Accepted'] | ['s051422133', 's029151502'] | [2940.0, 3064.0] | [17.0, 17.0] | [117, 121] |
p02729 | u546573715 | 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 = (N-1)*N/2\nans =ans + (M-1)*M/2\nprint(ans)', 'N,M = int(input().split()) \nall = N+M\nans = (N-1)*N/2\nans =ans + (M-1)*M/2\nprint(ans)\n', 'N,M = map(int,input()) \nans = (N-1)*N/2\nans =ans + (M-1)*M/2\nprint(ans)', 'N,M = map(int,input().split()) \nans = (N-1)*N//2\nans =ans + (M-1)*M//2\nprint(ans)'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s306062314', 's646266232', 's967282883', 's599271002'] | [2940.0, 3060.0, 2940.0, 3060.0] | [20.0, 18.0, 17.0, 19.0] | [79, 112, 71, 81] |
p02729 | u548127991 | 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())\nn=int(n)\nm=int(m)\nprint(((n*(n-1))+(m*(m-1)))/2)', 'n=int(input())\nm=int(input())\nrate=2*n*m/((n+m)*(n+m-1))\nprint(int((n+m)*rate))', 'n,m=(input().split())\nn=int(n)\nm=int(m)\nrate=2*n*m/((n+m)*(n+m-1))\nprint(int((n+m)*rate))', 'n,m=(input().split())\nn=int(n)\nm=int(m)\nprint(int(((n*(n-1))+(m*(m-1)))/2))'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s525532133', 's858988218', 's909379942', 's672781270'] | [3060.0, 2940.0, 2940.0, 3060.0] | [19.0, 17.0, 17.0, 17.0] | [70, 79, 89, 75] |
p02729 | u548545174 | 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\nimport math\n\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nprint(combinations_count(N, 2) + combinations_count(M, 2))', 'N, M = map(int, input().split())\n\nprint(N*(N-1)//2 + M*(M-1)//2)'] | ['Runtime Error', 'Accepted'] | ['s004557038', 's804562460'] | [2940.0, 2940.0] | [17.0, 17.0] | [214, 64] |
p02729 | u549603397 | 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'] | ['s284494679', 's179485778'] | [2940.0, 2940.0] | [18.0, 17.0] | [57, 64] |
p02729 | u551020541 | 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\nn,m = map(int,input().split())\n\nN = factorial(n)/factorial(2)/factorial(n-2)\nM = factorial(m)/factorial(2)/factorial(m-2)\n\nprint(N+M)\n', 'from scipy.special import comb\n\nn,m = map(int,input().split())\n\nans = comb(n,2,exact=True) + comb(m,2,exact=True)\n', 'from math import factorial\nn,m = map(int,input().split())\n\nN = factorial(n)/factorial(2)/factorial(n-2)\nM = factorial(M)/factorial(2)/factorial(m-2)\n\nprint(N+M)\n', 'from scipy.special import import comb\n\nn,m = map(int,input().split())\n\nans = comb(n,2,exact=True) + comb(m,2,exact=True)\n', 'from math import factorial\nn,m = map(int,input().split())\n\nif n == 0:\n N = 0\nelif n == 1:\n N = 0\nelse:\n N = factorial(n)/factorial(2)/factorial(n-2)\nif m == 0:\n M = 0\nelif m == 1:\n M = 0\nelse:\n M = factorial(m)/factorial(2)/factorial(m-2)\n\nprint(int(N+M))\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s410914157', 's634270736', 's791814754', 's896184497', 's383428894'] | [2940.0, 14388.0, 2940.0, 2940.0, 3060.0] | [17.0, 190.0, 17.0, 17.0, 18.0] | [161, 114, 161, 121, 272] |
p02729 | u551066908 | 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 = [int(i) for i in input().split()]\n\nx= a[0] * (a[0]-1) * (1/2)\n\nx+= a[1] * (a[1]-1) * (1/2)\n\nprint(x)', 'a = [int(i) for i in input().split()]\n\nx= a[0] * (a[0]-1) * (1/2)\n\nx+= a[1] * (a[1]-1) * (1/2)\n\nprint(int(x))\n'] | ['Wrong Answer', 'Accepted'] | ['s181084999', 's840170224'] | [2940.0, 2940.0] | [17.0, 17.0] | [104, 110] |
p02729 | u551786761 | 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())\n \nsumma=0\nif N>1:\n summa+=math.factorial(N)/(math.factorial(2)*math.factorial(N-2))\nif M>1:\n summa+=math.factorial(M)/(math.factorial(2)*math.factorial(M-2))\n \nprint(summa)', 'N, M = map(int, input().split())\n\nsumma=0\nif N>1:\n summa+=math.factorial(N)/(math.factorial(2)*math.factorial(N-2))\nif M>1:\n summa+=math.factorial(M)/(math.factorial(2)*math.factorial(M-2))\n \nprint(summa)', 'import math\n\nN, M = map(int, input().split())\n \nsumma=0\nif N>1:\n summa+=math.factorial(N)/(math.factorial(2)*math.factorial(N-2))\nif M>1:\n summa+=math.factorial(M)/(math.factorial(2)*math.factorial(M-2))\n \nprint(int(summa))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s496005924', 's817406332', 's534521017'] | [3064.0, 3060.0, 3060.0] | [17.0, 18.0, 17.0] | [231, 207, 236] |
p02729 | u556441284 | 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(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', 'Wrong Answer', 'Accepted'] | ['s210962395', 's852976368', 's492809124'] | [2940.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0] | [69, 69, 74] |
p02729 | u556594202 | 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)\nflag = True\n\nif S!=S[::-1]:\n flag=False\nif S[:int((N-1)/2)]!=S[:int((N-1)/2)][::-1]:\n flag=False\nprint("Yes" if flag else "No")', 'N,M = map(int,input().split())\nprint(int(N*(N-1)/2 + M*(M-1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s339194230', 's853519955'] | [8992.0, 8956.0] | [27.0, 29.0] | [156, 64] |
p02729 | u557494880 | 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 = L**3\nans = ans / 27\nprint(ans)', 'N,M = map(int,input().split())\nans = (N*(N-1))//2 + (M*(M-1))//2\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s503966244', 's337994766'] | [2940.0, 2940.0] | [17.0, 17.0] | [53, 75] |
p02729 | u557565572 | 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,input().split())\nimport math\ndef c(n,k):\n return math.factorial(n)//math.factorial(k)//math.factorial(n-k)\n\nprint(c(n,2) + c(m,2))', '\nn,m = map(int,input().split())\nimport math\n\nprint(n*(n-1)//2 + m*(m-1)//2)'] | ['Runtime Error', 'Accepted'] | ['s646802399', 's794309458'] | [3060.0, 2940.0] | [20.0, 19.0] | [148, 75] |
p02729 | u559250296 | 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 numpy\nimport copy\nN = int(input())\nE= list(map(int,input().split()))\nans = [0 for _ in range(N)]\nunique = numpy.unique(E)\n#for s in range(len(unique)):\n\nuniqueNum = [0 for _ in range(len(unique))]\n\nuniqueAns = [0 for _ in range(len(unique))]\n\ny =0\nfor t in range(len(unique)):\n uniqueNum[t] = E.count(unique[t])\nfor g in range(len(unique)):\n uni = copy.copy(uniqueNum)\n uni[g] = uni[g] -1\n for h in range(len(unique)):\n y = y + uni[h] * (uni[h]-1)/2\n uniqueAns[g] = y\nfor k in range(N):\n for w in range(len(uni)):\n if unique[w] == E[k]:\n ans[k] = uniqueAns[w]\n break\nfor i in range(N):\n print(int(ans[i]))', 'S = input().split()\nN = int(S[0])\nM = int(S[1])\n\nprint(N * (N-1)/2 + M * (M-1)/2)', 'S = input().split()\nN = int(S[0])\nM = int(S[1])\n\nprint(int(N * (N-1)/2 + M * (M-1)/2))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s084221784', 's100870442', 's537898371'] | [12512.0, 2940.0, 2940.0] | [150.0, 17.0, 18.0] | [691, 81, 86] |
p02729 | u563052724 | 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()\nn=int(n)\nm=int(m)\n\nnout =n* (n-1)/2\nmout =m* (m-1)/2\n\nprint(nout+mout)', 'n,m = input().split()\nn=int(n)\nm=int(m)\n\nnout =n* (n-1)//2\nmout =m* (m-1)//2\n\nprint(nout+mout)\n'] | ['Wrong Answer', 'Accepted'] | ['s292963705', 's614328085'] | [3060.0, 2940.0] | [19.0, 17.0] | [92, 95] |
p02729 | u564837886 | 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())\noo = n * (n-1) / 2\nee = m * (m-1) / 2\n\nprint(oo + ee)\n', 'n, m = map(int, input().split())\noo = n * (n-1) / 2\nee = m * (m-1) / 2\n\nprint(int(oo + ee))\n'] | ['Wrong Answer', 'Accepted'] | ['s674921146', 's225973324'] | [2940.0, 2940.0] | [17.0, 17.0] | [87, 92] |
p02729 | u569117803 | 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. | ['print((int(input())/3)**3)', 'm, n = list(map(int, input().split(" ")))\nans = int((m * (m - 1))/ 2) + int((n * (n - 1))/ 2)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s840884373', 's483140083'] | [2940.0, 3064.0] | [17.0, 17.0] | [26, 104] |
p02729 | u573234244 | 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\nimport math\n\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n \nif n <= 1 and m <= 1:\n print(0)\nelif n == 1 and m <= 1:\n print(comb(m,2))\nelif n <= 1 and m == 1:\n print(comb(n,2))\nelse:\n print(comb(n,2) + comb(m,2))', 'n,m = map(int, input().split())\n\nimport math\n\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nif n == 0:\n base1 = 0\nelif n == 1:\n base1 = 0\nelse:\n base1 = comb(n,2)\n\nif m == 0:\n base2 = 0\nelif m == 1:\n base2 = 0\nelse:\n base2 = comb(m,2)\n\nprint(base1 + base2)'] | ['Runtime Error', 'Accepted'] | ['s995291393', 's620335271'] | [3060.0, 3064.0] | [17.0, 17.0] | [304, 321] |
p02729 | u574053975 | 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()))\nprint((a[0]*(a[0]-1))+(a[1]*(a[1]-1)))', 'a=list(map(int,input().split()))\nout=int((a[0]*(a[0]-1))/2+(a[1]*(a[1]-1))/2)\nprint(out)\n'] | ['Wrong Answer', 'Accepted'] | ['s741850379', 's461192319'] | [2940.0, 2940.0] | [17.0, 17.0] | [71, 89] |
p02729 | u574464625 | 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\nn,m = map(int, input().split())\n\nans=0\nif n>=2:\n ans+=n*(n-1)/2\nif m>=2:\n ans+=m*(m-1)/2\nprint(ans)', '#A\nn,m = map(int, input().split())\n\nans=0\nif n>=2:\n ans+=n*(n-1)/2\nif m>=2:\n ans+=m*(m-1)/2\nprint(int(ans))'] | ['Wrong Answer', 'Accepted'] | ['s405446078', 's266664413'] | [9172.0, 9176.0] | [26.0, 32.0] | [108, 113] |
p02729 | u574565611 | 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(map(str,input().split()))\nN = int(len(S))\nS_a = S[:(N-1)//2]\nS_b = S[(N+1)//2:]\n\nif S == S[::-1] and S_a == S_a[::-1] and S_b == S_b[::-1]:\n print("Yes")\nelse:\n print("No")', 'S = input()\nN = int(len(S))\nS_a = S[:(N-1)//2]\nS_b = S[(N+1)//2:]\n#print(S)\nif S == S[::-1] and S_a == S_a[::-1] and S_b == S_b[::-1]:\n print("Yes")\nelse:\n print("No")', 'N,M = map(int,input().split())\nprint((N*(N-1)+M*(M-1))/2)', '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)+M*(M-1))/2))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s052142116', 's446647145', 's545705463', 's725611469', 's539526027'] | [3060.0, 3060.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0, 17.0] | [187, 173, 57, 57, 62] |
p02729 | u577146296 | 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\nans = (a * (a - 1) / 2) + (b * (b - 1) / 2)\nprint(ans)\n', 'a, b = map(int, input().split())\n\nans = round((a * (a - 1) / 2) + (b * (b - 1) / 2))\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s637102582', 's552588480'] | [2940.0, 2940.0] | [18.0, 18.0] | [89, 96] |
p02729 | u578647703 | 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. | ['M, N = map(int, input().split())\nresult = 0\n\ndef fact(num):\n result = 1\n while num > 1:\n result *= num\n num -= 1\n return result\n\nresult += fact(M) / (fact(2) * fact(M-2))\nresult += fact(N) / (fact(2) * fact(N-2))\n\nprint(round(result))', 'M, N = map(int, input().split())\nresult = 0\n\ndef fact(num):\n result = 1\n while num > 1:\n result *= num\n num -= 1\n return result\n\nif M!=0 or M!=1:\n result += fact(M) // (fact(2) * fact(M-2))\n\nif N!=0 or N!=1:\n result += fact(N) // (fact(2) * fact(N-2))\n\nprint(result)'] | ['Wrong Answer', 'Accepted'] | ['s124885580', 's227740884'] | [3060.0, 3060.0] | [17.0, 18.0] | [257, 295] |
p02729 | u581187895 | 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 itertools import combinations\n\ndef resolve():\n N, M = map(int, input().split())\n n = len(list(combinations(range(N), 2)))\n if M >= 2:\n m = len(list(combinations(range(M), 2)))\n else:\n m = 0\n return print(n+m)', 'from itertools import combinations\n\ndef resolve():\n N, M = map(int, input().split())\n balls = [2]*N + [1]*M\n ans = 0\n for x, y in combinations(balls, 2):\n if (x+y)%2 == 0:\n ans += 1\n return print(ans)\n\nif __name__ == "__main__":\n resolve()'] | ['Wrong Answer', 'Accepted'] | ['s020311902', 's413817073'] | [3060.0, 3060.0] | [17.0, 19.0] | [242, 275] |
p02729 | u581403769 | 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\nif n >= 2:\n a = n * (n - 1) / 2\nelse:\n a = 0\n\nif m >= 2:\n b = m * (m - 1) / 2\nelse:\n b = 0\n \nprint(a + b)', 'n, m = map(int, input().split())\n\nif n >= 2:\n a = n * (n - 1) / 2\nelse:\n a = 0\n\nif m >= 2:\n b = m * (m - 1) / 2\nelse:\n b = 0\n \nprint(int(a + b))\n'] | ['Wrong Answer', 'Accepted'] | ['s121239230', 's415311851'] | [9116.0, 9152.0] | [27.0, 26.0] | [154, 160] |
p02729 | u581603131 | 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 = int(len(S))\na = 0\n\nleft = []\nfor i in range(0,int((N-1)/2)):\n left += S[i]\nfor i in range(0,int((N-1)/4)):\n if left[i] == left[-i-1]:\n a += 1\n\nright = []\nfor i in range(0,int((N-1)/2)):\n right += S[-i-1]\nfor i in range(0,int((N-1)/4)):\n if right[i] == right[-i-1]:\n a += 1\n\nif a == int((N-1)/2) + int((N-1)//4 * 2) -1:\n\tprint('Yes')\nelse :\n print('No')", "S = input()\nN = int(len(S))\na = 0\nfor i in range(0,int((N-1)/2)): \n if S[i] == S[-i-1]:\n a += 1\n\nleft = []\nfor i in range(0,int((N-1)/2)):\n left += S[i]\nif left == left.reverse():\n a += 1\n\nright = []\nfor i in range(0,int((N-1)/2)):\n right += S[-i-1]\nif right == right.reverse():\n a += 1\n\nif a == 3:\n\tprint('Yes')\nelse :\n print('No')", 'N, M = map(int, input().split())\nn = N*(N-1)/2\nm = M*(M-1)/2\nprint(int(n+m))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s046753277', 's711093042', 's299660640'] | [3064.0, 3064.0, 2940.0] | [18.0, 17.0, 17.0] | [393, 450, 76] |
p02729 | u589340330 | 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'] | ['s427186297', 's535790957'] | [9072.0, 9076.0] | [29.0, 30.0] | [59, 66] |
p02729 | u589578850 | 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', '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(int(n*(n-1)/2 + m*(m-1)/2))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s159069249', 's869034972', 's480732179'] | [2940.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0] | [58, 62, 67] |
p02729 | u592035627 | 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\nM,N = list(map(int,input().split()))\ndef comb(n,r):\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n \n \nA = comb(M,2)\nB = comb(N,2)\nprint(A+B)', 'import math\nM,N = list(map(int,input().split()))\ndef comb(n,r):\n if n >= r:\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n else:\n return 0\n \n \nA = comb(M,2)\nB = comb(N,2)\nprint(A+B)'] | ['Runtime Error', 'Accepted'] | ['s960475725', 's157546546'] | [3060.0, 3060.0] | [18.0, 17.0] | [178, 224] |
p02729 | u593442720 | 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())\nprint(pow(n / 3, 3))', 'n, m = input().split()\nn = int(n)\nm = int(m)\nprint((n * (n - 1) / 2) + (m * (m - 1) / 2))', 'n, m = input().split()\nn = int(n)\nm = int(m)\nans = (n * (n - 1) / 2) + (m * (m - 1) / 2)\nprint(round(ans))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s731489097', 's926864373', 's333190665'] | [2940.0, 2940.0, 2940.0] | [17.0, 18.0, 18.0] | [37, 89, 106] |
p02729 | u595905528 | 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\nans = N*M + M(M-1)//2\nprint(ans)', 'N,M = map(int,input().split())\n\nans = N*M + M*(M-1)//2\nprint(ans)\n', 'N,M = map(int,input().split())\n\nans = (N+M)*(N+M+1)//2 - N*M\nprint(ans)\n', 'N,M = map(int,input().split())\n\nans = (N+M)*(N+M-1)//2 - N*M\nprint(ans)\n\n'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s438250680', 's795543078', 's870453262', 's721156348'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 18.0] | [64, 66, 72, 73] |
p02729 | u595952233 | 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\nfrom io import StringIO\nimport unittest\n\ndef resolve():\n n, m = map(int, input().split())\n print(int(n*(n-1)/2+m*(m-1)/2))\n\nclass TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_入力例_1(self):\n input = """2 1"""\n output = """1"""\n self.assertIO(input, output)\n\n def test_入力例_2(self):\n input = """4 3"""\n output = """9"""\n self.assertIO(input, output)\n\n def test_入力例_3(self):\n input = """1 1"""\n output = """0"""\n self.assertIO(input, output)\n\n def test_入力例_4(self):\n input = """13 3"""\n output = """81"""\n self.assertIO(input, output)\n\n def test_入力例_5(self):\n input = """0 3"""\n output = """3"""\n self.assertIO(input, output)\n\n\nif __name__ == "__main__":\n unittest.main()\n', 'import sys\nfrom io import StringIO\nimport unittest\n\ndef resolve():\n n, m = map(int, input().split())\n print(int(n*(n-1)/2+m*(m-1)/2))\n\nclass TestClass(unittest.TestCase):\n def assertIO(self, input, output):\n stdout, stdin = sys.stdout, sys.stdin\n sys.stdout, sys.stdin = StringIO(), StringIO(input)\n resolve()\n sys.stdout.seek(0)\n out = sys.stdout.read()[:-1]\n sys.stdout, sys.stdin = stdout, stdin\n self.assertEqual(out, output)\n\n def test_入力例_1(self):\n input = """2 1"""\n output = """1"""\n self.assertIO(input, output)\n\n def test_入力例_2(self):\n input = """4 3"""\n output = """9"""\n self.assertIO(input, output)\n\n def test_入力例_3(self):\n input = """1 1"""\n output = """0"""\n self.assertIO(input, output)\n\n def test_入力例_4(self):\n input = """13 3"""\n output = """81"""\n self.assertIO(input, output)\n\n def test_入力例_5(self):\n input = """0 3"""\n output = """3"""\n self.assertIO(input, output)\n\n\nif __name__ == "__main__":\n # unittest.main()\n resolve()\n'] | ['Wrong Answer', 'Accepted'] | ['s941552468', 's772000655'] | [5720.0, 5592.0] | [46.0, 42.0] | [1144, 1160] |
p02729 | u598480992 | 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. | ["inp = input().split(' ')\n\nn = int(inp[0])\nm = int(inp[1])\n\nncount = 0 if n < 2 else n*(n-1)/2\nmcount = 0 if m < 2 else m*(m-1)/2\n\nprint(str(ncount + mcount))", "n,m = input().split(' ')\n\nncount = 0 if n < 2 else n*(n-1)/2\nmcount = 0 if m < 2 else m*(m-1)/2\n\nprint(str(ncount + mcount))", "inp = input().split(' ')\n\nn = int(inp[0])\nm = int(inp[1])\n\nncount = 0 if n < 2 else n*(n-1)//2\nmcount = 0 if m < 2 else m*(m-1)//2\n\nprint(str(ncount + mcount))"] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s319074449', 's814654765', 's829161513'] | [3064.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [157, 124, 159] |
p02729 | u599547273 | 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)//2 + M*(M-1)//2)'] | ['Wrong Answer', 'Accepted'] | ['s397530228', 's207509987'] | [9152.0, 9096.0] | [27.0, 26.0] | [58, 64] |
p02729 | u606001175 | 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))\n', 'a,b = map(int,input().split())\nprint((a * (a + 1) / 2) + (b * (b + 1) / 2))', 'a,b = map(int,input().split())\nprint(int((a * (a - 1) / 2) + (b * (b - 1) / 2)))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s392545272', 's943520079', 's457939747'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [76, 75, 81] |
p02729 | u606146341 | 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 = float(input())\n\nans = float((L/3)**3)\n\nprint(ans)', 'm, n = map(int, input().split())\n\nans = n * (n - 1) // 2 + m * (m - 1) // 2\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s103083893', 's856119936'] | [2940.0, 2940.0] | [17.0, 18.0] | [53, 88] |
p02729 | u607075479 | 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'] | ['s463930938', 's976768659'] | [2940.0, 2940.0] | [17.0, 17.0] | [61, 66] |
p02729 | u607729897 | 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 kaibun(s):\n if s == s[::-1]:\n flg = True\n else:\n flg = False\n return flg\n\nS = input()\nN = len(S)\nans = 'Yes'\nif kaibun(S):\n pass\nelse:\n ans = ('No')\nif kaibun(S[:(N-1)//2]):\n pass\nelse:\n ans = ('No')\nif kaibun(S[:(-(N-1)//2)-1:-1]):\n pass\nelse:\n ans = ('No')\nprint(ans)", 'N, M = map(int, input().split())\nnC2 = N * (N - 1) / 2\nmC2 = M * (M - 1) / 2\nprint(nC2+mC2)', 'N, M = map(int, input().split())\nnC2 = N * (N - 1) / 2\nmC2 = M * (M - 1) / 2\nprint(int(nC2+mC2))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s167997249', 's724184206', 's625551077'] | [3188.0, 2940.0, 2940.0] | [18.0, 17.0, 18.0] | [288, 91, 97] |
p02729 | u608007704 | 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=input()\nA=int(A)\nB=int(B)\n\nnum=0\nnum+=A*(A-1)//2\nnum+=B*(B-1)//2\nprint(num)', "A,B=input().split(' ')\nA=int(A)\nB=int(B)\n\nnum=0\nnum+=A*(A-1)//2\nnum+=B*(B-1)//2\nprint(num)\n"] | ['Runtime Error', 'Accepted'] | ['s326731661', 's361808273'] | [3060.0, 2940.0] | [17.0, 17.0] | [79, 91] |
p02729 | u609093494 | 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 = (n+m)*(n+m-1)/2 - n*m\nprint(answer)', 'n, m = map(int,input(). split())\nanswer = (n+m)*(n+m-1)//2-n*m\nprint(answer)\n'] | ['Wrong Answer', 'Accepted'] | ['s120149912', 's759267019'] | [2940.0, 2940.0] | [17.0, 17.0] | [77, 77] |
p02729 | u611033537 | 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\nc = N(N-1) + M(M-1)\nprint(a + b + c)', 'N,M=map(int,input().split())\nprint((N**2-N)/2 + (M**2-M)/2)', 'N,M=map(int,input().split())\nAns = (N**2-N)/2 + (M**2-M)/2\nprint(int(Ans))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s265398409', 's298994186', 's518864738'] | [3060.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0] | [102, 59, 74] |
p02729 | u611352758 | 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())\nn=N*(N-1)\nm=M*(M-1)\nprint((n+m)/2)', 'N,M= map(int,input().split())\nn=N*(N-1)\nm=M*(M-1)\nprint((n+m)//2)'] | ['Wrong Answer', 'Accepted'] | ['s512017829', 's757641346'] | [2940.0, 2940.0] | [17.0, 17.0] | [63, 65] |
p02729 | u612071939 | 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(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', 'Wrong Answer', 'Accepted'] | ['s252986602', 's320447349', 's673932930'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [61, 64, 66] |
p02729 | u612895604 | 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 n >= 2:\n ret_n = n * (n - 1) / 2\nelse:\n ret_n = 0\n\nif m >= 2:\n ret_m = m * (m - 1) / 2\nelse:\n ret_m = 0\n\nprint(ret_n + ret_m)\n", "import math\n\nn, m = map(int, input().split(' '))\nif n >= 2:\n ret_n = n * (n - 1) / 2\nelse:\n ret_n = 0\n\nif m >= 2:\n ret_m = m * (m - 1) / 2\nelse:\n ret_m = 0\n\nprint(int(ret_n + ret_m))\n"] | ['Wrong Answer', 'Accepted'] | ['s477862736', 's328383364'] | [2940.0, 2940.0] | [17.0, 17.0] | [190, 195] |
p02729 | u614628638 | 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 defaultdict\nfrom itertools import product\n \nH,W,K = map(int,input().split())\nS = [input() for i in range(H)]\n \nC = [[int(S[i][k]) for i in range(H)] for k in range(W)]\nanswer = H*W \nfor X in product([False,True],repeat = H-1):\n M = [[0]]\n ans = sum(X)\n if ans > answer:\n continue\n for i,x in enumerate(X):\n if x:\n M.append([])\n M[-1].append(i+1)\n D = [0]*len(M)\n for c in C:\n for k,m in enumerate(M):\n D[k] += sum(c[i] for i in m)\n \n if any(d>K for d in D):\n ans += 1\n if ans >answer:\n break\n D = [sum(c[i] for i in m) for m in M]\n if any(d>K for d in D):\n ans = answer + 1\n \n break\n answer = min(answer,ans)\nprint(answer)', "from collections import defaultdict\nfrom itertools import product\n \nH, W, K = map(int, input().split())\nS = [input() for _ in range(H)]\n \ni = 0\nwhile i < len(S):\n if '1' in S[i]:\n i += 1\n else:\n del S[i]\nH = len(S)\n \nC = [[int(s[i]) for s in S] for i in range(W)]\n \ntotal = sum(sum(c) for c in C)\n \nif total <= K:\n answer = 0\nelse:\n answer = H * W\n for X in product([False, True], repeat=H-1):\n \n ans = sum(X)\n if ans > answer:\n continue\n M = [[0]]\n for i, x in enumerate(X):\n if x:\n M.append([])\n M[-1].append(i+1)\n print('M{}'.format(M))\n D = [0] * len(M)\n for c in C:\n print('c{}'.format(c))\n for k, m in enumerate(M):\n print('m{}'.format(m))\n D[k] += sum(c[i] for i in m)\n \n print('D1{}'.format(D))\n if any(d > K for d in D):\n ans += 1\n if ans > answer:\n break\n D = [sum(c[i] for i in m) for m in M]\n print('D2{}'.format(D))\n if any(d > K for d in D):\n ans = answer + 1\n break\n answer = min(answer, ans)\n\nprint(answer)", 'import numpy as np\na = [int(i) for i in list(input().split())]\nb = int((a[0]*(a[0]-1) +a[1]*(a[1]-1))/2)\n\nprint(b)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s675093789', 's789657125', 's670391848'] | [3316.0, 3316.0, 21800.0] | [20.0, 21.0, 1981.0] | [1242, 1612, 114] |
p02729 | u614964888 | 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\nif N==0 :\n print(M*(M-1)/2)\nelif M==0 :\n print(N*(N-1)/2)\nelse :\n print(N*(N-1)/2+M*(M-1)/2)', 'N,M=map(int, input().split())\n \nif N==0 :\n print(M*(M-1)//2)\nelif M==0 :\n print(N*(N-1)//2)\nelse :\n print(N*(N-1)//2+M*(M-1)//2)'] | ['Wrong Answer', 'Accepted'] | ['s119714798', 's645046912'] | [2940.0, 3060.0] | [17.0, 17.0] | [132, 137] |
p02729 | u615323709 | 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())\nnum = 2/n*(n-1) + 2/m*(m-1)\nprint(num)', 'n, m = map(int, input().split())\nnum = ((n**2-n)//2) + ((m**2-m)//2)\nprint(num)'] | ['Runtime Error', 'Accepted'] | ['s509424912', 's950435867'] | [2940.0, 2940.0] | [18.0, 17.0] | [71, 79] |
p02729 | u616468898 | 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(int(sum([N*(N-1)/2 if N >= 2 else N, M*(M-1)/2 if M >= 2 else M])))", "N, M = map(int, input().split(' '))\nprint(int(sum([N*(N-1)/2 if N >= 2 else 0, M*(M-1)/2 if M >= 2 else 0])))"] | ['Wrong Answer', 'Accepted'] | ['s622984689', 's934426134'] | [2940.0, 2940.0] | [17.0, 17.0] | [109, 109] |
p02729 | u616542081 | 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\nans = N*(N-1) /2+ M*(M-1)/2\n\nprint(ans)', 'N, M = map(int, input().split())\n\nans = N*(N-1) + M*(M-1)\n\nprint(ans)', 'N, M = map(int, input().split())\n\nans = int(N*(N-1) /2+ M*(M-1)/2)\n\nprint(ans)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s416353173', 's568187233', 's039544878'] | [9148.0, 9152.0, 9148.0] | [30.0, 26.0, 25.0] | [73, 69, 79] |
p02729 | u617037231 | 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())\nQ = N*(N-1)*0.5\nP = M*(M-1)*0.5\nprint(P+Q)\n', 'N,M = map(int,input().split())\nQ = N*(N-1)*0.5\nP = M*(M-1)*0.5\nprint(int(P+Q))'] | ['Wrong Answer', 'Accepted'] | ['s570206668', 's519727885'] | [2940.0, 2940.0] | [17.0, 17.0] | [74, 78] |
p02729 | u617103038 | 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\nnc=0\nmc=0\nif n >=2:\n nc=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))\nif m>=2:\n mc=math.factorial(m) // (math.factorial(m - 2) * math.factorial(2))\n\nprint(nc+mc)\n', 'import math\n\ndef resolve():\n\n n, m = map(int, input().split())\n\n nc=0\n mc=0\n if n >=2:\n nc=math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))\n if m>=2:\n mc=math.factorial(m) // (math.factorial(m - 2) * math.factorial(2))\n\n print(nc+mc)\n\nresolve()'] | ['Runtime Error', 'Accepted'] | ['s239525825', 's332878686'] | [2940.0, 3060.0] | [17.0, 17.0] | [221, 292] |
p02729 | u617225232 | 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'] | ['s894022248', 's553176729'] | [2940.0, 3316.0] | [17.0, 20.0] | [58, 65] |
p02729 | u617228707 | 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 = np.zeros((N+1,S+1,3),dtype=np.int16)\n', 'import numpy as np\nN,S = map(int,input().split())\nlist = list(map(int,input().split()))\nA = np.zeros((N+1,S+1,3),dtype=np.int16)\nA[0][0][0] = 1\n', 'N,M = map(int,input().split())\nprint(N*(N-1)//2+(M*(M-1))//2)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s042181125', 's753839723', 's681927688'] | [2940.0, 12392.0, 2940.0] | [17.0, 152.0, 17.0] | [41, 144, 61] |
p02729 | u619398783 | 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 = list(map(int,input().split()))\noutput = n*(n-1)/2+m*(m-1)/2\nprint(output)', 'n,m = list(map(int,input().split()))\noutput = n*(n-1)/2+m*(m-1)/2\nprint(int(output))'] | ['Wrong Answer', 'Accepted'] | ['s930636726', 's922040042'] | [2940.0, 2940.0] | [17.0, 17.0] | [79, 84] |
p02729 | u620238824 | 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 = N * (N - 1) / 2 + M * (M - 1) / 2\nprint(ans)', 'N, M = map(int, (input().split()))\nans = int(N * (N - 1) / 2 + M * (M - 1) / 2)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s798876722', 's798674614'] | [2940.0, 2940.0] | [17.0, 17.0] | [85, 90] |
p02729 | u620464724 | 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\nsys.setrecursionlimit(2147483647)\n\nn,m = map(int,input().split())\na = n - 1\nb = m - 1\nans = 0\n\nif m <= 1:\n ans = n*a/2\nelse:\n ans = n*a/2 + m*b/2\n\nprint(str(int(ans))', 'import sys\nsys.setrecursionlimit(2147483647)\n\nn,m = map(int,input().split())\na = n - 1\nb = m - 1\nans = 0\n\nif m <= 1:\n ans = n*a/2\nelse:\n ans = n*a/2 + m*b/2\n\nprint(str(int(ans)))'] | ['Runtime Error', 'Accepted'] | ['s281930778', 's532084184'] | [2940.0, 3060.0] | [18.0, 17.0] | [183, 184] |
p02729 | u620755587 | 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. | ['#!/usr/bin/env python3\n\nimport sys\n\nsys.setrecursionlimit(10 ** 6)\n\n\ndef main():\n\tpass\n\nmain()', '#!/usr/bin/env python3\n\nimport sys\nimport math\nsys.setrecursionlimit(10 ** 6)\n\n\ndef main():\n\tn, m = map(int, sys.stdin.readline().split())\n\tscore = 0\n\tif n >= 2:\n\t\tscore += math.factorial(n) // math.factorial(n-2) // math.factorial(2)\n\tif m >= 2:\n\t\tscore += math.factorial(m) // math.factorial(m-2) // math.factorial(2)\n\tprint(score)\n\nmain()'] | ['Wrong Answer', 'Accepted'] | ['s220529088', 's661194516'] | [2940.0, 3060.0] | [18.0, 17.0] | [94, 341] |
p02729 | u621225737 | 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(1/2 * N * (N - 1) + 1/2 * M * (M - 1)) ', 'N, M = map(int,input().split())\n\nprint(int(1/2 * N * (N - 1) + 1/2 * M * (M - 1))) '] | ['Wrong Answer', 'Accepted'] | ['s195759853', 's572673830'] | [2940.0, 2940.0] | [17.0, 17.0] | [78, 83] |
p02729 | u624613992 | 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())\nn2 = n*(n-1)/2\nm2 = m*(m-1)/2\n\nprint((n2+m2)//1)', 'n,m = import math\nn,m = map(int,input().split())\nprint(math.factorial(n)+math.factorial(m))', 'import math\nn,m = map(int,input().split())\nn2 = n*(n-1)/2\nm2 = m*(m-1)/2\n\nprint(round(n2+m2))'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s134036443', 's891669159', 's811187977'] | [3060.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0] | [91, 91, 93] |
p02729 | u625864724 | 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 < 2):\n a = 0\nelse:\n a = n*(n - 1)/2\nif (m < 2):\n b = 0\nelse:\n b = m*(m - 1)/2\nprint(a + b)', 'n, m = map(int,input().split())\nif (n < 2):\n a = 0\nelse:\n a = int(n*(n - 1)/2)\nif (m < 2):\n b = 0\nelse:\n b = int(m*(m - 1)/2)\nprint(a + b)\n'] | ['Wrong Answer', 'Accepted'] | ['s310625368', 's174977056'] | [9112.0, 9064.0] | [32.0, 29.0] | [132, 143] |
p02729 | u627057223 | 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(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', 'Accepted'] | ['s979004340', 's907036729'] | [9180.0, 9032.0] | [24.0, 25.0] | [56, 64] |
p02729 | u627213696 | 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'] | ['s548192191', 's100155268'] | [2940.0, 2940.0] | [17.0, 17.0] | [59, 64] |
p02729 | u629350026 | 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(n*(n-1)//2+m*(m-1)//2)'] | ['Wrong Answer', 'Accepted'] | ['s363593225', 's762646190'] | [2940.0, 2940.0] | [17.0, 17.0] | [57, 57] |
p02729 | u629540524 | 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 = list(map(int, input().split()))\n\nprint(n * (n - 1) // 2 + m * (m - 1) // 2 )'] | ['Runtime Error', 'Accepted'] | ['s987509305', 's268783882'] | [2940.0, 2940.0] | [17.0, 17.0] | [100, 105] |
p02729 | u629709614 | 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())\n\nfor inN in N:\n\tinN=N*2\n \n for inM in M:\n inM=M*2-1\n sum=inN+inM\n \n if sum%2==0:\n count.append(sum)\n \n else:\n break\n \n print(len(count))', 'def Even(x):\n return 2 * x\n\ndef Odd(x):\n return 2 * x - 1\n\nN, M = map(int, input().split())\nG = list(map(Even, range(1, N+1)))\nK = list(map(Odd, range(1, M+1)))\n\neven=list()\n\nfor n in range(0, N):\n for nm in range(n+1, N):\n even.append(G[n]+G[nm])\n \nfor m in range(0, M):\n for mm in range(m+1, M):\n even.append(K[m]+K[mm])\n\nprint(len(even))'] | ['Runtime Error', 'Accepted'] | ['s010044343', 's145242631'] | [2940.0, 3064.0] | [17.0, 19.0] | [223, 366] |
p02729 | u630452895 | 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(" "))\nn = a + b\nprint(n*(n-1)//2 - b * (b-1)//2)', 'a,b = map(int, input().split(" "))\nn = a + b\nprint(n*(n-1)//2 - b * a)\n'] | ['Wrong Answer', 'Accepted'] | ['s882745853', 's522463983'] | [2940.0, 2940.0] | [17.0, 17.0] | [77, 71] |
p02729 | u631579948 | 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())\nc=0\nwhile a>1 or b>1:\n if (a-2)>1 or (b-2)>1:\n a=a-2\n b=b-2\n c=c+1\nprint(c) \n', 'a,b=map(int,input().split())\nc=0\nwhile a>0 or b>0:\n if (a-2)>0 or (b-2)>0:\n a=a-2\n b=b-2\n c=c+1\nprint(c) \n', 'a,b=map(int,input().split()):\nc=0\nd=d*(d-1)//2\ne=e*(e-1)//2\nwhile d>0:\n d=d-1\n c=c+1\nwhile e>0:\n e=e-1\n c=c+1\nprint(c) \n \n ', 'a,b=map(int,input().split())\nc=0\nfor i in range(a+b)\n if (a-2)>0 or (b-2)>0:\n a=a-2\n b=b-2\n c=c+1\nprint(c) ', 'a,b=map(int,input().split())\nc=0\nd=a*(a-1)//2\ne=b*(b-1)//2\nwhile d>0:\n d=d-1\n c=c+1\nwhile e>0:\n e=e-1\n c=c+1\nprint(c) \n \n \n'] | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s026754698', 's688050718', 's868736717', 's957357324', 's066190415'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [2104.0, 2104.0, 17.0, 17.0, 20.0] | [117, 117, 129, 118, 129] |
p02729 | u632609425 | 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. | ['M,N=map(int,input().split())\ndef fact(n):\n\ts=1\n\tfor i in range(2,n):\n\t\ts=s*i\n\treturn s\n\ndef conb(n,r):\n\treturn fact(n)//(fact(r)*fact(n-r))\n\nprint(conb(M,2)+conb(N,2))', 'M,N=map(int,input().split())\ndef fact(n):\n\ts=1\n\tfor i in range(2,n+1):\n\t\ts=s*i\n\treturn s\n\ndef conb(n,r):\n\treturn fact(n)//(fact(r)*fact(n-r))\n\nif (N==1 or N==0) and (M==1 or M==0):\n\tprint(0)\nelif N==1 or N==0:\n\tprint(conb(M,2))\nelif M==1 or M==0:\n\tprint(conb(N,2))\nelse:\n\tprint(conb(M,2)+conb(N,2))\n'] | ['Wrong Answer', 'Accepted'] | ['s338685050', 's763203842'] | [3060.0, 3064.0] | [17.0, 17.0] | [167, 299] |
p02729 | u634046173 | 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())\nA = list(map(int,input().split()))\ncount = [0] * N\nfor i in range(N):\n count[A[i] - 1] += 1\n \nnanimo = 0 \nfor i in range(N):\n nanimo += count[i] * (count[i] - 1) // 2\nfor i in range(N):\n tekito = count[A[i] - 1]\n if tekito == 1:\n s = nanimo\n else:\n s = nanimo - ((tekito * (tekito - 1) //2) - ((tekito - 1) * (tekito - 2) //2))\n print(s)\n', 'N, M = map(int, input().split())\ngu = N * (N-1) //2\nki = M * (M-1) // 2\nprint(gu + ki)'] | ['Runtime Error', 'Accepted'] | ['s758745819', 's750154968'] | [3064.0, 2940.0] | [17.0, 17.0] | [370, 86] |
p02729 | u634079249 | 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\nimport os\n\n\ndef main():\n if os.getenv("LOCAL"):\n sys.stdin = open("input.txt", "r")\n\n L = int(sys.stdin.buffer.readline().rstrip())\n print(L ** 3 / 27)\n\n\nif __name__ == \'__main__\':\n main()\n', 'import sys\nimport os\nimport collections\n\ndef main():\n if os.getenv("LOCAL"):\n sys.stdin = open("input.txt", "r")\n\n N, M = list(map(int, sys.stdin.buffer.readline().split()))\n e = N * (N-1) // 2\n o = 0 if M <= 1 else M * (M-1) // 2\n print(e+o)\n\n\nif __name__ == \'__main__\':\n main()\n'] | ['Runtime Error', 'Accepted'] | ['s766493680', 's099299499'] | [2940.0, 3316.0] | [19.0, 21.0] | [219, 305] |
p02729 | u635252313 | 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())\nif n-2>0:\n a=math.factorial(n)//(math.factorial(2)*math.factorial(n-2))\nelse:\n a=0\nif m-2>0:\n b=math.factorial(m)//(math.factorial(2)*math.factorial(m-2))\nelse:\n b=0\nprint(a+b)', 'n,m=map(int,input().split())\ni=0\ni+=n*(n-1)/2\ni+=m*(m-1)/2\nprint(int(i))'] | ['Wrong Answer', 'Accepted'] | ['s451661109', 's209318346'] | [3060.0, 2940.0] | [18.0, 18.0] | [229, 72] |
p02729 | u636290142 | 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())\n\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nans = combinations_count(m, 2) + combinations_count(n, 2)\n\nprint(ans)\n', 'import math\n\nn, m = map(int, input().split())\n\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nif n >= 2 and m >= 2:\n ans = combinations_count(m, 2) + combinations_count(n, 2)\nelif n < 2 and m < 2:\n ans = 0\nelif n < 2:\n ans = combinations_count(m, 2)\nelif m < 2:\n ans = combinations_count(n, 2)\n\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s072089097', 's911706806'] | [9048.0, 9136.0] | [30.0, 24.0] | [226, 381] |
p02729 | u636665812 | 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 if(n>=r):\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n else:\n return 0\n\nf = open("input.txt", "r")\nsys.stdin = f\n\nm,n = map(int, input().split())\nans = comb(m, 2) + comb(n, 2)\nprint(ans)', 'import math\ndef comb(n, r):\n if(n>=r):\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n else:\n return 0\n \nm,n = map(int, input().split())\nans = comb(m, 2) + comb(n, 2)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s744360821', 's734175426'] | [3064.0, 3060.0] | [18.0, 17.0] | [258, 224] |
p02729 | u638867180 | 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:\n n = 0\nelse:\n n = N*(N-1) / 2\nif M > 1:\n m = 0\nelse:\n m = M*(M-1) / 2\nprint(n+m)', 'N,M=map(int,input().split())\nif N < 1:\n n = 0\nelse:\n n = N*(N-1) / 2\nif M < 1:\n m = 0\nelse:\n m = M*(M-1) / 2\nprint(n+m)\n', 'N,M=map(int,input().split())\nif N < 1:\n n = 0\nelse:\n n = N*(N-1) / 2\nif M < 1:\n m = 0\nelse:\n m = M*(M-1) / 2\nprint(int(n+m))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s520361710', 's848342227', 's945248341'] | [3064.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0] | [123, 124, 128] |
p02729 | u640922335 | 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=(N*N-1)/2+(M*M-1)/2\nprint(ans)', 'N,M=map(int,input().split())\nans=N*(N-1)/2+M*(M-1)/2\nprint(int(ans))'] | ['Wrong Answer', 'Accepted'] | ['s254895389', 's053153104'] | [2940.0, 2940.0] | [17.0, 17.0] | [63, 68] |
p02729 | u641804918 | 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()))\nprint(a)\n\ncount = 0\nfor i in range(a[0]):\n count += i\n \nfor i in range(a[1]):\n count += i\n \nprint(count)', 'a = list(map(int,input().split()))\n\ncount = 0\nfor i in range(a[0]):\n count += i\n \nfor i in range(a[1]):\n count += i\n \nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s077711405', 's230368929'] | [2940.0, 2940.0] | [17.0, 19.0] | [142, 133] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.