Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
if a = b & a = c:
    print("Yes")
else:
    print("No")

    

Fixed submission:
a, b, c = map(int, input().split())
if a == b & a == c:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
l=list(input())
count=0
while True:
    flag=True
    for i in range(len(l)-1):
        if l[i]!=l[i+1]:
            del l[i:i+2]
            flag=False
            count+=2
        if i>=len(l)-2:
            break
    if flag:
        break
print(count)


Fixed submission:
l=list(input())
o=0
z=0
for i in range(len(l)):
    if l[i]=="0":
        z+=1
    elif l[i]=="1":
        o+=1

if z > o:
    print(2*o)
else:
    print(2*z)

Buggy python submission (verdict: Time Limit Exceeded):
l=list(input())
count=0
while True:
    flag=True
    for i in range(len(l)-1):
        if l[i]!=l[i+1]:
            l.pop(i)
            l.pop(i)
            flag=False
            count+=2
        if i>=len(l)-2:
            break
    if flag:
        break
print(count)


Fixed submission:
l=list(input())
o=0
z=0
for i in range(len(l)):
    if l[i]=="0":
        z+=1
    elif l[i]=="1":
        o+=1

if z > o:
    print(2*o)
else:
    print(2*z)

Buggy python submission (verdict: Time Limit Exceeded):
l=list(input())
count=0
while True:
    flag=True
    for i in range(len(l)-1):
        if l[i]!=l[i+1]:
            l.pop(i)
            l.pop(i)
            flag=False
            count+=2
            break
    if flag:
        break
print(count)


Fixed submission:
l=list(input())
o=0
z=0
for i in range(len(l)):
    if l[i]=="0":
        z+=1
    elif l[i]=="1":
        o+=1

if z > o:
    print(2*o)
else:
    print(2*z)

Buggy python submission (verdict: Time Limit Exceeded):
l=list(input())
count=0
while True:
    flag=True
    for i in range(len(l)-1):
        if l[i]!=l[i+1]:
            l.pop(i)
            l.pop(i)
            flag=False
            count+=2
            break
    if flag:
        print(count)
        break


Fixed submission:
l=list(input())
o=0
z=0
for i in range(len(l)):
    if l[i]=="0":
        z+=1
    elif l[i]=="1":
        o+=1

if z > o:
    print(2*o)
else:
    print(2*z)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
l,r = 1,N
for i in range(m):
  L,R = map(int,input().split())
  L = max(l,L)
  R = min(r,R)
print(max(0,L-R+1))

Fixed submission:
n,m = map(int,input().split())
l,r = 1,n
for i in range(m):
  L,R = map(int,input().split())
  l = max(l,L)
  r = min(r,R)
print(max(0,r-l+1))
Buggy python submission (verdict: Runtime Error):
A,B = input().split()
a,b = input().split()
print(A*B-a*B-b*A+a*b)

Fixed submission:
A,B = input().split()
a,b = input().split()
A = int(A)
B = int(B)
a = int(a)
b = int(b)
print(A*B-a*B-b*A+a*b)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
a = []
b = []
ans = 0
for i in range(n):
  aa, bb = map(int,input().split())
  a.append(aa)
  b.append(bb)
ans = 0
mini = 10000000000
while(1):
  for i in range(n):
    if a[i] < mini:
      mini = a[i]
      index = i
  ans = ans + a[index]*min(m,b[index])
  m = m - min(m,b[index])
  if m == 0:
    break
  a.pop(index)
  b.pop(index)
  n = n - 1
  mini = 10000000000
  
print(ans)

Fixed submission:
n,m = map(int,input().split())
a = []
b = []
raw = []
ans = 0
for i in range(n):
  raw.append(list(map(int,input().split())))
raw.sort(key=lambda x:x[0])
for i in range(n):
  ans = ans + raw[i][0] * min(raw[i][1],m)
  m = m - min(raw[i][1],m)
  if m == 0:
    break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
slen = len(s)
while(1):
  sub = s
  s = s.replace("01","")
  s = s.replace("10","")
  if sub == s:
    break
print(slen-len(s))

Fixed submission:
s = input()
print(2*min(s.count("0"),s.count("1")))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
slen = len(s)
ans = 0

for i in range(len(s)):
  sub = s
  s = s.replace("01",'')
  s = s.replace("10",'')
  if sub == s:
    break
  
print(slen-len(s))



