Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a,b,c,d=map(int,list(input()))
if a==b==c:
  pritn("yes")
elif b==c==d:
  print("yes")
elif a==b==c==d:
  print("yes")
else:
  print("No")

Fixed submission:
a,b,c,d=map(int,list(input()))
if a==b==c:
  print("Yes")
elif b==c==d:
  print("Yes")
elif a==b==c==d:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())

sorted_A = A.sort().reverse()

alice = 0
bob = 0
for index, point in sorted_A:

  # Alice
  if (index + 1) % 2 == 0:
    alice = alice + point
  
  # Bob
  else:
    bob = bob + point

answer = alice - bob

print(answer)



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

sorted_A = sorted(A, reverse=True)

alice = 0
bob = 0
for index, point in enumerate(sorted_A):

  # Alice
  if (index + 1) % 2 != 0:
    alice = alice + point
  
  # Bob
  else:
    bob = bob + point
 
answer = alice - bob

print(answer)

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

Fixed submission:
n = int(input())
a = sorted(list(map(int,input().split())), reverse=True)
print(sum(a[::2]) - sum(a[1::2]))
Buggy python submission (verdict: Runtime Error):
n, a, b, = map(int,input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int,list(str(i))))) <= b
        ans += i
print(ans)
    

Fixed submission:
n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)

Buggy python submission (verdict: Runtime Error):
n, a, b, = map(int,input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int,list(str)))):
        ans += i
print(ans)
    

Fixed submission:
n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)
Buggy python submission (verdict: Runtime Error):
# 入力
a,b = map(int, input().split())
# 積の計算、判定
if (a * b) % 2 == 0:
  print('Even')
else:
  ptint('Odd')

Fixed submission:
# 入力
a,b = map(int, input().split())
# 積の計算、判定
if (a * b) % 2 == 0:
  print('Even')
else:
  print('Odd')

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


Fixed submission:
import sys
a,b=input().split()
a = int(a)
b = int(b)
if (a * b) % 2 == 0:
  print("Even")
else:
  print("Odd")

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

Fixed submission:
import sys
a,b=input().split()
a = int(a)
b = int(b)
if (a * b) % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
print("No" if ((N % 500)>=A else "Yes")

Fixed submission:
p = int(input())
one = int(input())
if (p%500)<=one:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
print("No" if ((N % 500)>=N else "Yes")

Fixed submission:
p = int(input())
one = int(input())
if (p%500)<=one:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
if (a*b)%2==1:
  print("odd")
else:
  print("Even")

Fixed submission:
a,b = map(int,input().split())
print('Odd' if a&b&1 else 'Even')

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


Fixed submission:
a, b = map(int, input().split())
c = a * b
if (c % 2 == 0):
	print('Even')
else:
	print('Odd')

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

Fixed submission:
a, b = map(int, input().split())
c = a * b
if (c % 2 == 0):
	print('Even')
else:
	print('Odd')

Buggy python submission (verdict: Runtime Error):
if ((a * b)%2 == 0):
	print('Even')
else:
	print('Odd')

Fixed submission:
a, b = map(int, input().split())
c = a * b
if (c % 2 == 0):
	print('Even')
else:
	print('Odd')
Buggy python submission (verdict: Runtime Error):
r，g，b = map(int,input().split())
x=r*100+g*10+b
if x%4==0
 print("YES")
else
 print("NO")


Fixed submission:
r, g, b = map(int, input().split())
rgb = int(str(r)+str(g)+str(b))
if rgb%4 == 0:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for K in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)

Fixed submission:
a, b, c, x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, imput().split())
seki = a*b
if seki % 2 == 0:
	print('Even')
else:
	print('Odd')


Fixed submission:
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")

Buggy python submission (verdict: Runtime Error):
a, b = map(int, imput().split())
seki = a*b
if seki % 2 == 0;
	print('Even')
else:
	print('Odd')

