Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
S=[0]*100010
S[1]=1
S[2]=1
for i in range(3,100010):
    S[i]=(S[i-2]+S[i-1])%1000000007

N,M=map(int,input().split())
T=[]
for i in range(M):
    T.append(int(input()))
    if i>=1:
        if T[i]-1==T[i-1]:
            print(0)
            exit()

U=[]
U.append(T[0])
for i in range(1,M):
    U.append(T[i]-T[i-1]-1)

U.append(N-T[M-1])

ans=1
for i in range(len(U)):
    ans=(ans*S[U[i]])%1000000007
print(ans)


Fixed submission:
S=[0]*100010
S[1]=1
S[2]=1
for i in range(3,100010):
    S[i]=(S[i-2]+S[i-1])%1000000007

N,M=map(int,input().split())
if M==0:
    ans=1
    print(S[N+1])
    exit()
T=[]
for i in range(M):
    T.append(int(input()))
    if i>=1:
        if T[i]-1==T[i-1]:
            print(0)
            exit()

U=[]
U.append(T[0])
for i in range(1,M):
    U.append(T[i]-T[i-1]-1)

U.append(N-T[M-1])

ans=1
for i in range(len(U)):
    ans=(ans*S[U[i]])%1000000007
print(ans)

Buggy python submission (verdict: Runtime Error):
S=[0]*100010
S[1]=1
S[2]=1
for i in range(3,102):
    S[i]=(S[i-2]+S[i-1])%1000000007

N,M=map(int,input().split())
T=[]
for i in range(M):
    T.append(int(input()))
    if i>=1:
        if T[i]-1==T[i-1]:
            print(0)
            exit()

U=[]
U.append(T[0])
for i in range(1,M):
    U.append(T[i]-T[i-1]-1)

U.append(N-T[M-1])

ans=1
for i in range(len(U)):
    ans=(ans*S[U[i]])%1000000007
print(ans)


Fixed submission:
S=[0]*100010
S[1]=1
S[2]=1
for i in range(3,100010):
    S[i]=(S[i-2]+S[i-1])%1000000007

N,M=map(int,input().split())
if M==0:
    ans=1
    print(S[N+1])
    exit()
T=[]
for i in range(M):
    T.append(int(input()))
    if i>=1:
        if T[i]-1==T[i-1]:
            print(0)
            exit()

U=[]
U.append(T[0])
for i in range(1,M):
    U.append(T[i]-T[i-1]-1)

U.append(N-T[M-1])

ans=1
for i in range(len(U)):
    ans=(ans*S[U[i]])%1000000007
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(map(int,input().split()))



while len(S)!=1:
    
    S.sort()
    
    if S[1]%S[0]==0:
        S.pop(1)
    
    else:
        S[1]=S[1]%S[0]

    if S[0]==1:
        print(1)
        exit()
print(S[0])

Fixed submission:
import math

N=int(input())
S=list(map(int,input().split()))
F=S[0]
for i in range(N-1):
    F=math.gcd(F,S[i+1])

print(F)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(map(int,input().split()))



while len(S)!=1:
    S.sort()
    
    
    if S[1]%S[0]==0:
        S.pop(1)
    
    else:
        S[1]=S[1]%S[0]
    if S[0]==1:
        print(1)
        exit()
print(S[0])

Fixed submission:
import math

N=int(input())
S=list(map(int,input().split()))
F=S[0]
for i in range(N-1):
    F=math.gcd(F,S[i+1])

print(F)
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())


T=list(map(int,input().split()))
S=[10**10]*(10**6)
DP=[10**10]*(10**6)

for i in range(N):
    S[i]=T[i]    

def chmin(a,b):
    if a>b:
        return b
    else:
        return a

def chmax(a,b):
    if a>b:
        return a
    else:
        return b

DP[0]=0
DP[1]=abs(S[1]-S[0])

for i in range(N):
    for j in range(1,K+1):
        DP[i+j]=chmin(DP[i]+abs(S[i+j]-S[i]),DP[i+j])
    
print(DP[N-1])


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

L=list(map(int,input().split()))
S=[0]*110000
for i in range(N):
    S[i]=L[i]

DP=[10**12]*110000

DP[0]=0
for i in range(N):
    for j in range(1,M+1):
        if DP[i+j]>DP[i]+abs(S[i+j]-S[i]):
            DP[i+j]=DP[i]+abs(S[i+j]-S[i])



