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

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

if A>=H:
	print(1)
elif H%A==0:
	print(H//A)
else:
	print((H//A)+1)

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

if A>=H:
	print(1)
else:
  print((N//M)+1)
Problem p02791 (python)

Fixed submission:
N=int(input())
p=list(map(int, input().split()))
 
cnt=0
min=p[0]
for i in range(N):
	if p[i]<=min:
		min=p[i]
		cnt+=1
	
print(cnt)

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

cnt=0
min=p[0]
for i in range(N):
	if p[i]<=min:
		min=p[i]
        cnt+=1
	
print(cnt)

Buggy submission (verdict: Runtime Error):
N=int(input())
p=list(map(int, input().split()))
cnt=0
min=p[0]
for i in range(N):
	if p[i]<=min:
		min=p[i]
        cnt+=1
        
print(cnt)
Problem p02802 (python)

Fixed submission:
N, M=map(int, input().split())
ac=[0]*N
wa=[0]*N

for i in range(M):
    p, S=input().split()
    p=int(p)
    if ac[p-1]==0:
        if S=="AC":
            ac[p-1]=1
        elif S=="WA":
            wa[p-1]+=1
            
wacnt=0
for i in range(N):
	if ac[i]>=1:
		wacnt+=wa[i]
		
print(sum(ac), wacnt)

Buggy submission (verdict: Runtime Error):
N, M=map(int, input().split())
ac=[0]*N
wa=[0]*N

for i in range(M):
    p, S=input().split()
    p=int(p)
    if ac[p-1]==0:
        if S=="AC":
            ac[p-1]=1
        elif S=="WA":
            wa[p-1]+=1
            
wacnt=0
for i in range(N):
	if ac[i]>=1:
      wacnt+=wa[i]
		
print(sum(ac), wacnt)
Problem p02813 (python)

Fixed submission:
import itertools

N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
U = list(itertools.permutations(range(1, N+1)))
a = U.index(P)
b = U.index(Q)
print(abs(a-b))

Buggy submission (verdict: Runtime Error):
import itertools
 
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
U = list(itertools.permutations(range(1, N+1)))
a = U.index(P)
b = U.index(Q)
print(abs(a-b))

Buggy submission (verdict: Runtime Error):
import itertools

N= int(input())
P=list(map(int, input().split()))
Q=list(map(int, input().split()))
p = list(itertools.permutations(P))
a = p.index(P)
b = p.index(Q)
print(abs(a - b))

Buggy submission (verdict: Runtime Error):
import itertools

N= int(input())
P=list(map(int, input().split()))
Q=list(map(int, input().split()))
p = list(itertools.permutations(range(1, N + 1)))
a = p.index(P)
b = p.index(Q)
print(abs(a - b))
Problem p02837 (python)

Fixed submission:
n=int(input())
word=[]

for i in range(n):
    a=int(input())
    l=[list(map(int, input().split())) for j in range(a)]
    word.append(l)

ans=0

for i in range(2**n):
    flag=0
    cnt=0
    for j in range(n):
        if((i>>j)&1)==1 and flag==0:
            for k in range(len(word[j])):
                if ((i>>word[j][k][0]-1)&1) != word[j][k][1]:
                    flag=1
                    break
    
    if flag==0:
        cnt=bin(i).count("1")
        ans=max(ans, cnt)

print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
ans=0

for i in range(2**n):
    m=bin(i)[2:].rjust(n, "0")
    cnt=0
    flag=0
    for j in range(n):
        A=int(input())
        if m[j]=="0":
            for k in range(A):
                b, c =input().split()

        elif m[j]=="1":
            for k in range(A):
                b ,c =input().split()
                b=int(b)
                if m[b-1]!=int(c):
                    flag=1
                elif m[b-1]==int(c) and c=="1":
                    cnt+=1
    
    if flag==0 and cnt>ans:
        ans=cnt

print(ans)
Problem p02861 (python)

Fixed submission:
import math
N = int(input())
xi = []
yi = []

for i in range(N):
  x, y = map(int, input(). split())
  xi.append(x)
  yi.append(y)

L=0

for j in range(N):
  for k in range(N):
    if j >= k:
      continue
    L += math.sqrt((xi[j]-xi[k])**2 + (yi[j]-yi[k])**2)
    
print(2*L/N)

Buggy submission (verdict: Runtime Error):
N = int(input())
xi = []
yi = []

for i in range(N):
  x, y = map(int, input(). split())
  xi.append(x)
  yi.append(y)
  
for j in range(N):
  for k in range(N):
    if j >= k:
      continue
    L += math.sqrt((xi[j]-xi[k])**2 + (yi[j]-yi[k])**2)
    
print(2*L/N)
Problem p02911 (python)

Fixed submission:
N, K, q=map(int, input().split())
score=[0]*N

for i in range(q):
    tmp=int(input())
    score[tmp-1]+=1

for i in range(N):
    if K-(q-score[i])>0:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N, K, q=map(int, input().split())
score=[0]*N

for i in range(q):
    score[q-1]+=1

for i in range(N):
    if score[i]-K<=0:
        print("No")
    else:
        print("Yes")
Problem p02995 (python)

Fixed submission:
import fractions
a, b, c, d=map(int, input().split())
k=fractions.gcd(c, d)
lcm=c*d//k
x=b//c - (a-1)//c
y=b//d - (a-1)//d
z=b//lcm - (a-1)//lcm
print(b-a+1-(x+y-z))

Buggy submission (verdict: Runtime Error):
import math
a, b, c, d=map(int, input().split())
k=math.gcd(c, d)
lcm=c*d//k
x=b//c - a//c
y=b//d - a//d
z=b//lcm - a//lcm
print(b-a+1-(x+y-z))
Problem p03087 (python)

Fixed submission:
n ,q=map(int, input().split())
s=input()
t=[0]*(n+1)

for i in range(n):
    if s[i:i+2]=="AC":
        c=1
    else:
        c=0

    t[i+1]=t[i]+c

for i in range(q):
    l, r=map(int, input().split())
    print(t[r-1]-t[l-1])

Buggy submission (verdict: Runtime Error):
n, q=map(int, input().split())
s=input()
ans=[]

for i in range(q):
    l, r=map(int, input().split())
    cnt=0

    for j in range(l-1, r):
        if s[j]=="A" and s[j+1]=="C":
            if j==r-1:
                pass
            else:
                cnt+=1

    ans.append(cnt)

for i in range(q):
    print(ans[i])
Problem p03206 (python)

Fixed submission:
D = int(input())
if D == 25:
  print("Christmas")
elif D == 24:
  print("Christmas Eve")
elif D == 23:
  print("Christmas Eve Eve")
elif D == 22:
  print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
N = int(input())
list = [int(input())for _ in range(N)]
print(round(sum(list) - max(list)/2))
Problem p03210 (python)

Fixed submission:
age = int(input())
if age == 3:
  print("YES")
elif age == 5:
  print("YES")
elif age == 7:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
S = input()
min = 999
for i in range(len(S)-2):
  if min > abs(int(S[i:i+3])-753):
    min = abs(int(S[i:i+3]-753)
    
print(min)
Problem p03211 (python)

Fixed submission:
S = input()
min = 999
for i in range(len(S)-2):
  if min > abs(int(S[i:i+3])-753):
    min = abs(int(S[i:i+3])-753)
    
print(min)

Buggy submission (verdict: Runtime Error):
S = input()
min = 100000000
for i in len(S-3):
  if min > abs(int(S[i]*100) + int(S[i+1]*10) + int(S[i+2]) - 753):
    min = abs(int(S[i]*100) + int(S[i+1]*10) + int(S[i+2]) - 753)
    
print(abs(int(S[i]*100) + int(S[i+1]*10) + int(S[i+2]) - 753))
Problem p03212 (python)

Fixed submission:
n = int(input())
def f(s):
  if int(s) > n:
    return 0 #再帰終了
  if s.count("3") > 0 and s.count("5") > 0 and s.count("7") > 0:
  	cnt = 1
  else:
  	cnt = 0
  cnt += f(s + "3")
  cnt += f(s + "5")
  cnt += f(s + "7")
  return cnt
  
result = f("0")
print(result)

Buggy submission (verdict: Runtime Error):
N=int(input())
cnt=0
 
for i in range(1, N+1):
    i=str(i)
    if "1" in i or "2" in i or "4" in i or "6" in i or "8" in i or "9" in i or "0" in i:
        continue
    elif "3" in i and "5" in i and "7" in i:
        cnt+=1
 
print(cnt

Buggy submission (verdict: Runtime Error):
n = input()
def f(s):
  if int(s) > n:
    return 0 #再帰終了
  if s.count("3") > 0 and s.count("5") > 0 and s.count("7") > 0:
    cnt += 1
  else:
    cnt += f(s + "3")
    cnt += f(s + "5")
    cnt += f(s + "7")
    
print(cnt)
Problem p03243 (python)

Fixed submission:
check=[99, 111, 222, 333, 444, 555, 666, 777, 888, 999]

n=int(input())

if n in check:
    print(n)
else:
    for i in range(20):
        if check[i]<n<check[i+1]:
            print(check[i+1])
            exit()

Buggy submission (verdict: Runtime Error):
check=[111, 222, 333, 444, 555, 666, 777, 888, 999]

n=int(input())

if n in check:
    print(n)
else:
    for i in range(10):
        if check[i]<n<check[i+1]:
            print(check[i+1])
            exit()
Problem p03262 (python)

Fixed submission:
import fractions
def gcd(x, y):
    gcd=fractions.gcd(x, y)
    return gcd

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

if n==1:
    print(abs(x-a[0]))

else:
    for i in range(n):
        a[i]=abs(x-a[i])
    
    ans=gcd(a[0], a[1])

    for i in range(2, n):
        ans=gcd(ans, a[i])
    
    print(ans)

Buggy submission (verdict: Runtime Error):
import math
def gcd(x, y):
    gcd=math.gcd(x, y)
    return gcd


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

if n==1:
    print(abs(x-a[0]))

else:
    for i in range(n):
        a[i]=abs(x-a[i])
    
    ans=gcd(a[0], a[1])

    for i in range(2, n):
        ans=gcd(ans, a[i])
    
    print(ans)
Problem p03282 (python)

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

if k==1:
    print(int(s[0]))

elif int(s[0])==1:

    if len(s)<k:
        num=1
        for i in range(1, len(s)):
            if int(s[i])!=1:
                num=int(s[i])
                break
        print(num)

    else:
        if s[:k]=="1"*k:
            print(1)
        else:
            num=1
            for i in range(1, len(s)):
                if int(s[i])!=1:
                    num=int(s[i])
                    break
            print(num)

elif int(s[0])!=1:
    print(int(s[0]))

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())

if k==1 or int(s[0])!=1:
    print(int(s[0]))

else:
    if s[:k]=="1"*k:
        print(1)
    else:
        for i in range(1, len(s)):
            num=int(s[i])
            if num!=1:
                break
        print(num)

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())

if k==1:
    print(int(s[0]))

elif int(s[0])==1:
    if s[:k]=="1"*k:
        print(1)
    else:
        num=1
        for i in range(1, len(s)):
            if int(s[i])!=1:
                num=int(s[i])
                break
        print(num)

elif int(s[0])!=1:
    print(int(s[0]))
Problem p03338 (python)

Fixed submission:
n=int(input())
s=input()
ans=0

for i in range(1, n):
    a=s[:i]
    b=s[i:]
    dic=[]
    dic2=[]
    for j in range(len(a)):
        if a[j] not in dic:
            dic.append(a[j])
    for k in range(len(b)):
        if b[k] not in dic2:
            dic2.append(b[k])

    l=min(len(dic), len(dic2))
    cnt=0
    if l==len(dic):
        for j in range(len(dic)):
            if dic[j] in dic2:
                cnt+=1
    else:
        for k in range(len(dic2)):
            if dic2[k] in dic:
                cnt+=1
    
    ans=max(ans, cnt)
    
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=0
 
for i in range(1, n):
    a=s[:i]
    b=s[i:]
    dic=[]
    dic2=[]
    for j in range(len(a)):
        if a[j] not in dic:
            dic.append(a[j])
    for k in range(len(b)):
        if b[k] not in dic2:
            dic2.append(b[k])
 
    for i in range(len(dic)):
        if dic[i] in dic2:
            cnt+=1
    ans=max(ans, cnt)
    
print(ans)
Problem p03401 (python)

Fixed submission:
n=int(input())
A=[0]+list(map(int, input().split()))+[0]

cost=0

for i in range(n+1):
    cost+=abs(A[i+1]-A[i])

for k in range(1, n+1):
    ans=cost+abs(A[k+1]-A[k-1])-(abs(A[k]-A[k-1])+abs(A[k+1]-A[k]))
    print(ans)

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


for i in range(n):
    delete=A[i]
    A.pop(i)
    cost=0
    for j in range(n-1):
        if j==0:
            cost+=abs(A[j])
        elif j==n-2:
            cost+=abs(A[j]-A[j-1])+abs(A[j])
        else:
            cost+=abs(A[j]-A[j-1])
    
    print(cost)
Problem p03497 (python)

Fixed submission:
n, k=map(int, input().split())
a=list(map(int, input().split()))
table=[0]*(n+1)

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

l=sorted(table, reverse=True)
get=0
for i in range(k):
    get+=l[i]

print(sum(l)-get)

Buggy submission (verdict: Runtime Error):
n, k=map(int, input().split())
a=list(map(int, input().split()))
table=[0]*(n+1)

for num in a:
    table[num]+=1

table.sort()
now_length=[]
for count in table:
    if count!=0:
        now_length.append(count)

if len(now_length)<=k:
    print(0)
else:
    ans=0
    i=0
    while len(now_length)!=k:
        ans+=now_length[i]
        now_length.remove(now_length[i])
        i+=1

    print(ans)
Problem p03607 (python)

Fixed submission:
n=int(input())

a=[int(input()) for i in range(n)]

dic={}

for i in range(n):
    if a[i] not in dic:
        dic[a[i]]=1
    else:
        dic[a[i]]+=1

ans=0

for val in dic.values():
    if val%2==1:
        ans+=1

print(ans)

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

a=[int(input()) for i in range(n)]

m=max(a)
table=[0]*m

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

ans=0

for j in range(m):
    if table[j]%2==1:
        ans+=1

print(ans)

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

a=[int(input()) for i in range(n)]

m=max(a)
table=[0]*m

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

ans=0
for j in range(m):
    if table[j]%2==1:
        ans+=1

print(ans)

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

table=[0]*10**6

for i in range(n):
    a=int(input())
    table[a-1]+=1

ans=0

for j in range(10**6):
    if table[j]%2==1:
        ans+=1

print(ans)

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

table=[0]*10**5

for i in range(n):
    a=int(input())
    table[a-1]+=1

ans=0

for j in range(10**5):
    if table[j]%2==1:
        ans+=1

print(ans)

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

table=[0]*10**9

for i in range(n):
    a=int(input())
    table[a-1]+=1

ans=0

for j in range(10**9):
    if table[j]%2==1:
        ans+=1

print(ans)

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

table=[0]*100000

for i in range(n):
    a=int(input())
    table[a-1]+=1

ans=0

for j in range(100000):
    if table[j]%2==1:
        ans+=1

print(ans)
Problem p03639 (python)

Fixed submission:
n=int(input())
a=list(map(int, input().split()))
cnt_2=0
cnt_1=0
cnt_0=0

for num in a:
    if num%4==0:
        cnt_2+=1
    elif num%2==0:
        cnt_1+=1
    else:
        cnt_0+=1

if cnt_1==0:
    if cnt_2+1>=cnt_0:
        print("Yes")
    else:
        print("No")

else:
    if cnt_2>=cnt_0:
        print("Yes")
    else:
        print("No")

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

for num in a:
    if num%4==0:
        cnt_2+=1
    elif num%2==0:
        cnt_1+=1
    else:
        cnt_0+=1

if cnt_1=0:
    if cnt_2+1>=cnt_0:
        print("Yes")
    else:
        print("No")

else:
    if cnt_2>=cnt_0:
        print("Yes")
    else:
        print("No")
Problem p03814 (python)

Fixed submission:
s=input()
l=len(s)
a=[]
z=[]
ans=0
for i in range(l):
    if s[i]=="A":
        a.append(i)
    elif s[i]=="Z":
        z.append(i)

ans=(max(z)-min(a)+1)

print(ans)

Buggy submission (verdict: Runtime Error):
l=len(s)
a=[]
z=[]
ans=0
for i in range(l):
    if s[i]=="A":
        a.append(i)
    elif s[i]=="Z":
        z.append(i)

for i in range(len(a)):
    for j in range(len(z)):
        if abs(z[j]-a[i]+1)>=ans:
            ans=abs(z[j]-a[i]+1)
Problem p02658 (python)

Fixed submission:
import array


n = int(input())
a=[]
a=input().split(" ")
f=0
f1=0
b=0
for i in a:
    if int(i) == 0:
        print("0")
        f1=1
        break
        

sum =1
if f1==0:
    for i in a:
        sum=sum*int(i)
        if sum>1e18:
            f=1
            print("-1")
            break
    


if f==0 and f1==0:
    print(sum)

Buggy submission (verdict: Runtime Error):
import array


n = int(input())
a=[]
f=0
f1=0
b=0
for i in range(0,n):
    i = int(input())
    a.append(i)
    if i == 0:
        print("0");
        f1=1
        

sum =1
if f1==0:
    for i in a:
        sum=sum*i;
        if sum>1e18:
            f=1
            print("-1");
    
if f==0:
    print(sum)
Problem p03071 (python)

Fixed submission:
AB = list(map(int,input().split()))
m2 = 2*max(AB)-1
two = sum(AB)
if m2>=two:
    print(m2)
else:
    print(two)

Buggy submission (verdict: Runtime Error):
AB = list(map(int,input().split()))
m2 = 2*max(AB)-1
two = sum(AB)
if m2>=two:
    print(max2)
else:
    print(two)
Problem p03076 (python)

Fixed submission:
a=[]
for i in range(5):
  a.append(int(input()))
bs=[]
cs=[]
cnt=0
for i in range(5):
    if a[i]%10!=0:
        b=int(a[i]/10)*10+10
        c=str(a[i])[-1]
        cs.append(int(c))
    else:
        b=a[i]
        cnt+=1
    bs.append(b)
if cnt==5:
  	print(sum(a))
else:
	print(sum(bs)+min(cs)-10)

Buggy submission (verdict: Runtime Error):
a=[]
for i in range(5):
  a.append(int(input()))
bs=[]
cs=[]
for i in range(5):
    if a[i]%10!=0:
        b=int(a[i]/10)*10+10
        c=str(a[i])[-1]
        cs.append(int(c))
    else:
        b=a[i]
    bs.append(b)
print(sum(bs)+min(cs)-10)
Problem p03079 (python)

Fixed submission:
list = list(map(int,input().split()))
if len(set(list)) == 1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,Q = map(int,input().split()) #Nマス Q呪文回数
s = input()
g_num = [1 for i in range(N)]

def sposi(t):
    s_list = []
    s_size = len(s)
    for ss in range(s_size):
        if s[ss]==t:
            s_list.append(ss)
    return s_list
  
for q in range(Q):
    t,d = map(str,input().split())
    s_posi = sposi(t)
    for k in s_posi:
      	if g_num[k]!=0:
            if k==0 and d=='L':
                g_num[k]-=1
            elif (k==N-1 or k==-1) and d=='R':
                g_num[k]-=1
            elif d=='L':
                g_num[k]-=1
                g_num[k-1]+=1
            elif d=='R':
                g_num[k]-=1
                g_num[k+1]+=1
golem = 0
for i in range(len(g_num)):
    golem+= g_num[i]
print(golem)
Problem p03109 (python)

Fixed submission:
list = input().split("/")
y = int(list[0])
m = int(list[1])

if (y>=2019 and m>=5):
    print("TBD")
else:
    print("Heisei")

Buggy submission (verdict: Runtime Error):
N = int(input())
total = 0.0
rate = 380000

for i in range(N):
  a,t = input().split()
  if(t=="BTC"):
    total += float(a) * rate
  else:
    total += float(a)
print(total)

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

for i in range(len(N)):
    if (N[i][1]=="BTC"):
        total += float(N[i][0])*380000
    else:
        total += float(N[i][0])
print(total)

Buggy submission (verdict: Runtime Error):
list = S.split("/")
y = int(list[0])
m = int(list[1])
d = int(list[2])

if (y > 2019):
    print("TBD")
elif (y < 2019):
    print("Heisei")
elif (m > 4):
    print("TBD")
elif (m < 4):
    print("Heisei")
elif (d > 30):
    print("TBD")
else:
    print("Heisei")

Buggy submission (verdict: Runtime Error):
def(S):

  list = S.split("/")
  y = int(list[0])
  m = int(list[1])
  d = int(list[2])

  if (y > 2019):
      print("TBD")
  elif (y < 2019):
      print("Heisei")
  elif (m > 4):
      print("TBD")
  elif (m <= 4):
      print("Heisei")
Problem p02573 (python)

Fixed submission:
class UnionFind():
    # 作りたい要素数nで初期化
    # 使用するインスタンス変数の初期化
    def __init__(self, n):
        self.n = n
        # root[x]<0ならそのノードが根かつその値が木の要素数
        # rootノードでその木の要素数を記録する
        self.root = [-1]*(n+1)
        # 木をくっつける時にアンバランスにならないように調整する
        self.rnk = [0]*(n+1)

    # ノードxのrootノードを見つける
    def Find_Root(self, x):
        if(self.root[x] < 0):
            return x
        else:
            # ここで代入しておくことで、後の繰り返しを避ける
            self.root[x] = self.Find_Root(self.root[x])
            return self.root[x]
    # 木の併合、入力は併合したい各ノード
    def Unite(self, x, y):
        # 入力ノードのrootノードを見つける
        x = self.Find_Root(x)
        y = self.Find_Root(y)
        # すでに同じ木に属していた場合
        if(x == y):
            return 
        # 違う木に属していた場合rnkを見てくっつける方を決める
        elif(self.rnk[x] > self.rnk[y]):
            self.root[x] += self.root[y]
            self.root[y] = x

        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            # rnkが同じ（深さに差がない場合）は1増やす
            if(self.rnk[x] == self.rnk[y]):
                self.rnk[y] += 1
    # xとyが同じグループに属するか判断
    def isSameGroup(self, x, y):
        return self.Find_Root(x) == self.Find_Root(y)

    # ノードxが属する木のサイズを返す
    def Count(self, x):
        return -self.root[self.Find_Root(x)]
    
N, M = map(int,input().split())
A = [None] * M
B = [None] * M
for i in range(M):
    A[i], B[i] = map(int,input().split())
uf = UnionFind(N)
for j,h in zip(A,B):
    uf.Unite(j,h)
print(min(uf.root)*(-1))

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = [0] * M
B = [0] * M
for i in range(M):
    A[i],B[i] = map(int,input().split())
C = [set()]
C[0].add(A[0])
C[0].add(B[0])
for i in range(1,M):
    for j in range(len(C)):
        if A[i] in C[j] or B[i] in C[j]:
            C[j].add(A[i])
            C[j].add(B[i])
        else:
            C.append({A[i],B[i]})
ans = 0
for j in range(len(C)):
    if len(C[j]) > ans:
        ans = len(C[j])
print(ans)
Problem p02603 (python)

Fixed submission:
N = int(input())
A_list = list(map(int, input().split()))
At_list = [A_list[0]]
D_list = list()
Dt_list = list()
mone = 1000
stoc = 0
for i in range(1,len(A_list)):
    D_list.append(A_list[i]-A_list[i-1])
for h in range(len(D_list)):
    if D_list[h] != 0:
        Dt_list.append(D_list[h])
        At_list.append(A_list[h + 1])
for j in range(len(Dt_list)):
    if Dt_list[j] > 0:#買う
        stoc = stoc + mone // At_list[j]
        mone = mone % At_list[j]
    elif Dt_list[j] < 0:
        mone = mone + stoc * At_list[j]
        stoc = 0
        last_sell = j
if len(Dt_list) != 0:
    if At_list[-1] >= At_list[-2]:
        mone = mone + stoc * At_list[-1]
    else:
        mone = mone + stoc * At_list[last_sell]
else:
    mone = 1000
print(mone)

Buggy submission (verdict: Runtime Error):
N = int(input())
A_list = list(map(int, input().split()))
At_list = [A_list[0]]
D_list = list()
Dt_list = list()
mone = 1000
stoc = 0
for i in range(1,len(A_list)):
    D_list.append(A_list[i]-A_list[i-1])
for h in range(len(D_list)):
    if D_list[h] != 0:
        Dt_list.append(D_list[h])
        At_list.append(A_list[h + 1])
for j in range(len(Dt_list)):
    if Dt_list[j] > 0:#買う
        stoc = mone // At_list[j]
        mone = mone % At_list[j]
    elif Dt_list[j] < 0:
        mone = mone + stoc * At_list[j]
        stoc = 0
        last_sell = j
if At_list[-1] >= At_list[-2]:
    mone = mone + stoc * At_list[-1]
else:
    mone = mone + stoc * At_list[last_sell]
print(mone)
Problem p02612 (python)

Fixed submission:
N = int(input())
M = 10000 - N
M = str(M)
M = M[-3:]
M = int(M)
print(M)

Buggy submission (verdict: Runtime Error):
N = int(input())
A_list = list(map(int,input().split()))
A_list.sort(reverse = True)
indx_list = []
for i in range(1,100000,2):
    indx_list.append(i)
insx_list = []
for j in range(0,20):
    insx_list.extend(indx_list[:2 ** j])
mx_cmfrt = 0
reached_list = [A_list[0],A_list[0]]
for j in range(1, len(A_list)):
    cmfrt = min(reached_list[insx_list[j-1]-1],reached_list[insx_list[j-1]])
    reached_list.insert(insx_list[j-1], A_list[j])
    mx_cmfrt += cmfrt
print(mx_cmfrt)