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

Fixed submission:
from collections import Counter

def inpl(): return list(map(int, input().split()))


N = int(input())
print(len(Counter([int(input()) for _ in range(N)])))

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include<set>
#include<math.h>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)

int main(){
    int N;
    cin >> N;
    set <int> s;
    int tmp;
    
    rep(i, N){
        cin >> tmp;
        s.insert(tmp);
    }
    cout << s.size() << endl;

    return 0;
}
Problem p03543 (python)

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

Buggy submission (verdict: Runtime Error):
S = input()
print("Yes" if s[0]==s[1]==s[2] or s[1]==s[2]==s[3] else "No")
Problem p03680 (python)

Fixed submission:
n = int(input())
A = [int(input())-1 for i in range(n)]
B = [False] * n
ans = 0
i = 0
while True:
    if B[i] is True:
        print(-1)
        break
    else:
        B[i] = True
    
    ans += 1
    if A[i] != 1:
        i = A[i]
    else:
        print(ans)
        break

Buggy submission (verdict: Runtime Error):
def func(i=0, ans=0):
    if B[i] is True:
        return -1
    else:
        B[i] = True
    
    ans += 1
    if A[i] != 1:
        return func(A[i], ans)
    else:
        return ans



n = int(input())
A = [int(input())-1 for i in range(n)]
B = [False] * n
print(func())
Problem p03695 (python)

