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 | u340032532 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["def main():\n \n strInput = input()\n \n if len(strInput) < 3 or len(strInput) > 99 \\\n \tor strInput.isupper() or (strInput.isalpha() == False):\n return print('No\\n')\n \n if len(strInput) % 2 != 0:\n return print('No\\n')\n \n strInputReverse = ''.join(list(reversed(strInput)))\n \n if strInput == strInputReverse:\n return print('Yes\\n')\n else:\n return print('No\\n')\n\nif __name__ == '__main__':\n main()", "def main():\n inputNumEven, inputNumOdd = map(int, input().split())\n \n \n if inputNumEven < 0:\n inputNumEven = 0\n if inputNumOdd > 100:\n inputNumOdd = 100\n \n result = inputNumEven*(inputNumEven-1)/2 + inputNumOdd*(inputNumOdd-1)/2\n \n \n return print(int(result))\n\nif __name__ == '__main__':\n main()\n"] | ['Wrong Answer', 'Accepted'] | ['s679935222', 's519986288'] | [3060.0, 2940.0] | [17.0, 17.0] | [416, 350] |
p02729 | u340494803 | 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'] | ['Runtime Error', 'Accepted'] | ['s147318425', 's600859140'] | [2940.0, 2940.0] | [17.0, 17.0] | [59, 62] |
p02729 | u344799658 | 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=int(input().split())\nprint((a*(a-1))//2+(b*(b-1))//2)', 'a,b=list(map(int, input().split()))\nprint((a*(a-1))//2+(b*(b-1))//2)'] | ['Runtime Error', 'Accepted'] | ['s266171141', 's828610886'] | [2940.0, 2940.0] | [17.0, 17.0] | [57, 68] |
p02729 | u345483150 | 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. | ['#include<bits/stdc++.h> \nusing namespace std;\n \nint main() {\n\tint n, m;\n\tcin >> n >> m;\n\tcout << (n*(n-1) / 2) + (m * (m-1) / 2) << "\\n";\n\treturn 0;\n}\n', 'import math\nn,m=map(int,input().split())\ndef comb(k, r):\n if n<2:\n return 0\n else:\n return math.factorial(k) // (math.factorial(k - r) * math.factorial(r))\n\nprint(comb(n,2)+comb(m,2))\n', 'import math\nn,m=map(int,input().split())\ndef comb(k, r):\n if k<2:\n return 0\n else:\n return math.factorial(k) // (math.factorial(k - r) * math.factorial(r))\n\nprint(comb(n,2)+comb(m,2))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s736914650', 's958065923', 's947227983'] | [2940.0, 2940.0, 3060.0] | [17.0, 17.0, 18.0] | [151, 192, 191] |
p02729 | u347920118 | 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"""\nfrom sys import stdin\nn = int(stdin.readline().rstrip())\ndata = [stdin.readline().rstrip().split() for _ in range(n)]\nprint(data)\nprint(*data, sep=\'\\n\')\n"""\n##################################################################\n\n"""\ns =input()\ns=list(input())\na=int(input())\nx,y = map(int,input().split())\t\nli = input().split()\t\nli = list(map(int,input().split()))\t\nli = input().split(\'T\')\t\n"""\n##################################################################\n\n\n"""\nfrom sys import stdin\nn = int(stdin.readline().rstrip())\ndata = [stdin.readline().rstrip().split() for _ in range(n)]\nprint(data)\nprint(*data, sep=\'\\n\')\n"""\n##################################################################\n\n"""\ns =input()\ns=list(input())\na=int(input())\nx,y = map(int,input().split())\t\nli = input().split()\t\nli = list(map(int,input().split()))\t\nli = input().split(\'T\')\t\n"""\n##################################################################\nN,M = map(int,input().split())\n\nif N==1 and M==1:\n print("0")\nelse:\n N = N*(N-1)\n M = M*(M-1)\n ans = (M+N)/2\n print(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n', '\n"""\nfrom sys import stdin\nn = int(stdin.readline().rstrip())\ndata = [stdin.readline().rstrip().split() for _ in range(n)]\nprint(data)\nprint(*data, sep=\'\\n\')\n"""\n##################################################################\n\n"""\ns =input()\ns=list(input())\na=int(input())\nx,y = map(int,input().split())\t\nli = input().split()\t\nli = list(map(int,input().split()))\t\nli = input().split(\'T\')\t\n"""\n##################################################################\n\n\n"""\nfrom sys import stdin\nn = int(stdin.readline().rstrip())\ndata = [stdin.readline().rstrip().split() for _ in range(n)]\nprint(data)\nprint(*data, sep=\'\\n\')\n"""\n##################################################################\n\n"""\ns =input()\ns=list(input())\na=int(input())\nx,y = map(int,input().split())\t\nli = input().split()\t\nli = list(map(int,input().split()))\t\nli = input().split(\'T\')\t\n"""\n##################################################################\nN,M = map(int,input().split())\n\nif N==1 and M==1:\n print("0")\nelse:\n N = N*(N-1)\n M = M*(M-1)\n ans = (M+N)//2\n print(ans)\n\n\n\n\n\n\n\n\n\n\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s586580712', 's642612536'] | [2940.0, 3060.0] | [19.0, 17.0] | [1363, 1364] |
p02729 | u349888092 | 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\nX,Y = map(int,input().split())\nif(X == 1 or Y == 1):\n print(0)\n sys.exit()\nprint(int((X * (X-1))/2 + Y))\n', 'import sys\nX,Y = map(int,input().spliut())\nif(X == 1 or Y == 1):\n print(0)\n sys.exit()\nprint(int((X * (X-1))/2 + Y))\n', 'import sys\nX,Y = map(int,input().split())\nif(X == 1 and Y == 1):\n print(0)\n sys.exit()\nelif(Y == 1):\n print(int(X/2))\n sys.exit()\nelif(X == 0 and Y ==2):\n print(1)\n sys.exit()\nprint(int((X * (X-1))/2 + int((Y * (Y-1))/2 )))\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s578348592', 's779551526', 's928859484'] | [2940.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0] | [122, 123, 242] |
p02729 | u350093546 | 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/(2n-4)+m/(2m-4))', 'n,m=map(int,input().split())\nprint(((n*(n-1))+(m*(m-1)))//2)'] | ['Runtime Error', 'Accepted'] | ['s698778575', 's366406405'] | [2940.0, 2940.0] | [17.0, 17.0] | [53, 60] |
p02729 | u350248178 | 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'] | ['Runtime Error', 'Accepted'] | ['s080752249', 's343951270'] | [3064.0, 2940.0] | [18.0, 17.0] | [56, 58] |
p02729 | u350578302 | 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())\nres = 0\nif(n>=2):\n\tres += n * (n-1) / 2\nif(m>=2):\n\tres += m * (m-1) / 2\nprint(res)', 'n,m = map(int,input().split())\nres = 0\nif(n>=2):\n\tres += n * (n-1) // 2\nif(m>=2):\n\tres += m * (m-1) // 2\nprint(res)'] | ['Wrong Answer', 'Accepted'] | ['s152472246', 's130620615'] | [2940.0, 2940.0] | [17.0, 17.0] | [113, 115] |
p02729 | u350667455 | 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()\nL=len(S)\nans=0\nif S[:int((L-1)/2)]==S[int((L-1)/2-1)::-1] and S[int((L+3)/2-1):]==S[:int((L+3)/2-2):-1]:\n ans='Yes'\nelse:\n ans='No'\nprint(ans)", "S = input()\nL=len(S)\nans='No'\n if S[:(L-1)/2+1]==S[(L-1)/2+1::-1] and S[L+3/2:]==S[:(L+3/2)-1:-1]:\n ans='Yes'\nprint(ans)", 'n,m = map(int, input().split())\na=n*(n-1)//2+m*(m-1)//2\nprint(a)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s553746447', 's977038942', 's507889337'] | [9088.0, 9016.0, 2940.0] | [30.0, 27.0, 18.0] | [160, 126, 64] |
p02729 | u351265848 | 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+m)*(n+m-1) / 2\nprint(ans-(n*m))', 'n, m = map(int, input().split())\nans = (n+m)*(n+m-1) / 2\nprint(int(ans-(n*m)))'] | ['Wrong Answer', 'Accepted'] | ['s716919656', 's249236899'] | [2940.0, 2940.0] | [17.0, 17.0] | [73, 78] |
p02729 | u355154595 | 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==0: \n print(n*(n-1)/2)\nelif m==0:\n print(m*(m-1)/2)\nelse:\n print(n*(n-1)/2+m*(m-1)/2)\n', 'n,m=map(int,input().split())\nif n==0: \n print(n*(n-1)/2)\nelif m==0:\n print(m*(m-1)/2)\nelse:\n print(n*(n-1)+m*(m-1))', 'n,m=map(int,input().split())\nif n==0: \n print((n*(n-1))/2)\nelif m==0:\n print((m*(m-1))/2)\nelse:\n print((n*(n-1))/2+(m*(m-1))/2)', 'n,m=map(int,input().split())\nif n==0: \n print(int(m*(m-1)/2))\nelif m==0:\n print(int(n*(n-1)/2))\nelse:\n print(int(n*(n-1)/2+m*(m-1)/2))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s155177535', 's319950077', 's457543671', 's363424157'] | [2940.0, 2940.0, 3060.0, 2940.0] | [17.0, 18.0, 19.0, 17.0] | [129, 124, 136, 144] |
p02729 | u357751375 | 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\nwhile n > 0:\n a = a + n\n n = n - 1\n\nwhile m > 0:\n a = a + m\n m = m - 1\n\nprint(a)', 'n,m = map(int,input().split())\n\nwhile n > 0:\n a = a + n\n\nwhile m > 0:\n a = a + m\n\nprint(a)', 'n,m = map(int,input().split())\na = 0\n\nwhile n > 0:\n a = a + n\n n = n - 1\n\nwhile m > 0:\n a = a + m\n m = m - 1\n\nprint(a)\n', 'n,m = map(int,input().split())\na = 0\nn = n - 1\nm = m - 1\n\nwhile n > 0:\n a = a + n\n n = n - 1\n\nwhile m > 0:\n a = a + m\n m = m - 1\n\nprint(a)\n'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s374071071', 's466486860', 's903199303', 's244049037'] | [2940.0, 2940.0, 3316.0, 2940.0] | [17.0, 17.0, 22.0, 17.0] | [124, 96, 131, 151] |
p02729 | u362031378 | 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'] | ['s147901412', 's054222712'] | [2940.0, 2940.0] | [17.0, 17.0] | [55, 57] |
p02729 | u362563655 | 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 N=1\nif M==0:\n M=1\nprint(N*(N-1)/2+M*(M-1)/2)', 'N, M = map(int, input().split())\n\nif N==0 or N ==1:\n if M ==0 or M == 1:\n print(0)\n else:\n print(M*(M-1)/2)\nelse:\n if M ==0 or M == 1:\n print(N*(N-1)/2)\n else:\n print(N*(N-1)/2+M*(M-1)/2)\n', 'N, M = map(int, input().split())\nif N <2:\n N=1\n\nif M<2:\n M=1\n\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())\n\nif N==0 or N ==1:\n if M ==0 or M == 1:\n print(0)\n else:\n print(M*(M-1)/2)\nelse:\n if M ==0 or M == 1:\n print(N*(N-1)/2)\n else:\n print(0)', 'N, M = map(int, input().split())\n\nif N==0 or N ==1:\n if M ==0 or M == 1:\n print(0)\n else:\n print(M*(M-1)/2)\nelse:\n if M ==0 or M == 1:\n print(N*(N-1))\n else:\n print(0)\n ', 'n,m=map(int,input().split())\nprint((n*(n-1)//2)+(m*(m-1)//2))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s006185759', 's316532157', 's476772705', 's825960106', 's888267083', 's949932517', 's246520600'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0, 17.0, 17.0, 18.0, 17.0] | [90, 204, 90, 59, 185, 186, 61] |
p02729 | u363421241 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\n\nprint(n*(n-1)/2+m*(m-1)/2)', 'n, m = map(int, input().split())\n\nprint(int(n*(n-1)/2+m*(m-1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s644710391', 's405078696'] | [9000.0, 9020.0] | [23.0, 27.0] | [60, 65] |
p02729 | u364512840 | 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)'] | ['Runtime Error', 'Accepted'] | ['s662384178', 's305817558'] | [2940.0, 2940.0] | [17.0, 18.0] | [57, 57] |
p02729 | u364541509 | 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(ans)'] | ['Wrong Answer', 'Accepted'] | ['s046678641', 's577221786'] | [2940.0, 2940.0] | [17.0, 17.0] | [91, 93] |
p02729 | u365770301 | 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=input()\nM=input()\n\nnum1=M*(M-1)*0.5\nnum2=N*(N-1)*0.5\n\nprint(num1+num2)', 'n,m=map(int, input().split())\n\nnum1=n*(n-1)*0.5\nnum2=m*(m-1)*0.5\n\nprint(num1+num2)', 'n,m=map(int, input().split())\n\nnum1=n*(n-1)*0.5\nnum2=m*(m-1)*0.5', 'N,R = map(int,input().split())\n\nnum1=M*(M-1)*0.5\nnum2=N*(N-1)*0.5\n\nprint(num1+num2)', 'n, m = map(int, input().split())\nans = n*(n-1)//2 + m*(m-1)//2\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s058857041', 's267894484', 's336723207', 's722137267', 's635673641'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0, 17.0] | [72, 82, 64, 83, 73] |
p02729 | u367147039 | 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)\n', 'n,m=map(int,input().split())\n\nprint(n*(n-1)+m*(m-1))\n', 'n,m=map(int,input().split())\n\nprint(int(n*(n-1)/2+m*(m-1)/2))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s318593542', 's459297532', 's902166120', 's003705528'] | [9056.0, 9104.0, 9064.0, 9068.0] | [26.0, 27.0, 24.0, 29.0] | [56, 57, 53, 62] |
p02729 | u367575195 | 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())\n\ndef nCr(n,r):\n\treturn math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n\nprint(nCr(N,2)+nCr(M,2))', 'import math\nN,M=map(int,input().split())\n\ndef nCr(n,r):\n\treturn math.factorial(n)//((math.factorial(n-r)) * math.factorial(r))\n\nif N >= 2:\n\tA=nCr(N,2)\nelse:\n\tA=0\nif M >= 2:\n\tB=nCr(M,2)\nelse:\n\tB=0\nprint(A+B)'] | ['Runtime Error', 'Accepted'] | ['s648005404', 's730276382'] | [3056.0, 3060.0] | [18.0, 18.0] | [148, 206] |
p02729 | u369094007 | 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'] | ['s287815249', 's979995236'] | [2940.0, 2940.0] | [17.0, 17.0] | [78, 80] |
p02729 | u370429695 | 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()\nif s[2] == s[3] and s[4] == s[5]:\n print("Yes")\nelse:\n print("No")', '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(int(n+m))\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s364330799', 's578309556', 's719880571'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [84, 131, 137] |
p02729 | u370657821 | 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())\n\nif N=<1:\n print(math.floor(M*(M-1)/2))\nelif M=<1:\n print(math.floor(N*(N-1)/2))\nelse: \n print(math.floor((N*(N-1)/2)+(M*(M-1)/2)))', 'N, M = map(int, input().split())\nprint((N*(N-1)/2)+(M*(M-1)/2))', 'import math\nN, M = map(int, input().split())\n\nif N<=1:\n print(math.floor(M*(M-1)/2))\nelif M<=1:\n print(math.floor(N*(N-1)/2))\nelse: \n print(math.floor((N*(N-1)/2)+(M*(M-1)/2)))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s428363648', 's481791062', 's303011616'] | [2940.0, 2940.0, 3060.0] | [17.0, 18.0, 17.0] | [179, 63, 179] |
p02729 | u370721525 | 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 and M != 0:\n answer = N(N-1)/2 + M(M-1)/2\n print(answer)\nelif N == 0:\n answer = M(M-1)/2\n print(answer)\nelse:\n answer = N(N-1)/2\n print(answer)', 'N, M = map(int, input().split())\n\nif N != 0 and M != 0:\n answer = N*(N-1)/2 + M*(M-1)/2\n print(answer)\nelif N == 0:\n answer = M*(M-1)/2\n print(answer)\nelse:\n answer = N*(N-1)/2\n print(answer)', 'N, M = map(int, input().split())\n\nif N != 0 and M != 0:\n answer = N*(N-1)/2 + M*(M-1)/2\n print(int(answer))\nelif N == 0:\n answer = M*(M-1)/2\n print(int(answer))\nelse:\n answer = N*(N-1)/2\n print(int(answer))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s834003672', 's979291584', 's292375158'] | [3060.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0] | [193, 197, 212] |
p02729 | u371132735 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M = map(int,input().split())\nprint(N*(N-1)/2+M*(M-1)/2)\n', 'N,M = map(int,input().split())\nprint(N*(N-1)//2+M*(M-1)//2)\n'] | ['Wrong Answer', 'Accepted'] | ['s659427315', 's527367827'] | [2940.0, 2940.0] | [17.0, 18.0] | [58, 60] |
p02729 | u374815848 | 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 sys import stdin\nfrom collections import Counter\n\nlines = stdin.readlines()\n\nn = int(lines[0].rstrip())\na = [int(x) for x in lines[1].rstrip().split()]\n\ncount = Counter(a)\nc = {k:v for k,v in filter(lambda kv: kv[1]>1, count.items())}\nres = []\nfor k in range(n):\n part_res = 0\n for i in c.keys():\n if not i == a[k]:\n quant = c[i]\n else:\n quant = c[i] - 1\n if quant > 1:\n part_res += int((quant * (quant - 1)) / 2)\n res.extend([part_res])\n\nfor j in range(len(res)):\n print(res[j])', 'from sys import stdin\nfrom collections import Counter\n\nlines = stdin.readlines()\n\nn = int(lines[0].rstrip())\na = [int(x) for x in lines[1].rstrip().split()]\n\nc = Counter(a)\n\nres = []\nfor k in range(n):\n part_res = 0\n for i in c.keys():\n if not i == a[k]:\n quant = c[i]\n else:\n quant = c[i] - 1\n if quant > 1:\n part_res += int((quant * (quant - 1)) / 2)\n res.extend([part_res])\n\nfor j in range(len(res)):\n print(res[j])', 'from sys import stdin\n\nn, m = [int(x) for x in stdin.readline().rstrip().split()]\n\neven_only = 0\nodd_only = 0\n\nif n > 1:\n even_only = n * (n - 1) / 2\nif m > 1:\n odd_only = m * (m - 1) / 2\n\nresult = int(even_only + odd_only)\nprint(result)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s653347611', 's901777254', 's500800883'] | [3316.0, 3316.0, 3060.0] | [21.0, 21.0, 17.0] | [550, 484, 243] |
p02729 | u375193358 | 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\n\nN = int(sys.argv[1]) \nM = int(sys.argv[2]) \n\ndef combination(n,r):\n if n == 1:\n ans = 0\n\n if r != 1:\n ans = n/r * combination(n-1,r-1)\n elif r == 1:\n ans = n/r\n\n return ans\n\nprint(combination(N,2)+combination(M,2))', 'import sys\n\nN, M = map(int, input().split())\n\ndef combination(n,r):\n if n == 1:\n ans = 0\n\n if r != 1:\n ans = n/r * combination(n-1,r-1)\n elif r == 1:\n ans = n/r\n\n return ans\n\nprint(combination(N,2)+combination(M,2))\n', 'import sys\n\nN, M = map(int, input().split())\n\ndef com(n,r):\n ans1 = 1\n ans2 = 1\n tmp = r\n while r != 0:\n ans1 = ans1 * (n)\n ans2 = ans2 * r\n n -= 1\n r -= 1\n\n return ans1/ans2\n\nprint(int(com(N,2)+com(M,2))\n', 'import sys\n\nN = int(input()) \nM = int(input()) \n\ndef combination(n,r):\n if n == 1:\n ans = 0\n\n if r != 1:\n ans = n/r * combination(n-1,r-1)\n elif r == 1:\n ans = n/r\n\n return ans\n\nprint(combination(N,2)+combination(M,2))\n', 'import sys\n\nN, M = map(int, input().split())\n\ndef com(n,r):\n ans1 = 1\n ans2 = 1\n tmp = r\n while r != 0:\n ans1 = ans1 * (n)\n ans2 = ans2 * r\n n -= 1\n r -= 1\n\n return ans1/ans2\n\nprint(com(N,2)+com(M,2))\n', "\ndef kaibuncheck(S):\n N=len(S)\n N_val=N-1\n center=int((N-1)/2)\n checkpoint=0\n for i in range(center-1):\n if S[i] == S[N_val]:\n checkpoint+=1\n N_val -= 1\n\n if checkpoint == center-1:\n return 1\n else:\n return 0\n\nS = list(input())\nN = len(S)\nN2 = int((N-1)/2)\n\nS_start=list()\nS_end=list()\nfor i in range(N2):\n S_start.append(S[i])\n S_end.append(S[N-1-i])\n\nif kaibuncheck(S) == 1 and kaibuncheck(S_start) == 1 and kaibuncheck(S_end) == 1:\n print('Yes')\nelse:\n print('No')\n", 'import sys\n\nN, M = map(int, input().split())\n\ndef com(n,r):\n ans1 = 1\n ans2 = 1\n tmp = r\n while r != 0:\n ans1 = ans1 * (n)\n ans2 = ans2 * r\n n -= 1\n r -= 1\n\n return ans1/ans2\n\nprint(int(com(N,2)+com(M,2)))\n'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s027596951', 's366510537', 's516524247', 's649675057', 's754615222', 's922625335', 's380736577'] | [3060.0, 2940.0, 2940.0, 2940.0, 2940.0, 3064.0, 2940.0] | [17.0, 17.0, 17.0, 18.0, 18.0, 18.0, 17.0] | [297, 249, 248, 290, 244, 568, 249] |
p02729 | u376450099 | 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. | ['# -*- coding: utf-8 -*-\n\nimport copy\n\na = input()\na=int(a)\nball=[]\nmydict={}\nDPdict={}\ntemp=input().split(" ")\nfor i in range(a):\n if not (temp[i] in mydict):\n mydict[temp[i]]=1\n else:\n mydict[temp[i]]+=1\n ball.append(temp[i])\n\nfor i in range(len(ball)):\n rettemp=0\n if i in DPdict:\n print(int(DPdict[i]))\n continue\n for j in mydict.keys():\n\n if ball[i]==j:\n rettemp+=(mydict[j]-1)*(mydict[j]-2)/2\n else :\n rettemp+=(mydict[j]-1)*(mydict[j])/2\n DPdict[i]=rettemp\n print(int(rettemp))\n', '# -*- coding: utf-8 -*-\n\n\na = input()\n\nH,W=a.split(" ")\nN=int(H)\nM=int(W)\nretnum=0\nfor i in range(N):\n retnum+=i\nretnum+=M*(M-1)/2\nprint(int(retnum))'] | ['Runtime Error', 'Accepted'] | ['s599090015', 's316956899'] | [3444.0, 3064.0] | [23.0, 17.0] | [589, 210] |
p02729 | u376616698 | 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 = [int(k) for k in input().split(' ')]\n\nfrom collections import Counter \nimport math \n\nres = [] # solution for each key in A\nres_list = {} # solution for each value in A\n\n\nA_c = Counter(A)\nl = len(A_c)\n\ndef ncr(j):\n return math.factorial(j) // math.factorial(2) // math.factorial(j - 2) if j >= 2 else 0\n\n# store ncr for each value \ncombs = {k: ncr(v) for k, v in A_c.items()}\n\ns = sum(combs.values())\n \nfor m in A_c.keys():\n res_list[m] = s - combs[m] + ncr(A_c[m] - 1)\n\nfor k in range(N):\n res.append(res_list[A[k]])\nprint('\\n'.join([str(s) for s in res]))", "N = int(input())\nA = [int(k) for k in input().split(' ')]\n\nfrom collections import Counter \nimport math \n\nres = [] # solution for each key in A\nres_list = {} # solution for each value in A\n\n\nA_c = Counter(A)\nl = len(A_c)\n\ndef ncr(j):\n return j * (j-1) // 2 if j >= 2 else 0\n\n# store ncr for each value \ncombs = {k: ncr(v) for k, v in A_c.items()}\n\ns = sum(combs.values())\n \nfor m in A_c.keys():\n res_list[m] = s - combs[m] + ncr(A_c[m] - 1)\n\nfor k in range(N):\n res.append(res_list[A[k]])\nprint('\\n'.join([str(s) for s in res]))", "N = int(input())\nA = [int(k) for k in input().split(' ')]\n\nfrom collections import Counter \nimport math \n\n# res = [] # solution for each key in A\nres_list = {} # solution for each value in A\n\n\nA_c = Counter(A)\nl = len(A_c)\n\ndef ncr(j):\n return math.factorial(j) // math.factorial(2) // math.factorial(j - 2) if j >= 2 else 0\n\n# store ncr for each value \ncombs = {k: ncr(v) for k, v in A_c.items()}\n\ns = sum(combs.values())\n \nfor m in A_c.keys():\n cnt = combs[m]\n\n n = s\n n -= cnt # the only inaccurate entry\n n += ncr(A_c[m] - 1)\n res_list[m] = n\n\nres = ''\nfor k in range(N):\n res += '\\n' + str(res_list[A[k]])\nprint(res[1:])\n# print('\\n'.join([str(s) for s in res]))", "N = int(input())\nA = [int(k) for k in input().split(' ')]\n\nfrom collections import Counter \nimport math \n\nres = [] # solution for each key in A\nres_list = {} # solution for each value in A\n\n\nA_c = Counter(A)\nl = len(A_c)\n\ndef ncr(j):\n return math.factorial(j) // math.factorial(2) // math.factorial(j - 2) if j >= 2 else 0\n\n# store ncr for each value \ncombs = {k: ncr(v) for k, v in A_c.items()}\n\ns = sum(combs.values())\n \nfor m in A_c.keys():\n cnt = combs[m]\n\n n = s\n n -= cnt # the only inaccurate entry\n n += ncr(A_c[m] - 1)\n res_list[m] = n\n\nfor k in range(N):\n print(res_list[A[k]])\n# print('\\n'.join([str(s) for s in res]))", "M, N = [int(k) for k in input().split(' ')]\nimport math \nres = 0\n\nif N >= 2:\n res += (math.factorial(N) // math.factorial(2) // math.factorial(N - 2))\n\nif M >= 2:\n res += (math.factorial(M) // math.factorial(2) // math.factorial(M - 2))\n\nprint(res)"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s364726256', 's536327410', 's557572796', 's738471573', 's780739079'] | [3064.0, 3064.0, 3064.0, 3064.0, 3060.0] | [17.0, 17.0, 18.0, 17.0, 17.0] | [594, 545, 688, 650, 250] |
p02729 | u376754170 | 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())\nall_pattern = (n+m) / (n+m-1) / 2\nprint(all_pattern - n*m)', 'import math\nn, m = map(int, input().split())\n\nall_pattern = math.factorial(n+m) // (math.factorial(n+m - 2) * math.factorial(2))\nprint(all_pattern - n*m)'] | ['Wrong Answer', 'Accepted'] | ['s513753461', 's398073436'] | [2940.0, 3060.0] | [17.0, 17.0] | [91, 182] |
p02729 | u377072670 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\n\nprint(n*(n-1)/2 + m*(m-1)/2)\n', 'n, m = map(int, input().split())\n\nprint(n*(n-1)//2 + m*(m-1)//2)\n'] | ['Wrong Answer', 'Accepted'] | ['s482119977', 's860580240'] | [2940.0, 2940.0] | [17.0, 17.0] | [63, 65] |
p02729 | u377834804 | 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\nans1 = 0\nif N > 1:\n ans1 = math.factorial(N)/math.factorial(N-2)/2\nans2 = 0\nif N > 1:\n ans2 = math.factorial(M)/math.factorial(M-2)/2\nprint(int(ans1 + ans2))', 'import math\n \nN, M = map(int, input().split())\n\nans1 = 0\nif N != 0:\n ans1 = math.factorial(N)/math.factorial(N-2)/2\nans2 = 0\nif N != 0:\n ans2 = math.factorial(M)/math.factorial(M-2)/2\nprint(int(ans1 + ans2))', 'import math\n \nN, M = map(int, input().split())\n\nans1 = math.factorial(N)/math.factorial(N-2)/2\nans2 = math.factorial(M)/math.factorial(M-2)/2\nprint(int(ans1 + ans2))', "def is_kaibun(st):\n f = True\n for x,y in zip(st, st[::-1]):\n if x != y:\n f = False\n break\n return f\n \nS = input()\nans = False\nif is_kaibun(S):\n if is_kaibun(S[:(len(S)-1)//2]):\n ans = is_kaibun(S[(len(S)+3)//2-1:])\nif ans:\n print('Yes')\nelse:\n print('No')", '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)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s119385548', 's133296565', 's185567344', 's253832705', 's486213483', 's124685803'] | [9164.0, 9096.0, 9072.0, 9056.0, 9140.0, 9144.0] | [25.0, 29.0, 27.0, 28.0, 26.0, 29.0] | [207, 209, 165, 277, 60, 63] |
p02729 | u378782369 | 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 time\ntime.sleep(3)', 'from itertools import combinations\n\nN, M = list(map(lambda x:int(x),input().split()))\n\ndef nCr(n, r):\n """\n Calculate the number of combination (nCr = nPr/r!).\n The parameters need to meet the condition of n >= r >= 0.\n It returns 1 if r == 0, which means there is one pattern\n to choice 0 items out of the number of n.\n """\n\n # 10C7 = 10C3\n r = min(r, n-r)\n\n # Calculate the numerator.\n numerator = 1\n for i in range(n, n-r, -1):\n numerator *= i\n\n # Calculate the denominator. Should use math.factorial?\n denominator = 1\n for i in range(r, 1, -1):\n denominator *= i\n\n return numerator // denominator\n\nif N <= 1 and M <= 1:\n print(0)\nelif N <= 1 and not M <= 1:\n print(nCr(M,2))\nelif not N <= 1 and M <= 1:\n print(nCr(N,2))\nelse:\n print(nCr(N, 2) + nCr(M,2))'] | ['Time Limit Exceeded', 'Accepted'] | ['s181655433', 's565806165'] | [2940.0, 3064.0] | [2104.0, 17.0] | [25, 829] |
p02729 | u381959472 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['from scipy.misc import comb\n\n\nN, M = map(int, input().split())\nresult = 0\nif N >= 2:\n result += comb(N, 2)\nif M >= 2:\n result += comb(M, 2)\nprint(int(result))', 'from operator import mul\nfrom functools import reduce\ndef combinations(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\n\n\nN, M = map(int, input().split())\nresult = 0\nif N >= 2:\n result += combinations(N, 2)\nif M >= 2:\n result += combinations(M, 2)\nprint(int(result))'] | ['Wrong Answer', 'Accepted'] | ['s386875998', 's558532626'] | [14272.0, 3700.0] | [205.0, 24.0] | [164, 370] |
p02729 | u382639013 | 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\nans = (N * (N-1)) / 2 + (M * (M-1)) /2\n\nprint(int(ans))'] | ['Wrong Answer', 'Accepted'] | ['s689723888', 's921581078'] | [2940.0, 3064.0] | [17.0, 18.0] | [74, 89] |
p02729 | u383508661 | 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(int(a*(a-1)/2+b*(b-1)//2))'] | ['Wrong Answer', 'Accepted'] | ['s505195125', 's632891751'] | [3060.0, 2940.0] | [19.0, 17.0] | [55, 61] |
p02729 | u384379887 | 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 as m\nN, M = input().split(' ')\nN, M = int(N), int(M)\n\nif N > 1:\n a = m.factorial(N)/(2*m.factorial(N-2))\nelse:\n a = 0\nif M > 1:\n b = m.factorial(M)/(2*m.factorial(M-2))\nelse:\n b = 0\n\nprint(a+b)\n", "import math as m\nN, M = input().split(' ')\nN, M = int(N), int(M)\n\nif N > 1:\n a = m.factorial(N)/(2*m.factorial(N-2))\nelse:\n a = 0\nif M > 1:\n b = m.factorial(M)/(2*m.factorial(M-2))\nelse:\n b = 0\n\nprint(int(a+b))\n"] | ['Wrong Answer', 'Accepted'] | ['s986901700', 's971150119'] | [3060.0, 3064.0] | [18.0, 25.0] | [218, 223] |
p02729 | u385825353 | 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=int(input().split(' '))\n\nans = 0\nif a>=2:\n ans += a*(a-1)//2\nif b>=2:\n ans += b*(b-1)//2\nprint(ans) \n", "a,b=map(int, input().split(' '))\n \nans = 0\nif a>=2:\n ans += a*(a-1)//2\nif b>=2:\n ans += b*(b-1)//2\nprint(ans) "] | ['Runtime Error', 'Accepted'] | ['s558550841', 's763147566'] | [2940.0, 2940.0] | [17.0, 17.0] | [114, 117] |
p02729 | u386944085 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import collections\nN=int(input())\na=0\nlist1 = list(map(int, input().split()))\nc = collections.Counter(list1)\nfor i in range(N):\n a+=int(c[i+1]*(c[i+1]-1)/2)\nfor i in range(N):\n if c[list1[i]]!=0:\n print(a-c[list1[i]]+1)\n else:\n print(a)', 'i = list(map(int, input().split()))\na=i[0]*(i[0]-1)/2+i[1]*(i[1]-1)/2\nprint(int(a))'] | ['Runtime Error', 'Accepted'] | ['s494284006', 's576439989'] | [3316.0, 2940.0] | [21.0, 17.0] | [259, 83] |
p02729 | u387109968 | 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\nsum = 0\n\nif n > 1:\n sum += 2 ** (n // 2)\nelse:\n sum += 1\n\nif m > 1:\n sum += 2 ** (m // 2)\nelse:\n sum += 1\n\nprint(sum)\n', 'n, m = map(int, input().split())\n\ncount = 0\nif n > 1:\n count += n * (n - 1) // 2\nif m > 1:\n count += m * (m - 1) // 2\nprint(count)'] | ['Runtime Error', 'Accepted'] | ['s013867231', 's852857420'] | [2940.0, 2940.0] | [17.0, 17.0] | [165, 132] |
p02729 | u387774811 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nA=0\nN,M=map(int,input().split())\nif N<=2:\n A+=0\nelse:\n A+=combinations_count(N, 2)\nif M<=2:\n A+=0\nelse:\n A+=combinations_count(M, 2)\nprint(A)\n', 'import math\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nA=0\nN,M=map(int,input().split())\nif N<2:\n A+=0\nelse:\n A+=combinations_count(N, 2)\nif M<2:\n A+=0\nelse:\n A+=combinations_count(M, 2)\nprint(A)\n'] | ['Wrong Answer', 'Accepted'] | ['s601627670', 's313802280'] | [3060.0, 3064.0] | [17.0, 17.0] | [257, 255] |
p02729 | u388458865 | 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)', 'a,b = map(int,input().)', 'N,M = map(int,input().split())\na = int((N*(N-1))/2+(M*(M-1))/2)\nprint(a)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s100534081', 's319398306', 's879329723'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [61, 23, 72] |
p02729 | u391589398 | 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())\ncount = N*(N-1) // 2\ncount += N*M\nprint(count)', 'N, M = map(int, input().split())\ncount = 0\ncount += N*(N-1) // 2\ncount += M*(M-1) // 2\nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s398322446', 's969344262'] | [3064.0, 2940.0] | [17.0, 17.0] | [79, 99] |
p02729 | u395202850 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["import math\nimport sys\nreadline = sys.stdin.readline\n\n\ndef main():\n # input\n n = int(readline().rstrip())\n A = list(map(int, readline().rstrip().split()))\n B = [0] * n\n\n for a in A:\n B[a - 1] += 1\n\n total = 0\n for b in B:\n if b > 1:\n total += b * (b - 1) // 2\n\n C = [0] * n\n for i, b in enumerate(B):\n C[i] = total - b + 1\n\n for a in A:\n print(C[a-1])\n\n\nif __name__ == '__main__':\n main()\n", "import math\nimport sys\nreadline = sys.stdin.readline\n\n\ndef main():\n # input\n n = int(readline().rstrip())\n A = list(map(int, readline().rstrip().split()))\n B = [0] * n\n\n for a in A:\n B[a - 1] += 1\n\n total = 0\n for b in B:\n if b > 1:\n total += b * (b - 1) // 2\n\n C = [0] * n\n for i, b in enumerate(B):\n C[i] = total - b + 1\n\n for a in A:\n print(C[a-1])\n\n\nif __name__ == '__main__':\n main()\n", 'n,m = map(int, input().split())\nprint((n*(n-1)+m*(m-1))//2)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s838476770', 's984089667', 's340265040'] | [3064.0, 3064.0, 2940.0] | [18.0, 17.0, 17.0] | [461, 461, 59] |
p02729 | u395761272 | 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. | ['ans=0\n\nn,m=map(input().split())\nif n > 1:\n\tfor i in range(1,n):\n\t\tans += i\n\nif m > 1:\n\tfor i in range(1,m):\n\t\tans += i\n\nprint(ans)', 'ans=0\n\nn,m=map(int,input().split())\nif n > 1:\n\tfor i in range(1,n):\n\t\tans += i\n\nif m > 1:\n\tfor i in range(1,m):\n\t\tans += i\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s237972242', 's790688869'] | [2940.0, 2940.0] | [18.0, 17.0] | [130, 134] |
p02729 | u395894569 | 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 as fact\nn,m=map(int,input().split())\ni,k=0,0\nif n<2 and m<2:\n print(0)\nelse:\n if n!=0:\n \ti=fact(n)/fact(2)/fact(n-2)\n if m!=0:\n k=fact(m)/fact(2)/fact(m-2)\n print(int(i+k))', 'from math import factorial as fact\nn,m=map(int,input().split())\ni,k=0,0\nif n<2 and m<2:\n print(0)\nelse:\n if n==0:i=0\n elif n==2:\n \ti=1\n elif n!=1:\n i=fact(n)/fact(2)/fact(n-2)\n if m==0:k=0\n elif m==2:\n \tk=1\n elif m!=1:\n k=fact(m)/fact(2)/fact(m-2)\n print(int(i+k))'] | ['Runtime Error', 'Accepted'] | ['s615772831', 's774560863'] | [3060.0, 3064.0] | [17.0, 17.0] | [207, 280] |
p02729 | u396858476 | 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 = str(input())\n\ndef check(text):\n n = len(text)\n if n == 1:\n return True\n\n left = int((n-1)/2)\n right = int((n+3)/2 - 1)\n if text[0:left] == text[right:n] and check(text[0:left]):\n return True\n return False\n\nif check(s):\n print("Yes")\nelse:\n print("No")\n', 'n, m = map(int, input().split())\n\ngu = 0\nki = 0\nif n >= 2:\n gu = n * (n -1) / 2\nif m >= 2:\n ki = m * (m-1) / 2\nprint(int(gu+ki))\n'] | ['Wrong Answer', 'Accepted'] | ['s122324754', 's291679195'] | [3060.0, 2940.0] | [18.0, 17.0] | [294, 135] |
p02729 | u397953026 | 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'] | ['s321457023', 's207976480'] | [2940.0, 2940.0] | [17.0, 17.0] | [58, 60] |
p02729 | u399973890 | 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 odd = (N*(N-1))/2\nelse:\n odd = 0\nif M >= 2:\n even = (M*(M-1))/2\nelse:\n even = 0\nprint(odd+even)', 'N, M = map(int, input().split())\nif N >=2:\n odd = (N*(N-1))/2\nelse:\n odd = 0\nif M >= 2:\n even = (M*(M-1))/2\nelse:\n even = 0\nprint(int(odd+even))'] | ['Wrong Answer', 'Accepted'] | ['s654692231', 's529506322'] | [3060.0, 2940.0] | [17.0, 18.0] | [151, 156] |
p02729 | u401452016 | 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. | ['#ABC159A\nimport sys\nimport itertools\nn, m = map(int, sys.stdin.readline().split())\n#print(n, m)\nL = [0 for _ in range(n)] + [1 for _ in range(m)]\nL = list(itertools.combinations(L, 2))\n#print(L)\ntotal = 0\nfor a, b in L:\n if (a+b)%2 ==0:\n total+=1\n', '#ABC159A\nimport sys\nimport itertools\nn, m = map(int, sys.stdin.readline().split())\n#print(n, m)\nL = [0 for _ in range(n)] + [1 for _ in range(m)]\nL = list(itertools.combinations(L, 2))\n#print(L)\ntotal = 0\nfor a, b in L:\n if (a+b)%2 ==0:\n total+=1\n\nprint(total)'] | ['Wrong Answer', 'Accepted'] | ['s742148867', 's709522870'] | [4468.0, 4468.0] | [23.0, 23.0] | [257, 270] |
p02729 | u403331159 | 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(n,k):\n comb_ans=1\n for i in range(1,k+1):\n comb_ans*=(n-i+1)/i\n comb_ans=int(comb_ans)\n return comb_ans\n\nN=int(input())\nA=list(map(int,input().split()))\nans=0\nB=set(A)\nL=[0]*N\nfor i in range(N):\n L[A[i]-1]+=1\nfor i in B:\n ans+=Comb(L[i-1],2)\nfor i in range(N):\n pri=ans\n pri=ans-L[A[i]-1]+1\n print(pri)', 'n,m=map(int,input().split())\ndef Comb(n,k):\n comb_ans=1\n for i in range(1,k+1):\n comb_ans*=(n-i+1)/i\n comb_ans=int(comb_ans)\n return comb_ans\nans=Comb(n,2)+Comb(m,2)\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s777893936', 's221559971'] | [3064.0, 2940.0] | [18.0, 17.0] | [345, 196] |
p02729 | u409254176 | 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'] | ['s853282244', 's866493052'] | [9088.0, 9072.0] | [29.0, 27.0] | [55, 57] |
p02729 | u411858517 | 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\nif a > 0:\n a = a * (a - 1)\n \nif b > 0:\n b = b * (b - 1)\nprint(a + b)\n', 'a, b = map(int, input().split())\n\nif a > 0:\n a = a * (a - 1) // 2\n \nif b > 0:\n b = b * (b - 1) // 2\nprint(a + b)\n'] | ['Wrong Answer', 'Accepted'] | ['s213272915', 's098696405'] | [2940.0, 2940.0] | [17.0, 17.0] | [106, 116] |
p02729 | u412139296 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M = map(int,input().split())\n\nreturn(int(N*(N-1)//2 + M*(M-1)//2))', 'N, M = map(int,input().split())\n\nreturn(int(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', 'N, M = map(int,input().split())\n\nreturn(int(N(N-1)//2 + M(M-1)//2))', 'N, M = map( int, input().split() )\n\nprint(int(N * (N-1)//2 + M * (M-1)//2))\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s286757365', 's442494669', 's589101027', 's989251429', 's900003933'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0, 17.0] | [68, 70, 67, 67, 76] |
p02729 | u414957786 | 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\ndef nCr(n, r):\n if n < r or r == 0:\n return 1\n ans = 1\n for i in range (r):\n ans *= (n-r+i+1)\n ans = ans // (i+1)\n\n return ans\n\nprint(nCr(n, 2) + nCr(m, 2))", "n, m = map(int, input().split(' '))\n\ndef nCr(n, r):\n if n < r:\n return 0\n ans = 1\n for i in range (r):\n ans *= (n-r+i+1)\n ans = ans // (i+1)\n\n return ans\n\nprint(nCr(n, 2) + nCr(m, 2))"] | ['Wrong Answer', 'Accepted'] | ['s904927158', 's032011749'] | [9052.0, 9052.0] | [26.0, 27.0] | [226, 216] |
p02729 | u417589709 | 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+m)*(n+m-1)-n*m))\n', 'n,m = map(int, input().split())\nprint(int(((n+m)*(n+m-1)-n*m)/2))\n', 'n,m = map(int, input().split())\nprint(int((n+m)*(n+m-1))-n*m)', 'n,m = map(int, input().split())\nprint(int(((n+m)*(n+m-1)/2-n*m)))\n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s164448927', 's868438775', 's915186441', 's405676873'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [62, 66, 61, 66] |
p02729 | u418826171 | 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'] | ['s544667107', 's242325900'] | [9092.0, 9080.0] | [26.0, 30.0] | [61, 63] |
p02729 | u422267382 | 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. | [' main()\nimport math\nn,m=map(int,input().split())\ndef cc(n,r):\n return int(math.factorial(n)/(math.factorial(n-r)*math.factorial(r)))\nif n>=2:\n if m>=2:\n print(cc(n,2)+cc(m,2))\n else:\n print(cc(n,2))\nelse:\n if m>=2:\n print(cc(m,2))\n else:\n print(0)', 'import math\nn,m=map(int,input().split())\ndef cc(n,r):\n return int(math.factorial(n)/(math.factorial(n-r)*math.factorial(r)))\nif n>=2:\n if m>=2:\n print(cc(n,2)+cc(m,2))\n else:\n print(cc(n,2))\nelse:\n if m>=2:\n print(cc(m,2))\n else:\n print(0)'] | ['Runtime Error', 'Accepted'] | ['s019755502', 's796046418'] | [2940.0, 3060.0] | [17.0, 19.0] | [293, 282] |
p02729 | u423137719 | 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)\nk = (n*(n-1) + m*(m-1))/2\nprint(k)', 'n,m = input().split()\nn = int(n)\nm = int(m)\nk = (n*(n-1) + m*(m-1))//2\nprint(k)'] | ['Wrong Answer', 'Accepted'] | ['s910027217', 's294706933'] | [2940.0, 2940.0] | [17.0, 17.0] | [78, 79] |
p02729 | u426506117 | 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())\nans=0\nif N>=2:\n ans+=N*(N-1)/2\nif M>=2:\n ans+=M*(M-1)/2\nprint(ans)', 'N, M = (int(x) for x in input().split())\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'] | ['s686247279', 's166179579'] | [8976.0, 9020.0] | [31.0, 27.0] | [109, 114] |
p02729 | u428341537 | 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))/2)\n', 'n,m= map(int, input().split())\n \nprint(((n*(n-1))+m*(m-1))/2)', 'n,m= map(int, input().split())\n \nprint(int(((n*(n-1))+m*(m-1))/2))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s208214648', 's727459541', 's770568906'] | [9068.0, 8960.0, 9048.0] | [20.0, 25.0, 23.0] | [60, 61, 66] |
p02729 | u429029348 | 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'] | ['s241249094', 's868515584'] | [3064.0, 2940.0] | [18.0, 18.0] | [55, 57] |
p02729 | u430543459 | 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 c(i):\n return i*(i-1)/2\n\nn,m=map(int,input().split())\nprint(c(n)+c(m))\n', 'import math\nn_num,m_num=map(int,input().split())\nn_comb=math.factorial(n_num)/(math.factorial(n_num-2)*math.factorial(2))\nm_comb=math.factorial(m_num)/(math.factorial(m_num-2)*math.factorial(2))\nprint(int(n_comb+m_comb))\n', 'import math\nn_num,m_num=map(int,input().split())\nn_comb=math.factorial(n_num)//(math.factorial(n_num-2)*math.factorial(2))\nm_comb=math.factorial(m_num)//(math.factorial(m_num-2)*math.factorial(2))\nprint(int(n_comb+m_comb))\n', 'def c(i):\n return i*(i-1)//2\n\nn,m=map(int,input().split())\nprint(c(n)+c(m))'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s529492402', 's709298543', 's735267534', 's455645989'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 18.0] | [78, 221, 223, 78] |
p02729 | u432251613 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['from operator import mul\nfrom functools import reduce\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\n\ndef main():\n N,M = map(int, input().split())\n ans = combinations_count(M,2) + combinations_count(N,2)\n print(ans)\n\nmain()\n', 'from operator import mul\nfrom functools import reduce\n\ndef combinations_count(n, r):\n if n<r: return 0\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\n\ndef main():\n N,M = map(int, input().split())\n ans = combinations_count(M,2) + combinations_count(N,2)\n print(ans)\n\nmain()\n'] | ['Wrong Answer', 'Accepted'] | ['s687676800', 's512178246'] | [3572.0, 3572.0] | [23.0, 23.0] | [357, 378] |
p02729 | u433172603 | 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(input().split())\nans=a*(a-1)/2+b*(b-1)/2\nprint (ans)', '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)', 'a,b=map(int,input().split())\nprint (a*(a-1)//2+b*(b-1)//2)\n'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s240462854', 's535395146', 's950391369', 's263896183'] | [2940.0, 2940.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0, 19.0] | [60, 56, 56, 59] |
p02729 | u435001241 | 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. | ['mport itertools\n\nn,m = map(int, input().split())\nprint(len(list(itertools.combinations(range(m),2))) + len(list(itertools.combinations(range(n),2))))', 'import itertools\n\nn,m = map(int, input().split())\nprint(len(list(itertools.combinations(range(m),2))) + len(list(itertools.combinations(range(n),2))))'] | ['Runtime Error', 'Accepted'] | ['s960325130', 's970543744'] | [2940.0, 3444.0] | [18.0, 18.0] | [149, 150] |
p02729 | u435593586 | 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 combninations\n\nn,m = map(int, input().split())\na = list(combinations(range(n),2))\nb = list(combinations(range(m),2))\n\nprint(len(a)+len(b))', 'from itertools import combinations\n\nn,m = map(int, input().split())\na = list(combinations(range(n),2))\nb = list(combinations(range(m),2))\n\nprint(len(a)+len(b))\n'] | ['Runtime Error', 'Accepted'] | ['s688420045', 's525884979'] | [3060.0, 3700.0] | [18.0, 19.0] | [160, 160] |
p02729 | u436001578 | 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(i) for i in input().split()]\n\nprint((N * (N-1)/2) + (M *(M-1)/2))', 'N,M = [int(i) for i in input().split()]\n\n\n\n\n\n\n\nprint(int((N * (N-1)/2) + (M *(M-1)/2)))'] | ['Wrong Answer', 'Accepted'] | ['s458165818', 's263349993'] | [2940.0, 2940.0] | [17.0, 17.0] | [76, 198] |
p02729 | u437215432 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['from math import factorial\n\ndef choose(n, k):\n if n <= 0:\n return 0\n else:\n return factorial(n) // factorial(k) // factorial(n - k)\n\nn, m = map(int, input().split())\nprint(choose(n, 2) + choose(m, 2))\n', 'from math import factorial\n\ndef choose(n, k):\n if n < k:\n return 0\n else:\n return factorial(n) // factorial(k) // factorial(n - k)\n\nn, m = map(int, input().split())\nprint(choose(n, 2) + choose(m, 2))\n'] | ['Runtime Error', 'Accepted'] | ['s434306455', 's411149177'] | [2940.0, 2940.0] | [24.0, 17.0] | [221, 220] |
p02729 | u440161695 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M=map(int,input().split())\nif N>1 and M>1:\n print((N*(N-1)/2)+(M*(M-1)/2))\nelif N<=1:\n if M<=1:\n print(0)\n print(M*(M-1)/2)\nelse:\n print(N*(N-1)/2)', 'N,M=map(int,input().split())\nif N>1 and M>1:\n print(int((N*(N-1)/2)+(M*(M-1)/2)))\nelif N<=1:\n if M<=1:\n print(0)\n else:\n print(int(M*(M-1)/2))\nelse:\n print(int(N*(N-1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s801041233', 's355752428'] | [3060.0, 3060.0] | [17.0, 17.0] | [162, 191] |
p02729 | u441246928 | 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()\nprint( 'N + N' )\nprint( 'M + M' )\n", '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'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s535013420', 's984724093', 's453891736'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0] | [56, 66, 68] |
p02729 | u441902623 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\nprint(n(n-1)/2 + m(m-1)/2)', 'n, m = map(int, input().split())\nans = n*(n - 1)/2 + m*(m - 1)/2\nprint(int(ans))'] | ['Runtime Error', 'Accepted'] | ['s523277598', 's070075292'] | [9144.0, 9076.0] | [22.0, 30.0] | [59, 80] |
p02729 | u443972048 | 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=int(input())\nN=int(input())\n\ncount=0\n\nif M >= 2:\n x=M*(M-1)\n print("M",x)\n count=x/2\n\nif N >= 2:\n x=N*(N-1)\n print("N",x)\n count=x/2 + count\n\nprint(int(count))', 'IN=input()\nM=int(IN.split(" ")[0])\nN=int(IN.split(" ")[1])\n\ncount=0\n\nif M >= 2:\n x=M*(M-1)\n count=x/2\n\nif N >= 2:\n x=N*(N-1)\n count=x/2 + count\n\nprint(int(count))'] | ['Runtime Error', 'Accepted'] | ['s132186453', 's274709862'] | [3060.0, 3060.0] | [18.0, 18.0] | [179, 174] |
p02729 | u446601167 | 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 decimal\n\nL=int(input())\n\n#decimal.getcontext().prec = 6\nx = decimal.Decimal(L / 3)\n\nV=decimal.Decimal(x*x*x)\n\nprint("{:.24f}".format(V))', 'import math\n\n\nN, M = map(int, input().split())\n\n\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n#main\nif N <=1 and M <= 1:\n print(0)\n\nelif N <= 1 and M>=2:\n print(combinations_count(M,2))\n\nelif M <=1 and N>=2:\n print(combinations_count(N,2))\n \nelif N >=2 and M >=2:\n print(combinations_count(N,2)+combinations_count(M,2))\n'] | ['Runtime Error', 'Accepted'] | ['s224724305', 's223282627'] | [5204.0, 3060.0] | [36.0, 17.0] | [143, 414] |
p02729 | u446711904 | 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())\ndef num(x):\n if x<2:\n return 0\n else:\n return int(x*(x-1)/2)\n print(num(n)+num(m))', 'n,m=map(int,input().split())\ndef num(x):\n if x<2:\n return 0\n else:\n return int(x*(x-1)/2)\nprint(num(n)+num(m))'] | ['Runtime Error', 'Accepted'] | ['s724425915', 's923221891'] | [2940.0, 2940.0] | [17.0, 17.0] | [119, 118] |
p02729 | u450786783 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['l = int(input())\nprint((l/3) ** 3)', 'n, m = map(int, input().split())\nprint((n*(n-1))//2 + (m*(m-1)//2))'] | ['Runtime Error', 'Accepted'] | ['s813341131', 's794119138'] | [2940.0, 2940.0] | [18.0, 17.0] | [34, 67] |
p02729 | u452885705 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m = map(int, input().split(" "))\nresult = 0\nprint(n,m)\nif n > 1:\n for i in range(n):\n result += n-1\n n -= 1\nif m > 1:\n for t in range(m):\n result += m-1\n m -= 1\nprint(result)\n', 'n,m = map(int, input().split(" "))\nresult = 0\nif n > 1:\n for i in range(n):\n result += n-1\n n -= 1\nif m > 1:\n for t in range(m):\n result += m-1\n m -= 1\nprint(result)\n'] | ['Wrong Answer', 'Accepted'] | ['s002370663', 's744046716'] | [2940.0, 2940.0] | [17.0, 17.0] | [211, 200] |
p02729 | u453623947 | 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)) + (m * (m - 1))\nprint(ans)', 'n, m = map(int, input().split())\n\nif n >= 2 and m >= 2 :\n ans = (n * (n - 1)) / 2 + (m * (m - 1) / 2)\n\nelif n <= 1 and m >= 2 :\n ans = n + (m * (m - 1) / 2)\n\nelif n >= 2 and m <= 1 :\n ans = (n * (n - 1)) / 2 + m\n\nelse :\n ans = n + m\n\nprint(ans)\n', 'N, M = map(int, input().split())\n\nans = (N * (N - 1) + M * (M - 1)) / 2\n\nprint(ans)\n', 'n, m = map(int, input().split())\n\nans = (n * (n -1)) / 2 + (m * (m - 1) / 2)\n\nprint(ans)\n', 'S = list(input())\nN = len(S)\ns1 = S[:int((N-1)/2):]\ns2 = S[int(((N+3)/2)-1):int(N):]\nif S == S[::-1] :\n if s1 == s1[::-1] and s2 == s2[::-1] :\n print("Yes")\n else:\n print("No")\nelse:\n print("No")\n', 'N, M = map(int, input().split())\n\nans = (N * (N - 1) + M * (M - 1)) / 2\n\nprint(int(ans))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s005043242', 's062326489', 's067301764', 's162205883', 's817126561', 's209202653'] | [2940.0, 3060.0, 2940.0, 2940.0, 3060.0, 2940.0] | [18.0, 17.0, 19.0, 17.0, 17.0, 17.0] | [78, 258, 84, 90, 219, 88] |
p02729 | u455571292 | 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. | ["str = list(input())\n\ndef isKaibun(src):\n rev = src[:]\n rev.reverse()\n\n return src == rev\n\n\nN = len(str)\n\ndef num(N):\n return N-1\n\ns1 = num(1)\ne1 = (num(N)-1) // 2 + 1\ns2 = (num(N) + 3) // 2\ne2 = num(N) + 1\n\nif isKaibun(str) and isKaibun(str[s1:e1]) and isKaibun(str[s2:e2]):\n print('Yes')\nelse:\n print('No')\n", 'N, M = map(int,input().split())\n\nans = 0\nans += N * (N - 1) // 2\nans += M * (M - 1) // 2\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s669224821', 's835825734'] | [3064.0, 2940.0] | [17.0, 17.0] | [314, 100] |
p02729 | u458834822 | 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. | ['# -*- coding: utf-8 -*-\nimport numpy as np\nimport math\n\nN, M = map(int, input().split())\n\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n \nprint(comb(N, 2)+comb(M, 2))', '# -*- coding: utf-8 -*-\nimport numpy as np\nimport math\n\nN, M = map(int, input().split())\n\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n \nprint(comb(N, M))', '# -*- coding: utf-8 -*-\nimport numpy as np\nimport math\n \nN, M = map(int, input().split())\n \ndef comb(n, r):\n return int(math.factorial(n) / (math.factorial(n - r) * math.factorial(r)))\n \nprint(comb(N, 2)+comb(M, 2))', '# -*- coding: utf-8 -*-\nimport numpy as np\nimport math\n \nN, M = map(int, input().split())\n \ndef comb(n, r):\n if n < r:\n return 0\n else:\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n \nprint(comb(N, 2)+comb(M, 2))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s192539256', 's322785551', 's750008196', 's820398674'] | [12504.0, 12484.0, 12848.0, 13076.0] | [151.0, 150.0, 160.0, 153.0] | [213, 202, 219, 260] |
p02729 | u460386402 | 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 count=n*(n-1)//2\n countt=m*(m-1)//2\nprint(count+countt)\n', 'n,m=map(int,input().split())\ncount=n*(n-1)//2\ncountt=m*(m-1)//2\nprint(count+countt)'] | ['Runtime Error', 'Accepted'] | ['s282742544', 's867480707'] | [2940.0, 2940.0] | [18.0, 17.0] | [88, 83] |
p02729 | u465652095 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import itertools\n\nN,M = map(int,input().split())\n\nif N == 1:\n c1 = 0\nelse:\n c1 = len(list(itertools.combinations(N, 2)))\n\nif M == 1:\n c2 = 0\nelse:\n c2 = len(list(itertools.combinations(M, 2)))\n\nc3 = c1 + c2\nprint(c3)', 'from scipy import special\n\nN,M = map(int,input().split())\n\nif N == 1:\n c1 = 0\nelse:\n c1 = special.comb(N, 2)\n\nif M == 1:\n c2 = 0\nelse:\n c2 = special.comb(M, 2)\n\nc3 = c1 + c2\nprint(c3)', 'N,M = map(int,input().split())\n\nif N == 1:\n c1 = 0\nelse:\n c1 = N! / (2! * (N - 2)!)\n\nif M == 1:\n c2 = 0\nelse:\n c2 = M! / (2! * (M - 2)!)\n\nprint(c1 + c2)', 'from scipy.special import comb\n\nN,M = map(int,input().split())\n\nif N == 1:\n c1 = 0\nelse:\n c1 = comb(N, 2, exact = False)\n\nif M == 1:\n c2 = 0\nelse:\n c2 = comb(M, 2, exact = False)\n\nc3 = c1 + c2\nprint(c3)', 'import itertools\n\nN,M = map(int,input().split())\n\nif N == 1:\n c1 = 0\nelse:\n c1 = len(list(itertools.combinations(N, 2)))\n\nif M == 1:\n c2 = 0\nelse:\n c2 = len(list(itertools.combinations(M, 2)))\n\nc3 = c1 + c2\nprint(c3)', 'import itertools\n\nN,M = map(int,input().split())\n\nif N == 1:\n c1 = 0\nelse:\n c1 = len(list(itertools.combinations(range(N), 2)))\n\nif M == 1:\n c2 = 0\nelse:\n c2 = len(list(itertools.combinations(range(M), 2)))\n\nc3 = c1 + c2\nprint(c3)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s046488721', 's184210754', 's411233964', 's650421978', 's837645943', 's903444076'] | [3060.0, 15256.0, 2940.0, 14496.0, 3060.0, 3444.0] | [18.0, 198.0, 17.0, 178.0, 17.0, 19.0] | [228, 195, 164, 214, 228, 242] |
p02729 | u468972478 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\na = n * (n - 1) // 2\nb = m*(m-1)//2\nprint(a*b)', 'n, m = map(int, input().split())\na = n * (n - 1) // 2\nb = m*(m-1)// 2\nprint(a + b)'] | ['Wrong Answer', 'Accepted'] | ['s917444758', 's729980021'] | [9020.0, 9092.0] | [25.0, 28.0] | [79, 82] |
p02729 | u470392120 | 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())\nif n<=1:\n n_ans=0\nelse:\n n_ans=n*(n-1)/2\n\nif m<=1:\n m_ans=0\nelse:\n m_ans=m*(m-1)/2\n \n\nprint(n_ans+m_ans)', '#A\nn,m=map(int,input().split())\nans=(n*(n-1)+m*(m-1))/2\nprint(ans)', '#A\nn,m=map(int,input().split())\nif n<=1:\n n_ans=0\nelse:\n n_ans=n*(n-1)/2\n\nif m<=1:\n m_ans=0\nelse:\n m_ans=m*(m-1)/2\n \n\nprint(int(n_ans+m_ans))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s010402479', 's859845671', 's210329683'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [151, 66, 156] |
p02729 | u470618774 | 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()))\nb = a[0]+a[1]\n\nc = ((a[0]*(a[0]-1))+(a[1]*(a[1]-1)))/2\nprint(c)', 'a = list(map(int,input().split()))\nb = a[0]+a[1]\n\nc = ((a[0]*(a[0]-1))+(a[1]*(a[1]-1)))/2\nprint(int(c))'] | ['Wrong Answer', 'Accepted'] | ['s731041023', 's438085491'] | [2940.0, 3060.0] | [18.0, 17.0] | [98, 103] |
p02729 | u471221431 | 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\ndata = input()\ndata = data.split()\nn = data[0]\nm = data[1]\n\nv = (math.factorial(int(n)) // (math.factorial(int(n) - 2) * math.factorial(2)))+(math.factorial(int(m)) // (math.factorial(int(m) - 2) * math.factorial(2)))\n\nprint(v)', 'import math\n\ndata = input()\ndata = data.split()\nn = data[0]\nm = data[1]\nv1 = 0\nv2 = 0\n\nif int(n) > 1:\n\tv1 = (math.factorial(int(n)) // (math.factorial(int(n) - 2) * math.factorial(2)))\n\nif int(m) > 1:\n v2 = (math.factorial(int(m)) // (math.factorial(int(m) - 2) * math.factorial(2)))\n\nprint(v1+v2)'] | ['Runtime Error', 'Accepted'] | ['s551380214', 's454859336'] | [3060.0, 3064.0] | [17.0, 17.0] | [240, 300] |
p02729 | u471503862 | 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())\nprint((m-1)*m/2+(n-1)*n/2)', 'm, n=map(int,input().split())\nprint(int((m-1)*m/2+(n-1)*n/2))\n'] | ['Wrong Answer', 'Accepted'] | ['s812179334', 's181763911'] | [2940.0, 2940.0] | [17.0, 18.0] | [56, 62] |
p02729 | u471539833 | 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)', 'L=int(input())\nprint((L/3)**3)', 'n=input()\nm=input()\n\nprint(n+m)', 'n,m=map(int,input().split())\n \nprint(n*(n-1)/2+m*(m-1)/2)', 'L=int(input())\nprint((L/3)**3)', 'n,m=map(int,input().split())\n \nprint(n*(n-1)/2+m*(m-1)/2)', 's=input()\nn=len(s)\n\nflag=True\n\nfor i in range(n):\n if(s[i]!=s[n-1-i]):\n flag=False\n\nfor i in range((n-1)/2):\n if(s[i]!=s[(n-1)/2-1-i]):\n flag=False\n if(s[(n-1)/2+1+i]!=s[n-1-i]):\n flag=False\n \nif(flag):\n print("Yes")\nelse:\n print("No")', 'n,m=map(int,input().split())\n \nprint(n(n-1)/2+m(m-1)/2)', "s=input()\nn=len(s)\n \nflag=True\n \nfor i in range(n):\n if(s[i]!=s[n-1-i]):\n flag=False\n \nfor i in range((n-1)//2):\n if(s[i]!=s[(n-1)//2-1-i]):\n flag=False\n if(s[(n-1)//2+1+i]!=s[n-1-i]):\n flag=False\n \nif(flag):\n print('Yes')\nelse:\n print('No')", 's=input()\nn=len(s)\n\nflag=True\n\nfor i in range(n):\n if(s[i]!=s[n-1-i]):\n flag=False\n\nfor i in range((n-1)//2):\n if(s[i]!=s[(n-1)//2-1-i]):\n flag=False\n if(s[(n-1)//2+1+i]!=s[n-1-i]):\n flag=False\n \nif(flag):\n print("Yes")\nelse:\n print("No")', 's=input()\nn=len(s)\n \nflag=True\n \nfor i in range(n):\n if(s[i]!=s[n-1-i]):\n flag=False\n \nfor i in range((n-1)//2):\n if(s[i]!=s[(n-1)//2-1-i]):\n flag=False\n if(s[(n-1)//2+1+i]!=s[n-1-i]):\n flag=False\n \nif(flag==True):\n print("Yes")\nelse:\n print("No")', 'n,m=map(int,input().split())\n \nprint(n*(n-1)//2+m*(m-1)//2)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s007571188', 's224918805', 's348720602', 's414910202', 's466494471', 's624078476', 's629476737', 's645597047', 's841513502', 's863554323', 's960736032', 's098409266'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3064.0, 2940.0, 3064.0, 3064.0, 3064.0, 2940.0] | [19.0, 17.0, 18.0, 17.0, 17.0, 18.0, 18.0, 17.0, 17.0, 17.0, 17.0, 17.0] | [54, 30, 31, 57, 30, 57, 252, 55, 258, 255, 264, 59] |
p02729 | u472696272 | 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)', "s = list(input())\nn = len(s)\nif s==s[::-1] and s[0:int((n-1)/2)]==s[0:int((n-1)/2)][::-1] and s[int((n+3)/2-1):n]==s[int((n+3)/2-1):n][::-1]:\n print('Yes')\nelse:\n print('No')\n", 'n,m = map(int,input())\nprint(int(n*(n-1)/2)+int(m*(m-1)/2))', 'n,m = map(int,input().split())\nprint(int(n*(n-1)/2)+int(m*(m-1)/2))\n'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s366640052', 's537339061', 's663916474', 's781738955'] | [2940.0, 3060.0, 2940.0, 2940.0] | [18.0, 19.0, 17.0, 17.0] | [59, 177, 59, 68] |
p02729 | u476038506 | 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().split()\nM = int(S[0])\nN = int(S[1])\na = (M*(M-1)/2) + (N*(N-1)/2)\nprint(a)', 'S = input().split()\nM = int(S[0])\nN = int(S[1])\na = int((M*(M-1)/2) + (N*(N-1)/2))\nprint(a)\n'] | ['Wrong Answer', 'Accepted'] | ['s639285766', 's460663767'] | [2940.0, 2940.0] | [17.0, 17.0] | [86, 92] |
p02729 | u476667222 | 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 combination(n, r):\n if n <= 0:\n return 0\n return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))\n\nn, m= input().split(" ")\nn = int(n)\nm = int(m)\n\nprint(combination(n, 2) + combination(m,2))', 'import math\ndef combination(n, r):\n return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))\n\nn, m= input().split(" ")\nn = int(n)\nm = int(m)\n\nprint(combination(n, 2) + combination(m,2))', 'import math\ndef combination(n, r):\n if n <= 0 or n is 1:\n return 0\n return math.factorial(n) // (math.factorial(r) * math.factorial(n - r))\n\nn, m= input().split(" ")\nn = int(n)\nm = int(m)\n\nprint(combination(n, 2) + combination(m,2))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s333403438', 's440340533', 's705511214'] | [3060.0, 3060.0, 3060.0] | [18.0, 17.0, 17.0] | [235, 203, 245] |
p02729 | u478646901 | 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())\nprint((l/3)**3)', '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))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s640109050', 's968342623', 's864202441'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [34, 58, 63] |
p02729 | u479484272 | 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()\nL = list(S)\nlen = int(len(L))\n\nL1 = L[:(len-1)//2]\nL1_r = L1[::-1]\nL2 = L[(len+3)//2-1:]\nL2_r = L2[::-1]\n\nif(L1==L1_r and L2==L2_r):\n print("Yes")\nelse:\n print("No")\n', 'S = input().split()\nN = int(S[0])\nM = int(S[1])\n\nprint(int((N*(N-1)/2)+(M*(M-1)/2)))'] | ['Wrong Answer', 'Accepted'] | ['s534080964', 's285467154'] | [3060.0, 3060.0] | [18.0, 19.0] | [184, 84] |
p02729 | u481919972 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['nm = input()\nn = int(nm[0])\nm = int(nm[1])\n\nans = 0\n\nn1 = n*(n-1)/2\n\nn2 = m*(m-1)/2\n\nans = n1 + n2\n\nprint(ans)', 'nm = input().split()\nn = int(nm[0])\nm = int(nm[1])\n\nans = 0\n\nn1 = n*(n-1)/2\n\nn2 = m*(m-1)/2\n\nans = n1 + n2\n\nprint(ans)', 'nm = input().split()\nn = int(nm[0])\nm = int(nm[1])\n\nans = 0\n\nn1 = n*(n-1)/2\n\nn2 = m*(m-1)/2\n\nans = int(n1 + n2)\n\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s059932050', 's348690695', 's320633242'] | [9072.0, 8992.0, 9088.0] | [28.0, 28.0, 25.0] | [110, 118, 123] |
p02729 | u482522932 | 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 = input()\nm = input()\nprint(math.factorial(n+m))', 'import math\nn,m = map(int,input().split())\nif n is 0 or n is 1:\n print(math.factorial(m)/math.factorial(m-2)/2)\nif m is 0 or m is 1:\n print(math.factorial(n)/math.factorial(n-2)/2)\nelse:\n print(math.factorial(n+m)/math.factorial(n+m-2)/2)', 'n = input()\nm = input()\nif n=0 or n=1:\n print(math.factorial(m))\nif m=0 or m=1:\n print(math.factorial(n))\nelse:\n print(math.factorial(n+m))', 'n,m = map(int,input().split())\nprint(int(n*(n-1)/2 + m*(m-1)/2))'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s034593318', 's228319966', 's339542503', 's417069887', 's870833969', 's084220605'] | [2940.0, 2940.0, 2940.0, 3060.0, 2940.0, 3064.0] | [17.0, 17.0, 17.0, 17.0, 18.0, 17.0] | [59, 59, 50, 241, 142, 64] |
p02729 | u482743994 | 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()\nl=s[:int(len(s)/2)+1]\nr=s[int(len(s)/2):]\n#print(l)\n#print(r)\nfor i in range(int(len(s)/2)+1):\n if s[i]==s[-i-1] and l[i]==r[i]:\n if i==int(len(s)/2):\n print("Yes")\n exit()\n continue\n else:\n print("No")\n break', 's=input()\nl=s[:(len(s)-1)//2]\nr=s[(len(s)+3)//2-1:]\n#print(l)\n#print(r)\nfor i in range((len(s)-1)//2):\n if s[i]==s[-i-1] and l[i]==r[i]:\n if i==(len(s)-1)//2-1:\n print("Yes")\n exit()\n continue\n else:\n print("No")\n break', 'from math import factorial as f\nn,m=map(int,input().split())\nprint(f(n)//(f(2)*f(n-2))+f(m)//(f(2)*f(m-2)))', 'from math import factorial as f\nn,m=map(int,input().split())\ncomb_n=f(n)//(f(2)*f(n-2)) if n>1 else 0\ncomb_m=f(m)//(f(2)*f(m-2)) if m>1 else 0\nprint(comb_n+comb_m)'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s501340748', 's765096458', 's953746329', 's933862212'] | [3060.0, 3064.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0, 19.0] | [243, 243, 107, 163] |
p02729 | u484052148 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\nprint(n*(n-1) + m*(m-1))', 'n, m = map(int, input().split())\n\n\nprint((n*(n-1) + m*(m-1))//2)'] | ['Wrong Answer', 'Accepted'] | ['s304109234', 's720881601'] | [2940.0, 2940.0] | [18.0, 17.0] | [57, 123] |
p02729 | u486209657 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M=map(int,input().split())\n\nc = (N+M)*(N+M-1)/2 - N*M\n\nprint(c)', 'N,M=map(int,input().split())\n\nc = (N+M)*(N+M-1)/2 - N*M\n\nprint(int(c))'] | ['Wrong Answer', 'Accepted'] | ['s770801955', 's597998981'] | [9148.0, 8980.0] | [27.0, 27.0] | [65, 70] |
p02729 | u487044452 | 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())\nX = N*(N-1)/2 + M*(M-1)/2\nprint(X)', 'N, M = map(int,input().split())\nX = N*(N+1)/2 + M*(M+1)/2\nprint(X)', 'N, M = map(int,input().split())\nX = int(N*(N-1)/2 + M*(M-1)/2)\nprint(X)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s710505873', 's743685969', 's121580024'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [66, 66, 71] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.