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

Fixed submission:
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=1

for i in range(1,n):
    if p[i]<a:
        cnt+=1
        a = p[i]

print(cnt)

Buggy submission (verdict: Runtime Error):
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=1

for i in range(1,n):
    if p[i]<=a:
    cnt+=1
    a = p[i]

print(cnt)

Buggy submission (verdict: Runtime Error):
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=0

for i in range(1,n):
    if p[i]<=a
    cnt+=1
    a = p[i]

print(cnt)

Buggy submission (verdict: Runtime Error):
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=1

for i in range(1,n):
    if p[i]<=a
    cnt+=1
    a = p[i]

print(cnt)

Buggy submission (verdict: Runtime Error):
from sys import stdin

n=int(input())
p=list(map(int,input().split()))

a=p[0]
cnt=0

for i in range(1,n):
    if p[i]<=a
    cnt+=1
    a = p[1]

print(cnt)
Problem p03210 (python)

Fixed submission:
a = int(input())
if a==7 or a==5 or a==3:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
a = int(input())
if a==7 or a==5 or a==3:
	print("YES")
else print("NO")
Problem p03943 (python)

Fixed submission:
a, b, c = map(int, input().split())
 
if a + b == c:
  print('Yes')
elif b + c == a:
  print('Yes')
elif c + a == b:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

if a + b = c:
  print('yes')
elif b + c = a:
  print('yes')
elif c + a = b:
  print('Yes')
else:
  print('No')
Problem p02675 (python)

Fixed submission:
N = input()
 
if N[-1]=='2' or N[-1]=='4' or N[-1]=='5' or N[-1]=='7' or N[-1]=='9':
    print('hon')
     
elif N[-1]=='0' or N[-1]=='1' or N[-1]=='6' or N[-1]=='8':
    print('pon')
     
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
N = input()
 
if N[-1]==2or N[-1]==4 or N[-1]==5or N[-1]==7or N[-1]==9:
    print('hon')
     
elif N[-1]==0or N[-1]==1or N[-1]==6or N[-1]==8:
    print('pon')
     
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
N = input()
 
if N[-1]==2or N[-1]==4 or N[-1]==5or N[-1]==7or N[-1]==9:
     print('hon')
     
elif N[-1]==0or N[-1]==1or N[-1]==6or N[-1]==8:
    print('pon')
     
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
N = input()
 
if N[-1]==2or N[-1]==4 or N[-1]==5or N[-1]==7or N[-1]==9:
     print('hon')
     
    elif N[-1]==0or N[-1]==1or N[-1]==6or N[-1]==8:
    print('pon')
     
    else:
    print('bon')

Buggy submission (verdict: Runtime Error):
N = input()
 
if N[-1]==2or 4or 5or 7or 9:
     print('hon')
     
elif N[-1]==0or 1or 6or 8:
    print('pon')
     
else:
    print('bon')

Buggy submission (verdict: Runtime Error):
N = input()
 
if N[-1]==2or 4or 5or 7or 9:
     print('hon')
     
    elif N[-1]==0or 1or 6or 8:
    print('pon')
     
    else:
    print('bon')

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

if N{[-1]==2or 4or 5or 7or 9:
     print('hon')
     
     elif N[-1]==0or 1or 6or 8:
     print('pon')
     
     else:
     print('bon')

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

if N[-1]==2or 4or 5or 7or 9:
  print('hon')
  
elif N[-1]==0or 1or 6or 8:
  print('pon')
  
else:
  print('bon')

Buggy submission (verdict: Runtime Error):
N=<999

N = input()

if N[-1]= 2or 4or 5 or 7 or 9:
  print('hon')
  
elif N[-1]==0or 1or 6or 8:
  print('pon')
  
else:
  print('bon')

Buggy submission (verdict: Runtime Error):
N=<999

if N[-1]==2  or 4 or 5 or 7 or 9:
  print('hon')

elif N[-1]==0 or 1 or 6 or 8:
  print('pon')
  
else:
  print('bon')

Buggy submission (verdict: Runtime Error):
N=< 999

if N [-1]= 2 or 4 or 5 or 7 or 9 :
  print ('hon')

elif N[-1]= 0 or 1 or 6 or 8:
  print('pon')
  
else N[-1]=3:
  print('bon')
Problem p02681 (python)

Fixed submission:
s = list(input())
t = list(input())
n = int(len(t))
m = int(len(s))
if s == t[0:n-1] and n-1 == m:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())
n = int(len(t))
if s =  t[0:n-2]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())
n = int(len(t))
if s =  t[0:n-1]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = list(input())
t = list(input())
n = len(t)
if s =  t[0:n-1]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
s = input())
t = input())
n = 1
m = len(t)
if s == t[0:m-1]:
  print('Yes')
