Harryxun/stf_run huggingface dataset:
N=int(input())
XY=[[]*N]
for i in range(N):
  A=int(input())
  for _ in range(A):
    x,y = map(int, input().split())
    x-=1
    XY[i].append([x,y])


ans=0
for bit_state in range(2**N):
  flag=True
  for i in range(N):
    if (bit_state>>i)&1:
      for x, y in XY[i]:
        if (bit_state >>x)&1 != y:
          flag=False
  if flag:
    ans=max(ans, bin(bit_state).count("1"))
    
print(ans) 

### FIXED CODE ###

N=int(input())
XY=[[] for _ in range(N)]
for i in range(N):
  A=int(input())
  for _ in range(A):
    x,y = map(int, input().split())
    x-=1
    XY[i].append([x,y])

ans=0
for bit_state in range(2**N):
  flag=True
  for i in range(N):
    if (bit_state>>i)&1:
      for x, y in XY[i]:
        if (bit_state >>x)&1 != y:
          flag=False
  if flag:
    ans=max(ans, bin(bit_state).count("1"))
    
print(ans)
#??°???????????¢

n = input()

l = raw_input().split()

for i in range(n):
    l.append(i)

l.reverse()

print l

### FIXED CODE ###

#??°???????????¢

n = input()
n = int(n)

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

# ?????¢
l.reverse()

# ????§????????????§??????
for i in range(n-1):
    print(l[i], end=" ")
print(l[n-1])
def sort(A):
    if len(A) < 2:
        return A
    c = len(A)//2
    return merge(sort(A[:c]), sort(A[c:]))

def merge(X, Y):
    if len(X) < 1:
        return Y
    if len(Y) < 1:
        return X
    if (X[0] < Y[0]):
        return [Y[0]]+ merge(X, Y[1:])
    else:
        return [X[0]] + merge(X[1:], Y)

N, K = map(int, input().split())
enemyHP = list(map(int, input().split()))
enemyHP = sort(enemyHP)
if(len(enemyHP) <= K):
    print(0)
else:
    print(sum(enemyHP[K:]))



### FIXED CODE ###

# def sort(A):
#     if len(A) < 2:
#         return A
#     c = len(A)//2
#     return merge(sort(A[:c]), sort(A[c:]))

# def merge(X, Y):
#     if len(X) < 1:
#         return Y
#     if len(Y) < 1:
#         return X
#     if (X[0] < Y[0]):
#         return [Y[0]]+ merge(X, Y[1:])
    # else:
#         return [X[0]] + merge(X[1:], Y)

N, K = map(int, input().split())
enemyHP = list(map(int, input().split()))
# enemyHP = sort(enemyHP)
enemyHP.sort(reverse=True)
if(len(enemyHP) <= K):
    print(0)
else:
    print(sum(enemyHP[K:]))
