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

Fixed submission:
N,K = map(int,input().split())
moji = str(input())
ans = [0]
for i in range(N-1):
    if moji[i] == "A" and moji[i+1] == "C":
        ans.append(ans[i]+1)
    else:
        ans.append(ans[i])

        
for i in range(K):
    st,sp = map(int,input().split())
    print(ans[sp-1]-ans[st-1])

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
moji = str(input())
ans = [0]
for i in range(N-1):
    if moji[i] == "A" and moji[i+1] == "C":
        ans.append(ans[i]+1)
    else:
        ans.append(ans[i])

        
for i in range(K):
    st,sp = map(int,input().split())
    print(ans[sp]-ans[st])

Buggy submission (verdict: Runtime Error):
cho,N = map(int,input().split())
moji = str(input())
moji_dict = []
flg = 0
##計算量は10**5
for i in range(cho):
    if flg == 1:
        flg = 0
    elif i != cho and moji[i] == "A" and moji[i+1] =="C":
        moji_dict.append(i + 1)
        flg = 1
##計算量は10**3　* 10 ** 5
for j in range(N):
    s,g = map(int,input().split())
    print(len([k for k in moji_dict if k >= s and k < g]))

Buggy submission (verdict: Runtime Error):
cho,N = map(int,input().split())
moji = str(input())
moji_dict = []
flg = 0
##計算量は10**5
for i in range(cho):
    if flg == 1:
        flg = 0
    elif i != cho and moji[i] == "A" and moji[i+1] =="C":
        moji_dict.append(i + 1)
        flg = 1
##計算量は10**3　* 10 ** 5
for j in range(N):
    s,g = map(int,input().split())
    print(len([k for k in moji_dict if k >= s and k < g]))

Buggy submission (verdict: Runtime Error):
cho,N = map(int,input().split())
moji = str(input())
moji_dict = []
flg = 0
##計算量は10**5
for i in range(cho):
    if flg == 1:
        flg = 0
    elif i != cho and moji[i] == "A" and moji[i+1] =="C":
        moji_dict.append(i + 1)
        flg = 1
##計算量は10**3　* 10 ** 5
for j in range(N):
    s,g = map(int,input().split())
    print(len([k for k in moji_dict if k >= s and k < g]))
Problem p03160 (python)

Fixed submission:
##https://atcoder.jp/contests/dp/tasks/dp_a 
N = int(input())
Place_Height_List = list(map(int,input().split()))  
Min_List = [0,abs(Place_Height_List[1]-Place_Height_List[0])]

for i in range(2,len(Place_Height_List)):
    One_Step = abs(Place_Height_List[i] - Place_Height_List[i - 1]) 
    Two_Step = abs(Place_Height_List[i] - Place_Height_List[i - 2])
    Min_List.append(min(Min_List[i - 1] + One_Step,Min_List[i - 2] + Two_Step))
    
print(Min_List[-1])

Buggy submission (verdict: Runtime Error):
A = [-1] * (10 ** 9)
print(A)
Problem p03162 (python)

Fixed submission:
# https://atcoder.jp/contests/dp/tasks/dp_c
import numpy as np
N = int(input())
Max_List=[]
N_List=[i for i in range(3)]
for i in range(N):
    Current_List=list(map(int,input().split())) 
    if i == 0:
        Max_List.append(Current_List)
    else:
        Current_Max_List = []
        for j in range(3):
            Index_List=np.array(Max_List[i-1])
            ind = np.ones(3, dtype=bool)
            ind[j] = False
            Current_Max_List.append(max(Index_List[ind])+Current_List[j])
            
        Max_List.append(Current_Max_List)
        
    
