Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

# coding: utf-8

# In[28]:

import sys
#input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))


# In[21]:

#import numpy as np
#A.sort(key=lambda x:abs(x))
#print(N, A)


# In[25]:

#A = np.array(A)
#print(sum(A<0))
#if sum(A<0)%2 == 0:
#    print(sum(abs(A)))
#else:
#    print(sum(abs(A[1:])) - abs(A[0]))


# In[29]:

B = list(map(abs, A))
C = [a for a in A if a < 0]
#print(A)
#print(B)
#print(C)


# In[30]:

if len(C)%2 ==0:
    print(sum(B))
else:
    print(sum(B) - min(B)*2)


# In[ ]:





Fixed submission:

# coding: utf-8

# In[ ]:

A, B, T = map(int, input().split())


# In[ ]:

#A, B, T = 3, 5, 7


# In[ ]:

print(T//A*B)

Buggy python submission (verdict: Runtime Error):

# coding: utf-8

# In[1]:

import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))


# In[2]:

#import copy
#import numpy as np
try:
    from fractions import gcd
except:
    from math import gcd


# In[ ]:

# 左からn個の最大公約数を求める O(n)
# 右からn個の最大公約数を求める O(n)
# n個目を抜いた最大公約数は n-1個目までの公約数とn+1個目からの公約数との公約数


# In[3]:

lg = [1]*(N)
rg = [1]*(N)
ans = 0


# In[4]:

#print(lg)
#print(rg)
#print(A)


# In[ ]:

lg[0] = A[1]
rg[0] = A[N-2]
lg[1] = A[0]
rg[1] = A[N-1]
#print(lg, rg)
for i in range(1, N-1):
    #print(i)
    lg[i+1] = gcd(lg[i], A[i])
    #print(lg[i], A[i])
    rg[i+1] = gcd(rg[i], A[N-1-i])
    #print(rg[N-1-i], A[N-1-i])
#print(lg, rg)

ans = [0]*N
ans = [gcd(lg[i], rg[N-1-i]) for i in range(N)]
#for i in range(N):
    #print(i, lg[i], rg[N-i-1])
    #ans = gcd(lg[i], rg[N-i-1])
print(max(ans))


# In[6]:

#print(ans)



Fixed submission:

# coding: utf-8

# In[ ]:

A, B, T = map(int, input().split())


# In[ ]:

#A, B, T = 3, 5, 7


# In[ ]:

print(T//A*B)

Buggy python submission (verdict: Runtime Error):

# coding: utf-8

# In[1]:

N = int(input())
A = list(map(int, input().split()))


# In[2]:

import copy
import numpy as np


# In[3]:

try:
    from math import gcd as ogcd
except:
    from fractions import gcd as ogcd
from functools import reduce

def gcd(*numbers):
    return reduce(ogcd, numbers)


# In[4]:

gcd_list = []
for i in range(N):
    Ac = copy.copy(A)
    Ac.pop(i)
    #print(Ac)
    gcd_list.append(gcd(*Ac))


# In[5]:

print(np.max(np.array(gcd_list)))


# In[ ]:





Fixed submission:

# coding: utf-8

# In[ ]:

A, B, T = map(int, input().split())


# In[ ]:

#A, B, T = 3, 5, 7


# In[ ]:

print(T//A*B)

Buggy python submission (verdict: Runtime Error):

# coding: utf-8

# In[ ]:

N = int(input())
V = map(int, input().split())
C = map(int, input().split())


# In[ ]:

import numpy as np


# In[ ]:

V = np.array(V)
C = np.array(C)


# In[ ]:

bene = V-C
print(np.sum(bene[bene>0]))



Fixed submission:

# coding: utf-8

# In[ ]:

A, B, T = map(int, input().split())


# In[ ]:

#A, B, T = 3, 5, 7


# In[ ]:

print(T//A*B)
Buggy python submission (verdict: Runtime Error):

# coding: utf-8

# In[ ]:

N = int(input())
V = map(int, input().split())
C = map(int, input().split())


# In[ ]:

import numpy as np


# In[ ]:

V = np.array(V)
C = np.array(C)


# In[ ]:

bene = V-C
print(np.sum(bene[bene>0]))



Fixed submission:

# coding: utf-8

# In[1]:

N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))


# In[2]:

import numpy as np


# In[3]:

V = np.array(V)
C = np.array(C)


# In[4]:

bene = V-C
print(np.sum(bene[bene>0]))


# In[ ]:

Buggy python submission (verdict: Runtime Error):

# coding: utf-8

# In[ ]:

N = int(input())
V = map(int, input().split())
C = map(int, input().split())


# In[ ]:

import numpy as np


# In[ ]:

bene = V-C
print(np.sum(bene[bene>0]))



Fixed submission:

# coding: utf-8

# In[1]:

N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))


