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

n,m = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(m)]
n = np.array([0]*n)
for l,r in LR:
  n[l-1:r] += 1.
print(sum(n == m))

Fixed submission:
n,m = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(m)]
L = max([i[0] for i in LR])
R = min([i[1] for i in LR])
print(max(R-L+1,0))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

n,m = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(m)]
n = np.zeros(n)
for l,r in LR:
  n[l-1:r] += 1
print(sum(n == m))

Fixed submission:
n,m = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(m)]
L = max([i[0] for i in LR])
R = min([i[1] for i in LR])
print(max(R-L+1,0))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())
ab = "abcdefghijklmnopqrstuvwxyz".replace(S[K],"")
for i in ab:
  S = S.replace(i,"*")
print(S)

Fixed submission:
N = int(input())
S = input()
K = int(input())
t = S[K-1]
ans = ""
for s in S:
  if s == t:
    ans += s
  else:
    ans += "*"
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())
T = ""
for s in S:
  if s == S[K]:
    T += s
  else:
    T += "*"
print(T)

Fixed submission:
N = int(input())
S = input()
K = int(input())
t = S[K-1]
ans = ""
for s in S:
  if s == t:
    ans += s
  else:
    ans += "*"
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,q= map(int,input().split())
s = input()
lr = [list(map(int, input().split())) for i in range(q)]

import numpy as np
for i,j in lr:
  print(s[i-1:j].count("AC"))

Fixed submission:
n,q= map(int,input().split())
s = input()
lr = [list(map(int, input().split())) for i in range(q)]
import numpy as np
sn = list(np.cumsum([0] + [s[i:i++2]=="AC" for i in range(n-1)]))

for i,j in lr:
  i -= 1
  j -= 1
  print(sn[j] - sn[i])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())
S = input()
l = [list(map(int, input().split())) for _ in range(Q)]
[print(S[l-1:r].count("AC")) for l,r in l]

Fixed submission:
n,q= map(int,input().split())
s = input()
lr = [list(map(int, input().split())) for i in range(q)]
import numpy as np
sn = list(np.cumsum([0] + [s[i:i++2]=="AC" for i in range(n-1)]))

for i,j in lr:
  i -= 1
  j -= 1
  print(sn[j] - sn[i])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())
S = input()
l = [list(map(int, input().split())) for _ in range(Q)]
for l,r in l:
  print(S[l-1:r].count("AC"))

Fixed submission:
n,q= map(int,input().split())
s = input()
lr = [list(map(int, input().split())) for i in range(q)]
import numpy as np
sn = list(np.cumsum([0] + [s[i:i++2]=="AC" for i in range(n-1)]))

for i,j in lr:
  i -= 1
  j -= 1
  print(sn[j] - sn[i])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())
S = input()
lr = [input().split() for _ in range(Q)]

for l,r in lr:
  l,r = int(l),int(r)
  s = S[l-1:r]
  print(s.count("AC"))

Fixed submission:
n,q= map(int,input().split())
s = input()
lr = [list(map(int, input().split())) for i in range(q)]
import numpy as np
sn = list(np.cumsum([0] + [s[i:i++2]=="AC" for i in range(n-1)]))

for i,j in lr:
  i -= 1
  j -= 1
  print(sn[j] - sn[i])

Buggy python submission (verdict: Time Limit Exceeded):
N,Q = map(int, input().split())
S = input()
lr = [input().split() for _ in range(Q)]

for l,r in lr:
  l,r = int(l),int(r)
  s = S[l-1:r]
  print(s.count("AC"))

Fixed submission:
n,q= map(int,input().split())
s = input()
lr = [list(map(int, input().split())) for i in range(q)]
import numpy as np
sn = list(np.cumsum([0] + [s[i:i++2]=="AC" for i in range(n-1)]))

for i,j in lr:
  i -= 1
  j -= 1
  print(sn[j] - sn[i])
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
l = []
for a,b in AB:
  l.extend([a]*b)
print(sum(sorted(l)[:M]))

Fixed submission:
N,M = map(int, input().split())
import numpy as np
AB = np.array([list(map(int, input().split())) for _ in range(N)])
idx = np.argsort(AB[:,0],axis=0)
AB = AB[idx]
l = []
for a,b in AB:
  l.extend([a]*b)
  if len(l) > M:
    break
