Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
cnt = 0

def merge(array, left, middle, right):
    n1 = middle - left
    n2 = right - middle
    L = []
    R = []
    for i in range(n1):
        L.append(array[left + i])
    for i in range(n2):
        R.append(array[middle + i])
    L.append(float("inf"))
    R.append(float("inf"))
    i = 0
    j = 0
    for k in range(left, right):
        global cnt
        cnt += 1
        if L[i] <= R[j]:
            array[k] = L[i]
            i += 1
        else:
            array[k] = R[j]
            j += 1


def mergeSort(array, left, right):
    if left + 1 < right:
        middle = int((left + right) / 2.)
        mergeSort(array, left, middle)
        mergeSort(array, middle, right)
        merge(array, left, middle, right)


n = int(input())
array = [int(x) for x in input().split()]
mergeSort(array, 0, len(array))
print(*array)
print(cnt)


Fixed submission:
cnt = 0

def merge(array, left, middle, right):
    n1 = middle - left
    n2 = right - middle
    L = array[left:left + n1] + [float("inf")]
    R = array[middle:middle + n2] + [float("inf")]
    i = 0
    j = 0
    for k in range(left, right):
        global cnt
        cnt += 1
        if L[i] <= R[j]:
            array[k] = L[i]
            i += 1
        else:
            array[k] = R[j]
            j += 1


def mergeSort(array, left, right):
    if left + 1 < right:
        middle = int((left + right) / 2.)
        mergeSort(array, left, middle)
        mergeSort(array, middle, right)
        merge(array, left, middle, right)


n = int(input())
array = [int(x) for x in input().split()]
mergeSort(array, 0, len(array))
print(*array)
print(cnt)
Buggy python submission (verdict: Runtime Error):
from math import sqrt
a, b, c, d = map(int, input().split())
print(sqrt((c - a)**2 + (d - b)**2)) 

Fixed submission:
a, b, c, d = map(float, input().split())                                    
print(pow((c - a)**2 + (d - b)**2, 0.5))

Buggy python submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())
print(pow((c-a)**2 + (d-b)**2, 0.5))

Fixed submission:
a, b, c, d = map(float, input().split())                                    
print(pow((c - a)**2 + (d - b)**2, 0.5))
Buggy python submission (verdict: Runtime Error):
import numpy as np

data = input().split()

for n in range(len(data)):
	data[n] = int(data[n])

W, H, x, y, r = data
theta = np.arange(0, 2 * np.pi + 0.01, 0.01)

k = True

for angle in theta:
	rx = x + np.cos(angle)
	ry = y + np.sin(angle)
	if rx >= 0 and rx <= W and ry >= 0 and ry <= H:
		pass
	else:
		k = False
		break

if k is True:
	print("Yes")
else:
	print("No")

Fixed submission:
data = input().split()

for n in range(len(data)):
	data[n] = int(data[n])

W, H, x, y, r = data

if (r <= x <= W - r) and (r <= y <= H - r):
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
pi = 3.14159265
r = int(input())
print(round(r * r * pi, 6), round(2 * pi * r, 6))

Fixed submission:
from math import pi
r = float(input())
print(round(r * r * pi, 7), round(2 * pi * r, 7))

Buggy python submission (verdict: Runtime Error):
from numpy import pi
r = float(input())
print(round(r * r * pi, 7), round(2 * pi * r, 7))

Fixed submission:
from math import pi
r = float(input())
print(round(r * r * pi, 7), round(2 * pi * r, 7))

Buggy python submission (verdict: Runtime Error):
from numpy import pi
r = float(input())
print(round(r * r * pi, 7), round(2 * pi * r, 7))

Fixed submission:
from math import pi
r = float(input())
print(round(r * r * pi, 7), round(2 * pi * r, 7))
Buggy python submission (verdict: Time Limit Exceeded):
arr = []

for _ in range(int(input())):
    cmd = [int(x) for x in input().split()]

    if cmd[0] == 0:
        if cmd[1]:
            arr.append(cmd[2])
        else:
            arr.insert(0, cmd[2])
    elif cmd[0] == 1:
        print(arr[cmd[1]])
    else:
        if cmd[1]:
            arr.pop()
        else:
            arr.pop(0)



Fixed submission:
from collections import deque

arr = deque()

