Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
    import math
     
    n, a, b = map(int, input().split(" "))
     
    h = []
    for i in range(n):
        h.append(int(input()))
     
    h.sort(reverse=True)
     
     
    def check(count_target, h, a, b):
        count = 0
     
        for i in h:
            if i >= count_target * b:
                count += math.ceil((i - count_target * b) / (a - b))
        return count_target - count
     
     
    l = 1
    r = math.ceil(h[0] / b)
     
     
    while r - l > 1:
        mid = math.floor(l + (r - l) / 2)
     
        if check(mid, h, a, b) < 0:
            l = mid
        else:
            r = mid
     
     
    if check(l, h, a, b) < 0:
        print(int(r))
    else:
        print(int(l))

Fixed submission:
import math

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

h = []
for i in range(n):
    h.append(int(input()))

h.sort(reverse=True)


def check(count_target, h, a, b):
    count = 0

    for i in h:
        if i >= count_target * b:
            count += math.ceil((i - count_target * b) / (a - b))
    return count_target - count


l = 1
r = math.ceil(h[0] / b)


while r - l > 1:
    mid = math.floor(l + (r - l) / 2)

    if check(mid, h, a, b) < 0:
        l = mid
    else:
        r = mid


if check(l, h, a, b) < 0:
    print(int(r))
else:
    print(int(l))

Buggy python submission (verdict: Time Limit Exceeded):
import math

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

h = []
for i in range(n):
    h.append(int(input()))

h.sort(reverse=True)


def check(count_target, h, a, b):
    count = 0

    for i in h:
        if i >= count_target * b:
            count += math.ceil((i - count_target * b) / (a-b))
    return count_target - count


count = 1
while check(count, h, a, b) < 0:
    count *= 2

count /= 2
basis_count = count

while basis_count >= 1:

    if check(count + basis_count - 1, h, a, b) < 0:
        count += basis_count
    basis_count /= 2


while check(count,h,a,b) < 0:

    count += 1

print(int(count))


Fixed submission:
import math

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

h = []
for i in range(n):
    h.append(int(input()))

h.sort(reverse=True)


def check(count_target, h, a, b):
    count = 0

    for i in h:
        if i >= count_target * b:
            count += math.ceil((i - count_target * b) / (a - b))
    return count_target - count


l = 1
r = math.ceil(h[0] / b)


while r - l > 1:
    mid = math.floor(l + (r - l) / 2)

    if check(mid, h, a, b) < 0:
        l = mid
    else:
        r = mid


if check(l, h, a, b) < 0:
    print(int(r))
else:
    print(int(l))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N,K,Q = map(int, input().split())
    res = [K]*N
    for _ in range(Q):
        a = int(input())
        a -= 1
        for n in range(N):
            if n != a:
                res[n] -= 1
    for x in res:
        if 0<x: print('Yes')
        else: print('No')

if __name__ == '__main__':
    main()

Fixed submission:
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N,K,Q = map(int, input().split())
    res = [0]*N
    for _ in range(Q):
        a = int(input())
        a -= 1
        res[a] += 1
    for x in res:
        if 0 < (K-Q+x): print('Yes')
        else: print('No')

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
from heapq import *
from collections import defaultdict

n, m = map(int, input().split())
jobs = defaultdict(list)
for _ in range(n):
    a, b = map(int, input().split())
    jobs[a].append(-b)

result = 0
pool = []
for i in range(1, m+1):
    pool += jobs[i]
    heapify(pool)
    if 0 < len(pool):
        result += -heappop(pool)

print(result)

Fixed submission:
from heapq import *
from collections import defaultdict

n, m = map(int, input().split())
jobs = defaultdict(list)
for _ in range(n):
    a, b = map(int, input().split())
    jobs[a].append(-b)

result = 0
pool = []
for i in range(1, m+1):
    for j in jobs[i]:
        heappush(pool, j)
    if 0 < len(pool):
        result += -heappop(pool)

print(result)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict

n, m = map(int, input().split())
jobs = defaultdict(list)
for _ in range(n):
    a, b = map(int, input().split())
    jobs[a].append(b)

result = 0
pool = []
for i in range(1, m+1):
    pool += jobs[i]
    pool = sorted(pool)
    if 0 < len(pool):
        result += pool.pop()

