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

Fixed submission:
N, K = map(int, input().split())
S = input()
print(S[:K-1] + S[K-1].lower() + S[K:])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = input()
print(S[:K-1] + S[K-1].lower + S[K:])
Problem p03127 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
 
def gcd(x, y):
  if x % y == 0:
    return y
  else:
    return gcd(y, x % y)
 
num = A[0]
for i in range(1, N):
  num = gcd(max(num, A[i]), min(num, A[i]))
 
print(num)

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

def gcd(x, y):
  if x % y == 0:
    return y
  else:
    gcd(y, x % y)

num = A[0]
for i in range(1, N):
  num = gcd(max(num, A[i]), min(num, A[i]))

print(num)
Problem p03775 (python)

Fixed submission:
N = int(input())
array = []

for i in range(1, int(N**0.5)+1):
    if N % i == 0:
        array.append(len(str(N//i)))

print(min(array))

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

array = []
r = 2
result = 11

while True:
    while True:
        if N % r == 0:
            array.append(r)
            N //= r
        else:
            break
    if N == 1:
        break

    r += 1

for i in range(2 ** len(array)):
    bin_i = bin(i)[2:]
    bin_i = '0' * (len(array) - len(bin_i)) + bin_i
    A = 1
    B = 1
    for j in range(len(bin_i)):
        if bin_i[j] == '1':
            A *= array[j]
        else:
            B *= array[j]

    result = min(result, max(len(str(A)), len(str(B))))

print(result)
Problem p02831 (python)

Fixed submission:
A,B=map(int,input().split())
ans=1
for g in range(1,100000):
  if A%g==0 and B%g==0:
    ans=g
print((A*B)//ans)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
from math import gcd
g=gcd(A,B)
print((A*B)//g)
Problem p03041 (python)

Fixed submission:
n,m=map(int,input().split())
s=input()
s=s[:m-1]+chr(ord(s[m-1])-ord('A')+ord('a'))+s[m:]
print(s)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
s=input()
s=s[:m]+chr(ord(s[m])-ord('A')+ord('a'))+s[m+1:]
print(s)
Problem p02622 (python)

Fixed submission:
S=input()
T=input()
count=0;
for i in range(0,len(S)):
    if (T[i]!=S[i]):
        count+=1
print(count)

Buggy submission (verdict: Runtime Error):
S=int(input())
T=int(input())
count=0;
for i in range(0,len(S)):
    if (T[i]!=S[i]):
        count+=1
print(count)
Problem p02627 (python)

Fixed submission:
s = input()
x = ord(s[0])
if x>=65 and x<=90:
  print("A")
elif x>=97 and x<=122:
  print("a")

Buggy submission (verdict: Runtime Error):
s = input()
x = ord(s[0])
if x>=65 and x<=90:
  print("A")
else if x>=97 and x<=122:
  print("a")
Problem p02915 (python)

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

Buggy submission (verdict: Runtime Error):
n = input()
print(n**3)
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()))
tot = sum(B)
for i in range(n-1):
  if A[i+1] == A[i]+1:
    tot += C[A[i]-1]
print(tot)

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()))
tot = sum(B)
for i in range(n-1):
  if A[i+1] == A[i]+1:
    tot += C[A[i]]
print(tot)

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()))
tot = sum(B)
for i in range(n-1):
  if A[i+1] = A[i]+1:
    tot += C[A[i]]
print(tot)
Problem p02879 (python)

Fixed submission:
A,B = 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(A<10 and B<10):
  print(A*B)
else:
  print(-1)
Problem p02925 (python)

Fixed submission:
import sys
from collections import deque
input = sys.stdin.readline
def combination_to_index(a,b,n):
    if(b<a):
        a,b = b,a
    return (2*n-a)*(a-1)//2+b-a