# In[2]:

import numpy as np


# In[3]:

V = np.array(V)
C = np.array(C)


# In[4]:

bene = V-C
print(np.sum(bene[bene>0]))


# In[ ]:
Buggy python submission (verdict: Runtime Error):
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        
        String w1=sc.nextLine();
        String w2=sc.nextLine();
        for(int i=0;i<3;i++){
            if(w1.charAt(i)!=w2.charAt(2-i)){
                System.out.println("NO");
                break;
            }
            if(i==2)System.out.println("YES");
        }
    }
}


Fixed submission:
a=input()
b=input()
if a==b[::-1]:print("YES")
else:print("NO")
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a > 8 || b > 8:
 print(':(')
else:
 print('Yay!')

Fixed submission:
a,b = map(int,input().split())
if a > 8 or b > 8:
 print(':(')
else:
 print('Yay!')

Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a > 8 || b > 8:
 print(':(")
else:
 print('Yay!')

Fixed submission:
a,b = map(int,input().split())
if a > 8 or b > 8:
 print(':(')
else:
 print('Yay!')
Buggy python submission (verdict: Runtime Error):
 input()
if N[-1] in '24579'
    print('hon')
elif N[-1] in '0168':
    print('pon')
else:
    print('bon')

Fixed submission:
n = input()
if n[-1] in '24579':
    print('hon')
elif n[-1] in '0168':
    print('pon')
else:
    print('bon')

Buggy python submission (verdict: Runtime Error):
N = input()
if N[-1] in '24579'
    print('hon')
elif N[-1] in  "0168":
    print('pon')
else:
    print('bon')

Fixed submission:
n = input()
if n[-1] in '24579':
    print('hon')
elif n[-1] in '0168':
    print('pon')
else:
    print('bon')

Buggy python submission (verdict: Runtime Error):
N = input()
if N[-1] in '3'
    print('bon')
elif N[-1] in  "0168":
    print('pon')
else:
    print('hon')

Fixed submission:
n = input()
if n[-1] in '24579':
    print('hon')
elif n[-1] in '0168':
    print('pon')
else:
    print('bon')

Buggy python submission (verdict: Runtime Error):
N = input()
if N % 3 == "3":
    print('bon')
elif N % 3 == "0" or "1" or "6" or "8":
    print('pon')
else:
    print('hon')

Fixed submission:
n = input()
if n[-1] in '24579':
    print('hon')
elif n[-1] in '0168':
    print('pon')
else:
    print('bon')
Buggy python submission (verdict: Runtime Error):
import math
A,B,H,M = int(input().split())
Ad = H * 30 + M * 0.5
Bd = M * 6
difAB = abs(Ad - Bd)
if difAB >=180:
    difAB = 360-difAB
print(math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(difAB))))

Fixed submission:
import math
A,B,H,M = map(int,input().split())
Ad = H * 30 + M * 0.5
Bd = M * 6
difAB = abs(Ad - Bd)
if difAB >=180:
    difAB = 360-difAB
