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

Fixed submission:
def resolve():
    a, b = list(map(int, input().split()))

    if a <= 0 and b >= 0:
        print('Zero')
    elif b < 0 and (b - a + 1) % 2 == 1:
        print('Negative')
    else:
        print('Positive')
    return


resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    a, b = list(map(int, input().split()))
    l = list(range(a, b + 1))

    if a <= 0 and b >= 0:
        print('Zero')
    elif b < 0 and (b - a + 1) % 2 == 1:
        print('Negative')
    else:
        print('Positive')
    return

resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    a, b = list(map(int, input().split()))
    l = list(range(a, b + 1))

    if a <= 0 and b >= 0:
        print('Zero')
    elif a > 0:
        print('Positive')
    else:
        if (b - a) % 2 == 0:
            print('Negative')
        else:
            print('Positive')
    return


resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    a, b = list(map(int, input().split()))
    l = list(range(a, b + 1))
    if 0 < a and a <= b:
        print('Positive')
    elif a <= b and b < 0:
        if (b - a + 1) % 2 == 0:
            print('Positive')
        else:
            print('Negative')
    elif a <= 0 and 0 <= b:
        print('Zero')
    return


resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    a, b = list(map(int, input().split()))
    l = list(range(a, b + 1))
    l.sort()
    minus = list(filter(lambda x: x < 0, l))
    minus = len(minus)

    if a <= 0 and b >= 0:
        print('Zero')
        return

    if a < 0 and b < 0:
        minus = len(range(a, b + 1))

    if minus % 2 == 1:
        print('Negative')
        return
    else:
        print('Positive')
        return
    return


resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    a, b = list(map(int, input().split()))
    l = list(range(a, b + 1))
    l.sort()
    minus = list(filter(lambda x: x < 0, l))
    minus = len(minus)

    if a <= 0 and b >= 0:
        print('Zero')
        return
    else:
        if minus % 2 == 1:
            print('Negative')
            return
        else:
            print('Positive')
            return
    return


resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    a, b = list(map(int, input().split()))
    l = list(range(a, b + 1))
    l.sort()
    minus = list(filter(lambda x: x < 0, l))
    minus = len(minus)

    if 0 in l:
        print('Zero')
        return
    else:
        if minus % 2 == 1:
            print('Negative')
            return
        else:
            print('Positive')
            return
    return

resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    a, b = list(map(int, input().split()))
    l = list(range(a, b + 1))
    minus = list(filter(lambda x: x < 0, l))
    minus = len(minus)

    if 0 in l:
        print('Zero')
        return
    else:
        if minus % 2 == 1:
            print('Negative')
            return
        else:
            print('Positive')
            return
    return


resolve()
Problem p02660 (python)

Fixed submission:
N = int(input())


#整数N以下の素数を#素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a = prime_factorize(N)
b = set(a)

dic = {}
for i in b:
    n = 0
    while True:
        n += 1
        if a == []:
            break
        a.pop(0)
        if a == []:
            break
        if a[0] != i:
            break
    dic[i] = n


an = 0
for k, v in dic.items():
    num = int((-1+(1+8*v)**(1/2))/2)
    an += num

print(an)

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


#整数N以下の素数を#素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

a = prime_factorize(N)
b = set(a)

dic = {}
for i in b:
    n = 0
    while True:
        n += 1
        a.pop(0)
        if a == []:
            break
        if a[0] != i:
            break
    dic[i] = n


an = 0
for k, v in dic.items():
    num = int((-1+(1+8*v)**(1/2))/2)
    an += num

print(an)
Problem p02684 (python)

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

NN = [-1] * N
NN[0] = 0

i = 0
num = 0

while True:
    num += 1
    i = A[i] - 1
    if NN[i] != -1:
        n1 = NN[i]
        break
    NN[i] = num

n_ = num - n1

if K > n1:
    K -= n1
    t = NN.index(n1 + K % n_) + 1
    print(t)
else:
    t = NN.index(K) + 1
    print(t)

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

NN = [-1] * N
NN[0] = 0

i = 0
num = 0

while True:
    num += 1
    i = A[i] - 1
    if NN[i] != -1:
        n1 = NN[i]
        break
    NN[i] = num

n_ = num - n1

if K > N:
    K -= n1
    t = NN.index(n1 + K % n_) + 1
    print(t)
else:
    t = NN.index(K)
    print(t) + 1

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

