Harryxun/stf_run huggingface dataset:
import math
from scipy import optimize


def resolve():
    a,b,x=map(int,input().split())
    xx=x/a
    
    if x==b*a**2:
        print(0)
    elif xx<a*b/2:
        ans = 90-optimize.fsolve(f1,math.pi/4,args=(b,xx),epsfcn=10**-18)
        print(math.degrees(ans[0]))
        
    elif xx==a*b/2:
        print(45)
    else:
        ts=a**2/(a*b-xx)/2
        print(90-math.degrees(math.atan(ts)))
        
if __name__ == "__main__":
    resolve()

### FIXED CODE ###

import math

def resolve():
    a,b,x=map(int,input().split())
    xx=x/a
    
    if x==b*a**2:
        print(0)
    elif xx<a*b/2:
        ts=b**2/(xx)/2
        print(math.degrees(math.atan(ts)))
        
    elif xx==a*b/2:
        print(45)
    else:
        ts=a**2/(a*b-xx)/2
        print(90-math.degrees(math.atan(ts)))
if __name__ == "__main__":
    resolve()
n,a,b = map(int(input().split()))
s = 0
for i in range(n):
    x = sum(list(map(int,str(i).split())))
    if a <= x and x <= b:
        s += x
print(s)


### FIXED CODE ###

n,a,b = map(int,input().split())
s = 0
for i in range(n):
    x = sum(list(map(int,str(i+1))))
    if a <= x and x <= b:
        s += i+1
print(s)
n = int(input())
info = [[int(i) for i in input().split()] for j in range(n)]
for x in range(101):
    for y in range(101):
        for i in range(n):
            if i == 0:
                cx = x
                cy = y
                h = info[i][2] + abs(cx - info[i][0]) + abs(cy - info[i][1])
            elif 0 < i < n-1:
                if h != info[i][2] + abs(cx - info[i][0]) + abs(cy - info[i][1]):
                    break
            elif i == n-1:
                if h == info[i][2] + abs(cx - info[i][0]) + abs(cy - info[i][1]):
                    kakutei_cx = cx
                    kakutei_cy = cy
                    kakutei_h = h
print(kakutei_cx, kakutei_cy, kakutei_h)


### FIXED CODE ###

n = int(input())
info = [[int(i) for i in input().split()] for j in range(n)]
info.sort(key=lambda x:x[2])
if n == 1:
    print(info[0][0], info[0][1], info[0][2])
else:
    for i in range(n):
        if info[i][2] > 0:
            r = i
    for x in range(101):
        for y in range(101):
            h = info[r][2] + abs(x - info[r][0]) + abs(y - info[r][1])
            for i in range(n):
                if i < n-1 :
                    if info[i][2] == 0:
                        if h > abs(x - info[i][0]) + abs(y - info[i][1]):
                            break
                    else:
                        if h != info[i][2] + abs(x - info[i][0]) + abs(y - info[i][1]):
                            break
                elif i == n-1:
                    if h == info[i][2] + abs(x - info[i][0]) + abs(y - info[i][1]):
                        cx = x
                        cy = y
                        ch = h
    print(cx, cy, ch)
#! /usr/bin/python3

N = [int(input()) for N in range(10000)]

if N % 1000 == 0:
   print(0)
else:
  #N=5300として考えてみる
  ##5300払ったとして5
  sen = N/1000
  print(sen)
  ##5*1000=5000円
  sen2 = sen*1000
  ##N(5300)-sen2(5000)
  atai = N-sen2
  #お釣りが300円と出るはずでは？
  print(atai)

### FIXED CODE ###

#! /usr/bin/python3

N = int(input())
1 <= N <= 10000

if N % 1000 == 0:
 print(0)
else:
  sen = N//1000
  sen2 = sen*1000
  atai = N-sen2
  atai2 = 1000-atai
  print(atai2)
# https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け


x, y = map(int, input().split())
if x > 0:
    if x < y:
        print(y - x)
    elif 0 <= y:  # ここがちがうまじ？
        print(x + y + 1)
    else:
        print(min(1 + x + y, -y - x + 1, key=lambda z: 10**10 if z < 1 else z))
else:  # xが負
    if y < x:
        print(2 + x - y)
    elif y <= 0:  # ここも違う
        print(y - x)
        raise ValueError()
    else:
        print(min(y - x, 1 + y + x, key=lambda z: 10**10 if z < 1 else z))


### FIXED CODE ###

