Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys

def main():
    N = int(input())
    
    cnt = 0
    for i in range(1, N+1, 2):
        prime_l = []
        for j in range(1, i+1, 2):
            if i%j==0:
                prime_l.append()
        if len(prime_l)==8:
            cnt+=1
    print(cnt)
main()

Fixed submission:
import sys

def main():
    N = int(input())
    
    cnt = 0
    for i in range(1, N+1, 2):
        prime_l = []
        for j in range(1, i+1, 2):
            if i%j==0:
                prime_l.append(j)
        if len(prime_l)==8:
            cnt+=1
    print(cnt)
main()
Buggy python submission (verdict: Runtime Error):
def main():
    S = input()
    cnt = 0
    for i in range(4):
        if S[i]=='o':
            cnt += 1
    ans = 700 + cnt * 100
    print(ans)
main()

Fixed submission:
def main():
    S = input()
    cnt = 0
    for i in range(3):
        if S[i]=='o':
            cnt += 1
    ans = 700 + cnt * 100
    print(ans)
main()

Buggy python submission (verdict: Runtime Error):
def main():
    S = input()
    cnt = 0
    for i in range(4):
        if S[i]=='o':
            cnt += 1
    ans = 700 + cnt * 100
    print(ans)
main()

Fixed submission:
def main():
    S = input()
    cnt = 0
    for i in range(3):
        if S[i]=='o':
            cnt += 1
    ans = 700 + cnt * 100
    print(ans)
main()

Buggy python submission (verdict: Runtime Error):
def main():
    S = input()
    cnt = 0
    for i in range(4):
        if s[i]=='o':
            cnt += 1
    ans = 700 + cnt * 100
    print(ans)
main()

Fixed submission:
def main():
    S = input()
    cnt = 0
    for i in range(3):
        if S[i]=='o':
            cnt += 1
    ans = 700 + cnt * 100
    print(ans)
main()

Buggy python submission (verdict: Runtime Error):
def main():
    S = int(input())
    cnt = 0
    for i in range(4):
        if s[i]=='o':
            cnt += 1
    ans = 700 + cnt * 100
    print(ans)
main()

Fixed submission:
def main():
    S = input()
    cnt = 0
    for i in range(3):
        if S[i]=='o':
            cnt += 1
    ans = 700 + cnt * 100
    print(ans)
main()

Buggy python submission (verdict: Runtime Error):
def main():
    S = int(input())
    cnt = 0
    for i in range(3):
        if s[i]=='o':
            cnt += 1
    ans = 700 + cnt * 100
    print(ans)
main()

Fixed submission:
def main():
    S = input()
    cnt = 0
    for i in range(3):
        if S[i]=='o':
            cnt += 1
    ans = 700 + cnt * 100
    print(ans)
main()
Buggy python submission (verdict: Runtime Error):
import sys

def main():
    N = input()
    A = input()
    x = N % 500
    if x<=A:
        print('Yes')
    else:
        print('No')

main()

Fixed submission:
import sys

def main():
    N = int(input())
    A = int(input())
    x = N % 500
    if x<=A:
        print('Yes')
    else:
        print('No')

main()

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

def main():
    N = input()
    A = input()
    x = N % 500
    if x<=A:
        print('Yes')
    else:
        print('No')

main()

Fixed submission:
import sys

def main():
    N = int(input())
    A = int(input())
    x = N % 500
    if x<=A:
        print('Yes')
    else:
        print('No')

main()

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

def main():
    N = input()
    A = input()
    x = N % 500
    if x%A==0:
        print('Yes')
    else:
        print('No')

main()

Fixed submission:
import sys

def main():
    N = int(input())
    A = int(input())
    x = N % 500
    if x<=A:
        print('Yes')
    else:
        print('No')

main()
Buggy python submission (verdict: Runtime Error):
import sys

def main():
    r, g, b = map(int(), input().split())
    x = 10 * g + b
    if x%4==0:
        print('YES')
    else:
        print('NO')

main()

Fixed submission:
import sys

def main():
    r, g, b = map(int, input().split())
    x = 10 * g + b
    if x%4==0:
        print('YES')
    else:
        print('NO')

main()
Buggy python submission (verdict: Runtime Error):
import sympy

x,y = map(int,input().split())

t = sympy.Symbol('t')
c = sympy.Symbol('c')

a = sympy.solve([t + c - x,4*t + 2*c - y],[t, c])

