Harryxun/stf_run huggingface dataset:
import math

def overlap(p1, p2, d):
    return (p1[0] - p2[0])**2 + (p1[1] - p2[1])**2 <= d

def intersection(o1,o2):
    a  = 2*(o2[0] - o1[0])
    b  = 2*(o2[1] - o1[1])
    c  = (o1[0] - o2[0])*(o1[0] + o2[0]) + (o1[1] - o2[1])*(o1[1] + o2[1])
    a2 = a**2 + b**2
    b2 = a*c + a*b*o1[1] - b**2*o1[0]
    c2 = b**2*(o1[0]**2 + o1[1]**2 - 1) + c**2 + 2*b*c*o1[1]
    x1 = (-b2 + math.sqrt(b2**2 - a2*c2))/a2
    x2 = (-b2 - math.sqrt(b2**2 - a2*c2))/a2
    if b == 0:
        y1 = (o1[1] + o2[1])/2
        y2 = (o1[1] + o2[1])/2
    else:
        y1 = -(a*x1 + c)/b
        y2 = -(a*x2 + c)/b
    if b2**2 - a2*c2 < 10e-6:
        return [x1, y1], [None, None]
    else:
        return [x1, y1], [x2, y2]

while True:
    n = int(input())
    if n == 0:
        break
    p = []
    for i in range(n):
        p.append(list(map(float, input().split(","))))
    ans = 0
    for i in range(n - 1):
        for j in range(i + 1, n):
            if not overlap(p[i], p[j], 4):
                continue
            elif overlap(p[i], p[j], 10e-6):
                continue
            p1, p2 = intersection(p[i], p[j])
            print(p1,p2)
            cnt1 = 0
            cnt2 = 0
            for k in range(n):
                if overlap(p1, p[k], 1):
                    cnt1 += 1
                if p2[0] != None and overlap(p2, p[k], 1):
                    cnt2 += 1
            print(ans, cnt1, cnt2)
            ans = max([ans, cnt1, cnt2])
    print(ans)



### FIXED CODE ###

import math

def dist(p1, p2):
    return math.sqrt((p1[0] - p2[0])**2 + (p1[1] - p2[1])**2)

def intersection(o1,o2):
    if dist(o1,o2) > 2:
        p1, p2 =  [None, None], [None, None]
    elif dist(o1,o2) == 2:
        p1, p2 =  [(o1[0] + o2[0])/2, (o1[1] + o2[1])/2], [None, None]
    else:
        m = [(o1[0] + o2[0])/2, (o1[1] + o2[1])/2]
        v = [m[0] - o1[0], m[1] - o1[1]]
        v_abs = dist(v,[0,0])
        w = [v[1], -v[0]]
        w_abs = dist(w,[0,0])
        n = [w[0]/w_abs, w[1]/w_abs]
        l = math.sqrt(1 - v_abs**2)
        p1 = [m[0] + l*n[0], m[1] + l*n[1]]
        p2 = [m[0] - l*n[0], m[1] - l*n[1]]
    return p1, p2
err = 1.0e-6
while True:
    n = int(input())
    if n == 0:
        break
    p = []
    for i in range(n):
        p.append(list(map(float, input().split(","))))
    ans = 1
    for i in range(n - 1):
        for j in range(i + 1, n):
            p1, p2 = intersection(p[i], p[j])
            cnt1 = 0
            cnt2 = 0
            for k in range(n):
                if p1[0] and dist(p1, p[k]) <= 1 + err:
                    cnt1 += 1
                if p2[0] and dist(p2, p[k]) <= 1 + err:
                    cnt2 += 1
            ans = max([ans, cnt1, cnt2])
    print(ans)
while True :
    a,b=input().split()
    h =int(a)
    w=int(b)
    if a==0 and b==0:
        break
    for i in range(h):
        if i %2==0:
            print(".#"*(w/2))
        elif w ==1 :
            print(#.")
        else:
            print("#."*(w-1)/2))
    primt(" ")

### FIXED CODE ###

while True:
    a,b=input().split()
    h = int(a)
    w=int(b)
    if h==0 and w==0:
        break
    odd = "#."*300
    even= ".#"*300
    for i in range(h):
        if (i%2)==0:
            print(odd[:w])
        else:
            print(even[:w])
    print("")
, y = map(int, input().split())
 
