Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math


def main():
    A, B, N = map(int, input().split())

    def target(x):
        # print(math.floor(A * x / B))
        # print(A * math.floor(x / B))
        return math.floor(A * x / B) - A * math.floor(x / B)

    max_value = -1
    for i in range(1, min(N+1, B + 1)):
        v = target(i)
        # print(f'x={i} f(x)={v}')
        if v > max_value:
            max_value = v
    print(max_value)


if __name__ == '__main__':
    main()


Fixed submission:
import math


def main():
    A, B, N = map(int, input().split())

    def target(x):
        # print(math.floor(A * x / B))
        # print(A * math.floor(x / B))
        return math.floor(A * x / B) - A * math.floor(x / B)

    print(target(min(N, B-1)))

    # B_A = 1.0 * B / A
    #
    # max_value = -1
    # for i in range(1, int(B / B_A) + 3):
    #     x = int(B_A * i)+1
    #     if x > N:
    #         break
    #     v = target(x)
    #     # print(f'x={i} f(x)={v}')
    #     if v > max_value:
    #         max_value = v
    #
    #     x_2 = int(B_A * i)
    #     if x_2 > N:
    #         break
    #     v = target(x_2)
    #     # print(f'x={i} f(x)={v}')
    #     if v > max_value:
    #         max_value = v
    #
    #     x_3 = int(B_A * i) -1
    #     if x_3 > N:
    #         break
    #     v = target(x_3)
    #     # print(f'x={i} f(x)={v}')
    #     if v > max_value:
    #         max_value = v
    #
    # print(max_value)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce


def gcd(*numbers):
    return reduce(math.gcd, numbers)


def main():
    K = int(input())

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

    print(total)


if __name__ == '__main__':
    main()


Fixed submission:
import math
from collections import defaultdict
from functools import reduce

memo = defaultdict(int)


def gcd(*numbers):
    return reduce(math.gcd, numbers)


def gcd_with_memo(x, y):
    key = tuple(sorted([x, y]))
    if memo[key] != 0:
        value = memo[key]
    else:
        value = math.gcd(x, y)
        memo[key] = value
    return value


# def main():
#     K = int(input())
#     total = 0
#     for a in range(1, K + 1):
#         for b in range(1, K + 1):
#             for c in range(1, K + 1):
#                 total += gcd_with_memo(a, gcd_with_memo(b, c))
#     print(total)