print(max(Max_List[-1]))

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/dp/tasks/dp_c
N = int(input())
Max_List = [[0] * 3 for i in range(N)]
for i in range(N):
    Current_List = list(map(int,input().split()))  
    if i == 0:
        Max_List[i] = Current_List
    else:
        Search_List = Max_List[i-1]
        for j in range(3):
            Current_Search_List = Search_List[1:3]
            Max_List[i][j] = max(Current_Search_List) + Current_List[j]
            Search_List.append(Search_List[0])
            del Search_List[0]
        
        Max_List[i] = Current_Max_List

        
print(max(Max_List[-1]))

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/dp/tasks/dp_c
N = int(input())
Max_List = [[0] * 3 for i in range(N)]
for i in range(N):
    Current_List = list(map(int,input().split()))  
    if i == 0:
        Max_List[i] = Current_List
    else:
        Search_List = Max_List[i-1]
        for j in range(3):
            Current_Search_List = Search_List[1:3]
            Max_List[i][j] = (max(Current_Search_List) + Current_List[j])
            Search_List.append(Search_List[0])
            del Search_List[0]
        
        Max_List[i] = Current_Max_List

        
print(max(Max_List[-1]))

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/dp/tasks/dp_c
N = int(input())
Max_List=[]
N_List=[i for i in range(3)]
for i in range(N):
    Current_Max_List = []
    Current_List=list(map(int,input().split())) 
    if i == 0:
        Max_List.append(Current_List)
    else:
        for j in range(3):
            Index_List=np.array(Max_List[i-1])
            ind = np.ones(3, dtype=bool)
            ind[j] = False
            Current_Max_List.append(max(Index_List[ind])+Current_List[j])
            
        Max_List.append(Current_Max_List)
 
print(max(Max_List[-1]))

Buggy submission (verdict: Runtime Error):
# https://atcoder.jp/contests/dp/tasks/dp_c
N = int(input())
Max_List=[]
N_List=[i for i in range(3)]
for i in range(N):
    Current_Max_List = []
    Current_List=list(map(int,input().split())) 
    if i == 0:
        Max_List.append(Current_List)
    else:
        for j in range(3):
            Index_List=np.array(Max_List[i-1])
            ind = np.ones(3, dtype=bool)
            ind[j] = False
            Current_Max_List.append(max(Index_List[ind])+Current_List[j])
            
        Max_List.append(Current_Max_List)

print(max(Max_List[-1]))
Problem p03168 (python)

Fixed submission:
#https://atcoder.jp/contests/dp/tasks/dp_i
import math
N = int(input())
P_List = list(map(float,input().split()))
dp = [[0 for j in range(N + 1)] for i in range(N+1)]
std = math.ceil(N/2)
for i in range(N+1):
    if i == 0:
        dp[i][0] = 1
    else:
        Current_P = P_List[i - 1]
        for j in range(i + 1):
            if (N - i + j) < std:
                dp[i][j] = 0
            elif j == 0:
                dp[i][j] = dp[i - 1][j]*(1 - Current_P)
            elif j != i:
                dp[i][j] = (dp[i - 1][j]*(1 - Current_P)) + (dp[i - 1][j - 1]*Current_P)
            else:
                dp[i][j] = dp[i - 1][j - 1]*Current_P
    
print(sum(dp[N][math.ceil(std):]))

Buggy submission (verdict: Runtime Error):
#https://atcoder.jp/contests/dp/tasks/dp_i
import math
N = int(input())
P_List = list(map(float,input().split()))
dp = [[] * N for i in range(N+1)]
std = math.ceil(N/2)
for i in range(N+1):
    if i == 0:
        dp[0].append(1)
    else:
        Current_P = P_List[i - 1]
        for j in range(i + 1):
            if (N - i + j) < std:
                dp[i].append(0)
            elif j == 0:
                dp[i].append(dp[i - 1][j]*(1 - Current_P),10)
            elif j != i:
                dp[i].append((dp[i - 1][j]*(1 - Current_P)) + (dp[i - 1][j - 1]*Current_P),10)
            else:
                dp[i].append(dp[i - 1][j - 1]*Current_P,10)
    
