ZhenlongDai/ACPR huggingface dataset:
Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
t, a = map(int, input().split(' '))
H = list(map(int, input().split(' ')))

ret = []
for i, h in enumerate(H):
    ret.append(abs(a - (t - 0.006 * h)))
print(H[ret.index(min(ret))])

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
1000


Fixed submission (verdict: Accepted):
n = int(input())
t, a = map(int, input().split(' '))
H = list(map(int, input().split(' ')))

ret = []
for i, h in enumerate(H):
    ret.append(abs(a - (t - 0.006 * h)))
print(ret.index(min(ret)) + 1)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
T, A = [int(i) for i in input().split(" ")]
temp = [T-0.006*int(h) for h in input().split(" ")]

place = 0
diff_min = abs(temp[0]-A)

for cnt, t in enumerate(temp):
  if abs(A-t) < diff_min:
    diff_min = abs(A-t)
    place = cnt

print(place)
  

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
0


Fixed submission (verdict: Accepted):
N = int(input())
T, A = [int(i) for i in input().split(" ")]
temp = [T-0.006*int(h) for h in input().split(" ")]

place = 1
diff_min = abs(temp[0]-A)

for cnt, t in enumerate(temp,1):
  if abs(A-t) < diff_min:
    diff_min = abs(A-t)
    place = cnt

print(place)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from operator import itemgetter
N = int(input())
T, A = map(int, input().split())
*H, = map(int, input().split())
avg = sorted([[i+1, abs(T - (h * 0.006))] for i, h in enumerate(H)], key=itemgetter(1))
print(avg[0][0])

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
2


Fixed submission (verdict: Accepted):
from operator import itemgetter
N = int(input())
T, A = map(int, input().split())
*H, = map(int, input().split())
avg = sorted([[i+1, abs(T - (h * 0.006) - A)] for i, h in enumerate(H)], key=itemgetter(1))
print(avg[0][0])

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
t,a=map(int,input().split())
ln=[abs(a-(t-0.006*int(x))) for x in input().split()]
print(ln.index(min(ln)))

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
0


Fixed submission (verdict: Accepted):
n=int(input())
t,a=map(int,input().split())
ln=[int(x) for x in input().split()]
ans=[abs(t-0.006*x-a)  for x in ln]
print(ans.index(min(ans))+1)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
before=math.fabs(t-h[0]*0.006-a)
num=1
for i in range(n-1):
    diff=before-math.fabs(t-h[i+1]*0.006-a)
    print(diff)
    if diff>0:
        before=math.fabs(t-h[i+1]*0.006-a)
        num=i+1
print(num)

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
-4.0
1


Fixed submission (verdict: Accepted):
import math
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
before=math.fabs(t-h[0]*0.006-a)
num=1
for i in range(n-1):
  diff=before-math.fabs(t-h[i+1]*0.006-a)
  if diff>0:
    before=math.fabs(t-h[i+1]*0.006-a)
    num=i+2
print(num)
Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))

h = [  abs(a - (t - i*.006)) for i in h]

mins = h[0]
index = 0
print(h)
for i in range(1, n):
  if h[i] < mins:
    mins = h[i]
    index = i
    
print((index+1))

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
[1.0, 5.0]
1


Fixed submission (verdict: Accepted):
n = int(input())
t, a = list(map(int, input().split()))
h = list(map(int, input().split()))

h = [  abs(a - (t - i*.006)) for i in h]

mins = h[0]
index = 0
for i in range(1, n):
  if h[i] < mins:
    mins = h[i]
    index = i
    
print((index+1))

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
T, A = [int(i) for i in input().split()]

diff_min = 999999999
diff_i = 0
H = [int(i) for i in input().split()]
for i, n in enumerate(H):
    diff = A - (T - 0.006*n)
    if diff < diff_min:
        diff = diff_min
        diff_i = i + 1

print(diff_i)


Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
2


Fixed submission (verdict: Accepted):
import math

N = int(input())
T, A = [int(i) for i in input().split()]

diff_min = 999999999
diff_i = 0
H = [int(i) for i in input().split()]
for i, n in enumerate(H):
    diff = math.fabs(A - (T - 0.006*n))
    if diff < diff_min:
        diff_min = diff
        diff_i = i + 1

print(diff_i)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
n = int(stdin.readline().rstrip())
t, a = [int(x) for x in stdin.readline().rstrip().split()]
hs = [int(x) for x in stdin.readline().rstrip().split()]
answers=[t-h*0.006 for h in hs]
ansers=[abs(an-a)for an in answers]
print(min(answers))

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
0.0


Fixed submission (verdict: Accepted):
from sys import stdin
n = int(stdin.readline().rstrip())
t, a = [int(x) for x in stdin.readline().rstrip().split()]
hs = [int(x) for x in stdin.readline().rstrip().split()]

answers=[t-h*0.006 for h in hs]

answers=[abs(an-a) for an in answers]

print(answers.index(min(answers))+1)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
T, A = map(int, input().split())
Hs = list(map(int, input().split()))

Ts = list(map(lambda x: T-x * 0.006, Hs))

i = 0
v = None
for _i, _T in enumerate(Ts):
    print(v)    
    if v is None or abs(_T-T) < v:
        v = abs(_T-T)
        i = _i

print(i+1)

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
None
6.0
1


Fixed submission (verdict: Accepted):
N = int(input())
T, A = map(int, input().split())
Hs = list(map(int, input().split()))

Ts = list(map(lambda x: T-x * 0.006, Hs))

