Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = input()
ans = 1
s = list(map(int, input().strip().split()))
if 0 in s:
    print(0)
    exit()
for i in s:
    if if ans>10**18:
        print(-1)
        exit()
    ans = ans*i

print(ans)

Fixed submission:
n = input()
ans = 1
s = list(map(int, input().strip().split()))
if 0 in s:
    print(0)
    exit()
for i in s:
    if ans>10**18:
        print(-1)
        exit()
    ans = ans*i

if ans>10**18:
        print(-1)
        exit()
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = input()
ans = 1
s = list(map(int, input().strip().split()))
for i in s:
    ans = ans*i
  
if ans>10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
n = input()
ans = 1
s = list(map(int, input().strip().split()))
if 0 in s:
    print(0)
    exit()
for i in s:
    if ans>10**18:
        print(-1)
        exit()
    ans = ans*i

if ans>10**18:
        print(-1)
        exit()
        
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(float, input().split())
a = int(a)
b_int = int(b)
b_frac = b*100-b*int*100

ans = a*b_int+(a*b_frac)//100
  
print(ans)

Fixed submission:
from decimal import Decimal
a,b = map(float, input().split())
ans = Decimal(str(a)) * Decimal(str(b))

  
print(int(ans))
Buggy python submission (verdict: Runtime Error):
a,b　= map(int, input().split())
print(a*b)

Fixed submission:
a,b = map(int, input().split())
print(a*b)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
li = input().split()
b = 0
for a in li:
    b = b + a
if n >= b:
    print(n-b)
else:
    print("-1")

Fixed submission:
n, m = map(int, input().split())
li = input().split()
b = 0
for a in li:
    b = b + int(a)
if n >= b:
    print(n-b)
else:
    print("-1")
Buggy python submission (verdict: Runtime Error):
i = input()
a = i//2
b = i%2
print(a+b)

Fixed submission:
i = input()
a = int(i)//2
b = int(i)%2
print(a+b)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
if a+b+c >= 22:
print("bust")
else:
    ("win")

Fixed submission:
#ABC147-A #Blackjack                                                                                             
a,b,c = map(int, input().split())
if a+b+c >= 22:
    print("bust")
else:
    print("win")
Buggy python submission (verdict: Runtime Error):
s = input()
t = [s[0], s[1], s[2], s[3]]
u = list(set(t))
v = len(u)
w = s.count(u[0])
x = s.count(u[1])
if v != 2:
    print("No")
else:
    w = s.count(u[0])
    x = s.count(u[1])
    if w == 2 and x ==2:
	print("Yes")
    else:
	print("No")

Fixed submission:
s = input()
t = [s[0], s[1], s[2], s[3]]
u = list(set(t))
v = len(u)
if v != 2:
    print("No")
else:
    w = s.count(u[0])
    x = s.count(u[1])
    if w == 2 and x ==2:
      print("Yes")
    else:
      print("No")
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
if a>b:
    print(a+(a-1))
elif a=b:
    print(a*2)
elif a<b:
    print(b+(b-1))

Fixed submission:
a, b = map(int, input().split())
if a>b:
    print(a+(a-1))
elif a==b:
    print(a*2)
elif a<b:
    print(b+(b-1))
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
ab = b-a
ac = c-a
ad = d-a
ae = e-a
bc = c-b
bd = d-b
be = e-b
cd = d-c
ce = e-c
de = e-d
if ab <=	k and ac <= k and ad <= k	and ae <= k and bc <= k and bd <= k and be <= k and cd <= k and ce <= k and d\
e <= k:
    print("Yay!")
else:
    print(":(")

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
ab = b-a
ac = c-a
ad = d-a
ae = e-a
bc = c-b
bd = d-b
be = e-b
cd = d-c
ce = e-c
de = e-d
if ab <= k and ac <= k and ad <= k and ae <= k and bc <= k and bd <= k and be <= k and cd <= k and ce <= k and de <= k:
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Runtime Error):
s = input()
y = int(s[0:4])
m = int(s[5:7])
d = int(s[8:10])
if y > 2019:
    print("TBD")
