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

Fixed submission:
A,B = map(int, input().split())
if A<=8 and B<=8:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if A<=8 and B<=8:
  print('Yay!')
else:
  print(':(')

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if A<=8 and B<=8:
  print('Yay!')
else:
  print(':(')
Problem p03371 (python)

Fixed submission:
A,B,C,X,Y = (int(i) for i in input().split())
i = 0
a = []
while i <= 100000:
    p = i * 2*C + A*max(0,X-i)+B*max(0,Y-i)
    a.append(p)
    i += 1
print(min(a))

Buggy submission (verdict: Runtime Error):
A,B,C,X,Y = (int(i) for i in input().split())
i = 0
a = []
while i <= 100000:
    p = i * 2*C + A*max(0,X-i)+B*max(0,Y-i)
    a.append(p)
    i += 1
print(min(a)
Problem p03524 (python)

Fixed submission:
s = input()
a=0
b=0
c=0
for charas in s:
  if charas=='a':
    a += 1
  elif charas == 'b':
    b += 1
  else:
    c += 1
if max(a,b,c)-min(a,b,c)<= 1:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
s = input()
a=0
b=0
c=0
for charas in s:
  if charas=='a':
    a += 1
  elif charas == 'b':
    b += 1
  else:
    c += 1
if max(a,b,c)-min(a,b,c)<= 1:
  print('YES')
else:
  primt('NO')
Problem p03549 (python)

Fixed submission:
N,M = map(int, input().split())
ans = (1900*M + 100*(N-M)) * (2**M)
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
ans = (1900*M + 100*(N − M)) * (2**M)
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
ans = (1900*M + 100*(N − M)) × (2**M)
print(ans)
Problem p03557 (python)

Fixed submission:
import bisect
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
c.sort()
ans = 0
def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect.bisect_left(a, x)
    if i:
        return i
    return 0
def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bisect.bisect_right(a, x)
    if i != len(a):
        return len(a)-i
    return 0
for bs in b:
  ans += find_lt(a, bs)*find_gt(c,bs)
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
c.sort()
ans = 0
def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect.bisect_left(a, x)
    if i:
        return i
    raise ValueError
def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bisect.bisect_right(a, x)
    if i != len(a):
        return len(a)-i
    raise ValueError
for bs in b:
  ans += find_lt(a, bs)*find_gt(c,bs)
print(ans)
Problem p03611 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
dic = {}
for nums in A:
  if nums in dic:
    dic[nums] += 1
  else:
    dic[nums] = 1
  if nums-1 in dic:
    dic[nums-1] += 1
  else:
    dic[nums-1] = 1
  if nums+1 in dic:
    dic[nums+1] += 1
  else:
    dic[nums+1] = 1
b = list(dic.values())
print(max(b))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
i = 0
b = []
while i <= 100000:
  n = a.count(i)
  b.append(n)
  i += 1
l = len(b)
j = 1
c = []
while j < l:
  nn = b[j-1]+b[j]+b[j+1]
  c.append(nn)
  j += 1
print(max(c))
Problem p03633 (python)

Fixed submission:
N=int(input())#入力回数を決める
import fractions
from functools import reduce
li=[]
for i in range(N):
  li.append(int(input()))
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(li))

Buggy submission (verdict: Runtime Error):
N = int(input())
a = []
import fractions
for i in range(N):
    a.append(int(input()))
def lcd(m,n):
  c = fractions.gcd(m,n)
  return m*n/c
def ans(li):
  if len(li)=1:
    return li[0]
  else:
    li[0]=lcd(li[0],li[1])
    del li[1]
    return ans(li)
print(ans(a))
Problem p03645 (python)

Fixed submission:
import sys
import bisect
N,M=map(int,input().split())
grid = []
for i in range(M):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
pre = []
pos = []
for ships in grid:
  if ships[0] == 1:
    pre.append(ships[1])
  if ships[1] == N:
    pos.append(ships[0])
