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
p02730
u942353650
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
["s = input()\na = s[:len(s)/2 -1]\nb = s[len(s)+3/2-1:]\nflag = 0\nif s == s[::-1]:\n if a == a[::-1]:\n if b == b[::-1]:\n flag = 1\n\nif flag:\n print('Yes')\nelse:\n print('No')", "\ns = input()\na = s[:int(len(s)/2)]\nb = s[:-int(len(s)/2 + 1)]\nflag = 0\nif s == s[::-1]:\n if a == ...
['Runtime Error', 'Accepted']
['s585448259', 's861029845']
[3060.0, 3060.0]
[18.0, 17.0]
[195, 204]
p02730
u942356554
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['s1=input()\nl=len(s1)\nh=(l-1)//2\nk1=s1[:h]\nk2=s1[h+1:]\nif k1==k2:\n a=(l-1)//2\n s3=s1[:a]\n if a%2!=0:\n h2=(a-1)//2\n j1=s3[:h2]\n j2=s3[h2+1:]\n if j1==j2:\n b=(l+3)/2\n b2=l-b+1\n s4=s1[:b2]\n h3=(b2-1)//2\n f1=s3[:h3]...
['Runtime Error', 'Accepted']
['s127646287', 's446026155']
[3064.0, 9184.0]
[18.0, 27.0]
[843, 480]
p02730
u944886577
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['s=str(input())\nn=len(s)\nnew_n1=(n-1)/2\nnew_s1=s[:new_n]\n\nnew_n2=(n+3)/2\nnew_s2=s[new_nw:]\n\nfor i in range(new_n1):\n if new_s1[i]!=new_s1[n-i+1]:\n print("No")\n exit()\n else:\n pass\n\nfor j in range(new_n2):\n if new_s2[j]!=new_s2[n-j+1]:\n prin("No")\n else\n print("Yes")\n \n\n ...
['Runtime Error', 'Accepted']
['s522175301', 's348016094']
[9000.0, 9088.0]
[24.0, 29.0]
[304, 380]
p02730
u947327691
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['s=str(input())\n\ncnt=0\n\nnum=len(s)//2\n\na=s[:num]\nb=s[num+1:]\nprint(a)\nprint(b)\n\nnum2=len(a)//2\nc=a[:num2]\nd=a[num2+1:]\n\nprint(c)\nprint(d)\n\nnum3=int((len(s)+3)/2-1)\ns1=s[num3:]\nnum4=len(s1)//2\ne=s1[:num4]\nf=s1[num4+1:]\n\nprint(e)\nprint(f)\n\nif a==b[::-1]:\n cnt +=1\n\nif c==d[::-1]:\n cnt...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s194620924', 's904571506', 's414817794']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 18.0]
[370, 495, 440]
p02730
u949234226
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['\nimport math\ncharacter = input()\nre_character = character[::-1]\n \nnum = int(len(character))\nmiddle = math.ceil(num/2.0)\nprint(middle)\n#print(character[0:middle-1], re_character[middle:num])\n#print(character[0:num], re_character[0:num])\n#print (character[middle:num], re_character[0:middle-1])\n\nif (characte...
['Wrong Answer', 'Accepted']
['s048450532', 's470775995']
[3060.0, 3060.0]
[17.0, 20.0]
[478, 479]
p02730
u953499988
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['def kaibun(s):\n n=len(s)\n a=True\n if n%2==0:\n for i in range(n/2):\n if s[i]!=s[n-1-i]:\n a=False\n else:\n for i in range((n-1)/2):\n if s[i]!=s[n-1-i]:\n a=False\n return a\nS=input()\nN=len(S)\nif kaibun(S)==True and kaibun(S[0:(N-1)/2])==True and kaibun(S[(N+3)/2-1:N])==True...
['Runtime Error', 'Runtime Error', 'Accepted']
['s269726923', 's841757035', 's220031252']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 17.0]
[340, 336, 344]
p02730
u957098479
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
["S = input()\nN = len(S)\n\nans = 'No'\nif S == S[::-1]:\n if S[:N//2] == S[N//2::-1]:\n ans = 'Yes'\n\nprint(ans)", "S = input()\nN = len(S)\n\nans = 'No'\nif S == S[::-1]:\n if S[:N//2] == S[(N//2)-1::-1]:\n ans = 'Yes'\n\nprint(ans)"]
['Wrong Answer', 'Accepted']
['s019281494', 's825196396']
[2940.0, 2940.0]
[17.0, 17.0]
[115, 119]
p02730
u958053648
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
["S=input()\na=S[:int((len(S)-1)/2)]\nb=S[int((len(S)+3)/2)-1:]\nc=''.join(list(reversed(a)))\nd=''.join(list(reversed(b)))\n\nprint(a,b,c,d)\nif a==c and b==d:\n\tprint('Yes')\nelse:\n\tprint('No')", "S=input()\ns=''.join(list(reversed(S)))\na=S[:int((len(S)-1)/2)]\nb=S[int((len(S)+3)/2)-1:]\nc=''.join(list(reversed(a...
['Wrong Answer', 'Accepted']
['s024432718', 's136934173']
[3064.0, 3064.0]
[17.0, 17.0]
[184, 206]
p02730
u962423738
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['s=input()\nn=s\n \nif s==reversed(s) and s[0:(n-1)//2]==reverses(s[0:(n-1)//2]) and s[((n+3)//2)-1:n]==reversed(s[((n+3)//2)-1:n]):\nprint("Yes")\n \nelse:\n\tprint("No")', 's=input()\nn=len(s)\n \nif s==reversed(s) and s[0:(n-1)//2]==reverses(s[0:(n-1)//2]) and s[((n+3)//2)-1:n]==reversed(s[((n+3)//2)-1:n]):\n\tprin...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s069441953', 's229471067', 's361406946', 's471633282', 's623553775', 's811539223', 's885986919']
[8976.0, 9040.0, 8976.0, 8952.0, 9080.0, 9112.0, 8896.0]
[25.0, 30.0, 27.0, 30.0, 32.0, 28.0, 28.0]
[162, 167, 163, 149, 168, 163, 124]
p02730
u964521959
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['\nS = input()\n\nS_list = list(S)\n\ncounter = 0\ncounter_ = 0\ncounter__ = 0\n\n\nfor i in range(int(len(S_list)/2)):\n if(S_list[i]==S_list[i+int(len(S_list)/2)+1]):\n counter = counter + 1\n else:\n counter = counter\nif(counter != int(len(S_list)/2)):\n print("No")\n \n \nelse:\n f...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s076282887', 's761213838', 's865552339', 's351941641']
[3064.0, 3064.0, 3064.0, 3060.0]
[18.0, 17.0, 17.0, 17.0]
[1127, 721, 645, 406]
p02730
u965723631
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['S = input()\nmessage = "No"\nif S == S[::-1]:\n\tindex = int((len(S)-1)/2)\n\ttest = S[:index]\n\tprint(test)\n\tif test == test[::-1]:\n\t\tindex = int((len(S)+3)/2)\n\t\ttest = S[index-1:]\n\t\tprint(test)\n\t\tif test == test[::-1]:\n\t\t\tmessage = "Yes"\nprint(message)\n', 'S = input()\nmessage = "No"\nif S == S...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s157022238', 's288855508', 's496798467']
[3060.0, 3064.0, 2940.0]
[18.0, 17.0, 17.0]
[248, 285, 218]
p02730
u966542724
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
["def kaibun(sl):\n for i in range(len(sl)):\n if sl[i] != sl[-1-i]:\n return 'No'\n break\n else:\n return 'Yes'\n\n\ns = input()\n\n\n\nsl = []\nout = 'Yes'\nslz = []\nslk = []\n\nfor i in range(len(s)):\n sl.append(s[i])\n\nfor i in range((len(s)-1) // 2):\n sl...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s117064046', 's365362244', 's942996037']
[3064.0, 3064.0, 3064.0]
[18.0, 17.0, 17.0]
[455, 513, 458]
p02730
u967484343
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['def palindrome(S):\n for i in range(len(S)//2):\n# print(S[i],S[-(i+1)])\n if S[i] != S[-(i+1)]:\n return 0\n return 1\nans = "No"\nS = input()\nS1 = S[:(len(S)-1)//2]\nS1 = S[(len(S)+3)//2:]\nif palindrome(S) == 1:\n if palindrome(S1) == 1:\n if palindrome(S2) == 1:\n ans == "Yes"\nprint(ans)',...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s533982290', 's790922504', 's975710313', 's520145828']
[8964.0, 9096.0, 8968.0, 9120.0]
[26.0, 29.0, 26.0, 28.0]
[302, 302, 367, 370]
p02730
u969708690
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['s=input()\nA=list(s)\nN=len(A)\nM=N-1\nk=0\nwhile k<M/2:\n if A[k]!=A[M-k]:\n print("No")\n if A[k]!=A[(M-2)/2-k]:\n print("No")\n if A[k+M/2+1]!=A[M-k]:\n print("No")\n else:\n print("Yes")\n k=k+1', 's=input()\nA=list(s)\nN=len(A)\nM=N-1\nR=M//2\nk=0\nwhile k<M/2:\n if A[k]!=A[M-k]:\n print("No...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s055069636', 's689465468', 's129809768']
[3060.0, 3060.0, 3060.0]
[18.0, 18.0, 17.0]
[201, 202, 180]
p02730
u969848070
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
["a = input()\nn= len(a)\nzenzen = a[0:n//2//2]\nzenkou = a[n//2//2:n//2]\nkouzen = a[n//2+1:n-1-n//2//2]\nkoukou = a[n-1-n//2//2]\nnew_zenkou = ''.join(list(reversed(zenkou)))\nnew_koukou = ''.join(list(reversed(koukou)))\nif zenzen != new_zenkou:\n print('No')\n exit()\nif kouzen != new_zenkou:\n print('No')\n ex...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s824306276', 's851103032', 's611207752']
[3064.0, 2940.0, 3064.0]
[17.0, 17.0, 17.0]
[322, 104, 278]
p02730
u974792613
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['s = input()\nn = len(s)\ntop = s[:(n-1)//2]\nbottom = s[(n+3)//2-1:]\n\nif s==s[::-1] and top == top[::-1] and bottom = bottom[::-1]:\n print("Yes")\nelse:\n print("No")', 's = input()\nn = len(s)\ntop = s[: (n - 1) // 2]\nbottom = s[(n + 3) // 2 - 1 :]\n\nif s == s[::-1] and top == top[::-1] and bottom == bottom[:...
['Runtime Error', 'Accepted']
['s279713971', 's796763944']
[2940.0, 2940.0]
[17.0, 17.0]
[163, 184]
p02730
u975652044
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['def pal(t):\n return t == t[::-1];\n\n\ns = input();\nf = pal(s) and pal(s[0:(len(s)//2 - 1):]) and pal(s[(len(s)//2 + 1)::]);\n\nif f == True:\n print("Yes");\nelse:\n print("No");\n', 'def pal(s):\n f = True;\n i = 0;\n l = s.size() - 1;\n while i < l - i:\n if s[i] != s[l - i]:\n f = false;\n\ti++;\...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s007463355', 's187607386', 's820314054']
[3188.0, 2940.0, 2940.0]
[18.0, 17.0, 17.0]
[187, 259, 181]
p02730
u978494963
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['s=input()\nif s==s[::-1] and s==s[:(len(s)−1)//2] and s==s[(len(s)+3)//2-1:]:\n print("Yes")\nelse:\n print("No")', 's=input()\na=s[:(len(s)−1)//2]\nb=s[(len(s)+3)//2-1:]\nif s==s[::-1] and a==a[::-1] and b==b[::-1]:\n print("Yes")\nelse:\n print("No")', 's=input()\na=s[:(len(s)-1)//2]\nb=s[((len(s)+3)//2-1):]\ni...
['Runtime Error', 'Runtime Error', 'Accepted']
['s156815907', 's507531224', 's695406927']
[3192.0, 2940.0, 3060.0]
[19.0, 17.0, 18.0]
[113, 133, 133]
p02730
u980875259
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
["##======================================python3\nimport sys\nimport collections\nsys.setrecursionlimit(10**6)\ninput = sys.stdin.readline\n\nclass Run:\n def build(gv):\n gv.s = input()\n \n def string_reverse_chk(gv, s:str):\n rev_s :_= ''.join(reversed(s))\n if s == rev_s:\n ...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s029958807', 's036165946', 's332852676', 's367189477', 's421797856', 's432768935', 's564593213', 's663099592', 's808345169', 's175554823']
[2940.0, 3316.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 3316.0, 3436.0, 3316.0]
[17.0, 21.0, 17.0, 17.0, 17.0, 17.0, 17.0, 23.0, 21.0, 21.0]
[461, 1111, 452, 487, 1117, 1113, 408, 407, 321, 1144]
p02730
u981812192
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['my_string = input("Type your word: ")\nmy_string = my_string.casefold()\nif ((len(my_string)) < 3 or (len(my_string)) > 100):\n #print(len(my_string))\n print("no")\n quit()\n\nreversed_string = reversed(my_string)\n\nn = len(my_string)\n#defining string [0:(n-1)/2]\nfirst_chars = my_string[:int((n-1)/2)]\nr...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s245985676', 's314899551', 's670257503', 's742110899']
[3064.0, 3064.0, 3064.0, 3064.0]
[19.0, 17.0, 17.0, 18.0]
[921, 813, 921, 942]
p02730
u982471399
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
["S=input()\nK1=int((len(S)-1)/2)\nK2=int((K1-1)/2)\nK3=int((len(S)+3)/2)\n\n#1\nS_K1=S[:K1]\nS_K1_r=S[:K1:-1]\n\n#2\nS_K2=S_K1[:K2]\nS_K2_r=S_K1[:K2:-1]\n#len(S_K2)>=3\n\n#3\nS_K3=S[K3-1:]\n#len(S_K3)>=3\nnum3=int((len(S_K3)-1)/2)\nS_K4=S_K3[:num3]\nS_K4_r=S_K3[:num3:-1]\n\nif S_K1==S_K1_r and (S_K2==S_K2_r and len(S...
['Wrong Answer', 'Accepted']
['s398527785', 's706198189']
[3064.0, 9032.0]
[17.0, 31.0]
[377, 203]
p02730
u982749462
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
["s = input()\nn = len(s)\nprint(s, n)\ni = int(((n-1)/2)-1)\nj = int(((n+3)/2)-1)\n#print(i, j)\nl = s[:i+1]\nl2 = l[::-1]\nr = s[j:]\nr2 = r[::-1]\n#print(l, l2, r, r2)\nif l == l2 and r == r2 and l == r:\n print('Yes')\nelse:\n print('No')", "s = input()\nS = s[::-1]\nn = len(s)\n#print(s, n)\ni = int(((n-1)/2)-1)...
['Wrong Answer', 'Accepted']
['s942550767', 's236623225']
[3064.0, 3064.0]
[18.0, 19.0]
[228, 241]
p02730
u985041094
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['s = list(map(str, input()))\nn = len(s)\nres = True\nfor i in range(n//2):\n print("?")\n if (s[i] != s[n-1-i]):\n res = False\n break\ni = 0\nwhile res and i < n//4:\n print("!")\n if (s[i] != s[(n-1)//2-1-i]):\n res = False\n break\n i += 1\nprint("Yes" if res else "No")',...
['Wrong Answer', 'Accepted']
['s712429970', 's890844329']
[3064.0, 3064.0]
[17.0, 17.0]
[301, 271]
p02730
u985949234
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
["s = input()\nls = list(s)\nprint((len(ls)-1)/2 - 1)\nls1 = ls[:int((len(ls)-1)/2)]\nls2 = ls[int((len(ls)+3)/2) - 1:]\ndef kt(l):\n lr = list(reversed(l))\n if l == lr:\n return 1\n else:\n return 0\na = kt(ls)\nb = kt(ls1)\nc = kt(ls2)\n\n\nd = a + b + c\n\nif d >= 3:\n print('Yes')\nelse:\...
['Wrong Answer', 'Accepted']
['s992662860', 's122311698']
[3064.0, 3064.0]
[17.0, 17.0]
[314, 289]
p02730
u986190948
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['S=input()\nn=len(S)\na=0\nb=0\nfor i in range((n-1)/2):\n\tif S[i]!=S[n-i]:\n \ta=1\n print("No")\n break;\np=""\nq=""\nif a==0:\n\tfor i in range((n-1)/2):\n\t\tp.append(S[i])\n \tq.append(S[i+1+(n-1)/2])\n\tfor i in range((len(p)-1)/2):\n \t\tif p[i]!=p[len(p)-i] or q[i]!=q[len(p)-i]:\n ...
['Runtime Error', 'Accepted']
['s002967175', 's713062904']
[2940.0, 3064.0]
[17.0, 17.0]
[372, 497]
p02730
u994527877
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['s = input()\n\n\ns1 = s[0:len(s)//2]\ns2 = s[len(s)//2+1:len(s)]\n\nprint(s1, s2)\ndef reverse(s): \n return s[::-1]\n\ndef isPalindrome(s): \n rev = reverse(s) \n \n if (s == rev): \n return True\n return False\n\nif isPalindrome(s1):\n if isPalindrome(s2):\n if s1==s2:\n pri...
['Wrong Answer', 'Accepted']
['s641515672', 's695431460']
[3060.0, 3064.0]
[18.0, 17.0]
[330, 393]
p02730
u996731299
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['word=list(map.string().split())\ncheck=True\nfor i in range(len(word)//2)\n if word[i]==word[len(word)-1]:\n continue:\n else:\n check=False\n braek:\nif check==True:\n print("Yes")\nelse:\n print("No")', 'word=list(input())\ncheck=True\nfor i in range(len(word)//2)\n if word[i...
['Runtime Error', 'Runtime Error', 'Accepted']
['s529613519', 's769396716', 's928670966']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0]
[228, 216, 335]
p02730
u997641430
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
["S = list(input())\nN = len(S)\nS0 = S[:(N - 1) // 2]\nS1 = S[(N + 1) // 2:]\nprint(S0, S1, S)\nif S0 == S0[::-1] and S1 == S1[::-1] and S == S[::-1]:\n print('Yes')\nelse:\n print('No')\n", "S = list(input())\nN = len(S)\nS0 = S[:(N - 1) // 2]\nS1 = S[(N + 1) // 2:]\nif S0 == S0[::-1] and S1 == S1[::-1] and S =...
['Wrong Answer', 'Accepted']
['s321537859', 's278491495']
[2940.0, 2940.0]
[17.0, 17.0]
[184, 167]
p02730
u997927785
2,000
1,048,576
A string S of an odd length is said to be a _strong palindrome_ if and only if all of the following conditions are satisfied: * S is a palindrome. * Let N be the length of S. The string formed by the 1-st through ((N-1)/2)-th characters of S is a palindrome. * The string consisting of the (N+3)/2-st through N-th...
['S = str(input())\n\nslist = list(S)\nN = len(slist)\nprint(N)\nk = int((N-1)/2)\n\nrs = slist[::-1]\nfront = slist[0:k]\nrfront = front[::-1]\n\nif front == rfront and rs == slist:\n print("Yes")\n\nelse:\n print("No")\n', 'S = str(input())\n\nslist = list(S)\nN = len(slist)\nk = int((N-1)/2)\n\nrs = slist[::-1...
['Wrong Answer', 'Accepted']
['s990963166', 's825190613']
[3060.0, 3060.0]
[18.0, 17.0]
[210, 201]
p02732
u001024152
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()))\ncnts = Counter(a)\n\n_sum = 0\nfor key,value in cnts.items():\n _sum += value*(value-1)//2\n\nfor ai in a:\n ans = _sum\n c = cnts.count(ai)\n ans -= c*(c-1)//2\n ans += (c-1)*(c-2)//2\n print(ans)\n', 'from c...
['Runtime Error', 'Accepted']
['s866912946', 's992333266']
[25900.0, 26780.0]
[137.0, 429.0]
[292, 286]
p02732
u003475507
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 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\nm = int(input())\na = list(map(int,input().split()))[:m]\nc = c...
['Runtime Error', 'Accepted']
['s532742333', 's105082777']
[26636.0, 26780.0]
[104.0, 456.0]
[666, 248]
p02732
u003644389
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 comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn = int(input())\na = [0]*n\na = list(map(int, input().split()))\nmap(lambda x: x-1, a)\nty=[0]*n\n\nfor i in range(0, n):\n ty[a[i]]+=1\n\ns = 0\n\nfor i in range(0, n):\n if ty[i]>=2:\n s += c...
['Runtime Error', 'Runtime Error', 'Accepted']
['s250173372', 's368339120', 's998780772']
[27676.0, 27396.0, 28188.0]
[112.0, 111.0, 500.0]
[513, 928, 416]
p02732
u004271495
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"""\nfrom math import factorial\nfrom collections import defaultdict\n\n\ndef int_as_array(num): return list(map(int, [y for y in str(num)]))\n\n\ndef array_as_int(arr): return int(\'\'.join(map(str, arr)))\n\n\ndef read_int(): return int(input())\n\n\ndef read_array(): return list(map(int, input().split(\' \'))...
['Wrong Answer', 'Accepted']
['s240064759', 's223136604']
[26888.0, 26888.0]
[2104.0, 399.0]
[1273, 1176]
p02732
u011277545
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\ndef comb(N, r):\n return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))\n\nfor i in range(num):\n A=target.copy()\n A.pop(i)\n out=0\n for j in set(A):\n if A.count(j)>1:\n base = comb(A.count(j),2)\n out=out+base\n print(out)', 'import mat...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s153059510', 's401087973', 's039290751']
[3060.0, 26140.0, 25900.0]
[17.0, 2104.0, 571.0]
[292, 385, 335]
p02732
u022979415
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.
['#include<bits/stdc++.h>\nusing namespace std;\n\nint main() {\n int N;\n cin >> N;\n vector<int> A(N), count(N);\n for (int i = 0; i < N; i++) {\n cin >> A[i];\n }\n for (int i = 0; i < N; i++) {\n count[A[i]]++;\n }\n long long answer = 0;\n for (int i = 0; i < N; i++) {\n ...
['Runtime Error', 'Accepted']
['s317084858', 's243887095']
[2940.0, 26140.0]
[17.0, 292.0]
[460, 455]
p02732
u023751250
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 reduce\nn=int(input())\na=list(map(int,input().split()))\nc=list(range(1,n+1))\na.insert(0,0)\nnum=list(map(lambda t:reduce(lambda a,b:a+1 if b==t else a,a),c))\n"""\ntest=list(map(lambda t:map(lambda x,y:x if (y!=t or x==0) else x-1,num,c),c))\nfor i in range(5):\n print(list(test[i]))\n"""\...
['Wrong Answer', 'Accepted']
['s038157096', 's658722784']
[27020.0, 26892.0]
[2105.0, 403.0]
[463, 257]
p02732
u025287757
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\nimport numpy as np\nfor i in A:\n num[i-1] += 1\nnum = np.array(num)\ndef comb(n):\n if n < 2:\n return 0\n else:\n return n * (n-1) // 2\nans_sub = np.sum(np.array(num))\nfor i in A:\n if num[i-1] < 2:\n a = 0\n else:\n a = ...
['Wrong Answer', 'Accepted']
['s717544727', 's461644729']
[26348.0, 26140.0]
[1705.0, 342.0]
[330, 306]
p02732
u030669569
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.
['#include <bits/stdc++.h>\nusing namespace std;\n\nint main() {\n\n int N; cin >> N;\n vector<int> A(N);\n for (int i = 0; i < N; i++) {\n cin >> A[i];\n }\n\n vector<int> uniqueA = A;\n sort(uniqueA.begin(), uniqueA.end());\n uniqueA.erase(unique(uniqueA.begin(), uniqueA.end()), uniqueA.en...
['Runtime Error', 'Accepted']
['s473018878', 's664025508']
[2940.0, 26780.0]
[18.0, 302.0]
[826, 391]
p02732
u033524082
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()))\nl=[0]*(n+1)\nans=0\nfor i in range(n):\n l[a[i]]+=1\nfor j in range(n):\n if l[j]>1:\n ans+=(l[j])*(l[j]-1)//2\nfor k in range(n):\n s=l[a[k]]\n if s<2:\n print(ans)\n else:\n print(ans-(s+1)*s//2+s*(s-1)//2)', '...
['Wrong Answer', 'Accepted']
['s256207899', 's156379253']
[26780.0, 26072.0]
[388.0, 457.0]
[299, 601]
p02732
u035453792
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()))\ns = n*[0]\nfor i in a:\n s[i]+=1\nfor i in range(0,n):\n s[a[i]]-=1\n ans=max(s)*(max(s)-1)/2\n s[a[i]]+=1\n print(int(ans))', 'import numpy as np\nn = int(input())\na = list(map(int,input().split()))\ns = np.zeros(n+1)\nfor i in a:\n s[i]+=1\nal...
['Runtime Error', 'Accepted']
['s882593097', 's448438276']
[32152.0, 51564.0]
[2206.0, 460.0]
[184, 196]
p02732
u036104576
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 itertools\n# import numpy as np\nimport time\nimport math\n\nsys.setrecursionlimit(10 ** 7)\n\nfrom collections import defaultdict\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\n\nn = int(readline())\na = list(map(int, readline().split...
['Runtime Error', 'Runtime Error', 'Accepted']
['s147971205', 's312640379', 's140028488']
[24788.0, 27860.0, 20776.0]
[268.0, 460.0, 383.0]
[1205, 1194, 651]
p02732
u037098269
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 = [a for a in map(int, input().split())]\n\n\n\ndic1 = {}\nfor i in range(N):\n dic1[i] = 0\n\n\nfor i in A:\n if i in dic1.keys():\n dic1[i] += 1\n\ndic2 = {}\n\nfor i in range(N):\n dic2[i] = dic1[i]*(dic1[i]-1)/2\n\nans1 = 0\nfor i in range(N):\n ans1 += dic2[i]\n\nfor i in r...
['Runtime Error', 'Accepted']
['s130995851', 's878031168']
[68600.0, 68216.0]
[636.0, 694.0]
[591, 660]
p02732
u038021590
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 = tuple(map(int, input().split()))\nA_count = Counter(A)\nans = 0\nfor i, j in A_count:\n ans += j * (j - 1) // 2\nfor k in range(1, N+1):\n n = A_count[A[k-1]]\n ans_ = ans - (n - 1)\n print(ans_)\n', 'from collections import Counter\nN = int(input())\...
['Runtime Error', 'Accepted']
['s069857645', 's925450778']
[27036.0, 27028.0]
[96.0, 391.0]
[253, 261]
p02732
u038887660
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\nh, w, k = map(int, input().split())\nli_hw = [list(f) for f in [input() for _ in range(h)]]\nall_h = []\nscore = []\n# for l in range(2**(h-1)):\n# ind = []\n\n# cut_list=[]\n\n# for n,yn in enumerate(reversed(list(bin(l))[2:])):\n\n# cut_list.append(li_hw[pre:n+1])\n\n# ...
['Runtime Error', 'Accepted']
['s585571731', 's225944951']
[3064.0, 26780.0]
[18.0, 417.0]
[1314, 258]
p02732
u043035376
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())\n\na_list = list(map(int, input().split()))\n\nc = Counter(a_list)\n\nall_count = 0\nfor value in c.values():\n if value == 1:\n continue\n else:\n tmp = int((value * (value - 1))/2)\n all_count += tmp\n\nif all_count == 0:\n all_count ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s069769074', 's182227687', 's206901337', 's263958003', 's800710908', 's248439356']
[26780.0, 26780.0, 26780.0, 26780.0, 34624.0, 26780.0]
[357.0, 330.0, 312.0, 330.0, 2109.0, 321.0]
[353, 315, 351, 333, 747, 317]
p02732
u044220565
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())\nA = input().split()\n\n\ndict = set(A)\ntotal_count = 0\nfor val in dict:\n tmp = A.count(val)\n tmp = int(tmp*(tmp-1)/2)\n total_count += tmp\n\n# substracted count\nfor k in range(N):\n tmp = A.count(A[k])\n sub_count = int(tmp*(tmp-1)/2)\n print('{}'.format(total_count - su...
['Wrong Answer', 'Accepted']
['s326172124', 's086835801']
[22824.0, 20396.0]
[2105.0, 260.0]
[324, 842]
p02732
u046158516
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())\nm=list(map(ine,input().split()))\nt=[]\nfor i in range(N):\n t.append(0)\nfor i in range(N):\n t[m[i]-1]+=1\ntotal=0\nfor i in range(N):\n total+=(t[i]*(t[i]-1))//2\nfor i in range(N):\n if t[m[i]-1]<2:\n print(total)\n else:\n print(total-(t[m[i]-1]-1))', 'N=int(input())\nm=list(map(int,in...
['Runtime Error', 'Accepted']
['s599399385', 's463682041']
[3064.0, 24748.0]
[17.0, 382.0]
[267, 267]
p02732
u046187684
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\n\ndef solve(string):\n n, *a = map(int, string.split())\n c = Counter(a)\n b = sum(v * (v - 1) // 2 for v in c.values())\n print(c, b)\n return "\\n".join(str(b - c[_a] + 1) for _a in a)\n\n\nif __name__ == \'__main__\':\n import sys\n print(solve(sys.stdin.read...
['Wrong Answer', 'Accepted']
['s677395242', 's255666672']
[37388.0, 33548.0]
[305.0, 219.0]
[315, 299]
p02732
u051684204
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()))\nls=[0 for _ in range(N)]\nfor i in range(N):\n ls[A[i]-1]+=1\ns=0\nprint(ls)\nfor i in range(len(ls)):\n m=ls[i]*(ls[i]-1)//2\n s+=m\nfor j in range(N):\n print(s-(ls[A[j]-1]-1))', 'N=int(input())\nA=list(map(int,input().split()))\nls=[0 for _ in range(N)]\nfo...
['Wrong Answer', 'Accepted']
['s507722891', 's167248189']
[25716.0, 25716.0]
[373.0, 355.0]
[225, 215]
p02732
u052221988
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())\nnumlist = [int(_) for _ in input().split()]\nsetnum = set(numlist)\nnsum = 0\n\nfor i in setnum:\n dicnum[i] = numlist.count(i)\n if dicnum[i] >= 2:\n nsum += dicnum[i]*(dicnum[i]-1)//2\n else:\n del dicnum[i]\n\nfor j in range(n):\n ans = nsum\n if numlist[j] in dicnum:...
['Runtime Error', 'Accepted']
['s291556030', 's903819716']
[25644.0, 25716.0]
[93.0, 407.0]
[362, 386]
p02732
u060793972
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 ABC159D(a):\n if a<2:\n return 0\n else:\n return math.factorial(a)//math.factorial(a-2)//2\n\n\nn=int(input())\na=list(map(int,input().split()))\nd1=dict()\nfor i in a:\n if i not in d1:\n d1[i]=1\n else:\n d1[i] += 1\n#print(d1)\nd2={i:ABC159D(j) for i,j in...
['Runtime Error', 'Accepted']
['s438645853', 's428704073']
[41888.0, 38044.0]
[2104.0, 235.0]
[430, 429]
p02732
u068862829
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# N = 5\n# A = [1, 1, 2, 1, 2]\n\nAset = set(A)\nlst = {}\nfor i in Aset:\n lst[i] = 0\n\n# print(lst)\n \nfor i in range(N):\n lst[A[i]] += 1\n\n# print(lst)\n\n \n\nfor i in lst:\n# print('i: {}'.format(i))\n c[i] = 0\n tmp_lst...
['Runtime Error', 'Runtime Error', 'Accepted']
['s541301591', 's795561080', 's075750647']
[33136.0, 33088.0, 37760.0]
[159.0, 152.0, 455.0]
[814, 809, 600]
p02732
u070201429
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.
['#TLE\nn = int(input())\na = input().split()\ndic = {}\nans = 0\nfor i in range(n):\n if a[i] in dic:\n ans += dic[a[i]]\n else:\n num = a.count(a[i]) - 1\n ans += num\n dic[a[i]] = num\nans /= 2\nfor i in range(n):\n print(int(ans - dic[a[i]]))\nprint(dic)', '#TLE\nn = int(input()...
['Wrong Answer', 'Accepted']
['s769399658', 's391800010']
[20764.0, 26752.0]
[2105.0, 400.0]
[278, 205]
p02732
u075012704
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 \nD = defaultdict(int)\nfor a in A:\n D[a] += 1\n \nans_base = 0\nfor v in D.values():\n ans_base += v * (v - 1) // 2\n \nfor a in A:\n print(ans_base - (D[a] * (D[a] - 1) // 2) + ((D[a] - 1) * (D[a] - 2) // 2))', 'from collections import defaultdict\nN...
['Runtime Error', 'Accepted']
['s346201973', 's166651525']
[26140.0, 26772.0]
[65.0, 412.0]
[264, 298]
p02732
u075304271
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 solve():\n n = int(input())\n a = list(map(int, input().split()))\n c = collections.Counter(a)\n s = 0\n for i in list(c.values()):\n s += i*(i-1)//2\n print(c)\n for i in a:\n print(c[i])\n print(s-(c[i]-1))\n return 0\n \nif __name__ == "__main__":\n solve()\n', 'import numpy as np\nimport fun...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s474606503', 's635764225', 's805363070', 's895329542']
[26268.0, 45888.0, 46016.0, 36308.0]
[67.0, 539.0, 720.0, 458.0]
[269, 368, 365, 357]
p02732
u078816252
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()))\nmaxim = max(A)\nselect_num = [0 for i in range(0,maxim+1)]\nselect_num2 = [0 for i in range(0,maxim+1)]\ncount_num = [0 for i in range(0,maxim+1)]\nfor i in range(1,maxim+1):\n count_num[i] = A.count(i)\n if(count_num[i] > 1):\n select_num[i] = (count_num[i] ...
['Runtime Error', 'Accepted']
['s360159552', 's168461853']
[3064.0, 26268.0]
[17.0, 306.0]
[447, 247]
p02732
u078982327
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.
['m = int(input())\nq_list = list(map(int, input().strip().split()))\nn = [0] * m\nk = [0] * m\n\nfor i in q_list:\n n[i - 1] += 1\nfor j, l in zip(range(m), n):\n k[j] = int(l * (l - 1)/2)\nsum_n = sum(k)\n\nfor j in q_list:\n print(sum_n - n[j - 1]-1)\n', 'm = int(input())\nq_list = list(map(int, input().str...
['Wrong Answer', 'Accepted']
['s966716221', 's217449968']
[24748.0, 26012.0]
[340.0, 325.0]
[249, 251]
p02732
u079022116
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 = list(map(int,input().split()))\nc=collections.Counter(a_list)\nresult=0\nprint(c)\n\nfor i in c.values():\n result+=i * (i - 1)//2\n\nfor a in a_list:\n print(result - c[a] + 1) ', 'import collections\nn = int(input())\na_list = list(map(int,input().split()))\nc=c...
['Wrong Answer', 'Accepted']
['s303631681', 's453836535']
[35996.0, 26780.0]
[435.0, 475.0]
[221, 280]
p02732
u079022693
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\ndef main():\n \n readline=stdin.readline\n N=int(readline())\n A=list(map(int,readline().split()))\n\n li=[[0,0] for _ in range(N+1)]\n di=dict()\n print(li)\n for i in range(N):\n if A[i] not in di:\n di[A[i]]=1\n else:\n di[A[i]]+=1\...
['Wrong Answer', 'Accepted']
['s703018926', 's829207099']
[46328.0, 43732.0]
[497.0, 456.0]
[555, 520]
p02732
u086438369
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())\nan = list(map(int, input().split()))\nn_list = [0]*n\n\nfor i in range(n):\n n_list[an[i]-1] += 1\n\nfor j in range(n):\n n_list1 = n_list[:]\n n_list1[an[j]-1] -= 1\n answer = 0\n for k in n_list1:\n answer += k*(k-1)/2\n print(answer)\n ', 'n = int(input())\nan = list(map(int, input().sp...
['Wrong Answer', 'Accepted']
['s149058930', 's941172887']
[24748.0, 25004.0]
[2104.0, 343.0]
[253, 237]
p02732
u088063513
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\nfrom decimal import *\nfrom itertools import permutations, combinations,combinations_with_replacement,product\n\nN = int(input())\n\ns = input().split()\np = [int(w) for w in s]\nprint(\'p:{}\'.format(p))\n\nnumber_list = []\n\'\'\'\nfor i in range(N):\n counter = 0\n for j in range(N):\n ...
['Wrong Answer', 'Accepted']
['s963266980', 's190961158']
[31620.0, 44940.0]
[2105.0, 564.0]
[1149, 1151]
p02732
u089142196
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\nfrom scipy.misc import comb\nfrom collections import Counter\n\nN=int(input())\nA=list(map(int,input().split() ))\nB=[-1]*N \n\nf_cnt=Counter(A)\nf_dic=dict(f_cnt)\n\nfor i,item in enumerate(A):\n if B[item-1]>-1:\n print(B[item-1])\n else:\n D=copy.deepcopy(f_dic)\n D[item] -= 1\n opt=0\...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Wrong Answer', 'Time Limit Exceeded', 'Accepted']
['s038309115', 's250542297', 's678696513', 's734295965', 's774974778', 's607369479']
[55708.0, 53676.0, 54676.0, 27040.0, 56064.0, 27732.0]
[2110.0, 2110.0, 2110.0, 467.0, 2110.0, 442.0]
[457, 454, 639, 287, 796, 289]
p02732
u089504174
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\n\nall=0\nfor i in range(n):\n c[a[i]-1]+=1\nfor i in range(n):\n if c[i]>=2:\n d=c[i]*(c[i]-1)/2\n all+=d\nfor i in range(n):\n print(all-(c[a[i]-1]-1))', 'n=int(input())\na=list(map(int,input().split()))\nc=[0]*n\n\nall=0\nfor i in range(n):\n c[a[...
['Wrong Answer', 'Accepted']
['s437271233', 's303658178']
[25716.0, 24996.0]
[422.0, 365.0]
[286, 291]
p02732
u091307273
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 balls = [int(i) for i in input().split()]\n\n # v - value written on ball\n # b - ball index in [0, n)\n # ct - number of times a value occurs\n\n # hist[v] = ct\n hist = Counter(balls)\n\n # counts[b] = ct \n counts = [ hi...
['Wrong Answer', 'Accepted']
['s363314504', 's839118127']
[9360.0, 34028.0]
[27.0, 226.0]
[699, 632]
p02732
u092387689
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())\nnum_list = list(map(int,input().split()))\nmemo = [0]*(N+1)\nmemo_flg = [False]*(N+1)\ncounter = [0] * (N+1)\ncounter_ans = [0] * (N+1)\n\nfor i in range(N):\n counter_ans[i] = (counter[i]*(counter[i]-1))//2\n\nfor i in num_list:\n counter[i] += 1\n\nall_sum = sum(counter...
['Wrong Answer', 'Accepted']
['s405862760', 's999198491']
[26780.0, 26780.0]
[382.0, 423.0]
[634, 635]
p02732
u093861603
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())\nal=list(map(int,input().split()))\n\ncounter=[0]*(n+1)\nfor a in al:\n nums[a]+=1\n\nsum=0\nfor c in counter:\n sum+=c*(c-1)//2\n\nfor a in al:\n print(sum-(counter[a]-1))\n', 'n=int(input())\nal=list(map(int,input().split()))\n\ncounter=[0]*n\nfor a in al:\n nums[a]+=1\n\nsum=0\nfor c in ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s197244731', 's629162765', 's261168735']
[26268.0, 26268.0, 24872.0]
[67.0, 68.0, 293.0]
[185, 181, 188]
p02732
u094103573
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 if n == 1:\n return 0\n if n == 0:\n return 0\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nif __name__ == '__main__':\n\n N= int(input())\n\n a = list(map(int, input().split()))\n\n for i in range(N):\n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s363313880', 's403345199', 's463253917']
[26140.0, 26780.0, 26780.0]
[72.0, 2104.0, 490.0]
[508, 475, 352]
p02732
u103520789
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_array = map(int, input().split())\nAi_dict = Counter(A_array)\n\n\ndef calc_comb(Ai, dictionary):\n num = 0\n for k,v in dictionary.items():\n if k == Ai:\n N_Ai = v -1 \n else:\n N_Ai = v\n num += N_Ai*(N_Ai-1)/2\...
['Wrong Answer', 'Accepted']
['s449556194', 's868668546']
[29468.0, 35224.0]
[104.0, 498.0]
[395, 401]
p02732
u103724957
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 = [int(i) for i in input().split(' ')]\nc = collections.Counter(a)\ncounts = {}\nall_sum = 0\nfor k, v in c.items():\n val = v * (v-1) / 2\n counts[k] = val\n all_sum += val\n\nfor i in range(n):\n k = a[i]\n count = c[k] - 1\n val = counts[k]\n print(all...
['Wrong Answer', 'Accepted']
['s835531943', 's388254091']
[34460.0, 31752.0]
[558.0, 512.0]
[340, 345]
p02732
u106342872
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\narr = [0]*(n+1)\nfor i in range(n):\n arr[a[i]] += 1\n\nfrom scipy.misc import comb\n\nc = [0]*(n+1)\nfor i in range(n+1):\n c[i] = int(comb(arr[i],2))\n\nd = [0]*(n+1)\nfor i in range(n+1):\n d[i] = int(comb(arr[i]-1,2))\n\n\nfor k in range(n):\n a...
['Wrong Answer', 'Accepted']
['s103284991', 's554061111']
[26584.0, 51356.0]
[2109.0, 592.0]
[361, 286]
p02732
u106778233
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()))\nsum=0\nm=len(a)\nc=list(set(a))\nsum1=0\n\nfor i in range(len(c)):\n k=c.count(c[i])\n sum1+=k*(k-1)//2\n \nfor j in range(m):\n g=a.count(a[i])\n t=sum1-(g*(g-1))//2+((g-1)*(g-2))//2\n print(t)', 'import collections\nfrom collections import defaultd...
['Wrong Answer', 'Accepted']
['s751536785', 's232931196']
[26140.0, 26780.0]
[2104.0, 338.0]
[248, 268]
p02732
u111473084
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 = dict(Counter(a))\nans = 0\nfor v in c.values():\n ans += v*(v-1)//2\nfor i in range(n):\n print(ans-a[i]-1)\n', 'from collections import Counter\n\nn = int(input())\na = list(map(int, input().split()))\nc = dict(Counte...
['Wrong Answer', 'Accepted']
['s146744732', 's610417301']
[26780.0, 26780.0]
[293.0, 350.0]
[199, 202]
p02732
u111652094
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=[]\n\nans1=0\ns=0\nfor i in range(1,N+1):\n a=A.count(i)\n C.append(a)\nfor j in range(N):\n c=C[j]\n if c>1:\n s=c*(c-1)/2\n ans1=ans1+s\nfor k in range(N):\n b=A[k]-1\n ans=ans1-(C[b]+1)\n print(ans)', 'N=int(input())\nA=list(map...
['Wrong Answer', 'Accepted']
['s632780188', 's796142661']
[24748.0, 25716.0]
[2104.0, 341.0]
[271, 305]
p02732
u112007848
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 comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nn = (int)(input())\na = list(map(int, input().split(" ")))\ntemp = [0 for i in range(n + 1)]\naaa = sorted(a)\ncount = 0\nfor i in range(n - 1):\n if aaa[i] == aaa[i + 1]:\n count+= 1\n else:\n temp[aa...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s053574490', 's245939588', 's890896638', 's040185384']
[25644.0, 26140.0, 26268.0, 26140.0]
[1553.0, 554.0, 231.0, 528.0]
[534, 935, 465, 871]
p02732
u113569368
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\ncA = Counter(A)\n\nallS = 0\nfor key in cA:\n allS += cA[key] * (cA[key] - 1) / 2\n\nfor i in range(N):\n if i in cA.keys():\n print(int(allS - (cA[i] - 1)))\n else:\n print(int(allS))', 'from collection...
['Wrong Answer', 'Accepted']
['s948153340', 's247230007']
[34128.0, 33952.0]
[258.0, 279.0]
[284, 290]
p02732
u113991073
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 from collections import Counter\n n=int(input())\n a=list(map(int,input().split()))\n\n q = Counter(a)\n a_cn = sum(x * (x - 1) // 2 for x in q.values())\n\n ans = []\n for x in a:\n ans.append(a_cn - q[x] + 1)\n\n print(ans, sep='\\n')\n\n\nif __name__ == '__main__':\n ...
['Wrong Answer', 'Accepted']
['s647729444', 's576332142']
[31100.0, 30008.0]
[185.0, 275.0]
[308, 309]
p02732
u116038906
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())\nk = list(map(int, input().split()))\n\n\nfrom collections import Counter\nA =Counter(k)\n\n\nfrom math import factorial\ndef kumiawase_num(n, r): \n if n<r:\n return 0\n return factorial(n) // (factorial(n - r) * factorial(r))\n\n\nfrom collections import OrderedDict\nD = OrderedDict...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s113259252', 's453522408', 's039252901']
[53536.0, 48868.0, 26780.0]
[2107.0, 2106.0, 332.0]
[737, 737, 214]
p02732
u118665579
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()]\nprint(A)\na = 0\nfor i in range(N):\n tmp = A[:i]\n tmp.extend(A[i+1:])\n for j in range(N-2):\n for k in range(N-1-j):\n if tmp[j] == tmp[k]:\n a += 1\nprint(a)', 'N = int(input())\nA = [int(i) for i in input().split()...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s552870049', 's691788229', 's928485901']
[26268.0, 26268.0, 26268.0]
[2105.0, 2104.0, 338.0]
[249, 235, 182]
p02732
u119655368
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 count_defaultdict(it):\n counter = collections.defaultdict(int)\n for x in it:\n counter[x] += 1\n return dict(counter)\n \nn = int(input())\nl = list(map(int, input().split()))\nall_sum = 0\ncount = count_defaultdict(l)\nfor k, v in count:\n all_sum += v * (v - 1) // 2\n...
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s087978003', 's198582967', 's341113013', 's689843245', 's976320670']
[26780.0, 26780.0, 3316.0, 26140.0, 26780.0]
[128.0, 126.0, 20.0, 2104.0, 435.0]
[467, 463, 596, 530, 473]
p02732
u121698457
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 = sorted(A)\nB.append(0)\np = B[0]\ny = dict()\nu = 0\nfor k in range(N+1):\n q = B[k]\n if p != q:\n y[p] = u\n u = 0\n u += 1\n p = q\nAll = 0\nfor l in y.values():\n All +=l*(l-1)//2\nprint(All)\nfor j in range(N):\n x = A[j]\...
['Wrong Answer', 'Accepted']
['s862276187', 's966722667']
[26524.0, 25384.0]
[521.0, 518.0]
[351, 340]
p02732
u124605948
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, copy\n\ndef c(n, r):\n return math.factorial(n) // (math.factorial(n-r) * math.factorial(r))\n\ns = input()\nA = list(map(int, input().split()))\n\nd = Counter(A)\n\nc_table = Counter()\nfor v in d.values():\n if v not in c_table:\n if v >= 2:\n c_...
['Wrong Answer', 'Accepted']
['s226263820', 's977225054']
[41564.0, 66208.0]
[2206.0, 458.0]
[550, 312]
p02732
u127499732
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 from collections import defaultdict\n from collections import Counter\n \n n = int(input())\n a = list(map(int, input().split()))\n \n d = Counter(a)\n e = defaultdict(int)\n \n \n \n func = lambda x: x*(x-1)//2 if x>=2 else 0\n \n ppp = ''\n \n for x in a:\n get = e.get(x)\n if ...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s072454376', 's142985106', 's615248209', 's332636812']
[39988.0, 26772.0, 40112.0, 34152.0]
[2105.0, 2105.0, 2105.0, 202.0]
[580, 602, 616, 307]
p02732
u129961029
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()))\nans=[]\nfor i in range(n):\n for j in range(n):\n if i!=j:\n for k in range(j+1,n):\n if a[j]==a[k]:\n ans[i]+=1\nfor i in range(n):\n print(ans[n])', 'n=int(input())\na=list(map(int,input().split()))\nans=[0]*...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s563348188', 's572422637', 's254444264']
[26268.0, 26140.0, 26140.0]
[120.0, 2108.0, 328.0]
[246, 239, 205]
p02732
u129978636
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()))\naset=list(set(a))\nans=0\nalist=[ 0 for i in range(n)]\nfor _ in a:\n alist[_ - 1] += 1\nfor j in aset:\n k=a.count(j) ans += (k*(k-1)) // 2 ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s051896091', 's185017100', 's893093786', 's710780284']
[2940.0, 2940.0, 2940.0, 26140.0]
[17.0, 17.0, 17.0, 330.0]
[359, 609, 548, 178]
p02732
u135116520
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()))\ns=0\ncnt=collections.Counter(A)\nfor key in cnt.keys():\n s+=(cnt[key]*(cnt[key]-1))//2\nfor i in range(N):\n tmp=s\n tmp-=cnt(A[i])*(cnt(A[i])-1)//2\n tmp+=(cnt(A[i])-1)*(cnt(A[i])-2)//2\n print(tmp)\n \n ', 'import collections\nN=int(in...
['Runtime Error', 'Accepted']
['s109192045', 's977422943']
[26780.0, 26780.0]
[156.0, 571.0]
[273, 262]
p02732
u136843617
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())\nballs = list(map(int, input().split()))\nconbi = [0]*n\nresult = 0\nfor i in balls:\n conbi[i-1] +=1\nprint(conbi)\nfor j in range(n):\n result += (conbi[j]*(conbi[j]-1))//2\nfor k in range(n):\n print(result-conbi[balls[k]-1]+1)\n', 'n = int(input())\nballs = list(map(int, input().split())...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s100781476', 's144247034', 's528224667', 's064402852']
[24996.0, 26012.0, 24748.0, 26012.0]
[345.0, 452.0, 347.0, 280.0]
[247, 246, 237, 308]
p02732
u138045722
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(x) for x in input().split()]\nnum={i:0 for i in range(N)}\nfor i in A:\n num[i-1]+=1\ndef set(k):\n if k >= 2:\n return (k)*(k-1)/2\n else:\n return 0\ndef selfset(k):\n if k >= 2:\n return (k-1)*(k-2)/2\n else:\n return 0\n\nsetnum={i:set(num[i]) for ...
['Wrong Answer', 'Accepted']
['s682900363', 's468429279']
[86500.0, 82972.0]
[613.0, 558.0]
[478, 462]
p02732
u143322814
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\nimport math \ndef C(n,r): return n*(n-1)/r\n\nn = int(input())\na = list(map(int, input().split()))\nd = {}\nfor i in a:\n d[i] = d.get(i, 0)+1\n\nc = 0\ncc = {}\nfor key, val in d.items():\n temp = C(val,2)\n c += temp\n if cc.get(key) is None:\n cc[key] = temp - C(val-1,2)\nfor ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s194345096', 's603857886', 's641433804']
[34064.0, 25644.0, 31904.0]
[462.0, 2105.0, 422.0]
[330, 352, 331]
p02732
u148856702
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 = input()\nn = int(n)\ninput_list = list(map(int, input().split()))\nprint(input_list)\ndicts = {}\nfor i in range(n):\n if input_list[i] not in dicts.keys():\n dicts[input_list[i]] = 0\n dicts[input_list[i]] += 1\n\nsums = 0\ndicts2 = {}\nfor key, value in dicts.items():\n if dicts[key] >= 2:\n ...
['Wrong Answer', 'Accepted']
['s021648948', 's982510459']
[36716.0, 31844.0]
[590.0, 537.0]
[642, 644]
p02732
u156815136
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\nA_ = list(map(int,input().split()))\n#A_.remove(1)\n#print(A_)\ndef xC(num):\n return (num * (num - 1)) //2\n\ndef Re_(reA,t):\n Dup = []\n num = 0\n #print(reA)\n for i in range(len(reA)):\n if Dup.count(reA[i]) == 0:\n Dup.append(reA[i])\n else:\n ...
['Wrong Answer', 'Accepted']
['s595360918', 's825830494']
[24748.0, 39636.0]
[66.0, 256.0]
[392, 407]
p02732
u159975271
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()))\na = collections.Counter(A)\nS = len(a)\nk = 0\nfor j in range (S):\n b = a.most_common()[j][1]\n if b > 1:\n k += b * (b-1)/2\n \n\nfor i in range(N):\n s = A[i]\n p = a[s]\n print(int(k - q) \n', 'import collectio...
['Runtime Error', 'Accepted']
['s675453582', 's909965723']
[3060.0, 26772.0]
[17.0, 411.0]
[282, 260]
p02732
u161693347
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, re, os\nfrom collections import deque, defaultdict, Counter\nfrom math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd\nfrom itertools import permutations, combinations, product, accumulate\nfrom operator import itemgetter, mul\nfrom copy import deepcopy\nfrom string import ascii_lowercase...
['Runtime Error', 'Accepted']
['s178828582', 's132464792']
[42488.0, 33304.0]
[895.0, 206.0]
[1045, 1001]
p02732
u163501259
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()))\nIND = list(set(A))\n# CNT = [A.count(x) for x in IND]\n# print(IND)\n# print(CNT)\nCONB = [A.count(x)*(A.count(x)-1)//2 for x in IND]\n\nSUM = sum(CONB)\nCALC = [-1]*(N+1)\nfor i in A:\n if CALC[i] != -1:\n print(CALC[i])\n else:\n # n = CNT[I...
['Runtime Error', 'Accepted']
['s519720690', 's981166797']
[24996.0, 24748.0]
[2104.0, 291.0]
[490, 369]
p02732
u163907160
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\nimport collections\nm=int(input())\na=list(map(int,input().split()))\nA=collections.Counter(a)\ntotal=0\nfor j in A.values():\n total = total + j*(j-1)/2\nfor k in range(m):\n s=A[a[k]]\n d=total-s+1\n print(d)\n', 'import math\nimport collections\nm=int(input())\na=list(map(int,input().split...
['Wrong Answer', 'Accepted']
['s607970902', 's763772587']
[26780.0, 26780.0]
[417.0, 348.0]
[225, 226]
p02732
u181668771
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 = defaultdict(lambda: 0)\nfor i in range(len(A)):\n d[A[i]] += 1\n\nans1 = 0\nans2 = 0\nr = 2\ncalc_dict1 = {}\ncalc_dict2 = {}\nfor k, v in zip(d.keys(), d.values()):\n if v > 1:\n ans1 = math.factorial(v) // (math.factorial(v - r) * math.factoria...
['Runtime Error', 'Accepted']
['s036817780', 's203032142']
[26140.0, 26780.0]
[65.0, 357.0]
[611, 252]
p02732
u183657342
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()))\ncounter = Counter(A)\ncounter_comb = list(map(lambda y: int(y*(y-1)/2), counter.values()))\nsum_counter = sum(counter_comb)\nfor i in range(n):\n z = counter[A[i]-1]\n if z>0:\n print(ssum_counter-(z-1))\n else:\...
['Runtime Error', 'Accepted']
['s240496990', 's330264031']
[26900.0, 26780.0]
[318.0, 371.0]
[338, 335]
p02732
u185297444
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 = [int(i) for i in input().split()]\n\ndef com(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nfor i in range(n):\n ans = 0\n b = a.copy()\n del b[i]\n bb = collections.Counter(b)\n for j in bb:\n if bb[j] > 1:\n ...
['Runtime Error', 'Accepted']
['s320742259', 's906411852']
[33900.0, 34068.0]
[110.0, 996.0]
[346, 389]
p02732
u185405877
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()))\nz=[0]*n\ncnt=0\nfor i in range(n):\n z[k[i]-1]+=1\nfor m in range(n):\n cnt+=z[m]*(z[m]-1)//2\nfor j in range(n):\n print(cnt-z[j]+1)', 'n=int(input())\nk= list(map(int, input().split()))\nz=[0]*n\ncnt=0\nfor i in range(n):\n z[k[i]-1]+=1\nfor m in range...
['Wrong Answer', 'Accepted']
['s625680820', 's929028798']
[26524.0, 25004.0]
[330.0, 354.0]
[185, 198]
p02732
u189056821
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 collections\n\nn = int(input())\na = tuple(map(int, input().split()))\n\nfor i in range(n):\n _a = np.delete(a, i)\n c_dict = collections.Counter(_a)\n total = 0\n for v in c_dict.values():\n if v >= 2:\n total += v * (v - 1) / 2\n \n flag[i] = 1...
['Runtime Error', 'Accepted']
['s234602241', 's001722014']
[34356.0, 34488.0]
[287.0, 210.0]
[326, 545]
p02732
u192042624
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\nusing namespace std;\n\nlong long facto(long long n)\n{\nlong long i,ans;\nans=1;\nfor(i=1;i<=n;i++) {\nans=ans*i;\n}\nreturn ans;\n}\n\n\nlong long com(int n , int r){\n return ( facto(n) / ( facto(n-r) * facto(r) ) );\n}\n\nvoid comb(vector<vector <long long int> > &v){\n for(int i = 0;i <v.size(); i++){\n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s328256446', 's631978194', 's372807001']
[2940.0, 26140.0, 26140.0]
[17.0, 353.0, 348.0]
[1084, 524, 494]