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

Fixed submission:
import sys
MOD = 10**9 + 7
n, m = map(int, input().split())
a = [int(x) for x in sys.stdin.readlines()]
ans = [1 for i in range(n)]
for x in a:
    ans[x-1] = 0
for i in range(n):
    if i == 0 and ans[i] == 0:
        ans[0] = 0
    elif i == 1:
        if ans[i] == 1:
            ans[1] += ans[0]
        elif ans[i] == 0:
            ans[1] = 0
    elif i >= 2 and ans[i] == 1:
        ans[i] = (ans[i-1] + ans[i-2])%MOD

print(ans[-1])

Buggy submission (verdict: Runtime Error):
import sys
MOD = 10**9 + 7
n, m = map(int, input().split())
a = [int(x) for x in sys.stdin.readlines()]
ans = [0 for i in range(n)]
if 1 not in a:
    ans[0] = 1
if 2 not in a:
    ans[1] = ans[0] + 1

for i in range(2, n):
    if i+1 not in a:
        ans[i] = (ans[i-1] + ans[i-2])%MOD
    else:
        ans[i] = 0

print(ans[-1])
Problem p03018 (python)

Fixed submission:
s = input().replace("BC", "D")
ans = 0
a = 0
for i in range(len(s)):
    if s[i] == "A":
        a += 1
    elif s[i] == "D":
        ans += a
    else:
        a = 0
print(ans)

Buggy submission (verdict: Runtime Error):
def c(s, cnt):
    tmp = s.count("ABC")
    if tmp == 0:
        print(cnt)
    else:
        cnt += tmp
        s = s.replace("ABC", "BCA")
        c(s, cnt)
s = input()
ans = 0
c(s, ans)
Problem p03041 (python)

Fixed submission:
n, k = map(int, input().split())
s = input()
ans = ""
for i in range(n):
  if i == k-1: 
    ans += s[i].lower()
  else : ans += s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
s[k].lower
print(s)
Problem p03042 (python)

Fixed submission:
s = input()

if 0 < int(s[0:2]) <= 12 and 0 < int(s[2:4]) <= 12 :
  print("AMBIGUOUS")
elif (12 < int(s[0:2]) or int(s[0:2]) == 0) and  0 < int(s[2:4]) <= 12:
  print("YYMM")
elif 0 < int(s[0:2]) <= 12 and (12 < int(s[2:4]) or int(s[2:4]) == 0):
  print("MMYY")
else:
  print("NA")

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

if 0 < int(s[0:2]) <= 12 and 0 < int(s[2:4]) <= 12 :
  print("AMBIGUOUS")
elif (12 < int(s[0:2]) or int(s[0:2]) == 0) and  0 < int(s[2:4]) <= 12:
  print("YYMM")