print(sum(l[:M]))

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]
import numpy as np
l = []
for i in [[a]*b for a,b in AB]:
  l.extend(i)

print(sum(sorted(l)[:M]))

Fixed submission:
N,M = map(int, input().split())
import numpy as np
AB = np.array([list(map(int, input().split())) for _ in range(N)])
idx = np.argsort(AB[:,0],axis=0)
AB = AB[idx]
l = []
for a,b in AB:
  l.extend([a]*b)
  if len(l) > M:
    break
print(sum(l[:M]))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
h = list(map(int, input().split()))

dp = [0]*n
dp[1] = abs(h[1] - h[0])
for i in range(2,n):
  dp[i] = min([dp[i-j]+abs(h[i]-h[i-j]) for j in range(1,min(i,k)+1)])
  
print(dp[-1])

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

dp = [0]*n
dp[1] = abs(h[1] - h[0])
for i in range(2,n):
  dp[i] = min([dp[i-j]+abs(h[i]-h[i-j]) for j in range(1,min(i,k)+1)])
  
print(dp[-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = sorted([int(input()) for _ in range(n)])
print(p[:-1] + p[-1]//2)

Fixed submission:
n = int(input())
p = sorted([int(input()) for _ in range(n)])
print(sum(p[:-1]) + p[-1]//2)
Buggy python submission (verdict: Runtime Error):
X = int(input())
if x==3 or x==5 or x==7:
  print("YES")
else:
  print("NO")

Fixed submission:
X = int(input())
if X==3 or X==5 or X==7:
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input()))
print(max(a) - min(a))

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
print(max(a) - min(a))
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
result = []
for i in range(min(len(s),k)):
  result = result + [s[j:j+i+1] for j in range(len(s)-i)]
  
result = sorted(set(result))
print(result[3])

Fixed submission:
s = input()
k = int(input())
result = []
for i in range(min(len(s),k)):
  result = result + [s[j:j+i+1] for j in range(len(s)-i)]
  
result = sorted(set(result))
print(result[k-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = list(map(int, input().split()))
count = 0
for idx,i in enumerate(p):
  if i == idx+1:
    p[idx],p[idx+1] = p[idx+1],i
    count += 1
    
print(count)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
count = 0
for idx,i in enumerate(p):
  if i == idx+1:
    try:
      p[idx],p[idx+1] = p[idx+1],i
      count += 1
    except:
      count += 1
    
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
k = int(input())-1

c = s[k]

out = ""

for i in s:
    if i == c:
        out += i
    else:
        out += "*"

print(out

Fixed submission:
n = int(input())
s = str(input())
k = int(input())-1

c = s[k]

out = ""

for i in s:
    if i == c:
        out += i
    else:
        out += "*"

print(out)

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

c = s[k]

out = ""

for i in s:
    if i == c:
        out += i
    else:
        out += "*"

print(out)

Fixed submission:
n = int(input())
s = str(input())
k = int(input())-1

c = s[k]

out = ""

for i in s:
    if i == c:
        out += i
    else:
        out += "*"

print(out)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())

ans = 0

for x in range(N+1):
    sum = 0
    xx = x
    while xx != 0:
        sum += xx % 10
        xx = xx / 10

    if A <= sum and B >= sum:
        ans += x

print(ans)

Fixed submission:
n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(raw_input())
A = int(raw_input())
B = int(raw_input())

ans = 0

for x in range(N+1):
    sum = 0
    xx = x
    while xx != 0:
        sum += xx % 10
        xx = xx / 10

    if A <= sum and B >= sum:
        ans += x

print(ans)

Fixed submission:
n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)
Buggy python submission (verdict: Runtime Error):
N = input(),strip()

if N[-1] in ['2', '4', '5', '7', '9']:
  print('hon')
elif N[-1] in ['0', '1', '6', '8']:
  print('pon')
elif N[-1] == '3':
  print('bon')


Fixed submission:
N = input().strip()

if N[-1] in ['2', '4', '5', '7', '9']:
  print('hon')
elif N[-1] in ['0', '1', '6', '8']:
  print('pon')
elif N[-1] == '3':
  print('bon')

Buggy python submission (verdict: Runtime Error):

N = input(),strip()

if N[len(N)] in ['2', '4', '5', '7', '9']:
  print('hon')
elif N[len(N)] in ['0', '1', '6', '8']:
  print('pon')
elif N[len(N)] in ['3']:
  print('bon')

Fixed submission:
N = input().strip()

if N[-1] in ['2', '4', '5', '7', '9']:
  print('hon')
elif N[-1] in ['0', '1', '6', '8']:
  print('pon')
elif N[-1] == '3':
  print('bon')

Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc168/tasks/abc168_a

while True:
    #入力を受け取りｎに代入
    n=list(input())
    #１の位をとってくる

    poo=n[-1]

    if poo in "24579":
        print("hon")
    elif poo in "0168":
        print("pon")
    elif poo=="3":
        print("bon")



Fixed submission:
#入力を受け取りｎに代入
n=list(input())
#１の位をとってくる

poo=n[-1]

if poo in "24579":
     print("hon")
elif poo in "0168":
    print("pon")
elif poo=="3":
    print("bon")

Buggy python submission (verdict: Runtime Error):
#https://atcoder.jp/contests/abc168/tasks/abc168_a

while True:
    #入力を受け取りｎに代入
    n=list(input())
    #１の位をとってくる

    poo=n[-1]

    if poo in "24579":
        print("hon")
    elif poo in "0168":
        print("pon")
    elif poo=="3":
        print("bon")


Fixed submission:
#入力を受け取りｎに代入
n=list(input())
#１の位をとってくる

poo=n[-1]

if poo in "24579":
     print("hon")
elif poo in "0168":
    print("pon")
elif poo=="3":
    print("bon")

Buggy python submission (verdict: Runtime Error):
while True:
    n = input('N = ')
    try:
        n = int(n)
    except ValueError:
        print(n, 'は数値に変換できません。')
        continue
    except:
        print("予期しないエラー")
        exit()
    if (n <=0 or n >999):
        print(n,"は範囲外の数値です。")
        continue

    while n>=100:
        n -= 100
    while n>=10:
        n -= 10

    if n==3:
        print('bon')
    elif n==0 or n==1 or n==6 or n==8:
        print('pon')
    else:
        print('hon')

Fixed submission:
N = int(input())
while N>=100:
    N -= 100
while N>=10:
    N -= 10

if N==3:
    print('bon')
elif N==0 or N==1 or N==6 or N==8:
    print('pon')
else:
    print('hon')
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())	

if x<10:
  r=y+100(10-x)
else:
  r=y
  
print(r)

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

if x<11:
  r=y+100*(10-x)
else:
  r=y
  
print(r)

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())	

if x<11:
  r=y+100(10-x)
else:
  r=y
  
print(r)

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

if x<11:
  r=y+100*(10-x)
else:
  r=y
  
print(r)

Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())	

