Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math
a,b,n = map(int,input().split())
if b != 1:
    x = min(n, b-1)
    while x <= n:
        Max = max(math.floor(a*x/b) - a*math.floor(x/b),Max)
        x += b
else:
    Max = 0
print(Max)

Fixed submission:
import math
a,b,n = map(int,input().split())
Max = 0
if b != 1:
    x = min(n, b-1)
    while x <= n:
        Max = max(math.floor(a*x/b) - a * math.floor(x/b),Max)
        x += b
else:
    Max = 0
print(Max)
Buggy python submission (verdict: Runtime Error):
import numpy as np

k,n = map(int,input().split())
a_ls = list(map(int,input().split()))

next_ls = [0] * n
for i in range(n-1):
    next_ls[i] = a_ls[i+1] - a_ls[i]
next_ls[n-1] = k - a_ls[-1] + a_ls[0]
argmax = np.argmax(next_ls)
next_ls.pop(argmax)
print(sum(next_ls))


Fixed submission:
import numpy as np

k,n = map(int,input().split())
a_ls = list(map(int,input().split()))

next_ls = [0] * n
for i in range(n-1):
    next_ls[i] = a_ls[i+1] - a_ls[i]
next_ls[n-1] = k - a_ls[-1] + a_ls[0]
argmax = np.argmax(next_ls)
next_ls.pop(argmax)
print(sum(next_ls))

Buggy python submission (verdict: Time Limit Exceeded):
k,n = map(int,input().split())
a_ls = list(map(int,input().split()))

next_ls = [0] * n
for i in range(n-1):
    next_ls[i] = a_ls[i+1] - a_ls[i]
next_ls[n-1] = k - a_ls[-1] + a_ls[0]
next_ls = next_ls * 2

dist = float('inf')
for i in range(n):
    costs = next_ls[i:i+n-1]
    sum_ = sum(costs)
    if sum_ < dist:
        dist = sum_

print(dist)

Fixed submission:
import numpy as np

k,n = map(int,input().split())
a_ls = list(map(int,input().split()))

next_ls = [0] * n
for i in range(n-1):
    next_ls[i] = a_ls[i+1] - a_ls[i]
next_ls[n-1] = k - a_ls[-1] + a_ls[0]
argmax = np.argmax(next_ls)
next_ls.pop(argmax)
print(sum(next_ls))

Buggy python submission (verdict: Time Limit Exceeded):
k,n = map(int,input().split())
a_ls = list(map(int,input().split()))

next_ls = [0] * n
for i in range(n-1):
    next_ls[i] = a_ls[i+1] - a_ls[i]
next_ls[n-1] = k - a_ls[-1] + a_ls[0]
next_ls = next_ls * 2

dist = float('inf')
for i in range(n):
    costs = next_ls[i:i+n-1]
    sum_ = sum(costs)
    if sum_ < dist:
        dist = sum_

print(dist)

Fixed submission:
import numpy as np

k,n = map(int,input().split())
a_ls = list(map(int,input().split()))

next_ls = [0] * n
for i in range(n-1):
    next_ls[i] = a_ls[i+1] - a_ls[i]
next_ls[n-1] = k - a_ls[-1] + a_ls[0]
argmax = np.argmax(next_ls)
next_ls.pop(argmax)
print(sum(next_ls))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
flip = 1
right_edge = s
left_edge = ''
for i in range(q):
    query = input()
    if query[0] == '1':
        flip *= -1
    else:
        if query[2] == '1':
            if flip == 1:
                left_edge += query[-1]
            else:
                right_edge += query[-1]
        else:
            if flip == 1:
                right_edge += query[-1]
            else:
                left_edge += query[-1]
left_edge = left_edge[::-1]
if flip == 1:
    print(left_edge + right_edge)
else:
    print(right_edge[::-1] + left_edge[::-1])
        



