Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [i for i in map(int, input().split())]

As = 1
for i in range(N):
    As = As*A[i]
if 1000000000000000000 < As:
    print(-1)
else:
    print(As)

Fixed submission:
N = int(input())
A = [i for i in map(int, input().split())]

if 0 in A:
    print(0)
else:
    As = 1
    for i in range(N):
        As *= A[i]
        if 10**18 < As:
            print(-1)
            break

    if As <= 10**18:
        print(As)
Buggy python submission (verdict: Runtime Error):
s, w = map(int, input().split())
if (s >= w):
    print(safe)
else:
    print(unsafe)

Fixed submission:
S, W = map(int, input().split())
if S <= W:
    print("unsafe")
else:
    print("safe")

Buggy python submission (verdict: Runtime Error):
s, w = map(int, input().split())
if s > w:
    print(safe)
else:
    print(unsafe)

Fixed submission:
S, W = map(int, input().split())
if S <= W:
    print("unsafe")
else:
    print("safe")

Buggy python submission (verdict: Runtime Error):
S,W = map(int, input().split())
if S > W:
    print(safe)
else:
    print(unsafe)

Fixed submission:
S, W = map(int, input().split())
if S <= W:
    print("unsafe")
else:
    print("safe")

Buggy python submission (verdict: Runtime Error):
S,W = map(int, input().split())
if S > W:
    print(safe)
else:
    print(unsafe)

Fixed submission:
S, W = map(int, input().split())
if S <= W:
    print("unsafe")
else:
    print("safe")

Buggy python submission (verdict: Runtime Error):
S,W = map(int,input().split())
if S > W: print(safe)
else: print(unsafe)

Fixed submission:
S, W = map(int, input().split())
if S <= W:
    print("unsafe")
else:
    print("safe")

Buggy python submission (verdict: Runtime Error):
S,W = input()
if S > W: print(safe)
else: print(unsafe)

Fixed submission:
S, W = map(int, input().split())
if S <= W:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Runtime Error):
FizzBuzz = int(input())

Sum = []
for i in range(FizzBizz):
    if FizzBuzz[i] % 3 == 0 and FizzBuzz[i] % 5 == 0:
        Sum.append(i)
    else:
        Sum.append(0)
print(sum(Sum))


Fixed submission:
FizzBizz = int(input())

Sum = []
for i in range(1, FizzBizz+1):
    if i % 3 != 0 and i % 5 != 0:
        Sum.append(i)
    else:
        Sum.append(0)
print(sum(Sum))
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

K = int(input())