Fixed submission:
s = input()
print(2*min(s.count("0"),s.count("1")))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
slen = len(s)
ans = 0

for i in range(len(s)):
  sub = s
  s = s.replace("01",'').strip()
  s = s.replace("10",'').strip()
  if sub == s:
    break
  

print(slen-len(s))



Fixed submission:
s = input()
print(2*min(s.count("0"),s.count("1")))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
slen = len(s)
ans = 0

while(1):
  sub = s
  s = s.replace("01",'').strip()
  s = s.replace("10",'').strip()
  if sub == s:
    break
  

print(slen-len(s))



Fixed submission:
s = input()
print(2*min(s.count("0"),s.count("1")))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
slen = len(s)
ans = 0

while(1):
  s = s.replace("01",'').strip()
  s = s.replace("10",'').strip()
  if not("01" in s or "10" in s):
    break
  

print(slen-len(s))



Fixed submission:
s = input()
print(2*min(s.count("0"),s.count("1")))
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(input())

S[K - 1] = S[K - 1].lower()

print(''.json(S))

Fixed submission:
N, K = map(int, input().split())
S = list(input())
 
S[K - 1] = S[K - 1].lower()
 
print(''.join(S))

Buggy python submission (verdict: Runtime Error):
# 文字列のリストとして受け取りので、高階関数mapでint関数を各要素に適用
N, K = map(int, input().split())
# 入力される文字列を、文字のリストに変換する
S = list(input())

S[K - 1] = S[K - 1].lower()

print(''.json(S))

Fixed submission:
N, K = map(int, input().split())
S = list(input())
 
S[K - 1] = S[K - 1].lower()
 
print(''.join(S))
Buggy python submission (verdict: Runtime Error):
n = int(input())
strs=[]
ind_a=[]
ind_b=[]
ind_both=[]
num=0
for i in range(n):
   str=input()
   num=num+str.count("AB")
   if str[len(str)-1]=="A":
       if str[0]=="B":
           ind_both.append(i)
       else:
           ind_a.append(i)
   elif str[0]=="B":
       ind_b.append(i)
big=0
small=0
both=len(ind_both)
if len(ind_a) > len(ind_b):
    big=len(ind_a)
    small=len(ind_b)
else:
    big=len(ind_b)
    small=len(ind_a)
if (big-small)>=both:
    num=num+small+both
else:
    both=both-(big-small)+1
    num=num+big+int(both/2)
print(num)
   





Fixed submission:
import math

n,k = (int(i) for i in input().split()) 
print(n-k+1)
Buggy python submission (verdict: Runtime Error):
N, Q = (int(i) for i in input().split())  
s = input()
s="!"+s+"?"
spells = [input().split() for _ in range(Q)]
 
masu=[1]*(N+2)
for spell in spells:
   t=spell[0]
   d=spell[1]
   indexes = [i for i, x in enumerate(s) if x == t]
   if d=="R":
      for index in indexes:
         index=index+1
         masu[index]+=masu[index-1]
         masu[index-1]=0
   else:
      for index in indexes:
         masu[index]+=masu[index+1]
         masu[index+1]=0
 
masu.pop(0)
masu.pop(N)
print(sum(masu)-1)

Fixed submission:
a, b, c = (int(i) for i in input().split())  
if a==b and b==c and a==c:
   print('Yes')
else:
   print('No')

Buggy python submission (verdict: Runtime Error):
N, Q = (int(i) for i in input().split())  
s = input()
s="!"+s+"?"
spells = [input().split() for _ in range(Q)]
 
masu=[1]*(N+2)
for spell in spells:
   t=spell[0]
   d=spell[1]
   indexes = [i for i, x in enumerate(s) if x == t]
   if d=="R":
      for index in indexes:
         index=index+1
         masu[index]+=masu[index-1]
         masu[index-1]=0
   else:
      for index in indexes:
         masu[index]+=masu[index+1]
         masu[index+1]=0
 
masu.pop(0)
masu.pop(N)
print(sum(masu)+1)

Fixed submission:
a, b, c = (int(i) for i in input().split())  
if a==b and b==c and a==c:
   print('Yes')
else:
   print('No')
Buggy python submission (verdict: Runtime Error):
N=int(input())
hats=input()
 
red=0
for hat in hats:
   if hat=="R":
      red++
 
if red>N-red:
   print("Yes")
