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

Fixed submission:
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
bc=[]
for i in range(M):
  bc.append(list(map(int,input().split())))

bc.sort(key=lambda x:x[1],reverse=True)
nbc=[0]*N
inde=0
for i in range(M):
  for j in range(bc[i][0]):
    if inde<=N-1:
      nbc[inde]=bc[i][1]
      inde+=1
      if inde==N:
        break
  if inde==N:
    break
  
ind=N
for i in range(N):
  if A[i]>=nbc[i]:
    ind=i
    break

print(sum(nbc[:ind])+sum(A[ind:]))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
bc=[]
for i in range(M):
  bc.append(list(map(int,input().split())))

bc.sort(key=lambda x:x[1],reverse=True)
nbc=[0]*N
inde=0
for i in range(M):
  for j in range(bc[i][0]):
    if inde<N-1:
      nbc[inde]=bc[i][1]
      inde+=1
    elif inde==N-1:
      nbc[inde]=bc[i][1]
      break
      
    
    

      
for i in range(N):
  if A[i]>=nbc[i]:
    ind=i
    break

print(sum(nbc[:ind])+sum(A[ind:]))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
bc=[]
for i in range(M):
  bc.append(list(map(int,input().split())))

bc.sort(key=lambda x:x[1],reverse=True)
nbc=[]
for i in range(M):
  for j in range(bc[i][0]):
    if len(nbc)<=N:
      nbc.append(bc[i][1])

while len(nbc)<=N:
  nbc.append(0)
      
for i in range(N):
  if A[i]>=nbc[i]:
    ind=i
    break

print(sum(nbc[:ind]+A[ind:]))
Problem p03108 (python)

Fixed submission:
import sys
sys.setrecursionlimit(100000)
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(M)]
AB.reverse()
par=list(range(1,N+1))
size=[1]*N

ans=[(N-1)*N//2]*M

def spar(n):
  if par[n-1]==n:
    return n
  else:
    par[n-1]=spar(par[n-1])
    return par[n-1]

for i in range(0,M-1):
  A,B=AB[i]
  pa,pb=spar(par[A-1]),spar(par[B-1])
  if pa==pb:
    ans[i+1]=ans[i]
  else:
    ans[i+1]=ans[i]-size[pa-1]*size[pb-1]
    sa,sb=size[pa-1],size[pb-1]
    size[pa-1]+=sb
    size[pb-1]+=sa
  par[pa-1]=pa
  par[pb-1]=pa
  
for i in reversed(ans):
  print(i)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(M)]
AB.reverse()
par=list(range(1,N+1))
size=[1]*N

ans=[(N-1)*N//2]*M

def spar(n):
  if par[n-1]==n:
    return n
  else:
    return spar(par[n-1])

for i in range(0,M-1):
  A,B=AB[i]
  pa,pb=spar(par[A-1]),spar(par[B-1])
  if pa==pb:
    ans[i+1]=ans[i]
  else:
    ans[i+1]=ans[i]-size[pa-1]*size[pb-1]
    sa,sb=size[pa-1],size[pb-1]
    size[pa-1]+=sb
    size[pb-1]+=sa
  par[pa-1]=pa
  par[pb-1]=pa
  
for i in reversed(ans):
  print(i)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(M)]
AB.reverse()
par=list(range(1,N+1))
size=[1]*N

