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 | u200228637 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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()\nd = len(s)//2\nprint("Yes" if s[:d] == s[d+1:] "No" else)', 'n, m = map(int, input().split())\nprint(n*(n-1)//2 + m*(m-1)//2)'] | ['Runtime Error', 'Accepted'] | ['s175010438', 's689871329'] | [2940.0, 2940.0] | [17.0, 17.0] | [68, 63] |
p02729 | u201387466 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import sys\ninput=sys.stdin.readline\nN,M = map(int,input().split())\nnCr = {}\ndef cmb(n, r):\n if r == 0 or r == n:\n return 1\n if r == 1:\n return n\n if (n,r) in nCr:\n return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n return nCr[(n,r)]\n\na = cmb(N,2)\nb = cmb(M,2)\nprint(a+b)', 'import sys\ninput=sys.stdin.readline\nN,M = map(int,input().split())\nnCr = {}\ndef cmb(n, r):\n if n == 0:\n return 0\n if r == 0 or r == n:\n return 1\n if r == 1:\n return n\n if (n,r) in nCr:\n return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n return nCr[(n,r)]\n\na = cmb(N,2)\nb = cmb(M,2)\nprint(a+b)\n'] | ['Runtime Error', 'Accepted'] | ['s912445257', 's783461445'] | [4028.0, 3064.0] | [75.0, 18.0] | [317, 350] |
p02729 | u201802797 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['# solution\n\nn,m = map(int,input().split())\nprint("solution is")\nprint(n*(n-1)//2 + m*(m-1)//2)', '# solution\n\nn,m = map(int,input().split())\nprint(n*(n-1)//2 + m*(m-1)//2)'] | ['Wrong Answer', 'Accepted'] | ['s879337193', 's691638000'] | [2940.0, 2940.0] | [18.0, 17.0] | [94, 73] |
p02729 | u201921821 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\nresult = (N+M)*(N+M-1)/2 - N*M\nprint(result)', 'N, M = map(int, input().split())\nresult = (N+M)*(N+M-1)/2 - N*M\nprint(int(result))'] | ['Wrong Answer', 'Accepted'] | ['s692835060', 's550636522'] | [2940.0, 2940.0] | [17.0, 17.0] | [77, 82] |
p02729 | u202112682 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\nN, M = list(map(int, input().split()))\nprint(math.factorial(N) // (2*math.factorial(N-2)) + math.factorial(M) // (2*math.factorial(M-2)))', 'import math\nN, M = list(map(int, input().split()))\nn_pairs = math.factorial(N) // (2*math.factorial(N-2)) if N > 1 else 0\nm_pairs = math.factorial(M) // (2*math.factorial(M-2)) if M > 1 else 0\nprint(n_pairs + m_pairs)'] | ['Runtime Error', 'Accepted'] | ['s763714156', 's041894899'] | [2940.0, 3316.0] | [17.0, 22.0] | [149, 217] |
p02729 | u204842730 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nn,m = map(int,input().split())\nif n<1 and m<1:\n print(0)\nelif n<1:\n print(combinations_count(m,2))\nelif m<1:\n print(combinations_count(n,2))\nelse:\n print(combinations_count(n,2)+combinations_count(m,2))', 'import math\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nn,m = map(int,input().split())\nif n<2 and m<2:\n print(0)\nelif n<2:\n print(combinations_count(m,2))\nelif m<2:\n print(combinations_count(n,2))\nelse:\n print(combinations_count(n,2)+combinations_count(m,2))'] | ['Runtime Error', 'Accepted'] | ['s113763405', 's663032247'] | [3060.0, 3060.0] | [17.0, 17.0] | [332, 332] |
p02729 | u205087376 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["n,m = map(int,input().split())\nif n == 0:\n print(m*(m-1)/2)\nelif n == 1:\n if m == 1:\n print('0')\n else:\n print(m*(m-1)/2)\nelif m == 0:\n print(n*(n-1)/2)\nelif m == 1 and n>=2:\n print(n*(n-1)/2)\nelse:\n print(m*(m-1)/2 + n*(n-1)/2)", "n,m = map(int,input().split())\nif n == 0:\n print(m*(m-1)/2)\nelif n == 1:\n if m == 1:\n print('0')\n else:\n print(m*(m-1)/2)\nelif m == 0:\n print(n*(n-1)/2)\nelif m == 1 and n>=2:\n print(n*(n-1)/2)\nelse:\n print(m*(m-1)/2 + n*(n-1)/2)", "n,m = map(int,input().split())\nif n == 0:\n print(int(m*(m-1)/2))\nelif n == 1:\n if m == 1:\n print('0')\n else:\n print(int(m*(m-1)/2))\nelif m == 0:\n print(int(n*(n-1)/2))\nelif m == 1 and n>=2:\n print(int(n*(n-1)/2))\nelse:\n print(int(m*(m-1)/2 + n*(n-1)/2))"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s214163639', 's627872804', 's243393718'] | [3060.0, 3060.0, 3064.0] | [17.0, 17.0, 18.0] | [240, 240, 265] |
p02729 | u206570055 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nans = math.factorial(n) / math.factorial(n - 2) / 2\nans += math.factorial(m) / math.factorial(m - 2) / 2\nprint(int(ans))', 'import math\n\nn, m = map(int, input().split())\nif n <= 1:\n ans = 0\nelse:\n ans = math.factorial(n) / math.factorial(n - 2) / 2\nif m <= 1:\n ans += 0\nelse:\n ans += math.factorial(m) / math.factorial(m - 2) / 2\nprint(int(ans))'] | ['Runtime Error', 'Accepted'] | ['s388095052', 's916989855'] | [2940.0, 3060.0] | [17.0, 17.0] | [166, 237] |
p02729 | u207799478 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 string\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not(item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n+1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\n\nn, m = map(int, input().split())\n#print(n, m)\nif n == 1:\n print(0)\n exit()\na = nCr(n, 2)\nprint(a+m)\n', 'import math\nimport string\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not(item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n+1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\n\nn, m = map(int, input().split())\n#print(n, m)\nif n == 1:\n print(0)\n exit()\nif n == 0:\n print(m)\n exit()\na = nCr(n, 2)\nprint(a+m)\n', 'import math\nimport string\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not(item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n+1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\n\nn, m = map(int, input().split())\n#print(n, m)\nif n == 1:\n print(math.floor(m/2))\n exit()\nif n == 0:\n print(m)\n exit()\na = nCr(n, 2)\nprint(a+m)\n', 'import math\nimport string\nimport collections\nfrom collections import Counter\n\n\ndef readints():\n return list(map(int, input().split()))\n\n\ndef nCr(n, r):\n return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))\n\n\ndef has_duplicates2(seq):\n seen = []\n for item in seq:\n if not(item in seen):\n seen.append(item)\n return len(seq) != len(seen)\n\n\ndef divisor(n):\n divisor = []\n for i in range(1, n+1):\n if n % i == 0:\n divisor.append(i)\n return divisor\n\n\n# coordinates\ndx = [-1, -1, -1, 0, 0, 1, 1, 1]\ndy = [-1, 0, 1, -1, 1, -1, 0, 1]\n\n\nn, m = map(int, input().split())\nprint(n*(n-1)//2+m*(m-1)//2)\n'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s102947027', 's215986051', 's508451534', 's513428958'] | [3832.0, 3832.0, 3832.0, 3832.0] | [27.0, 27.0, 24.0, 24.0] | [655, 690, 704, 662] |
p02729 | u208133431 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['def is_kaibun(kaibun):\n for i in range(len(kaibun)//2):\n if kaibun[i] != kaibun[-i-1]:\n return False\n return True\ns = str(input())\nif is_kaibun(s)==True:\n ku = int((len(s)-1)/2)\n news = s[:ku]\n if len(news) ==1:\n print("Yes")\n else:\n a = 0\n for a in range(len(news)//2):\n if news[a] != news[-a-1]:\n print("No")\n break\n ks = int((len(s)+1)/2)\n news = s[ks:]\n b = 0\n for b in range(len(news)//2):\n if news[b] != news[-b-1]:\n print("No")\n break\n print("Yes")\nelse:\n print("No")', 'n,m=map(int,input().split())\nprint(int(((n*(n-1))/2)+((m*(m-1))/2)))'] | ['Wrong Answer', 'Accepted'] | ['s676161638', 's970613125'] | [3064.0, 2940.0] | [18.0, 18.0] | [651, 68] |
p02729 | u209559874 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['inp = str(input())\nn, m = tuple(inp.split())\nm_calculation = math.factorial(m)/2**(m/2)*math.factorial(m/2)\nn_calculation = math.factorial(n)/2**(n/2)*math.factorial(n/2)\nprint(n_calculation + m_calculation)', "import math\n \ndef combinations_count(n, r):\n if n == 1 or n == 0:\n return 0\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n \nif __name__ == '__main__':\n a,b=map(int,input().split())\n e_2 = combinations_count(a,2)", 'import math\n\ndef combinations_count(n, r):\n if n == 1:\n return 0\n if n == 0:\n return 0\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n \n\na,b=map(int,input().split())\ne_2 = combinations_count(a,2)', 'n,m = map(int,input().split())\n \nprint(n*(n-1)//2+m*(m-1)//2)'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s051174872', 's275122795', 's419578871', 's630217485'] | [2940.0, 3060.0, 3060.0, 2940.0] | [16.0, 17.0, 17.0, 17.0] | [207, 257, 245, 61] |
p02729 | u211277872 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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/2)', '\na, b = input().strip().split()\na, b = [int(a), int(b)]\ns1 = a * (a - 1) / 2 \ns2 = b * (b - 1) / 2 \n\nprint(s1 + s2)', '\na, b = map(int, input().split())\ns1 = a * (a - 1) \ns2 = b * (b - 1) \n\nprint(s1 + s2)', 'n, m = map(int, input().split())\nprint((n+m)*(n+m-1)/2-n*m)\n', 'n, m = map(int, input().split())\nprint((n+m)*(n+m+1)/2-n*m/2)', 'a, b = list(map(int, input().strip().split())) \ns1 = a * (a - 1) /2 \ns2 = b * (b - 1) /2 \n\nprint(s1 + s2)', '\na, b = map(int, input().split())\ns1 = a * (a - 1) / 2 \ns2 = b * (b - 1) / 2 \n\nprint(s1 + s2)', 'n, m = map(int, input().split())\nprint(((n+m)*(n+m-1)/2-n*m)//1)\n', 'm, n = map(int, input().split())\nprint(int(n*(n-1)/2+m*(m-1)/2))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s075283426', 's269385846', 's329953910', 's350875767', 's491377437', 's695972173', 's832763848', 's866787741', 's159150866'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0, 17.0, 18.0, 17.0, 18.0, 17.0] | [60, 190, 160, 60, 61, 166, 168, 65, 64] |
p02729 | u212263866 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['\ndef check_str( ss ):\n sslen = len(ss)\n \n ccnt = 0\n for c in ss:\n if( ss[0] == c ):\n ccnt+=1\n \n if( sslen == ccnt ):\n return False\n \n return (ss[:sslen//2] == ss[sslen//2+1:][::-1])\n \ns = input()\n\nslen = len(s)\n\nif( not check_str( s ) ):\n print( "No" )\nelse:\n#print(s[:slen//2])\n#print(s[slen//2+1:][::-1])\n\n s1 = s[:slen//2]\n s2 = s[slen//2+1:]\n \n \n if( (not check_str( s1 )) or (not check_str( s2 )) ):\n print( "No" )\n else:\n print( "Yes" )\n\n#s1 = s[:len(s)-1]\n\n#s1\n\n', 'elms = input().split(" ")\n\nN= int(elms[0])\nM= int(elms[1])\n\n\nev =N * (N-1)\nev= ev/2 \n\nod = M*(M-1)\nod = od/2\n\nprint(int(ev+od))\n'] | ['Wrong Answer', 'Accepted'] | ['s608769369', 's664905643'] | [3064.0, 2940.0] | [19.0, 17.0] | [503, 128] |
p02729 | u217086212 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m = list(map(int, split()))\n\nprint(n*(n-1)/2 + m*(m-1)/2)', 'n,m = list(map(int, input().split()))\n\nprint(int(n*(n-1)/2 + m*(m-1)/2))'] | ['Runtime Error', 'Accepted'] | ['s204375954', 's597551381'] | [2940.0, 2940.0] | [17.0, 17.0] | [59, 72] |
p02729 | u218216885 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nn, m = [int(i) for i in input().split()]\nprint(combinations_count(n,2)+combinations_count(m,2))', 'import math\n\ndef combinations_count(n, r):\n if n<r:\n return 0\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nn, m = [int(i) for i in input().split()]\nprint(combinations_count(n,2)+combinations_count(m,2))'] | ['Runtime Error', 'Accepted'] | ['s747061189', 's766077553'] | [3056.0, 3060.0] | [17.0, 19.0] | [216, 245] |
p02729 | u218506594 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\nn,m = map(int, input().split())\n\ndef c(s,t):\n if s == 0 or s == 1:\n return 0\n return math.factorial(s)/(math.factorial(s-t)*math.fatorial(t))\n\nprint(c(n,2)+c(m,2))', 'import math\nn,m = map(int, input().split())\n\ndef c(s,t):\n if s == 0 or s == 1:\n return 0\n return math.factorial(s)/(math.factorial(s-t)*math.factorial(t))\n\nprint(int(c(n,2)+c(m,2)))'] | ['Runtime Error', 'Accepted'] | ['s977018590', 's283175365'] | [3060.0, 3060.0] | [18.0, 18.0] | [188, 194] |
p02729 | u219937318 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\n\nprint(N*(N-1)/2+M*(M-1)/2)', 'N,M=map(int,input().split())\n\nprint((N*(N-1)/2)+(M*(M-1)/2))', 'N,M=map(int,input().split())\n\nprint((N*(N-1)/2)+(M*(M-1)/2))\n', 'N,M=map(int,input().split())\n\nprint(N*(N-1)/2+M*(M-1)/2)\n', 'N,M=map(int,input().split())\n\nprint((N*(N-1)//2)+(M*(M-1)//2))'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s134695568', 's294668070', 's777449273', 's791457015', 's499259162'] | [2940.0, 2940.0, 2940.0, 3060.0, 2940.0] | [17.0, 17.0, 16.0, 19.0, 17.0] | [52, 60, 61, 57, 62] |
p02729 | u221149873 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = (int(input()))\nitems = list(map(int,input().split()))\nfor i in range(len(items)): \n rest = items[:i] + items[i+1:]\n rest_unique = sorted(set(rest))\n out = 0\n for j in rest_unique:\n cnt = sum([1 for x in rest if x == j])\n if cnt >= 2:\n out = out + math.factorial(cnt)/math.factorial(cnt-2)/2\n print(int(out))', 'import math\ne,o = map(int,input().split())\nif e < 2:\n e_cases = 0\nelse:\n e_cases = math.factorial(e)/math.factorial(e-2)/2\nif o < 2:\n o_cases = 0\nelse:\n o_cases = math.factorial(o)/math.factorial(o-2)/2\nprint(e_cases+o_cases)', 'import math\ne,o = map(int,input().split())\nif e < 2:\n e_cases = 0\nelse:\n e_cases = math.factorial(e)/math.factorial(e-2)/2\nif o < 2:\n o_cases = 0\nelse:\n o_cases = math.factorial(o)/math.factorial(o-2)/2\nprint(int(e_cases+o_cases))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s046117238', 's649990391', 's652342344'] | [3064.0, 3060.0, 3060.0] | [18.0, 18.0, 18.0] | [366, 237, 242] |
p02729 | u221272125 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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)\np = (n-1)//2\nq = (n+3)//2 - 1\nA = S[:p]\nB = S[q:]\nans = 'Yes'\nfor i in range(len(S)):\n if S[i] != S[-i-1]:\n ans = 'No'\nfor i in range(len(A)):\n if A[i] != A[-i-1]:\n ans = 'No'\nfor i in range(len(B)):\n if B[i] != B[-i-1]:\n ans = 'No'\nprint(ans)\n", 'N,M = map(int,input().split())\nans = (N*(N-1))//2 + (M*(M-1))//2\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s025497110', 's558008322'] | [3064.0, 2940.0] | [17.0, 17.0] | [297, 75] |
p02729 | u224119985 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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().splt())\nans=((n*(n-1))/2)+(m*(m-1))/2\nprint(int(ans))', 'n,m=map(int,input().split())\nprint((n*(n-1)/2)+(m*(m-1)/2))', 'n,m=map(int,input().splt())\nans=((n*(n-1))/2)+(m*(m-1))/2\nprint(ans)', 'n,m=map(int,input().split())\nans=((n*(n-1))/2)+(m*(m-1))/2\nprint(ans)', 'n,m=map(int,input().split())\nans=((n*(n-1))/2)+(m*(m-1))/2\nprint(int(ans))'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s469452548', 's476293328', 's487749379', 's636659489', 's008174103'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 18.0, 17.0] | [73, 59, 68, 69, 74] |
p02729 | u224554402 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nprint(int((M-1)*M/2+(N-1)*N/2))', 'N=int(input())\nM=int(input())\nsum_N = (N-1)*N/2\nsum_M=(M-1)*M/2\nsum_all = sum_N + sum_M\nprint(int(sum_all))', 'N=int(input())\nM=int(input())\nsum_N = (N-1)*N/2\nsum_M=(M-1)*M/2\nsum_all = sum_N + sum_M\nprint(int(sum_all))', 'inp=str(input())\nN= int(inp.split()[0])\nM=int(inp.split()[1])\nn= abs(N)\nm=abs(M)\nsum_N = (N-1)*N/2\nsum_M=(M-1)*M/2\nsum_all = sum_N + sum_M\nprint(int(sum_all))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s650176406', 's745616949', 's794101113', 's037633146'] | [2940.0, 2940.0, 2940.0, 3188.0] | [17.0, 17.0, 18.0, 18.0] | [62, 107, 107, 158] |
p02729 | u228303592 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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) + m*(m-1))/2\n\nprint(ans)', 'n,m = map(int,input().split())\n\nans = (n*(n-1) + m*(m-1))/2\n\nprint(ans)', 'import math\nn,m = map(int,input().split())\n\nans = (n*(n-1) + m*(m-1))/2\n\nprint(math.floor(ans))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s443029285', 's716842586', 's623978580'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0] | [71, 71, 95] |
p02729 | u231038326 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n , m= list(map(int,input().split()))\n\nans= 0\n\nans+= n*(n-1)/2\nans+= m* (m-1)/2\n\nprint(ans)\n\n', 'n , m= list(map(int,input().split()))\n\n\ns= n*(n-1)//2\nt= m* (m-1)//2\n\nprint(s+t)\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s231902457', 's516878398'] | [2940.0, 2940.0] | [17.0, 17.0] | [94, 83] |
p02729 | u233254147 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\n \ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn = int(input())\na_list = list(map(int, input().split()))\na_list.append(n + 100)\n\nfor i in range(len(a_list) - 1):\n tmp_list = a_list[:]\n del tmp_list[i]\n tmp_list.sort()\n count = 0\n tmp_count = 0\n for j in range(1, len(tmp_list)):\n if tmp_list[j] == tmp_list[j - 1]:\n tmp_count += 1\n else:\n if tmp_count >= 1:\n \tcount += comb(tmp_count + 1, 2)\n tmp_count = 0\n print(count)\n ', "def checkPalindrome(str1, str2):\n for i in range(len(str1) // 2):\n if str1[i] != str2[i]:\n return False\n return True\n \ns = input()\nrs = ''.join(list(reversed(s)))\ncri1 = checkPalindrome(s, rs)\n\ns2 = s[:len(s) // 2]\nrs2 = ''.join(list(reversed(s2)))\ncri2 = checkPalindrome(s2, rs2)\n\ns3 = s[len(s) // 2 + 1:len(s)]\nrs3 = ''.join(list(reversed(s3)))\ncri3 = checkPalindrome(s3, rs3)\n\nif cri1 and cri2 and cri3:\n print('Yes')\nelse:\n print('No')", 'import math\n\ndef comb(n, r):\n\treturn math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nnums = list(map(int, input().split()))\n\nif nums[0] <= 1 and nums[1] <= 1:\n print(0)\nelif nums[1] <= 1:\n print(comb(nums[0], 2))\nelif nums[0] <= 1:\n print(comb(nums[1], 2))\nelse:\n print(comb(nums[0], 2) + comb(nums[1], 2))\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s137284648', 's586691895', 's303335720'] | [3064.0, 3064.0, 3060.0] | [18.0, 17.0, 18.0] | [513, 454, 329] |
p02729 | u236823931 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["if __name__ == '__main__':\n n , m = map(int, input().split())\n print(((n * n - 1) / 2 )+ ((m * m - 1)/2))", "if __name__ == '__main__':\n n , m = map(int, input().split())\n print( ((n * (n - 1)) // 2 ) + ((m * (m - 1))//2))\n "] | ['Wrong Answer', 'Accepted'] | ['s567060785', 's461360983'] | [2940.0, 2940.0] | [17.0, 17.0] | [111, 124] |
p02729 | u237299453 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nfor i in range(0, N):\n n = n + i - 1\n \n\nm = 0\nfor j in range(0, M):\n m = m + j - 1\n \nreturn n + m', 'N, M = map(int, input().split())\n\nn = 0\nfor i in range(1, N):\n n = n + i\n \n\nm = 0\nfor j in range(1, M):\n m = m + j\n \nprint("{}".format(n + m)) \n'] | ['Runtime Error', 'Accepted'] | ['s240490928', 's360310601'] | [2940.0, 2940.0] | [17.0, 18.0] | [209, 217] |
p02729 | u238084414 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = list(int, input().split())\n\nprint(int(N * (N - 1) / 2 + M * (M - 1) / 2))\n', 'N, M = map(int, input().split())\n\nprint((N * (N - 1) + M * (M - 1)) // 2)'] | ['Runtime Error', 'Accepted'] | ['s321382416', 's325579232'] | [2940.0, 2940.0] | [17.0, 17.0] | [81, 73] |
p02729 | u241348301 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = ((n*(n-1))+(m*(m-1)))//2\nprint(ans)', 'n=int(input())\nm=int(input())\nk =(n*(n-1))//2\nj=(m*(m-1))//2\nprint(j+k)', 'n=int(input())\nm=int(input())\nans = (((n*(n-1))+(m*(m-1)))//2\nprint(ans)', 'n, m = map(int, input().split())\n \nans = ((n*(n-1))+(m*(m-1)))//2\n \nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s471599132', 's923774728', 's943970950', 's030571565'] | [9120.0, 9024.0, 8856.0, 8960.0] | [24.0, 29.0, 24.0, 26.0] | [71, 71, 72, 78] |
p02729 | u244423127 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['a,b=map(int,input().split())\n\nprint(a*(a-1)/2+b*(b-1)/2)', 'a,b=map(int,input().split())\n\nprint(int(a*(a-1)/2+b*(b-1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s118918106', 's686035213'] | [2940.0, 2940.0] | [17.0, 17.0] | [56, 61] |
p02729 | u244836567 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['a,b=input().split()\na=int(a)\nb=int(b)\nprint(a*(a-1)/2+(b*(b-1)/2))', 'a,b=input().split()\na=int(a)\nb=int(b)\nprint(int(a*(a-1)/2+(b*(b-1)/2)))'] | ['Wrong Answer', 'Accepted'] | ['s223129117', 's446404785'] | [9036.0, 9036.0] | [29.0, 26.0] | [66, 71] |
p02729 | u250734103 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\n\nans = N*(N-1)/2 + M*(M-1)/2\n\nprint(ans)', 'N, M = map(int, input().split())\n\nans = int(N*(N-1)/2 + M*(M-1)/2)\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s654677584', 's484312869'] | [2940.0, 2940.0] | [17.0, 17.0] | [73, 78] |
p02729 | u252071027 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M=map(int,input().split())\n\nprint(N*(N-1)/2 + M*(M-1)/2)', 'N,M=map(int,input().split())\n\nprint(N*(N-1)//2 + M*(M-1)//2)'] | ['Wrong Answer', 'Accepted'] | ['s045159735', 's237296202'] | [9040.0, 9060.0] | [25.0, 29.0] | [58, 60] |
p02729 | u252964975 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\ni=N*(N-1)/2+M*(M-1)/2\n\n\nprint('%d' % i)"] | ['Wrong Answer', 'Accepted'] | ['s033542463', 's439138599'] | [2940.0, 2940.0] | [17.0, 17.0] | [56, 69] |
p02729 | u254221913 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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)', "S = input()\nflg = False\nfor i in range(len(S)/2-1):\n if S[i] == S[len(S)-i]:\n flg = True\n else:\n flg = False\nfor i in range(((len(S)-1) /2 -1)/2):\n if S[i] == S[(len(S)-1)/2-i]:\n pass\n else:\n flg = False\nfor i in range((len(S)-(len(S)+3)/2 -1)/2):\n if S[i] == S[(len(S)+3)/2 -i]:\n pass\n else:\n flg = False\n \nif flg:\n print('Yes')\nelse:\n print('No')", 'N,M = map(int,input().split())\nprint(math.factorial(N) + math.factorial(M))', 'N,M = map(int,input().split())\nprint(int(N*(N-1)/2 + M*(M-1)/2))\n'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s486145579', 's517251190', 's588864319', 's485225372'] | [2940.0, 3064.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0, 18.0] | [59, 414, 75, 65] |
p02729 | u256801986 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nimport math\ninput_line = input().split()\n\nN = int(input_line[0])\nM = int(input_line[1])\ncounter = 0 \ncounter += combinations_count(N,2) \ncounter += combinations_count(M,2)\n \nprint(counter)\n\n', 'import math\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\ninput_line = input().split()\n\nN = int(input_line[0])\nM = int(input_line[1])\ncounter = 0 \nif N != 0:\n counter += combinations_count(N,2) \nif M != 0:\n counter += combinations_count(M,2)\n \nprint(counter)\n', 'import math\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\ninput_line = input().split()\n\nN = int(input_line[0])\nM = int(input_line[1])\ncounter = 0 \nif N > 1:\n counter += combinations_count(N,2) \nif M > 1:\n counter += combinations_count(M,2)\n \nprint(counter)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s331253671', 's346032056', 's424587263'] | [3060.0, 3060.0, 3060.0] | [18.0, 17.0, 17.0] | [303, 332, 329] |
p02729 | u257472411 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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.comb() import comb\na = list(map(int,input().split()))\n\nprint(scipy.misc.comb(a[0], 2, exact=True) + scipy.misc.comb(a[1], 2, exact=True))', 'import itertools\na = list(map(int,input().split()))\n\ns = [i for i in range(a[0])]\nt = [i for i in range(a[1])]\n\nn = list(itertools.combinations(s, 2))\nm = list(itertools.combinations(t, 2))\n\nprint(len(n) + len(m))\n\n'] | ['Runtime Error', 'Accepted'] | ['s644239145', 's881366878'] | [2940.0, 3700.0] | [17.0, 19.0] | [153, 215] |
p02729 | u259975636 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['from math import factorial as f\ndef t(x): return f(x)/(f(2)*f(x-2))\nn,m = [int(i) for i in input().split()]\n#if m%2==0: m-=1\nif m>=2 and n>=2:\n ans = t(m)+t(n)\nelif n==0 and m>=2: ans = t(m)\nelse: \n if m == 1: ans =0\n else: ans=2\n \nprint(int(ans))\n', "n,m = [int(i) for i in input().split()]\np = ['P']*n\nk = ['I']*m\nal = p+k\nans = 0\nfor i in range(len(al)):\n for j in range(i+1,len(al)):\n if al[i] == 'I' and al[j]=='I':ans+=1\n if al[i] == 'P' and al[j] == 'P': ans+=1\nprint(ans)\n"] | ['Wrong Answer', 'Accepted'] | ['s474887339', 's064541534'] | [9016.0, 9108.0] | [24.0, 32.0] | [275, 245] |
p02729 | u262801165 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import sys\nimport math\nimport collections\nfrom collections import deque\n#n = int(input())\nn, m = map(int, sys.stdin.readline().split())\n#s = input()\n#x = list(map(int, sys.stdin.readline().split()))\n\na = math.factorial(n) // (math.factorial(n - 2) * 2)\nb = math.factorial(m) // (math.factorial(m - 2) * 2)\n\nprint(a+b)\n', 'import sys\nimport math\nimport collections\nfrom collections import deque\n#n = int(input())\nn, m = map(int, sys.stdin.readline().split())\n#s = input()\n#x = list(map(int, sys.stdin.readline().split()))\n\nif n <= 1:\n a = 0\nelse:\n a = math.factorial(n) // (math.factorial(n - 2) * 2)\n\nif m <= 1:\n b = 0\nelse:\n b = math.factorial(m) // (math.factorial(m - 2) * 2)\n\nprint(a+b)\n'] | ['Runtime Error', 'Accepted'] | ['s998380062', 's686209741'] | [3440.0, 3440.0] | [109.0, 68.0] | [318, 381] |
p02729 | u263830634 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['MOD = 998244353\n\nN, S = map(int, input().split())\nA = list(map(int, input().split()))\n\nDP = [[[0] * 3 for _ in range(S + 1)] for _ in range(N + 1)]\nDP[0][0][0] = 1\n\nfor i in range(N):\n DP[i + 1][0][0] = DP[i][0][0] \n a = A[i]\n for j in range(S + 1):\n if j == 0: \n # DP[i + 1][j][0] = DP[i][j][0] \n DP[i + 1][j][1] = DP[i][j][0] + DP[i][j][1]\n elif j < a: \n # DP[i + 1][j][0] = DP[i][j][0] \n DP[i + 1][j][1] = DP[i][j][0] + DP[i][j][1] \n else: \n DP[i + 1][j][1] = DP[i][j][0] + DP[i][j][1] + DP[i][j - a][0] + DP[i][j - a][1]\n # DP[i + 1][j][0] %= MOD\n DP[i + 1][j][0] %= MOD\n DP[i + 1][S][2] = DP[i][S][1] + DP[i][S][2]\n if a <= S:\n DP[i + 1][S][2] += DP[i][S - a][0] + DP[i][S - a][1]\n DP[i + 1][S][2] %= MOD\n\nprint (DP[N][S][2])\n\n\n# print (DP[i])', 'N, M = map(int, input().split())\n\nans = (N * (N - 1) // 2) + (M * (M - 1) // 2)\n\nprint (ans)'] | ['Runtime Error', 'Accepted'] | ['s641787549', 's015584669'] | [3064.0, 3316.0] | [18.0, 19.0] | [1198, 92] |
p02729 | u264312747 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['\nn, m = map(int, input().split())\n# combination nC2 mC2\nans = n * (n - 1) / 2 + m * (m - 1) / 2\nprint(ans)', '\nn, m = map(int, input().split())\n# combination nC2 mC2\nans = n * (n - 1) / 2 + m * (m - 1) / 2\nprint(int(ans))'] | ['Wrong Answer', 'Accepted'] | ['s004121701', 's660615228'] | [2940.0, 2940.0] | [17.0, 17.0] | [132, 137] |
p02729 | u265118937 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\nimport sys\nn, m = map(int, input().split())\n\ndef combinations_count(n, r):\n C = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n return C\n\nif n <= 1 and m >= 2:\n print(combinations_count(m, 2))\n sys.exit()\nelif n >= 2 and m <= 1@:\n print(combinations_count(n, 2))\n sys.exit()\nelif n == m == 1:\n print(1)\n sys.exit()\nelif n == m == 0:\n print(0)\n sys.exit()\nelse:\n print(combinations_count(n, 2) + combinations_count(m, 2))', 'import math\nimport sys\nn, m = map(int, input().split())\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nif n == 0 and m <= 2:\n print(combinations_count(m, 2))\n sys.exit()\nelif n <= 2 and m == 0:\n print(combinations_count(n, 2))\n sys.exit()\nelif n == m == 1:\n print(1)\n sys.exit()\nelse:\n print(combinations_count(n, 2) + combinations_count(m, 2))', 'import math\nimport sys\nn, m = map(int, input().split())\n\ndef combinations_count(n, r):\n C = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n return C\n\nif n == 0 and m >= 2:\n print(combinations_count(m, 2))\n sys.exit()\nelif n >= 2 and m == 0:\n print(combinations_count(n, 2))\n sys.exit()\nelif n == m == 1:\n print(1)\n sys.exit()\nelif n == m == 0:\n print(0)\n sys.exit()\nelse:\n print(combinations_count(n, 2) + combinations_count(m, 2))', 'import math\nimport sys\nn, m = map(int, input().split())\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nprint(combinations_count(n, 2) + combinations_count(m, 2))', 'import math\nimport sys\nn, m = map(int, input().split())\n\ndef combinations_count(n, r):\n C = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n return C\n\nif n <= 1 and m >= 2:\n print(combinations_count(m, 2))\n sys.exit()\nelif n >= 2 and m <= 1:\n print(combinations_count(n, 2))\n sys.exit()\nelif n == m == 1:\n print(0)\n sys.exit()\nelif n == m == 0:\n print(0)\n sys.exit()\nelse:\n print(combinations_count(n, 2) + combinations_count(m, 2))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s782774280', 's896250199', 's908046045', 's955229299', 's489937810'] | [2940.0, 3064.0, 3064.0, 2940.0, 3064.0] | [17.0, 17.0, 17.0, 18.0, 18.0] | [483, 426, 482, 222, 482] |
p02729 | u265673107 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = input("").split()\nm = int(m)\nn = int(n)\ntotal = 0\nif m > 1:\n total += m*(m-1)/2\nif n > 1:\n total += n*(n-1)/2\nprint(total)', 'm, n = input("").split()\nm = int(m)\nn = int(n)\ntotal = 0\nif m > 1:\n total += m*(m-1)/2\nif n > 1:\n total += n*(n-1)/2\nprint(int(total))'] | ['Wrong Answer', 'Accepted'] | ['s376809052', 's823041676'] | [3060.0, 3060.0] | [17.0, 17.0] | [135, 140] |
p02729 | u266014018 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["def main():\n import sys\n input = sys.stdin.buffer.readline\n n, m = map(int, input().split())\n print(int(n*(n-1)/2 + m(m-1)/2))\n\n\nif __name__ == '__main__':\n main()", "def main():\n import sys\n input = sys.stdin.buffer.readline\n n, m = map(int, input().split())\n print(int(n*(n-1)/2 + m*(m-1)/2))\n\n\nif __name__ == '__main__':\n main()"] | ['Runtime Error', 'Accepted'] | ['s348662564', 's909632188'] | [2940.0, 2940.0] | [18.0, 17.0] | [178, 179] |
p02729 | u266675845 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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)\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)\nelse:\n print(int(n*(n-1)/2 + m*(m-1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s142341223', 's704672434'] | [2940.0, 9108.0] | [17.0, 25.0] | [102, 107] |
p02729 | u267983787 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['# -*- coding: utf-8 -*-\nimport math\n\n\nb, c = map(int, input().split())\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n(combinations_count(b+c, 2)-b*c)', '# -*- coding: utf-8 -*-\nimport math\n\n\nb, c = map(int, input().split())\n\ndef combinations_count(n, r):\n return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))\n\nprint(int(combinations_count(b+c, 2)-b*c))\n'] | ['Wrong Answer', 'Accepted'] | ['s460909766', 's429631804'] | [2940.0, 2940.0] | [18.0, 17.0] | [272, 282] |
p02729 | u268318377 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 * (n - 1) + m * (m - 1) // 2\n)', 'n, m = map(int, input().split())\n \nprint(\n (n * (n - 1) + m * (m - 1)) // 2\n)'] | ['Wrong Answer', 'Accepted'] | ['s130130082', 's183786938'] | [2940.0, 2940.0] | [17.0, 17.0] | [75, 78] |
p02729 | u273038590 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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==m==1:\n print(0)\nelif n==1:\n print(cmb(m,2))\nelif m==1:\n print(cmb(n,2))\nelse:\n print(cmb(n,2)+cmb(m,2))', 'n,m =map(int, input().split())\nif n==m==1:\n print(0)\nelif n==1 or n==0:\n print(cmb(m,2))\nelif m==1 or m==0:\n print(cmb(n,2))\nelse:\n print(cmb(n,2)+cmb(m,2))', 'nCr = {}\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n,r) in nCr: return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n return nCr[(n,r)]\n \nn,m =map(int, input().split())\nif n==m==1:\n print(0)\nelif n==1 or n==0:\n print(cmb(m,2))\nelif m==1 or m==0:\n print(cmb(n,2))\nelse:\n print(cmb(n,2)+cmb(m,2))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s163942506', 's537347221', 's136190252'] | [3060.0, 3060.0, 3064.0] | [17.0, 17.0, 18.0] | [152, 168, 357] |
p02729 | u275030199 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nsum = 0\nsum+=N*(N-1)/2\nsum+=M*(M-1)/2\nprint(int(sum)', "N = int(input())\na = (input().split())\na_str = ''.join(a)\na_str2 = a_str\nsum = 0\nl_dict = {}\nwhile len(a_str)>0:\n n = a.count(a_str[0])\n sum += int(n*(n-1)/2)\n l_dict[a_str[0]] = n\n a_str = a_str.replace(a_str[0],'')\nfor k in range(N):\n print(sum-l_dict[a_str2[k]]+1)\n", 'N,M = map(int,input().split())\nsum = 0\nsum+=N*(N-1)/2\nsum+=M*(M-1)/2\nprint(int(sum))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s538950041', 's811963081', 's217605212'] | [2940.0, 3060.0, 2940.0] | [17.0, 17.0, 18.0] | [83, 283, 84] |
p02729 | u276686572 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['even,odd = map(int, input().split())\n\ndef f(n):\nif n == 1 or n ==0:\n return 1\nelse:\n return n*f(n-1)\n \nprint(f(even) + f(odd))', 'even,odd = map(int, input().split())\n\ndef f(n):\n if n == 1 or n == 0:\n return 1\n else:\n return n*f(n-1)\n \nprint(int(f(even)/(f(even-2)*2) + f(odd)/(f(odd-2)*2)))', 'even,odd = map(int, input().split())\n\n \nprint(int(even * (even-1)/2 + odd * (odd-1)/2))\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s616832360', 's961744511', 's334916919'] | [9016.0, 9556.0, 9152.0] | [27.0, 27.0, 26.0] | [131, 170, 89] |
p02729 | u278761160 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['\nN, M = list(map(int, input().split()))\n\noutput = (N*(N-1))/2 + (M*(M-1))/2\n\n\nprint(output)', '# -*- coding: utf-8 -*-\n\n\nN, M = list(map(int, input().split()))\n\noutput = int( (N*(N-1))/2 + (M*(M-1))/2 )\n\n\nprint(output)'] | ['Wrong Answer', 'Accepted'] | ['s388653421', 's454516943'] | [2940.0, 2940.0] | [17.0, 18.0] | [128, 180] |
p02729 | u279266699 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\n\ndef main():\n n, m = map(int, input().split())\n print(combinations_count(n, 2) + combinations_count(m, 2))\n\n\nif __name__ == "__main__":\n main()\n', 'import math\n\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\ndef main():\n n, m = map(int, input().split())\n if n < 2:\n even = 0\n else:\n even = combinations_count(n, 2)\n if m < 2:\n odd = 0\n else:\n odd = combinations_count(m, 2)\n print(even + odd)\n\n\nif __name__ == "__main__":\n main()\n'] | ['Runtime Error', 'Accepted'] | ['s584253829', 's489492294'] | [9036.0, 9136.0] | [28.0, 27.0] | [274, 393] |
p02729 | u280552586 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import math\n\nn, m = map(int, input().split())\n\nans = n*(n-1)//2 + m(m-1)//2\nprint(ans)\n', 'import math\n\nn, m = map(int, input().split())\n\nans = n*(n-1)//2 + m*(m-1)//2\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s316476282', 's582106984'] | [2940.0, 2940.0] | [17.0, 17.0] | [87, 88] |
p02729 | u280695850 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["s = input()\nn = len(s)\nif(s==s[::-1] and s[:(n-1)//2]==s[:(n-1)//2][::-1]): print('Yes')\nelse: print('No')", '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'] | ['s834045543', 's880235385', 's182791461'] | [9132.0, 9160.0, 9156.0] | [26.0, 25.0, 30.0] | [106, 61, 63] |
p02729 | u281829807 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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+m*m)', 'n,m = map(int,input().split())\nprint(n*(n-1)/2+m*(m-1)/2)', 'n,m = map(int,input().split())\nprint(n*(n+1)/2+m*(m+1)/2)', 'n,m = map(int,input().split())\nprint(int(n*(n-1)/2+m*(m-1)/2))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s030113641', 's201336880', 's766563330', 's992415409', 's174263054'] | [2940.0, 2940.0, 3316.0, 2940.0, 2940.0] | [17.0, 17.0, 23.0, 17.0, 17.0] | [57, 45, 57, 57, 62] |
p02729 | u282376189 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nC = list(map(int,input().split()))\n\ndef chose(A):\n s = 0\n t = 0\n for i in range(len(A)):\n t = A.count(i+1) \n for q in range(t):\n s += q\n print(s)\n\nfor i in range(N):\n B = C[:]\n B.pop(i)\n chose(B)', 'N,M = map(int,input().split())\ns = t = 0\nfor i in range(N):\n s += i\nfor i in range(M):\n t += i\nprint(s+t)'] | ['Runtime Error', 'Accepted'] | ['s256176686', 's915677238'] | [3060.0, 2940.0] | [17.0, 17.0] | [258, 111] |
p02729 | u282657760 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\nans = 0\nif n > 1:\n ans += n*n-1//2\nif m > 1:\n ans += m*m-1//2\nprint(ans)', 'n, m = map(int, input().split())\nans = 0\nif n > 1:\n ans += n*(n-1)//2\nif m > 1:\n ans += m*(m-1)//2\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s325178741', 's880319638'] | [2940.0, 2940.0] | [19.0, 17.0] | [107, 112] |
p02729 | u283751459 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nmethod = n*(n-1)/2 + m*(m-1)/2\nprint(method)', 'n,m = map(int,input().split())\nmethod = n*(n-1)/2 + m*(m-1)/2\nprint(int(method))\n'] | ['Wrong Answer', 'Accepted'] | ['s617445944', 's871867496'] | [9060.0, 8968.0] | [53.0, 25.0] | [75, 81] |
p02729 | u283929013 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int,input().split())\n\nprint(N*(N-1)/2 + M*(M-1)/2)', 'N, M = map(int,input().split())\n \nprint(N*(N-1)//2 + M*(M-1)//2)'] | ['Wrong Answer', 'Accepted'] | ['s930869931', 's379832343'] | [2940.0, 2940.0] | [18.0, 17.0] | [61, 64] |
p02729 | u289036437 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['m,n=map(int,input().split())\nprint(m*(m-1)+n*(n-1))', 'm,n=map(int,input())\nprint(m*(m-1)+n*(n-1))', 'm,n=map(int,input().split())\nprint(m*(m-1)/2+n*(n-1)/2)', 'm,n=map(int,input().split())\nprint(m*(m-1)//2+n*(n-1)//2)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s322910272', 's511906788', 's794107729', 's062309480'] | [2940.0, 2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0, 18.0] | [51, 43, 55, 57] |
p02729 | u289162337 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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*m == 1:\n print(0)\nelse:\n print(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())\nif n*m == 1:\n print(0)\nelse:\n print(int(n*(n-1)/2+m*(m-1)/2))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s235871906', 's288294292', 's470083755'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [91, 59, 96] |
p02729 | u289288647 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['from scipy.special import comb\n\nN, M = map(int, input().split())\nprint(comb(N, 2) + comb(M, 2))\n\n', 'N, M = map(int, input().split())\nprint(int(N*(N-1)/2+M*(M-1)/2))\n'] | ['Runtime Error', 'Accepted'] | ['s541771685', 's308269239'] | [14212.0, 2940.0] | [174.0, 17.0] | [97, 65] |
p02729 | u290886932 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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, S = map(int, input().split())\nA = list(map(int, input().split()))\nMOD = 998244353\nL = 0\nR = 0\nret = 0\n\nwhile R < N:\n if L > R:\n R = L\n if sum(A[L:R + 1]) < S:\n R += 1\n elif sum(A[L:R + 1]) > S:\n L += 1\n elif sum(A[L:R + 1]) == S:\n ret += (L + 1) * (N - R - 1) % MOD\n R += 1\nprint(ret)', 'N, M = map(int, input().split())\nret = N * (N - 1) // 2 + M * (M - 1)// 2\nprint(ret)'] | ['Runtime Error', 'Accepted'] | ['s842844599', 's130067782'] | [3064.0, 3064.0] | [17.0, 17.0] | [306, 84] |
p02729 | u291460595 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['#200322D\nN = int(input())\nA = list(map(int,input().split()))\ncount = 0\nfor i in range(N):\n for j in range(N):\n if A[i] == A[j]:\n count += 1\nAll = (count - N) / 2\n#print(int(All))\n\nfor i in range(N):\n count = 0\n for j in range(N):\n if A[i] == A[j]:\n count += 1\n print(int(All - count + 1))', '#200322A\nN, M = map(int,input().split())\nx = N * (N - 1)/2 + M * (M-1) /2\nprint(int(x))'] | ['Runtime Error', 'Accepted'] | ['s686631473', 's714470636'] | [3064.0, 2940.0] | [17.0, 17.0] | [336, 87] |
p02729 | u294385082 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 - n + m**2 - m)/2)', 'n,m = map(int,input().split())\nprint((n**2 - n + m**2 - m)//2)'] | ['Wrong Answer', 'Accepted'] | ['s802438412', 's976114319'] | [2940.0, 2940.0] | [17.0, 17.0] | [61, 62] |
p02729 | u297089927 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\nNM=(N*(N-1)+M*(M-1))/2\nprint(NM)', 'S=input()\nN=len(S)\nS1=S[:int((N-1)/2)]\nS2=S[int((N+1)/2):]\nif S == S[::-1] and S1 == S1[::-1] and S2 == S2[::-1]:\n print("Yes")\nelse:\n print("No")', 'S=input()\nN=len(S)\nS1=S[:int((N+1)/2)]\nS2=S[int((N+3)/2):]\nif S == S[::-1] and S1 == S1[::-1] and S2 == S2[::-1]:\n print("Yes")\nelse:\n print("No")', '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=int(input())\nM=int(input())\nprint(N*(N-1)/2+M*(M-1)/2)', 'n,m=map(int,input().split())\nprint(n*(n-1)//2+m*(m-1)//2)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s372711853', 's462846613', 's605882868', 's667754246', 's791410605', 's930053636', 's925014620'] | [2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 18.0, 17.0, 17.0, 17.0, 17.0] | [61, 148, 148, 59, 59, 56, 57] |
p02729 | u301195216 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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)\nprint(Ans)'] | ['Wrong Answer', 'Accepted'] | ['s589831030', 's755129413'] | [2940.0, 2940.0] | [17.0, 17.0] | [76, 78] |
p02729 | u302297036 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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()\nN = int(data[0])\nM = int(data[1])\n\nC = N * (N - 1) / 2 + M * (M - 1) / 2\nprint(C)\n', 'data = input().split()\nN = int(data[0])\nM = int(data[1])\n\nC = N * (N - 1) / 2 + M * (M - 1) / 2\nprint(str(C))\n', 'data = input().split()\nN = int(data[0])\nM = int(data[1])\n\nC = N * (N - 1) / 2 + M * (M - 1) / 2\nprint(int(C))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s284214818', 's424643188', 's233668153'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [105, 110, 109] |
p02729 | u302435631 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = input()\nans = (L//3)**3\nprint(ans)', 'N, M = map(int, input().split())\nans = N*(N-1)/2 + M*(M-1)/2\nprint(ans)', 'N, M = map(int, input().split())\nans = N*(N-1)//2 + M*(M-1)//2\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s048856907', 's706863237', 's723757649'] | [2940.0, 3064.0, 2940.0] | [17.0, 18.0, 17.0] | [38, 71, 73] |
p02729 | u303384315 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import sys\ninput = sys.stdin.readline\n\ndef comb(n):\n if n == 1:\n return 0\n else:\n return int(n*(n-1)/2)\n\nn = int(input())\nAS = list(map(int,input().split()))\n\norigin = list(set(AS))\nnum = []\nfor i in origin:\n num.append(AS.count(i))\ncomb_list = [-1]*(max(num)+1)\nall_num = 0\nfor i in num:\n if comb_list[i] == -1:\n all_num += comb(i)\n comb_list[i] = comb(i)\n else:\n all_num += comb_list[i]\n \nfor i in range(n):\n j = num[origin.index(AS[i])]\n ans = all_num - (j-1)\n print(ans)', 'from math import factorial\n\nn, m = map(int, input().split())\nif n > 1 and m > 1:\n print(int(factorial(n)/factorial(2)/factorial(n-2) + factorial(m)/factorial(2)/factorial(m-2)))\nelif n > 1:\n print(int(factorial(n)/factorial(2)/factorial(n-2)))\nelif m > 1:\n print(int(factorial(m)/factorial(2)/factorial(m-2)))\nelse:\n print(0)'] | ['Runtime Error', 'Accepted'] | ['s969944414', 's027437177'] | [3064.0, 3064.0] | [18.0, 18.0] | [536, 337] |
p02729 | u303943871 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = [int(i) for i in input().split(" ")]\n\nprint(comb(n,2) + comb(m,2))', 'import math\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn, m = [int(i) for i in input().split(" ")]\nr = 0\nif n > 1:\n r += comb(n, 2)\nif m > 1:\n r += comb(m, 2)\nprint(r)'] | ['Runtime Error', 'Accepted'] | ['s565799870', 's350973219'] | [3056.0, 3060.0] | [18.0, 18.0] | [176, 217] |
p02729 | u306516971 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import sys\n\nn = int(sys.stdin.readline())\n \nli = list(map(int, sys.stdin.readline().split()))\n \nans = [0]*n\nfor i in range(n):\n li2 = li.copy()\n del li2[i]\n for j in range(n-1):\n for k in range(j+1, n-1):\n if li2[j] == li2[k]:\n ans[i] += 1\nfor l in range(len(ans)):\n print(ans[l])', 'n, m = map(int, input().split())\n\nans = 0\n\nans += n*(n-1)/2\nans += m*(m-1)/2\n\nprint(int(ans))'] | ['Runtime Error', 'Accepted'] | ['s777576952', 's539541180'] | [3060.0, 2940.0] | [18.0, 17.0] | [325, 93] |
p02729 | u307083029 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["ls = list(input())\nn = len(ls)\nrvls = ls[::-1]\n\nfh = int((n-1) /2)\nfhls = ls[:fh]\nrvfhls = fhls[::-1]\n\nsh = int((n+3)/2-1)\nshls = ls[sh:]\nrvshls = shls[::-1]\n\nif ls == rvls and fhls==rvfhls and shls == rvshls:\n print('Yes')\nelse:\n print('No')", 'n, m = map(int, input().split())\nans = int(n * (n-1)/2 + m*(m-1)/2)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s546685935', 's342919873'] | [3064.0, 2940.0] | [17.0, 17.0] | [248, 78] |
p02729 | u309423187 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | [' a, b = map(int, input().split())\n\nif a >= 2 and b >=2 :\n ans = (a * (a + 1)//2 - a) + (b * (b +1)//2 - b)\n print(ans)\n\nif a < 2 and b < 2:\n print(0)\n\nif a < 2 and b >= 2:\n print(b * (b + 1)//2 -b)\n\nif a >= 2 and b < 2:\n print(a * (a + 1)//2 -a)', 'a, b = map(int, input().split())\n\nif a >= 2 and b >=2 :\n ans = ((a * (a + 1))//2 - a) + ((b * (b +1))//2 - b)\n print(ans)\n\nif a < 2 and b < 2:\n print(0)\n\nif a < 2 and b >= 2:\n print((b * (b + 1))//2 -b)\n\nif a >= 2 and b < 2:\n print((a * (a + 1))//2 -a)'] | ['Runtime Error', 'Accepted'] | ['s831948439', 's516958727'] | [2940.0, 3064.0] | [17.0, 17.0] | [260, 267] |
p02729 | u311176548 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 nCr(n,r):\n return math.factorial(n) / math.factorial(r) / math.factorial(n-r)\nN,M=list(map(int,input().split(' ')))\nprint(int(nCr(N,2)+nCr(M,2)))", "import math\ndef nCr(n,r):\n return math.factorial(n) / math.factorial(r) / math.factorial(n-r) if n>1 else 0\nN,M=list(map(int,input().split(' ')))\nprint(int(nCr(N,2)+nCr(M,2)))"] | ['Runtime Error', 'Accepted'] | ['s383063729', 's437699948'] | [3060.0, 3060.0] | [17.0, 17.0] | [164, 178] |
p02729 | u311625355 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,w=map(int,input().split())\nprint(n*(n-1)/2+w*(w-1)/2)', 'n,w=map(int,input().split())\nprint(int(n*(n-1)/2+w*(w-1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s557065366', 's677615865'] | [2940.0, 2940.0] | [18.0, 18.0] | [55, 60] |
p02729 | u311961196 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['\nN,M = map(int, input().split())\n\nprint(N*(N-1)+M*(M-1)//2)', '\nN,M = map(int, input().split())\n\nprint((N*(N-1)+M*(M-1))//2)'] | ['Wrong Answer', 'Accepted'] | ['s232742829', 's955761267'] | [9164.0, 9160.0] | [29.0, 32.0] | [59, 61] |
p02729 | u313291636 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N,M = map(int, input().split())\nprint(((N * (N - 1)) / 2 ) + ((M * (M - 1)) / 2 ))\n', 'N,M = map(int, input().split())\nprint(int((N * (N - 1) / 2 ) + (M * (M - 1) / 2 )))\n'] | ['Wrong Answer', 'Accepted'] | ['s715375079', 's947362044'] | [2940.0, 2940.0] | [17.0, 18.0] | [83, 84] |
p02729 | u313317027 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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())\n\nif n < 1:\n print(comb(m, 2))\nelif m < 1:\n print(comb(n, 2))\nelse:\n print(comb(n, 2) + comb(m, 2))\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())\n\nprint(comb(n, 2) + comb(m, 2))', "import math\nimport sys\n\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn, m = map(int,input().split())\n\nif n <= 1\n print(comb(m, 2))\n sys.exit()\n \nif m <=1\n print(comb(n, 2))\n sys.exit()\n\nif n == 1 and m == 1:\n print('0')\n sys.exit()\n\nprint(comb(n, 2) + comb(m, 2))\n", "import math\nimport sys\n\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn, m = map(int,input().split())\n\nif n == 1 and m == 1:\n print('0')\n sys.exit()\n \nif n <= 1:\n print(comb(m, 2))\n sys.exit()\n \nif m <=1:\n print(comb(n, 2))\n sys.exit()\n\nprint(comb(n, 2) + comb(m, 2))"] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s295373764', 's426431658', 's807533230', 's221847719'] | [3060.0, 2940.0, 2940.0, 3064.0] | [18.0, 17.0, 17.0, 17.0] | [239, 168, 319, 322] |
p02729 | u317528406 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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()), int(input())\nprint(n*(n-1)//2+m*(m-1)//2)\n', 'n, m = [int(x) for x in input().split()]\nprint(n*(n-1)//2+m*(m-1)//2)'] | ['Runtime Error', 'Accepted'] | ['s476895543', 's800133026'] | [2940.0, 2940.0] | [16.0, 17.0] | [63, 69] |
p02729 | u320763652 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n, m = map(int, input().split())\n\nans = n * (n-1) / 2 + m * (m-1) /2\n\nprint(ans)', 'n, m = map(int, input().split())\n\nif n == 0:\n n = 1\n\nif m == 0:\n m = 1\n\nans = n * (n-1) / 2 + m * (m-1) /2\n\nprint(int(ans))'] | ['Wrong Answer', 'Accepted'] | ['s799081431', 's049579734'] | [2940.0, 3060.0] | [17.0, 17.0] | [80, 129] |
p02729 | u321096814 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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\nN, M= map(int, input().split())\nimport math\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nif N != 0:\n N_sum = combinations_count(N, 2)\nelse:\n N_sum = 0\nif M != 0:\n M_sum = combinations_count(M, 2)\nelse:\n M_sum = 0\nprint(N_sum + M_sum)', 'l=int(input())\nprint((l/3)**3)', '# -*- coding: utf-8 -*-\nN, M = map(int, input().split())\nimport math\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nif N != 0:\n if N != 1:\n N_sum = combinations_count(N, 2)\n else:\n N_sum = 0\nelse:\n N_sum = 0\nif M != 0:\n if M != 1:\n M_sum = combinations_count(M, 2)\n else:\n M_sum = 0\nelse:\n M_sum = 0\nprint(N_sum + M_sum)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s697161455', 's903467591', 's199052948'] | [3060.0, 2940.0, 3064.0] | [17.0, 18.0, 17.0] | [340, 30, 397] |
p02729 | u321163853 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["import sys\n\ns = input()\n\ndef is_kaibun(aaa):\n str_len = len(aaa)\n half_str_len = str_len // 2\n\n str_mae = aaa[:half_str_len]\n str_ato = aaa[half_str_len+1:]\n\n if str_mae == str_ato:\n return(True)\n else:\n return(False)\n \n\nif is_kaibun(s):\n s_len = len(s)\n half_s_len = s_len // 2\n mae = s[:half_s_len]\n ato = s[half_s_len+1:] \n if is_kaibun(mae) and is_kaibun(ato):\n print('Yes')\n else:\n print('No')\nelse:\n print('No')\n\n\n", 'import itertools\n\nn,m = map(int, input().split())\n\neven = [i for i in range(2, 333, 2)]\n\nodd = [i for i in range(1, 333, 2)]\n\n\nseq = []\n\n\nfor i in range(n):\n seq.append(even[i])\n\nfor i in range(m):\n seq.append(odd[i])\n\n\n\ncnt = 0\n\nfor v1, v2 in itertools.combinations(seq,2):\n tmp = int(v1) + int(v2)\n if tmp % 2 == 0:\n cnt += 1\n\nprint(cnt)\n'] | ['Wrong Answer', 'Accepted'] | ['s951084144', 's493164181'] | [3064.0, 3064.0] | [17.0, 27.0] | [490, 359] |
p02729 | u323531048 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["H, W, K = map(int, input().split())\nS = list(input() for i in range(H))\n\nsum = [[0] * (W+1) for i in range((H+1))]\nfor i in range(H):\n for j in range(W):\n sum[i+1][j+1] = sum[i][j+1] + sum[i+1][j] - sum[i][j] + (1 if S[i][j] == '1' else 0)\n\nans = H + W - 2\n\nfor ptn in range(1<<H-1): \n cand = 0\n\n sep = [0] \n for i in range(H-1):\n if((ptn >> i) & 1): \n sep.append(i+1)\n cand += 1\n sep.append(H)\n\n left = 0 \n for pos in range(W):\n \tcur = [] \n\n \t\n \tfor i in range(len(sep) - 1):\n \t\tcur.append(sum[sep[i+1]][pos+1] - sum[sep[i+1]][left] - sum[sep[i]][pos+1] + sum[sep[i]][left])\n\n \tif max(cur) > K:\n \t\tif left == pos: \n \t\t\tcand = H * W\n \t\t\tbreak\n \t\telse:\n \t\t\tcand += 1\n \t\t\tleft = pos\n\n ans = min(ans, cand)\n\nprint(ans)\n", 'N, M = map(int, input().split())\n\na = N * (N-1) / 2\nb = M * (M-1) / 2\n\nprint(a+b)', 'N, M = map(int, input().split())\n\na = N * (N-1) / 2\nb = M * (M-1) / 2\n\nprint(int(a+b))'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s427004385', 's706105750', 's583076929'] | [3188.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [1117, 81, 86] |
p02729 | u323776907 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 if m == 1:\n print(0)\n else:\n print((m * (m-1) / 2))\nelif m == 1:\n print((n * (n-1) / 2))\nelse:\n print((n * (n-1) / 2) + (m * (m-1) / 2))', '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'] | ['s184976889', 's703439396', 's171607486'] | [3060.0, 2940.0, 2940.0] | [19.0, 17.0, 17.0] | [191, 73, 75] |
p02729 | u325956328 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = map(int, input().split())\n\nprint(int(comb(N, 2) + comb(M, 2)))\n\n', 'from scipy.misc import comb\n\nN, M = map(int, input().split())\n\nprint(int(comb(N, 2)) + int(comb(M, 2)))\n', 'N, M = map(int, input().split())\n\n\ndef comb(x):\n if x == 0:\n return 0\n if x == 1:\n return 0\n return x * (x - 1) // 2\n\n\nprint(comb(N) + comb(M))\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s553026810', 's605543876', 's875508922'] | [24096.0, 26916.0, 2940.0] | [727.0, 465.0, 17.0] | [100, 104, 167] |
p02729 | u328510800 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['s = list(input())\n\nf1 = s == list(reversed(s))\nf2 = s[:(len(s)-1)//2] == list(reversed(s[:(len(s)-1)//2]))\nf3 = s[(len(s)+2)//2:] == list(reversed(s[(len(s)+2)//2:]))\nprint("Yes" if all([f1, f2, f3]) else "No")', 's = list(input())\n\nf1 = s == list(reversed(s))\nf2 = s[:(len(s)-1)//2] == list(reversed(s[:(len(s)-1)//2]))\nf3 = s[(len(s)+2)//2:] == list(reversed(s[(len(s)+2)//2:]))\n\nprint("Yes" if all([f1, f2, f3]) else "No")', 'n, m = map(int, input().split())\n\nprint((n * (n - 1)) // 2 + (m * (m - 1)) // 2)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s102379494', 's194434199', 's517426616'] | [9116.0, 9136.0, 9040.0] | [30.0, 26.0, 32.0] | [210, 211, 80] |
p02729 | u329049771 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['import sys\n\n\nimport math\n\nn,m = map(int, input().split())\ndef c(n):\n return int(math.factorial(n) / math.factorial(n-2) / math.factorial(2))\n\nif n == 1 and m == 1:\n print(0)\nelse:\n print(c(n)+c(m))', 'import sys\n\n\nimport math\n\nn,m = map(int, input().split())\ndef c(n):\n return int(math.factorial(n) / math.factorial(n-2) / math.factorial(2))\n\nif n == 1 and m == 1:\n print(0)\nelif n <= 1:\n print(c(m))\nelif m <= 1:\n print(c(n))\nelse:\n print(c(n)+c(m))'] | ['Runtime Error', 'Accepted'] | ['s920515236', 's795120090'] | [3060.0, 3060.0] | [17.0, 17.0] | [237, 295] |
p02729 | u329232967 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 = n*(n-1)//2+m*(m-1)//2\n\nprint(ans)\n', 'n = int(input())\nm = int(input())\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(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s003802126', 's210897227', 's104114243'] | [2940.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0] | [74, 76, 76] |
p02729 | u329565519 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\n\nprint((N * (N-1) / 2) + (M * (M-1) / 2))', 'N, M = map(int, input().split())\n\nprint(int((N * (N-1) / 2) + (M * (M-1) / 2)))'] | ['Wrong Answer', 'Accepted'] | ['s126062019', 's506679830'] | [2940.0, 2940.0] | [18.0, 18.0] | [74, 79] |
p02729 | u329675280 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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=map(int,input().split())\nprint(int(comb(n, 2)+comb(m, 2)))', 'n,m=map(int,input().split())\n\nprint(int((n*(n-1)+m*(m-1))/2))'] | ['Wrong Answer', 'Accepted'] | ['s996190256', 's077042801'] | [13600.0, 2940.0] | [164.0, 18.0] | [91, 61] |
p02729 | u331226975 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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 or M==1:\n print(0)\nelse:\n print(int(N * (N-1)/2 + M *(M-1)/2))\n', 'N, M = map(int, input().split())\nif N==1 or M==1:\n print(0)\nelse:\n print(int((N!=0) * N * (N-1)/2 + (M!=0) * M *(M-1)/2))\n', 'N, M = map(int, input().split())\nprint(int((N!=0) * N * (N-1)/2 + (M!=0) * M *(M-1)/2))\n\t'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s283546060', 's851713130', 's150969921'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [108, 126, 89] |
p02729 | u331997680 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['N, M = map(int, input().split())\n\nprint(N * (N-1) / 2 + M * (M - 1)/2)', 'N, M = map(int, input().split())\n\nprint(int(N * (N-1) / 2 + M * (M - 1)/2))'] | ['Wrong Answer', 'Accepted'] | ['s553470173', 's036642961'] | [2940.0, 2940.0] | [17.0, 17.0] | [70, 75] |
p02729 | u332800105 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['n,m=map(int,input().split())\nprint(n(n-1)//2 + m(m-1)//2)\n', 'n,m=map(int,input().split())\nr=n*(n-1)//2 + m*(m-1)//2\nprint(r)'] | ['Runtime Error', 'Accepted'] | ['s150949968', 's090792109'] | [2940.0, 2940.0] | [17.0, 18.0] | [58, 63] |
p02729 | u334242570 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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+m>=2):\n\n print((n*(n-1)/2)+(m*(m-1)/2))', 'n,m=map(int,input().split())\nif(n+m>=2):\n if(n==1 or n==0):\n print(m*(m-1)/2)\n else if(m==1 or m==0):\n print(n*(n-1)/2)\n \n else:\n print((n*(n-1)/2)+(m*(m-1)/2))', 'n,m=map(int,input().split())\nif(n+m>=2 and n>=0 and n<=100 and m<=100 and m>=0):\n\n print((n*(n-1)/2)+(m*(m-1)/2))', 'n,m=map(int,input().split())\nif(n+m>=2 and n>=0 and n<=100 and m<=100 and m>=0):\n ans=int(round(n*(n-1)/2)+(m*(m-1)/2))\n print(ans)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s274557527', 's467855018', 's756033656', 's355394081'] | [2940.0, 2940.0, 2940.0, 3060.0] | [20.0, 17.0, 17.0, 17.0] | [76, 175, 116, 137] |
p02729 | u334617936 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['def comb(val):\n if(val > 0):\n return int(val*(val-1) / 2)\n else:\n return 0\n \ndef make_map(balls):\n balls_map = {}\n for ball in balls:\n if(ball in balls_map):\n balls_map[ball] += 1\n else:\n balls_map[ball] = 1\n return balls_map\n\ndef main():\n args = input().rstrip().split(\' \')\n N = int(args[0])\n balls = [val for val in input().rstrip().split(\' \')]\n balls_map = make_map(balls)\n \n sum_ = 0\n for ball in balls:\n balls_map[ball] -= 1\n sum_ = 0\n for val in balls_map.values():\n sum_ += comb(val)\n print(sum_)\n balls_map[ball] += 1\n \nif __name__ == "__main__":\n main()', 'def comb(val):\n if(val > 0):\n return int(val*(val-1) / 2)\n else:\n return 0\n\ndef main():\n args = input().rstrip().split(\' \')\n N, M = int(args[0]), int(args[1])\n print(comb(N) + comb(M))\n \nif __name__ == "__main__":\n main()'] | ['Runtime Error', 'Accepted'] | ['s296786572', 's745721865'] | [3064.0, 3060.0] | [18.0, 17.0] | [703, 256] |
p02729 | u334983390 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ["a, b = map(int, input().split(' ')\nprint(a*(a-1)/2 + b*(b-1)/2)", "a, b = map(int, input().split(' '))\nprint(int(a*(a-1)/2 + b*(b-1)/2))"] | ['Runtime Error', 'Accepted'] | ['s224480639', 's939623042'] | [9016.0, 9096.0] | [24.0, 28.0] | [63, 69] |
p02729 | u336040199 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['def combination(M,N):\n return M*(M-1)/2+N*(N-1)/2\nM,N=map (int,input().split())\nx=combination(M,N)\nprint(x)\n', 'def combination(M,N):\n return M*(M-1)/2+N*(N-1)/2\nM,N=map (int,input().split())\nx=combination(M,N)\nx=int(x)\nprint(x)\n'] | ['Wrong Answer', 'Accepted'] | ['s216329016', 's328302152'] | [2940.0, 3060.0] | [17.0, 20.0] | [111, 120] |
p02729 | u337626942 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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'] | ['s348494921', 's912045836'] | [2940.0, 2940.0] | [17.0, 17.0] | [60, 59] |
p02729 | u338644171 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the 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=(int(x) for x in input().split());\neven = m*(m-1)/2;\nodd = n*(n-2)/2;\n\nresult = even + odd;\nprint(result);', 'n,m=(int(x) for x in input().split());\nprint(n);\nprint(m);\n\neven = n * (n-1) / 2 ;\nodd = m * (m-1) /2 \n', 'm,n=(int(x) for x in input().split());\neven = m*(m-1)/2;\nodd = n*(n-1)/2;\n\nresult = even + odd;\nprint(result);', 'm,n=(int(x) for x in input().split());\neven = m*(m-1)/2;\nodd = n*(n-1)/2;\n\nresult = int(even + odd);\nprint(result);'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s222216224', 's860825929', 's951761901', 's011129378'] | [2940.0, 2940.0, 3064.0, 2940.0] | [17.0, 18.0, 17.0, 17.0] | [110, 103, 110, 115] |
p02729 | u339868244 | 2,000 | 1,048,576 | We have N+M balls, each of which has an integer written on it. It is known that: * The numbers written on N of the balls are even. * The numbers written on M of the balls are odd. Find the number of ways to choose two of the N+M balls (disregarding order) so that the sum of the numbers written on them is even. It can be shown that this count does not depend on the actual values written on the balls. | ['from math import factorial as f\nx,y=map(int,input().split())\na=f(x)//(f(x-2)*2)\nb=f(y)//(f(y-2)*2)\nprint(a+b)', 'from math import factorial as f\nx,y=map(int,input().split())\nif(x<2):\n a=0\nelse:\n a=f(x)//(f(x-2)*2)\nif(y<2):\n b=0\nelse: \n b=f(y)//(f(y-2)*2)\nprint(a+b)'] | ['Runtime Error', 'Accepted'] | ['s463636816', 's426657257'] | [2940.0, 3060.0] | [17.0, 18.0] | [109, 167] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.