def main():
    K = int(input())

    total = 0

    # 1
    for i in range(1, K + 1):
        total += i

    # print(total)

    # 2 kind
    for i in range(1, K + 1):
        for j in range(i + 1, K + 1):
            total += 6 * gcd(i, j)

    # print(total)

    # 3kind
    for i in range(1, K + 1):
        for j in range(i+1, K + 1):
            for k in range(j+1, K + 1):
                total += 6 * gcd(i, j, k)

    print(total)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    S = input()

    c = 0

    r_indices = [i for i in range(N) if S[i] == 'R']
    g_indices = [i for i in range(N) if S[i] == 'G']
    b_indices = [i for i in range(N) if S[i] == 'B']

    # print(r_indices)
    # print(g_indices)
    # print(b_indices)

    for r in r_indices:
        for g in g_indices:
            for b in b_indices:
                # print(r + g + b)
                # print(r + g + b)
                if r + g + b != 3 * (max([r, g, b]) + min([r, g, b])) / 2:
                    c += 1

    print(c)


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    S = input()

    c = 0

    r_indices = tuple([i for i in range(N) if S[i] == 'R'])
    g_indices = tuple([i for i in range(N) if S[i] == 'G'])
    b_indices = tuple([i for i in range(N) if S[i] == 'B'])

    # print(r_indices)
    # print(g_indices)
    # print(b_indices)

    avoid = 0

    for center in range(1, N - 1):
        # print('###')
        # print('center = ', center)
        # print(min(center, N - center - 1))

        for width in range(1, min(center + 1, N - center)):
            # print('c, w = ', center, width)
            little = center - width
            great = center + width
            # print('little=', little)
            # print('center=', center)
            # print('great=', great)

            if S[little] != S[great] and S[center] != S[great] and S[little] != S[center]:
                avoid += 1

    total = len(r_indices) * len(g_indices) * len(b_indices)

    print(total - avoid)


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N = int(input())
    S = input()

    c = 0

    for i in range(N):
        for j in range(i, N):
            for k in range(j, N):
                if j - i != k - j and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                    c += 1

    print(c)


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N = int(input())
    S = input()

    c = 0

    r_indices = tuple([i for i in range(N) if S[i] == 'R'])
    g_indices = tuple([i for i in range(N) if S[i] == 'G'])
    b_indices = tuple([i for i in range(N) if S[i] == 'B'])

    # print(r_indices)
    # print(g_indices)
    # print(b_indices)

    avoid = 0

    for center in range(1, N - 1):
        # print('###')
        # print('center = ', center)
        # print(min(center, N - center - 1))

        for width in range(1, min(center + 1, N - center)):
            # print('c, w = ', center, width)
            little = center - width
            great = center + width
            # print('little=', little)
            # print('center=', center)
            # print('great=', great)

            if S[little] != S[great] and S[center] != S[great] and S[little] != S[center]:
                avoid += 1

    total = len(r_indices) * len(g_indices) * len(b_indices)

    print(total - avoid)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    X, Y, A, B, C = tuple(map(int, input().split()))
    P = tuple(map(int, input().split()))
    Q = tuple(map(int, input().split()))
    R = tuple(map(int, input().split()))

    P = sorted(P, reverse=True)
    Q = sorted(Q, reverse=True)
    R = sorted(R, reverse=True)

    x = P[:X]
    y = Q[:Y]

    for r_i in R:
        if r_i < min(x[-1], y[-1]):
            break
        else:
            if x[-1] < y[-1]:
                x[-1] = r_i
                # x = sorted(x, reverse=True)
                x.sort(reverse=True)
            else:
                y[-1] = r_i
                # y = sorted(y, reverse=True)
                y.sort(reverse=True)

    print(sum(x) + sum(y))


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    X, Y, A, B, C = tuple(map(int, input().split()))
    P = tuple(map(int, input().split()))
    Q = tuple(map(int, input().split()))
    R = tuple(map(int, input().split()))

    P = sorted(P, reverse=True)
    Q = sorted(Q, reverse=True)
    R = sorted(R, reverse=True)

    x = P[:X]
    y = Q[:Y]

    saikyo = sorted(x + y + R, reverse=True)
    print(sum(saikyo[:(X + Y)]))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    X, Y, A, B, C = tuple(map(int, input().split()))
    P = list(map(int, input().split()))
    Q = list(map(int, input().split()))
    R = list(map(int, input().split()))

    P = sorted(P, reverse=True)
    Q = sorted(Q, reverse=True)
    R = sorted(R, reverse=True)

    x = P[:X]
    y = Q[:Y]

    for r_i in R:
        if r_i < min(x[-1], y[-1]):
            break
        else:
            if x[-1] < y[-1]:
                x[-1] = r_i
                x = sorted(x, reverse=True)
            else:
                y[-1] = r_i
                y = sorted(y, reverse=True)

    print(sum(x) + sum(y))


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    X, Y, A, B, C = tuple(map(int, input().split()))
    P = tuple(map(int, input().split()))
    Q = tuple(map(int, input().split()))
    R = tuple(map(int, input().split()))

    P = sorted(P, reverse=True)
    Q = sorted(Q, reverse=True)
    R = sorted(R, reverse=True)

    x = P[:X]
    y = Q[:Y]

    saikyo = sorted(x + y + R, reverse=True)
    print(sum(saikyo[:(X + Y)]))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import math

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

a_l = A / 0.08
a_m = (A+1) /0.08

l = max(a_l, b_l)
m = min(a_m, b_m)

c = math.ceil(l)

if c < m:
  print(int(c))
else:
  print(-1)

Fixed submission:
import math

def main():

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

    a_l = A / 0.08
    a_m = (A + 1) / 0.08

    b_l = B / 0.1
    b_m = (B + 1) / 0.1

    l = max(a_l, b_l)
    m = min(a_m, b_m)

    c = math.ceil(l)

    if c < m:
        print(int(c))
    else:
        print(-1)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = list(map(int, input().split()))
    P = list(map(int, input().split()))

    expect = [((p + 1) / 2.0) for p in P]
    sum_exp = [sum(expect[i:i + K]) for i in range(N - K + 1)]
    print(max(sum_exp))


if __name__ == '__main__':
    main()


Fixed submission:
def main():
    N, K = list(map(int, input().split()))
    P = list(map(int, input().split()))

    E = [((p + 1) / 2.0) for p in P]

    total = 0
    m = 0
    for i in range(N):
        if i < K:
            total += E[i]
        else:
            total += E[i] - E[i - K]

        if total > m:
            m = total

    print(m)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = list(map(int, input().split()))
    H = list(map(int, input().split()))

    INF = float('inf')

    dp = [INF for _ in range(N)]
    dp[0] = 0

    for i in range(N):
        for dist in range(1, min(K, i) + 1):
            c = dp[i - dist] + abs(H[i] - H[i - dist])
            if c < dp[i]:
                dp[i] = c

    print(dp[-1])