i = 0
v = None
for _i, _T in enumerate(Ts):
    if v is None or abs(_T-A) < v:
        v = abs(_T-A)
        i = _i

print(i+1)
Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = input()
T, A = input().split()
targets = input().split()

result = 0
min = 0

for i, target in enumerate(targets):
  temp = int(int(T) - int(target) * 0.006)
  temp2 = abs(int(A) - int(temp))
  print(int(A))
  print(temp)
  print(temp2)
  if i == 0:
    result = i + 1
    min = temp2
  elif temp2 < min :
    result = i +1 
    min = temp2
  
print(result)


Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
5
6
1
5
0
5
1


Fixed submission (verdict: Accepted):
N = input()
T, A = map(int, input().split())
targets = list(map(int, input().split()))
 
result = 0
min = 0
 
for i, target in enumerate(targets):
  temp = T - target * 0.006 
  if i == 0:
    result = i + 1
    min = abs( A - temp )
  elif abs( A - temp ) < min :
    result = i +1 
    min = abs( A - temp )
 
print(result)

Problem: p03220
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
s=input().split()
t=int(s[0])
a=int(s[1])
s=input().split()
best=100000000000000000
res=-1
for i in range(n):
    h=int(s[i])
    if best>abs(t-h*0.006):
        best=abs(a-t+h*0.006)
        res=i+1
print(res)

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
2


Fixed submission (verdict: Accepted):
n=int(input())
s=input().split()
t=int(s[0])
a=int(s[1])
s=input().split()
best=100000000000000000
res=-1
for i in range(n):
    h=int(s[i])
    if best>abs(a-t+h*0.006):
        best=abs(a-t+h*0.006)
        res=i+1
print(res)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
h=list(map(lambda x:t-x*0.006-a,h))
print(h.index(min(h))+1)


Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
2


Fixed submission (verdict: Accepted):
n=int(input())
t,a=map(int,input().split())
h=list(map(int,input().split()))
h=list(map(lambda x:t-x*0.006,h))
tmp=[abs(i-a) for i in h]
print(tmp.index(min(tmp))+1)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
t,a = map(int,input().split())
h_list = list(map(int,input().split()))

temp_list = [abs((t-h*0.006)-a) for h in h_list]
print(temp_list)
ans = temp_list.index(min(temp_list))+1

print(ans)

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
[1.0, 5.0]
1


Fixed submission (verdict: Accepted):
n = int(input())
t,a = map(int,input().split())
h_list = list(map(int,input().split()))

temp_list = [abs((t-h*0.006)-a) for h in h_list]
ans = temp_list.index(min(temp_list))+1

print(ans)
Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
T, A = [int(x) for x in input().split(" ")]
H_list = [int(x) for x in input().split(" ")]

ave_list = [T - (H * 0.006) for H in H_list]

res_point = 0
res_ave = 99999

print(ave_list)
for enu, ave in enumerate(ave_list):
    if abs(res_ave - A) > abs(ave - A):
        res_ave = ave
        res_point = enu + 1
print(res_point)


Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
[6.0, 0.0]
1


Fixed submission (verdict: Accepted):
N = int(input())
T, A = [int(x) for x in input().split(" ")]
H_list = [int(x) for x in input().split(" ")]

ave_list = [T - (H * 0.006) for H in H_list]

res_point = 0
res_ave = 99999

for enu, ave in enumerate(ave_list):
    if abs(res_ave - A) > abs(ave - A):
        res_ave = ave
        res_point = enu + 1
print(res_point)

Problem: p03220
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
T,A=map(float,input().split())
H=list(map(float,input().split()))
d=[]
for i in H:
  d.append(abs(T-i*0.006))
print(d.index(min(d))+1)

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
2


Fixed submission (verdict: Accepted):
N=int(input())
T,A=map(float,input().split())
H=list(map(float,input().split()))
d=[]
for i in H:
  d.append(abs(A-(T-i*0.006)))
print(d.index(min(d))+1)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
t, a  = map(int, input().split())
h = list(map(int, input().split()))
diff = [0]*n

for i in range(n):
  diff[i] = abs(a - t + h[i]*0.006)
  print(diff[i])
  
print(diff.index(min(diff))+1)

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
1.0
5.0
1


Fixed submission (verdict: Accepted):
n = int(input())
t, a  = map(int, input().split())
h = list(map(int, input().split()))
diff = [0]*n

for i in range(n):
  diff[i] = abs(a - t + h[i]*0.006)
  
print(diff.index(min(diff))+1)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
dtmin=10**6
ans=-1
for i in range(N):
  dt=abs(A-(T-0.006*H[i]))
  if(dt<dtmin):ans=i+1
    
print(ans)

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
2


Fixed submission (verdict: Accepted):
N=int(input())
T,A=map(int,input().split())
H=list(map(int,input().split()))
dtmin=10**6
ans=-1
for i in range(N):
  dt=abs(A-(T-0.006*H[i]))
  if(dt<dtmin):
    ans=i+1
    dtmin=dt
    
print(ans)
Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())

t,a = map(int,input().split())

h = list(map(int,input().split()))

print(n,t,a,h)
t_2 = (t-a)/0.006

res = -1000

for m in range(n):
  num_ = abs(t_2 - h[m])
  if m == 0:
    res = num_
    res_2 = m + 1
  elif res > num_:
    res_2 = m + 1
print(res_2)

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
2 12 5 [1000, 2000]
1


Fixed submission (verdict: Accepted):
n = int(input())

t,a = map(int,input().split())