if x<11:
  r=y-100(10-x)
else:
  r=y
  
print(r)

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

if x<11:
  r=y+100*(10-x)
else:
  r=y
  
print(r)
Buggy python submission (verdict: Runtime Error):
a=int(input())
s=input()

if a>=3200:
    print(s)
else:
    print(red)

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

if a>=3200:
    print(s)
else:
    print("red")
Buggy python submission (verdict: Runtime Error):
k = int(input())
    s = input()
    if len(s) <= k:
        print(s)
    else:
        print(s[:k]+'...')

Fixed submission:
k = int(input())
s = input()
if k >= len(s):
  print(s)
else:
  print(s[:k]+"...")

Buggy python submission (verdict: Runtime Error):
k = int(input())
    s = str(input())
    if len(s) <= k:
        print(s)
    else:
        print(s[:k]+'...')

Fixed submission:
k = int(input())
s = input()
if k >= len(s):
  print(s)
else:
  print(s[:k]+"...")

Buggy python submission (verdict: Runtime Error):
k = int(input())
    s = str(input())
    if len(s) <= k:
        print(s)
    else:
        print(s[:k])

Fixed submission:
k = int(input())
s = input()
if k >= len(s):
  print(s)
else:
  print(s[:k]+"...")

Buggy python submission (verdict: Runtime Error):
 k = int(input())
    s = str(input())
    if len(s) <= k:
        print(str(s))
    else:
        print(s[:k])

Fixed submission:
k = int(input())
s = input()
if k >= len(s):
  print(s)