# https://atcoder.jp/contests/agc008/tasks/agc008_a
# どう見ても符号反転は1回するのが最適
# ひたすら場合分け


x, y = map(int, input().split())
if x * y < 0:  # 異符号ならば答えは一つ
    print(abs(abs(x) - abs(y)) + 1)
    exit()
elif 0 <= x < y:
    print(y - x)
    exit()
elif 0 < y < x:
    print(2 + x - y)
    exit()
elif y == 0 and y < x:
    print(1 + x)
    exit()
elif x < y <= 0:
    print(y - x)
    exit()
elif y < x < 0:
    print(2 + x - y)
    exit()
elif x == 0 and y < x:
    print(1 - y)
    exit()
raise ValueError()
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    h,w = f()
    g = [ f() for i in range(h)]

    cnt = 0
    ans = []
    for i in range(h):
        for j in range(w):
            if g[i][j]%2 == 0:
                continue
            else:
                if (j+1<w and g[i][j+1]%2 == 1) or i+1 == h:
                    g[i][j+1] += 1
                    cnt+=1
                    ans += [(i+1, j+1, i+1, j+1+1)]

                elif i+1<h:
                    g[i+1][j] += 1
                    cnt+=1
                    ans += [(i+1, j+1, i+2, j+1)]

    
    print(cnt)
    for i in ans:
        print(i[0], i[1], i[2], i[3])



solve()


### FIXED CODE ###

import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    h,w = f()
    g = [ f() for i in range(h)]

    cnt = 0
    ans = []
    for i in range(h):
        for j in range(w):
            if g[i][j]%2 == 0:
                continue
            else:
                if j+1<w  and (g[i][j+1]%2 == 1 or i+1 == h):
                    g[i][j+1] += 1
                    cnt+=1
                    ans += [(i+1, j+1, i+1, j+1+1)]

                elif i+1<h:
                    g[i+1][j] += 1
                    cnt+=1
                    ans += [(i+1, j+1, i+2, j+1)]

    
    print(cnt)
    for i in ans:
        print(i[0], i[1], i[2], i[3])



solve()
n=int(input())
List=[[input().split() , i+1] for i in range(n)]

List=sorted(List,key=lambda x : (x[0],-int(x[1])))

for i in range(n):
    print(List[i][2])

### FIXED CODE ###

n=int(input())
List=[[input().split() , i+1] for i in range(n)]

List=sorted(List,key=lambda x : (x[0][0],-int(x[0][1])))

for i in range(n):
    print(List[i][1])
N = int(input())
P = list(map(int, input().split()))

check = 0
for i, p in enumerate(P):
    if i + 1 != p[i]:
        check += 1

if (check == 0 or check == 2):
    print('YES')
else:
    print('NO')
    

### FIXED CODE ###

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

check = 0
for i, p in enumerate(P):
    if i + 1 != p:
        check += 1

if (check == 0 or check == 2):
    print('YES')
else:
    print('NO')
n=int(input())
s=list(map(int,input().split()))
a=0
l,r=0,1
while 1:
    if s[r-1]>=s[r]:
        a=max(a,r-l)
        r+=1
    else:
        l=r
        r=l+1
    if r==n:break
print(a)

### FIXED CODE ###

n=int(input())
if n==1:print(0);exit()
s=list(map(int,input().split()))
a=0
l,r=0,1
while 1:
    if s[r-1]>=s[r]:
        a=max(a,r-l)
        r+=1
    else:
        l=r
        r=l+1
    if r==n:break
print(a)
import sys

sys.setrecursionlimit(10000000)
n, k = map(int, input().split())
mod = 10**9+7

nCr = {}


def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n, r) in nCr: return nCr[(n, r)]
    nCr[(n, r)] = cmb(n - 1, r) + cmb(n - 1, r - 1)
    return nCr[(n, r)]


for i in range(1, k + 1):
    # print("{0}C{1} * {2}C{3}".format(n - k + 1, i, k-1,i-1))
    print((cmb((n - k + 1), i) * cmb(k - 1, i - 1)) % mod)


### FIXED CODE ###

import math

n, k = map(int, input().split())
mod = 10 ** 9 + 7

def cmb_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


for i in range(1, k + 1):
    # print("{0}C{1} * {2}C{3}".format(n - k + 1, i, k-1,i-1))
    if n -k +1 >=i:
        print(((cmb_count((n - k + 1), i) % mod) * (cmb_count(k - 1, i - 1)) % mod))
    else:
        print(0)
