Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N,Ma,Mb=map(int,input().split())
a=[0 for i in range(N)]
b=[0 for i in range(N)]
c=[0 for i in range(N)]
M=401
dp=[[[10**4 for cb in range(M)]for ca in range(M)]for i in range(N+1)]
for i in range(N):
    a[i],b[i],c[i]=map(int,input().split())
dp[0][0][0]=0
for i in range(N):
    for ca in range(M):
        for cb in range(M):
            if dp[i][ca][cb]==10**4:
                continue
            dp[i+1][ca][cb]=min([dp[i+1][ca][cb],dp[i][ca][cb]])
            dp[i+1][ca+a[i]][cb+b[i]]=min([dp[i+1][ca+a[i]][cb+b[i]],dp[i][ca][cb]+c[i]])
ans=10**4
for i in range(1,M):
    for j in range(1,M):
        if i*Mb==j*Ma:
            if dp[N][i][j]<ans:
                ans=dp[N][i][j]
if ans!=10**4:
    print(ans)
else:
    print(-1)


Fixed submission:
A,B=map(int,input().split())
if ((A-2)%13)<((B-2)%13):
  print("Bob")
elif ((A-2)%13)>((B-2)%13):
  print("Alice")
else:
  print("Draw")
Buggy python submission (verdict: Time Limit Exceeded):
N,Ma,Mb=map(int,input().split())
a=[0 for i in range(N)]
b=[0 for i in range(N)]
c=[0 for i in range(N)]
M=401
dp=[[[10**4 for cb in range(M)]for ca in range(M)]for i in range(N+1)]
for i in range(N):
    a[i],b[i],c[i]=map(int,input().split())
dp[0][0][0]=0
for i in range(N):
    for ca in range(M):
        for cb in range(M):
            if ca+a[i]<M and cb+b[i]<M:
                dp[i+1][ca+a[i]][cb+b[i]]=min([dp[i+1][ca+a[i]][cb+b[i]],dp[i][ca][cb]+c[i]])
            dp[i+1][ca][cb]=min([dp[i][ca][cb],dp[i+1][ca][cb]])
ans=10**4
for i in range(1,M):
    for j in range(1,M):
        if i*Mb==j*Ma:
            if dp[N][i][j]<ans:
                ans=dp[N][i][j]
if ans!=10**4:
    print(ans)
else:
    print(-1)


Fixed submission:
N,Ma,Mb=map(int,input().split())
a=[0 for i in range(N)]
b=[0 for i in range(N)]
c=[0 for i in range(N)]
M=401
dp=[[[10**4 for cb in range(M)]for ca in range(M)]for i in range(N+1)]
for i in range(N):
    a[i],b[i],c[i]=map(int,input().split())
dp[0][0][0]=0
for i in range(N):
    for ca in range(M):
        for cb in range(M):
            if dp[i][ca][cb]==10**4:
                continue
            dp[i+1][ca][cb]=min([dp[i+1][ca][cb],dp[i][ca][cb]])
            dp[i+1][ca+a[i]][cb+b[i]]=min([dp[i+1][ca+a[i]][cb+b[i]],dp[i][ca][cb]+c[i]])
ans=10**4
for i in range(1,M):
    for j in range(1,M):
        if i*Mb==j*Ma:
            if dp[N][i][j]<ans:
                ans=dp[N][i][j]
if ans!=10**4:
    print(ans)
else:
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = 0
A = [0 for i in range(N)]
B = [0 for i in range(N)]
for i in range(N):
    A[i], B[i] = map(int, input().split())
for i in range(N):
    s = (-A[N-1-i])%B[N-1-i]
    S += s
    for j in range(N-i):
        A[j] += s
print(S)


Fixed submission:
N = int(input())
S = 0
A = [0 for i in range(N)]
B = [0 for i in range(N)]
for i in range(N):
    A[i], B[i] = map(int, input().split())