# cording: utf-8
import math
num = input().split(" ")
a = int(num[0])-1
b = int(num[1])
c = int(num[2])
d = int(num[3])
e = int(c * d / int(math.gcd(c, d)))
bb = b - (b//c) -(b//d) +(b//e) 
aa = a - (a//c) -(a//d) + (a//e)
print(int(bb-aa))

### FIXED CODE ###

def gcd(a, b):
    while b!=0:
        a, b = b, a%b
    return a

num = input().split(" ")
a = int(num[0])-1
b = int(num[1])
c = int(num[2])
d = int(num[3])
e = int(c * d / int(gcd(c, d)))
bb = b - (b//c) -(b//d) +(b//e) 
aa = a - (a//c) -(a//d) + (a//e)
print(int(bb-aa))
h, n = map(int, input().split())
magics = [list(map(int, input().split())) for _ in range(n)]

dp = [0] * (h+1)

for i in range(1,h+1):
    dp[i] = min(dp[i-a]+b for a, b in magics)
print(dp[h])

### FIXED CODE ###

h, n = map(int, input().split())
magics = [list(map(int, input().split())) for _ in range(n)]
max_a = max(a for a,b in magics)
dp = [0] * (h+max_a)

for i in range(1,h+max_a):
    dp[i] = min(dp[i-a]+b for a, b in magics)
print(dp[h])
a = input()
if (a%100)<=(a/100*5):
    print(1)
else:
	print(0)

### FIXED CODE ###

a = int(input())
if a%100<=((a-(a%100))/100)*5:
    print(1)
else:
	print(0)
import numpy as np

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

ans = np.lcm(a,b)

print(ans)


### FIXED CODE ###

from fractions import gcd
a, b = map(int, input().split())

print(a*b//gcd(a,b))
from functools import lru_cache
N, K = map(int, input().split())
D = input().split()

O = []
for c in "0123456789":
    if c not in D:
        O.append(c)

# N = 523
# D = 2 3

@lru_cache()
def func(s, i, over):
    if i == len(s):
        return ""
    # d < N[0] 
    if over:
        return O[0] + func(s, i+1, over=True)
    for d in O:
        if d < s[i]:
            continue
        if s[i] == d:
            return d + func(s, i+1, over=False)
        return d + func(s, i+1, over=True)

print(func(str(N), 0, over=False))

### FIXED CODE ###

N, K = map(int, input().split())
D = [x for x in input().split()]

while True:
    S = str(N)
    if not any(d in S for d in D):
        break
    N += 1
print(N)
def cost( i,k,j ):
  return m[i][k] + m[k+1][j] + p[i][0] * p[k][1] * p[j][1]
 
n = input()
M = []
m = [[ 0 for i in range(n) ] for j in range(n) ]
for i in range(n):
  M.append( map (int, raw_input().split() ) )
 
M_long = len(M)
for l in range( 2,M_long+1 ):
  for i in range( 0,M_long-l+1 ):
    j = i+l-1
    m[i][j] = min( cost( i,k,j ) for k in range( i,j ) )
 
print m[0][M_long-1]

### FIXED CODE ###

def cost( i,k,j ):
  return m[i][k] + m[k+1][j] + M[i][0] * M[k][1] * M[j][1]
 
n = input()
M = []
m = [[ 0 for i in range(n) ] for j in range(n) ]
for i in range(n):
  M.append( map (int, raw_input().split() ) )
 
M_long = len(M)
for l in range( 2,M_long+1 ):
  for i in range( 0,M_long-l+1 ):
    j = i+l-1
    m[i][j] = min( cost( i,k,j ) for k in range( i,j ) )
 
print m[0][M_long-1]
num = input().split()
a = num[0]
b = num[1]
c = num[2]
ans = b + c - a
if ans > 0:
    print(ans)
else:
    print(0)


### FIXED CODE ###

num = input().split()
a = int(num[0])
b = int(num[1])
c = int(num[2])
ans = b + c - a
if ans > 0:
    print(ans)
else:
    print(0)
n,m=map(int,input().split())
x=int(input())
l=[int(i) for i in input().split()]
mat=[[0 for j in range(m)]for i in range(n)]
curr=1 
c=0 
j=0
for i in range(n): 
    for j in range(m):
        mat[i][j]=curr 
        c+=1 
        if c==l[j]: 
            curr+=1 
            j+=1
            c=0 
for i in range(n):
    if i&1:
        mat[i]=mat[i][::-1]
for i in range(n):
    print(*mat[i])

### FIXED CODE ###

n,m=map(int,input().split())
x=int(input())
l=[int(i) for i in input().split()]
mat=[[0 for j in range(m)]for i in range(n)]
curr=1 
c=0 
j1=0
for i in range(n): 
    for j in range(m):
        mat[i][j]=curr 
        c+=1 
        if c==l[j1]: 
            curr+=1 
            j1+=1
            c=0 
for i in range(n):
    if i&1:
        mat[i]=mat[i][::-1]
for i in range(n):
    print(*mat[i])
H, A = map(int, input().split())

print(H // A + min(H % A))


### FIXED CODE ###

H, A = map(int, input().split())

print(H // A + min(H % A, 1))
# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string
from functools import lru_cache
import heapq

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

MOD = int(1e09) + 7

def main():
    N = cin.int()
    A = cin.mapInt()
    T = [0] * N
    for i in range(N): 
        T[A[i] - 1] = i + 1
    print(*T," ")
    return

if __name__ == "__main__":
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import math
import os
import itertools
import _collections
import string
from functools import lru_cache
import heapq

class cin():
    def int():
        return int(sys.stdin.readline().rstrip())
    def string():
        return sys.stdin.readline().rstrip()
    def mapInt():
        return [int(x) for x in cin.string().split()]
    def stringList(n):
        return [input() for i in range(n)]
    def intListList(n):
        return [cin.mapInt() for i in range(n)]
    def intColsList(n):
        return [int(input()) for i in range(n)]
        
class Math():
    def gcd(a,b):
        if b == 0:
            return a
        return Math.gcd(b,a % b)
    def lcm(a,b):
        return (a * b) // Math.gcd(a,b)
    def roundUp(a,b):
        return -(-a // b)
    def toUpperMultiple(a,x):
        return Math.roundUp(a,x) * x
    def toLowerMultiple(a,x):
        return (a // x) * x
    def nearPow2(n):
        if n <= 0:
            return 0
        if n & (n - 1) == 0:
            return n
        ret = 1
        while(n > 0):
            ret <<= 1
            n >>= 1
        return ret

MOD = int(1e09) + 7

def main():
    N = cin.int()
    A = cin.mapInt()
    T = [0] * N
    for i in range(N): 
        T[A[i] - 1] = i + 1
    print(*T,sep =" ")
    return

if __name__ == "__main__":
    main()
n = int(input())
l = list(map(int,input().split()))
l.sort()
b = l[n//2+1]-[n//2+2]
print(b)

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
l.sort()
a = n//2

ans = l[a]-l[a-1]

print(ans)
N = int(input())
P = list(map(int, input().split()))

Pi = [0] * (N + 1)
for i, n in enumerate(P, 1):
    Pi[n] = i

T = [0] * N
f = [0] * N

if Pi[N] > Pi[N - 1]:
    T[N - 1] = 0
    f[N - 1] = N - 1
else:
    T[N - 1] = 1
    f[N - 1] = N

for i in range(N - 2, 0, -1):
    if T[i + 1] == 0:
        i_i = Pi[i]
        i_ii = Pi[i + 1]
        if i_ii > i_i:
            T[i] = T[i + 1]
            f[i] = f[i + 1]
        else:
            T[i] = T[i + 1] + 1
            f[i] = i + 1
    else:
        i_f = Pi[f[i + 1]]
        i_i = Pi[i]
        i_ii = Pi[i + 1]
        if i_f < i_i < i_ii or i_ii < i_f < i_i or i_i < i_ii < i_f:
            T[i] = T[i + 1]
            f[i] = f[i + 1]
        else:
            T[i] = T[i + 1] + 1
            f[i] = i + 1

print(T[1])

### FIXED CODE ###

N = int(input())
P = list(map(int, input().split()))

if N == 1:
    print(0)
    exit()

Pi = [0] * (N + 1)
for i, n in enumerate(P, 1):
    Pi[n] = i

T = [0] * N
f = [0] * N

if Pi[N] > Pi[N - 1]:
    T[N - 1] = 0
    f[N - 1] = N - 1
else:
    T[N - 1] = 1
    f[N - 1] = N

for i in range(N - 2, 0, -1):
    if T[i + 1] == 0:
        i_i = Pi[i]
        i_ii = Pi[i + 1]
        if i_ii > i_i:
            T[i] = T[i + 1]
            f[i] = f[i + 1]
        else:
            T[i] = T[i + 1] + 1
            f[i] = i + 1
    else:
        i_f = Pi[f[i + 1]]
        i_i = Pi[i]
        i_ii = Pi[i + 1]
        if i_f < i_i < i_ii or i_ii < i_f < i_i or i_i < i_ii < i_f:
            T[i] = T[i + 1]
            f[i] = f[i + 1]
        else:
            T[i] = T[i + 1] + 1
            f[i] = i + 1

print(T[1])
import sys,math,bisect
input = sys.stdin.readline

mod = 1000000007
eps = 0.00001

n = int(input())

ab = []
ang = []
for i in range(n):
    a,b = map(int,input().split())
    ab.append((a,b))
    if a == 0:
        ang.append(90.0)
    else:
        ang.append(math.degrees(math.atan(b/a)))
ang.sort()

used = [False]*n
res = 1
rest = n

i = 0
while True:
    if i >= n:
        break
    if used[i]:
        continue
    val = ang[i]
    if val > 2*eps:
        break
    cnt = bisect.bisect_right(ang,val+eps) - i
    cnt2 = bisect.bisect_right(ang,val+90+eps) - bisect.bisect_left(ang,val+90-eps)
    if cnt2 > 0:
        rest = rest - cnt - cnt2
        res = res*(pow(2,cnt,mod) + pow(2,cnt2,mod) - 1)%mod
    i += cnt

res = res*pow(2,rest,mod)%mod - 1
print(res%mod)



### FIXED CODE ###

import sys,math
input = sys.stdin.buffer.readline

mod = 1000000007
n = int(input())

ab = []
ang = dict()
rev = dict()
dg = 10**20
zero = 0

for i in range(n):
    a,b = map(int,input().split())
    if a == 0 and b == 0:
        zero += 1
    elif a == 0:
        if 1 in ang:
            ang[1] += 1
        else:
            ang[1] = 1
    elif b == 0:
        if 1 in rev:
            rev[1] += 1
        else:
            rev[1] = 1
    elif a*b > 0:
        if a < 0 and b < 0:
            a,b = -a,-b
        g = math.gcd(a,b)
        a,b = a//g,b//g

        if a*dg + b in ang:
            ang[a*dg + b] += 1
        else:
            ang[a*dg + b] = 1
    else:
        a,b = abs(a),abs(b)
        g = math.gcd(a,b)
        a,b = a//g,b//g

        if b*dg + a in rev:
            rev[b*dg + a] += 1
        else:
            rev[b*dg + a] = 1

rest = n - zero

res = 1

for e in ang:
    if e in rev:
        res = res*(pow(2,ang[e],mod) + pow(2,rev[e],mod) - 1)%mod
        rest -= ang[e] + rev[e]

res = res*pow(2,rest,mod)%mod - 1 + zero

print(res%mod)
import numpy as np
N, M = map(int, input().split())

X = []

i = 0
while i < N:
    X.append(list(map(int, input().split())))
    i += 1

X = np.asarray(X)

X_ind = np.lexsort((X[:,0], -X[:,1]), axis=0)[::-1]
X = X[X_ind]
# print(X)
least = M - 1
p = 0
while least >= 0:
    last, X = X[-1], X[:-1]
    # print(last, X)
    if (M - least) >= last[0]:
        p += last[1]
        least -= 1

print(p)


### FIXED CODE ###

from heapq import heappush,heappop
N, M = map(int, input().split())

X = []

for _ in range(N):
    a, b = map(int, input().split())
    if a <= M:
        X.append((a,b))


X = sorted(X, key=lambda x:(x[0], x[1]), reverse=True)

# print(X)
q = []
ans = 0
for i in range(1, M + 1):
    while X and X[-1][0] <= i:
        _, b = X.pop()
        heappush(q, -b)
    if q:
        ans -= heappop(q)
        
print(ans)
a=input()
for i in range(3):
  if a[i]==a[i+1]==a[i+2]:
    print('Yes')
    break
else:
  print('No')

### FIXED CODE ###

a=input()
for i in range(2):
  if a[i]==a[i+1]==a[i+2]:
    print('Yes')
    break
else:
  print('No')
n = len(input())
mp, res = {}, 0
for el in list(map(int, input().split())): mp[el] = mp.get(el, 0) + 1
for key, val in mp:
  if key > val: res += val
  elif key < val: res += val - key
print(res)

### FIXED CODE ###

n = len(input())
mp, res = {}, 0
for el in list(map(int, input().split())): mp[el] = mp.get(el, 0) + 1
for key in mp:
    val = mp[key]
    if key > val: res += val
    elif key < val: res += val - key
print(res)
a, b, c = map(int, input().split()), reverse = True
A = 100*a + 10*b + c

if A % 4 == 0:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

a, b, c = map(int, input().split())
A = 100*a + 10*b + c

if A % 4 == 0:
    print('YES')
else:
    print('NO')
T1,T2=map(int,input().split())
A1,A2=map(int,input().split())
B1,B2=map(int,input().split())


#A1>=B1にする
if A1>=B1:
    pass
else:
    A1,B1=B1,A1
    A2,B2=B2,A2

D1=(A1-B1)*T1#>=0
D2=(A2-B2)*T2#?

if D1==-D2:
    print("infinity")
elif D2>=0:
    print("0")
else:
    diff = abs(D1+D2)#マイからこれだけ差が開く
    if D1%diff==0:
        print(D1//diff*2)
    else:
        assert 1==2


### FIXED CODE ###

from math import ceil
T1,T2=map(int,input().split())
A1,A2=map(int,input().split())
B1,B2=map(int,input().split())


#A1>=B1にする
if A1>=B1:
    pass
else:
    A1,B1=B1,A1
    A2,B2=B2,A2

D1=(A1-B1)*T1#>=0
D2=(A2-B2)*T2#?

if D1==-D2:
    print("infinity")
elif D1+D2>=0:
    print("0")
else:
    diff = abs(D1+D2)#マイからこれだけ差が開く
    if D1%diff==0:
        print(D1//diff*2)
    else:
        print(ceil(D1/diff)*2-1)
if(S == ABC){
	print("ARC")
}
else if(S == ARC){
	print("ABC")
}


### FIXED CODE ###

S = input()

if(S == "ABC"):
	print("ARC")
elif(S == "ARC"):
	print("ABC")
N,M=map(int,input().split())
from collections import defaultdict
branch=defaultdict(set)
for i in range(M):
    a,b=map(int,input().split())
    branch[a]|={b}
    branch[b]|={a}
jisuu=[len(branch[i]) for i in range(N+1)]
def dfs1(check,visited,P):
    while len(check)>0:
        now=check.pop()
        for nex in branch[now]:
            if nex not in visited:
                if jisuu[nex]==1:
                    return P[now]+[nex]
                else:
                    check|={nex}
                    visited|={nex}
                    P[nex]=P[now]+[nex]
def dfs2(check,visited,P,goal):
    while len(check)>0:
        now=check.pop()
        for nex in branch[now]:
            if nex not in visited:
                if nex==goal:
                    return P[now]+[nex]
                else:
                    check|={nex}
                    visited|={nex}
                    P[nex]=P[now]+[nex]
if jisuu.count(1)>=2:
    exit()
    start=jisuu.index(1)
    visited={start}
    check={start}
    P=[0]*(N+1)
    P[start]=[start]
    path=dfs1(check,visited,P)
else:
    for i in range(1,1+N):
        if jisuu[i]==2:
            a,b=list(branch[i])
            if jisuu[a]==2:
                start=i
                goal=a
                nex=b
                break
            elif jisuu[b]==2:
                start=i
                goal=b
                nex=a
                break
    visited={start,nex}
    check={nex}
    P=[0]*(N+1)
    P[start]=[start]
    P[nex]=[start,nex]
    path=dfs2(check,visited,P,goal)
    print(1)
    exit()
print(len(path))
print(" ".join(map(str,path)))

### FIXED CODE ###

N,M=map(int,input().split())
from collections import deque,defaultdict
branch=defaultdict(set)
for i in range(M):
    a,b=map(int,input().split())
    branch[a-1]|={b-1}
    branch[b-1]|={a-1}
path=deque([0])
for x in branch[0]:
    path.append(x)
    break
used=set(path)
while True:
    A,B=False,False
    if len(branch[path[0]]-used)==0:
        A=True
    else:
        for x in branch[path[0]]:
            if x in used:
                continue
            path.appendleft(x)
            used|={x}
            break
    if len(branch[path[-1]]-used)==0:
        B=True
    else:
        for x in branch[path[-1]]:
            if x in used:
                continue
            path.append(x)
            used|={x}
            break
    if A and B:
        break
path=[p+1 for p in path]
print(len(path))
print(" ".join(map(str,path)))
import numpy as np
import sys
 
N,K=map(int, input().split())
A =np.array(list(map(int,input().split())), dtype=np.int64)
#A=sorted(A, reverse=True)
 
def factorial(p,q):
    fact = 1
    for integer in A[p:q]:
        fact *= integer
        fact = fact%(10**9+7)
    return fact
 
A=sorted(A)
 
Amin=factorial(0,K)%(10**9+7)
A=sorted(A, reverse=True)
 
Amax=factorial(0,K)%(10**9+7)
 
 
A=sorted(A, key=lambda x: abs(x), reverse=True)
 
B=A[0:K-1]
C=A[K-1:N]
 
 
Bmax=factorial(0,K-1)*C[0]%(10**9+7)
#print(factorial(0,K-1),C[0])
#print(Bmax)
 
C=sorted(C)
#print(C)
Bmin=factorial(0,K-1)*C[0]%(10**9+7)
#print(Bmin)
 
print(max(Amax,Amin,Bmax,Bmin))

### FIXED CODE ###

import math
N=int(input())
print(1000*math.ceil(N/1000)-N)
from itertools import combinations
from heapq import heappush, heappop

def dist(p1, p2): return ((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2) ** 0.5
    
xs, ys, xt, yt = map(int, input().split())
N = int(input())
P = [[(xs, ys), 0, 0], [(xt, yt), 0, 1]]
for i in range(2, N+2):
    x, y, r = map(int, input().split())
    P.append([(x, y), r, i])
E = [[float('inf')] * N for _ in range(N)]
for v in range(N): E[v][v] = 0
for [p1, r1, i], [p2, r2, j] in combinations(P, 2):
    d = max(0, dist(p1, p2) - (r1 + r2))
    E[i][j] = E[j][i] = d
dist = [float('inf')] * N # the distance of each vertex from s
prev = [-1] * N # the previous vertex of each vertex on a shortest path from s
visited = [False] * N
n_visited = 0 # #(visited vertices)
heap = []
heappush(heap, (0, -1, 0))
while heap:
    d, p, v = heappop(heap)
    if visited[v]: continue # (s,v)-shortest path is already calculated
    dist[v] = d; prev[v] = p; visited[v] = True
    n_visited += 1
    if n_visited == N: break
    for u in range(N):
        if visited[u]: continue
        temp = d + E[v][u]
        if dist[u] > temp: heappush(heap, (temp, v, u))
print(dist[1])

### FIXED CODE ###

from itertools import combinations
from heapq import heappush, heappop

class Dijkstra:
    def __init__(self, N):
        self.N = N # #vertices
        self.E = [[] for _ in range(N)]

    def add_edge(self, init, end, weight, undirected=False):
        self.E[init].append((end, weight))
        if undirected: self.E[end].append((init, weight))
    
    def distance(self, s):
        INF = float('inf')
        E, N = self.E, self.N
        self.dist = dist = [INF] * N # the distance of each vertex from s
        self.prev = prev = [-1] * N # the previous vertex of each vertex on a shortest path from s
        dist[s] = 0
        n_visited = 1 # #(visited vertices)
        heap = []
        heappush(heap, (0, s))
        while heap:
            d, v = heappop(heap)
            if dist[v] < d: continue
            for u, c in E[v]:
                temp = d + c
                if dist[u] > temp:
                    dist[u] = temp; prev[u] = v
                    heappush(heap, (temp, u))
            n_visited += 1
            if n_visited == N: break
        return dist
    
    def shortest_path(self, t):
        P = []
        prev = self.prev
        while True:
            P.append(t)
            t = prev[t]
            if t == -1: break
        return P[::-1]

def dist(p1, p2): return ((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2) ** 0.5
    
xs, ys, xt, yt = map(int, input().split())
N = int(input())
P = [[(xs, ys), 0, 0], [(xt, yt), 0, 1]]
for i in range(2, N+2):
    x, y, r = map(int, input().split())
    P.append([(x, y), r, i])
dk = Dijkstra(N+2)
for [p1, r1, i], [p2, r2, j] in combinations(P, 2):
    d = max(0, dist(p1, p2) - (r1 + r2))
    dk.add_edge(i, j, d, undirected=True)
print(dk.distance(0)[1])
xs = [for i in range[5]]
k = int(input())
if (xs[4] - xs[0] <= k):
	print("Yay!")
else:
	print(":(")


### FIXED CODE ###

xs = [int(input()) for i in range(5)]
k = int(input())
if (xs[4] - xs[0] <= k):
	print("Yay!")
else:
	print(":(")
#!/usr/bin/env python
from collections import deque, defaultdict
import bisect
from math import factorial, sqrt, log2


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

    right = c - a - b
    if right <= 0:
        print("No")
        return
    right = right ** 2
    left = 4 * a * b

    if right > left:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python
from collections import deque, defaultdict
import bisect
from math import factorial, sqrt


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

    right = c - a - b
    if right <= 0:
        print("No")
        return
    right = right ** 2
    left = 4 * a * b

    if right > left:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
import sys
import fractions
sys.setrecursionlimit(10**9)

n,m=map(int,input().split())
alist=list(map(int,input().split()))
alist=list(set(alist))

n=len(alist)

def sks(n):
	global alist
	if n == 1:
		return alist[0]
	else:
		tmp=sks(n-1)
		return int(tmp*alist[n-1]/fractions.gcd(tmp,alist[n-1]))

sk = sks(n)
gomi=sk/2

for a in alist:
	if (gomi-a/2)%a != 0:
		print(0)
		sys.exit()

print(int((m+gomi)//sk))



### FIXED CODE ###

import sys
import fractions
sys.setrecursionlimit(10**9)

n,m=map(int,input().split())
alist=list(map(int,input().split()))
alist=list(set(alist))

n=len(alist)


def sks(n):
	global alist
	if n == 1:
		return alist[0]
	else:
		tmp=sks(n-1)
		return tmp*alist[n-1]//fractions.gcd(tmp,alist[n-1])

sk = sks(n)
gomi=sk//2

for a in alist:
	if (gomi-a//2)%a != 0:
		print(0)
		sys.exit()

print(int((m+gomi)//sk))
a, b, c = [int(elem) for elem in input().split()]

if a == b and a != c:
  return "Yes"
if a == c and a != b:
  return "Yes"
if b == c and a != b:
  return "Yes"
else:
  return "No"

### FIXED CODE ###

a, b, c = [int(elem) for elem in input().split()]

if a == b and a != c:
  print("Yes")
elif a == c and a != b:
  print("Yes")
elif b == c and a != b:
  print("Yes")
else:
  print("No")
abc = list(map(int, input().split(" ")))

only_num = get_only(abc, key=lambda x: x%2)
if only_num:
	abc.remove(only_num)
	abc = [only_num] + [abc_i+1 for abc_i in abc]
max_num = max(abc)
abc.remove(max_num)

print((max_num-abc[0] + max_num-abc[1])//2+bool(only_num))

### FIXED CODE ###

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

count = 0
while True:
	abc.sort()

	if abc[0] == abc[1] == abc[2]:
		break
	elif abc[0] == abc[1]:
		abc[0] += 1
		abc[1] += 1	
		count += 1
	else:
		abc[0] += 2
		count += 1

print(count)