print(DP[N-1])

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

L=list(map(int,input().split()))
S=[0]*100010
for i in range(N):
    S[i]=L[i]

DP=[10**12]*100010

DP[0]=0
for i in range(N):
    for j in range(1,M+1):
        if DP[i+j]>DP[i]+abs(S[i+j]-S[i]):
            DP[i+j]=DP[i]+abs(S[i+j]-S[i])



print(DP[N-1])

            

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

L=list(map(int,input().split()))
S=[0]*110000
for i in range(N):
    S[i]=L[i]

DP=[10**12]*110000

DP[0]=0
for i in range(N):
    for j in range(1,M+1):
        if DP[i+j]>DP[i]+abs(S[i+j]-S[i]):
            DP[i+j]=DP[i]+abs(S[i+j]-S[i])



print(DP[N-1])

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())

L=list(map(int,input().split()))
S=[0]*100010
for i in range(N):
    S[i]=L[i]

DP=[10**12]*100010

DP[0]=0
for i in range(N):
    for j in range(1,M+1):
        if DP[i+j]>DP[i]+abs(S[i+j]-S[i]):
            DP[i+j]=DP[i]+abs(S[i+j]-S[i])



print(DP[N-1])

            

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

L=list(map(int,input().split()))
S=[0]*110000
for i in range(N):
    S[i]=L[i]

DP=[10**12]*110000

DP[0]=0
for i in range(N):
    for j in range(1,M+1):
        if DP[i+j]>DP[i]+abs(S[i+j]-S[i]):
            DP[i+j]=DP[i]+abs(S[i+j]-S[i])



print(DP[N-1])
Buggy python submission (verdict: Time Limit Exceeded):
N,W=map(int,input().split())
S = [[0 for j in range(2)] for i in range(N+1)]

DP= [[0]*100010  for i in range(110)]
def chmax(a,b):
    if a>b:
        return a
    else:
        return b


for i in range(N):
    w,v=map(int,input().split())
    S[i][0]=w
    S[i][1]=v


for i in range(N):
    for j in range(W+1):
        if j-S[i][0]>=0:
            
            DP[i+1][j]=chmax(DP[i][j],DP[i][j-S[i][0]]+S[i][1])
        
        else:
            DP[i+1][j]=DP[i][j]
        
print(DP[N][W])


Fixed submission:

N,W=map(int,input().split())


#S = [[0 for j in range(3)] for i in range(2)]　2行3列の場合S

weight=[0]*110
value=[0]*110

S = [[0 for j in range(3)] for i in range(100010)]
DP= [[0 for j in range(100100)] for i in range(110)]

for i in range(N):
    A,B=map(int,input().split())
    weight[i]=A
    value[i]=B
    
for i in range(N):
    for w in range(W+1):
        if w>=weight[i]:
            DP[i+1][w]=max(DP[i][w-weight[i]]+value[i],DP[i][w])
        else:
            DP[i+1][w]=DP[i][w]

print(DP[N][W])
Buggy python submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!


N,M=map(int,input().split())
S=[]
for i in range(M):
    S.append(list(map(int,input().split())))

S1 = sorted(S, key=lambda x: x[1]-x[0])
S1.reverse()
t=0
i=0
j=0
flug=False

while M-t>0 and i<M-t-1:
    j=0
    flug=False
    while M-t>0 and j<M-t-1:
        
        if S1[i][0]<=S1[j][0] and S1[i][1]>=S1[j][1] and i!=j:
            del S1[i]
            t+=1
            print(S1)
            flug=True
            break
        j+=1
    if flug==False:
        i+=1
        
        
x=0
y=1
z=0
count=0
nagasa=len(S)

while nagasa>x+z:
    hikaku=S1[x][1]
    flug=False
    while nagasa>y+z:
        if S1[y][0]<S1[x][1]:
            del S1[y]
            z+=1
            flug=True
        if flug==False:
            y+=1
    x+=1        
            

print(len(S1))


            

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

#S = [[0 for j in range(3)] for i in range(2)]　2行3列の場合
S = [[0 for j in range(2)] for i in range(M)]

for i in range(M):
    X,L=map(int,input().split())
    S[i][0]=X
    S[i][1]=L


T=sorted(S,key=lambda x:x[1])
#U=sorted(T,key=lambda x:x[1])



