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

Fixed submission:
from sys import stdin

# 標準入力から読み込み
inputs = [int(x) for x in stdin.readline().rstrip().split()]

# output = input[0] * input[1]
print(inputs[0] * inputs[1])

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

# 標準入力から読み込み
inputs = [list(map(int, input().split())) for _ in range(2)]
inputs = inputs[1]

if (0 in inputs):
  output = 0
else:
  output = reduce((lambda x, y: -1 if (x * y) > 1e18 or x < 0 or y < 0  else (x * y)), inputs)

print(output)

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

# 標準入力から読み込み
inputs = [list(map(int, input().split())) for _ in range(2)]
inputs = inputs[1]

if (0 in inputs):
  output = 0
else:
  output = reduce((lambda x, y: -1 if (x * y) > 1e18 or x < 0 or y < 0  else (x * y)), inputs)

print(output)
Problem p02658 (python)

Fixed submission:
from sys import stdin
from functools import reduce 

# 標準入力から読み込み
inputs = [list(map(int, input().split())) for _ in range(2)]
inputs = inputs[1]

if (0 in inputs):
  output = 0
else:
  output = reduce((lambda x, y: -1 if (x * y) > 1e18 or x < 0 or y < 0  else (x * y)), inputs)

print(output)

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

# 標準入力から読み込み
inputs = [list(map(int, input().split())) for _ in range(2)]
inputs = inputs[1]

if (0 in inputs):
  output = 0
else:
  output = reduce((lambda x, y: -1 if (x * y) <= 1e18 or x < 0 or y < 0  else (X * y)), inputs)

print(output)
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
total=a*b
if total%2==0:
    print('Even')
else:
    print('Odd')

Buggy submission (verdict: Runtime Error):
a=int(input('a='))
b=int(input('b='))
total=a*b
if total%2==0:
    print('Even')
else:
    print('Odd')

Buggy submission (verdict: Runtime Error):
while True:
    a=int(input('a='))
    b=int(input('b='))
    total=a*b
    if total%2==0:
        print('Even')
    else:
        print('Odd')

Buggy submission (verdict: Runtime Error):
while True:
    a=int(input('a='))
    b=int(input('b='))
    total=a*b
    if total%2==0:
        print('even')
    else:
        print('odd')
Problem p03147 (python)

Fixed submission:
"""
4
1 2 2 1

2


5
3 1 2 3 1

5


8
4 23 75 0 23 96 50 100

221
"""

_ = int(input())
first = list(map(int, input().split()))
count = 0


def water(base_list):
    global count
    count += 1
    separated = []
    each = []
    for i in base_list:
        hoge = i - 1
        if hoge == 0:
            separated.append(each)
            each = []
        else:
            each.append(hoge)
    if each:
        separated.append(each)

    new_separated = []
    for i in separated:
        if i:
            new_separated.append(i)

    if new_separated:
        for i in new_separated:
            water(i)
    else:
        return


def plus_one(i):
    return i + 1


first = list(map(plus_one, first))


water(first)

print(count - 1)

Buggy submission (verdict: Runtime Error):
"""
4
1 2 2 1

2


5
3 1 2 3 1

5
"""

_ = int(input())
first = list(map(int, input().split()))
count = 0


def water(base_list):
    global count
    count += 1
    separated = []
    each = []
    for i in base_list:
        if i - 1 == 0:
            separated.append(each)
            each = []
        else:
            each.append(i-1)
    if each:
        separated.append(each)

    new_separated = []
    for i in separated:
        if i:
            new_separated.append(i)

    if new_separated:
        for i in new_separated:
            water(i)
    else:
        return


water(first)

print(count)
Problem p03448 (python)

Fixed submission:
arr = [input() for i in range(4)]

count = 0
for fi in range(0, int(arr[0])+1):
    for hun in range(0, int(arr[1])+1):
        for fifty in range(0, int(arr[2])+1):
            sum = fi * 500 + hun * 100 + fifty * 50
            if sum == int(arr[3]):
                count += 1
print(count)

Buggy submission (verdict: Runtime Error):
arr = [input() for i in range(4)]

count = 0
for fi in range(0, arr[0]):
    for hun in range(0, arr[1]):
        for fifty in range(0, arr[2]):
            sum = int(fi) * 500 + int(hun) * 100 + int(fifty) * 50
            if sum == arr[3]:
                count += 1