ans=[(N-1)*N//2]*M

def spar(n):
  if par[n-1]==n:
    return n
  else:
    return spar(par[n-1])

for i in range(0,M-1):
  A,B=AB[i]
  pa,pb=spar(par[A-1]),spar(par[B-1])
  if pa==pb:
    ans[i+1]=ans[i]
  else:
    ans[i+1]=ans[i]-size[pa-1]*size[pb-1]
    sa,sb=size[pa-1],size[pb-1]
    size[pa-1]+=sb
    size[pb-1]+=sa
  par[pa-1]=pa
  par[pb-1]=pa
  
for i in reversed(ans):
  print(i)
Problem p03135 (python)

Fixed submission:
T,X=map(int,input().split())
print(T/X)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
lk=len(bin(K))-2
C=[0]*lk
for j in range(N):
  a=A[j]
  for i in range(lk):
    if a%2==1:
      C[i]+=1
    a=(a-a%2)//2

X="0b"
for i in reversed(range(lk)):
  if C[i]>=N-C[i]:
    X+="0"
  else:
    X+="1"
    
if int(X,0)<=K:
  X=int(X,0)
  ans=0
  for i in range(N):
    ans+=X^A[i]
  print(ans)
else:
  ans=-1
  for i in range(2,lk+2):
    x=int(bin(K)[:i]+"0"+X[i+1:],0)
    if x<=K:
      a=0
      for i in range(N):
        a+=x^A[i]
      ans=max(ans,a)
  print(ans)
Problem p02712 (python)

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

Buggy submission (verdict: Runtime Error):
N = input()
xx= 0
for i in range(1,N+1):
    if((i%3!=0)&(i%5!=0)):
        xx += i
print(xx)
Problem p02711 (python)

Fixed submission:
n = list(input())
ans = 0
for i in range(len(n)):
  if n[i] == "7":
    ans += 1
print("Yes" if ans > 0 else "No")

Buggy submission (verdict: Runtime Error):
n = input()
ans = 0
for i in range(len(n)):
  if n[i] == "7":
	ans += 1
print("Yes" if ans > 0 else "No")
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):
N,A,B = map(int,input().split())
a = N//(A+B)
ans = a*A
ans2 = min(N-(A+B)*a,A)
print(ans+ans2)
Problem p02754 (python)

Fixed submission:
N,A,B = map(int,input().split())
a = N//(A+B)
ans = a*A
ans2 = min(N-(A+B)*a,A)
print(ans+ans2)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())
i = a + b
for i in range(n):
  sum += sum + 1

sum = sum + a
print(sum)
Problem p02766 (python)

Fixed submission:
n,k = map(int, input().split())
cnt=0
while n!=0:
    n=n//k
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
N,R = map(int, input().split())
sum = 0
while(n != 0):
  n = n // k
  sum += 1;
print(sum)
Problem p02771 (python)

Fixed submission:
A, B, C = map(int, input().split())
if len(set({A, B, C})) == 2:
       print("Yes")
else:
       print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int, input().split()))
for a in A:
    if a%2 == 0 and ( a%3 != 0 and a%5 != 0 ):
        print('DENIED')
        exit()
print('APPROVED')
Problem p02711 (python)

Fixed submission:
N = int(input())
oh = N//100
ot = (N-oh*100)//10
oo = N-oh*100-ot*10
if oh==7 or ot==7 or oo==7:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = input()
oh = N//100
ot = (N-oh*100)//10
oo = N-oh*100-ot*10
if oh==7 or ot==7 or oo==7:
    print('Yes')
else:
    print('No')
Problem p03209 (python)

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

cnt = [0,1]
tmp = [[0,1]]

for i in range(n):

    tmp.append([cnt[0] * 2 + 2,cnt[1] * 2 + 1])
    cnt[0] = cnt[0] * 2 + 2
    cnt[1] = cnt[1] * 2 + 1

"""
半分に区切ってジャスト半分なら前の分+1を出力
大きければ前の分+1を足して次
小さければ数える数を1小さくしてレベルを下げる
"""
num = 0
for i in range(n,0,-1):
    if (sum(tmp[i])+1)/2 == k:
        num += tmp[i-1][1]+1
        break
    elif (sum(tmp[i])-1)/2 == k:
        num += tmp[i-1][1]
        break
    elif sum(tmp[i]) == k or sum(tmp[i])-1 == k:
        num += tmp[i][1]
        break
    elif (sum(tmp[i])-1)/2 < k:
        num += tmp[i-1][1]+1
        k = k - sum(tmp[i-1]) - 2
    elif (sum(tmp[i])-1)/2 > k:
        k = k - 1
print(num)

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

def make_barger(str):
    return "0" + str + "1" + str + "0"
str = "1"
for i in range(n):
    str = make_barger(str)
cnt = 0
for s in str[-k:]:
    cnt += int(s)
print(cnt)
Problem p02723 (python)

Fixed submission:
S = input()

if  S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")

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

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

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

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

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

Buggy submission (verdict: Runtime Error):
import random
letters = 'abcdefghijklmnopqrstuvwxyz'
S=random.choices(letters, k=5)
if  S[2] == S[3] and S[4] == S[5]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
S='ejkld'
a=S[2]
b=S[3]
c=S[4]
d=S[5]

