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

Fixed submission:
l, r = map(int, input().split())
if l <= 2019 <= r:
    print(0)
    exit()
elif r*(r-1) <= 2019:
    print(l*(l+1))
    exit()

a = 2019
for i in range(l, r):
    for j in range(i+1, r+1):
        a = min(a, i*j%2019)
        if a == 0:
            print(0)
            exit()

print(a)

Buggy submission (verdict: Runtime Error):
def mod(x,y):
    return x % y


l, r = map(int, input().split())
if l <= 2019 <= r:
    print(0)
    exit()
elif r*(r-1) <= 2019:
    print(l*(l+1))
    exit()
lr = list(range(l,r+1))
lr = [mod(lr[x]*lr[y], 2019) for x in range(len(lr)) for y in range(x+1, len(lr))]

print(min(lr))

Buggy submission (verdict: Runtime Error):
import numpy as np


l, r = map(int, input().split())
#if l <= 2019 <= r:
#    print(0)
#    exit()
#elif r*(r-1) <= 2019:
#    print(l*(l+1))
#    exit()

lr = np.arange(l, r+1)
lr = np.reshape(lr, (1, len(lr)))
lr_t = lr.T
mod = (lr*lr_t) % 2019
mod = mod[np.triu_indices_from(mod, k=1)]

print(mod.min())

Buggy submission (verdict: Runtime Error):
import numpy as np


l, r = map(int, input().split())
if l <= 2019 <= r:
    print(0)
    exit()
elif r*(r-1) <= 2019:
    print(l*(l+1))
    exit()

lr = np.arange(l, r+1)
lr = np.reshape(lr, (1, len(lr)))
lr_t = lr.T
mod = (lr*lr_t) % 2019
mod = mod[np.triu_indices_from(mod, k=1)]
print(mod.min())

Buggy submission (verdict: Runtime Error):
import numpy as np


l, r = map(int, input().split())
if l <= 2019 <= r:
    print(0)
    exit()
elif r*(r-1) <= 2019:
    print(l*(l+1))
    exit()

lr = np.arange(l, r+1)
lr = np.reshape(lr, (1, len(lr)))
lr_t = lr.T
mod = (lr*lr_t) % 2019
mod = np.triu(mod, k=1)
mod = mod[np.triu_indices_from(mod, k=1)]
print(mod.min())

Buggy submission (verdict: Runtime Error):
import numpy as np


l, r = map(int, input().split())
if l <= 2019 <= r:
    print(0)
    exit()
elif r*(r-1) <= 2019:
    print(l*(l+1))
    exit()

lr = np.arange(l,r+1)
lr = np.reshape(lr, (1,len(lr)))
lr_t = lr.T
mod = (lr*lr_t)%2019
mod = np.triu(mod, k=1)
mod = mod[np.triu_indices(len(mod),k=1)]
print(mod.min())

Buggy submission (verdict: Runtime Error):
import numpy as np


l, r = map(int, input().split())
if l <= 2019 <= r:
    print(0)
    exit()
elif r*(r-1) <= 2019:
    print(l*(l+1))
    exit()

lr = np.arange(l,r+1)
lr = np.reshape(lr, (1,len(lr)))
lr_t = lr.T
mod = (lr*lr_t)%2019
mod = np.triu(mod, k=1)
mod = mod[np.triu_indices(len(mod),k=1)]
print(mod.min())

Buggy submission (verdict: Runtime Error):
import numpy as np


l, r = map(int, input().split())
#if l <= 2019 <= r:
#    print(0)
#    exit()
#elif r*(r-1) <= 2019:
#    print(l*(l+1))
#    exit()

lr = np.arange(l,r+1)
lr = np.reshape(lr, (1,len(lr)))
lr_t = lr.T
mod = (lr*lr_t)%2019
mod = np.triu(mod, k=1)
mod = mod[np.triu_indices(len(mod),k=1)]
print(mod.min())
Problem p03029 (python)

Fixed submission:
A, P = map(int, input().split())
print((P+A*3)//2)

Buggy submission (verdict: Runtime Error):
print(a)
Problem p02582 (python)

Fixed submission:
data = input()

if data[0]=="R" and data[1]=="R" and data[2]=="R":
    print(3)
elif (data[0]=="R" and data[1]=="R") or (data[1]=="R" and data[2]=="R"):
    print(2)
elif data[0]=="R" or data[1]=="R" or data[2]=="R":
    print(1)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))
 
