Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import sys
a,b = map(int,input().split())
if(a%b==0):
    print(-1)
    sys.exit(0)
for i in range(10**18):
    if(i%a==0 and i%b):
        print(i)
        sys.exit(0)
print(-1)

Fixed submission:
import sys
a,b = map(int,input().split())
if(a%b==0):
    print(-1)
else:
    print(a)

Buggy python submission (verdict: Runtime Error):
import sys
a,b = map(int,input().split())
if(a%b==0):
    print(-1)
    sys.exit(-1)
for i in range(10**18):
    if(i%a==0 and i%b):
        print(i)
        sys.exit(0)
print(-1)

Fixed submission:
import sys
a,b = map(int,input().split())
if(a%b==0):
    print(-1)
else:
    print(a)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = list(set(a))
s =0
for i in b:
    c = a.count(i)
    if(c<i):
        s += c
    elif(c>i):
        s += c-i
print(s)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = {}
for i in a:
    b[i] = b.get(i,0)+1
s =0
for i in b.keys():
    c = b[i]
    if(c<i):
        s += c
    elif(c>i):
        s += c-i
print(s)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
b = list(set(a))
s =0
for i in b:
    if(a.count(i)<i):
        s += a.count(i)
    elif(a.count(i)>i):
        s += a.count(i)-i
print(s)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = {}
for i in a:
    b[i] = b.get(i,0)+1
s =0
for i in b.keys():
    c = b[i]
    if(c<i):
        s += c
    elif(c>i):
        s += c-i
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
a = {}
s = 0
for i in input().split():
    a[int(i)] = a.get(int(i),0)+1
b = list(a.values())
while(k<len(b)):
    c = min(b)
    s+=c
    b.remove(c)
print(s)

Fixed submission:
n,k = map(int,input().split())
a = {}
for i in input().split():
    a[int(i)] = a.get(int(i),0)+1
b = list(a.values())
b.sort()
print(sum(b[:len(b)-k]))
Buggy python submission (verdict: Time Limit Exceeded):
a,b,c,d,e,f = map(int,input().split())
x=[]
for i in range(int(f)):
    for j in range(int(f)):
        if (100*a*i+100*b*j)<= f:
            x.append(100*a*i+100*b*j)
y=[]
for i in range(int(f)):
    for j in range(int(f)):
        if (c*i+d*j)<= f:
            y.append(c*i+d*j)
p=e/(100+e)
maxp=0
mj=0
mi=0
for i in x:
    for j in y:
        if((i+j<=f) and (i+j)>0 and (j/(i+j)<=p)):
            if(j/(i+j)>=maxp):
                mj=j
                mi=i
                maxp=j/(i+j)
print(str(mj+mi)+" "+str(mj))

Fixed submission:
a,b,c,d,e,f = map(int,input().split())
x=[]
for i in range(int(f/100+0.9)):
    for j in range(int(f/100+0.9)):
        if (100*a*i+100*b*j)<= f:
            x.append(100*a*i+100*b*j)
y=[]
for i in range(int(f/c+0.9)):
    for j in range(int(f/d+0.9)):
        if (c*i+d*j)<= f:
            y.append(c*i+d*j)
p=e/(100+e)
maxp=0
mj=0
mi=0
for i in x:
    for j in y:
        if((i+j<=f) and (i+j)>0 and (j/(i+j)<=p)):
            if(j/(i+j)>=maxp):
                mj=j
                mi=i
                maxp=j/(i+j)
print(str(mj+mi)+" "+str(mj))
Buggy python submission (verdict: Runtime Error):
def main(input):
  a, b = [int(i) for i in input.split()]
  print(a if a <= b else a-1)

# tests = [
#   '5 5',  # 5
#   '2 1',  # 1
#   '11 30',  # 11
# ]

# for test in tests:
#   main(test)


main(a, b)

Fixed submission:
def main(input):
  a, b = [int(i) for i in input.split()]
  print(a if a <= b else a-1)

# tests = [
#   '5 5',  # 5
#   '2 1',  # 1
#   '11 30',  # 11
# ]

# for test in tests:
#   main(test)

main(input())
Buggy python submission (verdict: Runtime Error):
month, day = map(int, input())
if month > day:
    print(month-1)
else:
    print(month)

Fixed submission:
month, day = map(int, input().split())
if month > day:
    print(month-1)
else:
    print(month)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import defaultdict