if  a == b and c == d:
    print("yes")
else:
    print("no")
Problem p02790 (python)

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

if a > b:
    ans = ''
    for target_list in range(a):
        ans = ans + str(b)

    print(ans)

if b > a:
    ans = ''
    for target_list in range(b):
        ans = ans + str(a)

    print(ans)
    

if b == a:
    ans = ''
    for target_list in range(b):
        ans = ans + str(a)

    print(ans)

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

if a > b:
    ans = ''
    for target_list in range(a):
        ans = ans + str(b)

    print(ans)

if b > a:
    ans = ''
    for target_list in range(b):
        ans = ans + str(a)

    print(ans)
    

if b == a:
ans = ''
    for target_list in range(b):
        ans = ans + str(a)

    print(ans)

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

if a > b:
    ans = ''
    for target_list in range(a):
        ans = ans + str(b)

    print(ans)

if b > a:
    ans = ''
    for target_list in range(b):
        ans = ans + str(a)

    print(ans)
    

if b == a:
ans = ''
    for target_list in range(b):
        ans = ans + str(a)

    print(ans)
Problem p02829 (python)

Fixed submission:
A = int(input())
B = int(input())
ans = [1,2,3]
ans.remove(A)
ans.remove(B)
print(ans[0])

Buggy submission (verdict: Runtime Error):
A = input()
B = input()

ans = [1,2,3]
ans.remove(A)
ans.remove(B)
print(ans[0])
Problem p02831 (python)

Fixed submission:
import fractions
a = list(map(int, input().split()))
print(a[0]*a[1] // fractions.gcd(a[0], a[1]))

Buggy submission (verdict: Runtime Error):
import math
a = list(map(int, input().split()))
print(a[0]*a[1] // math.gcd(a[0], a[1]))

Buggy submission (verdict: Runtime Error):
import math
a = list(map(int, input().split()))
print(str(int(a[0]*a[1] / math.gcd(a[0], a[1]))))

Buggy submission (verdict: Runtime Error):
import math
a = list(map(int, input().split()))
print(int(a[0]*a[1] / math.gcd(a[0], a[1])))

Buggy submission (verdict: Runtime Error):
import math
a = list(map(int, input().split()))
print(int(a[0]*a[1] / math.gcd(a[0], a[1])))

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
def lcm(x, y):

print(lcm(a[0], a[1]))

Buggy submission (verdict: Runtime Error):
A,B = int(input().split(' '))
def lcm(x, y):
    return (x * y)
print(lcm(A, B))
Problem p02712 (python)

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

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

s = 0
for n in range(1, N+1):
    if n % 3 != 0 and n % 5 != 0:
        s += n
print(s)
Problem p02879 (python)

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

if a < 10 and b < 10:
  print(a * b)
else:
  print(-1)

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

if len(a) == 1 and len(b) == 1:
  print(a * b)
else:
  print(-1)
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
  print(s)
else:
  print('red')

Buggy submission (verdict: Runtime Error):
a, s = input().split()
a = int(a)

if a >= 3200:
  print(s)
else:
  print('red')

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

if a >= 3200:
    print(s)
else:
    print('red')
Problem p02725 (python)

Fixed submission:
K,N = map(int,input().split())	
A = list(map(int,input().split()))
D=[A[0]-A[-1]+K]
for i in range(N-1):
    D.append(A[i+1]-A[i])
print(K-max(D))

Buggy submission (verdict: Runtime Error):
k,n = map(int,input().split())	
a = list(map(int,input().split()))
D=[A[0]-A[-1]+K]
for i in range(N-1):
    D.append(A[i+1]-A[i])
print(K-max(D))
Problem p03075 (python)

Fixed submission:
args = {}
l = ["a", "b", "c", "d", "e", "k"]
for i in range(len(l)):
    args[l[i]] = int(input())
for i in range(len(l) - 1):
    j = 5-i
    for m in range(len(l) - 2):
        n = j - (m+1)
        if n <= 0:
            continue
        if args[l[j-1]] - args[l[n-1]] > args["k"]:
            print(':(')
            exit()
print("Yay!")

Buggy submission (verdict: Runtime Error):

args = {}

l = ["a", "b", "c", "d", "e", "k"]
for i in range(len(l)):
    args[l[i]] = int(input())


# 5-4
# 5-3
# 5-2
# 5-1

# 4-3
# 4-2
# 4-1

# 3-2
# 3-1

# 2-1

for i in range(len(l) - 1):
    j = 5-i
    for m in range(len(l) - 2):
        n = j - (m+1)
        if n <= 0:
            continue
        if l[j] - l[n] > l["k"]:
            print(':(')
            exit()
print("Yay!")
Problem p02711 (python)

Fixed submission:
N = input()
A="No"
for i in range(len(N)):
    if N[i]=="7":
        A = "Yes"
        break
        
    
 
print(A)

Buggy submission (verdict: Runtime Error):
N = input()
A="No"
for i in range(len(N)):
    if N[i]="7":
        A = "Yes"
        break
        
    

print(A)
Problem p02711 (python)

Fixed submission:
N = int(input())
f = 0
a = N//100
b = (N-a*100)//10
c = N-a*100-b*10
if a == 7 or b == 7 or c == 7:
    f = 1
if f == 1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N = int(input())
f = 0
a = N//100
b = (N-a*100)//10
c = N-a*100-b*10
if a == 7 or b == 7 or c == 7:
    f = 1
if f == 1:
    print(Yes)
else:
    print(No)
Problem p02726 (python)

Fixed submission:
a = list(map(int,input().split()))
N = a[0]
X = a[1]
Y = a[2]
ans = list(range(N))
for k in range(1,N):
  ans[k] = 0
 
for i in range(1,N):
  for j in range(i+1,N+1):
    k = min(j-i,abs(X-i)+1+abs(j-Y))
    ans[k] = ans[k]+1
 
for t in range(1,N):
  print(ans[t])

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
N = a[0]
X = a[1]
Y = a[2]
ans = []
for k in range(1,N+1):
  ans[k] = N-k

for i in range(1,N):
  for j in range(2,N+1):
    k = min(j-i,abs(X-i)+1+abs(j-Y))
    ans[k] = ans[k]+1

for dist in ans:
  print(dist)
Problem p03631 (python)

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

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int, input().split())
if D<A or B<C: print("0")
elif A<C and D<B: print(D-C)
elif C<A and B<D: print(B-A)
elif D-A < B-C: print(D-A)
else: print(B-C)

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int, input().split())
if D<A or B<C: print("0")
else if D-A < B-C: print(D-A)
else: print(B-C)

