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

Fixed submission:
a,b,c,d,e,f = map(int,input().split())
maxden = 0
amax = f //(a*100)
water=a*100
sugar=0
for i in range(amax+1):
  waterA = i*100*a
  res = f-waterA
  bmax = res // (b*100)
  for j in range(bmax+1):
    waterB = j*100*b
    waterS =waterA+waterB
    res = f-waterS
    cmax = res // c
    for k in range(cmax+1):
      sugarC = k*c
      res = f-waterS-sugarC
      dmax = res // d
      for l in range(dmax+1):
        sugarD = l*d
        sugarS = sugarC+sugarD
        if(sugarS+waterS==0):break
        den = (sugarS)*100/(sugarS+waterS)
        #if(den>49 and den<50.1):print(res-sugarD,waterA,waterB,sugarC,sugarD,den)
        #if(sugarS==146 and waterS==200):print(waterS,sugarS,den,(den*(100+e))/100,e)
        #if(sugarS==582 and waterS==800):print(waterS,sugarS,den,(den*(100+e))/100,e)
        if(den>maxden and (den*(100+e)/100)-e<=10**-5):
          maxden = den
          sugar = sugarS
          water = waterS

print(str(water+sugar)+" "+str(sugar))
#print(maxden)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f = map(int,input().split())
maxden = 0
amax = f //(a*100)
for i in range(amax+1):
  waterA = i*100*a
  res = f-waterA
  bmax = res // (b*100)
  for j in range(bmax+1):
    waterB = j*100*b
    waterS =waterA+waterB
    res = f-waterS
    cmax = res // c
    for k in range(cmax+1):
      sugarC = k*c
      res = f-waterS-sugarC
      dmax = res // d
      for l in range(dmax+1):
        sugarD = l*d
        sugarS = sugarC+sugarD
        if(sugarS+waterS==0):break
        den = (sugarS)*100/(sugarS+waterS)
        #if(den>49 and den<50.1):print(res-sugarD,waterA,waterB,sugarC,sugarD,den)
        if(den>maxden and (den/100)<=(e/(100+e))):
          maxden = den
          sugar = sugarS
          water = waterS

print(str(water+sugar)+" "+str(sugar))
Problem p03645 (python)

Fixed submission:
import sys
n,m=map(int,input().split())
INF=10**15
li1=set()
lin=set()
for i in range(m):
  a,b=map(int,input().split())
  if(a==1):li1.add(b)
  elif(b==1):li1.add(a)
  elif(a==n):lin.add(b)
  elif(b==n):lin.add(a)
for i in li1:
  if(i in lin):
    print("POSSIBLE")
    sys.exit()
    
print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
import sys
n,m=map(int,input().split())
INF=10**15
d={}
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  d.setdefault(a,[]).append(b)
  d.setdefault(b,[]).append(a)
dist=[INF for i in range(n)]
dist[0]=0
queue=[]
for i in d[0]:
  queue.insert(0,i)
  dist[i]=1

while(len(queue)):
  x=queue.pop()
  if(x==n-1 and dis[x]==2):
    print("POSSIBLE")
    sys.exit()
  elif(x==n-1 and dis[x]!=INF):
    print("INPOSSIBLE")
    sys.exit()
  for i in d[x]:
    if(dist[i]==INF):
      queue.insert(0,i)
      dist[i]=dist[x]+1
if(dist[-1]==2):print("POSSIBLE")
else:print("IMPOSSIBLE")
Problem p03659 (python)

Fixed submission:
import sys
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
if(n==2):
  mi=abs(a[0]-a[1])
else:
  mi=10**15
  s1=a[0]
  for i in range(1,len(a)-1):
    s1+=a[i]
    s2=s-s1
    #print(s1,s2)
    mi=min([mi,abs(s1-s2)])
print(mi)

Buggy submission (verdict: Runtime Error):
import sys
n=int(input())
a=list(map(int,input().split()))
s=sum(a)
if(n==2):
  mi=abs(a[0]-a[1])
else:
  s1=a[0]
  for i in range(1,len(a)-1):
    s1+=a[i]
    s2=s-s1
    #print(s1,s2)
    mi=min([mi,abs(s1-s2)])
print(mi)
Problem p03721 (python)

Fixed submission:
import sys
n,k=map(int,input().split())
ab=[[0,0]for i in range(n)]
for i in range(n):
  ab[i][0],ab[i][1]=map(int,input().split())