if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np


def main():
    N, K = list(map(int, input().split()))
    H = np.array(list(map(int, input().split())))

    INF = float('inf')

    dp = np.array([INF for _ in range(N)])
    dp[0] = 0

    for i in range(1, N):
        max_dist = min(K, i)
        dp[i] = np.min(dp[i - max_dist:i] + np.abs(H[i] - H[i - max_dist:i]))

    print(int(dp[-1]))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = list(map(int, input().split()))
    H = list(map(int, input().split()))

    INF = float('inf')

    dp = [INF for _ in range(N)]

    for i in range(N):
        if i == 0:
            dp[i] = 0
        else:
            for dist in range(1, min(K, i) + 1):
                c = dp[i - dist] + abs(H[i] - H[i - dist])
                if c < dp[i]:
                    dp[i] = c

    print(dp[-1])


if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np


def main():
    N, K = list(map(int, input().split()))
    H = np.array(list(map(int, input().split())))

    INF = float('inf')

    dp = np.array([INF for _ in range(N)])
    dp[0] = 0

    for i in range(1, N):
        max_dist = min(K, i)
        dp[i] = np.min(dp[i - max_dist:i] + np.abs(H[i] - H[i - max_dist:i]))

    print(int(dp[-1]))


if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N, K = list(map(int, input().split()))
    H = list(map(int, input().split()))

    INF = 10 ** 10

    dp = [INF for _ in range(N)]

    for i in range(N):
        if i == 0:
            dp[i] = 0
        else:
            for dist in range(1, min(K, i) + 1):
                c = dp[i - dist] + abs(H[i] - H[i - dist])
                if c < dp[i]:
                    dp[i] = c

    print(dp[-1])


if __name__ == '__main__':
    main()


Fixed submission:
import numpy as np


def main():
    N, K = list(map(int, input().split()))
    H = np.array(list(map(int, input().split())))

    INF = float('inf')

    dp = np.array([INF for _ in range(N)])
    dp[0] = 0

    for i in range(1, N):
        max_dist = min(K, i)
        dp[i] = np.min(dp[i - max_dist:i] + np.abs(H[i] - H[i - max_dist:i]))

    print(int(dp[-1]))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

A_minus_i = [A[i] - (i+1) for i in range(N)]

min_score = sum(A_minus_i)

scores = []

for i in range(min(A_minus_i), max(A_minus_i)+1):
    score = sum([abs(a - i) for a in A_minus_i])
    scores.append(score)

print(min(scores))


Fixed submission:
import numpy as np
import statistics

N = int(input())
A = [int(i) for i in input().split()]

A_minus_i = [A[i] - (i+1) for i in range(N)]

# print(A)
# print(A_minus_i)

bf = statistics.median(A_minus_i)
# print(bf)

# b_l = int(bf)+1
# b_m = int(bf)
# b_s = int(bf)-1
#
# score_l = sum([abs(a - b_l) for a in A_minus_i])
# score_m = sum([abs(a - b_m) for a in A_minus_i])
# score_s = sum([abs(a - b_s) for a in A_minus_i])

score = sum([abs(a - bf) for a in A_minus_i])

print(int(score))
Buggy python submission (verdict: Runtime Error):
# a, b = (int(i) for i in input().split())
a = int(input())
b = int(input())

if a <= 8 and b <= 8:
    print('Yay!')
else:
    print(':(')


Fixed submission:
a, b = (int(i) for i in input().split())

if a <= 8 and b <= 8:
    print('Yay!')
else:
    print(':(')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

changes = []

wests = tuple([i for i in range(N) if S[i] == 'W'])
easts = tuple([i for i in range(N) if S[i] == 'E'])

# print(wests)
# print(easts)


for leader in range(N):
    change = 0
    change += len([i for i in range(N) if i < leader and S[i] == 'W'])
    change += len([i for i in range(N) if leader < i and S[i] == 'E'])
    changes.append(change)

print(min(changes))

Fixed submission:
import bisect

N = int(input())
S = input()

changes = []

wests = [i for i in range(N) if S[i] == 'W']
# print(wests)
easts = [i for i in range(N) if S[i] == 'E']
# print(easts)

for leader in range(N):
    change = 0
    change += bisect.bisect_left(wests, leader)
    change += len(easts) - bisect.bisect_right(easts, leader)
    changes.append(change)

print(min(changes))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

changes = []
for leader in range(N):
    change = 0
    for j in range(N):
        if j < leader and S[j] == 'W':
            change += 1
        if leader < j and S[j] == 'E':
            change += 1
    changes.append(change)

