Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,M=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
l=[]
for b in a:
    for c in a:
        l.append(b + c)
print(sum(sorted(l)[len(l)-M:]))

Fixed submission:
a,b=[i for i in input().split()]
print(b+a)
Buggy python submission (verdict: Runtime Error):
N=int(input())
x=N/1000
if N/1000%=0:
  x=int(x)
else:
  x=int(x)+1
y=1000*x
print(y-N)

Fixed submission:
N=int(input())
x=N/1000
if N%1000==0:
  x=int(x)
else:
  x=int(x)+1
y=1000*x
print(y-N)

Buggy python submission (verdict: Runtime Error):
N=input()
x=N/1000
x=int(x)
y=1000*x
print(y-N)


Fixed submission:
N=int(input())
x=N/1000
if N%1000==0:
  x=int(x)
else:
  x=int(x)+1
y=1000*x
print(y-N)
Buggy python submission (verdict: Runtime Error):
N=int(input())
c_0=0
c_1=0
c_2=0
c_3=0
for i in range(N):
  s_i=input()
  if s_i=="AC":
    c_0=c_0+1
  elif s_i=="WA":
    c_1=c_1+1
  elif s_i=="TLE":
    c_2=c_2+1
  elif s_i=="RE":
    c_3=c_3+1
print("AC x "+c_0)
print("WA x "+c_1)
print("TLE x "+c_2)
print("RE x "+c_3)

Fixed submission:
N=int(input())
c_0=0
c_1=0
c_2=0
c_3=0
for i in range(N):
  s_i=input()
  if s_i=="AC":
    c_0=c_0+1
  elif s_i=="WA":
    c_1=c_1+1
  elif s_i=="TLE":
    c_2=c_2+1
  elif s_i=="RE":
    c_3=c_3+1
print("AC x "+str(c_0))
print("WA x "+str(c_1))
print("TLE x "+str(c_2))
print("RE x "+str(c_3))

Buggy python submission (verdict: Runtime Error):
N=int(input())
c_0=0
c_1=0
c_2=0
c_3=0
for i in range(N):
  s_i=input()
  if s_i=="AC":
    c_0=c_0+1
  elif s_i=="WA":
    c_1=c_1+1
  elif s_i=="TLE":
    c_2=c_2+1
  elif s_i=="RE":
    c_3=c_3+1
print("AC x "+c_0)
print("WA x "+c_1)
print("TLE x "+c_2)
print("RE x "+c_3)

Fixed submission:
N=int(input())
c_0=0
c_1=0
c_2=0
c_3=0
for i in range(N):
  s_i=input()
  if s_i=="AC":
    c_0=c_0+1
  elif s_i=="WA":
    c_1=c_1+1
  elif s_i=="TLE":
    c_2=c_2+1
  elif s_i=="RE":
    c_3=c_3+1
print("AC x "+str(c_0))
print("WA x "+str(c_1))
print("TLE x "+str(c_2))
print("RE x "+str(c_3))
Buggy python submission (verdict: Runtime Error):
s = input()
from collections import Counter
c = Counters(s)

bl = True;
for v in c.values():
  if v%2==1:
    bl = False

ans = 'Yes' if bl else 'No'
print(ans)



Fixed submission:
s = input()
from collections import Counter
c = Counter(s)

bl = True;
for v in c.values():
  if v%2==1:
    bl = False

ans = 'Yes' if bl else 'No'
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = [input() for i in range(N)]
for v in ['AC', 'WA', 'TLE', 'RE']:
  print('{0} × {1}'.format(v, s.count(v)))

Fixed submission:
N = int(input())
s = [input() for i in range(N)]
for v in ['AC', 'WA', 'TLE', 'RE']:
  print('{0} x {1}'.format(v, s.count(v)))
Buggy python submission (verdict: Runtime Error):
a = int(input())
print(int(a+a^2+a3))

Fixed submission:
a = int(input())
print(int(a+a*a+a*a*a))
Buggy python submission (verdict: Runtime Error):
a = input()
print('A' a.isupper() else 'a')

Fixed submission:
a = input()
print('A' if a.isupper() else 'a')

Buggy python submission (verdict: Runtime Error):
b = int(input())
print('A' if b.islower() else 'a')

Fixed submission:
a = input()
print('A' if a.isupper() else 'a')
Buggy python submission (verdict: Runtime Error):
X = list(map(int, input().split()))
for i in range(len(X)):
  if X[i-1] = 0:
    print(i)

