Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import bisect
N=int(input())
D=list(map(int,input().split()))
if D[0]==0:
    D.sort()
    m=max(D)
    counter=[]
    for i in range(1,m+1):
        counter.append(bisect.bisect_right(D,i)-bisect.bisect_left(D,i))
    ans=1
    for i in range(2,m+1):
        if counter[i-1]==0:
            counter[i-1]=1
        ans*=counter[i-1]**counter[i]
    print(ans%998244353)
else:
    print(0)

Fixed submission:
import bisect
N=int(input())
D=list(map(int,input().split()))
if D[0]==0 and D.count(0)==1:
    D.sort()
    m=max(D)
    counter=[]
    for i in range(m+1):
        counter.append(bisect.bisect_right(D,i)-bisect.bisect_left(D,i))
    ans=1
    for i in range(1,m+1):
        ans*=counter[i-1]**counter[i]
    print(ans%998244353)
else:
    print(0)

Buggy python submission (verdict: Runtime Error):
import bisect
N=int(input())
D=list(map(int,input().split()))
D.sort()
m=max(D)
counter=[]
if D[0]==0:
    for i in range(1,m+1):
        counter.append(bisect.bisect_right(D,i)-bisect.bisect_left(D,i))
    ans=1
    for i in range(2,m+1):
        if counter[i-1]==0:
            counter[i-1]=1
        ans*=counter[i-1]**counter[i]
    print(ans%998244353)
else:
    print(0)

Fixed submission:
import bisect
N=int(input())
D=list(map(int,input().split()))
if D[0]==0 and D.count(0)==1:
    D.sort()
    m=max(D)
    counter=[]
    for i in range(m+1):
        counter.append(bisect.bisect_right(D,i)-bisect.bisect_left(D,i))
    ans=1
    for i in range(1,m+1):
        ans*=counter[i-1]**counter[i]
    print(ans%998244353)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import sys 
import collections as cl

N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberTupleList=c.most_common()
NumberList=[x[1] for x in NumberTupleList[::-1]]
LengthOfNumberList=len(NumberList)
FormulaList=[sum([min(NumberList[i],x) for i in range(LengthOfNumberList)])/x for x in range(1,N+1)]

pin=N-1
for K in range(1,N+1):
    while pin>=0 and K>FormulaList[pin]:
        pin-=1
    print(pin+1)


Fixed submission:
import sys 
import collections as cl


N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberTupleList=c.most_common()
NumberList=[x[1] for x in NumberTupleList[::-1]]
LengthOfNumberList=len(NumberList)
FormulaList=[0 for i in range(N)]
flag=0
S=sum(NumberList)
for x in range(1,N+1):
    while flag<LengthOfNumberList and NumberList[flag]<=x:
        flag+=1
    if flag<LengthOfNumberList:
        FormulaList[x-1]=(sum(NumberList[:flag])+x*(LengthOfNumberList-flag))/x
    else:
        FormulaList[x-1]=S/x
pin=N-1
for K in range(1,N+1):
    while pin>=0 and K>FormulaList[pin]:
        pin-=1
    print(pin+1)

Buggy python submission (verdict: Time Limit Exceeded):
import sys 
import collections as cl

N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberList=[x for x in c.values()]
LengthOfNumberList=len(NumberList)
FormulaList=[sum([min(NumberList[i],x) for i in range(LengthOfNumberList)])/x for x in range(1,N+1)]
FormulaList.sort(reverse=True)

pin=N-1
for K in range(1,N+1):
    while pin>=0 and K>FormulaList[pin]:
        pin-=1
    print(pin+1)


Fixed submission:
import sys 
import collections as cl


N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberTupleList=c.most_common()
NumberList=[x[1] for x in NumberTupleList[::-1]]
LengthOfNumberList=len(NumberList)
FormulaList=[0 for i in range(N)]
flag=0
S=sum(NumberList)
for x in range(1,N+1):
    while flag<LengthOfNumberList and NumberList[flag]<=x:
        flag+=1
    if flag<LengthOfNumberList:
        FormulaList[x-1]=(sum(NumberList[:flag])+x*(LengthOfNumberList-flag))/x
    else:
        FormulaList[x-1]=S/x
