Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
p = list(map(int,input().split()))

a = i = j = count = ans = 0

new_p = [0] * n

for i in range(n):
    for j in range(p[i]):
        new_p[i] += j+1
    new_p[i] = float(new_p[i]/p[i])

i = j = 0
total = 0
for i in range(k):
    total += new_p[i]
ans = total
for i in range(k,n):
    total = total + new_p[i] - new_p[i-k]
    ans = max(ans,total)

print('{:.10f}'.format(ans))

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

a = i = j = count = ans = 0

new_p = [0] * n

for i in range(n):
    new_p[i] = float((p[i]+1)/2)

i = j = 0
total = 0
for i in range(k):
    total += new_p[i]
ans = total
for i in range(k,n):
    total = total + new_p[i] - new_p[i-k]
    ans = max(ans,total)

print('{:.10f}'.format(ans))

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

a = i = j = count = ans = 0

new_p = [0] * n

for i in range(n):
    for j in range(p[i]):
        new_p[i] += j+1
    new_p[i] = float(new_p[i]/p[i])

i = j = 0

while k <= n:
    total = 0
    for i in range(j,k):
        total += new_p[i]
    if ans < total:
        ans = total
    j += 1
    k += 1

print(ans)



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

a = i = j = count = ans = 0

new_p = [0] * n

for i in range(n):
    new_p[i] = float((p[i]+1)/2)

i = j = 0
total = 0
for i in range(k):
    total += new_p[i]
ans = total
for i in range(k,n):
    total = total + new_p[i] - new_p[i-k]
    ans = max(ans,total)

print('{:.10f}'.format(ans))

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

a = i = j = count = ans = 0

while k <= n:
    total = 0
    while i < k:
        tmp = 0
        for j in range(p[i]):
            tmp += j+1
        tmp = float(tmp/p[i])
        total += tmp
        i += 1
    if(total > ans):
        ans = total
    count += 1
    k += 1
    i = count
    
print(ans)


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

a = i = j = count = ans = 0

new_p = [0] * n

for i in range(n):
    new_p[i] = float((p[i]+1)/2)

i = j = 0
total = 0
for i in range(k):
    total += new_p[i]
ans = total
for i in range(k,n):
    total = total + new_p[i] - new_p[i-k]
    ans = max(ans,total)

print('{:.10f}'.format(ans))
Buggy python submission (verdict: Runtime Error):
D,S,T = map(int,input().split()))
print("Yes" if D<=S*T else "No")

Fixed submission:
D,S,T = map(int,input().split())
print("Yes" if D<=S*T else "No")
Buggy python submission (verdict: Runtime Error):
a=list(map(int,input().split()))
print(a.index(0)+1)


Fixed submission:
x,y=map(int,input().split())
if y%2==0 and 2*x<=y and y<=4*x:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):


r=[]
for i in range(128):
    A=i-63
    for j in range(128):
        B=j-63
        r.append((A**5-B**5,A,B))
r.sort()

target=int(input())
lwbd = 0
upbd = len(r)

while lwbd<upbd:
    middle = lwbd+ (upbd-lwbd)//2
    if(r[middle][0]==target):
        break
    elif r[middle][0]>target:
        upbd = middle
    else:
        lwbd = middle
print(r[middle][1],r[middle][2])

Fixed submission:


r=[]
for i in range(230):
    A=i-125
    for j in range(230):
        B=j-125
        r.append((A**5-B**5,A,B))
r.sort()

target=int(input())
lwbd = 0
upbd = len(r)


while lwbd<=upbd:
    middle = lwbd + (upbd-lwbd)//2
    if(r[middle][0]==target):
        break
    elif r[middle][0]>target:
        upbd = middle -1
    else:
        lwbd = middle +1
print(r[middle][1],r[middle][2])
Buggy python submission (verdict: Time Limit Exceeded):