count=1
last=T[0][1]
#print(T)
for i in range(1,M):
    if T[i][0]>=last:
        count+=1
        last=T[i][1]
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,K=map(int,input().split())
takahashi=A
nakahashi=B
teihashi=C
takahashi1=0
nakahashi1=0
teihashi1=0

if A==B and B==C:
    print("0")
else:
    for i in range(K):
        takahashi1=nakahashi+teihashi
        nakahashi1=takahashi+teihashi
        teihashi1=takahashi+nakahashi
        takahashi=takahashi1
        nakahashi=nakahashi1
        teihashi=teihashi1
    print(takahashi-nakahashi)

Fixed submission:
A,B,C,K=map(int,input().split())
takahashi=A
nakahashi=B
teihashi=C
takahashi1=0
nakahashi1=0
teihashi1=0
unfair=False
if A==B and B==C:
    print("0")
else:
    if K%2==0:
        print(takahashi-nakahashi)
    else:
        print(-(takahashi-nakahashi))
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
K=int(input())
mojiretsu=set()
for i in range(0,len(s)):
    for k in range(1,len(s)+1-i):
        mojiretsu.add(s[i:i+k])
ans=sorted(mojiretsu)
print(ans[K-1])

Fixed submission:
s=input()
K=int(input())
mojiretsu=set()
for i in range(0,len(s)):
    for k in range(1,6):
        mojiretsu.add(s[i:i+k])
ans=sorted(mojiretsu)
print(ans[K-1])
Buggy python submission (verdict: Time Limit Exceeded):
import copy
N=int(input())
X=list(map(int,input().split()))
Y=copy.deepcopy(X)

Z=N//2
for i in range(N):
    
    Y.pop(i)

    Y.sort()
    
    print(Y[Z-1])
    Y=copy.deepcopy(X)
    