elif y=2019 and	m>4:
    print("TBD")
else:
    print("Heisei")

Fixed submission:
s = input()
y = int(s[0:4])
m = int(s[5:7])
d = int(s[8:10])
if y > 2019:
    print("TBD")
elif y==2019 and	m>4:
    print("TBD")
else:
    print("Heisei")
Buggy python submission (verdict: Runtime Error):
def check(a,b,c,d):
	while(a>0 and c>0):
		c-=b
		if(c==0):
			return 1
		a-=d
		if(a==0):
			return 0
	if(a<0):
		return 0
	if(c < 0):
		return 1
inp1=list(map(int,input().strip().split()))[:4]
a,b,c,d=inp1[0],inp1[1],inp1[2],inp1[3]
if(check(a,b,c,d)):
	print("Yes")
else:
	print("No")

Fixed submission:
inp1=list(map(int,input().strip().split()))[:2]
s,w=inp1[0],inp1[1]
if(w >= s):
	print("unsafe")
else:
	print("safe")

Buggy python submission (verdict: Runtime Error):
def check(a,b,c,d):
	while(a>0 and c>0):
		c-=b
		if(c==0):
			return 1
		a-=d
		if(a==0):
			return 0
	if(a<0):
		return 0
	if(c < 0)
		return 1
inp1=list(map(int,input().strip().split()))[:4]
a,b,c,d=inp1[0],inp1[1],inp1[2],inp1[3]
if(check(a,b,c,d)):
	print("Yes")
else:
	print("No")

Fixed submission:
inp1=list(map(int,input().strip().split()))[:2]
s,w=inp1[0],inp1[1]
if(w >= s):
	print("unsafe")
else:
	print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
def check(a,b,c,d):
	while(a!=0 and c!=0):
		c-=b
		if(c==0):
			return 1
		a-=d
		if(a==0):
			return 0
	if(a==0):
		return 0
	else:
		return 1
inp1=list(map(int,input().strip().split()))[:4]
a,b,c,d=inp1[0],inp1[1],inp1[2],inp1[3]
if(check(a,b,c,d)):
	print("Yes")
else:
	print("No")

Fixed submission:
def check(a,b,c,d):
	while(a>0 and c>0):
		c-=b
		if(c<=0):
			return 1
		a-=d
		if(a<=0):
			return 0
inp1=list(map(int,input().strip().split()))[:4]
a,b,c,d=inp1[0],inp1[1],inp1[2],inp1[3]
if(check(a,b,c,d)):
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Time Limit Exceeded):
def gcd(a,b):
	if(a==0):
		return b
	return gcd(b % a,a)
n=int(input())
sum1=0
for i in range(1,n+1):
	for j in range(1,n+1):
		for k in range(1,n+1):
			gcd1=gcd(i,j)
			gcd2=gcd(gcd1,k)
			sum1+=gcd2
print(sum1)

Fixed submission:
from math import gcd
n=int(input())
sum1=0
for i in range(1,n+1):
	for j in range(1,n+1):
		gcd1=gcd(i,j)
		for k in range(1,n+1):
			gcd2=gcd(gcd1,k)
			sum1+=gcd2
print(sum1)
Buggy python submission (verdict: Runtime Error):
s=input()
dict1={}
for i in s:
	if i in dict1:
		dict1[i]+=1
	else:
		dict1[i]=0
if(dict1['A'] > 0 and dict1['B'] > 0):
	print("Yes")
else:
	print("No")

Fixed submission:
s=input()
dict1={}
if('A' in s and 'B' in s):
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
inp=list(map(int,input().strip().split()))[:2]
n,r=inp[0],inp[1]
count=0
while(n > 0):
  n=n//r
  count+=1
return count


Fixed submission:
inp=list(map(int,input().strip().split()))[:2]
n,r=inp[0],inp[1]
count=0
while(n > 0):
    n=n//r
    count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
inp=list(map(int,input().strip().split()))[:2]
n,r=inp[0],inp[1]
count=0
while(n > 0):
  n=n//k
  count+=1