print(count)

Buggy submission (verdict: Runtime Error):
arr = [input() for i in range(4)]

count = 0
for fi in range(0, arr[0]):
    for hun in range(0, arr[1]):
        for fifty in range(0, arr[2]):
            sum = int(fi) * 500 + int(hun) * 100 + int(fifty) * 50
            if sum == arr[3]:
                count += 1
print(count)
Problem p03455 (python)

Fixed submission:
list = input().split()
a = int(list[0])
b = int(list[1])

if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
list = input().split()
a = int(list[0])
b = int(list[1])

if a * b % 2 == 0:
  print(Even)
else:
  print(Odd)

Buggy submission (verdict: Runtime Error):
list = input().split()
a = list[0]
b = list[1]

if a * b % 2 == 0:
  print(Even)
else:
  print(Odd)

Buggy submission (verdict: Runtime Error):
a, b = input().split(' ')

if a * b % 2 == 0:
  print(Even)
else:
  print(Odd)
Problem p02658 (python)

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

if 0 in li:
  print(0)
else:
  result = 1
  flag = True
  for i in range(n):
    result *= li[i]
    if result > 10 ** 18:
      flag = False
      print(-1)
      break
  if flag == True:
    print(result)

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

if 0 in li:
  print(0)
else:
  result = 1
  flag = True
  for i in range(n):
    result *= li[i]
    if result > 10 ** 18:
      flag = False
      print(-1)
      break
if flag == True:
  print(result)
Problem p02677 (python)

Fixed submission:
import math
jishin, hunshin, hour, minute = map(float, input().split())

x_ji = jishin * math.cos(math.radians((hour + minute / 60) * 360 / 12))
y_ji = jishin * math.sin(math.radians((hour + minute / 60) * 360 / 12))
x_hun = hunshin  * math.cos(math.radians(minute * 360 / 60))
y_hun = hunshin  * math.sin(math.radians(minute * 360 / 60))

kyori = math.sqrt((x_ji - x_hun) ** 2 + (y_ji - y_hun) ** 2)
print(kyori)

Buggy submission (verdict: Runtime Error):
import math
jishin, hunshin, hour, minute = map(float, input().split())

x_ji = jishin * math.cos(math.radian(hour * 360 / 12))
y_ji = jishin * math.sin(math.radian(hour * 360 / 12))
x_hun = hunshin  * math.cos(math.radian(minute * 360 / 60))
y_hun = hunshin  * math.sin(math.radian(minute * 360 / 60))

kyori = math.sqrt((x_ji - x_hun) ** 2 + (y_ji - y_hun) ** 2)
print(kyori)

Buggy submission (verdict: Runtime Error):
import math
jishin, hunshin, hour, minute = map(float, input().split())

x_ji = jishin * math.cos(math.radian(hour * 360 / 12))
y_ji = jishin * math.sin(math.radian(hour * 360 / 12))
x_hun = hunshin  * math.cos(math.radian(minute * 360 / 60))
y_hun = hunshin  * math.sin(math.radian(minute * 360 / 60))

kyori = math.sqrt((x_ji - x_hun) ** 2 - (y_ji - y_hun) ** 2)
print(kyori)
Problem p02658 (python)

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

ans = 1
if 0 in A:
  print(0)
  exit()
  
for r in A:
  ans *= r
  if ans > 1e18:
      print(-1)
      exit()
      
print(ans)

Buggy submission (verdict: Runtime Error):
a = [int(map(int, input.split())) for i in range(n)]
a1 = a[0]
a2 = a[1]
ans = 1
for r in range(a[0]):
  ans *= a2[r]
print(ans)

Buggy submission (verdict: Runtime Error):
a = list(map(int, input(),split()))
ans = 1

for r in range(0,len(a)):
  ans *= a[r]
  
print(ans)
Problem p02658 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
  print(0)
  exit(0)
ans = 1
for i in A:
  ans *= i
  if ans > 10 ** 18:
    print(-1)
    exit(0)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
  print(-1)
  exit(0)
ans = 1
for i in A:
  ans *= i
  if ans >= 10 ** 18:
    print(-1)
	exit(0)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
  print(-1)
  exit()
ans = 1
for i in A:
  ans *= i
  if ans >= 10 ** 18:
    print(-1)
	exit()
print(ans)
Problem p02807 (python)

