Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(n,q,s,l):
    lst_ac = [0]*(len(s)-1)
    for i in range(len(s)-1):
        if s[i]+s[i+1] == "AC":
            lst_ac[i] = 1
    for item in l:
        print(sum(lst_ac[item[0]-1:item[1]-1]))

def resolve():
    n,q = mi()
    s = input()
    l = mix(q)
    main(n,q,s,l)

if __name__ == "__main__":
    resolve()

Fixed submission:
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(n,q,s,l):
    lst_ac = [0]*(len(s))
    for i in range(len(s)-1):
        if s[i]+s[i+1] == "AC":
            lst_ac[i+1] = lst_ac[i]+1
        else:
            lst_ac[i+1] = lst_ac[i]
    for item in l:
        print(lst_ac[item[1]-1] - lst_ac[item[0]-1])

def resolve():
    n,q = mi()
    s = input()
    l = mix(q)
    main(n,q,s,l)

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(n,q,s,l):
    res = []
    for i in l:
        c = 0
        tar = s[i[0]-1:i[1]]
        for j in range(len(tar)-1):
            if tar[j]=="A" and tar[j+1]=="C":
                c += 1
        res.append(c)
    for ans in res:
        print(ans)

def resolve():
    n,q = mi()
    s = input()
    l = mix(q)
    main(n,q,s,l)

if __name__ == "__main__":
    resolve()

Fixed submission:
ii = lambda:int(input())
mi = lambda:list(map(int,input().split()))
ix = lambda x:list(input() for _ in range(x))
mix = lambda x:list(mi() for _ in range(x))
iix = lambda x:list(int(input()) for _ in range(x))
##########
def main(n,q,s,l):
    lst_ac = [0]*(len(s))
    for i in range(len(s)-1):
        if s[i]+s[i+1] == "AC":
            lst_ac[i+1] = lst_ac[i]+1
        else:
            lst_ac[i+1] = lst_ac[i]
    for item in l:
        print(lst_ac[item[1]-1] - lst_ac[item[0]-1])

def resolve():
    n,q = mi()
    s = input()
    l = mix(q)
    main(n,q,s,l)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
def main(n,k,h):
    #初期化
    inf = 2**31 -1
    dp = [inf] * n
    dp[0] = 0
    #現在の足場
    for i in range(n):
        #ジャンプする距離
        for j in range(1, k+1):
            #ジャンプ先が範囲外ならスキップ
            if n-1 < i+j:
                break
            #dpマップに値を配る
            dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j] - h[i]))
    return dp[-1]

n,k = map(int,input().split())
h = list(map(int,input().split()))
print(main(n,k,h))

Fixed submission:
def main2(N,h,K):
    dp = [0] * N
    for i in range(1,N):
        dp[i] = min([dp[j] + abs(h[i] - h[j]) for j in range(max(0, i-K), i)])
    return dp[-1]

N, K = map(int, input().split())
h = list(map(int, input().split()))
print(main2(N,h,K))

Buggy python submission (verdict: Time Limit Exceeded):
def main2(N,h,K):
    inf = 2**31 -1
    dp = [inf] * N
    dp[0] = 0
    for i in range(1, N):
        for k in range(1, K+1):
            if i-k >= 0:
                dp[i] = min(dp[i], dp[i-k] + abs(h[i-k] - h[i]))
            else:
                break
    return dp[N-1]

N, K = map(int, input().split())
h = list(map(int, input().split()))

print(main2(N,h,K))

Fixed submission:
def main2(N,h,K):
    dp = [0] * N
    for i in range(1,N):
        dp[i] = min([dp[j] + abs(h[i] - h[j]) for j in range(max(0, i-K), i)])
    return dp[-1]

N, K = map(int, input().split())
h = list(map(int, input().split()))
print(main2(N,h,K))