Sum = []
for a in range(1, K+1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            gcd = reduce(math.gcd, [a, b, c])
            Sum.append(gcd)

print(sum(Sum))

Fixed submission:
import math

K = int(input())

Sum = []
for a in range(1, K+1):
    for b in range(1, K + 1):
        gcd2 = math.gcd(a, b)
        for c in range(1, K + 1):
            gcd = math.gcd(gcd2, c)
            Sum.append(gcd)

print(sum(Sum))

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

K = int(input())

Sum = []
for a in range(1, K+1):
    for b in range(1, K + 1):
        gcd2 = math.gcd(i.j)
        for c in range(1, K + 1):
            gcd = math.gcd(gcd2, c)
            Sum.append(gcd)

print(sum(Sum))


Fixed submission:
import math

K = int(input())

Sum = []
for a in range(1, K+1):
    for b in range(1, K + 1):
        gcd2 = math.gcd(a, b)
        for c in range(1, K + 1):
            gcd = math.gcd(gcd2, c)
            Sum.append(gcd)

print(sum(Sum))

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

K = int(input())

Sum = []
for a in range(1, K+1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            gcd = gcd_list([a, b, c])
            Sum.append(gcd)

print(sum(Sum))

Fixed submission:
import math

K = int(input())

Sum = []
for a in range(1, K+1):
    for b in range(1, K + 1):
        gcd2 = math.gcd(a, b)
        for c in range(1, K + 1):
            gcd = math.gcd(gcd2, c)
            Sum.append(gcd)

print(sum(Sum))

Buggy python submission (verdict: Runtime Error):
K = int(input())

Sum = []
for a in range(1, K+1):
    for b in range(1, K + 1):
        for c in range(1, K + 1):
            gcd = gcd_list([a, b, c])
            Sum.append(gcd)

print(sum(Sum))

Fixed submission:
import math

K = int(input())

Sum = []
for a in range(1, K+1):
    for b in range(1, K + 1):
        gcd2 = math.gcd(a, b)
        for c in range(1, K + 1):
            gcd = math.gcd(gcd2, c)
            Sum.append(gcd)

print(sum(Sum))
Buggy python submission (verdict: Runtime Error):

ABCD = str(input())
A = ABCD[0]
B = ABCD[1]
C = ABCD[2]
D = ABCD[3]

if int(A) + int(B) + int(C) + int(D) == 7:
    print(A + "+" + B + "+" + C + "+" + D +"=7")
    break
if int(A) - int(B) + int(C) + int(D) == 7:
    print(A + "-" + B + "+" + C + "+" + D +"=7")
    break
if int(A) + int(B) - int(C) + int(D) == 7:
    print(A + "+" + B + "-" + C + "+" + D +"=7")
    break
if int(A) - int(B) - int(C) + int(D) == 7:
    print(A + "-" + B + "-" + C + "+" + D +"=7")
    break
if int(A) + int(B) + int(C) - int(D) == 7:
    print(A + "+" + B + "+" + C + "-" + D +"=7")
    break
if int(A) - int(B) + int(C) - int(D) == 7:
    print(A + "-" + B + "+" + C + "-" + D +"=7")
    break
if int(A) + int(B) - int(C) - int(D) == 7:
    print(A + "+" + B + "-" + C + "-" + D +"=7")
    break
if int(A) - int(B) - int(C) - int(D) == 7:
    print(A + "-" + B + "-" + C + "-" + D +"=7")
    break


Fixed submission:

ABCD = str(input())
A = ABCD[0]
B = ABCD[1]
C = ABCD[2]
D = ABCD[3]

for i in range(1):
    if int(A) + int(B) + int(C) + int(D) == 7:
        print(A + "+" + B + "+" + C + "+" + D +"=7")
        break
    if int(A) - int(B) + int(C) + int(D) == 7:
        print(A + "-" + B + "+" + C + "+" + D +"=7")
        break
    if int(A) + int(B) - int(C) + int(D) == 7:
        print(A + "+" + B + "-" + C + "+" + D +"=7")
        break
    if int(A) - int(B) - int(C) + int(D) == 7:
        print(A + "-" + B + "-" + C + "+" + D +"=7")
        break
    if int(A) + int(B) + int(C) - int(D) == 7:
        print(A + "+" + B + "+" + C + "-" + D +"=7")
        break
    if int(A) - int(B) + int(C) - int(D) == 7:
        print(A + "-" + B + "+" + C + "-" + D +"=7")
        break
    if int(A) + int(B) - int(C) - int(D) == 7:
        print(A + "+" + B + "-" + C + "-" + D +"=7")
        break
    if int(A) - int(B) - int(C) - int(D) == 7:
        print(A + "-" + B + "-" + C + "-" + D +"=7")
        break
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
N = list(map(int,input().split()))
print("Yes" if sum(N) >= a else "No")

Fixed submission:
a,b = map(int,input().split())
print(a//b if a%b ==0 else a//b+1)
Buggy python submission (verdict: Runtime Error):
x=int(input())
if x=0:
    print(1)
else:
    print(0)

Fixed submission:
x=int(input())
if x==0:
    print(1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
5
3 3 3 3 3

Fixed submission:
n=int(input())
a=list(map(int, input().split()))
cnt=0
for i in range(1,n):
    if a[i-1]>a[i]:
        cnt+=a[i-1]-a[i]
        a[i]=a[i-1]
print(cnt)
Buggy python submission (verdict: Runtime Error):
s=input()

list = list(s)
cnt=0
if list(0) == 'R' and list(1) == 'R' and list(2)=='R':
    print(3)
elif list(0)=='R' and list(1) == 'R'and list(2)!='R':
    print(2)
elif list(0)=='R' and list(1) != 'R'and list(2)!='R':
    print(1)
elif list(0)=='R' and list(1) != 'R'and list(2)=='R':
    print(1)
elif list(0)!='R' and list(1) == 'R' and list(2)=='R':
    print(2)
elif list(0)!='R' and list(1) != 'R' and list(2)=='R':
    print(1)
elif list(0)!='R' and list(1) == 'R' and list(2)!='R':
    print(1)
else:
    print(0)

Fixed submission:
s=input()

list = list(s)
cnt=0
if list[0] == 'R' and list[1] == 'R' and list[2]=='R':
    print(3)
elif list[0]=='R' and list[1] == 'R'and list[2]!='R':
    print(2)
elif list[0]=='R' and list[1] != 'R'and list[2]!='R':
    print(1)
elif list[0]=='R' and list[1] != 'R'and list[2]=='R':
    print(1)
elif list[0]!='R' and list[1] == 'R' and list[2]=='R':
    print(2)
elif list[0]!='R' and list[1] != 'R' and list[2]=='R':
    print(1)
elif list[0]!='R' and list[1] == 'R' and list[2]!='R':
    print(1)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
import sys
a, b, c = map(int, input().split())
k = int(input())
while True:
    if b <= a:
        b = b*2
        k += -1
        if k == 0:
            print('No')
            sys.exit(1)
    else:
        break
while True:
    if c <= b:
        c = c*2
        k += -1
        if k == 0:
            print('No')
            sys.exit(1)
    else:
        break
print('Yes')

Fixed submission:
import sys
a, b, c = map(int, input().split())
k = int(input())
while True:
    if b <= a:
        b = b*2
        k += -1
        if k < 0:
            print('No')
            sys.exit()
    else:
        break
while True:
    if c <= b:
        c = c*2
        k += -1
        if k < 0:
            print('No')
            sys.exit()
    else:
        break
print('Yes')

Buggy python submission (verdict: Runtime Error):
import sys
a, b, c = map(int, input().split())
k = int(input())
while True:
    if b <= a:
        b = b*2
        k += -1
        if k == 0:
            print('No')
            sys.exit(1)
    else:
        break
while True:
    if c <= b:
        c = c*2
        k += -1
        if k < 0:
            print('No')
            sys.exit(1)
    else:
        break
print('Yes')

Fixed submission:
import sys
a, b, c = map(int, input().split())
k = int(input())
while True:
    if b <= a:
        b = b*2
        k += -1
        if k < 0:
            print('No')
            sys.exit()
    else:
        break
while True:
    if c <= b:
        c = c*2
        k += -1
        if k < 0:
            print('No')
            sys.exit()
    else:
        break
print('Yes')

Buggy python submission (verdict: Runtime Error):
import sys
a, b, c = map(int, input().split())
k = int(input())
while True:
    if b <= a:
        b = b*2
        k += -1
        if k == 0:
            print('No')
            sys.exit(1)
    else:
        break
while True:
    if c <= b:
        c = c*2
        k += -1
        if k < 0:
            print('No')
            sys.exit(1)
    else:
        break
print('Yes')

Fixed submission:
import sys
a, b, c = map(int, input().split())
k = int(input())
while True:
    if b <= a:
        b = b*2
        k += -1
        if k < 0:
            print('No')
            sys.exit()
    else:
        break
while True:
    if c <= b:
        c = c*2
        k += -1
        if k < 0:
            print('No')
            sys.exit()
    else:
        break
print('Yes')
Buggy python submission (verdict: Runtime Error):
#C
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
asum=[0]
bsum=[0]
for i in range(n):
    asum.append(asum[-1]+a[i])
for i in range(m):
    bsum.append(bsum[-1+b[i]])
ans=0
for i in range(n+1):
    if asum[i]>0:
        break
    while asum[i]+bsum[m]>0 and m>0:
        m-=1
    ans=(ans,i+m)
print(ans)

Fixed submission:
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
asum=[0]
bsum=[0]
for i in range(n):
    asum.append(asum[-1]+a[i])
for i in range(m):
    bsum.append(bsum[-1]+b[i])
ans=0
for i in range(n+1):
    if asum[i]>k:
        break
    while asum[i]+bsum[m]>k and m>0:
        m-=1
    ans=max(ans,i+m)
print(ans)
Buggy python submission (verdict: Runtime Error):
num = list(map(int, input().split()))
num.sort(reverse=True)
a = str(num[0])
b = str(num[1])
c = int(num[2])
ab = a + b
ab = int("ab")
print(ab + c)

Fixed submission:
num = list(map(int, input().split()))
num.sort(reverse=True)
a = str(num[0])
b = str(num[1])
c = int(num[2])
ab = a + b
ab = int(ab)
print(ab + c)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
n = b - a
print(int(n*(n+1)/2-b))

Fixed submission:
n = int(input())
if n > 999:
    print("ABD")
    exit()
print("ABC")

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
n=b-a
print(int(n*(n+1)/2-b))

Fixed submission:
n = int(input())
if n > 999:
    print("ABD")
    exit()
print("ABC")

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
n=b-a
print(int(n*(n+1)/2-b))

Fixed submission:
n = int(input())
if n > 999:
    print("ABD")
    exit()
print("ABC")

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
n=b-a
print(int(n*(n+1)/2-b))

Fixed submission:
n = int(input())
if n > 999:
    print("ABD")
    exit()
print("ABC")

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
n=b-a
print(int(n*(n+1)/2-b))

Fixed submission:
n = int(input())
if n > 999:
    print("ABD")
    exit()
print("ABC")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
n = b - a
print(int(n*(n+1)/2-b))

Fixed submission:
n = int(input())
if n > 999:
    print("ABD")
    exit()
print("ABC")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
ans = int(((b-a)*(b-a+1)/2)-b)
print(ans)

Fixed submission:
n = int(input())
if n > 999:
    print("ABD")
    exit()
print("ABC")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
ans = int(((b-a)*(b-a+1)/2)-b)
print(ans)

Fixed submission:
n = int(input())
if n > 999:
    print("ABD")
    exit()
print("ABC")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(((b-a)*(b-a+1)/2)-b)

Fixed submission:
n = int(input())
if n > 999:
    print("ABD")
    exit()
print("ABC")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
print(()(b-a)*(b-a+1)/2)-b)

Fixed submission:
a, b = map(int, input().split())
n = b - a
print(int(n*(n+1)/2-b))
Buggy python submission (verdict: Runtime Error):
#coding: utf-8

a, b = int(input())
c = a * b
if c % 2 = 0:
    print("Even")
else:
    print("odd")

Fixed submission:
#coding: utf-8

a, b = map(int, input().split())
if (a*b)%2 == 0:
    print("Even")
else:
    print("Odd")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
S=list(input().rstrip('\n'))
score = [S.count('R'),S.count('W')]
sta = 'R'
for i in range(N-1):
  if S[i] != sta:
    a = S[:i].count('W')
    b = S[i:].count('R')
    score.append(max(a,b))
    sta = S[i]
print(min(score))


Fixed submission:
import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
S=list(input().rstrip('\n'))
score = [S.count('R'),S.count('W')]
sta = 'R'
ws = 0
rs = S.count('R')
sto = 0
for i in range(N):
  if S[i] != sta:
    if sta=='W':
      ws += sto
      sto = 1
      score.append(max(rs,ws))
      sta ='R'
    else:
      rs -= sto
      sto = 1
      score.append(max(rs,ws))
      sta ='W'
  else:
    sto += 1
print(min(score))
Buggy python submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline

D=int(input().rstrip('\n'))
cs=[int(x) for x in input().rstrip('\n').split()]
S={}
cd=[0]*26
for i in range(D):
  S[i] = [int(x) for x in input().rstrip('\n').split()]
for i in range(D):
  s1 = S[i]
  s1_s=sorted(s1,reverse=True)
  if i!=D-1:
    s2=S[i+1]
    s1_a=[x-y for x,y in zip(s1,cd)]
    s2_i=[x-y for x,y in zip(s2,cd)]
    s1_b=sorted(s1_a,reverse=True)
    if s2_i.index(max(s2_i))==s1_a.index(s1_b[0]):
      x = s1.index(s1_b[1])+1
      cd = [y+z for y,z in zip(cd,cs)]
      cd[x-1]=0
      print(x)
    else:
      print(s1.index(s1_b[0])+1)
print(S[D-1].index(max(S[D-1]))+1)

Fixed submission:
import sys
input=sys.stdin.readline

D=int(input().rstrip('\n'))
cs=[int(x) for x in input().rstrip('\n').split()]
for i in range(D):
  Ss = [int(x) for x in input().rstrip('\n').split()]
  print(Ss.index(max(Ss))+1)

Buggy python submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline

D=int(input().rstrip('\n'))
cs=[int(x) for x in input().rstrip('\n').split()]
S={}
cd=[0]*26
for i in range(D):
  S[i] = [int(x) for x in input().rstrip('\n').split()]
for i in range(D):
  s1 = S[i]
  s1_s=sorted(s1,reverse=True)
  if i!=D-1:
    s2=S[i+1]
    s1_a=[x-y for x,y in zip(s1,cd)]
    s2_i=[x-y for x,y in zip(s2,cd)]
    if s2.index(max(s2_i))==s1.index(max(s1_a)):
      x = s1.index(sorted(s1_a,reverse=True)[1])+1
      cd = [y+z for y,z in zip(cd,cs)]
      cd[x-1]=0
      print(x)
    else:
      print(s1.index(sorted(s1_a,reverse=True)[0])+1)
print(S[D-1].index(max(S[D-1]))+1)


Fixed submission:
import sys
input=sys.stdin.readline

D=int(input().rstrip('\n'))
cs=[int(x) for x in input().rstrip('\n').split()]
for i in range(D):
  Ss = [int(x) for x in input().rstrip('\n').split()]
  print(Ss.index(max(Ss))+1)
Buggy python submission (verdict: Runtime Error):
 import sys
input=sys.stdin.readline

N,M=(int(x) for x in input().rstrip('\n').split())
Hs = [int(x) for x in input().rstrip('\n').split()]
nums = [1 for x in Hs]
for i in range(M):
  roads = [int(x) for x in input().rstrip('\n').split()]
  if Hs[roads[0]-1] < Hs[roads[1]-1]:
    nums[roads[0]-1] = 0
  elif Hs[roads[0]-1] > Hs[roads[1]-1]:
    nums[roads[1]-1] = 0
  else:
    nums[roads[0]-1] = 0
    nums[roads[1]-1] = 0
print(sum(nums))

Fixed submission:
import sys
input=sys.stdin.readline

N,M=(int(x) for x in input().rstrip('\n').split())
Hs = [int(x) for x in input().rstrip('\n').split()]
nums = [1 for x in Hs]
for i in range(M):
  roads = [int(x) for x in input().rstrip('\n').split()]
  if Hs[roads[0]-1] < Hs[roads[1]-1]:
    nums[roads[0]-1] = 0
  elif Hs[roads[0]-1] > Hs[roads[1]-1]:
    nums[roads[1]-1] = 0
  else:
    nums[roads[0]-1] = 0
    nums[roads[1]-1] = 0
print(sum(nums))
Buggy python submission (verdict: Runtime Error):
N,M=(int(x) for x in input().split())
As=[int(x) for x in input().split()]
p = sum(As)/4M
ov = [1 if x>=p else 0 for x in As]
if sum(ov)>=M:
  print('Yes')
else:
  print('No')

Fixed submission:
N,M=(int(x) for x in input().split())
As=[int(x) for x in input().split()]
p = sum(As)/(4*M)
ov = [1 if x>=p else 0 for x in As]
if sum(ov)>=M:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
X,Y,A,B,C=(int(x) for x in input().split())
ps = sorted([int(x) for x in input().split()],reverse=True)
qs = sorted([int(x) for x in input().split()],reverse=True)
rs = sorted([int(x) for x in input().split()],reverse=True)
sta = sorted(ps[:X] + qs[:Y])
for i in range(C):
  if rs[i]> min(sta):
    sta[i]=rs[i]
  else:
    break
print(sum(sta))

Fixed submission:
X,Y,A,B,C=(int(x) for x in input().split())
ps = sorted([int(x) for x in input().split()],reverse=True)
qs = sorted([int(x) for x in input().split()],reverse=True)
rs = sorted([int(x) for x in input().split()],reverse=True)
sta = sorted(ps[:X] + qs[:Y])
res = sum(sta)
for i in range(C):
  a = rs[i]
  s = sta[i]
  if a> s:
    res += a-s
  else:
    break
print(res)
Buggy python submission (verdict: Runtime Error):
HK=input().split(' ')
H=int(HK[0])
K=int(HK[1])
if K % 2==1 and H%2==1:
    print(round(HK/2)+1)
else:
    print(HK/2)

Fixed submission:
HK=input().split(' ')
H=int(HK[0])
K=int(HK[1])
if H==1 or K ==1:
    print(1)
else:
    if K % 2==1 and H%2==1:
        print(round(H*K/2)+1)
    else:
        print(int(H*K/2))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
A=[int(x) for x in input().rstrip('\n').split()]
res = 0
now = 0
for i in range(1,N+1):
  if i in A:
    res += 1
    now = A.index(i)
    A = A[now:]
  else:
    break
if res == 0:
  print(-1)
else:
  print(N-res)


Fixed submission:
import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
A=[int(x) for x in input().rstrip('\n').split()]
now = 0
for x in range(N):
  if A[x] == now+1:
    now += 1
if now == 0:
  print(-1)
else:
  print(N-now)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
A=[int(x) for x in input().rstrip('\n').split()]
res = 0
now = 0
for i in range(1,N+1):
  if i in A:
    res += 1
    now = A.index(i)
    A = A[now:]
  else:
    break
if res == 0:
  print(-1)
else:
  print(N-res)

Fixed submission:
import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
A=[int(x) for x in input().rstrip('\n').split()]
now = 0
for x in range(N):
  if A[x] == now+1:
    now += 1
if now == 0:
  print(-1)
else:
  print(N-now)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
import numpy as np

N=int(input().rstrip('\n'))
A=np.array([int(x) for x in input().rstrip('\n').split()])
res = 0
for i in range(N):
  if i+1 in A:
    a = np.where(A==i+1)
    b = a[0][0]
    A = A[b:]
    res += 1
  else:
    break
if res == 0:
  print(-1)
else:
  print(N-res)

Fixed submission:
import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
A=[int(x) for x in input().rstrip('\n').split()]
now = 0
for x in range(N):
  if A[x] == now+1:
    now += 1
if now == 0:
  print(-1)
else:
  print(N-now)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
A=[int(x) for x in input().rstrip('\n').split()]
res = 0
for i in range(N):
  if i+1 in A:
    A = A[A.index(i+1):]
    res += 1
  else:
    break
if res == 0:
  print(-1)
else:
  print(N-res)

Fixed submission:
import sys
input = sys.stdin.readline

N=int(input().rstrip('\n'))
A=[int(x) for x in input().rstrip('\n').split()]
now = 0
for x in range(N):
  if A[x] == now+1:
    now += 1
if now == 0:
  print(-1)
else:
  print(N-now)
Buggy python submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
import math

A,B = (int(x) for x in input().rstrip('\n').split())
c = math.gcd(A,B)
if c==1:
  print(1)
else:
  res = 1
  d = math.floor(math.sqrt(c))
  for i in range(2,d+2):
    if c%i==0:
      res += 1
      while c%i==0:
        c = c//i
  if res == 1:
    res += 1
print(res)

Fixed submission:
import sys
input=sys.stdin.readline
import math

A,B = (int(x) for x in input().rstrip('\n').split())
c = math.gcd(A,B)
if c==1:
  print(1)
else:
  ps=[]
  d = math.floor(math.sqrt(c))
  for i in range(2,d+2):
    if c%i==0:
      if all(i%x!=0 for x in ps):
        ps.append(i)
        while c % i ==0:
          c = c//i
  if c > 1:
    ps.append(0)
  print(len(ps)+1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

S=list(input().rstrip('\n'))
N=len(S)

kake10 = [0,10,7,4,1,11,8,5,2,12,9,6,3]
now = {0:1,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0}
for i in range(N):
  now = {kake10[x]:now[x] for x in range(13)}
  if S[i]=='?':
    now2 = {}
    for x in range(13):
      now2[x] = sum(now[(x+y)%13] for y in range(4,14))
    now = now2
  else:
    a = int(S[i])
    now = {(x+a)%13:now[x] for x in range(13)}
print(now[5]%((10**9)+7))

Fixed submission:
import sys
input = sys.stdin.readline

S=list(input().rstrip('\n'))

kake10 = [0,10,7,4,1,11,8,5,2,12,9,6,3]
now = {0:1,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:0}
for i in S:
  now = {kake10[x]:now[x] for x in range(13)}
  if i=='?':
    now2 = {x:sum(now[(x+y)%13] for y in range(4,14))%1000000007 for x in range(13)}
    now = now2
  else:
    a = int(i)
    now = {(x+a)%13:now[x] for x in range(13)}
print(now[5])