Fixed submission:
import copy
N=int(input())
X=list(map(int,input().split()))
Y=copy.deepcopy(X)
Y.sort()
kiteichiA=Y[N//2-1]
kiteichiB=Y[N//2]
for i in range(N):
    if X[i]>=kiteichiB:
        print(kiteichiA)
    elif X[i]<=kiteichiA:
        print(kiteichiB)
Buggy python submission (verdict: Time Limit Exceeded):
import copy
N=int(input())
A=list(map(int,input().split()))


for i in range(N):
    tujyo=0
    S=0

    for k in range(N):
        if i!=k:
            
            tujyo+=abs(A[k]-S)
            S=A[k]
          
    tujyo+=abs(0-S)
    print(tujyo)

Fixed submission:

N=int(input())

A=list(map(int,input().split()))
A=[0]+A+[0]

S=0
tujyo=0
for i in range(N+2):
    
            
    tujyo+=abs(A[i]-S)
    S=A[i]
          


for k in range(1,N+1):
    mae=A[k-1]
    usiro=A[k+1]
    if mae<= A[k]<=usiro or usiro<= A[k]<=mae:
        print(tujyo)
    else:
        print(tujyo-abs(A[k]-mae)-abs(usiro-A[k])+abs(usiro-mae))
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
n,H=map(int,input().split())
S=[]
for i in range(n):
    
    S.append(list(map(int,input().split())))
    
a=[]
b=[]
for i in range(n):
    a.append(S[i][0])
    
for i in range(n):
    if(max(a)<S[i][1]):
        b.append(S[i][1])

b.sort()
b.reverse()
k=0
count=0
while H>0:
    if len(b)>k:
        H-=b[k]
        k+=1
        count+=1
    else:
        
        count+=H//max(a)
        if(H%max(a)!=0):
            count+=1
        H=0

print(count)


Fixed submission:
# coding: utf-8
# Your code here!
n,H=map(int,input().split())
S=[]
for i in range(n):
    
    S.append(list(map(int,input().split())))
    
a=[]
b=[]
for i in range(n):
    a.append(S[i][0])

maxa=max(a)    
for i in range(n):
    if(maxa<S[i][1]):
        b.append(S[i][1])

b.sort()
b.reverse()
k=0
count=0
lenb=len(b)
while H>0:
    if lenb>k:
        H-=b[k]
        k+=1
        count+=1
    else:
        
        count+=H//maxa
        if(H%maxa!=0):
            count+=1
        H=0

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
n,H=map(int,input().split())
S=[]
for i in range(n):
    
    S.append(list(map(int,input().split())))
    
a=[]
b=[]
for i in range(n):
    a.append(S[i][0])
    
for i in range(n):
    if(max(a)<S[i][1]):
        b.append(S[i][1])

b.sort()
b.reverse()
k=0
count=0
while H>0:
    if len(b)>k:
        H-=b[k]
        k+=1
        count+=1
    else:
        
        count+=H//max(a)
        if(H%max(a)!=0):
            count+=1
        H=0

print(count)


Fixed submission:
# coding: utf-8
# Your code here!
n,H=map(int,input().split())
S=[]
for i in range(n):
    
    S.append(list(map(int,input().split())))
    
a=[]
b=[]
for i in range(n):
    a.append(S[i][0])

maxa=max(a)    
for i in range(n):
    if(maxa<S[i][1]):
        b.append(S[i][1])

b.sort()
b.reverse()
k=0
count=0
lenb=len(b)
while H>0:
    if lenb>k:
        H-=b[k]
        k+=1
        count+=1
    else:
        
        count+=H//maxa
        if(H%maxa!=0):
            count+=1
        H=0

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
A.reverse()
B.reverse()
C.reverse()

ue=0
naka=0
sita=0
count=0
for i in range(N):
    ue=A[i]
    for j in range(N):
        naka=B[j]
        if ue>=naka:
            break
        for k in range(N):
            
            sita=C[k]
            if A[i]<B[j] and B[j]<C[k]:
                count+=1
            if naka>=sita:
                break
            
print(count)

Fixed submission:
N=int(input())
S=list(map(int,input().split()))
T=list(map(int,input().split()))
U=list(map(int,input().split()))
S.sort()
T.sort()
U.sort()
#print(S)
#print(T)
#print(U)


count=0
def is_ok(index,key):
    if key>S[index]:
        return True
    else:
        return False


def meguru_bisect(key):
    ng=N
    ok=-1
    
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid,key):
            ok = mid
        else:
            ng = mid
    return ok

def is_ok2(index,key):
    if key<U[index]:
        return True
    else:
        return False


def meguru_bisect2(key):
    ng=-1
    ok=N
    
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok2(mid,key):
            ok = mid
        else:
            ng = mid
    return ok
ans=0
for i in range(N):
    ans+=(N-meguru_bisect2(T[i]))*(meguru_bisect(T[i])+1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
ANi=input().split()
AN=list(map(int,ANi))


Xhairetsu={}


for i in range(len(AN)):
    for X in range(1,10**5):
        if AN[i]<=X+1 and AN[i]>=X-1 and X  not in Xhairetsu.keys():
            Xhairetsu[X]=1
        elif AN[i]<=X+1 and AN[i]>=X-1 and X in Xhairetsu.keys():
            Xhairetsu[X]+=1
        
print(max(Xhairetsu.values()))

Fixed submission:
N=int(input())
ANi=input().split()
AN=list(map(int,ANi))

Whairetsu={}
Xhairetsu={}
Yhairetsu={}


for i in range(len(AN)):
    if AN[i] not in Xhairetsu.keys():
        Xhairetsu[AN[i]]=1
    elif AN[i] in Xhairetsu.keys():
        Xhairetsu[AN[i]]+=1
    
    if AN[i] -1 not in Whairetsu.keys():
        Whairetsu[AN[i]-1]=1
    elif AN[i]-1 in Whairetsu.keys():
        Whairetsu[AN[i]-1]+=1
    
    if AN[i] +1 not in Yhairetsu.keys():
        Yhairetsu[AN[i]+1]=1
    elif AN[i]+1 in Yhairetsu.keys():
        Yhairetsu[AN[i]+1]+=1
    


anshairetsu={}
for i in range(10**5+1):
    if i in Whairetsu.keys():
        if i in anshairetsu.keys():
            anshairetsu[i]+=Whairetsu[i]
        else:
            anshairetsu[i]=Whairetsu[i]
            
    if i in Xhairetsu.keys():
        if i in anshairetsu.keys():
            anshairetsu[i]+=Xhairetsu[i]
        else:
            anshairetsu[i]=Xhairetsu[i]
            
    if i in Yhairetsu.keys():
        if i in anshairetsu.keys():
            anshairetsu[i]+=Yhairetsu[i]
        else:
            anshairetsu[i]=Yhairetsu[i]
print(max(anshairetsu.values()))
Buggy python submission (verdict: Runtime Error):
import fractions

N=int(input())
S=[]
for i in range(N):
    S.append(int(input()))


def koubaisu(a,b):
    return a*b//fractions.gcd(a,b)
ans=koubaisu(S[0],S[1])

if N>2:
    for i in range(N-2):
        ans=koubaisu(ans,S[i+2])
else:
    pass
print(ans)

Fixed submission:
import fractions

N=int(input())
S=[]
for i in range(N):
    S.append(int(input()))


def koubaisu(a,b):
    return a*b//fractions.gcd(a,b)

ans=1

if N==1:
    print(S[0])
    exit()
elif N==2:
    ans=koubaisu(S[0],S[1])
    print(ans)
    exit()
elif N>2:
    ans=koubaisu(S[0],S[1])
    for i in range(N-2):
        ans=koubaisu(ans,S[i+2])

print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())

S=list(map(int,input().split()))

div1=0
div2=0
div4=0
lenS=len(S)

for i in range(N):
    if S[i]%4==0:
        div4+=1
    elif S[i]%2==0:
        div2+=1
    else:
        div1+=1

if lenS%2==0:

    if div4*2+div2>=lenS:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
else:
    
    if (div4*2+1)>=lenS:
        print("Yes")
        exit()
    elif div4*2+div2>=lens:
        print("Yes")
        exit()
    else:
        print("No")




Fixed submission:
N=int(input())

S=list(map(int,input().split()))

div1=0
div2=0
div4=0
lenS=len(S)

for i in range(N):
    if S[i]%4==0:
        div4+=1
    elif S[i]%2==0:
        div2+=1
    else:
        div1+=1

if lenS%2==0:

    if div4*2+div2>=lenS:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
else:
    
    if (div4*2+1)>=lenS:
        print("Yes")
        exit()
    elif div4*2+div2>=lenS:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
count=0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x+y+z == S:
                count+=1
print(count)

Fixed submission:
K,S=map(int,input().split())
count=0
for x in range(K+1):
    for y in range(K+1):
        z=S-x-y
        if z>=0 and z<=K:
            count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(map(int,input().split()))
lenS=len(S)
T=[]
for i in range(1,N+1):
    T.append(abs(i-(N+1-i)))

T.sort()
S.sort()



for i in range(N):
    if T!=S:
        print(0)
        exit()


ans=1
nagasa=lenS//2
for i in range(nagasa):
    
    ans=(ans*2)%(10**9+7)

print(ans)


    

Fixed submission:
N=int(input())
S=list(map(int,input().split()))
lenS=len(S)
T=[]
for i in range(1,N+1):
    T.append(abs(i-(N+1-i)))

T.sort()
S.sort()



for i in range(N):
    if T[i]!=S[i]:
        print(0)
        exit()


ans=1
nagasa=lenS//2
for i in range(nagasa):
    
    ans=(ans*2)%(10**9+7)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(map(int,input().split()))
lenS=len(S)
T=[]
for i in range(1,N+1):
    T.append(abs(i-(N+1-i)))

T.sort()
S.sort()

def mal(a):
    return (a*2)%(10**9+7)

for i in range(N):
    if T!=S:
        print(0)
        exit()


ans=1
for i in range(lenS//2):
    
    ans=mal(ans)

print(ans)


    

Fixed submission:
N=int(input())
S=list(map(int,input().split()))
lenS=len(S)
T=[]
for i in range(1,N+1):
    T.append(abs(i-(N+1-i)))

T.sort()
S.sort()



for i in range(N):
    if T[i]!=S[i]:
        print(0)
        exit()


ans=1
nagasa=lenS//2
for i in range(nagasa):
    
    ans=(ans*2)%(10**9+7)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=list(map(int,input().split()))
lenS=len(S)
T=[]
for i in range(1,N+1):
    T.append(abs(i-(N+1-i)))

T.sort()
S.sort()

def mal(a):
    return (a*2)%(10**9+7)

for i in range(N):
    if T!=S:
        print(0)
        exit()


ans=1
for i in range(lenS//2):
    
    ans=mal(ans)

print(ans)


    

Fixed submission:
N=int(input())
S=list(map(int,input().split()))
lenS=len(S)
T=[]
for i in range(1,N+1):
    T.append(abs(i-(N+1-i)))

T.sort()
S.sort()



for i in range(N):
    if T[i]!=S[i]:
        print(0)
        exit()


ans=1
nagasa=lenS//2
for i in range(nagasa):
    
    ans=(ans*2)%(10**9+7)

print(ans)
Buggy python submission (verdict: Runtime Error):
from sys import stdin, stdout
import sys
import bisect
INF=1e9
def get_int(): return int(stdin.readline().strip())
def get_ints(): return map(int,stdin.readline().strip().split()) 
def get_array(): return list(map(int,stdin.readline().strip().split()))
def get_string(): return stdin.readline().strip()
def op(c): return stdout.write(c)
#from collections import defaultdict 
#for _ in range(int(stdin.readline())):
x=get_array()
for i in range(len(x):
    if x[i]==0:
        print(i+1)

Fixed submission:
from sys import stdin, stdout
import sys
import bisect
INF=1e9
def get_int(): return int(stdin.readline().strip())
def get_ints(): return map(int,stdin.readline().strip().split()) 
def get_array(): return list(map(int,stdin.readline().strip().split()))
def get_string(): return stdin.readline().strip()
def op(c): return stdout.write(c)
#from collections import defaultdict 
#for _ in range(int(stdin.readline())):
x=get_array()
for i in range(len(x)):
    if x[i]==0:
        print(i+1)

Buggy python submission (verdict: Runtime Error):
from sys import stdin, stdout
import sys
import bisect
INF=1e9
def get_int(): return int(stdin.readline().strip())
def get_ints(): return map(int,stdin.readline().strip().split()) 
def get_array(): return list(map(int,stdin.readline().strip().split()))
def get_string(): return stdin.readline().strip()
def op(c): return stdout.write(c)
#from collections import defaultdict 
#for _ in range(int(stdin.readline())):
x=get_array()
for i in range(x):
    if x[i]==0:
        print(i+1)

Fixed submission:
from sys import stdin, stdout
import sys
import bisect
INF=1e9
def get_int(): return int(stdin.readline().strip())
def get_ints(): return map(int,stdin.readline().strip().split()) 
def get_array(): return list(map(int,stdin.readline().strip().split()))
def get_string(): return stdin.readline().strip()
def op(c): return stdout.write(c)
#from collections import defaultdict 
#for _ in range(int(stdin.readline())):
x=get_array()
for i in range(len(x)):
    if x[i]==0:
        print(i+1)
Buggy python submission (verdict: Runtime Error):
A,B,K = map(int, input().split())

if A+B<=K:
  print('0 0')
elif A<=K:
  print('0 {}'.format(B-K+A))
else:
  print('{} {}'.format(A-X,B))

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

if A+B<=K:
  print('0 0')
elif A<=K:
  print('0 {}'.format(B-K+A))
else:
  print('{} {}'.format(A-K,B))

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

if A+B<K:
  print('0 0')
elif A<K:
  print('0 {}'.format(B-K+A))
else:
  print('{} {}'.format(A-X,B))
  

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

if A+B<=K:
  print('0 0')
elif A<=K:
  print('0 {}'.format(B-K+A))
else:
  print('{} {}'.format(A-K,B))
Buggy python submission (verdict: Runtime Error):
def main():    
    n,m = map(int,input().split())

    a_list = list(map(int,input().split()))
    total = 0

    for i in range(m):
        b,c = map(int,input().split())
        a_list.extend([c]*b)

    a_list.sort(reverse=True)
    print(sum(a_list[:n]))

if __name__ == '__main__':
    main()

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


if a<=5:
    fee = 0
elif a>=13:
    fee = b
else:
    fee = b//2

print(fee)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

kyotu_s = {k for k in range(1,n+1)}

for i in range(m):
    l,r = map(int,input().split())
    s = {j for j in range(l,r+1)}
    kyotu_s = s & kyotu_s
    if len(kyotu_s)==0:
        break

print(len(kyotu_s))

Fixed submission:
n,m = map(int,input().split())

min_i = 1
max_i = n

for i in range(m):
    l,r = map(int,input().split())
    min_i = max(min_i,l)
    max_i = min(max_i,r)

if max_i-min_i>=0:
    print(max_i-min_i+1)
else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())

kyotu_s = {k for k in range(1,n+1)}

for i in range(m):
    l,r = map(int,input().split())
    s = {j for j in range(l,r+1)}
    kyotu_s = s & kyotu_s

print(len(kyotu_s))

Fixed submission:
n,m = map(int,input().split())

min_i = 1
max_i = n

for i in range(m):
    l,r = map(int,input().split())
    min_i = max(min_i,l)
    max_i = min(max_i,r)

if max_i-min_i>=0:
    print(max_i-min_i+1)
else:
    print(0)