Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02623 (python)

Fixed submission:
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
cum_A=[0]
cum_B=[0]
for i in range(N):
  cum_A.append(cum_A[-1]+A[i])
for i in range(M):
  cum_B.append(cum_B[-1]+B[i])
ans, j = 0,M
for i in range(N+1):
  if cum_A[i] > K:
    break
  while cum_B[j] > K-cum_A[i]:
    j -= 1
  ans = max(ans,i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
cum_A=[]
cum_B=[]
for i in range(N):
  cum_A.append(cum_A[-1]+A[i])
  cum_B.append(cum_B[-1]+B[i])
ans, j = 0,M
for i in range(N+1):
  if a[i] > K :
    break
  while b[j] > K-a[i]:
    j -= 1
  ans = max(ans,i+j)
print(ans)
Problem p02629 (python)

Fixed submission:
L=[26**i for i in range(13)]
#print(L)
gun=[sum(L[1:i])for i in range(2,13)]
#print(gun)
N=int(input())
i=0
while N > gun[i]:
  i += 1
#print(i)
if i != 0:
  N = N - gun[i-1] #これを26進法
N -= 1
#print(N)
L=[]
for k in range(1,i+2):
   L.append(N//(26**(i+1-k)))
   N = N % (26**(i+1-k))
#print(L)
L=[chr(i+97) for i in L]
#print(L)
print(''.join(L))

Buggy submission (verdict: Runtime Error):
L=[26**i for i in range(12)]
#print(L)
gun=[sum(L[1:i])for i in range(2,12)]
#print(gun)
N=int(input())
i=0
while N > gun[i]:
  i += 1
#print(i)
if i != 0:
  N = N - gun[i-1] #これを26進法
N -= 1
#print(N)
L=[]
for k in range(1,i+2):
   L.append(N//(26**(i+1-k)))
   N = N % (26**(i+1-k))
#print(L)
L=[chr(i+97) for i in L]
#print(L)
print(''.join(L))
Problem p02829 (python)

Fixed submission:
A=int(input())
B=int(input())
print(6-A-B)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=int(input())
L=[1,2,3]
p=L.pop(A-1)
q=L.pop(B-1)
print(L[0])
Problem p02676 (python)

Fixed submission:
K = int(input())
S = input()
if int(len(S)) <= K:
    print(S)
else:
    print(S[0:K]+'...')

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
if int(len(S)) <= K:
    print(S)
else:
    print(S[0:K]...)

Buggy submission (verdict: Runtime Error):
K = int(input())
S = input()
if int(len(S)) <= K:
    print(S)
else:
    print(S[0:K]...)
Problem p02729 (python)

Fixed submission:
N, M = map(int, input().split())
print(int((N * (N - 1) + M * (M-1)) / 2))

Buggy submission (verdict: Runtime Error):
print(int((input()))**3/27)

Buggy submission (verdict: Runtime Error):
S = input()
a = (len(S) - 1) / 2
b = (len(S) + 1) / 2
if S[:a] == S[b:]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
# %%
N = int(input())
M = int(input())
print((N * (N - 1) + M * (M-1)) / 2)
Problem p02753 (python)

Fixed submission:
S = input()
ans = 'Yes'
if S == 'AAA' or S == 'BBB':
  ans = 'No'
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
ans = 'Yes'
if S = 'AAA' or S = 'BBB':
  ans = 'No'
print(ans)
Problem p03011 (python)

Fixed submission:
P, Q, R = map(int, input().split())
print(P+Q+R-max(P,Q,R))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
NG = []
a = 10**9+7
for i in range(M):
  NG.append(int(input()))
ans = [0 for _ in range(N + 2)]
ans[0] = 1
for i in range(N):
  if not i + 1 in NG:
    ans[i + 1] = (ans[i + 1] + ans[i])%a
  if not i + 2 in NG:
    ans[i + 2] = (ans[i + 2] + ans[i])%a
print(ans[N])
Problem p03803 (python)

Fixed submission:
A, B = map(int, input().split())
if A == B:
  print('Draw')
else:
  if A == 1:
    print('Alice')
  elif B == 1:
    print('Bob')
  elif A < B:
    print('Bob')
  elif B < A:
    print('Alice')

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
if A == B:
  print('Draw')
else:
  if A == 1:
    print('Alice')
  elif B == 1:
    print('Bob')
  elif A < B:
    print('Bob')
  else B < A:
    print('Alice')
Problem p02707 (python)

Fixed submission:
from collections import Counter


n=int(input())
a=list(map(int,input().split()))



c=Counter(a)
ck=set(Counter(a).keys())
for i in range(1,n+1):
    if i in ck:
        print(c[i])
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))

c=Counter(a)
ck=list(Counter(a).keys())
for i in range(1,n+1):
    if i in ck:
        print(c[i])
    else:
        print(0)
Problem p02785 (python)

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
for i in range(k):
    if len(h)>0:
        h.pop()
print(sum(h))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
for i in range(k):
    h.pop()
print(sum(h))
Problem p02879 (python)

Fixed submission:
a,b=map(int,input().split())
if a>9 or b>9:
  print(-1)
else:
  print(a*b)

Buggy submission (verdict: Runtime Error):
n=int(input())
result=1000000000000
for i in range(n):
  nn=n/(i+1)
  if (nn.is_integer() and result>nn+i-1):
    result=nn+i-1
print(result)

Buggy submission (verdict: Runtime Error):
n=int(input())
result=1000000000000
for i in range(n):
  nn=n/(i+1)
  if (nn.is_integer() and result>nn+i-1):
    result=nn+i-1
    print(nn)
    print(i+1)
print(result)

Buggy submission (verdict: Runtime Error):
n=int(input())
result=100000000000000000000000000
for i in range(n):
  nn=n/(i+1)
  if (nn.is_integer() and result>nn+i-1):
    result=nn+i-1
    print(nn)
    print(i+1)
print(result)

Buggy submission (verdict: Runtime Error):
n=int(input())
result=100000000000000000000000000
for i in range(n):
  nn=n/(i+1)
  if (nn.is_integer() and result>nn+i-1):
	result=nn+i-1
print(result)
Problem p02880 (python)

Fixed submission:
n=int(input())
flag=0
for i in range(9):
  nn=n/(i+1)
  if(nn<10 and (nn.is_integer())):
    flag=1
    break
if(flag):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n=int(input())
flag=0
for i in range(9):
  nn=n/(i+1)
  if(nn<10 and type(nn)==int):
    flag=1
    break:
if(flag):
  print("Yes")
else:
  print("No")
Problem p02881 (python)

Fixed submission:
n = int(input())
list=[]
for i in range(1,int(n**0.5+1)):
  if n%i == 0:
    list.append(int(i+n/i))
print(min(list)-2)

Buggy submission (verdict: Runtime Error):
n=int(input())
result=100000000000000000000000000
for i in range(n):
  nn=n/i
  if (nn.is_integer() and result>nn+i-2):
	result=nn+i-2
print(result)
Problem p02959 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
count=0
def battle(a,ai,b):
  if a+ai <= b:
    count=a+ai
    ai=0
  elif a<=b:
    ai=ai-(b-a)
    count=b
  else:
    ai=ai
    count=b
  return ai,count
  
for i in range(n):
  c=0
  a[i+1],c=battle(a[i],a[i+1],b[i])
  count += c
 
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
count=0

def battle(a,ai,b):
  if a+ai <= b:
    ai=0
    count=a+ai
  elif a<=b:
    ai=ai-(b-a)
    count=b
  else:
    ai=ai
    count=b
  result ai,count
  
for i in range(n):
  c=0
  a[i+1],c=battle(a[i],a[i+1],b[i])
  count += c

print(count)
Problem p03036 (python)

Fixed submission:
r,d,x=map(int,input().split())
for i in range(10):
  x=r*x-d
  print(x)

Buggy submission (verdict: Runtime Error):
r,d,x=map(int,input().split())
for i range(10):
  x=r*x-d
  print(x)

Buggy submission (verdict: Runtime Error):
r,d,x=map(int,input().split())
for i range(10):
  x=rx-d
  print(x)
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
s=input()
print(s[0:k-1]+s[k-1].lower()+s[k:])

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
for i in range(n):
  s=list(map(int,input().split()))
s[k].lower()
for i in range(n):
  print(s[i],end="")
Problem p02595 (python)

Fixed submission:
import math

n, max_dist = input().split()

points = 0

for _ in range(int(n)):
    x, y = input().split()
    x = int(x)
    y = int(y)

    dist = math.sqrt(x * x + y * y)

    if dist <= float(max_dist):
        points += 1

print(points)

Buggy submission (verdict: Runtime Error):
n, max_dist = int(input())
points = 0

for _ in range(n):
  x, y = int(input())
  dist = sqrt(x * x + y * y)
  
  if dist <= max_dist:
    points += 1
	
print(points)

Buggy submission (verdict: Runtime Error):
n, max_dist = int(input().split())

points = 0

for _ in range(n):
  x, y = int(input().split())
  
  dist_origin = sqrt(x * x + y * y)
	if dist_origin <= max_dist:
    	points += 1
        
print(points)
Problem p02623 (python)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int,input().split()))
B = list(map(int, input().split()))
a = [0]
b = [0]