Fixed submission:
X = list(map(int, input().split()))
print(X.index(0)+1)
Buggy python submission (verdict: Runtime Error):
def main():
  N = int(input())
  A = list(map(int,input()))
  
  if 0 in A:
    print(0)
    return
  
  prod = 1
  for a in A:
    prod *= a
    if prod > 10**18:
      print(-1)
      return
    
    print(prod)

main()

Fixed submission:
def main ():
  N = int(input())
  A = list(map(int,input(). split ()))
  if 0 in A:
    print(0)
    return
  prod = 1
  for a in A:
    prod *= a
    if prod > 1000000000000000000:
      print(-1)
      return
  print(prod)
main ()
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = int(N[-1])
 
if a == 3:
  print('bon')
elif a == 0 or a == 1 or a == 6 or a == 8:
  print('pon')
else:
  print('hon')

Fixed submission:
N = int(input())
a = N%10
 
if a==3:
  print("bon")
elif a==0 or a==1 or a==6 or a==8:
  print("pon")
else:
  print("hon")

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = N[-1]

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

Fixed submission:
N = int(input())
a = N%10
 
if a==3:
  print("bon")
elif a==0 or a==1 or a==6 or a==8:
  print("pon")
else:
  print("hon")

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = N[-1]
 
if a == 2, 4, 5, 7, 9:
  print('hon')
elif a == 0, 1, 6, 8:
  print('pon')
else:
  print('bon')

Fixed submission:
N = int(input())
a = N%10
 
if a==3:
  print("bon")
elif a==0 or a==1 or a==6 or a==8:
  print("pon")
else:
  print("hon")

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = N[-1]

if a == 2, 4, 5, 7, 9:
  print('hon')
if a == 0, 1, 6, 8:
  print('pon')
else:
  print('bon')

Fixed submission:
N = int(input())
a = N%10
 
if a==3:
  print("bon")
elif a==0 or a==1 or a==6 or a==8:
  print("pon")
else:
  print("hon")
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 len(S) <= K:
  print(S)
else:
  print(S[:K] + '...')
Buggy python submission (verdict: Runtime Error):
S, T = map(input())

if S == T[:len(S)]:
  print('Yes')
else:
  print('No')

Fixed submission:
S = input()
T = input()

if S == T[:len(S)]:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
S,T = map(input().split())

if S == T[:len(S)]:
  print('Yes')
else:
  print('No')

Fixed submission:
S = input()
T = input()

if S == T[:len(S)]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
x,y=map(int,input().split())

def main():
    if 0<=(y/2 -x)<=x:
        if y==0 or x==0:
            return 'No'
        if (y/2 -x)%1==0:
            return('Yes')
        else:
            return('No')
    else:
        return('No')
print(main())



Fixed submission:
arr=list(map(int,input().split()))

for i in range(5):
    if arr[i]==0:
        print(i+1)

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

for i range(5):
  if arr[i]==0:
    print(i+1)

Fixed submission:
arr=list(map(int,input().split()))

for i in range(5):
    if arr[i]==0:
        print(i+1)
Buggy python submission (verdict: Runtime Error):
def main ():
    N = int(input())
    A = list(map(int,input(). split ()))
    if 0 in A:
        print(0)
        return
    prod = 1
    for a in A:
        prod *= a
        if prod > 1000000000000000000:
            print(-1)
            return
    print(prod)
main ()


Fixed submission:
A,B=map(int,input().split())
print(A*B)
Buggy python submission (verdict: Runtime Error):
K=int(input())
S=input()

def printt(S,K):
  if len(S)<=K:
    print(S)
  else:
    print(S[:k],'...')
      
printt(S,K)


Fixed submission:
N=int(input())

def ass(N):
  if N%10 in [2,4,5,7,9]:
    print('hon')
  elif N%10 in [0,1,6,8]:
    print('pon')
  else:
    print('bon')
   
ass(N)

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

def printt(S,K):
  if len(S)<=K:
    print(S)
  else:
    print(S[:K]+'...')
      
printt(S,K)


Fixed submission:
N=int(input())

def ass(N):
  if N%10 in [2,4,5,7,9]:
    print('hon')
  elif N%10 in [0,1,6,8]:
    print('pon')
  else:
    print('bon')
   
ass(N)

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

