Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
X = []
Y = []
for _ in range(N):
    x,y = map(int, input().split())
    X.append(x)
    Y.append(y)
X = np.array(X)
Y = np.array(Y)
X_ = X.reshape((N,1))
Y_ = Y.reshape((N,1))
Z = np.abs(X-X_)+np.abs(Y-Y_)
z = Z.reshape((1,-1))
print(np.max(z))

Fixed submission:
# ABC178D Manhattan
n = int(input())
z = []
w = []
for i in range(n):
    x,y = map(int, input().split())
    z.append(x-y)
    w.append(x+y)
    
z_ans = max(z)-min(z)
w_ans = max(w)-min(w)
print(max(z_ans,w_ans))

Buggy python submission (verdict: Runtime Error):
N = int(input())
X = []
Y = []
for _ in range(N):
    x,y = map(int, input().split())
    X.append(x)
    Y.append(y)
X = np.array(X)
Y = np.array(Y)
X_ = X.reshape((N,1))
Y_ = Y.reshape((N,1))
Z = np.abs(X-X_)+np.abs(Y-Y_)
z = Z.reshape((1,-1))
print(np.max(z))

Fixed submission:
# ABC178D Manhattan
n = int(input())
z = []
w = []
for i in range(n):
    x,y = map(int, input().split())
    z.append(x-y)
    w.append(x+y)
    
z_ans = max(z)-min(z)
w_ans = max(w)-min(w)
print(max(z_ans,w_ans))

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
xy = list()
for i in range(N):
    x,y = map(int,input().split())
    xy.append([x,y])
XY = np.array(xy)

dif = np.expand_dims(XY,axis=1) - np.expand_dims(XY,axis=0)
dis = np.sum(np.abs(dif), axis=-1).astype(np.int64)


idx = np.unravel_index(np.argmax(dis),dis.shape)
print(dis[idx])

Fixed submission:
# ABC178D Manhattan
n = int(input())
z = []
w = []
for i in range(n):
    x,y = map(int, input().split())
    z.append(x-y)
    w.append(x+y)
    
z_ans = max(z)-min(z)
w_ans = max(w)-min(w)
print(max(z_ans,w_ans))

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
xy = list()
for i in range(N):
    x,y = map(int,input().split())
    xy.append([x,y])
XY = np.array(xy)

dif = np.expand_dims(XY,axis=1) - np.expand_dims(XY,axis=0)
dis = np.sum(np.abs(dif), axis=-1)


idx = np.unravel_index(np.argmax(dis),dis.shape)
#print(dif)
#print(dis)
#print(idx)
print(dis[idx])

Fixed submission:
# ABC178D Manhattan
n = int(input())
z = []
w = []
for i in range(n):
    x,y = map(int, input().split())
    z.append(x-y)
    w.append(x+y)
    
z_ans = max(z)-min(z)
w_ans = max(w)-min(w)
print(max(z_ans,w_ans))

Buggy python submission (verdict: Runtime Error):
import numpy as np
N = int(input())
xy = list()
for i in range(N):
    x,y = map(int,input().split())
    xy.append([x,y])
XY = np.array(xy)

dif = np.expand_dims(XY,axis=1) - np.expand_dims(XY,axis=0)
dis = np.sum(dif, axis=-1)


idx = np.unravel_index(np.argmax(dis),dis.shape)
#print(dis)
#print(idx)
print(dis[idx])

Fixed submission:
# ABC178D Manhattan
n = int(input())
z = []
w = []
for i in range(n):
    x,y = map(int, input().split())
    z.append(x-y)
    w.append(x+y)
    
z_ans = max(z)-min(z)
w_ans = max(w)-min(w)
print(max(z_ans,w_ans))
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
F = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    F[a].append(b)
    F[b].append(a)
    
# 交友関係グループ（辞書型）
D = {}
# グループの親
parent = [-1] * N
# 訪問管理
visited = [False] * N