for i in range(N):
    S += (-A[N-1-i])%B[N-1-i]
    if i != N-1:
        A[N-2-i]+= S
print(S)
Buggy python submission (verdict: Time Limit Exceeded):
x,y=map(int,input().split())
S=[set([x])]
k=0
while(True):
    S.append(set())
    k+=1
    for i in S[k-1]:
        S[k].add(i+1)
        S[k].add(-i)
        if i+1==y or -i==y:
            print(k)
            exit()


Fixed submission:
x,y=map(int,input().split())
a=[0 for i in range(4)]
a[0]=y-x
a[1]=y+x+1
a[2]=-y-x+1
a[3]=-y+x+2
b=[]
for i in range(4):
    if a[i]>0:
        b.append(a[i])
print(min(b))

Buggy python submission (verdict: Time Limit Exceeded):
x,y=map(int,input().split())
M=max([abs(x),abs(y)])
T=[-1 for i in range(2*M+1)]
T[M+x]=0
k=1
S=[set([M+x])]
#print(T)
while(T[M+y]==-1):
    S.append(set())
    for i in S[k-1]:
        if i!=2*M:
            T[i+1]=k
            S[k].add(i+1)
        T[2*M-i]=k
        S[k].add(2*M-i)
    k+=1
    #print(T)
print(k-1)


Fixed submission:
x,y=map(int,input().split())
a=[0 for i in range(4)]
a[0]=y-x
a[1]=y+x+1
a[2]=-y-x+1
a[3]=-y+x+2
b=[]
for i in range(4):
    if a[i]>0:
        b.append(a[i])
print(min(b))
Buggy python submission (verdict: Runtime Error):
st=input().split()
A=int(st[0])
B=int(st[1])
op=st[2]
if op=="+":
  print(A+B)
else:
  print(A-B)


Fixed submission:
st=input().split()
A=int(st[0])
B=int(st[2])
op=st[1]
if op=="+":
  print(A+B)
else:
  print(A-B)
Buggy python submission (verdict: Time Limit Exceeded):
import math
import heapq
xs,ys,xt,yt=map(int,input().split())
N=int(input())
x=[xs]+[0 for i in range(N)]+[xt]
y=[ys]+[0 for i in range(N)]+[yt]
r=[0]+[0 for i in range(N)]+[0]
for i in range(1,N+1):
    x[i],y[i],r[i]=map(int,input().split())
dist=[10**15 for i in range(N+2)]
dist[0]=0
adjlist=[[0 for i in range(N+2)] for j in range(N+2)]
for i in range(N+2):
    for j in range(N+2):
        if i==j:
            continue
        adjlist[i][j]=max(math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)-r[i]-r[j],0)
q=[]
heapq.heappush(q,(0,0))
while(len(q)>0):
    d,p=heapq.heappop(q)
    if dist[p]<d:
        continue
    for j in range(N+2):
        if p==j:
            continue
        cost=adjlist[p][j]
        if dist[j]>dist[p]+cost:
            dist[j]=dist[p]+cost
            heapq.heappush(q,(dist[j],j))
print(dist[N+1])

Fixed submission:
import math
import heapq
xs,ys,xt,yt=map(int,input().split())
N=int(input())
x=[xs]+[0 for i in range(N)]+[xt]
y=[ys]+[0 for i in range(N)]+[yt]
r=[0]+[0 for i in range(N)]+[0]
for i in range(1,N+1):
    x[i],y[i],r[i]=map(int,input().split())
dist=[10**15 for i in range(N+2)]
dist[0]=0
adjlist=[[0 for i in range(N+2)] for j in range(N+2)]
for i in range(N+2):
    for j in range(N+2):
        if i==j:
            continue
        adjlist[i][j]=max(math.sqrt((x[i]-x[j])**2+(y[i]-y[j])**2)-r[i]-r[j],0)