a=list(map(int,input().split(" ")))
rr=a[0]
rg=a[1]
rb=a[2]
N=a[3]
count=0
for nr in range(0,N//rr+1):
    for ng in range(0,N//rg+1):
        tb=N-rr*nr-rg*ng
        if tb>=0 and tb%rb==0:
            count+=1
print(count)


Fixed submission:

a=list(map(int,input().split(" ")))
rr=a[0]
rg=a[1]
rb=a[2]
N=a[3]
count=0
for nr in range(0,N//rr+1):
    for ng in range(0,N//rg+1):
        tb=N-rr*nr-rg*ng
        if tb>=0 and tb%rb==0:
            count+=1
print(count)
Buggy python submission (verdict: Runtime Error):

def solve(x):
    if(x==0):
        return 0
    k=1
    s=0
    while True:
        if(x%k==0):
            i=(x//k)-1
            if (x//i==x%i):
                s+=i
        k+=1
        if k*k>x:
            break
    return s
        

x=int(input())
print(solve(x))


Fixed submission:
def solve(x):
    if(x<2):
        return 0
    k=1
    s=0
    while True:
        if(x%k==0):
            i=(x//k)-1
            if (x//i==x%i):
                s+=i
        k+=1
        if k*k>x:
            break
    return s
        

x=int(input())
print(solve(x))

Buggy python submission (verdict: Runtime Error):

def solve(x):
    k=1
    s=0
    while True:
        if(x%k==0):
            i=(x//k)-1
            if (x//i==x%i):
                s+=i
        k+=1
        if k*k>x:
            break
    return s
        

x=int(input())
print(solve(x))


Fixed submission:
def solve(x):
    if(x<2):
        return 0
    k=1
    s=0
    while True:
        if(x%k==0):
            i=(x//k)-1
            if (x//i==x%i):
                s+=i
        k+=1
        if k*k>x:
            break
    return s
        

x=int(input())
print(solve(x))
Buggy python submission (verdict: Runtime Error):
def init(a):
    cf=a[0]
    cc=0
    z=[]
    for it in a:
        if(it==cf):
            cc+=1
        else:
            if(cf=='0'):
                z.append(-cc)
            else:
                z.append(cc)
            cf=it
            cc=1
    z.append(cc)
    return z

p=[]
def solve(a,K):

    if(K==0):
        p.append(max(a))
        return
    N=len(a)
    if(K%2==0):
        if(a[0]>0):
            b=[]
            b.append(a[1]-a[0])
            for j in range(2,N):
                b.append(a[j])
            solve(b,K-1)
        if(a[N-1]>0):
            b=[]
            for j in range(2,N):
                b.append(a[j])
            b.append(a[N-2]-a[N-1]) 
            solve(b,K-1)            
        for i in range(1,N-1):
            if(a[i]>0):
                b=[]
                for j in range(0,i-1):
                    b.append(a[j])
                b.append(a[i-1]-a[i]+a[i+1])
                for j in range(i+2,N):
                    b.append(a[j])
                solve(b,K-1)
    else:
        if(a[0]<0):
            b=[]
            b.append(a[1]-a[0])
            for j in range(2,N):
                b.append(a[j])
            solve(b,K-1)
        if(a[N-1]<0):
            b=[]
            for j in range(2,N):
                b.append(a[j])
            b.append(a[N-2]-a[N-1]) 
            solve(b,K-1)            
        for i in range(1,N-1):
            if(a[i]<0):
                b=[]
                for j in range(0,i-1):
                    b.append(a[j])
                b.append(a[i-1]-a[i]+a[i+1])
                for j in range(i+2,N):
                    b.append(a[j])
                solve(b,K-1)

N,K=list(map(int,input().split(" ")))
a=str(input())
z=init(a)
L=len(a)
Q=0
if(z[0]<0):
    Q=N//2+1
else:
    Q=N//2
if(K>=Q):
    print(N)
else:

    solve(z,K)
    print(max(p))


Fixed submission:
a=list(map(int,input().split(" ")))
x,y=sorted(a)
if(y-1>x):
    print(y+y-1)
else:
    print(y+x)
Buggy python submission (verdict: Runtime Error):
def d201(a):
    count=0
    N=len(a)
    for i in range(N):
        if(i%2==0):
            if(a[i]=='0'):
                count+=1
        else:
            if(a[i]=='1'):
                count+=1
    return count

                
def d210(a):
    count=0
    N=len(a)
    for i in range(N):
        if(i%2==0):
            if(a[i]=='1'):
                count+=1
        else:
            if(a[i]=='0'):
                count+=1
    return count

a=input()
print(min(d210(a),d201(a))
                




Fixed submission:
def d201(a):
    count=0
    N=len(a)
    for i in range(N):
        if(i%2==0):
            if(a[i]=='0'):
                count+=1
        else:
            if(a[i]=='1'):
                count+=1
    return count

                
def d210(a):
    count=0
    N=len(a)
    for i in range(N):
        if(i%2==0):
            if(a[i]=='1'):
                count+=1
        else:
            if(a[i]=='0'):
                count+=1
    return count

a=input()
print(min(d210(a),d201(a)))
Buggy python submission (verdict: Runtime Error):
a=int(input())
if(a<1200):
  print("ABC")
 elif a<2800:
  print("ARC")
 else:
  print("AGC")
  

Fixed submission:
a=int(input())
if(a<1200):
  print("ABC")
elif a<2800:
  print("ARC")
else:
  print("AGC")
Buggy python submission (verdict: Runtime Error):
a=[]
for i in range(4):
 a.append(int(input())
print(min(a[0],a[1])+min(a[2],a[3]))

Fixed submission:
a=[]
for i in range(4):
 a.append(int(input()))
print(min(a[0],a[1])+min(a[2],a[3]))

Buggy python submission (verdict: Runtime Error):
a=[]
for i in range(4)
 a.append(int(input())
print(min(a[0],a[1])+min(a[2],a[3]))

Fixed submission:
a=[]
for i in range(4):
 a.append(int(input()))
print(min(a[0],a[1])+min(a[2],a[3]))

Buggy python submission (verdict: Runtime Error):
a=list(map(int,input().split(' ')))
print(min(a[0],a[1])+min(a[2],a[3]))

Fixed submission:
a=[]
for i in range(4):
 a.append(int(input()))
print(min(a[0],a[1])+min(a[2],a[3]))
Buggy python submission (verdict: Runtime Error):
n, x, t = map(int, input().split())
a = (n + x - 1) // x * t
print a

Fixed submission:
n, x, t = map(int, input().split())
a = (n + x - 1) // x * t
print(a)
Buggy python submission (verdict: Runtime Error):
8
5 7 4 2 6 8 1 3

Fixed submission:
m = input()
arr = input().split()
cnt = 0
flg = 1
mnn = arr[0]
for n in arr:
  if(int(n)>int(mnn)):
    continue
  else:
    mnn = n
    cnt = cnt + 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

m = int(input())
n = int(input())
a =  [m, n]
print(lcm(a))

Fixed submission:
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

a =  (input().split())
b = [1, 1]
b[0] = int(a[0])
b[1] = int(a[1])
print(lcm(b))

Buggy python submission (verdict: Runtime Error):
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

m = int(input())
n = int(input())
a =  [m, n]
print(lcm(a))

Fixed submission:
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

a =  (input().split())
b = [1, 1]
b[0] = int(a[0])
b[1] = int(a[1])
print(lcm(b))

Buggy python submission (verdict: Runtime Error):
m = int(input())
n = int(input())

x = max(m, n)
y = min(m, n)
if x % y == 0:
  print(x)
else:
  while x%y!=0:
    z = x % y
    x = y
    y = z
  
print(int(m * n / z))

Fixed submission:
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

a =  (input().split())
b = [1, 1]
b[0] = int(a[0])
b[1] = int(a[1])
print(lcm(b))

Buggy python submission (verdict: Runtime Error):
m = int(input())
n = int(input())

x = max(m, n)
y = min(m, n)
if x % y == 0:
  print(x)
else:
  while x%y!=0:
    z = x % y
    x = y
    y = z
  else:
    print(int(m * n / z))

Fixed submission:
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

a =  (input().split())
b = [1, 1]
b[0] = int(a[0])
b[1] = int(a[1])
print(lcm(b))

Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
  x = max(a, b)
  y = min(a, b)
  if x%y == 0:
    return y
  else:
    while x%y!=0:
      z = x%y
      x = y
      y = z
    else:
      return z

def lcm(m, n):
  return int(m * n/gcd(m, n))

m = int(input())
n = int(input())

print(lcm(m,n))

Fixed submission:
def lcm(a):
    from fractions import gcd
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

a =  (input().split())
b = [1, 1]
b[0] = int(a[0])
b[1] = int(a[1])
print(lcm(b))
Buggy python submission (verdict: Time Limit Exceeded):
def abc177_c_1():
    n = int(input())
    a = list(map(int, input().split(' ')))

    mod = 10 ** 9 + 7
    ans = 0

    for i in range(n - 1):
        ans += (a[i] * sum(a[i + 1:])) % mod

    ans = ans % mod
    print(ans)

if __name__ == '__main__':
    abc177_c_1()

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

    mod = 10 ** 9 + 7
    ans = 0
    x = 0

    for i in range(n):
        ans = (ans + a[i] * x) % mod
        x = (x + a[i]) % mod

    print(ans)

if __name__ == '__main__':
    abc177_c_2()

Buggy python submission (verdict: Time Limit Exceeded):
def abc177_c():
    n = int(input())
    a = list(map(int, input().split(' ')))

    mod = 10 ** 9 + 7
    ans = 0

    for i in range(n - 1):
        for j in range(i + 1, n):
            ans += ((a[i] % mod) * (a[j] % mod)) % mod
            ans %= mod

    print(ans)

if __name__ == '__main__':
    abc177_c()

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

    mod = 10 ** 9 + 7
    ans = 0
    x = 0

    for i in range(n):
        ans = (ans + a[i] * x) % mod
        x = (x + a[i]) % mod

    print(ans)

if __name__ == '__main__':
    abc177_c_2()

Buggy python submission (verdict: Time Limit Exceeded):
def abc177_c():
    n = int(input())
    a = list(map(int, input().split(' ')))

    mod = 10 ** 9 + 7
    ans = 0

    for i in range(n - 1):
        for j in range(i + 1, n):
            ans += ((a[i] % mod) * (a[j] % mod)) % mod
            ans %= mod

    print(ans)

if __name__ == '__main__':
    abc177_c()

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

    mod = 10 ** 9 + 7
    ans = 0
    x = 0

    for i in range(n):
        ans = (ans + a[i] * x) % mod
        x = (x + a[i]) % mod

    print(ans)

if __name__ == '__main__':
    abc177_c_2()

Buggy python submission (verdict: Time Limit Exceeded):
def abc177_c():
    n = int(input())
    a = list(map(int, input().split(' ')))

    mod = 10 ** 9 + 7
    ans = 0

    for i in range(n - 1):
        for j in range(i + 1, n):
            ans += ((a[i] % mod) * (a[j] % mod)) % mod

    ans = ans % mod
    print(ans)

if __name__ == '__main__':
    abc177_c()

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

    mod = 10 ** 9 + 7
    ans = 0
    x = 0

    for i in range(n):
        ans = (ans + a[i] * x) % mod
        x = (x + a[i]) % mod

    print(ans)

if __name__ == '__main__':
    abc177_c_2()
Buggy python submission (verdict: Runtime Error):
def abc170_c_1():
    """
    もうちょいコンパクトに書いてみる
    """
    def solve():
        x, n = map(int, input().split(' '))
        if n == 0:
            return x

        p = list(map(int, input().split(' ')))

        search_range_min = min(min(p), x) - 1
        search_range_max = max(max(p), x) + 1
        search_values = [i for i in range(search_range_min, search_range_max + 1) if i not in p]

        # min関数のkeyにxとの差の絶対値を直接渡してその値の最小値を取得してしまう。
        ans = min(search_values, key=lambda a: (abs(a - x)), x)

        # こっちはたぶん絶対値の差が同じ時にリストの先にあるほうをとってしまうので結果バグっている気がする
        # ans = min(search_values, key=lambda a: abs(a - x))

        return ans

    print(solve())

if __name__ == '__main__':
    abc170_c_1()


Fixed submission:
def abc170_c():
    def solve():
        x, n = map(int, input().split(' '))
        if n == 0:
            return x

        p = list(map(int, input().split(' ')))

        search_range_min = min(min(p), x) - 1
        search_range_max = max(max(p), x) + 1
        search_values = [i for i in range(search_range_min, search_range_max + 1) if i not in p]

        check_dict = {}

        for i in search_values:
            # 絶対値が小さいものを調べるので差の絶対値を格納
            check_dict[i] = abs(x - i)

        return min(check_dict, key=check_dict.get)
    print(solve())

if __name__ == '__main__':
    abc170_c()
Buggy python submission (verdict: Runtime Error):
def abc145_c():    
    n = int(input())
    xy = [list(map(int,input().split())) for i in range(n)]
    ans = 0
    for i in range(n):
        for j in range(n):
            cnt += 1
            ans += ((xy[i][0] - xy[j][0])** 2 + (xy[i][1] - xy[j][1])** 2)**0.5
    print(ans / n)
    
if __name__ == '__main__':
    abc145_c()

Fixed submission:
def abc145_c():    
    n = int(input())
    xy = [list(map(int,input().split())) for i in range(n)]
    ans = 0
    for i in range(n):
        for j in range(n):
            ans += ((xy[i][0] - xy[j][0])** 2 + (xy[i][1] - xy[j][1])** 2)**0.5
    print(ans / n)
    
if __name__ == '__main__':
    abc145_c()
Buggy python submission (verdict: Time Limit Exceeded):
def abc142_c():    
    n = int(input())
    a = list(map(int,input().split()))
    i = 0
    dict = {}

    for num in a:
        i += 1
        dict[i] = num

    sorted_arrive_list = sorted(dict.items(), key=lambda x :x[1])
    ans = ''
    for l in sorted_arrive_list:
        ans = ans + str(l[0]) + ' '
    print(ans)

if __name__ ==  '__main__':
    abc142_c()

Fixed submission:
def abc142_c2():    
    n = int(input())
    a = list(map(int, input().split()))
    # ansを格納する空のリストを準備
    ans = [0] * n

    # enumerate()でインデックスと取り出してansに格納
    for val, num in enumerate(a, 1):
        ans[num - 1] = val
    # リストの前に*をつけるとアンパックされる
    print(*ans)
if __name__ ==  '__main__':
    abc142_c2()
Buggy python submission (verdict: Runtime Error):
n = int(input())

def f(a, b):
    x = int(max(a, b))
    return len(str(x))

results = []

for i in range(1, (n // 2) + 1):
    if n % i == 0:
        a = i
        b = n / i
    result = f(a, b)
    results.append(result)

print(min(results))

Fixed submission:
n = int(input())

def f(a, b):
    x = int(max(a, b))
    return len(str(x))

results = []

for i in range(1, int(n ** (1/2)) + 1):
    if n % i == 0:
        a = i
        b = n / i
    result = f(a, b)
    results.append(result)

print(min(results))

Buggy python submission (verdict: Runtime Error):
n = int(input())

def f(a, b):
    x = max(a, b)
    return len(str(x))

results = []

for i in range(1, (n // 2) + 1):
    if n % i == 0:
        a = i
        b = int(n / i)
    result = f(a, b)
    results.append(result)

print(min(results))

Fixed submission:
n = int(input())

def f(a, b):
    x = int(max(a, b))
    return len(str(x))

results = []

for i in range(1, int(n ** (1/2)) + 1):
    if n % i == 0:
        a = i
        b = n / i
    result = f(a, b)
    results.append(result)

print(min(results))

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

def f(a, b):
    x = max(a, b)
    return len(str(x))

results = []

for i in range(1, n + 1):
    if n % i == 0:
        a = i
        b = n / i
    result = f(a, b)
    results.append(result)

print(min(results))

Fixed submission:
n = int(input())

def f(a, b):
    x = int(max(a, b))
    return len(str(x))

results = []

for i in range(1, int(n ** (1/2)) + 1):
    if n % i == 0:
        a = i
        b = n / i
    result = f(a, b)
    results.append(result)

print(min(results))
Buggy python submission (verdict: Runtime Error):
def resolve():
    s = input()
    t = input()
    ls = len(s)
    lt = len(t)
    c = []
    for i in range(ls - lt):
        count = 0
        for j in range(lt):
            if s[i+j] == t[j]:
                count += 1
        c.append(count)
    print(lt - max(c))
resolve()    

Fixed submission:
def resolve():
    s = input()
    t = input()
    ls = len(s)
    lt = len(t)
    c = []
    for i in range(ls - lt + 1):
        count = 0
        for j in range(lt):
            if s[i+j] == t[j]:
                count += 1
        c.append(count)
    print(lt - max(c))
resolve()
Buggy python submission (verdict: Runtime Error):
if '7' in n:
  print('Yes')
else:
  print('No')

Fixed submission:
def resolve():
    n = input()
    if n[0] == '7' or n[1] == '7' or n[2] == '7':
        print('Yes')
    else:
        print('No')
resolve()

Buggy python submission (verdict: Runtime Error):
n = input()
if 7 in n:
  print('Yes')
else:
  print('No')

Fixed submission:
def resolve():
    n = input()
    if n[0] == '7' or n[1] == '7' or n[2] == '7':
        print('Yes')
    else:
        print('No')
resolve()

Buggy python submission (verdict: Runtime Error):
n = int(input())
if 7 in n:
    print('Yes')
else:
    print('No')

Fixed submission:
def resolve():
    n = input()
    if n[0] == '7' or n[1] == '7' or n[2] == '7':
        print('Yes')
    else:
        print('No')
resolve()
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
L = []
if n > k:
  n = n - k*(n//k)
 
for i in range(k+1):
  L.append(abs(n-k))
  n = abs(n-k)
  
print(min(L))  

Fixed submission:
n, k = map(int, input().split())
L = []
if n > k:
  n = n - k*(n//k)
 
if n*2 <= k:
  print(n)
else:
  print(k-n)
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
L=""
for _ in range(n//(a+b)+1):
  L += 'b'*a+'r'*b
print(L[:n].count('b'))

Fixed submission:
n,a,b=map(int,input().split())
t= n//(a+b)
s = n%(a+b)
print(t*a + min(s,a))

Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
L=""
for _ in range(10**18):
  L += 'b'*a+'r'*b
print(L[:n].count('b'))

Fixed submission:
n,a,b=map(int,input().split())
t= n//(a+b)
s = n%(a+b)
print(t*a + min(s,a))

Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
L=""
for _ in range(10**100):
  L += 'b'*a+'r'*b
print(L[:n].count('b'))

Fixed submission:
n,a,b=map(int,input().split())
t= n//(a+b)
s = n%(a+b)
print(t*a + min(s,a))

Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
L=""
for _ in range(3):
  L += 'b'*a+'r'*b
print(L[:n].count('b'))

Fixed submission:
n,a,b=map(int,input().split())
t= n//(a+b)
s = n%(a+b)
print(t*a + min(s,a))
Buggy python submission (verdict: Time Limit Exceeded):
n, k  = map(int, input().split())
L = list(map(int, input().split()))
E = []
for i in range(len(L)):
  E.append((1+L[i])/2)
S = []  
for i in range(len(E)-k+1):
  sum = E[i]
  for j in range(1, k):
    sum += E[i+j]
  S.append(sum)
print(max(S)) 

Fixed submission:
n, k  = map(int, input().split())
L = list(map(int, input().split()))
E = []
for i in range(len(L)):
  E.append((1+L[i])/2)
v = 0
for i in range(k):
  v += E[i]
S = [v]  
for i in range(k, len(E)):
  v = v + E[i] - E[i-k]
  S.append(v)
print(max(S))
Buggy python submission (verdict: Runtime Error):
 n, m = map(int, input().split())
    if n == m:
        print('Yes')
    else:
        print('No')

Fixed submission:
n, m = map(int, input().split())
if n == m:
 print('Yes')
else:
 print('No')
Buggy python submission (verdict: Runtime Error):
print(char(ord(input())+1))

Fixed submission:
print(chr(ord(input())+1))

Buggy python submission (verdict: Runtime Error):
print(input()+1)

Fixed submission:
print(chr(ord(input())+1))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, k, q = map(int, input().split())
L = np.array([k]*n)
ones = np.array([1]*n)
for i in range(q):
  a = int(input())
  L -= ones
  L[a-1] += 1
    
for i in range(n):
  if L[i] > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
n, k, q = map(int, input().split())
L = [0]*n
for i in range(q):
  a = int(input())
  L[a-1] += 1
    
for i in range(n):
  if k - q + L[i] > 0:
    print('Yes')
  else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
L = [k]*n
for i in range(q):
  a = int(input())
  for j in range(n):
    L[j] -= 1
  L[a-1] += 1
    
for i in range(n):
  if L[i] > 0:
    print('Yes')
  else:
    print('No')

Fixed submission:
n, k, q = map(int, input().split())
L = [0]*n
for i in range(q):
  a = int(input())
  L[a-1] += 1
    
for i in range(n):
  if k - q + L[i] > 0:
    print('Yes')
  else:
    print('No')