return count

Fixed submission:
inp=list(map(int,input().strip().split()))[:2]
n,r=inp[0],inp[1]
count=0
while(n > 0):
    n=n//r
    count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
arr=list(map(int,input().strip().split()))[:3]
if(arr[0]==arr[1] and arr[0]!=arr[2]):
  print("Yes")
elif(arr[1]==arr[2] and arr[1]!=arr[0]):
  print("Yes")
elif(arr1[0]==arr[2] and arr1[0]!=arr[1]):
  print("Yes")
else:
  print("No")

Fixed submission:
arr=list(map(int,input().strip().split()))[:3]
dict1={}
for i in arr:
    if i in dict1:
        dict1[i]+=1
    else:
        dict1[i]=1
if(len(dict1)==2):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = input()
a = map(int, input().split())

result = 1
for an in a:
    result *= an

max = 10 ** 18
if result > max:
    result = -1

print(result)


Fixed submission:
def calc(a, n):
    for x in range(n):
        if a[x] == 0:
            return 0

    result = 1
    max = 10 ** 18
    for x in range(n):
        result *= a[x]
        if result > max:
            return -1

    return result

n = int(input())
a = list(map(int, input().split()))

print(calc(a, n))
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal

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

ab = Decimal(a) * Decimal(b)
result = str(ab).split('.')

print(int(result[0]))


Fixed submission:
from decimal import *

a, b = input().split()

ab = Decimal(a) * Decimal(b)
result = Decimal(str(ab)).quantize(Decimal(str(1)), rounding=ROUND_DOWN)

print(int(result))
Buggy python submission (verdict: Runtime Error):
from math import floor
 
a,b = list(map(float,input().split()))
print(floor(a*b))

Fixed submission:
import sys

n=int(input())
l=list(map(int,input().split()))

if 0 in l:
	print(0)
	sys.exit()

flg=False
a = 1
for i in l:
	a *= i
	if a>10e17:
		flg=True
		break
 
if flg:
	print(-1)
else:
	print(a)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a = 1
for i in map(int,input().split()):
	a *= i
 
if a>10e17:
	print(-1)
else:
	print(a)

Fixed submission:
import sys

n=int(input())
l=list(map(int,input().split()))

if 0 in l:
	print(0)
	sys.exit()

flg=False
a = 1
for i in l:
	a *= i
	if a>10e17:
		flg=True
		break
 
if flg:
	print(-1)
else:
	print(a)
Buggy python submission (verdict: Runtime Error):
import random
k = int(input())
a, b = map(int, input().split())
c = random.randrange(a, b)
if c % k == 0:
  print('OK')
else:
  print('NG')

Fixed submission:
k = int(input())
a,b = map(int, input().split())
 
