Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
t = 1
for i in range(1,n+1):
    t *= i
print(t%((10**9)+7))

Fixed submission:
n = int(input())
t = 1
a = 10**9 + 7
for i in range(1,n+1):
    t *= i
    t %= a
print(t)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
t = 1
for i in range(1,n+1):
    t *= i
if t > 10**9 + 7:
    print(t%((10**9)+7))
else:
    print(t)

Fixed submission:
n = int(input())
t = 1
a = 10**9 + 7
for i in range(1,n+1):
    t *= i
    t %= a
print(t)
Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
l = []
x = []
for i in range(len(s)):
    for j in range(len(s)-1,0,-1):
        if s[i] == "A":
            l.append(i)
            if s[j] == "Z":
                x.append(j)
print(max(x)-min(l)+1)

Fixed submission:
s = str(input())
a = []
b = []
for i in range(len(s)):
    if s[i] == "A":
        a.append(i)
    elif s[i] == "Z":
        b.append(i)
print(max(b)-min(a)+1)

Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
l = []
for i in range(len(s)):
    for j in range(len(s)-1,0,-1):
        if s[i] == "A":
            if s[j] == "Z":
                l.append(j+1-i)
print(max(l))

Fixed submission:
s = str(input())
a = []
b = []
for i in range(len(s)):
    if s[i] == "A":
        a.append(i)
    elif s[i] == "Z":
        b.append(i)
print(max(b)-min(a)+1)

Buggy python submission (verdict: Time Limit Exceeded):
s = str(input())
l = []
for i in range(len(s)):
    for j in range(len(s)-1,0,-1):
        if s[i] == "A":
            if s[j] == "Z":
                l.append((j+1-i))
                break
print(max(l))

Fixed submission:
s = str(input())
a = []
b = []
for i in range(len(s)):
    if s[i] == "A":
        a.append(i)
    elif s[i] == "Z":
        b.append(i)
print(max(b)-min(a)+1)