else:
  print('No')
Problem p02724 (python)

Fixed submission:
x = int(input())
s = 1000*(x//500) + 5*((x%500)//5)
print(s)

Buggy submission (verdict: Runtime Error):
x = int(input())
a = 500
b = 5
q = x//a
mod = x%a
if q > 0:
  c = q * 1000
elif mod // b > 0:
  d = (mod // b) * 5
  print(c + d)
else:
  print('0')
Problem p02730 (python)

Fixed submission:
S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
elif:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
A = (N - 1) // 2
B = ((N + 3) // 2)
if S[0:A] == S[B - 1:N]:
  print('Yes')
elif:
  print('No')

Buggy submission (verdict: Runtime Error):
S= input()
N = len(S)
A = (len(S) - 1) // 2
B = (len(S) + 3) // 2
if S[0:A] == S[B - 1:N]:
  print('Yes')
elif:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
A = (N - 1) // 2
B = ((N + 3) // 2)
if S[0:A] == S[B - 1:N]:
  print('Yes')
elif:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
A = (N-1)//2
B = ((N+2)//2)
if S[0:A] == S[B:N]:
  print('Yes')
elif:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
A = (N-1)//2
B = ((N+2)//2)
if S[0:A] == [B:N]:
  print('Yes')
elif:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
if S[0:(N-1)//2] == [((N+2)//2):N]:
  print('Yes')
elif:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
i = list(S)
if i[0:(N-1)//2] == [((N+2)//2):N]:
  print('Yes')
elif:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
i = list(S)
if i[0:((N+3)//2-2)] == [((N+3)//2):N]:
  print('Yes')
elif:
  print('No')

Buggy submission (verdict: Runtime Error):
S = input()
N = len(S)
i = list(S)
if i[0:((N+2)//2)] == [(N+4)//2:N]:
  print('Yes')
elif:
  print('No')
Problem p02731 (python)

Fixed submission:
L = int(input())
print((L/3)**3)

Buggy submission (verdict: Runtime Error):
L = int(input())
print((l/3)**3)

Buggy submission (verdict: Runtime Error):
L = int(input())
if L % 3 == 0:
  A = L / 3
  B = A ** 3
  print('{:.12f}'.format(B))
else:
  C = L / 3
  D = C ** 3
  print('{:.12f}'.format(B))
Problem p02717 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# 整数の入力
X, Y, Z =  input().split()
# スペース区切りの整数の入力

# 文字列の入力

# 出力
print("{} {} {}".format(Z, X, Y))

Buggy submission (verdict: Runtime Error):
N, M = input().split()
A = 0.25
B = (0.25 / int(M))

C = map(int, input().split())
D = B * sum(C)



E = sum(x > int(D) for x in C)
print(E)
Problem p02837 (python)

Fixed submission:
n = int(input())
A = []
ans = 0
for i in range(n):
    x =int(input())
    lists = [list(map(int,input().split())) for j in range(x)]
    A.append(lists)

for i in range(2**n):
    honesty = [0]*n
    for j in range(n):
        if (i>>j) & 1:
            honesty[j] = 1
    true = 1
    for j in range(n):
        if honesty[j] == 1:
            for k in range(len(A[j])):
                x,y = A[j][k]
                if not honesty[x-1] == y:
                    true = 0
                    break
    if true == 1:
        ans = max(ans,sum(honesty))
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = []
ans = 0
for i in range(n):
    x =int(input())
    lists = [list(map(int,input().split())) for j in range(x)]
    A.append(lists)

for i in range(2**n):
    honesty = [0]*n
    for j in range(n):
        if (i>>j) & 1:
            honesty[j] = 1
    true = 1
    for j in range(n):
        if honesty[j] == 1:
            for k in range(len(A[j])):
                x,y = A[j][k]
                
                if  honesty[x] != y :
                    true = 0
                    break
    if true == 1:
        ans = max(ans,sum(honesty))
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = []
ans = 0
for i in range(n):
    x =int(input())
    lists = [list(map(int,input().split())) for j in range(x)]
    A.append(lists)

for i in range(2**n):
    honesty = [0]*n
    for j in range(n):
        if (i>>j) & 1:
            honesty[j] = 1
    true = 1
    for j in range(n):
        if honesty[j] == 1:
            for k in range(len(A[j])):
                x,y = A[j][k]
                
                if  honesty[x] != y :
                    true = 0
                    break
    if true == 1:
        ans = max(ans,sum(honesty))
print(ans)
Problem p02861 (python)

Fixed submission:
import numpy as np
import itertools 
def distance(a,b):
    x1,y1 = a
    x2,y2 = b
    return np.sqrt((x1-x2)**2 + (y1- y2)**2)
n = int(input())
xy = []
for _ in range(n):
    x,y = map(int,input().split())
    xy.append([x,y])
n_permutations = itertools.permutations(range(n))
dist_list=[]
for one_case in n_permutations:
    dist = 0
    for i in range(n-1):
        a = xy[one_case[i]]
        b = xy[one_case[i+1]]
        dist += distance(a,b)
    dist_list.append(dist)
print(sum(dist_list)/len(dist_list))

Buggy submission (verdict: Runtime Error):
8
-406 10
512 859
494 362
-955 -475
128 553
-986 -885
763 77
449 310
Problem p03044 (python)

Fixed submission:
import sys

sys.setrecursionlimit(10**6)

n = int(input())
if n == 1:
    print(1)
else:
    edge=[[] for _ in range(n)]
    for _ in range(n-1):
        u,v,w = map(int,input().split())
        edge[u-1].append((v-1,w%2))
        edge[v-1].append((u-1,w%2))
 
    color =[-1]*n
    def dfs(node,edge):
        for next_node,w in edge[node]:
            if color[next_node] != -1:
                continue
            if w == 1:
                color[next_node] = color[node]^1
            elif w == 0:
                color[next_node] = color[node]
            dfs(next_node,edge)
        
        
    color[0] = 0
    dfs(0,edge)
    print(*color,sep="\n")

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 1:
    print(1)
else:
    edge=[[] for _ in range(n)]
    for _ in range(n-1):
        u,v,w = map(int,input().split())
        edge[u-1].append((v-1,w%2))
        edge[v-1].append((u-1,w%2))

    color =[-1]*n
    def dfs(node,edge):
        for next_node,w in edge[node]:
            if color[next_node] != -1:
                continue
            if w == 1:
                color[next_node] = color[node]^1
            elif w == 0:
                color[next_node] = color[node]
            dfs(next_node,edge)
        
        
    color[0] = 0
    dfs(0,edge)
    print(*color,sep="\n")

Buggy submission (verdict: Runtime Error):
n = int(input())
edge=[[] for _ in range(n)]
for _ in range(n-1):
    u,v,w = map(int,input().split())
    edge[u-1].append((v-1,w%2))
    edge[v-1].append((u-1,w%2))

color =[-1]*n
def dfs(node,edge):
    for next_node,w in edge[node]:
        if color[next_node] != -1:
            continue
        if w == 1:
            color[next_node] = color[node]^1
        elif w == 0:
            color[next_node] = color[node]
        dfs(next_node,edge)
        
        
color[0] = 0
dfs(0,edge)
print(*color,sep="\n")

Buggy submission (verdict: Runtime Error):
n = int(input())
edge=[[] for _ in range(n+1)]
for _ in range(n-1):
    u,v,w = map(int,input().split())
    edge[u].append((v,w%2))
    edge[v].append((u,w%2))

color =[-1]*(n+1)
def dfs(node,edge):
    for next_node,w in edge[node]:
        if color[next_node] != -1:
            continue
        if w == 1:
            color[next_node] = color[node]^1
        else:
            color[next_node] = color[node]
        dfs(next_node,edge)
        
        
color[1] = 0
dfs(1,edge)
color = color[1:]
print(*color,sep="\n")

Buggy submission (verdict: Runtime Error):
n = int(input())
edge=[[] for _ in range(n+1)]
for _ in range(n-1):
    u,v,w = map(int,input().split())
    edge[u].append((v,w%2))
    edge[v].append((u,w%2))

color =[-1]*(n+1)
def dfs(node,edge):
    for next_node,w in edge[node]:
        if color[next_node] != -1:
            continue
        if w == 1:
            color[next_node] = color[node]^1
        elif w == 0:
            color[next_node] = color[node]
        dfs(next_node,edge)
        
        
color[1] = 0
dfs(1,edge)
color = color[1:]
print(*color,sep="\n")
Problem p03166 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

n,m = map(int,input().split())
edge=[[] for _ in range(n)]
for _ in range(m):
    x,y = map(int,input().split())
    edge[x-1].append(y-1)


d = [0] * n

def dfs(v,edge):
    depth = 0
    for next_v in edge[v]:
        if d[next_v] == 0:
            depth = max(depth,dfs(next_v,edge))
        depth = max(depth,d[next_v])
    depth += 1 
    d[v] = depth
    return depth

for i in range(n):
    dfs(i,edge)
print(max(d)-1)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
edge=[[] for _ in range(n)]
for _ in range(m):
    x,y = map(int,input().split())
    edge[x-1].append(y-1)


d = [0] * n

def dfs(v,edge):
    global depth
    depth = 0
    for next_v in edge[v]:
        if d[next_v] == 0:
            dfs(next_v,edge)
        else:
            depth = max(depth,d[next_v])
    depth += 1 
    d[v] = depth

for i in range(n):
    dfs(i,edge)
print(max(d)-1)
Problem p03408 (python)

Fixed submission:
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

ans = 0

for i in set(s):
    a = sum(k == i for k in s) - sum(k == i for k in t)
    ans = max(a,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
l = list(set(s))
print(max(0,max(s.count(l[i]) - t.count(l[i]) for i in l)))
Problem p03471 (python)

Fixed submission:
n,Y = map(int,input().split())
Y = int(Y / 1000)
ans = [-1,-1,-1]
for x in range(n+1):
    for y in range(n+1):
        if 10*x + 5*y + (n-x-y) == Y and n-x-y >= 0:
            ans = [x,y,n-x-y]
print(*ans)

Buggy submission (verdict: Runtime Error):
n,Y = map(int,input().split())
Y = int(Y / 1000)
ans = [-1,-1,-1]
for x in range(n+1):
    for y in range(n+1):
        if 10*x + 5*y + (n-x-y) == Y and n-x-y => 0:
            ans = [x,y,n-x-y]
print(*ans)
Problem p03557 (python)

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

import bisect
a.sort()
b.sort()
c.sort()
ans = 0
for i in range(len(b)):
    ab = bisect.bisect_right(a,b[i]-1) # b[i]より真に小さいaの要素数
    bc = len(c) - bisect.bisect_left(c,b[i]+1) # b[i]より真に大きいcの要素数
    ans += ab*bc
print(ans)

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

import bisect
a.sort()
b.sort()
c.sort()
ans = 0

comb = []
for i in range(len(b)):
    key = bisect.bisect_left(c,b[i]+1)
    comb.append(len(c) -key)
comb.append(0)
combsum = []
for i in range(comb):
    x = sum(comb[i:])
    combsum.append(x)
for A in a:
    key_b = bisect.bisect_left(b,A+1)
    ans += combsum[key_b]
print(ans)
Problem p02675 (python)

Fixed submission:
N = int(input())
a = N % 100
b = a % 10
if b == 2 or b == 4 or b == 5 or b == 7 or b == 9:
  print('hon')
elif b == 0 or b == 1 or b == 6 or b == 8:
  print('pon')
else:
  print('bon')

Buggy submission (verdict: Runtime Error):
K = int(input())
S = list(input())
len_S = int(len(S))
S1 = ' '

if len_S <= K:
  print(K)
else:
  del S[K:]
  for x in S:
    S1 += x
  print(S1 + '...')
Problem p02789 (python)

Fixed submission:
n, m = map(int, input().split())
if n == m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
m = int(input())
if n == m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = 3
m = int(input())
if n == m:
    print("Yes")
else:
    print("No")
Problem p02811 (python)

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

Buggy submission (verdict: Runtime Error):
k, x = map(int input().split()) 
if 500*k >= x:
  print("Yes")
else:
  print("No")
Problem p02817 (python)

Fixed submission:
s, t = map(str, input().split()) 
print(t + s)

Buggy submission (verdict: Runtime Error):
s, t = input()
print(s + t)

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
print(s + t)
Problem p02947 (python)

Fixed submission:
from collections import Counter

num = int(input())
range_arr = range(num)

strs = [[] for i in range_arr]
for i in range_arr:
    strs[i] = input()

def sort(str):
    str_arr = list(str)
    str_arr.sort()
    return ''.join(str_arr)

new_strs = list(map(lambda v: sort(v), strs))
strs_length = len(new_strs)

sum = 0
counter = Counter()
for tmp_str in new_strs:
    sum += counter[tmp_str]
    counter[tmp_str] += 1

print(sum)

Buggy submission (verdict: Runtime Error):
num = int(input())
range_arr = range(num)

strs = [[] for i in range_arr]
for i in range_arr:
    strs[i] = input()

def conv(str):
    str_arr = list(str)
    str_arr.sort()
    return ''.join(str_arr)

new_strs = list(map(lambda v: conv(v), strs))
new_strs.sort()
compact_strs = list(set(new_strs))

cnt = 0
for str in compact_strs:
    str_count = new_strs.count(str)
    print(f'str_count:{str_count}')
    if str_count >= 2:
        cnt += int(str_count*(str_count-1)/2)

print(cnt)
Problem p02730 (python)

Fixed submission:
def palindrom(st):
    return st == st[::-1]
import math
s = input()
l = len(s)
print("Yes" if palindrom(s) and palindrom(s[:(l-1)//2]) and palindrom(s[(l+2)//2:]) else "No")

Buggy submission (verdict: Runtime Error):
x = input()
w = "" 
for i in x: 
    w = i + w 
    if (x==w): 
        print("Yes")
	else:
      	print("No")
Problem p02677 (python)

Fixed submission:
import math

A ,B ,H ,M =map(int,input().split())

dighour:float = 30*H + M*0.5
digmin:float =  M * 6
length:float = 0

deg = abs(dighour-digmin)
length = math.sqrt(A**2 + B**2 - (2 * A * B * math.cos(math.radians(deg))))

'''
if dighour > digmin and abs(dighour - digmin) <= 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians(abs(dighour-digmin)))))
elif dighour > digmin and abs(dighour - digmin) > 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians(360 - abs(dighour-digmin)))))
elif dighour < digmin and abs(digmin - dighour) <= 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians((abs(digmin-dighour))))))
elif dighour < digmin and abs(digmin - dighour) > 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians((360 - abs(digmin-dighour))))))
'''

print(length)

Buggy submission (verdict: Runtime Error):
import math

A ,B ,H ,M =map(int,input().split())

dighour:float = 360*((H+M/60)/12)
digmin:float =  360*(M/60)
length:float = 0

deg = abs(dighour-digmin)

length = A**2 + B**2 - 2 * A * B math.cos(math.radians(deg))

'''
if dighour > digmin and abs(dighour - digmin) <= 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians(abs(dighour-digmin)))))
elif dighour > digmin and abs(dighour - digmin) > 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians(360 - abs(dighour-digmin)))))
elif dighour < digmin and abs(digmin - dighour) <= 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians((abs(digmin-dighour))))))
elif dighour < digmin and abs(digmin - dighour) > 180:
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * math.cos(math.radians((360 - abs(digmin-dighour))))))
'''

print(length)

Buggy submission (verdict: Runtime Error):
import math

A ,B ,H ,M =map(int,input().split())

dighour = 360 * ((H+M/60)/12)
digmin = 360 * (M/60)
length = 0
cosin = 0
if dighour > digmin and abs(dighour - digmin) <= 180:
    cosin = round(math.cos(math.radians(abs(dighour-digmin))),5)
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * cosin))
elif dighour > digmin and abs(dighour - digmin) > 180:
    cosin = round(math.cos(math.radians(360 - abs(dighour-digmin)),5))
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * cosin))
elif dighour < digmin and abs(digmin - dighour) <= 180:
    cosin = round(math.cos(math.radians(abs(digmin-dighour))),5)
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * cosin))
elif dighour < digmin and abs(digmin - dighour) > 180:
    cosin = round(math.cos(math.radians(360 - abs(digmin-dighour)),5))
    length = math.sqrt((A **2 + B **2) - ((2*A*B) * cosin))

print(length)
Problem p03632 (python)

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

length = 0

if b <= c or d <= a:
    length = 0
elif b <= d and c <= d and a <= c:
    length = b - c
elif d <= b and a <= d and c <= a:
    length = d -a
elif b <= d and c <= a:
    length = b - a
elif d <= b and a <= c:
    length = d - c

print (length)

Buggy submission (verdict: Runtime Error):
0 75 25 100
Problem p02675 (python)

Fixed submission:
n = int(input())
str = ""

if n%10 == 0:
	str = "pon"
elif n%10 == 1:
	str = "pon"
elif n%10 == 2:
	str = "hon"
elif n%10 == 3:
	str = "bon"
elif n%10 == 4:
	str = "hon"
elif n%10 == 5:
	str = "hon"
elif n%10 == 6:
	str = "pon"
elif n%10 == 7:
	str = "hon"
elif n%10 == 8:
	str = "pon"
elif n%10 == 9:
	str = "hon"

print(str)

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

Knum = int(K)
Slength = len(S)

if Slength <= Knum:
	str = S
else:
	str = S[0:Knum]

print(str)
Problem p02812 (python)

Fixed submission:
N = int(input())
S = input()
print(S.count("ABC"))

Buggy submission (verdict: Runtime Error):
S = input()
N = int(input())
count = 0
S = S.split('ABC')
for i in S:
    if i == '':
        count += 1
    else: continue
print (count)

Buggy submission (verdict: Runtime Error):
S = input()
N = int(input())
count = 0
S = S.split('ABC')
for i in S:
    if i == '':
        count += 1
    else: continue
print (count)

Buggy submission (verdict: Runtime Error):
S = input()
N = int(input())
count = 0
a = S.split('ABC')
for i in a:
    if i == '':
        count += 1
    else: continue
print (count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
count = 0
for i in range(1,N-1):
  if S[i-1] + S[i] + s[i+1] == "ABC":
    count = count + 1
print (count)

Buggy submission (verdict: Runtime Error):
N = int(input)
S = input()
count = 0
for i in range(1,N-1):
  if S[i-1] + S[i] + s[i+1] == "ABC":
    count += 1
	print (count)

Buggy submission (verdict: Runtime Error):
S = input()
N = int(input())
count = 0
if N >= 3 and N <= 50:
	d = ''
	for j in S:
    	d += j
    	if len(d) == N:break
	a = d.split('ABC')
	for i in a:
    	if i == '':
        	count += 1
    	else: continue
print (count)

Buggy submission (verdict: Runtime Error):
N = int(input)
S = input()
count = 0
if N >= 3 and N <= 50:
	for i in range(1,N-1):
  		if S[i-1] + S[i] + s[i+1] == "ABC":
    	count = count + 1
print (count)

Buggy submission (verdict: Runtime Error):
N = int(input)
S = input()
count = 0
for i in range(1,N-1):
  if S[i-1] + S[i] + s[i+1] == "ABC":
    count = count + 1
print (count)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
count = 0
for i in range(1, N - 1):
  if S[i-1] + S[i] + S[i + 1] = 'ABC':
    count += 1
print (count)

Buggy submission (verdict: Runtime Error):
S = input()
N = int(input())
count = 0
d = ''
for j in S:
    d += j
    if len(d) == N:break
a = d.split('ABC')
for i in a:
    if i == '':
        count += 1
    else: continue
print (count)