Fixed submission:
s = input()
q = int(input())
flip = 1
right_edge = list(s)
left_edge = []
for i in range(q):
    query = input()
    if query[0] == '1':
        flip *= -1
    else:
        if query[2] == '1':
            if flip == 1:
                left_edge.append(query[-1])
            else:
                right_edge.append(query[-1])
        else:
            if flip == 1:
                right_edge.append(query[-1])
            else:
                left_edge.append(query[-1])
left_edge = left_edge[::-1]
if flip == 1:
    print(''.join(left_edge + right_edge))
else:
    print(''.join(right_edge[::-1] + left_edge[::-1]))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
q = int(input())
flip = 1
right_edge = s
left_edge = ''
for i in range(q):
    query = input()
    if query[0] == '1':
        flip *= -1
    else:
        if query[2] == '1':
            if flip == 1:
                left_edge = query[-1] + left_edge
            else:
                right_edge += query[-1]
        else:
            if flip == 1:
                right_edge += query[-1]
            else:
                left_edge = query[-1] + left_edge
if flip == 1:
    print(left_edge + right_edge)
else:
    print(right_edge[::-1] + left_edge[::-1])
        



Fixed submission:
s = input()
q = int(input())
flip = 1
right_edge = list(s)
left_edge = []
for i in range(q):
    query = input()
    if query[0] == '1':
        flip *= -1
    else:
        if query[2] == '1':
            if flip == 1:
                left_edge.append(query[-1])
            else:
                right_edge.append(query[-1])
        else:
            if flip == 1:
                right_edge.append(query[-1])
            else:
                left_edge.append(query[-1])
left_edge = left_edge[::-1]
if flip == 1:
    print(''.join(left_edge + right_edge))
else:
    print(''.join(right_edge[::-1] + left_edge[::-1]))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int,input().split()))

a_set = set(a_slit)
if len(a_list) == len(set):
    print('YES')
else:
    print('NO')

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

a_set = set(a_list)
if len(a_list) == len(a_set):
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p_ls = list(map(int, input().split()))
e_ls = [0] * n
for i in range(n):
    p = p_ls[i]
    e = (p*(1+p) // 2) / p
    e_ls[i] = e
max_exp = 0
for start in range(n):
    sum_exp = sum(e_ls[start:start+k])
    max_exp = max(max_exp, sum_exp)
print(max_exp)

Fixed submission:
import numpy as np
n,k = map(int,input().split())
p_ls = list(map(int, input().split()))
e_ls = [0] * n
for i in range(n):
    p = p_ls[i]
    e = (p*(1+p) // 2) / p
    e_ls[i] = e
e_csum = list(np.cumsum(e_ls))
max_exp = 0
for start in range(n):
    if start > 0 and start+k-1 < n:
        sum_exp = e_csum[start+k-1] - e_csum[start-1]
    elif start == 0:
        sum_exp = e_csum[start + k - 1]
    max_exp = max(max_exp, sum_exp)
print(max_exp)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p_list = list(map(int,input().split()))
ans = 0
for i in range(n):
    if min(p_list[:i+1]) >= p_list[i]:
        ans += 1
print(ans)    

Fixed submission:
n = int(input())
p_ls = list(map(int,input().split()))
min_ = float('inf')
count = 0
for i in range(n):
    if p_ls[i] < min_:
        count += 1
        min_ = p_ls[i]
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import copy
H,W = map(int,input().split())
grid = [[0]*W for _ in range(H)]
for i in range(H):
    grid[i] = list(input())
ans = 0
for sy in range(H):
    for sx in range(W):
        for gy in range(H):
            for gx in range(W):
                if sy == gy and sx == sy:
                    continue
                now_grid = copy.deepcopy(grid)
                time_grid = [[-1]*W for _ in range(H)]
                queue = deque()
                queue.append([sy,sx,0])
                now_grid[sy][sx] = '#'
                while queue:
                    y,x,t = queue.popleft()
                    for next_y, next_x in [[y+1, x],[y,x+1],[y-1,x],[y,x-1]]:
                        if 0<= next_y < H and 0 <= next_x < W and now_grid[next_y][next_x] != '#':
                            queue.append([next_y,next_x,t+1])
                            time_grid[next_y][next_x] = t+1
                            now_grid[next_y][next_x] = '#'
                ans = max(ans, time_grid[gy][gx])
print(ans)



Fixed submission:
from collections import deque
import copy
H,W = map(int,input().split())
grid = [[0]*W for _ in range(H)]
for i in range(H):
    grid[i] = list(input())
ans = 0
for sy in range(H):
    for sx in range(W):
        if grid[sy][sx] == '#':
            continue
        now_grid = copy.deepcopy(grid)
        time_grid = [[-1]*W for _ in range(H)]
        queue = deque()
        queue.append([sy,sx,0])
        now_grid[sy][sx] = '#'
        while queue:
            y,x,t = queue.popleft()
            for next_y, next_x in [[y+1, x],[y,x+1],[y-1,x],[y,x-1]]:
                if 0<= next_y < H and 0 <= next_x < W and now_grid[next_y][next_x] != '#':
                    queue.append([next_y,next_x,t+1])
                    time_grid[next_y][next_x] = t+1
                    now_grid[next_y][next_x] = '#'
        Max= 0
        for i in range(H):
            for j in range(W):
                Max = max(Max,time_grid[i][j])
        ans = max(ans, Max)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int,input().split())
for _ in range(k):
    if a >0:
        a -=1
    elif a ==0 and b > 0:
        b -=1
print (a,b)
    

Fixed submission:
a,b,k = map(int,input().split())
A = max(a-k,0)
B = max(b-max(k-a,0),0)
print(A,B)

Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int,input().split())
for _ in range(k):
    if a >0:
        a -=1
    elif a ==0 and b > 0:
        b -=1