Buggy python submission (verdict: Runtime Error):
s = str(input())
l = []
for i in range(len(s)):
    for j in range(len(s)-1,0,-1):
        if s[i] == "A":
            if s[j] == "Z":
                l.append((j+1-i)
                break
print(max(l))

Fixed submission:
s = str(input())
a = []
b = []
for i in range(len(s)):
    if s[i] == "A":
        a.append(i)
    elif s[i] == "Z":
        b.append(i)
print(max(b)-min(a)+1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
l = []
c = 0
if s.count("I") < s.count("D"):
    print(0)
else:
    for i in range(len(s)):
        if s[i] == "I":
            c += 1
        elif s[i] == "D":
            c -= 1
        l.append(c)
print(max(l))

Fixed submission:
n = int(input())
s = str(input())
l = []
c = 0
for i in range(len(s)):
    if s[i] == "I":
        c += 1
    elif s[i] == "D":
        c -= 1
    l.append(c)
print(max(max(l),0))
Buggy python submission (verdict: Time Limit Exceeded):
k,s = map(int,input().split())
d = 0
for a in range(0,k+1):
    for b in range(0,k+1):
        for c in range(0,k+1):
            if a+b+c == s:
                d += 1
print(d)

Fixed submission:
k,s = map(int,input().split())
d = 0
for a in range(0,k+1):
    for b in range(0,k+1):
        if 0 <= s-a-b <= k:
                d += 1
print(d)

Buggy python submission (verdict: Runtime Error):
k,s = map(int,input().split())
if s/k == 3 or k/s == 3:
    print(1)
elif k < s:
    print(int((1/2)*(k+1)*(k+2)))
elif k >= s:
    print(int((1/2)*(s+1)*(s+2)))

Fixed submission:
k,s = map(int,input().split())
d = 0
for a in range(0,k+1):
    for b in range(0,k+1):
        if 0 <= s-a-b <= k:
                d += 1
print(d)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

if 0 in A:
  sum = 0
sum = 1
ans = 0
for x in A:
  sum *= x
  if sum > 1000000000000000000:
    ans = -1
  if sum == 0:
    ans = 0
    break

if ans < 0:
  print(ans)
else:
  print(sum)

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

sum = 1
if 0 in A:
  sum = 0
ans = 0
for x in A:
  sum *= x
  if sum > 1000000000000000000:
    ans = -1
    break
  if sum == 0:
    ans = 0
    break

if ans < 0:
  print(ans)
else:
  print(sum)

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

sum = 1
ans = 0
for x in A:
  sum *= x
  if sum > 1000000000000000000:
    ans = -1
  if sum == 0:
    ans = 0

if ans < 0:
  print(ans)
else:
  print(sum)

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

sum = 1
if 0 in A:
  sum = 0
ans = 0
for x in A:
  sum *= x
  if sum > 1000000000000000000:
    ans = -1
    break
  if sum == 0:
    ans = 0
    break

if ans < 0:
  print(ans)
else:
  print(sum)
Buggy python submission (verdict: Runtime Error):
import sys
d = 'ABC'
N, *v = map(int, input().split())
e = [tuple(map(d.index, input())) for _ in range(N)]
p = []
def f(i):
	if i == len(e):
		print('Yes')
		print('\n'.join(p))
		raise SystemExit
	k, j = e[i]
	for a, s in ((k, j), (j, k)):
		if v[s] == 0: continue
		v[a] += 1
		v[s] -= 1
		p.append(d[a])
		f(i+1)
		v[a] -= 1
		v[s] += 1
		p.pop()
f(0)
print('No')

Fixed submission:
import sys
sys.setrecursionlimit(1<<30)
d = 'ABC'
N, *v = map(int, input().split())
e = [tuple(map(d.index, input())) for _ in range(N)]
p = []
def f(i):
	if i == len(e):
		print('Yes')
		print('\n'.join(p))
		raise SystemExit
	k, j = e[i]
	for a, s in ((k, j), (j, k)):
		if v[s] == 0: continue
		v[a] += 1
		v[s] -= 1
		p.append(d[a])
		f(i+1)
		v[a] -= 1
		v[s] += 1
		p.pop()
f(0)
print('No')
Buggy python submission (verdict: Runtime Error):
import sys
N = int(input().strip())
grid = []
ref = 0
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
    if array[2]>0:
      ref = i
x = 0
y = 0
while y <= 100:
  x = 0
  while x <= 100:
    h0 = grid[ref][2]+abs(x-grid[ref][0])+abs(y-grid[ref][1])
    for arrays in grid:
      h = h0-abs(x-arrays[0])-abs(y-arrays[1])
      if h != arrays[2]:
        break
    print(x,y,h0)
      sys.exit()
    x += 1
  y += 1

Fixed submission:
import sys
N = int(input().strip())
grid = []
ref = 0
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
    if array[2]>0:
      ref = i
x = 0
y = 0
while y <= 100:
  x = 0
  while x <= 100:
    flag = 0
    h0 = grid[ref][2]+abs(x-grid[ref][0])+abs(y-grid[ref][1])
    for arrays in grid:
      h = max(0,h0-abs(x-arrays[0])-abs(y-arrays[1]))
      if h != arrays[2]:
        flag = 1
    if flag == 0:
      print(x,y,h0)
      sys.exit()
    x += 1
  y += 1

Buggy python submission (verdict: Runtime Error):
import sys
N = int(input().strip())
grid = []
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
x = 0
y = 0
while y <= 100:
  x = 0
  while x <= 100:
    lis = []
    for arrays in grid:
      if arrays[2]>=1:
        lis.append(arrays[2]+abs(x-arrays[0])+abs(y-arrays[1]))
    if min(lis)==max(lis):
      if print(x,y,max(0,arrays[2]+abs(x-arrays[0])+abs(y-arrays[1])))
      sys.exit()
    x += 1
  y += 1
        


Fixed submission:
import sys
N = int(input().strip())
grid = []
ref = 0
for i in range(N):
    array = list(map(int, input().strip().split(' ')))
    grid.append(array)
    if array[2]>0:
      ref = i
x = 0
y = 0
while y <= 100:
  x = 0
  while x <= 100:
    flag = 0
    h0 = grid[ref][2]+abs(x-grid[ref][0])+abs(y-grid[ref][1])
    for arrays in grid:
      h = max(0,h0-abs(x-arrays[0])-abs(y-arrays[1]))
      if h != arrays[2]:
        flag = 1
    if flag == 0:
      print(x,y,h0)
      sys.exit()
    x += 1
  y += 1
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N,M = map(int, input().split())
tmax = int(M/N)
t = tmax
while 1 == 1:
  if M%t==0:
    print(t)
    sys.exit()
  t += -1

Fixed submission:
import sys
import math
N,M = map(int, input().split())
if N==1:
  print(M)
  sys.exit()
tmax = int(M/N)
t = tmax
divisor_list = [1]
for i in range(2, int(math.sqrt(M)) + 1):
  if M % i == 0:
    divisor_list.append(i)
    divisor_list.append(M//i)
divisor_list.sort(reverse = True)
for nums in divisor_list:
  if nums <= tmax:
    print(nums)
    sys.exit()
Buggy python submission (verdict: Runtime Error):
import fractions
n,x = map(int, input().split())
lis = [int(i) for i in input().split()]
lis2 = []
for nums in lis:
  lis2.append(abs(nums-x))
ans = 10000000000000
if n == 1:
  ans = lis2[0]
else:
  i = 2
  g = fractions.gcd(lis2[0],lis2[1])
  while i < n:
    g = fractions.gcd(g,lis2[i])
    i += 1
print(g)

Fixed submission:
import fractions
n,x = map(int, input().split())
lis = [int(i) for i in input().split()]
lis2 = []
for nums in lis:
  lis2.append(abs(nums-x))
ans = 10000000000000
if n == 1:
  g = lis2[0]
else:
  i = 2
  g = fractions.gcd(lis2[0],lis2[1])
  while i < n:
    g = fractions.gcd(g,lis2[i])
    i += 1
print(g)
Buggy python submission (verdict: Runtime Error):
K = int(input)
m = K//2
print(m*(K-m))

Fixed submission:
K = int(input())
m = K//2
print(m*(K-m))
Buggy python submission (verdict: Runtime Error):
import sys
N,K = map(int, input().split())
lis = [int(i) for i in input().split()]
if N == 1:
  print(1)
  sys.exit()
ind = lis.index(1)+1
print(ind)
pre = ind-1
pos = l-ind-1
if pre%(K-1)==0:
  a = pre//(K-1)
else:
  a = pre//(K-1)+1
if pos%(K-1)==0:
  b = pos//(K-1)
else:
  b = pos//(K-1)+1
print(1+a+b)

Fixed submission:
import sys
N,K = map(int, input().split())
lis = [int(i) for i in input().split()]
if N == 1:
  print(0)
  sys.exit()
if N<=K:
  print(1)
  sys.exit()
ind = lis.index(1)+1
if (N-1)%(K-1)==0:
  print(int((N-1)/(K-1)))
else:
  print(int((N-1)//(K-1))+1)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if A<=8 and B<=8:
  print('Yay!')
else:
  print(':(')

Fixed submission:
A,B = map(int, input().split())
if A<=8 and B<=8:
  print('Yay!')
else:
  print(':(')

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if A<=8 and B<=8:
  print('Yay!')
else:
  print(':(')

Fixed submission:
A,B = map(int, input().split())
if A<=8 and B<=8:
  print('Yay!')
else:
  print(':(')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = input()
i = 1
li = []
charas = 'abcdefghijklmnopqrstuvwxyz'
while i < N:
  m = 0
  s1 = s[0:i]
  s2 = s[i:]
  for chara in charas:
    if chara in s1 and chara in s2:
      m += 1
  li.append(m)
print(max(li))

Fixed submission:
N = int(input())
s = input()
i = 1
li = []
charas = 'abcdefghijklmnopqrstuvwxyz'
while i < N:
  m = 0
  s1 = s[0:i]
  s2 = s[i:]
  for chara in charas:
    if chara in s1 and chara in s2:
      m += 1
  li.append(m)
  i += 1
print(max(li))
Buggy python submission (verdict: Runtime Error):
A,B,C,X,Y = (int(i) for i in input().split())
i = 0
a = []
while i <= 100000:
    p = i * 2*C + A*max(0,X-i)+B*max(0,Y-i)
    a.append(p)
    i += 1
print(min(a)

Fixed submission:
A,B,C,X,Y = (int(i) for i in input().split())
i = 0
a = []
while i <= 100000:
    p = i * 2*C + A*max(0,X-i)+B*max(0,Y-i)
    a.append(p)
    i += 1
print(min(a))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
b = []
n = 0
for i in a:
  if i in b:
    pass
  elif a.count(i) == i:
    b.append(i)
  elif a.count(i) < i:
    b.append(i)
    n += a.count(i)
  else:
    b.append(i)
    n += a.count(i) - i
print(n)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()
dic = {}
for nums in A:
  if nums in dic:
    dic[nums] += 1
  else:
    dic[nums] = 1
a = list(dic.keys())
b = list(dic.values())
i = 0
ans = 0
while i < len(a):
  if a[i] > b[i]:
    ans += b[i]
    i += 1
  else:
    ans += b[i]-a[i]
    i += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int, input().split())
a = [int(i) for i in input().split()]
cnt = []
n = 1
while n <= N:
  c = a.count(n)
  if c > 0:
    cnt.append(c)
  n += 1
cnt.sort()
l = len(cnt)
print(sum(cnt[0:(l-K)]))

Fixed submission:
from collections import Counter
N,K = map(int, input().split())
a = [int(i) for i in input().split()]
cnt = Counter(a)
mc = cnt.most_common()
j = 0
ans = 0
while j < len(mc)-K:
  obj = mc[len(mc)-1-j]
  ans += obj[1]
  j += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
s = input()
a=0
b=0
c=0
for charas in s:
  if charas=='a':
    a += 1
  elif charas == 'b':
    b += 1
  else:
    c += 1
if max(a,b,c)-min(a,b,c)<= 1:
  print('YES')
else:
  primt('NO')
        

Fixed submission:
s = input()
a=0
b=0
c=0
for charas in s:
  if charas=='a':
    a += 1
  elif charas == 'b':
    b += 1
  else:
    c += 1
if max(a,b,c)-min(a,b,c)<= 1:
  print('YES')
else:
  print('NO')
Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
ans = (1900*M + 100*(N − M)) * (2**M)
print(ans)

Fixed submission:
N,M = map(int, input().split())
ans = (1900*M + 100*(N-M)) * (2**M)
print(ans)

Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
ans = (1900*M + 100*(N − M)) × (2**M)
print(ans)

Fixed submission:
N,M = map(int, input().split())
ans = (1900*M + 100*(N-M)) * (2**M)
print(ans)
Buggy python submission (verdict: Runtime Error):
import bisect
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
c.sort()
ans = 0
def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect.bisect_left(a, x)
    if i:
        return i
    raise ValueError
def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bisect.bisect_right(a, x)
    if i != len(a):
        return len(a)-i
    raise ValueError
for bs in b:
  ans += find_lt(a, bs)*find_gt(c,bs)
print(ans)
    

Fixed submission:
import bisect
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
c.sort()
ans = 0
def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect.bisect_left(a, x)
    if i:
        return i
    return 0
def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bisect.bisect_right(a, x)
    if i != len(a):
        return len(a)-i
    return 0
for bs in b:
  ans += find_lt(a, bs)*find_gt(c,bs)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort()
c.sort(reverse=True)
p=0
q=0
i = 0
ans = 0
for bss in b:
  p = 0
  q = 0
  for ass in a:
    if ass < bss:
      p += 1
  for css in c:
    if css > bss:
      q += 1
  ans += p*q
print(ans)

Fixed submission:
import bisect
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
c.sort()
ans = 0
def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect.bisect_left(a, x)
    if i:
        return i
    return 0
def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bisect.bisect_right(a, x)
    if i != len(a):
        return len(a)-i
    return 0
for bs in b:
  ans += find_lt(a, bs)*find_gt(c,bs)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
m = max(a)
n = 0
j = 1
while j <= m:
    c = a.count(j)
    if c%2 == 1:
        n += 1
        j += 1
    else:
        j += 1
print(n)


Fixed submission:
N = int(input())
a = []
for i in range(N):
    a.append(input())
a.sort()
b = []
b.append(1)
j =1
k = 0
while j < N:
  if j == N:
    break
  elif a[j-1] == a[j]:
    b[k] += 1
    j += 1
  elif a[j-1] != a[j]:
    b.append(1)
    k += 1
    j += 1
ans = 0
for c in b:
  if c %2==1:
    ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = [int(i) for i in input().split()]
i = 0
b = []
while i <= 100000:
  n = a.count(i)
  b.append(n)
  i += 1
l = len(b)
j = 1
c = []
while j < l-1:
  nn = b[j-1]+b[j]+b[j+1]
  c.append(nn)
  j += 1
print(max(c))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
dic = {}
for nums in A:
  if nums in dic:
    dic[nums] += 1
  else:
    dic[nums] = 1
  if nums-1 in dic:
    dic[nums-1] += 1
  else:
    dic[nums-1] = 1
  if nums+1 in dic:
    dic[nums+1] += 1
  else:
    dic[nums+1] = 1
b = list(dic.values())
print(max(b))

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
i = 0
b = []
while i <= 100000:
  n = a.count(i)
  b.append(n)
  i += 1
l = len(b)
j = 1
c = []
while j < l:
  nn = b[j-1]+b[j]+b[j+1]
  c.append(nn)
  j += 1
print(max(c))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
dic = {}
for nums in A:
  if nums in dic:
    dic[nums] += 1
  else:
    dic[nums] = 1
  if nums-1 in dic:
    dic[nums-1] += 1
  else:
    dic[nums-1] = 1
  if nums+1 in dic:
    dic[nums+1] += 1
  else:
    dic[nums+1] = 1
b = list(dic.values())
print(max(b))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse = True)
k = max(A)
l = []
while k >= min(A):
  if len(l)>=2:
    break
  if A.count(k)>=4:
    l.append(k)
    l.append(k)
  elif A.count(k)>=2:
    l.append(k)
  k += -1
if len(l)<= 1:
  print(0)
else:
  print(l[0]*l[1])

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
dic={}
mx=[0,0]
for x in a:
    if x in dic:
        dic[x]+=1
    else:
        dic[x]=1
    if dic[x]==2:
        dic[x]=0
        for i in range(2):
            mx.sort()
            if mx[i]<x:
                mx[i]=x
                break
print(mx[0]*mx[1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = []
import fractions
for i in range(N):
    a.append(int(input()))
def lcd(m,n):
  c = fractions.gcd(m,n)
  return m*n/c
def ans(li):
  if len(li)=1:
    return li[0]
  else:
    li[0]=lcd(li[0],li[1])
    del li[1]
    return ans(li)
print(ans(a))


Fixed submission:
N=int(input())#入力回数を決める
import fractions
from functools import reduce
li=[]
for i in range(N):
  li.append(int(input()))
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(li))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
a.sort(reverse=True)
maxi = a[0]
j = 1
k = 1
while k <= len(a)-1:
  if (j*maxi)%a[k] == 0:
    k += 1
  else:
    k = 1
    j += 1
print(j*maxi)

Fixed submission:
N=int(input())#入力回数を決める
import fractions
from functools import reduce
li=[]
for i in range(N):
  li.append(int(input()))
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)
print(lcm_list(li))
Buggy python submission (verdict: Runtime Error):
import sys
N = int(input())
r = list(map(int, input().split()))
if min(r) >= 3200:
  print(str(1)+' '+str(N))
  sys.exit()
li = [0 for i in range(9)]
for rates in r:
  n = rates//400
  li[n] += 1
p = 0
for nums in li[0:8]:
  if nums !=0:
    p += 1
print(str(p)+' '+str(p+li[8]))

Fixed submission:
import sys
N = int(input())
r = list(map(int, input().split()))
if min(r) >= 3200:
  print(str(1)+' '+str(N))
  sys.exit()
li = [0 for i in range(9)]
for rates in r:
  if rates >= 3200:
    rates = 3200
  n = rates//400
  li[n] += 1
p = 0
for nums in li[0:8]:
  if nums !=0:
    p += 1
print(str(p)+' '+str(p+li[8]))
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C=map(int,input().split())
i = 0
a = [A]
b = [B]
c = [C]
while a[i]%2==0 and b[i]%2==0 and c[i]%2==0:
  a.append((b[i]+c[i])/2)
  b.append((a[i]+c[i])/2)
  c.append((a[i]+b[i])/2)
  i += 1
print(i)

Fixed submission:
import sys
A,B,C=map(int,input().split())
if A==B and B==C and A%2==0:
  print('-1')
  sys.exit()
if A==B and B==C and A%2==1:
  print(0)
  sys.exit()
i = 0
a = [A]
b = [B]
c = [C]
while a[i]%2==0 and b[i]%2==0 and c[i]%2==0:
  a.append((b[i]+c[i])/2)
  b.append((a[i]+c[i])/2)
  c.append((a[i]+b[i])/2)
  i += 1
print(i)
Buggy python submission (verdict: Runtime Error):
N = int(input())
import math
def s(n):
  if n == 1:
    return 1
  else:
    return (n*s(n-1))%(10**9+7)
print(s(N))

Fixed submission:
N = int(input())
x = 1
i = 1
while i <= N:
  x = (x*i)%(10**9+7)
  i += 1
print(x)
Buggy python submission (verdict: Runtime Error):
N,M = map(int, input().split())
s = N
c = M
if 2*N>=M:
  print(M//2)
else:
  t = 2*s+c
print(t//4)

Fixed submission:
N,M = map(int, input().split())
s = N
c = M
if 2*N>=M:
  print(M//2)
else:
  t = 2*s+c
  print(t//4)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
s = N
c = M
while 2*s<c:
  s = s+1
  c = c-2
print(c//2)

Fixed submission:
N,M = map(int, input().split())
s = N
c = M
if 2*N>=M:
  print(M//2)
else:
  t = 2*s+c
  print(t//4)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int, input().split())
s = N
c = M
i = 0
if 2*N>=M:
  print(M//2)
else:
  while 2*s<c:
    s = s+1
    c = c-2
  print(c//2)

Fixed submission:
N,M = map(int, input().split())
s = N
c = M
if 2*N>=M:
  print(M//2)
else:
  t = 2*s+c
  print(t//4)
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
p = 0
n = 0
while p < x:
  if n%2==0:
    n+= 1
    p+= 6
  else:
    n += 1
    p += 5
print(n)

Fixed submission:
x = int(input())
N = x//11
m = x%11
if m == 0:
  print(2*N)
elif m <= 6:
  print(2*N+1)
else:
  print(2*N+2)
Buggy python submission (verdict: Runtime Error):
import sys
def coun(n):
  if n == 0:
    return 1
  else:
    return (2*coun(n-1))%(10**9+7)
N = int(input())
A = list(map(int, input().split()))
A.sort()
if len(A)%2 == 1:
  if A[0]!=0:
    print(0)
    sys.exit()
  i = 1
  while i <= len(A)//2:
    if A[2*i-1]==2*i and A[2*i]==2*i:
      i += 1
    else:
      print(0)
      sys.exit()
  print(coun(N//2))

if len(A)%2 == 0:
  i = 0
  while i < N//2:
    if A[2*i] == 2*i+1 and A[2*i+1] == 2*i+1:
      i += 1
    else:
      print(0)
      sys.exit()
  print(coun(N//2))

Fixed submission:
import sys
def coun(n):
  i = 0
  ans = 1
  while i < n:
    ans = (ans*2)%(10**9+7)
    i += 1
  return ans
N = int(input())
A = list(map(int, input().split()))
A.sort()
if len(A)%2 == 1:
  if A[0]!=0:
    print(0)
    sys.exit()
  i = 1
  while i <= len(A)//2:
    if A[2*i-1]==2*i and A[2*i]==2*i:
      i += 1
    else:
      print(0)
      sys.exit()
  print(coun(N//2))

if len(A)%2 == 0:
  i = 0
  while i < N//2:
    if A[2*i] == 2*i+1 and A[2*i+1] == 2*i+1:
      i += 1
    else:
      print(0)
      sys.exit()
  print(coun(N//2))
Buggy python submission (verdict: Time Limit Exceeded):
n,x = map(int, input().split())
a = [int(i) for i in input().split()]
ans = 0
if a[0]>x:
  ans += a[0]-x
  a[0]=x  
else:
  pass
j = 1
while j <= n-1:
  if a[j-1]+a[j]<=x:
    pass
  else:
    ans += a[j]-x
    a[j]=x
print(ans)

Fixed submission:
n,x = map(int, input().split())
a = [int(i) for i in input().split()]
ans = 0
if a[0]>x:
  ans += a[0]-x
  a[0]=x  
else:
  pass
j = 1
while j <= n-1:
  if a[j-1]+a[j]<=x:
    j += 1
  else:
    ans += a[j]-x+a[j-1]
    a[j]=x-a[j-1]
    j += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,x = map(int, input().split())
a = [int(i) for i in input().split()]
b = []
if a[0]>x:
  b.append(x)
else:
  b.append(a[0])
j = 1
while j <= n-1:
  if b[j-1]+a[j]<=x:
    b.append(a[j])
  else:
    b.append(x-b[j-1])
k = 0
ans =0
while k < n:
  ans += a[k]-b[k]
  k += 1
print(ans)

Fixed submission:
n,x = map(int, input().split())
a = [int(i) for i in input().split()]
ans = 0
if a[0]>x:
  ans += a[0]-x
  a[0]=x  
else:
  pass
j = 1
while j <= n-1:
  if a[j-1]+a[j]<=x:
    j += 1
  else:
    ans += a[j]-x+a[j-1]
    a[j]=x-a[j-1]
    j += 1
print(ans)