print(min(changes))

Fixed submission:
import bisect

N = int(input())
S = input()

changes = []

wests = [i for i in range(N) if S[i] == 'W']
# print(wests)
easts = [i for i in range(N) if S[i] == 'E']
# print(easts)

for leader in range(N):
    change = 0
    change += bisect.bisect_left(wests, leader)
    change += len(easts) - bisect.bisect_right(easts, leader)
    changes.append(change)

print(min(changes))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())

substring = {}

char_tuple = sorted(tuple(s))

for c in char_tuple:
    for i in range(len(s)):
        if s[i] == c:
            for j in range(i + 1, max(len(s) + 1, 5)):
                substring[s[i:j]] = True
    if len(substring) >= 5:
        break
#
# for i in range(len(s)):
#     for j in range(i+1, len(s)+1):
#         # print('i={}, j={} s[{}:{}]={}'.format(i,j,i,j,s[i:j]))
#         substring[s[i:j]] = True


words = [item[0] for item in substring.items()]
sorted_words = sorted(words)

print(sorted_words[k-1])

Fixed submission:
s = input()
k = int(input())

substring = {}

for i in range(len(s)):
    for j in range(i+1, i+1+k):
        # print('i={}, j={} s[{}:{}]={}'.format(i,j,i,j,s[i:j]))
        substring[s[i:j]] = True


words = [item[0] for item in substring.items()]
sorted_words = sorted(words)

print(sorted_words[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())

substring = {}

char_tuple = sorted(tuple(s))

for c in char_tuple:
    if len(substring) >= 5:
        break
    for i in range(len(s)):
        if s[i] == c:
            for j in range(i + 1, len(s) + 1):
                substring[s[i:j]] = True



#
# for i in range(len(s)):
#     for j in range(i+1, len(s)+1):
#         # print('i={}, j={} s[{}:{}]={}'.format(i,j,i,j,s[i:j]))
#         substring[s[i:j]] = True


words = [item[0] for item in substring.items()]
sorted_words = sorted(words)
# print(words)
# print(sorted_words)

# print(substring)

print(sorted_words[k-1])


Fixed submission:
s = input()
k = int(input())

substring = {}

for i in range(len(s)):
    for j in range(i+1, i+1+k):
        # print('i={}, j={} s[{}:{}]={}'.format(i,j,i,j,s[i:j]))
        substring[s[i:j]] = True


words = [item[0] for item in substring.items()]
sorted_words = sorted(words)

print(sorted_words[k-1])

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())

substring = {}

for i in range(len(s)):
    for j in range(i+1, len(s)+1):
        # print('i={}, j={} s[{}:{}]={}'.format(i,j,i,j,s[i:j]))
        substring[s[i:j]] = True

words = [item[0] for item in substring.items()]
sorted_words = sorted(words)
# print(words)
# print(sorted_words)

# print(substring)

print(sorted_words[k-1])

Fixed submission:
s = input()
k = int(input())

substring = {}

for i in range(len(s)):
    for j in range(i+1, i+1+k):
        # print('i={}, j={} s[{}:{}]={}'.format(i,j,i,j,s[i:j]))
        substring[s[i:j]] = True


words = [item[0] for item in substring.items()]
sorted_words = sorted(words)