ans = 0
j = M

for i in range(N):
  a.append(a[i] + A[i])

for i in range(M):
  b.append(b[i] + B[i])

for i in range(N+1):
  if a[i] > K:
    break
  while a[i] + b[j] > K:
    j -= 1
  ans = max(ans, i+j)

print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int,input().split()))
b = list(map(int, input().split()))


ans = 0
sum_a = 0
for i in range(len(a)):
  sum_a += a[i]
  sum_b = 0
  if sum_a > k:
    break
  if sum_a == k:
    temp = i+1
    if temp > ans:
      ans = temp
    break
  for j in range(len(b)):
    sum_b += b[j]
    if (sum_a + sum_b) > k:
      temp = i+1+j
      ans_list.append(temp)
      if temp > ans:
        ans = temp
      break
    if (sum_a + sum_b) == k:
      temp = i+1+j+1
      if temp > ans:
        ans = temp
      break
      
sum_b = 0
for i in range(len(b)):
  sum_b += b[i]
  sum_a = 0
  if sum_b > k:
    break
  if sum_b == k:
    temp = i+1
    if temp > ans:
      ans = temp
    break
  for j in range(len(a)):
    sum_a += a[j]
    if (sum_b + sum_a) > k:
      temp = i+1+j
      if temp > ans:
        ans = temp
      break
    if (sum_b + sum_a) == k:
      temp = i+1+j+1
      if temp > ans:
        ans = temp
      break
      