ab.sort()
x=0
for i in range(n):
  x+=ab[i][1]
  if(x>=k):
    print(ab[i][0])
    sys.exit()
print(ab[-1][0])

Buggy submission (verdict: Runtime Error):
import sys
n,k=map(int,input().split())
ab=[[0,0]for i in range(n)]
for i in range(n):
  ab[i][0],ab[i][1]=map(int,input.split())
ab.sort()
x=0
for i in range(n):
  x+=ab[i][1]
  if(x>=k):
    print(ab[i][0])
    sys.exit()
print(ab[-1][0])
Problem p03827 (python)

Fixed submission:
n=int(input())
s=input()
x=0
ma=0
for i in range(n):
  if(s[i]=="D"):
    x-=1
  else:
    x+=1
    ma=max([ma,x])
print(ma)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
x=0
max=0
for i in range(n):
  if(s[i]=="D"):
    x-=1
  else:
    x+=1
    max=max([max,x])
print(max)
Problem p03828 (python)

Fixed submission:
import sys
n=int(input())
lis=[0for i in range(n)]
for i in range(2,n+1):
  ib=i
  for j in range(2,ib+1):
    while(ib%j==0):
      lis[j-1]+=1
      ib=ib//j
pat=1
for i in lis:pat*=(i+1)
print(pat%(10**9+7))

Buggy submission (verdict: Runtime Error):
n=int(input())
i=1
lis=[]
while(i*i<=n):
  count=0
  while(n%i==0):
    count+=1
    n=n//i
  if(count！=0):lis.append(count)
x=1
for i in lis:
  x*=(i+1)
print(x)
Problem p03844 (python)

Fixed submission:
a,op,b=map(str,input().split())
if(op=="+"):
  print(int(a)+int(b))
else:
  print(int(a)-int(b))

Buggy submission (verdict: Runtime Error):
a,op,b=map(str,input().split())
if(op=="+"):
  print(a+b)
else:
  print(a-b)

Buggy submission (verdict: Runtime Error):
a,op,b=map(str,input().split())
if(op="+"):
  print(a+b)
else:
  print(a-b)
Problem p03919 (python)

Fixed submission:
h,w=map(int,input().split())
alh="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in range(h):
  s=list(input().split())
  if("snuke" in s):
    ind=s.index("snuke")
    print(alh[ind]+str(i+1))
    break

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
alh="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
for i in h:
  s=list(input().split())
  if("snuke" in s):
    ind=s.index("snuke")
    print(alh[ind]+str(i+1))
    break
Problem p03951 (python)

Fixed submission:
import sys


n=int(input())
s=input()
t=input()
test=s+t
if(s==t):
    print(len(s))
    sys.exit()
for i in range(1,n+1)[::-1]:
    test=s[0:-i]+t
    if(test[:n]==s and test[-n:]==t):
        print(len(test))
        sys.exit()
        
print(len(s+t))

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
t=input()
for i in range(n):
  if(t[i]==s[-(i+1)]):
    t=t[1:]
  else:break
print(n+len(t))
Problem p03957 (python)

Fixed submission:
import sys
s=input()
if("C" in s and "F" in s):
  for i in range(len(s)):
    if(s[i]=="C"):
      c=i
      break
  for i in range(len(s))[::-1]:
    if(s[i]=="F"):
      f=i
      break
  if(c<f):
    print("Yes")
    sys.exit()
print("No")

Buggy submission (verdict: Runtime Error):
import sys
s=input()
if("C" in s and "F" in s):
  for i in range(len(s)):
    if(s[i]=="C"):c=i
  for i in range(len(s))[::-1]:
    if(s[i]==="F"):f=i
  if(c<f):
    print("Yes")
    sys.exit()
print("No")

Buggy submission (verdict: Runtime Error):
import sys
s=input()
if("C" in s and "C" in s):
  if(s.index("C")<s.index("F")):
    print("Yes")
    sys.exit()
print("No")
Problem p03970 (python)

Fixed submission:
s=input()
co="CODEFESTIVAL2016"
cou=0
for i in range(len(s)):
  if(s[i]!=co[i]):cou+=1
print(cou)

Buggy submission (verdict: Runtime Error):
s=input()
co="CODEFESTIVAL2016"
cou=0
for i in range(s):
  if(s[i]!=co[i]):cou+=1
print(cou)
Problem p03998 (python)

