Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())

A_list = []
inp_list = list(map(int, input().split(" ")))
for i in range(N):
	A_list.append([i+1, inp_list[i]])
answer = 0
for v in itertools.combinations(A_list, 2):
	if abs(v[0][0] - v[1][0]) == (v[0][1] + v[1][1]):
		answer += 1
print(answer)

Fixed submission:
N = int(input())

X1_dict = {}
X2_dict = {}
inp_list = list(map(int, input().split(" ")))
for i, a_i in enumerate(inp_list):
	X1 = i + 1 + a_i
	X2 = i + 1 - a_i
	if X1 in X1_dict.keys():
		X1_dict[X1] += 1
	else:
		X1_dict[X1] = 1
	if X2 in X2_dict.keys():
		X2_dict[X2] += 1
	else:
		X2_dict[X2] = 1

answer = 0
for key, value in X1_dict.items():
	if key in X2_dict.keys():
		answer += value * X2_dict[key]
		
print(answer)
Buggy python submission (verdict: Runtime Error):
four = input()
four_set = set(four)

if len(four_set) != 2:
  print("No")
else:
  if four.count(four_set[0]) != 2:
    print("No")
  else:
    print("Yes")

Fixed submission:
four = input()
four_set = set(four)

if len(four_set) != 2:
    print("No")
else:
    if four.count(list(four_set)[0]) != 2:
        print("No")
    else:
        print("Yes")
Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np

def LI():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def main():
	N, K = LI()
	h_i = np.array(LI())
	dp = np.full(N, 10**10, dtype=int)
	dp[0] = 0
	for i in range(1, N):
		dp[i:i+K] = np.fmin(dp[i:i+K], dp[i-1] + np.abs(h_i[i:i+K] - h_i[i-1]))
		
	return dp[-1]


if __name__ == "__main__":
	print(main())

Fixed submission:
import sys
def I():
	return int(sys.stdin.readline().rstrip())


def SL():
	return S().split()


def IL():
	return list(map(int, sys.stdin.readline().rstrip().split()))


N = I()
h_i = IL()
dp = [0 for _ in range(N)]
for i in range(N):
	if i == 0:
		pass
	elif i == 1:
		dp[i] = abs(h_i[i] - h_i[i-1])
	else:
		point_1 = abs(h_i[i] - h_i[i-1]) + dp[i-1]
		point_2 = abs(h_i[i] - h_i[i-2]) + dp[i-2]
		if point_1 <= point_2:
			dp[i] = point_1
		else:
			dp[i] = point_2

print(dp[-1])

Buggy python submission (verdict: Runtime Error):
def I():
	return int(sys.stdin.readline().rstrip())


def IL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

  
N = I()
h_i = IL()
dp = [0 for _ in range(N)]
for i in range(N):
	if i == 0:
		pass
	elif i == 1:
		dp[i] = abs(h_i[i] - h_i[i-1])
	else:
		point_1 = abs(h_i[i] - h_i[i-1]) + dp[i-1]
		point_2 = abs(h_i[i] - h_i[i-2]) + dp[i-2]
		if point_1 <= point_2:
			dp[i] = point_1
		else:
			dp[i] = point_2

print(dp[-1])

Fixed submission:
import sys
def I():
	return int(sys.stdin.readline().rstrip())


def SL():
	return S().split()


def IL():
	return list(map(int, sys.stdin.readline().rstrip().split()))


N = I()
h_i = IL()
dp = [0 for _ in range(N)]
for i in range(N):
	if i == 0:
		pass
	elif i == 1:
		dp[i] = abs(h_i[i] - h_i[i-1])
	else:
		point_1 = abs(h_i[i] - h_i[i-1]) + dp[i-1]
		point_2 = abs(h_i[i] - h_i[i-2]) + dp[i-2]
		if point_1 <= point_2:
			dp[i] = point_1
		else:
			dp[i] = point_2

print(dp[-1])
Buggy python submission (verdict: Runtime Error):
import sys
# import numpy as np

def IL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

N, W = IL()
v_list = [0] * N
w_list = [0] * N
v = 0
w_total = 0
for i in range(N):
	w_list[i], v_list[i] = IL()
# dp = np.zeros((N+1, W+1))
dp = [[0] * (W+1) for _ in range(N+1)]
for i in range(N):
	for j in range(W+1):
		if j >= w_list[i]:
			dp[i+1][j] = max(dp[i][j-w_list[i]] + v_list[i], dp[i][j])
		else:
			dp[i+1][j] = dp[i][j]