if (b // k) * k >= a:
  print('OK')
else:
  print('NG')
Buggy python submission (verdict: Runtime Error):
s = list(input())
t = list(input())
ans = 0
for i in range (3):
    if S[i] == T[i]:
        ans += 1
print(ans)


Fixed submission:
s = list(input())
t = list(input())
ans = 0
for i in range (3):
    if s[i] == t[i]:
        ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
alist = list(map(int, input().split()))
result = 1
for a in alist:
  result *= a
if result > 10**18:
  print(-1)
else:
  print(result)

Fixed submission:
def solve(alist):
    if 0 in alist:
        return 0
    result = 1
    for a in alist:
        result *= a
        if result > 10**18:
            return -1
    return result

n = input()
alist = list(map(int, input().split()))
print(solve(alist))
Buggy python submission (verdict: Runtime Error):
print(int(input())*int(input()))

Fixed submission:
import math;print(math.prod(map(int,input().split())))
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from operator import mul
import sys
n=int(input())
s=input().split()
if '0' in s:
  print(0)
  sys.exit()
l=map(int,s)
ans=reduce(mul, l)
if ans>10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
import sys
n=int(input())
s=input().split()
if '0' in s:
  print(0)
  sys.exit()
l=list(map(int,s))
max=10**18
ans=1
while n>0:
  ans *= l[n-1]
  n-=1
  if ans>max:
    print(-1)
    sys.exit()
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
import sys
n=int(input())
s=input().split()
if '0' in s:
  print(0)
  sys.exit()
l=map(int,s)
ans=math.prod(l)
if ans>10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
import sys
n=int(input())
s=input().split()
if '0' in s:
  print(0)
  sys.exit()
l=list(map(int,s))
max=10**18
ans=1
while n>0:
  ans *= l[n-1]
  n-=1
  if ans>max:
    print(-1)
    sys.exit()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
a,b=map(int,input().split())
if b==1:
  a=a-10**str(a).count('0')
ans=[a]
for i in range(1000000000):
  ans.append(abs(ans[i]-b))
print(min(ans))

Fixed submission:
a,b=map(int,input().split())
ans=[a,a%b]
for i in range(10000):
    ans.append(abs(ans[i]-b))
print(min(ans))
Buggy python submission (verdict: Runtime Error):
s=[1,2,3];s.pop(int(input());s.pop(int(input());print(s[0])

Fixed submission:
print(6-int(input())-int(input()))
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,T = map(int, raw_input().split())
L = [map(int, raw_input().split()) for i in range(N)]
d=np.zeros(1000,int)
for a,b in sorted(L):
    t=d[a:T+a]
    np.maximum(t,d[:T]+b,t)
print(max(d))

Fixed submission:
import numpy as np
N,T = map(int, raw_input().split())
L = [map(int, raw_input().split()) for i in range(N)]
d=np.zeros(10000,int)
for a,b in sorted(L):
    t=d[a:T+a]
    np.maximum(t,d[:T]+b,t)
print(max(d))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int,input().split()))

cnt = 0
for i in range(n):
    ok_flag = True
    for j in range(i+1):
        if p[i] > p[j]:
            ok_flag=False
    if ok_flag:
        cnt += 1

print(cnt)

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

cnt = 0
min_1_i = p[0]
for i in range(n):
    min_1_i = min(min_1_i,p[i])
    if p[i] <= min_1_i:
        cnt += 1

print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
num2 = list(input().split())
for i in range(num):
  print(num2.count(str(i + 1)))

Fixed submission:
num = int(input())
li = list(int(x) for x in input().split())
li2 = [0] * num
num = len(li)
for i in li:
  li2[i - 1] = li2[i - 1] + 1
for j in range(num + 1):
  print(li2[j])

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
num2 = list(int(x) for x in input().split())
for i in range(num):
  print(num2.count(i + 1))

Fixed submission:
num = int(input())
li = list(int(x) for x in input().split())
li2 = [0] * num
num = len(li)
for i in li:
  li2[i - 1] = li2[i - 1] + 1
for j in range(num + 1):
  print(li2[j])

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
num2 = list(int(x) for x in input().split())
mb = [0] * num
for i in range(num):
  buka = num2.count(i + 1)
  mb[i] = buka
for j in range(num):
  print(mb[j])

Fixed submission:
num = int(input())
li = list(int(x) for x in input().split())
li2 = [0] * num
num = len(li)
for i in li:
  li2[i - 1] = li2[i - 1] + 1
for j in range(num + 1):
  print(li2[j])

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
num2 = list(int(x) for x in input().split())
mb = [0] * num
for i in range(num):
  buka = num2.count(i + 1)
  mb[i] = buka
for j in range(num):
  print(mb[j])

Fixed submission:
num = int(input())
li = list(int(x) for x in input().split())
li2 = [0] * num
num = len(li)
for i in li:
  li2[i - 1] = li2[i - 1] + 1
for j in range(num + 1):
  print(li2[j])
Buggy python submission (verdict: Runtime Error):
n,m = (int(x) for x in input('').split(''))
sum = (n * (n - 1) / 2) + (m * (m - 1) / 2)
print(sum)

Fixed submission:
n,m=(int(x) for x in input().split())
sum=int((n*(n-1)/2)+(m*(m-1)/2))
print(sum)
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())