else:
   print("No")

Fixed submission:
N=int(input())
hats=input()
 
red=0
for hat in hats:
   if hat=="R":
      red=red+1
 
if red>N-red:
   print("Yes")
else:
   print("No")

Buggy python submission (verdict: Runtime Error):
N=int(input())
hats=input()
 
red=0
for hat in range(len(hats)):
   if hat=="R":
      red++
 
if red>N-red:
   print("Yes")
else:
   print("No")

Fixed submission:
N=int(input())
hats=input()
 
red=0
for hat in hats:
   if hat=="R":
      red=red+1
 
if red>N-red:
   print("Yes")
else:
   print("No")

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

red=0
for hat in hats:
   if hat=="R":
      red++

if red>N-red:
   print("Yes")
else:
   print("No")

Fixed submission:
N=int(input())
hats=input()
 
red=0
for hat in hats:
   if hat=="R":
      red=red+1
 
if red>N-red:
   print("Yes")
else:
   print("No")
Buggy python submission (verdict: Runtime Error):

n = input()
list = []

for i in range(n):
    print("str: ")
    s,p = input().split()
    
    #s, p = sp[0], int(sp[1])
    list.append([i+1, s, p])
"""
list.append([1, "test2", 3])
list.append([2, "test3", 1])
list.append([3, "test1", 5])
list.append([4, "test1", 4])
"""

list.sort(key=lambda x:(x[1],x[2]))
for l in list:
    print(l[0])


Fixed submission:

n = int(input())
list = []

for i in range(n):
    sp = input().split()
    s = str(sp[0])
    p = int(sp[1])
    list.append([i+1, s, p])

list.sort(key=lambda x:(x[1],-x[2]))
for l in list:
    print(l[0])

Buggy python submission (verdict: Runtime Error):

n = input()
list = []

for i in range(n):
    print("str: ")
    sp = input().split()
    s = str(sp[0])
    p = int(sp[1])

    #s, p = sp[0], int(sp[1])
    list.append([i+1, s, p])
"""
list.append([1, "test2", 3])
list.append([2, "test3", 1])
list.append([3, "test1", 5])
list.append([4, "test1", 4])
"""

list.sort(key=lambda x:(x[1],x[2]))
for l in list:
    print(l[0])


Fixed submission:

n = int(input())
list = []

for i in range(n):
    sp = input().split()
    s = str(sp[0])
    p = int(sp[1])
    list.append([i+1, s, p])

list.sort(key=lambda x:(x[1],-x[2]))
for l in list:
    print(l[0])

Buggy python submission (verdict: Runtime Error):

n = input()
list = []

for i in range(n):
    s, p = map(input().split())
    #s, p = sp[0], int(sp[1])
    list.append([i+1, s, p])

list.sort(key=lambda x:(x[0],x[1]))
for l in list:
    print(l[0])


Fixed submission:

n = int(input())
list = []

for i in range(n):
    sp = input().split()
    s = str(sp[0])
    p = int(sp[1])
    list.append([i+1, s, p])

list.sort(key=lambda x:(x[1],-x[2]))
for l in list:
    print(l[0])

Buggy python submission (verdict: Runtime Error):

n = input()
list = []

for i in range(n):
    s, p = input().split()
    #s, p = sp[0], int(sp[1])
    list.append([i+1, s, p])

list.sort(key=lambda x:(x[0],x[1]))
for l in list:
    print(l[0])


Fixed submission:

n = int(input())
list = []

for i in range(n):
    sp = input().split()
    s = str(sp[0])
    p = int(sp[1])
    list.append([i+1, s, p])

list.sort(key=lambda x:(x[1],-x[2]))
for l in list:
    print(l[0])

Buggy python submission (verdict: Runtime Error):

n = input()
list = []

for i in range(n):
    s, p = input().split()
    #s, p = sp[0], int(sp[1])
    list.append(i+1, s, p)

list.sort(key=lambda x:(x[0],x[1]))
for l in list:
    print(l[0])


Fixed submission:

n = int(input())
list = []

for i in range(n):
    sp = input().split()
    s = str(sp[0])
    p = int(sp[1])
    list.append([i+1, s, p])

list.sort(key=lambda x:(x[1],-x[2]))
for l in list:
    print(l[0])

Buggy python submission (verdict: Runtime Error):

n = input()
list = []