Fixed submission:
N = int(input())
A = [0] * 9
for a in list(map(int, input().split())):
    A[min(a//400, 8)] += 1

ans = len(list(filter(lambda x: x>0, A[:-1])))

max_ans = ans+A[-1]

if A[-1] > 0:
    min_ans = max(1, ans)
else:
    min_ans = ans
print(min_ans, end=" ")
print(max_ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [0] * 9
for a in list(map(int, input().split())):
    A[min(a//400, 9)] += 1

ans = 0
for a in A[:-1]:
    ans += int(a>0)
max_ans = min(ans+A[-1], 8)

if A[-1] > 0:
    min_ans = max(1, ans)
else:
    min_ans = ans
print(min_ans, end=" ")
print(max_ans)
Problem p03737 (python)

Fixed submission:
a, b, c = input().split()
 
print(a[0].upper()+b[0].upper()+c[0].upper())

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

print(a[0].upper()+b[0].upper()+c[0].upper())
Problem p03845 (python)

Fixed submission:
n = int(input())
T = list(map(int, input().split()))
sumT = sum(T)
m = int(input())
for i in range(m):
  a, b = map(int, input().split())
  print(sumT - T[a - 1] + b)

Buggy submission (verdict: Runtime Error):
n = int(input())
T = list(map(int, input().split()))
sumT = sum(T)
m = int(input())
for i in range(m):
  a, b = map(int, input().split())
  print(sumT - T[a] + b)

Buggy submission (verdict: Runtime Error):
n = int(input())
T = list(map(int, input().split()))
sumT = sum(T)
m = int(input())
D = list(map(int, input().split()))
for i, d in enumerate(D):
  print(sumT - T[i] + d)
Problem p03860 (python)

Fixed submission:
A, B, C = map(str, input().split())
 
print(A[0]+B[0]+C[0])

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())

print(A[0]+B[0]+C[0])
Problem p03970 (python)

Fixed submission:
S = input()
ans = "CODEFESTIVAL2016"
a = 0
for i in range(len(S)):
  if S[i] != ans[i]:
    a += 1
print(a)

Buggy submission (verdict: Runtime Error):
S = input()
ans = "CODEFESTIVAL2016"
a = 0
for i in range(S):
  if S[i] != ans[i]:
    a += 1
print(a)
Problem p04012 (python)

Fixed submission:
from collections import Counter
S = Counter(list(input()))
for k, v in S.items():
  if v % 2 == 1:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
from collection import Counter
S = Counter(list(input()))
for k, v in S.items():
  if v % 2 == 1:
    print("No")
    exit()
print("Yes")
Problem p04015 (python)

Fixed submission:
def inpl():
    return list(map(int, input().split()))


N, A = inpl()
X = inpl()
maxX = max(X)

dp = [[[0 for _ in range(N * maxX + 1)] for j in range(i + 1)]
      for i in range(51)]

dp[0][0][0] = 1
for i in range(N):
    x = X[i - 1]
    for j in range(i + 1):
        for k in range(N * maxX + 1):
            # print(i, j, k)
            if dp[i][j][k] == 0:
                continue
            dp[i + 1][j][k] += dp[i][j][k]
            dp[i + 1][j + 1][k + x] += dp[i][j][k]

ans = 0
for j in range(1, N + 1):
    if j * A > N * maxX:
        continue
    ans += dp[N][j][j * A]
print(ans)

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


def inpl():
    return list(map(int, input().split()))


N, A = inpl()
X = inpl()
cX = Counter(X)

dp = [[[0 for _ in range(N * max(X) + 1)] for j in range(i + 1)]
      for i in range(N + 1)]

dp[0][0][0] = 1
for i in range(1, N + 1):
    x = X[i - 1]
    for j in range(i + 1):
        for k in range(N * max(X) + 1):
            # print(i, j, k)
            if j == i and k - x < 0:
                dp[i][j][k] = 0
            elif j == i and k - x >= 0:
                dp[i][j][k] = dp[i - 1][j - 1][k - x]
            elif k - x < 0 or j == 0:
                dp[i][j][k] = dp[i - 1][j][k]
            else:
                dp[i][j][k] = dp[i - 1][j][k] + dp[i - 1][j - 1][k - x]
print(sum(dp[N][j][j * A] for j in range(1, N + 1)))
Problem p04019 (python)

Fixed submission:
def inpl():
    return list(map(int, input().split()))


def f(a, b):
    if a == 0 and b == 0:
        return True
    elif a * b == 0:
        return False
    else:
        return True


S = input()
# print(S)
cN = S.count('N')
cW = S.count('W')
cS = S.count('S')
cE = S.count('E')

if f(cN, cS) is True and f(cW, cE) is True:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
def inpl():
    return list(map(int, input().split()))


def f(a, b):
    if a == 0 and b == 0:
        return True
    elif a * b == 0:
        return False
    else:
        return True

S = input()

N = S.count('N')
W = S.count('W')
S = S.count('S')
E = E.count('E')

if f(N, S) is True and f(W, E) is True:
    print('Yes')
else:
    print('No')
Problem p04047 (python)

Fixed submission:
n = int(input())
A = sorted(list(map(int, input().split())))
ans = 0
flag = True
for i in reversed(range(len(A))):
  if flag is False:
    flag = True
    continue
  if i - 1 < 0:
    continue
  ans += A[i - 1]
  flag = False
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split())).sort()
ans = 0
for a, b in zip(A, A[1:]):
  ans += a
print(ans)
Problem p02612 (python)

Fixed submission:
N=int(input())
A=0
for i in range(0,N):
    i=i+1
    A=str(i)+"000"
    A=int(A)
    if N<=A:
        print(A-N)
        break

Buggy submission (verdict: Runtime Error):
N=int(input())
A=0
for i in range(0,10):
    i=i+1
    A=i+"000"
    if N<=A:
        print(A-N)
        break

Buggy submission (verdict: Runtime Error):
N=int(input())
A=""
for i in range(0,10):
    i=i+1
    A=int(i+"000")
    if N<=A:
        print(A-N)
        break
Problem p02621 (python)

Fixed submission:
a=int(input())
B=0
C=0
D=0
B=a
C=a*a
D=a*a*a
print(B+C+D)

Buggy submission (verdict: Runtime Error):
a=int(input())
B=0
C=0
D=0
B=A
C=a*a
D=a*a*a
print(B+C+D)
Problem p02628 (python)

Fixed submission:
N,K=map(int,input().split())
p=list(map(int,input().split()))
B=0
C=0
p.sort()
N=N-5
for i in range(0,K):
    B=B+p[i]
    i=i+1
    
print(B)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input.split())
p=list(int,input().split())
B=0
p.sort()
K=K-1
for i in range(0,K):
    B=B+p[i]
    i=i+1
    
print(B)
Problem p02639 (python)

Fixed submission:
x=list(map(int,input().split()))
if x[0]==0:
    print(1)
elif x[1]==0:
    print(2)
elif x[2]==0:
    print(3)
elif x[3]==0:
    print(4)
else:
    print(5)

Buggy submission (verdict: Runtime Error):
x=list(map(int,input()))
if x[0]==0:
    print(1)
elif x[1]==0:
    print(2)
elif x[2]==0:
    print(3)
elif x[3]==0:
    print(4)
else:
    print(5)
Problem p02645 (python)

Fixed submission:
S=input()
B=0
B=S[0]+S[1]+S[2]
print(B)

Buggy submission (verdict: Runtime Error):
S=input()
print(S[0]S[1]S[2])
Problem p02657 (python)

Fixed submission:
A,B=map(int,input().split())
A=A*B
print(int(A))

Buggy submission (verdict: Runtime Error):
A,B=map(int,input())
A=A*B
print(int(A))

Buggy submission (verdict: Runtime Error):
A,B=map(int,input())
A=A*B
print(A)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input())
A=A*B
print(A)
Problem p02675 (python)