def main():
    N = int(input())
    M = N*(N-1)//2
    gp = [[] for _ in range(M+1)]
    cnts = [0]*(M+1)
    for a in range(1,N+1):
        A = [int(x) for x in input().split()]
        for ind,b in enumerate(A[:-1]):
            fr = combination_to_index(a,b,N)
            to = combination_to_index(a,A[ind+1],N)
            gp[fr].append(to)
            cnts[to] += 1

    for ind,i in enumerate(cnts):
        if(i==0 and ind!=0):
            gp[0].append(ind)
            cnts[ind]+=1

    ans = 0
    cnt = 0
    stk = deque()
    stk.append((0,0))
    while stk:
        n,ans = stk.popleft()
        for x in gp[n]:
            cnts[x]-=1
            if(cnts[x]==0):
                stk.append((x,ans+1))
                cnt += 1
    if(cnt!=M):
        print(-1)
    else:
        print(ans)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def combination_to_index(a,b,n):
    if(b<a):
        c = a
        a = b
        b = c
    return (2*n-a)*(a-1)//2+b-a

def dfs(gp):
    max_d = 0
    stk = []
    stk.append((0,set(),0))
    while stk:
        nxt = []
        n,seen,d = stk.pop()
        res = -1
        if(n in seen):
            continue
        max_d = max(max_d,d)
        for x in gp[n]:
            nxt.append((x,seen.union(set([n])),d+1))
        stk = nxt+stk
    return max_d

def main():
    N = int(input())
    M = N*(N-1)//2
    gp = [[] for _ in range(M+1)]
    for a in range(1,N+1):
        A = [int(x) for x in input().split()]
        for ind,b in enumerate(A[:-1]):
            gp[combination_to_index(a,b,N)].append(combination_to_index(a,A[ind+1],N))
    cnts = [0]*(M+1)
    for i in gp:
        for j in i:
            cnts[j]+=1

    for ind,i in enumerate(cnts):
        if(i==0 and ind!=0):
            gp[0].append(ind)

    d = dfs(0,set(),gp,0)
    if(d==0):
        print(-1)
    else:
        print(d)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def combination_to_index(a,b,n):
    if(b<a):
        c = a
        a = b
        b = c
    return (2*n-a)*(a-1)//2+b-a

def dfs(n,seen,gp,d):
    #print(d)
    res = -1
    if(n in seen):
        return -1
    for x in gp[n]:
        res = max(res,dfs(x,seen.union(set([n])),gp,d+1))

    if(res == -1):
        return d
    else:
        return res

def main():
    N = int(input())
    M = N*(N-1)//2
    gp = [[] for _ in range(M+1)]
    for a in range(1,N+1):
        A = [int(x) for x in input().split()]
        for ind,b in enumerate(A[:-1]):
            gp[combination_to_index(a,b,N)].append(combination_to_index(a,A[ind+1],N))
    cnts = [0]*(M+1)
    for i in gp:
        for j in i:
            cnts[j]+=1

    for ind,i in enumerate(cnts):
        if(i==0 and ind!=0):
            gp[0].append(ind)

    d = dfs(0,set(),gp,0)
    if(d==0):
        print(-1)
    else:
        print(d)

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

Fixed submission:
from operator import itemgetter
import bisect
import heapq
import sys
input = sys.stdin.readline

def main():
    N,M = [int(x) for x in input().split()]
    work = {}
    for _ in range(N):
        a,b = [int(x) for x in input().split()]
        if(a in work):
            work[a].append(-b)
        else:
            work[a] = [-b]

    cand = []
    heapq.heapify(cand)
    cnt = 0
    for i in range(1,M+1):
        if(i in work):
            for x in work[i]:
                heapq.heappush(cand,x)
        if(len(cand)==0):
            continue
        x = -heapq.heappop(cand)
        cnt += x

    print(cnt)

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
import bisect
import heapq
import sys
input = sys.stdin.readline

def main():
    N,M = [int(x) for x in input().split()]
    work = {}
    for _ in range(N):
        a,b = [int(x) for x in input().split()]
        if(a in work):
            work[a].append(b)
        else:
            work[a] = [b]

    cand = []
    prev_max = 0
    cnt = 0
    for i in range(1,M+1):
        if(i in work):
            y = max(work[i])
            if(prev_max<y):
                x = y
            else:
                x = prev_max
            cand += work[i]
        if(len(cand)==0):
            continue
        cand.remove(x)
        cnt += x
        prev_max = max(cand)

    print(cnt)

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

Fixed submission:
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def nPr(n,r):
    num = 1
    for i in range(n,n-r,-1):
        num*=i
    return num