Fixed submission:
a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
Buggy python submission (verdict: Runtime Error):
n, y = map(int, input().split())
for i in range(n + 1):
    for j in range(n - i - j):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print("-1 -1 -1")

Fixed submission:
n, y = map(int, input().split())
for i in range(n + 1):
    for j in range(n - i + 1):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print("-1 -1 -1")

Buggy python submission (verdict: Runtime Error):
n, y = map(int, input().split())
for i in range(n + 1)
    for j in range(n - i + 1):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print("-1 -1 -1")

Fixed submission:
n, y = map(int, input().split())
for i in range(n + 1):
    for j in range(n - i + 1):
        if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
            print(i, j, n - i - j)
            exit()
print("-1 -1 -1")
Buggy python submission (verdict: Runtime Error):
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    b = len(bin(i)) - bin(i).rfind("1") - 1)
    ans = min(ans, b)
print(round(ans))

Fixed submission:
import math
n = input()
a = list(map(int, input().split()))
ans = float("inf")
for i in a:
    ans = min(ans, len(bin(i)) - bin(i).rfind("1") - 1)
print(round(ans))
Buggy python submission (verdict: Runtime Error):
N = input()

a = []
for i in range(int(N)):
  a.append(input())

cnt = []
cnt2 = 0
while(int(N)-cnt2 != 0):
  s = a.count(a[0])-1
  cnt.append(s)
  a.remove(a[0])
  cnt2 += s+1
su = sum(cnt)
print(int(N)-su)

Fixed submission:
N = input()

a = []
for i in range(int(N)):
  a.append(input())

cnt = {s:(a.count(s)-1) for s in a}

print(int(N)-sum([int(j) for j in cnt.values()]))

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

a = []
for i in range(int(N)):
  a.append(input())

cnt = []
cnt2 = 0
while(int(N)-cnt2 != 0):
  s = a.count(a[0])-1
  cnt.append(s)
  a.remove(a[0])
  cnt2 += s+1
  print(cnt)
su = sum(cnt)
print(int(N)-su)

Fixed submission:
N = input()

a = []
for i in range(int(N)):
  a.append(input())

cnt = {s:(a.count(s)-1) for s in a}

print(int(N)-sum([int(j) for j in cnt.values()]))
Buggy python submission (verdict: Runtime Error):
def check(a,cnt):
  b = [int(x)%2 for x in a]
  if 1 in b:
    return 0,cnt
  else :
    cnt +=1
    b = [int(x)/2 for x in a]
    return 1,cnt
 
N = input()
a = input().split()
cnt = 0
while(1):
  m,cnt = check(a,cnt)
  if m == 0:
    print(cnt)
  else :
    continue