for i in range(n):
    sp = input().split()
    s, p = sp[0], int(sp[1])
    list.append(i+1, s, p)

list.sort(key=lambda x:(x[0],x[1]))
for l in list:
    print(l[0])


Fixed submission:

n = int(input())
list = []

for i in range(n):
    sp = input().split()
    s = str(sp[0])
    p = int(sp[1])
    list.append([i+1, s, p])

list.sort(key=lambda x:(x[1],-x[2]))
for l in list:
    print(l[0])
Buggy python submission (verdict: Runtime Error):

n, k = input().split()
#k = input()
s = input()

word = s[k-1].lower()

b = s[:k-1]

a = s[k:]

new_s = b + word + a

print(new_s)


Fixed submission:

n, k = map(int, input().split())
#k = input()
s = input()

word = s[k-1].lower()

b = s[:k-1]

a = s[k:]

new_s = b + word + a

print(new_s)

Buggy python submission (verdict: Runtime Error):

n = input()
k = input()
s = input()

word = s[k-1].lower()

b = s[:k-1]

a = s[k:]

new_s = b + word + a

print(new_s)


Fixed submission:

n, k = map(int, input().split())
#k = input()
s = input()

word = s[k-1].lower()

b = s[:k-1]

a = s[k:]

new_s = b + word + a

print(new_s)

Buggy python submission (verdict: Runtime Error):

n = input()
k = input()
s = input()

word = s[k-1].lower()

b = s[:k-1]

a = s[k:]

new_s = b + word + a

print(new_s)

Fixed submission:

n, k = map(int, input().split())
#k = input()
s = input()

word = s[k-1].lower()

b = s[:k-1]

a = s[k:]

new_s = b + word + a

print(new_s)
Buggy python submission (verdict: Runtime Error):
N,M - map(int, input())
gate_l = [[int(x) for x in input().split()] for _ in range(M)]

min_card = max(l[0] for l in gate_l)
max_card = min(l[1] for l in gate_l)

if max_card > min_card:
    print(max_card - min_card +1)
    
else:
    print(0)

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

min_card = max(l[0] for l in gate_l)
max_card = min(l[1] for l in gate_l)

if max_card >= min_card:
    print(max_card - min_card +1)
    
else:
    print(0)

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

min_card = max(l[0] for l in gate_l)
max_card = min(l[1] for l in gate_l)

print(max_card - min_card +1)

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

min_card = max(l[0] for l in gate_l)
max_card = min(l[1] for l in gate_l)

if max_card >= min_card:
    print(max_card - min_card +1)
    
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
a,b,c= map(str, input().split())
print("{}{}{}".format(a,b,c).count("1"))

Fixed submission:
s = str(input().split())
print(s.count("1"))
Buggy python submission (verdict: Runtime Error):
A,B = list(input())
if int(A) < 6:
  out = 0
elif int(A) > 12:
  out = int(B)
else:
  out = int(B) // 2
print(out)

Fixed submission:
A,B = input().split()
if int(A) < 6:
  out = 0
elif int(A) > 12:
  out = int(B)
else:
  out = int(B) // 2
print(out)
Buggy python submission (verdict: Runtime Error):
n,m= input().split()
n = int(n)
m = int(m)
g=[input().split() for i in range(m)]

for i in int(m):
  av =[0,0]
  av[0] = max(int(g[i][0]),av[0])
  av[1] = min(int(g[i][1]),av[1])
print(av[1] -av[0]+1)

Fixed submission:
n,m= input().split()
n = int(n)
m = int(m)
g=[input().split() for i in range(m)]
av =[-1,1000000]
for i in range(m):
  av[0] = max(int(g[i][0]),av[0])
  av[1] = min(int(g[i][1]),av[1])
print(max(av[1] -av[0]+1,0))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
out = 0
for i in range(len(a)):
  if i > 0 :
  	for j in range(i):
  		if not (a[j] <= a[i]):
      		break
  out += 1
print(out)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
out = 0
for i in range(len(a)):
  flg = 1
  if i > 0 :
    for j in range(i):
      if not (a[j] <= a[i]):
        flg = 0
  if flg == 1:
    out += 1
print(out)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
out = 0
for i in range(len(a)):
  if i > 0 :
  	for j in range(i):
  		if not (a[j] <= a[i]):
      		continue
  out += 1
