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

Fixed submission:
# -*- coding: utf-8 -*-
A=int(input())
B=int(input())
if A==1:
    if B==2:
        C=3
    if B==3:
        C=2
if A==2:
    if B==1:
        C=3
    if B==3:
        C=1
if A==3:
    if B==1:
        C=2
    if B==2:
        C=1

print(C)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
A=int(input())
B=int(input())
if A==1:
    if B==2:
        C=3
    if B==3:
        C=2
if A==2:
    if B==1:
        C=3
    if B==3:
        C=1
if A==3:
    if B==1:
        C==2
    if B==2:
        C==1

print(C)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
A=int(input())
B=int(input())
if A==1:
    if B==2:
        C=3
    if B==3:
        C=2
if A==2:
    if B==1:
        C=3
    if B==3:
        C=1
if A==3:
    if B==1:
        C==2
    if B==2:
        C==1

print(C)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
A=int(input())
B=int(input())
if A==1:
    if B==2:
        C=3
    if B==3:
        C=2
if A==2:
    if B==1:
        C=3
    if B==3:
        C=1
if A==3:
    if B==1:
        C==2
    if B==2:
        C==1

prnt(C)
Problem p02831 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
  
S, T=map(int, input().split())
print(lcm(S, T))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import(math)

S, T=map(int, input().split())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(S, T))
Problem p02897 (python)

Fixed submission:
n = int(input())

odd = (n + 1) // 2
ans = odd / n
print('{:.9f}'.format(ans))

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

odd = (n + 1) // 2
ans = odd / n
print(f'{ans:.9f}')
Problem p02990 (python)

Fixed submission:
import math

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

def comb(n, r):
    if n-r>=0:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    else: 
        return 0

for i in range(1,k+1):
    a = comb(k-1, i-1)
    b = comb(n-k+1, i)
    print((a*b)%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math

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

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1,k+1):
    a = comb(k-1, i-1)
    b = comb(n-k+1, i)
    print((a*b)%(10**9+7))

Buggy submission (verdict: Runtime Error):
import math

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

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1,k+1):
    a = comb(k-1, i-1)
    b = comb(n-k+1, i)
    print((a*b)%(10**9+7))

    
    


for i in range(1,k+1):
    a = comb(k-1, i-1)
    b = comb(n-k+1, i)
    print((a*b)%(10**9+7))

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

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

    
    


for i in range(1,k+1):
    a = comb(k-1, i-1, exact=True)
    b = comb(n-k+1, i, exact=True)
    print((a*b)%(10**9+7))

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

from scipy.special import comb
for i in range(1,k+1):
    a = comb(k-1, i-1, exact=True)
    b = comb(n-k+1, i, exact=True)
    print((a*b)%(10**9+7))
Problem p03127 (python)

Fixed submission:

n=int(input())
k=list(map(int,input().split()))
c=k[0]

def regcd(a,b):
    while b != 0:
        a, b = b, a%b
    return a

for i in k:
    c=regcd(max(c,i),min(c,i))

    
print(c)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
k=list(map(int,input().split()))
c=k[0]

for i in range(len(k)):
    c=math.gcd(c,k[i])
    
print(c)
Problem p03208 (python)

Fixed submission:

n,k=map(int,(input().split()))
a=[]
for i in range(n):
    a.append(int(input()))

a.sort()
min_high=1000000000000

for i in range(n-k+1):
    high=-a[i]+a[i+k-1]
#    print(high,a[i],i)
    if high<min_high:
        min_high=high

print(min_high)

Buggy submission (verdict: Runtime Error):

n,k=map(int,(input().split()))
a=[]
for i in range(k):
    a.append(int(input()))
    
a.sort(reverse=True)
for i in range(n-k):
    b=int(input())
    if max(a)>b:
        a.remove(max(a))
        a.append(b)
    elif min(a)<b:
        a.remove(min(b))
        a.append(b)

print(max(a)-min(a))
Problem p02754 (python)