print(ans)
Problem p02753 (python)

Fixed submission:
S = input()

ans = 'Yes'

if (S == 'AAA') or (S=='BBB'):
  ans = 'No'
  
print(ans)

Buggy submission (verdict: Runtime Error):
S = inpit()

ans = 'Yes'

if (S == 'AAA') or (S=='BBB'):
  ans = 'No'
  
print(ans)
Problem p02623 (python)

Fixed submission:
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

a_sum = [0]
for i in range(n):
  a_sum.append(a[i] + a_sum[i])
b_sum = [0]
for i in range(m):
  b_sum.append(b[i] + b_sum[i])
  
ans = 0
j = m
for i in range(n+1):
  if a_sum[i] > k:
    break
  while a_sum[i] + b_sum[j] > k:
    j -= 1
  ans = max(ans, i + j)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

a_sum = [0]
for i in range(n):
  a_sum.append(a[i] + a_sum[i])
b_sum = [0]
for i in range(m):
  b_sum.append(b[i] + b_sum[i])

ans = 0
for i in range(n+1):
  if a[i] > k:
    break
  for j in range(m+1):
    if a_sum[i] + b_sum[j] <= k:
      ans = max(ans, i + j)
    else:
      break
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
minutes = 0

if sum(a) + sum(b) <= k:
  ans = len(a) + len(b)
  print(ans)
else:
  while minutes <= k:
    if a[0] and b[0]:
      if a[0] <= b[0]:
        minutes += a[0]
        a.pop(0)
      else:
        minutes += b[0]
        b.pop(0)
    elif a[0]:
      minutes += a[0]
      a.pop(0)
    elif b[0]:
      minutes += b[0]
      b.pop(0)
  ans = n + m - len(a) - len(b)
  if minutes > k:
    ans -= 1
  print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
