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

Fixed submission:
import sys
sys.setrecursionlimit(sys.getrecursionlimit()*1000)
n = int(input())
g = [[] for _ in range(n+1)]
for _ in range(n-1):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)
a = []
def f(i, p):
    a.append(i)
    if i == n:
        return True
    for j in g[i]:
        if j != p:
            if f(j, i):
                return True
    a.pop()
f(1,0)
m = (len(a)+1) // 2
def h(i, j, p):
    if i == j:
        return 1
    return 1 + sum(h(k, j, i) for k in g[i] if k != p)
if h(1, a[m], 0) > h(n, a[m-1], 0):
    print("Fennec")
else:
    print("Snuke")

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(sys.getrecursionlimit()*100)
n = int(input())
g = [[] for _ in range(n+1)]
for _ in range(n-1):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)
a = []
def f(i, p):
    a.append(i)
    if i == n:
        return True
    for j in g[i]:
        if j != p:
            if f(j, i):
                return True
    a.pop()
f(1,0)
m = (len(a)+1) // 2
def h(i, j, p):
    if i == j:
        return 1
    return 1 + sum(h(k, j, i) for k in g[i] if k != p)
if h(1, a[m], 0) > h(n, a[m-1], 0):
    print("Fennec")
else:
    print("Snuke")

Buggy submission (verdict: Runtime Error):
n = int(input())
g = [[] for _ in range(n+1)]
for _ in range(n-1):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)
a = []
def f(i, p):
    a.append(i)
    if i == n:
        return True
    for j in g[i]:
        if j != p:
            if f(j, i):
                return True
    a.pop()
f(1,0)
m = (len(a)+1) // 2
def h(i, j, p):
    if i == j:
        return 1
    return 1 + sum(h(k, j, i) for k in g[i] if k != p)
if h(1, a[m], 0) > h(n, a[m-1], 0):
    print("Fennec")
else:
    print("Snuke")
Problem p02936 (python)

Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[17]:


from sys import stdin
input = stdin.readline

N, Q = map(int, input().split())


# In[18]:


class Node:
    def __init__(self, nb, data): #コンストラクタ
        self.nb = nb
        self.data = data #ノードがもつ数値
        self.parent = -1 # nodeがrootのとき-1、それ以外番号
        #self.childs = [] # childになるnode classが入る
        
    #def connect_childs(self, child_class_):
    #    self.childs.append(child_class_)


# In[19]:


nodes = [Node(_+1, 0) for _ in range(N)]


# In[12]:


for i in range(N-1):
    a, b = map(int, input().split())
    #nodes[a-1].connect_childs(nodes[b-1])
    nodes[b-1].parent = a-1


# In[13]:


for i in range(Q):
    p, x = map(int, input().split())
    nodes[p-1].data += x


# In[14]:


def sum_data_to_childs(nodes):
    datas = [0]*N
    
    datas[0] = nodes[0].data
    
    for i in range(1, N):
        nodes[i].data += nodes[nodes[i].parent].data
        #print(nodes[i].data)
        datas[i] = nodes[i].data
        
    return datas


# In[15]:


datas = sum_data_to_childs(nodes)


# In[16]:


print(' '.join(map(str, datas)))


# In[20]:


#datas = [0] * N


# In[21]:


#child = [[]] * N


# In[22]:


#print(child)


# In[ ]:

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# coding: utf-8

# In[1]:


from sys import stdin
input = stdin.readline
N, Q = map(int, input().split())
abs_ = [list(map(int, input().split())) for _ in range(N-1)]
pxs_ = [list(map(int, input().split())) for _ in range(Q)]


# In[13]:


class Node:
    def __init__(self, nb, data): #コンストラクタ
        self.nb = nb
        self.data = data #ノードがもつ数値
        #self.parent = -1 # nodeがrootのとき-1、それ以外番号
        self.childs = [] # childになるnode classが入る
        
    def connect_childs(self, child_class_):
        self.childs.append(child_class_)


# In[44]:


nodes = [Node(_+1, 0) for _ in range(N)]


# In[45]:


for i in range(N-1):
    a, b = abs_[i]
    nodes[a-1].connect_childs(nodes[b-1])
    nodes[b-1].parent = a-1


# In[46]:


for i in range(Q):
    p, x = pxs_[i]
    nodes[p-1].data += x


# In[47]:


def sum_data_to_childs(node):
    data = node.data
    for child in node.childs:
        child.data += data
        sum_data_to_childs(child)


# In[48]:


sum_data_to_childs(nodes[0])


# In[49]:


datas = [str(nodes[_].data) for _ in range(N)]
print(' '.join(datas))


# In[ ]:
Problem p03035 (python)

Fixed submission:
#!/usr/bin/env python
# coding: utf-8

# In[6]:


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


# In[7]:


if A <=5:
    print(0)
elif A <= 12:
    print(int(B/2))
else:
    print(B)


# In[ ]:

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# coding: utf-8

# In[1]:


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


# In[ ]:


if A <=5:
    print(0)
