Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
list_p = [int(x) for x in input().split()]

max = 0

for i in range(0,N-K+1) :
    total = sum(list_p[i:i+K])
    if total > max :
        max = total

print((max+K)/2)


Fixed submission:
N, K = map(int,input().split())
list_p = [int(x) for x in input().split()]

total = sum(list_p[0:K])
max = total

for i in range(0,N-K) :
    total = total - list_p[i] + list_p[i+K]
    if total > max :
        max = total

print((max+K)/2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
K = int(input())

ans = 0
for i in range(1,N+1) :
    list_i = [i for i in str(i) if i != "0"]
    if len(list_i) == K :
        ans += 1

print(ans)


Fixed submission:
N = input()
K = int(input())
dp = [[[0]*(2) for _ in range(K+1)] for _ in range(len(N)+1)]
dp[0][0][0] = 1

for i in range(len(N)) :
    for k in range(K+1) :
        for j in range(2) :
            n = int(N[i])
            for d in range(10) :
                nk = k
                nj = j
                if d != 0:
                    nk += 1
                if nk > K:
                    continue
                if j == 0:
                    if d > n:
                        continue
                    if d < n:
                        nj = 1
                dp[i+1][nk][nj] += dp[i][k][j]

ans = dp[len(N)][K][0] + dp[len(N)][K][1]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
list_H = [int(x) for x in input().split()]

list_H.sort()

while K :
    if list_H :
        list_H.pop()
    K -= 1

sum = 0
while list_H :
    sum += list_H[0]
    list_H.pop(0)

print(sum)


Fixed submission:
N, K = map(int, input().split())
list_H = [int(x) for x in input().split()]

list_H.sort()

while K :
    if list_H :
        list_H.pop()
    K -= 1

print(sum(list_H))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list_P = [int(x) for x in input().split()]

ans = 1

for i in range(1, len(list_P)) :
    if list_P[i] == min(list_P[:(i+1)]) :
        ans += 1

print(ans)


Fixed submission:
N = int(input())
list_P = [int(x) for x in input().split()]

ans = 0
min = N+1

for i in list_P :
    if i < min :
        ans += 1
        min = i

print(ans)

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

ans = 1

for i in range(1, len(list_P)) :
    if list_P[i] == min(list_P[:i]+1) :
        ans += 1

print(ans)


Fixed submission:
N = int(input())
list_P = [int(x) for x in input().split()]

ans = 0
min = N+1

for i in list_P :
    if i < min :
        ans += 1
        min = i

print(ans)

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

ans = 1

for i in range(1, len(list_P)) :
    if list_P[i] < min(list_P[:i]) :
        ans += 1

print(ans)


Fixed submission:
N = int(input())
list_P = [int(x) for x in input().split()]

ans = 0
min = N+1

for i in list_P :
    if i < min :
        ans += 1
        min = i

print(ans)

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

ans = 0

for i in range(len(list_P)) :
    out = 0
    for j in range(i) :
        if list_P[i] > list_P[j] :
            out = 1
    if out == 0 :
        ans += 1

print(ans)


Fixed submission:
N = int(input())
list_P = [int(x) for x in input().split()]

ans = 0
min = N+1

for i in list_P :
    if i < min :
        ans += 1
        min = i

print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
list_a = [int(x) for x in input().split()]

import fractions

def insu2(a) :
    insu = 0
    while a%2 == 0 :
        insu += 1
        a /= 2
    return insu

check = True

for i in list_a :
    if insu2(i) != insu2(list_a[0]) :
        check = False

ans_0 = list_a[0]
for i in range(1,N) :
    ans_0 = ans_0 * list_a[i] // fractions.gcd(ans_0, list_a[i])

if ans_0 == 2 :
    ans = int(M+1/2)
else :
    ans = int((int(M/(ans_0/2))+1)/2)

if check == False :
    print(0)
else :
    print(ans)


Fixed submission:
N, M = map(int, input().split())
list_a = [int(x) for x in input().split()]

import fractions

def insu2(a) :
    insu = 0
    while a%2 == 0 :
        insu += 1
        a /= 2
    return insu

check = True

for i in list_a :
    if insu2(i) != insu2(list_a[0]) :
        print(0)
        exit()

ans_0 = list_a[0]
for i in range(1,N) :
    ans_0 = ans_0 * list_a[i] // fractions.gcd(ans_0, list_a[i])

ans_0 //= 2
ans = M//ans_0 - M//(ans_0*2)

print(ans)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
list_a = [int(x) for x in input().split()]

import fractions

def insu2(a) :
    insu = 0
    while a%2 == 0 :
        insu += 1
        a /= 2
    return insu

check = True

for i in list_a :
    if insu2(i) != insu2(list_a[0]) :
        check = False

ans_0 = list_a[0]
for i in range(1,N) :
    ans_0 = ans_0 * list_a[i] // fractions.gcd(ans_0, list_a[i])

ans = int((int(M/(ans_0/2))+1)/2)

if check == False :
    print(0)
else :
    print(ans)


Fixed submission:
N, M = map(int, input().split())
list_a = [int(x) for x in input().split()]

import fractions

def insu2(a) :
    insu = 0
    while a%2 == 0 :
        insu += 1
        a /= 2
    return insu

check = True

for i in list_a :
    if insu2(i) != insu2(list_a[0]) :
        print(0)
        exit()

ans_0 = list_a[0]
for i in range(1,N) :
    ans_0 = ans_0 * list_a[i] // fractions.gcd(ans_0, list_a[i])

ans_0 //= 2
ans = M//ans_0 - M//(ans_0*2)

print(ans)
Buggy python submission (verdict: Runtime Error):
X, Y = map(int, input().split())
mod = 10**9 + 7

dp = [[0]*(Y+1) for i in range(X+1)]
dp[0][0] = 1

for i in range(X+1) :
    for j in range(Y+1) :
        if i >= 1 and j >= 2 :
            dp[i][j] = (dp[i][j] + dp[i-1][j-2])%mod
        if i >= 2 and j >= 1 :
            dp[i][j] = (dp[i][j] + dp[i-2][j-1])%mod

print(dp[X][Y])


Fixed submission:
X, Y = map(int, input().split())
mod = 10**9 + 7

def comb(n, r, mod):
    X = 1
    Y = 1
    for i in range(1,r+1):
        X = (X*(n-i+1))%mod
        Y = (Y*i)%mod
    return (X*pow(Y, mod-2, mod))%mod

if (X+Y)%3 != 0 :
    print(0)
elif X < (X+Y)//3 or Y < (X+Y)//3 :
    print(0)
else :
    i = X - (X+Y)//3
    print(comb((X+Y)//3, i, mod))
Buggy python submission (verdict: Time Limit Exceeded):
A, B = map(int, input().split())

maxp = int(max(A,B)**0.5)
num = [x for x in range(2,maxp+1)]
ps = []
while num :
    num_min = min(num)
    if num_min >= maxp :
        break
    ps.append(num_min)
    for i in range(len(num)) :
        if i >= len(num) :
            break
        if num[i]%num_min == 0 :
            num.pop(i)

ans = 1
for p in ps :
    if A%p == 0 and B%p == 0 :
        ans += 1

print(ans)


Fixed submission:
from fractions import gcd
import math
A, B = map(int, input().split())
AB = gcd(A, B)

def prime_factorize(n) :
    res = []
    for i in range(2, int(math.sqrt(n))+1) :
        if n%i == 0 :
            ex = 0
            while (n%i == 0) :
                ex += 1
                n //= i
            res.append([i, ex])
    if n != 1 :
        res.append([n, 1])
    return res

print(len(prime_factorize(AB))+1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N, Q = map(int,input().split())
G = [[] for _ in range(N)]
for i in range(N-1) :
    a, b = map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
ans = [0]*N
for i in range(Q) :
    pi, xi = map(int,input().split())
    ans[pi-1] += xi

def dfs(n) :
    visited[n] = 1
    for i in G[n] :
        if visited[i] == 1 :
            continue
        ans[i] += ans[n]
        dfs(i)

visited = [0]*N
dfs(0)

print(*ans)


Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N, Q = map(int,input().split())
G = [[] for _ in range(N)]
for i in range(N-1) :
    a, b = map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
ans = [0]*N
for i in range(Q) :
    pi, xi = map(int,input().split())
    ans[pi-1] += xi

def dfs(n) :
    visited[n] = 1
    for i in G[n] :
        if visited[i] == 1 :
            continue
        ans[i] += ans[n]
        dfs(i)

visited = [0]*N
dfs(0)

print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N, Q = map(int,input().split())
G = [[] for _ in range(N)]
for i in range(N-1) :
    a, b = map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
ans = [0]*N
for i in range(Q) :
    pi, xi = map(int,input().split())
    ans[pi-1] += xi

def dfs(n) :
    visited[n] = 1
    for i in G[n] :
        if visited[i] == 1 :
            continue
        ans[i] += ans[n]
        dfs(i)

visited = [0]*N
dfs(0)

print(*ans, sep=" ")


Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N, Q = map(int,input().split())
G = [[] for _ in range(N)]
for i in range(N-1) :
    a, b = map(int,input().split())
    G[a-1].append(b-1)
    G[b-1].append(a-1)
ans = [0]*N
for i in range(Q) :
    pi, xi = map(int,input().split())
    ans[pi-1] += xi

def dfs(n) :
    visited[n] = 1
    for i in G[n] :
        if visited[i] == 1 :
            continue
        ans[i] += ans[n]
        dfs(i)

visited = [0]*N
dfs(0)

print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
mod = 10**9 + 7
import sys
sys.setrecursionlimit(2147483647)
input = sys.stdin.readline

N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]

pat = [0 for _ in range(N+1)]
pat[0] = 1
if 1 in a :
    pat[1] = 0
else :
    pat[1] = 1

for i in range(2,N+1) :
    if i in a :
        pat[i] = 0
    else :
        pat[i] = (pat[i-1] + pat[i-2])%mod

print(pat[N])


Fixed submission:
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
mod = 10**9 + 7

pat = [1 for _ in range(N+1)]
for j in a :
    pat[j] = 0

for i in range(2,N+1) :
    if pat[i] == 0 :
        continue
    else :
        pat[i] = (pat[i-1] + pat[i-2])%mod

print(pat[N])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
N, Q = map(int,input().split())
S = input()
ls = []
rs = []
for i in range(Q) :
    l, r = map(int,input().split())
    ls.append(l)
    rs.append(r)

for i in range(Q) :
    print(S[ls[i]-1:rs[i]].count("AC"))


Fixed submission:
import sys
input = sys.stdin.readline
N, Q = map(int,input().split())
S = input()
ls = []
rs = []
for i in range(Q) :
    l, r = map(int,input().split())
    ls.append(l)
    rs.append(r)

ans = [0 for _ in range(N+1)]
temp = 0
for i in range(N) :
    if S[i:i+2] == "AC" :
        temp += 1
    ans[i+1] += temp

for i in range(Q) :
    print(ans[rs[i]-1] - ans[ls[i]-1])
Buggy python submission (verdict: Time Limit Exceeded):
def DP_B() :
    N, K = map(int, input().split())
    h = [int(x) for x in input().split()]
    dp = [10**10]*N

    dp[0] = 0
    for i in range(1,N) :
        for k in range(1,K+1) :
            if i >= k :
                dp[i] = min(dp[i], dp[i-k] + abs(h[i] - h[i-k]))

    return dp[N-1]

print(DP_B())


Fixed submission:
def DP_B() :
    N, K = map(int, input().split())
    h = [int(x) for x in input().split()]
    dp = [10**10]*N

    dp[0] = 0
    for i in range(1,N) :
        for k in range(1,K+1) :
            if i >= k :
                dp[i] = min(dp[i], dp[i-k] + abs(h[i] - h[i-k]))

    return dp[N-1]

print(DP_B())
Buggy python submission (verdict: Runtime Error):
N, x = map(int, input().split())
list_a = [int(x) for x in input().split()]

list_a.sort()
total = sum(list_a)
if x < list_a[0] :
    print(0)
    exit()
if x > total :
    print(ans-1)
    exit()
ans = 0

for i in range(N) :
    if list_a[i] <= x :
        x -= list_a[i]
        ans += 1

print(ans)


Fixed submission:
N, x = map(int, input().split())
list_a = [int(x) for x in input().split()]

list_a.sort()
total = sum(list_a)
if x < list_a[0] :
    print(0)
    exit()
if x > total :
    print(len(list_a)-1)
    exit()
ans = 0

for i in range(N) :
    if list_a[i] <= x :
        x -= list_a[i]
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A, B, K = map(int, input().split())

for i in range(A,B+1) :
    if i < A+K or B-K < i :
        print(i)


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

if B-A+1 >= 2*K :
    for i in range(A,A+K) :
        print(i)
    for i in range(B-K+1,B+1) :
        print(i)
else :
    for i in range(A,B+1) :
        print(i)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
Q = int(input())
l = []
r = []
for i in range(Q) :
    p, q = map(int,input().split())
    l.append(p)
    r.append(q)

def get_primenumber(number):
    prime_list = []
    search_list = list(range(2,number+1))
    while True:
      if search_list[0]**2 > number:
        prime_list.extend(search_list)
        break
      else:
        head_num = search_list[0]
        prime_list.append(head_num)
        search_list.pop(0)
        search_list = [num for num in search_list if num % head_num != 0]
    return prime_list

primes = get_primenumber(10**5+1)

for i in range(Q) :
    ans = 0
    for j in range(l[i],r[i]+1) :
        if j%2 == 0 :
            continue
        if j in primes and (j+1)//2 in primes :
            ans += 1
    print(ans)


Fixed submission:
import sys
import itertools
input = sys.stdin.readline
Q = int(input())
l = []
r = []
for i in range(Q) :
    p, q = map(int,input().split())
    l.append(p)
    r.append(q)

def get_primenumber(number):
    prime_list = []
    search_list = list(range(2,number+1))
    while True:
      if search_list[0]**2 > number:
        prime_list.extend(search_list)
        break
      else:
        head_num = search_list[0]
        prime_list.append(head_num)
        search_list.pop(0)
        search_list = [num for num in search_list if num % head_num != 0]
    return prime_list

primes = get_primenumber(10**5+1)
like2017 = [0 for _ in range(10**5+1)]

for p in primes :
    if (p+1)//2 in primes :
        like2017[p] = 1

like2017s = list(itertools.accumulate(like2017))

for i in range(Q) :
    print(like2017s[r[i]] - like2017s[l[i]-1])
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
list_A = [int(x) for x in input().split()]

set_A = set(list_A)
if len(set_A) <= K :
    print(0)
    exit()

dict_A = dict.fromkeys(set_A, 0)

for i in range(N) :
    dict_A[list_A[i]] += 1

ans = 0

for i in range(len(set_A)-K) :
    ans += min(dict_A.values())
    del dict_A[min(dict_A, key=dict_A.get)]

print(ans)


Fixed submission:
N, K = map(int, input().split())
list_A = [int(x) for x in input().split()]

list_num = [0 for i in range(N+1)]
for i in range(N) :
    list_num[list_A[i]] += 1

list_num.sort(reverse = True)

ans = N
for i in range(K) :
    ans -= list_num[i]

if ans > 0 :
    print(ans)
else :
    print(0)
Buggy python submission (verdict: Runtime Error):
# 入力 : 数字2つ
N, A = map(int, input().split())

# 出力　N^2-A
ans = N * N - A
print(ans)


Fixed submission:
# 入力 : 数字2つ
N = int(input())
A = int(input())

# 出力　N^2-A
ans = N * N - A
print(ans)

Buggy python submission (verdict: Runtime Error):
# 入力 : 数字2つ
N, A = map(int, input().split())

# 出力　N^2-A
print(N*N-A)


Fixed submission:
# 入力 : 数字2つ
N = int(input())
A = int(input())

# 出力　N^2-A
ans = N * N - A
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list_A = [int(input()) for i in range(N)]

list_X = []

for A in list_A :
    if A in list_X :
        list_X.remove(A)
    else :
        list_X.append(A)

print(len(list_X))


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

from collections import Counter
list_X = Counter(list_A).values()

ans = 0
for X in list_X :
    if X%2 == 1 :
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
list_a = [int(x) for x in input().split()]

ans = 0
ansX1 = 0
ansX2 = 0

for X in range(min(list_a),max(list_a)+1) :
    ansX0 = list_a.count(X)
    ansX = ansX0 + ansX1 + ansX2
    ans = max(ans,ansX)
    ansX2 = ansX1
    ansX1 = ansX0

print(ans)


Fixed submission:
N = int(input())
list_a = [int(x) for x in input().split()]

list_X = []

for X in list_a :
    list_X.append(X)
    list_X.append(X+1)
    list_X.append(X-1)

from collections import Counter
print(max(Counter(list_X).values()))

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

ans = 0

for X in range(min(list_a),max(list_a)+1) :
    ansX = list_a.count(X) + list_a.count(X+1) + list_a.count(X-1)
    ans = max(ans,ansX)

print(ans)


Fixed submission:
N = int(input())
list_a = [int(x) for x in input().split()]

list_X = []

for X in list_a :
    list_X.append(X)
    list_X.append(X+1)
    list_X.append(X-1)

from collections import Counter
print(max(Counter(list_X).values()))

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

ans = 0

for i in range(N) :
    X = list_a[i]
    T0 = list_a.count(X)
    T1 = list_a.count(X+1)
    T2 = list_a.count(X+2)
    Tm1 = list_a.count(X-1)
    Tm2 = list_a.count(X-2)
    ans = max(ans,T0+T1+T2,T0+T1+Tm1,T0+Tm1+Tm2)

print(ans)


Fixed submission:
N = int(input())
list_a = [int(x) for x in input().split()]

list_X = []

for X in list_a :
    list_X.append(X)
    list_X.append(X+1)
    list_X.append(X-1)

from collections import Counter
print(max(Counter(list_X).values()))

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

ans = 0

for i in range(N) :
    X = list_a[i]
    ans1 = list_a.count(X) + list_a.count(X+1) + list_a.count(X-1)
    ans2 = list_a.count(X) + list_a.count(X+1) + list_a.count(X+2)
    ans3 = list_a.count(X) + list_a.count(X-1) + list_a.count(X-2)
    ans = max(ans,ans1,ans2,ans3)

print(ans)


Fixed submission:
N = int(input())
list_a = [int(x) for x in input().split()]

list_X = []

for X in list_a :
    list_X.append(X)
    list_X.append(X+1)
    list_X.append(X-1)

from collections import Counter
print(max(Counter(list_X).values()))
Buggy python submission (verdict: Runtime Error):
N = int(input())
p = [int(x) for x in input().split()]

ans = 0
for i in range(N) :
    if p[i] == i+1 :
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1

print(ans)


Fixed submission:
N = int(input())
p = [int(x) for x in input().split()]

ans = 0
for i in range(N) :
    if p[i] == i+1 :
        if i == N-1 :
            p[i], p[i-1] = p[i-1], p[i]
            ans += 1
        else :
            p[i], p[i+1] = p[i+1], p[i]
            ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(M)]

c = [ab[i][1] for i in range(M) if ab[i][0] == 1]
d = set()
for i in range(M) :
    if ab[i][0] in c :
        d.add(ab[i][1])

if N in d :
    print("POSSIBLE")
else :
    print("IMPOSSIBLE")


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

c = {ab[i][1] for i in range(M) if ab[i][0] == 1}
d = {ab[i][0] for i in range(M) if ab[i][1] == N}

if c & d :
    print("POSSIBLE")
else :
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(M)]

c = [ab[i][1] for i in range(M) if ab[i][0] == 1]
d = set()
for i in range(M) :
    for k in c :
        if ab[i][0] == k :
            d.add(ab[i][1])

if N in d :
    print("POSSIBLE")
else :
    print("IMPOSSIBLE")


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

c = {ab[i][1] for i in range(M) if ab[i][0] == 1}
d = {ab[i][0] for i in range(M) if ab[i][1] == N}

if c & d :
    print("POSSIBLE")
else :
    print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int,input().split())