minutes = 0

if sum(a) + sum(b) <= k:
  ans = len(a) + len(b)
  print(ans)
else:
  while minutes <= k:
    if a[0] <= b[0]:
      minutes += a[0]
      a.pop(0)
    else:
      minutes += b[0]
      b.pop(0)
  ans = n + m - len(a) - len(b) - 1
  print(ans)
Problem p02707 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n

for i in range(n-1):
  ans[a[i]-1] += 1

for i in range(n):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
lst = []

for i in range(1,max(a)+1):
  count = a.count(i)
  lst.append(count)
lst.append(0)

for i in range(n):
  print(lst[i])
Problem p02753 (python)

Fixed submission:
S = input()
if S[0] == S[1] and S[1] == S[2]:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
import math

N, A, B = map(int, input().split())
x = math.floor(N // (A + B))
y = N % (A + B)

print(A * x + min(A, y))

Buggy submission (verdict: Runtime Error):
S = input()
if S[1] == S[2] and S[2] == S[3]:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
S = input()
if N[1] == N[2] and N[2] == N[3]:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
N = input()
if N[1] == N[2] and N[2] == N[3]:
  print("No")
else:
  print("Yes")
Problem p02779 (python)

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

if len(set(A)) < len(A):
  print("NO")
else:
  print("YES")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
print("YES" if len(set(A)) = N, else "NO")
Problem p02707 (python)

Fixed submission:
import collections

n = int(input())
a = list(map(int, input().split()))


ac = collections.Counter(a)

for i in range(n):
  print(ac[i+1])

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())
a = list(map(int, input().split()))


ac = collections.Counter(a)

for i in range(n):
  print(a[i+1])
Problem p02595 (python)

Fixed submission:
import math

N, D = map(int,input().split())

Df = [0]*N

for i in range(N):
  x,y = map(float,input().split())
  if math.sqrt(x*x + y*y) <= D:
    Df[i] = 1

print(Df.count(1))

Buggy submission (verdict: Runtime Error):
import math

N, D = map(int,input().split())

print(N+D)
Df = [0]*N

for i in range(N):
  x,y = map(float,input().split())
  if math.sqrt(x*2 + y*2) >= D:
    Df[i] = 1

print(Df.count(1))
Problem p02659 (python)

Fixed submission:
i = input().split()
a = int(i[0])
b = int(i[1][0]+i[1][2:])
print(a * b // 100)

Buggy submission (verdict: Runtime Error):
i = input().split()
a = int(i[0])
b = int(i[0]+i[2:])
print(a * b // 100)
Problem p02712 (python)

Fixed submission:
N = int(input())
sum = 0
for i in range(1, N+1):
    if (i%3 != 0 and i%5 != 0):
        sum += i

print(sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
sum = 0
for i in range(1, N+1):
    if any(i%3 == 0, i%5 == 0):
        pass
    else:
        sum += i

print(sum)
Problem p02771 (python)

Fixed submission:
a, b, c = map(int, input().split())

if (a == b and a != c) or (a == c and a != b) or (b == c and b != a):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

flag = 0
for i in range(len(a)):
    if a[i]%2 == 0:
        if a[i]%3 == 0 or a[i]%5 == 0:
            flag += 1
        else:
            flag = 0
            break

if flag != 0:
    print("APPROVED")
else:
    print("DENIED")
Problem p02984 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().strip().split()))
X = []
X.append(sum(A[0::2])-sum(A[1::2]))
for k in range (N-1):
  X.append(2*A[k] - X[k])
print(*X, sep=" ")

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().strip().split()))
X = []
X = X.append(sum(A[0::2])-sum(A[1::2]))
for k in range (N-1):
  X = X.extend(2*A[k] - X[k])
print(X)
Problem p02693 (python)

Fixed submission:
k = int(input())
a, b = map(int, input().split())

ans = 'NG'
for i in range(a, b+1):
  if ((i)%k == 0):
    ans = 'OK'
    
if (k == 1):
  ans = 'OK'
    
print(ans)

Buggy submission (verdict: Runtime Error):
k = int(input())
a, b = int(map(int, input().split()))

