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

Fixed submission:
N,M = [int(i) for i in input().split()]
d = {}
for i in range(M):
    s,c = [int(i) for i in input().split()]
    if d.get(s,c) != c:
        print(-1)
        break
    else:
        d[s] = c
else:
    if N==1:
        print(d.get(1,0))
    elif d.get(1,1) == 0:
        print(-1)
    else:
        l = [str(d.get(1,1))]
        l+=[str(d.get(i,0)) for i in range(2, N+1)]
        print(''.join(l))

Buggy submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split()]
d = {}
for i in range(M):
    s,c = [int(i) for i in input().split()]
    if d.get(s,c) != c:
        print(-1)
        break
    else:
        d[s] = c
else:
    if d[1] == 0:
        print(-1)
    else:
        l=[str(d.get(1,1))]
        l=[str(d.get(i,0)) for i in range(2, N+1)]
        print(''.join(l))

Buggy submission (verdict: Runtime Error):
N,M = [int(i) for i in input().split()]
d = {}
for i in range(M):
    s,c = [int(i) for i in input().split()]
    if d.get(s,c) != c:
        print(-1)
        break
    else:
        d[s] = c
else:
    if d[1] == 0:
        print(-1)
    else:
        l=[str(d.get(i,0)) for i in range(1, N+1)]
        print(''.join(l))
Problem p03160 (python)

Fixed submission:
n = int(input())
v = [int(x) for x in input().split()]

dp = [float("inf") for i in range(n+10)]
dp[0] = 0
dp[1] = abs(v[1]-v[0])
for i in range(n-2):
    dp[i+2] = min(dp[i+1]+abs(v[i+1]-v[i+2]),dp[i]+abs(v[i]-v[i+2]))

print(dp[n-1])

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
h = list(map(int, input().split()))
 
DP = [0]
for i in range(N-1):
    act = float("inf")
    for k in range(K):
        if i-k < 0 : continue
        act = min(DP[-1-k] + abs(h[i-k]-h[i+1]) , act)
    DP += [act]
 
print(DP[-1])

Buggy submission (verdict: Runtime Error):
n,K = map(int,input().split())
v = [int(x) for x in input().split()]

dp = [float("inf") for i in range(n+10)]
dp[0] = 0
dp[1] = abs(v[1]-v[0])
for i in range(n-2):
    for k in range(K):
        if i+1-k>=0:
            dp[i+2] = min(dp[i+2],dp[i+1-k]+abs(v[i+2]-v[i+1-k]))


print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n,K = map(int,input().split())
v = [int(x) for x in input().split()]

dp = [float("inf") for i in range(n+10)]
dp[0] = 0
dp[1] = abs(v[1]-v[0])
for i in range(n-2):
    for k in range(K):
        if i+1-k>=0:
            dp[i+2] = min(dp[i+2],dp[i+1-k]+abs(v[i+2]-v[i+1-k]))