if pre == [] or pos == []:
  print('IMPOSSIBLE')
  sys.exit()
pre.sort()
pos.sort()
def index(a, x):
    'Locate the leftmost value exactly equal to x'
    i = bisect.bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return 1
    return 0
for nums in pre:
  if index(pos,nums) == 1:
    print('POSSIBLE')
    sys.exit()
print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
import sys
N,M=map(int,input().split())
grid = []
for i in range(M):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
pre = []
pos = []
for ships in grid:
  if ships[0] == 1:
    pre.append(ships[1])
  if ships[1] == N:
    pos.append(ships[0])
if pre == [] or pos == []:
  print('IMPOSSIBLE')
  sys.exit()
pre.sort()
pos.sort()
def index(a, x):
    'Locate the leftmost value exactly equal to x'
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return 1
    return 0
for nums in pre:
  if index(nums,pos) == 1:
    print('POSSIBLE')
    sys.exit()
print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
import sys
N,M=map(int,input().split())
grid = []
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
pre = []
pos = []
for ships in grid:
  if ships[0] == 1:
    pre.append(ships[1])
  if ships[1] == N:
    pos.append(ships[0])
pre.sort()
for islands in pre:
  if islands in pos:
    print('POSSIBLE')
    sys.exit()
print('IMPOSSIBLE')
Problem p03695 (python)

Fixed submission:
import sys
N = int(input())
r = list(map(int, input().split()))
if min(r) >= 3200:
  print(str(1)+' '+str(N))
  sys.exit()
li = [0 for i in range(9)]
for rates in r:
  if rates >= 3200:
    rates = 3200
  n = rates//400
  li[n] += 1
p = 0
for nums in li[0:8]:
  if nums !=0:
    p += 1
print(str(p)+' '+str(p+li[8]))

Buggy submission (verdict: Runtime Error):
import sys
N = int(input())
r = list(map(int, input().split()))
if min(r) >= 3200:
  print(str(1)+' '+str(N))
  sys.exit()
li = [0 for i in range(9)]
for rates in r:
  n = rates//400
  li[n] += 1
p = 0
for nums in li[0:8]:
  if nums !=0:
    p += 1
print(str(p)+' '+str(p+li[8]))
Problem p03796 (python)

Fixed submission:
N = int(input())
x = 1
i = 1
while i <= N:
  x = (x*i)%(10**9+7)
  i += 1
print(x)

Buggy submission (verdict: Runtime Error):
N = int(input())
import math
def s(n):
  if n == 1:
    return 1
  else:
    return (n*s(n-1))%(10**9+7)
print(s(N))
Problem p03797 (python)