Buggy submission (verdict: Runtime Error):
N = input()
if N[0] == N[2]: print(Yes)
Problem p02777 (python)

Fixed submission:
s, t = input().split()
a, b = map(int, input().split())
u = input()

if u == s:
    a -= 1
elif u == t:
    b -= 1

print('{0} {1}'.format(a, b))

Buggy submission (verdict: Runtime Error):
import copy
n = input()
k = int(input())

n_list = []
for a in n:
    n_list.append(int(a))
n_num = len(n_list)

dp = [[0] * 2 for _ in range(n_num)]
dp[0][0] = 1
for i in range(n_num):
    nxt = [[0] * 2 for _ in range(n_num + 1)]
    for j in range(n_num):
        for l in range(2):
            lim = 9 if l else n_list[i]
            for x in range(lim + 1):
                if x != 0:
                    ns = j + 1
                else:
                    ns = j
                nlt = l | (x < n_list[i])
                nxt[ns][nlt] += dp[j][l]
    dp = copy.deepcopy(nxt)
ans = dp[k][0] + dp[k][1]
print(ans)
Problem p02723 (python)

Fixed submission:
s = input()

s_list = [i for i in s]

if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
x, y, a, b, c = list(map(int, input().split(' ')))
p_list = sorted(list(map(int, input().split(' '))), reverse=True)
q_list = sorted(list(map(int, input().split(' '))), reverse=True)
r_list = sorted(list(map(int, input().split(' '))), reverse=True)

xy_list = sorted(p_list[:x] + q_list[:y])

i = 0
for r in range(c):
    if r_list[r] > xy_list[0]:
        i += 1
    else:
        break

if i == 0:
    print(sum(xy_list))
else:
    print(sum(xy_list[i:] + r_list[:i]))

Buggy submission (verdict: Runtime Error):
import itertools as it
import collections
 
n, x, y = list(map(int, input().split(' ')))
 
