problem_id stringlengths 6 6 | buggy_code stringlengths 8 526k | fixed_code stringlengths 12 526k | labels listlengths 0 15 ⌀ | buggy_submission_id int64 1 1.54M | fixed_submission_id int64 2 1.54M | user_id stringlengths 10 10 | language stringclasses 8
values |
|---|---|---|---|---|---|---|---|
p02728 | def main():
from sys import stdin
input=stdin.readline
n = int(input())
ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
g = [set() for _ in [0]*n]
for a, b in ab:
g[a-1].add(b-1)
g[b-1].add(a-1)
mod = 10**9+7
fact = [1, 1]
inv = [pow(i, mod-2, mod) for i i... | def main():
from sys import stdin
input = stdin.readline
n = int(input())
ab = [list(map(int, input().split())) for _ in [0]*(n-1)]
g = [set() for _ in [0]*n]
for a, b in ab:
g[a-1].add(b-1)
g[b-1].add(a-1)
mod = 10**9+7
fact = [1, 1]
inv = [pow(i, mod-2, mod) for i... | [] | 510,656 | 510,657 | u532966492 | python |
p02728 | import sys
sys.setrecursionlimit(10 ** 7)
class Tree:
C, RL = {}, {}
R, N, D, S, P, T = None, None, None, None, None, None
TL = None
def __init__(s, num):
s.N = num
def set(s, a, b):
if a in s.C: s.C[a].append(b)
else: s.C[a] = [b]
if b in s.C: s.C[b].append(a)
else: s.C[b] = [a]
def mak... | import sys
sys.setrecursionlimit(10 ** 7)
class Tree:
C, RL = {}, {}
R, N, D, S, P, T = None, None, None, None, None, None
TL = None
def __init__(s, num):
s.N = num
def set(s, a, b):
if a in s.C: s.C[a].append(b)
else: s.C[a] = [b]
if b in s.C: s.C[b].append(a)
else: s.C[b] = [a]
def mak... | [
"call.remove"
] | 510,691 | 510,692 | u456353530 | python |
p02728 | n = int(input())
mod = 10**9 + 7
## nCkのmodを求める関数
# テーブルを作る(前処理)
max = 2 * 10**5 + 10
fac, finv, inv = [0]*max, [0]*max, [0]*max
def comInit(max):
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2,max):
fac[i] = fac[i-1]* i% mod
inv[i] = mod - inv[mod%i] * (mod // i) %... | n = int(input())
mod = 10**9 + 7
## nCkのmodを求める関数
# テーブルを作る(前処理)
max = 2 * 10**5 + 10
fac, finv, inv = [0]*max, [0]*max, [0]*max
def comInit(max):
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2,max):
fac[i] = fac[i-1]* i% mod
inv[i] = mod - inv[mod%i] * (mod // i) %... | [
"call.remove"
] | 510,698 | 510,699 | u490642448 | python |
p02728 | def examA():
S = SI()
if S[2]==S[3] and S[4]==S[5]:
print("Yes")
else:
print("No")
return
def examB():
X = I()
ans = 0
ans += (X//500) * 1000
X %= 500
ans += (X//5) * 5
print(ans)
return
def examC():
K, N = LI()
A = LI()
L = [0]*N
L[0] = K-A[... | def examA():
S = SI()
if S[2]==S[3] and S[4]==S[5]:
print("Yes")
else:
print("No")
return
def examB():
X = I()
ans = 0
ans += (X//500) * 1000
X %= 500
ans += (X//5) * 5
print(ans)
return
def examC():
K, N = LI()
A = LI()
L = [0]*N
L[0] = K-A[... | [
"control_flow.return.remove"
] | 510,702 | 510,703 | u638795007 | python |
p02728 | n = int(input())
mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
g2.append( (g2[-1] * inverse[-1]) % mod )
g = [[] for _ in range(n... | n = int(input())
mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
for i in range( 2, N + 1 ):
g1.append( ( g1[-1] * i ) % mod )
inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
g2.append( (g2[-1] * inverse[-1]) % mod )
g = [[] for _ in range(n... | [
"call.remove"
] | 510,712 | 510,713 | u186838327 | python |
p02728 | import sys
def solve():
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
mod = 10 ** 9 + 7
def comb(n, r):
if r > n: return 0
return fac[n] * inv[r] * inv[n - r] % mod
def dfs(v, Pa=-1):
for u in to[v]:
if u == Pa: continue
... | import sys
def solve():
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
mod = 10 ** 9 + 7
def comb(n, r):
if r > n: return 0
return fac[n] * inv[r] * inv[n - r] % mod
def dfs(v, Pa=-1):
for u in to[v]:
if u == Pa: continue
... | [
"identifier.change",
"expression.operation.binary.change"
] | 510,740 | 510,741 | u968404618 | python |
p02728 | import sys
def solve():
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
mod = 10 ** 9 + 7
def comb(n, r):
if r > n: return 0
return fac[n] * inv[r] * inv[n - r] % mod
def dfs(v, Pa=-1):
for u in to[v]:
if u == Pa: continue
... | import sys
def solve():
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
mod = 10 ** 9 + 7
def comb(n, r):
if r > n: return 0
return fac[n] * inv[r] * inv[n - r] % mod
def dfs(v, Pa=-1):
for u in to[v]:
if u == Pa: continue
... | [
"identifier.change",
"expression.operation.binary.change"
] | 510,742 | 510,741 | u968404618 | python |
p02728 | from functools import reduce
p = 1000000007 #ここを変える
ccache = []
inv_ccache = []
def powmod(a, n):
global p
res = 1
tmp=a
while n>0:
if n & 1 == 1:
res = (res * tmp) % p
n=n//2
tmp = tmp * tmp % p
return res
def invmod(n):
return powmod(n, p - 2)
def cmod(n, r... | from functools import reduce
p = 1000000007 #ここを変える
ccache = []
inv_ccache = []
N = 1000000
def powmod(a, n):
global p
res = 1
tmp=a
while n>0:
if n & 1 == 1:
res = (res * tmp) % p
n=n//2
tmp = tmp * tmp % p
return res
def invmod(n):
return powmod(n, p - 2)
d... | [
"assignment.add"
] | 510,787 | 510,788 | u634743753 | python |
p02732 | N = int(input())
A = list(map(int,input().split()))
from collections import Counter
cnt = Counter(A)
ans = 0
for v in cnt.values():
ans += v*(v-1)//2
for a in A:
k = C[a]
print(ans - (k*(k-1)//2) + (k-1)*(k-2)//2) | N = int(input())
A = list(map(int,input().split()))
from collections import Counter
cnt = Counter(A)
ans = 0
for v in cnt.values():
ans += v*(v-1)//2
for a in A:
k = cnt[a]
print(ans - (k*(k-1)//2) + (k-1)*(k-2)//2) | [
"assignment.value.change",
"identifier.change"
] | 510,815 | 510,816 | u744034042 | python |
p02732 | def nc2(n):
if n==0:
return 0
return n*(n-1)/2
n=int(input())
arr=[int(i) for i in input().strip().split(" ")]
ans=0
dic={}
for i in arr:
dic[i]=dic.get(i,0)+1
for i in dic:
if dic[i]==1 :
continue
ans+=nc2(dic[i])
print(dic)
for i in range(n):
curr_nc2=nc2(dic[arr[i]])
... | def nc2(n):
if n==0:
return 0
return n*(n-1)/2
n=int(input())
arr=[int(i) for i in input().strip().split(" ")]
ans=0
dic={}
for i in arr:
dic[i]=dic.get(i,0)+1
for i in dic:
if dic[i]==1 :
continue
ans+=nc2(dic[i])
#print(dic)
for i in range(n):
curr_nc2=nc2(dic[arr[i]])
... | [
"call.remove"
] | 510,817 | 510,818 | u686174642 | python |
p02732 | import collections
n=int(input())
a=list(map(int,input().split()))
c=collections.Counter(a)
print(c)
for i in c.values():
s+=i*(i-1)//2 #ボールを抜かない場合に2つのボールを選ぶ方法の数
for j in a:
f=c[j]
print(s-(f-1)) #下記メモ参照
'''
複数個のボールから1個のボールが抜かれる場合、i*(i-1)//2が(i-1)*(i-2)//2となる。
i*(i-1)//2-(i-1)*(i-2)//2
=i-1
よって、2つのボールを選ぶ方... | import collections
n=int(input())
a=list(map(int,input().split()))
c=collections.Counter(a)
s=0
for i in c.values():
s+=i*(i-1)//2 #ボールを抜かない場合に2つのボールを選ぶ方法の数
for j in a:
f=c[j]
print(s-(f-1)) #下記メモ参照
'''
複数個のボールから1個のボールが抜かれる場合、i*(i-1)//2が(i-1)*(i-2)//2となる。
i*(i-1)//2-(i-1)*(i-2)//2
=i-1
よって、2つのボールを選ぶ方法が(i-1... | [
"call.arguments.change"
] | 510,830 | 510,831 | u800058906 | python |
p02732 | import collections
n=int(input())
a=list(map(int,input().split()))
c=collections.Counter(a)
print(c)
s=0
for i in c.values():
s+=i*(i-1)//2 #ボールを抜かない場合に2つのボールを選ぶ方法の数
for j in a:
f=c[j]
print(s-(f-1)) #下記メモ参照
'''
複数個のボールから1個のボールが抜かれる場合、i*(i-1)//2が(i-1)*(i-2)//2となる。
i*(i-1)//2-(i-1)*(i-2)//2
=i-1
よって、2つのボールを... | import collections
n=int(input())
a=list(map(int,input().split()))
c=collections.Counter(a)
s=0
for i in c.values():
s+=i*(i-1)//2 #ボールを抜かない場合に2つのボールを選ぶ方法の数
for j in a:
f=c[j]
print(s-(f-1)) #下記メモ参照
'''
複数個のボールから1個のボールが抜かれる場合、i*(i-1)//2が(i-1)*(i-2)//2となる。
i*(i-1)//2-(i-1)*(i-2)//2
=i-1
よって、2つのボールを選ぶ方法が(i-1... | [
"call.remove",
"literal.string.change"
] | 510,832 | 510,831 | u800058906 | python |
p02732 |
if __name__ == '__main__':
n = int(input())
A = list(map(int,input().split()))
#全体の数
d = Counter(A)
d2 = dict()
#この時の組み合わせの合計
for k,v in d.items():
d2[k] = (v*(v-1)) // 2
ans_sum = sum(d2.values())
#結果表示
for i in A:
ans = 0
if i in d2:
... | from collections import Counter
if __name__ == '__main__':
n = int(input())
A = list(map(int,input().split()))
#全体の数
d = Counter(A)
d2 = dict()
#この時の組み合わせの合計
for k,v in d.items():
d2[k] = (v*(v-1)) // 2
ans_sum = sum(d2.values())
#結果表示
for i in A:
ans = 0... | [] | 510,854 | 510,855 | u517797706 | python |
p02732 | n = int(input())
A = list(map(int,input().split()))
S={}
for i in range(n):
a = A[i]
if a in S :
S[a]+=1
else:
S[a]=1
V=list(S.values())
c = sum([v*(v-1)//2 for v in V])
cdiff=0
K=[]
for i in range(n):
a = A[i]
s=S[a]
if s>=2 :
cdiff=(s*(s-1)-(s-1)*(s-2))//2
print(... | n = int(input())
A = list(map(int,input().split()))
S={}
for i in range(n):
a = A[i]
if a in S :
S[a]+=1
else:
S[a]=1
V=list(S.values())
c = sum([v*(v-1)//2 for v in V])
cdiff=0
K=[]
for i in range(n):
cdiff=0
a = A[i]
s=S[a]
if s>=2 :
cdiff=(s*(s-1)-(s-1)*(s-2))//... | [
"assignment.add"
] | 510,879 | 510,880 | u707030679 | python |
p02732 | import math
N = int(input())
A = list(map(int, input().split()))
dic = {}
for a in A:
if not a in dic:
dic[a] = 1
else:
dic[a] += 1
ans = 0
for a in dic:
if dic[a] > 1:
ans += dic[a] * (dic[a] - 1) // 2
ansdic = {}
for a in dic:
ansdic[a] = 0
if dic[a] > 1:
ansd... | import math
N = int(input())
A = list(map(int, input().split()))
dic = {}
for a in A:
if not a in dic:
dic[a] = 1
else:
dic[a] += 1
ans = 0
for a in dic:
if dic[a] > 1:
ans += dic[a] * (dic[a] - 1) // 2
ansdic = {}
for a in dic:
ansdic[a] = ans
if dic[a] > 1:
an... | [
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove"
] | 510,897 | 510,898 | u758815106 | python |
p02732 | def combination(n,r):
n_=1
r_=1
for i in range(n,n-r,-1):
n_*=i
for i in range(1,r+1):
r_*=i
return n_//(n_r*r_)
def main():
N=int(input())
A=list(map(int,input().split()))
ball_dic={}
for a in A:
if a in ball_dic.keys():
ball_dic[a]+=1
... | def combination(n,r):
n_=1
r_=1
for i in range(n,n-r,-1):
n_*=i
for i in range(1,r+1):
r_*=i
return n_//r_
def main():
N=int(input())
A=list(map(int,input().split()))
ball_dic={}
for a in A:
if a in ball_dic.keys():
ball_dic[a]+=1
else:... | [] | 510,903 | 510,904 | u920977317 | python |
p02732 | N=int(input())
A=list(map(int,input().split()))
dic={}
for a in A:
if a in dic:
dic[a]+=1
else:
dic[a]=1
print(dic)
c=0
for i in dic.values():
c+=i*(i-1)/2
for j in range(1,N+1):
d=c-dic[A[j-1]]+1
print(int(d))
| N=int(input())
A=list(map(int,input().split()))
dic={}
for a in A:
if a in dic:
dic[a]+=1
else:
dic[a]=1
c=0
for i in dic.values():
c+=i*(i-1)/2
for j in range(1,N+1):
d=c-dic[A[j-1]]+1
print(int(d))
| [
"call.remove"
] | 510,952 | 510,953 | u428199834 | python |
p02732 | n=int(input())
a=list(map(int,input().split()))
def choose2(n):
if n <= 1:
return 0
return n*(n-1)//2
inp = [0]*(n+1)
for i in range(n):
inp[a[i]] += 1
total = 0
for i in range(n):
total += choose2(inp[i])
for i in range(n):
count = total - choose2(inp[a[i]]) + choose2(inp[a[i]]-1)
print(count)
| n=int(input())
a=list(map(int,input().split()))
def choose2(n):
if n <= 1:
return 0
return n*(n-1)//2
inp = [0]*(n+1)
for i in range(n):
inp[a[i]] += 1
total = 0
for i in range(n+1):
total += choose2(inp[i])
for i in range(n):
count = total - choose2(inp[a[i]]) + choose2(inp[a[i]]-1)
print(count)
| [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 510,977 | 510,978 | u145145077 | python |
p02732 | from collections import Counter
n = int(input())
a_input = list(map(int,input().split()))
a_count = Counter(a_input)
score_dic={}
exclude_dic={}
for k,v in enumerate(a_count.items()):
score_dic[k]=v*(v-1)//2
exclude_dic[k]=(v-1)*(v-2)//2
score_sum = sum(score_dic.values())
for i in range(n):
print(scor... | from collections import Counter
n = int(input())
a_input = list(map(int,input().split()))
a_count = Counter(a_input)
score_dic={}
exclude_dic={}
for k,v in a_count.items():
score_dic[k]=v*(v-1)//2
exclude_dic[k]=(v-1)*(v-2)//2
score_sum = sum(score_dic.values())
for i in range(n):
print(score_sum-score... | [
"call.remove",
"call.arguments.change"
] | 510,979 | 510,980 | u535171899 | python |
p02732 | from collections import Counter
n = int(input())
a_input = list(map(int,input().split()))
a_count = Counter(a_input)
score_dic={}
exclude_dic={}
for k,v in enumerate(a_count.items()):
score_dic[k]=v*(v-1)//2
exclude_dic[k]=(v-1)*(v-2)//2
score_sum = sum(score_dic.values())
for i in range(n):
print(scor... | from collections import Counter
n = int(input())
a_input = list(map(int,input().split()))
a_count = Counter(a_input)
score_dic={}
exclude_dic={}
for k,v in a_count.items():
score_dic[k]=v*(v-1)//2
exclude_dic[k]=(v-1)*(v-2)//2
score_sum = sum(score_dic.values())
for i in range(n):
print(score_sum-score... | [
"call.remove",
"call.arguments.change"
] | 510,979 | 510,981 | u535171899 | python |
p02732 | import collections
n = int(input())
arr = list(map(int,input().split()))
cnt = collectioms.Counter(arr)
total = 0
for key in cnt.keys():
total += cnt[key] * (cnt[key] - 1)//2
for i in range(n):
tmp = total
tmp -= cnt[arr[i]]*(cnt[arr[i]] - 1)//2
tmp += (cnt[arr[i]] - 1)*(cnt[arr[i]] - 2)//2
print(tmp) | import collections
n = int(input())
arr = list(map(int,input().split()))
cnt = collections.Counter(arr)
total = 0
for key in cnt.keys():
total += cnt[key] * (cnt[key] - 1)//2
for i in range(n):
tmp = total
tmp -= cnt[arr[i]]*(cnt[arr[i]] - 1)//2
tmp += (cnt[arr[i]] - 1)*(cnt[arr[i]] - 2)//2
print(tmp)
| [
"assignment.value.change",
"identifier.change"
] | 510,993 | 510,994 | u228303592 | python |
p02732 |
import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
v = c.values()
s = 0
for i in v:
s += (i*(i-1))//2
for i in range(n):
d = c[a[i]]
x = (d*(d-1))//2 if d > 1 else 0
y = (d-1*(d-2))//2 if d > 2 else 0
print(s-x+y)
| import collections
n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
v = c.values()
s = 0
for i in v:
s += (i*(i-1))//2
for i in range(n):
d = c[a[i]]
x = (d*(d-1))//2 if d > 1 else 0
y = ((d-1)*(d-2))//2 if d > 2 else 0
print(s-x+y)
| [] | 511,004 | 511,005 | u555458045 | python |
p02732 | import math
N = int(input())
K = list(map(int,input().split()))
hashmap = {}
for k in K:
if k not in hashmap:
hashmap[k] = 0
hashmap[k]+=1
total = 0
for v in hashmap.values():
total+=math.factorial(v) // (math.factorial(v - 2) * 2)
for k in K:
print(total-(hashmap[k]-1)) | import math
N = int(input())
K = list(map(int,input().split()))
hashmap = {}
for k in K:
if k not in hashmap:
hashmap[k] = 0
hashmap[k]+=1
total = 0
for v in hashmap.values():
if v>=2:
total+=math.factorial(v) // (math.factorial(v - 2) * 2)
for k in K:
print(total-(hashmap[k]-1)) | [
"control_flow.branch.if.add"
] | 511,006 | 511,007 | u311488536 | python |
p02732 | def main():
N = int(input())
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
ans = 0
for v in c.values():
ans += v*(v-1)//2
for k in range(N):
v = c[A[k]]
diff = -v*(v-1)//2 + (v-1)*(v-2)//2
print(ans + diff if v != 1 else... | def main():
N = int(input())
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
ans = 0
for v in c.values():
ans += v*(v-1)//2
for k in range(N):
v = c[A[k]]
diff = -v*(v-1)//2 + (v-1)*(v-2)//2
print(ans + (diff if v != 1 els... | [
"call.arguments.change"
] | 511,010 | 511,011 | u312025627 | python |
p02732 | def main():
N = int(input())
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
ans = 0
for v in c.values():
ans += v*(v-1)//2
for k in range(N):
if 2 <= c[A[k]]:
print(ans - (c[A[k]] - 1))
else:
print(0)
if ... | def main():
N = int(input())
A = [int(i) for i in input().split()]
from collections import Counter
c = Counter(A)
ans = 0
for v in c.values():
ans += v*(v-1)//2
for k in range(N):
if 2 <= c[A[k]]:
print(ans - (c[A[k]] - 1))
else:
print(ans)
i... | [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"io.output.change"
] | 511,012 | 511,013 | u312025627 | python |
p02732 | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
cA = Counter(A)
allS = 0
for key in cA:
allS += cA[key] * (cA[key] - 1) / 2
for i in range(N):
if i in cA.keys():
print(int(allS - (cA[i] - 1)))
else:
print(int(allS)) | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
cA = Counter(A)
allS = 0
for key in cA:
allS += cA[key] * (cA[key] - 1) / 2
for i in range(N):
if A[i] in cA.keys():
print(int(allS - (cA[A[i]] - 1)))
else:
print(int(allS)) | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"call.arguments.change"
] | 511,031 | 511,032 | u113569368 | python |
p02732 | from collections import Counter
N=int(input())
A = list(map(int,input().split()))
ans = [0] * N
B = Counter(A)
for i in range(N):
ans[i] = B[A[i]]-1
total=sum(ans)
C=[]
for i in range(N):
c = (total-ans[i])//2
C.append(c)
for num in C:
print(num) | from collections import Counter
N=int(input())
A = list(map(int,input().split()))
ans = [0] * N
B = Counter(A)
for i in range(N):
ans[i] = B[A[i]]-1
total=sum(ans)
C=[]
for i in range(N):
c = (total-2*ans[i])//2
C.append(c)
for num in C:
print(num) | [
"assignment.change"
] | 511,073 | 511,074 | u640922335 | python |
p02732 | from collections import Counter
N=int(input())
A = list(map(int,input().split()))
ans = [0] * N
B = Counter(A)
for i in range(N):
ans[i] = B[A[i]]-1
total=sum(A)
C=[]
for i in range(N):
c = (total-ans[i])//2
C.append(c)
for num in C:
print(num) | from collections import Counter
N=int(input())
A = list(map(int,input().split()))
ans = [0] * N
B = Counter(A)
for i in range(N):
ans[i] = B[A[i]]-1
total=sum(ans)
C=[]
for i in range(N):
c = (total-2*ans[i])//2
C.append(c)
for num in C:
print(num) | [
"assignment.value.change",
"identifier.change",
"call.arguments.change"
] | 511,075 | 511,074 | u640922335 | python |
p02732 | from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
d = defaultdict(int)
for key in A:
d[key] += 1
#print(d)
Sum = 0
for i in d:
n = d[A[i]]
Sum += (n * (n - 1)) // 2
#print((n * (n - 1)) // 2)
#print(d[A[i]],i)
#print(d)
#print(Sum)
for i in range(N... | from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
d = defaultdict(int)
for key in A:
d[key] += 1
#print(d)
Sum = 0
for i in d:
n = d[i]
Sum += (n * (n - 1)) // 2
#print((n * (n - 1)) // 2)
#print(d[A[i]],i)
#print(d)
#print(Sum)
for i in range(N):
... | [] | 511,090 | 511,091 | u698902360 | python |
p02732 | N=int(input())
A=list(map(int,input().strip().split()))
l=[0 for n in range(N+1)]
for e in A:
l[e]+=1
count=0
for n in range(N):
if l[n]>=2:
count+=l[n]*(l[n]-1)//2
for n in range(N):
print(count-l[A[n]]+1) | N=int(input())
A=list(map(int,input().strip().split()))
l=[0 for n in range(N)]
for e in A:
l[e-1]+=1
count=0
for n in range(N):
if l[n]>=2:
count+=l[n]*(l[n]-1)//2
for n in range(N):
print(count-l[A[n]-1]+1) | [
"expression.operation.binary.remove"
] | 511,119 | 511,120 | u613920660 | python |
p02732 | from operator import mul
from functools import reduce
N = int(input())
A = list(map(int,input().split()))
def cmb(n, r):
if n < r: return 0
r = min(n - r, r)
if r == 0: return 1
over = reduce(mul, range(n, n - r, -1))
under = reduce(mul, range(1, r + 1))
return over // under
dic = {}
for i i... | from operator import mul
from functools import reduce
N = int(input())
A = list(map(int,input().split()))
def cmb(n, r):
if n < r: return 0
r = min(n - r, r)
if r == 0: return 1
over = reduce(mul, range(n, n - r, -1))
under = reduce(mul, range(1, r + 1))
return over // under
dic = {}
for i... | [
"identifier.change"
] | 511,125 | 511,126 | u885634168 | python |
p02732 | N=int(input())
A=list(map(int,input().split()))
count=[0]*(N+1)
for a in A:
count[a]+=1
combination=0
for i in range(N):
if count[i]!=0:
combination+=count[i]*(count[i]-1)//2
for a in A:
print(combination-(count[a]-1)) | N=int(input())
A=list(map(int,input().split()))
count=[0]*(N+1)
for a in A:
count[a]+=1
combination=0
for i in range(N+1):
if count[i]!=0:
combination+=count[i]*(count[i]-1)//2
for a in A:
print(combination-(count[a]-1)) | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 511,177 | 511,178 | u597374218 | python |
p02732 | n = int(input())
a = list(map(int, input().split()))
def factorial(n):
v = 1
for i in range(1, n + 1):
v *= i
return v
def comb(a, b):
return factorial(a) // (factorial(b) * factorial(a - b))
from collections import Counter
acnt = dict(Counter(a))
value = list(acnt.values())
sv = 0
for i in r... | n = int(input())
a = list(map(int, input().split()))
def factorial(n):
v = 1
for i in range(1, n + 1):
v *= i
return v
def comb(a, b):
return factorial(a) // (factorial(b) * factorial(a - b))
from collections import Counter
acnt = dict(Counter(a))
value = list(acnt.values())
sv = 0
for i in r... | [
"expression.operation.binary.change"
] | 511,254 | 511,255 | u288335507 | python |
p02732 | n = int(input())
a = list(map(int, input().split()))
c = {}
for i in a:
c[i] = c.get(i, 0) + 1
ways = 0
for i in a:
ways += c[i]*(c[i]-1)//2
for k in a:
ans = ways-c[k]+1
print(ans)
| n = int(input())
a = list(map(int, input().split()))
c = {}
for i in a:
c[i] = c.get(i, 0) + 1
ways = 0
for i in c:
ways += c[i]*(c[i]-1)//2
for k in a:
ans = ways-c[k]+1
print(ans)
| [
"identifier.change"
] | 511,278 | 511,279 | u878654696 | python |
p02732 | n = int(input())
l = list(map(int, input().split()))
import collections
c = collections.Counter(l)
ans = 0
for i in c.values():
ans += i * (i - 1) // 2
for i in l:
print(ans - c[i] - 1) | n = int(input())
l = list(map(int, input().split()))
import collections
c = collections.Counter(l)
ans = 0
for i in c.values():
ans += i * (i - 1) // 2
for i in l:
print(ans - c[i] + 1) | [
"misc.opposites",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 511,316 | 511,317 | u962505501 | python |
p02732 | n = int(input())
l = list(map(int, input().split()))
import collections
c = collections.Counter(l)
for i in c.values():
ans += i * (i - 1) // 2
for i in l:
print(ans - c[i] - 1) | n = int(input())
l = list(map(int, input().split()))
import collections
c = collections.Counter(l)
ans = 0
for i in c.values():
ans += i * (i - 1) // 2
for i in l:
print(ans - c[i] + 1) | [
"misc.opposites",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 511,318 | 511,317 | u962505501 | python |
p02732 | n = int(input())
number = list(map(int,input().split()))
num = sorted(number)
num.append(0)
p = num[0]
combi = dict()
u = 0
for i in range (n+1) :
q = num[i]
if p != q :
combi[p] = u
u = 0
u += 1
p = q
t = 0
for j in combi.values() :
t += j*(j-1)//2
for k in range (n) :
x = c... | n = int(input())
number = list(map(int,input().split()))
num = sorted(number)
num.append(0)
p = num[0]
combi = dict()
u = 0
for i in range (n+1) :
q = num[i]
if p != q :
combi[p] = u
u = 0
u += 1
p = q
t = 0
for j in combi.values() :
t += j*(j-1)//2
for k in range (n) :
x = n... | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 511,344 | 511,345 | u369502636 | python |
p02732 | N = int(input())
A = list(map(int, input().split()))
B = sorted(A)
B.append(0)
p = B[0]
y = dict()
u = 0
for k in range(N+1):
q = B[k]
if p != q:
y[p] = u
u = 0
u += 1
p = q
All = 0
for l in y.values():
All +=l*(l-1)//2
print(All)
for j in range(N):
x = A[j]
print(All+(y[x]-1... | N = int(input())
A = list(map(int, input().split()))
B = sorted(A)
B.append(0)
p = B[0]
y = dict()
u = 0
for k in range(N+1):
q = B[k]
if p != q:
y[p] = u
u = 0
u += 1
p = q
All = 0
for l in y.values():
All +=l*(l-1)//2
for j in range(N):
x = A[j]
print(All+(y[x]-1)*(y[x]-2)/... | [
"call.remove"
] | 511,390 | 511,391 | u121698457 | python |
p02732 | from collections import Counter
n = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
counter_comb = list(map(lambda y: int(y*(y-1)/2), counter.values()))
sum_counter = sum(counter_comb)
for i in range(n):
z = counter[A[i]-1]
if z>0:
print(ssum_counter-(z-1))
else:
print... | from collections import Counter
n = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
counter_comb = list(map(lambda y: int(y*(y-1)/2), counter.values()))
sum_counter = sum(counter_comb)
for i in range(n):
z = counter[A[i]]
if z>0:
print(sum_counter-(z-1))
else:
print(su... | [
"expression.operation.binary.remove",
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 511,438 | 511,439 | u183657342 | python |
p02732 | import collections
n = int(input())
A = list(map(int,input().split()))
B = collections.Counter(A)
C = B.copy()
total = 0
for i in B.values():
total += i*(i-1)//2
for i in A:
print(total - i) | import collections
n = int(input())
A = list(map(int,input().split()))
B = collections.Counter(A)
C = B.copy()
total = 0
for i in B.values():
total += i*(i-1)//2
for i in A:
print(total - B[i]+1) | [
"expression.operation.binary.add"
] | 511,442 | 511,443 | u678505520 | python |
p02732 | n=int(input())
al=list(map(int,input().split()))
counter=[0]*(n+1)
for a in al:
nums[a]+=1
sum=0
for c in counter:
sum+=c*(c-1)//2
for a in al:
print(sum-(counter[a]-1))
| n=int(input())
al=list(map(int,input().split()))
counter=[0]*(n+1)
for a in al:
counter[a]+=1
sum=0
for c in counter:
sum+=c*(c-1)//2
for a in al:
print(sum-(counter[a]-1))
| [
"identifier.change"
] | 511,460 | 511,461 | u093861603 | python |
p02732 | n=int(input())
al=list(map(int,input().split()))
counter=[0]*n
for a in al:
nums[a]+=1
sum=0
for c in counter:
sum+=c*(c-1)//2
for a in al:
print(sum-(counter[a]-1))
| n=int(input())
al=list(map(int,input().split()))
counter=[0]*(n+1)
for a in al:
counter[a]+=1
sum=0
for c in counter:
sum+=c*(c-1)//2
for a in al:
print(sum-(counter[a]-1))
| [
"identifier.change"
] | 511,462 | 511,461 | u093861603 | python |
p02732 | from copy import deepcopy
dp = {}
N = int(input())
A = list(map(int, input().split()))
balls = {}
fact = 1
for (i, a) in enumerate(A):
count = i+1
dp[count] = count * (count-1) // 2
if a in balls:
balls[a] += 1
else:
balls[a] = 1
res = 0
for count in balls.values():
res += dp[count]
for a in A:
... | from copy import deepcopy
dp = {0: 0}
N = int(input())
A = list(map(int, input().split()))
balls = {}
fact = 1
for (i, a) in enumerate(A):
count = i+1
dp[count] = count * (count-1) // 2
if a in balls:
balls[a] += 1
else:
balls[a] = 1
res = 0
for count in balls.values():
res += dp[count]
for a in A... | [] | 511,467 | 511,468 | u059940903 | python |
p02732 | n=int(input())
a=list(map(int,input().split()))
cnt=[0]*(n+1)
for i in range(n):
cnt[a[i]]+=1
aa=0
ans=[]
for i in range(n):
aa+=(cnt[i]*(cnt[i]-1)//2)
for i in range(n):
print(aa-(cnt[a[i]]*(cnt[a[i]]-1))//2 +((cnt[a[i]]-1)*(cnt[a[i]]-2))//2, end ="\n")
| n=int(input())
a=list(map(int,input().split()))
cnt=[0]*(n+1)
for i in range(n):
cnt[a[i]]+=1
aa=0
ans=[]
for i in range(n+1):
aa+=(cnt[i]*(cnt[i]-1)//2)
for i in range(n):
print(aa-(cnt[a[i]]*(cnt[a[i]]-1))//2 +((cnt[a[i]]-1)*(cnt[a[i]]-2))//2, end ="\n")
| [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 511,488 | 511,489 | u408148811 | python |
p02732 | N = int(input())
A = list(map(int,input().split()))
import collections
import math
dicA = collections.Counter(A)
total = 0
for x in list(dicA.values()):
total += math.factorial(x) // (math.factorial(x - 2)*2)
for i in range(N):
print(total - dicA[A[i]] +1)
| N = int(input())
A = list(map(int,input().split()))
import collections
import math
dicA = collections.Counter(A)
total = 0
for x in list(dicA.values()):
if x != 1:
total += math.factorial(x) // (math.factorial(x - 2)*2)
for i in range(N):
print(total - dicA[A[i]] +1)
| [
"control_flow.branch.if.add"
] | 511,490 | 511,491 | u760961723 | python |
p02732 | def possibleCombos(num):
num2 = num - 1
return (num2*num2 + num2)//2
N = int(input())
A = [int(i) for i in input().split()]
data = [0] * N
total = 0
for i in A:
data[i] +=1
for i in data:
total += possibleCombos(i)
for i in A:
result = total - possibleCombos(data[i]) + possibleCombos(data[i]-1)
... | def possibleCombos(num):
num2 = num - 1
return (num2*num2 + num2)//2
N = int(input())
A = [int(i) for i in input().split()]
data = [0] * (N+1)
total = 0
for i in A:
data[i] +=1
for i in data:
total += possibleCombos(i)
for i in A:
result = total - possibleCombos(data[i]) + possibleCombos(data[i]-1... | [] | 511,496 | 511,497 | u680144812 | python |
p02732 | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
allCount = 0
c = Counter(A)
for i, v in c.items():
if (v == 1):
continue
else:
allCount += v * (v - 1) // 2
if (allCount == 0):
for i in range(N):
print(0)
exit()
for i in range(N):
a = ... | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
allCount = 0
c = Counter(A)
for i, v in c.items():
if (v == 1):
continue
else:
allCount += v * (v - 1) // 2
if (allCount == 0):
for i in range(N):
print(0)
exit()
for i in range(N):
a = ... | [] | 511,521 | 511,522 | u787059958 | python |
p02732 | n = int(input())
a = [int(i) for i in input().split()]
c = [0 for i in range(n+1)]
b = sorted(a)
cnt = 1
for i in range(n-1):
if b[i]==b[i+1]:
cnt += 1
else:
c[b[i]] = cnt
cnt = 1
if i==n-2:
c[b[n-1]] = cnt
ans = 0
for i in range(n):
ans += int(c[i]*(c[i]-1)/2)
for i in range(n):
print(ans-(c[... | n = int(input())
a = [int(i) for i in input().split()]
c = [0 for i in range(n+1)]
b = sorted(a)
cnt = 1
for i in range(n-1):
if b[i]==b[i+1]:
cnt += 1
else:
c[b[i]] = cnt
cnt = 1
if i==n-2:
c[b[n-1]] = cnt
ans = 0
for i in range(n+1):
ans += int(c[i]*(c[i]-1)/2)
for i in range(n):
print(ans-(... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 511,532 | 511,533 | u831311378 | python |
p02732 | n = int(input())
a = [int(i) for i in input().split()]
c = [0 for i in range(n)]
b = sorted(a)
cnt = 1
for i in range(n-1):
if b[i]==b[i+1]:
cnt += 1
else:
c[b[i]] = cnt
cnt = 1
if i==n-2:
c[b[n-1]] = cnt
ans = 0
for i in range(n):
ans += int(c[i]*(c[i]-1)/2)
for i in range(n):
print(ans-(c[a[... | n = int(input())
a = [int(i) for i in input().split()]
c = [0 for i in range(n+1)]
b = sorted(a)
cnt = 1
for i in range(n-1):
if b[i]==b[i+1]:
cnt += 1
else:
c[b[i]] = cnt
cnt = 1
if i==n-2:
c[b[n-1]] = cnt
ans = 0
for i in range(n+1):
ans += int(c[i]*(c[i]-1)/2)
for i in range(n):
print(ans-(... | [
"control_flow.loop.range.bounds.upper.change",
"assignment.change",
"expression.operation.binary.add"
] | 511,534 | 511,533 | u831311378 | python |
p02732 | N=int(input())
A=list(map(int,input().split()))
total=0
A_li=[0]*(1+2*10**5)
for i in range(N):
A_li[A[i]]+=1
for i in range(1+2*10**5):
total+=A_li[i]*(A_li[i]-1)//2
for i in range(1,N+1):
if A_li[A[i-1]]>1:
print(total-(A_li[A[i-1]]-1))
else:
print(0) | N=int(input())
A=list(map(int,input().split()))
total=0
A_li=[0]*(1+2*10**5)
for i in range(N):
A_li[A[i]]+=1
for i in range(1+2*10**5):
total+=A_li[i]*(A_li[i]-1)//2
for i in range(1,N+1):
if A_li[A[i-1]]>1:
print(total-(A_li[A[i-1]]-1))
else:
print(total) | [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"io.output.change"
] | 511,543 | 511,544 | u934740772 | python |
p02732 | N = int(input())
K = list(map(int,input().split()))
A = [0]*N
print(A)
for i in range(N):
A[K[i]-1] += 1
r = 0
for k in range(N):
r += 0.5*(A[k]*(A[k]-1))
An =[]
for j in range(N):
D = A[K[j]-1]-1
An.append(int(r-(0.5*(D+1)*(D))+(0.5*D*(D-1))))
for i in range(len(An)):
print(An[i]) | N = int(input())
K = list(map(int,input().split()))
A = [0]*N
for i in range(N):
A[K[i]-1] += 1
r = 0
for k in range(N):
r += 0.5*(A[k]*(A[k]-1))
An =[]
for j in range(N):
D = A[K[j]-1]-1
An.append(int(r-(0.5*(D+1)*(D))+(0.5*D*(D-1))))
for i in range(len(An)):
print(An[i]) | [
"call.remove"
] | 511,547 | 511,548 | u973972117 | python |
p02732 | N = int(input())
K = list(map(int,input().split()))
A = [0]*N
for i in range(N):
A[K[i]] += 1
r = 0
for k in range(N):
r += 0.5*(A[k]*(A[k]-1))
An =[]
for j in range(N):
D = A[K[j]]-1
An.append(int(r-(0.5*(D+1)*(D))+(0.5*D*(D-1))))
for i in range(len(An)):
print(An[i]) | N = int(input())
K = list(map(int,input().split()))
A = [0]*N
for i in range(N):
A[K[i]-1] += 1
r = 0
for k in range(N):
r += 0.5*(A[k]*(A[k]-1))
An =[]
for j in range(N):
D = A[K[j]-1]-1
An.append(int(r-(0.5*(D+1)*(D))+(0.5*D*(D-1))))
for i in range(len(An)):
print(An[i]) | [
"expression.operation.binary.add",
"assignment.change"
] | 511,549 | 511,548 | u973972117 | python |
p02732 | n = int(input())
a = list(map(int, input().split()))
l = [0] * n
for i in a:
l[i-1] += 1
al = 0
for i in l:
al += i*(i-1)//2
for k in range(n):
print(al - (l[a[k]] - 1)) | n = int(input())
a = list(map(int, input().split()))
l = [0] * n
for i in a:
l[i-1] += 1
al = 0
for i in l:
al += i*(i-1)//2
for k in range(n):
print(al - (l[a[k]-1] - 1)) | [
"expression.operation.binary.add"
] | 511,552 | 511,553 | u297667660 | python |
p02732 | N = int(input())
A = [int(a) for a in input().split()]
cnt = {}
total = 0
for a in A:
if a not in cnt:
cnt[a] = 0
cnt[a] += 1
for i in cnt.values():
total += i * (i - 1) // 2
for i in range(N):
print(total - (cnt[i] - 1))
| N = int(input())
A = [int(a) for a in input().split()]
cnt = {}
total = 0
for a in A:
if a not in cnt:
cnt[a] = 0
cnt[a] += 1
for i in cnt.values():
total += i * (i - 1) // 2
for a in A:
print(total - (cnt[a] - 1))
| [
"identifier.change",
"control_flow.loop.range.bounds.upper.change",
"call.arguments.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"io.output.change"
] | 511,559 | 511,560 | u537892680 | python |
p02732 | import itertools
N=int(input())
A=list(map(int,input().split(' ')))
gr=itertools.groupby(sorted(A))
s=0
dic={}
for x,group in gr:
l=len(list(group))
if l >= 2:
s+=l*(l-1)/2
dic[x]=l
for k in range(N):
l=dic[A[k]]
if l >= 2:
print(int(s-l*(l-1)/2+(l-1)*(l-2)/2))
else:
print(0)
| import itertools
N=int(input())
A=list(map(int,input().split(' ')))
gr=itertools.groupby(sorted(A))
s=0
dic={}
for x,group in gr:
l=len(list(group))
if l >= 2:
s+=l*(l-1)/2
dic[x]=l
for k in range(N):
l=dic[A[k]]
if l >= 2:
print(int(s-l*(l-1)/2+(l-1)*(l-2)/2))
else:
print(int(s))
| [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"io.output.change",
"call.arguments.add"
] | 511,583 | 511,582 | u737718679 | python |
p02732 | # inputを高速化する。
import sys
input = sys.stdin.readline
n = int(input())
balls = list(map(int, input().split()))
cnt = {}
for ball in balls:
if ball not in cnt:
cnt[ball] = 0
cnt[ball] += 1
def combination(nxt, num = 0):
return (cnt[nxt]-num) * (cnt[nxt]-1- num) // 2
total = 0
for nxt in cnt:
... | # inputを高速化する。
import sys
input = sys.stdin.readline
n = int(input())
balls = list(map(int, input().split()))
cnt = {}
for ball in balls:
if ball not in cnt:
cnt[ball] = 0
cnt[ball] += 1
def combination(nxt, num = 0):
return (cnt[nxt]-num) * (cnt[nxt]-1- num) // 2
total = 0
for nxt in cnt:
... | [
"call.remove"
] | 511,599 | 511,600 | u324197506 | python |
p02732 | import copy
N = int(input())
A = list(map(int, input().split()))
count_dict = [0] * N
for each in A:
count_dict[each] += 1
all_types = 0
for value in count_dict:
all_types += value * (value - 1) // 2
# result_dict = {}
# for each in a_types:
# result_dict[each] = all_types - count_dict[each] + 1
for a i... | import copy
N = int(input())
A = list(map(int, input().split()))
count_dict = [0] * N
for each in A:
count_dict[each - 1] += 1
all_types = 0
for value in count_dict:
all_types += value * (value - 1) // 2
# result_dict = {}
# for each in a_types:
# result_dict[each] = all_types - count_dict[each] + 1
for... | [
"expression.operation.binary.add"
] | 511,601 | 511,602 | u531603069 | python |
p02732 |
n = int(input())
a = list(map(int, input().split()))
c = [0]*n
for i in range(n):
c[a[i]] = c[a[i]] + 1
total = 0
for x in c:
total = total + x*(x-1)//2
for i in range(n):
print(total - c[a[i]] + 1) | n = int(input())
a = list(map(int, input().split()))
c = [0]*n
for i in range(n):
c[a[i]-1] = c[a[i]-1] + 1
total = 0
for x in c:
total = total + x*(x-1)//2
for i in range(n):
print(total - c[a[i]-1] + 1)
| [
"assignment.change",
"expression.operation.binary.add"
] | 511,606 | 511,607 | u952773501 | python |
p02732 | input = sys.stdin.readline
from collections import Counter
#
n = int(input().strip())
a = list(map(int, input().strip().split()))
#
C=Counter()
for i in range(n):
C[a[i]] += 1
xsum=0
for key, value in C.items():
xsum += value*(value-1)//2
#
for k in range(n):
print( xsum - (C[a[k]] - 1) ) | import sys
input = sys.stdin.readline
from collections import Counter
#
n = int(input().strip())
a = list(map(int, input().strip().split()))
#
C=Counter()
for i in range(n):
C[a[i]] += 1
xsum=0
for key, value in C.items():
xsum += value*(value-1)//2
#
for k in range(n):
print( xsum - (C[a[k]] - 1) ) | [] | 511,610 | 511,611 | u185249212 | python |
p02732 | # https://atcoder.jp/contests/abc159/tasks/abc159_d
N = int(input())
A_list = list(map(int, input().split()))
box = [0] * (N + 1)
box_2 = [0] * (N + 1)
box_3 = [0] * (N + 1)
for i in range(N):
box[A_list[i] + 1] += 1
for i in range(N):
if box[i] > 1:
box_2[i] = (box[i] * (box[i] - 1)) / 2
bo... | # https://atcoder.jp/contests/abc159/tasks/abc159_d
N = int(input())
A_list = list(map(int, input().split()))
box = [0] * (N + 1)
box_2 = [0] * (N + 1)
box_3 = [0] * (N + 1)
for i in range(N):
box[A_list[i]] += 1
for i in range(N + 1):
if box[i] > 1:
box_2[i] = (box[i] * (box[i] - 1)) / 2
bo... | [
"expression.operation.binary.remove"
] | 511,641 | 511,642 | u886655280 | python |
p02732 | # https://atcoder.jp/contests/abc159/tasks/abc159_d
N = int(input())
A_list = list(map(int, input().split()))
box = [0] * (N + 1)
box_2 = [0] * (N + 1)
box_3 = [0] * (N + 1)
for i in range(N):
box[A_list[i]] += 1
for i in range(N):
if box[i] > 1:
box_2[i] = (box[i] * (box[i] - 1)) / 2
box_3[... | # https://atcoder.jp/contests/abc159/tasks/abc159_d
N = int(input())
A_list = list(map(int, input().split()))
box = [0] * (N + 1)
box_2 = [0] * (N + 1)
box_3 = [0] * (N + 1)
for i in range(N):
box[A_list[i]] += 1
for i in range(N + 1):
if box[i] > 1:
box_2[i] = (box[i] * (box[i] - 1)) / 2
bo... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 511,643 | 511,642 | u886655280 | python |
p02732 | M=int(input())
N=list(input().split())
print(N)
check=[0]*M
for i in range(M):
check[int(N[i])-1]+=1
num=0
for i in range(M):
num+=check[i]*(check[i]-1)//2
for i in range(M):
print(num-(check[int(N[i])-1]-1)) | M=int(input())
N=list(input().split())
check=[0]*M
for i in range(M):
check[int(N[i])-1]+=1
num=0
for i in range(M):
num+=check[i]*(check[i]-1)//2
for i in range(M):
#if check[int(N[i])-1]!=2:
print(num-(check[int(N[i])-1]-1))
#else:
# print(num-1) | [
"call.remove"
] | 511,667 | 511,668 | u996731299 | python |
p02732 | n = int(input())
a = list(map(int, input().split()))
data = [0]*n
for aa in a:
data[aa] += 1
allans = 0
for d in data:
if d >= 2:
allans += (d*(d-1))//2
for aa in a:
if data[aa] == 2:
print(allans - (data[aa]*(data[aa]-1))//2)
elif data[aa] > 2:
print(allans - (data[aa]-1))
else:
print... | n = int(input())
a = list(map(int, input().split()))
data = [0]*(n+1)
for aa in a:
data[aa] += 1
allans = 0
for d in data:
if d >= 2:
allans += (d*(d-1))//2
for aa in a:
if data[aa] == 2:
print(allans - (data[aa]*(data[aa]-1))//2)
elif data[aa] > 2:
print(allans - (data[aa]-1))
else:
p... | [] | 511,673 | 511,674 | u243714267 | python |
p02732 | N = int(input())
Alist=list(map(int, input().split()))
numdic = {}
for i in Alist:
if i in numdic:
numdic[i] += 1
else:
numdic[i] = 1
Apple = 0
for i in numdic.values():
Apple += i*(i-1)//2
for i in Alist:
tmp = Apple
tmp -= numdic[i]+1
print(tmp) | N = int(input())
Alist=list(map(int, input().split()))
numdic = {}
for i in Alist:
if i in numdic:
numdic[i] += 1
else:
numdic[i] = 1
Apple = 0
for i in numdic.values():
Apple += i*(i-1)//2
for i in Alist:
tmp = Apple
tmp -= (numdic[i]-1)
print(tmp) | [
"misc.opposites",
"expression.operator.arithmetic.change",
"expression.operation.binary.change"
] | 511,675 | 511,676 | u595905528 | python |
p02732 | n=int(input())
a=list(map(int,input().split()))
l=[0]*(n)
l1=[0]*(n)
for i in range(n):
l[a[i]-1]+=1
for i in range(n):
if l[i]>=2:
l1[i]+=(l[i]*(l[i]-1))//2
l1sum=sum(l1)
for i in range(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)
else:print(l1sum-l1[a[i]-1... | n=int(input())
a=list(map(int,input().split()))
l=[0]*(n)
l1=[0]*(n)
for i in range(n):
l[a[i]-1]+=1
for i in range(n):
if l[i]>=2:
l1[i]+=l[i]*(l[i]-1)//2
l1sum=sum(l1)
for i in range(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)
else:print(l1sum-l1[a[i]-1]... | [
"call.arguments.change"
] | 511,677 | 511,678 | u440129511 | python |
p02732 | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
cnt = Counter(a)
ans = {}
for k in cnt.keys():
ans[k] = (cnt[k] * cnt[k]-1) // 2
s = sum(list(ans.values()))
for ai in a:
if cnt[ai] == 1:
print(s)
else:
print(s - ans[ai] + (ans[ai] / cnt[ai]) * (cnt[ai] - ... | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
cnt = Counter(a)
ans = {}
for k in cnt.keys():
ans[k] = (cnt[k] * (cnt[k]-1)) // 2
s = sum(list(ans.values()))
for ai in a:
if cnt[ai] == 1:
print(s)
else:
print(s - ans[ai] + int((ans[ai] / cnt[ai]) * (cnt[... | [
"call.add",
"call.arguments.change"
] | 511,679 | 511,680 | u454524105 | python |
p02732 | from collections import Counter
N = int(input())
A = tuple(map(int, input().split()))
A_count = Counter(A)
ans = 0
for i, j in A_count:
ans += j * (j - 1) // 2
for k in range(1, N+1):
n = A_count[A[k-1]]
ans_ = ans - (n - 1)
print(ans_)
| from collections import Counter
N = int(input())
A = tuple(map(int, input().split()))
A_count = Counter(A)
ans = 0
for i, j in A_count.items():
ans += j * (j - 1) // 2
for k in range(1, N+1):
n = A_count[A[k-1]]
ans_ = ans - (n - 1)
print(ans_)
| [
"call.add"
] | 511,685 | 511,686 | u038021590 | python |
p02732 | import bisect
n = int(input())
a = list(map(int, input().split()))
A = sorted(a)
s = [0]*(n+1)
b = [0]*(n+1)
c = []
for i in range(1, n+1):
x = a[i-1]
s[i] = bisect.bisect_right(A, x) - bisect.bisect_left(A, x)
if b[a[i-1]] == 0:
c.append(s[i]*(s[i]-1)//2)
b[a[i-1]] = 1
S = sum(c)
print(c)
... | import bisect
n = int(input())
a = list(map(int, input().split()))
A = sorted(a)
s = [0]*(n+1)
b = [0]*(n+1)
c = []
for i in range(1, n+1):
x = a[i-1]
s[i] = bisect.bisect_right(A, x) - bisect.bisect_left(A, x)
if b[a[i-1]] == 0:
c.append(s[i]*(s[i]-1)//2)
b[a[i-1]] = 1
S = sum(c)
# print(c... | [
"call.remove"
] | 511,687 | 511,688 | u173072656 | python |
p02732 | N=int(input())
m=list(map(ine,input().split()))
t=[]
for i in range(N):
t.append(0)
for i in range(N):
t[m[i]-1]+=1
total=0
for i in range(N):
total+=(t[i]*(t[i]-1))//2
for i in range(N):
if t[m[i]-1]<2:
print(total)
else:
print(total-(t[m[i]-1]-1)) | N=int(input())
m=list(map(int,input().split()))
t=[]
for i in range(N):
t.append(0)
for i in range(N):
t[m[i]-1]+=1
total=0
for i in range(N):
total+=(t[i]*(t[i]-1))//2
for i in range(N):
if t[m[i]-1]<2:
print(total)
else:
print(total-(t[m[i]-1]-1)) | [
"assignment.value.change",
"identifier.change",
"call.arguments.change"
] | 511,749 | 511,750 | u046158516 | python |
p02732 | N=int(input())
A=list(map(int,input().split()))
ls=[0 for _ in range(N)]
for i in range(N):
ls[A[i]-1]+=1
s=0
print(ls)
for i in range(len(ls)):
m=ls[i]*(ls[i]-1)//2
s+=m
for j in range(N):
print(s-(ls[A[j]-1]-1)) | N=int(input())
A=list(map(int,input().split()))
ls=[0 for _ in range(N)]
for i in range(N):
ls[A[i]-1]+=1
s=0
for i in range(len(ls)):
m=ls[i]*(ls[i]-1)//2
s+=m
for j in range(N):
print(s-(ls[A[j]-1]-1)) | [
"call.remove"
] | 511,780 | 511,781 | u051684204 | python |
p02732 | n = int(input())
lis = list(map(int,input().split()))
num = [0 for i in range(n)]
for nn in lis:
num[nn-1] += 1
ans = 0
for nnn in num:
ans += (nnn*(nnn-1))//2
for i in range(n):
print(ans-(num[lis[i]]*(num[lis[i]]-1))//2+((num[lis[i]]-1)*(num[lis[i]]-2))//2) | n = int(input())
lis = list(map(int,input().split()))
num = [0 for i in range(n+1)]
for nn in lis:
num[nn] += 1
ans = 0
for nnn in num:
ans += (nnn*(nnn-1))//2
for i in range(n):
print(ans-(num[lis[i]]*(num[lis[i]]-1))//2+((num[lis[i]]-1)*(num[lis[i]]-2))//2)
| [
"expression.operation.binary.remove"
] | 511,951 | 511,952 | u667024514 | python |
p02732 | # coding: utf-8
n = int(input())
A = list(map(int, input().split()))
X = [0]*n
for a in A:
X[a] += 1
s = 0
for x in X:
s += x*(x-1)//2
for a in A:
print(s-X[a]+1) | # coding: utf-8
n = int(input())
A = list(map(int, input().split()))
X = [0]*(n+1)
for a in A:
X[a] += 1
s = 0
for x in X:
s += x*(x-1)//2
for a in A:
print(s-X[a]+1) | [] | 511,980 | 511,981 | u366836739 | python |
p02732 | n = int(input())
A = list(map(int,input().split()))
from collections import Counter
c = Counter(A)
# print(c)
cou = 0
for x in c:
if c[x]>1:
y = c[x]
cou+=y*(y-1)//2
else:
break
for i in A:
X = c[i]
ans = cou - X*(X-1)//2 + (X-1)*(X-2)//2
print(ans)
| n = int(input())
A = list(map(int,input().split()))
from collections import Counter
c = Counter(A)
# print(c)
cou = 0
for x in c:
# print(x,c[x])
if c[x]>1:
y = c[x]
cou+=y*(y-1)//2
for i in A:
X = c[i]
ans = cou - X*(X-1)//2 + (X-1)*(X-2)//2
print(ans)
| [
"control_flow.break.remove"
] | 512,109 | 512,110 | u785578220 | python |
p02732 | n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)
for i in a:
l[i]+=1
ans=0
for i in range(n):
ans+=l[i]*(l[i]-1)//2
for i in a:
print(ans-l[i]*(l[i]-1)//2+(l[i]-1)*(l[i]-2)//2) | n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)
for i in a:
l[i]+=1
ans=0
for i in range(n+1):
ans+=l[i]*(l[i]-1)//2
for i in a:
print(ans-l[i]*(l[i]-1)//2+(l[i]-1)*(l[i]-2)//2) | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 512,166 | 512,167 | u211706121 | python |
p02732 | from collections import Counter
n = int(input())
a = input().split()
freq = Counter(a)
print(freq)
total=0
for key,val in freq.items():
total+=(val*(val-1))//2
for k in range(n):
kth = (freq[a[k]]*(freq[a[k]]-1))//2
newkth = ((freq[a[k]]-2)*(freq[a[k]]-1))//2
total -= kth
total += newkth... | from collections import Counter
n = int(input())
a = input().split()
freq = Counter(a)
#print(freq)
total=0
for key,val in freq.items():
total+=(val*(val-1))//2
for k in range(n):
kth = (freq[a[k]]*(freq[a[k]]-1))//2
newkth = ((freq[a[k]]-2)*(freq[a[k]]-1))//2
total -= kth
total += newkt... | [
"call.remove"
] | 512,185 | 512,187 | u207326980 | python |
p02732 | from collections import Counter
def cmb(n):
if n < 2:
return 0
else:
return (n * (n-1)) // 2
n = int(input())
ls = list(map(int,input().split()))
cs = Counter(a)
s = 0
for v in cs.values():
s += cmb(v)
for a in ls:
print(s - cmb(cs[a]) + cmb(cs[a] - 1)) | from collections import Counter
def cmb(n):
if n < 2:
return 0
else:
return (n * (n-1)) // 2
n = int(input())
ls = list(map(int,input().split()))
cs = Counter(ls)
s = 0
for v in cs.values():
s += cmb(v)
for a in ls:
print(s - cmb(cs[a]) + cmb(cs[a] - 1)) | [
"assignment.value.change",
"identifier.change",
"call.arguments.change"
] | 512,233 | 512,234 | u865119809 | python |
p02732 | from collections import Counter
def cmb(n):
if n < 2:
return 0
else:
return (n * (n-1)) // 2
n = int(input())
ls = list(map(int,input().split()))
cs = Counter(a)
s = 0
for v in cs.values():
s += cmb(v)
for a in ls:
print(s - cmb(c[a]) + cmb(c[a] - 1)) | from collections import Counter
def cmb(n):
if n < 2:
return 0
else:
return (n * (n-1)) // 2
n = int(input())
ls = list(map(int,input().split()))
cs = Counter(ls)
s = 0
for v in cs.values():
s += cmb(v)
for a in ls:
print(s - cmb(cs[a]) + cmb(cs[a] - 1)) | [
"assignment.value.change",
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 512,235 | 512,234 | u865119809 | python |
p02732 | n = int(input())
data = list(map(int, input().split(" ")))
count = [0]*(n+1)
for i in range(n):
count[data[i]] = count[data[i]]+1
val = [0]*(n+1)
sumval = 0
for i in range(n):
if(count[i] >= 2):
val[i] = count[i]-1
sumval = sumval + int(count[i]*(count[i]-1)/2)
for i in range(n):
print(sum... | n = int(input())
data = list(map(int, input().split(" ")))
count = [0]*(n+1)
for i in range(n):
count[data[i]] = count[data[i]]+1
val = [0]*(n+1)
sumval = 0
for i in range(n+1):
if(count[i] >= 2):
val[i] = count[i]-1
sumval = sumval + int(count[i]*(count[i]-1)/2)
for i in range(n):
print(s... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 512,237 | 512,238 | u755989869 | python |
p02732 | import collections
from collections import Counter
*l, = map(int, input().split())
c = Counter(l)
A = [int(i*(i-1)/2) for i in c.values()]
A_sum = sum(A)
for j in l:
print(A_sum - c[j] + 1) | import collections
from collections import Counter
n = input()
*l, = map(int, input().split())
c = Counter(l)
A = [int(i*(i-1)/2) for i in c.values()]
A_sum = sum(A)
for j in l:
print(A_sum - c[j] + 1) | [
"assignment.add"
] | 512,273 | 512,275 | u713914478 | python |
p02732 | import collections
n = int(input())
a = list(map(int, input().split()))
num_count = collections.Counter(a)
total = sum([num*(num-1)//2 for num in num_count.values()])
for i in range(n):
print(total-a.count(a[i]+1)) | import collections
n = int(input())
a = list(map(int, input().split()))
num_count = collections.Counter(a)
total = sum([num*(num-1)//2 for num in num_count.values()])
for i in range(n):
print(total-num_count[a[i]]+1) | [
"call.remove",
"call.arguments.change"
] | 512,301 | 512,302 | u485566817 | python |
p02732 | import collections
N = int(input())
A = list(map(int,input().split()))
CA = collections.Counter(A)
S = 0
for i in CA.values():
S += i*(i-1)//2
for x in A:
print(S - count[x] + 1) | import collections
N = int(input())
A = list(map(int,input().split()))
CA = collections.Counter(A)
S = 0
for i in CA.values():
S += i*(i-1)//2
for x in A:
print(S - CA[x] + 1) | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 511,798 | 511,799 | u830588156 | python |
p02732 | import collections
N = int(input())
A = list(map(int,input().split()))
CA = collections.Counter(A)
S = 0
for i in CA.values():
S += i*(i-1)//2
for x in range(A):
print(S - count[x] + 1) | import collections
N = int(input())
A = list(map(int,input().split()))
CA = collections.Counter(A)
S = 0
for i in CA.values():
S += i*(i-1)//2
for x in A:
print(S - CA[x] + 1) | [
"call.remove",
"call.arguments.change",
"identifier.change",
"expression.operation.binary.change",
"io.output.change"
] | 511,800 | 511,799 | u830588156 | python |
p02732 | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
s = 0
for i in set(a):
s += c[i] * (c[i] - 1)
dp = [-1] * n
for i in a:
if dp[i] == -1:
dp[i] = (s - c[i] * (c[i] - 1) + (c[i] - 1) * (c[i] - 2)) // 2
print(dp[i])
else:
print(dp[i]) | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
s = 0
for i in set(a):
s += c[i] * (c[i] - 1)
dp = [-1] * (n + 1)
for i in a:
if dp[i] == -1:
dp[i] = (s - c[i] * (c[i] - 1) + (c[i] - 1) * (c[i] - 2)) // 2
print(dp[i])
else:
print(dp... | [] | 511,809 | 511,810 | u277312083 | python |
p02732 | N = int(input())
A = list(map(int, input().split()))
l = [0] * 10000001
for i in A:
l[i] += 1
s = 0
for i in range(N):
i = l[i]
s += i * (i - 1) // 2
for a in A:
a = l[a]
print(s - (a * (a - 1) // 2) + ((a - 1) * (a - 2) // 2))
| N = int(input())
A = list(map(int, input().split()))
l = [0] * 10000001
for i in A:
l[i] += 1
s = 0
for i in range(N + 1):
i = l[i]
s += i * (i - 1) // 2
for a in A:
a = l[a]
print(s - (a * (a - 1) // 2) + ((a - 1) * (a - 2) // 2))
| [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 511,869 | 511,870 | u339503988 | python |
p02732 | import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)
sum = 0
kn = [0 for i in range(n)]
for i in range(n):
kn[a[i]] += 1
for i in range(n):
sum += kn[i]*(kn[i]-1)//2
for i in range(n):
x = kn[a[i]]
print(sum-x+1)
| import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)
sum = 0
kn = [0 for i in range(n+1)]
for i in range(n):
kn[a[i]] += 1
for i in range(n+1):
sum += kn[i]*(kn[i]-1)//2
for i in range(n):
x = kn[a[i]]
print(sum-x+1)
| [
"control_flow.loop.range.bounds.upper.change",
"assignment.change",
"expression.operation.binary.add"
] | 511,880 | 511,881 | u169350228 | python |
p02732 | def com(n):
return n*(n-1)//2
ans=0
n=int(input())
a=list(map(int,input().split()))
coun=[0]*n
for i in range(n):
coun[a[i]]+=1
for i in range(n+1):
ans+=com(coun[i])
for i in range(n):
m=com(coun[a[i]]-1)
o=com(coun[a[i]])
print(ans-o+m) | def com(n):
return n*(n-1)//2
ans=0
n=int(input())
a=list(map(int,input().split()))
coun=[0]*(n+1)
for i in range(n):
coun[a[i]]+=1
for i in range(n+1):
ans+=com(coun[i])
for i in range(n):
m=com(coun[a[i]]-1)
o=com(coun[a[i]])
print(ans-o+m) | [] | 511,912 | 511,911 | u798675549 | python |
p02732 | def com(n):
return n*(n-1)//2
ans=0
n=int(input())
a=list(map(int,input().split()))
coun=[0]*n
for i in range(n):
coun[a[i]]+=1
for i in range(n):
ans+=com(coun[i])
for i in range(n):
m=com(coun[a[i]]-1)
o=com(coun[a[i]])
print(ans-o+m) | def com(n):
return n*(n-1)//2
ans=0
n=int(input())
a=list(map(int,input().split()))
coun=[0]*(n+1)
for i in range(n):
coun[a[i]]+=1
for i in range(n+1):
ans+=com(coun[i])
for i in range(n):
m=com(coun[a[i]]-1)
o=com(coun[a[i]])
print(ans-o+m) | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 511,913 | 511,911 | u798675549 | python |
p02732 | import collections
N=int(input())
lst=input().split()
s=0
dic=collections.Counter(lst)
for i in dic.values():
s+=(i*i-i)//2
for i in lst:
print(s+1-dict[i]) | import collections
N=int(input())
lst=input().split()
s=0
dic=collections.Counter(lst)
for i in dic.values():
s+=(i*i-i)//2
for i in lst:
print(s+1-dic[i]) | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 511,914 | 511,915 | u798675549 | python |
p02732 | n=int(input())
l=list(map(int,input().split()))
d={}
sum=0
for i in range(n):
if l[i] not in d:
d[l[i]]=1
else:
d[l[i]]+=1
l1=[]
for i in d:
if d[i]>1:
l.append((d[i]*(d[i]-1))//2)
sum+=((d[i]*(d[i]-1))//2)
#print(d,sum)
for i in range(n):
if d[l[i]]==2:
print(sum-1)
elif d[l[i]]>2:
... | n=int(input())
l=list(map(int,input().split()))
d={}
sum=0
for i in range(n):
if l[i] not in d:
d[l[i]]=1
else:
d[l[i]]+=1
l1=[]
for i in d:
if d[i]>1:
l.append((d[i]*(d[i]-1))//2)
sum+=((d[i]*(d[i]-1))//2)
#print(d,sum)
for i in range(n):
if d[l[i]]==2:
print(sum-1)
elif d[l[i]]>2:
... | [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"io.output.change"
] | 512,038 | 512,041 | u275392848 | python |
p02732 | import collections
N = int(input())
A = list(map(int, input().split()))
B = collections.Counter(A)
L = {key:(B[key] * (B[key] - 1) // 2) for key in B}
total = sum(L.values())
#print(f"A = {A}\nB = {B}\nL = {L}\ntotal = {total}")
[print(0 if L[i] == 0 else total - L[i] + ((B[i] - 1) * (B[i] - 2)) // 2) for i in A] | import collections
N = int(input())
A = list(map(int, input().split()))
B = collections.Counter(A)
L = {key:(B[key] * (B[key] - 1) // 2) for key in B}
total = sum(L.values())
#print(f"A = {A}\nB = {B}\nL = {L}\ntotal = {total}")
[print(total if L[i] == 0 else total - L[i] + ((B[i] - 1) * (B[i] - 2) // 2)) for i in A] | [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"io.output.change"
] | 512,146 | 512,149 | u865383026 | python |
p02732 | n = int(input())
ball = list(map(int,input().split()))
num = [0] * (n + 1)
data = [0] * (n + 1)
for i in ball:
num[i] += 1
for i in range(n):
data[i] = num[i] * (num[i] - 1) // 2
x = sum(data)
for i in ball:
print(x - num[i] + 1)
| n = int(input())
ball = list(map(int,input().split()))
num = [0] * (n + 1)
data = [0] * (n + 1)
for i in ball:
num[i] += 1
for i in range(n+1):
data[i] = num[i] * (num[i] - 1) // 2
x = sum(data)
for i in ball:
print(x - num[i] + 1)
| [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 512,178 | 512,180 | u257974487 | python |
p02732 | import collections as cl
N = int(input())
A = list(map(int,inpput().split()))
cn = cl.Counter(A)
sumC = sum([n*(n-1)//2 for n in cl.values()])
for k in range(N):
print(sumC - cn[A[k]] +1) | import collections as cl
N = int(input())
A = list(map(int,input().split()))
cn = cl.Counter(A)
sumC = sum([n*(n-1)//2 for n in cn.values()])
for k in range(N):
print(sumC - cn[A[k]] +1) | [
"assignment.value.change",
"identifier.change",
"call.function.change",
"call.arguments.change"
] | 512,360 | 512,361 | u699944218 | python |
p02732 | import collections as cl
N = int(input())
A = list(map(int,inpput().split()))
cn = cl.Counter(A)
sumC = sum([n*(n-1)//2 for n in cl.values()])
for k in range(N):
print(sumC - cn[k] +1) | import collections as cl
N = int(input())
A = list(map(int,input().split()))
cn = cl.Counter(A)
sumC = sum([n*(n-1)//2 for n in cn.values()])
for k in range(N):
print(sumC - cn[A[k]] +1) | [
"assignment.value.change",
"identifier.change",
"call.function.change",
"call.arguments.change"
] | 512,362 | 512,361 | u699944218 | python |
p02732 | N = int(input())
A = list(map(int, input().split()))
cnt = [0] * (N+1)
ans = 0
for i in range(N):
cnt[A[i]] += 1
for i in range(N):
ans += cnt[i] * (cnt[i] - 1) // 2
for i in range(N):
print(ans - cnt[A[i]] + 1) | N = int(input())
A = list(map(int, input().split()))
cnt = [0] * (N+1)
ans = 0
for i in range(N):
cnt[A[i]] +=1
for i in range(N+1):
ans += cnt[i] * (cnt[i] - 1) // 2
for i in range(N):
print(ans - cnt[A[i]] + 1) | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 512,376 | 512,377 | u114920558 | python |
p02732 | from collections import Counter
def solve(string):
n, *a = map(int, string.split())
c = Counter(a)
b = sum(v * (v - 1) // 2 for v in c.values())
print(c, b)
return "\n".join(str(b - c[_a] + 1) for _a in a)
if __name__ == '__main__':
import sys
print(solve(sys.stdin.read().strip()))
| from collections import Counter
def solve(string):
n, *a = map(int, string.split())
c = Counter(a)
b = sum(v * (v - 1) // 2 for v in c.values())
return "\n".join(str(b - c[_a] + 1) for _a in a)
if __name__ == '__main__':
import sys
print(solve(sys.stdin.read().strip()))
| [
"call.remove"
] | 512,384 | 512,385 | u046187684 | python |
p02732 | N = int(input())
As = list(map(int, input().split()))
# 1が3個、2が5個、、、みたいなものを管理する配列
counter = [0 for i in range(N+1)]
for i in range(N):
counter[As[i]] += 1
# kC2を求める。(2C2 ~ NC2まで)
k_C_2 = [0 for i in range(N+1)]
k_C_2[2] = 1
for i in range(3, N+1):
k_C_2[i] = k_C_2[i-1] * i / (i-2)
# 全体を求める
all_case = 0
for ... | N = int(input())
As = list(map(int, input().split()))
# 1が3個、2が5個、、、みたいなものを管理する配列
counter = [0 for i in range(N+1)]
for i in range(N):
counter[As[i]] += 1
# kC2を求める。(2C2 ~ NC2まで)
k_C_2 = [0 for i in range(N+1)]
k_C_2[2] = 1
for i in range(3, N+1):
k_C_2[i] = k_C_2[i-1] * i / (i-2)
# 全体を求める
all_case = 0
for ... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 512,401 | 512,402 | u666476759 | python |
p02732 | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
values, counts = zip(*c.most_common())
values, counts = list(values), list(counts)
k = 0
for i in range(len(counts)):
k += counts[i]*(counts[i]-1)//2
output = [0]*len(a)
for i in range(len(a)):
temp = c[a[i]]
if te... | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
values, counts = zip(*c.most_common())
values, counts = list(values), list(counts)
k = 0
for i in range(len(counts)):
k += counts[i]*(counts[i]-1)//2
output = [0]*len(a)
for i in range(len(a)):
temp = c[a[i]]
if te... | [] | 512,463 | 512,464 | u279292103 | python |
p02732 | N = int(input())
A = list(map(int, input().split()))
cnt = [0 for _ in range(N)]
for i in range(N):
cnt[A[i]-1] += 1
S = 0
for i in range(N):
S += cnt[i]*(cnt[i]-1)/2
for i in range(N):
if cnt[A[i]] == 1:
print(S)
else:
print(int(S+(3-2*cnt[A[i]-1])/2))
| N = int(input())
A = list(map(int, input().split()))
cnt = [0 for _ in range(N)]
for i in range(N):
cnt[A[i]-1] += 1
S = 0
for i in range(N):
S += cnt[i]*(cnt[i]-1)/2
for i in range(N):
if cnt[A[i]-1] == 1:
print(int(S))
else:
print(int(S+(3-2*cnt[A[i]-1])/2))
| [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change",
"misc.off_by_one",
"call.add",
"call.arguments.change"
] | 512,531 | 512,532 | u657901243 | python |
p02732 | import math
import sys
from collections import Counter
N=int(input())
a=sys.stdin.readline().split()
A=[int(b) for b in a]
numbers=[0]*N
count=Counter(A)
kotae=0
for a in range(N):
b=count[a]
kotae+=b*(b-1)//2
for a in A:
print(kotae+1-count[a])
| import math
import sys
from collections import Counter
N=int(input())
a=sys.stdin.readline().split()
A=[int(b) for b in a]
numbers=[0]*N
count=Counter(A)
kotae=0
for a in range(N+1):
b=count[a]
kotae+=b*(b-1)//2
for a in A:
print(kotae+1-count[a])
| [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 512,550 | 512,551 | u263824932 | python |
p02732 | from collections import Counter
n = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
ans = 0
for i in counter.values():
ans = i * (i - 1) // 2
for j in A:
cnt = counter[j]
if cnt <= 1:
print(ans)
else:
print(ans - cnt + 1) | from collections import Counter
n = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
ans = 0
for i in counter.values():
ans += i * (i - 1) // 2
for j in A:
cnt = counter[j]
if cnt <= 1:
print(ans)
else:
print(ans - cnt + 1) | [
"assignment.value.change"
] | 512,561 | 512,562 | u979362546 | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.