for root in range(N):
    if visited[root]:
        continue

    D[root] = set([root])
    # 訪問先のスタック
    stack = [root]
    # 訪問先が無くなるまで
    while stack:
        # 訪問者をポップアップ
        n = stack.pop()
        # 訪問者を訪問済み
        visited[n] = True
        # 訪問者のグループの親を設定
        parent[n] = root

        # root のフレンドをグループと訪問先に追加
        for to in F[n]:
            if visited[to]:
                continue
            D[root].add(to)
            stack.append(to)
print(max(map(len,D.values())))

Fixed submission:
N,M = map(int, input().split())
F = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a, b = a - 1, b - 1
    F[a].append(b)
    F[b].append(a)
    
# 交友関係グループ（辞書型）
D = {}
# グループの親
parent = [-1] * N
# 訪問管理
visited = [False] * N

for root in range(N):
    if visited[root]:
        continue

    D[root] = set([root])
    # 訪問先のスタック
    stack = [root]
    # 訪問先が無くなるまで
    while stack:
        # 訪問者をポップアップ
        n = stack.pop()
        # 訪問者を訪問済み
        visited[n] = True
        # 訪問者のグループの親を設定
        parent[n] = root

        # root のフレンドをグループと訪問先に追加
        for to in F[n]:
            if visited[to]:
                continue
            D[root].add(to)
            stack.append(to)
print(max(map(len,D.values())))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = 0
while N != 0:
    a += N%10
    N //= 10
if a % 9 == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
N = int(input())
if N % 9 == 0:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = 0
while N != 0:
    a += N%10
    N //= 10
if a % 9 == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
N = int(input())
if N % 9 == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
def main():
    N,M,K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    
    indb = M-1
    now = sum(B)
    count = M
    while now > K:
        now -= B[indb]
        count -= 1
        indb -= 1
    
    ans = count
    
    for a in A:
        count += 1
        now += a
        
        while now >K and indb >= 0:
            now -= B[indb]
            count -= 1
            indb -= 1
        
        if now <= K:
            if ans < count:
                ans = count
    print(ans)
    

if __name __ == "__main__":
    main()

Fixed submission:
from itertools import accumulate
from bisect import bisect_right

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

a = [0] + list(accumulate(A))
b = [0] + list(accumulate(B))

result = 0
for i in range(N + 1):
    if a[i] > K:
        break
    j = bisect_right(b, K - a[i])
    result = max(result, i + j - 1)
print(result)

Buggy python submission (verdict: Runtime Error):
N,M,K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
c = 0
while K >=0:
    c +=1
    if not A:
        K -= B.pop(0)
    elif not B:
        K -= A.pop(0)
    elif A[0] >=B[0]:
        K -= B.pop(0)
    else:
        K -= A.pop(0)
if K == 0:
    print(c)
else:
    print(c-1)

Fixed submission:
from itertools import accumulate
from bisect import bisect_right

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

a = [0] + list(accumulate(A))
b = [0] + list(accumulate(B))

result = 0
for i in range(N + 1):
    if a[i] > K:
        break
    j = bisect_right(b, K - a[i])
    result = max(result, i + j - 1)
print(result)
Buggy python submission (verdict: Time Limit Exceeded):
import time

N=int(input())

sieve= [0]*(N+1)
sieve[0]=-1
sieve[1]=-1
for i in range(2,N+1):
    if sieve[i] != 0:
        continue
    sieve[i] = i
    for j in range(i*i, N+1, i):
        if sieve[j] ==0:
            sieve[j] = i

def G(x):
    t=[]
    a = x
    while a!=1:
        if len(t) != 0 and t[-1][0] == sieve[a]:
            t[-1][1] += 1
        else:
            t.append([sieve[a],1])
        a //= sieve[a]
    result = 1
    for _,n  in t:
        result *= n+1
    return result

sum = 0
for i in range(1, N+1):
    sum += i*G(i)