ans = 0
for i in range(a,b+1) :
    if i%x == 0 :
        ans += 1

print(ans)


Fixed submission:
a, b, x = map(int,input().split())

if a%x == 0 :
    first = a // x
else :
    first = ( a + x - a%x ) // x

if b%x == 0 :
    end = b // x
else :
    end = ( b - b%x ) // x

ans = end - first + 1

print(ans)
Buggy python submission (verdict: Runtime Error):
N, A = map(int, input().split())
x = [0] + [int(i) for i in input().split()]

dp = [[[0]*(N*max(x)+1)]*(N+1) for _ in range(N+1)]
dp[0][0][0] = 1

for i in range(N+1):
    for j in range(N+1) :
        for k in range(N*max(x)+1) :
            if i >= 1 and k < x[i] :
                dp[i][j][k] = dp[i-1][j][k]
            if i >= 1 and j >= 1 and k >= x[i] :
                dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k-x[i]]

ans = 0
for j in range(N+1) :
    ans += dp[N][j][j*A]
print(ans-1)


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

x.sort()
x = [i - A for i in x]
D = {0 : 1}
for i in x :
    for j, k in list(D.items()) :
        D[i+j] = D.get(i+j, 0) + k

print(D[0] - 1)
Buggy python submission (verdict: Runtime Error):
N, A, B = [int(i) for i in input().split()]
S = 'b' * A + 'r' * B
if A == 0 and B == 0:
    print(0)