def printt(S,K):
  if len(S)<=K:
    print(S)
  else:
    print(S[:k]+'...')
      
printt(S,K)


Fixed submission:
N=int(input())

def ass(N):
  if N%10 in [2,4,5,7,9]:
    print('hon')
  elif N%10 in [0,1,6,8]:
    print('pon')
  else:
    print('bon')
   
ass(N)

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

def printt(S,K):
  if len(S)<=K:
    print(S)
  else:
    print(s[:k]+'...')
      
printt(S,K)


Fixed submission:
N=int(input())

def ass(N):
  if N%10 in [2,4,5,7,9]:
    print('hon')
  elif N%10 in [0,1,6,8]:
    print('pon')
  else:
    print('bon')
   
ass(N)

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

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


Fixed submission:
N=int(input())

def ass(N):
  if N%10 in [2,4,5,7,9]:
    print('hon')
  elif N%10 in [0,1,6,8]:
    print('pon')
  else:
    print('bon')
   
ass(N)

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

if N%10 in (2,4,5,7,9):
  print('hon')
elif N%10 in(0,1,6,8):
  print('pon')
else:
  ptint('bon)

Fixed submission:
N=int(input())

def ass(N):
  if N%10 in [2,4,5,7,9]:
    print('hon')
  elif N%10 in [0,1,6,8]:
    print('pon')
  else:
    print('bon')
   
ass(N)
Buggy python submission (verdict: Runtime Error):
K=int(input())
S=input()

def printt(S,K):
	if len(S)<=K:
      print(S)
    else:
      print(s[:k]+'...')
      
printt(S,K)

Fixed submission:
K=int(input())
S=input()
 
def printt(S,K):
  if len(S)<=K:
    print(S)
  else:
    print(S[:K]+'...')
      
printt(S,K)
Buggy python submission (verdict: Time Limit Exceeded):
#Breadth First Search

#for every node, print the last visited node before reaching itself
#starting from the source
from collections import deque

def bfs(graph,N,source):
    visited=[0]*N
    visited[source]=1
    q=deque([source])
    while len(q)>0:
        node=q.popleft()
        for i in graph[node]:
            if visited[i]==0:
                visited[i]=node+1
                q.append(i)
    return visited

n,m=map(int,input().split())
graph=[[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    graph[a].append(b)
    graph[b].append(a)
print('Yes')
for i in range(1,n):
    print(bfs(graph,n,0)[i])
    

    
        


Fixed submission:
#Breadth First Search

#for every node, print the last visited node before reaching itself
#starting from the source
from collections import deque

def bfs(graph,N,source):
    visited=[0]*N
    visited[source]=1
    q=deque([source])
    while len(q)>0:
        node=q.popleft()
        for i in graph[node]:
            if visited[i]==0:
                visited[i]=node+1
                q.append(i)
    return visited

n,m=map(int,input().split())
graph=[[] for i in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    graph[a].append(b)
    graph[b].append(a)
aw=bfs(graph,n,0)
print('Yes')
for i in range(1,n):
    print(aw[i])
Buggy python submission (verdict: Runtime Error):
abck=list(map(int,input().split()))
a=abck[0]
b=abck[1]
c=abck[2]
k=abck[3]

if a>=k:
    print(a)
elif a<k:
    if a+b>k:
        print(a)
    else:
        print(a-(k-a-b))

Fixed submission:
S=input()
T=input()

if S==T[0:len(T)-1]:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
abck=list(input().split())
a=abck[0]
b=abck[1]
c=abck[2]
k=abck[3]

if a>=k:
    print(a)
elif a<k:
    if a+b>k:
        print(a)
    else:
        print(a-(k-a-b))

Fixed submission:
abck=list(map(int,input().split()))
a=abck[0]
b=abck[1]
c=abck[2]
k=abck[3]

if a>=k:
    print(k)
elif a<k:
    if a+b>=k:
        print(a)
    else:
        print(a-(k-a-b))

Buggy python submission (verdict: Runtime Error):
abck=list(map(int,input().split()))
a=abck[0]
b=abck[1]
c=abck[2]
k=abck[3]

list=[]+[1]*a+[0]*b+[-1]*c
ans=0
for i in range(k):
    ans+=list[i]

print(ans)


Fixed submission:
abck=list(map(int,input().split()))
a=abck[0]
b=abck[1]
c=abck[2]
k=abck[3]

if a>=k:
    print(k)
elif a<k:
    if a+b>=k:
        print(a)
    else:
        print(a-(k-a-b))
Buggy python submission (verdict: Runtime Error):
k,n=map(int,input().split())
houses=list(map(int,input().split()))
houses.sort()
maxx=-float('INF')
for i in range(n-1):
    if houses[i+1]-houses[i]>maxx:
        maxx=houses[i+1]-houses[i]

maxx=max([maxx,k-(houses[-1]-houses[0])])
print(maxx)


Fixed submission:
s=input()

if s[2]==s[3]:
  if s[4]==s[5]:
    print("Yes")
  else:
    print('No')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
sa = sorted(A, reverse=True)
ans = 0

for i in range(1, N):
    ans += sa[i//2]

print(ans)


Fixed submission:
# AtCoder
N = int(input())
s = N % 1000
if s != 0:
    print(1000-s)
else:
    print(s)
Buggy python submission (verdict: Runtime Error):
S,W=int(input()),int(input())
if S <= W:
  print('unsafe')
else:
  print('safe')

Fixed submission:
# AtCoder
S, W = map(int, input().split())
if S <= W:
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Runtime Error):
#AtCoder

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

b = 'b'*A
r = 'r'*B

s = ''
while True:
    if len(s) >= N:
        break
    s += b
    s += r

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

Fixed submission:
#AtCoder

N, A, B = map(int, input().split())
q, mod = divmod(N,(A+B))
blue = (q*A)
blue += min(mod, A)

print(blue)
Buggy python submission (verdict: Runtime Error):
# AtCoder
from collections import defaultdict
N, M = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(M)]
ans = [0]*N

d = defaultdict(list)
for i in range(M):
    s = sc[i][0]
    c = sc[i][1]

    d[s].append(c)

for k, v in d.items():
    if list(set(v)) == v and len(v) >= 2:
        print(-1)
        exit()
    else:
        ans[k-1] = v[-1]

if (ans[0] == 0 and ans[1] == 0) or ans[0] == 0:
    print(-1)
    exit()

print(''.join(map(str, ans)))


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


def isValid(n):
    sn = str(n)
    if len(sn) != N:
        return False
    for s, c in sc:
        if sn[s-1] != str(c):
            return False
    return True


for i in range(1000):
    if isValid(i):
        print(i)
        exit()
print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = list(map(int, input().split()))

if len(H) <= K:
    print(0)
    exit()

for i in range(K):
    mn = max(H)
    H.remove(mn)

sm = sum(H)

print(sm)

Fixed submission:
N, K = map(int, input().split())
H = list(map(int, input().split()))

if len(H) <= K:
    print(0)
    exit()

sort_H = sorted(H)
for i in range(K):
    sort_H.pop(-1)

sm = sum(sort_H)

print(sm)
Buggy python submission (verdict: Runtime Error):
N = int(input())
table = [[0]*10 for _ in range(10)]

for i in range(1, N+1):
    s = str(i)
    e1 = int(s[0])
    e2 = int(s[1])
    table[e1][e2] += 1

res = 0
for i in range(1, 10):
    for j in range(1, 10):
        res += table[i][j]*table[j][i]
print(res)

Fixed submission:
N = int(input())
table = [[0]*10 for _ in range(10)]

for i in range(1, N+1):
    s = str(i)
    e1 = int(s[0])
    e2 = int(s[-1])
    table[e1][e2] += 1

res = 0
for i in range(1, 10):
    for j in range(1, 10):
        res += table[i][j]*table[j][i]
print(res)
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
A, B = map(int, input().split())

def lcm(x,y):
    return (x*y) // gcd(x,y)

ans = lcm(A, B)
print(ans)

Fixed submission:
import itertools
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

l = 0
r = 0

for i, j in enumerate(itertools.permutations(range(1,N+1)), start=1):
    if j == P and j == Q:
        l, r = i, i
    elif j == P:
        l = i
    elif j == Q:
        r = i
    else:
        pass

print(abs(l-r))

Buggy python submission (verdict: Runtime Error):
from fractions import gcd
A, B = map(int, input().split())

def lcm(x,y):
    return (x*y) // gcd(x,y)

ans = lcm(A, B)
print(ans)

Fixed submission:
import itertools
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))

l = 0
r = 0

for i, j in enumerate(itertools.permutations(range(1,N+1)), start=1):
    if j == P and j == Q:
        l, r = i, i
    elif j == P:
        l = i
    elif j == Q:
        r = i
    else:
        pass

print(abs(l-r))
Buggy python submission (verdict: Runtime Error):
import math
A, B = input().split()

def lcm(x,y):
    return (x*y) // math.gcd(x,y)

ans = lcm(int(A), int(B))
print(ans)

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

def lcm(x,y):
    return (x*y) // (fractions.gcd(x,y))

ans = lcm(A, B)
print(ans)

Buggy python submission (verdict: Runtime Error):
#AtCoder
import math
A, B = input().split()

def lcm(x,y):
    return (x*y) //math.gcd(x,y)

print(lcm(int(A), int(B)))

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

def lcm(x,y):
    return (x*y) // (fractions.gcd(x,y))

ans = lcm(A, B)
print(ans)
Buggy python submission (verdict: Runtime Error):
#AtCoder
from math import sqrt
N = int(input())
lst = [list(map(int, input().split())) for _ in range(N)]
res = 0
for i in range(N):
    for j in range(N):
        if i != j:
            res += sqrt((lst[i][0] - lst[j][0])**2 + (lst[i][1] - lst[j][1])**2) 
print(res/N)

Fixed submission:
#AtCoder
r = int(input())
ar = r*r
print(int(ar/1))
Buggy python submission (verdict: Time Limit Exceeded):
# AtCoder
N, K, Q = map(int, input().split())
solved = [int(input()) for i in range(Q)]
ilst = [int(K)] * N


def calc_minus(n):
    return n - 1


for i in solved:
    ilst[i-1] += 1
    ilst = list(map(calc_minus, ilst))


for i in ilst:
    if i >= 1:
        print("Yes")
    else:
        print("No")


Fixed submission:
N, K, Q = map(int, input().split())
ilst = [int(K-Q)] * N

for i in range(Q):
    inp = int(input())
    ilst[inp-1] += 1


for i in ilst:
    if i > 0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
lst = [int(input()) for _ in range(N)]


for j in range(len(lst)):
    if max(lst) != lst[j]:
        print(max(lst))
    else:
        print(sorted(lst)[-2])



Fixed submission:
N = int(input())
lst = [int(input()) for _ in range(N)]

mx = max(lst)
clst = sorted(lst)
mx2 = clst[-2]

for j in range(N):
    if mx != lst[j]:
        print(mx)
    else:
        print(mx2)
Buggy python submission (verdict: Runtime Error):
def gcd(x, y):  # ユークリッドの互除法
    if y == 0:
        return x
    else:
        return gcd(y, x % y)


def lcm(x, y):
    return x*y // (gcd(x, y))


def num(n, c, d):
    c = n // c
    d = n // d
    cd = n // (lcm(c, d))
    return n - c - d + cd


a, b, c, d = map(int, input().split())
print(int(num(b, c, d) - num(a-1, c, d)))

Fixed submission:
def gcd(a, b):
    if a < b:
        a, b = b, a
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a*b//(gcd(a, b))

def num(n, c, d):
    dc = n//c
    dd = n//d
    dcd = n//(lcm(c, d))
    return n-dc-dd+dcd

a, b, c, d = map(int, input().split())
print(num(b, c, d) - num(a-1, c, d))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
ks = [list(map(int, input().split())) for i in range(M)]
p = list(map(int, input().split()))

ans = 0

for bit in range(1 << N):
    flag = True
    for i in range(N):
        count = 0
        for v in ks[i]:
            if bit & (1<<(v-1)):
                cnt += 1
        if cnt %2 != p[i]:
            flag = False
    if flag:
        ans += 1

print(ans)

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

ans = 0

for i in range(2**N):
    light = 0
    for j in range(M):
        count = 0
        for k in range(1, ks[j][0]+1):
            if i & 2**(ks[j][k]-1) == 2**(ks[j][k]-1):
                count += 1
        if count % 2 == p[j]:
            light += 1
    if light == M:
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
# AtCoder
N, K = map(int, input().split())
V = list(map(int, input().split()))

ans = 0

for l in range(K+1):
    for r in range(K-l+1):
        if l+r > N:
            break
        d = K-l-r
        now = 0
        s = []
        for i in range(l+1):
            s.append(V[i])
            now += V[i]

        for i in range(N-r, N):
            s.append(V[i])
            now += V[i]

        s = sorted(s)
        for i in range(d-1):
            if i >= len(s):
                break
            if s[i] > 0:
                break
            now -= s[i]
        ans = max(ans, now)
print(ans)


Fixed submission:
# AtCoder
N, K = map(int, input().split())
V = list(map(int, input().split()))
ans = 0
for l in range(K+1):
    for r in range(K-l+1):
        if l+r > N:
            break
        d = K-(l+r)

        j = V[:l]+V[N-r:]
        j.sort()

        for i in range(d):
            if not j:
                break
            elif j[0] >= 0:
                break
            j.pop(0)

        ans = max(ans, sum(j))
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
ans = 1
for i in range(n):
    if h[i-1] < h[i]:
        if h[0] == max(h):
            break
        ans += 1

print(ans)

Fixed submission:
import sys
a,b=map(int,input().split())
ans = max(a,b)
if a == b:
    print(a+b)
    sys.exit()

print(ans+(ans-1))
Buggy python submission (verdict: Runtime Error):
# AtCoder

lst = [int(input()) for _ in range(5)]

n = len(lst)
diffs = []
for i in range(n):
    dif = 10 - int(str(lst[i])[-1])
    diffs.append(dif)

s = []
for i in diffs:
    if i == 10:
        continue
    s.append(i)
mx = max(s)
s.remove(mx)
print(sum(s)+sum(lst))


Fixed submission:
import math
l = [int(input()) for i in range(5)]
ans = 0
c = 0
for i in l:
    times = math.ceil(i/10)*10-i
    if times != 0:
        c = max(c, times)
    ans += math.ceil(i/10)*10
print(ans-c)
Buggy python submission (verdict: Runtime Error):
s = input()
a = 0
b = 0
for i in len(s):
    if i in 'ATGC':
        a += 1
    else:
        b = max(a, b)
        a = 0
print(max(a, b))

Fixed submission:
s = input()
a = 0
b = 0
for i in s:
    if i in 'ATGC':
        a += 1
    else:
        b = max(a, b)
        a = 0
print(max(a, b))

Buggy python submission (verdict: Runtime Error):
s = input()
a = 0
b = 0
for i in len(s):
    if i in 'ATGC':
        ans += 1
    else:
        b = max(a, b)
        a = 0
print(max(a, b))

Fixed submission:
s = input()
a = 0
b = 0
for i in s:
    if i in 'ATGC':
        a += 1
    else:
        b = max(a, b)
        a = 0
print(max(a, b))

Buggy python submission (verdict: Runtime Error):
s = input()
ans = 0
alst = []
for i in s:
    if i == 'A' or i == 'C' or i == 'G' or i == 'T':
        ans += 1
    else:
        alst.append(ans)
        ans = 0
        continue

print(max(alst))

Fixed submission:
s = input()
a = 0
b = 0
for i in s:
    if i in 'ATGC':
        a += 1
    else:
        b = max(a, b)
        a = 0
print(max(a, b))
Buggy python submission (verdict: Runtime Error):
import re
n, q = map(int, input().split())
st = input()
lst = []
for i in range(q):
    l, r = map(int, input().split())
    s = st[l-1:r]
    lst.append(s)
    
    # count = ac_str.count('AC')
    # ans.append(count)

for ac_str in lst:
    ss = 0
    for m in re.finditer('AC', ac_str):
        ss += 1
    print(ss)


Fixed submission:
from itertools import accumulate
n, q = map(int, input().split())
st = input()
lr = [list(map(int, input().split())) for i in range(q)]

lst = [0]*n
for i in range(n-1):
    if st[i] == "A" and st[i+1] == "C":
        lst[i+1] = 1
ans = list(accumulate(lst))
for i in lr:
    print(ans[i[1]-1]-ans[i[0]-1])

Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
st = input()
lst = []
for i in range(q):
    l, r = map(int, input().split())
    s = st[l-1:r]
    lst.append(s)
    
ans = []
for ac_str in lst:
    count = ac_str.count('AC')
    ans.append(count)


for i in ans:
    print(i)

Fixed submission:
from itertools import accumulate
n, q = map(int, input().split())
st = input()
lr = [list(map(int, input().split())) for i in range(q)]

lst = [0]*n
for i in range(n-1):
    if st[i] == "A" and st[i+1] == "C":
        lst[i+1] = 1
ans = list(accumulate(lst))
for i in lr:
    print(ans[i[1]-1]-ans[i[0]-1])