Fixed submission:
Sa=list(input())
Sb=list(input())
Sc=list(input())
S=Sa.pop(0)
Win="A"
while(S!=""):
  if(S=="a"):
    S=""
    if(len(Sa)!=0):
    	S=Sa.pop(0)
    Win="A"
  elif(S=="b"):
    S=""
    if(len(Sb)!=0):
	    S=Sb.pop(0)
    Win="B"
  elif(S=="c"):
    S=""
    if(len(Sc)!=0):
    	S=Sc.pop(0)
    Win="C"
print(Win)

Buggy submission (verdict: Runtime Error):
Sa=list(input())
Sb=list(input())
Sc=list(input())
Sa.pop()
Sb.pop()
#Sc.pop()
S=Sa.pop(0)
Win="A"
while(S!=""):
  if(S=="a"):
    S=""
    if(len(Sa)!=0):
    	S=Sa.pop(0)
    Win="A"
  elif(S=="b"):
    S=""
    if(len(Sb)!=0):
	    S=Sb.pop(0)
    Win="B"
  elif(S=="c"):
    S=""
    if(len(Sc)!=0):
    	S=Sc.pop(0)
    Win="C"
print(Win)

Buggy submission (verdict: Runtime Error):
Sa=list(input())
Sb=list(input())
Sc=list(input())
Sa.pop()
Sb.pop()
#Sc.pop()
S=Sa.pop(0)
Win="A"
while(S!=""):
  if(S=="a"):
    S=""
    if(len(Sa)!=0):
    	S=Sa.pop(0)
    Win="A"
  elif(S=="b"):
    S=""
    if(len(Sb)!=0):
	    S=Sb.pop(0)
    Win="B"
  elif(S=="c"):
    S=""
    if(len(Sc)!=0):
    	S=Sc.pop(0)
    Win="C"
print(Win)

Buggy submission (verdict: Runtime Error):
Sa=list(input())
Sb=list(input())
Sc=list(input())
Sa.pop()
Sb.pop()
Sc.pop()
S=Sa.pop(0)
Win="A"
while(S!=""):
  if(S=="a"):
    S=""
    if(len(Sa)!=0):
    	S=Sa.pop(0)
    Win="A"
  elif(S=="b"):
    S=""
    if(len(Sb)!=0):
	    S=Sb.pop(0)
    Win="B"
  elif(S=="c"):
    S=""
    if(len(Sc)!=0):
    	S=Sc.pop(0)
    Win="C"
print(Win)

Buggy submission (verdict: Runtime Error):
Sa=list(input())
Sb=list(input())
Sc=list(input())
S=Sa.pop(0)
Win=""
while(S):
  if(S=="a"):
    S=Sa.pop(0)
    Win="A"
  elif(S=="b"):
    S=Sb.pop(0)
  	Win="B"
  elif(S=="c"):
    S=Sc.pop(0)
  	Win="C"
print(Win)
Problem p03999 (python)

Fixed submission:
import sys
s=input()
if(len(s)==1):
  print(s)
  sys.exit()
su=0
for i in range(2**(len(s)-1)):
  b=bin(i)[2:].zfill(len(s)-1)
  calcs=s[0]
  for j in range(len(b)):
    if(b[j]=="0"):calcs+=s[j+1]
    else:calcs+="+"+s[j+1]
  su+=eval(calcs)
print(su)

Buggy submission (verdict: Runtime Error):
s=input()
su=0
for i in range(2**(len(s)-1)):
  b=bin(i)[2:].zfill(len(s)-1)
  calcs=s[0]
  for j in range(len(b)):
    if(b[j]=="0"):calcs+=s[j+1]
    else:calcs+="+"+s[j+1]
  su+=eval(calcs)
print(su)

Buggy submission (verdict: Runtime Error):
s=input()
su=0
for i in range(2**(len(s)-1)):
  b=bin(i)[2:].zfill(len(s)-1)
  calcs=s[0]
  for j in range(len(b)):
    if(b[j]=="0"):calcs+=s[j+1]
    else:calcs+="+"+s[j+1]
  sum+=eval(calcs)
print(sum)
Problem p04033 (python)

Fixed submission:
a,b=map(int,input().split())
if(a>0):print("Positive")
elif(a==0):print("Zero")
else:
  if(b>=0):print("Zero")
  else:
    if((b-a+1)%2==0):print("Positive")
    else:print("Negative")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
if(a>0):print("Positive")
elif(a==0):print("Zero")
else:
  if(b>=0):print("Zero")
  else:
    if((b-a+1)%2==0):print("Positive")
    else:print("Negative")