print(dp[n-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
v = [int(x) for x in input().split()]

dp = [float("inf") for i in range(n+1)]
dp[0] = 0
dp[1] = abs(v[1]-v[0])
for i in range(n-1):
    dp[i+2] = min(dp[i+1]+abs(v[i+1]-v[i+2]),dp[i]+abs(v[i]-v[i+2]))

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

Fixed submission:
import numpy as np
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]
 
DP = np.ones(N*1000+1, dtype=int) *(W+1)
DP[0] = 0
#総価値 i 円を得るために最低限必要な重量
for i in range(N):
    DP[v[i]:] = np.minimum(DP[:-v[i]]+ w[i], DP[v[i]:])
ans = 0
for k in range(N*1000+1):
    if DP[k] <= W:
        ans = k
        
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = np.zeros(W+1, dtype=int)
# i 円以下で買える商品の最大価値
for i in range(N):
    DP[w[i]:] = np.maximum(DP[:-w[i]]+ v[i], DP[w[i]:])
print(DP[-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = np.zeros(W+1, dtype=int)
# i 円以下で買える商品の最大価値
for i in range(N):
    DP[w[i]:] = np.maximum(DP[:-w[i]]+ v[i], DP[w[i]:])
    print(DP)
print(DP[-1])
Problem p03166 (python)

Fixed submission:
import sys
# 許容する再帰処理の回数を変更
sys.setrecursionlimit(10**5+10)
# input処理を高速化する
input = sys.stdin.readline

N,M = map(int,input().split())
to = [[] for i in range(N)]
for i in range(M):
    x,y = map(int,input().split())
    to[x-1]+=[y-1]

dp = [-1 for i in range(N)] #node[i]からの最長経路長を記す -1で未決定を示す

def memo(i):
    if dp[i] != -1:
        return dp[i]
    a=0
    for j in to[i]:
        a=max(a, memo(j)+1)
    dp[i] = a
    return a

lp = 0
for i in range(N):
    lp = max(lp,memo(i))
print(lp)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
to = [[] for i in range(N)]
for i in range(M):
    x,y = map(int,input().split())
    to[x-1]+=[y-1]

dp = [-1 for i in range(N)] #node[i]からの最長経路長を記す -1で未決定を示す

def memo(i):
    if dp[i] != -1:
        return dp[i]
    a=0
    for j in to[i]:
        a=max(a, memo(j)+1)
    dp[i] = a
    return a
    
lp = 0
for i in range(N):
    lp = max(lp,memo(i))
print(lp)
Problem p03485 (python)

Fixed submission:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
input = sys.stdin.readline

a,b = MI()
print(int((a+b+1)/2))

Buggy submission (verdict: Runtime Error):
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
input = sys.stdin.readline

a,b = MI()
print(int((a+b+1)/2)
Problem p03106 (python)

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

res = []
for i in range(1, 101):
    if a % i == 0 and b % i == 0:
        res.append(i)

res.sort(reverse=True)
print(res[k-1])

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

res = []
for i in range(1, min(a, b)):
    if a % i == 0 and b % i == 0:
        res.append(i)

res.sort(reverse=True)
print(res[k-1])
Problem p03243 (python)

Fixed submission:
n = int(input())
for i in range(n, 1000):
    if len(set(str(i))) == 1:
        print(i)
        exit()

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  for (int i = n; i <= 999; i++) {
    string str = to_string(i);
    set<char> st;
    for (int i = 0; i < str.size(); i++) {
      st.insert(str[i]);
    }
    if (st.size() == 1) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}
Problem p02658 (python)

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

result = 1
A.sort()
for i in A:
    result *= i
    if result > 10**18:
        result = -1
        break

print(result)

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

result = 1
if 0 in A:
    result = 0
else:
    for i in A:
    result *= i
    if result > 10**18:
        result = -1
        break

print(result)

Buggy submission (verdict: Runtime Error):
result = 1
if 0 in A:
    result = 0
else:
    for i in A:
        result *= i
        if result > 10**18:
            result = -1
            break

print(result)
Problem p02784 (python)

Fixed submission:
h, n = map(int, input().split())
a = [int(x) for x in input().split()]

if h <= sum(a):
    print('Yes')
else:
    print('No')

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

if h <= a[-2] + a[-1]:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
h, n = map(int, input().split())
a = [int(x) for x in input().split()]
a.sort()
if h <= a[-2] + a[-1]:
    print('Yes')
else:
    print('No')
Problem p02817 (python)

Fixed submission:
S, T = input().split()
print(T + S)

Buggy submission (verdict: Runtime Error):
N = int(input())
def sieve(n, s):
    num = [True]*n
    num[0] = num[1] = False
    for i in range(2,int(n**0.5)+1):
        if num[i]:
            for j in range(i**2, n, i):
                num[j] = False
    return [i for i in range(2,n) if num[i] and i > s]
print(sieve(int(N*1.2), N)[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
def sieve(n, s):
    num = [True]*n
    num[0] = num[1] = False
    for i in range(2,int(n**0.5)+1):
        if num[i]:
            for j in range(i**2, n, i):
                num[j] = False
    return [i for i in range(2,n) if num[i] and i > s]
print(sieve(N*2, N)[0])
Problem p03448 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
X = int(input())
 
count = 0
for i in range(A+1):
    for j in range(B+1):
        for k in range(C+1):
            if i*500 + j*100 + k*50 == X:
                count += 1
 
print(count)

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

price = 0
count = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            price = i * 500 + j * 100 + k * 50
            if price == X:
                count += 1
            price = 0

print(count)

Buggy submission (verdict: Runtime Error):
import itertools

X = int(input())
A, B, C = map(int, input().split())

price = 0
count = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            price = i * 500 + j * 100 + k * 50
            if price == X:
                count += 1
            price = 0

print(count)
Problem p03455 (python)

Fixed submission:

a, b = map(int, input().split(' '))

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

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

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

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

def calc_sum(n):
    dr = 0
    while(True):
        dr += n % 10
        n = n // 10
        if n == 0:
            break
    return dr

count = 0
for i in range(1, n + 1):
    sum = calc_sum(i)
    if (a <= sum) and (b >= sum):
        count += i

print(count)

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


def calc_sum(n):
    dr = 0
    while(True):
        dr += n % 10
        n = n // 10
        if n == 0:
            break
    return dr

count = 0
for i in range(1, n + 1):
    sum = calc_sum(i)
    if (a <= sum) and (b >= sum):
        count += i

print(count)

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


def calc_sum(n):
    count = 0
    while(True):
        dr = n % 10
        n = n // 10
        if n == 0:
            break
        else:
            count += dr
    return count

count = 0
for i in range(1, n + 1):
    if (a <= calc_sum(i)) and (b >= calc_sum(i)):
        count += 1

print(count)

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

count = 0
while(True):
    dr = n % 10
    n = n // 10
    if n == 0:
        break
    else:
        count += dr

print(count)
Problem p03493 (python)

Fixed submission:

a = input()

count = 0
for i in a:
    if i == '1':
        count += 1
print(count)

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

count = 0
while(True):
    for i in range(N):
        if arr[i] % 2 == 0:
            arr[i] = arr[i] / 2
            if i == 2:
                count += 1
        else:
            break
    else:
        continue
    break

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

count = 0
while(True):
    for i in range(N):
        if arr[i] % 2 == 0:
            arr[i] = arr[i] / 2
            if i == 2:
                count += 1
        else:
            break
    else:
        continue
    break
        
        

print(count)

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

count = 0
while(True):
    for i in range(N):
        if arr[i] % 2 == 0:
            arr[i] = arr[i] / 2
            if i == 2:
                count += 1
        else:
            exit()
Problem p03854 (python)

Fixed submission:
s = str(input())[::-1]

while(len(s) >= 5):
    if s[:5] == 'maerd':
        s = s.replace('maerd', '', 1)
    elif s[:7] == 'remaerd':
        s = s.replace('remaerd', '', 1)
    elif s[:5] == 'esare':
        s = s.replace('esare', '', 1)
    elif s[:6] == 'resare':
        s = s.replace('resare', '', 1)
    else:
        print('NO')
        exit()

else:
    print('YES')

Buggy submission (verdict: Runtime Error):
s = str(input())[::-1]

while(len(s) >= 5):
    print(s)
    if s[:5] == 'maerd':
        s = s.replace('maerd', '')
    elif s[:7] == 'remaerd':
        s = s.replace('remerd', '')
    elif s[:5] == 'esare':
        s = s.replace('esare', '')
    elif s[:6] == 'resare':
        s = s.replace('resare', '')
    else:
        print('NO')
        exit()

if len(s) == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
s = str(input())[::-1]
print(s)
while(len(s) >= 5):
    print(s)
    if s[:5] == 'maerd':
        s = s.replace('maerd', '')
    elif s[:7] == 'remaerd':
        s = s.replace('remerd', '')
    elif s[:5] == 'esare':
        s = s.replace('esare', '')
    elif s[:6] == 'resare':
        s = s.replace('resare', '')
    else:
        print('NO')
        exit()

if len(s) == 0:
    print('YES')
else:
    print('NO')
Problem p02657 (python)

Fixed submission:
num = input()
item = num.split(  )
result = int(item[1]) *  int(item[0])
print(result)

Buggy submission (verdict: Runtime Error):
a = input()
b = input().split()
result = 1
for i in range(int(a)):
    result = result * int(b[i])
if result > 1000000000000000000:
    print(-1)
else:
    print(result)
Problem p02658 (python)

Fixed submission:
n=int(input())
arr=list(map(int,input().split()))
arr=sorted(arr) 
ans=1
for val in arr:
 ans*=val 
 if ans>10**18:
   print(-1)
   break
else:
 print(ans)

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

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

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

if 0 in a:
  print(0)
  exit()

ans = 1
for i in a:
  ans *= a

if ans > 10**18:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [map(int, input().split()) for _ in range(n)]

ans = 1
for i in range(n):
  ans = a[i]
  
if ans > 10**18:
  print(-1)
else:
  print(ans)
Problem p02663 (python)

Fixed submission:
h1, m1, h2, m2, k = map(int, input().split())
hm = ((h2-h1)*60)-(m1-m2)-k
print(hm)

Buggy submission (verdict: Runtime Error):
h1, m1, h2, m2, k = map(int, input().split())

H = (h2-h1)*60
M = abs(m1-m2)
if H-M-k >= 0:
print(H-M-k)
Problem p02665 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
k = 1-a[0]
s -= a[0]
ans = 1

for i in range(1,n+1):
  if k*2 <= s:
    k *= 2
  else:
    k = s
  ans += k
  k -= a[i]
  s -= a[i]

if k == 0 and s == 0:
  print(ans)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = map(int, input().split())
s = sum(a)
k = 1 - a[0]
ans = 1

for i in range(1,n+1):
  if k*2 <= s:
    k *= 2
  else:
    k = s
  ans += k
  k -= a[i]
  s -= a[i]

if k == 0 and s == 0:
  print(ans)
else:
  print(-1)
Problem p02675 (python)

Fixed submission:
n = int(input()) % 10
print('bon' if n == 3 else 'pon' if n == 0 or n == 1 or n == 6 or n == 8 else 'hon')

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

print('bon' if n == 3)
print('pon' if n == 0 or n == 1 or n == 6 or n == 8)
print('hon' if n == 2 or n == 4 or n == 5 or n == 7 or n == 9)

Buggy submission (verdict: Runtime Error):
n = input() % 10
print('bon' if n == 3 else 'pon' if n == 0 or n == 1 or n == 6 or n == 8 else 'hon')
Problem p02677 (python)

Fixed submission:
import math
a, b, h, m = map(int, input().split())
     
mr = 6*m
hr = 360*(h/12+m/720)
r = math.radians(abs(mr-hr))
ans = math.sqrt((a**2)+(b**2)-2*a*b*math.cos(r))
print(ans)

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

hangle = 360*(h/12+m/(60*12))
mangle = 360*m/60
hm = math.radians(abs(hangle-mangle))

ans = math.sqrt(a**2+b**2-2*a*b*math.cos(hm))

print(ans)

Buggy submission (verdict: Runtime Error):
import math

A, B, H, M = (int(x) for x in input().split())
 

hang = math.radians(30*H/12+6*M)
mang = math.radians(6*M)
hm = abs(haang-mang)
ans = math.sqrt(A**2+B**2-2*A*B*math.cos(hm))
print(ans)

Buggy submission (verdict: Runtime Error):
import math

a, b, h, m = map(int , input().split())

x = ((360/12)*h+(360/12)*(m/60))
y = 360*(m/60)
z = math.radians(abs(x-y))
ans = ((a**2)+(b**2))-2*a*b*cos(z)

print(ans)

Buggy submission (verdict: Runtime Error):
import math

a , b , h, m = map(int , input())

x = 360/12
y = ((h/12)+(m/45))*x
z = math.radians(y)
ans = (a**2+b**2)-2*a*b*cos(z)

print(ans)

Buggy submission (verdict: Runtime Error):
import math

a , b , h, m = map(int , input())

x = 360/12
y = (h/12)+(m/45)*x
z = math.radians(y)
ans = a**2+b**2-2*a*b*cos(z)

print(ans)
Problem p02678 (python)

Fixed submission:
from collections import deque
n, m = map(int, input().split())
ab = [[] for i in range(n+1)]

for i in range(m):
    a, b = map(int, input().split())
    ab[a].append(b)
    ab[b].append(a)

ans = [-1]*(n+1)
que = deque([1])

while que:
    q = que.popleft()
    for i in ab[q]:
        if ans[i] == -1:
            que.append(i)
            ans[i] = q

print("Yes")

for i in range(2,n+1):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
from collections import deque
n, m = map(int, input().split())
ab = [[] for i in range(n+1)]

for i in range(m):
  a, b = map(int,input().split())
  ab[a].append(b)
  ab[b].append(a)

ans = [-1]*(n+1)
que = deque([1])

while que:
  q = que.popleft()
  for i in ab[q]:
    if ans[i] == -1:
      que.append(i)
      ans[i] = q

print("Yes")

for i range(2,n+1):
  print(ans[i])

Buggy submission (verdict: Runtime Error):
from collections import deque
n, m = map(int, input().split())
ab = [[] for i in range(n+1)]

for i in range(m):
  a, b = map(int,input().split())
  ab[a].append(b)
  ab[b].append(a)

ans = [-1]*(n+1)
que = deque([1])

while que:
  q = que.popleft()
  for i in ab[q]:
    if ans[i] == -1:
      que.append(i)
      ans[i] = q

print("Yes")

for i range(1,n+1):
  print(ans[i])
Problem p02681 (python)

Fixed submission:
s = input()
t = input()
print("Yes" if s == t[:-1] else "No")

Buggy submission (verdict: Runtime Error):
from itertools import combinations
n, m, x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]

ans = 10**10
for i in range(1,n+1):
  for j in combinations(ca,i):
    check = [0]*(m+1)
    for k in j:
      for a in range(m+1):
        check[a] += k[a]
    if min(check[1:]) >= x:
      ans = min(ans, check[0])

if ans == 10**6:
  print(-1)
else:
  print(ans)
Problem p02683 (python)

Fixed submission:
from itertools import combinations
n, m, x = map(int, input().split())
ca = [list(map(int, input().split())) for _ in range(n)]

ans = 10**10
for i in range(1,n+1):
  for j in combinations(ca,i):
    check = [0]*(m+1)
    for k in j:
      for a in range(m+1):
        check[a] += k[a]
    if min(check[1:]) >= x:
      ans = min(ans, check[0])

if ans == 10**10:
  print(-1)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
n, m, x = map(int, input().split())
ca = list(map(int, input().split()))

ans = 10**9
for i in range(1,n+1):
  for j in combinations(ca, i):
    s = [0]*(m+1)
    for k in j:
      for l in range(m+1):
        s[l] += k[l]
    if min(s[1:]) <= x:
      ans += min(ans, s[0])
if ans == 10**9:
  print(-1)
else:
  print(ans)
Problem p02700 (python)

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

t_hp = a
a_hp = c
while a_hp > 0 or t_hp > 0:
    a_hp -= b
    t_hp -= d
    if a_hp <= 0:
         print("Yes")
         exit()
    elif t_hp <= 0:
         print("No")
         exit()

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

t_hp = a
a_hp = c
while a_hp > 0 or t_hp > 0:
	a_hp -= b
	t_hp -= d
    if a_hp <= 0:
         print("Yes")
         exit()
    elif t_hp <= 0:
         print("No")
         exit()

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

t_hp = a
a_hp = c
while a_hp > 0 or t_hp > 0:
	a_hp -= b
	t_hp -= d
	if a_hp <= 0:
      print("Yes")
      exit()
    elif t_hp <= 0:
      print("No")
      exit()

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

t_hp = a
a_hp = c
while a_hp >= 0 or t_hp >= 0:
a_hp -= b
t_hp -= d

if a_hp <= t_hp:
  print("Yes")
else:
  print("No")
Problem p02702 (python)

Fixed submission:
S = input()
s = S[::-1]

cnt = [0]*2019
cnt[0] = 1
number = 0
d = 1

for i in s:
  number += int(i)*d
  cnt[number % 2019] += 1
  d *= 10
  d = d % 2019

ans = 0
for i in cnt:
  ans += i*(i-1) // 2

print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
s = S[::-1]

cnt = [0]*2019
s[0] = 1
number = 0
d = 1

for i in s:
  number += int(i)*d
  cnt[number % 2019] += 1
  d *= 10
  d = d % 2019

ans = 0
for i in cnt:
ans += i*(i-1) // 2

print(ans)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map (int, input().split()))
if 0 in A:
  print(0)
  return
 
re = 1
for i in range(N):
    re *= A[i]
    if re >= pow(10,18):
        print(-1)
        return
else:
    print(re)
    return

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
# スペース区切りの整数の入力
b = int(input())

# 出力
print(a*b)
Problem p02658 (python)

Fixed submission:
a = int(input())
ar = list(map(int,input().split(" ")))
if 0 in ar:
    print(0)
    exit()
b = 1
for r in ar:
    b *= r
    if b > 10 ** 18:
        print(-1)
        exit()
print(b)

Buggy submission (verdict: Runtime Error):
a = int(input())
ar = list(map(int,input().split()))
if 0 in ar:
    print(0)
    exit()
b = 1
for r in ar:
    b *= r
    if b > 10 ** 18:
        print(-1)
        return
print(b)

Buggy submission (verdict: Runtime Error):
a = int(input())
ar = list(map(int,input().split()))
if 0 in ar:
    print(0)
    return
b = 1
for r in ar:
    b *= r
    if b > 10 ** 18:
        print(-1)
        exit()
print(b)

Buggy submission (verdict: Runtime Error):
a = int(input())
ar = list(map(int,input().split(" ")))
if 0 in ar:
    print(0)
    return

b = 1
for r in ar:
    b *= r
    if b > 10 ** 18:
        print(-1)
        return
print(b)

Buggy submission (verdict: Runtime Error):
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)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map (int, input().split()))
if 0 in A:
  print(0)
  return
 
re = 1
for i in range(N):
    re *= A[i]
    if re >= pow(10,18):
        print(-1)
        return
else:
    print(re)
    return