for _ in range(int(input())):
    cmd = [int(x) for x in input().split()]

    if cmd[0] == 0:
        if cmd[1]:
            arr.append(cmd[2])
        else:
            arr.appendleft(cmd[2])
    elif cmd[0] == 1:
        print(arr[cmd[1]])
    else:
        if cmd[1]:
            arr.pop()
        else:
            arr.popleft()
Buggy python submission (verdict: Time Limit Exceeded):
a=input()
r=[]
for i in range(a):
    k=input()
    r.append(k)
minn=-10**9
for i in range(len(r)):
    for j in range(i+1,len(r)):
        k=r[j]-r[i]
        if k>minn:
            minn=k
print minn

Fixed submission:
a=input()
r=[]
for i in range(a):
    k=input()
    r.append(k)
minv=r[0]
maxv=-10**9
for j in range(1,len(r)):
    maxv=max(maxv,r[j]-minv)
    minv=min(minv,r[j])
print maxv
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from collections import deque

def parse_cmd(deque,input_cmd):
	if input_cmd[0] == 'insert':
		deque.appendleft(input_cmd[1])
	elif input_cmd[0] == 'delete':
		deque.remove(input_cmd[1])
	elif input_cmd[0] == 'deleteFirst':
		deque.popleft()
	elif input_cmd[0] == 'deleteLast':
		deque.pop()
		
def main():
	que = deque()
	n = int(raw_input())
	cmd = [raw_input().split() for _ in range(n)]
	
	for i in cmd:
		parse_cmd(que,i)
	
	print " ".join(que)


#def test():

if __name__ == '__main__':
	main()
	#test()

Fixed submission:
#!/usr/bin/env python
#-*- coding:utf-8 -*-
from collections import deque

def parse_cmd(deque,input_cmd):
	if input_cmd[0] == 'insert':
		deque.appendleft(input_cmd[1])
	elif input_cmd[0] == 'delete':
		try:
			deque.remove(input_cmd[1])
		except:
			pass
	elif input_cmd[0] == 'deleteFirst':
		deque.popleft()
	elif input_cmd[0] == 'deleteLast':
		deque.pop()
		
def main():
	que = deque()
	n = int(raw_input())
	cmd = [raw_input().split() for _ in range(n)]
	
	for i in cmd:
		parse_cmd(que,i)
	
	print " ".join(que)


#def test():

if __name__ == '__main__':
	main()
	#test()
Buggy python submission (verdict: Runtime Error):
n=int(input())
nums=[]
for i in range(n):
    nums.append(int(input()))
count=0
for i in range(n):
    for j in range(2,int(sqrt(nums[i])+1)):
        if nums[i]%j==0:
            break
    count+=1
print(count)


Fixed submission:
from math import sqrt
n = int(input())
ans = 0
for i in range(n):
    x = int(input())
    ok = 1
    for z in range(2, int(sqrt(x))+1):
        if x % z == 0:
            ok = 0
            break
    ans += ok
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
nums=[]
for i in range(n):
    nums.appemd(int(input()))
for i in range(1,n):
    v=nums[i]
    j=i-1
    while j>=0 and nums[j]>v:
        nums[j+1]=nums[j]
        j-=1
    nums[j+1]=v
print(nums[n-1]-nums[0])


Fixed submission:
import sys
  
input()
minv = int(input())
maxv = -1000000000
  
for r in map(int,sys.stdin.readlines()):
  m = r-minv
  if maxv < m: 
    maxv = m
    if m < 0: minv = r
  elif m < 0: minv = r
  
print(maxv)

Buggy python submission (verdict: Runtime Error):
import sys
  
input()
minv = int(input())
maxv = -1000000000
  
for r in map(int,sys.stdin.readlines()):
  m = r-minv
  if maxv < m: 
    maxv = m
    if m < 0: minv = r
  elif m < 0: minv = r
  