Problem p02681 (python)

Fixed submission:
list = [input() for i in range (2)]
if list[0] == list[1][:-1]:
  print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
list = [input() for i in range (2)]
if list[1] == list[2][:-1]:
  print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
list = [input() for i in range 2]
if list[1] == list[2][:-1]:
  print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
list = [input() for _ in range 2]
if list[1] == list[2][:-1]:
  print("Yes")
  else:
    print("No")
Problem p02681 (python)

Fixed submission:
import string

l=list(string.ascii_lowercase)


s=input()
t=input()
a=0

for i in range(26):
  if t==s+l[i]:
    print('Yes')
    a+=1
    break
    

if a==0:
  print('No')

Buggy submission (verdict: Runtime Error):
s=list(input())
t=list(input())

l=list(set(t)-set(s))

if l[0]==t[-1] and len(l)==1:
  print('Yes')
  
else:
  print('No')
Problem p02713 (python)

Fixed submission:
n=int(input())
 
import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
  
ans=0
for a in range(1,n+1):
    for b in range(1,n+1):
        for c in range(1,n+1):
            
            ans+=gcd(a,b,c)  
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
 
import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
  
ans=0
for a in range(1,n+1):
    for b in range(1,n+1):
        for c in range(1,n+1):
            
            ans+=gcd(a,b,c)  
print(ans)
n=int(input())

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

  
ans=0
for a in range(1,n+1):
    for b in range(1,n+1):
        for c in range(1,n+1):
            
            ans+=gcd(a,b,c)  
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
 
import math
from functools import reduce
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
  
ans=0
k=0
for a in range(1,n+1):
    for b in range(1,n+1):
      k=gcd(a,b)
        for c in range(1,n+1):
            ans+=gcd(k,c)  
print(ans)
Problem p02717 (python)

Fixed submission:
num=input()
num=num.split()

print(num[2]+" "+num[0]+" "+num[1])