Fixed submission:
N,M = map(int, input().split())
s = N
c = M
if 2*N>=M:
  print(M//2)
else:
  t = 2*s+c
  print(t//4)

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
s = N
c = M
if 2*N>=M:
  print(M//2)
else:
  t = 2*s+c
print(t//4)
Problem p03848 (python)

Fixed submission:
import sys
def coun(n):
  i = 0
  ans = 1
  while i < n:
    ans = (ans*2)%(10**9+7)
    i += 1
  return ans
N = int(input())
A = list(map(int, input().split()))
A.sort()
if len(A)%2 == 1:
  if A[0]!=0:
    print(0)
    sys.exit()
  i = 1
  while i <= len(A)//2:
    if A[2*i-1]==2*i and A[2*i]==2*i:
      i += 1
    else:
      print(0)
      sys.exit()
  print(coun(N//2))

if len(A)%2 == 0:
  i = 0
  while i < N//2:
    if A[2*i] == 2*i+1 and A[2*i+1] == 2*i+1:
      i += 1
    else:
      print(0)
      sys.exit()
  print(coun(N//2))

Buggy submission (verdict: Runtime Error):
import sys
def coun(n):
  if n == 0:
    return 1
  else:
    return (2*coun(n-1))%(10**9+7)
N = int(input())
A = list(map(int, input().split()))
A.sort()
if len(A)%2 == 1:
  if A[0]!=0:
    print(0)
    sys.exit()
  i = 1
  while i <= len(A)//2:
    if A[2*i-1]==2*i and A[2*i]==2*i:
      i += 1
    else:
      print(0)
      sys.exit()
  print(coun(N//2))

if len(A)%2 == 0:
  i = 0
  while i < N//2:
    if A[2*i] == 2*i+1 and A[2*i+1] == 2*i+1:
      i += 1
    else:
      print(0)
      sys.exit()
  print(coun(N//2))
Problem p03994 (python)

Fixed submission:
s = input()
K = int(input())
ans = ''
alphas = {'a':0,'b':25,'c':24,'d':23,'e':22,'f':21,'g':20,'h':19,'i':18,'j':17,'k':16,'l':15,'m':14,'n':13,'o':12,'p':11,'q':10,'r':9,'s':8,'t':7,'u':6,'v':5,'w':4,'x':3,'y':2,'z':1}
a = 'abcdefghijklmnopqrstuvwxyz'
dict1 = {}
dict2 = {}
i = 1
while i <= 26:
  dict1[i%26] = a[i-1]
  dict2[a[i-1]] = i
  i += 1
for chara in s:
  if alphas[chara] <= K:
    ans = ans + 'a'
    K = K - alphas[chara]
  else:
    ans = ans + chara
K = K%26
if len(ans)>=2:
  ans = ans[:-1]+dict1[(dict2[ans[-1]]+K)%26]
else:
  ans = dict1[(dict2[ans]+K)%26]
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
K = int(input())
ans = ''
alphas = {'a':0,'b':25,'c':24,'d':23,'e':22,'f':21,'g':20,'h':19,'i':18,'j':17,'k':16,'l':15,'m':14,'n':13,'o':12,'p':11,'q':10,'r':9,'s':8,'t':7,'u':6,'v':5,'w':4,'x':3,'y':2,'z':1}
a = 'abcdefghijklmnopqrstuvwxyz'
dict1 = {}
dict2 = {}
i = 1
while i <= 26:
  dict1[i] = a[i-1]
  dict2[a[i-1]] = i
  i += 1
for chara in s:
  if alphas[chara] <= K:
    ans = ans + 'a'
    K = K - alphas[chara]
  else:
    ans = ans + chara
K = K%26
ans = ans[:-1]+dict1[(dict2[ans[-1]]+K)%26]
print(ans)
Problem p02683 (python)

Fixed submission:
#n=int(input())
n,m,x=map(int,input().split())
#a=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(n)]

def tas(l1,l2):
    l3=[]
    for i in range(m+1):
        l3.append(l1[i]+l2[i])
    return l3


ll=[[0 for i in range(m+1)]]
for i in range(n):
    for j in range(len(ll)):
        ll.append(tas(ll[j],l[i]))

lm=[]
for i in ll:
    lll=[]
    for j in range(1,len(i)):
        if i[j]>=x:
            lll.append(True)
        else:
            lll.append(False)
    if all(lll)==True:
        lm.append(i[0])

if len(lm)>0:
    print(min(lm))
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
#n=int(input())
n,m,x=map(int,input().split())
#a=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(n)]

def tas(l1,l2):
    l3=[]
    for i in range(m+1):
        l3.append(l1[i]+l2[i])
    return l3


ll=[[0 for i in range(m+1)]]
for i in range(n):
    for j in range(len(ll)):
        ll.append(tas(ll[j],l[i]))

lm=[]
for i in ll:
    lll=[]
    for j in range(1,i):
        if i[j]>=x:
            lll.append(True)
        else:
            lll.append(False)
    if all(lll)==True:
        lm.append(i[0])

if len(lm)>0:
    print(min(lm))
else:
    print(-1)
Problem p02696 (python)

Fixed submission:
#n=int(input())
a,b,n=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(q)]

#for i in range(n+1):
#    print(i,(a*i/b)//1,a*((i/b)//1),(a*i/b)//1-a*((i/b)//1))
i=min(b-1,n)
print(int((a*i/b)//1-a*((i/b)//1)))

Buggy submission (verdict: Runtime Error):
#n=int(input())
n,m=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(q)]
b=(n-1)//2
a=b//2
ll=[[0,0]for i in range(b)]
ll[0]=[1,2]

if b//2==b/2:
    for i in range(1,b):
        if i//2!=i/2:
            ll[i]=[2+a-(i//2),2+a-(i//2)+i+1]
        else:
            if i==b-2:
                ll[i]=[3+b//2,3+b//2+b-2+1]
            else:
                ll[i]=[3+b//2+b-2+1-i//2,3+b//2+b-2+1-i//2+i+1]
else:
    for i in range(1,b):
        if i//2==i/2:
            ll[i]=[3+b//2-i//2,3+b//2-i//2+i+1]
        else:
            if i==b-2:
                ll[i]=[3+b//2+1,3+b//2+b-1+1]
            else:
                ll[i]=[3+b//2+b-1+1-(i+1)//2,3+b//2+b-1+1-(i+1)//2+i+1]            

for i in range(m):
    print(*ll[i])
Problem p02713 (python)

Fixed submission:
from functools import reduce
import fractions
import math
k=int(input())
m=0
for i in range(1,k+1):
    for j in range(i,k+1):
        for p in range(j,k+1):
            l=[i,j,p]
            if i==j==p:
                m+=reduce(math.gcd,l)
            elif (i==j and i!=p) or (i==p and i!=j) or (j==p and i!=p):
                m+=3*reduce(math.gcd,l)
            else:
                m+=6*reduce(math.gcd,l)
print(m)

Buggy submission (verdict: Runtime Error):
from functools import reduce
k=int(input())
m=0
for i in range(1,k+1):
    for j in range(1,k+1):
        for p in range(1,k+1):
            l=[i,j,p]
            m+=reduce(fractions.gcd,l)
print(m)
Problem p02727 (python)

Fixed submission:
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

ri=sorted(r)[::-1]

qi=q[::]
pi=p[::]
pi=sorted(pi)[::-1]
pi=pi[:x]
qi=sorted(qi)[::-1]
qi=qi[:y]

l=pi+qi
l=sorted(l)
k=0
for i in range(min(c,x+y)):
    if l[i]>ri[i]:
        break
    else:
        k=i+1
print(sum(l[k:])+sum(ri[:k]))

Buggy submission (verdict: Runtime Error):
import heapq
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

ri=sorted(r)[::-1]
heapq.heapify(pi)
heapq.heapify(qi)

try:
    while pi[0]<ri[0] or qi[0]<ri[0]:
        if pi[0]<qi[0]:
            heapq.heappop(pi)
            heapq.heappush(pi,ri[0])
            ri.pop(0)
        else:
            heapq.heappop(qi)
            heapq.heappush(qi,ri[0])
            ri.pop(0)
except IndexError:
    pass
print(sum(pi)+sum(qi))
Problem p02787 (python)

Fixed submission:
#n=int(input())
h,n=map(int,input().split())
#a=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(n)]
#l=[list(input().split()) for i in range(n)]

amax=0
for i in range(n):
    if amax<l[i][0]:
        amax=l[i][0]
        
ldp=[[0 for j in range(h+amax)]for i in range(n)]
for i in range(n):
    for j in range(h+amax):
        if i==0:
            ldp[i][j]=-(-(j+1)//l[i][0])*l[i][1]
        else:
            if j>=l[i][0]:
                ldp[i][j]=min(ldp[i-1][j],ldp[i][j-l[i][0]]+l[i][1])
            else:
                ldp[i][j]=min(ldp[i-1][j],l[i][1])
print(min(ldp[-1][h-1:]))

Buggy submission (verdict: Runtime Error):
#n=int(input())
h,n=map(int,input().split())
#a=list(map(int,input().split()))
l=[list(map(int,input().split())) for i in range(n)]
#l=[list(input().split()) for i in range(n)]


        
ldp=[[0 for j in range(h)]for i in range(n)]
for i in range(n):
    for j in range(h):
        if i==0:
            ldp[i][j]=-(-(j+1)//l[i][0])*l[i][1]
        else:
            if j>=l[i][0]:
                ldp[i][j]=min(ldp[i-1][j],ldp[i][j-l[i][0]]+l[i][1])
            else:
                ldp[i][j]=min(ldp[i-1][j],l[i][1])
print(min(ldp[-1][-1]))
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,m=map(int,input().split)
if n==m:
  print("Yes")
else:
  print("No")
Problem p02854 (python)

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

s=sum(l)
m=0
i=-1
while m<s//2:
    i+=1
    m+=l[i]
    


print(min(2*m-s,s-2*(m-l[i])))

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

s=sum(l)
m=0
i=0
while m<s//2:
    m+=l[i]
    i+=1

print(min(2*m-s,s-2*(m-l[i])))
Problem p03281 (python)

Fixed submission:
import numpy as np
from sys import stdin
ans=0
c=0
N = int(input().rstrip())
for i in range(N):
  c=0
  i+=1
  if i%2==1:
    for j in range(i):
      j+=1
      if i%j==0:
        c+=1
  if c==8:
    ans+=1

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
from sys import stdinans=0
c=0
N = int(input().rstrip())
for i in range(N):
  c=0
  i+=1
  if i%2==1:
    for j in range(i):
      j+=1
      if i%j==0:
        c+=1
  if c==8:
    ans+=1

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
from sys import stdin
ans=0
c=0
N = int(input().rstrip())
for i in range(N):
  c=0
  i+=1
  if i%2==1:
    for j in range(i):
      j+=1
      if i%j==0:
        c+=1
  if c==8:
    ans+=1

print(ans)
Problem p02730 (python)

Fixed submission:
S = str(input())
N = int(len(S))
B = S[:(N-1)//2]
C = S[(((N+3)//2)-1):]

if S == S[::-1]:
    if B == B[::-1]:
        if C[::-1] == C:
            print("Yes")
        else:
            print("No")
    else:
            print("No")
else:
            print("No")

Buggy submission (verdict: Runtime Error):
S = str(input())
N = len(S)
B = S[:((N-1)/2)]
C = S[((N+3)/2):]
if S == S[-1]:
    if S[:((N-1)/2)] == B[-1]:
        if C[-1] == S[((N+3)/2):]:
            print("Yes")
        else:
            print("No")
    else:
            print("No")
else:
            print("No")
Problem p02600 (python)

Fixed submission:
X = int(input())
if X >= 400 and X<600:
    print(8)
elif X >= 600 and X<800:
    print(7)
elif X >= 800 and X<1000:
    print(6)
elif X >= 1000 and X<1200:
    print(5)
elif X >= 1200 and X<1400:
    print(4)
elif X >= 1400 and X<1600:
    print(3)
elif X >= 1600 and X<1800:
    print(2)
elif X >= 1800 and X<2000:
    print(1)

Buggy submission (verdict: Runtime Error):
A,B,C = map(int,input().split())
K = int(input())
for i in range(K):
    if C<=B:
        C*=2
    elif B<A and C>B:
        B*=2
if B>A and C>B:
    print("Yes")
else:
    print("No")
Problem p02658 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A = sorted(A,reverse=True)
B = 1
if 0 in A:
    print(0)
    quit()
else:
    for i in A:
        B *= i
        if B> 10**18:  
            print(-1)
            quit()
print(B)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A = sorted(A,reverse=True)
ans = 1
if 0 in A:
    print(0)
    quit()
else:
    for i in A:
        ans *=A[i]
        if ans>= 10**18:  
            print(-1)
            quit()
print(ans)
Problem p02675 (python)

Fixed submission:
N = int(input())
hon = [2,4,5,7,9]
pon = [0,1,6,8]
if N%10 in hon:
    print("hon")
if N%10 in pon:
    print("pon")
if N%10 == 3:
    print("bon")

Buggy submission (verdict: Runtime Error):
import math
A,B,H,M = map(int, input().split())
C = (H * 30 + M * 0.5) - (M * 6)
Radians = math.radians(C)
COS= math.cos(Radians)
ans = (A**2) + (B**2) - 2*(A*B)*COS
print(ans**0.5)
Problem p02681 (python)

Fixed submission:
S = str(input())
T = str(input())
print('Yes' if T[:-1] == S else 'No')

Buggy submission (verdict: Runtime Error):
A, B, C, K = map(int, input().split())
count = 0
if A == K:
    print(A)
    quit()
D = K-A
if (D - B) <= 0:
    print(A)
elif (D-B) > 0:
    E = (D-B)-C
    print(E)
Problem p02687 (python)

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

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = [input().split() for _ in range(N+K-1)]
new_list = []
for i in range(1,(len(S)//2)+1):
    for j in S[i*2]:
        new_list.append(j)
new_list = set(new_list)
print(N - len(new_list))
Problem p02583 (python)

Fixed submission:
N=int(input())
import itertools
A = list(map(int, input().split())) 

count=0
if len(A)<=2:
    print(0)
else:
    for ｔ in itertools.combinations(A, 3):
        if t[2]<t[0]+t[1] and t[1]<t[0]+t[2] and t[0]<t[1]+t[2] and t[0]!=t[1]!=t[2]!=t[0]:

            count+=1

    print(count)

Buggy submission (verdict: Runtime Error):
N=int(input())
import itertools
A = list(map(int, input().split())) 

count=0
for ｔ in itertools.combinations(A, 3):
    if list(t)[0]<list(t)[1]+list[2] and list(t)[1]<list(t)[2]+list(t)[0] and list(t)[2]<list(t)[0]+list(t)[1]:

        cout+=1

print(count)
Problem p02606 (python)

Fixed submission:
L,R,d=map(int,input().split())
c =0
s = R-L
k = s//d
if L%d ==0 or R%d ==0:
  k = k+1
print(k)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
x = 0
y =0 
z =0
for m in range(1,N+1):
  l = math.sqrt(m)
  li = int(l)
  count =0
  for i in range(li):
    x = i+1
    for k in range(x):
      y = k+1
      for j in range(y):
        z = j+1
        n = x*x+y*y+z*z+x*y+y*z+z*x
        if n==m:
          if  x==y or y==z or z==x:
            if x==y and y == z:
              count =count+1
            else:
              count = count+3
          else:
            count =count+6
  print(count)
Problem p02639 (python)

Fixed submission:
a = list(map(int,input().split()))
for i in range(5):
  if a[i] == 0:
    print(i+1)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
if not a[1] ==0:
  b = list(map(int,input().split()))
  b2 = sorted(b)##小さい順に並べる
  if abs(a[0]-b2[0]) <= abs(a[0]-b2[a[1]-1]):#bがすべて連続の場合の対策
    c = b2[0]-a[0]-1
  else:
    c = b2[a[1]-1]-a[0]+1
  if a[0] < b2[0]:
    print(a[0])
  elif a[0] > b2[a[1]-1]:
    print(a[0])
  else:
    for i in range(a[1]-1):
      if abs(b2[i+1]-b[i])>1:
        for j in range(b2[i+1]-b2[i]-1):##差分が1より大きい場合ソート
          if abs(c) > abs(b2[i]-a[0]+j+1):
            c = b2[i]-a[0]+j+1
    print(c+a[0])
else:
  print(a[0])
Problem p02658 (python)

Fixed submission:
n = int(input())
a = [0]*n
a = input().split()
n0 = a.count('0')
sum = int(a[0])
if n0 == 0:
  for k in range(len(a)-1):
    sum =sum*int(a[k+1])
    if sum >1000000000000000000:
      print(-1)
      break
  if sum <=1000000000000000000:
    print(sum)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
a = [0]*n
a = input().split()
n0 = a.count('0')
sum = int(a[0])
if n0 == 0:
  for k in range(len(a)-1):
    sum =sum*int(a[k+1])
    if sum >1000000000000000000:
      print(-1)
      break
  if sum >1000000000000000000:
    print(-1)
  else:
    print(sum)
else:
  print(0)
Problem p02675 (python)

Fixed submission:
N = str(input())
l = len(N)
e = int(N[l-1])
if e == 3:
  print('bon')
elif e in [0,1,6,8]:
  print('pon')
else:
  print('hon')

Buggy submission (verdict: Runtime Error):
K = int(input())
S = str(input())
l = len(S)
ST = str()
if K >= l:
  for i in range(l):
    ST += str(S[i])
  print(ST)
else:
  for i in range(K):
    ST += str(S[i])
  print(ST +'...')
Problem p02681 (python)

Fixed submission:
a = input()
b = input()
c = len(a)
a = a + b[c]
if (a == b):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
if a[0] >= a[3]:
  print(a[3])
else:
  a[3] = a[3] -a[0]
  if a[1] >= a[3]:
    print(a[0])
  else:
    print(a[0]-a[3]+a[1])
Problem p02687 (python)

Fixed submission:
a=input()
if a[1] =='B' :
  print('ARC')
elif a[1] == 'R':
  print('ABC')

Buggy submission (verdict: Runtime Error):
A = input()
if A[1]=='B' :
  print('先週開催されたコンテストはABCなので、今週はARCが開催されます。')
elif:A[1]=='R':
  print('先週開催されたコンテストはARCなので、今週はABCが開催されます。')
Problem p02677 (python)

Fixed submission:
import math

A,B,H,M = map(float, input().split())
pi = math.pi
Ak = 360*H/12+360/12*M/60
Bk = 360*M/60
Ak = Ak/180*pi
Bk = Bk/180*pi
# print(Ak)
# print(Bk)
ans = A*A+B*B-2*A*B*math.cos(Ak-Bk)
print(math.sqrt(ans))

Buggy submission (verdict: Runtime Error):
A,B,H,M = map(float, input().split())
pi = math.pi
Ak = 360*H/12+360/12*M/60
Bk = 360*M/60
Ak = Ak/180*pi
Bk = Bk/180*pi
# print(Ak)
# print(Bk)
ans = A*A+B*B-2*A*B*math.cos(Ak-Bk)
print(math.sqrt(ans))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!
import math

A,B,H,N = map(float, input().split())
# print(A)
# print(N)
Ak = 360*H/12+360/12*N/60
Bk = 360*N/60
# print(Ak)
# print(Bk)
sita = abs(Ak-Bk)
if abs(Ak-Bk)>180:
    sita = 360-abs(Ak-Bk)
# print(sita)
# print(max(A,B))
# print(360/sita)
Ko1 = 2*max(A,B)*math.sin((math.pi/(180/sita))/2)
# print(Ko1)
ans = Ko1*min(A,B)/max(A,B)
if(H==N==0):
    print(abs(A-B))
else:
    print(ans)


'''
n = int(input())
s = input()
if len(s)<=n:
    print(s)
elif len(s)>n:
    print(s[0:n]+"...")
'''
'''
n = input()
s = n[-1:]
a  = ["0" , "1" ,"6", "8"]
b=["3"]
c = ["2","4","5","7","9"]
print(s)

if s in a:
    print("pon")
elif s in b:
    print("bon")
elif s in c:
    print("hon")
'''
Problem p02717 (python)

Fixed submission:
x,y,z = map(str, input().split())
print( z + " " + x + " " + y)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
def sa(x):
    if x < 0:
        return abs(x)
    return abs(sa(x-k)-k)
print(sa(n))