print(maxv


Fixed submission:
import sys
  
input()
minv = int(input())
maxv = -1000000000
  
for r in map(int,sys.stdin.readlines()):
  m = r-minv
  if maxv < m: 
    maxv = m
    if m < 0: minv = r
  elif m < 0: minv = r
  
print(maxv)
Buggy python submission (verdict: Runtime Error):
n=int(input())
nums=list(map(int,input()))
count=0
for i in range(n):
    minj=i
    for j in range(i,n):
        if nums[j] < nums[minj]:
            minj=j
    nums[i]=v
    nums[i]=nums[minj]
    nums[minj]=v
    count+=1
print(*nums)
print(count)


Fixed submission:
N = int(input())
*A, = map(int,input().split())
count = 0
for i in range(N):
    minj = i
    for j in range(i,N):
        if A[j] < A[minj]:
            minj = j
    if not minj == i:
        tmp = A[i]
        A[i] = A[minj]
        A[minj] = tmp
        count += 1
    
print(*A)
print(count)

Buggy python submission (verdict: Runtime Error):
n=int(input())
nums=list(map(int,input()))
count=0
for i in range(n):
    minj=i
    for j in range(i,n):
        if nums[j] < nums[minj]:
            minj=j
    if not i==minj:
        v=nums[i]
        nums[i]=nums[minj]
        nums[minj]=v
        count+=1
print(*nums)
print(count)


Fixed submission:
N = int(input())
*A, = map(int,input().split())
count = 0
for i in range(N):
    minj = i
    for j in range(i,N):
        if A[j] < A[minj]:
            minj = j
    if not minj == i:
        tmp = A[i]
        A[i] = A[minj]
        A[minj] = tmp
        count += 1
    
print(*A)
print(count)
Buggy python submission (verdict: Runtime Error):
num = input().split()
if int(num[0])<int(num[1]):
    x = int(num[1])
    y = int(num[0])
else:
    x = int(num[0])
    y = int(num[1])

end = 0
    
z = x % y
while True:
    z1 = y % z
    y1 = z
    if z1 == 0:
        print(z)
        break 
    z = z1
    y = y1    

Fixed submission:
num = input().split()
if int(num[0])<int(num[1]):
    x = int(num[1])
    y = int(num[0])
else:
    x = int(num[0])
    y = int(num[1])

end = 0
    
z = x % y
if z == 0:
    print(y)
else:
    while True:
        z1 = y % z
        y1 = z
        if z1 == 0:
            print(z)
            break 
        z = z1
        y = y1
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(x, y):
    a_x = list()
    a_y = list()

    for i in range(1, x+1):
        if x % i == 0:
            a_x.append(i)

    for i in range(1, y+1):
        if y % i == 0:
            a_y.append(i)

    a_cd = list(set(a_x).intersection(set(a_y)))

    return max(a_cd)

if __name__ == "__main__":
    x, y = map(int, input().split())
    if x > y:
        tmp = x
        x = y
        y = tmp
    print(gcd(x, y))

Fixed submission:
def gcd(x, y):
    if x < y:
        tmp = x
        x = y
        y = tmp

    while y > 0:
        r = x % y
        x = y
        y = r

    return x

if __name__ == "__main__":
    x, y = map(int, input().split())
    print(gcd(x, y))

Buggy python submission (verdict: Runtime Error):
def gcd(x, y):
    a_x = list()
    a_y = list()

    for i in range(1, x+1):
        if x % i == 0:
            a_x.append(i)

    for i in range(1, y+1):
        if y % i == 0:
            a_y.append(i)

    a_cd = list(set(a_x).intersection(set(a_y)))

    return max(a_cd)

if __name__ == "__main__":
    x, y = map(int, input().split())
    if x > y:
        tmp = x
        x = y
        y = tmp
    print(gcd(x, y%x))

Fixed submission:
def gcd(x, y):
    if x < y:
        tmp = x
        x = y
        y = tmp

    while y > 0:
        r = x % y
        x = y
        y = r

    return x

if __name__ == "__main__":
    x, y = map(int, input().split())
    print(gcd(x, y))
Buggy python submission (verdict: Time Limit Exceeded):
import math

def prime_numbers(x):
    i_a = list(range(2, x+1))
    p_a = list()
    e_a = math.sqrt(x)
    h = i_a[0]
    while h < e_a:
        h = i_a[0]
        p_a.append(h)
        for j in i_a:
            if j % h == 0:
                i_a.remove(j)
    p_a += i_a
    p_a.sort()
    return p_a

if __name__ == "__main__":
    n = int(input())
    n_s = list()
    for i in range(n):
        n_s.append(int(input()))

    pnums = prime_numbers(max(n_s))
    count = 0

    for i in n_s:
        if i in pnums:
            count += 1

    print(count)

Fixed submission:
import math

def is_prime(x):
    if x == 2:
        return True

    if x % 2 == 0 or x < 2:
        return False

    i = 3
    x_sqrt = math.sqrt(x)
    while i <= x_sqrt:
        if x % i == 0:
            return False
        i += 2

    return True

if __name__ == "__main__":
    n = int(input())
    count = 0
    for i in range(n):
        if is_prime(int(input())):
            count += 1

    print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
r_s = [int(input()) for i in range(n)]

maxsub = r_s[1] - r_s[0]
mini = r_s[0]

for i in range(n-1):
    if r_s[i] > mini:
        continue

    mini = r_s[i]
    for j in range(i+1, n):
        if maxsub < (r_s[j] - r_s[i]):
            maxsub = r_s[j] - r_s[i]

print(maxsub)

Fixed submission:
n = int(input())
r_s = [int(input()) for i in range(n)]

minv = r_s[0]
maxv = r_s[1] - r_s[0]
for i in range(1, n):
    maxv = max(maxv, r_s[i]-minv)
    minv = min(minv, r_s[i])

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

while True:
    n = int(input())
    if n == 0:
        break
    sn = [int(s) for s in input().split()]
    m = sum(sn) / n
    a2 = 0.0
    for s in sn:
        a2 += pow(s-m, 2)
    print(math.sqrt(a2/n)

Fixed submission:
import math

while True:
    n = int(input())
    if n == 0:
        break
    sn = [int(s) for s in input().split()]
    m = sum(sn) / n
    a2 = 0.0
    for s in sn:
        a2 += pow(s-m, 2)
    print(math.sqrt(a2/n))
Buggy python submission (verdict: Runtime Error):
x=(input())
print(x^3)

Fixed submission:
x=int(input())
print(x**3)

Buggy python submission (verdict: Runtime Error):
x=(input())
print(x**3)

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

m=a*b
l=2*a+2*b

print(m l)

Fixed submission:
a,b=map(int, input().split())
print(a*b, 2*a+2*b)
Buggy python submission (verdict: Runtime Error):
x = raw_input()
print x ** 3

Fixed submission:
n = raw_input()
print int(n) ** 3
Buggy python submission (verdict: Runtime Error):
l = map(int,raw_input().split())
if l[0] > l[1]:
  print a > b
elif l[0] < l[1]:
  print a < b
else:
  print a == b

Fixed submission:
l = map(int,raw_input().split())
if l[0] < l[1]:
  print "a < b"
elif l[0] == l[1]:
  print "a == b"
else:
  print "a > b"
Buggy python submission (verdict: Runtime Error):
l = map(int,raw_input().split())
L = sorted(l,key=int)
print L[0],L[1],L[2]

Fixed submission:
l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])