print(sum)



Fixed submission:
N=int(input())

sieve= [0]*(N+1)
sieve[0]=-1
sieve[1]=-1
for i in range(2,N+1):
    if sieve[i] != 0:
        continue
    sieve[i] = i
    for j in range(i*i, N+1, i):
        if sieve[j] ==0:
            sieve[j] = i
            
def G(x):
    t=[]
    a = x
    while a!=1:
        if len(t) != 0 and t[-1][0] == sieve[a]:
            t[-1][1] += 1
        else:
            t.append([sieve[a],1])
        a //= sieve[a]
    result = 1
    for _,n  in t:
        result *= n+1
    return result

sum = 0
for i in range(1, N+1):
    sum += i*G(i)
print(sum)
Buggy python submission (verdict: Runtime Error):


def main():
    n, *i = map(int, open(0).read().split())
    a = i[:n]　　＃数列Aのリスト
    _ = i[n]　　　＃Qのこと
    s = sum(a)　　＃数列Aの総和

    m = [0] * (10 ** 5 + 1)　　＃Aは1<A<10^5なのでラベル用リストを作成
    for x in a:　　　　　　　　　＃Aの個数をラベル化。リストmは個数を記録している
        m[x] += 1

    ans = []
    for b, c in zip(*[iter(i[n + 1:])] * 2):
        m[c] += m[b]　　　　　　＃ｃの個数にbの個数を足し算
        s += (c - b) * m[b]　　＃s:数列Aの総和に、(c-b)×(bの個数)を足し算
        m[b] = 0　　　　　　　　　＃bの個数はゼロに
        ans.append(s)　　　　　　＃リストansにSの変化を記録していく

    print("\n".join(map(str, ans)))


if __name__ == '__main__':
    main()

Fixed submission:
import collections

N = int(input())
A = list(map(int, input().split()))
S = sum(A)
Q = int(input())
T = collections.Counter(A)
for i in range(Q):
    b, c = map(int, input().split())
    S += T[b]*(c-b)
    T[c] += T[b]
    T[b] = 0
    print(S)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(input().split())
Q = int(input())
for i in range(Q):
    b,c = input().split()
    A = list(map(lambda x:x.replace(b,c),A))
    B = A.copy()
    print(sum(map(int, B)))

Fixed submission:
import collections

N = int(input())
A = list(map(int, input().split()))
S = sum(A)
Q = int(input())
T = collections.Counter(A)
for i in range(Q):
    b, c = map(int, input().split())
    S += T[b]*(c-b)
    T[c] += T[b]
    T[b] = 0
    print(S)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = map(int, input().split())

answer = 1

for i in A:
    answer = answer * i
    if i == 0:
        print(0)
        break
else:
    if answer > 10**18:
        print(-1)
    else:
        print(answer)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
answer = 1

for i in A:
    answer = answer * i
    if i == 0:
        print(0)
        break
    if answer > 10 **18:
        print(-1)
        break
else:
        print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = map(int, input().split())
answer = 1
for i in A:
    answer *= i

if answer > 1e18:
    print(-1)
else:
    print(answer)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
answer = 1

for i in A:
    answer = answer * i
    if i == 0:
        print(0)
        break
    if answer > 10 **18:
        print(-1)
        break
else:
        print(answer)
Buggy python submission (verdict: Runtime Error):
A,B = input().split()

