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 |
|---|---|---|---|---|---|---|---|
p02629 | n=int(input())
c=""
while(n>0):
mod=n%26
if mod==0:
mod=26
c+=chr(96+mod)
n=n//26
print(c[::-1]) | n=int(input())
c=""
while(n>0):
mod=n%26
if mod==0:
mod=26
c+=chr(96+mod)
n=(n-mod)//26
print(c[::-1])
| [] | 342,464 | 342,465 | u567225946 | python |
p02629 | n = int(input())
alpha = 'abcdefghijklmnopqrstuvwxyz'
out = ''
while n != 0:
out = alpha[(n % 26) - 1] + out
n = int(n // 26)
print(out) | n = int(input())
alpha = 'abcdefghijklmnopqrstuvwxyz'
out = ''
while n != 0:
out = alpha[(n % 26) - 1] + out
n = int((n-1) // 26)
print(out) | [
"call.arguments.change"
] | 342,466 | 342,467 | u582759840 | python |
p02629 | import numpy as np
import math
def num2alpha(num):
if num<=26:
return chr(96+num)
elif num%26==0:
return num2alpha(num//26-1)+chr(90)
else:
return num2alpha(num//26)+chr(96+num%26)
N = int(input())
print(num2alpha(N)) | import numpy as np
import math
def num2alpha(num):
if num<=26:
return chr(96+num)
elif num%26==0:
return num2alpha(num//26-1)+chr(122)
else:
return num2alpha(num//26)+chr(96+num%26)
N = int(input())
print(num2alpha(N)) | [
"literal.number.integer.change",
"call.arguments.change",
"function.return_value.change",
"expression.operation.binary.change"
] | 342,474 | 342,475 | u005317312 | python |
p02629 | N = int(input())
name = []
while N>0:
name.append(chr(ord('a')+(N-1)%26))
N = N // 26
name.reverse()
print("".join(name)) | N = int(input())
name = []
while N>0:
name.append(chr(ord('a')+(N-1)%26))
N = (N - 1) // 26
name.reverse()
print("".join(name)) | [] | 342,476 | 342,477 | u118642796 | python |
p02629 | def num2alpha(num):
if num<=26:
return chr(96+num)
elif num%26==0:
return num2alpha(num//26-1)+chr(90)
else:
return num2alpha(num//26)+chr(96+num%26)
N=int(input())
ans=num2alpha(N)
print(ans) | def num2alpha(num):
if num<=26:
return chr(96+num)
elif num%26==0:
return num2alpha(num//26-1)+chr(122)
else:
return num2alpha(num//26)+chr(96+num%26)
N=int(input())
ans=num2alpha(N)
print(ans) | [
"literal.number.integer.change",
"call.arguments.change",
"function.return_value.change",
"expression.operation.binary.change"
] | 342,490 | 342,491 | u585963734 | python |
p02629 | ########関数部分##############
def num2alpha(num):
if num<=26:
return chr(64+num)
elif num%26==0:
return num2alpha(num//26-1)+chr(90)
else:
return num2alpha(num//26)+chr(64+num%26)
############################
import numpy as np
n = int(input())
print (n)
x = num2alpha(n).lower()
prin... | ########関数部分##############
def num2alpha(num):
if num<=26:
return chr(64+num)
elif num%26==0:
return num2alpha(num//26-1)+chr(90)
else:
return num2alpha(num//26)+chr(64+num%26)
############################
import numpy as np
n = int(input())
x = num2alpha(n).lower()
print (x) | [
"call.remove"
] | 342,498 | 342,499 | u573536767 | python |
p02629 | def main():
N = int(input())
n = N
ans = []
while n > 0:
remain = n % 26
ans.append(chr(ord('a') + remain - 1))
n //= 26
print(''.join(reversed(ans)))
main() | def main():
N = int(input())
n = N
ans = []
while n > 0:
n -= 1
remain = n % 26
ans.append(chr(ord('a') + remain))
n //= 26
print(''.join(reversed(ans)))
main() | [
"expression.operation.binary.remove"
] | 342,502 | 342,503 | u224346910 | python |
p02629 | n = int(input())
lis = []
while n != 0:
if n%26 == 0:
lis.append(int(0))
n /= 26
else:
lis.append(int(n%26))
n -= n%26
n /= 26
alp = ["z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y"]
st = ""
for i in range(len(lis),0... | n = int(input())
lis = []
while n != 0:
if n%26 == 0:
lis.append(int(0))
n -= 26
n /= 26
else:
lis.append(int(n%26))
n -= n%26
n /= 26
alp = ["z","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y"]
st = ""
for i in ... | [] | 342,512 | 342,513 | u176826399 | python |
p02629 | N=int(input())
ans=''
alp=list('abcdefghijklmnopqrstuvwxyz')
while N != 0:
N,mod=divmod(N,26)
ans=alp[mod-1]+ans
print(ans)
#27 -> aa 26 + 1
| N=int(input())
#N=1000000000000001
ans=''
alp=list('abcdefghijklmnopqrstuvwxyz')
while N != 0:
N,mod=divmod(N-1,26)
ans=alp[mod]+ans
print(ans)
#27 -> aa 26 + 1
| [
"expression.operation.binary.remove"
] | 342,514 | 342,515 | u696499790 | python |
p02629 | import sys
l = sys.stdin.readline().rstrip('\n').split(' ')
N = int(l[0])
digits = 1
while True:
ub = 26 ** digits
if N <= ub:
break
N -= ub
digits += 1
ans = ''
N -= 1
for pos in range(digits):
offset = N % 26
digit = chr(ord('a') + offset)
ans = digit + ans
N /= 26
print(... | import sys
... | [
"expression.operator.change"
] | 342,537 | 342,538 | u899782392 | python |
p02629 | import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue
# import numpy as np
sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353
... | import sys
# import re
import math
import collections
# import decimal
import bisect
import itertools
import fractions
# import functools
import copy
# import heapq
import decimal
# import statistics
import queue
# import numpy as np
sys.setrecursionlimit(10000001)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353
... | [
"literal.number.integer.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 342,543 | 342,544 | u888337853 | python |
p02629 | n=int(input())
t="abcdefghijklmnopqrstuvwxyz"
def f(n):
if n<=26:return t[n-1]
return f(n//26)+t[(n-1)%26]
print(f(n)) | n=int(input())
t="abcdefghijklmnopqrstuvwxyz"
def f(n):
if n<=26:return t[n-1]
return f((n-1)//26)+t[(n-1)%26]
print(f(n)) | [
"call.arguments.change",
"function.return_value.change"
] | 342,582 | 342,583 | u227082700 | python |
p02629 | N = int(input())
name = ''
while N != 0:
name = chr(ord('a') + (N-1) % 26)+name
N = N // 26
print(name)
| N = int(input())
name = ''
while N != 0:
name = chr(ord('a') + (N-1) % 26)+name
N = (N-1) // 26
print(name)
| [] | 342,584 | 342,585 | u893178798 | python |
p02629 | import string
k=list(string.ascii_lowercase)
n=int(input())
l=[]
while n>0:
l.append(n%26)
n=n//26
l.reverse()
x=""
for i in l:
x+=k[i-1]
print(x) | import string
k=list(string.ascii_lowercase)
n=int(input())
l=[]
while n>0:
l.append(n%26)
n=(n-1)//26
l.reverse()
x=""
for i in l:
x+=k[i-1]
print(x) | [] | 342,586 | 342,587 | u672542358 | python |
p02629 | import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
sys.setrecursionlimit(500... | import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
return sys.stdin.readline()[:-1]
def ruiseki(lst):
return [0]+list(accumulate(lst))
sys.setrecursionlimit(500... | [
"expression.operation.binary.remove"
] | 342,602 | 342,603 | u654470292 | python |
p02629 | n=int(input())
s=''
while n:
s=chr(96+n%26)+s
n//=26
print(s) | n=int(input())
s=''
while n:
n-=1
s=chr(97+n%26)+s
n//=26
print(s) | [
"literal.number.integer.change",
"assignment.value.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 342,616 | 342,617 | u133936772 | python |
p02629 | n=int(input())
s=''
while n:
n-=1
s=chr(97+total%26)+s
n//=26
print(s) | n=int(input())
s=''
while n:
n-=1
s=chr(97+n%26)+s
n//=26
print(s) | [
"assignment.value.change",
"identifier.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 342,631 | 342,632 | u440613652 | python |
p02629 | n=int(input())
s=''
while n:
n-=1
s=chr(65+n%26)+s
n//=26
print(s) | n=int(input())
s=''
while n:
n-=1
s=chr(97+n%26)+s
n//=26
print(s) | [
"literal.number.integer.change",
"assignment.value.change",
"call.arguments.change",
"expression.operation.binary.change"
] | 342,633 | 342,632 | u440613652 | python |
p02629 | A = input()
def num2alpha(num):
if num<=26:
return chr(64+num)
elif num%26==0:
return num2alpha(num//26-1)+chr(90)
else:
return num2alpha(num//26)+chr(64+num%26)
ans =num2alpha(int(A))
print(ans) | A = input()
def num2alpha(num):
if num<=26:
return chr(64+num)
elif num%26==0:
return num2alpha(num//26-1)+chr(90)
else:
return num2alpha(num//26)+chr(64+num%26)
ans =num2alpha(int(A))
print(ans.lower()) | [
"call.add",
"call.arguments.change"
] | 342,644 | 342,645 | u892006633 | python |
p02629 | N = int(input())
D = ["a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k", "l", "m", "n", "o",
"p", "q", "r", "s", "t", "u", "v", "w",
"x", "y", "z"]
A = []
while True:
T = (N-1) % 26
N = N // 26
A.append(D[T])
if N == 0:
break
A = reversed(A)
print("".join(A)) | N = int(input())
D = ["a", "b", "c", "d", "e", "f", "g",
"h", "i", "j", "k", "l", "m", "n", "o",
"p", "q", "r", "s", "t", "u", "v", "w",
"x", "y", "z"]
A = []
while True:
T = (N-1) % 26
N = (N-1) // 26
A.append(D[T])
if N == 0:
break
A = reversed(A)
print("".join(A)) | [] | 342,672 | 342,673 | u068944955 | python |
p02629 | # i番目は26 ^ i個
# i番目までの個数は 26 * (26 ^ i - 1) / 25
n = int(input())
_ = 96
# 桁数
ans = ''
while True:
a, b = divmod(n, 26)
#print(a, b)
if b == 0:
b = 26
ans += str(chr(b + _))
if a == 0:
break
n = a
print(ans[::-1]) | # i番目は26 ^ i個
# i番目までの個数は 26 * (26 ^ i - 1) / 25
n = int(input())
_ = 96
# 桁数
ans = ''
while True:
a, b = divmod(n, 26)
#print(a, b)
if b == 0:
b = 26
a -= 1
ans += str(chr(b + _))
if a == 0:
break
n = a
print(ans[::-1]) | [] | 342,720 | 342,721 | u470560351 | python |
p02629 | N = int(input())
a = ord('a')
M = 1000000000000001
ans = ''
while N != 0:
ans = chr(a + N % 26 - 1) + ans
N //= 26
print(ans)
| N = int(input())
a = ord('a')
M = 1000000000000001
ans = ''
while N != 0:
N -= 1
ans = chr(a + N % 26) + ans
N //= 26
print(ans)
| [
"expression.operation.binary.remove"
] | 342,722 | 342,723 | u644516473 | python |
p02629 | n=int(input())
def num2(num):
if num<=26:
return chr(num+64)
elif num%26==0:
return num2(num//26-1)+chr(90)
else:
return num2(num//26)+chr(64+num%26)
print(num2(n)) | n=int(input())
def num2(num):
if num<=26:
return chr(num+96)
elif num%26==0:
return num2(num//26-1)+chr(122)
else:
return num2(num//26)+chr(96+num%26)
print(num2(n)) | [
"literal.number.integer.change",
"call.arguments.change",
"function.return_value.change",
"expression.operation.binary.change"
] | 342,724 | 342,725 | u224119985 | python |
p02629 | aalphabets = [""] + [s for s in "abcdefghijklmnopqrstuvwxyz"]
s = int(input())
nums = []
while s > 0:
nums.append((s - 1) % 26 + 1)
s = (s - 1) // 26
res = ""
for _ in range(len(nums)):
res = res + alphabets[nums.pop()]
print(res) | alphabets = [""] + [s for s in "abcdefghijklmnopqrstuvwxyz"]
s = int(input())
nums = []
while s > 0:
nums.append((s - 1) % 26 + 1)
s = (s - 1) // 26
res = ""
for _ in range(len(nums)):
res = res + alphabets[nums.pop()]
print(res) | [
"assignment.variable.change",
"identifier.change"
] | 342,728 | 342,729 | u820087133 | python |
p02629 | n = int(input())
def numalpha(num):
if num <= 26:
return chr(96+ num)
elif num % 26 == 0:
return numalpha(num // 26-1) + chr(90)
else:
return numalpha(num//26) + chr(96 + num % 26)
print(numalpha(n))
| n = int(input())
def numalpha(num):
if num <= 26:
return chr(64+ num)
elif num % 26 == 0:
return numalpha(num // 26-1) + chr(90)
else:
return numalpha(num//26) + chr(64 + num % 26)
print(numalpha(n).lower())
| [
"literal.number.integer.change",
"call.arguments.change",
"function.return_value.change",
"expression.operation.binary.change",
"call.add"
] | 342,744 | 342,745 | u201382544 | python |
p02629 | n = int(input())
result = ""
while n > 0:
x = n%26
if x==0:
result = result+"w"
n -= 26
else:
result = result + chr(96+x)
n -= x
n //= 26
print(result[::-1]) | n = int(input())
result = ""
while n > 0:
x = n%26
if x==0:
result = result+"z"
n -= 26
else:
result = result + chr(96+x)
n -= x
n //= 26
print(result[::-1])
| [
"literal.string.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 342,748 | 342,749 | u413165887 | python |
p02629 | N=int(input())
#26真数
abc=list("abcdefghijklmnopqrstuvwxyz")
ans=""
while True:
ans=abc[N%26-1]+ans
if N<27:
break
N=N//26
print(ans) | N=int(input())
#26真数
abc=list("abcdefghijklmnopqrstuvwxyz")
ans=""
while True:
ans=abc[N%26-1]+ans
#print(ans,N)
if N<27:
break
N=(N-1)//26
print(ans) | [] | 342,756 | 342,757 | u784022244 | python |
p02629 | n=int(input())
ans = ""
while(n > 0):
ans += chr(ord("a")-1 + n%26)
n = n//26
print(ans[::-1]) | n=int(input())
ans = ""
while(n > 0):
n -= 1
ans += chr(ord("a") + n%26)
n = n//26
print(ans[::-1]) | [
"expression.operation.binary.remove"
] | 342,758 | 342,759 | u141410514 | python |
p02609 | def pc(x):
return format(x, 'b').count('1')
N = int(input())
X = input()
Xo = int(X, 2)
count = 0
ans = 0
ori = pc(Xo)
X = list(X)
Xp = Xo%(ori + 1)
if ori == 1:
Xm = 0
else:
Xm = Xo % (ori - 1)
# for i in range(N-1, -1, -1):
for i in range(N):
if ori == 1 and X[i] == '1':
print(0)
... | def pc(x):
return format(x, 'b').count('1')
N = int(input())
X = input()
Xo = int(X, 2)
count = 0
ans = 0
ori = pc(Xo)
X = list(X)
Xp = Xo%(ori + 1)
if ori == 1:
Xm = 0
else:
Xm = Xo % (ori - 1)
# for i in range(N-1, -1, -1):
for i in range(N):
if ori == 1 and X[i] == '1':
print(0)
... | [
"assignment.value.change",
"identifier.change",
"expression.operation.binary.change",
"literal.number.integer.change"
] | 342,800 | 342,801 | u039860745 | python |
p02609 | def pc(x):
return format(x, 'b').count('1')
N = int(input())
X = input()
Xo = int(X, 2)
count = 0
ans = 0
ori = pc(Xo)
X = list(X)
Xp = Xo%(ori + 1)
if ori == 1:
Xm = 0
else:
Xm = Xo % (ori - 1)
# for i in range(N-1, -1, -1):
for i in range(N):
if ori == 1 and X[i] == '1':
print(0)
... | def pc(x):
return format(x, 'b').count('1')
N = int(input())
X = input()
Xo = int(X, 2)
count = 0
ans = 0
ori = pc(Xo)
X = list(X)
Xp = Xo%(ori + 1)
if ori == 1:
Xm = 0
else:
Xm = Xo % (ori - 1)
# for i in range(N-1, -1, -1):
for i in range(N):
if ori == 1 and X[i] == '1':
print(0)
... | [] | 342,802 | 342,801 | u039860745 | python |
p02609 | def main():
N = int(input())
X = input()
def popcount(x):
'''xの立っているビット数をカウントする関数
(xは64bit整数)'''
# 2bitごとの組に分け、立っているビット数を2bitで表現する
x = x - ((x >> 1) & 0x5555555555555555)
# 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
x = (x & 0x3333333333333333) + ((x >> 2) & 0x... | def main():
N = int(input())
X = input()
def popcount(x):
'''xの立っているビット数をカウントする関数
(xは64bit整数)'''
# 2bitごとの組に分け、立っているビット数を2bitで表現する
x = x - ((x >> 1) & 0x5555555555555555)
# 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
x = (x & 0x3333333333333333) + ((x >> 2) & 0x... | [
"control_flow.branch.if.condition.change",
"literal.number.integer.change",
"call.arguments.change"
] | 342,811 | 342,812 | u707498674 | python |
p02609 | from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
###############################################################################\
def power(a,p,m):
if m==0:
return 0
res=1
wh... | from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math
###############################################################################\
def power(a,p,m):
if m==0:
return 0
res=1
wh... | [
"literal.number.integer.change",
"assignment.value.change"
] | 342,827 | 342,828 | u861075868 | python |
p02609 | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split()... | import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split()... | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 342,829 | 342,830 | u036104576 | python |
p02609 | def popcount(x):
return bin(x).count("1")
n=int(input())
s=input()
X=int(s,2)
one_cnt=popcount(X)
modp=X%(one_cnt+1)
modm=X%(one_cnt-1) if one_cnt-1!=0 else 0
for i in range(n):
if s[i]=="1":
if cnt==1:
print(0)
continue
else:
num=(modm-pow(2,n-i-1,one_c... | def popcount(x):
return bin(x).count("1")
n=int(input())
s=input()
X=int(s,2)
one_cnt=popcount(X)
modp=X%(one_cnt+1)
modm=X%(one_cnt-1) if one_cnt-1!=0 else 0
for i in range(n):
if s[i]=="1":
if one_cnt-1==0:
print(0)
continue
else:
num=(modm-pow(2,n-i-1,o... | [
"control_flow.loop.for.condition.change",
"control_flow.branch.if.condition.change"
] | 342,839 | 342,840 | u588794534 | python |
p02609 | def popcount(n):
return bin(n).count('1')
N=int(input())
X=input()
xl=list(X)
X=int(X,2)
a=popcount(X)
#1が減った時
if a==1:
xi=0
else:
xi=X%(a-1)
#1が増えたとき
xd=X%(a+1)
for i in range(N):
if xl[i]=='1':
if a==1:
print(0)
continue
else:
k=pow(2,N-1-i,a-1)
... | def popcount(n):
return bin(n).count('1')
N=int(input())
X=input()
xl=list(X)
X=int(X,2)
a=popcount(X)
#1が減った時
if a==1:
xd=0
else:
xd=X%(a-1)
#1が増えたとき
xi=X%(a+1)
for i in range(N):
if xl[i]=='1':
if a==1:
print(0)
continue
else:
k=pow(2,N-1-i,a-1... | [
"assignment.variable.change",
"identifier.change"
] | 342,869 | 342,870 | u547090345 | python |
p02609 | import sys
def input(): return sys.stdin.readline().strip()
n=int(input())
xs=input()
xj=xs.count("1")
x=int(xs,2)
xip=x%(xj+1)
if xj!=1:
xim=x%(xj-1)
#i1=1<<n
for i in range(n-1,-1,-1):
# i1=i1>>1
# xi=x^i1
# if xi==0:
# print(0)
# continue
if xs[n-1-i]=="0":
pxi=xj+1
# ... | import sys
def input(): return sys.stdin.readline().strip()
n=int(input())
xs=input()
xj=xs.count("1")
x=int(xs,2)
xip=x%(xj+1)
if xj!=1:
xim=x%(xj-1)
for i in range(n-1,-1,-1):
if xs[n-1-i]=="0":
pxi=xj+1
i2=pow(2,i,pxi)
xi=(xip+i2)%pxi
elif xj==1:
print(0)
contin... | [] | 342,875 | 342,876 | u576432509 | python |
p02609 | def func(z,c):
if c == 0:
z = 0
else:
z = z%c
a = bin(z)
b = 0
for i in range(len(a)):
if a[i] == "1":
b += 1
return z,b
n = int(input())
x = input()
c = 0
sw = 0
for i in range(n):
if x[i] == "1":
c += 1
s0 = int(x,2)%(c+1)
if c <= 1:
s1 = 0
... | def func(z,c):
if c == 0:
z = 0
else:
z = z%c
a = bin(z)
b = 0
for i in range(len(a)):
if a[i] == "1":
b += 1
return z,b
n = int(input())
x = input()
c = 0
for i in range(n):
if x[i] == "1":
c += 1
s0 = int(x,2)%(c+1)
if c <= 1:
s1 = 0
else:
... | [
"assignment.remove",
"assignment.add"
] | 342,902 | 342,903 | u614181788 | python |
p02609 | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_str():
return readline().strip()
def slv(N, X):
C = X.count... | # -*- coding: utf-8 -*-
import sys
# sys.setrecursionlimit(10**6)
# buff_readline = sys.stdin.buffer.readline
buff_readline = sys.stdin.readline
readline = sys.stdin.readline
INF = 2**62-1
def read_int():
return int(buff_readline())
def read_str():
return readline().strip()
def slv(N, X):
C = X.count... | [
"assignment.add"
] | 342,909 | 342,910 | u334712262 | python |
p02609 | import sys
sys.setrecursionlimit(10**6)
def f(n):
if n == 0:
return 1
p = n % (bin(n).count('1'))
return f(p) + 1
def main(input, print):
N = int(input())
X = list(map(int, list(input())))
ans = [0] * N
pcnt = 0
for i in range(N):
if X[i] == 1:
pcnt += 1
... | import sys
sys.setrecursionlimit(10**6)
def f(n):
if n == 0:
return 1
p = n % (bin(n).count('1'))
return f(p) + 1
def main(input, print):
N = int(input())
X = list(map(int, list(input().strip())))
ans = [0] * N
pcnt = 0
for i in range(N):
if X[i] == 1:
pc... | [
"call.add"
] | 342,915 | 342,916 | u927078824 | python |
p02609 | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def popcnt(n):
return bin(n).count("1")
def mod(n, cnt):
if n == 0:
return cnt
n = n % popcnt(n)
cnt += 1
return mod(n, cnt)
n = int(readline())
x2 = list(readline().deco... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def popcnt(n):
return bin(n).count("1")
def mod(n, cnt):
if n == 0:
return cnt
n = n % popcnt(n)
cnt += 1
return mod(n, cnt)
n = int(readline())
x2 = list(readline().deco... | [
"call.arguments.change",
"control_flow.continue.add"
] | 342,935 | 342,936 | u062484507 | python |
p02609 | n = int(input())
s = input()
x = int(s, 2)
p = s.count("1")
if p > 2:
pre0 = x%(p-1)
pre1 = x%(p+1)
nxt = [i for i in range(n+10)]
for i in range(1, n+10):
nxt[i] %= bin(i).count("1")
for i in range(n):
if x == 1<<(n-1-i):
print(0)
continue
if s[i] == "0":
tmp = (pre1 + pow(2, n-1-i, p+1)) % (p+1)
else:
... | n = int(input())
s = input()
x = int(s, 2)
p = s.count("1")
if p > 1:
pre0 = x%(p-1)
pre1 = x%(p+1)
nxt = [i for i in range(n+10)]
for i in range(1, n+10):
nxt[i] %= bin(i).count("1")
for i in range(n):
if x == 1<<(n-1-i):
print(0)
continue
if s[i] == "0":
tmp = (pre1 + pow(2, n-1-i, p+1)) % (p+1)
else:
... | [
"literal.number.integer.change",
"control_flow.branch.if.condition.change"
] | 342,955 | 342,956 | u218843509 | python |
p02630 | N = int(input())
A = list(map(int,input().split()))
Q = int(input())
cnt_dict = {}
s = sum(A)
ans = 0
for item in A:
if item not in cnt_dict:
cnt_dict[item] = 0
cnt_dict[item] += 1
for _ in range(Q):
X,Y = map(int,input().split())
if X not in cnt_dict:
cnt_dict[X] = 0
if Y not... | N = int(input())
A = list(map(int,input().split()))
Q = int(input())
cnt_dict = {}
s = sum(A)
ans = 0
for item in A:
if item not in cnt_dict:
cnt_dict[item] = 0
cnt_dict[item] += 1
for _ in range(Q):
X,Y = map(int,input().split())
if X not in cnt_dict:
cnt_dict[X] = 0
if Y not... | [
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change",
"assignment.variable.change"
] | 342,996 | 342,997 | u907865484 | python |
p02630 | import collections
n = int(input())
arr = list(map(int,input().split()))
cnt = collections.defaultdict(int)
for val in arr:
cnt[val] += 1
sums = sum(arr)
q = int(input())
for _ in range(q):
b, c = map(int,input().split())
diff = (c-b)*(cnt[b])
sums += diff
print(sums)
cnt[c] += nt[b]
cnt[b] ... | import collections
n = int(input())
arr = list(map(int,input().split()))
cnt = collections.defaultdict(int)
for val in arr:
cnt[val] += 1
sums = sum(arr)
q = int(input())
for _ in range(q):
b, c = map(int,input().split())
diff = (c-b)*(cnt[b])
sums += diff
print(sums)
cnt[c] += cnt[b]
cnt[b]... | [
"identifier.change"
] | 342,998 | 342,999 | u465652095 | python |
p02630 | N = int(input())
As = list(map(int, input().split()))
Q = int(input())
sumAs = 0
dictAs = [0] * 100000
for i in range(len(As)):
sumAs += As[i]
dictAs[As[i] - 1] = 1
for _ in range(Q):
b, c = map(int, input().split())
sumAs += dictAs[b - 1] * (c - b)
dictAs[c - 1] += dictAs[b - 1]
dictAs[b - 1] = 0
pri... | N = int(input())
As = list(map(int, input().split()))
Q = int(input())
sumAs = 0
dictAs = [0] * 100000
for i in range(len(As)):
sumAs += As[i]
dictAs[As[i] - 1] += 1
for _ in range(Q):
b, c = map(int, input().split())
sumAs += dictAs[b - 1] * (c - b)
dictAs[c - 1] += dictAs[b - 1]
dictAs[b - 1] = 0
pr... | [
"assignment.value.change"
] | 343,008 | 343,009 | u617384447 | python |
p02630 | N = int(input())
As = list(map(int, input().split()))
Q = int(input())
sumAs = 0
dictAs = [0] * 1E5
for i in range(len(As)):
sumAs += As[i]
dictAs[As[i] - 1] = 1
for _ in range(Q):
b, c = map(int, input().split())
sumAs += dictAs[b - 1] * (c - b)
dictAs[c - 1] += dictAs[b - 1]
dictAs[b - 1] = 0
print(... | N = int(input())
As = list(map(int, input().split()))
Q = int(input())
sumAs = 0
dictAs = [0] * 100000
for i in range(len(As)):
sumAs += As[i]
dictAs[As[i] - 1] += 1
for _ in range(Q):
b, c = map(int, input().split())
sumAs += dictAs[b - 1] * (c - b)
dictAs[c - 1] += dictAs[b - 1]
dictAs[b - 1] = 0
pr... | [
"assignment.value.change",
"expression.operation.binary.change"
] | 343,010 | 343,009 | u617384447 | python |
p02630 | n = int(input())
a = list(map(int, input().split()))
q = int(input())
sums = sum(a)
d = {}
for i in a:
if i in d:
d[i] += 1
else:
d[i] = 1
for i in range(q):
b,c = map(int, input().split())
if b in d:
sums += d[b]*(c-b)
if c in d:
d[c] += d[b]
else:
d[c]... | n = int(input())
a = list(map(int, input().split()))
q = int(input())
sums = sum(a)
d = {}
for i in a:
if i in d:
d[i] += 1
else:
d[i] = 1
for i in range(q):
b,c = map(int, input().split())
if b in d:
sums += d[b]*(c-b)
if c in d:
d[c] += d[b]
else:
d[c]... | [
"assignment.add"
] | 343,060 | 343,061 | u981418135 | python |
p02630 | from collections import Counter
n = int(input())
a = list(map(int,input().split()))
q = int(input())
C = Counter(a)
s = sum(a)
for _ in range(q):
b,c = map(int,input().split())
s = s - b*C[b] + c*C[c]
C[c] += C[b]
C[b] = 0
print(s) | from collections import Counter
n = int(input())
a = list(map(int,input().split()))
q = int(input())
C = Counter(a)
s = sum(a)
for _ in range(q):
b,c = map(int,input().split())
s = s - b*C[b] + c*C[b]
C[c] += C[b]
C[b] = 0
print(s) | [
"assignment.value.change",
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 343,076 | 343,077 | u570155187 | python |
p02630 | N = int(input())
A = list(map(int, input().split()))
Q = int(input())
sum_res = sum(A)
counter = [0 for _ in range(10 ** 5 + 1)]
for a in A:
counter[a] += 1
for _ in range(Q):
B, C = map(int, input().split())
sum_res = sum_res - (counter[B] * B)
sum_res = sum_res + (counter[B] * C)
counter[C] = co... | N = int(input())
A = list(map(int, input().split()))
Q = int(input())
sum_res = sum(A)
counter = [0 for _ in range(10 ** 5 + 1)]
for a in A:
counter[a] += 1
for _ in range(Q):
B, C = map(int, input().split())
sum_res = sum_res - (counter[B] * B)
sum_res = sum_res + (counter[B] * C)
counter[C] += c... | [
"assignment.value.change"
] | 343,094 | 343,095 | u326278153 | python |
p02630 | def freq(my_list):
count = {}
for i in my_list:
count[i] = count.get(i, 0) + 1
return count
n = int(input())
l = list(map(int, input().split()))
s,f = sum(l), freq(l)
for _ in range(int(input())):
x, y = map(int, input().split())
if x in f:
v = f[x]
if y in f: f[y]+=v
... | def freq(my_list):
count = {}
for i in my_list:
count[i] = count.get(i, 0) + 1
return count
n = int(input())
l = list(map(int, input().split()))
s,f = sum(l), freq(l)
for _ in range(int(input())):
x, y = map(int, input().split())
if x in f:
v = f[x]
if y in f:
... | [
"call.add"
] | 343,159 | 343,160 | u112247039 | python |
p02630 | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = ... | class UnionFind():
def __init__(self, n):
self.n = n
self.parents = [-1] * n
def find(self, x):
if self.parents[x] < 0:
return x
else:
self.parents[x] = self.find(self.parents[x])
return self.parents[x]
def union(self, x, y):
x = ... | [
"call.add"
] | 343,238 | 343,239 | u493520238 | python |
p02630 | n=int(input())
a = list(map(int,input().split()))
q=int(input())
bc = [list(map(int, input().split())) for l in range(q)]
cnt=[0]*100001
Sum=0
for i in range(n):
cnt[a[i]]+=1
Sum+=a[i]
for i in range(q):
Sum+=(bc[i][1]-bc[i][0])*cnt[bc[i][1]]
cnt[bc[i][1]]+=cnt[bc[i][0]]
cnt[bc[i][0... | n=int(input())
a = list(map(int,input().split()))
q=int(input())
bc = [list(map(int, input().split())) for l in range(q)]
cnt=[0]*100001
Sum=0
for i in range(n):
cnt[a[i]]+=1
Sum+=a[i]
for i in range(q):
Sum+=(bc[i][1]-bc[i][0])*cnt[bc[i][0]]
cnt[bc[i][1]]+=cnt[bc[i][0]]
cnt[bc[i][0... | [
"literal.number.integer.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 343,246 | 343,245 | u430726059 | python |
p02630 | n=int(input())
a = list(map(int,input().split()))
q=int(input())
bc = [list(map(int, input().split())) for l in range(q)]
cnt=[0]*(n+1)
Sum=0
for i in range(n):
cnt[a[i]]+=1
Sum+=a[i]
for i in range(q):
Sum+=(bc[i][1]-bc[i][0])*cnt[bc[i][1]]
cnt[bc[i][1]]+=cnt[bc[i][0]]
cnt[bc[i][0]... | n=int(input())
a = list(map(int,input().split()))
q=int(input())
bc = [list(map(int, input().split())) for l in range(q)]
cnt=[0]*100001
Sum=0
for i in range(n):
cnt[a[i]]+=1
Sum+=a[i]
for i in range(q):
Sum+=(bc[i][1]-bc[i][0])*cnt[bc[i][0]]
cnt[bc[i][1]]+=cnt[bc[i][0]]
cnt[bc[i][0... | [
"assignment.value.change",
"expression.operation.binary.change",
"literal.number.integer.change",
"variable_access.subscript.index.change"
] | 343,247 | 343,245 | u430726059 | python |
p02630 | import math
import sys
import collections
import bisect
readline = sys.stdin.readline
def main():
n = int(readline().rstrip())
A = list(map(int, readline().rstrip().split()))
counter = collections.Counter(A)
q = int(readline().rstrip())
BCList = [list(map(int, readline().rstrip().split())) for _ i... | import math
import sys
import collections
import bisect
readline = sys.stdin.readline
def main():
n = int(readline().rstrip())
A = list(map(int, readline().rstrip().split()))
counter = collections.Counter(A)
q = int(readline().rstrip())
BCList = [list(map(int, readline().rstrip().split())) for _ i... | [
"call.add"
] | 343,253 | 343,254 | u395202850 | python |
p02630 | from collections import Counter
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
counter = Counter(A)
sum_res = sum(A)
for _ in range(Q):
bf,af = map(int,input().split())
sum_res -= bf*counter[bf]
sum_res += af*counter[af]
counter[af] += counter[bf]
counter[bf] = 0
... | from collections import Counter
N = int(input())
A = list(map(int,input().split()))
Q = int(input())
counter = Counter(A)
sum_res = sum(A)
#print(sum_res,counter)
for _ in range(Q):
bf,af = map(int,input().split())
sum_res -= bf*counter[bf]
sum_res += af*counter[bf]
counter[af] += counter[bf]
... | [
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 343,255 | 343,256 | u137228327 | python |
p02630 | n=int(input())
a=list(map(int,input().split()))
q=int(input())
dic = {}
ans = 0
for x in a:
if x not in dic:
dic[x] = 1
else:
dic[x]+=1
ans += x
for _ in range(q):
b,c=map(int,input().split())
if b not in dic:continue
ans += (c-b)*dic[b]
if c not in dic:
dic[c] = d... | n=int(input())
a=list(map(int,input().split()))
q=int(input())
dic = {}
ans = 0
for x in a:
if x not in dic:
dic[x] = 1
else:
dic[x]+=1
ans += x
for _ in range(q):
b,c=map(int,input().split())
if b not in dic:
print(ans)
continue
ans += (c-b)*dic[b]
if c no... | [
"call.add"
] | 343,260 | 343,261 | u566529875 | python |
p02626 | n = int(input())
l = list(map(int,input().split()))
x = 0
s = l[0]+l[1]
for i in l[2:]:
x ^= i
if x > s or (s-x)%2 or ((s-x)//2)&x:
print(-1)
exit()
a = (s-x)//2
if a > l[0]:
print(-1)
for i in range(50,-1,-1):
if 1<<i & x:
if a+ (1<<i) <= l[0]:
a += 1<<i
if a == 0:
print(-1... | n = int(input())
l = list(map(int,input().split()))
x = 0
s = l[0]+l[1]
for i in l[2:]:
x ^= i
if x > s or (s-x)%2 or ((s-x)//2)&x:
print(-1)
exit()
a = (s-x)//2
if a > l[0]:
print(-1)
exit()
for i in range(50,-1,-1):
if 1<<i & x:
if a+ (1<<i) <= l[0]:
a += 1<<i
if a == 0:
... | [
"call.add"
] | 343,397 | 343,398 | u368796742 | python |
p02626 | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
def solve():
n = ni()
f, s, *a = nm()
x = 0... | import sys
readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')
def solve():
n = ni()
f, s, *a = nm()
x = 0... | [
"expression.operator.compare.change",
"control_flow.branch.if.condition.change"
] | 343,473 | 343,474 | u543954314 | python |
p02630 | n = int(input())
a =list(map(int,input().split()))
s =sum(a)
x = [0]*100001
for i in a:
x[i] += 1
q = int(input())
for i in range(q):
b,c = map(int,input().split())
s -= b*x[b]
s += c*x[c]
x[c] += x[b]
x[b] = 0
print(s) | n =int(input())
a = list(map(int,input().split()))
s = sum(a)
x = [0]*1000001
for i in a:
x[i] +=1
q = int(input())
for i in range(q):
b,c = map(int,input().split())
s -= b*x[b]
s += c*x[b]
x[c] += x[b]
x[b] = 0
print(s) | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 343,587 | 343,588 | u175590965 | python |
p02630 | n = int(input())
a =list(map(int,input().split()))
s =sum(a)
x = [0]*100001
for i in a:
x[i] += 1
q = int(input())
for i in range(q):
b,c = map(int,input().split())
s -= b*x[b]
s += c*x[c]
x[c] += x[b]
x[b] = 0
print(s) | n = int(input())
a =list(map(int,input().split()))
s =sum(a)
x = [0]*1000001
for i in a:
x[i] += 1
q = int(input())
for i in range(q):
b,c = map(int,input().split())
s -= b*x[b]
s += c*x[b]
x[c] += x[b]
x[b] = 0
print(s) | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 343,587 | 343,590 | u175590965 | python |
p02630 | n = int(input())
a =list(map(int,input().split()))
s =sum(a)
x = [0]*100001
for i in a:
x[i] += 1
q = int(input())
for i in range(q):
b,c = map(int(input().split()))
s -= b*x[b]
s += c*x[c]
x[c] += x[b]
x[b] = 0
print(s) | n = int(input())
a =list(map(int,input().split()))
s =sum(a)
x = [0]*1000001
for i in a:
x[i] += 1
q = int(input())
for i in range(q):
b,c = map(int,input().split())
s -= b*x[b]
s += c*x[b]
x[c] += x[b]
x[b] = 0
print(s) | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 343,589 | 343,590 | u175590965 | python |
p02630 | import sys
import time
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
import bisect
from operator import itemgetter
MAX_INT = int(10e18)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): ret... | import sys
import time
import math
from collections import deque
import heapq
import itertools
from decimal import Decimal
import bisect
from operator import itemgetter
MAX_INT = int(10e18)
MIN_INT = -MAX_INT
mod = 1000000000+7
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): ret... | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 343,641 | 343,642 | u634461820 | python |
p02630 | N = int(input())
A = list(map(int, input().split(' ')))
Q = int(input())
BC = [list(map(int, list(input().split(' ')))) for i in range(Q)]
count = [0] * 10**5 + 5
for i in range(N):
count[A[i]] += 1
s = sum(A)
for i in range(Q):
s = s - BC[i][0] * count[BC[i][0]] + BC[i][1] * count[BC[i][0]]
count[BC[i][1... | N = int(input())
A = list(map(int, input().split(' ')))
Q = int(input())
BC = [list(map(int, list(input().split(' ')))) for i in range(Q)]
count = [0] * (10**5 + 5)
for i in range(N):
count[A[i]] += 1
s = sum(A)
for i in range(Q):
s = s - BC[i][0] * count[BC[i][0]] + BC[i][1] * count[BC[i][0]]
count[BC[i]... | [] | 343,643 | 343,644 | u661764795 | python |
p02630 | import sys
import time
import math
st = time.perf_counter()
def inpl():
return list(map(int, input().split()))
# ------------------------------
N = int(input())
nl = [0] * 10101
ls = inpl()
ans = 0
for i in ls:
nl[i] += 1
ans += i
M = int(input())
for _ in range(M):
a, b = map(int, input().split())
ans = ans -... | import sys
import time
import math
st = time.perf_counter()
def inpl():
return list(map(int, input().split()))
# ------------------------------
N = int(input())
nl = [0] * 100100
ls = inpl()
ans = 0
for i in ls:
nl[i] += 1
ans += i
M = int(input())
for _ in range(M):
a, b = map(int, input().split())
ans = ans ... | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 343,682 | 343,681 | u242580186 | python |
p02630 | import collections
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
s = sum(A)
c = collections.Counter(A)
for _ in range(Q):
B, C = map(int, input().split())
s += (C-B)*c[B]
c[C] += c[B]
c[B] += c[C]
print(s) | import collections
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
s = sum(A)
c = collections.Counter(A)
for _ in range(Q):
B, C = map(int, input().split())
s += (C-B)*c[B]
c[C] += c[B]
c[B] = 0
print(s) | [] | 343,683 | 343,684 | u211109468 | python |
p02630 | import sys
input_data = []
input_pointer = 0
output_data = []
def input_scan():
global input_data
input_data = sys.stdin.readlines()
input_data = [x[:-1] for x in input_data]
def next_line():
global input_pointer
global input_data
if input_pointer < len(input_data):
input_pointer += ... | import sys
input_data = []
input_pointer = 0
output_data = []
def input_scan():
global input_data
input_data = sys.stdin.readlines()
input_data = [x[:-1] for x in input_data]
def next_line():
global input_pointer
global input_data
if input_pointer < len(input_data):
input_pointer += ... | [
"assignment.add"
] | 343,695 | 343,696 | u581142892 | python |
p02630 | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
AC = Counter(A)
S = sum(A)
Q = int(input())
for _ in range(Q):
B,C = map(int, input().split())
if B not in AC:
pass
else:
count = AC[B]
S = S + (C-B)*count
if C in AC:
AC[C] += count
else:
AC[C] = ... | from collections import Counter
N = int(input())
A = list(map(int, input().split()))
AC = Counter(A)
S = sum(A)
Q = int(input())
for _ in range(Q):
B,C = map(int, input().split())
if B not in AC:
pass
else:
count = AC[B]
AC[B] = 0
S = S + (C-B)*count
if C in AC:
AC[C] += count
else:
... | [
"assignment.add"
] | 343,726 | 343,727 | u457901067 | python |
p02630 | N = int(input())
numbers = list(map(int,input().split()))
numOfOperation = int(input())
dic = {}
for num in numbers:
if num in dic : dic[num] += 1
else: dic[num] = 1
sums = sum(numbers)
for i in range(numOfOperation):
B,C = map(int,input().split())
if (B in dic) :
cnt = dic[B]
di... | N = int(input())
numbers = list(map(int,input().split()))
numOfOperation = int(input())
dic = {}
for num in numbers:
if num in dic : dic[num] += 1
else: dic[num] = 1
sums = sum(numbers)
for i in range(numOfOperation):
B,C = map(int,input().split())
if (B in dic) :
cnt = dic[B]
di... | [
"assignment.value.change",
"identifier.replace.add",
"literal.replace.remove"
] | 343,736 | 343,737 | u035044350 | python |
p02630 | n = int(input())
m=list(map(int,input().split()))
d={}
k=0
for i in range(n):
k+=m[i]
if m[i] in d:
d[m[i]]+=1
else:
d[m[i]]=1
for x in range(int(input())):
b,c=list(map(int,input().split()))
k+=d[b]*(c-b)
if c in d:
d[c]+=d[b]
else:
d[c] = d[b]
... | n = int(input())
m=list(map(int,input().split()))
d={}
k=0
for i in range(n):
k+=m[i]
if m[i] in d:
d[m[i]]+=1
else:
d[m[i]]=1
for x in range(int(input())):
b,c=list(map(int,input().split()))
if b in d:
k+=d[b]*(c-b)
if c in d:
d[c]+=d[b]
... | [
"control_flow.branch.if.add"
] | 343,757 | 343,758 | u769694158 | python |
p02630 | # Problem D - Replacing
# input
N = int(input())
a_nums = list(map(int, input().split()))
Q = int(input())
# initialization
nums = [0] * (10**5 + 1)
cur_sum = sum(a_nums)
for a in a_nums:
nums[a] += 1
# count
for i in range(Q):
b, c = map(int, input().split())
b_count = nums[b]
cur_sum = cur_sum - b_... | # Problem D - Replacing
# input
N = int(input())
a_nums = list(map(int, input().split()))
Q = int(input())
# initialization
nums = [0] * (10**5 + 1)
cur_sum = sum(a_nums)
for a in a_nums:
nums[a] += 1
# count
for i in range(Q):
b, c = map(int, input().split())
b_count = nums[b]
cur_sum = cur_sum - b_... | [
"assignment.add"
] | 343,777 | 343,778 | u368249389 | python |
p02630 | input()
arr = [int(num) for num in input().strip().split(' ')]
q = int(input())
queries = []
for i in range(q):
query = [ int(num) for num in input().strip().split(' ')]
queries.append(query)
nums = dict()
summ = 0
for number in arr:
summ += number
if number not in nums:
nums[number] = 1
... | input()
arr = [int(num) for num in input().strip().split(' ')]
q = int(input())
queries = []
for i in range(q):
query = [ int(num) for num in input().strip().split(' ')]
queries.append(query)
nums = dict()
summ = 0
for number in arr:
summ += number
if number not in nums:
nums[number] = 1
... | [
"call.add"
] | 343,792 | 343,793 | u447551479 | python |
p02630 | from collections import Counter
import numpy as np
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
ans = sum(A)
A = Counter(A)
bc = [tuple(map(int, input().split())) for i in range(Q)]
for b, c in bc:
v = A.pop(b, None)
if v:
A[c] += v
ans = ans+((c-b)*v)
print(ans)
| from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
ans = sum(A)
A = Counter(A)
bc = [tuple(map(int, input().split())) for i in range(Q)]
for b, c in bc:
v = A.pop(b, None)
if v:
A[c] += v
ans = ans+((c-b)*v)
print(ans)
| [] | 343,809 | 343,810 | u188138642 | python |
p02630 | n = int(input())
a = list(map(int,input().split()))
ans = sum(a)
#print(ans)
q = int(input())
import collections
cc = collections.Counter(a)
#print(cc)
for i in range(q):
b,c = map(int,input().split())
tmp = cc[b]
cc[b] = 0
s=s-b*tmp+c*tmp
cc[c]+=tmp
print(s) | n = int(input())
a = list(map(int,input().split()))
s = sum(a)
#print(ans)
q = int(input())
import collections
cc = collections.Counter(a)
#print(cc)
for i in range(q):
b,c = map(int,input().split())
tmp = cc[b]
cc[b] = 0
s=s-b*tmp+c*tmp
cc[c]+=tmp
print(s) | [
"assignment.variable.change",
"identifier.change"
] | 343,818 | 343,819 | u351480677 | python |
p02630 | n = int(input())
a = list(map(int,input().split()))
ans = sum(a)
#print(ans)
q = int(input())
import collections
cc = collections.Counter(a)
print(cc)
for i in range(q):
b,c = map(int,input().split())
tmp = cc[b]
cc[b] = 0
s=s-b*tmp+c*tmp
cc[c]+=tmp
print(s) | n = int(input())
a = list(map(int,input().split()))
s = sum(a)
#print(ans)
q = int(input())
import collections
cc = collections.Counter(a)
#print(cc)
for i in range(q):
b,c = map(int,input().split())
tmp = cc[b]
cc[b] = 0
s=s-b*tmp+c*tmp
cc[c]+=tmp
print(s) | [
"assignment.variable.change",
"identifier.change",
"call.remove"
] | 343,820 | 343,819 | u351480677 | python |
p02630 | import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy
def main()... | import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt
from copy import deepcopy
def main()... | [
"assignment.change"
] | 343,860 | 343,861 | u928758473 | python |
p02630 |
import collections
def main():
n = int(input())
a = list(map(int, input().split()))
cnt = collections.defaultdict(int)
for var in a:
cnt[var] += 1
sum_a = sum[a]
q = int(input())
for _ in range(q):
b, c = list(map(int, input().split()))
diff = (c-b) *... | import collections
def main():
n = int(input())
a = list(map(int, input().split()))
cnt = collections.defaultdict(int)
for var in a:
cnt[var] += 1
sum_a = sum(a)
q = int(input())
for _ in range(q):
b, c = list(map(int, input().split()))
diff = (c-b) * ... | [
"assignment.value.change"
] | 343,869 | 343,870 | u497277272 | python |
p02630 | from collections import Counter
def Replacing():
Num = int(input())
value_A = list(map(int,input().split()))
Sum = sum(value_A)
Counter_value = Counter(value_A)
NumB = int(input())
for i in range(NumB):
value_B = list(map(int,input().split()))
Sum += (value_B[1] - value_B[... | from collections import Counter
def Replacing():
Num = int(input())
value_A = list(map(int,input().split()))
Sum = sum(value_A)
Counter_value = Counter(value_A)
NumB = int(input())
for i in range(NumB):
value_B = list(map(int,input().split()))
Sum += (value_B[1] - value_B[... | [
"call.arguments.change",
"expression.operation.binary.change"
] | 343,890 | 343,891 | u075317232 | python |
p02630 | n=int(input())
a_list=list(map(int,input().split()))
cnt = [0] * int(1e5 + 10)
sum=0
for i in a_list:
cnt[i] +=1
sum+=i
q=int(input())
ans=0
for j in range(q):
x,y=map(int,input().split())
sum+=(y-x)*cnt[x]
cnt[y]+=cnt[x]
cnt[y]=0
print(sum) | n=int(input())
a_list=list(map(int,input().split()))
cnt = [0] * int(1e5 + 10)
sum=0
for i in a_list:
cnt[i] +=1
sum+=i
q=int(input())
ans=0
for j in range(q):
x,y=map(int,input().split())
sum+=(y-x)*cnt[x]
cnt[y]+=cnt[x]
cnt[x]=0
print(sum) | [
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 343,892 | 343,893 | u944886577 | python |
p02630 | n=int(input())
a_list=list(map(int,input().split()))
cnt = [0] * int(1e5 + 10)
sum=0
for i in a_list:
cnt[i] +=1
sum+=i
q=int(input())
ans=0
for j in range(q):
x,y=map(int,input().split())
sum+=(y-x)*cnt[x]
cnt[x]+=cnt[y]
cnt[y]=0
print(sum) | n=int(input())
a_list=list(map(int,input().split()))
cnt = [0] * int(1e5 + 10)
sum=0
for i in a_list:
cnt[i] +=1
sum+=i
q=int(input())
ans=0
for j in range(q):
x,y=map(int,input().split())
sum+=(y-x)*cnt[x]
cnt[y]+=cnt[x]
cnt[x]=0
print(sum) | [
"assignment.variable.change",
"identifier.change",
"variable_access.subscript.index.change"
] | 343,894 | 343,893 | u944886577 | python |
p02630 | n=int(input())
#a,b=map(int,input().split())
al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
q=int(input())
dic={}
for a in al:
dic[a]=dic.get(a,0)+1
total=sum(al)
ansl=[]
for i in range(q):
b,c=map(int,input().split())
b_num=dic.get(b,0)
total=total+b_num*(c-b)
... | n=int(input())
#a,b=map(int,input().split())
al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
q=int(input())
dic={}
for a in al:
dic[a]=dic.get(a,0)+1
total=sum(al)
ansl=[]
for i in range(q):
b,c=map(int,input().split())
b_num=dic.get(b,0)
total=total+b_num*(c-b)
... | [
"assignment.add"
] | 343,898 | 343,899 | u200887663 | python |
p02630 | def main():
N, *X = map(int, open(0).read().split())
A = X[:N]
Q = X[N]
s = sum(A)
B = {}
for a in A:
if a not in B:
B[a] = 0
B[a] += 1
ans = []
for i in range(Q):
b, c = X[N + 1 + 2*i], X[N + 1 + 2*i + 1]
if b in B:
num = B[b]
... | def main():
N, *X = map(int, open(0).read().split())
A = X[:N]
Q = X[N]
s = sum(A)
B = {}
for a in A:
if a not in B:
B[a] = 0
B[a] += 1
ans = []
for i in range(Q):
b, c = X[N + 1 + 2*i], X[N + 1 + 2*i + 1]
if b in B:
num = B[b]
... | [
"assignment.add"
] | 343,902 | 343,903 | u838644735 | python |
p02630 | n = int(input())
a = list(map(int, input().split()))
q = int(input())
bckt = [0]*(n+1)
for i in a:
bckt[i] += 1
s = sum(a)
for i in range(q):
b, c = map(int, input().split())
q = bckt[b]
bckt[c] += q
bckt[b] -= q
s += (c*q - b*q)
print(s)
| n = int(input())
a = list(map(int, input().split()))
q = int(input())
bckt = [0]*(int(1e5)+1)
for i in a:
bckt[i] += 1
s = sum(a)
for i in range(q):
b, c = map(int, input().split())
q = bckt[b]
bckt[c] += q
bckt[b] -= q
s += (c*q - b*q)
print(s)
| [
"assignment.value.change",
"expression.operation.binary.change",
"call.arguments.add"
] | 343,910 | 343,911 | u033178473 | python |
p02630 | n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = [0] * q
c = [0] * q
ans = sum(a)
number = [0] * 100000
for i in range(q):
b[i],c[i] = map(int,input().split())
for i in range(n):
number[a[i]] += 1
for i in range(q):
if number[b[i]] > 0:
ans += (c[i] - b[i]) * number[b[i]]
... | n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = [0] * q
c = [0] * q
ans = sum(a)
number = [0] * 100001
for i in range(q):
b[i],c[i] = map(int,input().split())
for i in range(n):
number[a[i]] += 1
for i in range(q):
if number[b[i]] > 0:
ans += (c[i] - b[i]) * number[b[i]]
... | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change"
] | 343,942 | 343,943 | u798093965 | python |
p02630 | # ans
N = int(input())
A = list(map(int, input().split()))
cnt = [0] * 100000
for i in range(N):
cnt[i] += 1
Q = int(input())
S = sum(A)
for i in range(Q):
B, C = map(int, input().split())
diff = (C - B) * cnt[B]
S += diff
print(S)
cnt[C] += cnt[B]
cnt[B] = 0 | # ans
N = int(input())
A = list(map(int, input().split()))
cnt = [0] * 100001
for i in A:
cnt[i] += 1
Q = int(input())
S = sum(A)
for i in range(Q):
B, C = map(int, input().split())
diff = (C - B) * cnt[B]
S += diff
print(S)
cnt[C] += cnt[B]
cnt[B] = 0 | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change",
"control_flow.loop.range.bounds.upper.change",
"call.arguments.change"
] | 343,961 | 343,960 | u766566560 | python |
p02630 | # ans
N = int(input())
A = list(map(int, input().split()))
cnt = [0] * 100000
for i in range(A):
cnt[i] += 1
Q = int(input())
S = sum(A)
for i in range(Q):
B, C = map(int, input().split())
diff = (C - B) * cnt[B]
S += diff
print(S)
cnt[C] += cnt[B]
cnt[B] = 0 | # ans
N = int(input())
A = list(map(int, input().split()))
cnt = [0] * 100001
for i in A:
cnt[i] += 1
Q = int(input())
S = sum(A)
for i in range(Q):
B, C = map(int, input().split())
diff = (C - B) * cnt[B]
S += diff
print(S)
cnt[C] += cnt[B]
cnt[B] = 0 | [
"literal.number.integer.change",
"assignment.value.change",
"expression.operation.binary.change",
"call.remove",
"call.arguments.change"
] | 343,962 | 343,960 | u766566560 | python |
p02630 | #D more faster method than above see it ..........
l = lambda : list(map(int,input().split().strip()))
n = int(input())
a = l
t = [0]*(10**5+1)
s = 0
for i in a:
s += i
t[i] += 1
q = int(input())
for _ in range(q):
b,c = l
s += (c-b)*t[b]
t[c] += t[b]
t[b] = 0
p... | #D more faster method than above see it ..........
l = lambda : list(map(int,input().strip().split()))
n = int(input())
a = l()
t = [0]*(10**5+1)
s = 0
for i in a:
s += i
t[i] += 1
q = int(input())
for _ in range(q):
b,c = l()
s += (c-b)*t[b]
t[c] += t[b]
t[b] = 0
... | [
"assignment.value.change",
"identifier.change",
"call.arguments.change",
"call.add"
] | 343,982 | 343,983 | u617953889 | python |
p02630 |
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
nizi = [0] * (10)
for i in range(len(A)):
# print(A[i], A)
nizi[A[i]] += 1
sumall = sum(A)
for q in range(Q):
# print(nizi)
B, C = map(int, input().split())
sumall += (C-B) * nizi[B]
nizi[C] += nizi[B]
nizi[B] = 0
pr... |
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
nizi = [0] * (10**5+1)
for i in range(len(A)):
# print(A[i], A)
nizi[A[i]] += 1
sumall = sum(A)
for q in range(Q):
# print(nizi)
B, C = map(int, input().split())
sumall += (C-B) * nizi[B]
nizi[C] += nizi[B]
nizi[B] = 0
... | [
"assignment.change"
] | 343,995 | 343,994 | u788608806 | python |
p02630 |
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
nizi = [0] * (10**5)
for i in range(len(A)):
# print(A[i], A)
nizi[A[i]] += 1
sumall = sum(A)
for q in range(Q):
B, C = map(int, input().split())
sumall += (C-B) * nizi[B]
nizi[C] =+ nizi[B]
nizi[B] = 0
print(sumall) |
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
nizi = [0] * (10**5+1)
for i in range(len(A)):
# print(A[i], A)
nizi[A[i]] += 1
sumall = sum(A)
for q in range(Q):
# print(nizi)
B, C = map(int, input().split())
sumall += (C-B) * nizi[B]
nizi[C] += nizi[B]
nizi[B] = 0
... | [
"assignment.value.change",
"expression.operation.unary.arithmetic.remove"
] | 343,996 | 343,994 | u788608806 | python |
p02630 |
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
nizi = [0] * (max(A)+1)
for i in range(len(A)):
# print(A[i], A)
nizi[A[i]] += 1
sumall = sum(A)
for q in range(Q):
B, C = map(int, input().split())
sumall += (C-B) * nizi[B]
nizi[C] =+ nizi[B]
nizi[B] = 0
print(sumall) |
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
nizi = [0] * (10**5+1)
for i in range(len(A)):
# print(A[i], A)
nizi[A[i]] += 1
sumall = sum(A)
for q in range(Q):
# print(nizi)
B, C = map(int, input().split())
sumall += (C-B) * nizi[B]
nizi[C] += nizi[B]
nizi[B] = 0
... | [
"call.arguments.change",
"assignment.value.change",
"expression.operation.unary.arithmetic.remove"
] | 343,997 | 343,994 | u788608806 | python |
p02630 | sum=0
dic={}
n=int(input())
lis=input()
lis=lis.split(' ')
def con(a,b):
if b in dic:
dic[b]=dic[b]+dic[a]
else:
dic[b]=dic[a]
for i in lis:
sum=sum+int(i)
if int(i) in dic:
dic[int(i)]=dic[int(i)]+1
else:
dic[int(i)]=1
#print(dic)
#print(sum)
q=int(input())
for i in ... | sum=0
dic={}
n=int(input())
lis=input()
lis=lis.split(' ')
def con(a,b):
if b in dic:
dic[b]=dic[b]+dic[a]
else:
dic[b]=dic[a]
del dic[a]
for i in lis:
sum=sum+int(i)
if int(i) in dic:
dic[int(i)]=dic[int(i)]+1
else:
dic[int(i)]=1
#print(dic)
#print(sum)
q=int(inp... | [] | 344,034 | 344,035 | u964410291 | python |
p02630 | N = int(input())
A = list(map(int, input().split()))
B = [0]*(N+1)
for n in range(N):
B[n+1] = B[n] + A[n]
C = B.pop()
Z = {}
for n in range(N):
Z[A[n]] = 0
for n in range(N):
Z[A[n]] += 1
D = []
Q = int(input())
for q in range(Q):
x, y = map(int, input().split())
if x in Z:
C = C - x*Z[x]... | N = int(input())
A = list(map(int, input().split()))
B = [0]*(N+1)
for n in range(N):
B[n+1] = B[n] + A[n]
C = B.pop()
Z = {}
for n in range(N):
Z[A[n]] = 0
for n in range(N):
Z[A[n]] += 1
D = []
Q = int(input())
for q in range(Q):
x, y = map(int, input().split())
if x in Z:
C = C - x*Z[x]... | [
"expression.operation.binary.add"
] | 344,041 | 344,042 | u718949306 | python |
p02630 | N = int(input())
a = list(map(int,input().split()))
q = int(input())
num = []
summ = 0
for i in range(10**5):
num.append(0)
for i in range(N):
num[a[i]-1] += 1
summ += a[i]
for i in range(q):
b,c = map(int,input().split())
summ += (c-b)*a[b-1]
a[c-1] += a[b-1]
a[b-1] = 0
print(summ)
| N = int(input())
a = list(map(int,input().split()))
q = int(input())
num = []
summ = 0
for i in range(10**5):
num.append(0)
for i in range(N):
num[a[i]-1] += 1
summ += a[i]
for i in range(q):
b,c = map(int,input().split())
summ += (c-b)*num[b-1]
num[c-1] += num[b-1]
num[b-1] = 0
print(summ)
| [
"identifier.change",
"expression.operation.binary.change",
"assignment.variable.change"
] | 344,065 | 344,066 | u655048024 | python |
p02630 | n=int(input())
a=list(map(int,input().split()))
q=int(input())
d=dict()
for i in a:
if i not in d:
d[i]=1
else:
d[i]+=1
ans=sum(a)
for i in range(q):
b,c=map(int,input().split())
if b not in d:
continue
if c not in d:
d[c]=0
d[c]+=d[b]
ans+=(c-b)*d[b]
prin... | n=int(input())
a=list(map(int,input().split()))
q=int(input())
d=dict()
for i in a:
if i not in d:
d[i]=1
else:
d[i]+=1
ans=sum(a)
for i in range(q):
b,c=map(int,input().split())
if b not in d:
d[b]=0
if c not in d:
d[c]=0
d[c]+=d[b]
ans+=(c-b)*d[b]
print(... | [
"assignment.variable.change"
] | 344,088 | 344,089 | u723583932 | python |
p02630 | N=int(input())
A=list(map(int,input().split()))
Q=int(input())
D=dict()
s=0
for i in A:
s+=i
if i in D:
D[i]+=1
else:
D[i]=1
for _ in range(Q):
b,c=map(int,input().split())
if b in D:
s+=(c-b)*D[b]
if c in D:
D[c]+=D[b]
else:
D[c]=D[b]
print(s) | N=int(input())
A=list(map(int,input().split()))
Q=int(input())
D=dict()
s=0
for i in A:
s+=i
if i in D:
D[i]+=1
else:
D[i]=1
for _ in range(Q):
b,c=map(int,input().split())
if b in D:
s+=(c-b)*D[b]
if c in D:
D[c]+=D[b]
else:
D[c]=D[b]
del D[b]
print(s) | [] | 344,129 | 344,130 | u571281863 | python |
p02630 | n = int(input())
a = list(map(int, input().split()))
q = int(input())
s = [list(map(int, input().split())) for i in range(q)]
ans = sum(a)
from collections import Counter
cnt = Counter(a)
for i, j in s:
if j in cnt:
cnt[j] += cnt[i]
else:
cnt[j] = cnt[i]
ans = ans - i * cnt[i... | n = int(input())
a = list(map(int, input().split()))
q = int(input())
s = [list(map(int, input().split())) for i in range(q)]
ans = sum(a)
from collections import Counter
cnt = Counter(a)
for i, j in s:
if j in cnt:
cnt[j] += cnt[i]
else:
cnt[j] = cnt[i]
ans = ans - i * cnt[i] + cnt[i... | [
"control_flow.branch.if.add"
] | 344,219 | 344,220 | u038408819 | python |
p02630 | n = int(input())
a = list(map(int, input().split()))
q = int(input())
from collections import Counter
dict_a = Counter(a)
s = sum(a)
for i in range(q):
b, c = map(int, input().split())
s -= b*dict_a[b]
s += c*dict_a[c]
dict_a[c] += dict_a[b]
dict_a[b] = 0
print(s)
| n = int(input())
a = list(map(int, input().split()))
q = int(input())
from collections import Counter
dict_a = Counter(a)
s = sum(a)
for i in range(q):
b, c = map(int, input().split())
s -= b*dict_a[b]
s += c*dict_a[b]
dict_a[c] += dict_a[b]
dict_a[b] = 0
print(s)
| [
"identifier.change",
"variable_access.subscript.index.change",
"expression.operation.binary.change"
] | 344,229 | 344,230 | u791110052 | python |
p02630 | from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
D = defaultdict(int)
for a in A:
D[a] += 1
Q = int(input())
SUM = sum(A)
for q in range(Q):
b, c = map(int, input().split())
SUM -= D[b] * b
SUM += D[b] * c
D[c] += D[b]
print(SUM)
| from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
D = defaultdict(int)
for a in A:
D[a] += 1
Q = int(input())
SUM = sum(A)
for q in range(Q):
b, c = map(int, input().split())
SUM -= D[b] * b
SUM += D[b] * c
D[c] += D[b]
D[b] = 0
print(SUM)
| [
"assignment.add"
] | 344,233 | 344,234 | u075012704 | python |
p02630 | n = int(input())
a = list(map(int,input().split()))
dist = [0]*max(a)
ans = sum(a)
for i in a:
dist[i-1] += 1
q = int(input())
for i in range(q):
b,c = map(int,input().split())
if dist[b-1] != 0:
dist[c-1] += dist[b-1]
ans += dist[b-1] * (c-b)
dist[b-1] = 0
print(ans) | n = int(input())
a = list(map(int,input().split()))
dist = [0]*100000
ans = sum(a)
for i in a:
dist[i-1] += 1
q = int(input())
for i in range(q):
b,c = map(int,input().split())
if dist[b-1] != 0:
dist[c-1] += dist[b-1]
ans += dist[b-1] * (c-b)
dist[b-1] = 0
print(ans)
| [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"expression.operation.binary.change",
"call.arguments.change"
] | 344,292 | 344,293 | u740284863 | python |
p02630 | n = int(input())
a = list(map(int,input().split()))
dist = [0]*max(a)
ans = sum(a)
for i in a:
dist[i-1] += 1
q = int(input())
for i in range(q):
b,c = map(int,input().split())
if dist[b-1] != 0:
dist[c-1] += dist[b-1]
ans += dist[b-1] * (c-b)
dist[b-1] = 0
print(ans) | n = int(input())
a = list(map(int,input().split()))
dist = [0]*100000
ans = sum(a)
for i in a:
dist[i-1] += 1
q = int(input())
for i in range(q):
b,c = map(int,input().split())
if dist[b-1] != 0:
dist[c-1] += dist[b-1]
ans += dist[b-1] * (c-b)
dist[b-1] = 0
print(ans) | [
"assignment.value.change",
"identifier.replace.remove",
"literal.replace.add",
"expression.operation.binary.change",
"call.arguments.change"
] | 344,292 | 344,294 | u740284863 | python |
p02630 | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
q = int(input())
cnt = Counter(a)
s = sum(cnt)
for i in range(q):
b, c = map(int, input().split())
s = s - b*cnt[b]
s = s + c*cnt[b]
cnt[c] += cnt[b]
cnt[b] = 0
print(s) | from collections import Counter
n = int(input())
a = list(map(int, input().split()))
q = int(input())
cnt = Counter(a)
s = sum(a)
for i in range(q):
b, c = map(int, input().split())
s = s - b*cnt[b]
s = s + c*cnt[b]
cnt[c] += cnt[b]
cnt[b] = 0
print(s) | [
"assignment.value.change",
"identifier.change",
"call.arguments.change"
] | 344,303 | 344,304 | u003644389 | python |
p02630 | n = int(input())
a = list(map(int,input().split()))
b = {}
for x in a:
try:
if b[x]:
b[x] += 1
except:
b[x] = 1
#print(b)
ans = sum(a)
q = int(input())
for _ in range(q):
x,y = map(int,input().split())
try:
if b[x] != -1:
bx = b[x]
b[x] = 0
except:
#print(b)
print(ans)
... | n = int(input())
a = list(map(int,input().split()))
b = {}
for x in a:
try:
if b[x]:
b[x] += 1
except:
b[x] = 1
#print(b)
ans = sum(a)
q = int(input())
for _ in range(q):
x,y = map(int,input().split())
try:
if b[x] != -1:
bx = b[x]
b[x] = 0
except:
#print(b)
print(ans)
... | [
"control_flow.branch.if.condition.change",
"control_flow.loop.for.condition.change"
] | 344,333 | 344,334 | u111365362 | python |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.