else:
    while len(S) < N:
        S += S
    print(S[0:N].count('b'))


Fixed submission:
import math
N, A, B = [int(i) for i in input().split()]
if A == 0 and B == 0:
    print(0)
else:
    count = A + B
    setCount = math.floor(N / count)
    amari = N - setCount * count
    if amari > 0:
        if A > amari:
            result = setCount * A + amari
        else:
            result = setCount * A + A
    else:
        result = setCount * A
    print(result)

Buggy python submission (verdict: Runtime Error):
N, A, B = [int(i) for i in input().split()]
S = 'b' * A + 'r' * B
while len(S) < N:
    S += S

print(S[0:N].count('b'))


Fixed submission:
import math
N, A, B = [int(i) for i in input().split()]
if A == 0 and B == 0:
    print(0)
else:
    count = A + B
    setCount = math.floor(N / count)
    amari = N - setCount * count
    if amari > 0:
        if A > amari:
            result = setCount * A + amari
        else:
            result = setCount * A + A
    else:
        result = setCount * A
    print(result)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
for i in range(N):
    s.append(input())

# setに変換
setS = set(s)

maxList = []
maxCount = 0
for word in setS:
    # 文字列の出現回数を数える
    cnt = s.count(word)
    if cnt > maxCount:
        maxCount = cnt
        # 初期化
        maxList = []
        maxList.append(word)
    elif cnt == maxCount:
        maxList.append(word)