else:
  print(s[:k]+"...")
Buggy python submission (verdict: Runtime Error):
import math

    a, b, h, m = map(int, input().split())
    h = h * 30 + m/2
    m = m * 6
    degree = abs(h - m)
    if degree > 180:
        degree = 360 - degree
    print(math.sqrt(a*a + b*b - 2*a*b*math.cos(math.radians(degree))))

Fixed submission:
from math import *
a, b, h, m = map(int, input().split())
h = 30 * h + m / 2
m *= 6
d = (a * sin(radians(h))) - (b * sin(radians(m)))
e = (a * cos(radians(h))) - (b * cos(radians(m)))
print((d * d + e * e)**0.5)

Buggy python submission (verdict: Runtime Error):
import math

    a, b, h, m = map(int, input().split())
    h = h * 30
    m = m * 6
    degree = abs(h - m)
    if degree > 180:
        degree = 360 - degree
    print(float(math.sqrt(a*a + b*b - 2*a*b*math.cos(math.radians(degree)))))

Fixed submission:
from math import *
a, b, h, m = map(int, input().split())
h = 30 * h + m / 2
m *= 6
d = (a * sin(radians(h))) - (b * sin(radians(m)))
e = (a * cos(radians(h))) - (b * cos(radians(m)))
print((d * d + e * e)**0.5)

Buggy python submission (verdict: Runtime Error):
    Hlong = int(input())
    Mlong= int(input())
    h = int(input()) * 30
    m = int(input()) * 6
    degree = abs(h - m)
    if degree > 180:
        degree = 360 - degree
    print(math.sqrt(Hlong*Hlong + Mlong*Mlong - 2*Hlong*Mlong*math.cos(math.radians(degree))))

Fixed submission:
from math import *
a, b, h, m = map(int, input().split())
h = 30 * h + m / 2
m *= 6
d = (a * sin(radians(h))) - (b * sin(radians(m)))
e = (a * cos(radians(h))) - (b * cos(radians(m)))
print((d * d + e * e)**0.5)
Buggy python submission (verdict: Runtime Error):
(base) C:\Users\toshi\AtCorder>python abc.py
2
hon

(base) C:\Users\toshi\AtCorder>
(base) C:\Users\toshi\AtCorder>python abc.py
3
bon

(base) C:\Users\toshi\AtCorder>python abc.py
4
hon

(base) C:\Users\toshi\AtCorder>python abc.py
5
hon

(base) C:\Users\toshi\AtCorder>python abc.py
6
pon

(base) C:\Users\toshi\AtCorder>python abc.py
7
hon

(base) C:\Users\toshi\AtCorder>python abc.py
8
pon

(base) C:\Users\toshi\AtCorder>python abc.py
9
hon

(base) C:\Users\toshi\AtCorder>

Fixed submission:
n = int(input())%10
if n==0:
    print("pon")
if n==1:
    print("pon")
if n==2:
    print("hon")
if n==3:
    print("bon")
if n==4:
    print("hon")
if n==5:
    print("hon")
if n==6:
    print("pon")
if n==7:
    print("hon")
if n==8:
    print("pon")
if n==9:
    print("hon")
Buggy python submission (verdict: Runtime Error):
   s,w=input().split()
s=int(s)
w=int(w)
if s>w:
    print("safe")
else:
    print("unsafe")

Fixed submission:
s,w=input().split()
s=int(s)
w=int(w)
if s>w:
    print("safe")
if w>s:
   print("unsafe")
if w==s:
   print("unsafe")
Buggy python submission (verdict: Runtime Error):
import sys
from collections import namedtuple, defaultdict
from math import gcd
input = sys.stdin.readline

class Point:
    def __init__(self, x, y):
        g = gcd(abs(x), abs(y))

        x //= g
        y //= g

        if x < 0:
            x *= -1
            y *= -1

        self.x = x
        self.y = y

    def __eq__(self, other):
        return self.x == other.x and self.y == other.y

    def __hash__(self):
        return hash((self.x, self.y))

    def __repr__(self):
        return f'({self.x}, {self.y})'