elif 0 < int(s[0:2]) <= 12 and (12 < int(s[2:4] or int(s[2:4]) == 0):
  print("MMYY")
else:
  print("NA")
Problem p03075 (python)

Fixed submission:
n = [int(input()) for i in range(6)]
if max(n[0], n[1], n[2], n[3], n[4]) - min(n[0], n[1], n[2], n[3], n[4]) <= n[5]:
  print("Yay!")  
else:
  print(":(")

Buggy submission (verdict: Runtime Error):
n = [int(input()) for i in range(5)]
for i in range(n):
  if n[i] - n[i+1] > 0:
    print("Yay!")
  else:
    print(":(")
Problem p03108 (python)

Fixed submission:
import sys


class UnionFind:
    def __init__(self, n):
        self.table = [-1] * n

    def _root(self, x):
        stack = []
        tbl = self.table
        while tbl[x] >= 0:
            stack.append(x)
            x = tbl[x]
        for y in stack:
            tbl[y] = x
        return x

    def find(self, x, y):
        return self._root(x) == self._root(y)

    def union(self, x, y):
        r1 = self._root(x)
        r2 = self._root(y)
        if r1 == r2:
            return
        d1 = self.table[r1]
        d2 = self.table[r2]
        if d1 <= d2:
            self.table[r2] = r1
            self.table[r1] += d2
        else:
            self.table[r1] = r2
            self.table[r2] += d1


def main():
    n, m = map(int, sys.stdin.buffer.readline().split())
    uf = UnionFind(n)
    ans = [n*(n-1)//2]
    for x in reversed(sys.stdin.buffer.readlines()):
        a, b = map(int, x.split())
        a -= 1
        b -= 1
        if uf.find(a, b):
            ans.append(ans[-1])
            continue
        ba, bb = uf.table[uf._root(a)], uf.table[uf._root(b)]
        ans.append(ans[-1] - ba*bb)
        uf.union(a, b)
    ans.reverse()
    print("\n".join(map(str, ans[1:])))


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys


class UnionFind:
    def __init__(self, n):
        self.table = [-1] * n

    def _root(self, x):
        stack = []
        tbl = self.table
        while tbl[x] >= 0:
            stack.append(x)
            x = tbl[x]
        for y in stack:
            tbl[y] = x
        return x

    def find(self, x, y):
        return self._root(x) == self._root(y)

    def union(self, x, y):
        r1 = self._root(x)
        r2 = self._root(y)
        if r1 == r2:
            return
        d1 = self.table[r1]
        d2 = self.table[r2]
        if d1 <= d2:
            self.table[r2] = r1
            self.table[r1] += d2
        else:
            self.table[r1] = r2
            self.table[r2] += d1


def main():
    n, m, k = map(int, sys.stdin.buffer.readline().split())
    uf = UnionFind(n)
    fb = [0]*n
    i = 0
    for x in sys.stdin.buffer.readlines():
        if i < m:
            a, b = map(int, x.split())
            fb[a-1] += 1
            fb[b-1] += 1
            uf.union(a-1, b-1)
        else:
            c, d = map(int, x.split())
            fb[c-1] += 1
            fb[d-1] += 1
        i += 1

    ans = [-uf.table[uf._root(i)]-1-fb[i] for i in range(n)]
    print(*ans)


if __name__ == "__main__":
    main()
Problem p03250 (python)

Fixed submission:
n = list(map(int, input().split()))
n.sort()
print(n[2]*10 + n[1] + n[0])

Buggy submission (verdict: Runtime Error):
n = list(map(int, input().split()))
n.reverse()
print('n[0]n[1]' +[2])
Problem p03307 (python)

Fixed submission:
n = int(input())
if n%2 == 0:
  print(n)
else:
  print(2*n)

Buggy submission (verdict: Runtime Error):
n = int(input)
if n%2 == 0:
  print(n)
else:
  print(2*n)
Problem p03631 (python)

Fixed submission:
n = input()
if n[0] == n[2]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
if n[0] == n[2]:
  print("Yes")
else:
  print("No")
Problem p03834 (python)

Fixed submission:
s = input().split(",")
print(*s)

Buggy submission (verdict: Runtime Error):
def main():
  k, s = map(int, input().split())
  cnt = 0
  for i in range(k+1):
    for j in range(k+1):
      if 0 <= s - i - j <= k:
        cnt += 1
  print(cnt)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
k, s = map(int, input().split())
cnt = 0
for i in range(k+1):
  if i < s:
    for j in range(k+1):
      if i + j :
        for l in range(k+1):
          if i + j + l == s:
            cnt += 1
print(cnt)
Problem p02623 (python)

Fixed submission:
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

Asum=[0]
for i in A:
  if Asum[-1]+i>K:break
  Asum.append(Asum[-1]+i)
import numpy as np
Asum=np.array(Asum)
Bsum=[0]
for i in B:
  if Bsum[-1]+i>K:break
  Bsum.append(Bsum[-1]+i)
Bsum=np.array(Bsum)

maxval=len(Asum)-1

tmp=0
lenB=len(Bsum)
lenA=len(Asum)
for i in range(lenA):
  if lenA-1-i+lenB<maxval:break
  for j in range(lenB):
    j=tmp+j
    if Asum[-i-1]+Bsum[j]>K:
      maxval=max(maxval,len(Asum)-1-i+j-1)
      tmp=j
      break
    elif j==lenB-1:
      maxval=max(maxval,lenA-1-i+j)
      break
print(maxval)

Buggy submission (verdict: Runtime Error):
N,M,K=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))



Asum=[0]
for i in A:
  if Asum[-1]+i>K:break
  Asum.append(Asum[-1]+i)
    
Bsum=[0]
for i in B:
  if Bsum[-1]+i>K:break
  Bsum.append(Bsum[-1]+i)

maxval=len(Asum)-1