q=[]
heapq.heappush(q,(0,0))
while(len(q)>0):
    d,p=heapq.heappop(q)
    if dist[p]<d:
        continue
    for j in range(N+2):
        if p==j:
            continue
        cost=adjlist[p][j]
        if dist[j]>dist[p]+cost:
            dist[j]=dist[p]+cost
            heapq.heappush(q,(dist[j],j))
print(dist[N+1])
Buggy python submission (verdict: Time Limit Exceeded):
X = input()
S = len(X)
while(True):
    N = len(X)
    X = X.replace("ST", "")
    K = N - len(X)
    if K == 0:
        break
    else:
        S -= K
print(S)


Fixed submission:
X=input()
N=len(X)
k=0
a=0
for i in range(N):
    if X[i]=="S":
       a+=1
    else:
        if a!=0:
            k+=2
            a-=1
print(N-k)

Buggy python submission (verdict: Time Limit Exceeded):
X = input()
S = len(X)
while(True):
    N = len(X)
    X = X.replace("ST", "")
    K = N - len(X)
    if K == 0:
        break
    else:
        S -= K
print(S)


Fixed submission:
X=input()
N=len(X)
k=0
a=0
for i in range(N):
    if X[i]=="S":
       a+=1
    else:
        if a!=0:
            k+=2
            a-=1
print(N-k)
Buggy python submission (verdict: Time Limit Exceeded):
N,x=map(int,input().split())
a=[int(i) for i in input().split()]
b=[[0 for k in range(N)] for i in range(N)]
for k in range(N):
    for i in range(N):
        if k==0:
            b[i][k]=a[i]
        else:
            b[i][k]=min([b[i][k-1],a[i-k]])
ans=sum(a)
for k in range(N):
    tmp=k*x
    for i in range(N):
        tmp+=b[i][k]
    if tmp<ans:
        ans=tmp
print(ans)


Fixed submission:
N,x=map(int,input().split())
a=[int(i) for i in input().split()]
b=[[0 for k in range(N)] for i in range(N)]
for k in range(N):
    for i in range(N):
        if k==0:
            b[i][k]=a[i]
        else:
            b[i][k]=min([b[i][k-1],a[i-k]])
ans=sum(a)
for k in range(N):
    tmp=k*x
    for i in range(N):
        tmp+=b[i][k]
    if tmp<ans:
        ans=tmp
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,A=map(int,input().split())
x=[int(i) for i in input().split()]
NX=N*max([max(x),A])
dp=[[[0 for s in range(NX+1)] for k in range(N+1)] for j in range(N+1)]
dp[0][0][0]=1
for j in range(N+1):
    for k in range(N+1):
        for s in range(NX+1):
            if j==0 and k==0 and s==0:
                dp[j][k][s]=1
            elif j>=1 and s<x[j-1]:
                dp[j][k][s]=dp[j-1][k][s]
            elif j>=1 and k>=1 and s>=x[j-1]:
                dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-x[j-1]]
            else:
                dp[j][k][s]=0
#(dp)
ans=0
for k in range(1,N+1):
    ans+=dp[N][k][k*A]
print(ans)


Fixed submission:
N,A=map(int,input().split())
x=[int(i) for i in input().split()]
NX=N*max([max(x),A])
dp=[[[0 for s in range(NX+1)] for k in range(N+1)] for j in range(N+1)]
dp[0][0][0]=1
for j in range(N+1):
    for k in range(N+1):
        for s in range(NX+1):
            if j==0 and k==0 and s==0:
                dp[j][k][s]=1
            elif j>=1 and s<x[j-1]:
                dp[j][k][s]=dp[j-1][k][s]
            elif j>=1 and k>=1 and s>=x[j-1]:
                dp[j][k][s]=dp[j-1][k][s]+dp[j-1][k-1][s-x[j-1]]
            else:
                dp[j][k][s]=0
