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
u642418876
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\neven=(N*(N-1))/2\nodd=(M*(M-1))/2\nprint(even+odd)\n', 'N,M=map(int,input().split())\nprint(((N*(N-1))/2)+((M*(M-1))/2))\n', 'N,M=map(int,input().split())\neven=(N*(N-1))/2\nodd=(M*(M-1))/2\nprint(int(even)+int(odd))\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s565017991', 's832184945', 's834206207']
[2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0]
[78, 64, 88]
p02729
u643498327
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['from operator import mul\nfrom functools import reduce\n\ndef cmb(n,r):\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\n\nn , m = map(int , input().split())\nprint(cmb(n , 2) + cmb(m , 2))', 'n , m = map(int , input().split())\nprint(int(n*(n-1)/2 + m*(m-1)/2))']
['Runtime Error', 'Accepted']
['s590586151', 's735838358']
[3572.0, 2940.0]
[23.0, 18.0]
[287, 68]
p02729
u643817184
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nfrom EmurateInput import input\nimport functools\n\n@functools.lru_cache(maxsize=None)\ndef factorial(N):\n if N == 0:\n return 1\n if N == 1:\n return 1\n else:\n return N * factorial(N - 1)\n\n\ndef c(n, r):\n if n < r:\n return 0\n return factorial(n) // (factorial(r) * factorial(n-r))\n\n\nN, M = [int(x) for x in input().split()]\n\nprint(\n c(N, 2) + c(M, 2)\n)\n', 'import functools\n\n@functools.lru_cache(maxsize=None)\ndef factorial(N):\n if N == 0:\n return 1\n if N == 1:\n return 1\n else:\n return N * factorial(N - 1)\n\n\ndef c(n, r):\n if n < r:\n return 0\n return factorial(n) // (factorial(r) * factorial(n-r))\n\n\nN, M = [int(x) for x in input().split()]\n\nprint(\n c(N, 2) + c(M, 2)\n)\n']
['Runtime Error', 'Accepted']
['s347000736', 's592344020']
[2940.0, 3684.0]
[18.0, 23.0]
[440, 361]
p02729
u646412443
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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()\nans = True\ndef isPalindrome(string):\n return s == s[::-1]\nif not isPalindrome(s):\n ans = Flase\nif not isPalindrome(s[:len(s)//2]):\n ans = False\nif not isPalindrome(s[len(s)//2+1:]):\n ans = False\nif ans:\n print('Yes')\nelse:\n print('No')\n", 'n = int(input())\na = list(map(int, input().split()))\ncnt = [0]*n\nfor i in a:\n cnt[i] += 1\ntotal = 0\nfor i in cnt:\n total += i * (i-1) // 2\nfor i in a:\n print(total - (cnt[i] - 1)\n\n ', "n = int(input())\na = list(map(int, input().split()))\nans = [0]*n\ndef choose2(n):\n return n * (n - 1) // 2\ntotal = 0\nfor i in range(1,n+1):\n total += choose2(a.count(i))\nfor i in range(n):\n ans[i] = total\n ans[i] -= a.count(a[i]) - 1\nprint(*ans[:], sep='\\n')\n", 'n, m = map(int, input().split())\nans = 0\nif n >= 2:\n ans += (n * (n - 1)) // 2\nif m >= 2:\n ans += (m * (m - 1)) // 2\nprint(ans)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s203012686', 's366271439', 's892624230', 's263398299']
[3060.0, 2940.0, 3060.0, 2940.0]
[17.0, 18.0, 17.0, 18.0]
[266, 199, 270, 134]
p02729
u646892595
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nimport math\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nbase = comb(N,2)\nbase2 = comb(M,2)\nprint(base+base2)', 'N, M = map(int,input().split())\nimport math\ndef comb(n, r):\n if (n-r) >= 0:\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n else:\n return 0\nbase = comb(N,2)\nbase2 = comb(M,2)\nprint(base+base2)']
['Runtime Error', 'Accepted']
['s795576622', 's367778623']
[3060.0, 3060.0]
[19.0, 17.0]
[188, 238]
p02729
u647287452
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['N,M = map(int,input().split())\nif N <= 1:\n N = 2\nif M <= 1:\n M = 2\nprint(int(N*(N-1)/2+M*(M-1)/2))\n', 'N,M = map(int,input().split())\nif N <= 1:\n N = 2\nif M <= 1:\n M = 2\nprint(N(N-1)/2+M(M-1)/2)', 'N,M = map(int,input().split())\nif N <= 1:\n N = 1\nif M <= 1:\n M = 1\nprint(int(N*(N-1)/2+M*(M-1)/2))\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s176100625', 's208791975', 's604359617']
[2940.0, 2940.0, 2940.0]
[18.0, 18.0, 17.0]
[101, 93, 101]
p02729
u647679586
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['# number of balls\nN = input()\n# ball values\nK = list(map(int, input().split()))\n\n# get ball counts\nball_counts = {}\nfor i in range(len(K)):\n ball_value = K[i]\n if ball_value in ball_counts:\n ball_counts[ball_value] += 1\n else:\n ball_counts[ball_value] = 1\n\n\ntotal_sum = 0\nfor value, count in ball_counts.items():\n total_sum += (count * (count - 1)) / 2\n\n\nfor i in range(len(K)):\n ball_value = K[i]\n print(int(total_sum - (ball_counts[ball_value] - 1)))', '# number of even balls, number of odd balls\nN, M = list(map(int, input().split()))\n\ntotal_choice = 0\n\nif N > 1:\n total_choice += N*(N-1)/2\n\nif M > 1:\n total_choice += M*(M-1)/2\n\nprint(int(total_choice))']
['Runtime Error', 'Accepted']
['s275547300', 's903615086']
[3064.0, 2940.0]
[18.0, 17.0]
[508, 208]
p02729
u652081898
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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']
['s447900471', 's050644051']
[3064.0, 2940.0]
[17.0, 17.0]
[61, 66]
p02729
u652656291
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['n,m = map(int,input().split())\nprint(n*(n-1) / 2 + m*(m-1) / 2)\n\n\n\n\n', 'n,m = map(int,input().split())\nprint(n*(n-1)/2 + m*(m-1)/2)\n', 'n,m = map(int,input().split())\nprint(n*(n-1)//2 + m*(m-1)//2)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s759632930', 's863128667', 's483041767']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[362, 60, 62]
p02729
u656919695
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nN1=(math.factorial(N))//(math.factorial(N-2)*2)\nM1=(math.factorial(M))//(math.factorial(M-2)*2)\n\nprint(str(N1+M1))', 'N,M =map(str,input().split())\n\nN1=math.factorial(N)//(math.factorial(N-2)*2)\nM1=math.factorial(M)//(math.factorial(M-2)*2)\n\nprint(N1+M1)', 'a,b =map(int,input().split())\nsum=a*(a-1)//2+b*(b-1)//2\nprint(sum)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s157930492', 's751421792', 's976837548']
[3060.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0]
[157, 136, 67]
p02729
u658987783
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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==1 and m==1:\n print("0")\nif n==1 and not m==1:\n print(m*(m-1)/2)\nif m==1 and not n==1:\n print(n*(n-1)/2)\nif not m==1 and not n==1:\n print(n*(n-1)/2+m*(m-1)/2)', 'n,m=map(int,input().split())\n\nif n==1 and m==1:\n print("0")\nif n==1:\n print(m/2)\nif m==1:\n print(n/2)\nelse:\n print(n*(n-1)/2+m*(m-1)/2)', 'n,m=map(int,input().split())\n\nif n==1 and m==1:\n print("0")\nif n==1 and not m==1:\n print(m*(m-1)//2)\nif m==1 and not n==1:\n print(n*(n-1)//2)\nif not m==1 and not n==1:\n print(n*(n-1)//2+m*(m-1)//2)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s263837693', 's984549135', 's841144350']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[199, 141, 203]
p02729
u660899380
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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()\nm = int(m)\nn = int(n)\nmNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))\nnNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))\nprint(int(mNum + nNum))', 'import math\nn, m = input().split()\nm = int(m)\nn = int(n)\nif n == 1 or n == 0:\n\tnNum = 0\nelse:\n\tnNum = math.factorial(n) / (math.factorial(n-2) * math.factorial(2))\nif m == 1 or m == 0:\n\tmNum = 0\nelse:\n\tmNum = math.factorial(m) / (math.factorial(m-2) * math.factorial(2))\nprint(int(mNum + nNum))']
['Runtime Error', 'Accepted']
['s584532370', 's818609181']
[3060.0, 3064.0]
[17.0, 17.0]
[218, 294]
p02729
u663089555
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['N,M=map(int, input().split())\nprint(N*(N-1)+M*(M-1))', ' N,M=map(int, input().split())\nprint(N*(N-1)//2+M*(M-1)//2)\n', "S=input()\ns=int(len(S))\np=1\nfor i in range(int((((s-1)/2)+1)/2)):\n if S[i]==S[int((s-1)/2-(i+1))]==S[s-i-1]==S[int((s-1)/2+(i+1))]:\n p=p*1\n else:\n p=p*0\nif int(p)==1:\n print('Yes')\nelse:\n print('No')", 'N,M = map(int, input().split())\nCon_N=N*(N-1)//2\nCon_M=M*(M-1)//2\nprint(Con_N+Con_M)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s535772031', 's641368165', 's851854666', 's583694109']
[2940.0, 2940.0, 3064.0, 2940.0]
[17.0, 17.0, 17.0, 17.0]
[52, 60, 225, 84]
p02729
u663438907
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['N, M = map(int, input().split())\n\nans = N * (N + 1) / 2 + M * (M + 1) / 2\n\nprint(int(ans))', 'N, M = map(int, input().split())\n\nans = N * (N - 1) / 2 + M * (M - 1) / 2\n\nprint(int(ans))']
['Wrong Answer', 'Accepted']
['s106302070', 's019577084']
[2940.0, 2940.0]
[17.0, 17.0]
[91, 91]
p02729
u665369939
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nN = n*(n-1)/2\nM = m*(m-1)/2\nprint(N+M)', 'n,m = (int(x) for x in inpit().split())\nN = n *(n -1) /2\nM = m *(m-1) / 2\nprint(N+M)', 'n,m =(int(x) for x in input().split())\nN = 0\nM = 0\nif n >1:\n N = n *(n-1)/2\nif m > 1:\n M = m*(m-1)/2\na = int(N + M)\nprint(a)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s051116889', 's937160405', 's554971999']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[78, 84, 130]
p02729
u666961261
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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(str(S))\ntemp = S[0:(N-1)/2]\ntemp2 = S[(N+2)/2:N]\nprint("Yes") if temp == temp[::-1] and temp2 == temp2[::-1] else "No"', 'from functools import reduce\ndef permu(n,r):\n return reduce(lambda a,b: a*b, range(n-r+1,n+1))\nN,M = map(int, input().split())\nprint(int((permu(N,2)+permu(M,2))/2))']
['Runtime Error', 'Accepted']
['s981902987', 's357417269']
[2940.0, 3700.0]
[18.0, 110.0]
[138, 167]
p02729
u667694979
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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,inputt().split())\nprint(N*(N-1)/2+M*(M-1)/2)', 'N,M=map(int,input().split())\n\nprint(N*(N-1)+M*(M-1))', 'N,M=map(int,inputt().split())\nx = M * (M - 1) // 2\nx += N * (N - 1) // 2\nprint(x)', 'N,M=map(int,inputt().split())\nprint(N*(N-1)+N*M)', 'N,M=map(int,inputt().split())\nprint(N*(N-1)+M*(M-1))', 'N,M=map(int,inputt().split())\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', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s227336465', 's594340477', 's710944794', 's741954122', 's751570191', 's929969537', 's438810542']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0, 18.0, 17.0, 17.0, 17.0]
[56, 52, 81, 48, 52, 60, 58]
p02729
u669729085
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
["import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline\nfrom math import floor, ceil, sqrt, factorial, log\nfrom collections import Counter, defaultdict, deque\nfrom operator import itemgetter\nINF = float('inf'); MOD = 10**9+7\ndef I(): return int(input())\ndef MI(): return map(int, input().split())\ndef LI(): return list(MI())\ndef LIR(n): return [LI() for i in range(n)]\ndef IS(): return input().rstrip()\nfrom operator import mul\nfrom functools import reduce\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\n\n\ndef main():\n N, M = MI()\n print(combinations_count(N, 2)+combinations_count(M, 2))\n \n\nif __name__ == '__main__':\n main()", "import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline\nfrom math import floor, ceil, sqrt, factorial, log\nfrom collections import Counter, defaultdict, deque\nfrom operator import itemgetter\nINF = float('inf'); MOD = 10**9+7\ndef I(): return int(input())\ndef MI(): return map(int, input().split())\ndef LI(): return list(MI())\ndef LIR(n): return [LI() for i in range(n)]\ndef IS(): return input().rstrip()\nfrom operator import mul\nfrom functools import reduce\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\n\n\ndef main():\n N, M = MI()\n if N > 1:\n n = combinations_count(N, 2)\n else:\n n = 0\n if M > 1:\n m = combinations_count(M, 2)\n else:\n m = 0\n print(n+m)\n\nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Accepted']
['s731007584', 's807619899']
[3568.0, 3824.0]
[24.0, 29.0]
[780, 879]
p02729
u670180528
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['def main():\n\tn, s, *a = map(int, open(0).read().split())\n\tans = 0\n\tmod = 998244353\n\tdp = [0] * (s + 1)\n\tfor i, x in enumerate(a):\n\t\tdp[0] += 1\n\t\tif x > s:continue\n\t\tans += dp[s - x] * (n - i)\n\t\tans %= mod\n\t\tdp = dp[:x] + [(dp[j] + dp[j - x]) % mod for j in range(x, s + 1)]\n\tprint(ans)\n\t\nif __name__=="__main__":\n\tmain()\n\n', 'n,m=map(int,input().split())\nprint(n*(n-1)//2+m*(m-1)//2)']
['Wrong Answer', 'Accepted']
['s236811514', 's831200625']
[3064.0, 2940.0]
[17.0, 17.0]
[322, 57]
p02729
u671446913
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['#!/usr/bin/env python3\nimport collections\nimport itertools as it\nimport math\n#import numpy as np\n \n# = input()\n# = int(input())\n# = map(int, input().split())\n# = list(map(int, input().split()))\n\n#\n# c = collections.Counter()\n', '#!/usr/bin/env python3\nimport collections\nimport itertools as it\nimport math\nimport numpy as np\n\ndef permutations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n# A = input()\n# A = int(input())\nN, M = map(int, input().split())\n# A = list(map(int, input().split()))\n\n#\n# c = collections.Counter()\n\ncN = 0\ncM = 0\nif N == 0:\n cN = 0\nelif N == 1:\n cN == 1\nelse:\n cN = permutations_count(N, 2)\n\nif M == 0:\n cM = 0\nelif M == 1:\n cM == 1\nelse:\n cM = permutations_count(M, 2)\n\nprint(cN + cM)']
['Wrong Answer', 'Accepted']
['s610309483', 's935674633']
[3316.0, 21156.0]
[20.0, 1693.0]
[266, 582]
p02729
u671889550
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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()\nt = s[::-1]\nn = len(s)\n\nif n == 1 or n == 5:\n print('No')\n exit()\n \nelif s != t:\n print('No')\n exit()\n\nelse:\n for i in range(0, (n - 1)//2, 2):\n if s[i] != t[i]:\n print('No')\n exit()\nprint('Yes')", 'n, m = map(int, input().split())\n\neven = n * (n - 1) // 2\nodd = m * (m - 1) // 2\n\nprint(even + odd)\n ']
['Wrong Answer', 'Accepted']
['s137808400', 's454711356']
[9060.0, 8944.0]
[25.0, 28.0]
[254, 104]
p02729
u672370694
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['k = list(map(int, input().split()))\n\nl = k[0] * (k[0] -1) / 2\nm = k[1] * (k[1] -1) / 2\n\nprint(l + m)', 'k = list(map(int, input().split()))\nl = k[0] * (k[0] -1) / 2\nm = k[1] * (k[1] -1) / 2\nprint(int(l + m))']
['Wrong Answer', 'Accepted']
['s529698839', 's112374187']
[2940.0, 2940.0]
[17.0, 17.0]
[100, 103]
p02729
u674052742
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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"""\nCreated on Sat Apr 4 19:20:51 2020\n\n@author: Kanaru Sato\n"""\n\nn,m = list(map(int, input().split()))\n\nif n <= 1:\n ans1 = 0\nelse:\n ans1 = n*(n-1)/2\n\nif m <= 1:\n ans2 = 0\nelse:\n ans2 = m*(m-1)/2\n \nans = ans1+ans2\nprint(ans)', '# -*- coding: utf-8 -*-\n"""\nCreated on Sat Apr 4 19:20:51 2020\n\n@author: Kanaru Sato\n"""\n\nn,m = list(map(int, input().split()))\n\nif n <= 1:\n ans1 = 0\nelse:\n ans1 = n*(n-1)/2\n\nif m <= 1:\n ans2 = 0\nelse:\n ans2 = m*(m-1)/2\n \nans = ans1+ans2\nprint(int(ans))']
['Wrong Answer', 'Accepted']
['s643344910', 's509704833']
[2940.0, 3060.0]
[18.0, 17.0]
[264, 269]
p02729
u674832921
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['arr = list(map(int,input().rstrip().split()))\ncou = 0\ncou_n = 0\ncou_m = 0\ni =1\nj =1\nN = arr[0]\nM = arr[1]\nn =[]\nm = []\nwhile cou_n != N:\n if i % 2 == 0:\n n.append(i)\n cou_n += 1\n i += 1\n\nwhile cou_m != M:\n if j % 2 != 0 :\n m.append(j)\n cou_m +=1\n j += 1\nf = n + m\n# print(n)\n# print(m)\nf.sort()\nprint(f)\n\nfor i in range(len(f)):\n for j in range(i+1,len(f)):\n if ((f[i] + f [j]) % 2) == 0:\n cou +=1\nprint(cou)', "if __name__ == '__main__':\n arr = list(map(int,input().rstrip().split()))\n cou = 0\n cou_n = 0\n cou_m = 0\n i =1\n j =1\n N = arr[0]\n M = arr[1]\n n =[]\n m = []\n while cou_n != N:\n if i % 2 == 0:\n n.append(i)\n cou_n += 1\n i += 1\n\n while cou_m != M:\n if j % 2 != 0 :\n m.append(j)\n cou_m +=1\n j += 1\n f = n + m\n# print(n)\n# print(m)\n f.sort()\n\n\n for i in range(len(f)):\n for j in range(i+1,len(f)):\n if ((f[i] + f [j]) % 2) == 0:\n cou +=1\n print(cou)"]
['Wrong Answer', 'Accepted']
['s114024374', 's136441073']
[3064.0, 3064.0]
[22.0, 22.0]
[488, 618]
p02729
u676645714
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['def factorial(n):\n if n > 1:\n return n * factorial(n - 1)\n else:\n return 1\n \nm,n=map(int,input().split())\n# n = 100\n# m = 100\nn_result = factorial(n)/(factorial(2) * factorial(n - 2))\nm_result = factorial(m)/(factorial(2) * factorial(m - 2))\n\nprint(n_result + m_result)', 'def factorial(n):\n if n > 1:\n return n * factorial(n - 1)\n else:\n return 1\n \nm,n=map(int,input().split())\n#n = 100\n#m = 100\n\nresult = (int)(factorial(n)/(factorial(2) * factorial(n - 2)))\nresult += (int)(factorial(m)/(factorial(2) * factorial(m - 2)))\n\nprint(result)']
['Wrong Answer', 'Accepted']
['s613833045', 's463913469']
[3060.0, 3060.0]
[17.0, 17.0]
[296, 293]
p02729
u676933207
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nx = float(L/3)\nprint(x**3)', 'N,M = map(int,input().split())\n \ndef cmb(n,r):\n if r > n:\n return 0\n if r == 0 or r == n:\n return 1\n if r == 1:\n return n\n return cmb(n-1,r) + cmb(n-1,r-1)\n \nret = cmb(N,2) + cmb(M,2)\nprint(ret)']
['Runtime Error', 'Accepted']
['s941461032', 's397205202']
[2940.0, 3060.0]
[17.0, 18.0]
[43, 227]
p02729
u678505520
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nn=N*(N-1)/2\nm=M*(M-1)/2\nprint(n+m)', 'N,M=int(input())\nn=N*(N-1)/2\nm=M*(M-1)/2\nprint(n+m)', 'N,M=int(input())\nn=n*(n-1)/2\nm=m*(m-1)/2\nprint(n+m)', 'N,M=map(int,input().split())\nprint(int(N*(N-1)/2+M*(M-1)/2))']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s365263636', 's394515233', 's684977703', 's512182594']
[2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 18.0, 17.0, 17.0]
[51, 51, 51, 60]
p02729
u679131784
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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']
['s965713675', 's169326265']
[2940.0, 2940.0]
[17.0, 17.0]
[58, 63]
p02729
u685244071
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['N, M = map(int, input().split())\na = N*(N-1)/2\nb = M*(M-1)/2\nprint(a+b)', 'N, M = map(int, input().split())\na = N*(N-1)//2\nb = M*(M-1)//2\nprint(a+b)\n']
['Wrong Answer', 'Accepted']
['s807149450', 's777738808']
[2940.0, 2940.0]
[18.0, 17.0]
[71, 74]
p02729
u685684561
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nimport sys\nt=0\nlista=[]\nfor i in range(99):\n try:\n lista.append(S[i])\n t=t+1\n except IndexError:\n break\nu=t//2\nv=u//2+1\np=1\nfor i in range(v):\n if S[i]==S[u-i-1] and S[u-i+1]==S[u+i+1] and S[u+i+1]==S[t-1-i]:\n p=p*1\n else:\n print ('No')\n sys.exit()\nprint ('Yes')", 'L=int(input())\nprint (L**3/27)', 'N,M=map(int,input().split())\n\nk=(M*(M-1)+N*(N-1))//2\nprint (k)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s612732286', 's988651762', 's850206039']
[3064.0, 2940.0, 2940.0]
[19.0, 18.0, 18.0]
[299, 30, 62]
p02729
u686230543
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 + 1) * (m // 2 + 1))', 'n, m = map(int, input().split())\n\nprint(n * (n - 1) // 2 + m * (m - 1) // 2)']
['Wrong Answer', 'Accepted']
['s378711194', 's393992214']
[2940.0, 2940.0]
[17.0, 17.0]
[62, 76]
p02729
u689835643
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 or a[0] == 0:\n a[0] = 1\n return a[0]\nelse: \n return a[0]*(a[0] - 1)/2\nif a[1] == 1 or a[1] == 0:\n a[1] = 1\n return a[1] \nelse: \n return a[1]*(a[1] - 1)/2\nprint(a[0]*a[1])\n', 'a = list(map(int, input().split()))\n\n\ndef a1():\n if a[0] == 1 or a[0] == 0:\n a[0] = 1\n return a[0]\n else:\n return a[0] * (a[0] - 1) / 2\n\n\ndef b1():\n if a[1] == 1 or a[1] == 0:\n a[1] = 1\n return a[1]\n else:\n return a[1] * (a[1] - 1) / 2\n\n\nprint(a1() * b1())\n', 'a = list(input().split())\na1 = "".join(a)\nc = reversed(a)\nc1 = "".join(c)\n\n\ndef b():\n if len(a1) <= 5:\n return 0\n if a1 == c1:\n return 1\n else:\n return 0\n\n\nif b() == 0:\n print("No")\nelse:\n print("Yes")\n', 'a = list(map(int, input().split()))\n\n\ndef a1():\n if a[0] == 1 or a[0] == 0:\n a[0] = 1\n return a[0]\n else:\n return a[0] * (a[0] - 1) / 2\n\n\ndef b1():\n if a[1] == 1 or a[1] == 0:\n a[1] = 1\n return a[1]\n else:\n return a[1] * (a[1] - 1) / 2\n\n\nprint(a1() + b1())\n', 'a = list(map(int, input().split()))\n\n\ndef a1():\n if a[0] == 1 or a[0] == 0:\n a[0] = 1\n return a[0]\n else:\n return a[0] * (a[0] - 1) / 2\n\n\ndef b1():\n if a[1] == 1 or a[1] == 0:\n a[1] = 1\n return a[1]\n else:\n return a[1] * (a[1] - 1) / 2\n\n\nprint(a() * b())\n', 'a = list(map(int, input().split()))\nif a[0] == 1:\n a[0] = 1\n return a[1]\nelse: \n return a[0]*(a[0] - 1)\nif a[1] == 1:\n a[1] = 1\n return a[1] \nelse: \n return a[1]*(a[1] - 1)\nprint(a[0]*a[1])', 'a = list(map(int, input().split()))\n\n\ndef a1():\n if a[0] == 1 or a[0] == 0:\n a[0] = 1\n return a[0]\n else:\n return a[0] * (a[0] - 1) / 2\n\n\ndef b1():\n if a[1] == 1 or a[1] == 0:\n a[1] = 1\n return a[1]\n else:\n return a[1] * (a[1] - 1) / 2\n\n\nprint(int(a1() + b1()))\n', 'a = list(map(int, input().split()))\nprint(a[0] * (a[0] - 1) // 2 + a[1] * (a[1] - 1) // 2)\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s084314486', 's278001913', 's284860035', 's337995782', 's502958817', 's680108986', 's802386852', 's217426419']
[2940.0, 3060.0, 2940.0, 3060.0, 3060.0, 3060.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0, 18.0, 17.0, 17.0, 17.0, 18.0]
[226, 311, 238, 311, 309, 195, 316, 91]
p02729
u690536347
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['N, M = map(int, input().split())\na, b = (N//2)+1, (M//2)+1\nprint(a*b+(N-a)*(M-b))\n', 'N, M = map(int, input().split())\nprint(N*(N-1)//2+M*(M-1)//2)']
['Wrong Answer', 'Accepted']
['s431408633', 's769563300']
[2940.0, 2940.0]
[17.0, 18.0]
[82, 61]
p02729
u692453235
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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, imput().split())\ncount = 0\n\ndef nCr(n):\n if n >= 2:\n return math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))\n else:\n return 0\n\nprint(nCr(N)+nCr(M))', 'N, M = map(int, input().split())\n\nprint( (N*(N-1))//2 + (M*(M-1))//2 )']
['Runtime Error', 'Accepted']
['s772469750', 's067641040']
[2940.0, 2940.0]
[18.0, 17.0]
[200, 70]
p02729
u692498898
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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+M)*(N+M-1)/2-N*M)', 'n,m=map(int,input().split())\nprint((n+m)*(n+m-1)//2-n*m)']
['Wrong Answer', 'Accepted']
['s210624204', 's787556389']
[2940.0, 2940.0]
[17.0, 18.0]
[56, 56]
p02729
u692687119
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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)\nkai = []\nkai2 = []\nkai3 = []\n\nfor i in range(N):\n kai.append(S[i])\n\nfor i in range(0, int((N - 1) / 2)):\n kai2.append(S[i])\n\nfor i in range(int((N + 3) / 2) - 1, N):\n kai3.append(S[i])\n\nrev = kai.reverse\nrev2 = kai2.reverse\nrev3 = kai3.reverse\n\nif kai == rev:\n if kai2 == rev2:\n if kai3 == rev3:\n print('Yes')\n else:\n print('No')\n else:\n print('No')\nelse:\n print('No')\n", 'N, M = map(int, input().split())\ndef sta(n):\n one = 1\n for i in range(1, n + 1):\n one *= i\n return one\n\nif N >= 3:\n num = sta(N)/(sta(2)*sta(N-2))\nif N = 2:\n num = 1\nif N <= 1:\n num = 0\n\nif M >= 3:\n mum = sta(N)/(sta(2)*sta(N-2))\nif M = 2:\n mum = 1\nif M <= 1:\n mum = 0\n\nprint(num + mum)\n', 'N, M = map(int, input().split())\ndef sta(n):\n one = 1\n for i in range(1, n + 1):\n one *= i\n return one\n\nif N >= 3:\n num = sta(N)/(sta(2)*sta(N-2))\nif N == 2:\n num = 1\nif N <= 1:\n num = 0\n\nif M >= 3:\n mum = sta(M)/(sta(2)*sta(M-2))\nif M == 2:\n mum = 1\nif M <= 1:\n mum = 0\n\nprint(int(num + mum))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s283050816', 's427195092', 's191058356']
[3064.0, 2940.0, 3064.0]
[17.0, 18.0, 17.0]
[417, 299, 305]
p02729
u693007703
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['from scipy.misc import comb\n\nN, M = [int(i) for i in input().split()]\n\nn_comb = comb(N, 2)\nm_comb = comb(M, 2)\n\noutput = int(n_comb) + int(m_comb)\n\nprint(output)', 'from scipy.misc import comb\n\nN, M = [int(i) for i in input().split()]\n\nn_comb = comb(N, 2)\nm_comb = comb(M, 2)\n\noutput = int(n_comb + m_comb)\n\nprint(output)', 'N, M = [int(i) for i in input().split()]\n\nn_comb = (N * (N -1)) / 2\nm_comb = (M * (M -1)) / 2\n\noutput = int(n_comb) + int(m_comb)\n\nprint(output)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s039071845', 's795951337', 's914326623']
[16664.0, 24936.0, 2940.0]
[223.0, 1712.0, 17.0]
[161, 156, 144]
p02729
u694665829
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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']
['s840496975', 's109520401']
[2940.0, 2940.0]
[17.0, 17.0]
[55, 60]
p02729
u697422981
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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']
['s812430065', 's534399830']
[2940.0, 2940.0]
[17.0, 17.0]
[57, 60]
p02729
u697758384
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = int(input())\nM = int(input())\n\nn = N-1\nm = M-1\n\nEven = N*n\nOdd = M*m\n\nprint((Even+Odd)/2)', 'N, M = map(int,input().split())\n\nn = N-1\nm = M-1\n\nEven = N*n\nOdd = M*m\n\nprint((Even+Odd)/2)', 'N = input()\nM = input()\n\nn = N-1\nm = M-1\n\nif N == 1 and M == 1:\n print("0")\nelse:\n print((N*n+M*m)/2)', 'N = input()\nM = input()\n\nn = N-1\nm = M-1\n\nif N == 1 and M == 1:\n print("0")\nelse:\n print(N*n+M*m)', 'N, M = map(int,input().split())\n\nprint((N*(N-1)+M*(M-1))//2)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s139635758', 's144601358', 's535666573', 's647305382', 's754613607', 's150477147']
[2940.0, 2940.0, 2940.0, 2940.0, 3064.0, 2940.0]
[18.0, 17.0, 17.0, 17.0, 17.0, 17.0]
[59, 93, 91, 107, 103, 60]
p02729
u698737869
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = input().split(' ')\nb = (a[0] * a[0]-1)/2 + (a[1] * a[1]-1)/2\nprint (b)", "a = input().split(' ')\nb = (int(a[0]) * (int(a[0])-1))/2 + (int(a[1]) * (int(a[1])-1))/2\nprint(int(b))"]
['Runtime Error', 'Accepted']
['s424634919', 's591199605']
[2940.0, 3060.0]
[18.0, 18.0]
[74, 102]
p02729
u699547221
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\n\npattern_1 = N*(N-1)/2\n\n\npattern_2 = M*(M-1)/2\n\nprint(pattern_1 + pattern_2)', 'N = int(input())\nM = int(input())\n\npattern_1 = N*(N-1)/2\npattern_2 = M*(M-1)/2\n\nprint(pattern_1 + pattern_2)', 'nm = list(map(int, input().split()))\nn = nm[0]\nm = nm[1]\nans = n*(n-1)/2 + m*(m-1)/2\nprint(int(ans))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s468990335', 's513728966', 's028838088']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[145, 108, 100]
p02729
u699944218
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nN, M = list(map(int,input().split()))\nprint(N * (N-1) /2 + M * (M-1) / 2)', '#!/usr/bin/ python3.8\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n \nN, M = map(int, readlines().split())\nx = M * (M - 1) // 2\nx += N * (N - 1) // 2\nprint(x)', '#!/usr/bin/ python3.8\nimport sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n \nN, M = map(int, read().split())\nx = M * (M - 1) // 2\nx += N * (N - 1) // 2\nprint(x)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s598606129', 's911378587', 's227080973']
[2940.0, 2940.0, 2940.0]
[17.0, 19.0, 17.0]
[190, 228, 223]
p02729
u701318346
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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()))\n\n\ndict = {}\nfor a in A:\n if a in dict:\n dict[a] += 1\n else:\n dict[a] = 1\n\n\nmemo = {}\nfor k in range(N):\n ans = 0\n m = A[k]\n if m in memo.keys():\n ans = memo[m]\n else:\n dict_work = dict.copy()\n dict_work[m] -= 1\n for d in dict_work.values():\n if d > 1:\n ans += (d * (d - 1)) // 2\n memo[m] = ans\n print(ans)', 'N, M = map(int, input().split())\n\nans = 0\n\nif N > 1:\n ans += (N * (N - 1)) // 2\nif M > 1:\n ans += (M * (M - 1)) // 2\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s833539175', 's391133359']
[3064.0, 2940.0]
[17.0, 17.0]
[553, 134]
p02729
u706330549
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['import collections\n\nn = int(input())\na = list(map(int, input().split()))\n\nc = collections.Counter(a)\n\nans = 0\n\nfor i in c.values():\n ans += i * (i - 1) // 2\n\nfor i in range(n):\n print(ans - c[a[i]] + 1)\n', 'n, m = map(int, input().split())\n\na = (n * (n - 1)) // 2 + (m * (m - 1)) // 2\n\nprint(a)\n']
['Runtime Error', 'Accepted']
['s865693185', 's803457081']
[3316.0, 2940.0]
[21.0, 18.0]
[209, 88]
p02729
u706785092
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 == int(0):\n print(M*(M-1)/2)\nelif M == int(0):\n print(N*(N-1)/2)\nelse:\n print(N*(N-1)/2 + M*(M-1)/2)', 'N, M = map(int, input().split())\n\nif N == int(0):\n print(int(M*(M-1)/2))\nelif M == int(0):\n print(int(N*(N-1)/2))\nelse:\n print(int(N*(N-1)/2 + M*(M-1)/2))']
['Wrong Answer', 'Accepted']
['s160663194', 's475320358']
[3060.0, 3060.0]
[19.0, 17.0]
[148, 163]
p02729
u711238850
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['import math\nimport functools\nfrom operator import add\n\ndef main():\n h,w,k = tuple([int(t)for t in input().split()])\n\n s = [[int(i) for i in list(input())] for _ in range(h)]\n \n cusum = [accumelist(s_) for s_ in s]\n\n candidates = []\n\n for i in range(1<<(h-1)):\n subcu = divide(cusum,i)\n subcusum = []\n\n for sub_ in subcu:\n subcusum.append(functools.reduce((lambda a,b:list(map(add,a,b))),sub_))\n\n cutnum = 0\n j=0\n temp = [0]*len(subcusum)\n\n while j<w:\n for l in range(len(subcusum)):\n pos = 0\n if subcusum[l][j]-temp[l]>k:\n pos = j\n j-=1\n if j-pos==0:\n cutnum+=10000\n temp = [x[j-1] for x in subcusum]\n cutnum+=1\n break\n j+=1\n \n candidates.append(cutnum+bin(i).count(\'1\'))\n\n print(min(candidates))\n \ndef divide(s,i):\n subs = []\n counter = 0\n pos = 0\n while i!= 0:\n counter +=1\n if i%2==1:\n subs.append(s[pos:counter])\n pos = counter\n i >>=1\n \n subs.append(s[pos:])\n return subs\n\ndef accumelist(s):\n if s == []:\n return []\n res = [s[0]]\n for i in range(1,len(s)):\n res.append(res[i-1]+s[i])\n\n return res\n\ndef _add_(a,b):\n return map(add,a,b)\n \nif __name__ == "__main__":\n main()', 'def main():\n n,m = tuple([int(t)for t in input().split()])\n\n print(n*(n-1)//2+m*(m-1)//2)\n\nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s311997790', 's724525505']
[3676.0, 2940.0]
[23.0, 17.0]
[1467, 134]
p02729
u711340028
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['import sys\nfrom math import factorial\n\ndef comb(n,r):\n a = factorial(n) / factorial(r) / factorial(n - r)\n return int(a)\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\nN, M = map(int, read().split())\n\nans = comb(N, 2) + comb(M, 2)\n\nprint(ans)', 'import sys\nfrom math import factorial\n\ndef comb(n,r):\n a = factorial(n) / factorial(r) / factorial(n - r)\n return int(a)\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\n\nN, M = map(int, read().split())\n\na = comb(N, 2) if N>=2 else 0\nb = comb(M, 2) if M >=2 else 0\nans = N * (N-1) // 2 + M * (M-1) //2\nprint(ans)']
['Runtime Error', 'Accepted']
['s900639334', 's690921757']
[3060.0, 3064.0]
[18.0, 18.0]
[309, 376]
p02729
u713914478
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\ndef combinations_count(n,r):\n\treturn math.factorial(n) // (math.factorial(n-r)*math.factorial(r))\nprint(combinations_count(N,2) + combinations_count(M,2))', 'import math\nN,M = map(int, input().split())\ndef combinations_count(n,r):\n\treturn math.fractorial(n) / (math.fractorial(n-r)*math.fractorial(r))\nprint(combinations_count(N,2) + combinations_count(M,2))', 'import math\nN,M = map(int, input().split())\ndef combinations_count(n,r):\n\tif n == 0 or n == 1:\n\t\treturn 0\n\telif n == 2:\n\t\treturn 1\n\telse: return math.factorial(n) // (math.factorial(n-r)*math.factorial(r))\nprint(combinations_count(N,2) + combinations_count(M,2))']
['Runtime Error', 'Runtime Error', 'Accepted']
['s767884993', 's861718385', 's514146187']
[3056.0, 3064.0, 3060.0]
[18.0, 18.0, 17.0]
[198, 200, 262]
p02729
u716660050
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\ndef kumiawase(n):\n a=math.factorial(n)\n r=math.factorial(2)\n return a / (r*math.factorial(n-2))\nprint(int(kumiawase(M)+kumiawase(N)))', 'import math\nN,M=map(int,input().split())\ndef kumiawase(n):\n if n>2:\n a=math.factorial(n)\n r=math.factorial(2)\n return a / (r*math.factorial(n-2))\n return 0\n\nprint(int(kumiawase(M)+kumiawase(N)))', 'N,M=map(int,input().split())\nprint(int(N*(N-1)/2+M*(M-1)/2))']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s376554064', 's959445114', 's579907477']
[3060.0, 3060.0, 2940.0]
[18.0, 19.0, 18.0]
[183, 221, 60]
p02729
u718536599
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['import math\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn,m=map(int,input().split())\nif (n<=1) and (m<=1):\n ans=0\nelif (n==0) or (m==0):\n ans=0\nelse:\n ans=comb(n,2)+comb(m,2)\n \nprint(ans)', 'import math\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn,m=map(int,input().split())\nif (n<=1) and (m<=1):\n ans=0\nelse:\n if n==0:\n ans=comb(m,2)\n elif m==0:\n ans=comb(n,2)\n else:\n ans=comb(n,2)+comb(m,2)\n \nprint(ans)\n ', 'import math\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn,m=map(int,input().split())\nif (n<=1) and (m<=1):\n ans=0\nelse:\n if n<=1:\n ans=comb(m,2)\n elif m<=1:\n ans=comb(n,2)\n else:\n ans=comb(n,2)+comb(m,2)\n \nprint(ans)\n ']
['Runtime Error', 'Runtime Error', 'Accepted']
['s564282083', 's835774841', 's642793936']
[9192.0, 9096.0, 9028.0]
[30.0, 30.0, 26.0]
[240, 282, 282]
p02729
u718949306
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nlist1 = []\nlist2 = []\n\ncount = 0\nC = 0\no = 0\nb = 0\nG = 0\n\nfor i in range(1, N + 1):\n list1.append(i * 2)\n if i >= 2:\n C = sum(list1)\n list1.remove(list1[o])\n o += 1\n if C % 2 == 0:\n count += 1\n C = 0\n\nfor q in range(1, M + 1):\n list2.append((q * 2) - 1)\n if q >= 2:\n G = sum(list2)\n list2.remove(list2[b])\n b += 1\n if G % 2 == 0:\n count += 1\n G = 0\n\nfor w in list1:\n for e in list2:\n total = w + e\n if total % 2 == 0:\n count += 1\n\nprint(count)', 'N, M = map(int, input().split())\n\nlist1 = []\nlist2 = []\n\n\ntotal1 = 0\n\ncount = 0\n\nfor i in range(1, N + 1):\n list1.append(i * 2)\n\nfor q in range(1, M + 1):\n list2.append((q * 2) - 1)\n\nfor w in list1:\n for e in list2:\n total = w + e\n if total % 2 == 0:\n count += 1\n', 'N, M = map(int, input().split())\n\ncount = N * (N - 1) / 2 + M * (M - 1) / 2\nprint(count)', 'N, M = map(int, input().split())\ncnt = 0\ncnt += N * (N - 1) // 2\ncnt += M * (M - 1) // 2\nprint(cnt)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s009699955', 's166998786', 's394291380', 's562385604']
[3192.0, 3060.0, 2940.0, 9096.0]
[17.0, 19.0, 18.0, 32.0]
[585, 297, 88, 99]
p02729
u719005202
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['N, M = map(int, input().split())\n\nans = N * (N-1) / 2 + M * (M-1) / 2\nprint(ans)', 'N, M = map(int, input().split())\n\nans = N * (N-1) / 2 + M * (M-1) / 2\n\nprint(ans)', 'N, M = map(int, input().split())\n\nans = int(N * (N-1) / 2 + M * (M-1) / 2)\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s257664723', 's793800340', 's722647243']
[3316.0, 2940.0, 2940.0]
[20.0, 17.0, 17.0]
[80, 81, 85]
p02729
u723444827
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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']
['s649175669', 's338119489']
[2940.0, 2940.0]
[17.0, 17.0]
[63, 67]
p02729
u723511547
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['from itertools import combinations\nne, no = map(int,input().split())\neven, odd = [i for i in range(1,2*(ne+1)) if i % 2 == 0], [i for i in range(1,2*no) if i % 2 != 0]\nlst = even + odd\nc = 0\nfor i in combinations(lst,2):\n print(i)\n if sum(i) % 2 == 0:\n c += 1\nprint(c)\n', 'from itertools import combinations\nne, no = map(int,input().split())\neven, odd = [i for i in range(1,2*(ne+1)) if i % 2 == 0], [i for i in range(1,2*no) if i % 2 != 0]\nlst = even + odd\nc = 0\nfor i in combinations(lst,2):\n if sum(i) % 2 == 0:\n c += 1\nprint(c)\n']
['Wrong Answer', 'Accepted']
['s200853634', 's039016196']
[3420.0, 3060.0]
[45.0, 23.0]
[282, 269]
p02729
u723583932
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['#abc159 a\nn,m=map(int,input().split())\nans=n*(n-1)/2+m*(m-1)/2\nprint(ans)\n', '#abc159 a\nn,m=map(int,input().split())\nans=n*(n-1)/2+(m-1)/2\nprint(ans)\n', '#abc159 a\nn,m=map(int,input().split())\nans=n*(n-1)/2+m*(m-1)/2\nprint(int(ans))']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s056541825', 's941769169', 's203335883']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[74, 72, 78]
p02729
u723792785
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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))', 'n,m = map(int,input().split())\nans = 0\nans += n*(n-1)//2\nans += m*(m-1)//2\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s178002976', 's239927922', 's452814502', 's540472111']
[3064.0, 2940.0, 3060.0, 9164.0]
[17.0, 18.0, 19.0, 25.0]
[61, 61, 59, 85]
p02729
u724724669
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['def main():\n N, M = map(int, input().split()) \n print((N*(N-1)/2 + (M*(M+1))/2))\nmain()', 'def main():\n N, M = map(int, input().split()) \n print((N*(N-1)//2 + (M*(M-1))//2))\nmain()']
['Wrong Answer', 'Accepted']
['s602417185', 's573811279']
[2940.0, 3064.0]
[17.0, 17.0]
[89, 91]
p02729
u725133562
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
["def main():\n n = int(input())\n a = tuple(map(int, input().split()))\n ans = 0\n lim = max(a)\n amount = [0]*lim\n for i in range(lim):\n amount[i] = a.count(i+1)\n ans += amount[i]*(amount[i]-1)//2\n #print(ans)\n for j in range(n):\n ansout = ans\n #print(amount[a[j]-1])\n ansout -= amount[a[j]-1] -1\n print(ansout)\n\nif __name__ == '__main__':\n main()\n", 'n,m = map(int, input().split())\nprint(n*(n-1)//2+m*(m-1)//2)']
['Runtime Error', 'Accepted']
['s795859760', 's022291755']
[3060.0, 2940.0]
[18.0, 17.0]
[412, 60]
p02729
u725993280
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nsum = (N*(N-1))/2 + (M*(M-1))/2\nprint(sum)', '\nN,M = map(int,input().split())\n\nsum = (N*(N-1))/2 + (M*(M-1))/2\nprint(int(sum))']
['Wrong Answer', 'Accepted']
['s886467525', 's460122006']
[3064.0, 2940.0]
[17.0, 17.0]
[87, 80]
p02729
u726154863
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['N,M=input().split()\nprint((N*N-1+M*M-1)/2)', 'n,m=map(int,input().split())\nprint(int((n*(n-1)+m*(m-1))/2))']
['Runtime Error', 'Accepted']
['s665025834', 's638270358']
[2940.0, 2940.0]
[17.0, 17.0]
[42, 60]
p02729
u726285999
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['import numpy as np\nimport itertools\n\nH, W, K = map(int, input().split())\nchoco = []\nfor i in range(H):\n choco.append([int(x) for x in list(input())])\n\narr = np.array(choco)\n\n\ncount = (H-1) + (W-1)\n\nfor k in range(H):\n \n \n if count <= k:\n break\n\n \n for comb in itertools.combinations(range(1,H),k):\n\n \n t = (None,) + comb + (None,)\n s = [slice(t[j],t[j+1],) for j in range(len(t)-1)]\n \n # print(t)\n \n sum_p = [0] * (k+1)\n \n cut = k\n \n for col in zip(*choco):\n \n \n sum_a = [sum(col[b]) for b in s]\n # print(sum_a)\n \n if any(map(K.__lt__, sum_a)):\n \n break\n \n sum_b = [x+y for x,y in zip(sum_p, sum_a)]\n\n if any(map(K.__lt__, sum_b)):\n cut += 1\n sum_p = [0] * (k+1)\n else:\n sum_p = sum_b\n \n \n \n else:\n count = min(count,cut)\n\nprint(count)', 'import math\n\nN,M = map(int, input().split())\n\n\na = 0\nif N > 1:\n a = int(math.factorial(N) / (math.factorial(N-2)*2))\n\n\nb = 0\nif M > 1:\n b = int(math.factorial(M) / (math.factorial(M-2)*2))\n\nprint(a + b)']
['Runtime Error', 'Accepted']
['s282200022', 's492810903']
[21456.0, 3060.0]
[314.0, 17.0]
[1298, 262]
p02729
u727057618
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['import itertools\nimport numpy as np\n\nres = 999999999999999999\n\nH, W, K = [int(i) for i in input().split()]\narr = []\nfor _ in range(H):\n arr.append([int(v) for v in input()])\n\narr = np.array(arr)\n \nfor p in itertools.product([0, 1], repeat = H-1):\n sp = np.zeros((sum(p)+1, W), int)\n row = 0\n sp[0] += arr[0]\n for j in range(H-1):\n if p[j]:\n row += 1\n sp[row] += arr[j+1]\n if np.max(sp) > K:\n continue\n \n sum_arr = np.zeros(len(sp), int)\n cut_cnt = sum(p)\n for c in range(W):\n sum_arr += sp[:, c]\n if max(sum_arr) > K:\n sum_arr = sp[:, c]\n cut_cnt += 1\n if cut_cnt < res:\n res = cut_cnt\nprint(res)', 'n, m = [int(i) for i in input().split()]\n\ndef calc(s):\n if s < 2:\n return int(0)\n else:\n return int(s * (s-1) / 2)\n\nprint(calc(n) + calc(m))\n']
['Runtime Error', 'Accepted']
['s081630927', 's753496990']
[12464.0, 2940.0]
[150.0, 17.0]
[641, 149]
p02729
u727717182
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['from sys import stdin\nfrom collections import Counter\n\ndef main():\n\n input = stdin.readline\n\n N = int(input())\n\n A = [0] * N\n\n A = list(map(int,input().split()))\n\n all_case = 0\n\n num_all = Counter(A) \n\n for k in num_all.values():\n all_case += (k * (k-1)) // 2\n\n for i in A:\n ans = all_case - (num_all[i] - 1)\n print(ans)\n \nif __name__ == "__main__":\n main()', 'from sys import stdin\n\ndef main():\n\n input = stdin.readline\n\n N,M = map(int,input().split())\n\n ans = 0\n\n ans += comb(N,2)\n ans += comb(M,2)\n\n print(ans)\n\n\ndef comb(n,k):\n min_k = min(k,n-k)\n\n if n < 2:\n return 0\n\n n_kaijyo = 1\n k_kaijyo = 1\n for i in range(min_k):\n n_kaijyo = n_kaijyo * (n - i)\n k_kaijyo = k_kaijyo * (i + 1)\n\n result = int(n_kaijyo / k_kaijyo)\n return result\n \nif __name__ == "__main__":\n main()']
['Runtime Error', 'Accepted']
['s182978549', 's243105806']
[3316.0, 3064.0]
[20.0, 18.0]
[408, 480]
p02729
u728318205
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nfrom decimal import *\nn = Decimal(l/3).quantize(Decimal('.001'))\n\nprint((l-2*n)*n*n)", 'n,m = map(int,input().split())\n\nprint(int(n*(n-1)/2 + m*(m-1)/2))\n\n']
['Runtime Error', 'Accepted']
['s621274078', 's468043141']
[2940.0, 2940.0]
[18.0, 17.0]
[102, 67]
p02729
u728483880
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['n,m=map(int,input().split())\n\nprint((n*(n-1)+m*(m-1))/2)\n', 'n,m=map(int,input().split())\n\nprint(int((n*(n-1)+m*(m-1))/2))\n']
['Wrong Answer', 'Accepted']
['s512303846', 's090762393']
[2940.0, 2940.0]
[17.0, 17.0]
[57, 62]
p02729
u732230060
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nrs = s[::-1]\nq1 = 0\nif s == rs:\n q1 = 1\n# print("q1=",q1)\n\n\nn = len(s)\nh = int((n-1)/2)\n# print("n,h=",n,h)\ns1 = s[:h:]\n# print("s1=",s1)\nrs1 = s1[::-1]\nq2 = 0\nif (s1 == rs1):\n q2 = 1\n# print("q2=",q2)\n\n\nn = len(s)\nh = int((n+2)/2)\n# print("n,h=",n,h)\ns2 = s[h::]\n# print("s2=",s2)\nrs2 = s2[::-1]\nq3 = 0\nif (s2 == rs2):\n q3 = 1\n# print("q3=",q3)\nif q1 == 1 and q2 == 1 and q3 ==1:\n print("Yes")\nelse:\n print("No")', 'lin = input().split()\nn = int(lin[0])\nm = int(lin[1])\nnp = 0\nif n >= 2:\n np = int(n * (n-1) / 2)\nop = 0\nif m >= 2:\n op = int(m * (m-1) / 2)\nprint(np+op)']
['Wrong Answer', 'Accepted']
['s729807988', 's742136541']
[3064.0, 3060.0]
[17.0, 19.0]
[713, 154]
p02729
u732390946
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 -*-\na, b = map(int, input().split())\ncnt = 0\n\n\nif a % 2 != 0:\n a = a - 1\n\n\n\n\n\nnCr = {}\n\n# https://qiita.com/derodero24/items/91b6468e66923a87f39f\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n, r) in nCr: return nCr[(n, r)]\n nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)\n return nCr[(n, r)]\n\n\n#\ncnt = cnt + cmb(a, 2) + cmb(b, 2)\nprint(cnt)\n', '# -*- coding: utf-8 -*-\na, b = map(int, input().split())\ncnt = 0\n\n\n#if a != 0:\n# if a % 2 != 0:\n# a = a - 1\n\n\n\n\n\nnCr = {}\n\n# https://qiita.com/derodero24/items/91b6468e66923a87f39f\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n, r) in nCr: return nCr[(n, r)]\n nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)\n return nCr[(n, r)]\n\n\n#\nif a != 0:\n cnt = cnt + cmb(a, 2)\ncnt = cnt + cmb(b, 2)\nprint(cnt)\n', '# -*- coding: utf-8 -*-\na, b = map(int, input().split())\ncnt = 0\n\n\n#if a != 0:\n# if a % 2 != 0:\n# a = a - 1\n\n\n\n\n\nnCr = {}\n\n# https://qiita.com/derodero24/items/91b6468e66923a87f39f\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n, r) in nCr: return nCr[(n, r)]\n nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)\n return nCr[(n, r)]\n\n\n#\nif a > 2:\n cnt = cnt + cmb(a, 2)\n\nif b > 2:\n cnt = cnt + cmb(b, 2)\nprint(cnt)\n', '# -*- coding: utf-8 -*-\na, b = map(int, input().split())\ncnt = 0\n\n\nif a != 0:\n if a % 2 != 0:\n a = a - 1\n\n\n\n\n\nnCr = {}\n\n# https://qiita.com/derodero24/items/91b6468e66923a87f39f\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n, r) in nCr: return nCr[(n, r)]\n nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)\n return nCr[(n, r)]\n\n\n#\nif a != 0:\n cnt = cnt + cmb(a, 2)\ncnt = cnt + cmb(b, 2)\nprint(cnt)\n', '# -*- coding: utf-8 -*-\na, b = map(int, input().split())\ncnt = 0\n\n\nif a != 0:\n if a % 2 != 0:\n a = a - 1\n\n\n\n\n\nnCr = {}\n\n# https://qiita.com/derodero24/items/91b6468e66923a87f39f\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n, r) in nCr: return nCr[(n, r)]\n nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)\n return nCr[(n, r)]\n\n\n#\ncnt = cnt + cmb(a, 2) + cmb(b, 2)\nprint(cnt)\n', '# -*- coding: utf-8 -*-\na, b = map(int, input().split())\ncnt = 0\n\n\n#if a != 0:\n# if a % 2 != 0:\n# a = a - 1\n\n\n\n\n\nnCr = {}\n\n# https://qiita.com/derodero24/items/91b6468e66923a87f39f\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n, r) in nCr: return nCr[(n, r)]\n nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)\n return nCr[(n, r)]\n\n\n#\nif a > 1:\n cnt = cnt + cmb(a, 2)\n\nif b > 1:\n cnt = cnt + cmb(b, 2)\nprint(cnt)\n']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s091573496', 's303587553', 's349487232', 's678792496', 's977095280', 's634581689']
[3936.0, 3932.0, 3064.0, 3932.0, 3936.0, 3064.0]
[81.0, 79.0, 17.0, 81.0, 79.0, 18.0]
[440, 487, 501, 484, 459, 501]
p02729
u735975757
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nnum1 = 1\nlist_M = []\n\nfor i in M:\n list_M.append(i)\n num1 += 1\n\nnum2 = 1\nlist_n = []\nfor j in N:\n list_N.append(j)\n num2 += 1\n\nadd_list = []\nfor k in M:\n for l in N:\n add_list.append(list_m[k] + list[l])\n\nodd = 0\n\nfor m in add_list:\n if m % 2 == 0:\n odd += 1\n \nprint(odd)\n ', 'n,m = map(int,input())\nif n >= 2:\n\tfor i in range(n):\n\t\ti *= i\nif m >= 2:\n\tfor j in range(m):\n \tj *= j\nprint(i+j//4)', 'm,n = map(int, input().split())\nprint(n*(n-1)//2+m*(m-1)//2)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s483311751', 's524410809', 's955581020']
[3060.0, 2940.0, 9176.0]
[18.0, 17.0, 27.0]
[325, 119, 61]
p02729
u737756998
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nprint(n*(n-1)/2+m*(m-1)/2)', 'n, m = (int(i) for i in input().split())\nprint(int(n*(n-1)/2+m*(m-1)/2))']
['Wrong Answer', 'Accepted']
['s827429611', 's226902100']
[2940.0, 3064.0]
[17.0, 19.0]
[67, 72]
p02729
u738898077
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nprint((n*(n-1))//2 + (m*(m-1))//2)', 'a,b=map(int,input().split());print((a**2-a+b**2-b)//2)']
['Runtime Error', 'Accepted']
['s138090553', 's010016047']
[2940.0, 2940.0]
[17.0, 17.0]
[61, 54]
p02729
u739843002
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['tmp = input().split(" ")\nN = int(tmp[0])\nM = int(tmp[1])\n\nprint(N * (N - 1) / 2 + M * (M - 1) / 2)', 'tmp = input().split(" ")\nN = int(tmp[0])\nM = int(tmp[1])\n \nans = N * (N - 1) / 2 + M * (M - 1) / 2\n\nprint(int(ans))']
['Wrong Answer', 'Accepted']
['s799893114', 's371502547']
[8948.0, 8848.0]
[29.0, 30.0]
[98, 115]
p02729
u740047492
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['n,m=map(int,input().split())\ncount=0\na=[]\nfor i in range(n):\n a.append(2)\nfor i in range(m):\n a.append(1)\n\nfor i in range(n+m-1):\n for j in range(i,n+m):\n if a[i]+a[j]%2==0:\n count+=1\nprint(count)', 'n,m=map(int,input().split())\ncount=0\na=[]\nfor i in range(n):\n a.append(2)\nfor i in range(m):\n a.append(1)\n#print(a)\n\nfor i in range(n+m-1):\n for j in range(i+1,n+m):\n #print(a[i],a[j])\n if (a[i]+a[j])%2==0:\n count+=1\nprint(count)']
['Wrong Answer', 'Accepted']
['s372611029', 's207326534']
[3064.0, 3060.0]
[20.0, 21.0]
[223, 263]
p02729
u740267532
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = int(input())\na = S//3\nb = a * 0.8\nc = a * 1.2\nans = a * b * c\nans = ans * 1.0416666666666666\nprint("{0:.7f}".format(ans))', 'N, M = map(int, input().split())\na = []\nb = []\nif M == 0:\n for i in range(1,(2*N)+1):\n if i%2==0 and i>0:\n a.append(i)\nelif N == 0:\n for i in range(1,(2*M)+1):\n if i%2==1:\n b.append(i)\nelse:\n for i in range(1,501):\n if i%2==0 and i>0:\n a.append(i)\n else:\n b.append(i)\nc = a[:N] + b[:M]\nl = []\nnum = 1\nfor i in range(len(c)-1):\n for j in range(num,len(c)):\n res = c[i] + c[j]\n l.append(res)\n num+=1\n\nk=[i for i in l if i%2==0]\nprint(len(k))']
['Runtime Error', 'Accepted']
['s009258699', 's496782547']
[3064.0, 3444.0]
[18.0, 24.0]
[125, 540]
p02729
u744695362
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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']
['s888960802', 's169711567']
[2940.0, 3064.0]
[17.0, 18.0]
[57, 62]
p02729
u747602774
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['a,b = map(int,input().split())\nprint(a*(a-1)/2 + b*(b-1)/2)', 'a,b = map(int,input().split())\nprint(a*(a-1)//2 + b*(b-1)//2)']
['Wrong Answer', 'Accepted']
['s989829314', 's278992824']
[2940.0, 2940.0]
[18.0, 20.0]
[59, 61]
p02729
u749742659
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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(int(n(n+1)/2 + m(m+1)/2))', 'n,m = map(int,input().split())\n\nprint(int(n*(n-1)/2 + m*(m-1)/2))']
['Runtime Error', 'Accepted']
['s480526359', 's755049573']
[2940.0, 3064.0]
[17.0, 17.0]
[63, 65]
p02729
u750257371
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nli = list(map(int, input().split()))\nn = li[0]\nm = li[1]\n\nprint(combinations_count(m, 2)+combinations_count(n, 2))\n', 'import math\n\n\ndef combinations_count(n, r):\n try:\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n except ValueError:\n return 0\n \n\nli = list(map(int, input().split()))\nn = li[0]\nm = li[1]\n\nprint(combinations_count(m, 2)+combinations_count(n, 2))\n']
['Runtime Error', 'Accepted']
['s542243327', 's690550280']
[3056.0, 3060.0]
[17.0, 17.0]
[236, 294]
p02729
u750651325
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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)\nlist_a = []\ncount = 0\n\nfor i in range(0, N):\n list_a.append(S[i])\n\nfor i in range(0, N):\n if list_a[i] == list_a[N-1-i]:\n count += 1\n else:\n pass\n\nfor j in range(0, int(N//2)):\n if list_a[j] == list_a[int((N-3-j)/2)] and list_a[int((N+1+j)/2)] == list_a[N-1-j]:\n count += 1\n else:\n pass\n\nif count > N:\n print("Yes")\nelse:\n print("No")\n', 'N, M = map(int, input().split())\nsum_a = 0\nsum_b = 0\n\nif N % 2 == 0:\n sum_a = (N/2) * (N-1)\nelse:\n sum_a = N * ((N-1)/2)\n\nif M % 2 == 0:\n sum_b = (M/2) * (M-1)\nelse:\n sum_b = M * ((M-1)/2)\n\nsum = sum_a + sum_b\n\nprint(int(sum))\n']
['Wrong Answer', 'Accepted']
['s445326158', 's970225192']
[3064.0, 3060.0]
[20.0, 17.0]
[407, 239]
p02729
u754511616
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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()))\nx=a/2*(a-1)+b/2*(b-1)\nprint(x)', 'a,b=list(map(int,input().split()))\nx=int(a/2*(a-1)+b/2*(b-1))\nprint(x)']
['Wrong Answer', 'Accepted']
['s891292387', 's157117551']
[9152.0, 9064.0]
[30.0, 29.0]
[65, 70]
p02729
u755180064
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
["def main():\n input()\n t = list(map(int, input().split()))\n col = collections.Counter(t)\n com = {}\n al = 0\n for key in col:\n com[key] = combinations_count(col[key], 2)\n al += com[key]\n for v in t:\n c = col[v] - 1\n if c <= 1:\n c = 0\n else:\n c = combinations_count(c, 2)\n tmp = (al - com[v]) + c\n print(tmp)\n\n\nif __name__ == '__main__':\n main()", '\nurl = "https://atcoder.jp//contests/abc159/tasks/abc159_a"\n\ndef main():\n e, v = list(map(int, input().split()))\n lis = []\n for i in range(e):\n lis.append(1)\n for i in range(v):\n lis.append(2)\n count = 0\n for i in range(len(lis)):\n for j in range(i + 1, len(lis)):\n # print(lis[i], lis[j])\n if (lis[i] + lis[j]) % 2 == 0:\n count += 1\n print(count)\n\nif __name__ == \'__main__\':\n main()\n']
['Runtime Error', 'Accepted']
['s425883650', 's901269250']
[3064.0, 3064.0]
[18.0, 20.0]
[436, 466]
p02729
u755989869
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 utility\n\nn,m = map(int, input().split(" "))\n\nresult = 0\nif(n >=1):\n result = result + n*(n-1)/2\n\nif(m >=1):\n result = result + m*(m-1)/2\n\nprint(int(result))', 'n,m = map(int, input().split(" "))\n\nresult = 0\nif(n >=1):\n result = result + n*(n-1)/2\n\nif(m >=1):\n result = result + m*(m-1)/2\n\nprint(int(result))']
['Runtime Error', 'Accepted']
['s757668576', 's010066887']
[2940.0, 2940.0]
[17.0, 17.0]
[169, 153]
p02729
u758884263
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['from scipy.misc import comb\n\n#from scipy.special import comb\n\ndef main():\n n, m = map(int, input().split(" "))\n ans = comb(n, 2) + comb(m, 2)\n\n print(ans)\n\nif __name__ == \'__main__\':\n main()', 'import itertools\nimport numpy as np\n\ndef main():\n n, m = map(int, input().split(" "))\n ans = 0\n for i in [n, m]:\n iterable = np.arange(start=1, stop=i+1, step=1).astype("str")\n ans += len(list(itertools.combinations(iterable, 2)))\n\n\n print(ans)\n\nif __name__ == \'__main__\':\n main()\n\n']
['Wrong Answer', 'Accepted']
['s359671364', 's381774684']
[14108.0, 12392.0]
[187.0, 150.0]
[202, 311]
p02729
u758973277
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = N*(N-1)/2\nans2 = M*(M-1)/2\nA = ans1+ans2\nprint(A)', 'N,M = map(int,input().split())\nans1 = N*(N-1)//2\nans2 = M*(M-1)//2\nA = ans1+ans2\nprint(A)']
['Wrong Answer', 'Accepted']
['s297457867', 's790089451']
[2940.0, 2940.0]
[17.0, 17.0]
[87, 89]
p02729
u759718348
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nn = 0\nm = 0\nif N <= 1:\n n = N\nelse:\n n = (N*(N-1))/2\nif M <= 1:\n m = M\nelse:\n m = (M*(M-1))/2\nprint(int(n + m))\n\n\n\n', 'N,M = map(int, input().split()) \n\nn = 0\nm = 0\nif N <= 1:\n n = 0\nelse:\n n = (N*(N-1))/2\nif M <= 1:\n m = 0\nelse:\n m = (M*(M-1))/2\nprint(int(n + m))\n\n\n\n']
['Wrong Answer', 'Accepted']
['s382861732', 's871250496']
[2940.0, 2940.0]
[17.0, 17.0]
[153, 153]
p02729
u760961723
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nC1 = N*(N-1)/2\nC2 = M*(M-1)/2\n\nprint(C1 + C2)\n', 'N, M = map(int,input().split())\nC1 = N*(N-1)//2\nC2 = M*(M-1)//2\n\nprint(C1 + C2)']
['Wrong Answer', 'Accepted']
['s646990867', 's384041726']
[2940.0, 2940.0]
[18.0, 19.0]
[78, 79]
p02729
u763177133
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = input().split()\n \nfor i in range(n):\n b = a[:]\n del b[i]\n k = 0\n c = set(b)\n for t in c:\n num = b.count(t)\n for i in range(num):\n k += i\n print(k)', 'n, m = input().split()\n\nn = int(n)\nm = int(m)\nj = 0\nfor i in range(1, n):\n j += i\n \nfor i in range(1, m):\n j += i\n \nprint(j)']
['Runtime Error', 'Accepted']
['s297974930', 's044420695']
[3060.0, 2940.0]
[17.0, 18.0]
[184, 128]
p02729
u763534217
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 \nln = [2*i for i in range(1, n+1)]\nlm = [2*i+1 for i in range(m)]\n \nc = 0\nfor i in ln:\n for j in lm:\n if (i+j)%2==0:\n c+=1\nfor i in lm:\n for j in lm:\n if (i+j)%2==0:\n c+=1\nfor i in ln:\n for j in ln:\n if (i+j)%2==0:\n c+=1\nprint(c)', 'n, m = map(int, input().split())\n\nln = [2*i for i in range(1, n+1)]\nlm = [2*i+1 for i in range(m)]\n\nc = 0\nfor i in ln:\n for j in lm:\n if (i+j)%2==0:\n c+=1\nprint(c)', 'n, m = map(int, input().split())\nc = 0\nc += n*(n-1)/2\nc += m*(m-1)/2\nprint(c)', 'n, m = map(int, input().split())\n \nc = 0\n\nif n!=0:\n c+= n*(n-1)/2\nif m!=0:\n c+= m*(m-1)/2\nprint(c)', 'n, m = map(int, input().split())\n \nln = [2*i for i in range(1, n+1)]\nlm = [2*i+1 for i in range(m)]\n \nc = 0\nfor i in ln:\n for j in lm:\n if (i+j)%2==0:\n c+=1\nc+= n*(n-1)/2\nc+= m*(m-1)/2\nprint(c)', 'n, m = map(int, input().split())\nc = 0\nif n!=0:\n c+= n*(n-1)/2\nprint(c)', 'n, m = map(int, input().split())\nc = 0\nc += int(n*(n-1)/2)\nc += int(m*(m-1)/2)\nprint(c)']
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s184132987', 's210256722', 's301616324', 's423062511', 's663195449', 's982802033', 's633092092']
[3064.0, 2940.0, 2940.0, 2940.0, 3060.0, 2940.0, 2940.0]
[22.0, 19.0, 17.0, 17.0, 19.0, 18.0, 17.0]
[290, 172, 77, 100, 202, 72, 87]
p02729
u763628696
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 != 0) and (b != 0):\n print(str(int(a*(a-1)/2 + b*(b-1)/2)))\nelif (a == 0) and (b == 0):\n print("0") \nelif (a == 0) and (b != 0):\n print(str(int((b*(b-1)/2)))\nelse:\n print(str(int((a*(a-1)/2)))', 'a,b = map(int,input().split())\nif (a >= 1) and (b >= 1):\n print(str(a*(a-1)/2 + b*(b-1)/2))\nelif (a == 0) and (b == 0):\n print(str("0")\nelif (a == 0):\n print(str(b*(b-1)/2))\nelse:\n print(str(a*(a-1)/2))\n', 'a,b = map(int,input().split())\nprint(str(a*(a-1)/2 + b*(b-1)/2))', 'a,b = map(int,input().split())\nif (a != 0) and (b != 0):\n print(str(a*(a-1)/2 + b*(b-1)/2))\nelif (a == 0) and (b == 0):\n print("0") \nelif (a == 0) and (b != 0):\n print(str(b*(b-1)/2))\nelse:\n print(str(a*(a-1)/2))', 'a,b = map(int,input().split())\nif (a != 0) and (b != 0):\n print(str(int(a*(a-1)/2 + b*(b-1)/2)))\nelif (a == 0) and (b == 0):\n print("0") \nelif (a == 0) and (b != 0):\n print(str(int(b*(b-1)/2)))\nelse:\n print(str(int(a*(a-1)/2)))']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s254533886', 's619654696', 's700297075', 's835581011', 's559275275']
[8940.0, 8812.0, 9160.0, 8936.0, 9200.0]
[28.0, 20.0, 33.0, 24.0, 32.0]
[246, 215, 64, 229, 244]
p02729
u766051499
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
["import sys\nfrom math import factorial\n\nN, M = (int(s) for s in sys.stdin.split(' '))\n\ntotal = 0\nif N > 1:\n total += factorial(N) / factorial(N - 2) / 2\nif M > 1:\n total += factorial(M) / factorial(M - 2) / 2\n \nprint(total)", "import sys\nfrom math import factorial\n\nline = input()\nN, M = (int(s) for s in line.split(' '))\n\ntotal = 0\nif N > 1:\n total += factorial(N) / factorial(N - 2) / 2\nif M > 1:\n total += factorial(M) / factorial(M - 2) / 2\n\nprint(total)", "import sys\nfrom math import factorial\n\nline = input()\nN, M = (int(s) for s in line.split(' '))\n\ntotal = 0\nif N > 1:\n total += factorial(N) / factorial(N - 2) / 2\nif M > 1:\n total += factorial(M) / factorial(M - 2) / 2\n\nprint(int(total))"]
['Runtime Error', 'Wrong Answer', 'Accepted']
['s213678790', 's931584657', 's633348402']
[3060.0, 3060.0, 3064.0]
[17.0, 24.0, 18.0]
[225, 233, 238]
p02729
u767821815
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 resolve():\n import itertools\n N,M = map(int,input().split())\n N_list = [int(x) for x in range(N)]\n M_list = [int(y) for y in range(M)]\n\n n = len(list(itertools.combinations(N_list,2)))\n m = len(list(itertools.combinations(M_list,2)))\n print(n+m)\n\nif __name__ == "__main__":\n main() ', 'def resolve():\n import itertools\n N,M = map(int,input().split())\n N_list = [int(x) for x in range(N)]\n M_list = [int(y) for y in range(M)]\n\n n = len(list(itertools.combinations(N_list,2)))\n m = len(list(itertools.combinations(M_list,2)))\n print(n+m)\n\nresolve()']
['Runtime Error', 'Accepted']
['s480236591', 's467495495']
[3064.0, 3444.0]
[18.0, 19.0]
[312, 281]
p02729
u771538568
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['n, m = map(int, input().split())\na=(n*(n-1))/2+(m*(m-1))/2\nprint(a)', 'n, m = map(int, input().split())\na=(n*(n-1))/2+(m*(m-1))/2\na=int(a)\nprint(a)']
['Wrong Answer', 'Accepted']
['s809997501', 's729919587']
[2940.0, 2940.0]
[19.0, 17.0]
[67, 76]
p02729
u778623968
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['n, m = map(int, input().split())\nprint(n(n-1)//2 + m(m-1)//2)', 'n, m = map(int, input().split())\nprint(n*(n-1)//2 + m*(m-1)//2)\n']
['Runtime Error', 'Accepted']
['s660483910', 's584452079']
[2940.0, 2940.0]
[18.0, 17.0]
[61, 64]
p02729
u779293207
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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/2+M/2)\n', 'N,M= map(int,input().split())\nprint(N*(N-1)/2+M*(M-1)/2)', 'N,M= map(int,input().split())\nprint(N*(N-1)//2+M*(M-1)//2)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s363588989', 's907513727', 's761148732']
[2940.0, 2940.0, 2940.0]
[18.0, 18.0, 19.0]
[46, 56, 58]
p02729
u779728630
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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']
['Wrong Answer', 'Accepted']
['s205359595', 's326763872']
[2940.0, 2940.0]
[17.0, 18.0]
[63, 64]
p02729
u794858045
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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']
['s296282514', 's355765620']
[2940.0, 2940.0]
[17.0, 18.0]
[55, 57]
p02729
u796044734
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['N,M = map(int,input().split)\n\nx = int( N*(N-1)/2 + M*(M-1)/2 )\n\nprint(x)', 'N,M = map(int,input().split())\n\nx = int( N*(N-1)/2 + M*(M-1)/2 )\n\nprint(x)\n']
['Runtime Error', 'Accepted']
['s770779565', 's808030912']
[2940.0, 2940.0]
[17.0, 18.0]
[72, 75]
p02729
u797421335
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls.
['data = input().split(" ")\n\nN = int(data[0])\nM = int(data[1])\n\nans = N*(N-1)/2\nans += M*(M-1)/2\n\nprint(ans)\n', 'data = input().split(" ")\n \nN = int(data[0])\nM = int(data[1])\n \nans = N*(N-1)/2\nans += M*(M-1)/2\n \nprint(int(ans))']
['Wrong Answer', 'Accepted']
['s984780726', 's333903878']
[2940.0, 2940.0]
[17.0, 17.0]
[107, 114]
p02729
u799215419
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nfrom scipy.misc import comb\n\nN, M = map(int, input().split())\nprint(math.ceil(comb(N, 2))+math.ceil(comb(M, 2)))', 'def comb(a):\n if a < 2:\n return 0\n else:\n return a * (a-1) // 2\n\n\nN, M = map(int, input().split())\nprint(comb(N)+comb(M))\n']
['Wrong Answer', 'Accepted']
['s382424991', 's966676318']
[21372.0, 2940.0]
[292.0, 17.0]
[124, 142]
p02729
u801573951
2,000
1,048,576
We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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(""))\nans = 0\nif N == 1 :\n if M != 1 :\n ans = M * (M - 1)\nelse :\n if M == 1 :\n ans = N * (N - 1)\n else :\n ans = M * (M - 1) + N * (N - 1)\nprint(ans)\n', 'n = input("")\nm = input("")\nN = int(n)\nM = int(m)\na = N*(N-1) if N*(N-1) >= 0 else 0\nb = M*(M-1) if M*(M-1) >= 0 else 0\nprint(a + b)', 'n,m = input("")\nN = int(n)\nM = int(m)\na = N*(N-1) if N*(N-1) >= 0 else 0\nb = M*(M-1) if M*(M-1) >= 0 else 0\nprint(a + b)', 'num = input("")\nnum = num.split(" ")\nN = int(num[0])\nM = int(num[1])\na = N*(N-1) if N*(N-1) >= 0 else 0\nb = M*(M-1) if M*(M-1) >= 0 else 0\nprint(a + b)', 'num = input("")\nnum = num.split(" ")\nN = int(num[0])\nM = int(num[1])\na = int(N*(N-1)/2) if N*(N-1) >= 0 else 0\nb = int(M*(M-1)/2) if M*(M-1) >= 0 else 0\nprint(a + b)\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s092352798', 's299597742', 's511953896', 's630250139', 's153186989']
[2940.0, 3060.0, 2940.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0, 17.0, 17.0]
[193, 132, 120, 151, 166]