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

Fixed submission:
import heapq

n, m = list(map(int, input().split()))
a = list(map(lambda x: -float(x), input().split()))

heapq.heapify(a)
for t in range(m):
  discount = heapq.heappop(a) / 2.
  heapq.heappush(a, discount)
    
print(sum(map(lambda x: int(-x), a)))

Buggy submission (verdict: Runtime Error):
import heapq

n, m = list(map(int, input().split()))
a = list(map(lambda x: -float(x), input().split()))

heap = heapq.heapify(a)
for t in range(m):
  discount = heapq.heappop(heap) / 2.
  heapq.heappush(heap, discount)
    
print(sum(map(lambda x: int(-x), heap)))

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

a.sort()
for t in range(m):
  discount = a.pop() / 2.
  inserted = False
  for i in range(n):
    if a[i] > discount:
      a.insert(i, discount)
      inserted = True
      break
  if not inserted:
    a.append(discount)
    
print(sum(map(int, a)))
Problem p02915 (python)

Fixed submission:
print(int(input()) ** 3)

Buggy submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
S = input()
 
happy = 0
for i in range(N-1):
  if S[i] == S[i+1]:
    happy += 1
print(min([N-1, happy + 2 * K]))
Problem p02916 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
sat = sum(B)
pre_a = A[0]
for a in A[1:]:
  if a == pre_a + 1:
    sat += C[pre_a-1]
  pre_a = a
  
print(sat)

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

sat = sum(B)
for i in range(N-1):
  if A[i] + 1 == A[i+1]:
    sat += C[i]
    
print(sat)

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

sat = sum(B)
pre_a = A[0]
for a in A[1:]:
  if a == pre_a + 1:
    sat += C[pre_a]
  pre_a = a
  
print(sat)
Problem p02948 (python)

Fixed submission:
import heapq

n, m = map(int, input().split())
jobs = [tuple(map(int, input().split())) for _ in range(n)]
jobs.sort()

i = 0
works = []
reward = 0
for d in range(m):
  while i < n and jobs[i][0] <= d + 1:
    heapq.heappush(works, -jobs[i][1])
    i += 1
  if works:
    reward -= heapq.heappop(works)
print(reward)

Buggy submission (verdict: Runtime Error):
import heapq

n, m = map(int, input().split())
jobs = [tuple(map(int, input().split())) for _ in range(n)]
jobs.sort()

i = 0
works = []
reward = 0
for d in range(m):
  while i < n and jobs[i][0] <= d + 1:
    heapq.heappush(works, -jobs[i][1])
    i += 1
  if works:
    reward -= heapq.heappop(words)
print(reward)
Problem p02954 (python)

Fixed submission:
s = input()
n = len(s)

i = 0
is_r = True
rl_list = []
r, l = 0, 0
idx = None
for i in range(n):
  if s[i] == 'R':
    if not is_r:
      rl_list.append((r, l, idx))
      is_r = True
      r, l = 0, 0
    r += 1
  else:
    if is_r:
      is_r = False
      idx = i - 1
    l += 1
rl_list.append((r, l, idx))
children = [0] * n
for r, l, idx in rl_list:
  children[idx] = (r + 1) // 2 + l // 2
  children[idx + 1] = r // 2 + (l + 1) // 2
print(' '.join(map(str, children)))

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

i = 0
is_r = True
rl_list = []
r, l = 0, 0
idx = None
for i in range(n)
  if s[i] == 'R':
    if not is_r:
      rl_list.append((r, l, idx))
      is_r = True
      r, l = 0, 0
    r += 1
  else:
    if is_r:
      is_r = False
      idx = i - 1
    l += 1
rl_list.append((r, l, idx))
children = [0] * n
for r, l, idx in rl_list:
  children[idx] = (r + 1) // 2 + l // 2
  children[idx + 1] = r // 2 + (l + 1) // 2
print(' '.join(map(str, children)))
Problem p02959 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input()))
b = list(map(int, input()))
monster = 0
for i in range(n):
  if b[i] <= a[i]:
    monster += b[i]
  elif b[i] <= a[i] + a[i+1]:
    monster += b[i]
    a[i+1] -= b[i] - a[i]
  else:
    monster += a[i] + a[i+1]
    a[i+1] = 0