H, W = map(int, input().split())
grid = [input() for _ in range(H)]
ans = 0
L = [[0] * W]*H; R = [[0] * W]*H; D = [[0] * W]*H; U = [[0] * W]*H;
for i in range(H):
    for j in range(W):
        if grid[i][j] == '.'
            L[i][j] = L[i][j-1] if j >= 1 else 1
            U[i][j] = U[i-1][j] if i >= 1 else 1
for i in reversed(range(H)):
    for j in reversed(range(W)):
        if grid[i][j] == '.':
            R[i][j] = R[i][j+1] if j <= W-1 else 1
            D[i][j] = D[i+1][j] if i <= H-1 else 1
for i in range(H):
    for j in range(W):
        ans = max(ans, L[i][j] + R[i][j] + D[i][j] + U[i][j] - 3)
print(ans)

### FIXED CODE ###

H, W = map(int, input().split())
grid = [input() for _ in range(H)]
ans = 0
vert = [[0] * W for _ in range(H)]; hori = [[0] * W for _ in range(H)];
for i in range(H):
    for j in range(W):
        if grid[i][j] == '.':
            hori[i][j] = hori[i][j-1] + 1 if j > 0 else 1
    for j in range(W-2, -1, -1):
        if grid[i][j] == '.' and grid[i][j+1] == '.':
            hori[i][j] = hori[i][j+1] 
for j in range(W):
    for i in range(H):
        if grid[i][j] == '.':
            vert[i][j] = vert[i-1][j] + 1 if i > 0 else 1
    for i in range(H-2, -1, -1):
        if grid[i][j] == '.' and grid[i+1][j] == '.':
            vert[i][j] = vert[i+1][j]
for i in range(H):
    for j in range(W):
        if grid[i][j] == '.':
            ans = max(ans, hori[i][j] + vert[i][j] - 1)
print(ans)
a,b=map(int,input().split())
def h(d):
    if d==1:
        return 1
    return h(d-1)+d
print(h(b-a)-b)


### FIXED CODE ###

a,b=map(int,input().split())
h=sum([i for i in range(1,b-a+1)])
print(h-b)
N, L = map(int, input().split())
for i in range(N):
  l.append(abs(L + i))
l.sort()
l.pop(0)
print(sum(l))

### FIXED CODE ###

N, L = map(int, input().split())
l = []
for i in range(N):
  l.append(L + i)
l.sort()
if 0 in l:
  print(sum(l))
else:
  if l[0] > 0:
    l.pop(0)
    print(sum(l))
  else:
    l.pop(-1)
    print(sum(l))
for i in range(len(S)-len(T)+1):
	sub_S = S[i:i+len(T)]
	cnt = 0
	for j in range(len(T)):
		if sub_S[j] != T[j]:
			cnt += 1
	cnt_list.append(cnt)
print(min(cnt_list))

### FIXED CODE ###

D,T,S =  map(int,input().split())
if D/S <= T:
  print("Yes")
else:
  print("No")
input(x)

if x>=30:
  print('yes')
else :
  print('No')


### FIXED CODE ###

x = int(input())

if x>=30:
  print('Yes')
else :
  print('No')
s = input()
a = list(s)
result = 700
for i in a:
  if i == o:
    result += 100
print(result)


### FIXED CODE ###

s = input()
a = list(s)
result = 700
for i in a:
  if i == "o":
    result += 100
print(result)
N = int(input())
Ai = list(map(int, input().split()))

result = 1

if 0 in Ai:
	result= '0'  
else:
  for i in range(N):
      result *= Ai[i]

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

print(result)

### FIXED CODE ###

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

print(a * b)
import numpy as np
S = np.array([list(map(int, input().split())) for _ in range(3)])
n = int(input())
for _ in range(n):
    S = np.where(S==int(input()), 0, S)
    HBingo = min(np.sum(S, axis=0)) == 0
    WBingo = min(np.sum(S, axis=1)) == 0
    SBingo = S[2][0] == 0 and S[1][1] == 0 and S[0][2] == 0
    BSBingo = S[0][0] == 0 and S[1][1] == 0 and S[2][2] == 0
if HBingo or WBingo or SBingo or BSBingo:
    print('Yes')
    exit()
print('No')

### FIXED CODE ###

import numpy as np
S = np.array([list(map(int, input().split())) for _ in range(3)])
n = int(input())
for _ in range(n):
    S = np.where(S==int(input()), 0, S)
if min(np.sum(S, axis=0))==0 or min(np.sum(S, axis=1))==0:
    print('Yes')
    exit()