tmp=0
for i in range(len(Asum)):
  for j in range(len(Bsum)):
    j=tmp+j
    if Asum[-i-1]+Bsum[j]>K:
      maxval=max(maxval,len(Asum)-1-i+j-1)
      tmp=j
      break
    elif j==len(Bsum)-1:
      maxval=max(maxval,len(Asum)-1-i+j)
      
print(maxval)
Problem p02659 (python)

Fixed submission:
X,Y=input().split() 
Y=Y.replace(".","")
print(int(X)*int(Y)//100)

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

print(X*Y//1)

Buggy submission (verdict: Runtime Error):
X,Y=input().split()

print(X*Y//1)
Problem p02729 (python)

Fixed submission:
A,B=input().split(' ')
A=int(A)
B=int(B)

num=0
num+=A*(A-1)//2
num+=B*(B-1)//2
print(num)

Buggy submission (verdict: Runtime Error):
A,B=input()
A=int(A)
B=int(B)

num=0
num+=A*(A-1)//2
num+=B*(B-1)//2
print(num)
Problem p02792 (python)

Fixed submission:
N=int(input())
l=[[0]*10 for i in range(10)]


for i in range(1,N+1):
  l[int(str(i)[0])][int(str(i)[-1])]+=1

ans=0
for i in range(10):
  for j in range(10):
    ans+=l[i][j]*l[j][i]
  
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
l=[0]*10

for i in range(1,N+1):
  if str(i[0])==str(i[-1]):
    l[int(str(i[0]))]+=1

ans=0
for i in range(l):
  ans+=i*i
print(ans)
Problem p02862 (python)

Fixed submission:
X,Y=sorted(list(map(int,input().split())))
#移動方法を(i+1,j),(i,j+1)となるようにどうにかする
if (X-abs(Y-X))%3!=0 or X*2<Y:
  print(0)
  exit(0)
n=(X-abs(Y-X))//3
X=n+abs(Y-X)
Y=n

  
mod=10**9+7
a=1
for i in range(1,X+Y+1):
  a*=i
  a%=mod
b=1
for i in range(1,X+1):
  b*=i
  b%=mod
c=1
for i in range(1,Y+1):
  c*=i
  c%=mod

print(a*pow(b,-1,mod)*pow(c,-1,mod)%mod)

Buggy submission (verdict: Runtime Error):
X,Y=sorted(list(map(int,input().split())))
#移動方法を(i+1,j),(i,j+1)となるようにどうにかする
if (X-abs(Y-X))%3!=0:
  print(0)
  exit(0)
n=(X-abs(Y-X))//3
X=n+abs(Y-X)
Y=n

  
mod=10**9+7
a=1
for i in range(1,X+Y+1):
  a*=i
  a%=mod
b=1
for i in range(1,X+1):
  b*=i
  b%=mod
c=1
for i in range(1,Y+1):
  c*=i
  c%=mod
print(a*pow(b,-1,mod)*pow(c,-1,mod)%mod)
Problem p03038 (python)

Fixed submission:
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
CB=[]
for i in range(M):
  B,C=map(int,input().split())
  CB.append([C,B])
CB.sort(reverse=True)

idx=0
for C,B in CB:
  for i in range(B):
    if not idx>=len(A) and A[idx]<C:
      A[idx]=C
      idx+=1
    else:
      break
print(sum(A))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
CB=[]
for i in range(M):
  B,C=map(int,input().split())
  CB.append([C,B])
CB.sort(reverse=True)

idx=0
for C,B in CB:
  for i in range(B):
    if A[idx]<C:
      A[idx]=C
      idx+=1
    else:
      break
print(sum(A))
Problem p02736 (python)

Fixed submission:
#dpでできないかな？
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,cos,radians,sqrt
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
s=list(map(int,SI()))
if n==1:
    print(s[0])
    sys.exit()

def divi2(x):
    if x%2==1:
        return 0
    else:
        count=0
        while x%2==0:
            x//=2
            count+=1
        return count
#print(divi2(24))
pw2=[0 for i in range(n-1)]
for i in range(n-1):
    if i%2==1:
        pw2[i]=divi2(i+1)
#print(pw2)
#print(s)
cmbnk2=[0 for i in range(n)]
for i in range(n-1):
    cmbnk2[i+1]=cmbnk2[i]+pw2[n-2-i]-pw2[i]
#print(cmbnk2)
ans=0
'''if (s.count(1)==1 and not 2 in s ) or (s.count(3)==1 and not 2 in s ):
    ans=2
    print(ans)
    sys.exit()'''
if not 2 in s:
    for i in range(n):
        s[i]=(s[i]-1)//2
    for i in range(n):
        if cmbnk2[i]==0:
            ans+=s[i]%2
    if ans%2==0:
        print(0)
    else:
        print(2)
    sys.exit()
    
        
else:
    for i in range(n):
        if cmbnk2[i]==0:
            ans+=s[i]%2
            #print(s[i]%2)
        #print(cmbnk2[i]%2+1)
        #print(s[i])
print(ans%2)

Buggy submission (verdict: Runtime Error):
H,W = map(int,input().split())

s = []

for i in range(H):

    S = list(input())
    s.append(S)

dis = [[float("inf")] * W for i in range(H)]

if s[0][0] == "#":
    dis[0][0] = 1
else:
    dis[0][0] = 0

for i in range(H):

    for j in range(W):

        if i != H-1:

            if s[i][j] == "." and s[i+1][j] == "#":

                dis[i+1][j] = min(dis[i][j] + 1,dis[i+1][j])

            else:
                dis[i+1][j] = min(dis[i][j],dis[i+1][j])

        if j != W-1:
            if s[i][j] == "." and s[i][j+1] == "#":

                dis[i][j+1] = min(dis[i][j] + 1,dis[i][j+1])

            else:
                dis[i][j+1] = min(dis[i][j],dis[i][j+1])

print (dis[-1][-1])
Problem p02819 (python)

Fixed submission:
x=int(input())
i=2
cond="notyet"
while cond=="notyet":
    count=0
    for i in range(2,x):
        ex=x%i
        if  ex!=0:
            count+=1
    if count==x-2:
        ans=x
        cond="discovered"
    else:
        x=x+1
print(ans)

Buggy submission (verdict: Runtime Error):
import sympy
x=int(input())
ans=sympy.nextprime(x)
print(ans)

Buggy submission (verdict: Runtime Error):
x=int(input())
from sympy import nextprime
print(nextprime(x))
Problem p02897 (python)

Fixed submission:
number = int(input())
if number%2 ==0:
  child = number/2
elif number%2==1:
  child = (number+1)/2
value =child/number
print(value)

Buggy submission (verdict: Runtime Error):
number =int(input())
orders =input().rstrip().split(" ")
studentnumbers =[]

for j in range(number):
  for i in range(len(orders)):
    if int(orders[i])==j+1:
      studentnumbers.append(i+1)
      print(i+1 ,end=" ")
Problem p02933 (python)

Fixed submission:
index = int(input())
message =input()
if index>=3200:
  print(message)
else:
  print("red")

Buggy submission (verdict: Runtime Error):
repeat =int(input())
numbers =input().rstrip().split(" ")
#print(numbers)
sum =0
for i in range(repeat):
  sum =sum +1/int(numbers[i])
#print(sum)
answer =1/sum
print(answer)
Problem p03426 (python)

Fixed submission:
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

h,w,d=MI()
mp=[LI() for i in range(h)]
lis=[[0,0] for i in range(w*h)]
for i in range(h):
    for j in range(w):
        lis[mp[i][j]-1]=[i,j]
#print(lis)

costs=[0 for i in range(h*w+1)]
for i in range(1,d+1):
    for j in range(0,h*w):
        if i+d*(j+1)<h*w+1:
            costs[i+d*(j+1)]=costs[i+d*j]+abs(lis[i+d*(j+1)-1][1]-lis[i+d*j-1][1])+abs(lis[i+d*(j+1)-1][0]-lis[i+d*j-1][0])
        else:
            break
q=I()
for i in range(q):
    l,r=MI()
    u=l%d
    print(costs[r]-costs[l])

Buggy submission (verdict: Runtime Error):
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

h,w,d=MI()
mp=[LI() for i in range(h)]
lis=[[0,0] for i in range(w*h+1)]
for i in range(h):
    for j in range(w):
        lis[mp[i][j]]=[i,j]
#print(lis)
cost=[[0]*(h*w) for i in range(d)]
for i in range(d):
    cost[i][i]=0
    for j in range(1,h*w):
        if i+d*j<h*w:
            cost[i][i+d*j]=cost[i][i+d*j-d]+abs(lis[i+d*j][0]-lis[i+d*(j-1)][0])+abs(lis[i+d*j][1]-lis[i+d*(j-1)][1])
            
        
#print(cost)
q=I()
for i in range(q):
    ans=0
    l,r=MI()
    k=l%d
    print(cost[k][r]-cost[k][l])
Problem p02623 (python)

Fixed submission:
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
for i in range(1,n):
    a[i] += a[i-1]
for i in range(1,m):
    b[i] += b[i-1]
a = [0]+a
b = [0]+b

ans = 0
ALL = 0
from bisect import bisect
for i in range(n+1):
    ALL = a[i]
    if ALL > k:
        continue
    else:
        idx = bisect(b,k-ALL)
    #print(i,ALL,idx)
        ans = max(ans,i+idx-1)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
for i in range(1,n):
    a[i] += a[i-1]
for i in range(1,m):
    b[i] += b[i-1]
a = [0]+a
b = [0]+b

ans = 0
ALL = 0
j = m
B = b[j-1]

for i in range(n+1):
    ALL = a[i]
    if ALL > k:
        continue
    else:
        while k-ALL <= B :
            B =b[j-1]
            j -=1

    ans = max(ans,i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
for i in range(1,n):
    a[i] += a[i-1]
for i in range(1,m):
    b[i] += b[i-1]
a = [0]+a
b = [0]+b

ans = 0
ALL = 0
from bisect import bisect
for i in range(n+1):
    ALL = a[i]
    if ALL > k:
        continue
    else:idx = bisect(b,k-ALL)
    #print(i,ALL,idx)
        ans = max(ans,i+idx-1)
print(ans)
Problem p02659 (python)

Fixed submission:
a,b = input().split()
a = int(a)
b = b.replace(".","")
print(a*int(b)//100)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
c = b*100
print(a*c//100)
Problem p02699 (python)

Fixed submission:
S,W = map(int,input().split())
#L = list(map(int,input()split()))
if W >= S:
    print("unsafe")
else:
    print("safe ")

Buggy submission (verdict: Runtime Error):
S,W = map(int,input()split())
#L = list(map(int,input()split()))
if W >= S:
    print("unsafe")
else:
    print("safe ")
Problem p02881 (python)

Fixed submission:
n = int(input())
#a,b = map(int,input().split())
#li = list(map(int,input().split()))
li = []
for i in range(1,int(n**0.5//1)+1):
    if n%i == 0:
        li.append(i+n//i-2)
        #print(i,n//i)
if len(li)!=0:
    print(min(li))
else:
    print(n-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = n** 0.5
if n%a == 0:
    print(int(2*a)-2)
else:
    while n%a != 0:
        a = a//1-1 
        if n%a == 0:
            print(int(a + n//a-2))
            exit()
Problem p02912 (python)

Fixed submission:
a,b = map(int,input().split())
li = [-int(x) for x in input().split()]
import heapq
heapq.heapify(li)
for i in range(b):
    c = heapq.heappop(li)
    heapq.heappush(li,c/2)
li = [int(x) for x in li]
print(-sum(li))

Buggy submission (verdict: Runtime Error):
import numpy as np
n, m = map(int,input().split())
L = list(map(int,input().split()))
a = np.array(L)
y_count = m
while y_count > 0:
    memo = np.argmax(a)
    a[memo] //= 2
    y_count -= 1
print(np.sum(a))
Problem p02948 (python)

Fixed submission:
import heapq
n,m = map(int,input().split())
dp = [0]*(n+1)
L = []
days = []
cost = []
for i in range(n):
    a,b = map(int,input().split())
    if a > m:
        continue
    L.append([a,b])

L.sort(reverse = True)

ans = 0
li = []
for i in range(1,m+1):
    while L and L[-1][0] <= i:
        (a,b) = L.pop()
        heapq.heappush(li,b*(-1))

    if li:
        h = heapq.heappop(li)
        ans +=(-1)*h

print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
dp = [0]*(n+1)
L = []
for i in range(n):
    a,b = map(int,input().split())
    L.append([a,b])

L.sort(key = lambda x:x[1],reverse = True)
#print(L)
cnt =0
cost = 0
for i in range(n):
    if 0 <=L[i][0] <=m and dp[i] !=1:
        dp[m - L[i][0]] = 1
        cost +=L[i][1]
print(cost)
Problem p02951 (python)

Fixed submission:
a,b,c = map(int,input().split())
if c>a-b:
    print(c-a+b)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input())
print(min(c-(a-b),0))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input())
print(min(c-(a-b),0)
Problem p02970 (python)

Fixed submission:
n,d=map(int, input().split())
if n%(2*d+1) == 0:
    print(n//(2*d+1))
else:
    print(n//(2*d+1)+1)

Buggy submission (verdict: Runtime Error):
n,d = map(int,input()split())
if n%(2*d+1) == 0:
  print(n%(2*d+1))
else:
  print(n%(2*d+1)+1)
Problem p03013 (python)

Fixed submission:
n,m = map(int,input().split())
li = [int(input()) for i in range(m)]

st = [1]*(n+1)
for i in range(m):
    st[li[i]-1] = 0

if st[0] == 0 and st[1] == 0:
    print(0)
    exit()
elif st[0] == 0 and st[1] != 0:
    st[1] = 1
elif st[0] == 1 and st[1] != 0:
    st[1] = 2

for i in range(2,n+1):
    if st[i] == 0:
        continue
    else:
        st[i] = (st[i-1] + st[i-2])%1000000007
print(st[n-1])

Buggy submission (verdict: Runtime Error):
n,m,*L = map(int,open(0).read().split())
mod = 10**9+7

dp = [0]*(n)
if 1 in L:
    dp[0] = 0
    dp[1] = 1
elif 1 not in L:
    dp[0] = 1
    dp[1] = 2

for i in range(2,n):
    if i+1 in L:
        continue
    dp[i] = (dp[i-1] + dp[i-2])%mod
    
print(dp[n-1])
Problem p03075 (python)

Fixed submission:
li = list(int(input()) for i in range(5))
#print(li)
k = int(input())

li1 = [(x - y) for x in li for y in li if x>y]
#print(li1)
if all(li1[i]<=k for i in range(len(li1))):
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
X,Y,Z,K = map(int, input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
     
a.sort(reverse = True)
b.sort(reverse = True)
c.sort(reverse = True)
     
li = []
for i in range(len(a)):
    for j in range(len(b)):
        li.append(a[i]+b[j])
    
li.sort(reverse = True)
     
li1 = []
for i in range(len(li)):
    for j in range(len(c)):
        li1.append(li[i]+c[j])
        if j > k:
          break
li1.sort(reverse = True)
n = 1
while n < K+1:
    print(li1[n-1])
    n += 1
Problem p03127 (python)

Fixed submission:
from fractions import gcd
from functools import reduce
n = int(input())
li = list(map(int,input().split()))
print(reduce(gcd,li))

Buggy submission (verdict: Runtime Error):
from  math import gcd
from functools import reduce
n = int(input())
li = list(map(int,input().split()))
print(reduce(gcd,li))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
n = int(input())
li = list(map(int,input().split()))
print(reduce(math.gcd,li))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
n = int(input())
li = list(map(int,input().split())
print(reduce(math.gcd,li))
Problem p03242 (python)

Fixed submission:
s = input()

a = ""
for i in range(len(s)):
  if s[i] == str(1):
    a += str(9)
  elif s[i] == str(9):
    a += str(1)
print(a)

Buggy submission (verdict: Runtime Error):
s = input()
a = ""
for i in range(len(s)):
  if i == 1:
    a += 9
  elif i == 9:
    a += 1
print(a)
Problem p03723 (python)

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

if any((a%2==1,b%2==1,c%2==1)):
    print(0)
    exit()
    
cnt = 0
while cnt <= 100:
    a,b,c = (b+c)/2, (a+c)/2,(a+b)/2
    cnt += 1
    if any((a%1!=0,b%1!=0,c%1!=0)):
        print(cnt-1)
        exit()
print(-1)

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

if any((a%2==1,b%2!==1,c%2==1)):
    print(0)
    exit()
    
cnt = 0
while cnt <= 100:
    a,b,c = (b+c)/2, (a+c)/2,(a+b)/2
    cnt += 1
    if any((a%1!=0,b%1!=0,c%1!=0)):
        print(cnt-1)
        exit()
print(-1)