print(sum(dp[N]))
Problem p03261 (python)

Fixed submission:
#https://atcoder.jp/contests/abc109/tasks/abc109_b
import collections
N = int(input())
Word_List = []
SP = ""
for i in range(N):
    CW = str(input())
    if i == 0:
        Word_List.append(CW)
        SP = CW[-1]
    elif SP != CW[0]:
        print("No")
        break
    else:
        Word_List.append(CW)
        SP = CW[-1]
else:
    Word_List = collections.Counter(Word_List)
    if len(Word_List) != N:
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc109/tasks/abc109_b
import collections
N = int(input())
Word_List = []
SP = ""
for i in range(N):
    CW = str(input())
    if i == 0:
        Word_List.append(CW)
        SP = CW[-1]
    elif SP != CW[0]:
        break
    else:
        Word_List.append(CW)
        SP = CW[-1]
else:
    Word_List = collections.Counter(Word_List))
    if len(Word_List) != N:
        print("No")
    else:
        print("Yes")
Problem p03292 (python)

Fixed submission:
import numpy as np
N_List = np.array(list(map(int,input().split())))
N_List_a = np.sort(N_List)
print(sum(N_List_a[1:]-N_List_a[:-1]))

Buggy submission (verdict: Runtime Error):
N_List = sorted(list(map(int,input().split())))
print(sum(N_List[1:]-N_List[:-1]))
Problem p03425 (python)

Fixed submission:
import itertools
N = int(input())
M_Dict = {"M":0,"A":0,"R":0,"C":0,"H":0}
for i in range(N):
    moji = str(input())
    if moji[0] in M_Dict.keys():
        M_Dict[moji[0]] += 1
M_Dict = {k: v for k, v in M_Dict.items() if v != 0}    
if len(M_Dict) < 3:
    ans = 0
else:
    ans = 0
    for k in itertools.combinations(list(M_Dict.keys()),3):
        ans += int(M_Dict[k[0]]) * int(M_Dict[k[1]]) * int(M_Dict[k[2]])
    
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
M_Dict = {"M":0,"A":0,"R":0,"C":0,"H":0}
for i in range(N):
    moji = str(input())
    if moji[0] in M_Dict.keys():
        M_Dict[moji[0]] += 1
M_Dict = {k: v for k, v in M_Dict.items() if v != 0}    
if len(M_Dict) < 3:
    ans = 0
else:
    ans = 0
    for k in itertools.combinations(list(M_Dict.keys()),3):
        ans += M_Dict[k[0]]*M_Dict[k[1]]*M_Dict[[2]]
    
print(ans)
Problem p03543 (python)

Fixed submission:
moji = str(input())
A,B,C,D = int(moji[0]),int(moji[1]),int(moji[2]),int(moji[3])

mojiretsu = str(A-B) + str(B-C) + str(C-D)
if ("00" in mojiretsu ):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
dp = [[]for i in range(87)] 
dp[0] = 2
dp[1] = 1

for i in range(2,87):
    dp[i] = dp[i-1]+dp[i-2]
    if i == N:
        print(dp[i])
        break
else:
    print(dp[N])
Problem p03635 (python)

Fixed submission:
N,M = map(int,input().split())
print((N-1)*(M-1))

Buggy submission (verdict: Runtime Error):
##
N = int(input())
N_List = list(map(int,input().split()))
Four_List = [i for i in N_List if i % 4 == 0]
Two_List = [i for i in N_List if i % 2 == 0]
if len(Two_List)-len(Four_List) > 0:
    N = N - (len(Two_List) - len(Four_List)) + 1

if N // 2 <= len(Four_List):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
##
N = int(input())
N_List = list(map(int,input().split()))
Four_List = [i for i in N_List if i % 4 == 0]
Two_List = [i for i in N_List if i % 2 == 0]
if len(Two_List) > 0:
    N = N - (len(Two_List) - len(Four_List)) + 1