Fixed submission:
import sys

sys.setrecursionlimit(1000000)
input = lambda : sys.stdin.readline().rstrip()

def pow_mod(x, y, mod):
    tmp = x
    ret = 1
    while y > 0:
        if y % 2 == 1:
            ret = ret * tmp % mod
        tmp = tmp * tmp % mod
        y //= 2
    return ret

def inverse(x, mod):
    return pow_mod(x, mod - 2, mod)

N = int(input())
x = list(map(int, input().split()))

MOD = 1000000007

def factorial(x):
    if x <= 1:
        return 1
    else:
        return x * factorial(x - 1) % MOD

f = factorial(N - 1)

h = [0]
for _ in range(N):
    h.append((h[-1] + f * inverse(len(h), MOD)) % MOD)

ans = 0
for i in range(N - 1):
    ans += h[i + 1] * (x[i + 1] - x[i])
    ans %= MOD

print(ans)

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(100000)
input = lambda : sys.stdin.readline().rstrip()

def pow_mod(x, y, mod):
    tmp = x
    ret = 1
    while y > 0:
        if y % 2 == 1:
            ret = ret * tmp % mod
        tmp = tmp * tmp % mod
        y //= 2
    return ret

def inverse(x, mod):
    return pow_mod(x, mod - 2, mod)

N = int(input())
x = list(map(int, input().split()))

MOD = 1000000007

def factorial(x):
    if x <= 1:
        return 1
    else:
        return x * factorial(x - 1) % MOD

f = factorial(N - 1)

h = [0]
for _ in range(N):
    h.append((h[-1] + f * inverse(len(h), MOD)) % MOD)

ans = 0
for i in range(N - 1):
    ans += h[i + 1] * (x[i + 1] - x[i])
    ans %= MOD

print(ans)

Buggy submission (verdict: Runtime Error):
import sys

input = lambda : sys.stdin.readline().rstrip()

def pow_mod(x, y, mod):
    tmp = x
    ret = 1
    while y > 0:
        if y % 2 == 1:
            ret = ret * tmp % mod
        tmp = tmp * tmp % mod
        y //= 2
    return ret

def inverse(x, mod):
    return pow_mod(x, mod - 2, mod)

N = int(input())
x = list(map(int, input().split()))

MOD = 1000000007

def factorial(x):
    if x <= 1:
        return 1
    else:
        return x * factorial(x - 1) % MOD

f = factorial(N - 1)

h = [0]
for _ in range(N):
    h.append((h[-1] + f * inverse(len(h), MOD)) % MOD)

ans = 0
for i in range(N - 1):
    ans += h[i + 1] * (x[i + 1] - x[i])
    ans %= MOD

print(ans)
Problem p02814 (python)

Fixed submission:
import sys
import math

def gcd(x, y):
    if x < y:
        return gcd(y, x)
    if y == 0:
        return x
    return gcd(y, x % y)

sys.setrecursionlimit(1000000)
input = lambda: sys.stdin.readline().rstrip()