dist_list = []
dist_a = dist_list.append
for i, j in it.combinations(list(range(n)), 2):
    warp_dist = abs(i - (x - 1)) + 1 + abs(j - (y - 1))
    if abs(j - i) < warp_dist:
        dist_a(abs(j - i))
    else:
        dist_a(warp_dist)
 
dist_c = collections.Counter(dist_list)
 
for i in range(1, n):
    print(dist_c[i])

Buggy submission (verdict: Runtime Error):
import itertools as it
import collections

n, x, y = list(map(int, input().split(' ')))

dist_list = []
dist_a = dist_list.append
for i, j in it.combinations(list(range(n)), 2):
    warp_dist = abs(i - (x - 1)) + 1 + abs(j - (y - 1))
    if abs(j - i) < warp_dist:
        dist_a(abs(j - i))
    else:
        dist_a(warp_dist)

dist_c = collections.Counter(dist_list)

for i in range(1, n):
    print(dist_c[i])
Problem p02711 (python)

Fixed submission:
a = input()
if '7' in a:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
import sys
a = sys.argv[1]
if '7' in a:
	print("Yes")
else:
	print("No")
Problem p02712 (python)

Fixed submission:

a = input()
t= sum([i for i in range(int(a)+1) if i %5 != 0 and i %3 != 0])
print(t)

Buggy submission (verdict: Runtime Error):
import sys
a = sys.argv[1]
t= sum([i for i in range(int(a)+1) if i %5 != 0 and i %3 != 0])
print(t)
Problem p03774 (python)

Fixed submission:
n, m = map(int, input().split())
pos = []
che = []
for i in range(n):
    a, b = map(int,input().split())
    pos.append([a,b])
for i in range(m):
    a, b = map(int,input().split())
    che.append([a,b])
 