def main():
    n = int(input())
    
    p = []
    d = defaultdict(lambda: 0)

    for _ in range(n):
        x, y = map(int, input().split())


        p.append(Point(x, y))
        d[p[-1]] += 1

    # print(d)

    MOD = 10 ** 9 + 7

    pw = [ pow(2, i, MOD) for i in range(n + 1) ]

    ans = 1
    tot = 0

    # pair = 0
    # for x in range(n):
    #     for y in range(x + 1, n):
    #         if p[x].x * p[y].x + p[x].y * p[y].y == 0:
    #             pair += 1

    # print(f'pairs = {pair}')

    for x in d.keys():
        if x.x > 0 and x.y >= 0 and x in d and Point(-x.y, x.x) in d:
            s = d[x]
            t = d[Point(-x.y, x.x)]

            # print(s, t)

            tot += s + t
            value = (pw[s] + pw[t] - 1 + MOD) % MOD
            ans = ans * value % MOD

    # print(f'tot={tot}, n={n}')

    ans = ans * pw[n - tot] % MOD
    ans = (ans - 1 + MOD) % MOD

    print(ans)
main()


Fixed submission:
import sys
from collections import namedtuple, defaultdict
from math import gcd
input = sys.stdin.readline

class Point:
    def __init__(self, x, y):
        g = gcd(abs(x), abs(y))

        x //= g
        y //= g

        if x < 0:
            x *= -1
            y *= -1

        elif x == 0 and y < 0:
            y *= -1

        self.x = x
        self.y = y

    def __eq__(self, other):
        return self.x == other.x and self.y == other.y

    def __hash__(self):
        return hash((self.x, self.y))

    def __repr__(self):
        return f'({self.x}, {self.y})'

def main():
    n = int(input())
    
    p = []
    d = defaultdict(lambda: 0)
    zeros = 0

    for _ in range(n):
        x, y = map(int, input().split())

        if x == 0 and y == 0:
            n -= 1
            zeros += 1
            continue

        p.append(Point(x, y))
        d[p[-1]] += 1

    MOD = 10 ** 9 + 7

    pw = [ pow(2, i, MOD) for i in range(n + 1) ]

    ans = 1
    tot = 0

    for x in d.keys():
        if x.x > 0 and x.y >= 0 and Point(-x.y, x.x) in d:
            s = d[x]
            t = d[Point(-x.y, x.x)]

            tot += s + t
            value = (pw[s] + pw[t] - 1 + MOD) % MOD
            ans = ans * value % MOD

    ans = ans * pw[n - tot] % MOD
    ans = (ans - 1 + MOD + zeros) % MOD

    print(ans)
main()
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

typedef long long int64;

int64 a, b, c, ans = LLONG_MAX;

void calc(int64 a, int64 b, int64 c) {
	int64 r = a / 2;

	for(int64 i = max(1LL, r - 5); i <= min(r + 5, a - 1); i++) {
		int64 v1 = i * b * c;
		int64 v2 = (a - i) * b * c;
		ans = min(ans, llabs(v1 - v2));
	}
}

int main() {
	scanf("%lld%lld%lld", &a, &b, &c);

	calc(a, b, c);
	calc(a, c, b);
	calc(b, a, c);
	calc(b, c, a);
	calc(c, a, b);
	calc(c, b, a);

	printf("%lld\n", ans);
	return 0;
}

Fixed submission:
from math import *

a, b, c = map(int, input().split())

def calc(a, b, c):
	r = a // 2

	ans = a * b * c
	for i in range(max(1, r - 5), min(r + 5, a - 1) + 1):
		v1 = i * b * c
		v2 = (a - i) * b * c
		ans = min(ans, abs(v1 - v2))

	return ans

res = a * b * c

res = min(res, calc(a, b, c))
res = min(res, calc(a, c, b))
res = min(res, calc(b, a, c))
res = min(res, calc(b, c, a))
res = min(res, calc(c, a, b))
res = min(res, calc(c, b, a))

print(res)

Buggy python submission (verdict: Runtime Error):
from math import *

a, b, c = map(int, input().split())

def calc(a, b, c):
	r = sqrt(a)

	ans = a * b * c
	for i in range(max(1, r - 5), min(r + 5, a - 1) + 1):
		v1 = i * b * c
		v2 = (a - i) * b * c
		ans = min(ans, abs(v1 - v2))

	return ans

res = a * b * c