a = [0, 300000, 200000, 100000, 0]
ans = 0
 
x = min(x, 4)
y = min(y, 4)
 
ans = a[x] + a[y]
if x == 1 and y == 1:
    ans += 400000
 
print(ans)

### FIXED CODE ###

x, y = map(int, input().split())
 
a = [0, 300000, 200000, 100000, 0]
ans = 0
 
x = min(x, 4)
y = min(y, 4)
 
ans = a[x] + a[y]
if x == 1 and y == 1:
    ans += 400000
 
print(ans)
N=int(input())
A= list(map(int,input().split()))
s=0

for i in A:
    S+=1/i

print(1/S)


### FIXED CODE ###

N=int(input())
A= list(map(int,input().split()))
S=0

for i in A:
    S+=1/i

print(1/S)
list=[int(i) for i in input().split()]

if list[0]>list[1]:
    a=list[0]
    b=list[1]
else:
    b=list[0]
    a=list[1]    


if a%b==0:
    print (b)
else:
    while b>0:
        c=a%b
        a=b
        b=c

    print(b)



### FIXED CODE ###

list=[int(i) for i in input().split()]

if list[0]>list[1]:
    a=list[0]
    b=list[1]
else:
    b=list[0]
    a=list[1]    


if a%b==0:
    print(b)
else:
    while b>0:
        c=a%b
        a=b
        b=c
    print(a)
j = 1
a = 0
i = 0
N = 0

N = int(input())

#N=int(input())
mylist = [0]*N

h = [int(x) for x in input().split()]

for i in range(N):
    mylist[h[i]-1]=i+1
print(*mylist)

### FIXED CODE ###

X = int(input())
a = 0
i =1
for i in range(X):
    if i%2==0:
        a = a+1
print(a/X)
N, M = map(int, input().split())
ans = ['-1'] * N

for i in range(M):
    s, c = map(int, input().split())
    if ans[s-1] == str(c):
        continue
    elif ans[s-1] == '-1':
        ans[s-1] = str(c)
    else:
        ans = -1
        print(ans)
        exit()

for i in range(N):
    if ans[i] == '-1':
        ans[i] = str(0)

if N == 3 and ans[0] == '0' or ans[1] == '0':
    ans = -1
    print(ans)
    exit()
elif N == 2 and ans[0] == '0':
    ans = -1
    print(ans)
    exit()
else:
    print(''.join(ans))

### FIXED CODE ###

N, M = map(int, input().split())
ans = ['-1'] * N

if N == 1 and M == 0:
    ans = 0
    print(ans)
    exit()

for i in range(M):
    s, c = map(int, input().split())
    if ans[s-1] == str(c):
        continue
    elif ans[s-1] == '-1':
        ans[s-1] = str(c)
    else:
        ans = -1
        print(ans)
        exit()

if N >= 2 and ans[0] == '0':
    ans = -1
    print(ans)
    exit()
elif ans[0] == '-1':
    ans[0] = '1'

ans = ''.join(ans).replace('-1', '0')

print(ans)
A,N = map(int,input().split())
if N%500 < A:
        print("YES")
else:
        print("NO")

### FIXED CODE ###

N = int(input())
A = int(input())

if N % 500 <= A:
        print("Yes")
else:
        print("No")
n = int(input())
s = input()
print(s.count("ABC"))

### FIXED CODE ###

a, b = input().split()
a = int(a)
b = int(b)
if a*500 >= b:
  print("Yes")
else:
  print("No")
import fractions


def main():
    X_S = S_ni_naru([0]*L, S, L, N)
    X_T = T_ni_naru([0]*L, T, L, M)

    for s, t in zip(X_S, X_T):
        if (s != t) and (s != 0) and (t != 0):
            print(-1)
            exit()

    print(L)


def S_ni_naru(X_S, S, L, N):
    for i in range(N):
        idx = L//N*i
        X_S[idx] = S[i]
    return X_S


def T_ni_naru(X_T, T, L, M):
    for i in range(M):
        idx = L//M*i
        X_T[idx] = T[i]
    return X_T


if __name__ == "__main__":
    N, M = map(int, input().split())
    S = input()
    T = input()
    L = N*M//fractions.gcd(N, M)
    main()


### FIXED CODE ###

import sys
import fractions
N, M = map(int, input().split())
S = input()
T = input()