print(result)

Fixed submission:
from heapq import *
from collections import defaultdict

n, m = map(int, input().split())
jobs = defaultdict(list)
for _ in range(n):
    a, b = map(int, input().split())
    jobs[a].append(-b)

result = 0
pool = []
for i in range(1, m+1):
    for j in jobs[i]:
        heappush(pool, j)
    if 0 < len(pool):
        result += -heappop(pool)

print(result)
Buggy python submission (verdict: Runtime Error):
s = list(input())
n = len(s)
children = [0]*n

def runlength(word):
    last_word = ''
    res = []
    for s in word:
        if last_word == s:
            res[-1] += 1
        else:
            res.append(s)
            res.append(1)
            last_word = s
    return ''.join(list(map(str, res)))

cur_total = 0
runlengthed = runlength(s)
for i in range(0, len(runlengthed), 4):
    r_cnt = int(runlengthed[i+1])
    l_cnt = int(runlengthed[i+3])
    first_idx = cur_total+r_cnt-1
    second_idx = first_idx+1
    from_idx = cur_total
    to_idx = cur_total + l_cnt + r_cnt - 1
    children[first_idx] = (r_cnt+1)//2+l_cnt//2
    children[second_idx] = r_cnt//2+(l_cnt+1)//2
    cur_total = cur_total + r_cnt + l_cnt

print(' '.join(list(map(str, children))))


Fixed submission:
s = list(input())
n = len(s)
children = [0]*n

def runlength(word):
    last_word = ''
    res = []
    for s in word:
        if last_word == s:
            res[-1] += 1
        else:
            res.append(s)
            res.append(1)
            last_word = s
    return res

cur_total = 0
runlengthed = runlength(s)
for i in range(0, len(runlengthed), 4):
    r_cnt = int(runlengthed[i+1])
    l_cnt = int(runlengthed[i+3])
    first_idx = cur_total+r_cnt-1
    second_idx = first_idx+1
    children[first_idx] = (r_cnt+1)//2+l_cnt//2
    children[second_idx] = r_cnt//2+(l_cnt+1)//2
    cur_total = cur_total + r_cnt + l_cnt