print(A*B)

Fixed submission:
A, B = map(int, input().split())
print(A*B)
Buggy python submission (verdict: Time Limit Exceeded):
# 1,0,-1
# K枚
A, B, C, K = map(int, input().split())

ans = 0
while(K!=0):
    if A!=0:
        ans += 1
        A -= 1
        K -= 1
    elif B!=0:
        ans += 0
        B -= 1
        K -= 1
    elif C!=0:
        ans += -1
        C -= 1
        K -= 1

print(ans)

Fixed submission:
# 1,0,-1
# K枚
A, B, C, K = map(int, input().split())

ans = 0
while(K!=0):
    #print(A, B, C, K, ans)
    
    if A!=0:
        if A <= K:
            ans += A*1
            K -= A
            A = 0
        else:
            ans += K*1
            A -= K
            K = 0
    elif B!=0:
        if B <= K:
            ans += B*0
            K -= B
            B = 0
        else:
            ans += K*0
            B -= K
            K = 0
    elif C!=0:
        if C <= K:
            ans += C*-1
            K -= C
            C = 0
        else:
            ans += K*-1
            C -= K
            K = 0

    if A==0 and B==0 and C==0:
        break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# 展望台N
# 道M
N, M = map(int, input().split())

# 展望台の高さ
H = list(map(int, input().split()))

n = [[0] * N for i in range(N)]

for m in range(M):
  A, B = map(int, input().split())
  n[A-1][B-1] = H[B-1]
  n[B-1][A-1] = H[A-1]
  
#print(n)

cnt = 0
for i in range(N):
  if H[i] > max(n[i]):
    cnt +=1
    
print(cnt)


Fixed submission:
# 展望台N
# 道M
N, M = map(int, input().split())

# 展望台の高さ
H = list(map(int, input().split()))

#n = [[0] * N for i in range(N)]
n = [0] * N

for m in range(M):
  A, B = map(int, input().split())
  #n[A-1][B-1] = H[B-1]
  #n[B-1][A-1] = H[A-1]
  n[A-1] = max(n[A-1], H[B-1])
  n[B-1] = max(n[B-1], H[A-1])
  
#print(n)

cnt = 0
for i in range(N):
  if H[i] > n[i]:
    cnt +=1
    
print(cnt)
##

Buggy python submission (verdict: Time Limit Exceeded):
# 展望台N
# 道M
N, M = map(int, input().split())

# 展望台の高さ
H = list(map(int, input().split()))

n = [[0] * N for i in range(N)]

for m in range(M):
  A, B = map(int, input().split())
  n[A-1][B-1] = H[B-1]
  n[B-1][A-1] = H[A-1]
  
#print(n)

cnt = 0
for i in range(N):
  if H[i] > max(n[i]):
    cnt +=1
    
print(cnt)


Fixed submission:
# 展望台N
# 道M
N, M = map(int, input().split())

# 展望台の高さ
H = list(map(int, input().split()))

#n = [[0] * N for i in range(N)]
n = [0] * N

for m in range(M):
  A, B = map(int, input().split())
  #n[A-1][B-1] = H[B-1]
  #n[B-1][A-1] = H[A-1]
  n[A-1] = max(n[A-1], H[B-1])
  n[B-1] = max(n[B-1], H[A-1])
  
#print(n)

cnt = 0
for i in range(N):
  if H[i] > n[i]:
    cnt +=1
    
print(cnt)
##
Buggy python submission (verdict: Runtime Error):
X = int(input())

for a in range(-3, 3):
  for b in range(-3, 3):
    #print(a,b)
    if a**5 - b**5 == X:
      print(a, b)
      return()

Fixed submission:
X = int(input())

for a in range(-1000, 1000):
  for b in range(-1000, 1000):
    #print(a,b)
    if a**5 - b**5 == X:
      print(a, b)
      exit()
Buggy python submission (verdict: Runtime Error):
import math
H, W = map(int, input().split())