if (a%k == 0 or b%k == 0):
  print('Yes')
elif (a//k != b//k):
  print('Yes')
else:
  print('No')
Problem p02711 (python)

Fixed submission:
n = input()

if ('7' in n):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = input()

if ('7' in n):
  print('Yes')
else:
  pritn('No')
Problem p02771 (python)

Fixed submission:
a, b, c  = map(int, input().split())
abc = len(set([a, b, c]))

if ( abc == 2):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]

s_unique   = []
s_cnt      = [0]*n
unique_num = 0
for i in range(n):
  # 新しい文字列の場合は配列に加える
  if (not(s[i] in s_unique)):
  	s_unique.append(s[i])
  else:
    s_cnt[s_unique.index(s[i])] += 1

# 最大カウントの要素で再構成
cnt_max = max(s_cnt)
s_max = []
for i in range(n):
  if (s_cnt[i] == cnt_max):
    s_max.append(s_unique[i])

s_max = sorted(s_max)
for s in s_max:
  print(s)
Problem p02773 (python)

Fixed submission:
from collections import Counter

n = int(input())
s = [input() for i in range(n)]
s = Counter(s)
s = s.most_common()

# ansの初期化
ans = []
ans.append(s[0][0])
cnt = s[0][1]

if (len(s) != 1):
  for i in range(1, n):
    if (s[i][1] < cnt):
      break
    else:
      ans.append(s[i][0])

for s in sorted(ans):
  print(s)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
s = [input() for i in range(n)]
s = Counter(s)
s = s.most_common()

# ansの初期化
ans = []
ans.append(s[0][0])
cnt = s[0][1]

for i in range(1, n):
  if (s[i][1] < cnt):
    break
  else:
    ans.append(s[i][0])

for s in sorted(ans):
  print(s)
Problem p02951 (python)

Fixed submission:
def main():
    s = input()
    [a, b, c] = [int(number) for number in s.split()]

    if b + c <= a:
        print(0)
    else:
        print(b + c - a)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    s = input()
    [a, b, c] = [int(number) for number in s.split()]

    if b + c <= a:
        print(0)
    else:
        print(b + c - a)