pin=N-1
for K in range(1,N+1):
    while pin>=0 and K>FormulaList[pin]:
        pin-=1
    print(pin+1)
Buggy python submission (verdict: Runtime Error):
import math 

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

A,B=map(int,input().split())
counter=0
gcd=math.gcd(A,B)
for i in range(2,gcd):
    if is_prime(i) and gcd%i==0:
        counter+=1
print(counter+1)

Fixed submission:
import math 
import fractions
import collections


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
A,B=map(int,input().split())
counter=0
gcd=fractions.gcd(A,B)
c = collections.Counter(prime_factorize(gcd))
print(len(c)+1)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
a=[]
for i in range(N):
    s,p=input().split()
    p=int(p)
    a.append([s,p,i+1])
a.sort(key=lambda x:(x[0],x[1]))
i=0
while i<=N:
    last=a[i][0]
    i+=1
    if i<N and last==a[i][0]:
        s=i-1
        g=i
        while 1:
            if i>=N or last!=a[i][0]:
                g=i
                break
            i+=1
        for j in reversed(range(s,g)):
            print(a[j][2])
        if i==N-1:
            break
    else:
        print(a[i-1][2])



Fixed submission:
A,P=map(int,input().split())
print((A*3+P)//2)
Buggy python submission (verdict: Runtime Error):
a=[]
b=[]
for i in range(5):
    buf = int(input())
    a.append(buf)
    if buf%10 != 0:
        b.append(10-buf%10)
print(sum(a)+sum(b)-max(b))


Fixed submission:
a=[]
b=[]
for i in range(5):
    buf = int(input())
    a.append(buf)
    if buf%10 != 0:
        b.append(10-buf%10)
if b:
    print(sum(a)+sum(b)-max(b))
else:
    print(sum(a))
Buggy python submission (verdict: Runtime Error):
S=list(input())
ans=0
j=0
while len(S)-1>j:
    if S[j]!=S[j+1]:
        S.pop(j)
        S.pop(j)
        ans+=2
        j-=1
        continue
    j+=1
print(ans)


Fixed submission:
S=list(input())
ans=0
j=0
while len(S)-1>j:
    if S[j]!=S[j+1]:
        S.pop(j)
        S.pop(j)
        ans+=2
        if j>0:
            j-=1
        continue
    j+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
X=list(map(int,input().split()))
s=[]
sum=0
if M!=1:
    X.sort()
    for i in range(M-1):
        s.append(X[i+1]-X[i])
    t=[]
    for i in range(M-1):
        t.append(s[i])
    s.sort(reverse=True)
    buf=[[],[]]
    for i in range(N-1):
        buf[0].append(s[i])
        buf[1].append(t.index(s[i]))
    print(buf)
    buf[1].sort()
    for i in range(len(buf[1])):
        if i==0:
            sum+=X[buf[1][i]]-X[0]
        else:
            sum+=X[buf[1][i]]-X[buf[1][i-1]+1]
    sum+=X[M-1]-X[buf[1][-1]+1]
else:
    sum=0
    print(sum)



Fixed submission:
N,M=map(int,input().split())
X=list(map(int,input().split()))
X.sort()
a=[0 for i in range(M-1)]
for i in range(M-1):
    a[i]=X[i+1]-X[i]
a.sort(reverse=True)
a=a[N-1:]
print(sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
AB=[[0,0]for i in range(N)]
for i in range(N):
    AB[i][0],AB[i][1]=map(int,input().split())
t_delta_AB=[[0,0,i] for i in range(N)]
for i in range(N):
    t_delta_AB[i][1]=AB[i][1]-AB[i][0]
    t_delta_AB[i][0]=AB[i][0]
t_delta_AB.sort(key= lambda x:(x[0],x[1]),reverse=True)
a_delta_AB=[[0,0,i] for i in range(N)]
for i in range(N):
    a_delta_AB[i][1]=AB[i][0]-AB[i][1]
    a_delta_AB[i][0]=AB[i][1]
a_delta_AB.sort(key= lambda x:(x[0],x[1]),reverse=True)
takahashi_score=0
aoki_score=0
buf=[]
t=0
a=0
for i in range(N):
    if i%2==0:
        n=t
        while 1:
            if not(t_delta_AB[n][2] in buf):
                takahashi_score+=t_delta_AB[n][0]
                buf.append(t_delta_AB[n][2])
                t=n
                break
            n+=1
    else:
        n=a
        while 1:
            if not(a_delta_AB[n][2] in buf):
                aoki_score+=a_delta_AB[n][0]
                buf.append(a_delta_AB[n][2])
                a=n
                break
            n+=1
print(takahashi_score-aoki_score)


Fixed submission:
N=int(input())
B=[0 for i in range(N)]
sum_AB=[0 for i in range(N)]
for i in range(N):
    A,B[i]=map(int,input().split())
    sum_AB[i]=A+B[i]
sum_AB.sort(reverse=True)
sum_B=sum(B)
sum_takahashi=-sum_B
i=0
while i<N:
    if i%2==0:
        sum_takahashi+=sum_AB[i]
    i+=1
print(sum_takahashi)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
AB=[[0,0]for i in range(N)]
for i in range(N):
    AB[i][0],AB[i][1]=map(int,input().split())
t_delta_AB=[[0,0,i] for i in range(N)]
for i in range(N):
    t_delta_AB[i][1]=AB[i][1]-AB[i][0]
    t_delta_AB[i][0]=AB[i][0]
t_delta_AB.sort(key= lambda x:(x[0],x[1]),reverse=True)
a_delta_AB=[[0,0,i] for i in range(N)]
for i in range(N):
    a_delta_AB[i][1]=AB[i][0]-AB[i][1]
    a_delta_AB[i][0]=AB[i][1]
a_delta_AB.sort(key= lambda x:(x[0],x[1]),reverse=True)
takahashi_score=0
aoki_score=0
buf=[]
for i in range(N):
    if i%2==0:
        n=i
        while 1:
            if not(t_delta_AB[n][2] in buf):
                takahashi_score+=t_delta_AB[n][0]
                buf.append(t_delta_AB[n][2])
                break
            n+=1
    else:
        n=i
        while 1:
            if not(a_delta_AB[n][2] in buf):
                aoki_score+=a_delta_AB[n][0]
                buf.append(a_delta_AB[n][2])
                break
            n+=1
print(takahashi_score-aoki_score)


Fixed submission:
N=int(input())
B=[0 for i in range(N)]
sum_AB=[0 for i in range(N)]
for i in range(N):
    A,B[i]=map(int,input().split())
    sum_AB[i]=A+B[i]
sum_AB.sort(reverse=True)
sum_B=sum(B)
sum_takahashi=-sum_B
i=0
while i<N:
    if i%2==0:
        sum_takahashi+=sum_AB[i]
    i+=1
print(sum_takahashi)
Buggy python submission (verdict: Runtime Error):
N=int(input())
H=int(input())
W==int(input())
print((N-H+1)*(N-W+1))


Fixed submission:
N=int(input())
H=int(input())
W=int(input())
print((N-H+1)*(N-W+1))

Buggy python submission (verdict: Runtime Error):
N=int(input())
H=int(input())
W==int(input())
print((N-H+1)*(N-W+1))

Fixed submission:
N=int(input())
H=int(input())
W=int(input())
print((N-H+1)*(N-W+1))
Buggy python submission (verdict: Runtime Error):
INF=100000000
def frog(i,h,dp):
    global INF
    if dp[i]!=INF:
        return dp[i]
    else:
        if i==1:
            dp[i]=0
            return dp[i]
        elif i==2:
            dp[i]=abs(h[1]-h[0])
            return dp[i]
        else:
            dp[i]=min(frog(i-2,h,dp)+abs(h[i-1]-h[i-3]),frog(i-1,h,dp)+abs(h[i-1]-h[i-2]))
            return dp[i]
sys.setrecursionlimit(INF)
N=int(input())
h=list(map(int,input().split()))
dp=[INF for i in range(N+1)]
print(frog(N,h,dp))


Fixed submission:
import sys
INF=100000000
def frog(i,h,dp):
    global INF
    if dp[i]!=INF:
        return dp[i]
    else:
        if i==1:
            dp[i]=0
            return dp[i]
        elif i==2:
            dp[i]=abs(h[1]-h[0])
            return dp[i]
        else:
            dp[i]=min(frog(i-2,h,dp)+abs(h[i-1]-h[i-3]),frog(i-1,h,dp)+abs(h[i-1]-h[i-2]))
            return dp[i]
sys.setrecursionlimit(INF)
N=int(input())
h=list(map(int,input().split()))
dp=[INF for i in range(N+1)]
print(frog(N,h,dp))

Buggy python submission (verdict: Runtime Error):
INF=100000000
def flog(i,h,dp):
    global INF
    if dp[i]!=INF:
        return dp[i]
    else:
        if i==1:
            dp[i]=0
            return dp[i]
        elif i==2:
            dp[i]=abs(h[1]-h[0])
            return dp[i]
        else:
            dp[i]=min(flog(i-2,h,dp)+abs(h[i-1]-h[i-3]),flog(i-1,h,dp)+abs(h[i-1]-h[i-2]))
            return dp[i]
N=int(input())
h=list(map(int,input().split()))
dp=[INF for i in range(N+1)]
print(flog(N,h,dp))


Fixed submission:
import sys
INF=100000000
def frog(i,h,dp):
    global INF
    if dp[i]!=INF:
        return dp[i]
    else:
        if i==1:
            dp[i]=0
            return dp[i]
        elif i==2:
            dp[i]=abs(h[1]-h[0])
            return dp[i]
        else:
            dp[i]=min(frog(i-2,h,dp)+abs(h[i-1]-h[i-3]),frog(i-1,h,dp)+abs(h[i-1]-h[i-2]))
            return dp[i]
sys.setrecursionlimit(INF)
N=int(input())
h=list(map(int,input().split()))
dp=[INF for i in range(N+1)]
print(frog(N,h,dp))
Buggy python submission (verdict: Runtime Error):
import numpy as np
MaxW=int(1e5)
N,W=map(int,input().split())
WV=[]
for i in range(N):
    WV.append(list(map(int,input().split())))
dp=[1e30 for i in range(MaxW+1)]
dp[0]=0
dp=np.array(dp)
for i in range(N):
    dp[WV[i][1]:]=np.minimum(dp[WV[i][1]:],dp[:MaxW-WV[i][1]+1]+WV[i][0])
for i in reversed(range(MaxW+1)):
    if dp[i]<=W:
        print(i)
        break

Fixed submission:
import numpy as np
n,w = [int(x) for x in input().split()]
wv = np.array([[int(y) for y in input().split()] for z in range(n)],dtype=int)
sum_wv = np.sum(wv,axis=0)
sum_v = sum_wv[1]
sum_w = sum_wv[0]
dp = np.full(sum_v+1,sum_w,dtype="int")
dp[0] = 0
for wei,val in wv:
    dp[val:] = np.minimum(dp[val:],dp[:-val]+wei)
for p in range(sum_v,1,-1):
    if(dp[p] <= w):
        print(p)
        break

Buggy python submission (verdict: Runtime Error):
import numpy as np
N,W=map(int,input().split())
w=[0 for i in range(N)]
v=[0 for i in range(N)]
for i in range(N):
    w[i],v[i]=map(int,input().split())
total_v=sum(v)
INF=100000000
dp=[INF for i in range(total_v+1)]
dp[0]=0
dp=np.array(dp)
for i in range(N):
    dp[v[i]:]=np.minimum(dp[v[i]:],dp[:total_v-v[i]+1]+w[i])
for i inrange(sum(v)):
    if dp[i]<=W:
        print(i)
        break



Fixed submission:
import numpy as np
n,w = [int(x) for x in input().split()]
wv = np.array([[int(y) for y in input().split()] for z in range(n)],dtype=int)
sum_wv = np.sum(wv,axis=0)
sum_v = sum_wv[1]
sum_w = sum_wv[0]
dp = np.full(sum_v+1,sum_w,dtype="int")
dp[0] = 0
for wei,val in wv:
    dp[val:] = np.minimum(dp[val:],dp[:-val]+wei)
for p in range(sum_v,1,-1):
    if(dp[p] <= w):
        print(p)
        break
Buggy python submission (verdict: Time Limit Exceeded):

N=int(input())
p=list(map(float,input().split()))
dp=[[0 for i in range(N+1)] for j in range(N+1)]
dp[0][0]=1
for i in range(1,N+1):
    for j in range(N+1):
        if j>0:
            dp[i][j]+=dp[i-1][j]*(1-p[i-1])+dp[i-1][j-1]*p[i-1]
        else:
            dp[i][j]+=dp[i-1][j]*(1-p[i-1])


print(sum(dp[N][N//2+1:]))

Fixed submission:

N=int(input())
p=list(map(float,input().split()))
dp=[[0 for i in range(N+1)] for j in range(N+1)]
dp[0][0]=1
for i in range(1,N+1):
    for j in range(N+1):
        if j>0:
            dp[i][j]+=dp[i-1][j]*(1-p[i-1])+dp[i-1][j-1]*p[i-1]
        else:
            dp[i][j]+=dp[i-1][j]*(1-p[i-1])


print(sum(dp[N][N//2+1:]))
Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
if B>=C:
  ans=B+C
else C>B:
  ans=2*B
  if A>C:
    ans+=C
  else:
    ans+=A
print(ans)


Fixed submission:
A,B,C=map(int,input().split())
if B>=C:
    print(B+C)
else:
    ans=2*B
    C-=B
    if A>=C:
        print(ans+C)
    else:
        print(ans+A+1)

Buggy python submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
if B>=C:
  ans=B+C
else C>B:
  ans+=2*B
  if A>C:
    ans+=C
  else:
    ans+=A
print(ans)


Fixed submission:
A,B,C=map(int,input().split())
if B>=C:
    print(B+C)
else:
    ans=2*B
    C-=B
    if A>=C:
        print(ans+C)
    else:
        print(ans+A+1)
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,T=map(int,input().split())
a=[]
for i in range(N):
    c,t=map(int,input().split())
    if t<=T:
        a.append(c)
if len(a)==0:
    print('TLE')
else:
    a.sort()
    print(a[0][0])


Fixed submission:
N,T=map(int,input().split())
a=[]
for i in range(N):
    c,t=map(int,input().split())
    if t<=T:
        a.append(c)
if len(a)==0:
    print('TLE')
else:
    a.sort()
    print(a[0])
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
a=M//N
x=1
if a>0:
    for i in reversed(range(1,a+1)):
        if M%i==0:
            x=i
            break
print(x)


Fixed submission:
N,M=map(int,input().split())
a=M//N
x=1
for i in range(1,a+1):
    if M%i==0:
        x=i
        if (M//i)>i and (M//i)<=a:
            x=M//i
            break
print(x)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
a=M//N
x=0
for i in reversed(range(1,a+1)):
    if M%i==0:
        x=i
        break
print(x)


Fixed submission:
N,M=map(int,input().split())
a=M//N
x=1
for i in range(1,a+1):
    if M%i==0:
        x=i
        if (M//i)>i and (M//i)<=a:
            x=M//i
            break
print(x)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
a=M//N
x=0
  for i in reversed(range(2,a+1)):
    if M%i==0:
      x=i
      break
print(x)

Fixed submission:
N,M=map(int,input().split())
a=M//N
x=1
for i in range(1,a+1):
    if M%i==0:
        x=i
        if (M//i)>i and (M//i)<=a:
            x=M//i
            break
print(x)
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()))
x.sort(reverse=True)
y.sort()
a=0
for z in range(X+1,Y+1):
    if z>x[0] and z<=y[0]:
        a=1
        break
if a=1:
    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.sort(reverse=True)
y.sort()
a=0
for z in range(X+1,Y+1):
    if z>x[0] and z<=y[0]:
        a=1
        break
if a==1:
    print('No War')
else:
    print('War')
Buggy python submission (verdict: Runtime Error):
N=int(input())
A=list(map(int,input().split()))
median_len=N*(N+1)//2
median=median_len//2+1
a=1
medin_rank=1
for i in range(1,N):
    a=i*(i+1)//2
    b=(i+2)*(i+1)//2
    if a<=median and b>median:
        medin_rank=i
        break
rank_index=median-a
median_list=[]
l=medin_rank//2
for i in range(N-medin_rank):
    median_list.append(A[l+i])
print(median_list[rank_index])


Fixed submission:
N,i=map(int,input().split())
print(N-i+1)
Buggy python submission (verdict: Runtime Error):
A=int(input())
A.sort()
print(A[2]-A[0])

Fixed submission:
A=list(map(int,input().split()))
A.sort()
print(A[2]-A[0])
Buggy python submission (verdict: Runtime Error):
def total(x):
    x=[abs(i) for i in x]
    return sum(x)

N,M=map(int,input().split())
x=[0 for i in range(N)]
y=[0 for i in range(N)]
z=[0 for i in range(N)]
for i in range(N):
    x[i],y[i],z[i]=map(int,input().split())
dp=[[[0,0,0] for i in range(M+1)] for j in range(N+1)]
for i in range(N):
    for j in range(M):
        if i>j:
            D=dp[i][j]
            XYZ=[D[0]+x[i],D[1]+y[i],D[2]+z[i]]
            if total(XYZ)>=total(dp[i][j+1]):
                dp[i+1][j+1]=[X,Y,Z]
            else:
                dp[i+1][j+1]=dp[i][j+1]
        elif i==j:
            dp[i+1][j+1]=[a+b for a,b in zip(dp[i][j],[x[i],y[i],z[i]])]
print(total(dp[N][M]))



Fixed submission:
import numpy as np
N,M=map(int,input().split())
x=[0 for i in range(N)]
y=[0 for i in range(N)]
z=[0 for i in range(N)]
for i in range(N):
    x[i],y[i],z[i]=map(int,input().split())
x=np.array(x)
y=np.array(y)
z=np.array(z)
xyz=np.array([x,y,z])
d=[]
for i in range(8):
    buf=np.zeros(N)
    for j in range(3):
        if i & (1<<j):
            buf=buf+-1*xyz[j]
            continue
        buf=buf+xyz[j]
    buf.sort()
    d.append(sum(buf[N-M:]))
print(int(max(d)))
Buggy python submission (verdict: Time Limit Exceeded):
buf=[-1 for i in range(90)]
def ryuka(N):
    global buf
    if buf[N]!=-1:
        return buf[N]
    else:
        if N==1:
            return 1
        elif N==0:
            return 2
        else:
            return ryuka(N-1)+ryuka(N-2)

N=int(input())
print(ryuka(N))



Fixed submission:
buf=[-1 for i in range(90)]
def ryuka(N):
    global buf
    if buf[N]!=-1:
        return buf[N]
    else:
        if N==1:
            return 1
        elif N==0:
            return 2
        else:
            buf[N]=ryuka(N-1)+ryuka(N-2)
            return ryuka(N-1)+ryuka(N-2)

N=int(input())
print(ryuka(N))
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
p - list(map(int, input().split()))

p = sorted(p, key = int)
print(sum(p[:2]))

Fixed submission:
n, k = map(int, input().split())
p = list(map(int,input().split()))
p = sorted(p, key = int)
print(sum(p[:k]))
Buggy python submission (verdict: Time Limit Exceeded):
h1, m1, h2, m2, k = map(int, input().split())
h = h2-h1
m = m2-m1
a = h*60
m += a
b = k
if k != m:
    while k+b != m:
        if k+b == m:
            k = 0
            break
        k += b
else:
    k = 0
print(k)



Fixed submission:
h1, m1, h2, m2, k = map(int, input().split())
print(60*(h2-h1) + m2-m1-k)
Buggy python submission (verdict: Runtime Error):
L,R,d=list(map(int,(input().split())))
if ((R//d-L//d)==99):
  print(100)
elif(((R//d-L//d)==0))
  print(1)
else:
  print(R//d-L//d)

Fixed submission:
L,R,d=list(map(int,(input().split())))
if (L==d):
  print(R//d-L//d+1)
elif L==R and L!=d:
  print(1)
else:
  print(R//d-L//d)
Buggy python submission (verdict: Runtime Error):
D=int(input())
c=list(map(int,(input().split())))
s=[]
t=[]
last=[0]*26
sat=0
for _ in range(D):
  s.append(list(map(int,(input().split()))))


for i in range(D):
  sat+=max(s[i])
  t.append(s[i].index(max(s[i]))+1)
  for j in range(26):
    sat-=c[i]*(1-last[j])
  
for ans in t:
  print(ans)

Fixed submission:
D=int(input())
c=list(map(int,(input().split())))
s=[]
t=[]
last=[0]*26
sat=0
  
for i in range(D):
  s.append(list(map(int,(input().split()))))
  sat+=max(s[i])
  ans=s[i].index(max(s[i]))+1
  t.append(ans)
  print(ans)

Buggy python submission (verdict: Runtime Error):
D=int(input())
c=list(map(int,(input().split())))
s=[]
t=[]
last=[0]*26
sat=0
for _ in range(D):
  s.append(list(map(int,(input().split()))))
for _ in range(D):
  t.append(int(input()))

for i in range(D):
  sat+=max(s[i])
  for j in range(26):
    sat-=c[i]*(1-last[j])
  print(sat)

Fixed submission:
D=int(input())
c=list(map(int,(input().split())))
s=[]
t=[]
last=[0]*26
sat=0
  
for i in range(D):
  s.append(list(map(int,(input().split()))))
  sat+=max(s[i])
  ans=s[i].index(max(s[i]))+1
  t.append(ans)
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
ans=0
for i in range(1,N+1):
  Y=int(N//i)
  ans+=int(Y*(Y+1)*i/2)
print(ans)

Fixed submission:
N=int(input())
ans=0
for i in range(1,N+1):
  Y=N//i
  ans+=Y*(Y+1)*i//2
print(int(ans))
Buggy python submission (verdict: Runtime Error):
X=int(input())
ans=[]
for i in range(-100,100):
  for j in range(-100,100):
    if((i**5)-(j**5)==X):
      ans.append((str(i)+" "+str(j)))
print(ans[0])

Fixed submission:
X=int(input())
ans=[]
for i in range(1,1000):
  for j in range(-1000,1000):
    if((i**5)-(j**5)==X):
      ans.append((str(i)+" "+str(j)))
print(ans[0])
Buggy python submission (verdict: Runtime Error):
N = input()
count=0
for i in range(len(N)+1):
  for j in range(i+1,len(N)+1):
    if(int(N[i:j])%3!=0):
      continue
    if(int(N[i:j])%673==0):
      count+=1

print(count)


Fixed submission:
S, W = map(int,(input().split()))
if(S>W):
  print("safe")
else:
  print("unsafe")
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int,input().split()))
buka_num=[0 for _ in range(N+1)]

for i in a:
  buka_num[i]+=1
buka_num.pop(0)
for j in buka_num:
  print(j)

Fixed submission:
R = int(input())
print(R*2*3.1415)