if K >= N:
    lst = []
    n = 0
    for i in range(N):
        n = A[n]-1
        if A[n] in lst:
            n0 = lst.index(A[n])
            n1 = i
            break
        lst.append(A[n])

    num = n1 - n0
    K -= n0
    r = K % num
    n = n0
else:
    n = 0
    
for _ in range(r):
    n = A[n] - 1

print(n0+n+1)
Problem p02658 (python)

Fixed submission:
N = int(input())
A = [int(x) for x in input().split()]
if 0 in A:
  print("0")
  exit(0)
ans = 1
lim = 10**18
for a in A:
  ans *= a
  if ans > lim:
    print("-1")
    exit(0)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(x) for x in input().split()]
if 0 in A:
	print("-1")
	exit(0)
ans = 1
lim = 10**18
for a in A:
	ans *= a
    if ans > lim:
      print("-1")
      exit(0)
print(ans)
Problem p02971 (python)

Fixed submission:
n = int(input())
top_val = 0
top_idx = set()
semi_top = 0

for i in range(n):
  a = int(input())
  if a > top_val:
    semi_top = top_val
    top_val = a
    top_idx.clear()
    top_idx.add(i)
  elif a == top_val:
    top_idx.add(i)
  elif a > semi_top:
    semi_top = a

if len(top_idx) > 1:
  semi_top = top_val

semi_top = str(semi_top)
top_val = str(top_val)

print("\n".join([semi_top if i in top_idx else top_val for i in range(n)]))

Buggy submission (verdict: Runtime Error):
n = int(input())
top_val = 0
top_idx = set()
semi_top = 0

for i in range(n):
  a = int(input())
  if a > top_val:
    semi_top = top_val
    top_val = a
    top_idx.clear()
    top_idx.add(i)
  elif a == top_val:
    top_idx.add(i)

if len(top_idx) > 1:
  semi_top = top_val

print("\n".join([semi_top if i in top_idx else top_val for i in range(n)]))
Problem p02600 (python)