if N // 2 <= len(Four_List):
    print("Yes")
else:
    print("No")
Problem p03695 (python)

Fixed submission:
N = int(input())
N_List = list(map(int,input().split()))
NR_List = [i // 400 for i in N_List]
Number_NRD = len(set([i for i in NR_List if i < 8]))
Number_NRU = len([i for i in NR_List if i >= 8])
max_p= Number_NRD + Number_NRU
min_p= (Number_NRD,1)[Number_NRD == 0]
print(str(min_p) + " " + str(max_p))

Buggy submission (verdict: Runtime Error):
N = int(input())
N_List = list(map(int,input().split()))
NR_List = [i // 400 for i in N_List]
Number_NRD = len(set([i for i in NR_List if i < 8]))
Number_NRU = len([i for i in NR_List if i >= 8])
max_p= (Number_NRD + Number_NRU,8)[Number_NRD +Number_NRU>=8]
min_P= (Number_NRD,1)[Number_NRD == 0]
print(str(min_p) + " " + str(max_p))

Buggy submission (verdict: Runtime Error):
N = int(input())
N_List = list(map(int,input().split()))
NR_List = [i // 400 for i in N_List]
Number_NRD = len(set([i for i in NR_List if i < 8]))
Number_NRU = len([i for i in NR_List if i >= 8])
max_p= (Number_NRD + Number_NRU,8)[Number_NRD +Number_NRU>=8]
min_P= (Number_NRD,1)[Number_NRD == 0]
print(min_p + " " + max_p)
Problem p03699 (python)

Fixed submission:
N = int(input())
dp = [0]
for i in range(N):
    P = int(input())
    dp_p = list(map(lambda x:x + P,dp))
    dp = list(set(dp + dp_p))

P_List = [0] + [i for i in dp if i % 10 != 0]
print(max(P_List))

Buggy submission (verdict: Runtime Error):
N = int(input())
dp = [[0]*(N + 1)*100 for i in range(N + 1)]
for i in range(1,N+1):
    cs = int(input())
    dp[i][cs] = cs
    U_List = [k for k, x in enumerate(dp[i-1]) if x != 0]
    for j in U_List:
        dp[i][j+cs] = j + cs
print(max([k for k, x in enumerate(dp[-1]) if x % 10 != 0]))
Problem p03280 (python)

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

print((L[0]-1)*(L[1]-1))

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

print((A-1)*(B-1))
Problem p03369 (python)

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

order = input()

ret = 700
for i in order:
    if i == 'o':
        ret += 100

print(ret)

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

order = input().srtip()

ret = 700
for i in order:
    if i == 'o':
        ret += 100

print(ret)
Problem p02743 (python)

Fixed submission:
from decimal import Decimal

a, b, c = [Decimal(x) for x in input().split()]

# math.sqrt(x: SupportsFloat) -> float
# param x: SupportsFloat

# sqrt(context: Optional[Context]=...) -> Decimal

if a.sqrt() + b.sqrt() < c.sqrt():
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a, b, c = [int(x) for x in input().split()]

if 2 * math.sqrt(a * b) < (c - a- b):
        print('Yes')
else:
    print('No')
Problem p02900 (python)

Fixed submission:

A,B =[int(x) for x in input().split()]

def bunkai(n):
    sosu= {1}
    tmp = n
    stop_flag = n
    
    if tmp%2 == 0:
        while tmp%2==0:
            tmp //=2
        sosu.add(2)
    
    for i in range(3,n+1,2):
        if tmp%i == 0:
            while tmp%i==0:
                tmp //=i
            sosu.add(i)
            stop_flag = tmp 
            
        if i > stop_flag:
            break
        else:
            stop_flag = int(n/i)+1
            
    if tmp!=1:
        sosu.add(tmp)
                
    if sosu==[1]:
        sosu.add(n)
    
    return sosu

def check_sosu(n,x):
    ans=0
    tmp = n
    for i in x:
        if (tmp % i) == 0:
            ans+=1
    return ans

ans = check_sosu(B,bunkai(A))

print(ans)

Buggy submission (verdict: Runtime Error):

A,B =[int(x) for x in input().split()]

def bunkai(n):
    sosu= [1]
    tmp = n
    
    if tmp%2 == 0:
        while tmp%2==0:
            tmp //=2
        sosu.append(2)
    
    stop_flag = n//2

    for i in range(3,(n//2)+1,2):
        if tmp%i == 0:
            while tmp%i==0:
                tmp //=i
            sosu.append(i)
        if i > stop_flag:
            break
        else:
            stop_flag //=i 
            
    if tmp!=1:
        sosu.append(tmp)
                
    if sosu==[1]:
        sosu.append[n]
    
    return sosu

def check_sosu(n,x):
    ans=0
    tmp = n
    for i in x:
        if (tmp % i) == 0:
            ans+=1
    return ans

ans = check_sosu(B,bunkai(A))

print(ans)

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

def bunkai(n):
    sosu= []
    tmp = n
    
    if tmp%2 == 0:
        while tmp%2==0:
            tmp //=2
        sosu.append(2)
    
    for i in range(3,int(n/2)+1,2):
        if tmp%i == 0:
            while tmp%i==0:
                tmp //=i
            sosu.append(i)

    if tmp!=1:
        sosu.append(tmp)
                
    if sosu==[]:
        sosu.append[n]
    
    return sosu

def check_sosu(n,x):
    ans=1
    tmp = n
    for i in x:
        if (tmp % i) == 0:
            ans+=1
    return ans

ans = check_sosu(B,bunkai(A))

print(ans)
Problem p02952 (python)

Fixed submission:
N = int(input())

if N ==100000:
    ans=90909
elif N > 9999:  
    ans=N-9999 +909
elif N > 999:
    ans=909
elif N > 99:
    ans=N-99 +9
elif N > 9:
    ans= 9
else :
    ans=N
print(ans)

Buggy submission (verdict: Runtime Error):
if N ==100000:
    ans=90909
elif N > 9999:  
    ans=N-9999 +909
elif N > 999:
    ans=909
elif N > 99:
    ans=N-99 +9
elif N > 9:
    ans= 9
else :
    ans=N
print(ans)
Problem p03076 (python)

Fixed submission:
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

X=[A,B,C,D,E]
ans=0

Y=10

for i in range(len(X)):
    if X[i]%10 == 0:
        ans+=X[i]
    else:
        Y=min(Y,X[i]%10)
        ans+=(X[i]//10)*10+10

ans +=-10+Y
print(ans)

Buggy submission (verdict: Runtime Error):
X=[int(input()) for i in range(5)]

ans=0
W=[]

for i in range(len(X)):
    if X[i]%10 == 0:
        ans+=X[i]
    else:
        ans+=(X[i]//10)*10+10
        W.append(X[i]%10)

ans +=-10+min(W)
print(ans)
Problem p03351 (python)

Fixed submission:
a, b, c, d = [int(x) for x in input().split()]

if (abs((a - b)) <= d) and (abs((c - b)) <= d) or abs(c-a) <=d :
    print('Yes')
else:
    print('No')

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

ans_list = [1]

for i in range(2,x+1):
    cnt = 2
    while True:
        tmp = i ** cnt
        if tmp > x:
            break
        ans_list += [tmp]
        cnt += 1
        
    
ans_list.sort()

for i in ans_list[::-1]:
    if i <= x:
        print(i)
        break
Problem p03998 (python)

Fixed submission:
SA = input()
SB = input()
SC = input()

card = SA[0]

SA_CNT = 1
SB_CNT = 0
SC_CNT = 0


while True:
    if card == 'a':
        if SA_CNT < len (SA):
            card = SA[SA_CNT]
            SA_CNT += 1
        else:
            print('A')
            break
    if card == 'b':
        if SB_CNT < len (SB):
            card = SB[SB_CNT]
            SB_CNT += 1
        else:
            print('B')
            break
    if card == 'c':
        if SC_CNT < len (SC):
            card = SC[SC_CNT]
            SC_CNT += 1
        else:
            print('C')
            break

Buggy submission (verdict: Runtime Error):
SA = input()
SB = input()
SC = input()

WIN = [0, 0, 0]



card = SA[0]

SA_CNT = 1
SB_CNT = 0
SC_CNT = 0

while True:
    if card == 'a':
        SA_CNT += 1
        if SA_CNT == len (SA):
            print('A')
            break
        else:
            card = SA[SA_CNT]
    if card == 'b':
        SB_CNT += 1
        if SB_CNT == len(SB):
            print('B')
            break
        else:
            card = SB[SB_CNT]
    if card == 'c':
        SC_CNT += 1
        if SC_CNT == len (SC):
            print('C')
            break
        else:
            card = SC[SC_CNT]

Buggy submission (verdict: Runtime Error):
SA = input()
SB = input()
SC = input()

WIN = [0, 0, 0]



card = SA[0]

SA_CNT = 1
SB_CNT = 0
SC_CNT = 0

while True:
    if card == 'a':
        SA_CNT += 1
        if SA_CNT == len (SA):
            print('A')
            break
        else:
            card = SA[SA_CNT]
    if card == 'b':
        SB_CNT += 1
        if SB_CNT == len(SB):
            print('B')
            break
        else:
            card = SB[SA_CNT]
    if card == 'c':
        SC_CNT += 1
        if SC_CNT == len (SC):
            print('C')
            break
        else:
            card = SC[SA_CNT]
Problem p02717 (python)

Fixed submission:
a, b, c = map(int, input().split())
hoge = a 
a = b
b = hoge
hoge = a
a = c
c = hoge

print(a,b,c)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
t = n%k
print(min(t,abs(k-t)))

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

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

t = n%k
if t > k-t:
  print(k-t)
else:
  print(t)
Problem p02823 (python)

Fixed submission:
x,y,z = map(int, input().split())
if (z+y)%2==1:
        d = min(y + z - 2, 2*x-y-z)+1
        print(d//2)
else:
	print((abs(y-z)+1)//2)

Buggy submission (verdict: Runtime Error):
x,y,z = map(int, input().split())
if (z+y)%2==1:
  	d = min(y + z - 2, 2*x-y-z)+1; 
	print(d//2)
else:
	print((abs(y-z)+1)//2)

Buggy submission (verdict: Runtime Error):
x,y,z = map(int, input().split())
if (z+y)%2==1:
	print(min(max(y,z)-1, max(x-y,x-z))
else:
	print((abs(y-z)+1)//2)
Problem p02641 (python)

Fixed submission:
x,n=map(int,input().split())
if n!=0:
  p=list(map(int,input().split()))
else:
  p=[]
ans=0
if x in p:
  low=x
  high=x
  while True:
    low-=1
    high+=1
    if low in p:
      if high in p:
        continue
      else:
        ans=high
        break
    else:
      ans=low
      break
  print(ans)
else:
  print(x)

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
if n==0:
  print(x)
else:
  p=list(map(int,input().split()))
  c=[0]*100
  for i in p:
    c[i]=1
  if max(p)<x:
    print(x)
  elif min(p)>x:
    print(x)
  else:
    i=0
    while True:
      if p.count(x-i)==0:
        print(x-i)
        break
      elif p.count(x+i)==0:
        print(x+i)
        break
      else:
        i+=1

Buggy submission (verdict: Runtime Error):
x,n=map(int,input().split())
if n!=0:
  p=list(map(int,input().split()))
  c=[0]*100
  for i in p:
    c[i-1]+=1
  ans=0
  while True:
    if c[x-ans-1]==0:
      ans=x-ans
      break
    elif c[x+ans-1]==0:
      ans=x+ans
      break
    else:
      ans+=1
  print(ans)
else:
  print(x)
Problem p02687 (python)

Fixed submission:
s=input()
if s=="ABC":
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
s=input()
if s="ABC":
  print("ARC")
else:
  print("ABC")
Problem p02690 (python)

Fixed submission:
x=int(input())
for i in range(-1000,1000):
  for j in range(-1000,1000):
    if i**5-j**5==x:
      print(i,j)
      break
  else:
    continue
  break

Buggy submission (verdict: Runtime Error):
import math
x=int(input())
for i in range(10**5):
  b=(x-i**5)**(1/5)
  if b==math.floor(b) and b==math.ceil(b):
    print(i,int(b))
    break

Buggy submission (verdict: Runtime Error):
import math
x=int(input())
for i in range(10**2):
  b=(x-i**5)**(1/5)
  if b==math.floor(b) and b==math.ceil(b):
    print(i,int(b))
    break
Problem p02696 (python)

Fixed submission:
a,b,n=map(int,input().split())
if n<b:
  print(a*n//b)
else:
  if n==b:
    print(a*(n-1)//b)
  else:
    i=n//b
    print(max((a*n//b-a*i),(a*(b*i-1)//b-a*(i-1))))

Buggy submission (verdict: Runtime Error):
a,b,n=map(int,input().split())
maxf=0
if n>b:
  i=n//b
  maxf=max((a*n)//b-a*(n//b)),((a*(b*i-1))//(b-a*(b*i-1)//b))
  print(maxf)
else:
  print((a*n)//b-a*(n//b))
Problem p02743 (python)

Fixed submission:
a,b,c=map(int,input().split())
if c-a-b<0:
  print("No")
elif 4*a*b<(c-a-b)**2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
if 4a*b<(c*c-2*c*(a+b)+(a+b)*(a+b)):
  print("Yes")
else:
  print("No")
Problem p02756 (python)

Fixed submission:
from collections import deque
S=deque(input())
Q=int(input())
T=[]
m=0
for i in range(Q):
  T.append(input().split())
for i in range(Q):
  if T[i][0]=="1":
    if len(S)>1:
      if m==0:
        m=1
      else:
        m=0
        
  else:
    if T[i][1]=="1":
      if m==0:
        S.appendleft(T[i][2])
      else:
        S.append(T[i][2])
   
    else:
      if m==0:
        S.append(T[i][2])
      else:
        S.appendleft(T[i][2])
if m==0:
  print("".join(S))
else:
  S.reverse()
  print("".join(S))

Buggy submission (verdict: Runtime Error):
S=list(input())
Q=int(input())
T=[]
for i in range(Q):
  T.append(input().split())
for i in range(Q-1):
  if T[i][0]=="1" and T[i+1][0]=="1":
    T.pop(i)
    T.pop(i)
for i in range(len(T)):
  if T[i][0]=="1":
    S.reverse()
  else:
    if T[i][1]=="1":
      S.insert(0,T[i][2])
    else:
      S.append(T[i][2])
print("".join(S))
Problem p02783 (python)

Fixed submission:
H,A=map(int,input().split())
count=0
while H>0:
  H=H-A
  count=count+1
print(count)

Buggy submission (verdict: Runtime Error):
H,N=map(int,input().split())
A=list(map(int,input().split()))
Max_A=0
for i in range(len(A)):
  Max_A=Max_A+A[i]
if Max_A>=H:
  print("YES")
else:
  print("NO")
Problem p02811 (python)

Fixed submission:
K,X=map(int,input().split())
if 500*K>=X:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
S=input()
count=0
for i in range(N-2):
  if S[i]=='A' and S[i+1]=='B' and S[i+2]=='C':
    count=count+1
print(count)