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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02732 | u478719560 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\nfrom sys import stdin\nn = int(stdin.readline().rstrip())\nass = list(map(int, stdin.readline().rstrip().split()))\n\nc = collections.Counter(ass)\n\ncnum =[0]*len(c)\nkeys = c.keys()\n\ncs = {}\nfor i in keys:\n key = c[i]\n combi = key *(key-1) / 2\n cs[i] = combi\n\nsum = sum(cs.values... | ['Wrong Answer', 'Accepted'] | ['s594292986', 's822253592'] | [35484.0, 35272.0] | [568.0, 524.0] | [425, 430] |
p02732 | u482157295 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\nn = int(input())\nnum_list = list(map(int,input().split()))\na = Counter(num_list)\ncount = 0\nfor i in a.values():\n count += (i*(i-1))//2\nfor j in num_list:\n', 'from collections import Counter\nn = int(input())\nnum_list = list(map(int,input().split()))\na = Counter(num_list)\nco... | ['Runtime Error', 'Accepted'] | ['s163856407', 's172486714'] | [2940.0, 26780.0] | [17.0, 314.0] | [187, 210] |
p02732 | u485566817 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\n\nn = int(input())\na = list(map(int, input().split()))\n\nnum_count = collections.Counter(a)\ntotal = sum([num*(num-1)//2 for num in num_count.values()])\n\nfor i in range(n):\n print(total-a.count(a[i]+1))', 'import collections\n\nn = int(input())\na = list(map(int, input().split()))\n\nnum_c... | ['Wrong Answer', 'Accepted'] | ['s301014128', 's586005183'] | [26780.0, 26780.0] | [2104.0, 322.0] | [221, 223] |
p02732 | u489959379 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\nfrom math import factorial\n\n\nn = int(input())\na = list(map(int, input().split()))\nd = Counter(a)\nc = [0 for _ in range(max(a))]\nfor k, v in d.items():\n if v > 2:\n c[k - 1] = factorial(v) / factorial(2) / factorial(v - 2)\n else:\n c[k - 1] = 0\n \nf... | ['Runtime Error', 'Accepted'] | ['s620312909', 's835324544'] | [26772.0, 26908.0] | [2104.0, 651.0] | [437, 343] |
p02732 | u490489966 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['\nfrom collections import Counter\nn = int(input())\na = list(map(int, input().split()))\nc = Counter(a)\nval=0\nfor i in c.values():\n print(i) \n val += i * (i - 1) // 2 \n # val+=sum(range(i-1))\nfor i in range(n):\n b = c[a[i]] \n print(val - b + 1) ', '#D AC\nfrom collections import Counter\nn... | ['Wrong Answer', 'Accepted'] | ['s943920220', 's367400221'] | [25900.0, 25900.0] | [440.0, 352.0] | [540, 527] |
p02732 | u502731482 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import defaultdict\n\nn = int(input())\na = list(map(int, input().split()))\n\ndic = defaultdict(int)\nans1 = defaultdict(int)\nans2 = defaultdict(int)\n\ndef calc_patern1(n, ans, dic):\n for k, v in dic.items():\n ans[k] = v * (v - 1) / 2\n\n\ndef calc_patern2(n, ans, dic):\n for k, v i... | ['Wrong Answer', 'Accepted'] | ['s286923630', 's121089851'] | [41884.0, 26908.0] | [2105.0, 412.0] | [698, 294] |
p02732 | u503111914 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\nN = int(input())\nA = list(map(int,input().split()))\nB = Counter(A)\nC = {key:(B[key]*(B[key]-1)//2) for key in B}\nans = sum(B.values())\nfor i in A:\n if C[i] < 2:\n print(ans)\n else:\n ans = ans - C[i] +(B[key-1]*(B[key]-2)//2)\n print(ans)', 'from coll... | ['Runtime Error', 'Accepted'] | ['s152519800', 's689481386'] | [30780.0, 32020.0] | [153.0, 444.0] | [294, 300] |
p02732 | u514401521 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import sys\nsys.setrecursionlimit(10**6)\nfrom collections import defaultdict\n\nN = int(input())\nA = list(map(int, input().split()))\n\nd = defaultdict(int)\n\nfor i in range(N):\n d[A[i]] += 1\n\nprint(d)\na = defaultdict(int)\nb = defaultdict(int)\nfor key, value in d.items():\n a[key] = value * (value - 1)... | ['Wrong Answer', 'Accepted'] | ['s372417661', 's088802979'] | [40244.0, 38964.0] | [556.0, 470.0] | [528, 529] |
p02732 | u517447467 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nK = list(map(int, input().split()))\ncounter = dict()\nfor i in range(N):\n if K[i] not in counter:\n \tcounter[K[i]] = 1\n else:\n \tcounter[K[i]] += 1\n\nresults = 0\nremove_counter = dict()\nfor key, value in counter.items():\n remove_counter[key] = (value * (value - 1) / 2) - ((value - 1) ... | ['Wrong Answer', 'Accepted'] | ['s654106237', 's348825289'] | [35232.0, 34848.0] | [432.0, 471.0] | [418, 424] |
p02732 | u517797706 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["\nif __name__ == '__main__':\n\n n = int(input())\n A = list(map(int,input().split()))\n\n \n d = Counter(A)\n \n d2 = dict()\n \n for k,v in d.items():\n d2[k] = (v*(v-1)) // 2\n ans_sum = sum(d2.values())\n\n \n for i in A:\n ans = 0\n if i in d2:\n \... | ['Runtime Error', 'Accepted'] | ['s678913857', 's591340897'] | [32348.0, 34236.0] | [70.0, 309.0] | [605, 637] |
p02732 | u526094365 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\nimport math\n\nN = int(input())\nA = list(map(int, input().split()))\nc = collections.Counter(A)\ncnt = 0\nansx = []\nansy = []\nansy2 = []\n\nfor x, y in c.items():\n sumall += (y*(y-1)//2)\n ansy2.append(y-1)\n ansx.append(x)\n\nfor i in A:\n print(sumall - ansy2[ansx.index(i)])\n', ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s111251894', 's876009264', 's025268467'] | [26772.0, 2940.0, 26772.0] | [94.0, 18.0, 365.0] | [297, 298, 235] |
p02732 | u530786533 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\na = list(map(int, input().split()))\n\nfrom collections import Counter\nc = Counter(a)\n\nprint(c)\nfor i in range(n):\n c[a[i]] -= 1\n tmp = [x*(x-1)//2 for x in c.values()]\n print(sum(tmp))\n c[a[i]] += 1\n', 'n = int(input())\na = list(map(int, input().split()))\n\nfrom collections impor... | ['Wrong Answer', 'Accepted'] | ['s113185833', 's888368532'] | [37024.0, 32212.0] | [2105.0, 439.0] | [223, 287] |
p02732 | u531603069 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import copy\nN = int(input())\nA = list(map(int, input().split()))\n\na_types = set(A)\nfor each in a_types:\n count_dict[each - 1] += A.count(each)\n\ncount_dict = [0] * N\nfor each in A:\n count_dict[each - 1] += 1\n\nall_types = 0\nfor value in count_dict:\n all_types += value * (value - 1) // 2\n\n# resu... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s161477503', 's578432179', 's903229811', 's628830366'] | [26908.0, 26780.0, 26908.0, 26908.0] | [89.0, 2104.0, 2104.0, 321.0] | [454, 453, 763, 391] |
p02732 | u534338602 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n= int(input())\na=list(map(int, input().split()))\nb = [0]*(n+1)\nc = [0]*(n+1)\nsu = 0\n\nfor x in range(n):\n b[a[x]] += 1\n\nfor y in range(len(b)):\n if b[y] >=2:\n c[y]=combinations_count(b[y], 2)\n else:\n c[y]=0\n su += c[y]\n\nfor z in range(n):\n if c[a[z]] > 0:\n ans = s... | ['Runtime Error', 'Accepted'] | ['s518789606', 's393489352'] | [26140.0, 25644.0] | [142.0, 1779.0] | [365, 485] |
p02732 | u535171899 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\nn = int(input())\na_input = list(map(int,input().split()))\n\na_count = Counter(a_input)\n\nscore_dic={}\nexclude_dic={}\n\nfor k,v in enumerate(a_count.items()):\n score_dic[k]=v*(v-1)//2\n exclude_dic[k]=(v-1)*(v-2)//2\n\nscore_sum = sum(score_dic.values())\n\nfor i in range(n... | ['Runtime Error', 'Accepted'] | ['s372033621', 's819668573'] | [26780.0, 38964.0] | [102.0, 397.0] | [372, 363] |
p02732 | u537892680 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nA = [int(a) for a in input().split()]\ncnt = {}\ntotal = 0\n\nfor a in A:\n if a not in cnt:\n cnt[a] = 0\n cnt[a] += 1\n\nfor i in cnt.values():\n total += i * (i - 1) // 2\n\nfor i in range(N):\n print(total - (cnt[i] - 1))\n', '# D - Banned K\n\nfrom collections import Counter\... | ['Runtime Error', 'Accepted'] | ['s071344434', 's627533312'] | [25768.0, 26780.0] | [166.0, 359.0] | [249, 252] |
p02732 | u538361257 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['\ndef Get_nC2(n):\n return int(n*(n-1) / 2);\n\n\nN = int(input())\nA_i = list(map(int, input().split()))\n\nfor a_i in A_i:\n cnt = 0\n for j in range(min(A_i), max(A_i)):\n j_cnt = A_i.count(j)\n if a_i == j:\n j_cnt -= 1\n\n cnt += Get_nC2(j_cnt)\n\n print(cnt)\n', '\nde... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s229111282', 's230279103', 's385782741', 's471199353', 's015538419'] | [26140.0, 25716.0, 2940.0, 26780.0, 26780.0] | [2104.0, 2104.0, 17.0, 98.0, 547.0] | [292, 437, 421, 306, 291] |
p02732 | u541017633 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import math\nN, *A = map(int,inp.split())\n\nfor e in A:\n d = dict((i, A.count(i)) for i in set(A))\n d[e]-=1\n \n ans = 0\n for i in list(d):\n if d[i] < 2:\n continue\n ans += d[i]*(d[i]-1)/2\n print(int(ans))\n ', 'import math\nN, *A = map(int,input().split())\n\nfor ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s144302541', 's160267036', 's209352827', 's492522634', 's512759244', 's683458426'] | [3060.0, 3060.0, 26268.0, 3060.0, 25256.0, 24748.0] | [17.0, 18.0, 2104.0, 17.0, 79.0, 403.0] | [248, 252, 234, 256, 260, 285] |
p02732 | u547608423 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N=int(input())\nA=list(map(int,input().split()))\n\n\ndict_A={}\nB=list(set(A))\nsum=0\n\n\nfor b in B:\n a=A.count(b)\n sum+=a*(a-1)//2\n\nfor a in A:\n print(sum-a+1)\n\n ', 'N=int(input())\nA=list(map(int,input().split()))\n\n\ndict_A={}\nB=list(set(A))\nsum=0\n\n\nfor a in A:\n if a not in dict... | ['Wrong Answer', 'Accepted'] | ['s445018518', 's688715425'] | [24872.0, 28604.0] | [2104.0, 366.0] | [173, 274] |
p02732 | u549383771 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['\nn = int(input())\nnum_list = list(map(int,input().split()))\nnum_list2 = [0]*n\nnum_list3 = [0]*n\nfor i in num_list:\n num_list2[i-1] += 1\nfor i in range(n):\n num_list3[i-1] = n*(n-1) // 2\n\nfor i in num_list:\n ans = n*(n-1) // 2\n print(ans-num_list3[i-1]+sum(num_list3))\n # elif size == 1:\n ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s264792927', 's905669996', 's977949418', 's299075722'] | [26140.0, 29088.0, 2940.0, 25716.0] | [2105.0, 318.0, 17.0, 420.0] | [386, 721, 996, 352] |
p02732 | u552176911 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import math\n\n\ndef kumiawase(n):\n if n == 0 or n == 1:\n return 0\n return 5 * n + 5\n\n\nn = int(input())\naL = list(map(int, input().split(" ")))\n\nd = {}\n\nfor ai in aL:\n if ai in d:\n d[ai] += 1\n else:\n d[ai] = 1\n\nfor ai in aL:\n sm = 0\n for dk, di in d.items():\n... | ['Wrong Answer', 'Accepted'] | ['s489407953', 's612714891'] | [26140.0, 26780.0] | [2104.0, 529.0] | [411, 325] |
p02732 | u553070631 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["import collections\nn=int(input())\na=list(map(int,input().split()))\nc = collections.Counter(a)\n\na1=len(list(set(a)))\n\ntotal=0\nfor j in range(a1):\n x=c.most_common()[j][1]\n total+=x*(x-1)/2\n print('total',total)\n\nfor i in range(n):\n ans=total-a.count(a[i])+1\n print(int(ans))", 'import coll... | ['Wrong Answer', 'Accepted'] | ['s624749465', 's838772733'] | [29080.0, 26780.0] | [2105.0, 443.0] | [288, 297] |
p02732 | u553600587 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from functools import lru_cache\n\nN = int(input().strip())\nA = [int(v) for v in input().strip().split()]\nC = {}\nS = {}\n\n\n@lru_cache\ndef calc(C, a):\n C[a] -= 1\n sum_ = sum([S[n] for n in C.values() if n > 1])\n C[a] += 1\n return sum_\n\nfor a in A:\n C.setdefault(a, 0)\n C[a] += 1\n\n\nfor... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s040321682', 's292143978', 's808714369', 's845152161'] | [26892.0, 26140.0, 26268.0, 52344.0] | [80.0, 2105.0, 153.0, 1454.0] | [343, 425, 421, 389] |
p02732 | u555458045 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\na = list(map(int, input().split()))\nfor i in range(n):\n acopy = a.copy()\n del acopy[i]\n c = collections.Counter(acopy)\n itm = c.values()\n ans = 0\n for j in itm:\n ans += j*(j-1)//2\n print(ans)\n', 'import collections\n\nsys.stdin = io.StringIO(_INPUT)\nn = int(inp... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s222061630', 's847421658', 's820696343'] | [32232.0, 9228.0, 34180.0] | [74.0, 29.0, 259.0] | [237, 288, 285] |
p02732 | u555688810 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter,defaultdict\nimport sys\ninput = sys.stdin.readline\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 2*(10**5)\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( ... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s069308646', 's111706600', 's191621510', 's485737069', 's496492560', 's566846230', 's656329672', 's785119196', 's392401462'] | [50244.0, 26552.0, 27784.0, 26644.0, 27792.0, 26660.0, 50272.0, 26672.0, 32488.0] | [2106.0, 2105.0, 2105.0, 2105.0, 2105.0, 2105.0, 2107.0, 2104.0, 320.0] | [788, 680, 755, 489, 766, 682, 717, 753, 292] |
p02732 | u556610039 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\n\nnum = int(input())\na_i = list(map(int, input().split()))\nanslist = collections.Counter(a_i)\nans = sum(anslist.values())\nfor x in range(num):\n val = a_i[x]\n cnt = a_i.count(val)\n sa = (cnt - 1)\n print(ans - sa)', 'import collections\n\nnum = int(input())\na_i = list(map(int, i... | ['Wrong Answer', 'Accepted'] | ['s925950930', 's853146845'] | [26780.0, 26780.0] | [2104.0, 349.0] | [241, 263] |
p02732 | u563838154 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\na = list(map(int,input().split()))\nx = [0]*max(a)\nfor i in a:\n x[i-1]+=1\n\n\nfor i in range(1,n+1):\n x[a[i-1]-1]-=1\n count = 0\n x_ = [(k*k-1)/2 for k in x if k>=2]\n count = sum(x_)\n # for j in x:\n # if j>=2:\n # count += int((j*(j-1)/2))\n x[a[i-1]-1]... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s013620150', 's107562405', 's566335794', 's841490850'] | [24748.0, 2940.0, 26268.0, 24744.0] | [2104.0, 18.0, 2104.0, 330.0] | [323, 317, 325, 334] |
p02732 | u563992898 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\nl = [int(i) for i in input().split()]\n\n\nans = 0\nfor i in range(n):\n j = l.count(i)\n ans += int(j * (j - 1) / 2)\n', 'from collections import Counter\n\nn = int(input())\nl = [int(i) for i in input().split()]\n\nS = Counter(l)\n\nans = 0\nfor i in S.values():\n ans += int(i * (i - 1) /... | ['Wrong Answer', 'Accepted'] | ['s721505270', 's552691293'] | [26268.0, 26780.0] | [2104.0, 398.0] | [135, 229] |
p02732 | u569322757 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\nimport math\n\n\ndef comb(n, r):\n if n < r:\n return 0\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nn = int(input())\na = list(map(int, input().split()))\nc = collections.Counter(a)\n\npre = 0\nfor i in range(n):\n if i == 0:\n c[a[i]] -= 1... | ['Wrong Answer', 'Accepted'] | ['s474419664', 's740769948'] | [26780.0, 25896.0] | [2104.0, 1686.0] | [418, 315] |
p02732 | u571867512 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\n\nN = int(input())\nA = list(map(int,input().split()))\nAS = set(A)\nprint(AS)\ndef comb(n):\n return n*(n-1)//2\n\nL = collections.Counter(A)\n\nfor i in range(N):\n ans = 0\n for a in AS:\n if A[i] == a:\n ans += comb(L[a]-1)\n else:\n ans += comb(L[a... | ['Wrong Answer', 'Accepted'] | ['s083268276', 's580974634'] | [29856.0, 28732.0] | [2105.0, 535.0] | [319, 299] |
p02732 | u576927476 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import sys\n\nfrom scipy.misc import comb \n\n#import numpy as np\n\nn = int(input())\n\na = [int(i) for i in input().split()]\n\nnum = [[-1,0,0]]*(200000)\n\nasort = sorted(a)\n\n#print(asort)\n\nsum = 0\ni = 0\nwhile i < n-1:\n counter = 1\n index = asort[i]\n while i < n-1 and asort[i] == asort[i+1]:\n ... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s576283369', 's602532595', 's705721653', 's375329284'] | [44820.0, 36468.0, 35820.0, 25716.0] | [2113.0, 2110.0, 2110.0, 424.0] | [529, 525, 531, 353] |
p02732 | u579699847 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\ndef I(): return int(input())\ndef LI(): return list(map(int,input().split()))\n##################################################\nN = I()\nA = LI()\ncount = collections.Counter(A)\nnC2 = {}\nfor x in count.values():\n nC2[x] = x*(x-1)//2\nsum = sum(nC2.values())\nfor x in A:\n if x-1 in nC2... | ['Wrong Answer', 'Accepted'] | ['s623035779', 's121994038'] | [39984.0, 26780.0] | [391.0, 426.0] | [421, 368] |
p02732 | u586639900 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nA = list(map(int, input().split()))\n\ncounts = [0] * (N+1)\n\nfor i in range(1, N+1):\n counts[A[i-1]] += 1\n\nsum_ = 0\nfor k in range(1, N+1):\n sum_ += counts[k] * (counts[k]-1) // 2\n\nres = []\nfor k in range(1, N+1):\n \n res.append(sum_ - (counts[A[k-1]] - 1))\n\nprint(res)', 'N ... | ['Wrong Answer', 'Accepted'] | ['s396888396', 's421307138'] | [30844.0, 26408.0] | [226.0, 341.0] | [349, 326] |
p02732 | u586662847 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\n\n\ndef resolve():\n N = int(input())\n A = sorted(map(int, input().split()))\n\n counter = collections.Counter(A)\n ans = 0\n\n for i in counter.values():\n ans += i * (i - 1) // 2\n\n for a in A:\n count = counter[a]\n print(ans - (count * (count - 1) // 2)... | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s645822930', 's756737436', 's797622309', 's534686673'] | [26780.0, 26268.0, 29476.0, 26780.0] | [432.0, 148.0, 111.0, 370.0] | [364, 343, 357, 363] |
p02732 | u587589241 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['def comb(n,k):\n nCk = 1\n MOD = 10**9+7\n\n for i in range(n-k+1, n+1):\n nCk *= i\n nCk %= MOD\n\n for i in range(1,k+1):\n nCk *= pow(i,MOD-2,MOD)\n nCk %= MOD\n return nCk\nn=int(input())\nans=[0 for i in range(n)]\na=list(map(int,input().split()))\n\nfor i in range(n):\... | ['Wrong Answer', 'Accepted'] | ['s711120943', 's144840629'] | [35388.0, 41580.0] | [1074.0, 334.0] | [618, 432] |
p02732 | u592035627 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nA = list(map(int,input().split()))\nimport copy\n\n\ns = [0 for i in range(N)]\nfor i in range(N):\n s[A[i]-1] += 1\n \ns1 = copy.copy(s)\nfor i in range(N):\n if s[i] == 0:\n s1[i] = 0\n else:\n s1[i] -= 1\n\namount = sum(s)\n\nfor i in range(N):\n print(amount-s1[A[i]-... | ['Wrong Answer', 'Accepted'] | ['s346841768', 's466592918'] | [25644.0, 26140.0] | [328.0, 425.0] | [307, 635] |
p02732 | u595905528 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nAlist=list(map(int, input().split()))\nnumdic = {}\nfor i in Alist:\n if i in numdic:\n numdic[i] += 1\n else:\n numdic[i] = 1\nApple = 0\nfor i in numdic.values():\n Apple += i*(i-1)//2\nfor i in Alist:\n tmp = Apple\n tmp -= numdic[i]+1\n print(tmp)', 'N = int(input... | ['Wrong Answer', 'Accepted'] | ['s088053854', 's248570570'] | [26268.0, 24748.0] | [328.0, 351.0] | [287, 289] |
p02732 | u595952233 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\nn = int(input())\na = list(map(int, input().split()))\n\nc = dict(Counter(a))\ndp_on = {}\ndp_off = {}\nfor k, v in c.items():\nif v < 2:\n dp_on[k] = 0\n dp_off[k] = 0\nelif v < 3:\n dp_on[k] = 1\n dp_off[k] = 0\nelse:\n dp_on[k] = int(v*(v-1)/2)\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s120470142', 's669148897', 's816583249'] | [2940.0, 26780.0, 40112.0] | [17.0, 106.0, 379.0] | [447, 477, 466] |
p02732 | u602773379 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\nN = int(input())\nA = list(map(int,input().split()))\n\ndef ch_2(n):\n\treturn n*(n-1)/2\n\ncount=Counter(A)\nans=0\nfor i in range(len(count)):\n\tans+=ch_2(count[i])\nfor j in range(N):\n\tprint(ans-ch_2(count[A[j]]-1))\n\n\n\n\n\n', 'from collections import Counter\nN = int(input()... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s331500009', 's891071424', 's216306363'] | [26780.0, 26780.0, 26780.0] | [475.0, 591.0, 552.0] | [245, 304, 293] |
p02732 | u607075479 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nA = list(map(int, input().split()))\nB = [[] for i in range(N)]\nans = [0]*N\nfor k, a in enumerate(A):\n a = a - 1\n B[a].append(k)\n\n\nS = 0\nfor b in B:\n lenb = len(b)\n if lenb >= 1:\n S += lenb * (lenb-1) / 2\n\nfor i, b in enumerate(B):\n for j, k in enumerate(b):\n ... | ['Wrong Answer', 'Accepted'] | ['s589751836', 's564587373'] | [51492.0, 47064.0] | [536.0, 644.0] | [346, 362] |
p02732 | u608579392 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import copy\nimport numpy as np\nfrom math import factorial\n\ndef num_choice_2(N):\n if N > 1:\n return factorial(N) // (factorial(N - 2)* 2)\n else:\n return 0\n\nN = int(input())\nA = [int(x) for x in input().split()]\n\nnums = np.zeros(N, dtype=int)\nfor a_i in A:\n nums[a_i - 1] += 1\n\nfo... | ['Runtime Error', 'Accepted'] | ['s695811691', 's700268351'] | [34040.0, 25764.0] | [483.0, 437.0] | [434, 427] |
p02732 | u614314290 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import deque, Counter as cnt\nfrom collections import defaultdict as dd\nfrom operator import itemgetter as ig\nfrom bisect import bisect_right as bsr\nfrom math import factorial, ceil, floor\nimport sys\nsys.setrecursionlimit(1000000)\n\n\nargs = None\nINF = float("inf")\nMOD = int(1e9 + 7)\n\n\ndef... | ['Runtime Error', 'Accepted'] | ['s118153786', 's322559401'] | [35344.0, 35344.0] | [274.0, 461.0] | [1193, 1060] |
p02732 | u617228707 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nlist = list(map(int,input().split()))\nlist.append(-1)\nkosuu = [0] * N\ntotal = 0\nlisted = sorted(list)\ni = 0\ncount = 1\nwhile i < N:\n a = listed[i]\n if a == listed[i+1]:\n count += 1\n else:\n kosuu[a-1] = count\n total += ( count * (count-1) ) //2\n count... | ['Wrong Answer', 'Accepted'] | ['s087113610', 's226570872'] | [26140.0, 26140.0] | [497.0, 502.0] | [407, 426] |
p02732 | u622847899 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N,A = [input() for i in range(2)]\nA=A.split()\nN=int(N)\nA=[int(i) for i in A]\n\na=0\nfor i in range(N):\n for j in A[i+1:]:\n if A[i]==j:\n a+=1\nprint(a)\n\nans=[]\nb=[]\nfor k in range(N):\n b_k=0\n for i in range(N-1):\n if A[k]==A[i]:\n b_k+=1\n ans.append(a-b_k)... | ['Wrong Answer', 'Accepted'] | ['s680065994', 's220496934'] | [26140.0, 24748.0] | [2104.0, 341.0] | [345, 250] |
p02732 | u634079249 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import sys\nimport os\nimport collections\n\n\ndef main():\n if os.getenv("LOCAL"):\n sys.stdin = open("input.txt", "r")\n\n L = int(sys.stdin.buffer.readline().decode().rstrip())\n print(L ** 3 / 27)\n\n\nif __name__ == \'__main__\':\n main()\n', 'import sys\nimport os\nimport collections\n\ndef m... | ['Wrong Answer', 'Accepted'] | ['s366349634', 's249217857'] | [3316.0, 25568.0] | [20.0, 294.0] | [247, 447] |
p02732 | u640922335 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\nN=int(input())\nA = list(map(int,input().split()))\nans = [0] * N\nB = Counter(A)\nfor i in range(N):\n ans[i] = B[A[i]]-1\n\ntotal=sum(ans)\nC=[]\nfor i in range(N):\n c = (total-ans[i])//2\n C.append(c)\n\nfor num in C:\n print(num)', 'from collections import Counter\nN=... | ['Wrong Answer', 'Accepted'] | ['s941402094', 's484455096'] | [34020.0, 34404.0] | [268.0, 249.0] | [264, 266] |
p02732 | u644224332 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import math\n\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nif __name__ == \'__main__\':\n n = int(input())\n a = list(map(int, input().split(" ")))\n\n total = 0\n c_list = []\n a_count_list = []\n for i in range(n):\n coun... | ['Wrong Answer', 'Accepted'] | ['s439526574', 's049353526'] | [26140.0, 36124.0] | [2104.0, 452.0] | [900, 1506] |
p02732 | u652081898 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\nfrom copy import deepcopy\n\nn = int(input())\na = list(map(int, input().split()))\nc = Counter(a)\nall_comb = 0\nfor v in c.values():\n all_comb += v*(v-1)/2\n\nfor i in range(n):\n tmp = c[a[i]]\n print(all_comb-tmp+1)\n', 'from collections import Counter\nfrom copy import ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s106258753', 's857438192', 's879370973', 's969261556'] | [26780.0, 49880.0, 26780.0, 25896.0] | [456.0, 2106.0, 97.0, 424.0] | [251, 273, 244, 230] |
p02732 | u667024514 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\nlis = list(map(int,input().split()))\nnum = [0 for i in range(n)]\nfor nn in lis:\n num[nn-1] += 1\nans = 0\nfor nnn in num:\n ans += (nnn*(nnn-1))//2\nfor i in range(n):\n print(ans-(num[lis[i]]*(num[lis[i]]-1))//2+((num[lis[i]]-1)*(num[lis[i]]-2))//2)', 'n = int(input())\nlis = list(map(int,inp... | ['Runtime Error', 'Accepted'] | ['s190172775', 's405216556'] | [26140.0, 26140.0] | [410.0, 410.0] | [265, 266] |
p02732 | u671446913 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections as cl\nfrom math import factorial\n\ndef comb(n, r):\n if n >= r:\n return int(factorial(n) / factorial(r) / factorial(n - r))\n elif n == 1:\n return 1:\n else:\n return 0\n \nn = int(input())\na = list(map(int, input().split()))\n\nclc = cl.Counter(a)\n\n\nnpair = 0\nfor (k, v) in ... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s646984932', 's835332261', 's997508655', 's376769798'] | [2940.0, 38284.0, 2940.0, 25900.0] | [17.0, 751.0, 17.0, 1681.0] | [488, 526, 493, 495] |
p02732 | u673101577 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["import collections\n\nN = int(input())\nA = list(map(int, input().split(' ')))\n\n\ndef main(n: int, a: list):\n counter = collections.Counter(a)\n pairs = {k: v * (v - 1) / 2 for k, v in counter.items()}\n pairs_all = sum(pairs.values())\n\n print(pairs)\n\n counted = {}\n\n for i in range(N):\n\n ... | ['Wrong Answer', 'Accepted'] | ['s775462597', 's518139115'] | [35484.0, 33948.0] | [502.0, 464.0] | [811, 410] |
p02732 | u674588203 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import numpy as np\n\nN=int(input())\nA=np.array(list(map(int,input().split())))\n\n\nunique_num, counts =np.unique(A,return_counts=True) \n\n\n# print(counts)\ndic0={} \ndic1={} \ndic2={} \n\nCombination_pattern\u3000= []\nfor i in range(len(counts)):\n Combination = counts[i] * (counts[i]-1) // 2 \n dic0[uniq... | ['Runtime Error', 'Accepted'] | ['s225944523', 's698970192'] | [8928.0, 76536.0] | [26.0, 897.0] | [2017, 2015] |
p02732 | u676933207 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import copy\n\n#N = int(input())\n#A = list(map(int,input().split()))\nN = 5\nA = [3,3,3,3,3]\n\n\nnCr = {}\ndef cmb(n,r):\n if r > n:\n return 0\n if r == 0 or r == n:\n return 1\n if r == 1:\n return n\n if (n,r) not in nCr:\n return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s230396377', 's411826219', 's111229488'] | [3444.0, 26140.0, 26780.0] | [22.0, 2104.0, 331.0] | [519, 484, 191] |
p02732 | u678505520 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\nn = int(input())\nA = list(map(int,input().split()))\nB = collections.Counter(A)\nC = B.copy()\ntotal = 0\nfor i in B.values():\n total += i*(i-1)//2\nfor i in A:\n print(total - i)', 'import collections\nn = int(input())\nA = list(map(int,input().split()))\nB = collections.Counter(A)\nC = B... | ['Wrong Answer', 'Accepted'] | ['s140522374', 's351094351'] | [27448.0, 28216.0] | [268.0, 359.0] | [198, 203] |
p02732 | u679439110 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import heapdict\n\nn = int(input())\nla = list(map(int, input().split()))\n\nct = [0] * (2*10**5+1)\nans = [0] * (n+1)\nld = [0] * (n+1)\n\nfor i in range(len(la)):\n ct[la[i]] += 1\n\nsa = set(la)\n\nfor j in sa:\n ans[j] = ct[j] * (ct[j]-1) // 2\n ld[j] = ans[j] - ((ct[j]-2) * (ct[j]-1) // 2)\n\ntotal = su... | ['Runtime Error', 'Accepted'] | ['s573053052', 's105781053'] | [3188.0, 26140.0] | [20.0, 388.0] | [404, 387] |
p02732 | u686174642 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['def nc2(n):\n if n==0:\n return 0\n return n*(n-1)/2\n\n\nn=int(input())\narr=[int(i) for i in input().strip().split(" ")]\nans=0\ndic={}\nfor i in arr:\n dic[i]=dic.get(i,0)+1\nfor i in dic:\n if dic[i]==1 :\n continue\n ans+=nc2(dic[i])\n \nprint(dic)\n\nfor i in range(n):\n curr_... | ['Wrong Answer', 'Accepted'] | ['s398621367', 's642062632'] | [32164.0, 32268.0] | [344.0, 337.0] | [393, 394] |
p02732 | u688219499 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N=int(input())\nA=list(map(int,input().split()))\nA_new=sorted(A)\nn=0\nsum_number=0\nindex=[]\nnumber=[]\nfor i in range(N-1):\n if A_new[i]==A_new[i+1]:\n n=n+1\n else:\n sum_number=n*(n+1)/2+sum_number\n index.append(i)\n number.append(n+1)\n n=0\nif n!=0:\n sum_number=n... | ['Wrong Answer', 'Accepted'] | ['s398588676', 's493197475'] | [28856.0, 26268.0] | [2105.0, 365.0] | [597, 205] |
p02732 | u690184681 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\n\nN = int(input())\nA = list(map(int,input().split()))\n\na = list(set(A))\ncc = Counter(A)\ndup = [x for x in a if cc[x] > 1]\nm = len(a)\nl = len(A) \nal = sum(cc.values())\n\nfor k in A:\n if k in dup:\n print(int(al-cc[k]+1))\n else :\n print(int(al))', 'from c... | ['Wrong Answer', 'Accepted'] | ['s770035689', 's443824186'] | [27820.0, 28852.0] | [2105.0, 492.0] | [292, 304] |
p02732 | u692054751 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\n\ndef LI():\n\treturn [ int(s) for s in input().split() ]\n\nN = int(input())\nA = LI()\n\nc_counter = [0]*(2*(10**5))\n\nfor a in A:\n c_counter[a]+=1\n\ntotal = 0\ntotal_dict = [0]*(2*(10**5))\n\nfor a in A:\n v = c_counter[a]\n if v >= 2:\n comb = v*(v-1)//2\n total_dict[a] = comb\n ... | ['Wrong Answer', 'Accepted'] | ['s421519369', 's916424718'] | [26780.0, 26780.0] | [441.0, 378.0] | [434, 460] |
p02732 | u693391925 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N=int(input())\nA = list(map(int, input().split()))\n\ndic={}\nfor i in A:\n if i in dic.keys():\n dic[i]+=1\n else:\n dic.setdefault(i,1)\n\nhoge=0\nfor i in dic.values():\n hoge+=i*(i-1)\nhoge =hoge/2\n\nfor k in A:\n print(hoge-(dic[k]-1))', 'N=int(input())\nA = list(map(int, input().spli... | ['Wrong Answer', 'Accepted'] | ['s707384392', 's936827924'] | [26268.0, 25644.0] | [426.0, 346.0] | [252, 257] |
p02732 | u693945629 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import sys\nfrom operator import mul\nfrom functools import reduce\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\n\nn = int(input())\nl = [int(x) for x in input().split()]\n\n\ncl = []\nl... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s120043455', 's489654267', 's623350698', 's738896579', 's182026606'] | [27024.0, 26636.0, 26636.0, 41484.0, 31892.0] | [2105.0, 116.0, 2105.0, 517.0, 474.0] | [800, 904, 948, 406, 806] |
p02732 | u694422786 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\nfrom collections import defaultdict\n\nn = int(input())\nl = list(map(int, input().split()))\n\ndict = defaultdict(int)\nfor i in l:\n dict[i]+=1\nprint(dict)\n\nans = 0\nfor v in dict.values():\n ans += int((v*(v-1)) // 2)\n\nfor k in l:\n print(ans - (dict[k] - 1))\n', 'from math import... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s657092754', 's869099787', 's662796714'] | [26780.0, 26140.0, 26780.0] | [378.0, 66.0, 339.0] | [281, 337, 269] |
p02732 | u695261159 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n,a = [input().split() for i in range(2)]\n\nfor index, item in enumerate(a):\n count = 0\n for chk_index, chk_item in enumerate(a):\n if index == chk_index:\n continue\n for cnt_index, cnt_item in enumerate(a[chk_index+1:]):\n if index == cnt_index:\n continue... | ['Wrong Answer', 'Accepted'] | ['s404801397', 's624480057'] | [19996.0, 26780.0] | [2105.0, 1761.0] | [391, 424] |
p02732 | u696684809 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\na =list(map(int,input().split()))\nd = [0]*(n+1)\nanswer = 0\nfor i in range(n):\n d[a[i]]+=1\nfor j in range(n):\n answer+= (d[j]*(d[j]-1))//2\nfor k in range(n) \n print(answer+1-(d[a[k]]))', 'n = int(input())\na =list(map(int,input().split()))\nd = [0]*(n+1)\nanswer = 0\nfor i in range(n):\n ... | ['Runtime Error', 'Accepted'] | ['s504691487', 's712774457'] | [9016.0, 32324.0] | [29.0, 226.0] | [204, 205] |
p02732 | u697696097 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n=int(input())\narr=list(map(int,input().split()))\ntt=[0]*(n+7)\n\ntotal=0\n\nfor a in range(n):\n tt[a]+=1\n\nfor t in tt:\n total += (t*(t-1)//2)\n\nfor i in range(n):\n n = tt[arr[0]]\n d = (n*(n-1)//2) - ((n-1)*(n-2)//2)\n print(total-d)\n# x * x-1 // 2', 'n=int(input())\narr=list(map(int,input().split()))\... | ['Wrong Answer', 'Accepted'] | ['s291330765', 's284230478'] | [32176.0, 32160.0] | [215.0, 255.0] | [247, 243] |
p02732 | u698849142 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\nn=int(input())\na=list(map(int,input().split()))\nd=collections.Counter(a)\ntotal=sum([(v-1)*v//2, for v in d.values()])\nfor x in a:\n print(total-d[x]+1)', 'n=int(input())\na=list(map(int,input().split()))\nd={}\nfor x in a:\n if d.get(x):\n d[x]+=1\n continue\n d[x]=1\nto... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s023071124', 's085572397', 's631202113', 's777546133', 's989752967', 's373089297'] | [2940.0, 26140.0, 26140.0, 24748.0, 24748.0, 26780.0] | [17.0, 310.0, 2104.0, 2105.0, 133.0, 329.0] | [172, 183, 190, 233, 220, 171] |
p02732 | u698919163 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nA = list(map(int,input().split()))\nimport collections as col\n \nnum _list= set(A)\nca = col.Counter(A)\n\nnum = 0\n\nfor i in num_list:\n if ca[i] == 1:\n continue\n else:\n num += (ca[i]*(ca[i]-1))//2\n \nfor i in A:\n ans = num - (ca[i]-1)\n print(ans)', 'N = int... | ['Runtime Error', 'Accepted'] | ['s605802000', 's557992738'] | [2940.0, 29312.0] | [18.0, 379.0] | [290, 290] |
p02732 | u699547221 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nA = list(map(int, input().split()))\n\nANSWER = []\nfor i in range(N):\n A_ = A.copy()\n del A_[i]\n unique_i = list(set(A_))\n\n answer_i = 0\n for j in unique_i:\n answer_i += (A_.count(j) * (A_.count(j)-1)/2)\n \n ANSWER.append(int(answer_i))\n \nprint(ANSWER)', 'N ... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s051103532', 's580300132', 's821049080', 's894009528', 's938555839', 's179306160'] | [26268.0, 26140.0, 26140.0, 34136.0, 3064.0, 36080.0] | [2104.0, 2104.0, 65.0, 229.0, 19.0, 898.0] | [297, 278, 286, 209, 297, 207] |
p02732 | u699944218 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections as cl\nN = int(input())\nA = list(map(int,inpput().split()))\ncn = cl.Counter(A)\nsumC = sum([n*(n-1)//2 for n in cl.values()])\nfor k in range(N):\n print(sumC - cn[A[k]] +1)', 'import collections as cl\nn = int(input())\nA = list(map(int,input().split()))\ncn = cl.Counter(A)\nsumC = sum([(n-2)*(... | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s144729415', 's371166371', 's381025388', 's458255813', 's814894889', 's967216419', 's572801220'] | [3316.0, 26780.0, 26780.0, 26780.0, 3316.0, 25644.0, 25900.0] | [20.0, 427.0, 174.0, 437.0, 20.0, 2104.0, 348.0] | [189, 191, 198, 188, 186, 185, 200] |
p02732 | u705007443 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["import numpy as np\nn=int(input())\na=list(np.fromstring(input(),int,sep=' '))\na_=list(set(a))\ndic={}\nans={}\nfor i in a_:\n dic[i]=a.count(i)\n \ndef check(x):\n lst_=lst\n count=0\n ans=0\n dic_=dic\n for i in a_:\n if x==i:\n dic_[x]-=1\n break\n for i in dic... | ['Runtime Error', 'Accepted'] | ['s593509734', 's348718506'] | [27848.0, 30808.0] | [2109.0, 468.0] | [430, 225] |
p02732 | u709304134 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\ndef C(n):\n return n * (n-1) // 2\nN = int(input())\nA = list(map(int,input().split()))\nc = collections.Counter(A)\nd = {}\nsm = 0\nfor k,v in c.most_common():\n d[k] = v\n sm += C(v)\nfor a in A:\n print (sm - 1 + d[a])', 'import collections\ndef C(n):\n return n * (n-1) // 2\nN =... | ['Wrong Answer', 'Accepted'] | ['s788110720', 's451394522'] | [38836.0, 38840.0] | [397.0, 415.0] | [241, 241] |
p02732 | u713914478 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections \nfrom collections import Counter\n*l, = map(int, input().split())\nc = Counter(l)\n\nA = [int(i*(i-1)/2) for i in c.values()]\nA_sum = sum(A)\n\nfor j in l:\n\tprint(A_sum - c[j] + 1)', 'import collections \nfrom collections import Counter\n*l, = map(int, input().split())\nc = Counter(l)\n\nA = [i... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s039918045', 's939835224', 's037878970'] | [3316.0, 3444.0, 26780.0] | [21.0, 21.0, 326.0] | [193, 193, 206] |
p02732 | u725133562 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["def main():\n n = int(input())\n a = tuple(map(int, input().split()))\n ans = 0\n lim = max(a)\n amount = [0]*lim\n for i in range(lim):\n amount[0] = a.count(i+1)\n ans += amount[i]*(amount[i]-1)//2\n #print(ans)\n for j in range(n):\n ansout = ans\n #print(amount[... | ['Wrong Answer', 'Accepted'] | ['s461547890', 's158560375'] | [26396.0, 34168.0] | [2104.0, 546.0] | [411, 312] |
p02732 | u726285999 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import itertools\n\n\nN = int(input())\nAn = [int(x) for x in input().split()]\n\n\nL = []\nfor i in range(0,N+1):\n l = [0] * i\n L.append(len(list(itertools.combinations(l,2))))\n \n\nCn = [An.count(i) for i in range(1,N+1)]\n\n\nDn = [L[Cn[i-1]] for i in range(1,N+1)]\ns = sum(Dn)', 'import copy\n\nN = in... | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s037992727', 's607474161', 's647658552', 's804616543', 's828355914', 's926553895', 's292775558'] | [26140.0, 26908.0, 26140.0, 25768.0, 26012.0, 25716.0, 26780.0] | [2105.0, 2104.0, 2104.0, 72.0, 2108.0, 78.0, 370.0] | [359, 287, 319, 349, 259, 306, 279] |
p02732 | u729790965 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n=(int)(nput())\na=input().split()\nfor i in range(n):\n a[i]=(int)(a[i])\n \ndic={}\nsum=0\nfor i in range(n):\n if not a[i] in dic:\n dic[a[i]]=1\n else:\n dic[a[i]]+=1\n sum+=dic[a[i]]-1\n\nfor i in a:\n print(sum-dic[i]+1)\n\n', 'n=(int)(input())\na=input().split()\nfor i in range(n):\n a[i]=(int)(... | ['Runtime Error', 'Accepted'] | ['s055203205', 's072346097'] | [8992.0, 31860.0] | [25.0, 257.0] | [227, 228] |
p02732 | u731322489 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\nA = list(map(int, input().split()))\n\nC = list(itertools.combinations(A, 2))\nC = list(c for c in C if c[0] == c[1])\nequal = len(C)\n\nfor i in range(n):\n A_tmp = A[: i] + A[i + 1: ]\n equal_i = A_tmp.count(A[i])\n print(equal - equal_i)', 'import math\nimport collections\n\nn = int(inpu... | ['Runtime Error', 'Accepted'] | ['s349957948', 's588133637'] | [26268.0, 26780.0] | [65.0, 338.0] | [257, 268] |
p02732 | u731368968 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nA = list(map(int, input().split()))\ncount = [0] * 200005\nfor a in A:\n count[a] += 1\n\ns = 0\nfor c in count:\n s += c * (c - 1) // 2\nprint(s)\n\nfor a in A:\n c = count[a]\n x = c * (c - 1) // 2\n c -= 1\n y = c * (c - 1) // 2\n\n print(s - x + y)\n', 'N = int(input())\nA =... | ['Wrong Answer', 'Accepted'] | ['s281156960', 's805093285'] | [24748.0, 26268.0] | [392.0, 385.0] | [275, 266] |
p02732 | u736470924 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\ndA = {}\nfor a in input().split():\n if a in dA:\n dA[a] += 1\n else:\n dA[a] = 1\n\ncA = {}\nfor a in dA:\n cA[a] = dA[a] * (dA[a] - 1) // 2\n\nfor a in A:\n print(sum(cA.values()) - dA[a] + 1)\n', 'n = int(input())\ndA = {}\nA = []\nfor a in input().split():\n A.append... | ['Runtime Error', 'Accepted'] | ['s429487389', 's444411377'] | [32636.0, 36508.0] | [150.0, 359.0] | [226, 255] |
p02732 | u736641785 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from sys import stdin\ninput = stdin.readline\n\nN = int(input())\nA = list(map(int,input().split()))\nimport collections\nc = collections.Counter(A)\n\nfor i in A:\n temp = c.copy()\n temp[i] = temp[i]-1\n counter = 0\n for j in c.keys():\n n = temp[j]\n if n >= 2:\n counter += n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s845176823', 's902754120', 's013598588'] | [33784.0, 32692.0, 24748.0] | [2105.0, 2105.0, 420.0] | [330, 284, 223] |
p02732 | u741612283 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\na_list = [int(x) for x in input().split()]\na_dict = {}\n\nfor a in a_list:\n if a in a_dict.keys():\n a_dict[a] += 1\n else:\n a_dict[a] = 0\n\nfor a in a_list:\n print(a_dict[a])', 'n = int(input())\na_list = [int(x) for x in input().split()]\na_dict = {}\n\nfor a in a_list:\n if a in a_... | ['Wrong Answer', 'Accepted'] | ['s201958091', 's977474949'] | [24744.0, 24748.0] | [279.0, 351.0] | [196, 270] |
p02732 | u742899538 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nA = list(map(int, input().split()))\n\nnumber = defaultdict(int)\nfor a in A:\n number[a] += 1\n\ndef combination(n, r):\n denominator = 1\n for i in range(n, n - r, -1):\n denominator *= i\n numerator = factorial(r)\n return denominator // numerator\n\ncombi = {}\ncombi2 = {}\... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s467338579', 's498320156', 's572946189', 's541248012'] | [26140.0, 2940.0, 26268.0, 38972.0] | [65.0, 17.0, 67.0, 518.0] | [658, 680, 613, 677] |
p02732 | u745687363 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\nA = list(map(int, input().split())\nfrom collections import Counter\nL = list(Counter(A))\nLV = L.values()\n\nans = 0\nfor x in LV:\n ans += x*(x-1)//2\n\nfor k in range(n):\n print(ans-(A[k]-1)) ', 'n = int(input())\nA = list(map(int, input().split()))\nfrom collections import Counter\nD = Co... | ['Runtime Error', 'Accepted'] | ['s693446752', 's988373611'] | [2940.0, 25644.0] | [17.0, 358.0] | [209, 211] |
p02732 | u746206084 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n=int(input())\nli=list(map(int,input().split()))\nd={}\ndif={-1}\nans={}\nfor i in range(n):\n if li[i] not in dif:\n dif|={li[i]}\n if d.get(li[i])!=None:\n d[li[i]]+=1\n else:\n d[li[i]]=1\ndif.remove(-1)\nfor i in dif:\n g=0\n for j in dif:\n if i!=j:\n ... | ['Wrong Answer', 'Accepted'] | ['s375730977', 's522363596'] | [28956.0, 38992.0] | [2105.0, 558.0] | [425, 363] |
p02732 | u751057101 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["def cmb(n):\n return n * (n-1) / 2\n\ndef main():\n\n N = int(input())\n\n a_l = [0] * N\n\n nums = list(map(int, input().split()))\n\n for i in nums:\n a_l[i-1] += 1\n\n for i in nums:\n a_l[i-1] -= 1\n total = 0\n for j in a_l:\n if j > 1:\n to... | ['Wrong Answer', 'Accepted'] | ['s592007905', 's106986999'] | [27676.0, 27252.0] | [2104.0, 423.0] | [395, 444] |
p02732 | u751277549 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['# from collections import deque\nfrom collections import Counter\nfrom scipy.misc import comb\nfrom copy import deepcopy\n\nn = int(input())\na = list(map(int, input().split()))\ncnt_n = 0\na_n = deepcopy(a)\nc = Counter(a_n)\nfor key in c:\n cnt_n += comb(c[key], 2, exact=True)\n\nfor k in range(len(a)):\n a_n... | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s148741529', 's363859280', 's753808051', 's731388407'] | [35224.0, 46500.0, 46408.0, 26780.0] | [2109.0, 2114.0, 2110.0, 381.0] | [411, 374, 345, 357] |
p02732 | u751843916 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\nimport copy\n\ndef f(l):\n return l*(l-1)\n\n\nn=int(input())\na=list(map(int,input().split()))\nb=collections.Counter(a)\nprint(b)\n\nfor x in a:\n c=copy.deepcopy(b)\n c[x]-=1\n d=c.values()\n e=0\n for y in d:\n e+=f(y)\n print(e//2)', 'import collections\nn=int(inpu... | ['Wrong Answer', 'Accepted'] | ['s704298942', 's718237864'] | [53484.0, 26780.0] | [2106.0, 379.0] | [265, 198] |
p02732 | u760961723 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\nimport numpy as np\n\nN = int(input()) \nli = list(map(int, input().split())) \n\n#print(N)\n#print(li)\n\n\nfor k in range(N):\n ans = 0\n LI = li.copy()\n LI_k = LI.pop(k)\n #print(LI)\n counter = Counter(LI)\n #print(counter)\n #print(len(counter))\n #print(... | ['Wrong Answer', 'Accepted'] | ['s774092120', 's333518776'] | [48740.0, 25644.0] | [2112.0, 1712.0] | [585, 282] |
p02732 | u762325798 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["def check_block(comb, K):\n block = 0\n pre = (comb & 1) > 0\n mapping = {0: 0}\n cut_num = 0\n for i in range(1, K):\n cur = ((1 << i) & comb) > 0\n if pre != cur:\n block += 1\n pre = cur\n cut_num += 1\n mapping[i] = block\n return mapping, cu... | ['Runtime Error', 'Accepted'] | ['s857995708', 's883537900'] | [3064.0, 38972.0] | [18.0, 307.0] | [1229, 327] |
p02732 | u767664985 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['from collections import Counter\n\nN = int(input())\nA = list(map(int, input().split()))\nc = Counter(A)\n\n\nans = 0\nfor n in c.values():\n ans += n*(n-1)//2\n\n\nfor k in range(N):\n m = c[A[k]]\n ans -= m-1 # -m*(m-1)//2 + (m-1)*(m-2)//2\n print(ans)\n', 'from collections import Counter\n\nN = int(in... | ['Wrong Answer', 'Accepted'] | ['s077938241', 's291069470'] | [26780.0, 26780.0] | [356.0, 351.0] | [352, 345] |
p02732 | u768496010 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["n = int(input())\nalist = list(map(int,input().split(' ')))\n\nfrom collections import defaultdict\n\nresdict = {}\n\nfrom collections import Counter\n\nc = Counter(alist)\n\nold_cdict = dict(c)\n\ncdict = dict((key, value) for (key, value) in old_cdict.items() if value >= 2)\n\n# print(cdict)\n\nmaxi = 0\n\nfor k, v... | ['Wrong Answer', 'Accepted'] | ['s709512989', 's494652014'] | [32928.0, 29140.0] | [353.0, 645.0] | [758, 719] |
p02732 | u768896740 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import numpy as np\nimport math\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\n\nn = int(input())\na = np.array(list(map(int, input().split())))\n\narray = np.zeros(n+1)\n\nfor i in a:\n array[i] += 1\n\nsum = 0\nfor i in array:\n if i > 1:\n ... | ['Time Limit Exceeded', 'Accepted'] | ['s513721736', 's743113106'] | [35764.0, 26780.0] | [2109.0, 374.0] | [597, 236] |
p02732 | u769095634 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nA = [int(i) for i in input().split()]\nC = [0 for i in range(N)]\nfor value in A:\n C[value - 1] += 1\nprint(C)\nways_all = 0\nfor i in range(N):\n ways_all += (C[i] * (C[i] - 1)) // 2\nprint(ways_all)\nfor value in A:\n print(ways_all - C[value - 1] + 1)', 'N = int(input())\nA = [int(i) fo... | ['Wrong Answer', 'Accepted'] | ['s443402788', 's233960921'] | [25772.0, 25900.0] | [341.0, 332.0] | [271, 246] |
p02732 | u771007149 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\nn = int(input())\na = list(map(int,input().split()))\ntmp = {}\nfor i in range(n):\n if a[i] in tmp:\n print(tmp[a[i]])\n else:\n a_copy = a[:]\n a_copy.remove(a[i])\n c = collections.Counter(a_copy)\n cnt = 0\n for i in c.values():\n cnt ... | ['Wrong Answer', 'Accepted'] | ['s579505478', 's873465827'] | [35348.0, 34220.0] | [2105.0, 224.0] | [375, 208] |
p02732 | u779728630 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['N = int(input())\nA = list(map(int, input.split()))\nL = [0 for i in range(N)]\n\ntotal = 0\n\nfor i in range(N):\n r = 0\n for j in range(N):\n if i != j and A[i] == A[j]:\n r += 1\n L[i] = r\n total += r\n\ntotal = total // 2\n\nfor i in L:\n print(total - L[i])', 'N = int(input())\nA = list(map(int, i... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s212862320', 's537375342', 's554707956'] | [3064.0, 26012.0, 25644.0] | [17.0, 411.0, 405.0] | [260, 357, 359] |
p02732 | u785578220 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['n = int(input())\nA = list(map(int,input().split()))\nfrom collections import Counter\n\nc = Counter(A)\nprint(c)\ncou = 0\nfor x in c:\n if c[x]>1:\n y = c[x]\n cou+=y*(y-1)//2\n else:\n break\n\n\nfor i in A:\n X = c[i]\n ans = cou - X*(X-1)//2 + (X-1)*(X-2)//2\n print(ans)\n', '... | ['Wrong Answer', 'Accepted'] | ['s666374289', 's970048359'] | [36896.0, 25644.0] | [454.0, 444.0] | [295, 294] |
p02732 | u787131053 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\n\ndef check(A):\n count = 0\n for j in A:\n n = A[j]\n if n > 1:\n count += n * (n - 1) / 2\n \n return int(count)\n\n\nN = int(input())\nA = list(map(int, input().split(" ")))\nA2 = collections.Counter(A)\nprint(A2)\nNsum = check(A2)\n# print(Nsum)\nfo... | ['Wrong Answer', 'Accepted'] | ['s855067964', 's362977813'] | [35996.0, 26780.0] | [479.0, 347.0] | [399, 401] |
p02732 | u798675549 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['def com(n):\n return n*(n-1)//2\nans=0\nn=int(input())\na=list(map(int,input().split()))\ncoun=[0]*n\nfor i in range(n):\n coun[a[i]]+=1\nfoi i in range(n):\n ans+=com(coun[i])\nfor i in range(n):\n m=com(coun[a[i]]-1)\n o=com(coun[a[i]])\n print(ans-o+m)\n ', 'import collections\nN=int(input())\nls... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s095373137', 's974730622', 's599686368'] | [2940.0, 26788.0, 26928.0] | [17.0, 103.0, 344.0] | [262, 164, 163] |
p02732 | u800058906 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['import collections\n\nn=int(input())\na=list(map(int,input().split()))\n\nc=collections.Counter(a)\n\nprint(c)\n\nfor i in c.values():\n s+=i*(i-1)//2 \n\nfor j in a:\n f=c[j]\n print(s-(f-1)) \n\n\n', 'import collections\n\nn=int(input())\na=list(map(int,input().split()))\n\nc=collections.Counter(a)\n\nprint(c)\n... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s455228437', 's494947842', 's881182493'] | [40896.0, 40732.0, 34108.0] | [160.0, 294.0, 227.0] | [489, 491, 482] |
p02732 | u801049006 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ["import math\nfrom collections import Counter\n\ndef cmb(n,r):\n if n < r:\n return 0\n else:\n math.factorial(n,r)\n\ndef main():\n N = int(input())\n A = list(map(int, input().split()))\n count = Counter(A)\n sum_ = sum([cmb(i,2) for i in count.values()])\n\n for i in range(len(A))... | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s372233223', 's889050259', 's994816956', 's031485016'] | [26776.0, 27120.0, 25900.0, 26780.0] | [96.0, 2105.0, 97.0, 386.0] | [469, 460, 396, 341] |
p02732 | u803989191 | 2,000 | 1,048,576 | We have N balls. The i-th ball has an integer A_i written on it. For each k=1, 2, ..., N, solve the following problem and print the answer. * Find the number of ways to choose two distinct balls (disregarding order) from the N-1 balls other than the k-th ball so that the integers written on them are equal. | ['# -*- coding: utf-8 -*-\nn = int(input())\nnumlist = list(map(int, input().split()))\ndic = {}\nfor num in numlist:\n if num not in dic:\n dic[num] = 1\n else:\n dic[num] += 1\n \nansdic = {}\nfor key in dic.keys():\n n = dic[key]\n ansdic[key] = [int(n*(n-1)/2),int((n-1)*(n-2)/2)]\n \nansdic2 = {}\... | ['Wrong Answer', 'Accepted'] | ['s151365368', 's451440602'] | [40908.0, 34720.0] | [2105.0, 369.0] | [525, 386] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.