if (S[0][0] == 0 and S[1][1] == 0 and S[2][2] == 0) or (S[2][0] == 0 and S[1][1] == 0 and S[0][2] == 0):
    print('Yes')
    exit()
print('No')
n = int(input())
lis = input().split()
for i in range(n):
  if lis[i] == 'Y':
    print('Four')
    break
  else:
    if i == n-1
    print('Three')

### FIXED CODE ###

n = int(input())
lis = input().split()
for i in range(n):
  if lis[i] == 'Y':
    print('Four')
    break
  else:
    if i == n-1:
    	print('Three')
n = int(input())
students = [int(x) for x in input().split(' ')]
order = [x for x in range(n)]
for i in range(n):
    order[students[i] - 1] = i+1
print(' '.join([str(x) for x in order]))

### FIXED CODE ###

n = int(input())

if n % 2 == 0:
    print(1 / 2)
else:
    print((((n - 1) / 2) + 1) / n)
def get():
	p,w = map(int, raw_input().split(","))
	for i in range(W-w+1,-1,-1):
		if bag[i] > 0 and bag[i]+p > bag[i+w]:
			bag[i+w] = bag[i]+p
	else:
		if p > bag[w]: bag[w] = p
	return

c = 1
while True:
	W = int(raw_input())
	if W == 0: break
	bag = [0]*(W+1)
	N = int(raw_input())
	for i in range(N): get()
	w_all = max(bag)
	money = bag.index(w_all)
	print "Case {}:\n{}\n{}".format(c,w_all,money)
	c += 1

### FIXED CODE ###

def get():
	p,w = map(int, raw_input().split(","))
	for i in range(W-w,-1,-1):
		if bag[i] > 0 and bag[i]+p > bag[i+w]:
			bag[i+w] = bag[i]+p
	else:
		if p > bag[w]: bag[w] = p
	return

c = 1
while True:
	W = int(raw_input())
	if W == 0: break
	bag = [0]*(W+1)
	N = int(raw_input())
	for i in range(N): get()
	w_all = max(bag)
	money = bag.index(w_all)
	print "Case {}:\n{}\n{}".format(c,w_all,money)
	c += 1
k = input()
x = input()

if k*500<=x:
    print("Yes")
else:
    print("No")



### FIXED CODE ###

import sys
# input=sys.stdin.readline

val = []
val = input()

arrays = val.split(' ')
a = int(arrays[0])*500

if a>=int(arrays[1]):
    print("Yes")
elif a<int(arrays[1]):
    print("No")