Fixed submission:
s=input()
a=[int(x) for x in s]
print(sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
def check(a,cnt):
  b = [int(x)%2 for x in a]
  if 1 in b:
    return 0,cnt
  else :
    cnt +=1
    b = [int(x)/2 for x in a]
    return 1,cnt
 
N = input()
a = input().split()
cnt = 0
m = 1
while(m != 0):
  m,cnt = check(a,cnt)
  if m == 0:
    print(cnt)
  else :
    continue

Fixed submission:
def check(a,cnt):
  c = [int(x)%2 for x in a]
  if 1 in c:
    return 0,cnt,a
  else :
    cnt +=1
    b = [int(x)/2 for x in a]
    return 1,cnt,b
 
N = input()
a = input().split()
cnt = 0
m = 1
while(m != 0):
  m,cnt,a = check(a,cnt)
  if m == 0:
    print(cnt)
  else :
    continue

Buggy python submission (verdict: Runtime Error):
def check(a,cnt)
  b = [int(x)%2 for x in a]
  if 1 in b:
    return 0,cnt
  else :
    cnt +=1
    b = [int(x)/2 for x in a]
    return 1,cnt

N = input()
a = input().split()
cnt = 0
while(1):
  m,cnt = check(a,cnt)
  if m == 0:
    print(cnt)
  else :
    continue

Fixed submission:
def check(a,cnt):
  c = [int(x)%2 for x in a]
  if 1 in c:
    return 0,cnt,a
  else :
    cnt +=1
    b = [int(x)/2 for x in a]
    return 1,cnt,b
 
N = input()
a = input().split()
cnt = 0
m = 1
while(m != 0):
  m,cnt,a = check(a,cnt)
  if m == 0:
    print(cnt)
  else :
    continue
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Nov  4 21:46:51 2018

@author: sk
"""


b, c = map(int, input().split())

s=b*c

if s%2==1:
  print("Odd")
else:
  prinnt("Even")




Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Nov  4 21:46:51 2018

@author: sk
"""


b, c = map(int, input().split())

s=b*c

if s%2==1:
  print("Odd")
else:
  print("Even")

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Nov  4 21:46:51 2018

@author: sk
"""


a ,b=map( input().split())

s=a*b

if s%2==1:
  print("Odd")
else:
  print("Even")
  



Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Nov  4 21:46:51 2018

@author: sk
"""


b, c = map(int, input().split())

s=b*c

if s%2==1:
  print("Odd")
else:
  print("Even")
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

a=input()

s=48-a

print(s)


Fixed submission:
# -*- coding: utf-8 -*-

a=int(input())

s=48-a

print(s)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

int a=input()

print(48-a)


Fixed submission:
# -*- coding: utf-8 -*-

a=int(input())

s=48-a

print(s)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Nov  4 21:46:51 2018

@author: sk
"""


a,b, c,d = map(int, input().split())

s1=a+b
s2=c+d

if s1>s2:
  print("Left")
elseif s1==s2:
  print("Balanced")
else:
  print("Right")





Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Nov  4 21:46:51 2018

@author: sk
"""


a,b,c,d = map(int, input().split())

s1=a+b
s2=c+d

if s1>s2:
  print("Left")
elif s1==s2:
  print("Balanced")
else:
  print("Right")
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sat Nov  3 09:19:07 2018

@author: sk
"""

     
      
a, b, c = map(int, input().split())

int s=0

if a==1:
  s=s+1

if b==1:
  s=s+1

if c==1:
  s=s+1
  

print(s)

Fixed submission:
# -*- coding: utf-8 -*-

a =str( input())

char_list = list(a)

b=int( char_list[0])
c=int( char_list[1])
d=int( char_list[2])

s=b+c+d

print(s)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-


a=input()
b=input()

s=2*b-a

print(s)



Fixed submission:
# -*- coding: utf-8 -*-

a=int(input())
b=int(input())

s=2*b-a

print(s)
Buggy python submission (verdict: Runtime Error):
n = int(input())
 
ai = []
for i in range(n):
    ai.append(int(input()))

sorted_ai = sorted(ai, reverse=True)

alice = 0
bob = 0

for index, x in enumerate(sorted_ai):
    if (index % 2 == 0):
        alice += x
    else:
        bob += x
        
print(alice - bob)

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

sorted_ai = sorted(ai, reverse=True)

alice = 0
bob = 0

for index, x in enumerate(sorted_ai):
    if (index % 2 == 0):
        alice += x
    else:
        bob += x
        
print(alice - bob)

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

ai = []
for i in range(n):
    ai.append(int(input()))

ai = sorted(ai, reverse=True)

alice = 0
bob = 0

for index, x in enumerate(ai):
    if (index % 2 == 0):
        alice += x
    else:
        bob += x
        
print(alice - bob)

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

sorted_ai = sorted(ai, reverse=True)

alice = 0
bob = 0

for index, x in enumerate(sorted_ai):
    if (index % 2 == 0):
        alice += x
    else:
        bob += x
        
print(alice - bob)

Buggy python submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
    i = int(input())

ai = []
for i in range(n):
    ai.append(int(input()))

ai = sorted(ai, reverse=True)

alice = 0
bob = 0

for index, x in enumerate(ai):
    if (index % 2 == 0):
        alice += x
    else:
        bob += x
        
print(alice - bob)

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

sorted_ai = sorted(ai, reverse=True)

alice = 0
bob = 0

for index, x in enumerate(sorted_ai):
    if (index % 2 == 0):
        alice += x
    else:
        bob += x
        
print(alice - bob)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = map(int, input().split())
A_score = 0
B_score = 0
for i in A:
  A_score += max(A)
  del max(A)
  B_score += max(A)
  del max(A)
  if lens(A) = 0:
    break
print(A_score - B_score)

Fixed submission:
N=int(input())
A=int(input())
 
if N % 500 <= A:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N=int(input())
A=int(input())
 
if N % 500 <= A:
print("Yes")
else:
print("No")

Fixed submission:
N=int(input())
A=int(input())
 
if N % 500 <= A:
  print("Yes")
else:
  print("No")

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

for i in A:
  A_score = 0
  A_score += max(card_list)
  del max(card_list)
  B_score = 0
  B_score += max(card_list)
  del max(card_list)
  if lens(card_list) = 0:
  break
print(A_score - B_score)

Fixed submission:
N=int(input())
A=int(input())

if N % 500 <= A:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
B = int(input(N))
C = int(input(A))
D = B % 500
if D > C:
  print("no")
else:
  print("yes")

Fixed submission:
N=int(input())
A=int(input())

if N % 500 <= A:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
ソースコード 

Copy
Copy
B = int(input(N))
C = int(input(A))
D = B % 500
if D > C:
  print("no")
else:
  print("yes")

Fixed submission:
N=int(input())
A=int(input())

if N % 500 <= A:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
B = int(input(N))
C = int(input(A))
D = B % 500
if D > C:
  print(no)
else:
  print(yes)

Fixed submission:
N=int(input())
A=int(input())

if N % 500 <= A:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = N % 500
if B > A:
  print(no)
else:
  print(yes)

Fixed submission:
N=int(input())
A=int(input())

if N % 500 <= A:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
X=input()
Y=input()
Z=input()

A = (X-2*Y) // (Y+Z)
print(A)

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

b = (a[0]-a[2]) // (a[1]+a[2])
print(b)

Buggy python submission (verdict: Runtime Error):
X=int(input())
Y=int(input())
Z=int(input())

A = X // (Y+Z)
print(A)

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

b = (a[0]-a[2]) // (a[1]+a[2])
print(b)
Buggy python submission (verdict: Runtime Error):

import itertools
import numpy as np

def calc(n, a, b):
    if a > b:
        return 0
    elif a == b:
        return 1
    elif n == 1:
        return 0

    s = set()
    ary = np.arange(a, b+1)
    it = itertools.combinations_with_replacement(ary, n-2)
    for x in it:
        s.add(sum(x))

    return len(s)

N, A, B = map(int, input().split())


print(calc(N, A, B))

Fixed submission:

import itertools
import numpy as np

def calc(n, a, b):
    if a > b:
        return 0
    elif a == b:
        return 1
    elif n == 1:
        return 0

    return (b - a) * (n - 2) + 1

N, A, B = map(int, input().split())


print(calc(N, A, B))
Buggy python submission (verdict: Time Limit Exceeded):

N, W = map(int, input().split())

weights = []
values = []
for i in range(N):
    lst = [int(e) for e in input().split()]
    weights.append(lst[0])
    values.append(lst[1])

#df = np.array(ary)

def rec(i, j):
    if i == N:
        return 0
    elif j < weights[i]:
        return rec(i+1, j)
    else:
        return max(rec(i+1, j), rec(i+1, j-weights[i]) + values[i])

print(rec(0, W))

Fixed submission:

N, W = map(int, input().split())

weights = []
values = []
for i in range(N):
    lst = [int(e) for e in input().split()]
    weights.append(lst[0])
    values.append(lst[1])


dp = [{} for j in range(N+1)]

def rec(i, j):
    if j in dp[i]:
        return dp[i][j]

    res = 0
    if i == N:
        res = 0
    elif j < weights[i]:
        res = rec(i+1, j)
    else:
        res = max(
            rec(i+1, j),
            rec(i+1, j-weights[i]) + values[i]
        )

    dp[i][j] = res
    return res


print(rec(0, W))
Buggy python submission (verdict: Runtime Error):
# x-500a-100b-5-c = 0 になる方法を探す

a = int(input())
b = int(input())
c = int(input())

x = 500a-100b-50c


Fixed submission:
a = int(input())
b = int(input())
c = int(input())
x = int(input())


count = 0
for i in range(a+1):
	for j in range(b+1):
		for k in range(c+1):
			#if (str(i) + " " + str(j) + " " + str(k)) == x:
			if 500*(i) + 100*(j) + 50*(k) == x:
				count += 1
				
print(count)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())

ab_count = a + b
cd_count = c + d

if ab_count > cd_count:
	print('left')
else if ab_count == cd_count:
	print('balanced')
elif:
	print('light')

Fixed submission:
a,b,c,d = map(int,input().split(" "))

if a+b > c+d:
	print("Left")
elif a+b == c+d:
	print("Balanced")
else:
	print("Right")
Buggy python submission (verdict: Runtime Error):
x = str(input()).split(" ")

n = int(x[0])
a = int(x[1])
b = int(x[2])

plan1 = n*a
plan2 = b

if plan1 >= plan2:
	print(plan2)
else:
	print(plan1)

Fixed submission:
x = list(input())

cnt = 0
for i in range(3):
	if x[i] == "1":
		cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
s = list(str(input()))
print(t = s[0::2])

Fixed submission:
s = str(input())

ss = ""
for i in range(len(s)):
	if (i +1)%2 != 0:
		ss += s[i]
print(ss)
Buggy python submission (verdict: Runtime Error):
N = input()
if "9" in n:
    print("Yes")
else:
    printI("No")

Fixed submission:
# coding: utf-8
# Your code here!
N = input()
if "9" in N:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
N = int(input())
A = []
for i in range(N):
    num = input()
    if num in A:
        A.remove(num)
    else:
        A.append(num)
print(len(A))


Fixed submission:
# coding: utf-8
# Your code here!
N = int(input())
A = set()
for i in range(N):
    num = input()
    if num in A:
        A.remove(num)
    else:
        A.add(num)
print(len(A))

Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
N = int(input())
A = []
for i in range(N):
    num = input()
    if num in A:
        A.remove(num)
    else:
        A.append(num)
print(len(A))


Fixed submission:
# coding: utf-8
# Your code here!
N = int(input())
A = set()
for i in range(N):
    num = input()
    if num in A:
        A.remove(num)
    else:
        A.add(num)
print(len(A))
Buggy python submission (verdict: Runtime Error):
X, Y=map(int, input().split())
i=X+X
MAX=10 ** 18
 
if X%Y== 0 or Y%X ==0:
    print(-1)
else:
    while i<MAX:
        if i%Y != 0:
            print(i)
            break
        i+=X
X, Y=map(int, input().split())
i=X+X
MAX=10 ** 18

if X%Y== 0:
    print(-1)
else:
    while i<MAX:
        if i%Y != 0:
            print(i)
            break
        i+=X


Fixed submission:
X, Y=map(int, input().split())
i=X+X
MAX=10 ** 18

if X%Y== 0:
    print(-1)
else:
    print(X)
Buggy python submission (verdict: Time Limit Exceeded):
MAX=100001
array=[True for i in range(MAX)]
array[1]=False

for i in range(2, MAX):
	if array[i]:
		for j in range(2, int(MAX/i)+1):
			if(j*i < MAX):
				array[i*j]=False
Q=int(input())
for i in range(Q):
	l,r=map(int, input().split())
	count=0
	for j in range(l, r+1):
		if array[j] and array[int((j+1)/2)]:
			count+=1
	print(count)


Fixed submission:
MAX=100001
array=[True for i in range(MAX)]
array[1]=False
similar=[True for i in range(MAX)]

for i in range(2, MAX):
	if array[i]:
		for j in range(2, int(MAX/i)+1):
			if(j*i < MAX):
				array[i*j]=False
c=[0 for i in range(MAX)]
count=0

for i in range(2, MAX):
	if array[i] and array[int((i+1)/2)]:
		count+=1

	c[i]=count

Q=int(input())
for i in range(Q):
	l,r=map(int, input().split())
	print(c[r]-c[l-1])
Buggy python submission (verdict: Time Limit Exceeded):
def judge(A, B):
  i=0
  if len(A) != len(B):
    return False
  else:
    while i<len(A):
      if A[i] != B[len(B)-i-1]:
        return False
    return True
 
A=input()
B=input()
 
if judge(A, B):
  print("YES")
else:
  print("NO")

Fixed submission:
def judge(A, B):
  i=0
  if len(A) != len(B):
    return False
  else:
    while i<len(A):
      if A[i] != B[len(B)-i-1]:
        return False
      i+=1
    return True

A=input()
B=input()
 
if judge(A, B):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
N=int(input())
ans=int(sqrt(N))
print(ans**2)

Fixed submission:
import math
N=int(input())
ans=int(math.sqrt(N))
print(ans**2)
Buggy python submission (verdict: Runtime Error):
def bills(count, value):
    max10000 = value // 10000
    for i in range(max10000 + 1):
        max5000 = min(count - i, (value - i * 10000) // 5000)
        for j in range(max5000 + 1):
            k = (value - i * 10000 - j * 5000) // 1000
            if i + j + k == count:
                return i, j, k
    
    return -1, -1, -1

v = bills(*map(int, input().split()))
print("{} {} {}".format(*v))

Fixed submission:
print(input().replace("2017", "2018"))

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

def bills(count, value):
    max10000 = value // 10000
    for i in range(max10000 + 1):
        max5000 = min(count - i, (value - i * 10000) // 5000)
        for j in range(max5000 + 1):
            k = (value - i * 10000 - j * 5000) // 1000
            if i + j + k == count:
                return i, j, k
    
    return -1, -1, -1

v = bills(int(sys.argv[1]), int(sys.argv[2]))
print("{} {} {}".format(*v))

Fixed submission:
print(input().replace("2017", "2018"))
Buggy python submission (verdict: Runtime Error):
import numpy as np

def katana(hp, katanas):
    katanas = np.array(katanas, 'i')
    max_slash = np.max(katanas[:, 0])
    throws = -np.sort(-katanas[:, 1])
    throws_index = np.where(throws > max_slash)[0]
    eff_throws = throws[throws_index]

    for i, v in enumerate(eff_throws):
        hp -= v
        if hp <= 0:
            print(i + 1)
            return

    print(len(eff_throws) + int(hp / max_slash + 0.9999999))

n, hp = map(int, input().split())
takanas = [map(int, input().split()) for _ in range(n)]
katana(hp, takanas)

Fixed submission:
import math
import numpy as np

def katana(hp, katanas):
    katanas = np.array(katanas, 'i')
    max_slash = np.max(katanas[:, 0])
    throws = -np.sort(-katanas[:, 1])
    throws_index = np.where(throws > max_slash)[0]
    eff_throws = throws[throws_index]

    for i, v in enumerate(eff_throws):
        hp -= v
        if hp <= 0:
            print(i + 1)
            return

    print(len(eff_throws) + math.ceil(hp / max_slash))

n, hp = map(int, input().split())
takanas = [list(map(int, input().split())) for _ in range(n)]
katana(hp, takanas)