Buggy python submission (verdict: Time Limit Exceeded):
def main(N,h,K):
    inf = 2**31 - 1
    dp = [inf] * N
    dp[0] = 0
    for i in range(N-1):
        for k in range(1, K+1):
            if i+k < N:
                dp[i+k] = min(dp[i+k], dp[i] + abs(h[i] - h[i+k]))
            else:
                break
    return dp[N-1]

N, K = map(int, input().split())
h = list(map(int, input().split()))

print(main(N,h,K))

Fixed submission:
def main2(N,h,K):
    dp = [0] * N
    for i in range(1,N):
        dp[i] = min([dp[j] + abs(h[i] - h[j]) for j in range(max(0, i-K), i)])
    return dp[-1]

N, K = map(int, input().split())
h = list(map(int, input().split()))
print(main2(N,h,K))

Buggy python submission (verdict: Time Limit Exceeded):
def main(N,h,K):
    inf = 2**31 - 1
    dp = [inf] * N
    dp[0] = 0
    for i in range(N-1):
        for k in range(1, K+1):
            if i+k < N:
                dp[i+k] = min(dp[i+k], dp[i] + abs(h[i] - h[i+k]))
    return dp[N-1]

N, K = map(int, input().split())
h = list(map(int, input().split()))

print(main(N,h,K))

Fixed submission:
def main2(N,h,K):
    dp = [0] * N
    for i in range(1,N):
        dp[i] = min([dp[j] + abs(h[i] - h[j]) for j in range(max(0, i-K), i)])
    return dp[-1]

N, K = map(int, input().split())
h = list(map(int, input().split()))
print(main2(N,h,K))
Buggy python submission (verdict: Time Limit Exceeded):
def main(n,w,item):
    #dp[i][sum_w]:i-1番目までの品物から重さsum_wを超えないように
    #選択した場合の価値の最大値
    dp = [[0]*(w+1) for _ in range(n+1)]
    for i in range(n):
        for j in range(w+1):
            #選択する場合
            weight, value = item[i]
            if j+weight <= w:
                dp[i+1][j+weight] = max(dp[i+1][j+weight], dp[i][j]+value)
            #選択しない場合
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])
    return max(dp[-1])

n,w = map(int, input().split())
item = [list(map(int, input().split())) for _ in range(n)]
print(main(n,w,item))

Fixed submission:
def main(n,w,item):
    #dp[i][sum_w]:i-1番目までの品物から重さsum_wを超えないように
    #選択した場合の価値の最大値
    dp = [[0]*(w+1) for _ in range(n+1)]
    for i in range(n):
        for j in range(w+1):
            #選択する場合
            weight, value = item[i]
            if j+weight <= w:
                dp[i+1][j+weight] = max(dp[i+1][j+weight], dp[i][j]+value)
            #選択しない場合
            dp[i+1][j] = max(dp[i+1][j], dp[i][j])
    return max(dp[-1])

n,w = map(int, input().split())
item = [list(map(int, input().split())) for _ in range(n)]
print(main(n,w,item))
Buggy python submission (verdict: Runtime Error):
a = [int(x) for x in input().split()]
count1=0
count0=0
count2=0
if a[3]>a[1]:
   count1=a[0]
if a[3]<=a[1]:
    count1=a[3]
if a[3]-a[1]-a[0]>0:
    count2=-(a[3]-a[1]-a[0])
print(count1+count2)


Fixed submission:
X = input()
Y = input()
if X==Y[:-1]:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A=[int(x) for x in input().split()]
k=0
if N==1:
    print("OK")
else:
     if A[0]//int(N) == A[1]//int(N) and A[0]%int(N)==A[1]%int(N) and A[0]%int(N)==0 :
        print("OK")
    elif A[0]//int(N) != A[1]//int(N) and A[0]%int(N)!=0 :
        print("OK")
     else:
        print("NG")


Fixed submission:
N = int(input())
A=[int(x) for x in input().split()]
k=0
if N==1:
    print("OK")