print(out)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
out = 0
for i in range(len(a)):
  flg = 1
  if i > 0 :
    for j in range(i):
      if not (a[j] <= a[i]):
        flg = 0
  if flg == 1:
    out += 1
print(out)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
out = 0
for i in range(len(a)):
  if i > 0 :
  	for j in range(i):
  		if not (a[j] =< a[i]):
      		continue
  out += 1
print(out)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
out = 0
for i in range(len(a)):
  flg = 1
  if i > 0 :
    for j in range(i):
      if not (a[j] <= a[i]):
        flg = 0
  if flg == 1:
    out += 1
print(out)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
out = 0
for i in range(len(a)):
  if max([i for i, x in enumerate(l_dup) if x == max(a[:i+1])]) == i:
    out += 1
print(out)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
out = 0
for i in range(len(a)):
  flg = 1
  if i > 0 :
    for j in range(i):
      if not (a[j] <= a[i]):
        flg = 0
  if flg == 1:
    out += 1
print(out)
Buggy python submission (verdict: Runtime Error):
s = input()
cha = list(s)
answer = []
for hoge in int_cha:
  if hoge == '1':
    answer.append('9')
  else:
    answer.append('1')
print(''.join(answer))

Fixed submission:
s = input()
cha = list(s)
answer = []
for hoge in cha:
  if hoge == '1':
    answer.append('9')
  else:
    answer.append('1')
print(''.join(answer))

Buggy python submission (verdict: Runtime Error):
s = input()
cha = list()
answer = []
for hoge in int_cha:
  if hoge == '1':
    answer.append('9')
  else:
    answer.append('1')
print(''.join(answer))


Fixed submission:
s = input()
cha = list(s)
answer = []
for hoge in cha:
  if hoge == '1':
    answer.append('9')
  else:
    answer.append('1')
print(''.join(answer))
Buggy python submission (verdict: Time Limit Exceeded):
from io import StringIO
from collections import *
from functools import *
import sys


def main(inputs):
    # n = int(next(inputs))
    # n, k = map(int, next(inputs).split())
    # xs = list(map(int, next(inputs).split()))
    n, m = map(int, next(inputs).split())
    an = list(map(int, next(inputs).split()))[:n]
    an.sort()
    bc = [ list(map(int, next(inputs).split())) for _ in range(m) ]
    bc.sort(key=lambda bc: bc[1]) # sort by c
    ans = 0
    for b, c in bc:
        for i in range(b):
            if an[i] < c:
                an[i] = c
                pass
            pass
        an.sort()
        pass
    return sum(an)


def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass


Fixed submission:
from io import StringIO
from collections import *
from functools import *
import sys


def main(inputs):
    # n = int(next(inputs))
    # n, k = map(int, next(inputs).split())
    # xs = list(map(int, next(inputs).split()))
    n, m = map(int, next(inputs).split())
    an = list(map(int, next(inputs).split()))[:n]
    an.sort()
    bc = [ list(map(int, next(inputs).split())) for _ in range(m) ]
    bc.sort(key=lambda bc: bc[1], reverse=True) # sort by c
    
    x = 0
    y = 0
    ans = 0
    for i in range(n):
        if x < m and bc[x][1] >= an[i]:
            ans += bc[x][1]
            y += 1
            if y >= bc[x][0]:
                x += 1
                y = 0
                pass
            pass
        else:
            ans += an[i]
            pass
        pass
    return ans

def gen_inputs(str_=None):
    inputs = StringIO(str_) if str_ else sys.stdin
    while True:
        a = inputs.readline().rstrip()
        yield a
        pass
    pass


if __name__ == "__main__":
    print(main(gen_inputs()))
    pass
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()

print(s[:k-1] + lower(s[k-1]) + s[k:])

Fixed submission:
n, k = map(int, input().split())
s = input()
print(s[:k-1] + s[k-1].lower() + s[k:])
Buggy python submission (verdict: Runtime Error):
N = int(input())
Vs = map(int, input().split())
Cs = map(int, input().split())

print(sum([ v - c for zip(Vs, Cs) if v >= c ]))


Fixed submission:
N = int(input())
Vs = map(int, input().split())
Cs = map(int, input().split())

print(sum([ v - c for v, c in zip(Vs, Cs) if v >= c ]))
Buggy python submission (verdict: Runtime Error):
from functools import *
from itertools import *

N = int(input())
As = list(map(int, input().split()))