N,K = [int(x) for x in input().split()]
R = N-K
mod = 10**9+7
for i in range(1,K+1):
    ans = 0
    if(i==1):
        ans = R+1
    else:
        if(R==i-1):
            ans = combinations_count(K-1,i-1)
        elif(R<i-1):
            ans = 0
        else:
            ans = combinations_count(K-1,i-1)*math.factorial(R+1)//math.factorial(R-(i-1))//math.factorial(i)
    print(ans%mod)

Buggy submission (verdict: Runtime Error):
import math
import sys
sys.setrecursionlimit(1000000)
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


N,K = [int(x) for x in input().split()]
R = N-K
mod = 10**9+7
for i in range(1,K+1):
    ans = 0
    if(i==1):
        ans = R+1
    else:
        ans = combinations_count(K-1,i-1)*math.factorial(R+1)//math.factorial(R-(i-1))//math.factorial(i)
    print(ans%mod)

Buggy submission (verdict: Runtime Error):
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def nPr(n,r):
    num = 1
    for i in range(n,n-r,-1):
        num*=i
    return num

N,K = [int(x) for x in input().split()]
R = N-K
mod = 10**9+7
for i in range(1,K+1):
    ans = 0
    if(i==1):
        ans = R+1
    else:
        ans = combinations_count(K-1,i-1)*math.factorial(R+1)//math.factorial(R-(i-1))//math.factorial(i)
    print(ans%mod)
Problem p03011 (python)

Fixed submission:
li = [int(x) for x in input().split()]
print(min(li[0]+li[1],li[1]+li[2],li[0]+li[2]))

Buggy submission (verdict: Runtime Error):
H,W = [int(x) for x in input().split()]
S = ['#'*(W+2)]+['#'+input()+'#' for _ in range(H)]+['#'*(W+2)]
#%%
di_w = {}
di_h = {}
cnt_w = 0
cnt_h = 0
ans = 0
li = [[[-1 for _ in range(2)] for _ in range(W+2)]for _ in range(H+2)]

for h,s in enumerate(S):
    for w,c in enumerate(s):
        if(c=='#'):
            cnt_w += 1
            cnt_h += 1
        else:
            if(li[h-1][w][0]==-1):
                li[h][w][0] = cnt_h
                di_h[cnt_h] = 1
            else:
                li[h][w][0] = li[h-1][w][0]
                di_h[li[h][w][0]] += 1

            if(li[h][w-1][1]==-1):
                li[h][w][1] = cnt_w
                di_w[cnt_w] = 1
            else:
                li[h][w][1] = li[h][w-1][1]
                di_w[li[h][w][1]] += 1
        cnt_h+=1

for h,s in enumerate(S):
    for w,c in enumerate(s):
        if(c=='#'):
            pass
        else:
            ans = max(ans,di_h[li[h][w][0]]+di_w[li[h][w][1]]-1)

print(ans)
Problem p03038 (python)

Fixed submission:
from operator import itemgetter
import sys
sys.setrecursionlimit(1000000)

N,M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort()
BC = [[int(x) for x in input().split()]for _ in range(M)]
BC.sort(key = itemgetter(1),reverse=True)

x = 0
bc_ind = 0
ans = 0
for ind,i in enumerate(A):
    bc = 0
    if(BC[bc_ind][0]>x):
        bc = BC[bc_ind][1]
        x+=1
    else:
        bc_ind+=1
        x = 1
        if(len(BC)<=bc_ind):
            ans += sum(A[ind:])
            break
        else:
            bc = BC[bc_ind][1]
    if(bc>i):
        ans += bc
    else:
        ans += sum(A[ind:])
        break
print(ans)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter

N,M = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
A.sort()
BC = [[int(x) for x in input().split()]for _ in range(M)]
BC.sort(key = itemgetter(1),reverse=True)
x = 0
stim_bc = [0]

for i in BC:
    y = 0
    while(x+y<len(A) and y<i[0]):
        if(x+y == 0):
            stim_bc.append(i[1])
        else:
            stim_bc.append(i[1]+stim_bc[-1])
        y += 1
    x = y