def solve():
    N = int(input())
    progression = list(map(int, input().split()))
    cuml = [0]*(N+1)
    for i in range(len(progression)):
        cuml[i+1] = cuml[i] + progression[i]
    cuml_dic = defaultdict(list)
    for i, num in enumerate(cuml):
        cuml_dic[num].append(i)
    ans = 0
    for i in range(1, N+1):
        if cuml[i] == 0:
            ans += 1
        for index in cuml_dic[cuml[i]]:
            if index > i:
                ans += 1
    print(ans)



solve()

Fixed submission:
from collections import defaultdict
def solve():
    N = int(input())
    progression = list(map(int, input().split()))
    cuml = [0]*(N+1)
    for i in range(len(progression)):
        cuml[i+1] = cuml[i] + progression[i]
    cuml_dic = defaultdict(list)
    for i, num in enumerate(cuml):
        cuml_dic[num].append(i)
    ans = 0
    for key, value in cuml_dic.items():
        n = len(value)-1
        ans += int((n+1)*n/2)

    print(ans)

solve()

Buggy python submission (verdict: Time Limit Exceeded):

def solve():
    N = int(input())
    progression = list(map(int, input().split()))
    cuml = [0]*(N+1)
    for i in range(len(progression)):
        cuml[i+1] = cuml[i] + progression[i]
    ans = 0
    for i in range(1, N+1):
        if cuml[i] == 0:
            ans += 1
        for j in range(i+1, N+1):
            # print(cuml[i], cuml[j])
            if cuml[i] == cuml[j]:
                ans += 1
        # print()
    print(ans)

solve()

Fixed submission:
from collections import defaultdict
def solve():
    N = int(input())
    progression = list(map(int, input().split()))
    cuml = [0]*(N+1)
    for i in range(len(progression)):
        cuml[i+1] = cuml[i] + progression[i]
    cuml_dic = defaultdict(list)
    for i, num in enumerate(cuml):
        cuml_dic[num].append(i)
    ans = 0
    for key, value in cuml_dic.items():
        n = len(value)-1
        ans += int((n+1)*n/2)

    print(ans)

solve()
Buggy python submission (verdict: Runtime Error):
N = input()

num = [int(i) for i in N]
f = sum(num)
if N%f == 0:
    print("Yes")
else:
    print('No')


Fixed submission:
N = input()

num = [int(i) for i in N]
f = sum(num)
if int(N)%f == 0:
    print("Yes")
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

from_one = []
to_n = [] 

for i in range(M):
    a, b = map(int, input().split())
    if a == 1 or b == 1:
        from_one.append(b)
    elif b == N or a == N:
        to_n.append(a)

pos = "IMPOSSIBLE"

for island in from_one:
    if island in to_n:
        pos = "POSSIBLE"

print(pos)

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

f = set()
t = set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        f.add(b)
    elif a == N:
        t.add(b)
    if b == 1:
        f.add(a)
    elif b == N:
        t.add(a)

pos = "IMPOSSIBLE"

if f&t:
    pos = "POSSIBLE"

print(pos)

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

from_one = []
to_n = []

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        from_one.append(b)
    elif b == N:
        to_n.append(a)

pos = "IMPOSSIBLE"

for island in from_one:
    if island in to_n:
        pos = "POSSIBLE"

print(pos)

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

f = set()
t = set()

for i in range(M):
    a, b = map(int, input().split())
    if a == 1:
        f.add(b)
    elif a == N:
        t.add(b)
    if b == 1:
        f.add(a)
    elif b == N:
        t.add(a)

pos = "IMPOSSIBLE"

if f&t:
    pos = "POSSIBLE"

print(pos)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
x = int(input())

if a <= x <= a + b:
    print("YES")
else:
    print("NO")


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

if a <= x <= a + b:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
a, b, k = map(int, input().split())

for i in range(a, b + 1):
    if i < a + k or i > b - k:
        print(i)


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

if b - a + 1 <= k * 2:
    for i in range(a, b + 1):
        print(i)
else:
    for i in range(a, a + k):
        print(i)
    for i in range(b - k + 1, b + 1):
        print(i)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    ans = 0
    tmp = 0
    for j in range(n):
        if j != i:
            ans += abs(tmp - a[j])
            tmp = a[j]

    ans += abs(tmp - 0)
    print(ans)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
s = abs(a[0])