else:
     if A[0]//int(N) == A[1]//int(N)  and A[0]%int(N)!=0  and A[1]%int(N)!=0:
        print("NG")
     else:
         print("OK")
Buggy python submission (verdict: Runtime Error):
N=[int(x) for x in input().split()]
if not N[2]%N[1]==0:
   c=N[2]//N[1]+1
else:
    c=N[2]//N[1]
if not N[0]%N[3]==0:
   d=N[0]//N[3]+1
else:
    d=N[0]//N[3]
if d>=c:
    print("Yes")
else:
    print("No")


Fixed submission:
N=[int(x) for x in input().split()]
if N[0]>N[1]:
    print("safe")
else:
   print("unsafe")

Buggy python submission (verdict: Runtime Error):
N=[int(x) for x in input().split()]
if not N[2]%N[1]==0:
   c=N[2]//N[1]+1
else:
    c=N[2]//N[1]
if not N[0]%N[3]==0:
   c=N[0]//N[3]+1

   d=N[0]//N[3]+1
else:
    d=N[0]//N[3]
if d>c:
    print("Yes")
else:
    print("No")

Fixed submission:
N=[int(x) for x in input().split()]
if N[0]>N[1]:
    print("safe")
else:
   print("unsafe")

Buggy python submission (verdict: Runtime Error):
N=[int(x) for x in input().split()]
if not N[2]%N[1]==0:
   c=N[2]//N[1]+1
else:
    c=N[2]//N[1]
if not N[0]%N[3]==0:
   c=N[0]//N[3]+1

   d=N[0]//N[3]+1
else:
    d=N[0]//N[3]
if d>=c:
    print("Yes")
else:
    print("No")

Fixed submission:
N=[int(x) for x in input().split()]
if N[0]>N[1]:
    print("safe")
else:
   print("unsafe")

Buggy python submission (verdict: Runtime Error):
N=[int(x) for x in input().split()]
if not N[2]%N[1]==0:
   c=N[2]//N[1]+1
else:
    c=N[2]//N[1]

if not N[0]%N[3]==0:
   c=N[0]//N[3]+1

   d=N[0]//N[3]+1
else:
    d=N[0]//N[3]
if d>=c:
    print("Yes")
else:
    print("No")

Fixed submission:
N=[int(x) for x in input().split()]
if N[0]>N[1]:
    print("safe")
else:
   print("unsafe")

Buggy python submission (verdict: Runtime Error):
N=[int(x) for x in input().split()]
if N[0]/2=>N[1]:
    print("safe")
else:
   print("unsafe")

Fixed submission:
N=[int(x) for x in input().split()]
if N[0]>N[1]:
    print("safe")
else:
   print("unsafe")
Buggy python submission (verdict: Runtime Error):
N=[int(x) for x in input().split()]
if not N[2]%N[1]==0:
   c=N[2]//N[1]+1
else:
    c=N[2]//N[1]
if not N[0]%N[3]==0:
   c=N[0]//N[3]+1

   d=N[0]//N[3]+1
else:
    d=N[0]//N[3]
if d=>c:
    print("Yes")
else:
    print("No")

Fixed submission:
N=[int(x) for x in input().split()]
if not N[2]%N[1]==0:
   c=N[2]//N[1]+1
else:
    c=N[2]//N[1]
if not N[0]%N[3]==0:
   d=N[0]//N[3]+1
else:
    d=N[0]//N[3]
if d>=c:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n,  = map(int, input().split())
A = [int(x) for x in input().split()]
freq=[]
k=1
for k in range(n):
    freq.append(k+1)
count=0
for k in range(n):
    for j in range(n-1):
        if A[j]==freq[k]:
           count=count+1
    print(count)
    count=0


Fixed submission:
import math
N=int(input())
PI=math.pi
print(2.0*PI*N)

Buggy python submission (verdict: Runtime Error):
N=[int(x) for x in input().split()]
A=[int(x) for x in input().split()]
sum=0
for a in range(N[1]):
    sum=sum+A[a]