Buggy python submission (verdict: Runtime Error):
l = map(int,raw_input().split())
L = sorted(l,key=int)
print str(L[0]),str(L[1]),str(L[2])

Fixed submission:
l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])

Buggy python submission (verdict: Runtime Error):
l = map(int,raw_input().split())
L = sorted(l,key=int)
print "L[0]","L[1]","L[2]"

Fixed submission:
l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])

Buggy python submission (verdict: Runtime Error):
l = sorted(map(int,raw_input().split())))
print str(l[0]),str(l[1]),str(l[2])

Fixed submission:
l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])

Buggy python submission (verdict: Runtime Error):
l = sorted(map(int,raw_input().split())))
print (str(l[0]),str(l[1]),str(l[2]))

Fixed submission:
l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])

Buggy python submission (verdict: Runtime Error):
l=sorted(map(int,raw_input()))
print(l[0],l[1],l[2])

Fixed submission:
l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])

Buggy python submission (verdict: Runtime Error):
l=sorted(map(int,raw_input().split()))
print(l[0],l[1],l[2])

Fixed submission:
l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])

Buggy python submission (verdict: Runtime Error):
l=list(sorted(map(int,raw_input().split())))
print(l[0],l[[1],l[2])

Fixed submission:
l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])

Buggy python submission (verdict: Runtime Error):
l=sorted(list(map(int,raw_input().split())))
print(l[0],l[[1],l[2])

Fixed submission:
l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])

Buggy python submission (verdict: Runtime Error):
l=sorted(list(map(int,raw_input().split())))
print(l[0],l[[1],l[2])

Fixed submission:
l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])