Fixed submission:
N=input()
B=0
B=len(N)
B=B-1
#print(B,N)
if N[B]=='2' or N[B]=='4' or N[B]=='5' or N[B]=='7' or N[B]=='9':
    print('hon')
elif N[B]=='0' or N[B]=='1' or N[B]=='6' or N[B]=='8':
    print('pon')
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
N=input()
B=0
B=len(N)
B=B-1
if N[B]=="2" or N[B]=="4" N[B]=="5" or N[B]=="7" or N[B]=="9":
    print('hon')
elif N[B]=="0" or N[B]=="1" or N[B]=="6"or N[B]=="8":
    print('pon')
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
N=input()
if N[2]==2 and N[2]==4 and N[2]==5 and N[2]==7 and N[2]==9:
    print('hon')
elif N[2]==0 and N[2]==1 and N[2]==6 and N[2]==8:
    print('pon')
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
N=input()
if N[2]=='2' and N[2]=='4' and N[2]=='5' and N[2]=='7' and N[2]=='9':
    print('hon')
elif N[2]=='0' and N[2]=='1' and N[2]=='6' and N[2]=='8':
    print('pon')
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
N=input()
if N[2]='2' and N[2]='4' and N[2]='5' and N[2]='7' andN[2]='9':
    print('hon')
elif N[2]='0' and N[2]='1' and N[2]='6' and N[2]='8':
    print('pon')
else:
    print('bon')
Problem p02687 (python)

Fixed submission:
S=input()
B="ABC"
if S==B:
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
S==input()
B="ABC"
if S==B:
    print("ARC")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
s=input()
if S==ABC:
    print("ARC")
else:
    print("ARC")

Buggy submission (verdict: Runtime Error):
s=input()
if S=="ABC":
    print("ARC")
else:
    print("ARC")
Problem p02700 (python)

Fixed submission:
A,B,C,D=map(int,input().split())
for i in range(0,100):
    C=C-B
    if C<=0:
        print('Yes')
        break
    else:
        A=A-D
        if A<=0:
            print('No')
            break

Buggy submission (verdict: Runtime Error):
A,B,C,D=map(int,input().split())
for i in range(0,99):
    C=C-B
    if C<=0:
        print('Yes')
        break
    else:
        A=A-D
         if A<=0:
            print('No')
            break

Buggy submission (verdict: Runtime Error):
A,B,C,D=map(int,input().split())
for i in range(0,99):
    C=C-B
    if C<=0:
        print('Yes')
         break
    else:
        A=A-D
        if A<=0:
            print('No')
             break
Problem p02706 (python)

Fixed submission:
N,M=map(int,input().split())
A=list(map(int,input().split()))
B=0
for i in A:
    B=B+i       
N=N-B
if 0<=N:
    print(N)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
N=N-M
if =0<N:
   print(N)
else:
   print(-1)

Buggy submission (verdict: Runtime Error):
"N,M".split(",")
N=N-M
if =0<N:
   print(N)