def gcd(a, b):
    a , b = (a, b) if a > b else (b, a)
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
        pass
    return b

Bs = sorted(As)
x = gcd(Bs[0], Bs[1])
y = gcd(Bs[1], Bs[2])
z = gcd(Bs[2], Bs[0])
w = max(x, y, z)
print(reduce(gcd, chain([w], islice(Bs, 3, None))))



Fixed submission:
import sys
from collections import deque
from functools import *
from itertools import *

N = int(input())
As = list(map(int, input().split()))

def gcd(a, b):
    if a == 0 or b == 0:
        return max(a, b)
    a , b = (a, b) if a > b else (b, a)
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
        pass
    return b

def gcd_acc(acc, x):
    if len(acc) == 0:
        acc.append(x)
        return acc
    last = acc[-1]
    acc.append(gcd(last, x))
    return acc

def candidates(As):
    length = len(As)
    L = iter(reduce(gcd_acc, As, deque()))
    R = reversed(reduce(gcd_acc, reversed(As), deque()))
    next(R)

    yield next(R)

    if length == 1:
        return

    for _ in range(length-2):
        yield gcd(next(L), next(R))
        pass
    yield next(L)
    pass

print(max(candidates(As)))

Buggy python submission (verdict: Time Limit Exceeded):
from functools import lru_cache, reduce

N = int(input())
As = list(map(int, input().split()))

@lru_cache(maxsize=100000)
def gcd(a, b):
    a , b = (a, b) if a > b else (b, a)
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
        pass
    return b

ans = max([ reduce(gcd, ( As[j] for j in range(N) if j != i )) for i in range(N) ])
print(ans)



Fixed submission:
import sys
from collections import deque
from functools import *
from itertools import *

N = int(input())
As = list(map(int, input().split()))

def gcd(a, b):
    if a == 0 or b == 0:
        return max(a, b)
    a , b = (a, b) if a > b else (b, a)
    r = a % b
    while r != 0:
        a = b
        b = r
        r = a % b
        pass
    return b

def gcd_acc(acc, x):
    if len(acc) == 0:
        acc.append(x)
        return acc
    last = acc[-1]
    acc.append(gcd(last, x))
    return acc

def candidates(As):
    length = len(As)
    L = iter(reduce(gcd_acc, As, deque()))
    R = reversed(reduce(gcd_acc, reversed(As), deque()))
    next(R)

    yield next(R)

    if length == 1:
        return

    for _ in range(length-2):
        yield gcd(next(L), next(R))
        pass
    yield next(L)
    pass

print(max(candidates(As)))
Buggy python submission (verdict: Runtime Error):
A, b = map(int, input().split())

print(max([
    A+B,
    A+A-1,
    B+B-1,
]))


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

print(max([
    A+B,
    A+A-1,
    B+B-1,
]))
Buggy python submission (verdict: Runtime Error):
c=int(input())
a=list(map(int,input().split()))
b=0
count=0
for i in a:
    if a[i]>=b:
        count=count+1
        b=a[i]
print(count)

Fixed submission:
c=int(input())
a=list(map(int,input().split()))
b=0
count=0
for i in range(0,c):
    if a[i]>=b:
        count=count+1
        b=a[i]
print(count)

Buggy python submission (verdict: Runtime Error):
a=list(map(int,input().split()))
b=0
count=0
for i in range(1,a[0]+1):
    if a[i]>=b:
        count=count+1
        b=a[i]
print(count)

Fixed submission:
c=int(input())
a=list(map(int,input().split()))
b=0
count=0
for i in range(0,c):
    if a[i]>=b:
        count=count+1
        b=a[i]
print(count)
Buggy python submission (verdict: Runtime Error):
#ABC118-B

N,M = (int(x) for x in input().split())
food = [0]*M
count = 0
for i in range(N):
    a = list(map(int, input().split()))
    for j in range(1,a[0]+1):
        food[a[j]] = food[a[j]] + 1
for i in range(M):
    if food[i] == N:
        count = count + 1
print(count)

Fixed submission:
N,M = (int(x) for x in input().split())
a = [[int(x) for x in input().split()] for i in range(N)] 
food = [0]*(M+1)
count = 0
for i in range(N):
    for j in range(1,a[i][0]+1):
        food[a[i][j]] = food[a[i][j]] + 1
for i in range(M+1):
    if food[i] == N:
        count = count + 1
print(count)