print (a,b)
    

Fixed submission:
a,b,k = map(int,input().split())
A = max(a-k,0)
B = max(b-max(k-a,0),0)
print(A,B)
Buggy python submission (verdict: Runtime Error):
import fractions
a, b = map(int,input().split())
def jk(j,k):
    return j*k//fractions.gcd(j,k)
print(jk(a, b))

Fixed submission:
a, b = [int(input()) for _ in range(2)]
set_ = {1,2,3}
set_.discard(a)
set_.discard(b)
print(set_.pop())
Buggy python submission (verdict: Runtime Error):
import math
def jk(j,k):
    return j*k//math.gcd(j,k)
a, b = map(int,input().split())
print(jk(a, b))

Fixed submission:
import fractions
a, b = map(int,input().split())
def jk(j,k):
    return j*k//fractions.gcd(j,k)
print(jk(a, b))

Buggy python submission (verdict: Runtime Error):
import math
def jk(j,k):
    return j*k//math.gcd(a,b)
a, b = map(int,input().split())
print(jk(a, b))

Fixed submission:
import fractions
a, b = map(int,input().split())
def jk(j,k):
    return j*k//fractions.gcd(j,k)
print(jk(a, b))

Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int,input().split())
def min_multi(x,y):
    for i in range(1,y+1):
        for j in range(1,x+1):
            if x*i == y*j:
                return x*i
print(min_multi(a,b))


Fixed submission:
import fractions
a, b = map(int,input().split())
def jk(j,k):
    return j*k//fractions.gcd(j,k)
print(jk(a, b))
Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
if sum(list) >= 22:
  print('bust')
else:
  print('win')

Fixed submission:
a = list(map(int,input().split()))
if sum(a) >= 22:
    print('bust')
else:
    print('win')

Buggy python submission (verdict: Runtime Error):
a = list(map(int,input().split()))
if sum(list) >= 22:
  print('bust')
else:
  print('win')

Fixed submission:
a = list(map(int,input().split()))
if sum(a) >= 22:
    print('bust')
else:
    print('win')