else:
   print(-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=int(input())
N=N-M
if N>0=:
   print(N)
else:
   print(-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=int(input())
N=N-M
if 0<N:
   print(N)
elif 0==N:
   print(0)
else:
   print(-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=int(input())
N=N-M
if 0<N:
   print(N)
elif 0=N:
   print(0)
else:
   print(-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=int(input())
if N>M>:
   print(N-M)
else:
   print(-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=int(input())
N=N-M
if N>0:
   print(N)
else:
   print(-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=int(input())
if N>M:
   print(N-M)
else:
   print(-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=int(input())
if N>M:
  	print(N-M)
else:
  	print(-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=int(input())
if N>M:
    print(N-M)
else:
  	print(-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
M=int(input())
if N>M:
  print(N-M)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
if N>M:
  print(N-M)
else:
  print(-1)
Problem p02724 (python)

Fixed submission:
X=int(input())
A=0
G=0
N=0
M=0
Z=0
N=int(X/500)
M=int(X%500)
Z=int(M/5)
N=N+Z
for i in range(0,N):
    if X>=500:
        X=X-500
        G=G+1000
    elif X>=5:
        X=X-5
        G=G+5
    else:
        break
        
print(G)

Buggy submission (verdict: Runtime Error):
X=int(input())
N=int(input())
Z=int(input())
A=int(input())
G=int(input())
M=int(input())
A=0
G=0
N=0
M=0
Z=0
N=X/500
M=int(X%500)
Z=M/5
N=N+Z
for i in range(0,N):
    if X-500:
        X=X-500
        G=G+1000
    elif X-5:
        X=X-5
        G=G+5
    else:
        break
        
print(G)

Buggy submission (verdict: Runtime Error):
X=int(input())
N=int(input())
Z=int(input())
A=0
G=0
N=0
M=0
Z=0
N=X/500
M=int(X%500)
Z=M/5
N=N+Z
for i in range(0,N):
    if X-500:
        X=X-500
        G=G+1000
    elif X-5:
        X=X-5
        G=G+5
    else:
        break
        
print(G)

Buggy submission (verdict: Runtime Error):
X=int(input())
A=0
G=0
N=0
M=0
Z=0
N=X/500
M=int(X%500)
Z=M/5
N=N+Z
for i in range(0,N):
    if X-500:
        X=X-500
        G=G+1000
    elif X-5:
        X=X-5
        G=G+5
    else:
        break
        
print(G)

Buggy submission (verdict: Runtime Error):
X=int(input())
A=0
G=0
N=0
M=0
Z=0
N=X/500
M=int(X%500)
Z=M/5
N=N+Z
for i in range(0,N):
    if X-500:
        X=X-500
        G=G+1000
    elif X-5:
        X=X-5
        G=G+5
    else:
        break
        
print(G)
Problem p02817 (python)

Fixed submission:
S,T=input().split()
S=T+S
print(S)

Buggy submission (verdict: Runtime Error):
S,T=map(input()split())
print(T.S)
Problem p02641 (python)

Fixed submission:
import numpy as np

x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()

p = np.array(list(map(int, input().split())))
for i in range(100):
    if not x-i in p:
        print(x-i)
        exit()
    elif not x+i in p:
        print(x+i)
        exit()

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n == 0:
    print(x)
    exit()

p = np.array(list(map(int, input().split())))
for i in range(100):
    if not x-i in p:
        print(x-i)
        exit()
    elif not x+i in p:
        print(x+i)
        exit()
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
import numpy as np
a = int(input())
b = np.array(list(map(int, input().split())))
b = np.prod(b)
if b > 10**18:
    print(-1)
else:print(b)

Buggy submission (verdict: Runtime Error):
import numpy as np
a = int(input())
b = np.array(list(map(int, input().split())))
b = np.prod(b)
if b >= 10**18:
    print(-1)
else:print(b)
Problem p02658 (python)

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

if 0 in a:
    print(0)
    exit()

mult = 1

for i in a:
    mult *= i
    if mult > 10**18:
        print(-1)
        exit()
print(mult)

Buggy submission (verdict: Runtime Error):
import numpy as np
a = int(input())
b = np.array(list(map(int, input().split())))
b = np.prod(b)
if b > 10**18:
    print('-1')
else:print(c)

Buggy submission (verdict: Runtime Error):
import numpy as np
a = int(input())
b = np.array(list(map(int, input().split())))
b = np.prod(b)
if b > 10**18:
    print('-1')
else:print(c)

Buggy submission (verdict: Runtime Error):
import numpy as np
a = int(input())
b = np.array(list(map(int, input().split())))
b = np.prod(b)
if c > 10**18:
    print('-1')
else:print(c)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = list(map(int, input().split()))
c = 1
for i in b:
    c *= i
if c > 10**18
    print('-1')
print(c)
Problem p02606 (python)

Fixed submission:
a, b, c = map(int, input().split())
print(int(b/c)-int(a/c+0.999)+1)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, raw_input().split())
print int(b/c)-int(a/c+0.999)+1

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a, b, c = map(int, raw_input().split())
print(int(b/c)-int(a/c+0.999)+1)

Buggy submission (verdict: Runtime Error):
input_line = raw_input()
a = []
for m in input_line.split(" "):
	a += [int(m)]
print(int(a[1]/a[2])-int(a[0]/a[2]+0.999)+1)

Buggy submission (verdict: Runtime Error):
input_line = raw_input()
for m in input_line.split(" "):
	a += [int(m)]
print(int(a[1]/a[2])-int(a[0]/a[2]+0.999)+1)

Buggy submission (verdict: Runtime Error):
input_line = input()
for m in input_line.split(" "):
	a += [int(m)]
print(int(a[1]/a[2])-int(a[0]/a[2]+0.999)+1)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
print(int(b/c)-int(a/c+0.999)+1)
Problem p02608 (python)

Fixed submission:
n = int(input())
ret = [0 for _ in range(1,n+1)]
def f(x,y,z):
	return x*x + y*y + z*z + x*y + y*z + x*z

for x in range(1,n+1):
	for y in range(1,n+1):
		for z in range(1,n+1):
			if f(x,y,z) > n:
				z = 1
				break
			ret[f(x,y,z)-1] += 1
		if f(x,y,z) > n:
			y = 1
			break
	if f(x,y,z) > n:
		x = 1
		break

for i in ret:
	print(i)

Buggy submission (verdict: Runtime Error):
n = int(input())
ret = [0 for _ in range(1,21)]
def f(x,y,z):
	return x*x + y*y + z*z + x*y + y*z + x*z

for x in range(1,n+1):
	for y in range(1,n+1):
		for z in range(1,n+1):
			if f(x,y,z) > n:
				z = 1
				break
			ret[f(x,y,z)-1] += 1
		if f(x,y,z) > n:
			y = 1
			break
	if f(x,y,z) > n:
		x = 1
		break

for i in ret:
	print(i)
Problem p02993 (python)

Fixed submission:
a = int(input())
b = a//1000
c = (a//100)%10
d = (a//10)%10
e = a%10
cou = 0
if b is c:
  cou = cou + 1
elif c is d:
   cou = cou + 1
elif d is e:
   cou = cou + 1
else:
  print("Good")
if cou > 0:
  print("Bad")

Buggy submission (verdict: Runtime Error):
a,b,c,d = list(map(int,input().split()))
cou = 0
if a is b:
  cou = cou + 1
elif b is c:
   cou = cou + 1
elif c is d:
   cou = cou + 1
else:
  print("Good")
if cou > 0:
  print("Bad")

Buggy submission (verdict: Runtime Error):
a,b,c,d = list(map(int,input().split()))
cou = 0
if a is b:
  cou +=1
elif b is c:
  cou +=1
elif c is d:
  cou +=1
else:
  print("Good")
if cou > 0:
  print("Bad")
Problem p03043 (python)

Fixed submission:
a,b = map(int,input().split())
s = b
p = 0.0
for i in range(1,a+1):
	tmp = 1.0/a
	now = i
	while now < b:
		now = now*2
		tmp = tmp/2
	p = p+tmp
print(p)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
s = b
p = 0.0
for i in range(1,a+1):
	tmp = 1.0/a
	now = i
	while now < b:
		now = now*2
        tmp = tmp/2
	p = p+tmp
print(p)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
s = b
p = 0.0
for i in range(1,a+1):
	tmp = 1.0/a
	now = i
	while now < b:
		now = now*2
        tmp = tmp/2
	p = p+tmp
print(p)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
s = b
p = 0.0
for i in range(1,a+1):
	tmp = 1.0/a
	now = i
	while now < b:
		now = now*2
        tmp = tmp/2
	p = p+tmp
print(%.12f%p)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
s = b
p = 0.0
for i in range(1,a+1):
	tmp = 1.0/a
	now = i
	while now < b:
		now = now*2
        tmp = tmp/2
	p = p+tmp
print(%.12f%p)
Problem p02606 (python)

Fixed submission:
param = input()
min, max, power = (param.split())

count = 0
for i in range(int(min), int(max)+1):
    if i % int(power) == 0:
        count += 1

print(count)

Buggy submission (verdict: Runtime Error):
min = int(input())
max = int(input())+1
power = int(input())

count = 0
for i in range(min, max):
    if i % power == 0:
        count += 1

print(count)
Problem p02630 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
arr = [0] * 100005
for val in a:
  arr[val] += 1
sums = sum(a)
q = int(input())
for _ in range(q):
  b, c = map(int,input().split())
  diff = (c-b) * (arr[b])
  sums += diff
  print(sums) 
  arr[c] += arr[b]
  arr[b] = 0

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
arr = [0] * 100000
for val in a:
  arr[val] += 1
sums = sum(a)
q = int(input())
for _ in range(q):
  b, c = map(int,input().split())
  diff = (c-b) * (arr[b])
  sums += diff
  print(sums) 
  arr[c] += arr[b]
  arr[b] = 0

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
arr= [0] * 10**5
for val in a:
  arr[val]+=1
sums=sum(a)
q=int(input())
for _ in range(q):
  b,c=map(int,input().split())
  diff=(c-b)*(arr[b])
  sums+=diff
  print(sums) 
  arr[c]+=arr[b]
  arr[b]=0
Problem p02995 (python)

Fixed submission:
def gcd(x,y):
    if x<y:
        x,y=y,x
    if y==0:
        return x
    c=x%y
    return gcd(y,c)   
def lcm( x, y):
    return (x*y)//gcd(x,y)
a,b,c,d=map(int,input().split())
C =b//c-(-(-a//c))
D= b//d-(-(-a//d))
EX=  lcm(c,d)
EX=b//EX+(-a//EX)
print(b-a-(C+D)+EX)

Buggy submission (verdict: Runtime Error):
from math import gcd
def lcm( x, y):
    return (x*y)//gcd(x,y)
a,b,c,d=map(int,input().split())
C =b//c-a//c
D= b//d-a//d
EX=  lcm(c,d)
EX=b//EX-a//EX
print(b-a+1-(C+D)+EX)

Buggy submission (verdict: Runtime Error):
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<stdio.h>
//#include<array>

#define rep(i,n) for(int i=0;i<(n);i++)
#define LL long long int


using namespace std;

int main(void){
    LL a,b,c,d;
    cin >> a>>b>>c>>d;

    LL ans=0;
    

    LL C =b/c-a/c;
    LL D= b/d-a/d;
      /* 
    for(int i =a; i<b; i++){

        if(i%c!=0 && i%d!=0){
            ans++;
        }

    }*/
    /* vector<LL> lista(C);
    int h=0;
    for(LL i =a/c,h=0;i<b/c;h++,i++){
        lista[h]=i*a;
        cout<<lista[h]<< " " << h<< " " << i<< " " << i*a<<endl;
    }
    LL x;
  
    LL j=0;
    LL EX=0;
   for(LL i =a/d;i<b/d;i++){
        x=i*b;
         while(x>lista[j] )j++;
        cout<<x<< " " << lista[j]<< " " << h<< " " << j<<endl;
        if(lista[j]==x)EX++;
        if( h>j)break;

   }*/

    cout <<b-a+1-(C+D)<<endl;
    return 0;
}

Buggy submission (verdict: Runtime Error):
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<stdio.h>
//#include<array>

#define rep(i,n) for(int i=0;i<(n);i++)
#define LL long long int


using namespace std;

int main(void){
    LL a,b,c,d;
    cin >> a>>b>>c>>d;

    LL ans=0;
    /* 
    for(int i =a; i<b; i++){

        if(i%c!=0 && i%d!=0){
            ans++;
        }

    }*/

    LL C =b/c-a/c;
      LL D= b/d-a/d;
    /* vector<LL> lista(C);
    int h=0;
    for(LL i =a/c,h=0;i<b/c;h++,i++){
        lista[h]=i*a;
        cout<<lista[h]<< " " << h<< " " << i<< " " << i*a<<endl;
    }
    LL x;
  
    LL j=0;
    LL EX=0;
   for(LL i =a/d;i<b/d;i++){
        x=i*b;
         while(x>lista[j] )j++;
        cout<<x<< " " << lista[j]<< " " << h<< " " << j<<endl;
        if(lista[j]==x)EX++;
        if( h>j)break;

   }*/

    cout <<b-a+1-(C+D)<<endl;
    return 0;
}
Problem p03060 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
x=[v[i]-c[i] for i in range(n)]
x.sort(reverse=True)
i=0
ans=0
while x[i]>0 :
    ans+=x[i]
    i=i+1
    if i==n:
        break
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
x=[v[i]-c[i] for i in range(n)]
x.sort(reverse=True)
i=0
ans=0
while x[i]>0:
    ans+=x[i]
    i=i+1
print(ans)