if N[0]-sum)>=0:
   print(N[0]-sum)
else:
   print(-1)

Fixed submission:
import math
N=int(input())
PI=math.pi
print(2.0*PI*N)

Buggy python submission (verdict: Runtime Error):
N=[int(x) for x in input().split()]
A=[int(x) for x in input().split()]
sum=0
for a in range(N[1]):
    sum=sum+A[a]
if sum>=0:
   print(N[0]-sum)
else:
   print(-1)


Fixed submission:
import math
N=int(input())
PI=math.pi
print(2.0*PI*N)

Buggy python submission (verdict: Runtime Error):
import math
N=[int(x) for x in input().split()]
print(2*math.pi*r)

Fixed submission:
import math
N=int(input())
PI=math.pi
print(2.0*PI*N)
Buggy python submission (verdict: Runtime Error):
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N=[int(x) for x in input().split()]
if N[1]==1:
  sum1=0
else:
  sum1 = comb(N[1], 2)
if N[0]==1:
  sum2=0
else:
    sum2 = comb(N[0], 2)
print(sum1+sum2)

Fixed submission:
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N=[int(x) for x in input().split()]
if N[1]==1 or N[1]==0:
  sum1=0
else:
  sum1 = comb(N[1], 2)
if N[0]==1 or N[0]==0:
  sum2=0
else:
    sum2 = comb(N[0], 2)
print(sum1+sum2)

Buggy python submission (verdict: Runtime Error):
from scipy.special import comb
N=[int(x) for x in input().split()]
if N[1]==1:
  sum1=0
else:
  sum1 = comb(N[1], 2, exact=True)
if N[0]==1:
  sum2=0
else:
    sum2 = comb(N[0], 2, exact=True)
print(sum1+sum2)

Fixed submission:
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N=[int(x) for x in input().split()]
if N[1]==1 or N[1]==0:
  sum1=0
else:
  sum1 = comb(N[1], 2)
if N[0]==1 or N[0]==0:
  sum2=0
else:
    sum2 = comb(N[0], 2)
print(sum1+sum2)

Buggy python submission (verdict: Runtime Error):
from scipy.special import comb
N=[int(x) for x in input().split()]
if N[1]==1:
  sum1=0
else:
  sum1 = comb(N[1], 2, exact=True)
if N[0]==1:
  sum2=0
else:
    sum2 = comb(N[0], 2, exact=True)
print(sum1+sum2)

Fixed submission:
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N=[int(x) for x in input().split()]
if N[1]==1 or N[1]==0:
  sum1=0
else:
  sum1 = comb(N[1], 2)
if N[0]==1 or N[0]==0:
  sum2=0
else:
    sum2 = comb(N[0], 2)
print(sum1+sum2)

Buggy python submission (verdict: Runtime Error):
from scipy.special import comb
N=[int(x) for x in input().split()]
if N[1]==1:
  sum1=0
else:
  sum1 = comb(N[1], 2, exact=True)
if N[0]==1:
  sum2=0
else:
    sum2 = comb(N[0], 2, exact=True)
print(sum1+sum2)

Fixed submission:
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
N=[int(x) for x in input().split()]
if N[1]==1 or N[1]==0:
  sum1=0
else:
  sum1 = comb(N[1], 2)
if N[0]==1 or N[0]==0:
  sum2=0
else:
    sum2 = comb(N[0], 2)
print(sum1+sum2)
Buggy python submission (verdict: Runtime Error):
N = input()
A = list(map(str, input().split()))
B=[]
C=[]
l=[]
m=[]
i=0
for a in range(int(N)):
    if int(A[a])%2==0:
       B.append(A[a])
       i=i+1
for a in range(int(i)):
    if not int(B[a])%3==0 or int(B[a])%5==0:
       C=1
    else:
       C=0
