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 | u195177386 | 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 math\nimport sys\n\nN = int(input())\nA = list(map(int, input().split()))\n\nif N == len(set(A)):\n for _ in range(N):\n print(0)\n sys.exit(0)\n\nc2 = math.factorial(2)\numemory = {}\ndmemory = {}\nmemory = {}\n\ncount = Counter(A)\n\nfor k, v in count.items():\n ... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s724169722', 's992892894', 's869824133'] | [38972.0, 3316.0, 26780.0] | [2105.0, 20.0, 1698.0] | [758, 302, 296] |
p02732 | u197457087 | 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\nN = int(input())\nA = list(map(int, input().split()))\nans = 0\n\nC = list(set(A))\nM = len(C)\nt = []\nanst = 0\nfor i in range(M):\n t.append(A.count(C[i]))\n temp = A.count(C[i])\n if temp >=2:\n anst += math.factorial(temp)/(math.factorial(temp-2)*2)\n\n#print(t)\n#print(anst)\n\nfor i in ran... | ['Wrong Answer', 'Accepted'] | ['s560275483', 's604441026'] | [26140.0, 32956.0] | [2104.0, 469.0] | [385, 450] |
p02732 | u197922478 | 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 = 8#int(input())\n#A = list(map(int, input().split()))\nA = [1, 2, 1, 4, 2, 1, 4, 1]\n\nc = collections.Counter(A)\n#print(c)\n\ncount_dic = {}\nfor i in c.keys():\n count = 0\n c_copy = c.copy()\n c_copy[i] = c[i]-1\n #print(c_copy)\n for k in c.keys():\n count += int(c_... | ['Wrong Answer', 'Accepted'] | ['s968185839', 's112761357'] | [3316.0, 34148.0] | [21.0, 1171.0] | [446, 289] |
p02732 | u197968862 | 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 scipy.misc import comb\n\nn = int(input())\na = list(map(int,input().split()))\nfor i in range(n):\n l = a[i]\n a[i] = ''\n ans = 0\n a_s = set(a)\n for j in a_s:\n c = a.count(j)\n ans += comb(c,2,exact=True)\n print(ans)\n a[i] = l", "from scipy.misc import comb\n\nn = int(in... | ['Time Limit Exceeded', 'Wrong Answer', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s081216138', 's157938198', 's559054860', 's772977612', 's892667806', 's738784835'] | [36560.0, 36572.0, 36572.0, 36624.0, 36444.0, 25900.0] | [2109.0, 2109.0, 2109.0, 2110.0, 2109.0, 344.0] | [260, 237, 243, 300, 248, 226] |
p02732 | u199830845 | 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 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())\nA_list = list(map(int, input().split()))\n\ndivided = []\nfor i i... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s127858712', 's528493090', 's634061243'] | [27020.0, 26140.0, 26772.0] | [2104.0, 2104.0, 439.0] | [567, 483, 422] |
p02732 | u201387466 | 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\ninput=sys.stdin.readline\nN = int(input())\nA = list(map(int,input().split()))\nnCr = {}\ndef cmb(n):\n if n == 1:\n return 0\n else:\n return n * n-1 /2\nmydict = {}\nfor i in range(N):\n a = A[i]\n if a in mydict.keys():\n mydict[a] += 1\n else:\n mydict[a] = 1... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s474144042', 's782124550', 's866938754'] | [25696.0, 24988.0, 24988.0] | [673.0, 2105.0, 444.0] | [425, 445, 414] |
p02732 | u207137484 | 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()))\ndi = {}\nfor i in range(n):\n\tk = list[i]\n\tif k not in di:\n\t\tdi[k]=1\n\telse:\n\t\tdi[k]+=1\nlist_del=[]\nfor key in di.keys():\n\tif di[key]==1:\n\t\tlist_del.append(key)\nfor i in range(len(list_del)):\n\tdi.pop(list_del[i])\n\t\n\t\nsu=0\nfor valu in d... | ['Runtime Error', 'Accepted'] | ['s151961351', 's022176089'] | [26140.0, 26140.0] | [198.0, 481.0] | [479, 449] |
p02732 | u207326980 | 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 = input().split()\nfreq = Counter(a)\nprint(freq)\ntotal=0\n \nfor key,val in freq.items():\n total+=(val*(val-1))//2\n\nfor k in range(n): \n\n kth = (freq[a[k]]*(freq[a[k]]-1))//2\n newkth = ((freq[a[k]]-2)*(freq[a[k]]-1))//2 \n\n total -= kth\n... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s828686117', 's958767750', 's547681645'] | [40792.0, 40776.0, 26660.0] | [700.0, 2105.0, 540.0] | [382, 282, 383] |
p02732 | u209299893 | 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\nimport math\nimport scipy.special import comb\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn = int(input())\nnums = [ int(s) for s in input().split() ]\n\n\nfor i in range(n):\n ans = 0\n\n cpl = copy.copy(nums)... | ['Runtime Error', 'Runtime Error', 'Time Limit Exceeded', 'Accepted'] | ['s295905820', 's623970273', 's937330189', 's702850699'] | [2940.0, 2940.0, 43784.0, 26268.0] | [17.0, 19.0, 2110.0, 1680.0] | [470, 467, 465, 422] |
p02732 | u212328220 | 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())\nal = list(map(int, input().split()))\nC = Counter(al)\n# print(C)\n# print(C.values())\nans = 0\nfor i in C.values():\n ans += i * (i - 1) / 2\n\nfor a in al:\n k = C[a]\n print(ans - (k * (k - 1) / 2) + (k - 1) * (k - 2) / 2)\n', 'import math\nfrom collec... | ['Wrong Answer', 'Accepted'] | ['s030206391', 's925199882'] | [26772.0, 33920.0] | [454.0, 278.0] | [276, 288] |
p02732 | u214344212 | 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\nx=int(input())\na=list(map(int,input().split()))\n\nc=collections.Counter(a)\nnum=0\nfor i in c.values():\n num+=i*(i-1)/2\n \nfor i in range(x):\n print(num-c[a[i]]+1)', 'import collections\n\nx=int(input())\na=list(map(int,input().split()))\n\nc=collections.Counter(a)\nnum=0\nfor i in... | ['Wrong Answer', 'Accepted'] | ['s784354194', 's955399637'] | [25960.0, 26780.0] | [453.0, 406.0] | [188, 193] |
p02732 | u217627525 | 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=list(map(int,input().split()))\n cnt=[0]*n\n for i in range(n):\n cnt[a[i]-1]+=1\n res=0\n for i in range(n):\n if cnt[i]>1:\n res+=cnt[i]*(cnt[i]-1)//2\n ans=[0]*n\n for i in range(n):\n if cnt[i]>=1:\n ans[i]=res-(cn... | ['Wrong Answer', 'Accepted'] | ['s018261888', 's526288057'] | [26140.0, 26140.0] | [352.0, 307.0] | [437, 407] |
p02732 | u221149873 | 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 = (int(input()))\nitems = list(map(int,input().split()))\nfor i in range(len(items)): \n rest = items[:i] + items[i+1:]\n rest_unique = list(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\n e... | ['Wrong Answer', 'Accepted'] | ['s372801907', 's444946144'] | [26140.0, 33664.0] | [2105.0, 433.0] | [394, 302] |
p02732 | u221272125 | 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())\nd = {}\nfor i in range(1,N+1):\n d[i] = 0\nA = list(map(int,input().split()))\nfor i in range(N):\n a = A[i]\n d[a] += 1\ns = 0\nfor i in range(1,N+1):\n x = d[a]\n s += (x*(x-1))//2\nfor i in range(N):\n y = A[i]\n z = s + 1 - d[y]\n print(z)', 'N = int(input())\nd = {}\nfor... | ['Wrong Answer', 'Accepted'] | ['s440651808', 's127135510'] | [43612.0, 44384.0] | [418.0, 423.0] | [270, 270] |
p02732 | u222668979 | 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()))\nnum = [0] * n\ncnt = 0\n\nfor i in a:\n num[i - 1] += 1\n\nfor i in num:\n cnt += i * (i - 1)//2\n\nfor i in range(n):\n tmp = num[a[i]-1]\n ans = cnt - ((tmp-(tmp-2)) * (tmp-1) // 2)\n ans += ((tmp-2) * (tmp-1) // 2)\n print(ans)\n', 'n = int(i... | ['Wrong Answer', 'Accepted'] | ['s354364679', 's224741691'] | [26268.0, 26140.0] | [417.0, 352.0] | [289, 230] |
p02732 | u225627575 | 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\n\nc = collections.Counter(A)\nkeys = c.keys()\nans_dict = {}\nans_dict2 = {}\nfor key in keys:\n ans_dict[key] = cmb(c[key]-1,2)\n ans_dict2[key] = cmb(c[key],2)\n\nSUM = sum(ans_dict2.values())\n\n# print(ans_dict)\n# print(ans_dict2)\n... | ['Runtime Error', 'Accepted'] | ['s366000473', 's823853703'] | [26268.0, 39508.0] | [97.0, 458.0] | [360, 939] |
p02732 | u228303592 | 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())\narr = list(map(int,input().split()))\ncnt = collectioms.Counter(arr)\ntotal = 0\n\nfor key in cnt.keys():\n total += cnt[key] * (cnt[key] - 1)//2\n \nfor i in range(n):\n tmp = total\n tmp -= cnt[arr[i]]*(cnt[arr[i]] - 1)//2\n tmp += (cnt[arr[i]] - 1)*(cnt[arr[i]] - 2)//2\... | ['Runtime Error', 'Accepted'] | ['s526474296', 's749434989'] | [34116.0, 34076.0] | [72.0, 323.0] | [317, 318] |
p02732 | u229429359 | 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 = input().split()\n\nL = [0 for i in range(N)]\n\nfor i in range(N):\n L[int(A[i])-1] +=1\n\nc = 0\nfor i in range(N):\n n = L[i]\n if n >= 2:\n c += factorial(n) // factorial(2) // factorial(n - 2)\n\nfor i in range(N):\n n = L[A[i]-1]\n if n >= 2:\n print(c - n + 1)\n else:\n pr... | ['Runtime Error', 'Accepted'] | ['s571290966', 's040048839'] | [18724.0, 22444.0] | [129.0, 1799.0] | [305, 338] |
p02732 | u236885379 | 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())\n*li,=map(int, input().split())\nfrom collections import Counter\nc = Counter()\nfor i in li:\n c[i] += 1\nans=0\nfrom math import comb\nfor i in c.values():\n ans += comb(i, 2)\nfor i in li:\n print(ans - comb(c[i], 2) + comb(c[i-1], 2))\n ', 'def f():\n n = int(input())\n *li,=map(int, ... | ['Wrong Answer', 'Accepted'] | ['s728993036', 's407095322'] | [32264.0, 32212.0] | [325.0, 271.0] | [256, 287] |
p02732 | u239528020 | 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. | ['#!/usr/bin/env python3\n\nimport collections\n\nN = int(input())\nA = list(map(int, input().split()))\n\nc = collections.Counter(A)\nvalues = c.keys()\ncounts = c.values()\n\n\nans = 0\nfor i in range(len(values)):\n tmp = counts[i]\n ans += (tmp * (tmp-1))//2\n\nfor i in range(N):\n num = A[i]\n index = ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s275678538', 's933722124', 's301281902'] | [26772.0, 26772.0, 32156.0] | [94.0, 98.0, 377.0] | [352, 351, 317] |
p02732 | u239653493 | 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 math\nn=int(input())\nA = list(map(int, input().split()))\nres=[0]*n\nimport collections\ndef com(n, r):\n if n<r:\n return 0\n else:\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nfor i in range(n):\n ac=copy.deepcopy(A)\n del ac[i]\n ak=co... | ['Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s081937984', 's734413288', 's871673878'] | [40112.0, 34636.0, 35248.0] | [2105.0, 1854.0, 1685.0] | [462, 547, 493] |
p02732 | u240096083 | 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\nfrom pprint import pprint\nfrom scipy.misc import comb\n\nn = int(input())\n\na_list = list(map(int,input().split()))\n\na_dict = defaultdict(int)\n\nfor i in a_list:\n a_dict[i] += 1\n\n#pprint(a_dict)\n\n\n\n\n\n\ntotal = 0\n\n\nfor j in a_dict.values():\n total += comb(j,... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s093368136', 's606432246', 's619703169', 's089021027'] | [37244.0, 35628.0, 35712.0, 26504.0] | [2109.0, 2109.0, 2112.0, 418.0] | [732, 747, 728, 732] |
p02732 | u241159583 | 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, 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 = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i]... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s124954809', 's593352717', 's845532264'] | [26164.0, 26140.0, 34036.0] | [2104.0, 2104.0, 289.0] | [856, 362, 352] |
p02732 | u242196904 | 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\n\nc = Counter(a)\n\nfrom scipy.misc import comb\n\ns = set(c.values())\n\ndic = {}\nfor ss in s:\n if ss not in dic.keys():\n dic[ss] = comb(ss, 2)\nfor ss in s:\n ss -= 1\n if ss not in dic.keys():\n dic[... | ['Wrong Answer', 'Accepted'] | ['s935267153', 's152940936'] | [29264.0, 25716.0] | [1001.0, 497.0] | [449, 283] |
p02732 | u243312682 | 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\nimport sys\ninput = sys.stdin.readline\n\ndef main():\n n = int(input())\n A = [int(x) for x in input().split()]\n a_c= Counter(A)\n values = a_c.values()\n val_cnt = Counter(values\n for a in A:\n val_cnt_c = deepcopy(val_cnt)\n ... | ['Runtime Error', 'Accepted'] | ['s031714281', 's808873473'] | [9028.0, 34116.0] | [25.0, 210.0] | [510, 305] |
p02732 | u244416763 | 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()))\nc = [0 for _ in range(n)]\nr = []\nfor i in range(n):\n c[a[i-1]-1] += 1\nfor i in range(n):\n r.append(c[i-1])\nkai = []\nv = []\nfor i in range(len(r)):\n kai.append((r[i]*(r[i]-1)//2))\n v.append(kai[i] - max(((r[i]-1)*(r[i]-2)//2),0))\n\nans = sum(... | ['Wrong Answer', 'Accepted'] | ['s870571696', 's656229332'] | [26140.0, 26140.0] | [545.0, 501.0] | [399, 372] |
p02732 | u245299791 | 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()))\nkeys=[]\nvalues=[]\nfor i in A:\n if i in keys:\n pass\n else:\n counts=A.count(i)\n keys.append(i)\n values.append(counts)\nans=0\nfor j in values:\n ans+=j*(j-1)/2\nfor k in A:\n a=keys.index(k)\n print(ans-values[a]+1)', 'N=int(input())\nA=list(map... | ['Wrong Answer', 'Accepted'] | ['s655856510', 's946332178'] | [25644.0, 24748.0] | [2104.0, 415.0] | [272, 271] |
p02732 | u250583425 | 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 collections import Counter\ndef input(): return sys.stdin.readline().rstrip()\n\ndef main():\n N = int(input())\n A = tuple(map(int, input().split()))\n c = Counter(A)\n\n sum_count = sum([v * (v - 1) // 2 for v in c.values()])\n for i, v in c.items():\n if v < 2:\n c... | ['Wrong Answer', 'Accepted'] | ['s343266795', 's986186820'] | [27028.0, 32952.0] | [165.0, 178.0] | [442, 502] |
p02732 | u257265865 | 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)\ncount=0\nfor i in range(1,N+1):\n a=B["i"]\n count+=(a*(a-1))/2\n\n \nfor i in range(1,N+1):\n a=B["i"]\n print(int(count-(a*(a-1))/2))', 'import collections\nN=int(input())\nA=list(map(int,input().split()))\nB=collec... | ['Wrong Answer', 'Accepted'] | ['s074472640', 's092866709'] | [26780.0, 26780.0] | [473.0, 507.0] | [224, 221] |
p02732 | u266675845 | 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())\nA = []\nA = [int(i) for i in input().split()]\n\nnumber_set = list(set(A))\n#print("number set is :", number_set) \n \nfor k in range(n):\n out = 0\n ans = []\n ans += A[0:k]\n ans += A[k+1:n]\n #print(ans)\n for i in range(len(number_set)):\n #print(ans.count(number... | ['Wrong Answer', 'Accepted'] | ['s243223153', 's674761747'] | [25764.0, 26780.0] | [2105.0, 334.0] | [415, 198] |
p02732 | u268554510 | 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 H,W,K = map(int,input().split())\n import numpy as np\n from collections import deque\n ans = 10000\n S = np.array([list(map(int,list(input()))) for _ in range(H)])\n cum = [[0]*W for _ in range(H+1)]\n for j in range(W):\n for i in range(1,H+1):\n cum[i][j] = cum[i-1][j]+S[i-1][j]\n\n c... | ['Runtime Error', 'Accepted'] | ['s607051464', 's197240809'] | [3444.0, 32080.0] | [21.0, 436.0] | [962, 334] |
p02732 | u274841648 | 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())\ns = [int(i) for i in input().split()]\n\ns_set = set(s)\n\ncounted = Counter(s)\nans = sum(i*(i-1)/2 for i in counted.values())\nprint(ans)\n\nfor i in s:\n x = counted[i]\n print(int(ans - x + 1))', 'from collections import Counter\nn = int(input())\ns = [int(... | ['Wrong Answer', 'Accepted'] | ['s972711693', 's473904987'] | [28704.0, 29388.0] | [440.0, 418.0] | [242, 231] |
p02732 | u277104886 | 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())\na = list(map(int, input().split()))\nb = set(a)\n\ndef choose2(x):\n return int(x*(x-1)/2)\n \ntotal = 0\nfor i in b:\n total += choose2(a.count(i))\n\nfor i in a:\n print(total - choose2(s[i]) + choose2(s[i]-1))', '\nn = int(input())\na = list(map(int, input().split()))\n\nfrom collec... | ['Runtime Error', 'Accepted'] | ['s220774709', 's589322605'] | [32252.0, 32288.0] | [2206.0, 310.0] | [231, 293] |
p02732 | u279266699 | 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()))\ndif = [0] * n\nsum_c = 0\nfor i, v in collections.Counter(a).items():\n if v < 2:\n continue\n val = v * (v - 1) // 2\n dif[i] = 2 * (v - 1) // 2\n sum_c += val\nprint('\\n'.join([int(sum_c - data[i]) for i in a])", "import ... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s254885830', 's358421717', 's520479268', 's817810767', 's838050639', 's136833647'] | [3060.0, 3064.0, 2940.0, 3060.0, 3060.0, 38488.0] | [17.0, 17.0, 17.0, 17.0, 17.0, 304.0] | [295, 289, 302, 295, 291, 393] |
p02732 | u279292103 | 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()))\nc = Counter(a)\nvalues, counts = zip(*c.most_common())\nvalues, counts = list(values), list(counts)\nk = 0\nfor i in range(len(counts)):\n k += counts[i]*(counts[i]-1)//2\noutput = [0]*len(a)\nfor i in range(len(a)):\n temp = c[... | ['Wrong Answer', 'Accepted'] | ['s089742310', 's225305820'] | [36892.0, 37024.0] | [381.0, 573.0] | [424, 429] |
p02732 | u281610856 | 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, deque, Counter\nimport sys\ninput = sys.stdin.readline\n\n\ndef main():\n n = int(input())\n A = list(map(int, input().split()))\n dd = defaultdict(int)\n ans = []\n for i in A:\n dd[i] += 1\n for i in range(n):\n ng = A[i]\n dd[ng] -= 1\n ... | ['Wrong Answer', 'Accepted'] | ['s085313924', 's138887377'] | [3316.0, 29808.0] | [21.0, 417.0] | [459, 472] |
p02732 | u281796054 | 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())\nS=list(map(int,input().split()))\nset_S=list(set(S))\nans_stock={}\nnumber={}\nfor i in set_S:\n number[i] = S.count(i)\ncomb = 0\nfor i in set_S:\n comb += number[i]*(number[i]-1)/2\n\nfor i in S:\n if i in list(ans_stock.keys()):\n print(ans_stock[i])\n else:\n ans = comb - number[i]*(num... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s369672688', 's773202334', 's644706116'] | [26140.0, 24996.0, 25896.0] | [2104.0, 2108.0, 508.0] | [383, 88, 269] |
p02732 | u283605799 | 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\ntable = set(a)\n\ncon = {}\ndic = {}\nans = []\n\ncon = Counter(a)\ndic = {}\n\n# con[i] = a.count(i)\n\n\nfor x in a:\n if dic[x] == None:\n ex = (con[x] - 1) * (con[x] - 2) / 2\n no = (con[x]) * (con[x] - ... | ['Runtime Error', 'Accepted'] | ['s440552026', 's319951107'] | [28732.0, 35256.0] | [113.0, 579.0] | [484, 368] |
p02732 | u289162337 | 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()]\nt = set(L)\ndn = {}\ndc = {}\nAll = 0\nfor i in L:\n dn[i] += 1\nfor i in t:\n dc[i] = int(dn[i]*(dn[i]-1)/2)\n All += dc[i]\nfor i in range(n):\n print(All-dc[L[i]] + int((dn[L[i]]-1)*(dn[L[i]]-2)/2))', 'n = int(input())\nL = [int(i) for i in input().split... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s170039205', 's871182105', 's354746712'] | [24748.0, 25764.0, 38152.0] | [97.0, 2104.0, 541.0] | [250, 248, 274] |
p02732 | u289288647 | 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 math import factorial\n\nN = int(input())\nindex = list(map(int, input().split()))\nval = [0]*max(index)\nfor i in index:\n val[i-1] += 1\ntotal = 0\nfor i in val:\n if i >= 2:\n total += comb(i, 2, exact=True)\nfor i in index:\n if val[i-1] >= 2:\n print(total-(comb(val[i-1], 2, exact=Tru... | ['Runtime Error', 'Accepted'] | ['s418251006', 's418685127'] | [32324.0, 65988.0] | [99.0, 453.0] | [373, 377] |
p02732 | u290886932 | 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()))\nwlists = collections.Counter(A)\nprint(wlists)\nprint(wlists[1])\nprint(wlists[2])\nsum_num = 0\nfor i in wlists:\n sum_num += wlists[i] * (wlists[i] - 1) // 2\nprint("num_sum:{}".format(sum_num))\nfor i in range(N):\n num = sum_num - wlists... | ['Wrong Answer', 'Accepted'] | ['s888709344', 's120081869'] | [35896.0, 26780.0] | [632.0, 549.0] | [430, 346] |
p02732 | u291988695 | 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())\nAs=list(map(int,input().split()))\nls=collections.Counter(As)\nsubd={}\nan=ls.values()\nfor k in l:\n ans+=k*(k-1)//2\nsans=ans\n\nfor i in As:\n ans=sans+1-ls[i]\n print(ans)\n', 'import collections\n\nn=int(input())\nAs=list(map(int,input().split()))\nls=collections.Counter(... | ['Runtime Error', 'Accepted'] | ['s314297412', 's417184652'] | [26780.0, 26780.0] | [97.0, 369.0] | [204, 210] |
p02732 | u303739137 | 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. | ['input()\naa = list(map(int, input().split()))\nuu = list(set(aa))\ncc = uu.copy()\nfor i in range(len(uu)):\n cc[i] = aa.count(uu[i])\n total += cc[i] * (cc[i]-1) / 2\n\ndic = dict(zip(uu,cc))\n\nfor a in aa:\n print(int(total - dic[a] + 1))', 'input()\nfrom collections import Counter\naa = list(map(int, inp... | ['Runtime Error', 'Accepted'] | ['s374044320', 's059565955'] | [26012.0, 26780.0] | [94.0, 411.0] | [239, 204] |
p02732 | u306516971 | 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\nsetA = set(A)\nan = 0\nfor num in B:\n d = A.count(num)\n an += d*(d-1)//2\n\nfor i in range(n):\n ans = an\n t = A[i]\n e = A.count(A[i])\n ans -= e*(e-1)//2\n ans += (e-1)*(e-2)//2\n print(ans)', 'n = int(input())\n\nli = list(map(int,... | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s129111414', 's791905994', 's863228159', 's880736096'] | [26268.0, 26268.0, 24748.0, 26268.0] | [88.0, 2104.0, 470.0, 414.0] | [261, 281, 210, 215] |
p02732 | u306950978 | 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())\nc=list(map(int,input().split()))\n\ns = Counter(c)\nt = list(s.items())\n\nnag = len(t)\nx = 0\nrt = [0 for i in range(nag)]\nprint(s)\n\nfor i in range(nag):\n x += (t[i][1]*(t[i][1]-1))//2\nfor f in range(nag):\n rt[f] = x - (t[f][1] -1)\n \nfor j in range... | ['Wrong Answer', 'Accepted'] | ['s045245771', 's704209160'] | [46000.0, 28336.0] | [2109.0, 408.0] | [401, 268] |
p02732 | u312078744 | 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#from scipy.special import comb\n# a = comb(n, r)\n# >> cannot use in Contest (like AtCoder)\n\n\ndef cmb(n, r):\n if n - r < r:\n r = n - r\n if r == 0:\n return 1\n if r == 1:\n return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denomina... | ['Wrong Answer', 'Accepted'] | ['s434539736', 's619641781'] | [30124.0, 31516.0] | [1297.0, 1370.0] | [1163, 1386] |
p02732 | u312237545 | 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_int():\n\treturn int(input())\n\ndef get_ints():\n\treturn list(map(int, input().split()))\n\n\n\ndef choose2(n):\n return n*(n-1)/2\n \n\nN = get_int()\nAn = get_ints()\n\nuni = [0] * (N+1)\n\nfor i in range(N):\n uni[An[i]] += 1\nsumWay = 0\n\nfor i in range(N):\n sumWay += choose2(uni[i])\n\nfo... | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s064369476', 's542645556', 's256697253'] | [32324.0, 32292.0, 32312.0] | [316.0, 310.0, 338.0] | [760, 684, 814] |
p02732 | u313370702 | 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\n\nimport collections\nimport copy\n\n\nN = int(input())\n\n\nA = list(map(str, input().split()))\n\nprint(A)\nfor _N in range(N):\n A2 = copy.copy(A)\n del A2[_N]\n c = collections.Counter(A2)\n ans = 0\n for v in c.values():\n if v >= 2:\n ans += int(((v * (v - 1)) / 2))\n print(ans)\n... | ['Wrong Answer', 'Accepted'] | ['s787595947', 's281181907'] | [43688.0, 28896.0] | [2105.0, 594.0] | [344, 450] |
p02732 | u314089899 | 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(10000000000000)\n\nfrom operator import mul\nfrom functools import reduce\nfrom functools import lru_cache\n\nN = int(input())\nA_list = [int(e) for e in input().split()]\n\n\nnumber_dict = dict()\n\nfor i in range(N):\n ball_number = A_list[i]\n if ball_number not in number_di... | ['Runtime Error', 'Accepted'] | ['s375824454', 's177936696'] | [3064.0, 31888.0] | [19.0, 1117.0] | [1351, 1321] |
p02732 | u316733945 | 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 = []\ntotal = 0\n\nm = max(a)\n\nfor i in range(1, m+1):\n if a.count(i):\n total += (a.count(i)*(a.count(i)-1))/2\n l.append(a.count(i))\n\nprint(l)\nprint(total)\n\nfor k in range(n):\n score = total\n if l[a[k]-1]:\n score -= (l[a[k... | ['Wrong Answer', 'Accepted'] | ['s739795035', 's250523728'] | [26140.0, 26780.0] | [2104.0, 380.0] | [330, 254] |
p02732 | u319311571 | 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(' ')))\nc = [0] * (n + 1)\nd = [0] * (n + 1)\nfor i in a:\n c[i] += 1\n d[i] = c[i] * (c[i] - 1) // 2\nfor i in a:\n if c[i] > 2:\n r = (((c[i] - 1) * (c[i] - 2)) // 2)\n else:\n r = 0\n print(d[i] + r)", "n = int(input())\na = list(map(in... | ['Wrong Answer', 'Accepted'] | ['s899151406', 's660051074'] | [24872.0, 25716.0] | [375.0, 381.0] | [269, 284] |
p02732 | u323531048 | 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\ninp = [input() for i in range(2)]\nN = int(inp[0])\nA = list(map(int, inp[1].split()))\n# B = 0\nd = {}\nfor k in A:\n # a = A.count(k)\n # B += (a - 1) / 2\n if k in d.keys():\n d[i] += 1\n\n# for k in range(N):\n# c = A.count(A[k]) - 1\n# counter = B - c\n# print(int(counter... | ['Runtime Error', 'Accepted'] | ['s125973209', 's726055094'] | [26816.0, 35084.0] | [89.0, 427.0] | [453, 480] |
p02732 | u324197506 | 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. | ['\nimport sys\ninput = sys.stdin.readline\n\nn = int(input())\n\nballs = list(map(int, input().split()))\n\ncnt = {}\n\nfor ball in balls:\n if ball not in cnt:\n cnt[ball] = 0\n cnt[ball] += 1\n\ndef combination(nxt, num = 0):\n return (cnt[nxt]-num) * (cnt[nxt]-1- num) // 2\n\ntotal = 0\nfor nxt in c... | ['Wrong Answer', 'Accepted'] | ['s453683894', 's025802920'] | [25916.0, 25912.0] | [545.0, 483.0] | [468, 455] |
p02732 | u331226975 | 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_set = list(set(A))\n\nAd = {a_set:A.count(a_set) for a_set in A_set}\n\nscore_sum = sum([x*(x-1)/2 for x in list(Ad.values())]\n\nfor a in A:\n print(int(score_sum - (Ad[a] - 1)))\n', 'import collections\n\nN = int(input())\nA = list(map(int, input().split()... | ['Runtime Error', 'Accepted'] | ['s211491722', 's312716047'] | [2940.0, 26780.0] | [17.0, 337.0] | [231, 363] |
p02732 | u332800105 | 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(s) for s in input().split()]\nfor i in range(0,n):\n print(a.count(a[i])-1)', 'n=int(input())\na=[int(s) for s in input().split()]\nd={}\nfor i in range(0,n):\n if a[i] not in d:\n d[a[i]]=1\n else:\n d[a[i]]+=1 \nfor i in range(0,n):\n print(d[a[i]]-1)', 'n=int(input(... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s249084131', 's576658897', 's020021417'] | [25768.0, 26268.0, 32008.0] | [2104.0, 311.0, 460.0] | [98, 188, 306] |
p02732 | u336564899 | 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\nmod = pow(10,9)+7\n\n\nmemo = {}\ndef combination(n, a, mod):\n\n if (n,a) in memo:\n return memo[(n,a)]\n\n x = 1\n y = 1\n for i in range(a):\n x = x * (n-i)%mod\n y = y * (a-i)%mod\n\n ans = x * pow(y, mod-2, mod)%mod\n\n memo[(n, a)] = ans\n return a... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s098757121', 's835657874', 's197573360'] | [39200.0, 66352.0, 26780.0] | [2106.0, 2107.0, 437.0] | [771, 491, 435] |
p02732 | u337751290 | 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 main():\n N = int(input())\n A = list(map(int, input().split()))\n\n # print(N)\n # print(A)\n\n for i in range(N):\n result = 0\n for j in range(N):\n if A[i] == A[j]:\n result += 1\n print(result)\n\n\n\n\nif __name__ == '__main__':\n main()", "... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s716497234', 's892564128', 's682799882'] | [24748.0, 26268.0, 82040.0] | [2104.0, 2104.0, 494.0] | [295, 291, 583] |
p02732 | u339503988 | 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] * 100000\nfor i in A:\n l[i] += 1\nc = 0\nnums = [0] * N\nfor i in range(N):\n nums[i] = l[i] * (l[i] - 1) / 2\ns = sum(nums)\nfor i in range(N):\n a = A[i]\n print(int(s - nums[a - 1] + (l[a] - 1) * (l[a] - 2) / 2))\n', 'N = int(input())\nA =... | ['Runtime Error', 'Time Limit Exceeded', 'Accepted'] | ['s313211991', 's825991993', 's637999746'] | [26140.0, 94464.0, 94304.0] | [97.0, 2104.0, 485.0] | [280, 228, 252] |
p02732 | u343523553 | 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 = [a.count(i+1) for i in range(n)]\nd = []\nfor j in b:\n if j >= 2:\n d.append(factorial(j)//factorial(2)//factorial(j-2))\n else:\n d.append(0)\n\nfor k in a:\n if b[k-1] >= 3:\n u = b[k-1] \n p = factorial(u-1)//factorial(... | ['Runtime Error', 'Accepted'] | ['s984463996', 's436355017'] | [26140.0, 26140.0] | [2104.0, 304.0] | [393, 185] |
p02732 | u348868667 | 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\ndef main():\n N = int(input())\n A = list(map(int, input().split()))\n c = Counter(A)\n comb = 0\n for i in c.values():\n if i >= 2:\n comb += i*(i-1)/2\n for i in range(N):\n print(comb - (c[A[i]] - 1))\n\nif __name__ == '__main__':\n m... | ['Wrong Answer', 'Accepted'] | ['s731175258', 's450577113'] | [26780.0, 26780.0] | [407.0, 298.0] | [309, 310] |
p02732 | u349444371 | 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()))\nC=Counter(a)\n#print(C)\ntotal=0\nfor k,v in C.items():\n if v>=2:\n total+=v*(v-1)//2\nprint(total)\nfor i in range(n):\n V=C[a[i]]\n ans=total-(V*(V-1))//2+((V-1)*(V-2))//2\n print(ans)', 'from collections import C... | ['Wrong Answer', 'Accepted'] | ['s853817482', 's273812705'] | [25896.0, 26772.0] | [410.0, 400.0] | [276, 277] |
p02732 | u353895424 | 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 return n*(n-1)/2\n\nn = int(input())\na = list(map(int, input().split()))\n\ncnt = [0]*(n+1)\ntotal = 0\nans = 0\n\nfor i in range(n):\n cnt[a[i]] += 1\n\nfor i in range(n):\n total += nC2(cnt[i])\n\nfor i in range(n):\n print(total - nC2(cnt[a[i]]) + nC2(cnt[a[i]] - 1))', 'def nC2(n):\n ... | ['Wrong Answer', 'Accepted'] | ['s728851196', 's342944230'] | [24748.0, 24744.0] | [505.0, 429.0] | [280, 286] |
p02732 | u357230322 | 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=int(input())\na=list(map(int,input().split()))\nt=0\nu=0\nfor i in range(n):\n if u!=n-1:\n m=a[i]\n del a[i]\n s=sorted(a)\n x=s.count(s[u])\n t+=math.factorial(x)//2\n u+=x\n a.insert(i,m)\n print(t)', 'from collections import Counter\n\nn=int(input())\na=list(map(int,input().s... | ['Wrong Answer', 'Accepted'] | ['s170629747', 's617894629'] | [26140.0, 26780.0] | [2105.0, 375.0] | [225, 179] |
p02732 | u360061665 | 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\nN = int(input())\nA = list(map(int, input().split(' ')))\nc = collections.Counter(A)\nd1 = {}\nd2 = {}\nfor i in c:\n d1[str(i)] = (c[i]*(c[i]-1))/2\n d2[str(i)] = ((c[i]-1)*(c[i]-2))/2\n\ns = sum(d1.values())\n\nprint(c)\nfor i in range(N):\n ans = s - d1[str(A[i])]+d2[str(A... | ['Wrong Answer', 'Accepted'] | ['s831879127', 's838555003'] | [71324.0, 56604.0] | [835.0, 790.0] | [329, 320] |
p02732 | u362563655 | 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 = []\nC = []\n\nfor i in range(1,N+1):\n n = A.count(i)\n B.append(n*(n-1)//2)\n C.append((n-1)*(n-2)//2 if n >1 else 0)\n\nB_sum = sum(B)\nprint(B)\nprint(C)\n\nfor i in range(N):\n a = A[i]-1\n print(B_sum-B[a]+C[a])', 'N= int(input())\nA = list(... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s426739555', 's796473001', 's425965428'] | [24748.0, 24748.0, 26140.0] | [2105.0, 364.0, 320.0] | [272, 206, 189] |
p02732 | u365838886 | 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 = []\nS = 0\n\nfor i in range(1, N+1):\n B[i] = A.count(i)\n S += B[i]*(B[i]-1)/2\n\nfor i in range(N):\n if B[A[i]] < 2:\n print(S)\n else:\n print(S-B[A[i]]+1)', 'N = int(input())\nA = list(map(int, input().split()))\nB = []\nS = 0\n... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s328819793', 's501750708', 's663283234'] | [32132.0, 32140.0, 32216.0] | [76.0, 76.0, 221.0] | [231, 207, 203] |
p02732 | u367130284 | 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*\nd={}\nn,*a=map(int,open(0).read().split())\nb=Counter(a)\nfor i in range(n):\n c=(b-Counter([a[i]]))\n if a[i]not in d:\n ans=sum([v*(v-1)//2 for k,v in c.items()if v>=2])\n d[a[i]]=ans\n else:\n print(d[a[i]])', 'from collections import*\nn,*a=map(int,open(0).r... | ['Wrong Answer', 'Accepted'] | ['s807318046', 's349987590'] | [39948.0, 25932.0] | [2105.0, 414.0] | [256, 192] |
p02732 | u369502636 | 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())\nnumber = list(map(int,input().split()))\nnum = sorted(number)\nnum.append(0)\np = num[0]\ncombi = dict()\nu = 0\n\nfor i in range (n+1) :\n q = num[i]\n if p != q :\n combi[p] = u\n u = 0\n u += 1\n p = q\n\nt = 0\n\nfor j in combi.values() :\n t += j*(j-1)//2\n\nfor k i... | ['Runtime Error', 'Accepted'] | ['s582353740', 's967167594'] | [26140.0, 26524.0] | [498.0, 529.0] | [398, 399] |
p02732 | u370217787 | 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\nfrom math import factorial\n\nN = int(input())\nA = np.array(list(map(int, input().split())))\n\ndic = {}\nafter = {}\n\nnewdata = np.unique(A)\nfor i in range(len(newdata)):\n\tx = np.sum(A == newdata[i])\n\tif x <= 1:\n\t\tdic[newdata[i]] = 0\n\telse:\n\t\tdic[newdata[i]] = factorial(x) / factor... | ['Runtime Error', 'Time Limit Exceeded', 'Accepted'] | ['s815548418', 's845200179', 's170094262'] | [34156.0, 34080.0, 53384.0] | [2109.0, 2109.0, 592.0] | [589, 422, 386] |
p02732 | u370721525 | 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\nN = int(input())\nA = list(map(int, input().split()))\nans = 0\n\nfor i in range(N):\n li = A[:i] + A[i+1]\n c = collections.Counter(li)\n l = [i for i in C.items() if i > 1]\n for num in l:\n ans += math.factorial(num) // (math.factorial(num-2) * 2)\n \nprint(ans)', 'import... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s129350506', 's386222118', 's734595832'] | [26900.0, 26780.0, 25896.0] | [70.0, 97.0, 345.0] | [295, 240, 200] |
p02732 | u378153116 | 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 scipy.misc import comb\n# from scipy.special import comb\n\ndef banned(al):\n d = {}\n for a in al:\n if a in d.keys():\n d[a] += 1\n else:\n d[a] = 1\n # print(d)\n for k, v in d.items():\n if v > 1:\n d[k] = [v, comb(v, 2)]\n else:\n ... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s303232421', 's447887772', 's702984428'] | [43148.0, 35252.0, 26268.0] | [2110.0, 2109.0, 1708.0] | [621, 417, 798] |
p02732 | u379142263 | 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 bisect\nn = int(input())\na = list(map(int,input().split()))\nA = collections.Counter(a)\nKey = []\nVal = []\nfor key,val in A.items():\n Key.append(key)\n Val.append(val)\nans = 0\nans1 = 0\nfor i in range(len(Val)):\n ans+= ((Val[i])*(Val[i]-1))//2\nfor i in range(n):\n s = bi... | ['Runtime Error', 'Accepted'] | ['s723362407', 's297894938'] | [26780.0, 26004.0] | [707.0, 449.0] | [474, 563] |
p02732 | u384124931 | 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 - d[a] + 1)', 'import collections\ndef C(n):\n return n * (n-1) // 2\nN =... | ['Runtime Error', 'Accepted'] | ['s309822946', 's369433689'] | [27960.0, 38840.0] | [161.0, 413.0] | [241, 241] |
p02732 | u386944085 | 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=0\nlist1 = list(map(int, input().split()))\nc = collections.Counter(list1)\nfor i in range(N):\n a+=int(c[i+1]*(c[i+1]-1)/2)\nfor i in range(N):\n print(a-c[list1[i]]*2+3)', 'import collections\nN=int(input())\na=0\nlist1 = list(map(int, input().split()))\nc = collections.C... | ['Wrong Answer', 'Accepted'] | ['s038728579', 's663257035'] | [26772.0, 26780.0] | [508.0, 525.0] | [207, 259] |
p02732 | u399155892 | 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. | ["#!/usr/bin/env python\n\ndef main():\n n = int(input())\n a = list(map(int, input().split()))\n a_sort = sorted(a)\n\n ball_dict = {}\n count = 1\n for i in range(1, n):\n if a_sort[i] == a_sort[i - 1]:\n count += 1\n else:\n ball_dict.setdefault(a_sort[i - 1], co... | ['Runtime Error', 'Accepted'] | ['s993478399', 's072867725'] | [25380.0, 26200.0] | [456.0, 373.0] | [702, 693] |
p02732 | u401452016 | 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 math\nfrom collections import Counter\nn = int(sys.stdin.readline())\nA = map(int, sys.stdin.readline().split())\ndef comb(n):\n return int(math.factrial(n)/(math.factrial(n-2)*2))\nfor k in range(n):\n ans =0\n L=A[:k]+A[k+1:]\n for v in Counter(L).values():\n if v>=2:\n ans +=comb(v)\... | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s410852382', 's437160250', 's799438762', 's343877728'] | [18668.0, 18668.0, 26224.0, 25920.0] | [39.0, 40.0, 95.0, 1712.0] | [319, 313, 325, 346] |
p02732 | u403331159 | 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 comb_ans=1\n for i in range(1,k+1):\n comb_ans*=(n-i+1)/i\n comb_ans=int(comb_ans)\n return comb_ans\n\nN=int(input())\nA=list(map(int,input().split()))\nans=0\nL=[0]*N\nfor i in range(N):\n L[A[i]-1]+=1\nfor i in range(len(C)):\n ans+=Comb(L[A[i]-1],2)\nfor i in range(N):\n ... | ['Runtime Error', 'Accepted'] | ['s798927853', 's991226313'] | [26140.0, 26140.0] | [109.0, 442.0] | [377, 345] |
p02732 | u405733072 | 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 resolve():\n n = int(input())\n a = tuple(map(int,input().split()))\n A = collections.Counter(a)\n cnt_0 = 0\n for i in A.values():\n cnt_0 += int(i*(i-1)/2)\n for i in a:\n cnt_1 = A[i]-1\n print(cnt_0-cnt_1)\nresolve()', 'import collections\ndef resolve():\n n = int(inp... | ['Runtime Error', 'Accepted'] | ['s148677311', 's029531447'] | [33172.0, 34340.0] | [70.0, 199.0] | [253, 272] |
p02732 | u408375121 | 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()))\ndic1 = {}\ndic2 = {}\nfor i in range(N):\n if A[i] in dic1:\n dic1[A[i]] += 1\n dic2[A[i]].append(i)\n else:\n dic1[A[i]] = 1\n dic2[A[i]].append(i)\n\nfor j in range(N):\n ans = 0\n for k, v in dic1.items():\n if j in dic2[k]:\n ans += ((... | ['Runtime Error', 'Accepted'] | ['s002903765', 's949204356'] | [26268.0, 25716.0] | [66.0, 431.0] | [365, 314] |
p02732 | u411858517 | 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\ndef P(n, r):\n return math.factorial(n)//math.factorial(n-r)\ndef C(n, r):\n return P(n, r)//math.factorial(r)\n\nN = int(input())\nA = list(map(int, input().split()))\n\ndic = {}\nfor i in range(N):\n if A[i] in dic:\n dic[A[i]] += 1\n else:\n dic[A[i]] = 1\n\nmemo = \nans = 0\nfor k in ... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s435961984', 's669691376', 's209825365'] | [2940.0, 32544.0, 32544.0] | [17.0, 1788.0, 436.0] | [532, 595, 545] |
p02732 | u412139296 | 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\nans = [-1] * N\n\nfor A_ in range(len(A)):\n K = A[A_]\n for B_ in range(len(A)):\n if K == A[B_]:\n ans[A_] += 1\n print(ans[A_])\n', 'N = int(input())\nA = list(map(int, input().split()))\nCNT = [0] * (N+1)\n\nfor i in A:\n CNT[i]... | ['Wrong Answer', 'Accepted'] | ['s457594361', 's837384944'] | [24996.0, 26140.0] | [2104.0, 300.0] | [204, 227] |
p02732 | u424467986 | 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 scipy.misc import comb\n\nN = int(input())\nA = list(map(int, input().split(' ')))\n\nK = {}\nfor row in A:\n if row in K:\n K[row] += 1\n else:\n K[row] = 1\n\n\nD = {}\nfor row in A:\n ans = 0\n if row not in D:\n for i in K:\n if i == row:\n ans += co... | ['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted'] | ['s021331440', 's577416243', 's995316573', 's173821362'] | [45348.0, 43792.0, 36568.0, 24748.0] | [2109.0, 2110.0, 2110.0, 488.0] | [501, 610, 386, 319] |
p02732 | u428199834 | 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()))\ndic={}\nfor i in set(A):\n dic[i]=A.count(i) \ndef ans(k,dic):\n dic[A[k-1]]+=-1\n c=0\n for i in dic.values():\n c+=i*(i-1)/2\n dic[A[k-1]]+=1 \n return int(c)\nfor k in range(1,N+1):', 'N=int(input())\nA=list(map(int,input().split()))\ndic={}\nfor a in A:\... | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s535560891', 's812048410', 's670867495'] | [3060.0, 25716.0, 33876.0] | [17.0, 462.0, 221.0] | [232, 235, 220] |
p02732 | u436982376 | 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\ndef combinations_count(n, memo_fact):\n return memo_fact[n] // (memo_fact[n - 2] * 2)\n\nn = int(input())\na = list(map(int,input().split()))\nprint(len(a))\nn_list = [0 for i in range(n)]\nlen_list = [0 for i in range(n)]\n\nmemo_fact = [1]\n\nfor i in range(1, n+1):\n memo_fact.append(memo_fact... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s691212242', 's853357839', 's021792663'] | [3436.0, 46816.0, 26140.0] | [2286.0, 2106.0, 1865.0] | [849, 900, 710] |
p02732 | u440129511 | 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]*(n)\nl1=[0]*(n)\nfor i in range(n):\n l[a[i]-1]+=1\n \nfor i in range(n):\n if l[i]>=2:\n l1[i]+=(l[i]*(l[i]-1))//2\n\nl1sum=sum(l1)\nfor i in range(n):\n if l[a[i]-1]-1>=2:print(l1sum-l1[a[i]-1]+(l[a[i]-1]-1 * l[a[i]-1]-2)//2)\n else:print... | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s018361761', 's022429724', 's381442052', 's722207055'] | [26140.0, 26140.0, 26140.0, 26140.0] | [390.0, 376.0, 117.0, 409.0] | [322, 310, 437, 321] |
p02732 | u440161695 | 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 f(n):\n return (n*(n-1))//2\nN=int(input())\nA=list(map(int,input().split()))\nd=dict()\nans=0\n\nfor i in range(len(A)):\n if A[i] not in d:\n d[i]=0\n d[i]+=1\nfor i in d:\n ans+=f(d[i])\nfor i in range(len(A)):\n print(ans-d[A[i]]-1)', 'def f(n):\n return (n*(n-1))//2\nN=int(input())\nA=list(map(int,i... | ['Runtime Error', 'Accepted'] | ['s522401057', 's023997932'] | [25716.0, 25716.0] | [71.0, 382.0] | [283, 289] |
p02732 | u443569380 | 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 = int(input())\na = list(map(int, input().split()))\n\n\nfor i in range(len(a)):\n rem_k = a[:i] + a[i + 1:]\n \n cho = []\n for j in rem_k:\n if rem_k.count(j) >= 2:\n cho.append(j)\n # print(rem_k)\n for i in cho:\n if rem_k.count(i) - 2 < 0:\n an... | ['Runtime Error', 'Accepted'] | ['s596802136', 's712030714'] | [26140.0, 26772.0] | [2104.0, 413.0] | [522, 265] |
p02732 | u451017206 | 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. | ['A = [int(i) for i in input().split()]\nfrom collections import Counter\na = Counter(A)\n\nfor i in A:\n t = 0\n for k in a.keys():\n c = a[k]\n if k == i:\n c -= 1\n t += (c * (c-1)) // 2\n print(t) ', 'N = int(input())\nA = [int(i) for i in input().split()]\nfrom collectio... | ['Wrong Answer', 'Accepted'] | ['s116354754', 's517854386'] | [3316.0, 26268.0] | [21.0, 465.0] | [232, 288] |
p02732 | u452512115 | 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 choose2(n):\n return n * (n - 1) // 2\n\na = int(input())\nA = list(map(int, input().split())) \nd = {}\nfor k in A:\n if k in d:\n d[k] += 1\n else:\n d[k] = 1\n \nres = 0\nfor k in d.values():\n res += choose2(k, 2)\n\nfor k in A:\n temp = res\n m = d[k]\n temp -= choose2(m, 2, mod)\n\n d[k] -=... | ['Runtime Error', 'Accepted'] | ['s454359673', 's228993235'] | [26268.0, 25716.0] | [116.0, 534.0] | [358, 339] |
p02732 | u454524105 | 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()))\ncnt = Counter(a)\nans = {}\nfor k in cnt.keys():\n ans[k] = (cnt[k] * cnt[k]-1) // 2\ns = sum(list(ans.values()))\nfor ai in a:\n if ai == 1:\n print(s)\n else:\n print(s - ans[ai] + (ans[ai] / cnt[ai]) * (c... | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s065512292', 's581406267', 's041316976'] | [32924.0, 32924.0, 32028.0] | [655.0, 658.0, 525.0] | [318, 323, 330] |
p02732 | u458834822 | 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 -*-\nimport numpy as np \nimport math\n\n\nN = int(input())\nA = input()\n\nA = np.array(A.split()).astype('int')\nones = np.ones([N, N])\nB = (A*ones)\nfor i in range(N):\n B[i, i] = 0\nB = B[np.where(B != 0, True, False)].reshape(N, N-1)\nB.sort()\n\ndef comb(n, r):\n if n < r:\n retu... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s261991113', 's980130020', 's761644273'] | [38412.0, 38412.0, 26780.0] | [240.0, 248.0, 1711.0] | [669, 711, 426] |
p02732 | u459150945 | 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())\nAn = list(map(int, input().split()))\ncounter = Counter(An)\ncnt = 0\nfor c in counter.values():\n cnt += c * c-1 // 2\nfor a in An:\n print(int(cnt - (counter[a] - 1)))\n', 'from collections import Counter\nfrom scipy.misc import comb\nN = int(input())\nAn = l... | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s292301052', 's652926158', 's715777098', 's440544599'] | [26780.0, 37048.0, 26780.0, 26780.0] | [364.0, 2109.0, 302.0, 332.0] | [219, 272, 214, 216] |
p02732 | u460375306 | 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 OrderedDict\nN = int(input())\nA = list(map(int, input().split()))\n\nball_values = OrderedDict()\nfor val in A:\n if val not in ball_values:\n ball_values[val] = 1\n else:\n ball_values[val] += 1\n# get total pairs of all balls\ntotal_possible_combos = sum(item[1]*(item[1]-1)//2 for i... | ['Wrong Answer', 'Accepted'] | ['s100131083', 's995147199'] | [56752.0, 55308.0] | [590.0, 678.0] | [506, 527] |
p02732 | u470618774 | 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 = list()\nfor i in range(1,n+1):\n c.append(int((b[i]*(b[i]-1))/2))\nprint(c)\nfor i in range(n):\n d = int(a[i]-1)\n if c[d]>2:\n e = sum(c) - c[d] + int( (c[d])*(b[d+1]-2) /(b[d+1]) )\n else:\n ... | ['Wrong Answer', 'Accepted'] | ['s882430612', 's925742389'] | [26780.0, 26780.0] | [2105.0, 681.0] | [341, 340] |
p02732 | u471214054 | 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 scipy.misc import comb\n\nN, M = map(int, input().split())\n\nprint(int(comb(N, 2) + comb(M, 2)))\n', 'from scipy.misc import comb\n\nN = int(input())\nA = list(map(int, input().split()))\n\nfor k, val in enumerate(A):\n count = 0\n nums = [0] * N\n for i, v in enumerate(A):\n if k == i:\n ... | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s178651076', 's629965911', 's355677315'] | [13964.0, 35212.0, 26012.0] | [173.0, 2109.0, 284.0] | [99, 311, 258] |
p02732 | u471539833 | 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\nsum=0\nfor i in range(N):\n b[a[i]]+=1\n\nfor i in range(N):\n sum+=b[i]*(b[i]-1)//2\nfor i in range(N):\n print(sum-b[a[i]]-1)', 'N=int(input())\na=list(map(int,input().split()))\nb=[0]*N\nsum=0\nfor i in range(N):\n b[a[i]-1]+=1\n\nfor i in range(N):\n ... | ['Runtime Error', 'Accepted'] | ['s681130384', 's407320900'] | [24748.0, 26140.0] | [335.0, 362.0] | [179, 183] |
p02732 | u471593927 | 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. | ["#!/usr/bin/python\n# -*- coding: utf-8 -*-\n\n\n\n\n\n\n\nN = int(input())\nA = list(map(int, input().split()))\n\nNumber = []\nTotal = 0\n\nNumber = [A.count(i+1) for i in range(N)]\nTotal = sum([Number[i]*(Number[i]-1)/2 for i in range(N)])\n\n#for Ak in A:\n# print(int(Total - Number[Ak-1]+1))\n\nprint('\\n'.jo... | ['Wrong Answer', 'Accepted'] | ['s455623717', 's422996647'] | [24744.0, 26780.0] | [2104.0, 396.0] | [482, 232] |
p02732 | u471641802 | 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_uni = list(set(a))\n\na_ol = {}\ndef_count = 0\nfor i in a_uni:\n a_co = a.count(i)\n a_ol[i] = a_co\n def_count += a_co * (a_co - 1)\n\ndef_count *= 0.5\n\nfor k in range(n):\n print(def_count - a_ol[a[k]] + 1)\n\n', 'from collections import Counte... | ['Wrong Answer', 'Accepted'] | ['s053442611', 's626015841'] | [26140.0, 26780.0] | [2105.0, 342.0] | [268, 265] |
p02732 | u476124554 | 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()))\ndic = {}\nfor i in a:\n s.add(i)\n if i in dic:\n dic[i] +=1\n else:\n dic[i] = 1\n\nans = 0\nfor i in dic.values():\n ans += i * (i - 1) // 2\n\nfor i in a:\n sa = dic[i] * (dic[i] - 1) // 2 - ((dic[i] - 1) * (dic[i] - 2) // 2)\n p... | ['Runtime Error', 'Accepted'] | ['s483494077', 's996827229'] | [24996.0, 25644.0] | [65.0, 391.0] | [316, 303] |
p02732 | u478266845 | 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 CountFrequency_mod(my_list): \n \n # Creating an empty dictionary \n freq = {} \n for item in my_list: \n if (item in freq): \n freq[item] += 1\n else: \n freq[item] = 1\n \n freq_mod = freq\n freq_val = list(freq.values())\n all_sum=0\n \n for i in... | ['Runtime Error', 'Accepted'] | ['s542897015', 's981244907'] | [26140.0, 26268.0] | [175.0, 413.0] | [596, 604] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.