print(dp[N][W])

Fixed submission:
import sys
# import numpy as np

def IL():
	return list(map(int, sys.stdin.readline().rstrip().split()))

N, W = IL()
v_list = [0] * N
w_list = [0] * N

for i in range(N):
	w_list[i], v_list[i] = IL()

v_max = 100100
dp = [[sys.maxsize] * (v_max+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
	for j in range(v_max+1):
		if j >= v_list[i]:
			dp[i+1][j] = min(dp[i][j-v_list[i]] + w_list[i], dp[i][j])
		else:
			dp[i+1][j] = min(dp[i+1][j], dp[i][j])

ans = 0
for j in range(v_max+1):
	if dp[N][j] <= W:
		ans = j

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

employee = input().split(" ")

for i in range(1, N+1):
    print(employee.count(str(i)))

Fixed submission:
N = int(input())

employees = list(map(int, input().split(" ")))

subordinates = [0] * N

for employee in employees:
    subordinates[employee-1] += 1
    
for i in range(N):
    print(subordinates[i])
Buggy python submission (verdict: Time Limit Exceeded):
def calc_gcd2(a, b):
    if b == 0:
        return a
    else:
        return calc_gcd2(b, a % b)
    
def calc_gcd3(a, b, c):
    gcd_ab = calc_gcd2(a, b)
    return calc_gcd2(gcd_ab, c)
    
K = int(input())
tanget_num = range(1, K+1)
sum_ = 0
for i in tanget_num:
    for j in tanget_num:
        for k in tanget_num:
            sum_ = sum_ + calc_gcd3(i, j, k)
print(str(sum_))

Fixed submission:
import math

K = int(input())
tanget_num = range(1, K+1)
sum_  = sum([math.gcd(i, math.gcd(j, k)) for i in tanget_num for j in tanget_num for k in tanget_num])

print(str(sum_))
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/python
# -*- coding: UTF-8 -*-

N = int(input())
if N%10 == 3
	print('bon')
elif N%10 == 0 or N%10 == 1 or N%10 == 6 or N%10 == 8:
	print('pon')
else:
	print('hon')

Fixed submission:
#!/usr/bin/python
# -*- coding: UTF-8 -*-

N = int(input())
if N%10 == 3:
	print('bon')
elif N%10 == 0 or N%10 == 1 or N%10 == 6 or N%10 == 8:
	print('pon')
else:
	print('hon')
Buggy python submission (verdict: Runtime Error):
nums = input()
S = int(nums.split(' ')[0])
W = int(nums.split(' ')[1])

if W >= S:
	print(unsafe)
else:
	print('safe')

Fixed submission:
nums = input()
S = int(nums.split(' ')[0])
W = int(nums.split(' ')[1])

if W >= S:
	print('unsafe')
else:
	print('safe')
Buggy python submission (verdict: Runtime Error):
import math
a,b,h,m=map(int,input().split())
#1分間に進む分針 360/60=6度
#1時間に進む時針 360/12=30度
#1分間に進む時針 30/60=0.5度
r=abs((h*30+m*0.5)-(m*6))
s1=math.sqrt(a**2+b**2-(2*a*b*(math.cos(math.radians(r)))))
print(s)

Fixed submission:
import math
a,b,h,m=map(int,input().split())
#1分間に進む分針 360/60=6度
#1時間に進む時針 360/12=30度
#1分間に進む時針 30/60=0.5度
r=abs((h*30+m*0.5)-(m*6))
s=math.sqrt(a**2+b**2-(2*a*b*(math.cos(math.radians(r)))))
print(s)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,n=map(int,input().split())
l=[]
for i in range(1,n+1):
    m=(a*i//b)-a*(i//b)
    l.append(m)
print(max(l))

Fixed submission:
a,b,n=map(int,input().split())
x=min(n,b-1)
print(a*x//b)
Buggy python submission (verdict: Runtime Error):
from scipy.special import comb
n=[int(i) for i in input().split()]
a=comb(n[0],2,exact=True)
b=comb(n[1],2,exact=True)
print(a+b)

Fixed submission:
from scipy.misc import comb
n=[int(i) for i in input().split()]
a=comb(n[0],2,exact=True)
b=comb(n[1],2,exact=True)
print(a+b)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[]
a=[]
b=[]
for i in range(n):
    m=[int(j) for j in input().split()]
    
    for k in m:
        if k%2==0:
            l.append(k)
    
    for p in l:
        if p%3==0 or p%5==0:
            a.append(p)
        else:
            b.append(p)

    if len(a)==len(l):
        print("APPROVED")
    else:
        print("DENIDE")

Fixed submission:
n=int(input())
l=[]
a=[]
b=[]
for i in range(n):
    m=[int(j) for j in input().split()]
    
    for k in m:
        if k%2==0:
            l.append(k)
    
    for p in l:
        if p%3==0 or p%5==0:
            a.append(p)
        else:
            b.append(p)
 
    if len(a)==len(l):
        print("APPROVED")
    else:
        print("DENIED")
    break
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
for i in range(k):
    if a>=1:
        a-=1
    elif a==0 and b>=1:
        b-=1
print(a,b)

Fixed submission:
a,b,k=map(int,input().split())
if a>=k:
    print(a-k,b)
elif a<k and b>=k-a:
    print(0,b-(k-a))
else:
    print(0,0)
Buggy python submission (verdict: Runtime Error):
from sympy import isprime
x=int(input())
for i in range(x,2**64):
    if isprime(i)==True:
        print(i)
        break

Fixed submission:
import math
x=int(input())
def prime(n):
    for i in range(2,int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True
for i in range(x,2**64):
    if prime(i)==True:
        print(i)
        break
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())

for i in range(-1,10000):
    for j in range(-1,10000):
        if (i ** 5 - j ** 5) == x:
            print(i,j)
            break


Fixed submission:
X = int(input())
flag=1
for A in range(-500,500):
    for B in range(-500,500):
        if(A**5-B**5==X):
            print(A,B)
            break
    else:
        continue
    break
Buggy python submission (verdict: Runtime Error):
numbers = input().split(" ")
healthOfT = int(numbers[0])
strengthOfT = int(numbers[1])
healthOfA = int(numbers[2])
strengthOfA = int(numbers[3])
for i in(0,1000):
	healthOfA=healthOfA-strengthOfT
	if healthOfA<=0:
		a=i
		break
for p in(0,1000):
	healthOfT=healthOfT-strengthOfA
	if healthOfT<=0:
		break
if p<i:
	print("No")
else:
	print("Yes")

Fixed submission:
s, w = map(int,input().split())
if s <= w:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Runtime Error):
def answer(n, m, x, y, x_array, y_array):
    max_x = x
    for i in range n:
        if x_array[i] > max:
            max_x = x_array[i]


    min_y = y
    for i in range m:
        if y_array[i] < min:
            min_y = y_array[i]

    if max_x < min_y:
        return "No War"
    else:
        return "War"


[n, m, x, y] = list(map(int, input().split()))
x_array = list(map(int, input().split()))
y_array = list(map(int, input().split()))
    
print(answer(n, m, x, y, x_array, y_array))

Fixed submission:
def answer(n, m, x, y, x_array, y_array):
    max_x = x
    for i in range(n):
        if x_array[i] > max_x:
            max_x = x_array[i]


    min_y = y
    for i in range(m):
        if y_array[i] < min_y:
            min_y = y_array[i]

    if max_x < min_y:
        return "No War"
    else:
        return "War"


[n, m, x, y] = list(map(int, input().split()))
x_array = list(map(int, input().split()))
y_array = list(map(int, input().split()))
    
print(answer(n, m, x, y, x_array, y_array))
Buggy python submission (verdict: Runtime Error):
n=int(input())
p=n%10
if(p==2||p==4||p==5||p==7||p==9):
  print("hon")
elif(p==3):
  print("pon")
else:
  print("bon")


Fixed submission:
n=int(input())
p=n%10
if(p==2 or p==4 or p==5 or p==7 or p==9):
  print("hon")
elif(p==3):
  print("bon")
else:
  print("pon")
Buggy python submission (verdict: Runtime Error):
n = input()
if 7 in n:
  print("Yes")
else:
  print("No")

Fixed submission:
n = list(input())
if "7" in n:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
k = int(input())
sum = 0
def gcd(p,q):
  if p%q == 0:
    return q
  retrun gcd(q,p%q)
for i in range(1,k+1):
   for j in range(1,k+1):
      for k in range(1,k+1):
        sum += gcd(gcd(i,j),k)

print(sum)

Fixed submission:
k = int(input())
sum = 0
def gcd(p,q):
  if p%q == 0:
    return q
  return gcd(q,p%q)
  
for i in range(1,k+1):
   for j in range(1,k+1):
      for k in range(1,k+1):
        sum += gcd(gcd(i,j),k)

print(sum)
Buggy python submission (verdict: Runtime Error):
memory = [[-1 for i in range(W)] for j in range(H)]
def flip_count_mem(r, c):
  if memory[r][c] < 0:
    memory[r][c] = flip_coumt(r, c)
  return memory[r][c]

def flip_count (r, c):
  if r == H - 1 and c == W - 1:
    if s[r][c] == "#":
      return 1
    else:
      return 0
  #右に行ったとき
  if c == W - 1:
    count_right = 10000
  else:
    count_right = flip_count_mem (r, c + 1)
    if s[r][c] == "#" and s[r][c + 1] == ".":
      count_right += 1
  #下に行ったとき
  if r == H - 1:
    count_down = 10000
  else:
    count_down = flip_count_mem (r + 1, c)
    if s[r][c] == "#" and s[r + 1][c] == ".":
      count_down += 1
  return min(count_right, count_down)

H, W = input().split()
W = int (W)
H = int (H)
s = []
for i in range(H):
  s.append(input())
print (flip_count(0, 0))


Fixed submission:
def flip_count_mem(r, c):
  if memory[r][c] < 0:
    memory[r][c] = flip_count(r, c)
  return memory[r][c]

def flip_count (r, c):
  if r == H - 1 and c == W - 1:
    if s[r][c] == "#":
      return 1
    else:
      return 0
  #右に行ったとき
  if c == W - 1:
    count_right = 10000
  else:
    count_right = flip_count_mem (r, c + 1)
    if s[r][c] == "#" and s[r][c + 1] == ".":
      count_right += 1
  #下に行ったとき
  if r == H - 1:
    count_down = 10000
  else:
    count_down = flip_count_mem (r + 1, c)
    if s[r][c] == "#" and s[r + 1][c] == ".":
      count_down += 1
  return min(count_right, count_down)

H, W = input().split()
W = int (W)
H = int (H)
s = []
for i in range(H):
  s.append(input())
memory = [[-1 for i in range(W)] for j in range(H)]
print (flip_count(0, 0))

Buggy python submission (verdict: Time Limit Exceeded):
def flip_count (r, c):
  if r == H - 1 and c == W - 1:
    if s[r][c] == "#":
      return 1
    else:
      return 0
  #右に行ったとき
  if c == W - 1:
    count_right = 10000
  else:
    count_right = flip_count (r, c + 1)
    if s[r][c] == "#" and s[r][c + 1] == ".":
      count_right += 1
  #下に行ったとき
  if r == H - 1:
    count_down = 10000
  else:
    count_down = flip_count (r + 1, c)
    if s[r][c] == "#" and s[r + 1][c] == ".":
      count_down += 1
  return min(count_right, count_down)

H, W = input().split()
W = int (W)
H = int (H)
s = []
for i in range(H):
  s.append(input())
print (flip_count(0, 0))


Fixed submission:
def flip_count_mem(r, c):
  if memory[r][c] < 0:
    memory[r][c] = flip_count(r, c)
  return memory[r][c]

def flip_count (r, c):
  if r == H - 1 and c == W - 1:
    if s[r][c] == "#":
      return 1
    else:
      return 0
  #右に行ったとき
  if c == W - 1:
    count_right = 10000
  else:
    count_right = flip_count_mem (r, c + 1)
    if s[r][c] == "#" and s[r][c + 1] == ".":
      count_right += 1
  #下に行ったとき
  if r == H - 1:
    count_down = 10000
  else:
    count_down = flip_count_mem (r + 1, c)
    if s[r][c] == "#" and s[r + 1][c] == ".":
      count_down += 1
  return min(count_right, count_down)

H, W = input().split()
W = int (W)
H = int (H)
s = []
for i in range(H):
  s.append(input())
memory = [[-1 for i in range(W)] for j in range(H)]
print (flip_count(0, 0))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from collections import deque

n, m = list(map(int, input().split()))
a = np.zeros((m,), dtype=np.int)
b = np.zeros((m,), dtype=np.int)
for i in range(m):
    a[i], b[i] = list(map(int, input().split()))
a -= 1
b -= 1

is_visited = np.zeros((n,), dtype=np.bool)
parent = np.zeros((n,), dtype=np.int)

q = deque()
q.append(0)
is_visited[0] = True
while len(q) != 0:
    node = q.popleft()
    for i in np.where(a == node)[0]:
        child = b[i]
        if not is_visited[child]:
            is_visited[child] = True
            parent[child] = node
            q.append(child)
    for i in np.where(b == node)[0]:
        child = a[i]
        if not is_visited[child]:
            is_visited[child] = True
            parent[child] = node
            q.append(child)

parent += 1

print('Yes')
for node in parent[1:]:
    print(node)

Fixed submission:
from collections import deque
import numpy as np

n, m = list(map(int, input().split()))
edge = {}
for i in range(m):
    ai, bi = list(map(int, input().split()))
    if ai in edge:
        edge[ai].append(bi)
    else:
        edge[ai] = [bi,]
    if bi in edge:
        edge[bi].append(ai)
    else:
        edge[bi] = [ai,]
# print(edge)

is_visited = np.zeros((n+1,), dtype=np.bool)
parent = np.zeros((n+1,), dtype=np.int)

q = deque()
q.append(1)
is_visited[1] = True
while len(q) != 0:
    node = q.popleft()
    for child in edge[node]:
        if not is_visited[child]:
            is_visited[child] = True
            parent[child] = node
            q.append(child)

print('Yes')
print('\n'.join(list(map(str, list(parent[2:])))))
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
if (a * b) % 2:
    print('Odd')
else:
    print('Even')

Fixed submission:
a, b = [int(e) for e in input().split()]
if (a * b) % 2:
    print('Odd')
else:
    print('Even')

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if(a*b)%2:
print("Odd")
else:
print("Even")


Fixed submission:
a,b=map(int,input().split())
if(a*b)%2:
   print("Odd")
else:
   print("Even")
Buggy python submission (verdict: Runtime Error):
n=int(input())
h=list(map(int,input().split()))

dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])

for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[n-1])

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

dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])

for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[n-1])

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

dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[2])

for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[n-1])

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

dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])

for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[n-1])

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

dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[2])

for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[n-1])

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

dp=[0]*n
dp[0]=0
dp[1]=abs(h[1]-h[0])

for i in range(2,n):
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))

print(dp[n-1])
Buggy python submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())
A = map(int, raw_input().split())

ave = sum(A)/N

c = 0
for i in range(N):
    if A[i] >= ave:
        c += 1

if c >= M:
    print "Yes"
else:
    print "No"


Fixed submission:
N, K = map(int, raw_input().split())

N = N % K

print min(N, abs(K-N))
Buggy python submission (verdict: Runtime Error):
cat atcorder_151_C.py
N, M = map(int, raw_input().split())
#print N, M

state = [-1 for i in range(N)]
pena = [0 for i in range(N)]
WA = [0 for i in range(N)]

for i in range(M):
    s = raw_input().split()
    p = int(s[0])
    sc = s[1]
    #print p, sc
    p -= 1
    if (state[p] == 0):
        continue
    if sc == 'WA':
        pena[p] += 1
    else:
        state[p] = 0

ok = 0
pn = 0
for i in range(N):
    if state[i] == 0:
        ok += 1
        pn += pena[i]

print ok, pn


Fixed submission:
N, M = map(int, raw_input().split())
#print N, M