g = fractions.gcd(N, M)
L = N * M // g

ss = L // N
ts = L // M
for i in range(N):
  if (i * ss) % ts == 0:
    j = (i * ss) // ts
    if S[i] != T[j]:
      print(-1)
      sys.exit()

for i in range(M):
  if (i * ts) % ss == 0:
    j = (i * ts) // ss
    if T[i] != S[j]:
      print(-1)
      sys.exit()

print(L)
import math

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

ans = a[0]
for i in range(n-1):
    ans = math.gcd(ans, a[i+1])
print(ans)


### FIXED CODE ###

import fractions

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

ans = a[0]
for i in range(n-1):
    ans = fractions.gcd(ans, a[i+1])
print(ans)
import math

time_list = list()

for _ in range(5):
    time_list.append(int(input()))


def key_func(x):
    if x < 100:  # 2桁 or 1桁の場合
        if x % 10 == 0:
            return 10
        return x % 10  # ex: 19の場合は9を返す
    else:
        if x % 100 == 0:
            return 10
        return x % 100  # ex: 123の場合は3を返す


time_list.sort(key=key_func, reverse=True)

# print(time_list)

ans = sum
for i, time in enumerate(time_list):
    if i < len(time_list) - 1:
        ans += math.ceil(time / 10) * 10
    else:
        ans += time

print(ans)


### FIXED CODE ###

import math

time_list = list()

for _ in range(5):
    time_list.append(int(input()))

# 全探索
ans = 1e6
for i in range(len(time_list)):
    tmp = 0
    for j in range(len(time_list)):
        if i == j:
            tmp += time_list[i]
            continue
        tmp += math.ceil(time_list[j] / 10) * 10
    ans = min(tmp, ans)

print(ans)
x = int(input())
y = int(input())

result = x + y/2
print(int(result))

### FIXED CODE ###

x, y = map(int, input().split())
print(int(x + y / 2))
N,M = map(int(input().split()))
A = list(map(int(input().split())))
sumA = sum(A)
if N-sumA < 0:
  print(-1)
else:
  print(N-sumA)

### FIXED CODE ###

N,M = map(int,input().split())
A = list(map(int,input().split()))
sumA = sum(A)
if N-sumA < 0:
  print(-1)
else:
  print(N-sumA)
n=int(input())
a=list(map(int, input().split()))
print(max(a)-min(a))

### FIXED CODE ###

a=int(input())
if (a%2)==0: print(a)
else: print(a*2)
import numpy as np
import math
import bisect

N, D, A = map(int, input().split())
xh = np.array(sorted([list(map(int, input().split())) for _ in range(N)]), dtype=int32)
b = 0
for _ in range(N):
  if len(xh)==0:
    break
  x, h = xh[0]
  r = min(x+2*D, xh[-1, 0])
  times = h//A if h%A==0 else h//A+1
  xh[:bisect.bisect_right(xh[:, 0], r)] -= times*A
  xh = xh[xh[:, 1]>0]
  b += times
print(b)

### FIXED CODE ###

from bisect import bisect_right

N, D, A = map(int, input().split())
xh = sorted([list(map(int, input().split())) for _ in range(N)])
ds = [0]*(N+2)
b = 0
for i, (x, h) in enumerate(xh, 1):
  ds[i] += ds[i-1]
  d = ds[i]
  if d>=h:
    continue
  h -= d
  times = h//A if h%A==0 else h//A+1
  ds[i] += times*A
  ds[bisect_right(xh, [x+2*D, float('inf')])+1] -= times*A
  b += times
print(b)
n = int(input())
power = [1]

if n == 1:
    print(1)
    exit()

for i in range(2, n+1):
    power.append((i * power[-1]) % (10 ** 9 + 7))

print(power[-1])


### FIXED CODE ###

s, c = list(map(int, input().split(" ")))

count = 0