print(math.sqrt(A**2+B**2-2*A*B*math.cos(math.radians(difAB))))
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
if S == D[:len(S)]:
    print('Yes')
else:
    print('No')

Fixed submission:
S = input()
T = input()
if (S == T[:len(S)]) and ((len(S)+1)==len(T)):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
if (S == D[:len(S)]) and ((len(S)+1)==len(D)):
    print('Yes')
else:
    print('No')

Fixed submission:
S = input()
T = input()
if (S == T[:len(S)]) and ((len(S)+1)==len(T)):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
if (S == D[:len(S)]) and (len(S)+1==len(D)):
    print('Yes')
else:
    print('No')

Fixed submission:
S = input()
T = input()
if (S == T[:len(S)]) and ((len(S)+1)==len(T)):
    print('Yes')
else:
    print('No')

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

if (S == D[:len(S)]) and (len(S)==len(D)+1):
    print('Yes')
else:
    print('No')

Fixed submission:
S = input()
T = input()
if (S == T[:len(S)]) and ((len(S)+1)==len(T)):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n%i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    return sorted(divisors) 
n = int(input())
ans = len(divisors(n-1))-1;
for k in divisors(N)[1:]:
    boz = n
    while (n % k == 0):
        n = n//k
    if (n % k == 1):
	    ans += 1
    n = boz
print(ans)