Buggy submission (verdict: Runtime Error):
num1 = int(input().split())
num2 = list(map(int, input().split())    
            
num2 = sorted(num2, reverse=True)
           
N=num1[0]
M=num1[1]
A=num2[M-1]

if A<N/M/4:
    print('No')
else:
    print('Yes')

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

print(c,a,b)

Buggy submission (verdict: Runtime Error):
a,b,c=num(input(),split())
  
  print(c,a,b)
Problem p02718 (python)

Fixed submission:
n,m = map(int,input().split())
li = list(map(int,input().split()))
  
li.sort(reverse=True)
  
a=li[m-1]
b=sum(li)

if a>=b/4/m:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
num1 = int(input().split())
num2 = list(map(int, input().split())    
            
            
sorted(num2,reverse=True)            
N=num1[0]
M=num1[1]
A=num2[M-1]

if A<N/M/4:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
num1 = int(input().split())
num2 = sorted(map(int, input().split())

N=num1[0]
M=num1[1]
A=num2[M-1]

if A<N/M/4:
    print('No')
else:
    print('Yes')

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

sorted(num2, reverse=True)
N=num1[0]
M=num1[1]
A=num2[M-1]

if A<N/M/4:
    print('No')
else:
    print('Yes')

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

num2.sort(reverse=True)
N=num1[0]
M=num1[1]
A=num2[M-1]

if A<N/M/4:
    print('No')
else:
    print('Yes')

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

num2.sort(reverse=True)
N=int(num1[0])
M=int(num1[1])
A=int(num2[M-1])

if A<N/M/4:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
num1=input().split()
num2=input().split()

num2.sort(reverse=True)
N=int(num1[0])
M==int(num1[1])
A=int(num2[int(num1[1])-1])

if A<N/M/4:
    print('Yes')
    else:
    print('No')
Problem p03471 (python)

Fixed submission:
n,y = map(int,input().split())
l=0
for a in range(n+1):
  for b in range(n+1-a):
    c=n-a-b
    if y==a*10000+b*5000+c*1000 and n==a+b+c:
      i=a
      j=b
      k=c
      
      l=1
      break

if l==1:
  print(i,j,k)
else:
  print(-1,-1,-1)

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

for a in range(n+1):
  for b in range(n+1-a):
    c=n-a-b
    if y==a*10000+b*5000+c*1000 and n==a+b+c:
      i=a
      j=b
      k=c
      
      break
      
print(i,j,k)
Problem p02700 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
 
killcount_a = -(-c//b)
killcount_b = -(-a//d)
 
if killcount_a <= killcount_b:
  print("Yes")
else:
  print("No")

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

killcount_a = -(-C//B)
killcount_b = -(-A//D)

if a <= b:
  print("Yes")
else:
  print("No")
Problem p02910 (python)

Fixed submission:
s = input()
even = ['R', 'U', 'D']
odd = ['L', 'U', 'D']

for i, j in enumerate(s):
    if i % 2 == 0:
        if j not in even:
            print('No')
            break
    else:
        if j not in odd:
            print('No')
            break
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
s = input()
even = ['R', 'U', 'D']
odd = ['L', 'U', 'D']

for i, j in enumerate(s):
    if i % 2 == 0:
        if j not in odd:
            print('No')
            break
    else:
        if j not in even:
            printt('No')
            break
else:
    print('Yes')
Problem p03023 (python)

Fixed submission:
n = int(input())
print((n - 2) * 180)

Buggy submission (verdict: Runtime Error):
n = input()
print((n - 2) * 180)
Problem p03024 (python)

Fixed submission:
a = input()

b = a.count('o')

if 8 - b <= 15 - len(a):
    print('YES')
else:
    print('NO')

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

b = a.count('o')

if 8 - b <= 15 - len(s):
  print('YES')
else:
  print('NO')
Problem p03085 (python)

Fixed submission:
a = str(input())

if a == 'A':
    print('T')
elif a == 'T':
    print('A')
elif a == 'G':
    print('C')
elif a == 'C':
    print('G')

Buggy submission (verdict: Runtime Error):
a = str(input())

if a == 'A':
    print('T')
elif a == 'T'
    print('A')
elif a == 'G':
    print('C')
elif a == 'C':
    print('G')
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

Buggy submission (verdict: Runtime Error):
times, questions = [int(a) for a in input().split()]

strings = str(input())

for i in range(questions):
    for j in range(times):
        start, end = [int(a) for a in input().split()]
        moji = strings[start - 1: end]
        counts = 0
        for k in range(len(moji) - 1):
            if moji[k] == 'A' and moji[k + 1] == 'C':
                counts += 1
        print(counts)
Problem p03110 (python)

Fixed submission:
a = int(input())

btc = 0
yen = 0

for i in range(a):
    a = input().split()
    if a[1] == 'BTC':
        btc += float(a[0])
    else:
        yen += int(a[0])

btc = btc * 380000

print(float(btc + yen))

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

btc = 0
yen = 0

for i in range(a):
    a = input().split()
    if a[1] == 'BTC':
        btc += float(a[0])
    else:
        yen += int(a[0])

btc = btc * 380000

print(float(btc + yen))3
Problem p03147 (python)

Fixed submission:
a = int(input())
b = [int(i) for i in input().split()]

numbers = min(b)

b = [i - min(b) for i in b]

theend = False

while theend == False:
  
    if b.count(0) == a:
        theend = True
        break

    indexnotzero = 0

    for i in range(len(b)):
        if b[i] == 0:
            continue
        else:
            indexnotzero = i
            break

    if indexnotzero == len(b) - 1:
        numbers += b[len(b) - 1]
        break

    try:
        length = b.index(0, indexnotzero)
    except ValueError:
        length = len(b)
    minimum = min(b[indexnotzero:length])

    numbers += minimum

    b[indexnotzero:length] = [i - minimum for i in b[indexnotzero:length]]

print(numbers)

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

numbers = min(b)

b = [i - min(b) for i in b]

theend = False

while theend == False:

    indexnotzero = 0

    for i in range(len(b)):
        if b[i] == 0:
            continue
        else:
            indexnotzero = i
            break
    try:
        length = b.index(0, indexnotzero)
    except ValueError:
        length = len(b)
    minimum = min(b[indexnotzero:length])

    numbers += minimum

    b[indexnotzero:length] = [i - minimum for i in b[indexnotzero:length]]

    if b.count(0) == a:
        theend = True

print(numbers)

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

numbers = min(b)

b = [i - min(b) for i in b]

theend = False

while theend == False:

    indexnotzero = 0

    for i in range(len(b)):
        if b[i] == 0:
            continue
        else:
            indexnotzero = i
            break

    if indexnotzero == len(b) - 1:
        numbers += b[len(b) - 1]
        theend = True
        break
    try:
        length = b.index(0, indexnotzero)
    except ValueError:
        length = len(b)
    minimum = min(b[indexnotzero:length])

    numbers += minimum

    b[indexnotzero:length] = [i - minimum for i in b[indexnotzero:length]]

    if b.count(0) == a:
        theend = True

print(numbers)
Problem p03161 (python)

Fixed submission:
import numpy as np
 
 
N, K = map(int, input().split())
inputs = np.array([int(i) for i in input().split()])
 
dp = np.zeros(N, dtype=int)
for i in range(1, N):
    start = max(0, i-K)
    dp[i] = (dp[start:i] + abs(inputs[i] - inputs[start:i])).min()
 
print(dp[-1])

Buggy submission (verdict: Runtime Error):
n,k = [int(i) for i in input().split()]

steps = [int(i) for i in input().split()]
dp = [9999999] * n

dp[0] = 0

for i in range(1, n):
    start = max(0, i-k)
    dp[i] = min([dp[start+j] + abs(steps[i] - steps[start+j]) for j in range(i)])

print(dp[n - 1])

Buggy submission (verdict: Runtime Error):
n,k = [int(i) for i in input().split()]

steps = [int(i) for i in input().split()]
dp = ['inf'] * n

for i in range(1, n):
    start = max(0, i-k)
    dp[i] = (dp[start:i] + abs(steps[i] - steps[start:i])).min()

print(dp[n - 1])
Problem p03206 (python)

Fixed submission:
a = int(input())
if a == 25:
  print('Christmas')
elif a == 24:
  print('Christmas Eve')
elif a == 23:
  print('Christmas Eve Eve')
elif a == 22:
  print('Christmas Eve Eve Eve')

Buggy submission (verdict: Runtime Error):
a = int(input())
if a = 25:
  print('Christmas')
elif a = 24:
  print('Christmas Eve')
elif a = 23:
  print('Christmas Eve Eve')
elif a = 22:
  print('Christmas Eve Eve Eve')
Problem p02747 (python)

Fixed submission:
s = input()
if s == "hi" * (len(s) // 2):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()
if s == "hi" * len(s) // 2:
    print("Yes")
else:
    print("No")
Problem p02761 (python)

Fixed submission:
import sys
# スペース区切りの整数入力
N,M = map(int, input().split())

sc = {}
snum = '0' * N

for i in range(M):
    s,c = map(int, input().split())
    if s in sc:
        if c != sc[s]:
            print(-1)
            sys.exit()
    sc[s] = c

for i in sc:
    snum = snum[:i-1] + str(sc[i]) + snum[i:] 

if N == len(str(int(snum))):
    print(snum)
else:
    if 1 in sc:
        print(-1)
    else:
        print("1"+snum[1:])

Buggy submission (verdict: Runtime Error):
import sys
# スペース区切りの整数入力
N,M = map(int, input().split())

sc = {}
snum = '0' * N

for i in range(M):
    s,c = map(int, input().split())
    if s in sc:
        if c != sc[s]:
            print(-1)
            sys.exit()
    sc[s] = c

for i in sc:
    snum = snum[:i-1] + str(sc[i]) + snum[i:] 

if N == len(str(int(snum))):
    print(snum)
else:
    if 1 in sc:
        print(-1)
    else:
        print(1+snum[1:])
Problem p02782 (python)

Fixed submission:
#-----combination計算部分------
def cmb(n, r):
    #if ( r<0 or r>n ):
    #    return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6*2+2
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

#入力
r1,c1,r2,c2 = map(int, input().split())

def g(r,c):
    gsum = 0
    for i in range(1,r+2):
        gsum += cmb(i+c,c)
    return gsum
'''
sum = 0
for r in range(r1,r2+1):
    for c in range(c1,c2+1):
        sum += cmb(r+c,r)
print(sum % mod)
'''
sum2 = g(r2,c2) - g(r1-1,c2) - g(r2,c1-1) + g(r1-1,c1-1)
print(sum2 % mod)

Buggy submission (verdict: Runtime Error):
#-----combination計算部分------
def cmb(n, r):
    #if ( r<0 or r>n ):
    #    return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5*2
g1 = [1, 1] # 元テーブル
g2 = [1, 1] # 逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

#入力
r1,c1,r2,c2 = map(int, input().split())
#迷路の初期化


sum = 0
for r in range(r1,r2+1):
    for c in range(c1,c2+1):
        sum += cmb(r+c,r)

print(sum % mod)