print(monster)
Problem p02987 (python)

Fixed submission:
s = input()
if s[0] == s[1] == s[2] == s[3]:
  print('No')
elif s[0] == s[1] and s[2] == s[3]:
  print('Yes')
elif s[0] == s[2] and s[1] == s[3]:
  print('Yes')
elif s[0] == s[3] and s[1] == s[2]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input()
s.sort()
if s[0] == s[1] and s[1] != s[2] and s[2] == s[3]:
  print('Yes')
else:
  print('No')
Problem p02989 (python)

Fixed submission:
n = int(input())
d = sorted(map(int, input().split()))
print(d[n // 2] - d[n // 2 - 1])

Buggy submission (verdict: Runtime Error):
n = int(input())
d = sorted(map(int, input().split()))
print(d[n // 2 + 1] - d[n // 2])
Problem p02990 (python)

Fixed submission:
n, k = map(int, input().split())
mod = 10 ** 9 + 7

fact = [1] * (n + 1)
for i in range(2, n + 1):
  fact[i] = fact[i-1] * i % mod
inv_fact = [1] * (n + 1)
inv_fact[n] = pow(fact[n], mod - 2, mod)
for i in range(n - 1, 1, -1):
  inv_fact[i] = inv_fact[i + 1] * (i + 1) % mod

def comb(_n: int, _k: int) -> int:
  return fact[_n] * inv_fact[_n - _k] * inv_fact[_k] % mod

for i in range(1, k + 1):
  red = n - k
  if i > red + 1:
    print(0)
  else:
    print(comb(red + 1, i) * comb(k - 1, k - i) % mod)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
mod = 10 ** 9 + 7

fact = [1] * (n + 1)
for i in range(2, n + 1):
  fact[i] = fact[i-1] * i % mod
inv_fact = [1] * (n + 1)
inv_fact[n] = pow(fact[n], mod - 2, mod)
for i in range(n - 1, 1, -1):
  inv_fact[i] = inv_factor[i + 1] * (i + 1) % mod

def comb(_n: int, _k: int) -> int:
  return fact[_n] * inv_fact[_n - _k] * inv_vact[_k] % mod

for i in range(1, k + 1):
  red = n - k
  if i > red + 1:
    print(0)
  else:
    print(comb(red + 1, i) * comb(k - 1, k - i) % mod)
Problem p03012 (python)

Fixed submission:
n = int(input())
cumsum_w = [0]
for w in map(int, input().split()):
  cumsum_w.append(cumsum_w[-1] + w)
minimum = 100
for s in cumsum_w[1:-1]:
  minimum = min(minimum, abs(cumsum_w[-1] - 2 * s))
print(minimum)

Buggy submission (verdict: Runtime Error):
n = int(input())
cumsum_w = [0]
for w in map(int, input().split()):
  cumsum_w.append(cumsum_w[-1] + w)
minimum = 100
for s in cumsum_w[1:-1]:
  minimum = min(minimum, abs(w[-1] - 2 * s))
print(minimum)

Buggy submission (verdict: Runtime Error):
n = int(input())
cumsum_w = [0]
for w in map(int, input().split()):
  cumsum_w.append(cumsum_w[-1] + w)
minimum = 100
for s in w[1:-1]:
  minimum = min(minimum, abs(w[-1] - 2 * s))
print(minimum)
Problem p03045 (python)

Fixed submission:
n, m = map(int, input().split())
adj = [[] for _ in range(n)]
for _ in range(m):
  x, y, z = map(int, input().split())
  adj[x-1].append(y-1)
  adj[y-1].append(x-1)
opn = [True] * n
count = 0
for i in range(n):
  if opn[i]:
    count += 1
    opn[i] = False
    stack = [i]
    while stack:
      u = stack.pop()
      for v in adj[u]:
        if opn[v]:
          stack.append(v)
          opn[v] = False
print(count)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
adj = [[] for _ in range(m)]
for _ in range(m):
  x, y, z = map(int, input().split())
  adj[x-1].append(y-1)
  adj[y-1].append(x-1)
opn = [True] * n
count = 0
for i in range(n):
  if opn:
    count += 1
    opn[i] = False
    stack = [i]
    while stack:
      u = stack.pop()
      for v in adj[u]:
        if opn[v]:
          stack.append(v)
          opn[v] = False
print(count)
Problem p02552 (python)

Fixed submission:
x=int(input())
if x==1:
  print(0)
elif x==0:
  print(1)

Buggy submission (verdict: Runtime Error):
x=int(input())
if x==0:
  print 1
elif x==1:
  print 0
Problem p02549 (python)

Fixed submission:
N,K=map(int,input().split())
x=998244353
dp=[0 for i in range(N)]
sdp=[0 for i in range(N)]
L=[]
R=[]
dp[0]=1
sdp[0]=1
for i in range(K):
    l,r=map(int,input().split())
    L.append(l)
    R.append(r) 
for i in range(1,N):
    for j in range(K):
        dp[i]+=(sdp[max(i-L[j],-1)]-sdp[max(i-R[j]-1,-1)])
        dp[i]%=x
    sdp[i]=(sdp[i-1]+dp[i])%x
print(dp[-1]%x)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
x=998244353
S=[]
for i in range(K):
    l,r=map(int,input().split())
    for j in range(l,r+1):
      S.append(j)
S=list(set(S))
dp=[0 for i in range(N)]
for i in range(len(S)):
    dp[S[i]]=1
for i in range(N):
    for j in range(len(S)):
        if(i-S[j]>0):
            dp[i]+=dp[i-S[j]]
            dp[i]=dp[i]%x
print(dp[-1])

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
x=998244353
S=[]
for i in range(K):
    l,r=map(int,input().split())
    for j in range(l,r+1):
      S.append(j)
S=list(set(S))
dp=[0 for i in range(N)]
for i in range(len(S)):
    dp[S[i]]=1
for i in range(N):
    for j in range(len(S)):
        if(i-S[j]>0):
            dp[i]+=dp[i-S[j]]
            dp[i]=dp[i]%x
print(dp[-1])
Problem p02659 (python)

Fixed submission:
import decimal
A,B=input().split()
A=int(A)
B=decimal.Decimal(B)
print(int(A*B))

Buggy submission (verdict: Runtime Error):
a,b=input().split()
a=int(a)
b=float(b)
a=a**-1
print(int(b//a))
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()))
last=A[N-2]
for i in range(1,last+1):
    print(A.count(i))
for i in range(last+1,N+1)
    print(0)
Problem p02771 (python)

Fixed submission:
A,B,C=input().split()
if(A==B):
    if(A!=C):
        print("Yes")
    else:
        print("No")
else:
    if(B==C):
        print("Yes")
    else:
        if(A==C):
            print("Yes")
        else:
            print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
a = list(map(int,input().split()))
c=0
i=0
print(a)
while(c==0 and i<N):
    if(a[i]%2==0):
        if(a[i]%3==0 or a[i]%5==0):
            i+=1
        else:
            c+=1
    else:
        i+=1
if(c==0):
    print("APPROVED")
else:
    print("DENINED")

Buggy submission (verdict: Runtime Error):
A,B,C=input().split()
if(A==B):
    if(A!=C):
        print("Yes")
    else:
        print("No")
else:
    if(B==C):
        print("Yes")
    else if(A==C):
        print("Yes")
        else:
            print("No")
Problem p02829 (python)

Fixed submission:
a=int(input())
b=int(input())
for i in range(3):
    if((i+1==a or i+1==b)==False):
        print(i+1)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
for i in range(3)
	if((i+1==a or i+1==b)=False):
    	print(i+1)
Problem p02594 (python)

Fixed submission:
x=int(input())
if x>=30:
  print('Yes')   
else:
  print('No')

Buggy submission (verdict: Runtime Error):
x=int(input())
if x>=30 : 
  print('Yes')   
else : 
  pt('No')

Buggy submission (verdict: Runtime Error):
x=int(input())
if x>=30 : 
  put('Yes')
else :
  put('No')

Buggy submission (verdict: Runtime Error):
x=int(input())
if x>=30 :  
  put('Yes')   
else :    
  put('No')

Buggy submission (verdict: Runtime Error):
x=input()
if x>=30 :
  put('Yes') 
else :  
  put('No')

Buggy submission (verdict: Runtime Error):
x=input()
if x>=30 :
　　put('Yes')
  else :
    put('No')
Problem p03242 (python)

Fixed submission:
text = list(input())

def swap(char, a, b):
    if char == a:
        return(b)
    if char == b:
        return(a)

res = list(map(lambda x: swap(x, "1", "9"), text))
print("".join(res))

Buggy submission (verdict: Runtime Error):
text = list(input())

def swap(char, a, b):
    if char == a:
        return(b)
    if char == b:
        return(a)

res = list(map(lambda x: swap(x, "1", "9"), text))
print("".join(res))
~
Problem p03272 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split)
print(a + 1 - b)
Problem p03835 (python)

Fixed submission:
K,S = map(int, input().split())
 
ans = 0
 
for X in range(K+1):
	S1 = S - X
	if S1 < 0:
		break
	else:
		if S1 <= K:
			ans += S1 + 1
		elif S1 <= 2 * K:
			ans += 2*K - S1 + 1
 
print(ans)

Buggy submission (verdict: Runtime Error):
K,S = map(int, input().split())

if K == S:
	print( (K+5)*(K+4)//2 )
	sys.exit( ) 

ans = 0
for X in range(K+1):
	S1 = S - X
	if S1 < 0:
		break
	else:
		if S1 <= K:
			ans += S1 + 1
		elif S1 <= 2 * K:
			ans += S1 - 2*K + 1
		else:
			continue

print(ans)
Problem p02753 (python)

Fixed submission:
s = input()
if s.count("A") == 3 or s.count("B") == 3:
  print("No")
else:
  print("Yes")

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

if blue_count >= n:
  print(n)
elif blue_count + red_count > n:
  print(blue_count)
else:
  set_count = blue_count + red_count

  margin = 0
  if n % set_count == 0:
    c =  n // set_count
  else:
    c =  n // set_count
    margin = n % set_count

  # NOTE: あまり部分が 青 -> 赤 の途中である事を前提としてしまっているので変更が必要
  if margin > blue_count:
    margin = blue_count
    
  print(blue_count * c + margin )
Problem p02860 (python)

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

if n % 2 == 1:
  print("No")
else:
  d = int(n/2)
  if s[:d] == s[d:]:
    print("Yes")
  else:
    print("No")

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

if n % 2 == 1:
  print("No")
else:
  d = n/2
  if s[:d] == s[d:]:
    print("Yes")
  else:
    print("No")
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
  print(s)
else:
  print("red")

Buggy submission (verdict: Runtime Error):
n = int(input())
data = map(int, input().split())
up = 0
for i in range(n):
  up *= data[i]

down = 0
for j in range(n):
  down += up / data[j]

print(up / down)
Problem p03011 (python)

Fixed submission:
data = list(map(int, input().split()))
data.sort()
print(data[0] + data[1])

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
broken_data = [int(input()) for _ in range(M) ]
ans = 0
 
memo = [-1] * (N+1)
def countWays(n):
    if n < 0 or (n in broken_data):
        return 0
    elif n == 0:
        return 1
    else:
        if memo[n] > -1:
            return memo[n]
        else:
            memo[n] = ( countWays(n-1) + countWays(n-2) ) % 1000000007
            return memo[n]
 
print(countWays(N))
Problem p03041 (python)

Fixed submission:
hoge, n = map(int, input().split())
s = list(input())
s[n-1] = s[n-1].lower()
print(*s, sep="")

Buggy submission (verdict: Runtime Error):
hoge, n = map(int, input().split())
s = list(input())
s[n] = s[n].lower()
print(*s, sep="")

Buggy submission (verdict: Runtime Error):
s, n = map(str, input().split())
n = int(n)
s = list(s)
s[n] = s[n].lower()
print(*s, sep="")
Problem p03209 (python)

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

# メモ化するための初期化
a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(N, X):
    # X <= 0 や X > a_N を許容し解説本文から簡略化
    if N == 0:
        if X <= 0:
            return 0
        else:
            return 1
    elif X <= 1 + a[N - 1]:
        return f(N - 1, X - 1)
    else:
        return p[N - 1] + 1 + f(N - 1, X - 2 - a[N - 1])

print(f(N, X))

Buggy submission (verdict: Runtime Error):
N, X = map(input().split())

# メモ化するための初期化
a, p = [1], [1]
for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(N, X):
    # X <= 0 や X > a_N を許容し解説本文から簡略化
    if N == 0:
        if X <= 0:
            return 0
        else:
            return 1
    elif X <= 1 + a[N - 1]:
        return f(N - 1, X - 1)
    else:
        return p[N - 1] + 1 + f(N - 1, X - 2 - a[N - 1])

print(f(N, X))
Problem p03327 (python)

Fixed submission:
n = int(input())
if n > 999:
    print("ABD")
else:
    print("ABC")

Buggy submission (verdict: Runtime Error):
n = int(input())
if n > 999:
    print("ABD)
else:
    print("ABC")
Problem p02571 (python)

Fixed submission:
S = input()
T = input()

z = len(S)-len(T)

res = []
cnt = 0
if z == 0:
  for a,b in zip(S,T):
    if a != b:
      cnt += 1
  print(cnt)
  exit();
else:
  for i in range(z):
    s = S[i:i+len(T)]
    cnt = 0
    for j,k in zip(s,T):
      if j != k:
        cnt += 1
    res.append(cnt)
  print(min(res))

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

res = []
cnt = 0
for i in range(len(S)-len(T)):
  s = S[i:i+len(T)]
  cnt = 0
  for j,k in zip(s,T):
    if j != k:
      cnt += 1
  res.append(cnt)

print(min(res))
Problem p03317 (python)

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

for g in range(1,N):
  if K+(K-1)*(g-1) >= N:
    print(g)
    exit()

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

if N == K:
  print(1)
  exit()
elif N % (K-1) != 0:
  print(N//(k-1)+1)
else:   
  print(N//(K-1))
Problem p02594 (python)

Fixed submission:
n = int(input())
if n < 30:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
n = int(input())
if n > 30:
  prtin('Yes')
 else:
  print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
if n >= 30:
  prtin('Yes')
 else:
  print('No')
Problem p02546 (python)

Fixed submission:
s = input()
if s[-1] == "s":
	s += "es"
else:
 	s += "s"
print(s)

Buggy submission (verdict: Runtime Error):
s = input()
l = len(s)
if s[l - 1] == "s":
	s += "es"
else:
 	l.append("s")
print(s)

Buggy submission (verdict: Runtime Error):
s = input()
l = len(s)
if s[l - 1] == s:
	l.append(es)
else:
 	l.append(s)
print(s)

Buggy submission (verdict: Runtime Error):
s = input()
l = len(s)
if(s[l - 1]) == 's':
	l.append(es)
else:
 	l.append(s)
print(s)

Buggy submission (verdict: Runtime Error):
s = input()
l = len(s)
if(s[l - 1]) == s:
	l.append(es)
else:
 	l.append(s)
print(s)
Problem p02577 (python)

Fixed submission:
def digit_sum(n):
    n_lst = list( str(n) )
    n_sum = 0
    for i in range( len(n_lst) ):
        n_sum += int( n_lst[i] )
    return n_sum

n1 = input()
if digit_sum(n1)%9==0 : print("Yes")
else: print("No")

Buggy submission (verdict: Runtime Error):
def digit_sum(n):
    n_lst = list( str(n) )
    n_sum = 0
    for i in range( len(n_lst) ):
        n_sum += int( n_lst[i] )
    return n_sum
 
n1 = input()
if digit_sum(n1)%9==0 : print("Yes")
else: print("No"
Problem p03013 (python)

Fixed submission:
n, m = map(int, input().split())
bad = []
for i in range(m):
    bad.append(int(input()))
dp = [0 for x in range(n+1)]
dp[0] = 1
idx = 0
if m > 0 and bad[0] == 1:
    dp[1] = 0
    idx = 1
else:
    dp[1] = 1

for i in range(2, n+1):
    if idx < m and i == bad[idx]:
        dp[i] = 0
        idx+=1
    else:
        dp[i] = (dp[i-1] + dp[i-2]) % 1000000007

print(dp[n])

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
bad = []
for i in range(m):
    bad.append(int(input()))
dp = [0 for x in range(n+1)]
dp[0] = 1
idx = 0
if bad[0] == 1:
    dp[1] = 0
    idx = 1
else:
    dp[1] = 1

for i in range(2, n+1):
    if idx < m and i == bad[idx]:
        dp[i] = 0
        idx+=1
    else:
        dp[i] = (dp[i-1] + dp[i-2]) % 1000000007

print(dp[n])
Problem p02546 (python)

Fixed submission:
n = input()

if n[len(n) - 1] == 's':
    print(n + 'es')
else:
    print(n + 's')

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

if n[len(n - 1)] == 's':
    print(n + 'es')
else:
    print(n + 's')
Problem p02570 (python)

Fixed submission:
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    d, t, s = map(int, input().split())
    if d > t*s:
        print("No")
    else:
        print("Yes")
    return 0

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n, m = map(int, input().split())
    group = []
    done = [-1]*n
    num = 0
    for i in range(m):
        a, b = map(lambda x:int(x)-1, input().split())
        if done[a] != -1:
            if done[b] == -1:
                group[done[a]].append(b)
                done[b] = done[a]
        else:
            if done[b] == -1:
                group.append([a,b])
                done[a], done[b] = num, num
                num += 1
            else:
                group[done[b]].append(a)
                done[a] = done[b]
    people = [0]+[len(i) for i in group]
    print(max(people))
    return 0

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    s = input()
    t = input()
    hoge = 10000
    let = len(t)
    les = len(s)
    ans = 10000
    for i in range(les-let+1):
        hoge = s[i:i+let]
        piyo = 0
        for j, k in zip(hoge,t):
            if j != k:
                piyo += 1
        if piyo < ans:
            ans = piyo
    print(ans)
    return 0

if __name__ == "__main__":
    solve()
Problem p02623 (python)

Fixed submission:
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    ruia, ruib = [0], [0]
    for i in range(n): ruia.append(a[i]+ruia[i])
    for i in range(m): ruib.append(b[i]+ruib[i])
    ans = 0
    j = m
    for i in range(n+1):
        if ruia[i] > k:
            break
        while(ruib[j]>k-ruia[i]):
            j -= 1
        ans = max(ans, i+j)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    ruia, ruib = [0], [0]
    for i in range(n): ruia.append(a[i]+ruia[i])
    for i in range(m): ruib.append(b[i]+ruib[i])
    ans = 0
    j = m
    for i in range(n+1):
        if ruia[i] > k:
            break
        while(k > ruia[i]+ruib[j]):
            j -= 1
        ans = max(ans, i+j)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
    n, m, k = map(int, input().split())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    ruia, ruib = [0], [0]
    for i in range(n): ruia.append(a[i]+ruia[i])
    for i in range(m): ruib.append(b[i]+ruib[i])
    ans = 0
    j = m
    for i in range(n+1):
        if ruia[i] > k:
            break
        while(k > ruia[i]+ruib[j]):
            j -= 1
            ans = max(ans, i+j)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()
Problem p02629 (python)

Fixed submission:
def solve():
    n=int(input())
    ans=''
    check='abcdefghijklmnopqrstuvwxyz'
    while n!=0:
        n-=1
        ans+=check[n%26]
        n //= 26
    print(ans[::-1])
    return 0

if __name__ == "__main__":
    solve()

Buggy submission (verdict: Runtime Error):
import math
import collections
import fractions
import itertools

def solve():
    n=int(input())
    ans=''
    check='abcdefghijklmnopqrstuvwxyz'
    while n!=0:
        n-=1
        ans+=check[n%26]
        print(ans[::-1])
    return 0

if __name__ == "__main__":
    solve()