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 | u048166300 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nN=len(S)\np=0\na=0\nc=0\nfor i in range(int((N-1)/2)):\n if S[i]==S[-i-1]:\n p+=1\nif p==(N-1)/2:\n for i in range(int((N-1)/4)):\n T=S[:int((N-1)/2)]\n if T[i]==T[-i-1]:\n a+=1\n if a==int((N-1)/4):\n for y in range(int((N-(N+3)/2)/2)):\n F=S[int((N+3)/2)-1:]\n if F[y]==F[-y-1]:\n c+=1\n if c==(int((N-(N+3)/2)/2)):\n print("yes")\n else:\n print("No")\n else:\n print("No")\nelse:\n print("No")', 'N,M = map(int,input().split())\ns=int(N*(N-1)/2+M*(M-1)/2)\nprint(s)\n'] | ['Wrong Answer', 'Accepted'] | ['s899834151', 's459008855'] | [3064.0, 2940.0] | [17.0, 17.0] | [534, 67] |
p02729 | u053035261 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['x,y = map(int,input().split())\t\n\n# even + even \nans = x*(x – 1) / 2\n\n\nans += y*(y-1) / 2\n\nprint(ans)\n', 'x,y = map(int,input().split())\n\n# even + even\nans = x*(x-1) / 2\n\n\nans += y*(y-1) / 2\n\nprint(int(ans))\n'] | ['Runtime Error', 'Accepted'] | ['s342583681', 's764017584'] | [2940.0, 2940.0] | [17.0, 17.0] | [114, 113] |
p02729 | u054662964 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['a,b = input().split()\na = int(a)\nb = int(b)\nA = (a*a-1)/2\nB = (b*b-1)/2\nif a == 1 and b == 1:\n print(0)\nelif a ==1 and b >= 1:\n print(B)\nelif a >= 1 and b == 1:\n print(A)\nelif a>= 1 and b >=1:\n print(A+B)', 'a,b = input().split()\na = int(a)\nb = int(b)\n\n\nS = a*a-1/2\nF = b*b-1/2\nif a<1.9 and b<1.9:\n print(0)\nelif a<1.9 and b>1.9:\n print(int(F))\nelif a>1.9 and b<1.9:\n print(int(S))\nelif a>1.9 and b>1.9:\n print(int(S+F))\n \n', 'a,b = input().split()\na = int(a)\nb = int(b)\nA = (a*a-1)/2\nB = (b*b-1)/2\nif a <= 2 and b <= 2:\n print(0)\nelif a <=2 and b >= 1:\n print(B)\nelif a >= 1 and b <= 2:\n print(A)\nelif a>= 1 and b >=1:\n print(A+B)', 'a = input().split()\nb = int(a[0])\nc = int(a[1])\nif b == 1 and c == 1:\n print(0)\nelif b>=2 and c>=2:\n d = b-1\n e = c-1\n f = b*d/2\n g = c*e/2\n print(int(f+g))\nelif b<=1 and c>=2:\n d = c-1\n f = c*d/2\n print(int(f))\nelif b>=2 and c<=1:\n d = b-1\n f = b*d/2\n print(int(f))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s322872755', 's425503019', 's472481350', 's013384080'] | [3060.0, 3060.0, 3060.0, 3064.0] | [18.0, 17.0, 17.0, 17.0] | [208, 226, 208, 302] |
p02729 | u055687574 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nn = math.factorial(N) / math.factorial(N-2) / 2\nm = math.factorial(M) / math.factorial(M-2) / 2\n\nprint(int(n + m))', 'import math\n\nN, M = map(int, input().split())\n\ndef f(a):\n if a > 1:\n return int(math.factorial(a) / math.factorial(a-2) / 2)\n else:\n return 0\n\nprint(f(N) + f(M))'] | ['Runtime Error', 'Accepted'] | ['s517160695', 's313930332'] | [3060.0, 2940.0] | [17.0, 17.0] | [161, 181] |
p02729 | u058510797 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 *\n\n\nN,M = list(map(int,input().split(" ")))\nA = (N*(N-1))/2+(M*(M-1))/2\nprint (A)', 'L= int(input())\nA = (L/3)*(L/3)*(L/3)\nprint (A)\n', 'N = input()\nM = input()\nA = (factorial(N)*factorial(N-1))+(factorial(M)*factorial(M-1))/2\nprint A', 'from math import *\n\n\nN,M = list(map(int,input().split(" ")))\nA = (N*(N-1))/2+(M*(M-1))/2\nprint (int(A))\n\n'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s122100044', 's124031041', 's413770404', 's793846834'] | [3060.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [98, 48, 97, 105] |
p02729 | u060736237 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n = int(input())\na = list(map(int, input().split()))\ncount = 0\nL = len(a)\nfor el in a:\n count += a.count(el)-1\ncount //= 2\nfor el in a:\n print(count - a.count(el)+1)', 'n = int(input())\na = list(map(int, input().split()))\nd = [0]*(n+1)\ncount = 0\nfor el in set(a):\n temp = d[el] = a.count(el)\n count += temp*(temp-1)\ncount //= 2\nfor el in a:\n print(count - d[el] + 1)', 'n = int(input())\na = list(map(int, input().split()))\ncount = 0\nfor el in a:\n count += a.count(el)-1\ncount //= 2\nfor el in a:\n print(count - a.count(el)+1)', 'n = int(input())\na = list(map(int, input().split()))\ncount = 0\nfor i in range(len(a)):\n count += a.count(a[i])\ncount /= 2\nfor i in range(len(a)):\n print(count - a.count(a[i])+1)', 'n = int(input())\na = list(map(int, input().split()))\ncount = 0\nfor i in range(len(a)):\n count += a.count(a[i])\ncount /= 2\nfor i in range(len(a)):\n print(count - a.count(a[i])+1)', 'n, m = map(int, input().split())\nresult = (n+m)*(n+m-1)//2 - n*m\nprint(result)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s004012443', 's149677125', 's388606978', 's441353551', 's799917610', 's203343816'] | [3060.0, 3060.0, 2940.0, 3060.0, 3060.0, 2940.0] | [18.0, 18.0, 17.0, 17.0, 17.0, 17.0] | [171, 206, 160, 183, 183, 79] |
p02729 | u060896757 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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.__int__())'] | ['Wrong Answer', 'Accepted'] | ['s757750957', 's272841529'] | [2940.0, 2940.0] | [17.0, 18.0] | [83, 93] |
p02729 | u062754605 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\nprint(int(N * (N - 1) + M * (M-1)) / 2)\n', '# %%\nN = int(input())\nM = int(input())\nprint((N * (N - 1) + M * (M-1)) / 2)\n', 'print(int((input()))**3/27)\n', 'S = input()\na = (len(S) - 1) / 2\nb = (len(S) + 1) / 2\nif S[:a] == S[b:]:\n print("Yes")\nelse:\n print("No")\n', 'N, M = map(int, input().split())\nprint(int((N * (N - 1) + M * (M-1)) / 2))\n'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s008612372', 's062901936', 's070246510', 's110142306', 's140531487'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 18.0, 18.0, 17.0, 17.0] | [73, 76, 28, 112, 75] |
p02729 | u063346608 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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()\n\nflag = 0\nfor i in range(0, len(S), 1):\n\tif S[i] != S[len(S)-1-i]:\n\t\tflag = 1\n\nfor i in range(0, (len(S) + 1) //2, 1):\n\tif S[i] != S[len(S)//2-1-i]:\n\t\tflag = 1\n\nif flag == 0:\n\tprint("Yes")\nelse:\n\tprint("No")', 'N,M = map(int,input().split())\n\nprint((N * (N - 1)) // 2 + (M * (M - 1)) // 2)'] | ['Wrong Answer', 'Accepted'] | ['s723727367', 's007056868'] | [9060.0, 9144.0] | [27.0, 29.0] | [219, 79] |
p02729 | u065578867 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 col(x):\n if x == 0:\n return(0)\n else:\n return((x * (x - 1)) / 2)\nprint(col(n) + col(m))\n', 'n, m = map(int, input().split())\ndef col(x):\n if x == 0:\n return(0)\n else:\n return((x * (x - 1)) // 2)\nprint(col(n) + col(m))\n'] | ['Wrong Answer', 'Accepted'] | ['s089708972', 's994200239'] | [2940.0, 2940.0] | [17.0, 17.0] | [145, 146] |
p02729 | u065870010 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nN2,M1 = map(int, input().split())\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\ncount = combinations_count(N2,2)\n\ncount += combinations_count(M1,2)\n\nprint(count)', 'import math \n\nN2,M1 = map(int, input().split())\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nprint(combinations_count(4, 2))\n\ncount = combinations_count(N2,2)\n\ncount += combinations_count(M1,2)\n\nprint(count)', 'import math \n\nN2,M1 = map(int, input().split())\ncount=0\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nif N2!=0:\n count += combinations_count(N2,2)\nif M1!=0:\n count += combinations_count(M1,2)\n\nprint(count)', 'import math \n\nN2,M1 = map(int, input().split())\ncount=0\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nif N2!=0 and N2!=1:\n count += combinations_count(N2,2)\nif M1!=0 and M1!=1:\n count += combinations_count(M1,2)\n\nprint(count)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s685321725', 's755306636', 's986186154', 's348113020'] | [3060.0, 3060.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0, 17.0] | [238, 270, 272, 292] |
p02729 | u066551652 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nN = len(S)\n\nS1 = S[0:N//2]\nS1_1=S1[0:len(S)//4]\nS1_2=S1[len(S)//4+1:]\n\nS2= S[N//2+1:]\nS2_1=S2[0:len(S)//4]\nS2_2=S2[len(S)//4+1:]\n\n\nif S1_1 == S1_2 and S2_1 == S2_2:\n print("Yes")\nelse:\n print("No")', '\nN, M = map(int,input().split())\n\nif N > 2:\n N_even = N*(N - 1)/2\nelse:\n N_even = 0\n\nif M > 2:\n M_even = M*(M-1)/2\nelse:\n M_even = 0\n\nprint(int(N_even + M_even))', '\nN, M = map(int, input().split())\n\n\nif N >= 2:\n N_even = N*(N - 1)/2\nelse:\n N_even = 0\n\nif M >= 2:\n M_even = M*(M-1)/2\nelse:\n M_even = 0\n\nprint(int(N_even + M_even))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s029586450', 's438668346', 's987780342'] | [3064.0, 2940.0, 2940.0] | [17.0, 19.0, 20.0] | [220, 211, 215] |
p02729 | u067986264 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['S = input()\nN = len(S)\nif S == S[::-1] and S[:(N - 1)//2][::-1] == S[:(N - 1)//2] and S[(N + 3)//2][::-1] == S[(N + 3)//2]:\n print("Yes")\nelse:\n print("No")', 'from itertools import combinations\nn, m = map(int, input().split())\nr = []\ni = 0\nj = -1\nc = 0\nfor _ in range(n):\n i += 2\n r.append(i)\nfor _ in range(m):\n j += 2\n r.append(j)\nr.sort()\nfor k in list(combinations(r, 2)):\n if sum(k) % 2 == 0:\n c += 1\n\nprint(c)'] | ['Runtime Error', 'Accepted'] | ['s092902172', 's029214785'] | [3060.0, 4468.0] | [17.0, 25.0] | [162, 278] |
p02729 | u068750695 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nif a<=1 and b<=1:\n print(0)\nif a<1 and 1<b:\n print((b*(b-1))//2)\nif 1<a and b<1:\n print((a*(a-1))//2)\nif 1<a and 1<b:\n print(((a*(a-1))//2)+((b*(b-1))//2))\n', 'a,b=map(int,input().split())\nif a<=1 and b<=1:\n print(0)\nif a<=1 and 1<b:\n print((b*(b-1))//2)\nif 1<a and b<=1:\n print((a*(a-1))//2)\nif 1<a and 1<b:\n print(((a*(a-1))//2)+((b*(b-1))//2))'] | ['Wrong Answer', 'Accepted'] | ['s108490342', 's864142331'] | [2940.0, 3064.0] | [17.0, 18.0] | [197, 198] |
p02729 | u068862866 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\n\nif N>=2:\n gyu = N*(N-1)//2\nelse:\n gyu = 0\n \nif M>=2:\n ki = M*(M-1)//2\nelse:\n ki = 0\n\nprint(gyu+ki)', 'N,M = map(int,input().split())\n \nif N>=2:\n gyu = N*(N-1)//2\nelse:\n gyu = 0\n \nif M>=2:\n ki = M*(M-1)//2\nelse:\n ki = 0\n \nprint(gyu+ki)'] | ['Runtime Error', 'Accepted'] | ['s967155107', 's142135689'] | [9096.0, 9100.0] | [23.0, 29.0] | [127, 137] |
p02729 | u070201429 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\n\ninput_1 = input()\ninput_2 = input_1.split()\n\nA = map(int, input_2)\n\ndef equal(num):\n return num\nA = [equal(x) for x in A]\n\nans = 0\n\nfor l in range(N):\n ans += A.count(A[l]) - 1\n\nans = ans / 2\nre = ans\n\nfor k in range(N):\n ans -= A.count(A[k]) - 1\n\n print(int(ans))\n\n ans = re', 'N, M = map(int, input().split())\n\nans = (N * (N - 1) + M * (M - 1)) / 2\n\nprint(int(ans))'] | ['Runtime Error', 'Accepted'] | ['s434490776', 's718588266'] | [3064.0, 2940.0] | [17.0, 17.0] | [308, 88] |
p02729 | u071916806 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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)\na=n*(n-1)\nb=m*(m-1)\nprint(a+b)', 'n,m=input().split()\nn=int(n)\nm=int(m)\na=n*(n-1)+m*(m-1)\nprint(a)', 'N,M=input().split()\nn=int(N)\nm=int(M)\na=(n*(n-1))/2\nb=(m*(m-1))/2\nprint(a+b)', 'N,M=input().split()\nn=int(N)\nm=int(M)\na=int((n*(n-1))/2)\nb=int((m*(m-1))/2)\nprint(a+b)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s061603079', 's800050622', 's840828997', 's358924798'] | [2940.0, 2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0, 17.0] | [68, 64, 76, 86] |
p02729 | u074687136 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\ne_e = N * (N - 1) / 2\no_o = M * (M - 1) / 2\n\nprint(e_e + o_o)', 'N, M = map(int, input().split())\n\ne_e = N * (N - 1) / 2\no_o = M * (M - 1) / 2\n\nprint(int(e_e + o_o))'] | ['Wrong Answer', 'Accepted'] | ['s500338777', 's782698156'] | [2940.0, 2940.0] | [17.0, 17.0] | [95, 100] |
p02729 | u075109824 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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<stdio.h>\n\nlong int multiplyNumbers(int n) {\n if (n>=1)\n return n*multiplyNumbers(n-1);\n else\n return 1;\n}\n\nint main(){\n\tlong int N, M;\n\tscanf("%ld %ld", &N, &M);\n\tlong int c1 = multiplyNumbers(N)/((multiplyNumbers(N-2))*multiplyNumbers(2));\n\tlong int c2 = multiplyNumbers(M)/((multiplyNumbers(M-2))*multiplyNumbers(2));\n\tprintf("%d", c1+c2);\n\treturn 0;\n}', 'from itertools import combinations\n\nN, M = map(int, input().split())\n\na = list(combinations(range(N), 2))\nb = list(combinations(range(M), 2))\nprint(len(a)+len(b))'] | ['Runtime Error', 'Accepted'] | ['s458234952', 's070109905'] | [2940.0, 3700.0] | [17.0, 20.0] | [383, 162] |
p02729 | u075304271 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 functools\nimport math\nimport collections\nimport scipy\nimport fractions\nimport itertools\n\ndef solve():\n n = int(input())\n a = list(map(int, input().split()))\n c = collections.Counter(a)\n s = 0\n for i in list(c.values()):\n s += i*(i-1)//2\n print(c)\n for i in a:\n print(c[i])\n print(s-(c[i]-1))\n return 0\n \nif __name__ == "__main__":\n solve()\n', 'import itertools\n\ndef solve():\n n, m = map(int, input().split())\n a = len(list(itertools.combinations(range(n), 2)))\n b = len(list(itertools.combinations(range(m), 2)))\n print(a + b)\n return 0\n\nif __name__ == "__main__":\n solve()\n'] | ['Runtime Error', 'Accepted'] | ['s335643789', 's297472336'] | [13328.0, 3444.0] | [166.0, 19.0] | [365, 236] |
p02729 | u075595666 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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()]\nif n <= 1:\n a = 0\nelse:\n a = n*(n-1)/2\nif m <= 1:\n b = 0\nelse:\n b = m*(m-1)/2\nprint(ab)', 'n,m = [int(i) for i in input().split()]\nif n <= 1:\n a = 0\nelse:\n a = n*(n-1)/2\nif m <= 1:\n b = 0\nelse:\n b = m*(m-1)/2\nprint(a+b)', 'n,m = [int(i) for i in input().split()]\nif n <= 1:\n a = 0\nelse:\n a = n*(n-1)/2\nif m <= 1:\n b = 0\nelse:\n b = m*(m-1)/2\nprint(int(a+b))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s058881399', 's441229931', 's012314406'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [131, 132, 137] |
p02729 | u076360626 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["def kaibun(str):\n return True if str == str[::-1] else False\n\ns = input()\nif not kaibun(s) :\n print('No')\n exit()\nn = len(s)\nn1 = (n - 1) // 2\nif not kaibun(s[:n1]) :\n print('No')\n exit()\nn2 = (n + 3) // 2 - 1\nif not kaibun(s[n2:]) :\n print('No')\n exit()\nprint('Yes')\n", 'import math\n \ndef resolve():\n n = int(input())\n a = [int(x) for x in input().split()]\n \n for k in range(n):\n \n ak = [x for x in a] \n del ak[k]\n kumi = 0\n ended = []\n \n # loop\n for i in range(n - 1):\n a0 = ak[i] \n if a0 in ended:\n continue\n cnt = ak.count(a0)\n if cnt >= 2:\n kumi += kumiawase(cnt ,2)\n ended.append(a0)\n print(kumi)\n \ndef kumiawase(n, r):\n return math.factorial(n) // (r * math.factorial(n - r))\n \nresolve()', 'import math\n\na = [int(x) for x in input().split(" ")]\nn = a[0]\nm = a[1]\nans = 0\nif n >= 2 :\n ans += math.factorial(n) // (2 * math.factorial(n - 2))\nif m >= 2 :\n ans += math.factorial(m) // (2 * math.factorial(m - 2))\nprint(ans)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s197530308', 's570448554', 's226396039'] | [3060.0, 3064.0, 3060.0] | [17.0, 17.0, 17.0] | [289, 624, 234] |
p02729 | u077019541 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M=map(int,input().split())\nprint(N*(N-1)/2+M*(M-1)/2)', 'N,M=map(int,input().split())\nprint(int(N*(N-1)/2+M*(M-1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s448628829', 's295206877'] | [2940.0, 3060.0] | [17.0, 19.0] | [55, 60] |
p02729 | u078168851 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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'] | ['s167102047', 's361229427'] | [9100.0, 9024.0] | [28.0, 30.0] | [59, 61] |
p02729 | u078225071 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['a,b = map(int,input().split())\nprint(((a*(a-1)) // 2 + ((b*(b-1))// 2) \n\n \n \n', 'M,N = map(int,input().split())\nprint((M*(M-1))//2 + ((N*(N-1))//2) \n\n \n \n', 'a,b = map(int,input().split())\nprint((a*(a-1)) // 2 + ((b*(b-1))// 2 )\n\n \n ', 'a,b = map(int,input().split())\nc = ((a*(a-1)) / 2 + ((b * (b-1)) / 2 )\nprint(int(c))', 'N,M = map(int, input().split())\nprint((N*(N-1))//2 + (M*(M-1))//2) \n\n \n \n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s088855698', 's261376291', 's690573147', 's975256448', 's738580032'] | [2940.0, 2940.0, 3064.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0, 17.0] | [84, 80, 82, 84, 80] |
p02729 | u078307399 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nnums = list(map(int, input().split()))\n\nvalues = {}\nfor i in nums:\n if i in values: values[i] += 1\n else: values[i] = 1\n\nsums={} \nsubsums={} (ボールがないとき版\nallsum = 0\nfor k,v in values.items():\n sums[k] = v * (v - 1) / 2\n undersum = (v - 2) * (v - 1) / 2 if v > 1 else 0\n subsums[k] = sums[k] - undersum\n allsum += sums[k]\n\n\n# for k,v in sums.items():\n\nfor i in nums:\n print(int(allsum - subsums[i]))\n', 'n,m = map(int, input().split())\n\nprint(int(n * (n-1) / 2 + m * (m - 1) / 2))'] | ['Runtime Error', 'Accepted'] | ['s971120151', 's912786637'] | [3064.0, 2940.0] | [18.0, 17.0] | [558, 76] |
p02729 | u078982327 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 * (m - 1)/2 + n * (n - 1)/2)', 'm, n = map(int, input().split())\nprint(int(m * (m - 1)/2 + n * (n - 1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s346161232', 's064830889'] | [2940.0, 3060.0] | [17.0, 17.0] | [69, 74] |
p02729 | u080364835 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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)//2a)', 'n, m = map(int, input().split())\nprint(n*(n-1)//2 + m*(m-1)//2)'] | ['Runtime Error', 'Accepted'] | ['s455492020', 's518864292'] | [2940.0, 3060.0] | [17.0, 19.0] | [64, 63] |
p02729 | u080423069 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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,M=map(int,input().split())\n\nprint((N*(N-1)+M*(M-1))//2)'] | ['Wrong Answer', 'Accepted'] | ['s001055165', 's773077196'] | [2940.0, 2940.0] | [17.0, 17.0] | [56, 57] |
p02729 | u080685822 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\nif m >= 2:\n if n < 2:\n print(int(m*(m-1)/2)\n quit()\n else:\n print(int(m*(m-1)/2 + n*(n-1)/2))\n quit()\n \nif m < 2:\n if n < 2:\n print(0)\n else:\n print(int(n*(n-1)/2))\n \n', 'n, m = map(int, input().split())\nif m >= 2:\n if n < 2:\n print(m * (m - 1) / 2)\n quit()\n else:\n print(m*(m-1)/2 + n*(n-1)/2)\n quit()\n \nif m < 2:\n if n< 2:\n print(0)\n else:\n print(n*(n-1)/2)\n ', 'n, m = map(int, input().split())\nif m >= 2:\n if n < 2:\n print(int(m*(m-1)/2))\n quit()\n else:\n print(int(m*(m-1)/2 + n*(n-1)/2))\n quit()\n \nif m < 2:\n if n < 2:\n print(0)\n else:\n print(int(n*(n-1)/2))\n \n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s340889097', 's928948754', 's138650224'] | [2940.0, 2940.0, 3060.0] | [16.0, 17.0, 17.0] | [226, 216, 227] |
p02729 | u083874202 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nH, W = map(int, input().split())\n\na = (H * (H-1))/2\nb = (W * (W-1))/2\n\nprint(a+b)\n', 'import math\nH, W = map(int, input().split())\n\na = (H * H-1)/2\nb = (W * W-1)/2\nprint(a+b)', 'import math\nH, W = map(int, input().split())\n \na = (H * (H-1))/2\nb = (W * (W-1))/2\n \nprint(int(a+b))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s121999561', 's437960009', 's358768987'] | [2940.0, 3060.0, 2940.0] | [18.0, 17.0, 17.0] | [94, 88, 100] |
p02729 | u084261177 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = list(map(int, input().split()))\nlis = []\nfor i in range(n):\n lis.append(1)\n for i in range(m):\n lis.append(2)\n count = 0\n for i in range(len(lis)):\n for j in range(i + 1, len(lis)):\n if (lis[i] + lis[j]) % 2 == 0:\n count += 1\n print(count)', 'n, m = list(map(int, input().split()))\nlis = []\nfor i in range(n):\n lis.append(1)\nfor i in range(m):\n lis.append(2)\ncount = 0\nfor i in range(len(lis)):\n for j in range(i + 1, len(lis)):\n if (lis[i] + lis[j]) % 2 == 0:\n count += 1\nprint(count)'] | ['Wrong Answer', 'Accepted'] | ['s028798046', 's417861559'] | [15340.0, 3064.0] | [2104.0, 22.0] | [287, 253] |
p02729 | u085279920 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m = map(int, input().split())\nprint(n*(n-1)/2 + m*(m-1)/2)', 'n,m = map(int, input().split())\nprint(int(n*(n-1)/2 + m*(m-1)/2))\n'] | ['Wrong Answer', 'Accepted'] | ['s871459978', 's613425726'] | [2940.0, 2940.0] | [17.0, 17.0] | [60, 66] |
p02729 | u085329544 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m = map(int, input().split())\nprint((n*(n-1)+m*(m-1))/2)', 'n,m = map(int, input().split())\nprint((n*(n-1)/2+m*(m-1)/2)', 'n,m = map(int, input().split())\nprint((n*(n-1)+m*(m-1))/2)', 'n,m = map(int, input().split())\nprint(n*(n-1)+m*(m-1))', 'n,m = map(float, input().split())\nprint(int((n*(n-1)+m*(m-1))/2))'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s045773440', 's584726800', 's815156244', 's939293801', 's257718379'] | [2940.0, 2940.0, 2940.0, 3316.0, 2940.0] | [17.0, 17.0, 17.0, 21.0, 17.0] | [58, 59, 58, 54, 65] |
p02729 | u088115428 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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)\nans= "Yes"\nfor i in range(0,(len(s)//2)):\n if(l[i]!=l[-1-i]):\n ans = "No"\nprint(ans)\n', 's= input()\nl = list(s)\nans= "Yes"\nfor i in range(0,(len(s)//2)+1):\n if(l[i]!=l[-1-i]):\n ans = "No"\nprint(ans)\n', 's= input()\nl = list(s)\nans= "Yes"\nfor i in range(0,len(s)//2):\n if(l[i]!=l[-1-i]):\n ans = "No"\nprint(ans)\n', 'n,m = map(int, input().split())\nprint((n+m)*(n+m-1)//2 -n*m)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s077771924', 's318297027', 's930527967', 's741146689'] | [2940.0, 2940.0, 2940.0, 3316.0] | [17.0, 17.0, 18.0, 21.0] | [112, 114, 110, 60] |
p02729 | u089504174 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m=map(int,input().split())\nans=n*(n-1)/2+m*(m-1)/2\nprint(ans)', 'n,m=map(int,input().split())\nans=n*(n-1)/2+m*(m-1)/2\nprint(int(ans))'] | ['Wrong Answer', 'Accepted'] | ['s284660398', 's268553569'] | [2940.0, 2940.0] | [17.0, 21.0] | [63, 68] |
p02729 | u092460072 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['a,b=list(map(int, input().split()))\nct=(a*(a-1))//2\nct+=b\nprint(ct)', 'a,b=list(map(int, input().split()))\nct=(a*(a-1))//2\nct+=(b*(b-1))//2\nprint(ct)'] | ['Wrong Answer', 'Accepted'] | ['s891050277', 's756107580'] | [2940.0, 2940.0] | [18.0, 17.0] | [67, 78] |
p02729 | u093861603 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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(int(n*(n-1)/2+m*(m-1)/2))\n'] | ['Wrong Answer', 'Accepted'] | ['s177054164', 's791183790'] | [2940.0, 2940.0] | [17.0, 17.0] | [57, 62] |
p02729 | u096446417 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = N+M\nif result % 2 == 1:\n print(result)', 'a = map(int, input().split())\nprint(n*(n-1)//2 + m*(m-1)//2)\n', 'N,M = map(int , input().split())\nresult = N+M\nif result % 2 == 1:\n print(result)\n', 'a = 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'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s075487793', 's211844557', 's318590610', 's668656020', 's087229598'] | [3316.0, 2940.0, 2940.0, 2940.0, 2940.0] | [19.0, 17.0, 17.0, 17.0, 17.0] | [83, 61, 84, 59, 64] |
p02729 | u097069712 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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,w=map(int,input().split())\nprint((n*w)*(n*w-1) /2)', 'n,w=map(int,input().split())\nprint(nw(nw-1) /2)', 'n,w=map(int,input().split())\nprint(n*w(n*w-1) /2)', 'n,w=map(int,input().split())\nprint((n*(n-1)//2)+(w*(w-1)//2))'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s299603750', 's440232523', 's867292605', 's151401673'] | [2940.0, 2940.0, 2940.0, 2940.0] | [18.0, 17.0, 18.0, 17.0] | [52, 47, 49, 61] |
p02729 | u100572972 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nif N !=0 and N != 1:\n a = combinations_count(N, 2)\nelse:\n a = 0\n\nif M !=0 and M != 0:\n b = combinations_count(M, 2)\nelse:\n b = 0\n\nprint(a+b)', 'import math\nN,M = map(int,input().split())\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nif N !=0 and N != 1:\n a = combinations_count(N, 2)\nelse:\n a = 0\n\nif M !=0 and M != 1:\n b = combinations_count(M, 2)\nelse:\n b = 0\n\nprint(a+b)'] | ['Runtime Error', 'Accepted'] | ['s535496083', 's122282433'] | [3060.0, 3064.0] | [17.0, 18.0] | [303, 303] |
p02729 | u100812801 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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()\ns = int(s)\nt=input()\nt = int(t)\nprint(s*(s-1) /2 + t*(t-1)/2)', 's,t=(int(x) for x in input().split())\nprint(s*(s-1) /2 + t*(t-1)/2)', 's,t=(int(x) for x in input().split())\nprint(int(s*(s-1) /2 + t*(t-1)/2))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s731813071', 's733203620', 's344866078'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0] | [71, 67, 72] |
p02729 | u100873497 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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+m)*(n+m-1)/2-n*m)', 'n,m = map(int,input().split())\n\nprint(round((n+m)*(n+m-1)/2-n*m))'] | ['Wrong Answer', 'Accepted'] | ['s302645398', 's750755857'] | [2940.0, 2940.0] | [17.0, 18.0] | [58, 65] |
p02729 | u101350975 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['s = input()\nn = len(s)\nt = s[:(n-1)//2]\nu = s[(n+3)//2-1:]\nif s==s[::-1] and t==t[::-1] and u==u[::-1]:\n print("Yes")\nelse:\n print("No")\n', 'N, M = map(int,input( ).split())\nanswer = (N * (N-1) + M * (M-1)) // 2\nprint(answer)'] | ['Wrong Answer', 'Accepted'] | ['s843221007', 's029948279'] | [2940.0, 2940.0] | [17.0, 18.0] | [143, 84] |
p02729 | u101513660 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["import math\n\ndef inputlist(): return [int(i) for i in input().split()]\n\ndef kumiawase(num):\n r = 2\n if num != 1 or num != 0:\n return math.factorial(num) // (math.factorial(num - r) * math.factorial(r))\n else:\n return 0\n\ndef main():\n N, M = inputlist()\n print(kumiawase(N) + kumiawase(M))\n\nif __name__ == '__main__':\n main()", "import math\n\ndef inputlist(): return [int(i) for i in input().split()]\n\ndef kumiawase(num):\n r = 2\n return math.factorial(num) // (math.factorial(num - r) * math.factorial(r))\n\ndef main():\n N, M = inputlist()\n print(kumiawase(N) + kumiawase(M))\n\nif __name__ == '__main__':\n main()", "import math\n\ndef inputlist(): return [int(i) for i in input().split()]\n\ndef kumiawase(num):\n r = 2\n if num != 1 and num != 0:\n return math.factorial(num) // (math.factorial(num - r) * math.factorial(r))\n else:\n return 0\n\ndef main():\n N, M = inputlist()\n print(kumiawase(N) + kumiawase(M))\n\nif __name__ == '__main__':\n main()"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s936381064', 's944162396', 's195905127'] | [3060.0, 3060.0, 3060.0] | [18.0, 17.0, 17.0] | [355, 295, 356] |
p02729 | u102242691 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['\nn = int(input())\na = list(map(int,input().split()))\nb = a.copy()\nb = set(b)\nb = list(b)\nc = []\nans = []\n\nfor i in range(len(b)):\n c.append(a.count(b[i]))\nprint(b)\nprint(c)\nd = []\nfor i in range(len(b)):\n num = 0\n for j in range(len(b)):\n if i == j:\n num += int(((c[j]-1)*(c[j]-2))/2)\n else:\n num += int(((c[j])*(c[j]-1))/2)\n d.append(num)\nprint(d)\n\nfor i in range(n):\n for j in range(len(b)):\n if a[i] == b[j]:\n print(d[j])\n', '\nn,m = map(int,input().split())\n\na = int(n*(n-1)/2)\nb = int(m*(m-1)/2)\n\nprint(a+b)\n'] | ['Runtime Error', 'Accepted'] | ['s594597555', 's163601029'] | [3064.0, 2940.0] | [17.0, 18.0] | [494, 83] |
p02729 | u103520789 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['guu, ki = map(int, input().split())\n\nprint(guu*(guu-1)/2 + ki*(ki-1)/2)', 'guu, ki = map(int, input().split())\n\nprint(int(guu*(guu-1)/2 + ki*(ki-1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s349854956', 's260167983'] | [2940.0, 2940.0] | [17.0, 17.0] | [71, 76] |
p02729 | u103724957 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["val = input().split(' ')\nn = int(val[0])\nm = int(val[1])\n\nresult = n * (n-1) / 2 + m * (m-1) / 2\n\nprint(result)\n", "val = input().split(' ')\nn = int(val[0])\nm = int(val[1])\n\nresult = n * (n-1) / 2 + m * (m-1) / 2\n\nprint(int(result))\n"] | ['Wrong Answer', 'Accepted'] | ['s306370613', 's583363475'] | [2940.0, 2940.0] | [18.0, 17.0] | [112, 117] |
p02729 | u104005543 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["s1 = str(input())\ns2 = ''\nfor i in range(len(s1)):\n s2 += s1[- i - 1]\nif s1 != s2:\n print('No')\n exit()\n\nt1 = s1[0 : ((len(s1)) - 1) // 2]\nt2 = ''\nfor i in range(len(t1)):\n t2 += t1[- i - 1]\nif t1 != t2:\n print('No')\n exit() \n\nu1 = s1[(len(s1) + 3) // 2 - 1:]\nu2 = ''\nfor i in range(len(u1)):\n u2 += u1[- i - 1]\nif u1 != u2:\n print('No')\n exit() \nprint('Yes')", 'n, m = map(int, input().split())\nans = n * (n - 1) // 2 + m * (m - 1) //2\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s484173465', 's084440807'] | [3064.0, 2940.0] | [17.0, 18.0] | [386, 84] |
p02729 | u105659451 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M=map(int, input().split()) \nif M == 1:\n answer = N * N-1\nelif N == 1:\n answer = M * M-1\nelse:\n answer = (N * (N-1))//2 + (M * (M-1))//2\nprint(answer)', 'N,M=map(int, input().split()) \nif M == 1 or M==0:\n answer = N * (N-1)\nelif N == 1 or N==0:\n answer = M * (M-1) \nelse:\n answer = (N * (N-1))//2 + (M * (M-1))//2\nprint(answer)\n ', 'N,M=map(int, input().split()) \nif M == 1 or M==0:\n answer = N * (N-1)//2\nelif N == 1 or N==0:\n answer = M * (M-1)//2 \nelse:\n answer = (N * (N-1))//2 + (M * (M-1))//2\nprint(answer)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s800952899', 's971918565', 's378256465'] | [3060.0, 2940.0, 3060.0] | [18.0, 17.0, 17.0] | [161, 190, 191] |
p02729 | u106489129 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\ntotal=0\nif N>=2\n\ttotal+=N*(N-1)/2\nif M>=2\n total+=M*(M-1)/2\nprint(total)', 'N,M=map(int,input().split())\nt =0\nif N>=2:\n\tt+=N*(N-1)//2\nif M>=2:\n t+=M*(M-1)//2\nprint(t)'] | ['Runtime Error', 'Accepted'] | ['s554595710', 's030129009'] | [2940.0, 2940.0] | [17.0, 19.0] | [104, 93] |
p02729 | u109133010 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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(input().split())\nif n<=1:\n n=0\nif m<=1:\n m=0\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', 'Accepted'] | ['s059273277', 's167665032'] | [2940.0, 2940.0] | [17.0, 17.0] | [91, 62] |
p02729 | u111652094 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M=map(int,input().split())\n\nN1=(N*(N-1))/2\nM1=(M*(M-1))/2\n\nif N==0:\n print(M1)\nelif M==0:\n print(N1)\nelse:\n print(M1+N1)', 'N,M=map(int,input().split())\n\nN1=(N*(N-1))/2\nM1=(M*(M-1))/2\n\nif N==0:\n print(int(M1))\nelif M==0:\n print(int(N1))\nelse:\n print(int(M1+N1))'] | ['Wrong Answer', 'Accepted'] | ['s391761318', 's451410525'] | [3060.0, 3060.0] | [17.0, 18.0] | [131, 146] |
p02729 | u112247039 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['print((int(input()))**3/27)', 'n, m = list(map(int,input().strip().split()))\nprint(((n- 1)*(n))//2 + ((m-1)*(m))//2)'] | ['Runtime Error', 'Accepted'] | ['s199018769', 's706736202'] | [9092.0, 2940.0] | [23.0, 17.0] | [27, 85] |
p02729 | u113991073 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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=0\nb=0\ndef ball(x,y):\n a=x*(x-1)//2\n b=y*(y-1)//2\n if a!=0 and b!=0:\n print(a+b)\n elif a=0:\n print(b)\n else:\n print(a)\n\n\nn,m=list(map(int,input().split()))\nball(n,m)', 'n=int(input())\na=(input().split())\nfor i in range(n):\n x=0\n for j in range(n):\n for k in range(n):\n if j>k:\n if a[j]==a[k] and j!=i and k!=i:\n x=x+1\n print(x)\n', 'n,m=list(map(int,input().split()))\nx=0\n\nx==m*(m-1)/2+n*(n-1)/2\nprint(x)', 'n,m=list(map(int,input().split()))\nx=0\nif n<2 and m<2:\n x=0\nelif n<2 :\n x=m*(m-1)/2\nelif m<2:\n x=n*(n-1)/2\nelse:\n x=m*(m-1)/2+n*(n-1)/2\nprint(x)', 'def ball(x,y):\n if x>1 and y>1:\n print((x*(x-1)+y*(y-1))//2)\n elif x<=1 and y>1:\n print((y*(y-1))//2)\n elif x>1 and y<=1:\n print((x*(x-1))//2)\n else:\n print(0)\n\n\nn,m=list(map(int,input().split()))\nball(n,m)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s175399614', 's198383255', 's460185522', 's893596234', 's060741298'] | [2940.0, 2940.0, 3060.0, 2940.0, 3060.0] | [17.0, 17.0, 19.0, 17.0, 18.0] | [202, 220, 71, 156, 246] |
p02729 | u115877451 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['a,b=map(int,input().split())\nn=(a*(a-1))//2\nm=(b*(b-1))//2\nif b<2 and b<2:\n print(0)\nelif b<2:\n print(n)\nelse:\n print(n+m)\n\n ', 'def uhe(x):\n return x%2\n\na,b=map(int,input().split())\nc=list(range(2,a*2+1,2))\nd=list(range(1,b*2+1,2))\n\ne=[(x+y) for x in c for y in d]\nf=list(map(uhe,e))\n\nwhile a!=1:\n g=(a-1)*a\n a=a-1\nwhile b!=1:\n h=(b-1)*b\n b=a-1\nprint(g,h)\nprint(f.count(0)+g//a+h//b)', 'def uhe(x):\n return x%2\n\na,b=map(int,input().split())\nc=list(range(2,a*2+1,2))\nd=list(range(1,b*2+1,2))\n\ne=[(x+y) for x in c for y in d]\nf=list(map(uhe,e))\nprint(f.count(0))', 'a,b=map(int,input().split())\nn=(a*(a-1))//2\nm=(b*(b-1))//2\nif b<2 and a<2:\n print(0)\nelif b<2:\n print(n)\nelse:\n print(n+m)\n\n '] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s227137394', 's274632936', 's572496644', 's698083332'] | [2940.0, 3188.0, 3316.0, 2940.0] | [18.0, 2104.0, 19.0, 17.0] | [129, 270, 176, 129] |
p02729 | u122428774 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = (int(x) for x in input().split())\nprint(N*(N-1)/2+M*(M-1)/2)', 'N, M = (int(x) for x in input().split())\nprint(N*(N-1)//2+M*(M-1)//2)'] | ['Wrong Answer', 'Accepted'] | ['s161463563', 's868816356'] | [2940.0, 2940.0] | [17.0, 17.0] | [67, 69] |
p02729 | u123745130 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nx,y=map(int,input().split())\n\na = factorial(x) / factorial(2) / factorial(x - 2)\nb = factorial(y) / factorial(2) / factorial(y - 2)\nprint(int(a+b))', 'from math import factorial\n\nx,y=map(int,input().split())\nif x>1:\n a = factorial(x) / factorial(2) / factorial(x - 2)\nelse: a=0\nif y>1:\n b = factorial(y) / factorial(2) / factorial(y - 2)\nelse: b=0\nprint(int(a+b))'] | ['Runtime Error', 'Accepted'] | ['s676308962', 's629399859'] | [3060.0, 3060.0] | [17.0, 17.0] | [175, 218] |
p02729 | u123849536 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 collections\n\nn = int(input())\nballs = list(map(int, input().split(' ')))\n\nfor k in range(n):\n # print(balls[ : k])\n \n arr = balls[ : k] + balls[ k + 1 : ]\n\n dic = collections.Counter(arr)\n total = 0\n for v in dic.values():\n total += int(v * (v - 1) / 2)\n print(total)\n\n", '# -*- coding: utf-8 -*-\nn, m = map(int, input().split())\n\nprint(n * (n -1) // 2 + m * (m - 1) // 2)'] | ['Runtime Error', 'Accepted'] | ['s885637540', 's789525299'] | [3316.0, 2940.0] | [21.0, 17.0] | [353, 99] |
p02729 | u125269142 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\n\nif n >= 2:\n even = n * (n-1) /2\nelse:\n even = 0\n\nif m >= 2: \n odd = m * (m-1) /2\nelse:\n odd = 0\nprint(even + odd)', 'n, m = map(int, input().split())\n\nif n >= 2:\n even = n * (n - 1) / 2\nelse:\n even = 0\n\nif m >= 2:\n odd = m * (m - 1) / 2\nelse:\n odd = 0\nprint(int(even + odd))'] | ['Wrong Answer', 'Accepted'] | ['s836633992', 's637243852'] | [9100.0, 9164.0] | [28.0, 30.0] | [152, 169] |
p02729 | u125389321 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = list(map(int,input().split()))\n\ndef combination(n,r):\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n\nans = combination(N,2) + combination(M,2)\n\nprint(ans)', 'import math\nN,M = list(map(int,input().split()))\n\ndef combination(n,r):\n return math.factorial(n)/(math.factorial(n-r)*math.factorial(r))\n\nans = combination(N,2) + combination(M,2)\n\nprint(ans)', 'N,M = list(map(int,input().split()))\nans = (N*(N-1)/2) + (M*(M-1)/2)\nprint(ans)', 'N,M = list(map(int,input().split()))\nans = N*(N-1)/2 + M*(M-1)/2\nprint(ans)', 'N,M = list(map(int,input().split()))\nans = (N*(N-1)//2) + (M*(M-1)//2)\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s018810168', 's534613705', 's786492252', 's988933389', 's964883973'] | [3056.0, 2940.0, 2940.0, 2940.0, 2940.0] | [18.0, 18.0, 17.0, 17.0, 17.0] | [196, 195, 79, 75, 81] |
p02729 | u129019798 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 cmb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\ndef main():\n import sys\n N,M=list(map(int,sys.stdin.readline().split()))\n print(cmb(M,2)+cmb(N,2))\n\n\nmain()\n', 'import math\ndef cmb(n, r):\n if n<2:\n return 0\n\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\ndef main():\n import sys\n N,M=list(map(int,sys.stdin.readline().split()))\n print(cmb(M,2)+cmb(N,2))\n\n\nmain()\n'] | ['Runtime Error', 'Accepted'] | ['s939505853', 's136383768'] | [3064.0, 2940.0] | [18.0, 17.0] | [221, 251] |
p02729 | u131464432 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nans = int()\nprint(ans)', 'N,M = map(int,input().split())\nans = N*(N-1)//2 + M*(M-1)//2\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s526416391', 's706888565', 's796984887'] | [8900.0, 8900.0, 9044.0] | [21.0, 23.0, 27.0] | [68, 80, 71] |
p02729 | u132895075 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nN=len(S)\nif S[1:int(N-1)//2] == S[int(N+3)//2:N]:\n print('Yes')\nelse:\n print('No')\n", "S=str(input())\nN=len(S)\nif S[1:int(N-1)//2]== S[int(N+3)//2:N]:\n print('Yes')\nelse:\n print('No')", 'N,M=map(int,input().split())\na=N*N/4+M*M/4\nb=N+M\nif int(b)>2:\n print(a)\nelse:\n print(0)', 'N,M=map(int,input().split())\na=N*(N-1)/2+M*(M-1)/2\nprint(int(a))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s193390527', 's351703444', 's655340456', 's318985792'] | [2940.0, 2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0, 17.0] | [100, 98, 89, 64] |
p02729 | u135389999 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nans = (math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))) + (math.factorial(m) // ((math.factorial(m - 2) * math.factorial(2))))\nprint(ans)', 'import math\n\nn,m = map(int,input().split())\n\ndef ans(a):\n if a<2:\n return 0\n else:\n return math.factorial(a) // (math.factorial(a - 2) * math.factorial(2))\n\nprint(int(ans(n) + ans(m)))'] | ['Runtime Error', 'Accepted'] | ['s336487276', 's144665422'] | [3060.0, 3060.0] | [17.0, 24.0] | [201, 205] |
p02729 | u135847648 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\na = l/3\nprint(round(a**3,13))', 'n,m = map(int,input().split())\nans = n*(n-1)//2 + m*(m-1)//2\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s419843581', 's962751037'] | [2940.0, 2940.0] | [17.0, 17.0] | [46, 72] |
p02729 | u136071569 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['def factorial(n):\n if n == 0 or n == 1 or n < 0:\n return 1\n return n * factorial(n-1)\n\nN,M = map(int,input().split())\n\ncombination = int(factorial(N) / (2 * (factorial(N-2)))) + M\nprint(combination)\n', 'def factorial(n):\n if n == 0 or n == 1 or n < 0:\n return 1\n return n * factorial(n-1)\n\nN,M = map(int,input().split())\n\neven = int(factorial(N) / (2 * (factorial(N-2))))\nodd = int(factorial(M) / (2 * (factorial(M-2))))\nprint(even+odd)'] | ['Wrong Answer', 'Accepted'] | ['s753047752', 's514549391'] | [3060.0, 3060.0] | [17.0, 17.0] | [212, 246] |
p02729 | u136279532 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['input_line = input().split()\nN = int(input_line[0])\nM = int(input_line[1])\n\nimport math\n\nprint("N="+str(N)+" M="+str(M))\n\ndef combination(n, r):\n if(n == 1 or n == 0):\n return 0\n else:\n return math.factorial(n) // math.factorial(n-r) // math.factorial(r)\n\nprint(combination(N,2) + combination(M,2))\n', 'input_line = input().split()\nN = int(input_line[0])\nM = int(input_line[1])\n\nimport math\n\ndef combination(n, r):\n if(n == 1 or n == 0):\n return 0\n else:\n return math.factorial(n) // math.factorial(n-r) // math.factorial(r)\n\nprint(combination(N,2) + combination(M,2))\n'] | ['Wrong Answer', 'Accepted'] | ['s572491248', 's150426325'] | [3060.0, 2940.0] | [17.0, 18.0] | [319, 286] |
p02729 | u144310740 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\ny = (m*(m-1)) / 2\nprint(x+y)\n\n', 'n, m = map(int, input().split())\nx = (n*(n-1)) // 2\ny = (m*(m-1)) // 2\nprint(x+y)'] | ['Wrong Answer', 'Accepted'] | ['s815405898', 's069880786'] | [2940.0, 2940.0] | [20.0, 17.0] | [80, 81] |
p02729 | u145145077 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\n\nimport numpy as np\nresult = 0\nfor x in np.arange(l/3-0.1, l/3+0.1, 0.1):\n for y in np.arange(x, l/3+0.1, 0.1):\n z = l - (x+y)\n if z <= 0:\n break\n v = x*y*z\n result = max(v, result)\nprint(result)', 'n,m=map(int,input().split())\nprint( int((n+m)*(n+m-1)/2 - n*m) )'] | ['Runtime Error', 'Accepted'] | ['s142589650', 's182618090'] | [9120.0, 9164.0] | [25.0, 31.0] | [228, 64] |
p02729 | u148753842 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n = int(input())\na = list(map(int, input().split()))\nimport math\nimport collections\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\ndef get_result(key, c):\n ans = 0\n for d in c.items():\n if d[0] == key:\n value = d[1]-1\n else:\n value = d[1]\n if value > 1:\n ans += combinations_count(value, 2)\n return int(ans)\nans = {}\ntmp = a.copy()\ntmp.sort()\nc = collections.Counter(tmp)\nfor k in range(n):\n key = a[k]\n if key in ans:\n print(ans[key])\n else:\n ans[key] = get_result(key, c)\n print(ans[key])', 'n, m = map(int, input().split())\nn_l = [i for i in range(0,n*2,2)]\nm_l = [i for i in range(1,m*2,2)]\nhoge = n_l + m_l\ncount = 0\nfor i in hoge:\n for j in hoge:\n if (i!=j)&((i+j)%2==0):\n count+=1\nprint(int(count/2))'] | ['Runtime Error', 'Accepted'] | ['s052104981', 's127790217'] | [3064.0, 3064.0] | [17.0, 26.0] | [642, 234] |
p02729 | u153259685 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nx=n*(n-1)/2+m*(m-1)/2\nprint(x)', 'n,m=map(int,input().split())\nprint(int(n*(n-1)/2+m*(m-1)/2))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s596995230', 's944723636', 's134127725'] | [2940.0, 2940.0, 3064.0] | [17.0, 17.0, 17.0] | [55, 59, 60] |
p02729 | u155946404 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nn_dot = n*(n-1)/2\nm_dot = m*(m-1)/2\n\nanswer = int(n_dot+ m_dot)\nprint(answer)', 'n = int(input())\nm = int(input())\n\nn_dot = n*(n-1)/2\nm_dot = m*(m-1)/2\n\nanswer = n_dot+ m_dot\nprint(answer)', 'n,m=(int(x) for x in input().split())\n\nn_dot = n*(n-1)/2\nm_dot = m*(m-1)/2\n\nanswer = int(n_dot+ m_dot)\nprint(answer)\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s154510027', 's351433220', 's360585202'] | [2940.0, 2940.0, 2940.0] | [20.0, 19.0, 17.0] | [112, 107, 117] |
p02729 | u163907160 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\nm,n=map(int,input().split())\ndm,dn=0,0\nif m>2:\n dm = math.factorial(m)//math.factorial(m-2)\nif n>2:\n dn = math.factorial(n)//math.factorial(n-2)\nprint((dm+dn)//2)\n', 'import math\nm,n=map(int,input().split())\ndm,dn=0,0\nif m>=2:\n dm = math.factorial(m)//math.factorial(m-2)\nif n>=2:\n dn = math.factorial(n)//math.factorial(n-2)\nprint((dm+dn)//2)\n'] | ['Wrong Answer', 'Accepted'] | ['s988931150', 's977654359'] | [2940.0, 3060.0] | [18.0, 18.0] | [181, 183] |
p02729 | u165114979 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = input().split()\nn = int(n)\nm = int(m)\n\nprint(int(math.factorial(n)/(2 * math.factorial(n-2)) + math.factorial(m)/(2 * math.factorial(m-2))))\n\n', 'n, m = input().split()\nn = int(n)\nm = int(m)\n\nprint(n!/(2 * (n-2)!) + m!/(2 * (n-2)!))', 'import math\nn, m = input().split()\nn = int(n)\nm = int(m)\n\nprint(int(math.factorial(n)/(2 * math.factorial(n-2)) + math.factorial(m)/(2 * math.factorial(m-2))))\n\n', 'import math\nn, m = input().split()\nn = int(n)\nm = int(m)\nx = 0\ny = 0\nif n > 1:\n x = int(math.factorial(n)/(2 * math.factorial(n-2)))\nif m > 1:\n y = int(math.factorial(m)/(2 * math.factorial(m-2)))\n\nprint(x+y)\n\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s316046405', 's364162629', 's812978881', 's519090219'] | [9028.0, 8960.0, 9152.0, 9076.0] | [27.0, 26.0, 31.0, 28.0] | [161, 86, 161, 212] |
p02729 | u165268875 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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', '\nN, M = map(int, input().split())\nprint((N*(N-1)+M*(M-1))//2)\n'] | ['Wrong Answer', 'Accepted'] | ['s598936338', 's127843534'] | [2940.0, 2940.0] | [18.0, 17.0] | [61, 62] |
p02729 | u165394332 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['from math import factorial\n\nN, M = map(int, input().split())\n\ndef comb(n, k):\n return int(factorial(n) / factorial(k) / factorial(n-k))\n\nres = comb(M, 2) + comb(N, 2)\n\nprint(res)', 'N, M = map(int, input().split())\n\ndef factorial(n):\n p = 1\n for i in range(n, 0, -1):\n p *= i\n return p\n\n\ndef comb(n, k):\n return factorial(n) // (factorial(k) * factorial(n-k))\n\n\nres = comb(M, 2) + comb(N, 2)\n\nprint(res)'] | ['Runtime Error', 'Accepted'] | ['s914144230', 's316133076'] | [8932.0, 9012.0] | [27.0, 25.0] | [181, 240] |
p02729 | u166621202 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\ncnt = 0\ncnt += ((N * N-1) / 2)\ncnt += ((M * M-1) / 2)\nprint(cnt)\n', 'N,M = map(int,input().split())\ncnt = 0\nif N >= 2:\n cnt += ((N * (N-1)) / 2)\nif M >= 2:\n cnt += ((M * (M-1)) / 2)\nprint(int(cnt))\n\n'] | ['Wrong Answer', 'Accepted'] | ['s193161118', 's502486511'] | [2940.0, 2940.0] | [17.0, 17.0] | [96, 136] |
p02729 | u170158642 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 fact(n):\n for i in range(1,n+1): \n fact = fact * i \n return fact\n\n\nx,y = input().split()\nreturn ((fact(x)/(2*fact(x-2)) + (fact(y)/(2*fact(y-2)))', '\nusing namespace std;\nint fact(int n)\n{\n int facto=1;\n for (int i = 1; i < n+1;i++)\n {\n facto = facto * i;\n }\n return facto;\n}\n\n\nint main()\n{\n\tint x,y, result;\n\tcin >> x >> y;\n\tresult = (fact(x)/(2*fact(x-2))) + (fact(y)/(2*fact(y-2)));\n\tcout << result << endl;\n\treturn 0;\n}', 'def fact(n):\n fact=1\n for i in range(1,n+1): \n fact = fact * i \n return fact\n\n\nx,y = input().split()\nreturn ((fact(x)/(2*fact(x-2)) + (fact(y)/(2*fact(y-2)))', 'def fact(n):\n fact=1\n for i in range(1,n+1): \n fact = fact * i \n return fact\n\n\nx,y = input().split()\nx = int(x)\ny = int(y)\nprint((fact(x)//(2*fact(x-2))) + (fact(y)//(2*fact(y-2))))\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s041460549', 's358386394', 's438917371', 's940691485'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0, 17.0] | [154, 301, 163, 188] |
p02729 | u172780602 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m=map(int,input.split())\n\nans=n*(n-1)/2\nans+=m*(m-1)/2\n\nprint(int(ans))', 'n,m=map(int,input().split())\n\nans=n*(n-1)/2\nans+=m*(m-1)/2\n\nprint(int(ans))'] | ['Runtime Error', 'Accepted'] | ['s430910010', 's658570699'] | [2940.0, 2940.0] | [17.0, 17.0] | [136, 75] |
p02729 | u172966990 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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()\nfrom math import factorial \nif int(N)>=2 and int(M)>=2:\n print(factorial(int(N))/2/factorial(int(N)-2)+factorial(int(M))/2/factorial(int(M)-2))\nelif int(N)<2 and int(M)>=2:\n print(factorial(int(M))/2/factorial(int(M)-2))\nelif int(M)<2 and int(N)>=2:\n print(factorial(int(N))/2/factorial(int(N)-2))\nelse:\n print("0")', 'S=input()\nN=len(S)\n\na=False\n\nfor i in range(N):\n if S[i]!=S[N-1-i]:\n print("No")\n break\n else:\n a=True\n\nif a==True:\n for j in range(int((N-3)/2)):\n if S[j]!=S[int((N-3)/2)-j]:\n a=False\n print("No")\n break\nif a==True:\n for k in range(int((N-3)/2)):\n if S[int((N+1)/2)+k]!=S[N-1-k]:\n a=False\n print("No")\n break\nif a==True:\n print("Yes")\n ', 'N,M=input().split()\nfrom math import factorial \nif int(N)>=2 and int(M)>=2:\n print(\'{:.0f}\'.format(factorial(int(N))/2/factorial(int(N)-2)+factorial(int(M))/2/factorial(int(M)-2)))\nelif int(N)<2 and int(M)>=2:\n print(\'{:.0f}\'.format(factorial(int(M))/2/factorial(int(M)-2)))\nelif int(M)<2 and int(N)>=2:\n print(\'{:.0f}\'.format(factorial(int(N))/2/factorial(int(N)-2)))\nelse:\n print("0")'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s024692582', 's555527401', 's251901032'] | [3064.0, 3064.0, 3064.0] | [18.0, 17.0, 17.0] | [349, 456, 400] |
p02729 | u173550659 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\n\nif n <= 2:\n n_even = 0\nelse:\n n_even = n * (n-1) / 2\nif m <= 2:\n m_even = 0\nelse:\n m_even = m * (m-1) / 2\n\neven = n_even + m_even\nprint(int(even))', 'n, m = map(int, input().split())\n\nif n <= 1:\n n_even = 0\nelse:\n n_even = n * (n-1) / 2\nif m <= 1:\n m_even = 0\nelse:\n m_even = m * (m-1) / 2\n\neven = n_even + m_even\nprint(int(even))\n'] | ['Wrong Answer', 'Accepted'] | ['s438103669', 's171688362'] | [2940.0, 2940.0] | [17.0, 18.0] | [184, 185] |
p02729 | u174181999 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nif N == 0:\n ans = combinations_count(M, 2)\nelif M == 0:\n ans = combinations_count(N, 2)\nelif N == 1 and M == 1:\n ans = 0\nelse:\n ans = combinations_count(N, 2) + combinations_count(M, 2)\nprint(ans)', 'import math\n\nN, M = map(int, input().split())\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nif N == 0:\n ans = combinations_count(M, 2)\nelif M == 0:\n ans = combinations_count(N, 2)\nelif N == 1 and M == 1:\n ans = 0\nelif N == 1:\n ans = combinations_count(M, 2)\nelif M == 1:\n ans = combinations_count(N, 2)\nelse:\n ans = combinations_count(N, 2) + combinations_count(M, 2)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s548908649', 's855182949'] | [3060.0, 3188.0] | [18.0, 20.0] | [351, 443] |
p02729 | u175217658 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nans1 = 0\nans2 = 0\n\nif(N >= 2): \n ans1 = (N*(N-1))/2\nif(M >= 2):\n ans2 = (M*(M-1))/2\n\nprint(ans1+ans2)', 'N,M = map(int, input().split())\nans1 = 0\nans2 = 0\n\nif(N >= 2): \n ans1 = (N*(N-1))//2\nif(M >= 2):\n ans2 = (M*(M-1))//2\n\nprint(ans1+ans2)'] | ['Wrong Answer', 'Accepted'] | ['s537555749', 's720389670'] | [2940.0, 2940.0] | [17.0, 17.0] | [142, 144] |
p02729 | u175590965 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m = map(int,input().split())\nprint((n*(n-1)//2))+(m*(m-1)//2))', 'n,m = map(int,input().split())\nprint((n*(n-1//2))+(m*(m-1)//2))', 'n,m = map(int,input().split())\nprint((n*(n-1)//2)+(m*(m-1)//2))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s367185007', 's427551576', 's134445899'] | [2940.0, 2940.0, 9104.0] | [17.0, 17.0, 26.0] | [64, 63, 63] |
p02729 | u177411511 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect\nfrom operator import itemgetter\n#from heapq import heappush, heappop\n#import numpy as np\n#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson\n#from scipy.sparse import csr_matrix\n#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\n\nstdin = sys.stdin\n\nni = lambda: int(ns())\nnf = lambda: float(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nnb = lambda: list(map(float, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nN, M = na()\nprint(N * (N - 1) // 2 + M)\n\n\n', 'import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect\nfrom operator import itemgetter\n#from heapq import heappush, heappop\n#import numpy as np\n#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson\n#from scipy.sparse import csr_matrix\n#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN\nsys.setrecursionlimit(10**7)\ninf = 10**20\nmod = 10**9 + 7\n\nstdin = sys.stdin\n\nni = lambda: int(ns())\nnf = lambda: float(ns())\nna = lambda: list(map(int, stdin.readline().split()))\nnb = lambda: list(map(float, stdin.readline().split()))\nns = lambda: stdin.readline().rstrip() # ignore trailing spaces\n\nN, M = na()\nprint(N * (N - 1) // 2 + M * (M - 1) // 2)\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s177445781', 's430308166'] | [10820.0, 10936.0] | [42.0, 43.0] | [730, 745] |
p02729 | u180824420 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nprint(int(math.factorial(N)/math.factorial(N-2)/math.factorial(2)+math.factorial(M)/math.factorial(M-2)/math.factorial(2)))\n', 'import math\n\nN,M=map(int,input().split())\n\nif (N==0 or N==1) and (M==0 or M==1):\n print(0)\nelif (N==0 or N==1) and (M!=0 and M!=1):\n print(int(math.factorial(M)/math.factorial(M-2)/math.factorial(2)))\nelif (M==0 or M==1) and (N!=0 and N!=1):\n print(int(math.factorial(N)/math.factorial(N-2)/math.factorial(2)))\nelse:\n print(int(math.factorial(N)/math.factorial(N-2)/math.factorial(2)+math.factorial(M)/math.factorial(M-2)/math.factorial(2)))\n'] | ['Runtime Error', 'Accepted'] | ['s401560622', 's130084967'] | [2940.0, 3064.0] | [17.0, 17.0] | [167, 446] |
p02729 | u182594853 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nex1 = n*(n-1)/2\nex2 = m*(m-1)/2\nans = ex1 + ex2\nprint(ans)', 'n, m = map (int, input().split())\nex1 = n*(n-1)//2\nex2 = m*(m-1)//2\nans = ex1 + ex2\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s087086521', 's088638802'] | [9152.0, 9116.0] | [30.0, 27.0] | [92, 94] |
p02729 | u184238067 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M = input().split()\n\nN = int(N)\nM = int(M)\n\neven = int\nodd = int\nfinal = int\n\neven = (N*(N-1))/2\nodd = (M*(M-1))/2\nfinal = even + odd\nprint(final)', 'N,M = input().split()\n\nN = int(N)\nM = int(M)\n\neven = 0\nodd = 0\nfinal = 0\n\neven = (N*(N-1))/2\nodd = (M*(M-1))/2\nfinal = even + odd\nprint(final)', 'N,M = input().split()\n\nN = int(N)\nM = int(M)\n\neven = 0\nodd = 0\nfinal = int\n\neven = (N*(N-1))/2\nodd = (M*(M-1))/2\nfinal = even + odd\nprint(int(final))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s473731370', 's779698594', 's538979789'] | [3060.0, 3060.0, 3060.0] | [18.0, 17.0, 17.0] | [148, 142, 149] |
p02729 | u184793010 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\n\nprint(M*(M-1)/2+N*(N-1)/2)', 'M, N = map(int, input().split())\n\nprint(int(M*(M-1)/2+N*(N-1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s796748845', 's371002927'] | [9136.0, 9040.0] | [26.0, 26.0] | [60, 65] |
p02729 | u186121428 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nans = math.factorial(n - 1) + math.factorial(m)\nprint(ans)', 'from math import factorial\nn, m = map(int, input().split())\nc_n = factorial(n) / (factorial(2) * factorial(n - 2)) if n > 1 else 0\nc_m = factorial(m) / (factorial(2) * factorial(m - 2)) if m > 1 else 0\nans = int(c_n) + int(c_m)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s366639594', 's394117263'] | [2940.0, 3060.0] | [17.0, 17.0] | [103, 238] |
p02729 | u186530241 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['while True:\n m, n = list(map(int, input().split()))\n print(m * (m - 1) / 2 + n * (n - 1) / 2)\n', 'm, n = list(map(int, input().split()))\nprint(m * (m - 1) / 2 + n * (n - 1) / 2)', 'm, n = list(map(int, input().split()))\nprint(int(m * (m - 1) / 2 + n * (n - 1) / 2))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s164214433', 's412975319', 's639243566'] | [2940.0, 2940.0, 2940.0] | [18.0, 18.0, 17.0] | [100, 79, 84] |
p02729 | u186729829 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['from math import factorial\n\nn, m = map(int, input().split())\n\n\ndef combinations_count(n, r):\n \n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\nn_cmb = combinations_count(n, 2)\nm_cmb = combinations_count(m, 2)\n\nprint(n_cmb + m_cmb)', 'from operator import mul\nfrom functools import reduce\n\nn, m = map(int, input().split())\n\n\ndef cmb(n, r):\n r = min(n-r, r)\n if r == 0:\n return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1, r + 1))\n return over // under\n\n\na = cmb(n, 2)\nb = cmb(m, 2)\n\nprint(a + b)', 'n, m = map(int, input().split())\n\nn_cmb = n * (n - 1) / 2\nm_cmb = m * (m - 1) / 2\nprint(int(n_cmb + m_cmb))\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s751372208', 's816551744', 's025936578'] | [3060.0, 3572.0, 2940.0] | [17.0, 23.0, 17.0] | [271, 310, 108] |
p02729 | u187169337 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 compute_fact(n):\n global f\n f = [0 for i in range(n+1)]\n f[0] = 1\n f[1] = 1\n for i in range(2,n+1):\n f[i] = f[i-1]*i\n\ndef compute_c(n,r):\n compute_fact(n)\n ans = f[n]/(f[r] * f[n-r])\n return ans\n\nn,m = [int(s) for s in input().split()]\nprint(int(compute_c(n,2) + compute_c(m,2)))\n\n', 'def compute_fact(n):\n global f\n if(n < 2):\n f = [1,1]\n else:\n f = [0 for i in range(n+1)]\n f[0] = 1\n f[1] = 1\n for i in range(2,n+1):\n f[i] = f[i-1]*i\n\ndef compute_c(n,r):\n compute_fact(n)\n ans = f[n]/(f[r] * f[n-r])\n return ans\n\nn,m = [int(s) for s in input().split()]\nif n >= 2 and m >= 2:\n print(int(compute_c(n,2) + compute_c(m,2)))\nelif n >= 2:\n print(int(compute_c(n,2)))\nelif m >= 2:\n print(int(compute_c(m,2)))\nelse:\n print(0)\n '] | ['Runtime Error', 'Accepted'] | ['s515744632', 's267189602'] | [3060.0, 3064.0] | [17.0, 17.0] | [316, 515] |
p02729 | u193927973 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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()))\nif a[0]<=1:\n n=0\nelse:\n n=a[0]*(a[0]-1)/2\n\nif a[1]<=1:\n m=0\nelse:\n m=a[1]*(a[1]-1)/2\n \nprint(n+m)', 'a = list(map(int, input().split()))\nif a[0]==1:\n n=0\nelse:\n n=a[0]*(a[0]-1)/2\n\nif a[1]==1:\n m=0\nelse:\n m=a[1]*(a[1]-1)/2\n \nprint(n+m)', 'a = list(map(int, input().split()))\nif a[0]==1:\n n=0\nelse:\n n=a[0]*(a[0]-1)/2\n\nif a[1]==1:\n m=0\nelse:\n m=a[1]*(a[1]-1)/2\n \nprint(int(n+m))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s590085233', 's626760749', 's859381555'] | [3060.0, 3060.0, 3060.0] | [17.0, 17.0, 17.0] | [137, 137, 142] |
p02729 | u194472175 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nmethod1 = N*(N-1)/2\nmethod2 = M*(M-1)/2\nmethod=method1+method2\nprint(str(method))\n', 'N, M = map(int, input().split())\nmethod1 = N*(N-1)/2\nmethod2 = M*(M-1)/2\nmethod=method1+method2\nprint(str(round(method)))\n'] | ['Wrong Answer', 'Accepted'] | ['s988325623', 's497194449'] | [2940.0, 2940.0] | [19.0, 17.0] | [115, 122] |
p02729 | u194585018 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['even, odd = map(int, input().split())\ns = even * (even -1) / 2\ns += odd * (odd - 1) / 2\nprint(s)\n', 'even, odd = map(int, input().split())\ns = even * (even -1) // 2\ns += odd * (odd - 1) // 2\nprint(s)\n'] | ['Wrong Answer', 'Accepted'] | ['s494523981', 's401479446'] | [2940.0, 3060.0] | [17.0, 19.0] | [97, 99] |
p02729 | u195272001 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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(i) for i in input().split()]\nx = 0\nx = a*(a-1)/2+b*(b-1)/2\nprint(x)\n\n', 'a, b = [int(i) for i in input().split()]\nx = 0\nx = a*(a-1)//2+b*(b-1)//2\nprint(x)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s696979154', 's482879686'] | [2940.0, 2940.0] | [18.0, 17.0] | [82, 84] |
p02729 | u197922478 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["\ndef main():\n from itertools import product\n\n H,W,K = map(int, input().split())\n S = [list(input()) for _ in range(H)]\n \n i = 0\n while i < len(S):\n if '1' in S[i]:\n i += 1\n else:\n del S[i]\n H = len(S)\n \n S = [[int(s[i]) for s in S] for i in range(W)]\n\n if sum(sum(s) for s in S)<=K:\n print(0)\n else:\n answer = (H-1) * (W-1)\n for X in product([False,True], repeat=H-1):\n ans = np.sum(X)\n if ans >= answer:\n continue\n M = [[0]]\n for i, x in enumerate(X):\n if x:\n M.append([])\n M[-1].append(i+1)\n D = [0]*len(M)\n for s in S:\n for k, m in enumerate(M):\n D[k] += sum(s[i] for i in m)\n if any(d > K for d in D):\n ans += 1\n if ans >= answer:\n break\n for k, m in enumerate(M):\n D[k] = sum(s[i] for i in m)\n \n if any(d > K for d in D):\n ans = answer + 1\n break\n\n answer = min(answer,ans)\n\n print(answer)\n\nmain()", 'S = list(input())\nN = len(S)\nS_mae = S[:int((N-1)/2)]\nS_usi = S[int((N+1)/2):]\n\nif (S_mae[:len(S_mae)] == S_mae[::-1]) and (S == S[::-1]):\n print("Yes")\nelse:\n print("No")\n \n#print(S_mae)\n#print(S_usi)\n\n', 'A, B = map(int, input().split())\n#A = list(map(int, input().split()))\n\nprint(int((A*(A-1))/2+(B*(B-1))/2))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s026008885', 's484418605', 's221396511'] | [3064.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0] | [1274, 212, 106] |
p02729 | u199120400 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nresult = 0\n\nif n != 0: \n result += n*(n-1)/2\n\nif m != 0:\n result += m*(m-1)/2\n\nprint(result)', 'n, m = map(int, input().split())\n \nresult = 0\n \nif n != 0: \n result += n*(n-1)/2\n \nif m != 0:\n result += m*(m-1)/2\n \nprint(int(result))'] | ['Runtime Error', 'Accepted'] | ['s758540639', 's434084325'] | [2940.0, 2940.0] | [17.0, 17.0] | [129, 137] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.