state = [-1 for i in range(N)]
pena = [0 for i in range(N)]
WA = [0 for i in range(N)]

for i in range(M):
    s = raw_input().split()
    p = int(s[0])
    sc = s[1]
    #print p, sc
    p -= 1
    if (state[p] == 0):
        continue
    if sc == 'WA':
        pena[p] += 1
    else:
        state[p] = 0

ok = 0
pn = 0
for i in range(N):
    if state[i] == 0:
        ok += 1
        pn += pena[i]

print ok, pn
Buggy python submission (verdict: Runtime Error):
N = int(input())
s = raw_input().split()
A = [0]*N

for i in range(N):
    A[i] = int(s[i])

#print N, A

h = 0
t = N-1
lh = 0
lt = 0

for i in range(N):
    if (lh > lt):
        lt += A[t]
        t -= 1
    else:
        lh += A[h]
        h += 1
    #print h, t, lh, lt, A[h+1:t-1]

print abs(lh-lt)


Fixed submission:
s = raw_input().split()
[X, Y] = s
o = [0,0]
o[0] = int(X)
o[1] = int(Y)
#print A, B

p = 0
for i in range(2):
    if o[i] == 1:
        p += 300000
    elif o[i] == 2:
        p += 200000
    elif o[i] == 3:
        p += 100000