stim_a = [0]
for ind,i in enumerate(A):
    if(ind==0):
        stim_a.append(i)
    else:
        stim_a.append(i+stim_a[-1])
max_score = 0
for i in range(len(A)):
    score = stim_bc[i]+stim_a[-1]-stim_a[i]
    if(score>max_score):
        max_score=score
    else:
        break

print(max_score)
Problem p03108 (python)

Fixed submission:
import sys
#sys.setrecursionlimit(1000000)

class UnionFind():
    def __init__(self,n):
        self.parent = [-1 for _ in range(n)]

    def size(self,x):
        return -self.parent[self.find(x)]

    def find(self,x):
        if(self.parent[x]<0):
            return x
        else:
            self.parent[x]=self.find(self.parent[x])
            return self.parent[x]

    def unite(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if(x == y):
            return False
        if(self.size(x)<self.size(y)):
            self.parent[y]+=self.parent[x]
            self.parent[x]=y
        else:
            self.parent[x]+=self.parent[y]
            self.parent[y]=x
        return True

    def same(self,x,y):
        return self.find(x)==self.find(y)

N,M = [int(x) for x in input().split()]
A = [0]*M
B = [0]*M
ans = [0]*M
for i in range(M):
    A[i],B[i] = [int(x) for x in input().split()]
ans[M-1] = int(N*(N-1)/2)
uni = UnionFind(N)
for i in range(M-1,0,-1):
    ans[i-1]=ans[i]
    if(not uni.same(A[i]-1,B[i]-1)):
        ans[i-1]-=uni.size(A[i]-1)*uni.size(B[i]-1)
        uni.unite(A[i]-1,B[i]-1)
for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
N,M = [int(x) for x in input().split()]
map = [[0 for j in range(N+1)] for i in range(N+1)]
li_e = []
dp = [0]*(M+1)

def dfs(v,li_gr,flg):
    if(not flg[v]):
        flg[v] = True
        li_gr.append(v)
        for u,exist in enumerate(map[v]):
            if(exist == 1 and not flg[u]):
                dfs(u,li_gr,flg)

for i in range(M):
    A,B = [int(x) for x in input().split()]
    map[A][B] = 1
    map[B][A] = 1
    li_e.append((A,B))
dp[0] = [x for x in range(1,N+1)]

for i in range(M):
    flg = [True]*(N+1)
    dp[i+1] = dp[i]
    A = li_e[i][0]
    B = li_e[i][1]
    map[A][B] = 0
    map[B][A] = 0
    for n,p in enumerate(li_gr):
        if(A in p):
            for q in p:
                flg[q] = False
            dp[i+1].pop(n)
    li = []
    li.append([])
    dfs(A,li[0],flg)
    if(not flg[B]):
        li.append([])
        dfs(B,li[1],flg)
    dp[i+1].append(li)
    ans = 0
    grps = len(dp[i+1])
    for p in range(grps):
        for q in range(p+1,grps):
            ans += len(dp[i+1][p])*len(dp[i+1][q])
    print(ans)
Problem p03803 (python)

Fixed submission:
li=[13,1,2,3,4,5,6,7,8,9,10,11,12]
A,B = [int(x)-1 for x in input().split()]
if(li[A]>li[B]):
  print('Alice')
elif(li[A]==li[B]):
  print('Draw')
else:
  print('Bob')

Buggy submission (verdict: Runtime Error):
li=[13,1,2,3,4,5,6,7,8,9,10,11,12]
A,B = [int(x) for x in input().split()]
if(li[A]>li[B]):
  print('Alice')
elif(li[A]==li[B]):
  print('Draw')
else:
  print('Bob')
Problem p03804 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)

N,M = [int(x) for x in input().split()]
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]
#%%
flag = False
for i in range(N-M):
    for j in range(N-M):
        flagx = True
        for x in range(M):
            if(A[i+x][j:j+M]!=B[x]):
                flagx = False
        if(flagx):
            flag = flag|flagx
            break

if(flag or (N==1 and M==1)):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N,M = [int(x) for x in input().split()]
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

for i in range(N-M):
    for j in range(N-M):
        flagx = True
        for x in range(M):
            if(A[i+x][j:j+M]!=B[x]):
                flagx = False
        if(flagx): break