Fixed submission:
n = int(input())
print(10 - n // 200)

Buggy submission (verdict: Runtime Error):
n = input()
print(10 - n // 200)
Problem p02642 (python)

Fixed submission:
n = int(input())
a = sorted(list(map(int,input().split())))
m = a[-1]
b = [True]*(m+1)
for i in range(n):
    if i > 0 and a[i] == a[i-1]:
        continue
    for j in range(2, m//a[i]+1):
        b[j*a[i]] = False
ans = 0
for i in range(n):
    if 0 < i and a[i] == a[i-1]:
        continue
    if i < n-1 and a[i] == a[i+1]:
        continue
    if b[a[i]]:
        ans += 1
print(ans)

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

if n == 1:
    print(1)
    exit()

b = [True]*n
fix = [False]*n
for i in range(n):
    if not b[i] or fix[i]:
        continue
    if i < n and a[i] == a[i+1]:
        b[i] = False
        fix[i] = True
    for j in range(i+1, n):
        if a[i] < a[j] < a[i]*2:
            fix[j] = True
            continue
        if a[j] % a[i] == 0:
            fix[j] = True
            b[j] = False

print(sum(b))

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

if len(b) == 0:
    print(0)
    exit()
ans = 1
div = [b[0]]
for x in b[1:]:
    f = True
    for d in div:
        if x % d == 0:
            f = False
            break
    if f:
        div += [x]
        ans += 1
print(ans)
Problem p02731 (python)

Fixed submission:
print(pow(int(input()) / 3, 3))

Buggy submission (verdict: Runtime Error):
print(pow(int(input) / 3, 3))
Problem p02732 (python)

Fixed submission:
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
d = defaultdict(int)
for x in a:
  d[x] += 1
  
s = 0
for k,v in d.items():
  s += v * (v-1) // 2
for x in a:
  c = d[x] - 1
  print(s - c)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
n = int(input())
a = list(map(int,input().split()))
d = defaultdict(int)
for x in a:
  d[x] += 1
for x in a:
  c = d[x] - 1
  print(c * (c-1) // 2)a
Problem p02786 (python)

Fixed submission:
h = int(input())
ans = 1
h //= 2
i = 2
while h > 0:
    ans += i
    i *= 2
    h //= 2
print(ans)

Buggy submission (verdict: Runtime Error):
h = int(input())
ans = 1
h //= 2
i = 2
while h > 0:
    ans += i
    i *= 2
    h //= 2
print(ans)
pow(2,n)-1
Problem p02837 (python)

Fixed submission:
n = int(input())
d = [dict() for _ in range(n)]
for i in range(n):
    a = int(input())
    for _ in range(a):
        x, y = map(int, input().split())
        d[i][x - 1] = y

def count_honest(bits):
    honest = [(bits >> i) & 1 for i in range(n)]
    for i in range(n):
        if not honest[i]:
            continue
        for k, v in d[i].items():
            if honest[k] != v:
                return 0
    return sum(honest)


print(max([count_honest(i) for i in range(2**n)]))

Buggy submission (verdict: Runtime Error):
n = int(input())
d = [dict()] * n
for i in range(n):
  a = int(input())
  for j in range(a):
    x,y = map(int,input().split())
    d[i][x-1] = y
ans = 0

def count_honest(bits):
  count = 0
  vec = [-1] * n
  for j in range(n):
    honest = (bits >> j) | 1
    count += honest
    for k,v in d[j]:
      v = v if honest else (v+1) % 2
      if vec[k] == -1:
        vec[k] = v
      elif vec[k] != v:
        return 0
  return count
  
for i in range(2**n):
  ans = max(ans, count_honest(i))
Problem p02853 (python)

Fixed submission:
x,y = map(int, input().split())
d = {1:300000, 2:200000, 3:100000}
if x == y == 1:
  print(1000000)
  exit()
a = 0
b = 0
if 1 <= x <= 3:
  a = d[x]
if 1 <= y <= 3:
  b = d[y]

print(a+b)

Buggy submission (verdict: Runtime Error):
x,y = map(int, input().split())
d = {1:300000, 2:200000, 3:100000}
if x == y == 1:
  print(1000000)
  exit()
a = 0, b = 0
if 1 <= x <= 3:
  a = d[x]
if 1 <= y <= 3:
  b = d[x]

print(a+b)
Problem p02855 (python)

Fixed submission:
h, w, k = map(int, input().split())
a = []
ans = []
no = [True] * h
for i in range(h):
    a.append(input())
    ans.append([0] * w)

color = 1
last_i = 0
for i in range(h):
    last_j = 0
    found = False
    for j in range(w):
        if a[i][j] == '#':
            for k in range(last_i, i+1):
                for l in range(last_j, j+1):
                    ans[k][l] = color
            last_j = j+1
            color += 1
            found = True
    if found:
        last_i = i+1

for i in range(h):
    for j in range(w-1):
        if ans[i][j+1] == 0:
            ans[i][j+1] = ans[i][j]
for i in range(h-1):
    for j in range(w):
        if ans[i+1][j] == 0:
            ans[i+1][j] = ans[i][j]

for i in range(h):
    for j in range(w):
        print(ans[i][j], end=' ')
    print('')

Buggy submission (verdict: Runtime Error):
m = int(input())
d = []
c = []
s = 0
ans = -1
for i in range(m):
  d,c = map(int,input().split())
  s += d*c
  ans += c + (d*c) // 10 - len(str(d*c)) + 1

while s >= 10:
  tmp = s
  l = []
  while tmp > 0:
    l.append(tmp%10)
    tmp //= 10
  ans += len(l) - 1 + sum(l)//10 - len(str(sum(l))) + 1
  s = sum(l)
print(ans)
Problem p02882 (python)

Fixed submission:
import math
a,b,x = map(int, input().split())
if a * a * b == x:
  print(0)
  exit()
if x / a / a >= b / 2:
  print(90 - math.degrees(math.atan(a/2/(b-(x/a/a)))))
else:
  print(90 - math.degrees(math.atan(2*x/a/b/b)))

Buggy submission (verdict: Runtime Error):
import math
a,b,x = map(int, input().split())
if x / a / a >= b / 2:
  print(90 - math.degrees(math.atan(a/2/(b-(x/a/a)))))
else:
  print(90 - math.degrees(math.atan(2*x/a/b/b)))

Buggy submission (verdict: Runtime Error):
import math
a,b,x = map(int, input().split())
if x / a / a >= b / 2:
  print(90 - math.degrees(math.atan(a/2/(b-(x/a/a)))))
else:
  print(90 - math.degrees(math.atan(2*x/a/b/b)))

Buggy submission (verdict: Runtime Error):
a,b,x = map(int, input().split())
if x / a / a >= b / 2:
  print(90 - math.degrees(math.atan(a/2/(b-(x/a/a)))))
else:
  print(90 - math.degrees(math.atan(2*x/a/b/b)))

Buggy submission (verdict: Runtime Error):
a,b,x = map(int, input().split())
if x / a / a >= b / 2:
  print(90 - math.degrees(math.atan(a/2/(b-(x/a/a)))))
else:
  print(math.degrees(math.atan(2*x/a/b/b)))
Problem p02888 (python)

Fixed submission:
from bisect import bisect
from bisect import bisect_left
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
  for j in range(i+1, n):
    left = l[j]-l[i]
    right = l[i]+l[j]
    ans += max(0, bisect_left(l, right) - max(j+1, bisect(l,left)))
print(ans)

Buggy submission (verdict: Runtime Error):
from bisect import bisect
from bisect import bisect_left
n = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(n):
  for j in range(i+1, n):
    left = abs(a-b)
    right = a+b
    ans += max(0, bisect_left(l, right) - bisect(l,left))
    if left < a < right:
      ans -= 1
    if left < b < right:
      ans -= 1
print(ans)
Problem p02898 (python)

Fixed submission:
n,k = map(int, input().split())
h = list(map(int, input().split()))
ans = 0
for i in h:
  if i >= k:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input().split())
ans = 0
for i in range(n):
  if int(input()) >= k:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,k = map(int, input())
ans = 0
for i in range(n):
  if int(input()) >= k:
    ans += 1
print(ans)
Problem p02899 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
  b.append((a[i], i+1))
for x,y in sorted(b):
  print(y, end=" ")

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
b = {}
for i in range(n):
  b.add((a[i], i+1))
for x,y in sorted(b):
  print(y, end=" ")
Problem p02910 (python)

Fixed submission:
s = input()
for i in range(len(s)):
  if i % 2 == 0 and s[i] == "L":
    print("No")
    exit()
  elif i % 2 == 1 and s[i] == "R":
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
for i in range(len()s):
  if i % 2 == 0 and s[i] == "R":
    print("No")
    exit()
  elif i % 2 == 1 and s[i] == "L":
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
for i in range(len()s):
  if i % 2 == 0 and s[i] == "R":
    print("No")
    exit()
  elif i % 2 == 1 and s[i] == "L":
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
for i in range(len()s):
  if i % 2 == 0 && s[i] == "R":
    print("No")
    exit()
  elif i % 2 == 1 && s[i] == "L":
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
for i in range(len()s):
  if i % 2 == 0 && s[i] == "R":
    print("No")
    exit()
  elif i % 2 == 1 %% s[i] == "L":
    print("No")
    exit()
print("Yes")
Problem p02911 (python)

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

for x in a:
  if k - q + x > 0:
    print("Yes")
  else:
    print("No")

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

for x in a:
  if k - q + x > 0:
    print("Yes")
  else:
    print("No")

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

for x in a:
  if k - q + x > 0:
    print("Yes")
  else:
    print("No")
Problem p02918 (python)

Fixed submission:
n, k = map(int, input().split())
s = input()

if n == 1:
    print(0)
    exit()

two = 0
pre = s[0]
cont = 1
ans = 0
for c in s[1:]:
    if c != pre:
        if c == s[0]:
            two += 1
        ans += cont - 1
        cont = 1
        pre = c
    else:
        cont += 1
ans += cont - 1

if s[0] != s[-1] and k > two:
    ans += 1
print(ans + 2 * min(k, two))

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

if n == 1:
  print(0)
  exit()

two = 0
pre = s[0]
cont = 1
for c in s[1:]:
  if c != pre:
    if c == s[0]:
      two += 1
    ans += cont-1
    cont = 1
    pre = c
  else:
    cont += 1
ans += cont-1

if s[0] != s[1]:
  ans += 1
print(ans + 2*min(k,two))

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

if n == 1:
  print(0)
  exit()

pre = s[0]
cont = 1
for c in s[1:]:
  if c != pre:
    if c == s[0]:
      two += 1
    ans += cont-1
    cont = 1
    pre = c
  else:
    cont += 1
ans += cont-1

if s[0] != s[1]:
  ans += 1
print(ans + 2*min(k,two))

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

pre = s[0]
cont = 1
for c in s[1:]:
  if c != pre:
    if c == s[0]:
      two += 1
    ans += cont-1
    cont = 1
  else:
    cont += 1
ans += cont-1

print(ans)
Problem p02922 (python)

Fixed submission:
import math
a,b = map(int, input().split())
print(math.ceil(((b-1)/(a-1))))

Buggy submission (verdict: Runtime Error):
a,b = map(input().split())
print(math.ceil(((b-1)/(a-1))))

Buggy submission (verdict: Runtime Error):
a,b = map(input().split())
print(math.ceil(((b-1)/(a-1)))
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
ans = 0
move = 0
for i in range(n-1):
  if h[i] >= h[i+1]:
    move += 1
    ans = max(ans, move)
  else:
    move = 0
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
ans = 0
move = 0
for i in range(n):
  if h[i] >= h[i+1]:
    move += 1
    ans = max(ans, move)
  else:
    move = 0
print(ans)
Problem p02934 (python)

Fixed submission:
n = int(input())
a = list(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 = list(map(int, input().split()))

ans = 0
for i in a:
  ans += 1/a
  
print(1/ans)
Problem p02947 (python)

Fixed submission:
n = int(input())
s = []
for i in range(n):
    s.append(''.join(sorted(list(input()))))
s.sort()

ans = 0
count = 1
s_pre = s[0]

for i in range(1, n):
    if s_pre == s[i]:
        count += 1
    else:
        ans += int(count * (count - 1) / 2)
        s_pre = s[i]
        count = 1

ans += int(count * (count - 1) / 2)
print(int(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(n):
  s.append(input())

b = [False]*n
ans = 0
count = 1

for i in range(n):
  if b[i]:
    continue
  for j in range(i+1, n):
    if ana(s[i], s[j]):
      count += 1
      b[j] = True
  ans += count * (count-1) / 2
  count = 1
  b[i] = True
  
print(ans)
  
def ana(s1, s2):
  b = [False] * len(s1)
  for i in range(len(s1)):
    for j in range(len(s2)):
      if b[j]:
        continue
      if s1[i] == s2[j]:
        b[j] = True
  for i in range(len(s1)):
    if not b[i]:
      return False
  return True
Problem p02953 (python)

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

minimum = 1000000000
for i in range(n-1, -1, -1):
  minimum = min(h[i], minimum)
  if h[i] > minimum + 1:
    print("No")
    exit()
print("Yes")

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

minimum = 1000000000
for i in range(n-1, -1, -1):
  minimum = min(s[i], minimum)
  if s[i] > minimum + 1:
    print("No")
print("Yes")

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

minimum = 1000000000
for i in range(n-1, -1, -1):
  minimum = min(s[i], minimum)
  if s[i] > minimum + 1:
    print("No")
print("Yes")
Problem p02958 (python)

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

ans = 0
for i in range(len(a)):
  if i != a[i]-1:
    ans += 1
    
if ans <= 2:
  print("YES")
else:
  print("NO")

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

ans = 0
for i in range(len(a)):
  if i != a[i]-1:
    ans += 1
    
if ans <= 2:
  print("YES")
else:
  print("NO")

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

ans = 0
for i in a:
  if i != a[i]-1:
    ans += 1
    
if ans <= 2:
  print("YES")
else:
  print("NO")

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

ans = 0
for i in a:
  if i != a[i]:
    ans += 1
    
if ans <= 2:
  print("YES")
else:
  print("NO")
Problem p02995 (python)

Fixed submission:
a, b, c, d = map(int, input().split())
 
def gcd(x, y):
    if x % y == 0:
        return y
    return gcd(y, x%y)
 
cd = c // gcd(c,d) * d

a -= 1
a_ = a - a//c - a//d + a//cd
b_ = b - b//c - b//d + b//cd
 
print(b_ - a_)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int, input().split())
cd = math.gcd(c, d)
 
def f(x,y,div):
  return int(max(x,y)/div) - int((min(x,y)-1) / div)
print(a-b+1- f(a,b,c) - f(a,b,d) + f(a,b,cd))

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d = map(int, input().split())
cd = math.gcd(cd)
 
def f(x,y,div):
  return int(max(x,y)/div) - int((min(x,y)-1) / div)
print(a-b+1- f(a,b,c) - f(a,b,d) + f(a,b,cd))

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

def f(x,y,div):
  return int(max(x,y)/div) - int((min(x,y)-1) / div)
print(a-b+1- f(a,b,c) - f(a,b,d) + f(a,b,cd))