ans = -float('inf')
for s in range(N):
    S = [] 
    i = P[s] - 1
    S.append(C[i])
    while i != s:
        i = P[i] - 1
        S.append(S[-1] + C[i])
 
    if K <= len(S):
        score = max(S[:K])
    elif S[-1] <= 0:
        score = max(S)
    else:
        score1 = S[-1] * (K // len(S) - 1)
        score1 += max(S)
        score2 = S[-1] * (K // len(S))
        r = K % len(S)
        if r != 0:
            score2 += max(0, max(S[:r]))
        score = max(score1, score2)
 
    ans = max(ans, score)
 
print(ans)
Problem p02607 (python)

Fixed submission:
mass=int(input())
number=list(map(int,input().split()))

cnt = 0

for i in range(mass):
    if (i+1)%2!=0 and number[i]%2!=0:
        cnt+=1

print(cnt)

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

cnt = 0

for i in mass:
    if (i+1)%2!=0 and number[i]%2!=0:
        cnt+=1

print(cnt)

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

cnt = 0

for i in mass:
    if (i+1)%2!=0 and number[i]%2!=0:
        cnt+=1
 print(cnt)

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

cnt = 0

for i in mass:
    if (i+1)%2==0 and number[i]%2==0:
        cnt+=1
 print(cnt)
Problem p02641 (python)

Fixed submission:
import sys

x, n = map(int, input().split())
p = list(map(int, input().split()))
list_p = [i for i in range(-1, 102)] 
t = x
num = x

for i in p:
  list_p[i + 1] = -2

for i in range(len(list_p)):
  if(list_p[i] == -2):
    continue
  else:
    if(abs(list_p[i] - x) <= t):
      if(abs(list_p[i] - x) < t):
        t = abs(list_p[i] - x)
        num = list_p[i]
      elif(abs(list_p[i] - x) == t):
        t = abs(list_p[i] - x)
        num = min(num, list_p[i])
print(num)

Buggy submission (verdict: Runtime Error):
import sys

x, n = map(int, input().split())
p = list(map(int, input().split()))
list_p = [i for i in range(-1, 102)] 
t = x
num = x

if(x == n):
  print(x - 1)
  sys.exit()

for i in p:
  list_p[i + 1] = -2

for i in range(len(list_p)):
  if(list_p[i] == -2):
    continue
  else:
    if(abs(list_p[i] - x) <= t):
      if(abs(list_p[i] - x) != t):
        t = abs(list_p[i] - x)
        num = list_p[i]
      elif:
        t = abs(list_p[i] - x):
        num = min(num, list_p[i])

print(num)
Problem p02660 (python)

Fixed submission:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=[]
            count = 1
            while temp%i==0:
                if(count not in cnt):
                  cnt.append(count)
                  count = 0 
                count += 1
                temp //= i
            arr.append(len(cnt))

    if temp!=1:
        arr.append(1)

    if arr==[]:
        arr.append(1)

    return arr

n = int(input())
num = factorization(n)
if(n == 1):
  num = [0]

print(sum(num))

Buggy submission (verdict: Runtime Error):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=[]
            count = 1
            while temp%i==0:
                if(count not in cnt):
                  cnt.append(count)
                  count = 0 
                count += 1
                temp //= i
            arr.append(len(cnt))

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())
num = factorization(n)
if(n == 1):
  num = [1]

print(sum(num))

Buggy submission (verdict: Runtime Error):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=[]
            count = 1
            while temp%i==0:
                if(count not in cnt):
                  cnt.append(count)
                  count = 0 
                count += 1
                temp //= i
            arr.append(len(cnt))

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())
num = factorization(n)
if(n == 1):
  num = [1]

print(sum(num))
Problem p02675 (python)

Fixed submission:
n = input()
num = int(n[-1])

if(num == 2 or num == 4 or num == 5 or num == 7 or num == 9):
  print('hon')
elif(num == 1 or num == 6 or num == 8 or num == 0):
  print('pon')
else:
  print('bon')