res = min(res, calc(a, b, c))
res = min(res, calc(a, c, b))
res = min(res, calc(b, a, c))
res = min(res, calc(b, c, a))
res = min(res, calc(c, a, b))
res = min(res, calc(c, b, a))

print(res)

Fixed submission:
from math import *

a, b, c = map(int, input().split())

def calc(a, b, c):
	r = a // 2

	ans = a * b * c
	for i in range(max(1, r - 5), min(r + 5, a - 1) + 1):
		v1 = i * b * c
		v2 = (a - i) * b * c
		ans = min(ans, abs(v1 - v2))

	return ans

res = a * b * c

res = min(res, calc(a, b, c))
res = min(res, calc(a, c, b))
res = min(res, calc(b, a, c))
res = min(res, calc(b, c, a))
res = min(res, calc(c, a, b))
res = min(res, calc(c, b, a))

print(res)
Buggy python submission (verdict: Runtime Error):
ans = (N // (A+B)) * A
N -= ((A+B) * (N // (A+B)))
if N >= A:
    ans+=A
else:
    ans+=N

print(ans)

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

if B==0:
    print(N)
elif A==0:
    print(0)
else:
    n = (N//(A+B))
    ans = n * A
    N -= n*(A+B)
    if N >= A:
        ans+=A
    else:
        ans+=N
    print(ans)
Buggy python submission (verdict: Runtime Error):
for i in range(1,10100):
    if int(i*0.08)==A and int(i*0.1)==B:
        print(i)
        break
else:
    print(-1)

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

for i in range(1,10100):
    if int(i*0.08)==A and int(i*0.1)==B:
        print(i)
        break
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S_dict = {}

for i in range(N):
    s = input()
    if s in S_dict.keys():
        S_dict[s] += 1
    else:
        S_dict[s] = 1

max_S = sorted([d[0] for d in S_dict.items() if d[1]==max(S_dict.values())])
for i in max_S:
    print(i)

Fixed submission:
from collections import Counter

stdin = open(0)
N = int(stdin.readline())
S = stdin.read().split()

counter = Counter(S)
max_cnt = max(counter.values())
names = [n for n,c in counter.items() if c==max_cnt]
names.sort()
print(*names, sep='\n')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = []
for _ in range(N):
    S.append(input())
s_set = set(S)
s_dict = {}
for s in s_set:
    s_dict[s] = S.count(s)

s_list = sorted(s_dict.items(),key=lambda x:x[1],reverse=True)
num = s_list[0][1]
ans_list = []
for i in range(len(s_set)):
    if num == s_list[i][1]:
        ans_list.append(s_list[i][0])
    else:
        break
ans_list.sort()
for i in ans_list:
    print(i)

Fixed submission:
from collections import Counter

stdin = open(0)
N = int(stdin.readline())
S = stdin.read().split()

counter = Counter(S)
max_cnt = max(counter.values())
names = [n for n,c in counter.items() if c==max_cnt]
names.sort()
print(*names, sep='\n')
Buggy python submission (verdict: Runtime Error):
import fractions
A,B = map(int,input.split())
ans = fractions.gcd(A, B)
print(ans)


Fixed submission:
import fractions
A,B = map(int,input().split())
ans = A * B // fractions.gcd(A, B)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import bisect

N = int(input())
L = list(map(int,stdin.readline().strip().split()))

L.sort()

ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if L[k] < (L[i]+L[j]):
                ans+=1

print(ans)    


Fixed submission:
from sys import stdin
import bisect

N = int(input())
L = list(map(int,stdin.readline().strip().split()))

L.sort()

ans = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        idx = bisect.bisect_left(L,L[i]+L[j],j)
        ans += (idx-j-1)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import bisect

N,Q = list(map(int,stdin.readline().strip().split()))
S = input().strip()

for i in range(Q):
    l,r = list(map(int,stdin.readline().strip().split()))
    print(S[l-1:r].count('AC'))


Fixed submission:
from sys import stdin
import bisect

N,Q = list(map(int,stdin.readline().strip().split()))
S = input().strip()

P = [0]*N
cnt = 0

for i in range(1,N):
    if S[i-1:i+1] == 'AC':
        cnt+=1
    P[i] = cnt

for i in range(Q):
    l,r = list(map(int,stdin.readline().strip().split()))
    print(P[r-1] - P[l-1])