Buggy python submission (verdict: Time Limit Exceeded):
from copy import copy
n = int(input())
a_ls = list(map(int, input().split()))
c_bin = [[0]*60 for _ in range(n)]
a_bin_ls = [[0]*60 for _ in range(n)]
now_bin = [0] * 60
for i in range(n-1,-1,-1):
    a = a_ls[i]
    j = 0
    while True:
        if a == 1:
            now_bin[j] += 1
            a_bin_ls[i][j] = 1
            break
        elif a == 0:
            break
        a,r = divmod(a,2)
        now_bin[j] += r 
        a_bin_ls[i][j] = r
        j += 1
    c_bin[i] = copy(now_bin)
ans_bin = [0]*60
for i in range(n-1):
    a_bin = a_bin_ls[i]
    for j in range(60):
        if a_bin[j] == 0:
            times = c_bin[i+1][j]
        else:
            times = n - (i+1) - c_bin[i+1][j]
        ans_bin[j] += times
ans = 0
mod = 10**9+7
for i in range(60):
    ans += 2**i * (ans_bin[i]%mod)
    ans %= mod
print(ans)




Fixed submission:
from copy import copy
n = int(input())
a_ls = list(map(int, input().split()))
c_bin = [[0]*60 for _ in range(n)]
a_bin_ls = [[0]*60 for _ in range(n)]
now_bin = [0] * 60
for i in range(n-1,-1,-1):
    a = a_ls[i]
    j = 0
    while True:
        if a == 1:
            now_bin[j] += 1
            a_bin_ls[i][j] = 1
            break
        elif a == 0:
            break
        a,r = divmod(a,2)
        now_bin[j] += r 
        a_bin_ls[i][j] = r
        j += 1
    c_bin[i] = copy(now_bin)
ans_bin = [0]*60
for i in range(n-1):
    a_bin = a_bin_ls[i]
    for j in range(60):
        if a_bin[j] == 0:
            times = c_bin[i+1][j]
        else:
            times = n - (i+1) - c_bin[i+1][j]
        ans_bin[j] += times
ans = 0
mod = 10**9+7
for i in range(60):
    ans += 2**i * (ans_bin[i]%mod)
    ans %= mod
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7)
n = int(input())
S = input()
used_ls = [0] * 1000
def dfs(s):
    if len(s) == 3:
        target = ''
        for i in s:
            ind = int(i)
            target += S[ind]
        used_ls[int(target)] = 1
    if len(s) > 0:
        last = int(s[-1])
    else:
        last = -1
    for nex in range(last+1,n):
        s += str(nex)
        dfs(s)
        s = s[:-1]
dfs('')
print(sum(used_ls)) 


Fixed submission:
n = int(input())
s = input()
ans = 0
for pin in range(10**3):
    str_pin = str(pin)
    str_pin = str_pin.zfill(3)
    nex = 0
    for i in range(n):
        searching_for = str_pin[nex]
        now_s = s[i]
        if searching_for == now_s:
            nex += 1
            if nex == 3:
                ans += 1
                break
print(ans)
Buggy python submission (verdict: Runtime Error):
str_d = input().replace("SUN","7").replace("MON","6").replace("TUE","5").replace("WED","4").replace("THU","3").replace("FRI","2").replace("SUT","1")
ans = int(str_d)
print(ans)

Fixed submission:
str_d = input().replace("SUN","7").replace("MON","6").replace("TUE","5").replace("WED","4").replace("THU","3").replace("FRI","2").replace("SAT","1")
ans = int(str_d)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
def comb(n,k,p):
  """power_funcを用いて(nCk) mod p を求める"""
  from math import factorial
  if n<0 or k<0 or n<k: return 0
  if n==0 or k==0: return 1
  a=factorial(n) %p
  b=factorial(k) %p
  c=factorial(n-k) %p
  return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p
