Harryxun/stf_run huggingface dataset:
def coloring2(color,p):
    global K
    dcolor = 1
    for c in Data[p]:
        if dcolor == color:
            dcolor += 1
        s = str(p)+'_'+str(c)
        Edge[s] = dcolor 
        coloring2(dcolor,c)
        dcolor += 1
    K = max(K,dcolor-1)

N = int(input())
Data = [ [] for _ in range(N+1) ]
Edge = {} 
Edge2 = []
for _ in range(N-1):
    a,b = map(int,input().split())
    Data[a].append( b )
    s = str(a)+'_'+str(b)
    Edge[s] = 0
    Edge2.append([a,b])
K = 0
coloring2(0,Edge2[0][0])
print(K)
for [a,b] in Edge2:
    s = str(a)+'_'+str(b)
    print(Edge[s])


### FIXED CODE ###

import sys
def coloring2(color,p):
    global K
    dcolor = 1
    for c in Data[p]:
        if dcolor == color:
            dcolor += 1
        s = str(p)+'_'+str(c)
        Edge[s] = dcolor 
        coloring2(dcolor,c)
        dcolor += 1
    K = max(K,dcolor-1)

sys.setrecursionlimit(10 ** 9)
N = int(input())
Data = [ [] for _ in range(N+1) ]
Edge = {} 
Edge2 = []
for _ in range(N-1):
    a,b = map(int,input().split())
    Data[a].append(b)
    s = str(a)+'_'+str(b)
    Edge[s] = 0
    Edge2.append([a,b])

K = 0
coloring2(0,1)
print(K)
for [a,b] in Edge2:
    s = str(a)+'_'+str(b)
    print(Edge[s])
a=int(input())
s=input()
b=int(input())
t=input()
u=input()
if u==s:
    print(a-1,b)
if u==t:
    print(a,b-1)

### FIXED CODE ###

s,t=map(str,input().split())
a,b=map(int,input().split())
u=input()
if u==s:
    print(a-1,b)
if u==t:
    print(a,b-1)
H,W = map(int, input().split(','))
h,w = map(int, input().split(','))
print((H-h)*(W-w))

### FIXED CODE ###

H,W = map(int, input().split(' '))
h,w = map(int, input().split(' '))
print((H-h)*(W-w))
import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

n,m=map(int, input().split())
s = []
c = []
for i in range(m):
    a, b = map(int, input().split())
    s.append(a)
    c.append(b)

if n==1:
    if c[0]==0:
        print(0)
        sys.exit()
def ok(num,m,s,c):
    for i in range(m):
        if str(num)[s[i]-1] != str(c[i]):
            return False
    return True
    
for num in range(10**(n-1),10**n):
    if ok(num,m,s,c):
        print(num)
        sys.exit()

print(-1)
            


### FIXED CODE ###

import sys
input = sys.stdin.readline
#n = int(input())
#l = list(map(int, input().split()))
'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''

n,m=map(int, input().split())
s = []
c = []
if m!=0:
    for i in range(m):
        a, b = map(int, input().split())
        s.append(a)
        c.append(b)

    if n==1:
        if c[0]==0:
            print(0)
            sys.exit()
    def ok(num,m,s,c):
        for i in range(m):
            if str(num)[s[i]-1] != str(c[i]):
                return False
        return True
        
    for num in range(10**(n-1),10**n):
        if ok(num,m,s,c):
            print(num)
            sys.exit()

    print(-1)
else:
    if n==1:
        print(0)
    else:
        print(10**(n-1))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans='No'
if a[1]-a[0]==b[1]-b[0]==c[1]-c[0] and a[2]-a[1]==b[2]-b[1]==c[2]-c[1]:
  b[0]-a[0]==b[1]-a[1]==b[2]-b[2] and c[0]-b[0]==c[1]-b[1]==c[2]-b[2]:
    ans='Yes'
print(ans)

### FIXED CODE ###

a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans='No'
if a[1]-a[0]==b[1]-b[0]==c[1]-c[0] and a[2]-a[1]==b[2]-b[1]==c[2]-c[1]:
  if b[0]-a[0]==b[1]-a[1]==b[2]-a[2] and c[0]-b[0]==c[1]-b[1]==c[2]-b[2]:
    ans='Yes'