Fixed submission:
def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n%i == 0:
            divisors.append(i)
            if i != n//i:
                divisors.append(n//i)
    return sorted(divisors) 
n = int(input())
ans = len(divisors(n-1))-1;
for k in divisors(n)[1:]:
    boz = n
    while (n % k == 0):
        n = n//k
    if (n % k == 1):
	    ans += 1
    n = boz
print(ans)
Buggy python submission (verdict: Runtime Error):
a = input();
cnt = 0;
if(a == a[::-1]):
	cnt+=1
n = len(a)
if(a[:(n-1)//2] == a[:(n-1)//2:-1):
    cnt+=1
if(a[(n+3)//2::-1] == a[(n+3)//2:]):
    cnt+=1
if(cnt == 3):
    print("Yes")
else:
   	print("No")

Fixed submission:
a = input();
cnt = 0;
if(a == a[::-1]):
	cnt+=1
n = len(a)
if(a[:(n-1)//2] == a[:(n-1)//2:-1]):
    cnt+=1
if(a[(n+3)//2-1::][::-1] == a[(n+3)//2-1:]):
    cnt+=1
if(cnt == 3):
    print("Yes")
else:
   	print("No")
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = str(a)*b
d = str(b)*a
if(c < d):
  print (c)
else:
  print(d)

Fixed submission:
(a , b) = list (map (int, input().strip().split()))
c = str(a)*b
d = str(b)*a
if(c < d):
  print (c)
else:
  print(d)
Buggy python submission (verdict: Runtime Error):
a, b = list(map(int, input().split(' ')))
print(b*pow(b-1, a-1))



Fixed submission:
import numpy as np
array = list(map(int, input().split(' ')))
print(len(np.unique(array)))
Buggy python submission (verdict: Time Limit Exceeded):
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if v<w:
  print("NO")
  exit()
diff=abs(a-b)
for _ in range(t):
  diff=diff-v+w
  if diff<=0:
    print("YES")
    exit()
print("NO")

Fixed submission:
a,v=map(int,input().split())
b,w=map(int,input().split())
t=int(input())
if v<w:
  print("NO")
  exit()
diff=abs(a-b)
for _ in range(t):
  diff=diff-v+w
  if diff<=0:
    print("YES")
    exit()
print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import accumulate

N,K=map(int,input().split())
A=list(map(int,input().split()))

def calc_imos(arr):
  imos=[0]*(N+1)
  for i,a in enumerate(arr):
    l=max(0,i-a) #照らす範囲の左側インデックス、0が最小
    r=min(N-1,i+a) #照らす範囲右側インデックス,arrの長さ-1=Nが最大
    imos[l]+=1
    imos[r+1]-=1
    #print("imos",imos)
  imos=list(accumulate(imos))
  #print("imos",imos)
  return imos[:-1]

for k in range(min(50,K)):
  A=calc_imos(A)
print(*A,sep=" ")

Fixed submission:
from itertools import accumulate

N,K=map(int,input().split())
A=list(map(int,input().split()))

def calc_imos(arr):
  imos=[0]*(N+1)
  for i,a in enumerate(arr):
    l=max(0,i-a) #照らす範囲の左側インデックス、0が最小
    r=min(N-1,i+a) #照らす範囲右側インデックス,arrの長さ-1=Nが最大
    imos[l]+=1
    imos[r+1]-=1
  imos=list(accumulate(imos))
  return imos[:-1]

for k in range(min(50,K)):
  A=calc_imos(A)
print(*A,sep=" ")
Buggy python submission (verdict: Time Limit Exceeded):
def main():
  n,k=map(int,input().split())
  h=list(map(int,input().split()))
  dp=[0]*n
  for i in range(1,n):
    dp[i]=dp[i-1]+abs(h[i-1]-h[i])
    for j in range(1,k+1):
      if i-j<0:
        break
      dp[i]=min(dp[i],dp[i-j]+abs(h[i-j]-h[i]))
      #print("i",i,"j",j,dp)
  print(dp[-1])

main()

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
  dp[i]=dp[i-1]+abs(h[i-1]-h[i])
  for j in range(1,k+1):
    if i-j<0:
      break
    dp[i]=min(dp[i],dp[i-j]+abs(h[i-j]-h[i]))
    #print("i",i,"j",j,dp)
print(dp[-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
  dp[i]=dp[i-1]+abs(h[i-1]-h[i])
  for j in range(1,k+1):
    if i-j<0:
      break
    dp[i]=min(dp[i],dp[i-j]+abs(h[i-j]-h[i]))
    #print("i",i,"j",j,dp)
print(dp[-1])

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
  dp[i]=dp[i-1]+abs(h[i-1]-h[i])
  for j in range(1,k+1):
    if i-j<0:
      break
    dp[i]=min(dp[i],dp[i-j]+abs(h[i-j]-h[i]))
    #print("i",i,"j",j,dp)
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
n=int(input())
a,b,c=[],[],[]
for _ in range(n):
  A,B,C=map(int,input().split())
  a.append(A)
  b.append(B)
  c.append(C)
#print(a,b,c)
dp=[[[0] for _ in range(3)] for _ in range(n)]
dp[0][0]=a[0]
dp[0][1]=b[0]
dp[0][2]=c[0]
#print(dp)
for i in range(1,n):
  dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i])
  #print("dp[i][0]",dp[i][0],"dp[i-1][1]",dp[i-1][1],"dp[i-1][2]",dp[i-1][2],"a[i]",a[i])
  dp[i][1]=max(dp[i-1][0]+b[i],dp[i-1][2]+b[i])
  #print("dp[i][1]",dp[i][1],"dp[i-1][0]",dp[i-1][0],"dp[i-1][2]",dp[i-1][2],"b[i]",b[i])
  dp[i][2]=max(dp[i-1][0]+c[i],dp[i-1][1]+c[i])
  #print("dp[i][2]",dp[i][2],"dp[i-1][0]",dp[i-1][0],"dp[i-1][1]",dp[i-1][1],"c[i]",c[i])
  #print(i,dp)
print(max(dp[-1][0],dp[-1][1],dp[-1][2])



Fixed submission:
n=int(input())
a,b,c=[],[],[]
for _ in range(n):
  A,B,C=map(int,input().split())
  a.append(A)
  b.append(B)
  c.append(C)
#print(a,b,c)
dp=[[[0] for _ in range(3)] for _ in range(n)]
dp[0][0]=a[0]
dp[0][1]=b[0]
dp[0][2]=c[0]
#print(dp)
for i in range(1,n):
  dp[i][0]=max(dp[i-1][1]+a[i],dp[i-1][2]+a[i])
  #print("dp[i][0]",dp[i][0],"dp[i-1][1]",dp[i-1][1],"dp[i-1][2]",dp[i-1][2],"a[i]",a[i])
  dp[i][1]=max(dp[i-1][0]+b[i],dp[i-1][2]+b[i])
  #print("dp[i][1]",dp[i][1],"dp[i-1][0]",dp[i-1][0],"dp[i-1][2]",dp[i-1][2],"b[i]",b[i])
  dp[i][2]=max(dp[i-1][0]+c[i],dp[i-1][1]+c[i])
  #print("dp[i][2]",dp[i][2],"dp[i-1][0]",dp[i-1][0],"dp[i-1][1]",dp[i-1][1],"c[i]",c[i])
  #print(i,dp)
#print(dp)
print(max(dp[-1][0],dp[-1][1],dp[-1][2]))
Buggy python submission (verdict: Time Limit Exceeded):
import math
N,W=map(int,input().split())
dp=[[math.inf for _ in range(100001)] for _ in range(N+1)]
#print(dp[-1][100000])
dp[0][0]=0
def min_(a,b):
  if a<b:
    return a
  else:
    return b
def nap():
  for i in range(N):
    w,v=map(int,input().split())
    for j in range(100001):
      if j-v>=0:
        #print(dp[i-1][j-w[i]])
        dp[i+1][j]=min_(dp[i+1][j],dp[i][j-v]+w)
      dp[i+1][j]=min_(dp[i+1][j],dp[i][j])
  ans=100000
  #print(dp[0][:4])
  while dp[-1][ans]>W:
    ans-=1
  print(ans)

nap()

Fixed submission:
import math
N,W=map(int,input().split())
dp=[[math.inf for _ in range(100001)] for _ in range(N+1)]
#print(dp[-1][100000])
dp[0][0]=0
def min_(a,b):
  if a<b:
    return a
  else:
    return b
  
def nap():
  for i in range(N):
    w,v=map(int,input().split())
    for j in range(100001):
      if j-v>=0:
        #print(dp[i-1][j-w[i]])
        dp[i+1][j]=min(dp[i+1][j],dp[i][j-v]+w)
      dp[i+1][j]=min(dp[i+1][j],dp[i][j])
  ans=100000
  #print(dp[0][:4])
  while dp[-1][ans]>W:
    ans-=1
  print(ans)

nap()

Buggy python submission (verdict: Time Limit Exceeded):
import math
N,W=map(int,input().split())
dp=[[math.inf for _ in range(100001)] for _ in range(N+1)]
#print(dp[-1][100000])
dp[0][0]=0

def nap():
  for i in range(N):
    w,v=map(int,input().split())
    for j in range(100001):
      if j-v>=0:
        #print(dp[i-1][j-w[i]])
        dp[i+1][j]=min(dp[i+1][j],dp[i][j-v]+w)
      dp[i+1][j]=min(dp[i+1][j],dp[i][j])
  ans=100000
  #print(dp[0][:4])
  while dp[-1][ans]>W:
    ans-=1
  print(ans)

nap()

Fixed submission:
import math
N,W=map(int,input().split())
dp=[[math.inf for _ in range(100001)] for _ in range(N+1)]
#print(dp[-1][100000])
dp[0][0]=0
def min_(a,b):
  if a<b:
    return a
  else:
    return b
  
def nap():
  for i in range(N):
    w,v=map(int,input().split())
    for j in range(100001):
      if j-v>=0:
        #print(dp[i-1][j-w[i]])
        dp[i+1][j]=min(dp[i+1][j],dp[i][j-v]+w)
      dp[i+1][j]=min(dp[i+1][j],dp[i][j])
  ans=100000
  #print(dp[0][:4])
  while dp[-1][ans]>W:
    ans-=1
  print(ans)

nap()

Buggy python submission (verdict: Time Limit Exceeded):
import math
N,W=map(int,input().split())
dp=[[math.inf for _ in range(100001)] for _ in range(N+1)]
#print(dp[-1][100000])
dp[0][0]=0
for i in range(N):
  w,v=map(int,input().split())
  for j in range(100001):
    if j-v>=0:
      #print(dp[i-1][j-w[i]])
      dp[i+1][j]=min(dp[i+1][j],dp[i][j-v]+w)
    dp[i+1][j]=min(dp[i+1][j],dp[i][j])
ans=100000
#print(dp[0][:4])
while dp[-1][ans]>W:
  ans-=1
print(ans)

Fixed submission:
import math
N,W=map(int,input().split())
dp=[[math.inf for _ in range(100001)] for _ in range(N+1)]
#print(dp[-1][100000])
dp[0][0]=0
def min_(a,b):
  if a<b:
    return a
  else:
    return b
  
def nap():
  for i in range(N):
    w,v=map(int,input().split())
    for j in range(100001):
      if j-v>=0:
        #print(dp[i-1][j-w[i]])
        dp[i+1][j]=min(dp[i+1][j],dp[i][j-v]+w)
      dp[i+1][j]=min(dp[i+1][j],dp[i][j])
  ans=100000
  #print(dp[0][:4])
  while dp[-1][ans]>W:
    ans-=1
  print(ans)

nap()
Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
count=0

if k*3==s:
  print(1)
  exit()

for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if x+y+z==s:
        count+=1
print(count)

Fixed submission:
k,s=map(int,input().split())
count=0

if k*3==s:
  print(1)
  exit()

for x in range(k+1):
  for y in range(k+1):
    z=s-x-y
    if z>=0 and z<=k:
      count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k,s=map(int,input().split())
count=0
for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if x+y+z==s:
        count+=1
print(count)

Fixed submission:
k,s=map(int,input().split())
count=0

if k*3==s:
  print(1)
  exit()

for x in range(k+1):
  for y in range(k+1):
    z=s-x-y
    if z>=0 and z<=k:
      count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
a=input()
#str = list(a)
print(str[0:2])

Fixed submission:
a=input()
#str = list(a)
print(a[:3])
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=a[-1]
if b==3:
  print("bon")
elif b==2 or b==4 or b==5 or b==7 or b==9:
  print("hon")
else:
  print("pon")

Fixed submission:
a=int(input())
b = a % 10
if b==3:
  print("bon")
elif b==2 or b==4 or b==5 or b==7 or b==9:
  print("hon")
else:
  print("pon")

Buggy python submission (verdict: Runtime Error):
a = int(input())
b=a[-1]
if b=='3':
  print('bon')
elif b=='2' or b=='4' or b=='5' or b=='7'or b=='9':
  print('hon')
else:
  print('pon')

Fixed submission:
a=int(input())
b = a % 10
if b==3:
  print("bon")
elif b==2 or b==4 or b==5 or b==7 or b==9:
  print("hon")
else:
  print("pon")

Buggy python submission (verdict: Runtime Error):
a=int(input())
b=a[-1]
if b==3:
  print('bon')
elif b==2 or b==4 or b==5 or b==7 or b==9:
  print('hon')
else:
  print('pon')

Fixed submission:
a=int(input())
b = a % 10
if b==3:
  print("bon")
elif b==2 or b==4 or b==5 or b==7 or b==9:
  print("hon")
else:
  print("pon")

Buggy python submission (verdict: Runtime Error):
a=int(input())
a=a[-1]
if a==3:
  print('bon')
elif a==2 or a==4 or a==5 or a==7 or a==9:
  print('hon')
else:
  print('pon')

Fixed submission:
a=int(input())
b = a % 10
if b==3:
  print("bon")
elif b==2 or b==4 or b==5 or b==7 or b==9:
  print("hon")
else:
  print("pon")

Buggy python submission (verdict: Runtime Error):
a=int(input())
a=a[-1]
if a=3:
  print('bon')
elif a=2 or a=4 or a=5 or a=7 or a=9:
  print('hon')
else:
  print('pon')

Fixed submission:
a=int(input())
b = a % 10
if b==3:
  print("bon")
elif b==2 or b==4 or b==5 or b==7 or b==9:
  print("hon")
else:
  print("pon")
Buggy python submission (verdict: Runtime Error):
##======================================python3
''' ===========================================
## null
##
##
=========================================== '''
import sys
from sys import stdin #read(), readline()
input = stdin.readline
import heapq #heappush(trgt, val) heappop(trgt) trgt[0] __lt__<
sys.setrecursionlimit(10**6)
INF = 1<<50

if __name__ == '__main__':
    n = int(input())
    
    chk = True;
    
    iip = list(map(int, input().split(' ')))
    for i in range(n):
        a = iip[i]
        if a&1 == 0:
            if a%3 == 0 or a%5 == 0:
                continue;
            else:
                chk = False;
                break;
        else:
            continue;
    
    if chk == True:
        print("APPROVED")
    else:
        print(DENIED)
    

Fixed submission:
##======================================python3
''' ===========================================
## null
##
##
=========================================== '''
import sys
from sys import stdin #read(), readline()
input = stdin.readline
import heapq #heappush(trgt, val) heappop(trgt) trgt[0] __lt__<
sys.setrecursionlimit(10**6)
INF = 1<<50

if __name__ == '__main__':
    n = int(input())
    
    chk = True;
    
    iip = list(map(int, input().split(' ')))
    for i in range(n):
        a = iip[i]
        if a&1 == 0:
            if a%3 == 0 or a%5 == 0:
                continue;
            else:
                chk = False;
                break;
        else:
            continue;
    
    if chk == True:
        print("APPROVED")
    else:
        print("DENIED")
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
for _ in range(q):
    t=list(map(str,input().split()))
    if int(t[0])==1:
        s=s[::-1]
        #print(s)
    if int(t[0])==2:
        f=int(t[1])
        if f==1:
            p=t[2]
            s=p+s
            #print(s)
        if f==2:
            z=t[2]
            s=s+z
            #print(s)
print(s)

Fixed submission:
s=input()
q=int(input())
cn=0
l1=""
l2=""
for i in range(q):
    p=input()
    if p=="1":
        cn+=1
    else:
        _,f,c=p.split()
        if f=="1":
            if cn%2==0:
                l1+=c
            else:
                l2+=c
        else:
            if cn%2==1:
                l1+=c
            else:
                l2+=c
if cn%2==1:
    s=s[::-1]
    l1,l2=l2,l1
print(l1[::-1]+s+l2)
Buggy python submission (verdict: Runtime Error):
print(S[0:3])

Fixed submission:
S = input()
print(S[0:3])

Buggy python submission (verdict: Runtime Error):
print(S[0:4])

Fixed submission:
S = input()
print(S[0:3])
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n, k = list(map(int, input().split()))
    a = list(map(int, input().split()))

    if n <= k:
        print(0)
    elif k > int((n - 1) /2):
        sum_ = sum(a)
        for i in range(n - k):
            a.remove(min(a))
        print(sum_ - sum(a))
    else:
        for i in range(k):
            a.remove(max(a))

        print(sum(a))


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n, k = list(map(int, input().split()))
    h = list(map(int, input().split()))
    h = sorted(h, reverse=True)

    if n <= k:
        print(0)
    else:
        print(sum(h[k:]))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n, k = list(map(int, input().split()))
    a = list(map(int, input().split()))

    if n <= k:
        print(0)
    else:
        for i in range(k):
            a.remove(max(a))

        print(sum(a))


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    n, k = list(map(int, input().split()))
    h = list(map(int, input().split()))
    h = sorted(h, reverse=True)

    if n <= k:
        print(0)
    else:
        print(sum(h[k:]))


if __name__ == '__main__':
    main()