if(flagx):
    print('Yes')
else:
    print('No')
Problem p02627 (python)

Fixed submission:
a = input()

if a.islower() == True:
    print("a")

else:
    print("A")

Buggy submission (verdict: Runtime Error):
a - input()

if a.islower():
    print("a")

else:
    print("A")
Problem p02779 (python)

Fixed submission:
n = input()
a = input().split()
n = int(n)
a = [int(s) for s in a]
a.sort()
#print(a)
s=0

for i in range(len(a)-1):
    #print(a[i],a[i+1])
    
    if a[i]==a[i+1]:
        print("NO")
        s=s+1
        break
        
if s == 0: print("YES")

Buggy submission (verdict: Runtime Error):
s =0

print(n,a)

for f in range(n):
  
  for g in range(n):

    if g != f:
    	if a[f] == a[g]:
      		#print(a[f], a[g])
      		s = s+1
      
if s>0: print("NO")
else: print('YES')
Problem p02711 (python)

Fixed submission:
s = input()
ans = 'No'
for e in s:
  if e == '7':
    ans = 'Yes'
    break
print(ans)

Buggy submission (verdict: Runtime Error):
s = input().split()
ans = 'No'
for e in s:
  if e = '7':
    ans = 'Yes'
    break
print(ans)
Problem p02712 (python)

Fixed submission:
s = input().split()
n = int(s[0])
sum = 0
for i in range(1,n+1):
  #print(n)
  if ((i % 3 )!=0 ) and ((i % 5 )!=0 ) :
    sum += i
print(sum)

Buggy submission (verdict: Runtime Error):
s = input().split()
n = int(s)
sum = 0
for i range(1,n+1):
  print(n)
  if ((i mod 3 )!=0 ) and ((i mod 5 )!=0 ) :
    sum += i
print(sum)

Buggy submission (verdict: Runtime Error):
s = input().split()
n = int(s)
sum = 0
for i range(1:n+1):
  #print(n)
  if ((i mod 3 )!=0 ) and ((i mod 5 )!=0 ) :
    sum += i
print(sum)
Problem p03041 (python)

Fixed submission:
#!/usr/bin/env python3
n,k = map(int, input().split())
S = list(input())
S[k-1]= S[k-1].lower()
print("".join(S))

Buggy submission (verdict: Runtime Error):
n = input()
a = int(n[0:2])
b = int(n[2:])
if 1 <= a <= 12 and 1 <= b <= 12:
	print('AMBIGUOUS')
elif 1 <= a <= 12 and b > 12:
	print('MMYY')
elif 1 <= b <= 12 and a > 12:
	print('YYMM')
else:
print('NA')
Problem p03042 (python)

Fixed submission:
n = input()
a = int(n[:2])
b = int(n[2:])
if 1 <= a <= 12 and 1 <= b <= 12:
	print('AMBIGUOUS')
elif 1 <= a <= 12:
	print('MMYY')
elif 1 <= b <= 12:
	print('YYMM')
else:
	print('NA')

Buggy submission (verdict: Runtime Error):
n = input()
a = int(n[0:2])
b = int(n[2:])
if 1 <= a <= 12 and 1 <= b <= 12:
	print('AMBIGUOUS')
elif 1 <= a <= 12 and b > 12:
	print('MMYY')
elif 1 <= b <= 12 and a > 12:
	print('YYMM')
else:
print('NA')

Buggy submission (verdict: Runtime Error):
n = input()
a = int(n[0:2])
b = int(n[2:])
if a > 12 and b > 12:
  print('NA')
elif a 
elif a > 12 and b <= 12:
  print('YYMM')
elif a <= 12 and b > 12:
  print('MMYY')
else:
  print('AMBIGUOUS')
Problem p03127 (python)

Fixed submission:
#!/usr/bin/env python3
import functools
import fractions
n, *a = map(int, open(0).read().split())
gcd = functools.reduce(fractions.gcd, a)
print(gcd)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import functools
import math
n, *a = map(int, open(0).read().split())
gcd = functools.reduce(math.gcd, a)
print(gcd)
Problem p02879 (python)

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

Buggy submission (verdict: Runtime Error):
import numpy as np
 