print(ans)
from functools import lru_cache
@lru_cache(maxsize=100000)

import sys
sys.setrecursionlimit(100000) 

n,m = list(map(int,input().split()))
a = [0]*m
for i in range(m):
    a[i] = int(input())
memo = [-1]*(n+1)

def stair(k):
    if memo[k] != -1:
        return memo[k]
    else:
        if k == 1:
            if 1 not in a:
                memo[k] = 1
            else:
                memo[k] = 0
        elif k == 2:
            if 2 not in a:
                memo[k] = 1 + stair(1)
            else:
                memo[k] = 0 + stair(1)
        elif k not in a:
            if k-1 not in a:
                if k-2 not in a:
                    memo[k] = (stair(k-1)+stair(k-2))%1000000007
                else:
                    memo[k] = stair(k-1)
            else:
                if k-2 not in a:
                    memo[k] = stair(k-2)
                else:
                    memo[k] = 0
        else:
            memo[k] = 0
        return memo[k]

print(stair(n))

### FIXED CODE ###

n,m = list(map(int,input().split()))
a = [0]*m
for i in range(m):
    a[i] = int(input())
dp = [0]*(n+2)
for i in a:
    dp[i] = -1
dp[0] = 1

for i in range(n):
    if dp[i]<0:
        continue
    dp[i] %= 10**9+7
    if dp[i+1]>=0:
        dp[i+1] += dp[i]
    if dp[i+2]>=0:
        dp[i+2] += dp[i]
print(dp[n]%(10**9+7))
ls = []

for i in range(5):
    ls.append(int(input()))