maxList.sort()

for word in maxList:
    print(word)

    

Fixed submission:
from collections import Counter

N = int(input())
s = []
for i in range(N):
    s.append(input())

sc = Counter(s)
maxNum = sc.most_common()[0][1]
keys = [k for k , v in sc.most_common() if v == maxNum]
keys.sort()
for word in keys:
    print(word)
Buggy python submission (verdict: Runtime Error):
N, K = [int(i) for i in input().split()]
H = list(map(int, input().split()))

# 昇順にソート
H.sort()

for i in  range(K):
    H.pop()

if len(H) > 0:
    print(sum(H))
else:
    print("0")

Fixed submission:
N, K = [int(i) for i in input().split()]
H = list(map(int, input().split()))

# 昇順にソート
H.sort()

if K >= len(H):
    print("0")
else:
    for i in  range(K):
        H.pop()
    print(sum(H))

Buggy python submission (verdict: Runtime Error):
N, K = [int(i) for i in input().split()]
H = list(map(int, input().split()))

# 昇順にソート
H.sort()

for i in  range(K):
    H.pop()

print(sum(H))

Fixed submission:
N, K = [int(i) for i in input().split()]
H = list(map(int, input().split()))

# 昇順にソート
H.sort()

if K >= len(H):
    print("0")
else:
    for i in  range(K):
        H.pop()
    print(sum(H))