if __name__ == '__main__':20
    """
    main()
Problem p02729 (python)

Fixed submission:
def tmp(n):
    return n * (n - 1) / 2


def main():
    line = input().strip()
    n, m = [int(v) for v in line.split(' ')]

    ans_n = tmp(n) if n > 1 else 0
    ans_m = tmp(m) if m > 1 else 0
    ans = ans_n + ans_m
    print(int(ans))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    line = input().strip()
    n, m = [int(v) for line.split(' ')]

    ans_n = n * (n - 1) if n > 1 else 0
    ans_m = m * (m - 1) if m > 1 else 0
    ans = ans_n + ans_m
    return ans


if __name__ == '__main__':
    main()
Problem p02622 (python)

Fixed submission:
S = list(input())
T = list(input())
i = 0
counter = 0

if S == T:
  print(counter)
  exit()
  
for i in range(len(S)):
  if T[i] != S[i]:
    counter += 1
    if S == T:
      break
      
print(counter)

Buggy submission (verdict: Runtime Error):
S = list(input())
T = list(input())

if S == T:
  print(counter)
  exit()
  
counter = 0 
for i in range(len(S)):
  if T[i] != S[i]:
    counter += 1
    if S == T:
      break
  i += 1
  
print(counter)
Problem p02699 (python)

Fixed submission:
S,W = map(int,input().split())

if W >= S:
    print("unsafe")
else:
    print("safe")

Buggy submission (verdict: Runtime Error):
S,W = map(int,input())

if W >= S:
    print("unsafe")
else:
    print("safe")
Problem p02627 (python)

Fixed submission:
import re
a=input()
if re.sub(r'[A-Z]',"",a)=="":
  print('A')
else:
  print('a')

Buggy submission (verdict: Runtime Error):
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[b]
 cnt[x]=0
 print(sum)

Buggy submission (verdict: Runtime Error):
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)

Buggy submission (verdict: Runtime Error):
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]
 print(sum)
 cnt[x]+=cnt[y]
 cnt[y]=0

Buggy submission (verdict: Runtime Error):
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+=(x-y)*cnt[x]
 print(sum)
 cnt[x]+=cnt[y]

Buggy submission (verdict: Runtime Error):
import re
n=int(input())
s=[]
s=input().split()
q=int(input())

for i in range(q):
 x,y=map(str, input().split())
 s.replace(x,y)
 
for j in range(q):
 ans+=int(s[j])
 
print(ans)

Buggy submission (verdict: Runtime Error):
a=input（）
if a.isupper():
  print('A')
else:
  print('a')

Buggy submission (verdict: Runtime Error):
a=input（）
if a.isuppder():
  print('A')
else:
  print('a')
Problem p02629 (python)

Fixed submission:
alp=['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']
n=int(input())
ans=""
while n>0:
 n-=1
 a=n%26
 ans+=alp[a] 
 n=int(n//26)
 
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
a=int(input())

alp=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','z']
if a<27:
 print(alp[a-1])
else:
 b=a//26

 c=a%26
 ans=""
 if b==1:
    ans+='a'
 for i in range(1,17):
  if b/(10**(i))>1:
    d=int(b/(10**(i)))
    ans+=alp[d-1]
  else:
    break
 ans+=alp[c-1]

 print(ans)

Buggy submission (verdict: Runtime Error):
a=int(input())

alp=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','z']
if a<27:
 print(alp[a-1])
else:
 b=a//26

 c=a%26
 ans=""
 if b==1:
    ans+='a'
 for i in range(0,17):
  if b/(10**(i))>1:
    d=int(b/(10**(i)))
    ans+=alp[d-1]
  else:
    break
 ans+=alp[c-1]

 print(ans)

Buggy submission (verdict: Runtime Error):
alp=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','z']
if a<27:
 print(alp[a-1])
else:
 b=a//26
 c=a%26
 ans=[]
 for i in range(17):
  if b/(10^(i+1))>0:
    d=int(b/(10^(i+1)))
    ans.append(alp[d-1])
  else:
    break
 ans.append(alp[c-1])

 print(ans)
Problem p02633 (python)

Fixed submission:
import math
a=int(input())
i=a*360/math.gcd(a,360)
print(int(i/a))

Buggy submission (verdict: Runtime Error):
a,n =map(str, input().split())
b=str(a[2:])
ans=0

for i in range(int(n)+1):
  for j in range(1):
      c=b[i:]+str(a[j])+b[i+1:]
      ans+=1
print(ans*2)
Problem p02676 (python)

Fixed submission:
k=int(input())
s=str(input())
if len(s)<=k:
  print(s)
  exit()
else:
  print(s[0:k]+"...")

Buggy submission (verdict: Runtime Error):
k=str(input())
s=int(input())
if len(s)<=k:
  print(s)
  exit()
else:
  print(s[len(s-1):]+"...")
Problem p02682 (python)

Fixed submission:
a,b,c,k=map(int,input().split())
 
if a>=k:
  print(k)
  exit()
else:
  if k-a<=b:
    print(a)
    exit()
  else:
    c=k-a-b
    print(a-c)

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
 
if a>=k:
  print(a)
  exit()
else:
  if k-a=<b:
    print(a)
    exit()
  else:
    c=k-a-b
    print(a-c)

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
 
if a>=k:
  print(a)
  exit()
else:
  if k-a=<b:
    print(a)
    exit()
  else:
    c=k-a-b
    print(a-c)

Buggy submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())

if a>=k:
  print(a)
  break()
else:
  if k-a<b:
    print(a)
  else:
    c=k-a-b
    print(a-c)
Problem p02693 (python)

Fixed submission:
k=int(input())
a,b=map(int,input().split())
 
for i in range(10000):
 if a<=k*i<=b:
  print("OK")
  exit()
 else:
  pass
print("NG")

Buggy submission (verdict: Runtime Error):
k=int(input())
a,b=map(int,input().split())
 
for i in 1000:
 if a<=k*i<=b:
  print("OK")
 else:
  pass
print("NG")

Buggy submission (verdict: Runtime Error):
k=int(input())
a,b=map(int,input().split())

for i in 1000:
 if a<=k*i<=b:
  print("OK")
 else:
  pass
print("NG")