if C==1:
   print("DENIED")
else:
   print("APPROVED")

Fixed submission:
A = list(map(str, input().split()))
m=set(A)
s=len(m)
if s==2:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
N = input()
A = list(map(str, input().split()))
B=[]
l=[]
m=[]
i=0
for a in range(int(N)):
    if int(A[a])%2==0:
       B.append(A[a])
       i=i+1
for a in range(int(i)):
    if not int(B[a])%3==0 or int(B[a])%5==0:
       C.append(B[a])
    else:
       C=[0]
if C==0:
   print("DENIED")
else:
   print("APPROVED")

Fixed submission:
N = input()
A = list(map(str, input().split()))
B=[]
C=[]
l=[]
m=[]
n=0
i=0
for a in range(int(N)):
    if int(A[a])%2==0:
       B.append(A[a])
       i=i+1
for a in range(int(i)):
    if int(B[a])%3==0 or int(B[a])%5==0:
       n=n+1
if n==i:
   print("APPROVED")
else:
   print("DENIED")
Buggy python submission (verdict: Runtime Error):
N = str(input())
if N=="SAT":
  print("1")
if N=="FRY":
  print("2")
if N=="THU":
  print("3")
if N=="WED":
  print("4")
if N=="TUE":
  print("5")
if N=="MON":
  print("6")
if N=="SUN":
  print("7")


Fixed submission:
N = str(input())
if N=="SAT":
  print("1")
elif N=="FRI":
  print("2")
elif N=="THU":
  print("3")
elif N=="WED":
  print("4")
elif N=="TUE":
  print("5")
elif N=="MON":
  print("6")
else:
  print("7")
Buggy python submission (verdict: Runtime Error):
N = input()
S = input()
T = S[0:N/2]
Q=T+T
if S in Q:
    print("Yes")
else:
    print("No")

Fixed submission:
N = int(input())
print(N*N)
Buggy python submission (verdict: Runtime Error):
N = int(input()) #入力値
lists = []
Bob=0
Alice=0

for i in range(0,N):
    A = input()
    lists.append(A) #入力した値をどんどん入れていく
    
lists.reverse() #入力した値ソート

for j in range(0,N):
      if j % 2 == 0: # Bobが偶数なら実行
         Bob=Bob+int(lists[j])
      else:
         Alice=Alice+int(lists[j])
print(Alice-Bob)

Fixed submission:
N = int(input()) #入力値
A = sorted(map(int, input().split()), reverse = True)
Bob=0
Alice=0
for i in range(0,N):
      if i % 2 == 0: # Bobが偶数なら実行
         Alice=Alice+int(A[i])
      else:
         Bob=Bob+int(A[i])
print(Alice-Bob)
Buggy python submission (verdict: Runtime Error):
n,A,B=map(int,input().split())
if A+2>=B:
  ans=bis+n
else:

  print("A n",A,n)
  if (n+1)>=(A+2):
    en+=(n+1)//(A+2)
    n-=en*(A+2)-1
    print(bis,en,n)
    #交換
    bis=en*B
    en=0
    print("交換",bis,en,n)
  if n==0:
    ans=bis
  else:
    ans=bis+n
  
print(ans)

Fixed submission:
b,c=map(int,input().split())
  