w1 = math.ceil(W/2)*math.ceil(H/2)
w2 = math.floor(W/2)*math.floor(H/2)

if: H == 1:
    print(1)
elif W==1:
    print(1)
elif W != 1:
    print(w1+w2)

Fixed submission:
import math
H, W = map(int, input().split())

w1 = math.ceil(W/2)*math.ceil(H/2)
w2 = math.floor(W/2)*math.floor(H/2)

if H == 1:
    print(1)
elif W==1:
    print(1)
elif W != 1:
    print(w1+w2)
Buggy python submission (verdict: Time Limit Exceeded):
# N枚の投票用紙
N = int(input())

s = {}
for _ in range(N):
    tmp = input()
    try:
        if s[tmp]:
            s[tmp] +=1
    except:
        s[tmp] = 1
    
#print(s)
max_kv_list = [kv[0] for kv in s.items() if kv[1] == max(s.values())]
#print(max_kv_list)

max_kv_list.sort()
for tmp in max_kv_list:
    print(tmp)

Fixed submission:
import collections
import itertools

# N枚の投票用紙
N = int(input())

s = []
for _ in range(N):
    s.append(input())

counter = collections.Counter(s)

mode_v = counter.most_common()[0][-1]
it = itertools.takewhile(
    lambda kv: kv[-1] == mode_v, counter.most_common()
)

l_it=list(it)
l_it.sort()
for k, v in l_it:
    print(k)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input())

if N==M:
    print("Yes")
else:
    print("No")

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

if N==M:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
# N個のロボット
N = int(input())

# 1個前
rem = 0
bx = 0
bl = 0
for i in range(N):
    x,l = map(int, input().split())
    
    #print(x,l, bx,bl)
    
    # 1個前と重複確認
    if i != 0:
        rn = list(range(x+l-1, x-l, -1 ))
        before = list(range(bx+bl-1, bx-bl, -1 ))
        #print(rn)
        #print(before)
        if len(set(rn) & set(before)) != 0:
            #print("rem")
            rem +=1
            # 1個前は変えないで次へ
            continue
        else:
            # 1個前を更新
            bx = x
            bl = l
    else:
        # 1個前を更新
        bx = x
        bl = l
    

print(N-rem)

Fixed submission:
N = int(input())
robots = [tuple(map(int,input().split())) for _ in range(N)]

#print(robots)
# 最大値と最小値を計算する
robots = [(x+l,x-l) for x,l in robots]
#print(robots)
# ソートする
robots.sort()
#print(robots)

cnt = 0
last = -float('inf')
for r,l in robots:
    #print(last, l, r)
    # 1個前の最大値を、今回の最小値が上回っていたらOK
    if last <= l:
        cnt += 1
        # 次の最大値を更新する
        last = r

print(cnt)

Buggy python submission (verdict: Runtime Error):
# N個のロボット
N = int(input())

X = []
L = []
for n in range(N):
    x,l = map(int, input().split())
    X.append(x)
    L.append(l)
    
rem = 0
flg = False
for i in range(0, N-1):
    # アームの行動範囲
    if flg == True:
        flg = False
        continue
    if i !=0:
        rn = list(range(X[i]+L[i]-1, X[i]-L[i], -1 ))
        before = list(range(X[i-1]+L[i-1]-1, X[i-1]-L[i-1], -1 ))
        next = list(range(X[i+1]+L[i+1]-1, X[i+1]-L[i+1], -1 ))
        #print(rn)
        #print(before)
        #print(next)
        
        # アームの可動範囲が被る
        if len(set(rn) & set(before)) != 0 or len(set(rn) & set(next)) != 0:
            rem +=1
            flg = True
    else:
        rn = list(range(X[i]+L[i]-1, X[i]-L[i], -1 ))
        next = list(range(X[i+1]+L[i+1]-1, X[i+1]-L[i+1], -1 ))
        #print(rn)
        #print(next)
        # アームの可動範囲が被る
        if len(set(rn) & set(next)) != 0:
            rem +=1
            flg = True

print(N-rem)