sys.exit()
n=int(input())
a=list(map(int,input()))
for i in range(n//2):
  print(a[n//2+1])
for i in range(n//2):
  print(a[n//2])

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=sorted(a)
l=b[:n//2]
u=b[n//2:]
for i in a:
  if i <= l[-1]:
    print(u[0])
  else:
    print(l[-1])
def distance(p1,p2):
    return abs(p1[0]-p2[0])+abs(p1[1]-p2[1])

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

student=[]
check=[]
for i in range(0,M):
    a,b=[int(x) for x in input().split()]
    student.append((a,b))

for j in range(0,N):
    c,d=[int(x) for x in input().split()]
    check.append((c,d))


for i in range(0,M):
    dist=distance(student[i],check[N-1])
    num=N-1
    for j in range(0,N):
        k=N-j-1
        if dist>=distance(student[i],check[k]):
            dist=distance(student[i],check[k])
            num=k
    print(num+1)


### FIXED CODE ###

A,B=[int(x) for x in input().split()]
print((A+B)%24)
#!/usr/bin/env python3
N = int(input())

sum = 0
m = 0
for i in range(1, 10**3 + 1):
    sum += i
    if sum >= N:
        m = i
        break

sum = N
for i in range(1, m + 1)[::-1]:
    if sum - i >= 0:
        sum -= i
        print(i)


### FIXED CODE ###

#!/usr/bin/env python3
class UnionFind():
    def __init__(self, size):
        self.table = [-1] * size

    def find(self, x):
        if self.table[x] < 0:
            return x
        else:
            self.table[x] = self.find(self.table[x])
            return self.table[x]

    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 != s2:
            if self.table[s2] < self.table[s1]: s1, s2 = s2, s1
            self.table[s1] += self.table[s2]
            self.table[s2] = s1
        return s1 != s2


N, M = map(int, input().split())
uf = UnionFind(N + M)
for i in range(N):
    L = [int(x) - 1 for x in input().split()]
    L[0] += 1
    for j in range(L[0]):
        uf.union(L[j + 1], M + i)

ans = True
for i in range(N):
    if uf.find(M + i) != uf.find(M):
        ans = False
print(('NO', 'YES')[ans])
N, M = map(int, input().split())
PYI = []
for i in range(M):
  pi, yi = map(int, input().split())
  PYI.append("{:06}{:06}{:06}".format(pi, yi, i))
  
ID = ["" for i in range(M)]
PYI.sort()
count = 0
for i in range(M):
  y = int(PYI[i][6 : 12])
  if i == 0 or PYI[i][0 : 6] != PYI[i - 1][0 : 6]:
    count = 1
  else:
    count += 1
  ID[int(PYI[i][12 :])] = "{}{:06}".format(PYI[i][0 : 6], count)

for i in range(M):
  print(ID[i])

### FIXED CODE ###

N, M = map(int, input().split())
iPYx = []
for i in range(M):
  P, Y = map(int, input().split())
  iPYx.append([i, P, Y])

iPYx.sort(key = lambda x: (x[1], x[2]))
cnt = 0
for i in range(M):
  if i == 0 or iPYx[i][1] != iPYx[i - 1][1]:
    cnt = 1
  else:
    cnt += 1
  iPYx[i].append(cnt)
iPYx.sort(key = lambda x: x[0])
for i in range(M):
  print("{:06}{:06}".format(iPYx[i][1], iPYx[i][3]))
n = int(input())
x = input()
k = x.count("1")
cnt = 0
s = int(x, 2)
k1 = s % (k-1)
k2 = s % (k+1)
while s != 0:
	targ = bin(s).count("1")
	s = s % targ
	cnt += 1

def ev(n):
	cnt = 0
	while n != 0:
		m = bin(n).count("1")
		n = n % m
		cnt += 1
	return cnt

for i in range(n):
	if x[i] == "0":
		targ = k+1
		print(ev((k2+pow(2, n-i-1, targ)) % targ)+1)
	else:
		targ = k-1
		print(ev((k1-pow(2, n-i-1, targ)) % targ)+1)

### FIXED CODE ###

n = int(input())
x = input()
k = x.count("1")
cnt = 0
s = int(x, 2)
if k >= 2:
	k1 = s % (k-1)
k2 = s % (k+1)
while s != 0:
	targ = bin(s).count("1")
	s = s % targ
	cnt += 1

def ev(n):
	cnt = 0
	while n != 0:
		m = bin(n).count("1")
		n = n % m
		cnt += 1
	return cnt

if k != 1:
	for i in range(n):
		if x[i] == "0":
			targ = k+1
			print(ev((k2+pow(2, n-i-1, targ)) % targ)+1)
		else:
			targ = k-1
			print(ev((k1-pow(2, n-i-1, targ)) % targ)+1)
else:
	for i in range(n):
		if x[i] == "0":
			targ = k+1
			print(ev((k2+pow(2, n-i-1, targ)) % targ)+1)
		else:
			targ = k-1
			print(0)
S = input()
print(s.count("+")-s.count("-"))

### FIXED CODE ###

S = input()
print(S.count("+")-S.count("-"))
for i in range(1,int(input)+1):
 a=i
 while(a>0):
  if a%3==0:
   print(i,end='')
   break
  a/=10

### FIXED CODE ###

print('',*[i for i in range(3,int(input())+1)if i%3==0 or'3'in str(i)])
n = int(input())

if n%1000 == 0:
  return n//1000
else:
  return 1000 - n%1000

### FIXED CODE ###

n = int(input())

if n%1000 == 0:
  print(0)
else:
  print(1000 - n%1000)
from collections import deque
S=deque([input()])
q=int(input())
rev=False
for i in range(q):
   s=input()
   if s=="1":
      rev= not rev
   else:
      t,f,c=s.split()
      if (rev==False and f=="1") or (rev==True and f=="2"):
         S.appendleft(c)
      else:
         S.append(c)
if rev==False:
   print("".join(S))
else:
   print("".join(S[::-1]))

### FIXED CODE ###

S=input()
q=int(input())
RV=0
A="A"
for i in range(q):
    IN=input()
    if IN=="1":
        RV+=1
    else:
        t,f,c=IN.split()
        if RV%2==0:
            if f=="1":
                A=c+A               
            else:
                A=A+c
        else:
            if f=="1":
                A=A+c
            else:
                A=c+A
if RV%2==0:
    for i in range(len(A)):
        if A[i]=="A":
            print(A[:i]+S+A[i+1:])
else:
    A=A[::-1]
    for i in range(len(A)):
        if A[i]=="A":
            print(A[:i]+S[::-1]+A[i+1:])
a,x,b=map(int,input().split())

if b>=a+x+1:
  print("dangerous")
elif  b<=a+x and a<b:
  print("safe")
else:
  print(delicious)

### FIXED CODE ###

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

if b>=a+x+1:
  print("dangerous")
elif  b<=a+x and a<b:
  print("safe")
else:
  print("delicious")
from math import gcd

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

d = a[0]
m = a[0]

g = True

for i in range(1, n):
    d = gcd(d, a[i])

if d != 1:
    print("not coprime")
else:
    while len(a) > 1:
        b = []
        for i in range(0, len(a), 2):
            #print(i, a)
            if i == n-1:
                b.append(a[i])
            else:
                e = gcd(a[i], a[i+1])
                if e != 1:
                    g = False
                    break
                else:
                    b.append(a[i] * a[i+1])
        a = b.copy()
        #print(a)


    if not g:
        print("setwise coprime")
    else:
        print("pairwise coprime")

### FIXED CODE ###

from math import gcd

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

d = a[0]
m = a[0]

g = True

for i in range(1, n):
    d = gcd(d, a[i])

if d != 1:
    print("not coprime")
else:
    while len(a) > 1:
        b = []
        for i in range(0, len(a), 2):
            #print(i, a)
            if i == len(a)-1:
                b.append(a[i])
            else:
                e = gcd(a[i], a[i+1])
                if e != 1:
                    g = False
                    break
                else:
                    b.append(a[i] * a[i+1])
        a = b.copy()
        #print(a)


    if not g:
        print("setwise coprime")
    else:
        print("pairwise coprime")
s=input()
n=len(s)
count=0
a=[0 for i in range(n)]
for i in range(3,n):
    a[i]=10**i%2019
if n<4:
    print(0)
else:
    for i in reversed(range(2,n)):
        k=int(s[i-2:i+1])
        h=3
        for j in reversed(range(0,i-2)):
            k=k+a[h]*int(s[j])
            h+=1
            if k%2019==0:
                count+=1
    print(count)

### FIXED CODE ###

s,w=map(int,input().split())
if w>=s:
    print("unsafe")
else:
    print("safe")
import sys
sys.setrecursionlimit(100000)

n, q = map(int, input().split())
dic = {}
dic2 = {}

for _ in range(n - 1):
    a, b = map(int, input().split())
    if not (a in dic):
        dic[a] = []
    dic[a].append(b)

for _ in range(n - 1):
    a, b = map(int, input().split())
    if not (a in dic2):
        dic2[a] = 0
    dic2[a] = dic2[a]+b

v_list = [0 for _ in range(n)]


def add_v(num, value):
    v_list[num - 1] = v_list[num - 1] + value
    if num in dic:
        for root in dic[num]:
            add_v(root, value)


for i in dic2:
    add_v(i, dic2[i])


print(*v_list)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

n, q = map(int, input().split())
dic = {}

for _ in range(n - 1):
    a, b = map(int, input().split())
    if not (a in dic):
        dic[a] = []
    dic[a].append(b)

v_list = [0 for _ in range(n)]

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

key_list = list(dic.keys())
key_list.sort()

for a in key_list:
    for b in dic[a]:
        v_list[b-1] = v_list[a-1] + v_list[b-1]

print(*v_list)
import math
xy = [map(int, input().split()) for _ in range(5)]
x, y = [list(i) for i in zip(*xy)]

n = 0

for i ,index in enumerate(x[0]):
  m = math.sqrt(x[i+1]**2 + y[i+1]**2)
  if (m <= y[0]):
    n += 1

print(n)

### FIXED CODE ###

import math
n,d  = map(int,input().split())

x =[]
y = []
for i in range(n):
    x1,y1  = map(int,input().split())
    x.append(x1)
    y.append(y1)

n = 0
 
for i ,index in enumerate(x):
  m = math.sqrt(x[i]**2 + y[i]**2)
  if m <= d:
    n += 1
 
print(n)
N=int(input())
for i in range(1,10):
  for j in range(i,10):
    if i*j==N:
      print("Yes")
   	  exit()
print("No")

### FIXED CODE ###

N=int(input())
for i in range(1,10):
  for j in range(i,10):
    if i*j==N:
      print("Yes")
      exit()
print("No")