sum = 0
ls1 = []
for i in range(5):
    if ls[i] % 10 == 0:
        sum += ls[i]
    else:
        ls1.append(10 - ls[i] % 10)
        sum += (ls[i] // 10 + 1 )* 10
#print(ls1)
print(sum - max(ls1))


### FIXED CODE ###

ls = []

for i in range(5):
    ls.append(int(input()))
sum = 0
ls1 = []
for i in range(5):
    if ls[i] % 10 == 0:
        sum += ls[i]
    else:
        ls1.append(10 - ls[i] % 10)
        sum += ((ls[i] // 10) + 1)* 10
#print(ls1)
if len(ls1) != 0:
    print(sum - max(ls1))
else:
    print(sum)
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import bellman_ford, NegativeCycleError


def main():
    N, M, P = map(int, input().split())
    A, B, C = [0] * M, [0] * M, [0] * M
    v = [set() for _ in range(N)]
    u = [set() for _ in range(N)]
    for i in range(M):
        a, b, c = map(int, input().split())
        A[i], B[i], C[i] = a - 1, b - 1, P - c
        u[a - 1].add(b - 1)
        v[b - 1].add(a - 1)
    vv = set()
    cur = set([N - 1])
    while cur:
        vv |= cur
        cur = set().union(*(v[c] for c in cur)) - vv
    uu = set()
    cur = set([0])
    while cur:
        uu |= cur
        cur = set().union(*(u[c] for c in cur)) - uu
    reachable = vv & uu
    for i in range(M):
        if A[i] not in reachable or B[i] not in reachable:
            C[i] = 10 ** 9

    mx = csr_matrix((C, (A, B)), shape=(M, M))
    try:
        dm = bellman_ford(mx, indices=list(reachable))
    except NegativeCycleError:
        return -1
    return max(0, -int(dm[0][N - 1]))


print(main())


### FIXED CODE ###

from scipy.sparse import csr_matrix, lil_matrix
from scipy.sparse.csgraph import bellman_ford, NegativeCycleError


def main():
    N, M, P = map(int, input().split())
    A, B, C = [0] * M, [0] * M, [0] * M
    v = [set() for _ in range(N)]
    u = [set() for _ in range(N)]
    for i in range(M):
        a, b, c = map(int, input().split())
        A[i], B[i], C[i] = a - 1, b - 1, P - c
        u[a - 1].add(b - 1)
        v[b - 1].add(a - 1)
    vv = set()
    cur = set([N - 1])
    while cur:
        vv |= cur
        cur = set().union(*(v[c] for c in cur)) - vv
    uu = set()
    cur = set([0])
    while cur:
        uu |= cur
        cur = set().union(*(u[c] for c in cur)) - uu
    reachable = vv & uu
    l = {}
    for a, b, c in zip(A, B, C):
        if a in reachable and b in reachable:
            l[(a, b)] = min(c, l.get((a, b), 10 **9))
    AA, BB, CC = [], [], []
    for (a, b), c in l.items():
        AA.append(a)
        BB.append(b)
        CC.append(c)
    mx = csr_matrix((CC, (AA, BB)), shape=(N, N))
    try:
        dm = bellman_ford(mx, indices=[0])
    except NegativeCycleError:
        return -1
    return max(0, -int(dm[0][N - 1]))


print(main())
def func(x, y):
  if len(y)==1:
    dic.append(i*10+int(y))
  else:
    for j in range(len(y)):
      func(i*10+int(y[j]), y[:j]+y[j+1:])
dic = []

N = int(input())
func(0, "".join([i in range(1,N+1)]))

A = int(input().replace(" ", ""))
B = int(input().replace(" ", ""))
ans = abs(dic.index(A)-dic.index(B))
print(ans)

### FIXED CODE ###

def func(x, y):
  if len(y)==1:
    dic.append(x*10+int(y))
  else:
    for j in range(len(y)):
      func(x*10+int(y[j]), y[:j]+y[j+1:])
dic = []
 
N = int(input())
func(0, "".join([str(i) for i in range(1,N+1)]))
 
A = int(input().replace(" ", ""))
B = int(input().replace(" ", ""))
ans = abs(dic.index(A)-dic.index(B))
print(ans)
n=int(input())
x=list(input())
def str2int(z):
  flag=1
  a=0
  for i in reversed(x):
    if i=='1':a+=flag
    flag*=2
  return a
 
popc=x.count('1')
x=str2int(x)
fl_1=x%(popc-1)
fl_0=x%(popc+1)
cc=[]
for i in range(n):
  if ((x>>i)&1):
    mod=(fl_1-(2**i)%(popc-1))%(popc-1)
  else:mod=(fl_0+(2**i)%(popc+1))%(popc+1)
  #print('mod : %s'%mod)
  cnt=1
  while mod!=0:
    pp=bin(mod).count("1")
    mod%=pp
    cnt+=1
  cc.append(cnt)
  
for c in reversed(cc):
  print(c)

### FIXED CODE ###

n=int(input())
x=list(input())
def str2int(z):
  flag=1
  a=0
  for i in reversed(x):
    if i=='1':a+=flag
    flag*=2
  return a
 
popc=x.count('1')
z=str2int(x)
if popc-1!=0:
  fl_1=z%(popc-1)
fl_0=z%(popc+1)

for i in range(n):
  if x[i]=='1':
    if popc-1==0:
      print(0)
      continue
    mod=(fl_1-pow(2,n-1-i,popc-1))%(popc-1)
  else:mod=(fl_0+pow(2,n-1-i,popc+1))%(popc+1)
  #print('mod : %s'%mod)
  cnt=1
  while mod!=0:
    pp=bin(mod).count("1")
    mod%=pp
    cnt+=1
  print(cnt)
#No4.py
s = input()
h = s/(60*60)
m = s - h*60*60
s = s - h*60*60 - m*60
print(h+":"+m+":"+s)

### FIXED CODE ###

#No4.py
s = int(input())
h = s//(60*60)
m = (s-h*60*60)//60
s = s-h*60*60-m*60
print(str(h)+":"+str(m)+":"+str(s))
H, W = map(int, input.split())
h, w = map(int, input.split())

print((H-h)*(W-w))

### FIXED CODE ###

a = [input() for i in range(2)]
H, W = map(int, a[0].split())
h, w = map(int, a[1].split())
print((H-h)*(W-w))
n=int(input(""))
a=[]
b=[]
for i in range(n):
    cc=input("").split(" ")
    a+=[int(cc[0])]
    b+=[int(cc[1])]
s=0
a.sort()
b.sort()
if (n%2==0):
    s=(a[n/2]+a[n/2-1]-b[n/2]-b[n/2-1])/2
else:
    s=a[int((n+1)/2)]-b[int((n+1)/2)]
print(-s+1)


### FIXED CODE ###

n=int(input(""))
a=[]
b=[]
for i in range(n):
    cc=input("").split(" ")
    a+=[int(cc[0])]
    b+=[int(cc[1])]
s=0
a.sort()
b.sort()
if (n%2==0):
    s=(a[int(n/2)]+a[int(n/2)-1]-b[int(n/2)]-b[int(n/2)-1])
else:
    s=a[int((n-1)/2)]-b[int((n-1)/2)]
print(int(-s+1))
a, b, c = map(int, input().split())

print(sum(a, b, c) - max(a, b, c))

### FIXED CODE ###

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

print(min(a + b, b + c, c + a))
n=int(input())
print(n.replace("1","9").replace("9","1"))


### FIXED CODE ###

print(input().replace("1","*").replace("9","1").replace("*","9"))
def decide_H(Cx,Cy,x,y,h):
    H=h+abs(x-Cx)+abs(y-Cy)
    if h>=1:
        return(H)
 
def check_H(Cx,Cy,H):
    for x,y,h in T:
        if h != max(H - abs(x - Cx) - abs(y - Cy), 0):
        # if H==decide_H(Cx,Cy,x,y,h) and H!=None and h!=0:
        #     continue
            return False
    return True
 
N=int(input())
T=[[int(i) for i in input().split()] for _ in range(N)]
 
for Cx in range(101):
    for Cy in range(101):
        for x,y,h in T:
            H=decide_H(Cx,Cy,x,y,h)
            if check_H(Cx,Cy,H):
                print(Cx,Cy,H)
                exit()
            else:
                break
def decide_H(Cx,Cy,x,y,h):
    H=h+abs(x-Cx)+abs(y-Cy)
    if H>=1:
        return(H)

def check_H(Cx,Cy,H):
    for x,y,h in T:
        if h != max(H - abs(x - Cx) - abs(y - Cy), 0):
        # if H==decide_H(Cx,Cy,x,y,h) and H!=None and h!=0:
        #     continue
            return False
    return True

N=int(input())
T=[[int(i) for i in input().split()] for _ in range(N)]

for Cx in range(101):
    for Cy in range(101):
        for x,y,h in T:
            H=decide_H(Cx,Cy,x,y,h)
            if check_H(Cx,Cy,H):
                print(Cx,Cy,H)
                exit()
            else:
                break
提出情報

### FIXED CODE ###

def get_H(Cx, Cy):
    for x, y, h in L:
        if h > 0:
            return abs(x - Cx) + abs(y - Cy) + h


def check_H(Cx, Cy, H):
    for x, y, h in L:
        if h != max(H - abs(x - Cx) - abs(y - Cy), 0):
            return False
    return True


N = int(input())

L = [(list(map(int, input().split()))) for _ in range(N)]

for Cx in range(101):
    for Cy in range(101):
        H = get_H(Cx, Cy)
        if check_H(Cx, Cy, H):
            print('{} {} {}'.format(Cx, Cy, H))
            exit(0)
import math
A,B = input().split()
 
print(math.gcd(int(A),int(B)))

### FIXED CODE ###

import fractions
A,B = input().split()
 
lcm = int(A) * int(B)/ fractions.gcd(int(A),int(B))
print(int(lcm))
C = input().split()

A = int(C[0])
B = int(C[1]*100)



E = A*B

F = E/100

print(F)

### FIXED CODE ###

C = input().split()

A = int(C[0])
B = int(float(C[1])*100+0.5)



E = A*B



if E < 100:
    print(0)
elif E < 200:
    print(1)
elif E < 300:
    print(2)
else:
    F = str(E)
    print(F[0:len(F)-2])
import math
from fractions import Fraction

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

y = Fraction(x / (a ** 2))

if b > a:
    a = Fraction(2 * a * y / b)
    teihen = b
else:
    teihen = 2 * (b - y)
res = Fraction(a / teihen)
print(90 - math.degrees(math.atan(res)))

### FIXED CODE ###

import sys
import math
from fractions import Fraction

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

y = Fraction(x / (a ** 2))

if y == b:
    print(0)
    sys.exit()

if b - 2 * y > 0:
    a = Fraction(2 * a * y / b)
    teihen = b
else:   
    teihen = 2 * (b - y)
res = Fraction(a / teihen)
print(90 - math.degrees(math.atan(res)))
n=int(input())
for _ in range(n):
    a,b,c,d,e,f,g,h=map(float, input().split())
    if (b-d)/(a-c) == (f-h)/(e-g):
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

for _ in range(int(input())):
    a,b,c,d,e,f,g,h=map(float, input().split())
    
    if abs((c-a)*(h-f) - (g-e)*(d-b)) < 1e-10:
        print("YES")
    else:
        print("NO")
from collections import deque
n,k=map(int, input().split())

A = deque(map(int, input().split()))
li = []
li2 = [0]*n
li.append(1)

next = 0
t=0
rep = False

for i in range(n):
    li.append(A[next])
    li2[next] = 1
    next = A[next]-1

    if li2[next] == 1:
        t = li.index(A[next])
        rep = True
        break

if rep == True:
    tmp = (k%len(li[t:])) - len(li[0:t])
    g=li[t:]
    if t==0:
        print(g[0])
    else:
        print(g[tmp])
else:
    print(li[k-1])


### FIXED CODE ###

from collections import deque
n,k=map(int, input().split())

A = deque(map(int, input().split()))
li = []
li2 = [0]*n
li.append(1)

next = 0

t=0
rep = False

for i in range(k):
    if i == k:
        print(next+1)
        exit()

    if li2[next] == 1:
        t = li.index(next+1)
        rep = True
        li.pop()
        break

    li.append(A[next])
    li2[next] = 1
    next = A[next]-1


tmp = (k-t)%len(li[t:])
print(li[tmp+t])
n = int(input())
a = [[0]*n for i in range(n)]
  
for i in range(n):
    v = list(map(int, input().split()))
    u = v[0]
    k = v[1]
    for j in range(k):
        a[u - 1][v[2 + j] - 1] = 1

d = [0] * n
f = [0] * n
isDiscovered = [False] * n
time_stamp = 0

def dfs(x):
    global time_stamp
    isDiscovered [x] = True
    time_stamp = time_stamp + 1
    d[x] = time_stamp
    for i in range(n):
        if a[x][i] == 1 and isDiscovered[i] == False:
            dfs(i)
    time_stamp = time_stamp + 1
    f[x] = time_stamp

for i in range(n):
    if isDiscovered[i] == False:
        dfs(i)

for i in rane(n):
    print(i+1, d[i], f[i])

### FIXED CODE ###

n = int(input())
a = [[] for i in range(n)]

for i in range(n):
    v = list(map(int, input().split()))
    u = v[0] - 1
    for j in v[2:]:
        a[u].append(j-1)

d = [0] * n
f = [0] * n
isDiscovered = [False] * n
time_stamp = 0

def dfs(x):
    global time_stamp
    isDiscovered [x] = True
    time_stamp += 1
    d[x] = time_stamp
    for i in a[x]:
        if not isDiscovered[i]:
            dfs(i)
    time_stamp += 1
    f[x] = time_stamp

for i in range(n):
    if not isDiscovered[i]:
        dfs(i)

for i in range(n):
    print(i+1, d[i], f[i])
def main():
    N, K = map(int, input().split())
    td = []
    for _ in range(N):
        ti, di = map(int, input().split())
        td.append([ti, di])
    td.sort(key=lambda x: -x[1])
    num = 0
    kind = set()
    changable = []
    for i in range(K):
        num += td[i][1]
        if td[i][0] in kind:
            changable.append(td[i][0])
        else:
            kind.add(td[i][0])
    num += len(kind) ** 2
    ans = num

    for i in range(K, N):
        if not changable:
            break
        if td[i][0] not in kind:
            num += td[i][1] + 2 * len(kind) + 1 - changable.pop()
            kind.add(td[i][0])
            ans = max(ans, num)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    AB, BC, CA = map(int, input().split())
    print(int(AB * BC / 2))


if __name__ == "__main__":
    main()
a,b,c = map(int, input().split())
t = a % b
if t==c:
  print("YES")
  exit()
if t == 0 and c != 0:
  print("NO")
elif t==0 and c==0:
  print("YES")
else:
  for i in range(b):
    t*=(a%b)
    if t%b==c:
      print("YES")
   	  exit()
  print("NO")
    

### FIXED CODE ###

a,b,c=map(int, input().split())
r=0
i=0
while 1:
    r+=a
    if r>=a*b:
        print("NO")
        exit()
    else:
        if r%b==c:
            print("YES")
            exit()
N = int(input())

if N <= 999:
  print("ABC")
else:
  pritn("ABD")

### FIXED CODE ###

N = int(input())

if N <= 999:
  print("ABC")
else:
  print("ABD")
import numpy as np

antennas = []

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

k = int(input())

available = True

for send in range(5):
  if not available:
    break
  for receive in range(5):
    if antennas[receive] - antennas[send] > k:
      available = False
      break

if available:
  print("Yay!")
else:
  print(":(")


### FIXED CODE ###

antennas = []

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

k = int(input())

available = True

for send in range(5):
  if not available:
    break
  for receive in range(5):
    if antennas[receive] - antennas[send] > k:
      available = False
      break

if available:
  print("Yay!")
else:
  print(":(")
s = input()
m = int(input())

c = []

if len(s) < 100:

    for i in range(len(s)):
        for k in range(1,len(s)+1):
            c.append(s[i:i+k])

    b = sorted(list(set(c)))

    print(b[m-1])

else:
    po = []
    for i in range(len(s)):
        if s[i] not in po:
            po.append(s[i])

    for i in range(len(s)):
        if s[i:i+2] not in po:
            po.append(s[i:i+2])

    for i in range(len(s)):
        if s[i:i+3] not in po:
            po.append(s[i:i+3])
    print(po[m-1])


### FIXED CODE ###

s = input()
m = int(input())

c = []


for i in range(len(s)):
    for k in range(1,m+1):
        c.append(s[i:i+k])

b = sorted(list(set(c)))


print(b[m-1])
n,ma,mb = map(int,input().split())
L = []
for i in range(n):
    a,b,c = map(int,input().split())
    L.append([a,b,c])
dp = [[10**5]*401 for i in range(401)]
make = [[0,0],[L[0][0],L[0][1]]]
dp[L[0][0]][L[0][1]] = L[0][2]
dp[0][0] = 0
for i in range(1,n):
    a = L[i][0]
    b = L[i][1]
    c = L[i][2]
    for j in range(len(make)):
        t = make[j][0]
        u = make[j][1]
        dp[t+a][u+b] = min(dp[t][u]+c,dp[t+a][u+b])
        make.append([t+a, u+b])
    make = list(set(make))
if ma <= mb:
    cnt = 1
    ans = 10**5
    while mb*cnt <= 400:
        ans = min(ans, dp[ma*cnt][mb*cnt])
        cnt += 1
    if ans == 10**5:
        print(-1)
    else:
        print(ans)
else:
    cnt = 1
    ans = 10**5
    while ma*cnt <= 400:
        ans = min(ans, dp[ma*cnt][mb*cnt])
        cnt += 1
    if ans == 10**5:
        print(-1)
    else:
        print(ans)


### FIXED CODE ###

A,B = map(int,input().split())
if (A == 1):
  if (B == 1):
    print('Draw')
  else:
    print('Alice')
else:
  if (B == 1):
    print('Bob')
  elif (A == B):
    print('Draw')
  elif (A > B):
    print('Alice')
  else:
    print('Bob')
a, b = map(int,raw_inpu().split())
if a < b:
	print 'a < b'
elif a > b:
	print 'a > b'
else:
	print 'a == b'

### FIXED CODE ###

a, b = map(int,raw_input().split())
if a < b:
	print 'a < b'
elif a > b:
	print 'a > b'
else:
	print 'a == b'
x,a = map(int,input().split())

if x <a:
    print(o)
else:
    print(10)

### FIXED CODE ###

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

if x <a:
    print(0)
else:
    print(10)
S = int(input())
W = int(input())
if S <= W : print("unsafe")
else: print("safe")

### FIXED CODE ###

S, W = map(int,input().split())
if S <= W :
  print("unsafe")
else:
  print("safe")
n,m=map(int, input().split())  #複数数値入力

list_a = []
for i in range(m):
    list_a.append(int(input()))
    
def countWays_memo(n):
    memo = [-1]*(n+1)
    def _countWays(n):
        if n < 0:
            return 0
        elif n == 0:
            return 1
        else:
            if memo[n] > -1:
                return memo[n]
            else:
                memo[n] = _countWays(n-1) + _countWays(n-2) 
                return memo[n]
    return _countWays(n)

steps = []
now_step = -1
for i in range(len(list_a)):
    steps.append(list_a[i]-now_step-2)
    now_step = list_a[i]
steps.append(n-now_step-1)

if steps[0] == 0:
    steps[0] = 1

dict_steps = {}
for s in set(steps):
    if s == 0:
        print(0)
    else:
        dict_steps[s] = steps.count(s)

ans = 1
for k,v in dict_steps.items():
    ans *= countWays_memo(k)**v
    
if steps.count(0) == 0:
    print(ans% 1000000007)

### FIXED CODE ###

n,m=map(int, input().split())  #複数数値入力

import sys

sys.setrecursionlimit(10**9)

def countWays_memo(n):
    memo = [-1]*(n+1)
    def _countWays(n):
        if n < 0:
            return 0
        elif n == 0:
            return 1
        else:
            if memo[n] > -1:
                return memo[n]
            else:
                memo[n] = _countWays(n-1) + _countWays(n-2) 
                return memo[n]
    return _countWays(n)
    
if m == 0:
    print(countWays_memo(n)% 1000000007)
else:
    list_a = []
    for i in range(m):
        list_a.append(int(input()))

    steps = [list_a[0]]
    now_step=list_a[0]+1
    for i in range(len(list_a)-1):
        steps.append(list_a[i+1]-now_step)
        now_step = list_a[i+1]+1
    steps.append(n-now_step+1)


    dict_steps = {}
    for s in set(steps):
        dict_steps[s] = steps.count(s)

    ans = 1
    for k,v in dict_steps.items():
        ans *= countWays_memo(k-1)**v

    print(ans% 1000000007)
N = int(input())
import math
ans = 0
for k in range(1, int(math.sqrt(N) + 1)):
    # print(k - 1, N // k - 1)
    m = N // k - 1
    if N % k == 0 and N // m == N % m:
        ans += m

print(ans)


### FIXED CODE ###

N = int(input())
import math
ans = 0
for k in range(1, int(math.sqrt(N) + 1)):
    # print(k - 1, N // k - 1)
    m = N // k - 1
    if m != 0:
        if N % k == 0 and N // m == N % m:
            ans += m

print(ans)
import math

A,B,C,D = map(int, input().split())
B_C = B // C
B_D = B // D
g = math.gcd(C,D)
l = C * D / g
duplicate_B = B // l
answer_B = B - B_C - B_D + duplicate_B

A_C = (A - 1) // C
A_D = (A - 1) // D
duplicate_A = (A - 1) // l
answer_A = (A - 1) - A_C - A_D + duplicate_A
print(int(answer_B - answer_A))


### FIXED CODE ###

def gcd(x, y):
    while y > 0:
        x, y = y, x%y
    return x

A,B,C,D = map(int, input().split())
B_C = B // C
B_D = B // D
g = gcd(C,D)
l = C * D // g
duplicate_B = B // l
answer_B = B - B_C - B_D + duplicate_B

A_C = (A - 1) // C
A_D = (A - 1) // D
duplicate_A = (A - 1) // l
answer_A = (A - 1) - A_C - A_D + duplicate_A
print(int(answer_B - answer_A))
import math

r = int(input())

s = r * r * math.pi
l = 2 * r * math.pi

print(s, end = " ")
print(l)

### FIXED CODE ###

r = float(input())

s = r * r * 3.14159265358979
l = 2 * r * 3.14159265358979
 
print(s, end = " ")
print(l)
n = int( input() )
p = map(int, input().split())
q = map(int, input().split())

import math

a=0
for i in range(n-1):
  a = a + (p[i]-1) * math.factorial(n-1-i)
  
b=0
for i in range(n-1):
  b = b + (p[i]-1) * math.factorial(n-1-i)
  
print( abs(a-b) )


### FIXED CODE ###

from itertools import permutations
n=int(input())
v=list(permutations(range(1,n+1),n))
print(abs(v.index(tuple(map(int,input().split())))-v.index(tuple(map(int,input().split())))))