if o[0] == 1 and o[1] == 1:
    p += 400000

print p
Buggy python submission (verdict: Runtime Error):
s = raw_input().split()
[N] = s
N = int(N)

print ((N-1)/2)


Fixed submission:
s = raw_input().split()
[N] = s
N = int(N)

print ((N-1)/2)
Buggy python submission (verdict: Runtime Error):
s = raw_input().split()
[N, K] = s
N = int(N)
K = int(K)
#print N, K

s = raw_input().split()
#print s
h = [0]*N

for i in range(N):
    h[i] = int(s[i])
    #print h[i]

h.sort(reverse=True)
#print h

for i in range(N):
    if (h[i] >= K):
        continue
    else:
        print i
        exit()

print N


Fixed submission:
v=int(input())
if (v % 2 == 0):
    print 0.5
else:
    print (v/2+1.0)/v
Buggy python submission (verdict: Runtime Error):
$ cat atcorder_142_C.py
N = int(input())
s = raw_input().split()
h = [0]*N

for i in range(N):
    h[i] = int(s[i])
    h[i] = (h[i], i+1)

#print h
h.sort()
#print h

for i in range(N-1):
    print h[i][1],

print h[N-1][1]


Fixed submission:
N = int(input())
s = raw_input().split()
h = [0]*N