h = list(map(int,input().split()))

t_2 = (t-a)/0.006
res = 1000000

for m in range(n):
  num_ = abs(t_2 - h[m])
  if res > num_:
    res = num_
    res_2 = m + 1
print(res_2)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
t, a = map(int, input().split())
temp = 10 ** 6
ans = 0
height = list(map(int, input().split()))
for i, h in enumerate(height):
    diff = abs(a - (t - h * 0.006))
    print(diff)
    if temp > diff:
        temp = diff
        ans = i + 1
print(ans)

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
1.0
5.0
1


Fixed submission (verdict: Accepted):
n = int(input())
t, a = map(int, input().split())
temp = 10 ** 6
ans = 0
height = list(map(int, input().split()))
for i, h in enumerate(height):
    diff = abs(a - (t - h * 0.006))
    if temp > diff:
        temp = diff
        ans = i + 1
print(ans)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
ans = 0
temp1 = t - h[0] * 0.006
for i in range(1,n):
    temp2 = t - h[i] * 0.006
    if abs(temp1-a) > abs(temp2-a):
        ans = i
        temp1 = temp2
print(ans)

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
t,a = map(int,input().split())
h = list(map(int,input().split()))
ans = 1
temp1 = t - h[0] * 0.006
for i in range(1,n):
    temp2 = t - h[i] * 0.006
    if abs(temp1-a) > abs(temp2-a):
        ans = i + 1
        temp1 = temp2
print(ans)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
tmp = 10 ** 10
for i in range(N):
    if tmp > abs(T - H[i]*0.006):
        tmp = abs(T - H[i]*0.006)
        res = i
print(res+1)
    

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
tmp = 10 ** 10
for i in range(N):
    if tmp > abs(A - T + H[i]*0.006):
        tmp = abs(A - T + H[i]*0.006)
        res = i
print(res+1)
Problem: p03220
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
t, a = map(int, input().split())
h = list(map(float, input().split()))

dt = 10000000
ans = 0
for i in range(len(h)):
    print(i)
    tmp = float(t) - 0.006 * h[i]
    if dt > abs( a - tmp ):
        dt = abs( a - tmp )
        ans = i + 1

print(ans)


Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
0
1
1


Fixed submission (verdict: Accepted):
n = int(input())
t, a = map(int, input().split())
h = list(map(float, input().split()))

dt = 10000000
ans = 0
for i in range(len(h)):
    tmp = float(t) - 0.006 * h[i]
    if dt > abs( a - tmp ):
        dt = abs( a - tmp )
        ans = i + 1

print(ans)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

mini = 0
min = float('inf')

for i in range(len(H)):
    if min > abs(A - (T - 0.006 * H[i])):
        mini = i + 1

print(mini)


Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

mini = 0
min = float('inf')

for i in range(len(H)):
    if min > abs(A - (T - 0.006 * H[i])):
        min = abs(A - (T - 0.006 * H[i]))
        mini = i + 1

print(mini)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
T,A=map(int,input().split())
H=list(map(int, input().split()))

B=abs(A)*9999999
X=0
for i in range(N):
  if B>abs((T-H[i]*0.006)-A):
    X=i+1
    B=min(abs((T-H[i]*0.006)-A),B)
  print(B)

print(X)

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
1.0
1.0
1


Fixed submission (verdict: Accepted):
N=int(input())
T,A=map(int,input().split())
H=list(map(int, input().split()))

B=999999999999999
X=0
for i in range(N):
  if B>abs((T-H[i]*0.006)-A):
    X=i+1
    B=min(abs((T-H[i]*0.006)-A),B)

print(X)

Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
t, a = map(int,input().split())
min = 10000

h = list(map(int, (input().split())))

for i in range(n):
    print(a-(t-h[i]*0.006))
    if(min > a - (t - h[i]*0.006)):
        min = a - (t - h[i]*0.006)
        ans = i+1

print(ans)     

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
-1.0
5.0
1


Fixed submission (verdict: Accepted):
n = int(input())
t, a = map(int,input().split())

h = list(map(int, (input().split())))
min = abs(a - (t - h[0]*0.006))
ans = 1

for i in range(1, n):
    if (min > abs(a - (t - h[i]*0.006))):
        min = abs(a - (t - h[i]*0.006))
        ans = i+1

print(ans)
Problem: p03220
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
T,A=map(int,input().split())
H=[int(i) for i in input().split()]
ans=0
que=T-H[0]
for i in range(1,N):
    temp=T-0.006*H[i]
    if abs(A-que)>abs(A-temp):
        que=temp
        ans=i
print(ans+1)

Failing test case input:
2
12 5
1000 2000

Expected output:
1

Actual output:
2


Fixed submission (verdict: Accepted):
N=int(input())
T,A=map(int,input().split())
H=[int(i) for i in input().split()]
ans=0
que=T-0.006*H[0]
for i in range(1,N):
    temp=T-0.006*H[i]
    if abs(A-que)>abs(A-temp):
        que=temp
        ans=i
print(ans+1)
Problem: p02432
Buggy submission (Python3, verdict: Wrong Answer):
cnt = int(input())
a = []
for i in range(cnt):
    li = list(map(int,input().split()))
    if li[0] == 0:
        if li[1] == 0:
            a.insert(0,li[2])
        else:
            a.insert(-1,li[2])
    if li[0] == 1:
        print(a[li[1]])
    if li[0] ==2:
        if li[1]==0:
            a.pop(0)
        else:
            a.pop(-1)