N, M = map(int, input().split())
a = list(map(lambda x : int(x) // 2, input().split()))
lcm = 1
for i in a:
    lcm = lcm * i // gcd(lcm, i)
ok = True
for i in a:
    if lcm // i % 2 == 0:
        ok = False

if not ok:
    print(0)
else:
    print((M // lcm - 1) // 2 + 1)

Buggy submission (verdict: Runtime Error):
import sys
import math

sys.setrecursionlimit(1000000)
input = lambda: sys.stdin.readline().rstrip()

N, M = map(int, input().split())
a = list(map(lambda x : int(x) // 2, input().split()))
lcm = 1
for i in a:
    lcm = lcm * i // math.gcd(lcm, i)
ok = True
for i in a:
    if lcm // i % 2 == 0:
        ok = False

if not ok:
    print(0)
else:
    print((M // lcm - 1) // 2 + 1)
Problem p02995 (python)

Fixed submission:
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *
from fractions import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

A, B, C, D = map(int, input().split())
ans = B // C + B // D - B // (C * D // gcd(C, D))
ans -= (A - 1) // C + (A - 1) // D - (A - 1) // (C * D // gcd(C, D))
print(B - A + 1 - ans)

Buggy submission (verdict: Runtime Error):
import sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *

sys.setrecursionlimit(100000000)
input = lambda: sys.stdin.readline().rstrip()

A, B, C, D = map(int, input().split())
ans = B // C + B // D - B // (C * D // gcd(C, D))
ans -= (A - 1) // C + (A - 1) // D - (A - 1) // (C * D // gcd(C, D))
print(B - A + 1 - ans)
Problem p03261 (python)

Fixed submission:
N = int(input())
W = [input() for _ in range(N)]
print('Yes' if len(W) == len(set(W)) and all(i[-1] == j[0] for i, j in zip(W, W[1:])) else 'No')

Buggy submission (verdict: Runtime Error):
print('Yes' if len(W) == len(set(W)) and all(i[-1] == j[0] for i, j in zip(W, W[1:])) else 'No')
Problem p02677 (python)

Fixed submission:
import math
#minH=6deg/min
#HrH=30deg/hr=0.5degree/min
    ##angle by minH=6*M
    ##angle by HrH=30*H
    ##angle=abs(minH-HrH)
A,B,H,M=map(int,input().strip().split())
minH=6*M
HrH=0.5*(H*60+M)
Ang=abs(HrH-minH)
#print(math.cos((math.pi/180)*Ang))
Ans=math.sqrt(A**2+B**2-2*A*B*math.cos((math.pi/180)*Ang))
Ans=str(Ans)
if "." in Ans:
    intg=Ans.split(".")[0]
    decimal=Ans.split(".")[1]
    if len(decimal)<9:
      print(intg+"."+decimal+"0"*(9-len(decimal)))
    else:
      print(intg+"."+decimal[:9])
else:
   print(Ans+"."+"0"*9)

Buggy submission (verdict: Runtime Error):
import math
#minH=6deg/min
#HrH=30deg/hr=0.5degree/min
##angle by minH=6*M
##angle by HrH=30*H
##angle=abs(minH-HrH)
A,B,H,M=map(int,input().strip().split())
minH=6*M
HrH=0.5*(H*60+M)
Ang=abs(HrH-minH)
Ans=math.sqrt(A**2+B**2-2*A*B*math.cos((2*math.pi/180)*Ang))
Ans=str(Ans)
if "." in Ans:
  intg=Ans.split(".")[0]
  decimal=Ans.split(".")[1]
  if len(decimal)<9:
    	print(intg+"."+decimal+"0"*(9-len(decimal))
  else:
        print(intg+"."+decimal[:9])
else:
  print(Ans+"."+"0"*9)
Problem p02678 (python)

Fixed submission:

from collections import defaultdict
N,M=map(int,input().strip().split())
G=defaultdict(list)
for i in range(M):
  u,v=map(int,input().strip().split())
  G[u].append(v)
  G[v].append(u)
dist=[]
for i in range(N+1):
    dist.append([0,-1])
valid=False
Q=[1]
visited=[False]*(N+1)
visited[1]=True
while(len(Q)!=0):
  top=Q[0]
  Q.pop(0)
  for u in G[top]:
    if not visited[u]:
      Q.append(u)
      dist[u][0]=1+dist[top][0]
      dist[u][1]=top
      visited[u]=True
for pair in dist[2:]:
  if pair[0]==-1:
    valid=True
    print("No")
if not valid:
  print("Yes")
  for pair in dist[2:]:
    print(pair[1])

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
N,M=map(int,input().strip().split())
G=defaultdict(list)
for i in range(M):
  u,v=map(int,input().strip().split())
  G[u].append(v)
  G[v].append(V)
dist=[(-1,parent)]*(N+1)
valid=False
Q=[1]
visited=[False]*(N+1)
while(len(Q)!=0):
  top=Q[0]
  Q.pop(0)
  for u in G[top]:
    if not visited[u]:
      Q.append(u)
      dist[u][0]=1+dist[top][0]
      dist[u][1]=top
      visited[u]=True
for pair in dist[1:]:
  if pair[0]==-1:
    valid=True
    print("No")
    return 
if not valid:
  print("Yes")
  for pair in dist[1:]:
    print(pair[1])
Problem p02681 (python)

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

Buggy submission (verdict: Runtime Error):
S=input()
T=input()
if S == T[:len(T)-1]:
  print("Yes")
 else:
  print("No")
Problem p02658 (python)

Fixed submission:
from sys import stdin
import sys

n = stdin.readline().rstrip().split()
a = stdin.readline().rstrip().split()

if '0' in a:
    print(0)
    sys.exit()

total = 1
for i in a:
    total = total*int(i)

    if(total > 1000000000000000000):
        print(-1)
        sys.exit()

print(total)

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

n = stdin.readline().rstrip().split()
a = stdin.readline().rstrip().split()

total = 1
for i in a:
    total = total*int(i)
	if(total > 1000000000000000000):
      total = -1
      break
    
print(total)
Problem p02658 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
if (0 in a):
  print(0)
  exit()
MAX = 10 ** 18
ans = 1
for i in range(len(a)):
  ans *= a[i]
  if (ans > MAX):
    print(-1)
    exit()
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
if (a.include(0)):
  print(0)
  exit()
MAX = 10 ** 18
ans = 1
for i in range(len(a)):
  ans *= a[i]
  if (ans > MAX):
    print(-1)
    exit()
print(ans)
Problem p02658 (python)

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

if 0 in a:
    print(0)
    exit()
ans = 1
for i in a:
    ans *= i
    if ans > 10**18:
        ans = -1
        break
print(ans)

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

if 0 in a:
    print(0)
    return
ans = 1
for i in a:
    ans *= i
    if ans > 10**18:
        ans = -1
        break
print(ans)

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

if 0 in a:
    print(0)
    return
ans = 1
for i in a:
    ans *= i
    if ans >1000000000000000000:
        print(-1)
        return
print(ans)

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

if 0 in a:
    print(0)
    return
ans = 1
for i in a:
    ans *= i
    if ans >1000000000000000000:
        print(-1)
        return
    print(ans)
Problem p02700 (python)

Fixed submission:
import math
A, B, C, D = map(int,input().split())
hpa = math.ceil(A / D)
hpb = math.ceil(C / B)
if (hpa >= hpb):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int,input().split())
hpa = math.ceil(A / D)
hhb = math.ceil(C / B)
if (hpa >= hpb):
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
A, B, C, D = map(int,input().split())
hpa = A
hhb = C
while(1):
    hpb -= B
    if(hpb <= 0):
        print('Yes')
        break
    hpa -= D
    if(hpa <= 0):
        print('No')
        break
Problem p02783 (python)

Fixed submission:
H, A = map(int,input().split())

if(H % A != 0):
    print(H // A + 1)
else:
    print(H // A)

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

if(h % A != 0):
    print(H // A + 1)
else:
    print(H // A)
Problem p02909 (python)

Fixed submission:
s = input()
l = ["Sunny","Cloudy","Rainy","Sunny"]
for i in range(3):
  if s==l[i]:
     print(l[i+1])

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

if(s = 'Sunny'):
    print('Cloudy')
elif(s = 'Cloudy'):
    print('Rainy')
else:
    print('Sunny')
Problem p02934 (python)

Fixed submission:
n = int(input())

a = map(int,input().split())
ans = 0
for i in a:
    ans += 1/i
print(1 / ans)

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

a = map(list(int,input().split()))
ans = 0
for i in a:
    ans += i
print(1 / ans)
Problem p02658 (python)

Fixed submission:
def main ():
  N = int(input())
  A = list(map(int,input(). split ()))
  if 0 in A:
    print(0)
    return
  prod = 1
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      return
    
  print(prod)
main ()

Buggy submission (verdict: Runtime Error):
def main ():
N = int(input())
A = list(map(int,input(). split ()))
if 0 in A:
print(0)
return
prod = 1
for a in A:
prod *= a
if prod > 1000000000000000000:
print(-1)
return
print(prod)
main ()

Buggy submission (verdict: Runtime Error):
def main():
  n=int(input())
  arr=list(map(int,input.split()))
  prod=1
  for i in range(0,n):
    prod*=arr[i]
    if(prod>=1000000000000000000):
      print(-1)
      return
    
  print(prod)

  
main()

Buggy submission (verdict: Runtime Error):
def cal():
  n=int(input())
  arr=list(map(int,input.split()))
  prod=1
  for i in range(0,n):
    prod*=arr[i]
    if(prod>=1000000000000000000):
      print(-1)
      return
  print(prod)
  return

cal()
Problem p02658 (python)

Fixed submission:
input()
ans = 1
n = int(1e18)
a = list(map(int, input().strip().split()))
for i in a:
    ans *= i
    if ans > n:
        ans = -1
        break
if 0 in a: ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
input()
ans = 1
n = int(1e18)
a = list(map(int, input().strip().split()))
for i in a:
    ans *= i
    if ans > n:
        ans = -1
        break
if 0 in ans: ans = 0
print(ans)
Problem p02972 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().strip().split()))
a=[0]*n
for i in range(n-1,-1,-1):
  c=0
  for j in range(i,n,i+1):
    c ^= a[j]
  if c != v[i]:
    a[i] = 1
ans = []
for i in range(n):
  if a[i]: ans.append(i+1)
print(len(ans))
print(*ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().strip().split()))
a=[0]*n
for i in range(n-1,-1,-1):
  c=0
  for j in range(i,n,i):
    c ^= a[j]
  if c != v[i]:
    a[i] = 1
ans = []
for i in range(n):
  if a[i]: ans.append(i+1)
print(len(ans))
print(*ans)
Problem p03074 (python)

Fixed submission:
n,k=map(int,input().strip().split())
s=input().strip()
l=r=0
c=0
while r<n and s[r]=='1': r+=1
while c<k:
 while r<n and s[r]=='0':r+=1
 while r<n and s[r]=='1':r+=1
 if r==n:print(n);exit()
 c+=1
ans=r-l
while r<n:
 while l<n and s[l]=='1':l+=1
 while l<n and s[l]=='0':l+=1 
 while r<n and s[r]=='0':r+=1
 while r<n and s[r]=='1':r+=1
 ans=max(ans,r-l)
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().strip().split())
s=input.strip()
l=r=0
c=0
while r<n and s[r]=='1': r+=1
while c<k:
 while r<n and s[r]=='0':r+=1
 while r<n and s[r]=='1':r+=1
 if r==n:print(n);exit()
 c+=1
ans=r-l
while r<n:
 while l<n and s[l]=='1':l+=1
 while l<n and s[l]=='0':l+=1 
 while r<n and s[r]=='0':r+=1
 while r<n and s[r]=='1':r+=1
 ans=max(ans,r-l)
print(ans)
Problem p02657 (python)

Fixed submission:
A, B = map(int, input().split())
print(A*B)

Buggy submission (verdict: Runtime Error):
A, B = map(int(), input().split())
print(A*B)
Problem p02658 (python)

Fixed submission:
def main ():
	N = int(input())
	A = list(map(int,input(). split ()))
	if 0 in A:
		print(0)
		return
	prod = 1
	for a in A:
		prod *= a
		if prod > 1000000000000000000:
			print(-1)
			return
	print(prod)
main ()

Buggy submission (verdict: Runtime Error):

N = int(input())
A = list(map(int,input(). split ()))

S = 1
for i in range(1, N):
	S *= A[i]
	if S > 1000000000000000000:
         print(-"1")
	
print(S)

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

S = A[0]

for i in range(1, N):
	S = S * A[i]
	if S > 10**18:
         print(-"1")

print(S)

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

S = A[0]
for i in range(1, N):
	S = S * A[i]
	if S > 10**18:
         print(-"1")
print(S)

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

S = A[0]
for i in range(1, N):
	S = S * A[i]
	if S > 10**18:
         print(-"1")
print(S)
Problem p02658 (python)

Fixed submission:
N = int(input())
nums = input().split()
mul = int(nums[0])
if str(0) in nums:
    mul = 0
else:
    for i in nums[1:]:
        mul *= int(i)
        if len(str(mul)) >= 19 and str(mul) != "1000000000000000000":
            mul = -1
            break
print(mul)

Buggy submission (verdict: Runtime Error):
N = int(input())
nums = input().split()
mul = int(nums[0])
for i in nums[1:]:
    if str(0) in mul:
        mul = 0
        break
    if len(str(mul)) > 19:
        mul = -1
        break
    mul *= int(i)
print(mul)
Problem p02952 (python)

Fixed submission:
n=int(input())

k=str(n)
ans=0

for i in range(1,len(k),2):
  s="9"
  s*=i
  ans+=int(s)-int(s)//10
    
if(len(k)%2==1):
	m=pow(10,len(k)-1)
	ans+=n-m+1

print(ans)

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

while(n%10==0):
	n//=10
    
k=str(n)
ans=0

for i in range(1,len(k),2):
	ans+=i*9 
    
if(len(k)%2==1):
	m=n//pow(10,len(n)-1)
	ans+=m-1

print(ans)