Buggy submission (verdict: Runtime Error):
n = input()
num = int(n[-1])

if(num == 2 or num = 4 or num == 5 or num == 7 or num == 9):
  print('hon')
elif(num == 1 or num = 6 or num == 8 or num == 0):
  print('pon')
else:
  print('bon')

Buggy submission (verdict: Runtime Error):
n = input()
num = int(n[-1])

if(num == 2 or num = 4 or num == 5 or num == 7 or num == 9):
  print('hon')
elif(num == 1 or num = 6 or num == 8 or num == 0):
  print('pon')
else:
  print('bon')
Problem p02681 (python)

Fixed submission:
a = input()
b = input()

if(a[0:len(a)] == b[0:len(a)]):
  print('Yes')
else:
  print('No')

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

num = list(map(int, input().split()))
t = [-1] * n
count = 0
s = 1

while t[s - 1] == -1:
  if count == k:
    break

  t[s - 1] = count
  count += 1
  s = num[s - 1]
else:
  z = (k - t[s - 1]) % (count - t[s - 1])
  w = t.index(t[s - 1] + z + 1)
print(w)

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

n, m, x = map(int, input().split())
num = list(list(map(int, input().split())) for i in range(n))

s = [i for i in range(n)]
t = []
list_num = []

for i in range(m):
  t.append(list(map(list, itertools.combinations(s, i + 1))))

for i in t:
  for j in i:
    k = [0] * m
    for z in j:
      k = tuple(x + y for (x,y) in zip(k, num[z]))
    list_num.append(k)


list_num = list(sorted(list_num, key =lambda w : w[0]))


for i in list_num:
  flag = 1
  for j in range(1, len(i)):
    if(i[j] < x):
      flag = 0
      break
  if(flag == 1):
    print(i[0])
    sys.exit()
 
print(-1)
Problem p02683 (python)

Fixed submission:
import itertools
import sys

n, m, x = map(int, input().split())
num = list(list(map(int, input().split())) for i in range(n))

s = [i for i in range(n)]
t = []
list_num = []

for i in range(n):
  t.append(list(map(list, itertools.combinations(s, i + 1))))


for i in t:
  for j in i:
    k = [0] * (m + 1)
    for z in j:
      k = tuple(x + y for (x,y) in zip(k, num[z]))
    list_num.append(k)


list_num = list(sorted(list_num, key =lambda w : w[0]))
q = []

flag2 = 0

for i in list_num:
  flag = 1
  for j in range(1, m + 1):
    if(i[j] < x):
      flag = 0
  if(flag == 1):
    q.append(i[0])
    flag2 = 1

if(flag2 == 1):
  print(min(q))
else: 
  print(-1)

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

n, m, x = map(int, input().split())
num = list(list(map(int, input().split())) for i in range(n))

s = [i for i in range(m)]
t = []
list_num = []

for i in range(m):
  t.append(list(map(list, itertools.combinations(s, i + 1))))

for i in t:
  for j in i:
    k = [0] * (m + 1)
    for z in j:
      k = tuple(x + y for (x,y) in zip(k, num[z]))
    list_num.append(k)


list_num = list(sorted(list_num, key =lambda w : w[0]))
q = []

flag2 = 0

for i in list_num:
  flag = 1
  for j in range(1, m + 1):
    if(i[j] < x):
      flag = 0
  if(flag == 1):
    q.append(i[0])
    flag2 = 1

if(flag2 == 1):
  print(min(q))
else: 
  print(-1)
Problem p02684 (python)

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

t_zero = [-1] * N

t = 0
a = 1

while t_zero[a-1] == -1:
  if t == K:
    break
  t_zero[a-1] = t
  t += 1
  a = A[a-1]
else:
  k = (K - t_zero[a-1]) % (t - t_zero[a-1])
  a = t_zero.index(t_zero[a-1] + k) + 1
print(a)

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

num = list(map(int, input().split()))
t = [-1] * n
count = 0
s = 1

while t[s - 1] == -1:
  if count == k:
    break

  t[s - 1] = count
  count += 1
  s = num[s - 1]
else:
  z = (k - t[s - 1]) % (count - t[s - 1])
  s = t.index(t[s - 1] + z + 1)
print(s)

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