Failing test case input:
11
0 0 1
0 0 2
0 2 6
1 0
1 1
1 1
2 0
2 1
0 0 2
1 0
1 1

Expected output:
2
1
1
2
1


Actual output:
2
6
6
2
6


Fixed submission (verdict: Accepted):
from collections import deque
cnt = int(input())
a = deque()

for i in range(cnt):
    li = list(map(int,input().split()))
    if li[0] == 0:
        if li[1] == 0:
            a.appendleft(li[2])
        else:
            a.append(li[2])
    if li[0] == 1:
        print(a[li[1]])
    if li[0] ==2:
        if li[1]==0:
            a.popleft()
        else:
            a.pop()

Problem: p02432
Buggy submission (Python3, verdict: Wrong Answer):
q = int(input())
a = []
end = 0
for i in range(q):
    ops= list(map(int,input().split()))
    if ops[0] == 0:
        end += 1
        if ops[1] == 0:
            a.insert(0,ops[2])
        else:
            a.insert(end,ops[2])
    elif ops[0] == 1:
        print(a[ops[1]])
    elif ops[0] == 2:
        end -= 1
        if ops[1] == 0:
            a.pop(0)


Failing test case input:
11
0 1 1
0 0 2
0 1 3
1 1
1 1
1 0
2 0
2 1
0 1 0
1 0
1 1

Expected output:
1
1
2
1
0


Actual output:
1
1
2
1
3


Fixed submission (verdict: Accepted):



q = int(input())
a = [0 for _ in range(8000000)]
start = 4000000
end = 4000001
for i in range(q):
    ops = list(map(int,input().split()))
    if ops[0] == 0:
        if ops[1] == 0:
            a[start] = ops[2]
            start -= 1
        else:
            a[end] = ops[2]
            end += 1
    elif ops[0] == 1:
        print(a[start+ops[1]+1])
    elif ops[0] == 2:
        if ops[1] == 0:
            start += 1
        elif ops[1] == 1:
            end -= 1

Problem: p02432
Buggy submission (Python3, verdict: Wrong Answer):
cnt = int(input())
a = []
for i in range(cnt):
    li = list(map(int,input().split()))
    if li[0] == 0:
        if li[1] == 0:
            a.insert(0,li[2])
        else:
            a.insert(-1,li[2])
    if li[0] == 1:
        print(a[li[1]])
    if li[0] ==2:
        if li[1]==0:
            a.pop(0)
        else:
            a.pop()


Failing test case input:
11
0 0 1
0 0 0
0 1 3
1 1
1 1
1 0
2 1
2 1
0 0 3
1 0
1 1

Expected output:
1
1
0
3
0


Actual output:
3
3
0
3
0


Fixed submission (verdict: Accepted):
from collections import deque
cnt = int(input())
a = deque()

for i in range(cnt):
    li = list(map(int,input().split()))
    if li[0] == 0:
        if li[1] == 0:
            a.appendleft(li[2])
        else:
            a.append(li[2])
    if li[0] == 1:
        print(a[li[1]])
    if li[0] ==2:
        if li[1]==0:
            a.popleft()
        else:
            a.pop()
Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
print(S[0:2])

Failing test case input:
wsk_g``ii

Expected output:
wsk


Actual output:
ws