if a[t]<0 or a[c]<0:
    print("No")

elif a[t]%1 == 0 and a[c]%1 == 0:
    print("Yes")

else:
    print("No")

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

for i in range(x+1):
    c = i
    t = abs(x-i)
    if 2*c + 4*t == y:
        print("Yes")
        break
    if i == x:
        print("No")
        break
Buggy python submission (verdict: Runtime Error):
x,n = map(int,input().split())
p = list(map(int,input().split()))
if n == 0:
    print(x)
else:
    y2 = 100

    for i in range(1,max(p)+1):
        if x == i:
            continue
        if (i in p) == True:
            continue
    
        y1 = abs(i-x)
        if y2 > y1:
            y2 = y1
            t = i
    print(t)

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

if n == 0:
    print(x)

else:
    i = 1
    while True:
        t = x-i
        s = x+i
        if x not in p:
            print(x)
            break
        if t not in p:
            print(t)
            break
        if s not in p:
            print(s)
            break
        i +=1
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
x = 1

for i in range(n):
    x = x*a[i]
    
if x > 10**18:
    print('-1')

else:
    print(x)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
x = 1

a = sorted(a)

if a[0]==0:
    print(0)

else:
    for i in range(n):
        x = x*a[i]
    
        if x > 10**18:
            print('-1')
            break
        if i == n-1:
            print(x)
            break

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

for i in range(len(a)):
    x = x*a[i]
    
if x > 10**18:
    print('-1')

else:
    print(x)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
x = 1

a = sorted(a)

if a[0]==0:
    print(0)

else:
    for i in range(n):
        x = x*a[i]
    
        if x > 10**18:
            print('-1')
            break
        if i == n-1:
            print(x)
            break
Buggy python submission (verdict: Runtime Error):
h1,m1,h2,m2,k = map(int,input().split())
if h1 < h2:
    x = (h2-h1)*60+(m1+m2)-k
elif h1 > h2:
    x = (24-(h1-h2))*60+(m1+m2)-k
print(x)

Fixed submission:
h1,m1,h2,m2,k = map(int,input().split())
x = (h2*60+m2-k)-(h1*60 + m1)
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
T = str(input())
PD = 0

for i in range(int(T.count('?'))+1):
    T1 = T.replace('?','D',i)
    T1 = T1.replace('?','P')
    PD1 = T1.count('D') + T1.count('PD')
    if PD1 > PD:
        T2 = T1

print(T2)

Fixed submission:
T = str(input())

T = T.replace('P?','PD')
T = T.replace('?','D')

print(T)
Buggy python submission (verdict: Runtime Error):
a=int(input())
b=int(input())

if int(a*b%2) != 0:
    print('Odd')
else:
    print('Even')

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

if a*b%2 == 0:
    print('Even')
else:
    print('Odd')

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

if int(a*b%2) == 0:
    print('Even')
else:
    print('Odd')

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

if a*b%2 == 0:
    print('Even')
else:
    print('Odd')

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

if a*b%2 == 0:
    print('Even')
else:
    print('Odd')

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

if a*b%2 == 0:
    print('Even')
else:
    print('Odd')

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

if a*b%2 == 0:
    print('Even')
else:
    print('Odd')

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

if a*b%2 == 0:
    print('Even')
else:
    print('Odd')
Buggy python submission (verdict: Runtime Error):
n, m =map(int,input().split())
s = list(map(int,input().split()))
ans = 0
s = s.sort()
for _ in range(m):
  ans += s[_]
print(ans)

Fixed submission:
n, m =map(int,input().split())
s = list(map(int,input().split()))
ans = 0
s.sort()
for _ in range(m):
  ans += s[_]
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(map(int,input().split()))
if 0 in s:
  print(0)
  exit()
for _ in range(n):
  ans *= s[_]
  if ans > 10**18:
    print(-1)
    exit()
else:
  print(ans)


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

Buggy python submission (verdict: Runtime Error):
a, b = map(int,input().split()) 
    ...: print(a * b)     