for i in range(N):
    h[i] = int(s[i])
    h[i] = (h[i], i+1)

#print h
h.sort()
#print h

for i in range(N-1):
    print h[i][1],

print h[N-1][1]
Buggy python submission (verdict: Runtime Error):
import math
a, b, n = list(map(int,input().split()))
if b > n:
    print(math.floor(a*n/b))
elif n < 2*b - 1:
    print(max(math.floor(a*n/b)-a,math.floor(a*(b-1)/b))
else:
    print(a+math.floor((-1)*a/b))

Fixed submission:
import math
a, b, n = list(map(int,input().split()))
if b > n:
    print(math.floor(a*n/b))
elif n < 2*b - 1:
    print(max(math.floor(a*n/b)-a,math.floor(a*(b-1)/b)))
else:
    print(a+math.floor((-1)*a/b))
Buggy python submission (verdict: Runtime Error):
s = input()
s = list(reversed(s))
n = len(s)
dp1 = [0]*n
dp2 = [0]*n
counting = [0]*2019
counitng[0] += 1
dp1[0] = 1
dp2[0] = int(s[0])
counting[dp2[0]] += 1
if n >= 2:
    for i in range(1,n):
        dp1[i] = (10*dp1[i-1]) % 2019
        dp2[i] = (int(s[i])*dp1[i]+dp2[i-1]) % 2019
        counting[dp2[i]] += 1
#print(counting)
sm = 0
for j in range(2019):
    sm += int(counting[j]*(counting[j]-1)/2)
print(sm)

Fixed submission:
s = input()
s = list(reversed(s))
n = len(s)
dp1 = [0]*n
dp2 = [0]*n
counting = [0]*2019
counting[0] += 1
dp1[0] = 1
dp2[0] = int(s[0])
counting[dp2[0]] += 1
if n >= 2:
    for i in range(1,n):
        dp1[i] = (10*dp1[i-1]) % 2019
        dp2[i] = (int(s[i])*dp1[i]+dp2[i-1]) % 2019
        counting[dp2[i]] += 1
#print(counting)
sm = 0
for j in range(2019):
    sm += int(counting[j]*(counting[j]-1)/2)
print(sm)

Buggy python submission (verdict: Runtime Error):
s = input()
s.reverse()
n = len(s)
dp1 = [0]*n
dp2 = [0]*n
counting = [0]*2019
dp1[0] = 1
dp2[0] = s[0]
counting[dp2[0]] += 1
if n >= 2:
    for i in range(1,n):
        dp1[i] = (10*dp1[i-1]) % 2019
        dp2[i] = (int(s[i])*dp1[i]+dp2[i-1]) % 2019
        counting[dp2[i]] += 1
sm = 0
for j in range(2019):
    sm += counting[j]*(counting[j]-1)
print(sm)

Fixed submission:
s = input()
s = list(reversed(s))
n = len(s)
dp1 = [0]*n
dp2 = [0]*n
counting = [0]*2019
counting[0] += 1
dp1[0] = 1
dp2[0] = int(s[0])
counting[dp2[0]] += 1
if n >= 2:
    for i in range(1,n):
        dp1[i] = (10*dp1[i-1]) % 2019
        dp2[i] = (int(s[i])*dp1[i]+dp2[i-1]) % 2019
        counting[dp2[i]] += 1
#print(counting)
sm = 0
for j in range(2019):
    sm += int(counting[j]*(counting[j]-1)/2)
print(sm)