if (b//2+b%2)>=c:
    print("YES")
else : print("NO")

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

  print("A n",A,n)
  if (n+1)>=(A+2):
    en+=(n+1)//(A+2)
    n-=en*(A+2)-1
    print(bis,en,n)
    #交換
    bis=en*B
    en=0
    print("交換",bis,en,n)
  if n==0:
    ans=bis
  else:
    ans=bis+n
  
print(ans)

Fixed submission:
b,c=map(int,input().split())
  
if (b//2+b%2)>=c:
    print("YES")
else : print("NO")

Buggy python submission (verdict: Runtime Error):
b,c=map(input().split())
  
if (b//2+b%2)>=c:
    print("YES")
else : print("NO")

Fixed submission:
b,c=map(int,input().split())
  
if (b//2+b%2)>=c:
    print("YES")
else : print("NO")

Buggy python submission (verdict: Runtime Error):
b,c=map(input().split())
  
  if (b//2+b%2)>=c:
    print("YES")
  else : print("NO")

Fixed submission:
b,c=map(int,input().split())
  
if (b//2+b%2)>=c:
    print("YES")
else : print("NO")
Buggy python submission (verdict: Runtime Error):
s = input()
a = [int(c) for c in s]

if a[-3] != 0:
    ans = int(s) - (a[-4]*1000)
else:
    ans = 0

print(ans)

Fixed submission:
s = input()
a = [int(c) for c in s]


if len(a) < 4:
    print(1000 - int(s))
elif a[-3] != 0:
    print((a[-4]+1)*1000 - int(s))
elif int(s) % 1000 != 0:
    print((a[-4]+1)*1000 - int(s))
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
line = input().split()
n, m, k = int(line[0]), int(line[1]), int(line[2])
line = input().split()
a = [None] * n
for i in range(n):
    a[i] = int(line[i])
line = input().split()
b = [None] * m
for i in range(m):
    b[i] = int(line[i])

time = [[0 for j in range(n+1)] for i in range(m+1)]
for i in range(1,n+1):
    time[0][i] = time[0][i-1] + a[i-1]
for j in range(1,m+1):
    time[j][0] = time[j-1][0] + b[j-1]
ans = 0
for i in range(1,n+1):
    for j in range(1,m+1):
        if time[j-1][i-1] + a[i-1] > k or time[j-1][i-1] + b[i-1] > k or time[j-1][i-1] + a[i-1] + b[j-1] > k:
            break
        else:
            time[j][i] = time[j-1][i-1] + a[i-1] + b[j-1]
            ans = max(ans, i+j)
print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
def line_to_int(): return int(sys.stdin.readline())
def line_to_each_int(): return map(int, sys.stdin.readline().split())
def line_to_list(): return list(map(int, sys.stdin.readline().split()))
def line_to_list_in_iteration(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
# def dp(init, i, j): return [[init]*i for i2 in range(j)]
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #A = [0]+list(accumulate(A))
import bisect #bisect.bisect_left(B, a), bisect.bisect_right(B,a)

n,m,k = line_to_each_int()
A = line_to_list()
B = line_to_list()

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

ans, j = 0, m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**8)
def line_to_int(): return int(sys.stdin.readline())
def line_to_each_int(): return map(int, sys.stdin.readline().split())
def line_to_list(): return list(map(int, sys.stdin.readline().split()))
def line_to_list_in_iteration(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
# def dp(init, i, j): return [[init]*i for i2 in range(j)]
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
# from itertools import accumulate #A = [0]+list(accumulate(A))
# import bisect #bisect.bisect_left(B, a), bisect.bisect_right(B,a)

n, k = line_to_each_int()
p = line_to_list()

p = sorted(p)
ans = 0
for i in range(k):
    ans += p[i]
print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(10**8)
def line_to_int(): return int(sys.stdin.readline())
def line_to_each_int(): return map(int, sys.stdin.readline().split())
def line_to_list(): return list(map(int, sys.stdin.readline().split()))
def line_to_list_in_iteration(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
# def dp(init, i, j): return [[init]*i for i2 in range(j)]
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
# from itertools import accumulate #A = [0]+list(accumulate(A))
# import bisect #bisect.bisect_left(B, a), bisect.bisect_right(B,a)

x = line_to_list()
print(x.index(0)+1)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
data = stdin.readline().split()
N, M = int(data[0]), int(data[1])
a = [None] * M
fib = [None] * N
for i in range(M):
    a[i] = int(stdin.readline().rstrip())
    fib[a[i] - 1] = 0
    if i > 0 and a[i] - a[i-1] == 1:
        print(0)
        exit()
if not 1 in a:
    fib[0] = 1
    if not 2 in a:
        fib[1] = 2
    else:
        fib[1] = 0
else:
    fib[0] = 0
    fib[1] = 1
for i in range(2,N):
    if fib[i] == 0:
        continue
    else:
        fib[i] = fib[i-1] + fib[i-2]
# print(fib)
print(fib[N-1] % 1000000007)

Fixed submission:
from sys import stdin
data = stdin.readline().split()
N, M = int(data[0]), int(data[1])
a = [None] * M
fib = [None] * N
if N == 1:
    print(1)
    exit()
for i in range(M):
    a[i] = int(stdin.readline().rstrip())
    fib[a[i] - 1] = 0
    if i > 0 and a[i] - a[i-1] == 1:
        print(0)
        exit()
if not 1 in a:
    fib[0] = 1
    if not 2 in a:
        fib[1] = 2
    else:
        fib[1] = 0
else:
    fib[0] = 0
    fib[1] = 1
for i in range(2,N):
    if fib[i] == 0:
        continue
    else:
        fib[i] = fib[i-1] + fib[i-2]
# print(fib)
print(fib[N-1] % 1000000007)

Buggy python submission (verdict: Runtime Error):
from sys import stdin
data = stdin.readline().split()
N, M = int(data[0]), int(data[1])
a = [None] * M
for i in range(M):
    a[i] = int(stdin.readline().rstrip())
    if i > 0 and a[i] - a[i-1] == 1:
        print(0)
        exit()
fib = [None] * N
if not 1 in a:
    fib[0] = 1
    if not 2 in a:
        fib[1] = 2
    else:
        fib[1] = 0
else:
    fib[0] = 0
    fib[1] = 1
for i in range(2,N):
    if not i + 1 in a:
        fib[i] = fib[i-1] + fib[i-2]
    else:
        fib[i] = 0
# print(fib)
print(fib[N-1] % 1000000007)

Fixed submission:
from sys import stdin
data = stdin.readline().split()
N, M = int(data[0]), int(data[1])
a = [None] * M
fib = [None] * N
if N == 1:
    print(1)
    exit()
for i in range(M):
    a[i] = int(stdin.readline().rstrip())
    fib[a[i] - 1] = 0
    if i > 0 and a[i] - a[i-1] == 1:
        print(0)
        exit()
if not 1 in a:
    fib[0] = 1
    if not 2 in a:
        fib[1] = 2
    else:
        fib[1] = 0
else:
    fib[0] = 0
    fib[1] = 1
for i in range(2,N):
    if fib[i] == 0:
        continue
    else:
        fib[i] = fib[i-1] + fib[i-2]
# print(fib)
print(fib[N-1] % 1000000007)
Buggy python submission (verdict: Runtime Error):
from sys import stdin
N = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
sum = 0
cnt = 0
for itr in range(N):
    if s[itr] == '#':
        cnt += 1
        continue
    if cnt > 0:
        sum += 1
        cnt = 0
print(sum)

Fixed submission:
from sys import stdin
s_data = stdin.readline().rstrip().split()
data = [int(itr) for itr in s_data]
A = data[0]
B = data[1]
C = data[2]
if (B <= C and C <= A) or (A <= C and C <= B):
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
from sys import stdin
N = int(stdin.readline().rstrip())
s = stdin.readline().rstrip()
sum = 0
wh = s.count('.')
cnt = 0
for itr in range(N):
    if s[itr] == '#':
        cnt += 1
        continue
    if cnt > 0:
        sum += 1
        cnt -= 1
print(sum)


Fixed submission:
from sys import stdin
s_data = stdin.readline().rstrip().split()
data = [int(itr) for itr in s_data]
A = data[0]
B = data[1]
C = data[2]
if (B <= C and C <= A) or (A <= C and C <= B):
    print('Yes')
else:
    print('No')