Fixed submission:
a, b = map(int,input().split()) 
print(a * b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(map(int,input().split()))
if 0 in s:
  print(0)
  exit()
for _ in range(n):
  ans *= s[_]
  if ans > 10**18:
    print(-1)
    exit()
else:
  print(ans)



Fixed submission:
n = int(input())
s = list(map(int,input().split()))
ans = 1
if 0 in s:
  print(0)
  exit()
for _ in range(n):
  ans *= s[_]
  if ans > 10**18:
    print(-1)
    exit()
else:
  print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(map(int,input().split()))
if 0 in s:
  print(0)
  exit()
for _ in range(n):
  ans *= s[_]
  if len(str((ans-1))) > 18:
    print(-1)
    exit()
else:
  print(ans)

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
ans = 1
if 0 in s:
  print(0)
  exit()
for _ in range(n):
  ans *= s[_]
  if ans > 10**18:
    print(-1)
    exit()
else:
  print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

n =int(input())
s = list(map(int,input().split()))
k = 1
for _ in range(n):
  k *= s[_]

if len(str(k-1)) < 19:
  print(k)
else :
  print("-1")

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
ans = 1
if 0 in s:
  print(0)
  exit()
for _ in range(n):
  ans *= s[_]
  if ans > 10**18:
    print(-1)
    exit()
else:
  print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a =list(map(int,input().split()))
s = 1
f = 0
if not a.count(0) == 0:
  print ("0")
  f += 1
if f == 0:
  for _ in range(n):
    s *= a[_]
  if len(str(s-1)) > 18:
    print("-1")
    f += 1
if f == 0:
  print(s)

Fixed submission:
n = int(input())
s = list(map(int,input().split()))
ans = 1
if 0 in s:
  print(0)
  exit()
for _ in range(n):
  ans *= s[_]
  if ans > 10**18:
    print(-1)
    exit()
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
n, m =map(double,input().split()) 

M = 10000*m
a = n * M
ans = float(a / 10000)
print(round(ans))

Fixed submission:
a, b = input().split()
a = int(a)
b = round(float(b) * 100)
print(a * b // 100)

Buggy python submission (verdict: Runtime Error):
n, m =map(double,input().split()) 

M = 10000*m
a = n * M
ans = float(a / 10000)
print(int(ans))

Fixed submission:
a, b = input().split()
a = int(a)
b = round(float(b) * 100)
print(a * b // 100)
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
\\print(t[:len(s)])
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: Time Limit Exceeded):
n, m =map(int,input().split())
s = list(map(int,input().split()))
a = []*m
b = []*m
ans = 0
for __ in range(m):
  _= list(map(int, input().split()))
  a.append(_)
  if s[_[0]-1] > s[_[1]-1]:
    b.append(_[0])
  elif s[_[0]-1] < s[_[1]-1]:
    b.append(_[1])
  else:
    b.append(0)
for i in range(n):
  count = 0
  for j in range(m):
    if i+1 in a[j]:
      count += 1
  if b.count(i+1) == count:
      ans += 1
print(ans)

Fixed submission:
n, m =map(int,input().split())
s = list(map(int,input().split()))
t = [0]*n #展望台が良いと0
for __ in range(m):
  a, b =map(int,input().split())
  if s[a-1] >= s[b-1]:
    t[b-1] += 1
  if s[a-1] <= s[b-1]:
    t[a-1] += 1
print(t.count(0))

Buggy python submission (verdict: Time Limit Exceeded):
ans = 0
n, m =map(int,input().split())
s = list(map(int,input().split()))
a = [list(map(int, input().split())) for _ in range(m)]
for i in range(1,n+1):
  l = []
  for _ in range(m):
    if i in a[_]:
      l += a[_]
      l.remove(i)
  for _ in range(len(l)):
    l[_] = s[l[_]-1]
  if not l:
    l.append(0)
  if s[i-1] > max(l):
    ans += 1
print(ans)

Fixed submission:
n, m =map(int,input().split())
s = list(map(int,input().split()))
t = [0]*n #展望台が良いと0
for __ in range(m):
  a, b =map(int,input().split())
  if s[a-1] >= s[b-1]:
    t[b-1] += 1
  if s[a-1] <= s[b-1]:
    t[a-1] += 1
print(t.count(0))
Buggy python submission (verdict: Runtime Error):
In [93]: s, w  = map(int,input().split()) 
    ...: if s <= w: 
    ...:     print("unsafe") 
    ...: else : 
    ...:     print("safe") 

Fixed submission:
s, w  = map(int,input().split())
if s <= w:
    print("unsafe")
else :
    print("safe")

Buggy python submission (verdict: Runtime Error):
In [93]: s, w  = map(int,input().split()) 
    ...: print("{} {}".format(s,w)) 
    ...: if s <= w: 
    ...:     print("unsafe") 
    ...: else : 
    ...:     print("safe") 

Fixed submission:
s, w  = map(int,input().split())
if s <= w:
    print("unsafe")
else :
    print("safe")
Buggy python submission (verdict: Runtime Error):
n =int(input())
s = list(map(int,input().split()))
l =[0]*n
for i in range(n-1) :
     l[s[i]-1] += 1
for _ in range(n):
     print(l[_])

Fixed submission:
import math 
r = int(input())
print (str(2 *r * math.pi))

Buggy python submission (verdict: Runtime Error):
n =int(input())
s = list(map(int,input().split()))
i = 1
l =[]
while i <= n:
     l.append(s.count(i))
     i += 1
[print(_) for _ in l]

Fixed submission:
import math 
r = int(input())
print (str(2 *r * math.pi))
Buggy python submission (verdict: Runtime Error):
n =int(input())
s = list(map(int,input().split()))
l =[0]*n
while i < n-2 :
     l[s[i]-1] += 1
     i += 1
for _ in range(n):
     print(l[_])

Fixed submission:
n =int(input())
s = list(map(int,input().split()))
l =[0]*n
i = 0
while i < n-1 :
     l[s[i]-1] += 1
     i += 1
for _ in range(n):
     print(l[_])

Buggy python submission (verdict: Runtime Error):
n, m =map(int,input().split())
s = list(map(int,input().split()))
a = [input() for __ in range(n)]

n =int(input())
s = list(map(int,input().split()))
l =[0]*n
print(l)
while i < n-2 :
     l[s[i]-1] += 1
     i += 1
for _ in range(n):
     print(l[_])

Fixed submission:
n =int(input())
s = list(map(int,input().split()))
l =[0]*n
i = 0
while i < n-1 :
     l[s[i]-1] += 1
     i += 1
for _ in range(n):
     print(l[_])

Buggy python submission (verdict: Time Limit Exceeded):
n =int(input())
s = list(map(int,input().split()))
i = 1
l =[]
while i <= n:
     l.append(s.count(i))
     i += 1
[print(_) for _ in l]

Fixed submission:
n =int(input())
s = list(map(int,input().split()))
l =[0]*n
i = 0
while i < n-1 :
     l[s[i]-1] += 1
     i += 1
for _ in range(n):
     print(l[_])

Buggy python submission (verdict: Time Limit Exceeded):
n =int(input())
s = list(map(int,input().split()))
i = 1
while i <= n:
     print(s.count(i))
     i += 1

Fixed submission:
n =int(input())
s = list(map(int,input().split()))
l =[0]*n
i = 0
while i < n-1 :
     l[s[i]-1] += 1
     i += 1
for _ in range(n):
     print(l[_])
Buggy python submission (verdict: Runtime Error):
a, b, c, x, y =map(int,input().split())
if a + b <= 2*c :
  print(a*x +b*y)
else:
  if x <= y :
    print(min(2*x*c+(y-x)*b,2*y*c)
  else :
    print(min(2*y*c+(x-y)*a,2*x*c)

Fixed submission:
a, b, c, x, y =map(int,input().split())
if a + b <= 2*c :
  print(a*x +b*y)
else:
  if x <= y :
    print(min(2*x*c+(y-x)*b,2*y*c))
  else :
    print(min(2*y*c+(x-y)*a,2*x*c))
Buggy python submission (verdict: Time Limit Exceeded):
def f(a,b):
  return max(len(str(a)),len(str(b)))

N = int(input())
n = N
ans = N

for _ in range(1,int(n/2)+1):
  if n % _ == 0:
#    print("{}: {} {}".format(f(_,N/_),_,int(N/_)))
    if ans >= f(_,int(N/_)):
      ans = f(_,int(N/_))
    else:
      break
print(ans)

Fixed submission:
import math
def f(a,b):
  return max(len(str(a)),len(str(b)))

N = int(input())
n = N
ans = N

for _ in range(1,int(math.sqrt(n))+1):
  if n % _ == 0:
#    print("{}: {} {}".format(f(_,N/_),_,int(N/_)))
    if ans >= f(_,int(N/_)):
      ans = f(_,int(N/_))
    else:
      break
print(ans)
Buggy python submission (verdict: Runtime Error):
A, B, K = input().split()

if int(A)==1 or int(B)==1:
    print(1)
else:
    div = [x for x in range(1, min(int(A),int(B))) if int(A)%x==0 and int(B)%x==0]
    print(div[-int(K)])

Fixed submission:
A, B, K = [int(x) for x in input().split()]

if A==1 or B==1:
    print(1)
else:
    div = [x for x in range(1, min(A,B)+1) if A%x==0 and B%x==0]
    print(div[-K])
Buggy python submission (verdict: Runtime Error):
x = int(input())
y = int(input())

print(int(x+y/2))


Fixed submission:
s = input().split()
x, y = int(s[0]), int(s[1])

print(int(x+y/2))
Buggy python submission (verdict: Time Limit Exceeded):
def turn(x):
    return 1 if x==0 else 0

input_data = input().split()
n = int(input_data[0])
m = int(input_data[1])

array = [[-1 for _ in range(m+2)] for _ in range(n+2)]

for i in range(1, n+1):
    for j in range(1, m+1):
        array[i][j] = 1

for i in range(1, n+1):
    for j in range(1, m+1):
        if array[i-1][j-1] != -1 : array[i-1][j-1] = turn(array[i-1][j-1])
        if array[i-1][j]   != -1 : array[i-1][j]   = turn(array[i-1][j])
        if array[i-1][j+1] != -1 : array[i-1][j+1] = turn(array[i-1][j+1])
        if array[i][j-1]   != -1 : array[i][j-1]   = turn(array[i][j-1])
        if array[i][j+1]   != -1 : array[i][j+1]   = turn(array[i][j+1])
        if array[i+1][j-1] != -1 : array[i+1][j-1] = turn(array[i+1][j-1])
        if array[i+1][j]   != -1 : array[i+1][j]   = turn(array[i+1][j])
        if array[i+1][j+1] != -1 : array[i+1][j+1] = turn(array[i+1][j+1])

count = 0

for i in range(1, n+1):
    for j in range(1, m+1):
        count += array[i][j]

print(count)

Fixed submission:
input_data = input().split()
n = int(input_data[0])
m = int(input_data[1])

if n == 1 or m == 1:
    if n == 1 and m != 1:
        print(m-2)
    elif m == 1 and n != 1:
        print(n-2)
    elif n == 1 and m==1:
        print(1)

if n>=2 and m>=2:
    print(n*m-(2*n+2*(m-2)))
Buggy python submission (verdict: Runtime Error):
import math

A, B, C, D = map(int, input().split())

A -= 1

Z = ((C * D) // math.gcd(C, D))

A_C = A // C
A_D = A // D
A_Z = A // Z

A_num = A - (A_C + A_D - A_Z)

B_C = B // C
B_D = B // D
B_Z = B // Z


B_num = B - (B_C + B_D - B_Z)


print(B_num - A_num)



Fixed submission:
import fractions

A, B, C, D = map(int, input().split())

A -= 1

Z = ((C * D) // fractions.gcd(C, D))

A_C = A // C
A_D = A // D
A_Z = A // Z

A_num = A - (A_C + A_D - A_Z)

B_C = B // C
B_D = B // D
B_Z = B // Z


B_num = B - (B_C + B_D - B_Z)


print(B_num - A_num)

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

A, B, C, D = map(int, input().split())

A -= 1

Z = (C * D // math.gcd(C, D))

A_C = A // C
A_D = A // D
A_Z = A // Z

A_num = A - (A_C + A_D - A_Z)

B_C = B // C
B_D = B // D
B_Z = B // Z


B_num = B - (B_C + B_D - B_Z)


print(B_num - A_num)



Fixed submission:
import fractions

A, B, C, D = map(int, input().split())

A -= 1

Z = ((C * D) // fractions.gcd(C, D))

A_C = A // C
A_D = A // D
A_Z = A // Z

A_num = A - (A_C + A_D - A_Z)

B_C = B // C
B_D = B // D
B_Z = B // Z


B_num = B - (B_C + B_D - B_Z)


print(B_num - A_num)
Buggy python submission (verdict: Runtime Error):
N, K = map(int,input().split())
a = list(map(int,input().split()))

total = 0
ans = 0
r = 0

for l in range(N):
    while total < K:

        if r >= N:
            break

        else:
            total += a[r]
            r += 1

    if total < K:
        break

    ans += N-r+1
    total -= a[l]

print(ans)

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

if X < A:
    print(0)
else:
    print(10)
Buggy python submission (verdict: Runtime Error):
N, X = map(int,input().split())
L = list(map(int,input().split()))

cnt = 0
total = 0
i = 0

while total <= X:
    cnt += 1
    total += L[i]
    i += 1

print(cnt)

Fixed submission:
N, X = map(int,input().split())
L = list(map(int,input().split()))

cnt = 0
total = 0

for i in range(N):
    if total <= X:
        cnt += 1
        total += L[i]
    else:
        break
else:
    if total <= X:
        cnt += 1


print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
def GCD(a, b):
    while a % b != 0:
        r = a % b
        a, b = b, r
    return b

ans = 0
N = int(input())
A = tuple(map(int,input().split()))
for S in range(len(A)):
    Af = 0
    for i in range(len(A)):
        if S != i:
            Af = GCD(Af,A[i])
    ans = max(ans,Af)

print(ans)


Fixed submission:
def GCD(a, b):
    if a == 0 and b == 0:
        return 0
    elif a == 0:
        return b
    elif b == 0:
        return a

    while a % b != 0:
        r = a % b
        a, b = b, r
    return b

ans = 0
N = int(input())
A = tuple(map(int,input().split()))

X = [0]*N
Y = [0]*N

for i in range(1,N):
    X[i] = GCD(X[i-1],A[i-1])
for i in range(N-1)[::-1]:
    Y[i] = GCD(Y[i+1],A[i+1])

for i in range(N):
    ans = max(ans,GCD(X[i],Y[i]))

print(ans)

Buggy python submission (verdict: Runtime Error):
def GCD(a, b):
    while a % b != 0:
        r = a % b
        a, b = b, r
    return b

ans = 0
N = int(input())
A = tuple(map(int,input().split()))
A2 = tuple(set(A))

if len(A2) <= 2:
    A2 = (A2[0],A2[0])

for i in range(N-1):
    for j in range(i+1,N):
        ans = max(ans,GCD(A2[i],A2[j]))

print(ans)

Fixed submission:
def GCD(a, b):
    if a == 0 and b == 0:
        return 0
    elif a == 0:
        return b
    elif b == 0:
        return a

    while a % b != 0:
        r = a % b
        a, b = b, r
    return b

ans = 0
N = int(input())
A = tuple(map(int,input().split()))

X = [0]*N
Y = [0]*N

for i in range(1,N):
    X[i] = GCD(X[i-1],A[i-1])
for i in range(N-1)[::-1]:
    Y[i] = GCD(Y[i+1],A[i+1])

for i in range(N):
    ans = max(ans,GCD(X[i],Y[i]))

print(ans)
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
s = tuple(input())

now = 1 # 今見ている数
cnt = 0 # nowがいくつ並んでいるか
nums =[]

for i in range(n):
    if s[i] == '0'+str(now):
        cnt += 1
    else:
        nums.append(cnt)
        now ^= 1    #見る値の切り替え
        cnt += 1

if cnt != 0:
    nums.append(cnt)

if len(nums) % 2 == 0:
    nums.append(0)

add = 2 * k + 1
ans = 0
left = 0
right = 0
r_l_sum = 0
for i in range(len(nums))[::2]:
    next_left = i
    next_right = min(i+add,len(nums))
    # 尺取法
    while next_left > left:
        tmp -= nums[left]
        left += 1
    while next_right > right:
        tmp += nums[right]
        right += 1
    ans = max(tmp,ans)

print(ans)

Fixed submission:
n,k = map(int,input().split())
s = tuple(input())

now = 1 # 今見ている数
cnt = 0 # nowがいくつ並んでいるか
nums =[]

for i in range(n):
    if s[i] == str(now):
        cnt += 1
    else:
        nums.append(cnt)
        now ^= 1    #見る値の切り替え
        cnt = 1

if cnt != 0:
    nums.append(cnt)

if len(nums) % 2 == 0:
    nums.append(0)

add = 2 * k + 1
ans = 0
left = 0
right = 0
tmp = 0

for i in range(len(nums))[::2]:
    next_left = i
    next_right = min(i+add, len(nums))
    # 尺取法
    while next_left > left:
        tmp -= nums[left]
        left += 1
    while next_right > right:
        tmp += nums[right]
        right += 1
    ans = max(tmp,ans)

print(ans)