Fixed submission:
N = int(input())
robots = [tuple(map(int,input().split())) for _ in range(N)]

#print(robots)
# 最大値と最小値を計算する
robots = [(x+l,x-l) for x,l in robots]
#print(robots)
# ソートする
robots.sort()
#print(robots)

cnt = 0
last = -float('inf')
for r,l in robots:
    #print(last, l, r)
    # 1個前の最大値を、今回の最小値が上回っていたらOK
    if last <= l:
        cnt += 1
        # 次の最大値を更新する
        last = r

print(cnt)
Buggy python submission (verdict: Runtime Error):
# N問出題
# M回提出
N, M = map(int, input().split())

AC = []
WC = []
ansAC
ansRC

for i in range(0, M):
    AC[i] = False
    WA[i] = 0

for m in range(0, M):
    p, s = input().split()
    # 正解
    if s == "AC" and int(p) <= N:
        AC[p] = True
        ansAC +=1
        ansWC += WA[p]
    # WAかつ未正解
    elif s == "WA" and (p not in ans):
        WA[p] +=1
    else:
        continue

print(len(set(ans)), pena)

Fixed submission:
import sys
from collections import defaultdict

n, m = map(int, input().split())
ac = 0
# 初期化
wa = defaultdict(lambda: 0)
already = set()
for line in sys.stdin:
    p, s = line.strip().split()
    p = int(p)
    # すでに正解していたらスキップ
    if p in already:
        continue
    # 初正解ならAC+1, 失敗回数を追加
    if s == 'AC':
        ac += 1
        already.add(p)
    # 失敗なら失敗回数を増やす
    else:
        wa[p] += 1

print(ac, sum(wa[i] for i in already))
Buggy python submission (verdict: Runtime Error):
import math
from functools import reduce
# 長さN
# 整数M
N, M = map(int, input().split())

# 長さNからなる偶数列: a
a = list(set(map(int, input().split())))
print(a)

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

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

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

if M//(lcm_list(a)) == 0:
    print(0)
else:
    print(M//(lcm_list(a))+1)

Fixed submission:
import fractions
n,m=map(int,input().split())
lis  = list(map(int,input().split()))
#aそれぞれを2で割ったものを持っておく
div = []
for i in range(n):
    div.append(lis[i]//2)
#lisそれぞれの要素を2で割り切れる回数をすべて数える
L = []
for i in range(n):
    cnt = 0
    while lis[i] %2 ==0:
        lis[i] //= 2
        cnt += 1
    L.append(cnt)

bl = True
#重複要素を削除して要素数でLがすべて一緒か判断
def set_list(es):
    return len(list(set(es))) == 1

if set_list(L) != 1:
    print(0)
    exit()

#div内の最小子公倍数ansを求める

ans = div[0]
for i in range(1,n):
    ans =ans*div[i]//fractions.gcd(ans,div[i])

S = m//ans
if S %2 ==0:
    print(S//2)
else:
    print(S//2 +1)
Buggy python submission (verdict: Runtime Error):
#(1,0)と(1,1)が敗戦の最終状態。そこから遷移する状態を考える。
#(2,0),(3,0)は勝利状態。
#(2,1),(2,2)はどう遷移しても上記勝利状態に遷移してしまうので、敗北状態。
#(3,1),(4,0),(4,1),(5,0)...などが上記敗北状態に遷移できる状態なので勝利状態。
#実験を重ねると|X-Y|<=1が敗戦状態ではないか、という仮説が立つ。
#少し考えると、|X-Y|<=1からの遷移は必ず|X'-Y'|>1にならざるを得なくて
#|X-Y|>1からは必ず|X'-Y'|<=1となる遷移が存在することが分かる。
#最終的には|X-Y|<=1の状態は2N手後に(1,0)と(1,1)へと収斂するので、勝利条件が確定する。

X,Y=map(int,input().split())
if abs(X-Y)<=1:
    print("Brown")
else:
    print("Alice")


Fixed submission:
s = list(input().split())


ans = "".join([s[0][0],s[1][0],s[2][0]]).upper()
print(ans)