Buggy python submission (verdict: Runtime Error):
l=sorted(list(map(int,raw_input().split())))
print(l[0],l[1],l[2])

Fixed submission:
l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])

Buggy python submission (verdict: Runtime Error):
l=list(map(int,raw_input().split()))
L=sorted(l)
print(L[0],L[1],L[2])

Fixed submission:
l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])
Buggy python submission (verdict: Runtime Error):
a = []
i = 0
while true:
  n = input()
  if n == 0:
    break
  a.append(n)
  print('Case {0}: {1}'.format(i,n))

Fixed submission:
i = 1
while True:
  n = input()
  if n == "0":
    break
  print("Case {0}: {1}".format(i,n))
  i += 1

Buggy python submission (verdict: Runtime Error):
a = []
i = 0
while true:
  n = input()
  if n == 0:
    break
  a.append(n)
  print('Case {0}: {1}'.format(i,a))
  i++

Fixed submission:
i = 1
while True:
  n = input()
  if n == "0":
    break
  print("Case {0}: {1}".format(i,n))
  i += 1

Buggy python submission (verdict: Runtime Error):
i = 1
while True:
  n = input()
  if n == 0:
    break
  print("Case {0}: {1}").format(i,n)
  i++

Fixed submission:
i = 1
while True:
  n = input()
  if n == "0":
    break
  print("Case {0}: {1}".format(i,n))
  i += 1

Buggy python submission (verdict: Runtime Error):
i = 1
while True:
  n = input()
  if n == 0:
    break
  print("Case {0}: {1}").format(i,n)
  i += 1

Fixed submission:
i = 1
while True:
  n = input()
  if n == "0":
    break
  print("Case {0}: {1}".format(i,n))
  i += 1

Buggy python submission (verdict: Runtime Error):
i = 1
while True:
  n = input()
  if n == 0:
    break
  print("Case {0}: {1}".format(i,n))
  i += 1

Fixed submission:
i = 1
while True:
  n = input()
  if n == "0":
    break
  print("Case {0}: {1}".format(i,n))
  i += 1
Buggy python submission (verdict: Runtime Error):
n = 0
a,b,c = list(map(int,input().split()))
for i in range(a,b):
  if true:
    continue
  x = c % i
  if x == 0:
    n += 1
print(n)

Fixed submission:
n = 0
a,b,c = list(map(int,input().split()))
for i in range(a,b + 1):
  x = c % i
  if x == 0:
    n += 1
print(n)
Buggy python submission (verdict: Runtime Error):
import math
r = input()
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("5f" % (a),"5f" % (c))

Fixed submission:
import math
r = float(input())
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("%5f" % (a),"%5f" % (c))

Buggy python submission (verdict: Runtime Error):
import math
r = input()
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("%5f" % (a),"%5f" % (c))

Fixed submission:
import math
r = float(input())
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("%5f" % (a),"%5f" % (c))

Buggy python submission (verdict: Runtime Error):
import math
r = input()
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("%5f" % (a),"%5f" % (c))

Fixed submission:
import math
r = float(input())
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("%5f" % (a),"%5f" % (c))

Buggy python submission (verdict: Runtime Error):
import math
r = int(input())
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("%5f" % (a),"%5f" % (c))

Fixed submission:
import math
r = float(input())
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("%5f" % (a),"%5f" % (c))

Buggy python submission (verdict: Runtime Error):
import math
r = int(input())
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("%5f" % (a),"%5f" % (c))

Fixed submission:
import math
r = float(input())
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("%5f" % (a),"%5f" % (c))

Buggy python submission (verdict: Runtime Error):
import math
r = int(input())
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("%5f" % (a),"%5f" % (c))

Fixed submission:
import math
r = float(input())
a = r ** 2 * math.pi
c = r * 2 * math.pi

print("%5f" % (a),"%5f" % (c))
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
	if a < b:
		tmp = a
		a = b
		b = tmp
	
	r = a % b
	while r != 0:
		a = b
		b = r
		r = a % b

	return b

if __name__ == '__main__':
	l = list(map(int, input().split()))
	x = l[0]
	y = l[1]

	ans = gcd(x, y)
	print(ans)

Fixed submission:
def gcd(a, b):
	if a < b:
		tmp = a
		a = b
		b = tmp
	
	r = a % b
	while r != 0:
		a = b
		b = r
		r = a % b

	return b