el
Problem p03047 (python)

Fixed submission:

# coding: utf-8

# In[ ]:

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


# In[ ]:

print(N-K+1)

Buggy submission (verdict: Runtime Error):

# coding: utf-8

# In[1]:

import sys
import math
#input = sys.stdin.readline
N = int(input())


# In[5]:

sum_ = 0
#print(math.sqrt(N))
#print(int(math.sqrt(N)))
for i in range(1, int(math.sqrt(N+0.5))+1):
    if N%i == 0:
        #print(i)
        #print(N/i-1)
        sum_ += N/i-1
print(int(sum_))


# In[ ]:
Problem p03050 (python)

Fixed submission:

# coding: utf-8

# In[10]:

import sys
#import math
#input = sys.stdin.readline
N = int(input())


# In[13]:

sum_ = 0
#print(math.sqrt(N))
#print(int(math.sqrt(N)))
#print(int(N**0.5))
rn = N**0.5
if rn%1 == 0:
    rn -= 1
for i in range(1, int(rn)+1):
    if N%i == 0 and i < N//i-1:
        #print(i)
        #print(N/i-1)
        sum_ += N/i-1
print(int(sum_))


# In[ ]:

Buggy submission (verdict: Runtime Error):

# coding: utf-8

# In[1]:

import sys
#input = sys.stdin.readline
N = int(input())


# In[3]:

import numpy as np


# In[9]:

a = np.arange(1, N//2)
nN = np.ones(N//2-1)*N
print(np.sum((nN/a-1)[(nN/a-1)%1==0]))


# In[ ]:

Buggy submission (verdict: Runtime Error):

# coding: utf-8

# In[1]:

import sys
input = sys.stdin.readline
N = int(input())


# In[2]:

import numpy as np


# In[9]:

#sum_ = 0
a = np.arange(1, N//2)
print(np.sum(N/a[(N/a-1)%1==0]-1))
#print(a)
#print(np.sum(a[N//a==N%a]))
#print(a)
#for m in range(1, (N-2)//2):
#    if (N-m)%m==0:
#        print(m)
#        sum_ += (N-m)/m
#print(sum_)


# In[ ]:

Buggy submission (verdict: Runtime Error):

# coding: utf-8

# In[17]:

import sys
#input = sys.stdin.readline
N = int(input())


# In[3]:

import numpy as np


# In[ ]:

sum_ = 0
a = np.arange(1, N)
#print(a)
print(np.sum(a[N//a==N%a]))
#print(a)
#for m in range(1, (N-2)//2):
#    if (N-m)%m==0:
#        print(m)
#        sum_ += (N-m)/m
#print(sum_)


# In[ ]:
Problem p03059 (python)

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 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[ ]:

Buggy 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)

Buggy 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[ ]:

Buggy 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]))
Problem p03060 (python)

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 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]))

Buggy 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]))
Problem p03074 (python)

Fixed submission:

# coding: utf-8

# In[5]:

import sys
#input = sys.stdin.readline
N, K = map(int, input().split())
S = input()


# In[6]:

#print(N, K)
#print(len(S), S)


# In[21]:

tmp = S[0]
sums = [0]*(N+2)
counter = 1
gc = N
nb = 0
for i in range(1, N):
    if S[i] != tmp:
        sums[nb+1] = i
        nb += 1
        counter = 0
        tmp = S[i]
    else:
        gc -= 1
    counter += 1
    if i == N-1:
        sums[nb+1] = i+1

#print(N, gc)
sums = sums[:gc+2]
#print(S)
#print(sums)
#print(gc)
#print(gc-K*2)
pl = [0]*(gc+2)
if gc < K*2:
    print(N)
else:
    if S[0] == "0":
        if S[-1] == "0":
            for i in range(-1, gc-K*2+1, 2):
                #print(i, i+1+K*2, gc)
                j = 0 if i < 0 else i
                l = gc if i+1+K*2>gc else i+1+K*2
                #print(j, l)
                pl[i] = sums[l]-sums[j]
        else:
            for i in range(-1, gc-K*2, 2):
                j = 0 if i < 0 else i
                pl[i] = sums[i+1+K*2]-sums[j]
    else:
        if S[-1] == "0":
            for i in range(0, gc-K*2+1, 2):
                #print(i, i+1+K*2, gc)
                j=i
                l = gc if i+1+K*2>gc else i+1+K*2
                #print(j, l)
                pl[i] = sums[l]-sums[j]
        else:
            for i in range(0, gc-K*2, 2):
                j = i
                pl[i] = sums[i+1+K*2]-sums[j]
    #print(pl)
    print(max(pl))


# In[ ]:

Buggy submission (verdict: Runtime Error):

# coding: utf-8

# In[1]:

import sys
#input = sys.stdin.readline
N, K = map(int, input().split())
S = input()


# In[2]:

#print(N, K)
#print(len(S), S)


# In[4]:

tmp = S[0]
sums = [0]*(N+1)
counter = 1
gc = N
nb = 0
for i in range(1, N):
    if S[i] != tmp:
        sums[nb+1] = i
        nb += 1
        counter = 0
        tmp = S[i]
    else:
        gc -= 1
    counter += 1
    if i == N-1:
        sums[nb+1] = i+1

#print(N, gc)
sums = sums[:gc+1]
pl = [0]*gc
if gc < K*2:
    print(N)
else:
    if S[0] == "0":
        for i in range(-1, gc-K*2+1, 2):
            j = 0 if i < 0 else i
            pl[i] = sums[i+1+K*2]-sums[j]
    else:
        for i in range(0, gc-K*2+1, 2):
            j = i
            pl[i] = sums[i+1+K*2]-sums[j]
    print(max(pl))


# In[ ]:
Problem p03555 (python)

Fixed submission:
a=input()
b=input()
if a==b[::-1]:print("YES")
else:print("NO")

Buggy 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");
        }
    }
}
Problem p03323 (python)

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

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

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

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

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

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

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

Buggy 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')
Problem p02677 (python)

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 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))))
Problem p02681 (python)

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

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

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

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

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

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

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 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)
Problem p02730 (python)

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 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")
Problem p03962 (python)

Fixed submission:
import numpy as np
array = list(map(int, input().split(' ')))
print(len(np.unique(array)))

Buggy submission (verdict: Runtime Error):
a, b = list(map(int, input().split(' ')))
print(b*pow(b-1, a-1))
Problem p03162 (python)

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 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])
Problem p03172 (python)

Fixed submission:
import sys
from itertools import accumulate

def main():
  input=sys.stdin.readline
  n,k=map(int,input().split())
  A=list(map(int,input().split()))
  mod=10**9+7
  dp=[0]*(k+1)
  dp[0]=1
  for a in A:
    dp=list(accumulate(dp))
    #print("accumulated",dp)
    for j,d in enumerate(dp[:k-a],start=a+1):
      dp[j]-=d
    dp=[dpi%mod for dpi in dp]
    #print(dp)
  print(dp[k])
"""
def main():
  dp=[[0]*(k+1) for _ in range(n+1)]
  mod=1000000007
  #i人目までに0個配る方法は1通り
  #for i in range(n+1):
  #  dp[i][0]=1
  for i in range(0,n+1):
    for j in range(0,k+1):
      if i==0 and j==0:
        dp[i][j]=1
        break
      if j==0:
        dp[i][j]=1
        continue
      tmp=dp[i - 1][j] + dp[i][j - 1]
      if tmp>=mod:
        tmp%=mod
      dp[i][j]=tmp
      if j-a[i-1]-1>=0:
        tmp=dp[i][j]-dp[i-1][j-a[i-1]-1]
        if tmp>=mod:
          tmp%=mod
        dp[i][j]=tmp
    #print(dp)   
  print(dp[n][k])"""
main()

Buggy submission (verdict: Runtime Error):
import sys
from itertools import accumulate

def main():
  input=sys.stdin.readline
  n,k=map(int,input().split())
  A=list(map(int,input().split()))
  
  dp=[0]*(k+1)
  dp[0]=1
  for a in A:
    dp=list(accumulate(dp))
    print("accumulated",dp)
    for j,d in enumerate(dp[:k-a],start=a+1):
      dp[j]-=d
    dp=[dpi for dpi in dp]
    print(dp)
"""
def main():
  dp=[[0]*(k+1) for _ in range(n+1)]
  mod=1000000007
  #i人目までに0個配る方法は1通り
  #for i in range(n+1):
  #  dp[i][0]=1
  for i in range(0,n+1):
    for j in range(0,k+1):
      if i==0 and j==0:
        dp[i][j]=1
        break
      if j==0:
        dp[i][j]=1
        continue
      tmp=dp[i - 1][j] + dp[i][j - 1]
      if tmp>=mod:
        tmp%=mod
      dp[i][j]=tmp
      if j-a[i-1]-1>=0:
        tmp=dp[i][j]-dp[i-1][j-a[i-1]-1]
        if tmp>=mod:
          tmp%=mod
        dp[i][j]=tmp
    #print(dp)   
  print(dp[n][k])"""
main()
Problem p02645 (python)

Fixed submission:
a=input()
#str = list(a)
print(a[:3])

Buggy submission (verdict: Runtime Error):
a=input()
#str = list(a)
print(str[0:2])
Problem p02675 (python)

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 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")

Buggy 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')

Buggy 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')

Buggy 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')

Buggy 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')
Problem p02772 (python)

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 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)
Problem p02645 (python)

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

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

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

Fixed submission:
print(input().count('1'))

Buggy submission (verdict: Runtime Error):
#prep
n = int(input())
m = list(map(int, input().split())) #initial values
asmt = [0]*n
cnt = 0

#assessment 
while True:
    a = list(map(lambda x: x*(1/2)**(cnt+1), m))
    for i in range(n):
        asmt[i] = a[i].is_integer() 
        
    if all(asmt) == False:
        break 
    else: cnt = cnt+1

print(cnt)