for i in range(n):
    dis = []
    for j in range(m):
        dis.append(abs(pos[i][0]-che[j][0])+abs(pos[i][1]-che[j][1]))
    print(dis.index(min(dis))+1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
pos = []
che = []
for i in range(n):
    a,b=map(int,input().split())
    pos.append([a,b])
for i in range(m):
    a,b=map(int,input().split())
    che.append([a,b])

for i in range(n):
    dis = []
    for j in range(m):
        dis.append(abs(pos[i][0]-che[i][0])+abs(pos[i][1]-che[i][1]))
    print(dis.index(min(dis))+1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
print(n,m)
pos = []
che = []
for i in range(n):
    a,b=map(int,input().split())
    pos.append([a,b])
for i in range(m):
    a,b=map(int,input().split())
    che.append([a,b])

for i in range(n):
    dis = []
    for j in range(m):
        dis.append(abs(pos[i][0]-che[i][0])+abs(pos[i][1]-che[i][1]))
    print(dis.index(min(dis))+1)
Problem p03803 (python)

Fixed submission:
a, b = map(int, input().split())
l = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]

if l.index(a) > l.index(b):
    print("Alice")
elif l.index(a) == l.index(b):
    print("Draw")
else:
    print("Bob")

Buggy submission (verdict: Runtime Error):
import sys

n, m = map(int, input().split())

a = []
for i in range(n):
    a.append(list(input()))

b = []
for i in range(m):
    b.append(list(input()))

for i in range(n-m+1):
    for j in range(n-m+1):
        for k in range(m):
            if k <= m-2:
                if a[i+k][j:j+m] == b[k]:
                    continue
                else:
                    break
            else:
                if a[i+k][j:j+m] == b[k]:
                    print("Yes")
                    sys.exit()
                else:
                    break

print("No")
Problem p02829 (python)

Fixed submission:
A = int(input())
B = int(input())

c = A + B
 
if c == 3:
    print(3)
elif c == 4:
    print(2)
elif c == 5:
    print(1)

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

c = a + b

if a == 1 and b == 2:
    print(3)
elif b == 1 and a == 2:
    print(3)
elif a == 1 and b == 3:
    print(2)
elif b == 1 and a == 3:
    print(2)
elif a == 2 and b == 3:
    print(1)
else b == 2 and a == 3:
    print(1)

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

c = a + b

if a == 1 and b == 2:
    print(3)
elif b == 1 and a == 2:
    print(3)
elif a == 1 and b == 3:
    print(2)
elif b == 1 and a == 3:
    print(2)
elif a == 2 and b == 3:
    print(1)
elif b == 2 and a == 3:
    print(1)

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

if c == 3:
    print(3)
elif c == 4:
    print(2)
elif c == 5:
    print(1)

exit()

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

if c == 3:
    print(3)
elif c == 4:
    print(2)
elif c == 5:
    print(1)
Problem p02831 (python)

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

Buggy submission (verdict: Runtime Error):
import math

def lcm(a, b):
	return a * b // math.gcd (a, b)

c, d = map(int, input().split())

print(lcm(c, d))

Buggy submission (verdict: Runtime Error):
import math
def lcm(a, b):
	return a * b // math.gcd (a, b)

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

print(lcm(a, b))
Problem p02762 (python)

Fixed submission:
class UnionFind:
    def __init__(self, N, l):
        self.roots = list(range(N+1))
        self.counter = [1]*(N+1)
        for a, b in l:
            self.union(a, b)
 
    def get_root(self, n):
        if self.roots[n] != n:
            self.roots[n] = self.get_root(self.roots[n])
        return self.roots[n]
 
    def union(self, a, b):
        a, b = sorted([self.get_root(a), self.get_root(b)])
        if a != b:
            self.roots[b] = a
            self.counter[a] += self.counter[b]
            self.counter[b] = 0
 
    def find(self, a, b):
        return self.get_root(a) == self.get_root(b)
 
    def count(self, x):
        return(self.counter[self.get_root(x)])
 
 
N, M, K = [int(i) for i in input().split()]
ab = [[int(i) for i in input().split()] for _ in range(M)]
cd = [[int(i) for i in input().split()] for _ in range(K)]
friend = [[] for _ in range(N+1)]
uf = UnionFind(N, ab)
 
for a, b in ab:
    friend[a].append(b)
    friend[b].append(a)
 
ans = [uf.count(i)-1-len(friend[i]) for i in range(N+1)]
 
for c, d in cd:
    if uf.find(c, d):
        ans[c] -= 1
        ans[d] -= 1
 
print(*ans[1:])

Buggy submission (verdict: Runtime Error):
import sys
from io import StringIO
import unittest

def resolve():
    N, M, K = [int(x) for x in input().split()]
    global list, block, seen, osusume
    list = [[] for _ in range(N)]
    block = [[] for _ in range(N)]
    seen = [[False] * N for _ in range(N)]
    osusume = [[] for _ in range(N)]

    for _ in range(M):
        A, B = [int(x)-1 for x in input().split()]
        list[A].append(B)
        list[B].append(A)

    for _ in range(K):
        C, D = [int(x)-1 for x in input().split()]
        block[C].append(D)
        block[D].append(C)

    for i in range(N):
        dfs(i, i)
        print(len(osusume[i]), end=" ")

def dfs(v, origin):
    stacka = list[v]
    seen[origin][v] = True

    if not v in list[origin] and not v in block[origin] and v != origin:
        osusume[origin].append(v)

    for i in stacka:
        if(seen[origin][v] == True):
            dfs(i, origin)

resolve()

Buggy submission (verdict: Runtime Error):
import sys
from io import StringIO
import unittest

def resolve():
    N, M, K = [int(x) for x in input().split()]
    global list, block, seen, osusume
    list = [[] for _ in range(N)]
    block = [[] for _ in range(N)]
    seen = [[False] * N for _ in range(N)]
    osusume = [[] for _ in range(N)]

    for _ in range(M):
        A, B = [int(x)-1 for x in input().split()]
        list[A].append(B)
        list[B].append(A)

    for _ in range(K):
        C, D = [int(x)-1 for x in input().split()]
        block[C].append(D)
        block[D].append(C)

    for i in range(N):
        dfs(i, i)
        print(len(osusume[i]), end=" ")

def dfs(v, origin):
    stacka = list[v]
    seen[origin][v] = True

    if not v in list[origin] and not v in block[origin] and v != origin:
        osusume[origin].append(v)

    for i in stacka:
        if(seen[origin][v] == True):
            dfs(i, origin)
resolve()
Problem p02859 (python)

Fixed submission:
r=int(input())
print(r*r)

Buggy submission (verdict: Runtime Error):
r=int(input())
print(r＊r)

Buggy submission (verdict: Runtime Error):
r=int(input())
print(r＊＊2)