def power_func(a,b,p):
  """a^b mod p を求める"""
  if b==0: return 1
  if b%2==0:
    d=power_func(a,b//2,p)
    return d*d %p
  if b%2==1:
    return (a*power_func(a,b-1,p ))%p
mod = 10**9+7
x,y = map(int,input().split())
if (x+y) % 3 != 0:
    res = 0
else:
    m = (2 * x - y) // 3
    n = (2 * y - x) // 3
    if m < 0 or n < 0:
        res = 0
    else:
        res = comb(n+m, n, mod)
print(res)


Fixed submission:
def cmb(n, k, mod, fac, ifac):
    """
    nCkを計算する
    """
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % mod


def make_tables(mod, n):
    """
    階乗テーブル、逆元の階乗テーブルを作成する
    """
    fac = [1, 1] # 階乗テーブル・・・(1)
    ifac = [1, 1] #逆元の階乗テーブル・・・(2)
    inverse = [0, 1] #逆元テーブル・・・(3)
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        ifac.append((ifac[-1] * inverse[-1]) % mod)
    return fac, ifac
mod = 10**9+7
x,y = map(int,input().split())
if (x+y) % 3 != 0:
    res = 0
else:
    m = (2 * x - y) // 3
    n = (2 * y - x) // 3
    if m < 0 or n < 0:
        res = 0
    else:
        total = n+m
        k = n
        fac,ifac = make_tables(mod, total)
        res = cmb(total, k, mod, fac, ifac)
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(1000000)
x,y = map(int,input().split())
def count(x,y):
    if (y+x) % 3 != 0 or y > 2 * x or y < x / 2:
        return 0
    elif x == 0 and y == 0:
        return 1
    else:
        return count(x-1, y-2) + count(x-2, y-1)
print(count(x,y))

Fixed submission:
def cmb(n, k, mod, fac, ifac):
    """
    nCkを計算する
    """
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % mod


def make_tables(mod, n):
    """
    階乗テーブル、逆元の階乗テーブルを作成する
    """
    fac = [1, 1] # 階乗テーブル・・・(1)
    ifac = [1, 1] #逆元の階乗テーブル・・・(2)
    inverse = [0, 1] #逆元テーブル・・・(3)
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        ifac.append((ifac[-1] * inverse[-1]) % mod)
    return fac, ifac
mod = 10**9+7
x,y = map(int,input().split())
if (x+y) % 3 != 0:
    res = 0
else:
    m = (2 * x - y) // 3
    n = (2 * y - x) // 3
    if m < 0 or n < 0:
        res = 0
    else:
        total = n+m
        k = n
        fac,ifac = make_tables(mod, total)
        res = cmb(total, k, mod, fac, ifac)
print(res)
Buggy python submission (verdict: Runtime Error):
n = int(input())
ls = make_divisors(n)
pairs = []
for i in ls:
    pair = (i, n//i)
    pairs.append(pair)
count = []
for pair in pairs:
    count.append(pair[0] + pair[1] - 2)
print(min(count))

Fixed submission:
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

n = int(input())
ls = make_divisors(n)
pairs = []
for i in ls:
    pair = (i, n//i)
    pairs.append(pair)
count = []
for pair in pairs:
    count.append(pair[0] + pair[1] - 2)
print(min(count))
Buggy python submission (verdict: Runtime Error):
n = int(input())
h_list = list(map(int,input().split()))
count = {}
for i in range(len(h_list)-1):
    count[i] = 0
    j = i
    while j < n-1:
        if h_list[j] >= h_list[j+1]:
            count[i] += 1
            j += 1

        else:
            break
ls = sorted(count.items(), key=lambda x: x[1])
print(ls[-1][1])

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

count = 0
bestcount = count
for i in range(n-1):
    if h_list[i] >= h_list[i+1]:
        count += 1
    else:
        bestcount = max(count,bestcount)
        count= 0
print(max(count,bestcount))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
h_list = list(map(int,input().split()))
count = {}
for i in range(len(h_list)-1):
    if h_list[i] >= h_list[i+1]:
        count[i] = 0
        j = i
        while j < n-1:
            if h_list[j] >= h_list[j+1]:
                count[i] += 1
                j += 1

            else:
                break
if count:
    ls = sorted(count.items(), key=lambda x: x[1])
    print(ls[-1][1])
else:
    print(0)

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

count = 0
bestcount = count
for i in range(n-1):
    if h_list[i] >= h_list[i+1]:
        count += 1
    else:
        bestcount = max(count,bestcount)
        count= 0
print(max(count,bestcount))
Buggy python submission (verdict: Runtime Error):
n = int(input())
print(N*(N-1)//2)

Fixed submission:
N = int(input())
print(N*(N-1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**7)
num_ver, times_plus = map(int,input().split())
graph_ls = [[] for _ in range(num_ver)]
for i in range(num_ver-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    graph_ls[a].append(b)
    graph_ls[b].append(a)

point_ls = [0] * num_ver
for i in range(times_plus):
    ver, point = map(int,input().split())
    ver -= 1
    point_ls[ver] += point

ans_ls = [0] * num_ver
visited_ls = [0] * num_ver

def dfs(ver,point_before):
    visited_ls[ver] = 1
    point_after = point_before + point_ls[ver]
    ans_ls[ver] = point_after
    for nex in graph_ls[ver]:
        if not visited_ls[nex]:
            dfs(nex, point_after)

dfs(0,0)
for ans in ans_ls:
    print(ans)

Fixed submission:
from collections import deque
n,q = map(int,input().split())
ad_ls = [[] for _ in range(n+1)]
count_ls = [0] * (n+1)
done_ls = [0] * (n+1)
for i in range(n-1):
    a,b = map(int,input().split())
    ad_ls[a].append(b)
    ad_ls[b].append(a)
for i in range(q):
    p,x = map(int,input().split())
    count_ls[p] += x
def turn(ver):
    if ad_ls[ver]:
        for ad in  ad_ls[ver]:
            if not done_ls[ad]:
                count_ls[ad] += count_ls[ver]
                q.append(ad)
    done_ls[ver] = 1
q = deque()
q.append(1)
while len(q) > 0:
    target = q.popleft()
    turn(target)
count_ls = list(map(str, count_ls))
print(' '.join(count_ls[1:]))
Buggy python submission (verdict: Time Limit Exceeded):
mod = 10**9+7
s = input()
N = len(s)

dp = [[0]*13 for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(13):
        if s[i] == '?':
            for x in range(10):
                dp[i+1][(10*j+x)%13] += dp[i][j]
                dp[i+1][(10*j+x)%13] %= mod
        else:
            x = int(s[i])
            dp[i+1][(10*j+x)%13] += dp[i][j]
            dp[i+1][(10*j+x)%13] %= mod

print(dp[N][5])

Fixed submission:
mod = 10**9+7
s = input()
N = len(s)

dp = [[0]*13 for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(13):
        if s[i] == '?':
            for x in range(10):
                dp[i+1][(10*j+x)%13] += dp[i][j]
                dp[i+1][(10*j+x)%13] %= mod
        else:
            x = int(s[i])
            dp[i+1][(10*j+x)%13] += dp[i][j]
            dp[i+1][(10*j+x)%13] %= mod

print(dp[N][5])
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
from fractions import gcd

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

count_b = b - b//c - b//d + b//lcm(c,d)
count_a = a-1 - (a-1)//c - (a-1)//d + (a-1)//lcm(c,d)
print(count_b-count_a)

Fixed submission:
s = input()
list_s = [i for i in s]
for i in range(3):
    if list_s[i] == list_s[i+1]:
        print('Bad')
        exit()
print('Good')
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
from fractions import gcd

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

count_b = b - b//c - b//d + b//lcm(c,d)
count_a = a-1 - (a-1)//c - (a-1)//d + (a-1)//lcm(c,d)
print(count_b-count_a)

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

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

count_b = b - b//c - b//d + b//lcm(c,d)
count_a = a-1 - (a-1)//c - (a-1)//d + (a-1)//lcm(c,d)
print(count_b-count_a)

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

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

count_b = b - b//c - b//d + b//lcm(c,d)
count_a = a-1 - (a-1)//c - (a-1)//d + (a-1)//lcm(c,d)
print(count_b-count_a)

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

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

count_b = b - b//c - b//d + b//lcm(c,d)
count_a = a-1 - (a-1)//c - (a-1)//d + (a-1)//lcm(c,d)
print(count_b-count_a)