Fixed submission (verdict: Accepted):
S = input()
print(S[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
print(s[:2])

Failing test case input:
af^lu_eix

Expected output:
af^


Actual output:
af


Fixed submission (verdict: Accepted):
s = input()
print(s[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a=str(input())
print(a[0:2])

Failing test case input:
lghlps`

Expected output:
lgh


Actual output:
lg


Fixed submission (verdict: Accepted):
a=str(input())
print(a[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input(str("Input text: "))
S = S.lower()
if 3 <= len(S) <= 20:
    print(S[:3])


Failing test case input:
hhsaiakbr

Expected output:
hhs


Actual output:
Input text: hhs


Fixed submission (verdict: Accepted):
S = input(str(""))
if 3 <= len(S) <= 20:
    print(S[:3].lower())

Problem: p02645
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
print(input()[:2])

Failing test case input:
sakahashi

Expected output:
sak


Actual output:
sa


Fixed submission (verdict: Accepted):
print(input()[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S="nakonako"

str = S

print(str[0:3])

Failing test case input:
lehlsp`

Expected output:
leh


Actual output:
nak


Fixed submission (verdict: Accepted):
S= input()

str = S

print(str[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
name = input('')
print(name)

Failing test case input:
ixe]ul^fa

Expected output:
ixe


Actual output:
ixe]ul^fa


Fixed submission (verdict: Accepted):
name = input('')
print(name[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a=input()

print(a[0:2])

Failing test case input:
xie_u_fka

Expected output:
xie


Actual output:
xi


Fixed submission (verdict: Accepted):
a=input()

print(a[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
print(S[:2])
  

Failing test case input:
lehlsp`

Expected output:
leh


Actual output:
le


Fixed submission (verdict: Accepted):
S = input()
print(S[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
print(s[0],s[1],s[2])


Failing test case input:
wig``_ksi

Expected output:
wig


Actual output:
w i g


Fixed submission (verdict: Accepted):
s = input()
print(s[0]+s[1]+s[2])

Problem: p02645
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
i = input()
print(i[0:2])

Failing test case input:
nmpgira

Expected output:
nmp


Actual output:
nm


Fixed submission (verdict: Accepted):
str = input()
print(str[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = input()
print(a[1:4])

Failing test case input:
af^lu_eix

Expected output:
af^


Actual output:
f^l


Fixed submission (verdict: Accepted):
a = input()
print(a[0:3])
Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
print(S[0:4])

Failing test case input:
shsai_kai

Expected output:
shs


Actual output:
shsa


Fixed submission (verdict: Accepted):
S = input()
print(S[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = input(str())

print(a[2])

Failing test case input:
rbkaiashh

Expected output:
rbk


Actual output:
k


Fixed submission (verdict: Accepted):
a = input()

print(a[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


_in = input()






print(_in[0:2])


Failing test case input:
god`lqk

Expected output:
god


Actual output:
go


Fixed submission (verdict: Accepted):


_in = input()






print(_in[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
print(s[:2])

Failing test case input:
krh`fol

Expected output:
krh


Actual output:
kr


Fixed submission (verdict: Accepted):
s = input()
print(s[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()

print(s[:4])

Failing test case input:
itg_i`auj

Expected output:
itg


Actual output:
itg_


Fixed submission (verdict: Accepted):
s=input()

print(s[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()
print(s[0:2])

Failing test case input:
ujg_`f`kw

Expected output:
ujg


Actual output:
uj


Fixed submission (verdict: Accepted):
s=input()
print(s[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S=str(input())
S[:3]

Failing test case input:
nplgi`s

Expected output:
npl


Actual output:

Fixed submission (verdict: Accepted):
S=str(input())
print(S[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
ss = str()
for s in S:
  if not s in ss:
    ss = ss + s
  if len(ss)==3:
    print (ss)
    break

Failing test case input:
shsai_kai

Expected output:
shs


Actual output:
sha


Fixed submission (verdict: Accepted):
S = input()
ss = str()
for s in S:
  ss = ss + s
  if len(ss)==3:
    print (ss)
    break

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input() 
print (type(S), S)

Failing test case input:
lghlps`

Expected output:
lgh


Actual output:
<class 'str'> lghlps`


Fixed submission (verdict: Accepted):
S = input() 
print (S[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A = str(input())
print(A[0:2])

Failing test case input:
`pslhfl

Expected output:
`ps


Actual output:
`p


Fixed submission (verdict: Accepted):
A = str(input())
print(A[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S= input()
print(S[:2])

Failing test case input:
hhsaiakbr

Expected output:
hhs


Actual output:
hh


Fixed submission (verdict: Accepted):
S= input()
print(S[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=str(input())
print(s[:2])

Failing test case input:
itg_i`auj

Expected output:
itg


Actual output:
it


Fixed submission (verdict: Accepted):
s=str(input())
print(s[:3])
Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import fileinput

lines = list(fileinput.input())

print(lines)



Failing test case input:
vtg```kii

Expected output:
vtg


Actual output:
vtg```kii


Fixed submission (verdict: Accepted):
import fileinput
 
lines = list(fileinput.input())
 
for x in lines:
	print(x[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()

print(s[:2])

Failing test case input:
ska^iashi

Expected output:
ska


Actual output:
sk


Fixed submission (verdict: Accepted):
x= input()
print(x[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = input()
print(n[:2])

Failing test case input:
ehllo`s

Expected output:
ehl


Actual output:
eh


Fixed submission (verdict: Accepted):
n = input()
print(n[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input(str("Input text: "))
if 3 <= len(S) <= 20:
    print(S[:3].lower())

Failing test case input:
nlp`igs

Expected output:
nlp


Actual output:
Input text: nlp


Fixed submission (verdict: Accepted):
S = input(str(""))
if 3 <= len(S) <= 20:
    print(S[:3].lower())

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
print(S[3:])

Failing test case input:
lsn`kgf

Expected output:
lsn


Actual output:
`kgf


Fixed submission (verdict: Accepted):
S = input()
print(S[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
print(S[0:2:1])

Failing test case input:
s`qglin

Expected output:
s`q


Actual output:
s`


Fixed submission (verdict: Accepted):
S = input()
print(S[0:3:1])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = str(input())
print(S[0:2])

Failing test case input:
itg_i`auj

Expected output:
itg


Actual output:
it


Fixed submission (verdict: Accepted):
S = str(input())
print(S[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = input().split();
print(n[0:3])

Failing test case input:
sgi`pmn

Expected output:
sgi


Actual output:
sgi`pmn

Fixed submission (verdict: Accepted):
n = input();
print(n[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
print(S[0:4])

Failing test case input:
gfl`snl

Expected output:
gfl


Actual output:
gfl`


Fixed submission (verdict: Accepted):
S = input()
print(S[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()
print(s[0:2])

Failing test case input:
wig``_ksi

Expected output:
wig


Actual output:
wi


Fixed submission (verdict: Accepted):
s=input()
print(s[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
print(s[1:4])

Failing test case input:
vig```kti

Expected output:
vig


Actual output:
ig`


Fixed submission (verdict: Accepted):
s = input()
print(s[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a=input()

print(a[:2])

Failing test case input:
takahashi

Expected output:
tak

Actual output:
ta


Fixed submission (verdict: Accepted):
a=input()

print(a[:3])
Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
S[0:3]

Failing test case input:
ihsahakbs

Expected output:
ihs


Actual output:

Fixed submission (verdict: Accepted):
S = input()
print(S[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()
print(s[0:2])

Failing test case input:
takahashi

Expected output:
tak

Actual output:
ta


Fixed submission (verdict: Accepted):
s=input()
print(s[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
import random

def main():
    S = input()
    l = len(S)
    n = [random.randint(0, l-1) for i in range(3)]
    out = S[n[0]] + S[n[1]] + S[n[2]]
    
    print(out)
main()

Failing test case input:
sehllp`

Expected output:
seh


Actual output:
`e`


Fixed submission (verdict: Accepted):
import sys
import random

def main():
    S = input()
    l = len(S)
    n = [0, 1, 2]
    out = S[n[0]] + S[n[1]] + S[n[2]]
    
    print(out)
main()

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
l=input()
print(l[0:4])

Failing test case input:
rgok_ld

Expected output:
rgo


Actual output:
rgok


Fixed submission (verdict: Accepted):
l=input()
print(l[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
print(s[:2])

Failing test case input:
orihoam

Expected output:
ori


Actual output:
or


Fixed submission (verdict: Accepted):
s = input()
print(s[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = str(input())

print(a[2])

Failing test case input:
kr_dolg

Expected output:
kr_


Actual output:
_


Fixed submission (verdict: Accepted):
a = input()

print(a[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
print(s[0:2])

Failing test case input:
glod`rk

Expected output:
glo


Actual output:
gl


Fixed submission (verdict: Accepted):
s = input()
print(s[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = input()

print(a[0:2])

Failing test case input:
takahashi

Expected output:
tak

Actual output:
ta


Fixed submission (verdict: Accepted):
a = input()

print(a[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
print(s[0:4])

Failing test case input:
sgq`lim

Expected output:
sgq


Actual output:
sgq`


Fixed submission (verdict: Accepted):
s = input()
print(s[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
name = input()
print(name[0:2])

Failing test case input:
ij``g_ksw

Expected output:
ij`


Actual output:
ij


Fixed submission (verdict: Accepted):
name = input()
print(name[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
print(s[0:2])

Failing test case input:
akf_u_ejw

Expected output:
akf


Actual output:
ak


Fixed submission (verdict: Accepted):
s= input()
print(s[0:3])
Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S=input()
print(S[:2])

Failing test case input:
krh`fol

Expected output:
krh


Actual output:
kr


Fixed submission (verdict: Accepted):
S=input()
print(S[:3])

Problem: p02645
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
s=input()
print(s[0:4])

Failing test case input:
nplgi`s

Expected output:
npl


Actual output:
nplg


Fixed submission (verdict: Accepted):
s=input()
print(s[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S=input()
print(S[0:2])

Failing test case input:
lghlps`

Expected output:
lgh


Actual output:
lg


Fixed submission (verdict: Accepted):
S = input()
print(S[0:3:1])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
import random

def main():
    S = input()
    l = len(S)
    n = [0, 1, l-1]
    out = S[n[0]] + S[n[1]] + S[n[2]]
    
    print(out)
main()

Failing test case input:
ish_i`atj

Expected output:
ish


Actual output:
isj


Fixed submission (verdict: Accepted):
import sys
import random

def main():
    S = input()
    l = len(S)
    n = [0, 1, 2]
    out = S[n[0]] + S[n[1]] + S[n[2]]
    
    print(out)
main()

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = str(input())

print(a[0:2])

Failing test case input:
wjs_f``ki

Expected output:
wjs


Actual output:
wj


Fixed submission (verdict: Accepted):
a = input()

print(a[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = str(input())
print(s[0:2])

Failing test case input:
lpd`hqk

Expected output:
lpd


Actual output:
lp


Fixed submission (verdict: Accepted):
s = input()
print(s[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a = str(input())

print(a[3:])

Failing test case input:
frk`fnl

Expected output:
frk


Actual output:
`fnl


Fixed submission (verdict: Accepted):
a = input()

print(a[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a=input()
print(a[3:])

Failing test case input:
wje_u_fka

Expected output:
wje


Actual output:
_u_fka


Fixed submission (verdict: Accepted):
a=input()
print(a[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import random

S = str(input())

A = list(S)

print(S[0:2])

Failing test case input:
nplgi`s

Expected output:
npl


Actual output:
np


Fixed submission (verdict: Accepted):
import random

S = str(input())

A = list(S)

print(S[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
print(s[0:2])

Failing test case input:
milgq`s

Expected output:
mil


Actual output:
mi


Fixed submission (verdict: Accepted):
s = input()
print(s[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
print(input()[0:2])      

Failing test case input:
nilgq`s

Expected output:
nil


Actual output:
ni


Fixed submission (verdict: Accepted):
print(input()[0:3])
Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
S = str()

print(S[:3])

Failing test case input:
sehllp`

Expected output:
seh


Actual output:

Fixed submission (verdict: Accepted):
S = str(input())
print(S[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x= input()
print(x[:2])

Failing test case input:
lpd`hqk

Expected output:
lpd


Actual output:
lp


Fixed submission (verdict: Accepted):
x= input()
print(x[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


_in = input()






print(_in[1:3])

Failing test case input:
skbajashh

Expected output:
skb


Actual output:
kb


Fixed submission (verdict: Accepted):


_in = input()






print(_in[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s=input()
print(s[:2])

Failing test case input:
sgi`pmn

Expected output:
sgi


Actual output:
sg


Fixed submission (verdict: Accepted):
s=input()
print(s[:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()
print(s[0:2])

Failing test case input:
lod`hqk

Expected output:
lod


Actual output:
lo


Fixed submission (verdict: Accepted):
s = input()
print(s[0:3])

Problem: p02645
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
S = input()
print(S[ :2: 1])

Failing test case input:
ehllo`s

Expected output:
ehl


Actual output:
eh


Fixed submission (verdict: Accepted):
S = input()
print(S[0:3:1])

Problem: p02645
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
name = input()

print(name[0:2])

Failing test case input:
gr_kold

Expected output:
gr_


Actual output:
gr


Fixed submission (verdict: Accepted):
name = input()
 
print(name[0:3])
Problem: p02630
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = [0 for _ in range(q)]
c = [0 for _ in range(q)]
for i in range(q):
    b[i], c[i] = map(int, input().split())

for num, rep in zip(b, c):
    if num not in a: continue
    else:
        a = [rep if ele == num else ele for ele in a]
    print(sum(a))

Failing test case input:
4
0 2 4 3
3
0 4
3 4
0 4

Expected output:
13
14
14


Actual output:
13
14


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
X = Counter(a)
q = int(input())
b = [0 for _ in range(q)]
c = [0 for _ in range(q)]
for i in range(q):
    b[i], c[i] = map(int, input().split())

ans = sum(a)
for num, rep in zip(b, c):
    ans += (rep * X[num] - num * X[num])
    X[rep] += X[num]
    del(X[num])
    print(ans)

Problem: p02630
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import collections

n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]
ans_count = []
count = collections.Counter(a)
for i in range(q):
  num = count[bc[i][0]]
  count[bc[i][0]] = 0
  count[bc[i][1]] += num
  ans_count.append(count)

for ans in ans_count:
  total = 0
  for key, value in zip(count.keys(), count.values()):
    total += int(key) * int(value)
  print(total)

Failing test case input:
2
1 2
3
1 100
2 001
110 1001

Expected output:
102
101
101


Actual output:
101
101
101


Fixed submission (verdict: Accepted):
import collections

n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]
ans_count = []
total = 0
for i in range(n):
  total += a[i]

count = collections.Counter(a)
for i in range(q):
  num = count[bc[i][0]]
  count[bc[i][0]] = 0
  count[bc[i][1]] += num
  total += (bc[i][1] - bc[i][0]) * num
  print(total)

Problem: p02630
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
Q = int(input())

S = sum(A)
counter = Counter(A)
for i in range(Q):
    B,C = list(map(int,input().split()))
    S += counter[B]*C - counter[B]*B
    counter[C] += counter[B]
    print(S)


Failing test case input:
4
0 2 5 8
3
0 4
5 0
0 4

Expected output:
19
14
18


Actual output:
19
14
22


Fixed submission (verdict: Accepted):
from collections import Counter
N = int(input())
A = list(map(int,input().split()))
Q = int(input())

S = sum(A)
counter = Counter(A)
for i in range(Q):
    B,C = list(map(int,input().split()))
    S += counter[B]*C - counter[B]*B
    counter[C] += counter[B]
    counter[B] = 0
    print(S)
Problem: p02630
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for _ in range(Q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)

counter = Counter(A)
ans = 0
for num, count in counter.items():
    ans += num * count

for i in range(Q):
    if B[i] in counter:
        ans += counter[B[i]] * C[i] - counter[B[i]] * B[i]
        counter[C[i]] = counter[C[i]] + counter[B[i]]
    print(ans)


Failing test case input:
4
0 2 5 6
3
0 4
5 4
0 4

Expected output:
17
16
16


Actual output:
17
16
20


Fixed submission (verdict: Accepted):
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for _ in range(Q):
    b, c = map(int, input().split())
    B.append(b)
    C.append(c)

counter = Counter(A)
ans = 0
for num, count in counter.items():
    ans += num * count

for i in range(Q):
    if B[i] in counter:
        ans += counter[B[i]] * C[i] - counter[B[i]] * B[i]
        counter[C[i]] = counter[C[i]] + counter.pop(B[i])
    print(ans)

Problem: p02630
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]

asum=sum(a) 
d={}

for i in a:
  if i in d:
    d[i]+=1
  else:
    d[i]=1

for b,c in bc:
  print(b)
  print(c)
  if b in d:
    asum+=d[b]*(c-b)
    if c in d:
      d[c]+=d[b]
    else:
      d[c]=d[b]
    d[b]=0
  print(asum)

Failing test case input:
4
0 2 1 1
3
1 0
2 1
5 10

Expected output:
2
1
1


Actual output:
1
0
2
2
1
1
5
10
1


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
q=int(input())
bc=[list(map(int,input().split())) for i in range(q)]

asum=sum(a) 
d={}

for i in a:
  if i in d:
    d[i]+=1
  else:
    d[i]=1

for b,c in bc:
  if b in d:
    asum+=d[b]*(c-b)
    if c in d:
      d[c]+=d[b]
    else:
      d[c]=d[b]
    d[b]=0
  print(asum)

Problem: p02630
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
suma=sum(a)
q=int(input())
b=[]
c=[]
for i in range(q):
  b_,c_=map(int,input().split())
  b.append(b_)
  c.append(c_)

counter=[0]*(10**5+1)
for i in a:
  counter[i]+=1
  
for i in range(q):
  new_sum=suma-b[i]*counter[b[i]]+c[i]*counter[b[i]]
  suma=new_sum
  counter[c[i]]+=1
  counter[b[i]]=0
  print(new_sum)

Failing test case input:
4
0 1 1 1
2
1 2
2 1
5 5

Expected output:
6
3


Actual output:
6
5


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
suma=sum(a)
q=int(input())
b=[]
c=[]
for i in range(q):
  b_,c_=map(int,input().split())
  b.append(b_)
  c.append(c_)

counter=[0]*(10**5+1)
for i in a:
  counter[i]+=1
new_sum=suma
for i in range(q):
  new_sum=new_sum-b[i]*counter[b[i]]+c[i]*counter[b[i]]
  
  counter[c[i]]+=counter[b[i]]
  counter[b[i]]=0
  print(new_sum)
Problem: p02630
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter
dicy = {}
def swap(a,b):
	tmp = 0
	try:
		tmp = dicy.pop(a)
	except Exception:
		tmp = 0

	try:
		dicy[b] += tmp
	except Exception:
		dicy[b] = tmp

	return (int(b)-int(a)) * tmp
  

max = input()
dicy = dict(Counter(input().split(' ')))
result = 0
for v,k in dicy.items():
	result += int(v)*int(k)
print(result)
num_oper = int(input())
for i in range(num_oper):
	a,b = input().split(' ')
	diff = swap(a,b)
	result += diff
	print(result)

Failing test case input:
4
1 0 2 1
3
0 2
2 1
3 13

Expected output:
6
4
4


Actual output:
4
6
4
4


Fixed submission (verdict: Accepted):
from collections import Counter
dicy = {}
def swap(a,b):
	tmp = 0
	try:
		tmp = dicy.pop(a)
	except Exception:
		tmp = 0

	try:
		dicy[b] += tmp
	except Exception:
		dicy[b] = tmp

	return (int(b)-int(a)) * tmp
  

max = input()
dicy = dict(Counter(input().split(' ')))
result = 0
for v,k in dicy.items():
	result += int(v)*int(k)
num_oper = int(input())
for i in range(num_oper):
	a,b = input().split(' ')
	diff = swap(a,b)
	result += diff
	print(result)

Problem: p02630
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter

def main():
    n = int(input())
    a = Counter(map(int, input().split()))
    q = int(input())
    bc = [map(int, input().split()) for _ in range(q)]
    temp = suma(a)
    for b,c in bc:
        t = a[b]
        temp -= b*t
        a[c] += t
        temp += c*t
        print(temp)

def suma(a):
    x = 0
    for i in a.items():
        x += i[0] * i[1]
    return x

if __name__ == '__main__':
    main()

Failing test case input:
4
0 2 5 6
3
0 1
5 4
0 4

Expected output:
14
13
13


Actual output:
14
13
17


Fixed submission (verdict: Accepted):
from collections import Counter

def main():
    n = int(input())
    a = Counter(map(int, input().split()))
    temp, a = listed(a)
    q = int(input())
    bc = [tuple(map(int, input().split())) for _ in range(q)]
    
    for b, c in bc:
        t = a[b]
        if t == 0:
            print(temp)
            continue
        a[b] = 0
        temp -= b*t
        a[c] += t
        temp += c*t
        print(temp)

def listed(a):
    x = [0] * (10**5 + 1)
    kei = 0
    for i,v in a.items():
        x[i] = v
        kei += i*v
    return kei, x

if __name__ == '__main__':
    main()
Problem: p02630
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = [0 for _ in range(q)]
c = [0 for _ in range(q)]
for i in range(q):
    b[i], c[i] = map(int, input().split())

for num, rep in zip(b, c):
    if num in set(a):
        a = [rep if ele == num else ele for ele in a]
    else:
        continue
    print(sum(a))

Failing test case input:
2
1 2
3
1 100
1 001
100 1000

Expected output:
102
102
1002


Actual output:
102
1002


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
X = Counter(a)
q = int(input())
b = [0 for _ in range(q)]
c = [0 for _ in range(q)]
for i in range(q):
    b[i], c[i] = map(int, input().split())

ans = sum(a)
for num, rep in zip(b, c):
    ans += (rep * X[num] - num * X[num])
    X[rep] += X[num]
    del(X[num])
    print(ans)

Problem: p02630
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

a = [0] * (10 ** 5 + 1)
ans = sum(A)

for i in range(N):
    a[A[i]] += 1

for i in range(Q):
    B, C = map(int, input().split())
    a[C] += a[B]
    a[B] = 0
    ans += a[B] * (C - B)
    print(ans)


Failing test case input:
4
0 1 1 1
3
1 2
2 1
3 5

Expected output:
6
3
3


Actual output:
3
3
3


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())

a = [0] * (10 ** 5 + 1)
ans = sum(A)

for i in range(N):
    a[A[i]] += 1

for i in range(Q):
    B, C = map(int, input().split())
    ans += a[B] * (C - B)
    a[C] += a[B]
    a[B] = 0
    print(ans)

Problem: p02630
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
q = int(input())
nums = Counter(a)
m = sum(a)
print(nums)
for _ in range(q):
  b,c = map(int,input().split())
  nums[c] += nums[b]
  k = nums[b]
  nums[b] = 0
  m = m + (c-b)*k
  print(m)
print(nums)

Failing test case input:
4
0 -1 0 0
3
0 0
2 0
5 0

Expected output:
-1
-1
-1


Actual output:
Counter({0: 3, -1: 1})
-1
-1
-1
Counter({-1: 1, 0: 0, 2: 0, 5: 0})


Fixed submission (verdict: Accepted):
from collections import Counter
n = int(input())
a = list(map(int,input().split()))
q = int(input())
nums = Counter(a)
m = sum(a)
for _ in range(q):
  b,c = map(int,input().split())
  nums[c] += nums[b]
  k = nums[b]
  nums[b] = 0
  m = m + (c-b)*k
  print(m)