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 |
|---|---|---|---|---|---|---|---|
p02732 | #!/usr/bin/env python
def main():
n = int(input())
a = list(map(int, input().split()))
a_sort = sorted(a)
ball_dict = {}
count = 1
for i in range(1, n):
if a_sort[i] == a_sort[i - 1]:
count += 1
else:
ball_dict.setdefault(a_sort[i - 1], count)
... | #!/usr/bin/env python
def main():
n = int(input())
a = list(map(int, input().split()))
a_sort = sorted(a)
ball_dict = {}
count = 1
for i in range(1, n):
if a_sort[i] == a_sort[i - 1]:
count += 1
else:
ball_dict.setdefault(a_sort[i - 1], count)
... | [
"control_flow.loop.for.condition.change",
"call.remove"
] | 512,577 | 512,578 | u399155892 | python |
p02732 | import collections
N = int(input())
num_list = list(map(int,input().split()))
memo = [0]*(N+1)
memo_flg = [False]*(N+1)
counter = [0] * (N+1)
counter_ans = [0] * (N+1)
for i in num_list:
counter[i] += 1
for i in range(N):
counter_ans[i] = (counter[i]*(counter[i]-1))//2
all_sum = sum(counter_ans)
def calc(k):... | import collections
N = int(input())
num_list = list(map(int,input().split()))
memo = [0]*(N+1)
memo_flg = [False]*(N+1)
counter = [0] * (N+1)
counter_ans = [0] * (N+1)
for i in num_list:
counter[i] += 1
for i in range(N+1):
counter_ans[i] = (counter[i]*(counter[i]-1))//2
all_sum = sum(counter_ans)
def calc(k... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 512,581 | 512,582 | u092387689 | python |
p02732 | n=int(input())
a=list(map(int,input().split()))
from collections import Counter
c=Counter(a)
max_c=0 # max combination
for i in c.values():
max_c+=i*(i-1)//2 # 6+1+1 = 8
for num in a:
k=c[num] # 4 2 4 2 2 4 2 4
print(ans-(k*(k-1)//2)+((k-1)*(k-2)//2)) # different from max combination
... | n=int(input())
a=list(map(int,input().split()))
from collections import Counter
c=Counter(a)
max_c=0 # max combination
for i in c.values():
max_c+=i*(i-1)//2 # 6+1+1 = 8
for num in a:
k=c[num] # 4 2 4 2 2 4 2 4
print(max_c-(k*(k-1)//2)+((k-1)*(k-2)//2)) # different from max combination
... | [
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 512,603 | 512,604 | u952968889 | python |
p02732 | n=int(input())
a=list(map(int,input().split()))
ans=0
b=[0]*n
for i in range(n):
b[a[i]]+=1
for k in b:
ans+=k*(k-1)//2
for i in range(n):
print(ans-b[a[i]]+1) | n=int(input())
a=list(map(int,input().split()))
ans=0
b=[0]*(n+1)
for i in range(n):
b[a[i]]+=1
for k in b:
ans+=k*(k-1)//2
for i in range(n):
print(ans-b[a[i]]+1) | [] | 512,605 | 512,606 | u943057856 | python |
p02732 | from collections import Counter
n = int(input())
a_list = list(map(int, input().split()))
c = Counter(a_list)
all_count = 0
for value in c.values():
if value == 1:
continue
else:
tmp = int((value * (value - 1))/2)
all_count += tmp
for i in range(n):
print(all_count - c[i])
| from collections import Counter
n = int(input())
a_list = list(map(int, input().split()))
c = Counter(a_list)
all_count = 0
for value in c.values():
if value == 1:
continue
else:
tmp = int((value * (value - 1))/2)
all_count += tmp
for i in a_list:
print(all_count - c[i] + 1)
| [
"control_flow.loop.range.bounds.upper.change",
"call.arguments.change"
] | 512,613 | 512,614 | u043035376 | python |
p02732 | import collections
def check(A):
count = 0
for j in A:
n = A[j]
if n > 1:
count += n * (n - 1) / 2
return int(count)
N = int(input())
A = list(map(int, input().split(" ")))
A2 = collections.Counter(A)
print(A2)
Nsum = check(A2)
# print(Nsum)
for i in range(0,N):
... | import collections
def check(A):
count = 0
for j in A:
n = A[j]
if n > 1:
count += n * (n - 1) / 2
return int(count)
N = int(input())
A = list(map(int, input().split(" ")))
A2 = collections.Counter(A)
# print(A2)
Nsum = check(A2)
# print(Nsum)
for i in range(0,N):... | [
"call.remove"
] | 512,617 | 512,618 | u787131053 | python |
p02732 | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
re = [0] * (n-1)
c = Counter(a) # c: Counter({1: 3, 2: 2})など
for k, v in c.items():
re[k] = v*(v-1) // 2
total = sum(re)
for i in a:
print(total - re[i] + (c[i]-1)*(c[i]-2) // 2) | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
re = [0] * (n+1)
c = Counter(a) # c: Counter({1: 3, 2: 2})など
for k, v in c.items():
re[k] = v*(v-1) // 2
total = sum(re)
for i in a:
print(total - re[i] + (c[i]-1)*(c[i]-2) // 2) | [
"misc.opposites",
"expression.operator.arithmetic.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 512,643 | 512,644 | u896726004 | python |
p02732 | n = int(input())
l = list(map(int, input().split()))
ans = 0
k = [0 for _ in range(n+1)]
for i in range(n):
k[l[i]] += 1
ll = len(k)
for i in range(ll):
a = k[i]
if a <= 1:
pass
else:
ans += (a * (a - 1))/2
for i in range(n):
a = k[l[i]]
b = (a * (a - 1))/2
c... | n = int(input())
l = list(map(int, input().split()))
ans = 0
k = [0 for _ in range(n+1)]
for i in range(n):
k[l[i]] += 1
ll = len(k)
for i in range(ll):
a = k[i]
if a <= 1:
pass
else:
ans += (a * (a - 1))/2
for i in range(n):
a = k[l[i]]
b = (a * (a - 1))/2
c... | [
"control_flow.loop.for.condition.change"
] | 512,672 | 512,673 | u840974625 | python |
p02732 | import collections
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
c=defaultdict(int)
for s in a:
c[s]+=1
a1=list(set(a))
total=0
for j in range(len(a1)):
x=c[a[j]]
total+=x*(x-1)/2
for i in range(n):
ans=total-c[a[i]]+1
print(int(ans)) | import collections
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
c=defaultdict(int)
for s in a:
c[s]+=1
a1=list(set(a))
total=0
for j in range(len(a1)):
x=c[a1[j]]
total+=x*(x-1)/2
for i in range(n):
ans=total-c[a[i]]+1
print(int(ans)) | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 512,674 | 512,675 | u553070631 | python |
p02732 | m = int(input())
q_list = list(map(int, input().strip().split()))
n = [0] * m
k = [0] * m
for i in q_list:
n[i - 1] += 1
for j, l in zip(range(m), n):
k[j] = int(l * (l - 1)/2)
sum_n = sum(k)
for j in q_list:
print(sum_n - n[j - 1]-1)
| m = int(input())
q_list = list(map(int, input().strip().split()))
n = [0] * m
k = [0] * m
for i in q_list:
n[i - 1] += 1
for j, l in zip(range(m), n):
k[j] = int(l * (l - 1)/2)
sum_n = sum(k)
for j in q_list:
print(sum_n - n[j - 1] + 1)
| [
"misc.opposites",
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 512,686 | 512,687 | u078982327 | python |
p02732 | N=int(input())
a=list(map(int,input().split()))
b=[0]*N
sum=0
for i in range(N):
b[a[i]]+=1
for i in range(N):
sum+=b[i]*(b[i]-1)//2
for i in range(N):
print(sum-b[a[i]]+1) | N=int(input())
a=list(map(int,input().split()))
b=[0]*N
sum=0
for i in range(N):
b[a[i]-1]+=1
for i in range(N):
sum+=b[i]*(b[i]-1)//2
for i in range(N):
print(sum-b[a[i]-1]+1) | [
"expression.operation.binary.add"
] | 512,734 | 512,735 | u471539833 | python |
p02732 | N=int(input())
a=list(map(int,input().split()))
b=[0]*N
sum=0
for i in range(N):
b[a[i]]+=1
for i in range(N):
sum+=b[i]*(b[i]-1)//2
for i in range(N):
print(sum-b[a[i]]-1) | N=int(input())
a=list(map(int,input().split()))
b=[0]*N
sum=0
for i in range(N):
b[a[i]-1]+=1
for i in range(N):
sum+=b[i]*(b[i]-1)//2
for i in range(N):
print(sum-b[a[i]-1]+1) | [
"call.arguments.change"
] | 512,736 | 512,735 | u471539833 | python |
p02732 | N = int(input())
A = list(map(int, input().split()))
D = defaultdict(int)
for a in A:
D[a] += 1
ans_base = 0
for v in D.values():
ans_base += v * (v - 1) // 2
for a in A:
print(ans_base - (D[a] * (D[a] - 1) // 2) + ((D[a] - 1) * (D[a] - 2) // 2)) | from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
D = defaultdict(int)
for a in A:
D[a] += 1
ans_base = 0
for v in D.values():
ans_base += v * (v - 1) // 2
for a in A:
print(ans_base - (D[a] * (D[a] - 1) // 2) + ((D[a] - 1) * (D[a] - 2) // 2))
| [] | 512,744 | 512,745 | u075012704 | python |
p02732 | from collections import Counter
N = int(input())
a = list(map(int, input().split()))
cnts = Counter(a)
_sum = 0
for key,value in cnts.items():
_sum += value*(value-1)//2
for ai in a:
ans = _sum
c = cnts.count(ai)
ans -= c*(c-1)//2
ans += (c-1)*(c-2)//2
print(ans)
| from collections import Counter
N = int(input())
a = list(map(int, input().split()))
cnts = Counter(a)
_sum = 0
for key,value in cnts.items():
_sum += value*(value-1)//2
for ai in a:
ans = _sum
c = cnts[ai]
ans -= c*(c-1)//2
ans += (c-1)*(c-2)//2
print(ans)
| [
"assignment.value.change",
"call.remove",
"call.arguments.change"
] | 512,773 | 512,774 | u001024152 | python |
p02732 | import collections
# input
N = int(input())
A = map(int,input().split())
# calculatioin
cnt = collections.Counter(A)
full_cnt = int(sum(cnt[key]*(cnt[key]-1)/2 for key in cnt))
for i in range(N):
print(full_cnt - cnt[A[i]]+1) | import collections
# input
N = int(input())
A = input().split()
# calculatioin
cnt = collections.Counter(A)
full_cnt = int(sum(cnt[key]*(cnt[key]-1)/2 for key in cnt))
for i in range(N):
print(full_cnt - cnt[A[i]]+1) | [
"call.remove",
"call.arguments.change"
] | 512,851 | 512,852 | u814885356 | python |
p02732 | import collections
MOD = 10**15+7
n = int(input())
a = list(map(int, input().split()))
b = [[0 for j in range(2)] for i in range(n)]
c = collections.Counter(a)
s = 0
def nCr(nn, r, mod):
r = min(r, nn-r)
numer = denom = 1
for i in range(1, r+1):
numer = numer * (nn+1-i) % mod
denom = denom * i % mod
return nume... | import collections
MOD = 10**18+9
n = int(input())
a = list(map(int, input().split()))
b = [[0 for j in range(2)] for i in range(n)]
c = collections.Counter(a)
s = 0
def nCr(nn, r, mod):
r = min(r, nn-r)
numer = denom = 1
for i in range(1, r+1):
numer = numer * (nn+1-i) % mod
denom = denom * i % mod
return nume... | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 512,994 | 512,995 | u124498235 | python |
p02732 | n=int(input())
a=list(map(int,input().split()))
d={}
for x in a:
if d.get(x) is None:
d[x]=1
continue
d[x]+=1
total=0
for v in d.values():
total+=(y-1)*y//2
for x in a:
print(total-d[x]+1) | n=int(input())
a=list(map(int,input().split()))
d={}
for x in a:
if d.get(x) is None:
d[x]=1
continue
d[x]+=1
total=0
for v in d.values():
total+=(v-1)*v//2
for x in a:
print(total-d[x]+1) | [
"identifier.change",
"expression.operation.binary.change"
] | 513,080 | 513,081 | u698849142 | python |
p02732 | import collections
def C(n):
return n * (n-1) // 2
N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
d = {}
sm = 0
for k,v in c.most_common():
d[k] = v
sm += C(v)
for a in A:
print (sm - 1 + d[a]) | import collections
def C(n):
return n * (n-1) // 2
N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
d = {}
sm = 0
for k,v in c.most_common():
d[k] = v
sm += C(v)
for a in A:
print (sm - d[a] + 1) | [
"expression.operation.binary.remove"
] | 513,128 | 513,129 | u709304134 | python |
p02732 | import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
from collections import Counter
from bisect import bisect_left
def f(i, d, dsum, n):
return func(i, d) + dsum[i] + dsum[n] - dsum[i+1]
def func(i, w):
return w[i][1] * max(0, w[i][1]-1) // 2
def... | import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30
from collections import Counter
from bisect import bisect_left
def f(i, d, dsum, n):
return func(i, d) + dsum[i] + dsum[n] - dsum[i+1]
def func(i, w):
return w[i][1] * max(0, w[i][1]-1) // 2
def... | [] | 513,186 | 513,187 | u432551953 | python |
p02732 | def CountFrequency_mod(my_list):
# Creating an empty dictionary
freq = {}
for item in my_list:
if (item in freq):
freq[item] += 1
else:
freq[item] = 1
freq_mod = freq
freq_val = list(freq.values())
all_sum=0
for i in freq_val:
... | def CountFrequency_mod(my_list):
# Creating an empty dictionary
freq = {}
for item in my_list:
if (item in freq):
freq[item] += 1
else:
freq[item] = 1
freq_mod = freq
freq_val = list(freq.values())
all_sum=0
for i in freq_val:
... | [
"call.add",
"call.arguments.change"
] | 513,206 | 513,207 | u478266845 | python |
p02732 | import heapdict
n = int(input())
la = list(map(int, input().split()))
ct = [0] * (2*10**5+1)
ans = [0] * (n+1)
ld = [0] * (n+1)
for i in range(len(la)):
ct[la[i]] += 1
sa = set(la)
for j in sa:
ans[j] = ct[j] * (ct[j]-1) // 2
ld[j] = ans[j] - ((ct[j]-2) * (ct[j]-1) // 2)
total = sum(ans)
# print(ct[0... | n = int(input())
la = list(map(int, input().split()))
ct = [0] * (2*10**5+1)
ans = [0] * (n+1)
ld = [0] * (n+1)
for i in range(len(la)):
ct[la[i]] += 1
sa = set(la)
for j in sa:
ans[j] = ct[j] * (ct[j]-1) // 2
ld[j] = ans[j] - ((ct[j]-2) * (ct[j]-1) // 2)
total = sum(ans)
# print(ct[0:10])
# print(ans... | [] | 513,269 | 513,270 | u679439110 | python |
p02732 | N = int(input())
A = list(map(int, input().split()))
m = [0] * N
for i in range(N):
m[A[i]] += 1
ans = 0
for i in range(len(m)):
ans += (m[i] * (m[i] - 1) // 2)
for i in range(N):
print(ans - m[A[i]] + 1)
| N = int(input())
A = list(map(int, input().split()))
m = [0] * (N + 1)
for i in range(N):
m[A[i]] += 1
ans = 0
for i in range(len(m)):
ans += (m[i] * (m[i] - 1) // 2)
for i in range(N):
print(ans - m[A[i]] + 1)
| [] | 513,275 | 513,276 | u263226212 | python |
p02732 | n = int(input())
a = list(map(int, input().split()))
import collections
c = collections.Counter(a)
values, counts = zip(*c.most_common())
if counts[-1] == 1:
k = counts.index(1)
del counts[k:]
from operator import mul
from functools import reduce
def cmb(n,r):
r = min(n-r,r)
if r == 0: return 1
over =... | n = int(input())
a = list(map(int, input().split()))
import collections
c = collections.Counter(a)
values, counts = zip(*c.most_common())
counts = list(counts)
if counts[-1] == 1:
k = counts.index(1)
del counts[k:]
from operator import mul
from functools import reduce
def cmb(n,r):
r = min(n-r,r)
if r == ... | [
"assignment.add"
] | 513,331 | 513,332 | u793666115 | python |
p02732 | n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*n
for i in a:
al[i]+=1
for j in aset:
k=al[j]
ans+=(k*(k-1))//2
for u in a:
print(ans-al[u]+1) | n=int(input())
a=list(map(int,input().split()))
aset=list(set(a))
ans=0
al=[0]*200000
for i in a:
al[i]+=1
for j in aset:
k=al[j]
ans+=(k*(k-1))//2
for u in a:
print(ans-al[u]+1) | [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"expression.operation.binary.change"
] | 513,343 | 513,344 | u129978636 | python |
p02732 | import collections
n = int(input())
a_list = list(map(int,input().split()))
c=collections.Counter(a_list)
result=0
print(c)
for i in c.values():
result+=i * (i - 1)//2
for a in a_list:
print(result - c[a] + 1) | import collections
n = int(input())
a_list = list(map(int,input().split()))
c=collections.Counter(a_list)
result=0
for i in c.values():
result+=i * (i - 1)//2
for a in a_list:
print(result - c[a] + 1) | [
"call.remove"
] | 513,406 | 513,407 | u079022116 | python |
p02732 | N = int(input())
A = [int(a)-1 for a in input().split()]
X = [0] * N
for a in A:
X[a] += 1
s = 0
for x in X:
s += x * (x-1) // 2
print(s)
for a in A:
print(s - (X[a] - 1))
| N = int(input())
A = [int(a)-1 for a in 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))
| [
"call.remove"
] | 513,408 | 513,409 | u928713799 | python |
p02732 | #D ACして欲しい
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)#出現回数を辞書で取り出す
val=0
for i in c.values():#辞書に含まれる値をすべて取り出す
print(i) #1,2,3・・・の回数
val += i * (i - 1) // 2 #整数が同じボールを選ぶ組み合わせ
# val+=sum(range(i-1))
for i in range(n):
b = c[a[i]] #i番目の出現回数
p... | #D AC
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)#出現回数を辞書で取り出す
val=0
for i in c.values():#辞書に含まれる値をすべて取り出す
# print(i) #1,2,3・・・の回数
val += i * (i - 1) // 2 #整数が同じボールを選ぶ組み合わせ
# val+=sum(range(i-1))
for i in range(n):
b = c[a[i]] #i番目の出現回数
prin... | [
"call.remove"
] | 513,434 | 513,435 | u490489966 | python |
p02732 | import collections
from collections import defaultdict
n = int(input())
l = list(map(int, input().split()))
dict = defaultdict(int)
for i in l:
dict[i]+=1
print(dict)
ans = 0
for v in dict.values():
ans += int((v*(v-1)) // 2)
for k in l:
print(ans - (dict[k] - 1))
| import collections
from collections import defaultdict
n = int(input())
l = list(map(int, input().split()))
dict = defaultdict(int)
for i in l:
dict[i]+=1
ans = 0
for v in dict.values():
ans += int((v*(v-1)) // 2)
for k in l:
print(ans - (dict[k] - 1))
| [
"call.remove"
] | 513,548 | 513,549 | u694422786 | python |
p02732 | import collections
def resolve():
N = int(input())
A = map(int, input().split())
counter = collections.Counter(A)
ans = 0
for i in counter.values():
ans += i * (i - 1) // 2
for a in A:
count = counter[a]
print(ans - (count * (count - 1) // 2) +
((count ... | import collections
def resolve():
N = int(input())
A = list(map(int, input().split()))
counter = collections.Counter(A)
ans = 0
for i in counter.values():
ans += i * (i - 1) // 2
for a in A:
count = counter[a]
print(ans - (count * (count - 1) // 2) +
((... | [
"call.add",
"call.arguments.change"
] | 513,572 | 513,573 | u586662847 | python |
p02732 | import collections
def resolve():
N = int(input())
A = sorted(map(int, input().split()))
counter = collections.Counter(A)
ans = 0
for i in counter.values():
ans += i * (i - 1) // 2
for a in A:
count = counter[a]
print(ans - (count * (count - 1) // 2) +
... | import collections
def resolve():
N = int(input())
A = list(map(int, input().split()))
counter = collections.Counter(A)
ans = 0
for i in counter.values():
ans += i * (i - 1) // 2
for a in A:
count = counter[a]
print(ans - (count * (count - 1) // 2) +
((... | [
"assignment.value.change",
"identifier.change",
"call.function.change"
] | 513,574 | 513,573 | u586662847 | python |
p02732 | def resolve():
N = int(input())
A = sorted(map(int, input().split()))
counter = collections.Counter(A)
ans = 0
for i in counter.values():
ans += i * (i - 1) // 2
for a in A:
count = counter[a]
print(ans - (count * (count - 1) // 2) +
((count - 1) * (count... | import collections
def resolve():
N = int(input())
A = list(map(int, input().split()))
counter = collections.Counter(A)
ans = 0
for i in counter.values():
ans += i * (i - 1) // 2
for a in A:
count = counter[a]
print(ans - (count * (count - 1) // 2) +
((... | [
"assignment.value.change",
"identifier.change",
"call.function.change"
] | 513,575 | 513,573 | u586662847 | python |
p02732 | import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
d = [0] * n
s = {}
for i in a:
d[i] += 1
sum = 0
for k in d:
if k>1:
sum += (k*(k-1))//2
for i in range(n):
nd = d[a[i]]
ans = sum-(nd*(nd-1))//2
nd -= 1
if nd>1:
ans += (nd*(nd-1))//2
print(ans)
| import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
d = [0] * (n+1)
s = {}
for i in a:
d[i] += 1
sum = 0
for k in d:
if k>1:
sum += (k*(k-1))//2
for i in range(n):
nd = d[a[i]]
ans = sum-(nd*(nd-1))//2
nd -= 1
if nd>1:
ans += (nd*(nd-1))//2
print(ans)
| [] | 513,583 | 513,584 | u915879510 | python |
p02732 | import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
d = [0] * n
s = {}
for i in a:
d[i-1] += 1
sum = 0
for k in d:
if k>1:
sum += (k*(k-1))//2
for i in range(n):
nd = d[a[i]]
ans = sum-(nd*(nd-1))//2
nd -= 1
if nd>1:
ans += (nd*(nd-1))//2
print(ans)
| import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
d = [0] * (n+1)
s = {}
for i in a:
d[i] += 1
sum = 0
for k in d:
if k>1:
sum += (k*(k-1))//2
for i in range(n):
nd = d[a[i]]
ans = sum-(nd*(nd-1))//2
nd -= 1
if nd>1:
ans += (nd*(nd-1))//2
print(ans)
| [
"expression.operation.binary.remove"
] | 513,585 | 513,584 | u915879510 | python |
p02732 | n = int(input())
nums = list(map(int, input().split()))
print(nums)
values = {}
for i in nums:
if i in values: values[i] += 1
else: values[i] = 1
sums={} # 各値ごとの組み合わせ数
subsums={} # 各値ごとの組み合わせ数(ボールがないとき版
allsum = 0
for k,v in values.items():
sums[k] = v * (v - 1) / 2
undersum = (v - 2) * (v - 1) / 2 if v > 1 ... | n = int(input())
nums = list(map(int, input().split()))
values = {}
for i in nums:
if i in values: values[i] += 1
else: values[i] = 1
sums={} # 各値ごとの組み合わせ数
subsums={} # 各値ごとの組み合わせ数(ボールがないとき版
allsum = 0
for k,v in values.items():
sums[k] = v * (v - 1) / 2
undersum = (v - 2) * (v - 1) / 2 if v > 1 else 0
subs... | [
"call.remove"
] | 513,626 | 513,627 | u078307399 | python |
p02732 | N = int(input())
A = list(map(int,input().split()))
B = [0]*(N+1)
for a in A:
B[a]+=1
C = [0]*(N+1)
for i in range(N):
C[i] = (B[i]-1)*B[i]//2
S = sum(C)
for k in range(N):
s = A[k]
ans = S-C[s]
b = B[s]-1
print(ans+(b-1)*b//2) | N = int(input())
A = list(map(int,input().split()))
B = [0]*(N+1)
for a in A:
B[a]+=1
C = [0]*(N+1)
for i in range(N+1):
C[i] = (B[i]-1)*B[i]//2
S = sum(C)
for k in range(N):
s = A[k]
ans = S-C[s]
b = B[s]-1
print(ans+(b-1)*b//2)
| [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 513,632 | 513,633 | u350997995 | python |
p02732 | def main():
N = int(input())
A = [int(v) for v in input().split()]
C = [0] * (N + 1)
for i in A:
C[i] += 1
b = 0
print(C)
for cnt in C:
b += ((cnt * (cnt - 1)) // 2)
for i in range(N):
p = ((C[A[i]] - 1) * (C[A[i]] - 2)) >> 1
m = (C[A[i]] * (C[A[i]] - ... | def main():
N = int(input())
A = [int(v) for v in input().split()]
C = [0] * (N + 1)
for i in A:
C[i] += 1
b = 0
for cnt in C:
b += ((cnt * (cnt - 1)) // 2)
for i in range(N):
p = ((C[A[i]] - 1) * (C[A[i]] - 2)) >> 1
m = (C[A[i]] * (C[A[i]] - 1)) >> 1
... | [
"call.remove"
] | 513,648 | 513,649 | u652583512 | python |
p02732 | N=int(input())
A=list(map(int,input().split()))
S=[0 for j in range(N+1)]
count=0
for i in range(N):
S[A[i]]+=1
for i in range(N):
count+=S[i]*(S[i]-1)//2
for i in range(N):
print(count-(S[A[i]]-1))
| N=int(input())
A=list(map(int,input().split()))
S=[0 for j in range(N+1)]
count=0
for i in range(N):
S[A[i]]+=1
for i in range(N+1):
count+=S[i]*(S[i]-1)//2
for i in range(N):
print(count-(S[A[i]]-1)) | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 513,675 | 513,676 | u462976050 | python |
p02732 | N_max = 2*(10**5)
N = int(input())
A = list(map(int, input().split()))
array = sorted(A)
quantity_of_num = [0]*(N_max + 1) # kという値がquantity_of_num[k]個あることを示す
type_index = list() # 文字の種類を昇順で記録していく配列。 len(type_index)が文字の種類数
count = 1 # 各文字が何個あるかの記録作業
for i in range(N-1):
if array[i] == array[i+1]:
count +=... | N_max = 2*(10**5)
N = int(input())
A = list(map(int, input().split()))
array = sorted(A)
quantity_of_num = [0]*(N_max + 1) # kという値がquantity_of_num[k]個あることを示す
type_index = list() # 文字の種類を昇順で記録していく配列。 len(type_index)が文字の種類数
count = 1 # 各文字が何個あるかの記録作業
for i in range(N-1):
if array[i] == array[i+1]:
count +=... | [
"expression.operation.binary.add",
"assignment.change"
] | 513,738 | 513,739 | u539969758 | python |
p02732 | import collections
N = int(input())
A = list(map(int, input().split()))
ctr_A = collections.Counter(A).most_common()
less_A = collections.Counter(A)
total = 0
for i in range(len(ctr_A)):
n = ctr_A[i][1]
total += n * (n - 1) // 2
for i in range(N):
summ = total
num = A[i]
n = less_A[num]
if... | import collections
N = int(input())
A = list(map(int, input().split()))
ctr_A = collections.Counter(A).most_common()
less_A = collections.Counter(A)
total = 0
for i in range(len(ctr_A)):
n = ctr_A[i][1]
total += n * (n - 1) // 2
for i in range(N):
summ = total
num = A[i]
n = less_A[num]
if... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 513,774 | 513,775 | u015593272 | python |
p02732 | n = int(input())
k = [int(i) for i in input().split()]
pair = {}
for i in range(n):
pair.setdefault(k[i], []).append(i)
sum = 0
for value in pair.values():
l = len(value)
sum += l*(l-1)//2
for i in range(n):
ans = 0
len_pair = len(pair[k[i]])
if len_pair != 1:
ans = sum - ((len_pair*(... | n = int(input())
k = [int(i) for i in input().split()]
pair = {}
for i in range(n):
pair.setdefault(k[i], []).append(i)
sum = 0
for value in pair.values():
l = len(value)
sum += l*(l-1)//2
for i in range(n):
len_pair = len(pair[k[i]])
if len_pair != 1:
ans = sum - ((len_pair*(len_pair-1)/... | [
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 513,778 | 513,779 | u759518460 | python |
p02732 | def conbination_2(n):
if n <= 1:
return 0
else:
return int(n * (n - 1) / 2)
N = int(input())
A = list(map(int,input().split()))
S = 0
Count = [0] * (N - 1)
for i in range(N):
Count[A[i] - 1] += 1
for i in range(N - 1):
S += conbination_2(Count[i])
for i in range(N):
Ans = S - (Count[A[i] - 1]... | def conbination_2(n):
if n <= 1:
return 0
else:
return int(n * (n - 1) / 2)
N = int(input())
A = list(map(int,input().split()))
S = 0
Count = [0] * N
for i in range(N):
Count[A[i] - 1] += 1
for i in range(N):
S += conbination_2(Count[i])
for i in range(N):
Ans = S - (Count[A[i] - 1] - 1)
pr... | [
"expression.operation.binary.remove"
] | 513,792 | 513,793 | u092646083 | python |
p02732 | N = int(input())
A = list(map(int, input().split()))
lis = [0 for _ in range(N+1)]
lis1 = [0 for _ in range(N+1)]
lis2 = [0 for _ in range(N+1)]
for i in range(N):
lis[A[i]] += 1
for i in range(N):
num = lis[i]
if num != 0:
lis1[i] = int(num*(num-1)/2)
lis2[i] = int((num-1)*(num-2)/2) - li... | N = int(input())
A = list(map(int, input().split()))
lis = [0 for _ in range(N+1)]
lis1 = [0 for _ in range(N+1)]
lis2 = [0 for _ in range(N+1)]
for i in range(N):
lis[A[i]] += 1
for i in range(N+1):
num = lis[i]
if num != 0:
lis1[i] = int(num*(num-1)/2)
lis2[i] = int((num-1)*(num-2)/2) - ... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 513,837 | 513,838 | u905329882 | python |
p02732 | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = dict(Counter(a))
ans = 0
for v in c.values():
ans += v*(v-1)//2
for i in range(n):
print(ans-a[i]-1)
| from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = dict(Counter(a))
ans = 0
for v in c.values():
ans += v*(v-1)//2
for i in range(n):
print(ans-c[a[i]]+1)
| [
"call.arguments.change",
"expression.operation.binary.change",
"io.output.change"
] | 513,848 | 513,849 | u111473084 | python |
p02732 | import collections
import math
N = int(input())
A = list(map(int, input().split(' ')))
c = collections.Counter(A)
d1 = {}
d2 = {}
for i in c:
d1[str(i)] = (c[i]*(c[i]-1))/2
d2[str(i)] = ((c[i]-1)*(c[i]-2))/2
s = sum(d1.values())
print(c)
for i in range(N):
ans = s - d1[str(A[i])]+d2[str(A[i])]
print(i... | import collections
import math
N = int(input())
A = list(map(int, input().split(' ')))
c = collections.Counter(A)
d1 = {}
d2 = {}
for i in c:
d1[str(i)] = (c[i]*(c[i]-1))/2
d2[str(i)] = ((c[i]-1)*(c[i]-2))/2
s = sum(d1.values())
for i in range(N):
ans = s - d1[str(A[i])]+d2[str(A[i])]
print(int(ans))
| [
"call.remove"
] | 513,856 | 513,857 | u360061665 | python |
p02732 | import collections
n=int(input())
As=list(map(int,input().split()))
ls=collections.Counter(As)
subd={}
an=ls.values()
for k in l:
ans+=k*(k-1)//2
sans=ans
for i in As:
ans=sans+1-ls[i]
print(ans)
| import collections
n=int(input())
As=list(map(int,input().split()))
ls=collections.Counter(As)
subd={}
an=ls.values()
ans=0
for k in an:
ans+=k*(k-1)//2
sans=ans
for i in As:
ans=sans+1-ls[i]
print(ans) | [
"identifier.change"
] | 513,864 | 513,865 | u291988695 | python |
p02732 | from collections import Counter
n = int(input())
s = [int(i) for i in input().split()]
s_set = set(s)
counted = Counter(s)
ans = sum(i*(i-1)/2 for i in counted.values())
print(ans)
for i in s:
x = counted[i]
print(int(ans - x + 1)) | from collections import Counter
n = int(input())
s = [int(i) for i in input().split()]
s_set = set(s)
counted = Counter(s)
ans = sum(i*(i-1)/2 for i in counted.values())
for i in s:
x = counted[i]
print(int(ans - x + 1)) | [
"call.remove"
] | 513,902 | 513,903 | u274841648 | python |
p02732 | import sys
stdin = sys.stdin
ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)
def cmb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
numerator = [n - r + k + 1 for k in range(... | import sys
stdin = sys.stdin
ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)
def cmb(n, r):
if n - r < r: r = n - r
if r == 0: return 1
if r == 1: return n
numerator = [n - r + k + 1 for k in range(... | [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"io.output.change"
] | 513,918 | 513,919 | u887207211 | python |
p02732 | N = int(input())
A = list(map(int, input().split()))
B = [[] for i in range(N)]
ans = [0]*N
for k, a in enumerate(A):
a = a - 1
B[a].append(k)
S = 0
for b in B:
lenb = len(b)
if lenb >= 1:
S += lenb * (lenb-1) / 2
for i, b in enumerate(B):
for j, k in enumerate(b):
ans[k] = int(S ... | N = int(input())
A = list(map(int, input().split()))
B = [[] for i in range(N)]
ans = [0]*N
for k, a in enumerate(A):
a = a - 1
B[a].append(k)
S = 0
for b in B:
lenb = len(b)
if lenb >= 1:
S += lenb * (lenb-1) / 2
for i, b in enumerate(B):
for j, k in enumerate(b):
ans[k] = int(S ... | [
"identifier.change",
"call.arguments.change",
"io.output.change"
] | 513,920 | 513,921 | u607075479 | python |
p02732 | def nCr(n, r):
import math
# nCrのr>nは組み合わせが存在しないので0を返す
# raiseすべきのこともあるかも
if r > n:
return 0
return math.factorial(n) // ((math.factorial(n - r) * math.factorial(r)))
memo = [-1] * 300000
memo2 = [-1] * 300000
memo3 = [-1] * 300000
n = int(input())
dat = list(map(int, input().split()))
fro... | def nCr(n, r):
import math
# nCrのr>nは組み合わせが存在しないので0を返す
# raiseすべきのこともあるかも
if r > n:
return 0
return math.factorial(n) // ((math.factorial(n - r) * math.factorial(r)))
memo = [-1] * 300000
memo2 = [-1] * 300000
memo3 = [-1] * 300000
n = int(input())
dat = list(map(int, input().split()))
fro... | [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"io.output.change"
] | 513,976 | 513,977 | u073549161 | python |
p02732 | import collections
N = int(input())
A = list(map(int, input().split()))
ct = collections.Counter(A)
ret = []
total = 0
for k,count in ct.items():
if count > 1:
total += count * (count-1) // 2
for i,v in enumerate(A):
if ct[v] > 1:
count = ct[v]
adjust = (count-1) * (count-2) // 2 - (... |
import collections
N = int(input())
A = list(map(int, input().split()))
ct = collections.Counter(A)
ret = []
total = 0
for k,count in ct.items():
if count > 1:
total += count * (count-1) // 2
for i,v in enumerate(A):
if ct[v] > 1:
count = ct[v]
adjust = (count-1) * (count-2) // 2 - ... | [
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove"
] | 514,023 | 514,024 | u179053337 | python |
p02732 | def fun(a):
return a*(a-1)//2
import sys
def main():
n = int(input())
l = [int(j) for j in sys.stdin.readline().split()]
d = dict()
for i in range(n):
if l[i] in d:
d[l[i]]+=1
else:
d[l[i]]=1
print(d)
ans = 0
for key in d:
ans+=fun(d[key])
... | def fun(a):
return a*(a-1)//2
import sys
def main():
n = int(input())
l = [int(j) for j in sys.stdin.readline().split()]
d = dict()
for i in range(n):
if l[i] in d:
d[l[i]]+=1
else:
d[l[i]]=1
# print(d)
ans = 0
for key in d:
ans+=fun(d[key]... | [
"call.remove"
] | 514,029 | 514,030 | u687667446 | python |
p02732 | import collections
n=int(input())
a=list(map(int,input().split()))
ct=[0 for i in range(n+1)]
for i in range(n):
ct[a[i]]+=1
ans=0
for i in range(n):
ans+=ct[i]*(ct[i]-1)//2
for i in range(n):
print(ans-ct[a[i]]+1) | n=int(input())
a=list(map(int,input().split()))
ct=[0 for i in range(n+1)]
for i in range(n):
ct[a[i]]+=1
ans=0
for i in range(n+1):
ans+=(ct[i]*(ct[i]-1))//2
for i in range(n):
print(ans-ct[a[i]]+1) | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 514,136 | 514,137 | u017810624 | python |
p02732 | N = int(input())
K = list(map(int,input().rstrip().split()))
CK = [0 for i in range(N + 1)]
ans = 0
for i in K:
CK[i] += 1
for i in range(N):
ans += CK[i] * (CK[i] -1) /2
for i in range(N):
bans = ans - CK[K[i]] * (CK[K[i]] -1 ) /2 + (CK[K[i]] -1) * (CK[K[i]] -2) /2
print(int(bans)) | N = int(input())
K = list(map(int,input().rstrip().split()))
CK = [0 for i in range(N + 1)]
ans = 0
for i in K:
CK[i] += 1
for i in range(N + 1):
ans += CK[i] * (CK[i] - 1) /2
for i in range(N):
bans = ans - CK[K[i]] * (CK[K[i]] -1 ) / 2 + (CK[K[i]] -1) * (CK[K[i]] -2) / 2
print(int(bans)) | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 514,164 | 514,165 | u017050982 | python |
p02732 | n=int(input())
arr= list(map(int,input().split(' ')))
count={}
for i in range(len(arr)):
val=arr[i]
if val not in count.keys():
count[val]=1
else:
count[val]+=1
big_sum=0
for d in count.keys():
big_sum+= count[d]*(count[d]-1)/2
for a in arr:
if a in count.keys():
if count[... | n=int(input())
arr= list(map(int,input().split(' ')))
count={}
for i in range(len(arr)):
val=arr[i]
if val not in count.keys():
count[val]=1
else:
count[val]+=1
big_sum=0
for d in count.keys():
big_sum+= count[d]*(count[d]-1)/2
for a in arr:
if a in count.keys():
if count[... | [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"io.output.change",
"call.arguments.add"
] | 514,192 | 514,193 | u794066762 | python |
p02732 | n = int(input())
a = [int(i) for i in input().split()]
ball = [0]*(n+1)
for i in range(n):
ball[a[i]] += 1
zenbu = 0
for i in range(n):
tmp = ball[i]
if tmp > 1:
zenbu += (tmp*(tmp-1))//2
for i in range(n):
tmp = ball[a[i]]
if tmp > 1:
#sabun = (tmp*(tmp-1))//2 - ((t... | n = int(input())
a = [int(i) for i in input().split()]
ball = [0]*(n+1)
for i in range(n):
ball[a[i]] += 1
zenbu = 0
for i in range(n+1):
tmp = ball[i]
if tmp > 1:
zenbu += (tmp*(tmp-1))//2
for i in range(n):
tmp = ball[a[i]]
if tmp > 1:
#sabun = (tmp*(tmp-1))//2 - (... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 514,340 | 514,341 | u228223940 | python |
p02732 | n = int(input())
a = list(map(int,input().split()))
dic = {}
for i in a:
s.add(i)
if i in dic:
dic[i] +=1
else:
dic[i] = 1
ans = 0
for i in dic.values():
ans += i * (i - 1) // 2
for i in a:
sa = dic[i] * (dic[i] - 1) // 2 - ((dic[i] - 1) * (dic[i] - 2) // 2)
print(ans - sa) | n = int(input())
a = list(map(int,input().split()))
dic = {}
for i in a:
if i in dic:
dic[i] +=1
else:
dic[i] = 1
ans = 0
for i in dic.values():
ans += i * (i - 1) // 2
for i in a:
sa = dic[i] * (dic[i] - 1) // 2 - ((dic[i] - 1) * (dic[i] - 2) // 2)
print(ans - sa) | [
"call.remove"
] | 514,420 | 514,421 | u476124554 | python |
p02732 | N=int(input())
A=list(map(int,input().split()))
B=[0 for i in range(N+1)]
for i in range(N):
B[A[i]] += 1
S=0
for i in range(N):
if B[i]!=0:
S += int(B[i]*(B[i]-1)/2)
for i in range(N):
print(S - (B[A[i]] -1))
| N=int(input())
A=list(map(int,input().split()))
B=[0 for i in range(N+1)]
for i in range(N):
B[A[i]] += 1
S=0
for i in range(N+1):
if B[i]!=0:
S += int(B[i]*(B[i]-1)/2)
for i in range(N):
print(S - (B[A[i]] -1))
| [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 514,442 | 514,443 | u447679353 | python |
p02732 | import sys
#input = sys.stdin.readline
def main():
n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)
s=0
for i in range(n):
l[a[i]]+=1
for i in range(n):
if l[i]==0:
continue
else:
s+=l[i]*(l[i]-1)//2
for i in range(n):
print... | import sys
#input = sys.stdin.readline
def main():
n=int(input())
a=list(map(int,input().split()))
l=[0]*(n+1)
s=0
for i in range(n):
l[a[i]]+=1
for i in range(n+1):
if l[i]==0:
continue
else:
s+=l[i]*(l[i]-1)//2
for i in range(n):
pri... | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 514,482 | 514,483 | u919730120 | python |
p02732 | N = int(input())
A = list(map(int, input().split()))
#L = [0 for i in range(N)]
dict = {}
for i in A:
if i in dict:
dict[i] = dict[i] + 1
else:
dict[i] = 1
print(dict)
total = 0;
for i in dict:
# print("i:" + str(i) + " " + str(dict[i]))
total += dict[i]*(dict[i]-1) // 2
#print("T:" + str(total))
for... | N = int(input())
A = list(map(int, input().split()))
#L = [0 for i in range(N)]
dict = {}
for i in A:
if i in dict:
dict[i] = dict[i] + 1
else:
dict[i] = 1
#print(dict)
total = 0;
for i in dict:
# print("i:" + str(i) + " " + str(dict[i]))
total += dict[i]*(dict[i]-1) // 2
#print("T:" + str(total))
fo... | [
"call.remove"
] | 514,538 | 514,539 | u779728630 | python |
p02732 | def main():
n=int(input())
a=list(map(int,input().split()))
cnt=[0]*n
for i in range(n):
cnt[a[i]-1]+=1
res=0
for i in range(n):
if cnt[i]>1:
res+=cnt[i]*(cnt[i]-1)//2
ans=[0]*n
for i in range(n):
if cnt[i]>1:
ans[i]=res-(cnt[i]-1)
for ... | def main():
n=int(input())
a=list(map(int,input().split()))
cnt=[0]*n
for i in range(n):
cnt[a[i]-1]+=1
res=0
for i in range(n):
if cnt[i]>1:
res+=cnt[i]*(cnt[i]-1)//2
ans=[0]*n
for i in range(n):
if cnt[i]>=1:
ans[i]=res-(cnt[i]-1)
for... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 514,649 | 514,650 | u217627525 | python |
p02732 | n = int(input())
b = list(map(int,input().split()))
balls = [0]*(n+1)
for i in range(n):
balls[b[i]] += 1
su = 0
for i in range(n):
su += (balls[i]*(balls[i]-1))//2
for i in range(n):
bb = balls[b[i]]
print(su - bb+1)
| n = int(input())
b = list(map(int,input().split()))
balls = [0]*(n+1)
for i in range(n):
balls[b[i]] += 1
su = 0
for i in range(n+1):
su += (balls[i]*(balls[i]-1))//2
for i in range(n):
bb = balls[b[i]]
print(su - bb+1)
| [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 514,714 | 514,715 | u963915126 | python |
p02732 | N=int(input())
A=[int(i) for i in input().split()]
ok=[0]*(N+1)
# print(ok)
for i in range(N):
ok[A[i]]+=1
# print(ok)
ans=0
sum=0
for i in range(N):
if ok[i]!=0:
sum+=int(ok[i]*(ok[i]-1)/2)
# print("sum ",sum)
for i in range(N):
# print(i,A[i])
if ok[A[i]]<=1:
ans=sum
elif ok[A[i... | N=int(input())
A=[int(i) for i in input().split()]
ok=[0]*(N+1)
# print(ok)
for i in range(N):
ok[A[i]]+=1
# print(ok)
ans=0
sum=0
for i in range(N+1):
if ok[i]>=2:
sum+=int(ok[i]*(ok[i]-1)/2)
# print("sum ",sum)
for i in range(N):
# print(i,A[i])
if ok[A[i]]<=1:
ans=sum
elif ok[A... | [
"control_flow.loop.for.condition.change"
] | 514,716 | 514,717 | u456806668 | python |
p02732 | import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int,input().split()))
B = [0] * (n+1)
for i in range(n):
B[A[i]] += 1
C = [0] * (n+1)
for i in range(n):
C[i] = B[i]*(B[i]-1)//2
su = sum(C)
for i in range(n):
print(su - C[A[i]] + (B[A[i]]-1)*(B[A[i]]-2)//2) | import sys
input = sys.stdin.readline
n = int(input())
A = list(map(int,input().split()))
B = [0] * (n+1)
for i in range(n):
B[A[i]] += 1
C = [0] * (n+1)
for i in range(n+1):
C[i] = B[i]*(B[i]-1)//2
su = sum(C)
for i in range(n):
print(su - C[A[i]] + (B[A[i]]-1)*(B[A[i]]-2)//2) | [
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.add"
] | 514,744 | 514,745 | u325227960 | python |
p02732 | N = int(input())
A = list(map(int, input().split()))
count = [0] * 200005
for a in A:
count[a] += 1
s = 0
for c in count:
s += c * (c - 1) // 2
print(s)
for a in A:
c = count[a]
x = c * (c - 1) // 2
c -= 1
y = c * (c - 1) // 2
print(s - x + y)
| N = int(input())
A = list(map(int, input().split()))
count = [0] * 200005
for a in A:
count[a] += 1
s = 0
for c in count:
s += c * (c - 1) // 2
for a in A:
c = count[a]
x = c * (c - 1) // 2
c -= 1
y = c * (c - 1) // 2
print(s - x + y)
| [
"call.remove"
] | 514,758 | 514,759 | u731368968 | python |
p02733 | #!/usr/bin/env python3
import sys
# import math
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popl... | #!/usr/bin/env python3
import sys
# import math
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popl... | [
"call.remove"
] | 514,900 | 514,901 | u480300350 | python |
p02733 | #!/usr/bin/env python3
import sys
# import math
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popl... | #!/usr/bin/env python3
import sys
# import math
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popl... | [
"identifier.change",
"variable_access.subscript.index.change",
"call.arguments.change"
] | 514,902 | 514,901 | u480300350 | python |
p02733 | #!/usr/bin/env python3
import sys
# import math
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popl... | #!/usr/bin/env python3
import sys
# import math
# import re # re.compile(pattern) => ptn obj; p.search(s), p.match(s), p.finditer(s) => match obj; p.sub(after, s)
# from collections import deque # deque class. deque(L): dq.append(x), dq.appendleft(x), dq.pop(), dq.popl... | [
"identifier.change",
"variable_access.subscript.index.change",
"call.arguments.change"
] | 514,903 | 514,901 | u480300350 | python |
p02733 | import sys
from itertools import product
read = sys.stdin.read
readline = sys.stdin.readline
H, W, K = map(int, readline().split())
S = [list(map(int, list(readline().rstrip()))) for _ in range(H)]
answer = 10 ** 10
for i in product((0, 1), repeat=H - 1):
cnt = sum(i)
if cnt >= answer:
continue
c... | import sys
from itertools import product
read = sys.stdin.read
readline = sys.stdin.readline
H, W, K = map(int, readline().split())
S = [list(map(int, list(readline().rstrip()))) for _ in range(H)]
answer = 10 ** 10
for i in product((0, 1), repeat=H - 1):
cnt = sum(i)
if cnt >= answer:
continue
c... | [
"control_flow.continue.remove",
"control_flow.break.add"
] | 514,969 | 514,970 | u945181840 | python |
p02733 | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
H, W, K = [int(x) for x in input().split()]
S = [list(input().strip()) for _ in range(H)]
ans = float("inf")
for n in range(2 ** (H - 1)):
tmp = 0
wn = [0] * 10
for i in range(H):
... | import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline
def main():
H, W, K = [int(x) for x in input().split()]
S = [list(input().strip()) for _ in range(H)]
ans = float("inf")
for n in range(2 ** (H - 1)):
tmp = 0
wn = [0] * 10
for i in range(H):
... | [
"control_flow.break.add"
] | 515,002 | 515,003 | u098012509 | python |
p02733 | import sys
input = sys.stdin.readline
h, w, K = map(int, input().split())
s = []
for i in range(h):
s.append(input().rstrip())
ans = float('inf')
for i in range(2 ** (h-1)):
# 仕切り 1, 2, ...
sep = [0]
for j in range(h-1):
if i & (1 << j):
sep.append(j+1)
memo = [0 for _ in ran... | import sys
input = sys.stdin.readline
h, w, K = map(int, input().split())
s = []
for i in range(h):
s.append(input().rstrip())
ans = float('inf')
for i in range(2 ** (h-1)):
# 仕切り 1, 2, ...
sep = [0]
for j in range(h-1):
if i & (1 << j):
sep.append(j+1)
memo = [0 for _ in ran... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 515,100 | 515,101 | u711539583 | python |
p02733 | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
H, W, K = map(int, input().split())
S = [input() for _ in range(H)]
ans = 10 ** 9
for bit in range(1 << (H-1)):
canSolve = True
ord = [0] * (H + 1)
N = 0
for i in range(H):
if bit & 1 ... | import sys
def input(): return sys.stdin.readline().rstrip()
def main():
H, W, K = map(int, input().split())
S = [input() for _ in range(H)]
ans = 10 ** 9
for bit in range(1 << (H-1)):
canSolve = True
ord = [0] * (H + 1)
N = 0
for i in range(H):
if bit & 1 ... | [
"call.remove"
] | 515,122 | 515,123 | u250583425 | python |
p02732 | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
ans = 0
for k, v in counter.items():
if 2 <= v:
ans += v * (v - 1) // 2
for a in A:
if a in counter and 2 <= counter[a]:
v = counter[a]
diff = v * (v - 1) // 2 - ((v- 1) * (v - 2) //... | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
ans = 0
for k, v in counter.items():
if 2 <= v:
ans += v * (v - 1) // 2
for a in A:
if a in counter and 2 <= counter[a]:
v = counter[a]
diff = v * (v - 1) // 2 - ((v- 1) * (v - 2) //... | [
"identifier.replace.add",
"literal.replace.remove",
"call.arguments.change",
"io.output.change"
] | 515,320 | 515,321 | u291766461 | python |
p02732 | N = int(input())
A = list(map(int, input().split()))
d = {}
for a in A:
if a in d:
d[a] += 1
else:
d[a] = 1
ans = 0
for a in d:
n = d[a]
ans += n * (n-1) // 2
print(ans)
for a in A:
n = d[a]
if n >= 2:
print(ans - n + 1)
else:
print(ans) | N = int(input())
A = list(map(int, input().split()))
d = {}
for a in A:
if a in d:
d[a] += 1
else:
d[a] = 1
ans = 0
for a in d:
n = d[a]
ans += n * (n-1) // 2
for a in A:
n = d[a]
if n >= 2:
print(ans - n + 1)
else:
print(ans)
| [
"call.remove"
] | 515,406 | 515,407 | u922449550 | python |
p02733 | import sys
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def MAP(): return map(int, input().split())
inf = sys.maxsize
h, w, k = MAP()
s = [[int(i) for i in STR()] for _ in range(h)]
ans = inf
for i in range(2 ** (h - 1)): #縦方向の割り方を全探索 O(500)
hdiv = [1 for _ in range(h)]
for j in ... | import sys
def input(): return sys.stdin.readline().strip()
def STR(): return input()
def MAP(): return map(int, input().split())
inf = sys.maxsize
h, w, k = MAP()
s = [[int(i) for i in STR()] for _ in range(h)]
ans = inf
for i in range(2 ** (h - 1)): #縦方向の割り方を全探索 O(500)
hdiv = [1 for _ in range(h)]
for j in ... | [
"assignment.variable.change",
"identifier.change"
] | 515,142 | 515,143 | u287500079 | python |
p02733 | import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()
H, W, K = map(int, input().split())
S = [input() for _ in range(H)]
mi = None
def max(iterabl... | import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()
H, W, K = map(int, input().split())
S = [input() for _ in range(H)]
mi = None
def _max(iterab... | [
"identifier.change",
"call.function.change",
"control_flow.branch.if.condition.change"
] | 515,173 | 515,174 | u845152373 | python |
p02733 | from collections import *
from heapq import *
from itertools import *
from math import gcd
import sys
from decimal import *
import copy
input=lambda :sys.stdin.readline().rstrip()
H,W,K=map(int,input().split())
S=[input() for i in range(H)]
value=H+W-1
if H==1:
count=0
countL=0
w=0
while w<W:
... | from collections import *
from heapq import *
from itertools import *
from math import gcd
import sys
from decimal import *
import copy
input=lambda :sys.stdin.readline().rstrip()
H,W,K=map(int,input().split())
S=[input() for i in range(H)]
value=H+W-1
if H==1:
count=0
countL=0
w=0
while w<W:
... | [
"control_flow.break.remove",
"control_flow.break.add"
] | 515,197 | 515,198 | u779455925 | python |
p02720 | from collections import deque
k = int(input())
q = deque()
if k > 9:
for i in range(1, 10):
q.append(i)
for _ in range(k):
temp = q.popleft()
if temp % 10 != 0:
q.append(temp*10+int(str(temp)[-1])-1)
q.append(temp*10+int(str(temp)[-1]))
if temp % 10 != 9:
q.append(t... | from collections import deque
k = int(input())
q = deque()
for i in range(1, 10):
q.append(i)
for _ in range(k):
temp = q.popleft()
if temp % 10 != 0:
q.append(temp*10+int(str(temp)[-1])-1)
q.append(temp*10+int(str(temp)[-1]))
if temp % 10 != 9:
q.append(temp*10+int(str(tem... | [] | 515,452 | 515,453 | u608053762 | python |
p02720 | k = int(input())
dp = [[[] for j in range(11)] for i in range(11)]
for i in range(10):
dp[1][i].append(i)
dp[0][i].append(0)
if k<=9:
print(k)
exit()
k-=9
for i in range(2, 11):
for j in range(1, 10):
if j==1:
for z in range(i):
for x in dp[i-z-1][j]:
... | k = int(input())
dp = [[[] for j in range(11)] for i in range(11)]
for i in range(10):
dp[1][i].append(i)
dp[0][i].append(0)
if k<=9:
print(k)
exit()
k-=9
for i in range(2, 11):
for j in range(1, 10):
if j==1:
for z in range(i):
for x in dp[z][j]:
... | [
"expression.operation.binary.remove"
] | 515,454 | 515,455 | u190405389 | python |
p02720 | k = int(input())
x = [1,2,3,4,5,6,7,8,9]
i = 0
xa = x.append
while len(x) < k:
if x[i]%10 == 0:
xa(10*x[i])
xa(10*x[i]+1)
elif x[i]%10 == 9:
xa(10*x[i]+8)
xa(10*x[i]+9)
else:
j = x[i]%10
xa(10*x[i]+j-1)
xa(10*x[i]+j)
xa(10*x[i]+j+1)
print(x[k-1])
| k = int(input())
x = [1,2,3,4,5,6,7,8,9]
i = 0
xa = x.append
while len(x) < k:
if x[i]%10 == 0:
xa(10*x[i])
xa(10*x[i]+1)
elif x[i]%10 == 9:
xa(10*x[i]+8)
xa(10*x[i]+9)
else:
j = x[i]%10
xa(10*x[i]+j-1)
xa(10*x[i]+j)
xa(10*x[i]+j+1)
i += 1
print(x[k-1])
| [] | 515,456 | 515,457 | u673338219 | python |
p02720 | import queue
k = int(input())
q = queue.Queue()
x = -1
for i in range(1,10):
q.put(i)
for i in range(1,k+1):
x = q.get()
if x % 10 != 0:
q.put(10 * x + (x % 10) - 1)
q.put(10 * x + (x % 10))
if x % 9 != 0:
q.put(10 * x + (x % 10) + 1)
print(x) | import queue
k = int(input())
q = queue.Queue()
x = -1
for i in range(1,10):
q.put(i)
for i in range(1,k+1):
x = q.get()
if x % 10 != 0:
q.put(10 * x + (x % 10) - 1)
q.put(10 * x + (x % 10))
if x % 10 != 9:
q.put(10 * x + (x % 10) + 1)
print(x) | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 515,469 | 515,470 | u907414670 | python |
p02720 | import queue
K = int(input())
count = 0
q = queue.Queue()
for i in range(1, 10):
count += 1
q.put(i)
if count == K:
print(i)
break
result = 0
while count != K:
tmp = q.get() # 先頭のキューを取り出す
keta1 = tmp % 10 # 1の位を取得
for i in range(-1, 2):
if keta1 == 0 and i == -1:
... | import queue
K = int(input())
count = 0
q = queue.Queue()
for i in range(1, 10):
count += 1
q.put(i)
if count == K:
print(i)
break
result = 0
while count != K:
tmp = q.get() # 先頭のキューを取り出す
keta1 = tmp % 10 # 1の位を取得
for i in range(-1, 2):
if keta1 == 0 and i == -1: # ... | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change",
"control_flow.break.remove"
] | 515,473 | 515,474 | u577146296 | python |
p02720 | a=[]
def dfs(x):
if x>3234566667:
return
a.append(x)
for i in range(10):
if abs(x%10-i) <= 1:
dfs(x%10+i)
for i in range(1,10):
dfs(i)
a =sorted(a)
k=int(input())
print(a[k-1]) | a = []
def dfs(x):
if x > 3234566667:
return
a.append(x)
for i in range(10):
if abs(x%10-i) <= 1:
dfs(x*10+i)
for i in range(1, 10):
dfs(i)
a = sorted(a)
k = int(input())
print(a[k-1])
| [
"expression.operator.arithmetic.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 515,475 | 515,476 | u757030836 | python |
p02720 | from collections import deque
def lunlun():
k = int(input())
q = deque(list(range(1, 10)))
while k > 0:
k -= 1
n = q.popleft()
# print('====== popleft:', n)
if n % 10 != 0:
n0 = int(str(n) + str(n % 10 - 1))
q.append(n0)
# print('=== ap... | from collections import deque
def lunlun():
k = int(input())
q = deque(list(range(1, 10)))
while k > 0:
k -= 1
n = q.popleft()
# print('====== popleft:', n)
if n % 10 != 0:
n0 = int(str(n) + str(n % 10 - 1))
q.append(n0)
# print('=== ap... | [
"call.arguments.change"
] | 515,484 | 515,485 | u517910772 | python |
p02720 | n = int(input())
lunlun = [[1,2,3,4,5,6,7,8,9]]
for _ in range(2):
tmp = []
for i in lunlun[-1]:
if i % 10 == 0 :
tmp.append(10 * i + i % 10)
tmp.append(10 * i + i % 10 + 1)
elif i % 10 == 9:
tmp.append(10 * i + i % 10 - 1)
tmp.append(10 * i + i %... | n = int(input())
lunlun = [[1,2,3,4,5,6,7,8,9]]
for _ in range(10):
tmp = []
for i in lunlun[-1]:
if i % 10 == 0 :
tmp.append(10 * i + i % 10)
tmp.append(10 * i + i % 10 + 1)
elif i % 10 == 9:
tmp.append(10 * i + i % 10 - 1)
tmp.append(10 * i + i... | [
"literal.number.integer.change",
"call.arguments.change",
"control_flow.loop.range.bounds.upper.change"
] | 515,488 | 515,489 | u476124554 | python |
p02720 | n = int(input())
lunlun = [[1,2,3,4,5,6,7,8,9]]
for _ in range(2):
tmp = []
for i in lunlun[-1]:
if i % 10 == 0 :
tmp.append(10 * i + i % 10)
tmp.append(10 * i + i % 10 + 1)
elif i % 10 == 9:
tmp.append(10 * i + i % 10 - 1)
tmp.append(10 * i + i %... | n = int(input())
lunlun = [[1,2,3,4,5,6,7,8,9]]
for _ in range(9):
tmp = []
for i in lunlun[-1]:
if i % 10 == 0 :
tmp.append(10 * i + i % 10)
tmp.append(10 * i + i % 10 + 1)
elif i % 10 == 9:
tmp.append(10 * i + i % 10 - 1)
tmp.append(10 * i + i %... | [
"literal.number.integer.change",
"call.arguments.change",
"control_flow.loop.range.bounds.upper.change"
] | 515,488 | 515,490 | u476124554 | python |
p02733 | def main():
import sys
input=sys.stdin.readline
h,w,k=map(int,input().split())
S=[]
for _ in range(h):
s=list(map(int,list(input().rstrip())))
S.append(s)
ans=10**5
for i in range(2**(h-1)):
l=[0]
for j in range(h-1):
if i&1<<j:
l.a... | def main():
import sys
input=sys.stdin.readline
h,w,k=map(int,input().split())
S=[]
for _ in range(h):
s=list(map(int,list(input().rstrip())))
S.append(s)
ans=10**5
for i in range(2**(h-1)):
l=[0]
for j in range(h-1):
if i&1<<j:
l.a... | [
"assignment.variable.change",
"identifier.change"
] | 515,506 | 515,507 | u798316285 | python |
p02733 | import sys
import math
from collections import Counter
h, w, k = [int(s) for s in sys.stdin.readline().strip().split()]
s = [''] * h
for i in range(h):
s[i] = sys.stdin.readline().strip()
# h, w, k = 3, 5, 3
# s = [
# '11111',
# '11111',
# '11111'
# ]
ans = float('inf')
for i in range((h - 1) ** 2):... | import sys
import math
from collections import Counter
h, w, k = [int(s) for s in sys.stdin.readline().strip().split()]
s = [''] * h
for i in range(h):
s[i] = sys.stdin.readline().strip()
# h, w, k = 3, 5, 3
# s = [
# '11111',
# '11111',
# '11111'
# ]
# h, w, k = 10, 1000, 1
# s = ['11111111111111111... | [
"expression.operation.binary.remove"
] | 515,674 | 515,675 | u922965680 | python |
p02733 | import sys
import math
from collections import Counter
h, w, k = [int(s) for s in sys.stdin.readline().strip().split()]
s = [''] * h
for i in range(h):
s[i] = sys.stdin.readline().strip()
# h, w, k = 3, 5, 1
# s = [
# '11100',
# '10001',
# '00111'
# ]
ans = float('inf')
for i in range((h - 1) ** 2):... | import sys
import math
from collections import Counter
h, w, k = [int(s) for s in sys.stdin.readline().strip().split()]
s = [''] * h
for i in range(h):
s[i] = sys.stdin.readline().strip()
# h, w, k = 3, 5, 3
# s = [
# '11111',
# '11111',
# '11111'
# ]
# h, w, k = 10, 1000, 1
# s = ['11111111111111111... | [
"expression.operation.binary.remove"
] | 515,676 | 515,675 | u922965680 | python |
p02733 | import sys
input=lambda: sys.stdin.readline().rstrip()
h,w,k=map(int,input().split())
S=[input() for _ in range(h)]
ans=float("inf")
import bisect
for i in range(2**(h-1)):
Cut=[]
cur=0
for ii in range(h-1):
if i&(1<<ii):
Cut.append(ii)
p=len(Cut)+1
Num=[0]*h
for ii in range(h):
Num[ii]=bisect... | import sys
input=lambda: sys.stdin.readline().rstrip()
h,w,k=map(int,input().split())
S=[input() for _ in range(h)]
ans=float("inf")
import bisect
for i in range(2**(h-1)):
Cut=[]
cur=0
for ii in range(h-1):
if i&(1<<ii):
Cut.append(ii)
p=len(Cut)+1
Num=[0]*h
for ii in range(h):
Num[ii]=bisect... | [
"assignment.add",
"assignment.remove"
] | 515,829 | 515,830 | u969190727 | python |
p02734 | #!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return... | #!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return... | [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"expression.operation.binary.change"
] | 516,115 | 516,116 | u423585790 | python |
p02734 | import sys
def input():
return sys.stdin.readline()[:-1]
n, s = map(int, input().split())
a = list(map(int, input().split()))
MOD = 998244353
dp = [0 for _ in range(s+1)]
dp[0] = 1
ans = 0
for i in range(n):
for j in range(s, a[i]-1, -1):
dp[j] += dp[j-a[i]]
dp[j] %= MOD
dp[a[i]] += i
dp[a[i]] %= MOD
ans += dp... | import sys
def input():
return sys.stdin.readline()[:-1]
n, s = map(int, input().split())
a = list(map(int, input().split()))
MOD = 998244353
dp = [0 for _ in range(3001)]
dp[0] = 1
ans = 0
for i in range(n):
for j in range(s, a[i]-1, -1):
dp[j] += dp[j-a[i]]
dp[j] %= MOD
dp[a[i]] += i
dp[a[i]] %= MOD
ans += d... | [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"call.arguments.change",
"expression.operation.binary.change",
"control_flow.loop.range.bounds.upper.change",
"expression.operation.binary.remove"
] | 516,133 | 516,134 | u218843509 | python |
p02736 | import sys
import math
import heapq
mod=10**9+7
inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict, OrderedDict
#すべてのkeyが用意されてる defaultdict(int)で初期化
#順序を保ったdict
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Deci... | import sys
import math
import heapq
mod=10**9+7
inf=float("inf")
from math import sqrt, ceil
from collections import deque, Counter, defaultdict, OrderedDict
#すべてのkeyが用意されてる defaultdict(int)で初期化
#順序を保ったdict
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from decimal import ROUND_HALF_UP,Deci... | [] | 516,951 | 516,952 | u023229441 | python |
p02736 | N = int(input())
a = list(map(int,list(input())))
a = list(map(lambda x:x-1,a))
x = 0
num_mod = [0]*N
for i in range(1,N):
tmp = 0
while i%2==0:
i//=2
tmp+=1
num_mod[i] = num_mod[i-1]+tmp
for i,n in enumerate(a):
if n%2==0:
continue
else:
if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i]):
... | N = int(input())
a = list(map(int,list(input())))
a = list(map(lambda x:x-1,a))
x = 0
num_mod = [0]*N
for i in range(1,N):
tmp = 0
t = i
while t%2==0:
t//=2
tmp+=1
num_mod[i] = num_mod[i-1]+tmp
for i,n in enumerate(a):
if n%2==0:
continue
else:
if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i])... | [
"assignment.variable.change",
"identifier.change"
] | 517,127 | 517,128 | u268554510 | python |
p02736 | N = int(input())
a = list(map(int,list(input())))
a = list(map(lambda x:x-1,a))
x = 0
num_mod = [0]*N
for i in range(1,N):
tmp = 0
while i%2==0:
i//=2
tmp+=1
num_mod[i] = num_mod[i-1]+x
for i,n in enumerate(a):
if n%2==0:
continue
else:
if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i]):
x... | N = int(input())
a = list(map(int,list(input())))
a = list(map(lambda x:x-1,a))
x = 0
num_mod = [0]*N
for i in range(1,N):
tmp = 0
t = i
while t%2==0:
t//=2
tmp+=1
num_mod[i] = num_mod[i-1]+tmp
for i,n in enumerate(a):
if n%2==0:
continue
else:
if num_mod[N-1]==(num_mod[i]+num_mod[N-1-i])... | [
"assignment.variable.change",
"identifier.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 517,129 | 517,128 | u268554510 | python |
p02720 | from itertools import product
K = int(input())
ans = []
for l in range(10):
for s in range(1, 10):
for pattern in product([-1, 0, 1], repeat=l):
X = [s]
for p in pattern:
if not (0 <= X[-1] + p <= 9):
break
X.append(X[-1] + p)
... | from itertools import product
K = int(input())
ans = []
for l in range(10):
for s in range(1, 10):
for pattern in product([-1, 0, 1], repeat=l):
X = [s]
for p in pattern:
if not (0 <= X[-1] + p <= 9):
break
X.append(X[-1] + p)
... | [
"call.arguments.add",
"call.arguments.change"
] | 517,202 | 517,203 | u075012704 | python |
p02720 | #!/usr/bin/env python3
k = int(input())
a = []
for i in range(1, 10):
a.append(i)
while True:
if k <= len(a):
print(a[k - 1])
exit()
k -= len(a)
old = []
a, old = old, a
for x in old:
for i in range(-1, 2):
d = x % 10 + i
if d < 0 and d > 9:
... | #!/usr/bin/env python3
k = int(input())
a = []
for i in range(1, 10):
a.append(i)
while True:
if k <= len(a):
print(a[k - 1])
exit()
k -= len(a)
old = []
a, old = old, a
for x in old:
for i in range(-1, 2):
d = x % 10 + i
if d < 0 or d > 9:
... | [
"control_flow.branch.if.condition.change"
] | 517,210 | 517,211 | u536560967 | python |
p02720 | import math
import sys
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7
sys.setrecursionlimit(1000010)
K = ni()
if K <=9:
print(K)
u = []
dp... | import math
import sys
stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7
sys.setrecursionlimit(1000010)
K = ni()
if K <=9:
print(K)
exit(0... | [
"call.add"
] | 517,212 | 517,213 | u068692021 | python |
p02720 | k = int(input())
d = deque(list(range(1, 10)))
c = 0
v = 0
while c < k:
v = d.popleft()
c += 1
if v % 10 == 9:
d.append(v * 10 + 8)
d.append(v * 10 + 9)
elif v % 10 == 0:
d.append(v * 10)
d.append(v * 10 + 1)
else:
t = v % 10
d.append(v * 10 + t - 1)
... | from collections import deque
k = int(input())
d = deque(list(range(1, 10)))
c = 0
v = 0
while c < k:
v = d.popleft()
c += 1
if v % 10 == 9:
d.append(v * 10 + 8)
d.append(v * 10 + 9)
elif v % 10 == 0:
d.append(v * 10)
d.append(v * 10 + 1)
else:
t = v % 10
... | [] | 517,219 | 517,220 | u940743763 | python |
p02720 | # 2020/04/04
# AtCoder Beginner Contest 161 - D
runsu = list()
def makerunrun(s):
if int(s) > 3234566667:
return 0
runsu.append(int(s))
lketa = int(s[len(s)-1])
if lketa > 0:
wks = s + str(lketa - 1)
makerunrun(wks)
wks = s + str(lketa)
makerunrun(wks)
i... | # 2020/04/04
# AtCoder Beginner Contest 161 - D
runsu = list()
def makerunrun(s):
if int(s) > 3234566667:
return 0
runsu.append(int(s))
lketa = int(s[len(s)-1])
if lketa > 0:
wks = s + str(lketa - 1)
makerunrun(wks)
wks = s + str(lketa)
makerunrun(wks)
i... | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 517,237 | 517,238 | u981767024 | python |
p02720 | import collections
k=int(input())
if k<=9:
print(k)
else:
k-=9
l =list(range(9,0,-1))
print(l)
q = collections.deque(l)
counter=0
while counter<k:
x=q.pop()
xrem=x%10
if xrem!=0:
q.appendleft(10*x+xrem-1)
counter+=1
if counter>=k:
... | import collections
k=int(input())
if k<=9:
print(k)
else:
k-=9
l =list(range(9,0,-1))
#print(l)
q = collections.deque(l)
counter=0
while counter<k:
x=q.pop()
xrem=x%10
if xrem!=0:
q.appendleft(10*x+xrem-1)
counter+=1
if counter>=k:
... | [
"call.remove"
] | 517,243 | 517,244 | u927839462 | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.