print(' '.join(list(map(str, children))))
Buggy python submission (verdict: Runtime Error):
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
import numpy as np

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    dams = list(map(int, input().split()))
    smallest_idx = 0
    for i in range(1,N):
        if dams[i] < dams[smallest_idx]:
            smallest_idx = i
    dams = dams[smallest_idx:] + dams[:smallest_idx]

    for i in range(0, dams[0]*2+1, 2):
        mts = [0]*N
        mts[0] = i
        for j in range(1,N):
            mts[j] = (dams[j-1]-mts[j-1]//2)*2
            if mts[j] < 0:
                break
        else:
            if mts[0]//2 + mts[N-1]//2 == dams[N-1]:
                mts = mts[N-smallest_idx:] + mts[:N-smallest_idx]
                print(*mts)
                return 0

if __name__ == '__main__':
    main()

Fixed submission:
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
import numpy as np

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    dams = list(map(int, input().split()))
    S = sum(dams)
    res = [0]*N
    res[0] = S - 2*sum(dams[1:N:2])
    for i in range(1,N):
        res[i] = 2*dams[i-1]-res[i-1]
    print(*res)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
import numpy as np

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    dams = list(map(int, input().split()))
    smallest_idx = 0
    for i in range(1,N):
        if dams[i] < dams[smallest_idx]:
            smallest_idx = i
    dams = dams[smallest_idx:] + dams[:smallest_idx]

    for i in range(0, dams[0]*2+1, 2):
        mts = [0]*N
        mts[0] = i
        for j in range(1,N):
            mts[j] = (dams[j-1]-mts[j-1]//2)*2
            if mts[j] < 0:
                break
        else:
            if mts[0]//2 + mts[N-1]//2 == dams[N-1]:
                mts = mts[N-smallest_idx:] + mts[:N-smallest_idx]
                print(*mts)
                return 0


if __name__ == '__main__':
    main()

Fixed submission:
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
import numpy as np

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    dams = list(map(int, input().split()))
    S = sum(dams)
    res = [0]*N
    res[0] = S - 2*sum(dams[1:N:2])
    for i in range(1,N):
        res[i] = 2*dams[i-1]-res[i-1]
    print(*res)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
import numpy as np

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N,K = map(int, input().split())
    MOD = 10**9+7

    for i in range(1,K+1):
        ans = 0
        a = factorial(N-K+1)//(factorial(N-K+1-i)*factorial(i))
        b = factorial(K-1)//(factorial(K-i)*factorial(i-1))
        print(a*b % MOD)

if __name__ == '__main__':
    main()

Fixed submission:
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
import numpy as np

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N,K = map(int, input().split())
    MOD = 10**9+7

    for i in range(1,K+1):
        if N-K+1-i < 0:
            print(0)
        else:
            a = factorial(N-K+1)//(factorial(N-K+1-i)*factorial(i))
            b = factorial(K-1)//(factorial(K-i)*factorial(i-1))
            print(a*b % MOD)

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

lcm = c*d // math.gcd(c,d)

def calc(x):
    return x-(x//c)-(x//d)+(x//lcm)

print(calc(b)-calc(a-1))

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

lcm = c*d // gcd(c,d)

def calc(x):
    return x-(x//c)-(x//d)+(x//lcm)

print(calc(b)-calc(a-1))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
import numpy as np

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    jobs = [tuple(map(int, input().split())) for _ in range(N)]
    jobs.sort(key=lambda x: x[1])

    cur_time = 0
    while jobs:
        job = jobs.pop(0)
        if job[1] < cur_time + job[0]:
            print("No")
            return 0
        else:
            cur_time += job[0]
    else:
        print("Yes")


if __name__ == '__main__':
    main()

Fixed submission:
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
import numpy as np

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    jobs = [tuple(map(int, input().split())) for _ in range(N)]
    jobs.sort(key=lambda x: x[1])
    jobs = deque(jobs)

    cur_time = 0
    while jobs:
        job = jobs.popleft()
        if job[1] < cur_time + job[0]:
            print("No")
            return 0
        else:
            cur_time += job[0]
    else:
        print("Yes")


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    VS = list(map(int, input().split()))
    CS = list(map(int, input().split()))

    ans = 0
    for bit in range(2**N):
        tmp = 0
        for i in range(N):
            if bit & 1<<i == 0: continue
            tmp += VS[i] - CS[i]
        ans = max(ans, tmp)
    print(ans)

if __name__ == '__main__':
    main()

Fixed submission:
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    VS = list(map(int, input().split()))
    CS = list(map(int, input().split()))

    ans = 0
    for i in range(N):
        if VS[i] - CS[i] > 0:
            ans += VS[i] - CS[i]
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
# from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

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

def main():
    """ main """
    N = int(input())
    AS = list(map(int, input().split()))
    dp = [0]*N
    dp[0] = AS[1]
    for i in range(1,N):
        for j in range(0,i):
            dp[j] = gcd(dp[j],AS[i])
        i_gcd = AS[0]
        for j in range(1,i):
            i_gcd = gcd(AS[j],i_gcd)
        dp[i] = i_gcd
    print(max(dp))


if __name__ == '__main__':
    main()

Fixed submission:
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
# from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

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

def main():
    """ main """
    N = int(input())
    AS = list(map(int, input().split()))
    L = [0]*(N+2)
    R = [0]*(N+2)
    for i in range(0,N):
        L[i+1] = gcd(L[i],AS[i])
    for i in range(N-1,-1,-1):
        R[i] = gcd(R[i+1],AS[i])
    ans = 0
    for i in range(N):
        ans = max(ans, gcd(L[i],R[i+1]))
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
from itertools import combinations
N,A,B = [int(i) for i in input().split()]

v = [int(i) for i in input().split()]
v.sort()

if v[-A] != v[-A-1]:
    print(sum(v[-A:]) / A)
    print(1)
elif v[-1] :
    # AAと同じ数のカウント
    # Aよりも大きい数のカウント
    cnt = 0
    bigger = 0
    for i in range(N):
        if v[A] < v[i]:
            bigger += 1
        if v[i] == v[A]:
            cnt += 1

    ans = 0
    mini = min(B, cnt+bigger)
    for i in range(A,mini):
        ans += len(list(combinations(range(cnt), i - bigger)))

    print(sum(v[-A:]) / A)
    print(ans)

Fixed submission:
A,B = [int(i) for i in input().split()]

hour = (A + B) % 24

print(hour)
Buggy python submission (verdict: Runtime Error):
from itertools import combinations
N,A,B = [int(i) for i in input().split()]

v = [int(i) for i in input().split()]
v.sort()

if v[-A] != v[-A-1]:
    print(sum(v[-A:]) / A)
    print(1)
elif v[-1] :
    # AAと同じ数のカウント
    # Aよりも大きい数のカウント
    cnt = 0
    bigger = 0
    for i in range(N):
        if v[A] < v[i]:
            bigger += 1
        if v[i] == v[A]:
            cnt += 1

    ans = 0
    mini = min(B, cnt+bigger)
    for i in range(A,mini):
        ans += len(list(combinations(range(cnt), i - bigger)))

    print(sum(v[-A:]) / A)
    print(ans)

Fixed submission:
N,A,B = [int(i) for i in input().split()]

v = [int(i) for i in input().split()]
v.sort(reverse=True)

max_average = sum(v[:A]) / A

C = [[0]*51 for i in range(51)]
for i in range(N+1):
    for j in range(i+1):
        if j == 0 or i == 0:
            C[i][j] = 1
        else:
            C[i][j] = C[i-1][j-1] + C[i-1][j]

ans = 0
cnt = 0
if v[0] == v[A-1]:
    for i in range(N):
        if v[i] == v[0]:
            cnt += 1
    for i in range(A, B+1):
        ans += C[cnt][i]
else:
    included = 0
    for i in range(N):
        if v[i] == v[A-1]:
            cnt += 1
            if i < A:
                included += 1
    ans += C[cnt][included]

print(max_average)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from math import gcd
from functools import reduce

K = int(input())

res = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            res += reduce(gcd,(a,b,c))

print(res)


Fixed submission:
from math import gcd

K = int(input())

res = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        tmp = gcd(a,b)
        for c in range(1,K+1):
            res += gcd(tmp,c)

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
res = 0
for i in range(N):
    res += i

print(res)

Fixed submission:
N = int(input())
N -= 1
print(N*(N+1)//2)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
PY = [list(map(int,input().split())) for i in range(N)]

PY_sort = sorted(PY)

tmp = dict()

before = 0
for py in PY_sort:
    if before != py[0]:
        count = 0
    count += 1
    tmp[py] = count

for py in PY:
    print("{:06}{:06}".format(tmp[py][0],tmp[py][1]))

Fixed submission:
N, M = map(int, input().split())
PY = [tuple(map(int,input().split())) for i in range(M)]

PY_sort = sorted(PY)

tmp = dict()

before = 0
for py in PY_sort:
    if before != py[0]:
        before = py[0]
        count = 0
    count += 1
    tmp[py] = count

for py in PY:
    print("{:06}{:06}".format(py[0],tmp[py]))
Buggy python submission (verdict: Time Limit Exceeded):
N,M,Q = map(int, input().split())

LR = [list(map(int, input().split())) for i in range(M)]
pq = [list(map(int, input().split())) for i in range(Q)]

res = [[0]*N for i in range(N)]

def lsadd(L,R):
    L-=1
    R-=1
    for i in range(0,L+1):  
        res[i][R] += 1

for l,r in LR:
    lsadd(l,r)

for p,q in pq:
    print(sum(res[p-1][:q]))


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

LR = [list(map(int, input().split())) for i in range(M)]
pq = [list(map(int, input().split())) for i in range(Q)]

res = [[0]*N for i in range(N)]

def lsadd(L,R):
    L-=1
    R-=1
    for i in range(0,L+1):  
        res[i][R] += 1

for l,r in LR:
    lsadd(l,r)

for p,q in pq:
    print(sum(res[p-1][:q]))

Buggy python submission (verdict: Time Limit Exceeded):
N,M,Q = map(int, input().split())

LR = [list(map(int, input().split())) for i in range(M)]
pq = [list(map(int, input().split())) for i in range(Q)]

res = [[0]*N for i in range(N)]

def lsadd(L,R):
    L-=1
    R-=1
    for i in range(0,L+1):
        for j in range(R,N):    
            res[i][j] += 1

for l,r in LR:
    lsadd(l,r)

for p,q in pq:
    print(res[p-1][q-1])


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

LR = [list(map(int, input().split())) for i in range(M)]
pq = [list(map(int, input().split())) for i in range(Q)]

res = [[0]*N for i in range(N)]

def lsadd(L,R):
    L-=1
    R-=1
    for i in range(0,L+1):  
        res[i][R] += 1

for l,r in LR:
    lsadd(l,r)

for p,q in pq:
    print(sum(res[p-1][:q]))
Buggy python submission (verdict: Runtime Error):
def main():
    import math

    def lcm(x, y):
        return (x * y) // math.gcd(x, y)
    N = int(input())
    ABCD = [list(map(int, input().split())) for i in range(N)]
    for A,B,C,D in ABCD:
        # 在庫が買う本数以下 or 在庫追加が買う本数以下
        if A < B or D < B:
            print("No")
            continue

        A %= B
        # 在庫が買う本数以下になり、補給出来ない
        if C < A:
            print("No")
            continue
        if B == D:
            print("Yes")
            continue

        flag = True
        #print((B-A-1)%(D-B) ,">", (B-1)-(C+1))
        if (B-A-1)%(math.gcd(D,B)) <= (B-1)-(C+1):
            flag = False
        
        print("Yes" if flag else "No")


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    import math

    def gcd(a, b):
        while b:
            a, b = b, a % b
        return a
    N = int(input())
    ABCD = [list(map(int, input().split())) for i in range(N)]
    for A,B,C,D in ABCD:
        # 在庫が買う本数以下 or 在庫追加が買う本数以下
        if A < B or D < B:
            print("No")
            continue

        A %= B
        # 在庫が買う本数以下になり、補給出来ない
        if C < A:
            print("No")
            continue
        if B == D:
            print("Yes")
            continue

        flag = True
        #print((B-A-1)%(D-B) ,">", (B-1)-(C+1))
        if (B-A-1)%(gcd(D,B)) <= (B-1)-(C+1):
            flag = False
        
        print("Yes" if flag else "No")


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    ABCD = [list(map(int, input().split())) for i in range(N)]
    for A,B,C,D in ABCD:
        # 在庫が買う本数以下 or 在庫追加が買う本数以下
        if A < B or D < B:
            print("No")
            continue

        A %= B
        # 在庫が買う本数以下になり、補給出来ない
        if C < A:
            print("No")
            continue
        if B == D:
            print("Yes")
            continue

        tmp = D-B
        flag = True
        for i in range(C+1,B):
            if (i-A) % tmp == 0:
                flag = False
                break
        print("Yes" if flag else "No")


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    import math

    def gcd(a, b):
        while b:
            a, b = b, a % b
        return a
    N = int(input())
    ABCD = [list(map(int, input().split())) for i in range(N)]
    for A,B,C,D in ABCD:
        # 在庫が買う本数以下 or 在庫追加が買う本数以下
        if A < B or D < B:
            print("No")
            continue

        A %= B
        # 在庫が買う本数以下になり、補給出来ない
        if C < A:
            print("No")
            continue
        if B == D:
            print("Yes")
            continue

        flag = True
        #print((B-A-1)%(D-B) ,">", (B-1)-(C+1))
        if (B-A-1)%(gcd(D,B)) <= (B-1)-(C+1):
            flag = False
        
        print("Yes" if flag else "No")


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
D, N = map(int, input().split())


if D==2:
    dp = [10000*i for i in range(1,10010)]
    print(dp[N-1] N!=100 else dp[N])
elif D==1:
    dp = [100*i for i in range(1,10010)]
    print(dp[N-1] N!=100 else dp[N])
else:
    print(N if N!=100 else 101)

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


if D==2:
    dp = [10000*i for i in range(1,10010)]
    print(dp[N-1] if N!=100 else dp[N])
elif D==1:
    dp = [100*i for i in range(1,10010)]
    print(dp[N-1] if N!=100 else dp[N])
else:
    print(N if N!=100 else 101)