print(int(A)*round(float(b)*100)//100)

Fixed submission:
a, b = map(str, open(0).read().split())
print(int(a)*int(b[:-3]+b[-2:]) // 100)

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

print(int(int(A)*round(float(b)*100)//100))

Fixed submission:
a, b = map(str, open(0).read().split())
print(int(a)*int(b[:-3]+b[-2:]) // 100)

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

print(int(A)*round(float(b)*100)//100)

Fixed submission:
a, b = map(str, open(0).read().split())
print(int(a)*int(b[:-3]+b[-2:]) // 100)

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

print(int(A)*round(float(b)*100)//100)

Fixed submission:
a, b = map(str, open(0).read().split())
print(int(a)*int(b[:-3]+b[-2:]) // 100)
Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())

c = collections.Counter(prime_factorize(N))

ans = 0
for j in c:
    for i in range(1,c[j]+1):
        if c[j] == 1:
            ans += 1
        elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):
            ans += i

print(ans)

Fixed submission:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
import collections
N = int(input())

c = collections.Counter(prime_factorize(N))

ans = 0
for j in c:
    for i in range(1,c[j]+1):
        if c[j] == 1:
            ans += 1
        elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):
            ans += i

print(ans)

Buggy python submission (verdict: Runtime Error):
import collections
N = int(input())
c = collections.Counter(prime_factorize(N))

ans = 0
for j in c:
    for i in range(1,c[j]+1):
        if c[j] == 1:
            ans += 1
        elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):
            ans += i

print(ans)

Fixed submission:
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
  
import collections
N = int(input())

c = collections.Counter(prime_factorize(N))

ans = 0
for j in c:
    for i in range(1,c[j]+1):
        if c[j] == 1:
            ans += 1
        elif i*(i+1)<= 2*c[j] < (i+1)*(i+2):
            ans += i

print(ans)
Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np

N,M,X = map(int, input().split())
lista = [list(map(int,input().split())) for i in range(N)]

lista = np.array(lista)
judge = [X]*M
cost = 1200001
data = [a for a in range(1,N+1)] # [1,2,3,...,N]

for i in range(1,N+1):
  j = list(itertools.combinations(data, i))
  for k in j:
    result = np.array([0]*(M+1))
    for l in k:
      result = result + lista[l-1]
      if all(result[1:]>=judge):
        if reslut[0]<cost:
          cost = result[0]
          m = k
c = 0

try:
  for i in m:
    c +=lista[i-1][0]
    
  print(c)
  
except:
  print(-1)

Fixed submission:
import itertools
import numpy as np

N,M,X = map(int, input().split())
lista = [list(map(int,input().split())) for i in range(N)]

lista = np.array(lista)
judge = [X]*M
cost = 120000000000
data = [a for a in range(1,N+1)] # [1,2,3,...,N]

for i in range(1,N+1):
    j = list(itertools.combinations(data, i))
    for k in j:
        result = np.array([0]*(M+1))
        for l in k:
            result = result + lista[l-1]
        if all(result[1:]>=judge):
            if result[0]<cost:
                cost = result[0]
                m = k
c = 0

try:
    for i in m:
        c +=lista[i-1][0]
    
    print(c)
except:
    print(-1)

Buggy python submission (verdict: Runtime Error):
import itertools
import numpy as np

N,M,X = map(int, input().split())
lista = [list(map(int,input().split())) for i in range(N)]

lista = np.array(lista)
judge = [X]*M
cost = 1200001
data = [a for a in range(1,N+1)] # [1,2,3,...,N]

for i in range(1,N+1):
    j = list(itertools.combinations(data, i))
    for k in j:
        result = np.array([0]*(M+1))
        for l in k:
            result = result + lista[l-1]
        if all(result[1:]>=judge):
            if reslut[0]<cost:
                cost = result[0]
                m = k
c = 0

try:
    for i in m:
        c +=lista[i-1][0]
    
    print(c)
except:

Fixed submission:
import itertools
import numpy as np

N,M,X = map(int, input().split())
lista = [list(map(int,input().split())) for i in range(N)]

lista = np.array(lista)
judge = [X]*M
cost = 120000000000
data = [a for a in range(1,N+1)] # [1,2,3,...,N]

for i in range(1,N+1):
    j = list(itertools.combinations(data, i))
    for k in j:
        result = np.array([0]*(M+1))
        for l in k:
            result = result + lista[l-1]
        if all(result[1:]>=judge):
            if result[0]<cost:
                cost = result[0]
                m = k
c = 0

try:
    for i in m:
        c +=lista[i-1][0]
    
    print(c)
except:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
A = list(map(int, input().split()))
k = K.bit_length()
dv = [[0]*N for _ in range(k)]
dv[0] = [a-1 for a in A]
for turn in range(1,k):
    for town in range(N):
        dv[turn][town] = dv[turn-1][dv[turn-1][town]]

a = 0
for i in range(k):
    if (K>>i)&1:
        a = dv[i][a]
        
print(a+1)

Fixed submission:
N,K = map(int, input().split())
A = list(map(int, input().split()))
k = K.bit_length()
dv = [[0]*N for _ in range(k)]
dv[0] = [a-1 for a in A]
for turn in range(1,k):
    for town in range(N):
        dv[turn][town] = dv[turn-1][dv[turn-1][town]]

a = 0
for i in range(k):
    if (K>>i)&1:
        a = dv[i][a]
        
print(a+1)
Buggy python submission (verdict: Time Limit Exceeded):
import collections
N = int(input())
S = [input() for i in range(N)]
D = collections.Counter(S)
print(*[j[0] for j in sorted(D.items()) if j[1] == max(D.values())], sep="\n")

Fixed submission:
import collections
N = int(input())
D = collections.Counter(input() for i in range(N))
maximum = max(D.values())
sort = sorted(key for key,value in D.items() if value == maximum)
for s in sort:
    print(s)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
D = {}
for i in range(N):
    s = input()
    if s in D:
        D[s] += 1
    else:
        D[s] = 0
print(*[j[0] for j in sorted(D.items()) if j[1] == max(D.values())], sep="\n")

Fixed submission:
import collections
N = int(input())
D = collections.Counter(input() for i in range(N))
maximum = max(D.values())
sort = sorted(key for key,value in D.items() if value == maximum)
for s in sort:
    print(s)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
D = {}
for i in range(N):
    s = input()
    if s in D:
        D[s] += 1
    else:
        D[s] = 0
E = sorted(D.items())
G = [j[0] for j in E if j[1] == max(D.values())]
print(*G, sep="\n")

Fixed submission:
import collections
N = int(input())
D = collections.Counter(input() for i in range(N))
maximum = max(D.values())
sort = sorted(key for key,value in D.items() if value == maximum)
for s in sort:
    print(s)
Buggy python submission (verdict: Runtime Error):
N,K = map(int, input().split())
H = list(map(int, input().split()))

H.sort()
for i in range(1,K+1):
    H[-i] = 0
print(sum(H))

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

if N < K:
    print(0)
else:
    H.sort()
    for i in range(1,K+1):
        H[-i] = 0
    print(sum(H))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
P = list(map(int, input().split()))
ans = 1
for i in range(1, N):
    if P[i] == min(P[:i+1]):
        ans += 1
print(ans)

Fixed submission:
N = int(input())
P = list(map(int, input().split()))
Q = [P[0]]
for i in P[1:]:
    if i < Q[-1]:
        Q.append(i)
print(len(Q))
Buggy python submission (verdict: Runtime Error):
r = input()
ans = int(r)**2
return ans

Fixed submission:
r = int(input())
print(r**2)

Buggy python submission (verdict: Runtime Error):
ans = r**2
return int(ans)

Fixed submission:
r = int(input())
print(r**2)

Buggy python submission (verdict: Runtime Error):
return int(r**2)

Fixed submission:
r = int(input())
print(r**2)

Buggy python submission (verdict: Runtime Error):

return int(radius**2)
              




Fixed submission:
r = int(input())
print(r**2)
Buggy python submission (verdict: Runtime Error):

N = int(input())
b = n**0.5//1.0
while True:
    if N%b != 0:
        b -= 1
    else:
        break
print(int(b+N/b-2))

Fixed submission:

N = int(input())
b = N**0.5//1.0
while True:
    if N%b != 0:
        b -= 1
    else:
        break
print(int(b+N/b-2))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N = int(input())
b = np.sqrt(N)//1.0
while True:
    if N%b != 0:
        b -= 1
    else:
        break
print(int(b+N/b-2))

Fixed submission:

N = int(input())
b = N**0.5//1.0
while True:
    if N%b != 0:
        b -= 1
    else:
        break
print(int(b+N/b-2))
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N,M = map(int, input().split())
A = sorted(map(int, input().split()))
for i in range(M):
    bisect.insort(A, A.pop()//2)
print(sum(A))

Fixed submission:
import bisect
N,M = map(int, input().split())
A = sorted(map(int, input().split()))
for i in range(M):
    bisect.insort(A, A.pop()//2)
print(sum(A))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
C = []
for i in range(N):
    C.append("".join(sorted(input())))
B = set(C)
ans = 0
for j in B:
    t = C.count(j)
    if t > 1:
        ans += int(t*(t-1)/2 )
# 1->0, 2->1, 3->3, 4->6, 5->10 :: nC2
    
print(ans)

Fixed submission:
N=int(input())
dictionary={}
count=0
for i in range(N):
    s="".join(sorted(input()))
    if s in dictionary:
        dictionary[s]+=1
        count+=dictionary[s]
    else:
        dictionary[s]=0
print(count)
Buggy python submission (verdict: Time Limit Exceeded):

L,R = map(int,input().split())

b = 2018
for i in range(L,R+1):
    for j in range(i+1,R+1):
        a = (i*j)%2019
        b = min(b,a)
        if b == 0:
            break
print(b)

Fixed submission:
L,R=map(int,input().split())
if R-L>=2019:
    minimum=0
else:
    left,right=L%2019,R%2019
    minimum=2018**2
    for i in range(left,right+1):
        for j in range(i+1,right+1):
            minimum=min(minimum,i*j%2019)
print(minimum)
Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
A = [int(input()) for i in range(M)]
dp = [0]*(N+1)
dp[0]=1
if 1 in A:
    dp[1]= 0
else:
    dp[1]=1
for i in range(2,N+1):
    if i in A:
        dp[i] == 0
    else:
        dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
print(dp[-1])

Fixed submission:
N,M = map(int, input().split())
A = [int(input()) for i in range(M)]
dp = [0]*(N+1)
for k in A:
    dp[k]="E"
dp[0]=1
if dp[1]=="E":
    dp[1]= 0
else:
    dp[1]= 1
for i in range(2,N+1):
    if dp[i]=="E":
        dp[i] = 0
    else:
        dp[i] = (dp[i-1]+dp[i-2])%(10**9+7)
print(dp[-1])
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
N = int(input())
A = list(map(int,input().split()))

ans = 1
for i in range(N):
    g = reduce(math.gcd,A[:i]+A[i+1:])
    ans = max(ans,g)
print(ans)

Fixed submission:
import math
from collections import deque
N = int(input())
A = list(map(int,input().split()))

M = 0
L = deque([0])
R = deque([0])
for i in range(1,N+1):
    L.append(math.gcd(L[-1],A[i-1]))
    R.appendleft(math.gcd(R[0],A[N-i]))
for j in range(N):
    m = math.gcd(L[j],R[j+1])
    M = max(M,m)
print(M)

Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
input()
A = list(map(int,input().split()))

ans = 1
for i in range(N):
    g = reduce(math.gcd,A[:i]+A[i+1:])
    ans = max(ans,g)
print(ans)

Fixed submission:
import math
from collections import deque
N = int(input())
A = list(map(int,input().split()))

M = 0
L = deque([0])
R = deque([0])
for i in range(1,N+1):
    L.append(math.gcd(L[-1],A[i-1]))
    R.appendleft(math.gcd(R[0],A[N-i]))
for j in range(N):
    m = math.gcd(L[j],R[j+1])
    M = max(M,m)
print(M)