a,b=map(int,input().split())
A=np.array(sorted(list(map(int,input().split()))))
F=np.array(sorted(list(map(int,input().split())),reverse=True))
 
s=A.sum()
 
x=-1
y=10**12
while x+1<y:
  mid=(x+y)//2
  if s-np.minimum(A,mid//F).sum()<=b:
    y=mid
  else:
    x=mid
print(y)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
if(a<=9&b<=9):
  print(a*b)
else:
  print(-1)
Problem p02880 (python)

Fixed submission:
N=int(input())
judge=0
for i in range(1,10):
  if N%i==0 and N/i<=9:
    print("Yes")
    judge=1
    break
if(judge==0):
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
for i in range(1,10):
  if N%i==0 and N/i<=9:
    print(Yes)
    break
Problem p02987 (python)

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

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

Fixed submission:
from fractions import gcd
n=int(input())
A=list(map(int,input().split()))
for i in range(n-1):
  A[i+1]=gcd(A[i],A[i+1])
print(A[n-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
A=list(map(int,input().split()))
def gcd(x,y):
  a=max(x,y)
  b=min(x,y)
  z=a%b
  if z==0:
    return b
  else:
    gcd(z,b)
for i in range(n-1):
  A[i+1]=gcd(A[i],A[i+1])
print(A[n-1])
Problem p03250 (python)

Fixed submission:
a,b,c=map(int,input().split())
x=max(a,b,c)
print(x*10+a+b+c-x)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
x=max(a,b,c)
print(x*10+sum(a,b,c)-x)
Problem p02835 (python)

Fixed submission:
import sys
A1, A2, A3 = input().split(" ")
A1 = int(A1)
A2 = int(A2)
A3 = int(A3)
if A1+A2+A3 >= 22:
  print("bust")
else:
  print("win")

Buggy submission (verdict: Runtime Error):
if A1+A2+A3 >= 22:
  print("bust")
else:
  print("win")
Problem p02836 (python)

Fixed submission:
import sys
s = input()
n = 0
l = len(s)
for i in range(l):
  j = l-i-1
  if i>=j:
    print(n)
    exit(0)
  if s[i]!=s[j]:
    n = n+1
print(n)
exit(0)

Buggy submission (verdict: Runtime Error):
import sys
s = input()
n = 0
l = len(s)
for i in range(l):
  j = l-i-1
  if i>=j:
    print(n)
    return
  if s[i]!=s[j]:
    n = n+1
print(n)
return
Problem p03222 (python)

Fixed submission:
def memorize(func):
    memo = {}
    def wrapper(*args):
        if args not in memo:
            memo[args] = func(*args)
        return memo[args]
    return wrapper

@memorize
def amida(W):   # W本の棒に対する1行アミダの引き方
    if W<2:
        return 1
    else:
        return amida(W-1)+amida(W-2)

@memorize
def amida2(H, W, x):
    if H==0:
        return 1 if x==1 else 0
    a = 0 if x==1 else amida(x-2)*amida(W-x)*amida2(H-1, W, x-1)
    b = amida(x-1)*amida(W-x)*amida2(H-1, W, x)
    c = 0 if x==W else amida(x-1)*amida(W-x-1)*amida2(H-1, W, x+1)
    return (a+b+c)%1000000007
print(amida2(*map(int, input().split())))

Buggy submission (verdict: Runtime Error):
def memorize(func):
    memo = {}
    def wrapper(*args):
        if args not in memo:
            memo[args] = func(*args)
        return memo[args]
    return wrapper

@memorize
def amida(W):   # W本の棒に対する1行アミダの引き方
    if W<2:
        return 1
    else:
        return amida(W-1)+amida(W-2)

@memorize
def amida2(H, W, x):
    if H==0:
        return 1 if x==1 else 0
    a = 0 if x==1 else amida(x-2)*amida(W-x)*amida2(H-1, W, x-1)
    b = amida(x-1)*amida(W-x)*amida2(H-1, W, x, y)
    c = 0 if x==W else amida(x-1)*amida(W-x-1)*amida2(H-1, W, x+1)
    return (a+b+c)%1000000007
print(amida2(*map(int, input().split())))