Fixed submission:
def main():
    import numpy as numpy
    import sys
    n,a,b=list(map(int,sys.stdin.readline().split()))
 
    print(a*(n//(a+b))+min(a,n%(a+b)))
 
 
 
main()

Buggy submission (verdict: Runtime Error):
def main():
    n,a,b = map(int,input().split())
    print((n // (a + b) ) * a + n % a)
main()
Problem p02831 (python)

Fixed submission:
A,B = map(int,input().split())
def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
print(A*B // euclid(A, B))

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

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

Buggy submission (verdict: Runtime Error):
r = int(input().split())
print(r ** 2)
Problem p02860 (python)

Fixed submission:
N = int(input())
S = input()
if N <= 1 or (N % 2) == 1:
    print("No")
else:
    S1 = S[:int((N / 2))]
    S2 = S[int((N / 2)):]
    if S1 == S2:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
if N % 2 == 0:   
    if S[:N / 2] == S[N / 2:]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
S1 = S[:N / 2]
S2 = S[N / 2:]
if N > 1 or (N % 2) != 0 or S1 != S2:
    print("No")
else:
    print("Yes")
Problem p02951 (python)

Fixed submission:
A,B,C = map(int,input().split())
if B + C - A <= 0:
    print(0)
else:
    print(B + C - A)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input())
print(B + C - A)
Problem p03307 (python)

Fixed submission:
#-*- coding:utf-8 -*-

a = int(input())

if a % 2 == 1:
        print(2*a)
else:
        print(a)

Buggy submission (verdict: Runtime Error):
#-*- coding:utf-8 -*-
import math

a = int(input())
print(math.gcd(a, 2))
Problem p02699 (python)

Fixed submission:

S,W = map(int, input().split())

if W >= S:
    print('unsafe')
else:
    print('safe')

Buggy submission (verdict: Runtime Error):

S,W = map(int, input().split())

if W => S:
    print('unsafe')
else:
    print('safe')
Problem p02835 (python)

Fixed submission:
A1, A2, A3 = map(int, input().split())

if A1+A2+A3 >= 22:
    print('bust')
else:
    print('win')

Buggy submission (verdict: Runtime Error):
A1, A2, A3 = map(int, input().split())

if A1+A2+A3 => 22:
    print('bust')
else:
    print('win')
Problem p03127 (python)

Fixed submission:
n=int(input())
a=[int(i) for i in input().split()]
b=a[0]
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x

for i in a:
  b=gcd(b,i)
print(b)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[map(int,input().split()) for i in range(n)]
b=a[0]
def gcd(x,y):
  while y:
    x,y=y,x%y
  return x

for i in a:
  b=gcd(b,i)
print(b)
Problem p03242 (python)

Fixed submission:
n=input()
c=""
for i in range(len(n)):
  if n[i]=="9":
    c+="1"
  else:
    c+="9"
print(c)

Buggy submission (verdict: Runtime Error):
n=input()
for i in range(len(n)):
  if n[i]=="9":
    n[i]="1"
  else:
    n[i]="9"
print(n)
Problem p03250 (python)

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

Buggy submission (verdict: Runtime Error):
a=int(input().split())
a.sort()
print(a[2]*10+a[1]+a[0])
Problem p03272 (python)

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

Buggy submission (verdict: Runtime Error):
print(int(input())+1-int(input()))
Problem p03315 (python)

Fixed submission:
a=list(input())
sum=0
for i in range(len(a)):
  sum+=1 if a[i]=="+" else -1
print(sum)

Buggy submission (verdict: Runtime Error):
a=list(input())
sum=0
for i in range(len(a)):
  sum+=1 if a[i]=="+" else sum-=1
print(sum)
Problem p03803 (python)

Fixed submission:
a,b=map(int,input().split())
if a==b:
  print("Draw")
elif a==1:
  print("Alice")
elif b==1:
  print("Bob")
elif b<a:
  print("Alice")
else:
  print("Bob")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a==b:
  print("Draw")
elif a==1:
  print("Alice")
elif b==1:
  print("Bob")
elif b<a:
  print("Alice")
else a<b:
  print("Bob")
Problem p02623 (python)

Fixed submission:
# %%

N, M, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

# %%
AA = [0] * (N + 1)
BB = [0] * (M + 1)
for i, v in enumerate(A):
    AA[i + 1] += v + AA[i]
for i, v in enumerate(B):
    BB[i + 1] += v + BB[i]

ans = 0
b_cnt = M
for a_cnt in range(N + 1):
    if AA[a_cnt] > K:
        continue
    while AA[a_cnt] + BB[b_cnt] > K:
        b_cnt -= 1

    ans = max(ans, a_cnt + b_cnt)

print(ans)

Buggy submission (verdict: Runtime Error):
5 4 1
1000000000 1000000000 1000000000 1000000000 1000000000
1000000000 1000000000 1000000000 1000000000
Problem p02754 (python)

Fixed submission:
N, A, B = [int(i) for i in input().split()]
ans = N // (A + B) * A
r = N % (A + B)
print(ans+min(r, A))

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

ans = []
for _ in range(N//(A+B)+1):
    ans.append("b"*A)
    ans.append("r"*B)
        
ans = "".join(ans)
print(ans[:N].count("b"))

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

ans = []
for i in range(1,10**18+1):
    ans.append("b"*A)
    ans.append("r"*B)
    if (A+B) * i >= N:
        break
    
ans = "".join(ans)
print(ans[:N].count("b"))

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

ans = []
for _ in range(10**18):
    ans.append("b"*A)
    ans.append("r"*B)
    
    if len("".join(ans)) >= N:
        break

ans = "".join(ans)
print(ans[:N].count("b"))
Problem p02773 (python)

Fixed submission:
N = int(input())
S = [input() for i in range(N)]

ans = {}
for i in S:
    if i in ans:
        ans[i] += 1
    else:
        ans[i] = 1

max_v = max(ans.values())        
ANS = []
for key, value in ans.items():
    if ans[key] == max_v:
        ANS.append(key)

for i in sorted(ANS):
    print(i)

Buggy submission (verdict: Runtime Error):
ans = {}
for i in S:
    if i in ans:
        ans[i] += 1
    else:
        ans[i] = 1

max_v = max(ans.values())        
ANS = []
for key, value in ans.items():
    if ans[key] == max_v:
        ANS.append(key)

for i in sorted(ANS):
    print(i)
Problem p02860 (python)

Fixed submission:
N = int(input())
S = input()
if N % 2 != 0:
    print("No")
elif S[:N//2] == S[N//2:]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
if S[0:N//2] == S[N//2:N]:
    print("yes")
    
elif S[0:N//2] != S[N//2:N]
    print("No")

else:
    print("No")
Problem p02879 (python)

Fixed submission:
A, B = [int(i) for i in input().split()]

if A < 10 and B < 10:
  print(A * B)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
A, B = [int(i) for i in input().split()]
List_9 = []
for i in range(1, 10):
    for j in range(1, 10):
        List_9.append(i * j)
        
if A * B in List_9:
    print(A * b)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
A, B = [int(i) for i in input().split()]
List_9 = []
for i in range(1, 10):
    for j in range(1, 10):
        List_9.append(i * j)
        
if A * B in List_9:
    print(A * b)
else:
    print(-1)
Problem p02880 (python)

Fixed submission:
N = int(input())
List_9 = []
for i in range(1, 10):
    for j in range(1, 10):
        List_9.append(i * j)
        
if N in List_9:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
List_9 = []
for i in range(1, 10):
    for j in range(1, 10):
        List_9.append(i * j)
        
if A * B in List_9:
    print("Yes")
else:
    print("No")
Problem p03767 (python)

Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
s_sort = sorted(a, reverse=True)
score = 0
for i in range(1, 2*N, 2):
    score += s_sort[i]
print(score)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
s_sort = sorted(a, reverse=True)
score = 0
for i in range(1, 3N, 2):
    score += s_sort[i]
print(score)
Problem p03775 (python)

Fixed submission:
N = int(input())

import math
N_sqrt = int(math.sqrt(N))

A = [i for i in range(1, N_sqrt+1) if N%i == 0]

print(len(str(N // A[-1])))

Buggy submission (verdict: Runtime Error):
n = int(input())
 
a = []
b = []
 
 
for i in range(1, n):
    if n%i == 0:
        a.append(i)
        b.append(int(n/i))
 
a = list(map(str, a))
b = list(map(str, b))
 
 
result = []
for i in range(len(a)):
    result.append(max(len(a[i]), len(b[i])))
 
print(min(result))
Problem p03805 (python)

Fixed submission:
from   itertools import   permutations

N,M = map(int, input().split())
L = [list(map(int,input().split())) for _ in range(M)]
graph = [[False] * (N + 1) for _ in range(N + 1)]
#%%

for i in L:
    graph[i[0]][i[1]] = True
    graph[i[1]][i[0]] = True

graph[0][1] = True
graph[1][0] = True
#%%
ans = 0
for i in permutations(range(1, N + 1)):
    if i[0] != 1:
        continue
    for j in range(1, N):
        if not graph[i[j - 1]][i[j]]:
            break
    else:
       ans += 1 

print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
L = [list(map(int,input().split())) for _ in range(M)]
graph = [[False] * (N + 1) for _ in range(N + 1)]
#%%

for i in L:
    graph[i[0]][i[1]] = True
    graph[i[1]][i[0]] = True

graph[0][1] = True
graph[1][0] = True
#%%
ans = 0
for i in permutations(range(1, N + 1)):
    if i[0] != 1:
        continue
    for j in range(1, N):
        if not graph[i[j - 1]][i[j]]:
            break
    else:
       ans += 1 

print(ans)
Problem p02659 (python)

Fixed submission:
A,B = input().split()
A = int(A)
B = int(B.replace('.',''))
print(int(A*B//100))

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

Fixed submission:
n = int(input())
ans = ''
alf = ['a', 'b', 'c', 'd', 'e','f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ]
order = 0
def func(m):
    return int(26 * (26**m-1) / 25 + 0.5)
# print(func(12))
for i in range(11, 0, -1):
    if n > func(i):
        n = n-func(i)
        order = i
        break
for i in range(order, 0, -1):
    if n % 26**i == 0:
        m = n//(26**i) - 1
        n -= m * 26 ** i
        ans += alf[m]
    # print(n)
    # print(m)
    else:
        m = n // 26**i
        n %= 26**i
        ans += alf[m]
ans += alf[n-1]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
ans = ''
alf = ['a', 'b', 'c', 'd', 'e','f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ]
order = 0
def func(m):
    return 26 * (26**m-1) / 25
# print(func(12))
for i in range(11, 0, -1):
    if n > func(i):
        n = int(n-func(i)+0.5)
        order = i
        break
for i in range(order, 0, -1):
    m = int(n//(26**i) + 0.5)
    # print(n)
    # print(m)
    n %= 26**i
    ans += alf[m]
ans += alf[n-1]
print(ans)
Problem p02693 (python)

Fixed submission:
k = int(input())
a, b = map(int, input().split())
flag = 0
for i in range(a, b+1):
    if i%k == 0:
        flag = 1
        break
if flag == 0:
    print('NG')
else:
    print('OK')

Buggy submission (verdict: Runtime Error):
a, b, n = map(int, input().split())
f = max(n, b-1)

print((a*f)//b -a*(f//b))
Problem p02623 (python)

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

s=0
ac=0
bc=0
max=0

for i in range(n):
  s=s+a[i]
  ac=ac+1
  if s > k:
    s=s-a[i]
    ac=ac-1
    break
for i in range(m):
  s=s+b[i]
  bc=bc+1
  if s > k:
    s=s-b[i]
    bc=bc-1
    break

max=ac+bc

flag=0
while flag==0 and ac!=0:
  ac=ac-1
  s=s-a[ac]
  while s <= k:
    bc=bc+1
    if bc > m:
      flag=1
      break
    s=s+b[bc-1]
  bc=bc-1
  if flag==0:
    s=s-b[bc]
  
  if max < ac+bc:
    max=ac+bc
    
print(max)

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

s=0
ac=0
bc=0
max=0

for i in range(n):
  s=s+a[i]
  ac=ac+1
  if s > k:
    s=s-a[i]
    ac=ac-1
    break
for i in range(m):
  s=s+b[i]
  bc=bc+1
  if s > k:
    s=s-b[i]
    bc=bc-1
    break

max=ac+bc

flag=0
while flag==0 && ac!=0:
  ac=ac-1
  s=s-a[ac]
  while s <= k:
    bc=bc+1
    if bc > m:
      flag=1
      break
    s=s+b[bc-1]
  bc=bc-1
  if flag==0:
    s=s-b[bc-1]
  
  if max < ac+bc:
    max=ac+bc
    
print(max)

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

s=0
count=0

while s <= k:
  if a[0] <= b[0]:
    s=s+a[0]
    count=count+1
    del(a[0])
  else:
    s=s+b[0]
    count=count+1
    del(b[0])
    
print(count-1)
Problem p02629 (python)

Fixed submission:
import math

N = int(input())
i = 0

#c = math.log(N-1, 26)
#A = list(range(int(c)+1))
A = []

while(N!=0):
  c,d = divmod(N-1, 26)
  A.append(chr(d+97))
  #A[i] = chr(d+97)
  N = c
  i+=1

A.reverse()
print("".join(A))

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
i = 0

c = math.log(N-1, 26)
A = list(range(int(c)+1))

while(N!=0):
  c,d = divmod(N-1, 26)
  A[i] = chr(d+97)
  N = c
  i+=1

A.reverse()
print("".join(A))

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
i = 0
a,b = divmod(N, 26)
c = math.log(N, 26)
A = list(range(int(c)+1))

while(N!=0):
  c,d = divmod(N-1, 26)
  A[i] = chr(d+97)
  N = c
  i+=1

A.reverse()
#print(A)
print("".join(A))

Buggy submission (verdict: Runtime Error):
N = int(input())
i = 0
a,b = divmod(N, 26)
A = list(range(a))

while(N!=0):
  c,d = divmod(N-1, 26)
  A[i] = chr(d+97)
  N = c
  i+=1

A.reverse()
print("".join(A))
Problem p02693 (python)

Fixed submission:
#-*-ccoding:utf-8-*-
k = int(input())
a, b = map(int, input().split())
is_ok = False
 
for i in range(a,b+1):
  if i % k == 0:
    is_ok = True
    
if is_ok:
  print("OK")
else:
  print("NG")

Buggy submission (verdict: Runtime Error):
#-*-ccoding:utf-8-*-
k = int(input())
a, b = map(int, input().split())
is_ok = False

for i in range(a,b+1):
  if i % k == 0:
    is_ok = true
    
if is_ok:
  print("OK")
else:
  print("NG")
Problem p02753 (python)

Fixed submission:
s = input()
 
if "A" in s and "B" in s:
  print("Yes")
else:
  print("No")

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

if A in s and B in s:
  print("Yes")
else:
  print("No")
Problem p02777 (python)

Fixed submission:
S,T = input().split()
A,B = map(int, input().split())
U = input()
 
if S == U:
  A -= 1
else:
  B -= 1
  
print(A,B)

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

if S == U:
  A -= 1
else:
  B -= 1
  
print(A,B)
Problem p02987 (python)

Fixed submission:
S = input()
S1 = []
for i in S:
  if i not in S1:
    S1.append(i)
if len(S1) == 2:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
L = sorted(S)
if L[0]==L[1] and L[1]!=L[2] and L[2]==L[3]:
  print('Yes')
else:
  prin('No')

Buggy submission (verdict: Runtime Error):
S = input()
S1 = []
for i in S:
  if i not in S1:
    S1.append(i)
if len(S1) == 2:
  print('Yes')
else:
  prin('No')
Problem p03012 (python)

Fixed submission:
N = int(input())
X = list(map(int,input().split()))
A = 10**10
R = sum(X)
K = 0
for i in range (N-1):
	K += X[i]
	R -= X[i]
	A = min(A, abs(K-R))
print(A)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = list(map(int,input().split()))
A = 10**10
R = sum(X)
K = 0
for i in range (N-1):
	K += X[i]
	R -= X[i]
	A = min(A, abs(l-r))
print(A)

Buggy submission (verdict: Runtime Error):
N = int(input())
X = list(map(int, input().split()))
A = 10**10
R = sum(X)
L = 0
for i in range(N-1):
	L += X[i]
	R -= X[i]
	A = min(A, abs(l-r))
print(A)
Problem p03041 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input('N: '))
K = int(input('K: '))
S = input('S: ')
S1 = ''
for i in range (N):
    if i + 1 == K:
        if S[i] == 'A':
            S1 += 'a'
        elif S[i] == 'B':
            S1 += 'b'
        elif S[i] == 'C':
            S1 += 'c'
    else:
        S1 += S[i]

print(S1)

Buggy submission (verdict: Runtime Error):
N = 0
while N<1 or N>50:
	N = int(input('N: '))
    if N<1 or N>50:
      print('1 <= N <= 50')
K = 0
while K<1 or K>N:
  K = int(input('K: '))
  if K<1 or K>N:
    print('1 <= K <= N')
S = ''
while len(S) != N:
  S = input('S: ')
  if len(S) != N:
    print("Length doesn't Match")
  for i in S:
    if i != 'A' and i != 'B' and i != 'C':
      print('Only A, B and C allowed')
      S = ''
      break

S1 = ''
for i in range (N):
  if i + 1 == K:
    if S[i] == 'A':
      S1 += 'a'
    elif S[i] == 'B':
      S1 += 'b'
    elif S[i] == 'C':
      S1 += 'c'
  else:
 	 S1 += S[i]
S = S1
print(S)
Problem p03042 (python)

Fixed submission:
S = input()
S1 = int(S[:2])
S2 = int(S[2:])

if 1 <= S1 <= 12 and 1 <= S2 <= 12:
  print("AMBIGUOUS")
elif 0 <= S1 <= 99 and 1 <= S2 <= 12:
  print("YYMM")
elif 1 <= S1 <= 12 and 0 <= S2 <= 99:
  print("MMYY")
else:
  print("NA")

Buggy submission (verdict: Runtime Error):
S = input()
S1 = int(s[:2])
S2 = int(s[2:])

if 1<=s1<=12 and 1<=s2<=12:
  print("AMBIGUOUS")
elif 0<=s1<=99 and 1<=s2<=12:
  print("YYMM")
elif 1<=s1<=12 and 0<=s2<=99:
  print("MMYY")
else:
  print("NA")
Problem p03250 (python)

Fixed submission:
l = list(map(int, input().split()))
l.sort()

print(l[2] * 10 + sum(l[:2]))

Buggy submission (verdict: Runtime Error):
l = map(int, input().split())
l.sort()

print(l[2] * 10 + sum(l[:2]))

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
print(sum(A, B, C) - min(A, B, C))
Problem p03631 (python)

Fixed submission:
N = input()

half = len(N) // 2

if len(N)%2 == 0:
  left_N = N[:half]
  right_N = N[half:]
else:
  left_N = N[:half]
  right_N = N[half+1:]

for l,r in zip(left_N, right_N[::-1]):
  if l != r:
    print('No')
    exit()
    
print('Yes')

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

half = N // 2

if N%2 == 0:
  left_N = N[:half]
  right_N = N[half:]
else:
  left_N = N[:half]
  right_N = N[half+1:]

for l,r in zip(left_N, right_N[::-1]):
  if l != r:
    print('No')
    exit()
    
print('Yes')
Problem p03834 (python)

Fixed submission:
s = input()
print(s.replace(',', ' '))

Buggy submission (verdict: Runtime Error):
s = input()
s.replace(','. ' ')
print(s)