Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
word = input()
al = [chr(ord("a") + i) for i in range(26)]
ans = "None"
for i in range(len(al)):
    if not al[i] in word:
      ans = append(al[i])
      break
print(ans)

        


Fixed submission:
word = input()
al = "qwertyuiopasdfghjklzxcvbnm"
d = []
for i in range(len(al)):
    if not al[i] in word:
        d.append(al[i])
if d == []:
    print("None")
else:
    print(sorted(d)[0])
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())

print(sum(sorted(list(map(input(split()))), reverse = True)[0:k+1]))

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

num = sorted(list(map(int, input().split())), reverse = True)

print(sum(num[:k]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = sorted(list(map(int, input().split())), reverse = True)

sum = 0
for i in range(n):
    a.pop(0)
    sum += a.pop(0)
print(sum)


Fixed submission:
n = int(input())
a = sorted(list(map(int, input().split())), reverse = True)
print(sum(a[1::2][:n]))
Buggy python submission (verdict: Runtime Error):
K, S = map(int, input().split())

result = 0

for x in range(K + 1):
    for y in range(K + 1):
        Z = S - X - Y
        if 0 <= Z and  Z <= K:
            result += 1

print(result)

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

result = 0

for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if 0 <= z <= K:
            result += 1

print(result)

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

result = 0

for x in range(K + 1):
    for y in range(K + 1):
        Z = S - X - Y
        if 0 <= Z <= K:
            result += 1

print(result)

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

result = 0

for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if 0 <= z <= K:
            result += 1

print(result)

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

result = 0

for x in range(K + 1):
    for y in range(K + 1):
        for z in range(K + 1):
            if x + y + z == S:
                result += 1

print(result)

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

result = 0

for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if 0 <= z <= K:
            result += 1

print(result)
Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

x,y = map(int,input().split())
print(lcm(x,y))

Fixed submission:
from fractions import gcd
import math
def lcm(x, y):
    return (x * y) // gcd(x, y)

x,y = map(int,input().split())
print(lcm(x,y))

Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

x,y = map(int,input().split())
print(lcm(x,y))

Fixed submission:
from fractions import gcd
import math
def lcm(x, y):
    return (x * y) // gcd(x, y)

x,y = map(int,input().split())
print(lcm(x,y))
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
l = list(map(int, input().split()))
ans=1;
for i in range(n):
	ans=max(math.gcd(math.gcd(l[0],l[i-1]),math.gcd(l[i],l[n-1])),ans)
print(ans)

Fixed submission:
def gcd(a,b):
	while b:
		a,b=b,a%b
	return a
n=int(input())
l = list(map(int, input().split()))
ans=1;
m=[0]*(n+1)
o=[0]*(n+1)
for i in range(n):
	m[i+1]=gcd(m[i],l[i])
	o[i+1]=gcd(o[i],l[n-i-1])
for i in range(n):
	ans=max(gcd(m[i],o[n-i-1]),ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, A, B = [int(i) for i in input().split()]
ans = []
if (B-A)%2 == 0:
print(int(int(B-A)/2))
else:
print(int((B-A)//2+1+min([A-1,N-B])))

Fixed submission:
N, A, B = [int(i) for i in input().split()]
ans = []
if (B-A)%2 == 0:
    print(int((B-A)//2))
else:
    print(int((B-A)//2+1+min([A-1,N-B])))

Buggy python submission (verdict: Runtime Error):
    N, A, B = [int(i) for i in input().split()]
    ans = []
    if (B-A)%2 == 0:
        print(int(int(B-A)/2))
    else:
        print(int((B-A)//2+1+min([A-1,N-B])))

Fixed submission:
N, A, B = [int(i) for i in input().split()]
ans = []
if (B-A)%2 == 0:
    print(int((B-A)//2))
else:
    print(int((B-A)//2+1+min([A-1,N-B])))

Buggy python submission (verdict: Runtime Error):
    N, A, B = [int(i) for i in input().split()]
    ans = []
    if (B-A)%2 == 0:
        print(int((B-A)/2))
    else:
        print(int((B-A)//2+1+min([A-1,N-B])))

Fixed submission:
N, A, B = [int(i) for i in input().split()]
ans = []
if (B-A)%2 == 0:
    print(int((B-A)//2))
else:
    print(int((B-A)//2+1+min([A-1,N-B])))
Buggy python submission (verdict: Runtime Error):
K,X = map(int, input().split(" "))
x_min = X-K+1
x_max = X+K-1
r = [i for i in range(x_min,x_max+1)]
print(" ".join(r))


Fixed submission:
K,X = map(int, input().split(" "))
x_min = X-K+1
x_max = X+K-1
r = [str(i) for i in range(x_min,x_max+1)]
print(" ".join(r))

Buggy python submission (verdict: Runtime Error):
K,X = map(int, input().split(" "))
x_min = X-K+1
x_max = X+k-1
r = [i for i in range(x_min,x_max+1)]
print(" ".join(r))

Fixed submission:
K,X = map(int, input().split(" "))
x_min = X-K+1
x_max = X+K-1
r = [str(i) for i in range(x_min,x_max+1)]
print(" ".join(r))
Buggy python submission (verdict: Runtime Error):
a=int(input)
def area(int x):
  area=3*(x^2)
  return area
x=area(a)
print (x)

Fixed submission:
a=int(input())
print(3*(a*a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = int(input(), 2)

print(x * (x+1))

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

import copy

if len(s) == 1:
    print(k//2)

elif len(s) == len(set(s)):
    print(0)
    
elif s[0] != s[-1]:
    c = 0
    for i in range(1, len(s)):
        if s[i-1] == s[i]:
            c = c + 1
            s[i] = 'Z'
    print(c*k)

else: # s[0]==s[-1]
    s2 = copy.copy(s)
    c = 0
    for i in range(1, len(s)):
        if s[i-1] == s[i]:
            c = c + 1
            s[i] = 'Z'
    if s[-1] == 'Z':
        print(c*k)
    else:
        c2 = 1
        s2[0] = 'Z'
        for i in range(1, len(s)):
            if s2[i-1] == s2[i]:
                s2[i] = 'Z'
                c2 = c2 + 1
        if s2[-1] == 'Z':
            if k % 2 == 0:
                print(int((c+c2)*(k/2)))
            else:
                print(int((c+c2)*((k-1)/2)+c))
        else:
            print(c + c2*(k-1))
Buggy python submission (verdict: Runtime Error):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(i)

    if temp!=1:
        arr.append(temp)

    if arr==[]:
        arr.append(n)

    return arr

#import numpy as np

a, b = map(int, input().split())
if a==1 and b==1:
    print(1)
else:
    #print(factorization(a))
	prime_a = factorization(a)
	prime_b = factorization(b)
	#print(prime_a, prime_b)
	print(1+len(set(prime_a)&set(prime_b)))

Fixed submission:
n = int(input())

if n%2==0:
    print(1/2)
else:
    print((n+1)/2/n)
Buggy python submission (verdict: Runtime Error):
import numpy as np

n = int(input())
a = [int(x) for x in input().split()]
np_a = np.array(a)

a_idx = np.argsort(np_a)
#print(a_idx)

res = [str(1+int(x)) for x in a_idx.tolist()]
#print(res)

print(' '.join(res))


Fixed submission:
import numpy as np

n = int(input())
a = [int(x) for x in input().split()]
np_a = np.array(a)

a_idx = np.argsort(np_a)
#print(a_idx)

res = [str(1+int(x)) for x in a_idx.tolist()]
#print(res)

print(' '.join(res))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(x) for x in input().split()]

a_sorted = sorted(a)
#print(a)
#print(a_sorted)

a_idx = [str(1+a.index(x)) for x in a_sorted]
#print(a_idx)

print(' '.join(a_idx))


Fixed submission:
import numpy as np

n = int(input())
a = [int(x) for x in input().split()]
np_a = np.array(a)

a_idx = np.argsort(np_a)
#print(a_idx)

res = [str(1+int(x)) for x in a_idx.tolist()]
#print(res)

print(' '.join(res))
Buggy python submission (verdict: Runtime Error):
n = input()
if n == 1:
  print (n)
else:
  if n % 2 == 1:
    print(0.6)
  else:
    print(0.5)

Fixed submission:
n = int(input())
if n == 1:
  print (n)
else:
  if n % 2 == 1:
    print((n//2+1)/n)
  else:
    print(1/2)
Buggy python submission (verdict: Runtime Error):
### INPUT
N = int(input())
A = list(map(int,input().split()))
cont = 0
CN = [0]
b = N-1
### MAIN
for i in range(b):
    s = i
    while A[s]>=A[s+1] and s+1!=b:
        cont = cont + 1
        s = 1 + s
    if  (A[s]>=A[s+1]) and (s+1==b):
        cont =cont + 1
    if  cont != 0:
        CN.extend([cont])
        cont = 0
### MAX

print(max(CN))


Fixed submission:
t = list(input())
s = list(input())
cnt = 0
for a in range(3):
    if s[a] == t[a]:
        cnt = cnt + 1

print(cnt)

Buggy python submission (verdict: Runtime Error):
### INPUT
N = int(input())
A = list(map(int,input().split()))
A.extend([1000])
cont = 0
CN = [0]
b = N-1
### MAIN
for i in range(b):
    s = i
    while (A[s]>A[s+1]) and ((s+1)!=(b+1)):
        cont = cont + 1
        s = 1 + s
    if  cont != 0:
        CN.extend([cont])
        cont = 0
### MAX
print(max(CN))


Fixed submission:
t = list(input())
s = list(input())
cnt = 0
for a in range(3):
    if s[a] == t[a]:
        cnt = cnt + 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
c=0
for i in range(a):
  c = c+i
  
print(c)

Fixed submission:
N = int(input())
print((N-1)*N//2)

Buggy python submission (verdict: Time Limit Exceeded):
a=int(input())
c=0
for i in range(a):
  c = c+i
  
print(c)

Fixed submission:
N = int(input())
print((N-1)*N//2)

Buggy python submission (verdict: Runtime Error):
a = int(input())
  c=0
for i in range(a)
  c = i+c
print(c)

Fixed submission:
N = int(input())
print((N-1)*N//2)
Buggy python submission (verdict: Runtime Error):
a, b, x = [int(x) for x in input().split(' ')]

prev_max_number = 0
answer = -1
for i in range(10):
    baseline = b * (i + 1)
    offset = (x - baseline) // a
    min_number = (10 ** i)
    max_number = (10 ** (i + 1)) - 1

    if offset < min_number:
        answer = prev_max_number
        break

    if offset < max_number:
        answer = offset
        break

    prev_max_number = max_number

if answer < (10 ** 9):
    print(answer)
else:
    print(10 ** 9)


Fixed submission:
days = ['SUN','MON','TUE','WED','THU','FRI','SAT']
s = input().rstrip()
index = days.index(s)
for i in range(7):
    ni = (index + i + 1) % 7
    if days[ni] == 'SUN':
        print(i + 1)
        break
Buggy python submission (verdict: Runtime Error):
import math

# 入力
N = int(input())

ans = 10**12
square = math.ceil(math.sqrt(N))
for i in range(1, square):
    if N%i == 0:
        ans = min(ans, int(N/i))
b = int(N/ans)
print(ans + b-2)

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

if A < 10 and B < 10:
    print(A*B)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
import math

#入力
a,b,x = map(int, input().split())

if a*b*a/2 < x:
    if a == 1 and b == 1 and x == 1:
        print(0)
    else:
        c = 2*x/(a*a) - b
        d = a*b/(b-c)
        print(90-math.degrees(math.atan(d/b)))
else:
    c = (2*x)/(a*b)
    print(90 - math.degrees(math.atan(c/b)))


Fixed submission:
import math

#入力
a,b,x = map(int, input().split())

if a*b*a/2 < x:
    c = 2*x/(a*a) - b
    if b == c:
        print(0)
    else:
        d = a*b/(b-c)
        print(90-math.degrees(math.atan(d/b)))
else:
    c = (2*x)/(a*b)
    print(90 - math.degrees(math.atan(c/b)))

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

#入力
a,b,x = map(int, input().split())

if a*b*a/2 < x:
    c = 2*x/(a*a) - b
    d = a*b/(b-c)
    print(90-math.degrees(math.atan(d/b)))
else:
    c = (2*x)/(a*b)
    print(90 - math.degrees(math.atan(c/b)))

Fixed submission:
import math

#入力
a,b,x = map(int, input().split())

if a*b*a/2 < x:
    c = 2*x/(a*a) - b
    if b == c:
        print(0)
    else:
        d = a*b/(b-c)
        print(90-math.degrees(math.atan(d/b)))
else:
    c = (2*x)/(a*b)
    print(90 - math.degrees(math.atan(c/b)))

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

#入力
a,b,x = map(int, input().split())

c = (2*x)/(a*b)
if a*b*a/2 < x:
    c = 2*x/(a*a) - b
    d = a*b/(b-c)
    print(90-math.degrees(math.atan(d/b)))
else:
    print(90 - math.degrees(math.atan(c/b)))


Fixed submission:
import math

#入力
a,b,x = map(int, input().split())

if a*b*a/2 < x:
    c = 2*x/(a*a) - b
    if b == c:
        print(0)
    else:
        d = a*b/(b-c)
        print(90-math.degrees(math.atan(d/b)))
else:
    c = (2*x)/(a*b)
    print(90 - math.degrees(math.atan(c/b)))
Buggy python submission (verdict: Runtime Error):
# 入力                                                                                   
S = input()
K = int(input())

# kindリストに同じ文字が続くものごとに区切ったものを格納                                 
kind = []
back = "0"
len_S = len(S)
i = 0
for moji in S:
    if i == 0:
        back = moji
        i += 1
        continue
    if moji == back[-1]:
        back = moji + back
        if i == len_S-1:
            kind.append(back)
    else:
        kind.append(back)
        back = moji
    i += 1

score = 0
# 最初の文字と最後の文字が異なる時                                                       
if S[0] != S[-1]:
    for word in kind:
        len_word = len(word)
        score += len_word // 2
    print(score*K)
# 最初の文字と最後の文字が一緒の時                                                       
else:
    if len(set(kind)) == 1:
        print((len(kind[0])//2)*K)
    else:
        # 最初と最後がつながることでできる文字列の長さ                                   
        len_sg = len(kind[0] + kind[-1])
        for word in kind[1:-1]:
            len_word = len(word)
            score += len_word // 2
        print(score*K + (len_sg//2)*(K-1) + (len(kind[0]))//2 + (len(kind[-1]))//2 )

Fixed submission:
# 入力                                                                                   
S = input()
K = int(input())

# kindリストに同じ文字が続くものごとに区切ったものを格納                                 
kind = []
back = "0"
len_S = len(S)
i = 0
for moji in S:
    if i == 0:
        back = moji
        i += 1
        continue
    if moji == back[-1]:
        back = moji + back
        if i == len_S-1:
            kind.append(back)
    else:
        kind.append(back)
        back = moji
    i += 1

score = 0
# 文字列が1文字の時
if len(S) == 1:
  	print(K//2)
   
# 最初の文字と最後の文字が異なる時                                                       
elif S[0] != S[-1]:
    for word in kind:
        len_word = len(word)
        score += len_word // 2
    print(score*K)
# 最初の文字と最後の文字が一緒の時                                                       
else:
    if len(set(kind)) == 1:
      	if len(kind) == 1:
          	print(len(kind[0])*K//2)
      	else:
        	print((len(kind[0])//2)*K)
    else:
        # 最初と最後がつながることでできる文字列の長さ                                   
        len_sg = len(kind[0] + kind[-1])
        for word in kind[1:-1]:
            len_word = len(word)
            score += len_word // 2
        print(score*K + (len_sg//2)*(K-1) + (len(kind[0]))//2 + (len(kind[-1]))//2 )
Buggy python submission (verdict: Runtime Error):
r = int(input())
print((3 * r*r)

Fixed submission:
r = int(input())
print(3 * r*r)
Buggy python submission (verdict: Runtime Error):
import heapq
n,m = map(int,input().split())
l = []
for i in range(n):
  a,b = map(int,input().split())
  l.append([a,b])
l = sorted(l, key=lambda x: (x[0],x[1]))
b = []
heapq.heapify(l)
j = 0
q = 0
for i in range(m):
  key = i+1
  if j >= n+1:
    break
  while j < n:
    if l[j][0] != key:
      break
    heapq.heappush(b,-l[j][1])
    j += 1
  if b != []:
    heapq.heapify(b)
    k = -heapq.heappop(b)
    q += k
print(q)

Fixed submission:
a,b = map(int,input().split())
print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Runtime Error):
import heapq
n,m = map(int,input().split())
l = [0]*n
for i in range(n):
  l[i] = list(map(int,input().split()))
l.sort()

L = [[] for i in range(m+1)]
for i in range(n):
  if l[i][0] <= m:
    L[l[i][0]].append(l[i][1])

a = []
ans = 0
for i in range(m):
  key = i+1
  for j in L[key]:
    heapq.heappush(a, -L[i][j])
  if a != []:
    heapq.heapify(a)
    ans += heapq.heappop(a)
print(-ans)

Fixed submission:
from heapq import *
n,m = map(int,input().split())
l = [[] for i in range(m+1)]
for i in range(n):
  a,b = map(int,input().split())
  if a < m+1:
    l[a].append(b)

ans = 0
a = []
for i in range(1,m+1):
  for j in l[i]:
    heappush(a,-j)
  if a:
    ans -= heappop(a)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n,m = map(int,input().split())
l = [0]*n
for i in range(n):
  l[i] = list(map(int,input().split()))
l.sort()

L = [[] for i in range(m+1)]
for i in range(n):
  if l[i][0] <= m:
    L[l[i][0]].append(l[i][1])

a = []
ans = 0
for i in range(m):
  key = i+1
  for j in L[key]:
    a.append(-j)
  if a != []:
    heapq.heapify(a)
    ans += heapq.heappop(a)
print(-ans)

Fixed submission:
from heapq import *
n,m = map(int,input().split())
l = [[] for i in range(m+1)]
for i in range(n):
  a,b = map(int,input().split())
  if a < m+1:
    l[a].append(b)

ans = 0
a = []
for i in range(1,m+1):
  for j in l[i]:
    heappush(a,-j)
  if a:
    ans -= heappop(a)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n,m = map(int,input().split())
l = []
for i in range(n):
  a,b = map(int,input().split())
  l.append([a,b])
l = sorted(l, key=lambda x: (x[0],x[1]))
b = []
heapq.heapify(l)
j = 0
q = 0
for i in range(m):
  key = i+1
  if j >= n+1:
    break
  while j < n:
    if l[j][0] != key:
      break
    heapq.heappush(b,-l[j][1])
    j += 1
  if b != []:
    heapq.heapify(b)
    k = -heapq.heappop(b)
    q += k
print(q)

Fixed submission:
from heapq import *
n,m = map(int,input().split())
l = [[] for i in range(m+1)]
for i in range(n):
  a,b = map(int,input().split())
  if a < m+1:
    l[a].append(b)

ans = 0
a = []
for i in range(1,m+1):
  for j in l[i]:
    heappush(a,-j)
  if a:
    ans -= heappop(a)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import heapq
n,m = map(int,input().split())
l = []
for i in range(n):
  a,b = map(int,input().split())
  l.append([a,b])
l = sorted(l, key=lambda x: (x[0],x[1]))
b = []
heapq.heapify(l)
j = 0
q = 0
for i in range(m):
  key = i+1
  if j >= n+1:
    break
  while j < n:
    if l[j][0] != key:
      break
    heapq.heappush(b,-l[j][1])
    j += 1
  if b != []:
    heapq.heapify(b)
    k = -heapq.heappop(b)
    q += k
print(q)

Fixed submission:
from heapq import *
n,m = map(int,input().split())
l = [[] for i in range(m+1)]
for i in range(n):
  a,b = map(int,input().split())
  if a < m+1:
    l[a].append(b)

ans = 0
a = []
for i in range(1,m+1):
  for j in l[i]:
    heappush(a,-j)
  if a:
    ans -= heappop(a)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
for i in range(n):
  b = a[:i] + a[i+1:]
  print(max(b))

Fixed submission:
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
b = sorted(a)
m = b[n-2]
M = b[n-1]
if M == m:
  for i in range(n):
    print(M)
else:
  for i in range(n):
    if a[i] == M:
      print(m)
    else:
      print(M)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
a = a*2
k = 0
b = []
for j in range(n):
  for i in range(j,j+n):
    k += (-1)**(i+2)*a[i]
  print(abs(k), end=" ")
  k = 0

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
a = a*2
k = 0
for i in range(0,n):
  k += (-1)**(i+2)*a[i]
k = abs(k)
print(k,end=" ")
for i in range(0,n-1):
  y = 2*(a[i] - k/2)
  k = y
  print(int(y),end=" ")
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = [int(input()) for i in range(m)]
b = [a[0]-1] + [a[i+1]-a[i]-2 for i in range(m-1)] + [n-a[m-1]-1]
c = [1,1]+[0]*(n-1)
for i in range(2,n+1):
  c[i] = c[i-1] + c[i-2]
ans = 1
for j in b:
  if j == -1:
    ans = 0
    break
  ans = ans * c[j] %1000000007
print(ans)

Fixed submission:
n,m = map(int,input().split())
a = [int(input()) for i in range(m)]
b = []
if a:
  b = [a[0]-1] + [a[i+1]-a[i]-2 for i in range(m-1)] + [n-a[m-1]-1]
c = [1,1]+[0]*(n-1)
for i in range(2,n+1):
  c[i] = c[i-1] + c[i-2]
ans = 1
if b:
  for j in b:
    if j == -1:
      ans = 0
      break
    ans = (ans * c[j]) %1000000007
else:
  ans = c[n] % 1000000007
print(ans)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
h = []
for i in range(0,m):
  h.append(int(input()))
now = 0
s = 1
def c(i):
  if 0 <= i <= 2:
    return i
  else:
    return c(i-2) + c(i-1)

def check(h):
  if m == 1:
    return 0
  if m == 2 and h[0]+1 == h[1]:
    return -1
  for i in range(0,m-2):
    if h[i] + 1 == h[i+1]:
      return -1
  return 0

if check(h) == 0:
  for i in h:
    b = i - now - 1
    if b > 0:
      s = (s * c(b)) % 1000000007
    now = i + 1
  s = (s * c(n-now)) % 1000000007
  print(s)
else:
  print(0)

Fixed submission:
n,m = map(int,input().split())
a = [int(input()) for i in range(m)]
b = []
if a:
  b = [a[0]-1] + [a[i+1]-a[i]-2 for i in range(m-1)] + [n-a[m-1]-1]
c = [1,1]+[0]*(n-1)
for i in range(2,n+1):
  c[i] = c[i-1] + c[i-2]
ans = 1
if b:
  for j in b:
    if j == -1:
      ans = 0
      break
    ans = (ans * c[j]) %1000000007
else:
  ans = c[n] % 1000000007
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**6)
N = int(input())
v = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    v[a].append([b,i])

ans = [None] * (N-1)

def decide_colord(cur,color):
    cnt = 1
    for (to,j)in v[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        decide_colord(to,cnt)
        cnt += 1
decide_colord(0,0)
print(max(ans))
[print(a) for a in ans]

Fixed submission:
day = {'SUN':7,'MON':6,'TUE':5,'WED':4,'THU':3,'FRI':2,'SAT':1}
s = input()
print(day[s])
Buggy python submission (verdict: Runtime Error):
N = int(input())
v = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    v[a].append([b,i])

ans = [None] * (N-1)

def decide_colord(cur,color):
    cnt = 1
    for (to,j)in v[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        decide_colord(to,cnt)
        cnt += 1
decide_colord(0,0)
print(max(ans))
[print(a) for a in ans]

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
N = int(input())
v = [[] for i in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    v[a].append([b,i])

ans = [None] * (N-1)

def decide_colord(cur,color):
    cnt = 1
    for (to,j)in v[cur]:
        if cnt == color:
            cnt += 1
        ans[j] = cnt
        decide_colord(to,cnt)
        cnt += 1
decide_colord(0,0)
print(max(ans))
[print(a) for a in ans]
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
a = []
x = []
y = []
count = 0

def factorial(n):
    if n<2:
        return 1
    else:
        return(n*factorial(n-1))

for i in range(N):
    a.append(list(map(int,input().split())))    
for i in range(N):
    for j in range(N):
        if i==j:
            continue
        count += np.sqrt((a[i][0] - a[j][0])**2 + (a[i][1] - a[j][1])**2)
b = factorial(N)
#print(count/b)
print(count/N)


Fixed submission:
r = int(input())
print(r**2)

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
a = []
x = []
y = []
count = 0

def factorial(n):
    if n<2:
        return 1
    else:
        return(n*factorial(n-1))

for i in range(N):
    a.append(list(map(int,input().split())))    
for i in range(N):
    for j in range(N):
        if i==j:
            continue
        count += np.sqrt((a[i][0] - a[j][0])**2 + (a[i][1] - a[j][1])**2)
b = factorial(N)
print(count/b)
#print(count/N)


Fixed submission:
r = int(input())
print(r**2)