for i in range(n - 1):
    s += abs(a[i] - a[i + 1])
s += abs(a[n - 1])

for i in range(n):
    if i == 0:
        print(s + abs(0 - a[i + 1]) - (abs(0 - a[i]) + abs(a[i] - a[i + 1])))
    elif i == n - 1:
        print(s + abs(a[i - 1] - 0) - (abs(a[i - 1] - a[i]) + abs(a[i])))
    else:
        print(s + abs(a[i - 1] - a[i + 1]) - (abs(a[i - 1] - a[i]) + abs(a[i] - a[i + 1])))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))
l = sorted(x)

for i in x:
  y = l[:]
  t = y.remove(i)
  print(y[n//2-1])


Fixed submission:
n = int(input())
x = list(map(int, input().split()))
l = sorted(x)

for i in x:
  if i <= l[n//2-1]:
    print(l[n//2])
  else:
    print(l[n//2-1])

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))
l = sorted(x)
X = {}

for i in range(len(x)):
  y = l[:]
  t = y.pop(i)
  X[t] = y[n//2-1]
  
for i in x:
  print(X[i])


Fixed submission:
n = int(input())
x = list(map(int, input().split()))
l = sorted(x)

for i in x:
  if i <= l[n//2-1]:
    print(l[n//2])
  else:
    print(l[n//2-1])

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

for i in range(len(x)):
  y = x[:]
  y.pop(i)
  y = sorted(y)
  print(y[n//2-1])


Fixed submission:
n = int(input())
x = list(map(int, input().split()))
l = sorted(x)

for i in x:
  if i <= l[n//2-1]:
    print(l[n//2])
  else:
    print(l[n//2-1])
Buggy python submission (verdict: Runtime Error):
import sys
n, y = map(int, input().split())
for i in reversed(range(y//10000+1)):
  for j in reversed(range((y-i*10000)//5000+1)):
    if i*10000+j*5000+(n-i-j)*1000 == y:
      print(i, j, n-i-j)
      sys.exit(1)

print('-1 -1 -1')


Fixed submission:
import sys
n, y = map(int, input().split())
for i in range(n+1):
  for j in range(i, n+1):
      if (i*10000+(j-i)*5000+(n-j)*1000 == y):
        print(i, j-i, n-j)
        sys.exit(0)
print('-1 -1 -1')
Buggy python submission (verdict: Runtime Error):
n, h = map(int, input().split())
a = []
b = []
amax = 0
for i in range(n):
  ai, bi = map(int, input().split())
  if amax < ai:
    amax = ai
  a.append(ai)
  b.append(bi)

b = [b[j] for j in range(n) if b[j] > amax]
sumb = sum(b)
if sumb >= h:
  s = 0
  b = sorted(b)
  c = 0
  while s < h:
    s += b[-1]
    b.pop(-1)
    c + =1
  print(c)
else:
  print((h-sumb)//amax+((h-sumb)%amax!=0) + len(b))



Fixed submission:
n, h = map(int, input().split())
a = []
b = []
amax = 0
for i in range(n):
  ai, bi = map(int, input().split())
  if amax < ai:
    amax = ai
  a.append(ai)
  b.append(bi)

b = [b[j] for j in range(n) if b[j] > amax]
sumb = sum(b)
if sumb >= h:
  s = 0
  b = sorted(b)
  c = 0
  while s < h:
    s += b[-1]
    b.pop(-1)
    c += 1
  print(c)
else:
  print((h-sumb)//amax+((h-sumb)%amax!=0) + len(b))
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))

def sort_reverse(n):
    n.sort(reverse=True)
    return n

N_Even = list(range(0, N+1, 2))
N_Odd = list(range(1, N+1, 2))
a1 = sort_reverse(a)
sum1 = 0
sum2 = 0

for i in N_Even:
    sum1 += a1[i]
for j in N_Odd:
    sum2 += a1[j]

print(sum1 - sum2)

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

def sort_reverse(n):
    n.sort(reverse=True)
    return n

N_Even = list(range(0, N, 2))
N_Odd = list(range(1, N, 2))
a1 = sort_reverse(a)
sum1 = 0
sum2 = 0

for i in N_Even:
    sum1 += a1[i]
for j in N_Odd:
    sum2 += a1[j]

print(sum1 - sum2)

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

def sort_reverse(n):
    n.sort(reverse=True)
    return n

N_Even = list(range(0, N+1, 2))
N_Odd = list(range(1, N+1, 2))
a1 = sort_reverse(a)
sum1 = 0
sum2 = 0

for i in N_Even:
    sum1 += a1[i]
for j in N_Odd:
    sum2 += a1[i]

print(sum1 - sum2)

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

def sort_reverse(n):
    n.sort(reverse=True)
    return n

N_Even = list(range(0, N, 2))
N_Odd = list(range(1, N, 2))
a1 = sort_reverse(a)
sum1 = 0
sum2 = 0

for i in N_Even:
    sum1 += a1[i]
for j in N_Odd:
    sum2 += a1[j]

print(sum1 - sum2)
Buggy python submission (verdict: Runtime Error):
using namespace std;

int main() {
    int N;
    int t[110000], x[110000], y[110000];
    cin >> N;
    t[0] = x[0] = y[0] = 0;  // 初期状態
    for (int i = 0; i < N; ++i) cin >> t[i+1] >> x[i+1] >> y[i+1];  // 1-index にしておく

    bool can = true;
    for (int i = 0; i < N; ++i) {
        int dt = t[i+1] - t[i];
        int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        if (dt < dist) can = false;
        if (dist % 2 != dt % 2) can = false;  // dist と dt の偶奇は一致する必要あり！
    }

    if (can) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Fixed submission:
import sys
N = int(input())
t_param = 0
x_param = 0
y_param = 0

for i in range(N):
    t, x, y = map(int, input().split())
    if (abs(x - x_param) + abs(y - y_param))  > (abs(t - t_param)) or ((x + y + t)%2) != 0 :
        print('No')
        sys.exit()
    t_param = t
    x_param = x
    y_param = y
print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int,input().split())

count = 0
first = 0
for i in range(a, b+1):
#    print(i)
    if i%x == 0:
        first = i
        count = 1
        break
    
if count != 0:
    result  = (b-first) // x +1

else :
    result = 0


print(result)





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



## ことごとくTLEする件
# forを回すからだめなのかも→回さないですませるには？
# bまでに約数いくつあるか出す → a-1 までに約数いくつあるか出す→引き算



## まず、aが割り切れるかどうか判定
## aが割り切れるなら、最小値はa
## 割り切れないなら、a+（除数 - あまり ) が最小値

#### divmodを使ってみよう！！


result = 0

a_x = divmod(a,x)  ## a/x の商と余り
## a = x * a_x[0] + a_x[1]
if a_x[1]==0:  ## 割り切れるとき
    first = a
else:  ## 割り切れないとき
    first = x * (a_x[0]+1)
    first2 = a + (x - a_x[1])  ## 検算用


b_x = divmod(b-first, x)

result = b_x[0]+1

print(result)






"""
名答だと思ったがだめだった

count = 0
first = 0
for i in range(a, b+1):
#    print(i)
    if i%x == 0:
        first = i
        count = 1
        break
    
if count != 0:
    result  = (b-first) // x +1

else :
    result = 0


print(result)



"""

Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int,input().split())

count = 0
for i in range(a, b+1):
#    print(i)
    if i%x == 0:
        count += 1


 #  print('--------')
print(count)



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



## ことごとくTLEする件
# forを回すからだめなのかも→回さないですませるには？
# bまでに約数いくつあるか出す → a-1 までに約数いくつあるか出す→引き算



## まず、aが割り切れるかどうか判定
## aが割り切れるなら、最小値はa
## 割り切れないなら、a+（除数 - あまり ) が最小値

#### divmodを使ってみよう！！


result = 0

a_x = divmod(a,x)  ## a/x の商と余り
## a = x * a_x[0] + a_x[1]
if a_x[1]==0:  ## 割り切れるとき
    first = a
else:  ## 割り切れないとき
    first = x * (a_x[0]+1)
    first2 = a + (x - a_x[1])  ## 検算用


b_x = divmod(b-first, x)

result = b_x[0]+1

print(result)






"""
名答だと思ったがだめだった

count = 0
first = 0
for i in range(a, b+1):
#    print(i)
    if i%x == 0:
        first = i
        count = 1
        break
    
if count != 0:
    result  = (b-first) // x +1

else :
    result = 0


print(result)



"""
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
power = 1

for i in range(1,n+1):
  power *= i
  
print(power % (pow(10,9) + 7))

Fixed submission:
INF = 1000000007
n = int(input())

ans = 1


for i in range(1,n+1):
  ans = ans * i % INF
  
print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
power = 1

for i in range(1,n+1):
  power = power * i
  
print(powe r% (pow(10,9) + 7))

Fixed submission:
INF = 1000000007
n = int(input())

ans = 1


for i in range(1,n+1):
  ans = ans * i % INF
  
print(ans)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = [list(input()) for i in range(H)]

check_i = []
check_j = []
for i in range(H):
    if i == 0:
        check_i = [0, 1]
    elif i == H-1:
        check_i = [i-1, i]
    else:
        check_i = [i-1, i, i+1]
    for j in range(W):
        if S[i][j] == "#":
            continue

        if j == 0:
            check_j = [0, 1]
        elif j == W-1:
            check_j = [j-1, j]
        else:
            check_j = [j-1, j, j+1]
        
        count = 0
        for k in check_i:
            for l in check_j:
                if S[k][l] == "#":
                    count += 1
        S[i][j] = str(count)

for i in range(H):
    print("".join(S[i]))

Fixed submission:
H, W = map(int, input().split())
S = [list(input()) for i in range(H)]

check_i = []
check_j = []
for i in range(H):
    if H == 1:
        check_i = [0]
    elif i == 0:
        check_i = [0, 1]
    elif i == H-1:
        check_i = [i-1, i]
    else:
        check_i = [i-1, i, i+1]
    for j in range(W):
        if S[i][j] == "#":
            continue

        if W == 1:
            check_j = [0]
        elif j == 0:
            check_j = [0, 1]
        elif j == W-1:
            check_j = [j-1, j]
        else:
            check_j = [j-1, j, j+1]
        
        count = 0
        for k in check_i:
            for l in check_j:
                if S[k][l] == "#":
                    count += 1
        S[i][j] = str(count)

for i in range(H):
    print("".join(S[i]))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(input())-1 for i in range(N)]

hist = []
next_i = 0
ans = 0
for i in range(N):
    ans += 1
    hist.append(next_i)
    next_i = a[next_i]
    if next_i == 1:
        break
    elif next_i in hist:
        ans = -1
        break

print(ans)

Fixed submission:
N = int(input())
a = [int(input())-1 for i in range(N)]

hist = set()
next_i = 0
ans = 0
for i in range(N):
    ans += 1
    hist.add(next_i)
    next_i = a[next_i]
    if next_i == 1:
        break
    elif next_i in hist:
        ans = -1
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
print(len(filter(lambda s: s == '1', list(input()))))

Fixed submission:
print(len(list(filter(lambda s: s == '1', list(input())))))
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int, input().split())
cnd = range(0, k+1)
print(str(sum([1 for x in cnd for y in cnd for z in cnd if x+y+z == s])))

Fixed submission:
k,s = map(int, input().split())
cnd = range(0, k+1)
print(str(sum([1 for x in cnd for y in cnd if s-x-y in cnd])))
Buggy python submission (verdict: Time Limit Exceeded):
data = input().split(" ")
N = int(data[0])
tol = int(data[1])

tmp1 = 0
tmp2 = 0
tmp3 = 0

#print("{0} {1}".format(N, tol))

while tmp1 == 0:
  for i in range(0, N + 1, 1):
    for j in range(0, N + 1 - i, 1):
      k = N - i - j
      if (10000 * i + 5000 * j + 1000 * k) == tol and (i + j + k) == N:
        tmp1 = i
        tmp2 = j
        tmp3 = k
        break
    if tmp1 != 0 or tmp2 != 0 or tmp3 != 0:
      break

if tmp1 != 0 or tmp2 != 0 or tmp3 != 0:
  print("{0} {1} {2}".format(tmp1, tmp2, tmp3))
else:
  print("-1 -1 -1")

Fixed submission:
"""

times = int(input())  

data = [int(input()) for i in range(times)] 

N = data[0]

cards = data[0:]

#バブルソート
for i in range(0, len(cards), 1):
  
  for j in range(i + 1, len(cards), 1):
    
    if cards[i] < cards[j]:
      tmp1 = cards[i]
      tmp2 = cards[j]
      
      cards[i] = tmp2
      cards[j] = tmp1
      
#鏡餅を積んで行くぜ！！

print(len(set([str(x) for x in cards])))
"""

data = input().split(" ")
N = int(data[0])
tol = int(data[1])

tmp1 = 0
tmp2 = 0
tmp3 = 0

for i in range(0, N + 1, 1):
  for j in range(0, N + 1 - i, 1):
    k = N - i - j
    if (10000 * i + 5000 * j + 1000 * k) == tol and (i + j + k) == N:
      tmp1 = i
      tmp2 = j
      tmp3 = k
      break
  if tmp1 != 0 or tmp2 != 0 or tmp3 != 0:
    break

if tmp1 != 0 or tmp2 != 0 or tmp3 != 0:
  print("{0} {1} {2}".format(tmp1, tmp2, tmp3))
else:
  print("-1 -1 -1")
Buggy python submission (verdict: Runtime Error):
length = int(input())  
 
data = ([int(input()) for i in range(length)])

cnt = 0
i = 1
v = 0

while v != 2:
  v = data[i]
  i = v
  if cnt >= data[0]: 
    cnt = -1
    break
  cnt += 1
  
print(cnt)

Fixed submission:
N = int(input())  
 
data = ([int(input()) for i in range(N)])

data.insert(0, 0)

cnt = 0
i = 1
v = 0

while v != 2:
  v = data[i]
  i = v
  if cnt >= N: 
    cnt = -1
    break
  cnt += 1
  
print(cnt)

Buggy python submission (verdict: Runtime Error):
length = int(input())  
 
data = ([int(input()) for i in range(length)])

cnt = 0
i = 1
v = 0

while v != 2:
  v = data[i]
  i = v
  cnt += 1
  if cnt >= data[0]: 
    cnt = -1
    break
print(cnt)

Fixed submission:
N = int(input())  
 
data = ([int(input()) for i in range(N)])

data.insert(0, 0)

cnt = 0
i = 1
v = 0

while v != 2:
  v = data[i]
  i = v
  if cnt >= N: 
    cnt = -1
    break
  cnt += 1
  
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
power = 1

for i in range(1, N + 1, 1):
  power = i * power
  
print(power % (10 ** 9 + 7))

Fixed submission:
N = int(input())
power = 1

for i in range(1, N + 1, 1):
 
  power = (i * power) % (10**9 + 7)
  
print(power)

Buggy python submission (verdict: Runtime Error):
N = int(input())
power = 1

for i in range(1, N + 1, 1):
  power = i * power
  
print(power / (10 ** 9 + 7))

Fixed submission:
N = int(input())
power = 1

for i in range(1, N + 1, 1):
 
  power = (i * power) % (10**9 + 7)
  
print(power)

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

for i in range(1, N + 1, 1):
  
  if i == 1:
    power = i
  else:
  	power = i * power
  
print(power / (10 ** 9 + 7))

Fixed submission:
N = int(input())
power = 1

for i in range(1, N + 1, 1):
 
  power = (i * power) % (10**9 + 7)
  
print(power)
Buggy python submission (verdict: Runtime Error):
words = {"dream": "A", "dreamer": "A", "erase": "A", "eraser": "A"}
 
ans = []
 
inputs = list(input())
 
inputs = inputs.replace("eraser", "").replace("dreamer", "")
inputs = .replace("dream", "").replace("erase", "")

if len(list(inputs)) > 0:
  print("No")
else:
  print("Yes")

Fixed submission:
words = {"dream": "A", "dreamer": "A", "erase": "A", "eraser": "A"}
 
ans = []
 
inputs = str(input())
 
inputs = inputs.replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "")

if len(list(inputs)) > 0:
  print("NO")
else:
  print("YES")

Buggy python submission (verdict: Runtime Error):
words = {"dream": "A", "dreamer": "A", "erase": "A", "eraser": "A"}

ans = []

inputs = list(input())

tmp1 = []

for c in reversed(inputs):
  
  tmp1.append(c)
  
  tmp2 = "".join([x for x in reversed(tmp1)])
  
  if tmp2 in words:
    ans.append("".join(tmp2))
    tmp1.clear()
    tmp2.clear()

ans = [x for x in reversed(ans)]

if "".join(ans) == "".join(inputs):
  print("YES")
else:
  print("No")

Fixed submission:
words = {"dream": "A", "dreamer": "A", "erase": "A", "eraser": "A"}
 
ans = []
 
inputs = str(input())
 
inputs = inputs.replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "")

if len(list(inputs)) > 0:
  print("NO")
else:
  print("YES")