num = list(map(int, input().split()))
t = [-1] * n
count = 0
s = 1

while t[s - 1] == -1:
  if count == k:
    break

  t[s - 1] = count
  count += 1
  s = num[s - 1]
else:
  z = (k - t[s - 1]) % (count - t[s - 1])
  print(t.index(t[s - 1] + z + 1)
Problem p02731 (python)

Fixed submission:
def main():
  l = input()

  print(int(l)**3/27)

if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def main():
  l = input()

  print(l**3/27)

if __name__ == '__main__':
  main()
Problem p02755 (python)

Fixed submission:
def cul_even(x):
  return x // 2 * 25
def cul_odd(x):
  return x // 2 * 25 + 13
def main():
  a,b = map(int,input().split())
  if(a % 2 == 0):
    if(b == cul_even(a)//10):
      print(cul_even(a))
    elif(b == (cul_even(a)//10 + 1)):
      print((cul_even(a)+12)//10*10)
    else:
      print(-1)
  else:
    if(b == cul_odd(a)//10):
      print(cul_odd(a))
    elif(b == (cul_odd(a)//10 + 1)):
      print((cul_odd(a)+11)//10*10)
    else:
      print(-1)

if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def cul_even(x):
  return x // 2 * 25
def cul_odd(x):
  return x // 2 * 25 + 13
def test(a, b, func):
  if(b == func(a)//10):
      print(func(a))
    elif(b == (func(a)//10 + 1)):
      print((func(a)+12)//10*10)
    else:
      print(-1)

def main():
  a,b = map(int,input().split())
  if(a % 2 == 0):
    test(a, b, cul_even)
  else:
    test(a, b, cul_odd)

if __name__ == '__main__':
  main()
Problem p02784 (python)

Fixed submission:
h, n = map(int, input().split())
x = sorted([int(i) for i in input().split()], reverse = True)
if(sum(x[:n]) >= h):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
h, n = map(int, input().split())
x = sorted([int(i) for i in input().split()], reverse = True)
if(x[0] + x [1] >= h):
  print('Yes')
else:
  print('No')
Problem p02789 (python)

Fixed submission:
n, k = map(int, input().split())
if(n == k):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
n. k = map(int, input().split())
if(n == k):
  print('Yes')
else:
  print('No')
Problem p02900 (python)

Fixed submission:
from fractions import gcd
import math

def test(a,b):
  x = gcd(a,b)
  s = []
  for i in range(2, int(math.sqrt(x)) + 1):
    while x % i == 0:
      s.append(i)
      x //= i

  s.append(x)
  s.append(1)

  return list(set(s))

def main():

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

  num = []

  num = test(a, b)
  print(len(num))

if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
import math

def test(a,b):
  num = 2
  x = math.gcd(a,b)
  s = []
  while x != 1:
    if(x % num == 0):
      x = x / num
      s.append(num)
    else:
      num += 1

  return set(s)

def main():

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

  num = []

  num = list(test(a, b))
  num.append(1)
  print(len(num))

if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
import math

def test(a,b):
  num = 2
  x = math.gcd(a,b)
  s = []
  while x != 1:
    if(x % num == 0):
      x = x / num
      s.append(num)
    else:
      num += 1

  return set(s)

def main():

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

  num = []

  num = list(test(a, b))
  num.append(1)
  print(len(num))

if __name__ == '__main__':
  main()
Problem p02923 (python)

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

num = 0
count = 0
s_list = [0]

for i in range(1, n):
  if(h[i - 1] >= h[i]):
    count += 1
  else:
    count = 0
  s_list.append(count)
print(max(s_list))

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

num = 0
count = 0
s_list = []

for i in range(1, n):
  if(h[i - 1] >= h[i]):
    count += 1
  else:
    count = 0
  s_list.append(count)
print(max(s_list))
Problem p02995 (python)

Fixed submission:
import fractions

a,b,c,d = map(int, input().split())
x = (b//c - (a - 1)//c)
y = (b//d - (a - 1)//d)
z = (b//((c * d)//fractions.gcd(c,d)) - (a - 1)//((c * d)//fractions.gcd(c,d)))

print(int((b - a + 1) - (x + y - z)))

Buggy submission (verdict: Runtime Error):
import math

a,b,c,d = map(int, input().split())
x = (b//c - (a - 0.1)//c)
y = (b//d - (a - 0.1)//d)
z = (b//((c * d)//math.gcd(c,d)) - (a - 0.1)//((c * d)//math.gcd(c,d)))

print(int((b - a + 1) - (x + y - z)))

Buggy submission (verdict: Runtime Error):
import math

a,b,c,d = map(int, input().split())
#print((b//c - (a - 0.1)//c) + (b//d - (a - 0.1)//d) - (b//math.gcd(c,d) - (a - 0.1)//math.gcd(c,d))) 
x = (b//c - (a - 0.1)//c)
y = (b//d - (a - 0.1)//d)
z = (b//((c * d)//math.gcd(c,d)) - (a - 0.1)//((c * d)//math.gcd(c,d)))

print(int((b - a + 1) - (x + y - z)))
Problem p03164 (python)

Fixed submission:
n, w = map(int, input().split())
x = []
y = []

for i in range(n):
  a,b = map(int, input().split())
  x.append(b)
  y.append(a)

max_num = sum(x)

dp = [[float("inf")] * (max_num + 1) for i in range(n + 1)]
dp[0][0] = 0

for i in range(n):
  for j in range(max_num + 1):
    if(j >= x[i]):
      dp[i + 1][j] = min(dp[i + 1][j], dp[i][j - x[i]] + y[i])
    dp[i + 1][j] = min(dp[i + 1][j], dp[i][j])
    
print(max(list(int(i) for i in range(max_num + 1) if dp[n][i] <= w)))

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

for i in range(n):
  a,b = map(int, input().split())
  x.append(b)
  y.append(a)

dp = [[0] * (w + 1) for i in range(n + 1)]

for i in range(n):
  for j in range(w + 1):
    if(j >= y[i]):
      dp[i + 1][j] = max(dp[i][j], dp[i][j - y[i]] + x[i])
    else:
      dp[i + 1][j] = dp[i][j]

print(dp[n][w])
Problem p02613 (python)

Fixed submission:

def b():
    n = int(input())
    AC=0
    WA=0
    TLE=0
    RE=0
    while n:
        n-=1
        t= input()
        if t=='AC':
            AC+=1
        elif t=='WA':
            WA+=1
        elif t=='TLE':
            TLE+=1
        else:

            RE+=1
    print("AC x %d"%AC)
    print("WA x %d"% WA)
    print("TLE x %d"% TLE)
    print("RE x %d"% RE)
b()

Buggy submission (verdict: Runtime Error):

def b():
    n = int(input())
    AC=0
    WA=0
    TLE=0
    RE=0
    while n:
        n-=1
        if input()=='AC':
            AC+=1
        elif input()=='WA':
            WA+=1
        elif input()=='TLE':
            TLE+=1
        else:
            RE+=1
    print("AC x %d"%AC)
    print("WA x %d"% WA)
    print("TLE x %d"% TLE)
    print("RE x %d"% RE)
b()
Problem p02601 (python)

Fixed submission:
A, B, C = map(int, input().split())
K = int(input())
Ak = 0

for i in range(K):
    if A >= B:
        B = B * 2
        Ak = i + 1
    else:
        break

if K - Ak > 0:
    for j in range(K - Ak):
        if B >= C:
            C = C * 2
else:
    print("No")
    exit()

if A < B and B < C:
    print("Yes")
else:
    print("No")

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

for i in range(K):
    if A > B:
        B = B * 2
    else:
        Ak = i
        break

for j in range(K - Ak):
    if B > C:
        C = C * 2

if A < B and B < C:
    print("Yes")
else:
    print("No")
Problem p02923 (python)

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
H = list(map(int, input().split()))
ans = []
cnt = 0
for i in range(N - 1):
    if H[i] >= H[i + 1]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0

ans.append(cnt)
print(max(ans))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
H = list(map(int, input().split()))
ans = []
cnt = 0
for i in range(N - 1):
    if H[i] >= H[i + 1]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0

print(max(ans))
Problem p02953 (python)

Fixed submission:
# -*- coding: utf-8 -*-
N = int(input())
H = list(map(int,input().split()))

ans = 'Yes'
diff = 0

for i in range(N - 1):
	diff = H[i + 1] - H[i]

	if diff >= 1:
		H[i + 1] -= 1
	elif diff < 0:
		ans = 'No'

print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys

N = int(input())
H = list(map(int,input().split()))
check = 0

if int(len(H)) == 1:
	print('Yes')
	sys.exit()

for i in range(0,N-1,1):
	
	elif H[i] > H[i + 1]:
		H[i + 1] += 1

	check = sorted(H)

	if check = H:
		print('Yes')
	else:
		print('No')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys

N = int(input())
H = list(map(int,input().split()))
check = 0

if int(len(H)) == 1:
	print('Yes')
	sys.exit()

for i in range(0,N-1,1):
	
	elif H[i] > H[i + 1]:
		H[i + 1] += 1

	check = sorted(H)

	if check = H:
		print('Yes')
	else:
		print('No')


print('Yes')
Problem p02969 (python)

Fixed submission:
# -*- coding:utf-8 -*-

r = int(input())
A = 3 * r**2

print(int(A))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
N = int(input())
A = [int(input()) for i in range(N)]
temp = 0

for i in range(N):
	if A[i] != max(A):
		print(max(A))
	else
		temp = A[i]
		del A[i]
		print(max(A))
		A.insert(i,temp)
		temp = 0
Problem p02995 (python)

Fixed submission:
# -*- coding: utf-8 -*-
A, B, C, D = map(int, input().split())
ans = 0
Am = 0
Bm = 0
df = 0
t = 0

def lcm(x, y):
	return (x * y) // gcd(x, y)

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

t = B - A + 1
Am = B // C - (A - 1) // C
Bm = B // D - (A - 1) // D
df = B // lcm(C, D) - (A - 1)//lcm(C, D)
ans = t - (Am + Bm) + df
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
A, B, C, D = map(int, input().split())
ans = 0
Am = 0
Bm = 0
df = 0

Am = A - (A // C + A // D - A //lcm(C,D))
Bm = B - (B // C + B // D - B //lcm(C,D))
ans = Bm - Am

if A % C != 0 and A % D != 0:
	ans += 1
print(ans)

def lcm(x, y):
	return (x * y) // gcd(x, y)

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math
A, B, C, D = map(int, input().split())
ans = 0
Am = 0
Bm = 0
df = 0

Am = A - (A // C + A // D - A //lcm_base(C,D))
Bm = B - (B // C + B // D - B //lcm_base(C,D))
ans = Bm - Am

if A % C != 0 and A % D != 0:
	ans += 1
print(ans)

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

A, B, C, D = map(int, input().split())
ans = 0
Am = 0
Bm = 0
df = 0

Am = A - (A // C + A // D - A //lcm_base(C,D))
Bm = B - (B // C + B // D - B //lcm_base(C,D))
ans = Bm - Am

if A % C != 0 and A % D != 0:
	ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

A, B, C, D = map(int, input().split())
ans = 0
Am = 0
Bm = 0
df = 0

Am = A - (A // C + A // D - A //lcm_base(C,D))
Bm = B - (B // C + B // D - B //lcm_base(C,D))
ans = Bm - Am

if A % C != 0 and A % D != 0:
	ans += 1
print(ans)
Problem p02639 (python)

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

print(N.index(0)+1)

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

a=2*X
b=(Y-a)/2
c=X-b

if(2*c+4*b==Y and (Y-a)%2==0 and c>=0):
    print("Yes")
else:
    print("No")
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()))

x = 1

y = 1000000000000000000

for i in A:
  x = x*i  

if (x>y):
    print(-1)
else:
    print(x)

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

x = 1


for i in A:
  x = x*i  

if (x<=1000000000000000000) :
    print(x)
else:
    print(-1)

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

x = 1


for i in A:
  x = x*i  

if (x>1000000000000000000) :
    print(-1)
else:
    print(x)

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

x = 1


for i in A:
  x = x*i  
y = 10**18
if (x>y) :
    print(-1)
else:
    print(x)

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

x = 1
y = 10**18

for i in A:
  x = x*i  

if (x>y) :
    print(-1)
else:
    print(x)

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

x = 1
y = 10**18

for i in A:
  x = x*i  

if (x>y) :
    print(-1)
else:
    print(x)