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

Fixed submission:
nk_str = input()
string = input()
nk_list = nk_str.split()
k = int(nk_list[-1])
string_list = [c for c in string]
string_list[k - 1] = string_list[k - 1].lower()
string = ''.join(string_list)
print(string)

Buggy submission (verdict: Runtime Error):
string = input()
numlist = [int(n) for n in string]
fst = numlist[0] * 10 + numlist[1]
scd = numlist[2] * 10 + numlist[3]
 
  
if string == '0000':
    print('NA')
    
elif fst > 12:
    if scd > 12:
        print('NA')
    else:
      	print('YYMM')
else:
    if scd > 12:
        print('MMYY')
    else:
        print('AMBIGUOUS')

Buggy submission (verdict: Runtime Error):
nk_str = input()
string = input()
nk_list = nk_str.split()
k = int(nk_list[-1])
char_list = [c for c in string]
char_list[k - 1] = char_list[k - 1].lower()
string = ''.join(string_list)
print(string

Buggy submission (verdict: Runtime Error):
nk_str = input()
string = input()
nk_list = nk_str.split()
k = int(nk_list[-1])
string_list = string.split()
string_list[k - 1] = string_list[k - 1].lower()
string = ''.join(string_list)
print(string)
Problem p03135 (python)

Fixed submission:
lis = input().split()
print(int(lis[0])/int(lis[1]))

Buggy submission (verdict: Runtime Error):
nandm = input().split()
numlist = input().split()
N = int(nandm[0])
M = int(nandm[1])
if N >= M:
    print(0)
else:
    intlist = [int(num) for num in numlist]
    intlist.sort()
    subtract = [intlist[i + 1] - intlist[i] for i in range(len(intlist) - 1)]
    subtract.sort()
    print(sum(subtract[:(M - N)]))
Problem p03137 (python)

Fixed submission:
nandm = input().split()
numlist = input().split()
N = int(nandm[0])
M = int(nandm[1])
if N >= M:
    print(0)
else:
    intlist = [int(num) for num in numlist]
    intlist.sort()
    subtract = [intlist[i + 1] - intlist[i] for i in range(len(intlist) - 1)]
    subtract.sort()
    print(sum(subtract[:(M - N)]))

Buggy submission (verdict: Runtime Error):
nandm = input().split()
numlist = input().split()
N = int(nandm[0])
M = int(nandm[1])
if N >= M:
    print(0)
else:
    intlist = [int(num) for num in numlist]
    intlist.sort()
    subtract = [intlist[i + 1] - intlist[i] for i in range(len(intlist) - 1)]
    subtract.sort()
    print(sum(subtract[M - N]))
Problem p03042 (python)

Fixed submission:
S = str(input())
F = int(S[0:2])
T = int(S[2:4])

def Greaterthan12(x):
    if x > 12:
        return 0
    else:
        if x == 0:
            return 0
        else:
            return 1
        
Fjudge = Greaterthan12(F)
Tjudge = Greaterthan12(T)
if Fjudge == 0:
    if Tjudge == 0:
        print("NA")
    else:
        print("YYMM")
else:
    if Tjudge == 0:
        print("MMYY")
    else:
        print("AMBIGUOUS")

Buggy submission (verdict: Runtime Error):
S = str(input())
F = int(S[0:2])
T = int(S[2:4])

def Greaterthan12(x):
    if x > 12:
        return 0
    else:
        return 1
        
Fjudge = BorS(F)
Tjudge = BorS(T)
if Fjudge == 0:
    if Tjudge == 0:
        print("NA")
    else:
        print("YYMM")
else:
    if Tjudge == 0:
        print("MMYY")
    else:
        print("AMBIGUOUS")
Problem p03041 (python)

Fixed submission:
N,K = map(int,input().split())
strlist = list(input())
ans = ''
S = strlist[K-1].lower()
strlist[K-1] = S
for i in strlist:
    ans += i
print(ans)

Buggy submission (verdict: Runtime Error):
S = str(input())
li = [(i+j) for (i,j) in zip(S[::2],S[1::2])]
if int(li[0]) == 00 or int(li[1]) == 00:
    print('NA')
elif int(li[0]) <= 12 and int(li[1]) <= 12:
    print('AMBIGUOUS')
elif int(li[0]) >= 13 and int(li[1]) <= 12:
    print('YYMM')
elif int(li[0]) <= 12 and int(li[1]) >= 13:
    print('MMYY')
else:
    print('NA')
Problem p03042 (python)

Fixed submission:
S = input()
X = int(S[0:2])
Y = int(S[2:4])

if X > 12 and Y > 12:
    print("NA")
elif X == 0 or Y == 0:
    if X == 0:
        if Y > 12 or Y == 0:
            print("NA")
        else:
            print("YYMM")
    else:
        if X > 12:
            print("NA")
        else:
            print("MMYY")
elif X < 13 and Y < 13:
    print("AMBIGUOUS")
elif X > Y:
    print("YYMM")
else:
    print("MMYY")

Buggy submission (verdict: Runtime Error):
S = input()
X = int(S[0:2])
Y = int(S[2:4])

if X > 12 and Y > 12:
    print("NA")
elif X == 0 or Y == 0:
    if X == 0:
        if Y > 12:
            print("NA")
        else:
            pirnt("YYMM")
    else:
        if X > 12:
            print("NA")
        else:
            print("MMYY")
elif X < 13 and Y < 13:
    print("AMBIGUOUS")
elif X > Y:
    print("YYMM")
else:
    print("MMYY")
Problem p03042 (python)

Fixed submission:
# coding: utf-8
s = input()
s_list=list(s)
s_len=len(s_list)
s_first=int(s_list[0]+s_list[1])
s_second=int(s_list[2]+s_list[3])
if s_first<13 and s_first>0: #MMYY case
    if s_second<13 and s_second>0:
        print('AMBIGUOUS')
    else:
        print('MMYY')

else: #YYMM case
    if s_second<13 and s_second>0:
        print('YYMM')
    else:
        print('NA')

Buggy submission (verdict: Runtime Error):
# coding: utf-8
s = input()
s_list=list(s)
s_len=len(s_list)
s_first=int(s_list[0]+s_list[1])
s_second=int(s_list[2]+s_list[3])
if s_first<13:#MMYY case
    if s_second<13:
        print('AMBIGOUS')
    else:
        print('MMYY')

else if: #YYMM case
    if s_second==0:
        print('NA')
    else:
        print('YYMM')

else
    print('NA')
Problem p03073 (python)

Fixed submission:
s = list(str(input()))
flag = 0
for i in range(len(s)-1):
  if s[i] == '1' and s[i+1] == '1':
    s[i+1] = '0'
    flag += 1
  elif s[i] == '0' and s[i+1] == '0':
    s[i+1] = '1'
    flag += 1
print(flag)

Buggy submission (verdict: Runtime Error):
s = list(int(input()))
flag = 0
for i in range(len(s)-1):
  if s[i] == '1' and s[i+1] == '1':
    s[i+1] = '0'
    flag += 1
  elif s[i] == '0' and s[i+1] == '0':
    s[i+1] = '1'
    flag += 1
print(flag)
Problem p03075 (python)

Fixed submission:
input_list = [int(input()) for i in range(5)]
k = int(input())
if input_list[4] - input_list[0] <= k:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
x, y, z, k = map(int, input().split())
l_a = list(map(int, input().split()))
l_b = list(map(int, input().split()))
l_c = list(map(int, input().split()))
print(list(itertools.product(l_a, l_b, l_c)))
l = [sum(i) for i in list(itertools.product(l_a, l_b, l_c))]
print(sorted(l, reverse=True)[:k])

Buggy submission (verdict: Runtime Error):
l = [int(input()) for i in range(5)]
l_0 = [a%10 for a in l]
ar = []
for n in l_0:
  if n != 0:
    ar.append(10-n)
  else:
    ar.append(0)
s = l_0.index(max(l_0))
l.pop(s)
l_0.pop(s)
ans = sum(l) + sum(l_0) + l[s]
print(ans)
l = [int(input()) for i in range(5)]
l_0 = [a%10 for a in l]
ar = []
for n in l_0:
  if n != 0:
    ar.append(10-n)
  else:
    ar.append(0)
s = ar.index(max(ar))
ar.pop(s)
ans = sum(l) + sum(ar)
print(ans)

Buggy submission (verdict: Runtime Error):
l = [int(input()) for i in range(5)]
l_0 = [a%10 for a in l]
ar = []
for n in l_0:
  if n != 0:
    ar.append(10-n)
  else:
    ar.append(0)
s = l_0.index(max(l_0))
l.pop(s)
l_0.pop(s)
ans = sum(l) + sum(l_0) + l[s]
print(ans)

Buggy submission (verdict: Runtime Error):
if e - a =< k:
  print('Yay!')
else:
  print(':(')
Problem p03041 (python)

Fixed submission:
n,k=map(int, input().split())
String=input()
String=list(String)
String[k-1]=String[k-1].lower()
String="".join(String)
print(String)

Buggy submission (verdict: Runtime Error):
n,k=map(int, input().split())
String=input()
String=list(String)
String[k]=String[k].lower()
String="".join(String)
print(String)

Buggy submission (verdict: Runtime Error):
n,k=map(int, input().split())
String=input()
String=list(String)
String[k]=String[k].upper()
String="".join(String)
print(String)
Problem p03041 (python)

Fixed submission:
i = int(input().split()[1]) - 1
s = input()
print("{}{}{}".format(s[:i], s[i].lower(), s[i+1:]))

Buggy submission (verdict: Runtime Error):
i = int(input().split()[1])
s = input()
print("{}{}{}".format(s[:i], s[i].lower(), s[i+1:]))
Problem p03315 (python)

Fixed submission:
s=input()
result=0
for i in s:
    if i=="+" : result+=1
    else : result-=1
print(result)

Buggy submission (verdict: Runtime Error):
s=input()
result=0
for i in s:
  result+=1 if i=="+" else result-=1
print(result)
Problem p03834 (python)

Fixed submission:
a,b,c=input().split(",")
print(a,b,c)

Buggy submission (verdict: Runtime Error):
a,b,c=input().split(".")
print(a,b,c)
Problem p03041 (python)

Fixed submission:
n, k = (int(i) for i in input().split())  
s=str(input())
if k == n:
    r=s[0:(k-1)] + s[n-1].lower()
elif k == 1:
    r=s[0].lower() + s[1:n]
else:
    r=s[0:(k-1)] + s[k-1].lower() + s[k:n]
print(r)

Buggy submission (verdict: Runtime Error):
n, k = (int(i) for i in input().split())  
s=str(input())
if k == n:
    r=s[0:(k-1)] + s[n].lower()
elif k == 1:
    r=s[0].lower() + s[1:n]
else:
    r=s[0:(k-1)] + s[k-1].lower() + s[k:n]
print(r)

Buggy submission (verdict: Runtime Error):
n, k = (int(i) for i in input().split())  
s=str(input())
if k == n:
    r=s[0:(k-1)] + s[k].lower()
elif k == 0:
    r=s[0:(k-1)].lower() + s[k]
else:
    r=s[0:(k-1)] + s[k-1].lower() + s[k]
print(r)

Buggy submission (verdict: Runtime Error):
n=int(input())
k=int(input())
s=str(input())
if k == n:
    r=s[0:(k-1)] + s[k].lower()
elif k == 0:
    r=s[0:(k-1)].lower() + s[k]
else:
    r=s[0:(k-1)] + s[k-1].lower() + s[k]
print(r)
Problem p03041 (python)

Fixed submission:
miu = input().split()
sella = input()

for x in range(0, int(miu[0])):
	if x == int(miu[1])-1:
		print(sella[x].lower(), end='')
	else:
		print(sella[x], end='')

Buggy submission (verdict: Runtime Error):
miu = input().split()
sella = input()

for x in range(0, int(miu[0])):
	if x == int(miu[1]-1):
		print(sella[x].lower(), end='')
	else:
		print(sella[x], end='')

Buggy submission (verdict: Runtime Error):
miu = input().split()
sella = input()

for x in range(0, int(miu[0]):
	if x == int(miu[1]):
		print(sella[x].lower(), end='')
	else:
		print(sella[x], end='')

Buggy submission (verdict: Runtime Error):
miu = input().split()
sella = input()

for x in sella:
	if x == int(miu[1]):
		print(x.lower(), end='')
    else:
		print(x, end='')

Buggy submission (verdict: Runtime Error):
miu = input().split()
sella = input()
 
for x in sella:
	if x == int(miu[1]):
		print(x.lower(), end='')
    else:
		print(x, end='')

Buggy submission (verdict: Runtime Error):
miu = input().split()[1]
sella = input()
 
sella[int(miu)-1] = sella[int(miu)-1].lower()
 
print(sella)

Buggy submission (verdict: Runtime Error):
miu = input().split()[1]
sella = input()

sella[int(miu)+1].lower()

print(sella)
Problem p03775 (python)

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

def digits(n):
    count = 1
    while n // 10 != 0:
        n = n // 10
        count += 1
    return count

for a in range(1, int(math.sqrt(N)) + 1):
    if N % a == 0:
        b = N // a
        ans.append(max(digits(a), digits(b)))

print(min(ans))

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
ans = []

def digits(n):
    count = 1
    while n // 10 != 0:
        n = n // 10
        count += 1
    return count

for a in range(1, int(math.sqrt(N))):
    if N % a == 0:
        b = N // a
        ans.append(max(digits(a), digits(b)))

print(min(ans))
Problem p03041 (python)

Fixed submission:
ls = input().split()
s = list(input())
 
n = int(ls[0])
k = int(ls[1]) - 1
 
if s[k] == 'A':
  s[k] = 'a'
elif s[k] == 'B':
  s[k] = 'b'
elif s[k] == 'C':
  s[k] = 'c'
  
print(''.join(s))

Buggy submission (verdict: Runtime Error):
ls = input().split()
s = list(input())

n = int(ls[0])
k = int(ls[1])

if s[k] == 'A':
  s[k] == 'a'
elif s[k] == 'B':
  s[k] == 'b'
elif s[k] == 'C':
  s[k] == 'c'
  
print(''.join(s))
Problem p03135 (python)

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

print(T/X)

Buggy submission (verdict: Runtime Error):
T, X = map(int, input().split(''))

print(T/X)

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

print(T/X)

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

R = X/T

print(R)
Problem p03315 (python)

Fixed submission:
s = input()
ans = 0
for i in s:
    if i == '+':
        ans += 1
    else:
        ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n, k = map(int, input().split())
data = list(map(int, input().split()))
print(math.ceil((n-1)/(k-1)))
Problem p03104 (python)

Fixed submission:
def F(n):
    res = 0
    if n % 4 == 0:
        res = n
    elif n % 4 == 1:
        res = 1
    elif n % 4 == 2:
        res = 1^n
    else:
        res = 0
        
    return res

def main():
    A, B = map(int, input().split())
    ans = F(A-1) ^ F(B)

    #print(A, B, F(A-1), F(B))

    print(ans)

main()

Buggy submission (verdict: Runtime Error):
import numpy as np
def binary(_x):
    x = _x
    l = int(np.log2(x) + 1)
    res = [0] * l
    
    for i in range(l):
        res[i] += x%2
        x = int(x/2)
    return res


def a_xor(lis, i, sub, sub_max):
    return lis[i] * ( ( sub_max - sub + 1 ) % 2 )


def b_xor(lis, i, sub, sub_max):
    return lis[i] * ( ( sub_max - sub ) % 2 )


def main():
    A, B = map(int, input().split())
    bin_a = binary(A)
    bin_b = binary(B)
    odd_even_vec = [0] * len(bin_b)

    #print("a")
    sub = 0
    sub_max = 0
    for i, bit in enumerate(bin_a):
        if i == 0:
            odd_even_vec[i] += bit%2
        else:
            k = i-1
            sub += bit * 2**k
            sub_max += 2**k
            odd_even_vec[i] += a_xor(bin_a, i, sub, sub_max)
        #print(odd_even_vec, sub, sub_max)

    #print("b")
    sub = 0
    sub_max = 0
    for i, bit in enumerate(bin_b):
        if i == 0:
            odd_even_vec[i] += bit%2
        else:
            k = i-1
            sub += bit * 2**k
            sub_max += 2**k
            odd_even_vec[i] += b_xor(bin_b, i, sub, sub_max)
            
        #print(odd_even_vec, sub, sub_max)
        
    res = 0
    for i, bit in enumerate(odd_even_vec):
        res += bit%2 * 2**i

    print (res)

    
main()

Buggy submission (verdict: Runtime Error):
import numpy as np
def binary(_x):
    x = _x
    l = int(np.log2(x) + 1)
    res = [0] * l
    
    for i in range(l):
        res[i] += x%2
        x = int(x/2)
    return res


def a_xor(lis, i, sub, sub_max):
    return lis[i] * ( ( sub_max - sub + 1 ) % 2 )


def b_xor(lis, i, sub, sub_max):
    return lis[i] * ( ( sub_max - sub ) % 2 )


def main():
    A, B = map(int, input().split())
    bin_a = binary(A)
    bin_b = binary(B)
    odd_even_vec = [0] * len(bin_b)

    print("a")
    sub = 0
    sub_max = 0
    for i, bit in enumerate(bin_a):
        if i == 0:
            odd_even_vec[i] += bit%2
        else:
            k = i-1
            sub += bit * 2**k
            sub_max += 2**k
            odd_even_vec[i] += a_xor(bin_a, i, sub, sub_max)
        print(odd_even_vec, sub, sub_max)

    print("b")
    sub = 0
    sub_max = 0
    for i, bit in enumerate(bin_b):
        if i == 0:
            odd_even_vec[i] += bit%2
        else:
            k = i-1
            sub += bit * 2**k
            sub_max += 2**k
            odd_even_vec[i] += b_xor(bin_b, i, sub, sub_max)
            
        print(odd_even_vec, sub, sub_max)
        
    res = 0
    for i, bit in enumerate(odd_even_vec):
        res += bit%2 * 2**i

    print (res)

    
main()
Problem p03315 (python)

Fixed submission:
s = input()
p = s.count('+')
m = s.count('-')
print(p-m)

Buggy submission (verdict: Runtime Error):
S = input()
p = S.count('+')
m = s.count('-')
print(p-m)
Problem p03327 (python)

Fixed submission:
N = int(input())
if N <= 999:
  print('ABC')
else:
  print('ABD')

Buggy submission (verdict: Runtime Error):
N = int(inut())
if N <= 999:
  print('ABC')
else:
  print('ABD')
Problem p03107 (python)

Fixed submission:
x = input()
cnt1 = 0
cnt2 = 0
for i in x:
  if i == '1':
    cnt1 += 1
  else:
    cnt2 += 1
print(min(cnt1, cnt2)*2)

Buggy submission (verdict: Runtime Error):
def algo(s):
  if len(s) == 1:
    return 0
  elif len(s) == 2:
    if s[0] != s[1]:
      return 2
    else:
      return 0
  else:
    tmp = ""
    for i in range(1, len(s)-1):
      if s[i] != s[i+1]:
        tmp += s[0:i] + s[i+2:]
        break
    return 2 + algo(tmp)
    
x = input()
ans = algo(x)
print(ans)
Problem p03041 (python)

Fixed submission:
n = input().split()
c = list(input()) 
c[int(n[1]) - 1] = c[int(n[1]) - 1].lower()
print("".join(c))

Buggy submission (verdict: Runtime Error):
n = input().split()
c = list(input()) 
c[int(n[1] - 1)] = c[int(n[1]) - 1].lower()
print("".join(c))

Buggy submission (verdict: Runtime Error):
n = input().split()
c = list(input()) 
c[int(n[1])] = c[int(n[1])].lower()
print("".join(c))
Problem p04005 (python)

Fixed submission:
str = input()
num = list(map(int,str.split(' ')))
if ((num[0]%2)and(num[1]%2)and(num[2]%2))==0:
	print(0)
else:
	num.sort()
	print(num[0]*num[1])

Buggy submission (verdict: Runtime Error):
str = input()
num = list(map(int,str.split(' ')))
if (num[0]%2)and(num[1]%2)and(num[2])==0:
	print(0)
else:
	num.sort()
        print(num[0]*num[1])

Buggy submission (verdict: Runtime Error):
str = input()
num = list(map(int,str.split(' ')))
if (num[0]%2)*(num[1]%2)*(num[2])==1:
	num.sort()
        print(num[0]*num[1])
else:
        print(0)

Buggy submission (verdict: Runtime Error):
str = input()
num = list(map(int,str.split(' ')))
if !(num[0]%2)*(num[1]%2)*(num[2]):
	print(0)
else:
	num.sort()
print(num[0]*num[1])
Problem p03041 (python)

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

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

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

Fixed submission:
x=input()
n=[x[i] for i in range(len(x))]
for i in range(len(n)):
  if n[i]=="1":
    n[i]="9"
  elif n[i]=="9":
    n[i]="1"
print(int("".join(n)))

Buggy submission (verdict: Runtime Error):
x=input()
n=[x[i] for i in range(len(n))]
for i in range(len(n)):
  if n[i]=="1"or"9":
    if n[i]=="1":
      n[i]="9"
    else:
      n[i]=="1"
print(int("".join(n)))

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

Fixed submission:
N,M = map(int,(input().split()))
X = list(map(int,(input().split())))
X.sort()
if M > N:
    dist = [X[i+1]-X[i] for i in range(M - 1)]
    dist.sort(reverse = True)
    for i in range(N - 1):
        del dist[0]
    print(sum(dist))
else:
 print(0)

Buggy submission (verdict: Runtime Error):
N,M = map(int,(input().split()))
X = list(map(int,(input().split())))
X.sort()
if M > N:
    dist = [X[i+1]-X[i] for i in range(M - 1)]
    dist.sort(reverse = True)
        del dist[0:N]
    print(sum(dist))
else:
 print(0)

Buggy submission (verdict: Runtime Error):
N,M = map(int,(input().split()))
X = list(map(int,(input().split())))
X.sort()
if M > 1:
    dist = [X[i+1]-X[i] for i in range(M - 1)]
    dist.sort(reverse = True)
    for i in range(N - 1):
        del dist[0]
    print(sum(dist))
else:
 print(0)

Buggy submission (verdict: Runtime Error):
N,M = map(int,(input().split()))
X = list(map(int,(input().split())))
X.sort()
if len(X) > 1:
    dist = [X[i+1]-X[i] for i in range(len(X) - 1)]
    dist.sort(reverse = True)
    for i in range(N - 1):
        del dist[0]
    print(sum(dist))
else:
 print(0)

Buggy submission (verdict: Runtime Error):
N,M = map(int,(input().split()))
X = list(map(int,(input().split())))
X.sort()
dist = [X[i+1]-X[i] for i in range(len(X) - 1)]
dist.sort(reverse = True)
for i in range(N - 1):
    del dist[0]
print(sum(dist))
Problem p03042 (python)

Fixed submission:
def has_month_potential(num):
    return num >= 1 and num <= 12

S = input()

formar = int(S[:2])
latter = int(S[2:])

if has_month_potential(formar) and not has_month_potential(latter):
    print('MMYY')
elif not has_month_potential(formar) and has_month_potential(latter):
    print('YYMM')
elif has_month_potential(formar) and has_month_potential(latter):
    print('AMBIGUOUS')
elif not has_month_potential(formar) and not has_month_potential(latter):
    print('NA')

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

formar = int(S[:2])
latter = int(S[2:])

if has_month_potential(formar) and not has_month_potential(latter):
    print('MMYY')
elif not has_month_potential(formar) and has_month_potential(latter):
    print('YYMM')
elif has_month_potential(formar) and has_month_potential(latter):
    print('AMBIGUOUS')
elif not has_month_potential(formar) and not has_month_potential(latter):
    print('NA')
Problem p03077 (python)

Fixed submission:
import math
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
 
cs = [a,b,c,d,e]
 
min_cs = min(cs)
 
t = math.ceil(n / min_cs)

print(t + 4)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cs = [a,b,c,d,e]

min_idx = cs.index(min(cs))

if min_idx == 0:
    t = int(n / cs[min_idx]) + 1
elif min_idx == 1:
    amari = n % cs[min_idx-1]
    t = int(cs[min_idx-1] / (cs[min_idx-1] - cs[min_idx])) + 1
    if amari <= cs[min_idx]:
        t = t - 1
else:
    amari = cs[min_idx-2] % cs[min_idx-1]
    t = int(cs[min_idx-1] / (cs[min_idx-1] - cs[min_idx])) + 1
    if aamari <= cs[min_idx]:
        t = t - 1

print(4 + t)
Problem p03107 (python)

Fixed submission:
from collections import Counter
S = input()
c = Counter(S)
print(min(c['0'], c['1']) * 2)

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

if len(S) < 2:
    print('0')

else:
    # 最初に攻めていくパターンを仮ぎめ
    i = 0
    while True:
        if S[i] != S[-1-i]:
            left = S[i]
            right = S[-1-i]
            break
        i += 1
    pattern = right + left

    # マッチングして取り除いていく
    count = 0
    curr_S = S

    while True:
        count_increased = False
        new_S = ''
        j = 0
        while True:
#             print(curr_S, j, curr_S[j:j+2], new_S, pattern, count)
            if curr_S[j:j+2] == pattern:
                count += 2
                j += 2
                count_increased = True
            else:
                new_S += curr_S[j]
                j += 1
            if j == len(curr_S):
                break
        # １個も見つからなかった場合はパターンを反転させて継続
        if not count_increased:
            pattern = pattern[::-1]

        # 全てが0または1になったら終了
        if '0' not in new_S or '1' not in new_S:
            break
        curr_S = new_S

    print(count)

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

if len(S) < 2:
    print('0')

else:
    # 最初に攻めていくパターンを仮ぎめ
    i = 0
    while True:
        if S[i] != S[-1-i]:
            left = S[i]
            right = S[-1-i]
            break
        i += 1
    pattern = right + left

    # マッチングして取り除いていく
    count = 0
    curr_S = S

    while True:
        count_increased = False
        new_S = ''
        j = 0
        while True:
            print(curr_S, j, curr_S[j:j+2], new_S, pattern, count)
            if curr_S[j:j+2] == pattern:
                count += 2
                j += 2
                count_increased = True
            else:
                new_S += curr_S[j]
                j += 1
            if j == len(curr_S):
                break
        # １個も見つからなかった場合はパターンを反転させて継続
        if not count_increased:
            pattern = pattern[::-1]

        # 全てが0または1になったら終了
        if '0' not in new_S or '1' not in new_S:
            break
        curr_S = new_S

    print(count)
Problem p03327 (python)

Fixed submission:
line = input()

num = int(line)

if num < 1000:
    print("ABC")
else:
    print("ABD")

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

num = int(line)

if line < 1000:
    print("ABC")
else:
    print("ABD")