if __name__ == '__main__':
	l = list(map(int, input().split()))
	x = l[0]
	y = l[1]

	ans = gcd(x, y)
	print(ans)
Buggy python submission (verdict: Runtime Error):
num = int(imput())

print(num**3)


Fixed submission:
cube = int(input())

print(cube**3)
Buggy python submission (verdict: Runtime Error):
def insertionSort(A,N):
    for i in range(1,N):
        v = A[i]
        j=i-1
        while(j>=0 and A[j] > v):
            A[j+1] = A[j]
            j-=1
        A[j+1]=v
        print(*A)

if __name__ == '__main__':
    N = int(input())
    A = [int(i) for i in input().split()]
    print(*insertionSort(A,N))

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
print( *A )
for i in range(1,N):
    v = A[i]
    j = i - 1
    while j >= 0 and A [j] > v :
        A[j + 1] = A[j]
        j -= 1
    A[j + 1] = v
    print( *A )

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
print(*A)
for i in range(1,N):
    v = A[i]
    j = i - 1
    while j > = 0 and A [j] > v :
        A[j + 1] = A[j]
        j -= 1
    A[j+1] = v
    print(*A)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
print( *A )
for i in range(1,N):
    v = A[i]
    j = i - 1
    while j >= 0 and A [j] > v :
        A[j + 1] = A[j]
        j -= 1
    A[j + 1] = v
    print( *A )
Buggy python submission (verdict: Time Limit Exceeded):
import math
N = int(input())
A = [int(input()) for i in range(N)]
c=0
for i in range(N):
    x=A[i]
    if x < 2: continue
    if x==2 or x==3 or x==5:c+=1
    if x%2==0 or x%3==0 or x%5==0: continue

    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: continue
        prime += step
        step = 6 - step
    c += 1
print(c)

Fixed submission:
def is_prime(x):
    if x==2:
        return 1
    elif x&1==0:
        return 0
    else: return pow(2,x-1,x)==1
N = int(input())
c=0
for i in range(N):
    c+=is_prime(int(input()))
print(c)

Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
A = [int(input()) for i in range(N)]
c=0
for i in range(N):
    x=abs(A[i])
    if x==2:c+=1
    if x<2 or x&1==0:continue
    if pow(1,x-1,x)==1 c+=1

print(c)

Fixed submission:
def is_prime(x):
    if x==2:
        return 1
    elif x&1==0:
        return 0
    else: return pow(2,x-1,x)==1
N = int(input())
c=0
for i in range(N):
    c+=is_prime(int(input()))
print(c)

Buggy python submission (verdict: Runtime Error):
def is_prime(x):
    if x==2:
        return 1
    elif x&1==0:
        return 0
    else:
        return pow(2,x-1,x)==1
N = int(input())
for i in range(N):
    n=int(input())
    c+=is_prime(n)
print(c)

Fixed submission:
def is_prime(x):
    if x==2:
        return 1
    elif x&1==0:
        return 0
    else: return pow(2,x-1,x)==1
N = int(input())
c=0
for i in range(N):
    c+=is_prime(int(input()))
print(c)

Buggy python submission (verdict: Runtime Error):
def is_prime(x):
    if x==2:
        return 1
    elif x&1==0:
        return 0
    elif pow(2,x-1,x)==1:
        return 1
    else:
        return 0
N = int(input())
for i in range(N):
    n=int(input())
    c+=is_prime(n)
print(c)

Fixed submission:
def is_prime(x):
    if x==2:
        return 1
    elif x&1==0:
        return 0
    else: return pow(2,x-1,x)==1
N = int(input())
c=0
for i in range(N):
    c+=is_prime(int(input()))
print(c)
Buggy python submission (verdict: Runtime Error):
i=input
r=range
N=int(i())
A=(int(i()) for _ in r(N))
mp=A[1]-A[0]
mn=A[0]
for a in r(1,N):
    x=A[a]
    b=x-mn
    if mp<(b):mp=b
        if 0>b:mn=x
    if x<mn:mn=x
print(mp)

Fixed submission:
import sys
i=input
n=int(i())
r0=int(i())
r1=int(i())
x=r1-r0
y=min(r1,r0)
for i in map(int,sys.stdin.readlines()):
    a=i-y
    if x<a:
        x=a
        if 0>a:y=i
    elif y>i:y=i
print(x)