if c >= 2 * s:
    print(s + ((c - s * 2) // 4))

else:
    count = (c - 1) // 2 if c % 2 == 1 else c // 2
    print(count)
S = input()
K = int(input())

if S[0] == '1':
  print(S[1])
else:
  print(S[0])

### FIXED CODE ###

S = input()
K = int(input())
not_one = '1'
count = 0
for s in S:
  if s != '1':
    not_one = s
    break
  count += 1

if K <= count:
  print('1')
else:
  print(not_one)
def main():
    H, W = map(int, raw_input().split())
    G = [list(raw_input()) for i in range(H)]


    up = [[0] * W for i in range(H)]  # あるマスから上に連続していくつ障害物のないマスが続くか
    right = [[0] * W for i in range(H)]  # あるマスから右に連続していくつ障害物のないマスが続くか
    down = [[0] * W for i in range(H)]  # あるマスから下に連続していくつ障害物のないマスが続くか
    left = [[0] * W for i in range(H)]  # あるマスから左に連続していくつ障害物のないマスが続くか


    # up
    for w in range(W):
        for h in range(1, H):
            if G[h - 1][w] == '#':
                continue
            up[h][w] = up[h - 1][w] + 1

    # right
    for h in range(H):
        for w in reversed(range(W - 1)):
            if G[h][w + 1] == '#':
                continue
            right[h][w] = right[h][w + 1] + 1

    # down
    for w in range(W):
        for h in reversed(range(H - 1)):
            if G[h + 1][w] == '#':
                continue
            down[h][w] = down[h + 1][w] + 1

    # left
    for h in range(H):
        for w in range(1, W):
            if G[h][w - 1] == '#':
                continue
            left[h][w] = left[h][w - 1] + 1


    ans = 0
    for h in range(H):
        for w in range(W):
            if G[h][w] == '#':
                continue
            ans = max(ans, up[h][w] + right[h][w] + down[h][w] + left[h][w] + 1)

    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

H, W = map(int, input().split())
G = [list(input()) for i in range(H)]

# あるマスから（右・下・左・上）にいくつ障害物ないマスが続くか
right_space = [[-1] * (W + 2) for i in range(H + 2)]
down_space = [[-1] * (W + 2) for i in range(H + 2)]
left_space = [[-1] * (W + 2) for i in range(H + 2)]
up_space = [[-1] * (W + 2) for i in range(H + 2)]

# 左上から更新（上・左に対応）
for h in range(1, H + 1):
    for w in range(1, W + 1):
        if G[h - 1][w - 1] == '.':
            up_space[h][w] = up_space[h - 1][w] + 1
            left_space[h][w] = left_space[h][w - 1] + 1

# 右下から更新（下・右に対応）
for h in reversed(range(1, H + 1)):
    for w in reversed(range(1, W + 1)):
        if G[h - 1][w - 1] == '.':
            down_space[h][w] = down_space[h + 1][w] + 1
            right_space[h][w] = right_space[h][w + 1] + 1

ans = 0
for h in range(1, H + 1):
    for w in range(1, W + 1):
        if G[h - 1][w - 1] == '.':
            tmp_ans = right_space[h][w] + down_space[h][w] + left_space[h][w] + up_space[h][w] + 1
            ans = max(ans, tmp_ans)

print(ans)
l=int(input())
ans((l/3.0)**3)

### FIXED CODE ###

l=int(input())
print((l/3.0)**3)
print('Yes' if all(input().count(c) > 0 for c in 'AB') else 'No')

### FIXED CODE ###

s = input()
print('No' if (s == 'AAA' or s == 'BBB') else 'Yes')
N = input()
ans = 0
for i in range(1, N + 1):
    if len(str(i)) % 2 is 1:
      ans += 1
      
print(ans)

### FIXED CODE ###

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

D = C - (A-B)
if D < 0:
  print(0)
else:
  print(D)
n=int(input())
a=list(map(int,input().split()))
b=a.sort()
x=b[n//2-1]
y=b[n//2]
for i in a:
    if a<=x:
      print(y)
    else:
      print(x)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=sorted(a)
x=b[n//2-1]
y=b[n//2]
for i in a:
    if i<=x:
      print(y)
    else:
      print(x)
h,w=map(int,input().split())
n=int(input())
l=list(map(int,input().split()))
l1=[]
l2=[]
ans=[[0]*w for _ in range(h)]
for i in range(n):
    for j in range(i+1):
        l1.append(i+1)
flag=1
for i in range(h):
    for j in range(w):
        if flag==1:
            l2.append([i,j])
        else:
            l2.append([i,w-j-1])
    flag*=(-1)

for i in range(h*w):
        ans[l2[i][0]][l2[i][1]]=l1[i]
for i in ans:
    print(*i)


### FIXED CODE ###

h,w=map(int,input().split())
n=int(input())
l=list(map(int,input().split()))
l1=[]
l2=[]
ans=[[0]*w for _ in range(h)]
for i in range(n):
    for j in range(l[i]):
        l1.append(i+1)

flag=1
for i in range(h):
    for j in range(w):
        if flag==1:
            l2.append([i,j])
        else:
            l2.append([i,w-j-1])
    flag*=(-1)
for i in range(h*w):
        ans[l2[i][0]][l2[i][1]]=l1[i]
for i in ans:
    print(*i)
A,B= list(input().split())
a = int(B[0])
b = int(B[2])
c = int(B[3])
e = int(A[-2])
f = int(A[-1])
d = (int(A)- 10*e - f)/100
error = 10 * (c * e + b * f) + c * f
error = int(error/100)
ans = int(A) * a + 10 * d * b + e * b + c * d + error
print(ans)

### FIXED CODE ###

A,B= list(input().split())
a = int(B[0])
b = int(B[2])
c = int(B[3])
if int(A) > 1000:
   e = int(A[-2])
   f = int(A[-1])
   d = int((int(A)- 10 * e - f)/100)
   error = 10 * (c * e + b * f) + c * f
   error = int(error/100)
   ans = int(A) * a + 10 * d * b + e * b + c * d + error
   print(int(ans))
else:
   print(int(int(A)*float(B)))
N,M = map(int,input().split())
pS = [[0,0] for i in range(M)]
for i in range(M):
  pS[i]= list(map(str,input().split()))
p = [0]*M
S = [0]*M
for i in range(M):
  p[i] = pS[i][0]
  S[i] = pS[i][1]
NM = N*M
AC = [0]*NM
WA = [0]*NM
i = 0
while i < M:
  if S[i] == 'WA':
    if AC[int(p[i])] == 0:
      WA[int(p[i])] = WA[int(p[i])]+1
    i = i+1
  elif S[i] == 'AC':
    AC[int(p[i])]=1
    i = i+1
  else:
    i = i+1
print(sum(AC),sum(WA))

### FIXED CODE ###

N,M = map(int,input().split())
p = ['0']*M
S = ['0']*M
for i in range(M):
  p[i],S[i]= map(str,input().split())
AC = [0]*(N+1)
WA = [0]*(N+1)
i = 0
for i in range(M):
  if S[i] == 'WA':
    if AC[int(p[i])] == 0:
      WA[int(p[i])] = WA[int(p[i])]+1
    else:
      None
  else:
    AC[int(p[i])]=1
count = 0
for i in range(N+1):
  if AC[i]==0:
    count = count+WA[i]
print(sum(AC),sum(WA)-count)
from sys import stdin
input = stdin.readline

N, A = [int(x) for x in input().rstrip().split()]
x = [int(x) for x in input().rstrip().split()]

X = max(max(x), A)
# dp = [[[0]*(N*X+1) for _ in range(N+1)] for _ in range(N+1)]
# for j in range(N+1):
# 	for k in range(N+1):
# 		for s in range(N*X+1):
# 			if j == 0 and k == 0 and s == 0:
# 				dp[j][k][s] = 1
# 			elif j >= 1 and s < x[j-1]: # 探索先が総和より大きい
# 				dp[j][k][s] = dp[j-1][k][s]
# 			elif j >= 1 and k >= 1 and s >= x[j-1]:
# 				dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-x[j-1]]
# 			else:
# 				dp[j][k][s] = 0
# sum = 0
# for i in range(1, N+1):
# 	sum += dp[N][i][i*A]
# print(sum)

dp = [[0]*(2*N*X+1) for _ in range(N+1)]
y = [0] * len(x)
for i in range(len(x)):
	y[i] = x[i]-A

for j in range(N+1):
	for t in range(2*N*X+1):
		if j == 0 and t == N*X:
			dp[j][t] = 1
		elif j >= 1 and (t-y[j-1] < 0 or t-y[j-1] > 2*N*X):
			dp[j][t] = dp[j-1][t]
		elif dp[j-1][t] + dp[j-1][t-y[j-1]]:
			dp[j][t] = dp[j-1][t] + dp[j-1][t-y[j-1]]
		else:
			dp[j][t] = 0
print(dp[N][N*X]-1)


### FIXED CODE ###

from sys import stdin
input = stdin.readline

N, A = [int(x) for x in input().rstrip().split()]
x = [int(x) for x in input().rstrip().split()]

X = max(max(x), A)
# dp = [[[0]*(N*X+1) for _ in range(N+1)] for _ in range(N+1)]
# for j in range(N+1):
# 	for k in range(N+1):
# 		for s in range(N*X+1):
# 			if j == 0 and k == 0 and s == 0:
# 				dp[j][k][s] = 1
# 			elif j >= 1 and s < x[j-1]: # 探索先が総和より大きい
# 				dp[j][k][s] = dp[j-1][k][s]
# 			elif j >= 1 and k >= 1 and s >= x[j-1]:
# 				dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-x[j-1]]
# 			else:
# 				dp[j][k][s] = 0
# sum = 0
# for i in range(1, N+1):
# 	sum += dp[N][i][i*A]
# print(sum)

dp = [[0]*(2*N*X+1) for _ in range(N+1)]
y = [0] * len(x)
for i in range(len(x)):
	y[i] = x[i]-A

for j in range(N+1):
	for t in range(2*N*X+1):
		if j == 0 and t == N*X:
			dp[j][t] = 1
		elif j >= 1 and (t-y[j-1] < 0 or t-y[j-1] > 2*N*X):
			dp[j][t] = dp[j-1][t]
		elif j >= 1 and 0 <= t-y[j-1] <= 2*N*X:
			dp[j][t] = dp[j-1][t] + dp[j-1][t-y[j-1]]
		else:
			dp[j][t] = 0
print(dp[N][N*X]-1)
S = input()
N = len(S)
for _ in range(N//2):
    S = S.replace('01','').replace('10','')S.replace('01','').replace('10','')S.replace('01','').replace('10','')S.replace('01','').replace('10','')S.replace('01','').replace('10','')
    if S.count('01') == 0 and S.count('10') == 0:
        break
print(N - len(S))


### FIXED CODE ###

S = input()
r = S.count('0')
b = S.count('1')
print(min(r,b)*2)
from collections import defaultdict
from collections import deque
from sys import stdin
input = stdin.readline


def main():
  # input
  N, Q = list(map(int, input().split()))

  G = [[] for _ in range(N+1)]
  for _ in range(N-1):
    a, b = map(int, input().split())
    G[a].append(b)
    G[b].append(a)

  PX = defaultdict(int)
  for _ in range(Q):
    p, x = map(int, input().split())
    PX[p] += x

  # solve
  ans = [0]*(N+1)
  visited = set()
  # temp = PX[1]
  # S = [1] # Stack
  # S = deque([1])

  # while len(S):
  #   now = S[-1]
  #   visited.add(now)

  #   for next_ in G[now]:
  #     if next_ not in visited:
  #       S.append(next_)
  #       temp += PX[next_]
  #       break
  #   else:
  #     S.pop()
  #     ans[now] = temp
  #     temp -= PX[now]

  def dfs(now, sum_):
    visited.add(now)
    for next_ in G[now]:
      if next_ not in visited:
        sum_ += PX[next_]
        sum_ = dfs(next_, sum_)

    ans[now] = sum_
    sum_ -= PX[now]
    return sum_

  dfs(1, PX[1])

  print(*ans[1:], sep=' ')


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


### FIXED CODE ###

import sys
from collections import defaultdict
from collections import deque
from sys import stdin
sys.setrecursionlimit(10**7)
input = stdin.readline


def main():
  # input
  N, Q = list(map(int, input().split()))

  G = [[] for _ in range(N+1)]
  for _ in range(N-1):
    a, b = map(int, input().split())
    G[a].append(b)
    G[b].append(a)

  PX = defaultdict(int)
  for _ in range(Q):
    p, x = map(int, input().split())
    PX[p] += x

  # solve
  ans = [0]*(N+1)
  visited = set()
  # temp = PX[1]
  # S = [1] # Stack
  # S = deque([1])

  # while len(S):
  #   now = S[-1]
  #   visited.add(now)

  #   for next_ in G[now]:
  #     if next_ not in visited:
  #       S.append(next_)
  #       temp += PX[next_]
  #       break
  #   else:
  #     S.pop()
  #     ans[now] = temp
  #     temp -= PX[now]

  def dfs(now, sum_):
    visited.add(now)
    for next_ in G[now]:
      if next_ not in visited:
        sum_ += PX[next_]
        sum_ = dfs(next_, sum_)

    ans[now] = sum_
    sum_ -= PX[now]
    return sum_

  dfs(1, PX[1])

  print(*ans[1:], sep=' ')


if(__name__ == '__main__'):
  main()
a, b = [int(i) for i in input().split()]

d = a // b
r = a % b
f = a / b

print("{0} {1} {2:.5f}".format(d, r, f)

### FIXED CODE ###

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

d = a // b
r = a % b
f = a / b

print("{0} {1} {2:.5f}".format(d, r, f))
n, m = map(int, input().split())
l = [False] * n
ans = [0, 0]
for i in range(n):
  p, r = map(input().split())
  if l[int(p) - 1] == False:
    if r == "WA":
      c[0] += 1
    elif r == "AC":
      l[int(p) - 1] = True
      c[1] += 1
print(c[1], c[0])

### FIXED CODE ###

n, m = map(int, input().split())
l = [False] * n
c = [0] * n
ans = [0, 0]
for i in range(m):
  p, r = map(str, input().split())
  if l[int(p) - 1] == False:
    if r == "WA":
      c[int(p) - 1] += 1
    elif r == "AC":
      l[int(p) - 1] = True
      ans[0] += c[int(p) - 1]
      ans[1] += 1
print(ans[1], ans[0])
A = int(input())
B = int(input())
C = int(input())
X = int(input())
print([0 <= X - 500*a - 100*b and X - 500*a - 100*b %
       50 == 0 and X - 500*a - 100*b // 50 <= C for a in A for b in B].count(True))


### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())
print([0 <= X - 500*a - 100*b and (X - 500*a - 100*b) %
       50 == 0 and (X - 500*a - 100*b) // 50 <= C for a in range(A+1) for b in range(B+1)].count(True))
rint("YES" if (input() in (3,5,7)) else "NO")

### FIXED CODE ###

print("YES" if (int(input()) in (3,5,7)) else "NO")
a = [list(map(int, input().split())) for i in range(3)]
aa = list(zip(*a))
n = int(input())
b = [int(input()) for _ in range(n)]
if a[0] in b or a[1] in b or a[2] in b or aa[0] in b or aa[1] in b or aa[2] in b or (a[0][0] in b and a[1][1] in b and a[2][2] in b) or (a[0][2] in b and a[1][1] in b and a[2][0] in b):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n,m = map(int,input().split())
digit = [0]*(m)
value = [0]*(m)
for i in range(m):
    digit[i],value[i] = map(int,input().split())

#全探索
ans = 0
for i in range(10**3):
    s = str(i)
    if len(s)!=n: continue
    for j in range(m): 
        if int(s[digit[j]-1]) != value[j]:
            break
    else:
        print(i)
        exit()
print('-1')
import math
a, b, k = map(int, input().split())
c = math.gcd(a,b)
count = 0
for i in range(1,c+1):
    if c%i == 0:
        count += 1
    if count == k:
        ans = i
        break
print(ans)


### FIXED CODE ###

a, b, k = map(int, input().split())
count = 0
ans = min(a,b)
while count != k:
    if a%ans == b %ans == 0:
        count += 1
    ans -= 1
print(ans+1)
# coding:utf-8
k, n = map(int, input().split())
a = list(map(int, input().split()))
a += k
for i in range(n+1):
  l = max(l, a[i+1]-a[i])

print(k-l)

### FIXED CODE ###

# coding:utf-8
k, n = map(int, input().split())
a = list(map(int, input().split()))
distance = []
for i in range(len(a)):
  if i == len(a) - 1:
    distance.append(k+a[0] - a[i])
  else:
  	distance.append(a[i+1] - a[i])
distance.sort()
print(sum(distance[:-1]))
n = int(input())
a = list(map(int, input().split()))

b = sorted(a)

stack = []
stack.push(b[0])
for i in range(1,n):
    flag = 0
    for e in stack:
        if b[i] % e == 0:
            flag = 1
            break
    if flag == 0:
        stack.push(e)

print(len(stack))


### FIXED CODE ###

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


maxA = max(a)
dp = [0]*(maxA+1)
count = 0

for e in a:
    for i in range(e,maxA+1,e):
        dp[i] += 1

for e in a:
    if dp[e] == 1:
        count += 1

print(count)