#(dp)
ans=0
for k in range(1,N+1):
    ans+=dp[N][k][k*A]
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
def f(b,n):
    if n<b:
        return n
    else:
        return f(b,n//b)+(n%b)
N=int(input())
S=int(input())
if N==S:
    print(N+1)
else:
    for b in range(2,int(math.sqrt(N))+2):
        if f(b,N)==S:
            print(b)
            exit()
    for p in range(int(math.sqrt(N))+2):
        b=(N-S)//(p+1)
        if f(b,N)==S:
            print(b)
            exit()
    print(-1)


Fixed submission:
import math
def f(b,n):
    if n<b:
        return n
    else:
        return f(b,n//b)+(n%b)
N=int(input())
S=int(input())
if N==S:
    print(N+1)
else:
    for b in range(2,int(math.sqrt(N))+2):
        if f(b,N)==S:
            print(b)
            exit()
    ans=10**13
    for p in range(1,int(math.sqrt(N))+2):
        if (N-S)%p!=0:
            continue
        b=(N-S)//p+1
        if b<=1:
            continue
        if f(b,N)==S:
            ans=b
    if ans==10**13:
        print(-1)
    else:
        print(ans)
Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
  if a%b==0:
    return b
  else:
    return gcd(b,a%b)
N,X=map(int,input().split())
print(3*(N-gcd(N,X))


Fixed submission:
def gcd(a,b):
  if a%b==0:
    return b
  else:
    return gcd(b,a%b)
N,X=map(int,input().split())
print(3*(N-gcd(N,X)))

Buggy python submission (verdict: Runtime Error):
def gcd(a,b):
  if a%b==0:
    return b
  else:
    return gcd(b,a%b):
N,X=map(int,input().split())
print(3*(N-gcd(N,X))

Fixed submission:
def gcd(a,b):
  if a%b==0:
    return b
  else:
    return gcd(b,a%b)
N,X=map(int,input().split())
print(3*(N-gcd(N,X)))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
pair_list = []

ans = 0

for a in range(1, N+1):
    b = 1
    while (a*b < N):
        ans += 1
        b += 1
    
print(ans)


Fixed submission:
N = int(input())

ans = 0

for a in range(1, N+1):
    if N%a==0:
        b_max = int(N/a)-1
    else:
        b_max = int(N//a)
    
    ans += b_max
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):

N = int(input())

ans = 0

for a in range(1, N+1):
    for b in range(1, int(N/a)+1):
        if a * b < N:
            ans +=1
print(ans)

Fixed submission:
N = int(input())

ans = 0

for a in range(1, N+1):
    if N%a==0:
        b_max = int(N/a)-1
    else:
        b_max = int(N//a)
    
    ans += b_max
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        A_i = A[i]%(10**9+7)
        A_j = A[j]%(10**9+7)
        ans += (A_i * A_j)%(10**9+7)
        ans = ans%(10**9+7)
        
print(ans)

Fixed submission:
N = int(input())
MOD = 10**9 + 7

A = list(map(lambda x: int(x)%MOD, input().split()))
S = []

tmp_s = 0
for A_i in A[::-1]:
    tmp_s += A_i
    S.append(tmp_s%MOD)
S.pop(-1)
S = S[::-1]

ans = 0
for i in range(N-1):
    ans += (A[i] * S[i])%MOD
    ans = ans%MOD
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
if c%b =< a%d:
    print("Yes")
else:
    print("No")

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

takahashi = c//b
if c%b!=0:
    takahashi += 1
    
aoki = a//d
if a%d!=0:
    aoki += 1

if takahashi <= aoki:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int,input().split())
a=[]
for i in range(q):
    a.append(int(input()))

    
for i in range(n):
    if k-(q-a.count(i+1))>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
import collections
n, k, q = map(int,input().split())
a=[]
for i in range(q):
    a.append(int(input()))

c = collections.Counter(a)

sa = k-q

for i in range(n):
    if sa+c[i+1]>0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
l,r=map(int,input().split())

if r-l>=2019:
    print(0)
else:
    i_l=[]
    for i in range(l,r):
        for j in (i+1,r+1):
        i_l.append((i%2019*j%2019)%2019)
    print(min(i_l))
           

Fixed submission:
l,r=map(int,input().split())

if r-l>=2019:
    print(0)
else:
    i_l=[]
    for i in range(l,r):
        for j in range(i+1,r+1):
            i_l.append((i%2019*j%2019)%2019)
    print(min(i_l))
Buggy python submission (verdict: Runtime Error):
import math

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

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


p = B-(int(B/C) + int(B/D) - int(B/lcm(C,D)))

q = A-1-(int((A-1)/C) + int((A-1)/D) - int((A-1)/lcm(C,D)))

print(p-q)

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())

#b以下の自然数で、cでもdでも割り切れないものの個数から
#a-1以下の自然数で、cでもdでも割り切れないものの個数を引けばOK

#cとdの最小公倍数を求める
def lcm(x,y):
    return (x*y)//fractions.gcd(x,y)

#b以下の自然数で、cでもdでも割り切れないものの個数を求める
b_ika=b-(b//c+b//d-b//lcm(c,d))
a_mimann=a-1-((a-1)//c+(a-1)//d-(a-1)//lcm(c,d))

ans=b_ika-a_mimann

print(ans)

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

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

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


p = B-(int(B/C) + int(B/D) - int(B/lcm(C,D)))

q = A-1-(int((A-1)/C) + int((A-1)/D) - int((A-1)/lcm(C,D)))

print(p-q)

Fixed submission:
import fractions
a,b,c,d=map(int,input().split())

#b以下の自然数で、cでもdでも割り切れないものの個数から
#a-1以下の自然数で、cでもdでも割り切れないものの個数を引けばOK

#cとdの最小公倍数を求める
def lcm(x,y):
    return (x*y)//fractions.gcd(x,y)

#b以下の自然数で、cでもdでも割り切れないものの個数を求める
b_ika=b-(b//c+b//d-b//lcm(c,d))
a_mimann=a-1-((a-1)//c+(a-1)//d-(a-1)//lcm(c,d))

ans=b_ika-a_mimann

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

Fixed submission:
X, A = map(int, input().split())
if X < A:
    print(0)
else:
    print(10)

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

Fixed submission:
X, A = map(int, input().split())
if X < A:
    print(0)
else:
    print(10)

Buggy python submission (verdict: Runtime Error):
X, A = map(int, input().split())
if X < A:
    print("0")
else:
    print("1")

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()))

j = 1
sumL = L[0]

while sumL <= X:
    sumL += L[j]
    j += 1

print(j)

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

lenL = 0

for i in range(len(L)):
    lenL += L[i]
    i += 1

if lenL <= X:
    print(N+1)
else:
    j = 1
    sumL = L[0]

    while sumL <= X:
        sumL += L[j]
        j += 1
    print(j)
Buggy python submission (verdict: Runtime Error):
n,m,c=map(int, input().split())
b=list(map(int, input().split()))
tmp=0
cnt=0
a_i=[]
for _ in range(n):
    a=list(map(int, input().split()))
    for i in range(m):
        tmp=0
        tmp+=int(a[i])*int(b[i])
    if tmp+c>0:
        cnt+=1
        
print(cnt)

Fixed submission:
H, W = map(int, input().split())
h, w = map(int, input().split())

print(H*W-(h*W+H*w-h*w))
Buggy python submission (verdict: Runtime Error):
a,b,k=map(int, input().split())
l=[]
for i in range(1,100):
    if a%i==0 and b%i==0:
        l.append(i)
if k==len(k):
    print(l[0])
else:
    print(l[-k])

Fixed submission:
a,b,k=map(int, input().split())
l=[]
for i in range(1,101):
    if a%i==0 and b%i==0:
        l.append(i)
if k==len(l):
    print(l[0])
else:
    print(l[-k])
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N == 1:
    print("Hello World")
else:
    A,B = map(int, input().split())
    print(A+B)

Fixed submission:
N = int(input())
if N == 1:
    print("Hello World")
else:
    A = int(input())
    B = int(input())
    print(A+B)
Buggy python submission (verdict: Runtime Error):
n,m,X,Y=map(int, input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))

if max(x,X)<min(y,Y):
    print("No war")
else:
    print("War")

Fixed submission:
n,m,X,Y=map(int, input().split())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
x.append(X)
y.append(Y)
if max(x)<min(y):
    print("No War")
else:
    print("War")
Buggy python submission (verdict: Runtime Error):
s=input()
l=[]
for i in range(2,len(s)-1):
    l.append(s[i])

k=s[1:s.index("C")]+s[s.index("C")+1:]

if s[0]=="A" and l.count("C")==1 and k==k.lower():
    print("AC")
else:
    print("WA")

Fixed submission:
import sys
s=input()
l=[]
for i in range(2,len(s)-1):
    l.append(s[i])
if l.count("C")!=1:
    print("WA")
    sys.exit()
else:
    k=s[1:s.index("C")]+s[s.index("C")+1:]

if s[0]=="A" and l.count("C")==1 and k==k.lower():
    print("AC")
else:
    print("WA")
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()
k = t.index(s[0])
t = t[k:]+t[:k]
if s==t:
    print("Yes")
else:
    print("No")

Fixed submission:
import sys
s = input()
t = input()
for i in range(len(t)):
    l = t[i:]+t[:i]
    if s==l:
        print("Yes")
        sys.exit()
print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=input()
ans=n
for i in range(n):
    #i番目（0〜N-1）の人をリーダーにする
    
    #リーダの左で向きを変える人数(もともと西を向いてて、東に向き直らなければいけない人数)
    left_num=s[:i].count("W")
    
    #リーダの右で向きを変える人数(もともと東を向いてて、西に向き直らなければいけない人数）
    right_num=s[i+1:].count("E")
    
    num=left_num+right_num
    
    #ansを更新
    ans=min(ans,num)
    
print(ans)

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

#Eが出てくる回数の累積和を取る(O(n))
l=[0]
l_tmp=0
for i in range(n):
    if s[i]=="E":
        l_tmp+=1
        l.append(l_tmp)
    else:
        l.append(l_tmp)

#クエリ(O(n))

ans=n
for j in range(1,n+1):
    #j番目より左のWの数は(j-1)-l[j-1]
    #j番目より右のEの数はl[-1]-l[j]
    ans=min(ans,(j-1)-l[j-1]+l[-1]-l[j])
    
print(ans)
Buggy python submission (verdict: Runtime Error):
s = [input() for i in range(3)]
print(s[0][0], s[1][1], s[2][2], sep="")

Fixed submission:
N = int(input())
print(int(N/3))
Buggy python submission (verdict: Runtime Error):
def lucas(n):
    if n==0:
        return 2
    elif n==1:
        return 1
    else:
        return lucas(n-1)+lucas(n-2)
n= int(input())

l=((1+math.sqrt(5))/2)**n+((1-math.sqrt(5))/2)**n
print(int(l))

Fixed submission:
n=int(input())
a,b,c=2,1,3
if n==0:
    print(2)
elif n==1:
    print(1)
elif n==2:
    print(3)
else:
    for i in range(n-2):
        a,b,c=b,c,b+c
    print(c)

Buggy python submission (verdict: Time Limit Exceeded):
def lucas(n):
    if n==0:
        return 2
    elif n==1:
        return 1
    else:
        return lucas(n-1)+lucas(n-2)
n= int(input())
print(lucas(n))

Fixed submission:
n=int(input())
a,b,c=2,1,3
if n==0:
    print(2)
elif n==1:
    print(1)
elif n==2:
    print(3)
else:
    for i in range(n-2):
        a,b,c=b,c,b+c
    print(c)
Buggy python submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[input() for i in range(h)]

for i in range(h):
    for j in range(w):
        c=0
        for a in range(i-1,i+2):
            for b in range(j-1,j+2):
                c+=all((min(a,b)>=0,a<h,b<w))and s[a][b]=='#'
        if s[i][j]=='.':s[i][j]=c

for a in s:
    print(*a,sep='')

Fixed submission:
h,w=map(int,input().split())
s=[input() for _ in range(h)]
 
for i in range(h):
    ans=""
    for j in range(w):
        if(s[i][j]=="#"):
            ans+="#"
        else:
            tmp=0
            for k in s[max(0, i-1):min(h, i+2)]:
                tmp+=k[max(0, j-1):min(w, j+2)].count("#")
                
            ans+=str(tmp)
    print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
n=int(input())
a=[int(input()) for _ in range(n)]
       
cnt=0
tmp=1

for i in range(n):
    cnt+=1
    already.append(tmp)
    tmp=a[tmp-1]
    if tmp==2:
        print(cnt)
        sys.exit()
print(-1)

Fixed submission:
import sys
n=int(input())
a=[int(input()) for _ in range(n)]
       
cnt=0
tmp=1

for i in range(n):
    cnt+=1
    tmp=a[tmp-1]
    if tmp==2:
        print(cnt)
        sys.exit()
print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for _ in range(n)]
       
cnt=0
tmp=1
already=[]
while True:
    cnt+=1
    already.append(tmp)
    tmp=a[tmp-1]
    if tmp==2:
        print(cnt)
        break
    elif tmp in already[::-1]:
        print(-1)
        break

Fixed submission:
import sys
n=int(input())
a=[int(input()) for _ in range(n)]
       
cnt=0
tmp=1

for i in range(n):
    cnt+=1
    tmp=a[tmp-1]
    if tmp==2:
        print(cnt)
        sys.exit()
print(-1)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[int(input()) for _ in range(n)]

for i in range(a):
    if a[i]==i+1:
        print(-1)
        
cnt=0
tmp=1
already=[]
while True:
    cnt+=1
    already.append(tmp)
    tmp=a[tmp-1]
    if tmp==2:
        print(cnt)
        break
    elif tmp in already:
        print(-1)
        break

Fixed submission:
import sys
n=int(input())
a=[int(input()) for _ in range(n)]
       
cnt=0
tmp=1

for i in range(n):
    cnt+=1
    tmp=a[tmp-1]
    if tmp==2:
        print(cnt)
        sys.exit()
print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for _ in range(n)]

cnt=0
tmp=1
already=[]
while True:
    cnt+=1
    already.append(tmp)
    tmp=a[tmp-1]
    if tmp==2:
        print(cnt)
        break
    elif tmp in already:
        print(-1)
        break

Fixed submission:
import sys
n=int(input())
a=[int(input()) for _ in range(n)]
       
cnt=0
tmp=1

for i in range(n):
    cnt+=1
    tmp=a[tmp-1]
    if tmp==2:
        print(cnt)
        sys.exit()
print(-1)
Buggy python submission (verdict: Runtime Error):
a, b, c  = map(int, input().split())

if A<=c and c<=b:
    print("Yes")
else:
    print("No")

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

if a<=c and c<=b:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
ans=0
a.sort(reverse=True)
for _ in range(n):
    a.pop(0)
    ans+=a.pop(0)
print(ans)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
ans=sum(a[n::2])
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = int(input().split)

if a ==b :
    print("Draw")
elif a == 1 or a>b:
    print("Alice")
else:
    print("Bob")

Fixed submission:
a, b = (int(i) for i in input().split())

if a==1:
    a=14

if b==1:
    b=14

if a==b:
    print("Draw")
elif a>b:
    print("Alice")
else:
    print("Bob")
Buggy python submission (verdict: Runtime Error):
a,b=map(str, input().split())
if a==b:
    print("H")
else:
    print("D")

Fixed submission:
a,op,b=input().split()
if op=="+":
    print(int(a)+int(b))
else:
    print(int(a)-int(b))