print(sorted_words[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = [list(input()) for i in range(N)]

def is_ok(mat):
    n = len(mat)
    for i in range(n):
        for j in range(n):
            if mat[i][j] != mat[j][i]:
                return False
    return True

count = 0
A = 1
for B in range(N):
    next_S = [S[(i+B) % N] for i in range(N)]
    if is_ok(next_S):
        count += 1

print(count * N)

Fixed submission:
N = int(input())
S = [list(input()) for i in range(N)]

def is_ok(mat):
    n = len(mat)
    for i in range(n):
        for j in range(i, n):
            if mat[i][j] != mat[j][i]:
                return False
    return True

count = 0
A = 1
for B in range(N):
    next_S = [S[(i+B) % N] for i in range(N)]
    if is_ok(next_S):
        count += 1

print(count * N)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
r = []
g = []
b = []
s = input()
for i in range(n):
    if(s[i]=='R'):
        r.append(i)
    elif(s[i]=='G'):
        g.append(i)
    else:
        b.append(i)

ans = 0
for i in r:
    for j in g:
        for k in b:
            mn = min(i,j,k)
            mx = max(i,j,k)
            mid = (i+j+k) - (mn+mx)

            if(mx - mid != mid - mn):
                ans += 1

print(ans)

Fixed submission:
n = int(input())
r = []
g = []
b = []
s = input()
blen = 0
glen = 0
rlen = 0
for i in range(n):
    if(s[i]=='R'):
        r.append(i)
        rlen += 1
    elif(s[i]=='G'):
        g.append(i)
        glen += 1
    else:
        b.append(i)
        blen += 1

ans = 0
minus = 0
t = 0
for i in r:
    for j in g:
        mn = min(i,j)
        mx = max(i,j)

        mid2 = mx + (mx-mn)
        mid3 = mn - (mx-mn)

        if((mx-mn)%2==0):
            mid1 = mn + (mx-mn)//2
            if(mid1 >= 0 and mid1 < n):
                if(s[mid1]=='B'):
                    minus += 1
        if(mid2 >= 0 and mid2 < n):
            if(s[mid2] == 'B'):
                minus += 1
                #print("2",i,j,mid2,s[i],s[j],s[mid2])

                
        if(mid3 >= 0 and mid3 < n):
            if(s[mid3]=='B'):
                minus += 1
                #print("3",i,j,mid3,s[i],s[j],s[mid3])

        t += blen
                

ans = rlen * glen * blen
ans -= minus
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = [int(x) for x in input().split()]
k = int(input())
found = False
for i in range(a, b + 1):
    if i % k == 0:
        found = True
if found: 
    print("YES")
else:
    print("NO")
    

Fixed submission:
k = int(input())
a, b = [int(x) for x in input().split()]
found = False
for i in range(a, b + 1):
    if i % k == 0:
        found = True
if found:
    print("OK")
else:
    print("NG")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(a) for a in input().split()]

import numpy as np

mod = 10**9 + 7

mesh = np.array(np.meshgrid(A, A), dtype=np.int64)
comb = mesh.T.reshape(-1, 2)

t_comb = []
for c in comb:
    if c[0] == c[1]:
        continue
    else:
        t_comb.append(sorted(c))

t_comb = np.unique(t_comb, axis=0)

summa = 0
for c in t_comb:
    summa += c[0] * c[1]

print(summa % mod)

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

mod = 10**9 + 7

print(((sum(A)**2 - sum([i**2 for i in A]))//2) % mod)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(a) for a in input().split()]

import numpy as np

mod = 10**9 + 7

def pairwise_combs_mask(a):
    a = np.array(a, dtype=np.int64)
    n = len(a)
    L = n*(n-1) // 2
    out = np.empty((L,2), dtype=a.dtype)
    m = ~np.tri(len(a), dtype=bool)
    out[:,0] = np.broadcast_to(a[:,None],(n,n))[m]
    out[:,1] = np.broadcast_to(a,(n,n))[m]
    return out

comb = pairwise_combs_mask(A)

summa = 0
for c in comb:
    summa += c[0] * c[1]

print(int(summa % mod))

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

mod = 10**9 + 7

print(((sum(A)**2 - sum([i**2 for i in A]))//2) % mod)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(a) for a in input().split()]

import numpy as np

mod = 10**9 + 7

def pairwise_combs_mask(a):
    a = np.array(a, dtype=np.float64)
    n = len(a)
    L = n*(n-1)//2
    out = np.empty((L,2), dtype=a.dtype)
    m = ~np.tri(len(a),dtype=bool)
    out[:,0] = np.broadcast_to(a[:,None],(n,n))[m]
    out[:,1] = np.broadcast_to(a,(n,n))[m]
    return out

comb = pairwise_combs_mask(A)

summa = 0
for c in comb:
    summa += c[0] * c[1]

print(int(summa % mod))

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

mod = 10**9 + 7

print(((sum(A)**2 - sum([i**2 for i in A]))//2) % mod)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(a) for a in input().split()]

import itertools

sum = 0
for i, j in itertools.combinations(A, 2):
    sum += i * j

print(sum % (10**9+7))

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

mod = 10**9 + 7

print(((sum(A)**2 - sum([i**2 for i in A]))//2) % mod)
Buggy python submission (verdict: Runtime Error):
N, A, B = map(int, input().split())

mojiretsu = ''
while len(mojiretsu) < N:
    mojiretsu += 'b' * A
    mojiretsu += 'r' * B

print(mojiretsu[:N].count('b'))

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

if A == 0:
    print(0)
    exit()

quotient = N // (A + B) * A
remainder = N % (A + B)

quotient += min((remainder, A))

print(quotient)
Buggy python submission (verdict: Runtime Error):
A, B  = map(int,input().split())

print(math.ceil(B / A))

Fixed submission:
import math

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

x = (B-1)/(A-1)

print(math.ceil(x))