Harryxun/stf_run huggingface dataset:
1inport sys
for i in sys.stdin.readlines():
        a, b = i.strip().split()
        if a == "0" and b == "0":
                break;

        if int(a) < int(b):
                print("{} {}".format(a,b))
        else:
                print("{} {}".format(b,a))
        

### FIXED CODE ###

import sys
for i in sys.stdin.readlines():
        a,b = i.strip().split()
        if a == "0" and b == "0":
                break

        if int(a) < int(b):
                print("{0} {1}".format(a,b))
        else:
                print("{1} {0}".format(a,b))
S = input()
K = int(input())
flg = True
for i in range(K):
    if 100 <= i:
        break
    if S[i] != '1':
        flg = False
if flg:
    print('1')
    exit()
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()
print('1')

### FIXED CODE ###

S = input()
K = int(input())
flg = True
for i in range(K):
    if len(S) <= i:
        break
    if S[i] != '1':
        flg = False
if flg:
    print('1')
    exit()
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()
print('1')
S = input()

count = 0
for i in range(len(S)):
    if S[i] == 'W':
        continue
    else:
        break
S = S[i:]

count = 0
score = 0
for i in range(len(S))
    if S[i] == 'W':
        score += (i - count)
        count += 1
print(score)

### FIXED CODE ###

S = input()

count = 0
for i in range(len(S)):
    if S[i] == 'W':
        continue
    else:
        break
S = S[i:]

count = 0
score = 0
for i in range(len(S)):
    if S[i] == 'W':
        score += (i - count)
        count += 1
print(score)
from math import gcd

n, x = map(int, input().split())
town = list(map(int, input().split()))

res = abs(town[0] - x)
for t in town[1:]:
    d = abs(t - x)
    res = gcd(res, d)

print(res)

### FIXED CODE ###

from fractions import gcd
from functools import reduce

n, x = map(int, input().split())
town = map(int, input().split())

dist = map(lambda y: abs(x - y), town)
res = reduce(gcd, dist)
print(res)
a,b = map(int,input().split())
S = [list(map(int,input().split())) for i in range(a)]
CP = [list(map(int,input().split())) for i in range(a)]


for s in S:
  count = 0
  ab = 10**8
  p = 10**8
  for cp in CP:
    total = abs(s[0]-cp[0]) + abs(s[1]-cp[1])
    count +=1
    if ab > total:
      ab = total
      p = count
  print(p)

### FIXED CODE ###

a,b = map(int,input().split())
S = [list(map(int,input().split())) for i in range(a)]
CP = [list(map(int,input().split())) for i in range(b)]
for s in S:
  count = 0
  ab = 10**9
  p = 10**9
  for i,cp in zip(range(b),CP):
    total = abs(s[0]-cp[0]) + abs(s[1]-cp[1])
    count +=1
    if ab > total:
      ab = total
      p = i+1
      
  print(p)
import math

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

N, M = map(int, input().split())
S = input()
T = input()
L = lcm(N , M)
x = [""] * (L + 1)
for i in range(N):
    idx = i * (L // N)
    x[idx] = S[i]
for i in range(M):
    idx = i * (L // M)
    if x[idx] != "" and x[idx] != T[i]:
        print(-1)
        exit()
print(L)


### FIXED CODE ###

import math

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

N, M = map(int, input().split())
S = input()
T = input()
L = lcm(N , M)
x = {}
for i in range(N):
    idx = i * (L // N)
    x[idx] = S[i]
for i in range(M):
    idx = i * (L // M)
    if idx in x and x[idx] != T[i]:
        print(-1)
        exit()
print(L)
num = input().split()
if int(num[0])<int(num[1]):
    x = int(num[1])
    y = int(num[0])
else:
    x = int(num[0])
    y = int(num[1])

end = 0
    
z = x % y
while True:
    z1 = y % z
    y1 = z
    if z1 == 0:
        print(z)
        break 
    z = z1
    y = y1    

### FIXED CODE ###

num = input().split()
if int(num[0])<int(num[1]):
    x = int(num[1])
    y = int(num[0])
else:
    x = int(num[0])
    y = int(num[1])

end = 0
    
z = x % y
if z == 0:
    print(y)
else:
    while True:
        z1 = y % z
        y1 = z
        if z1 == 0:
            print(z)
            break 
        z = z1
        y = y1
N,X = map(int,input().split())
l = list(map(int,input().split()))

pos = 0

for i in range(N+1):
    pos = pos + l[i]

    if pos > X:
        print(i+1)
        exit()

print(i+1)



### FIXED CODE ###

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

pos = 0
cnt = 1

for i in range(N):
    pos += l[i]

    if pos <= X:
        cnt += 1
    else:
        break

print(cnt)
r = int(input())
print(R*2*3.14)

### FIXED CODE ###

r = int(input())
print(r*2*3.141592653589793238462643383279502884197169399375105820974944592307816406286)
n.k=map(int,input().split())
lis=list(map(int,input().split()))

ans=0
for i in range(k):
  mi=min(lis)
  ans+=mi
  lis.remove(mi)
  
print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
lis=list(map(int,input().split()))

ans=0
for i in range(k):
  mi=min(lis)
  ans+=mi
  lis.remove(mi)
  
print(ans)
mycode = '''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。

ctypedef long long LL

cdef extern int __builtin_popcount(unsigned int) nogil

import numpy as np

import sys
readline = sys.stdin.buffer.readline
read = sys.stdin.readline #文字列読み込む時はこっち


cdef ints(): return np.fromstring(readline(), sep=' ', dtype=np.int64)


cdef read_matrix(LL H,LL W):
    #return np.ndarray shape=(H,W) matrix
    lines=[]
    cdef LL _
    for _ in range(H): 
        lines.append(read())
    lines=' '.join(lines) #byte同士の結合ができないのでreadlineでなくreadで
    return np.fromstring(lines, sep=' ',dtype=np.int64).reshape(H,W)

# この問題をあえてグラフの構造を持つことで解く
from libcpp.vector cimport vector as vec

cdef LL N,M
N,M=ints()
AB=read_matrix(M,2)-1
cdef LL a,b

ctypedef vec[vec[LL]] Graph
cdef Graph graph=Graph(N)

for a,b in AB:
    graph[a].push_back(b)
    graph[b].push_back(a)

cdef vec[int] ans
for i in range(N):
    ans.push_back(graph[i].size())
print(*ans, sep='\n')
'''

import sys
import os
if sys.argv[-1] == 'ONLINE_JUDGE':  # コンパイル時
    with open('mycode.pyx', 'w') as f:
        f.write(mycode)
    os.system('cythonize -i -3 -b mycode.pyx')

import mycode


### FIXED CODE ###

mycode = '''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。

ctypedef long long LL

cdef extern int __builtin_popcount(unsigned int) nogil

import numpy as np

import sys
readline = sys.stdin.buffer.readline
read = sys.stdin.readline #文字列読み込む時はこっち


cdef ints(): return np.fromstring(readline(), sep=' ', dtype=np.int64)


cdef read_matrix(LL H,LL W):
    #return np.ndarray shape=(H,W) matrix
    lines=[]
    cdef LL _
    for _ in range(H): 
        lines.append(read())
    lines=' '.join(lines) #byte同士の結合ができないのでreadlineでなくreadで
    return np.fromstring(lines, sep=' ',dtype=np.int64).reshape(H,W)

# この問題をあえてグラフの構造を持つことで解く
from libcpp.vector cimport vector as vec

cdef LL N,M
N,M=ints()
AB=read_matrix(M,2)-1
cdef LL a,b

ctypedef vec[vec[LL]] Graph
cdef Graph graph=Graph(N)

for a,b in AB:
    graph[a].push_back(b)
    graph[b].push_back(a)

cdef vec[int] ans
for i in range(N):
    ans.push_back(graph[i].size())
print(*ans, sep='\\n')
'''

import sys
import os
if sys.argv[-1] == 'ONLINE_JUDGE':  # コンパイル時
    with open('mycode.pyx', 'w') as f:
        f.write(mycode)
    os.system('cythonize -i -3 -b mycode.pyx')

import mycode
n,m=map(int,input().split())
c=[]
d=[]
for _ in range(m):
  a,b=map(int,input().split())
  if a==1:
    c.append(b)
  elif b==n:
    d.append(a)
if len(c&d)!=0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

### FIXED CODE ###

n,m=map(int,input().split())
c=[]
d=[]
for _ in range(m):
  a,b=map(int,input().split())
  if a==1:
    c.append(b)
  elif b==n:
    d.append(a)
if len(set(c)&set(d))!=0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
import math

A, B, C, D = [int(i) for i in input().split()]

lcm = (C*D)/math.gcd(A, D)
A = A-1

if A == 0:
	t1 = 0
else:
	t1 = A - (A/C + A/D - A/lcm)

t2 = B - (B/C + B/D - B/lcm)
print(int(t2 - t1))


### FIXED CODE ###

import fractions

A, B, C, D = [int(i) for i in input().split()]

lcm = (C*D)//fractions.gcd(C,D)
A = A-1
t1 = A - (A//C + A//D - A//lcm)
t2 = B - (B//C + B//D - B//lcm)
print(int(t2 - t1))
a,b=map(int,input().split())
one=a//b
two=a%b
three=a/b
print(a//b,a%b,"{:three}".format(three))


### FIXED CODE ###

a, b = map(int, input().split())
  
d = int(a / b)
r = a % b
f = a / b
  
print(d, r,"{:f}".format(f))
from sys import stdin
import itertools
N,A,B,C=[int(x) for x in stdin.readline().rstrip().split()]
data=[]

for i in range(N):
    data.append(int(input()))
target=[A,B,C]

ans=0

if A in data:
    data.remove(A)
    target.remove(A)

if B in data:
    data.remove(B)
    target.remove(B)
    
if C in data:
    data.remove(C)
    target.remove(C)

if target==[]:
    print(ans)

else:
    for k in sorted(target):
        sa=float("inf")
        for l in range(1,len(data)):
            for j in itertools.combinations(data,l):
                if abs(k-sum(j)) < sa:
                    sa= abs(k-sum(j))
                    ansj=j
        if len(ansj)==1:
            ans+=sa
        else:
            ans=ans+sa+10*(len(ansj)-1)
        for m in ansj:
            data.remove(m)
    print(ans)

### FIXED CODE ###

from sys import stdin
import itertools

def get_index(l,x):
    return [i for i, _x in enumerate(l) if _x == x]

N,A,B,C=[int(x) for x in stdin.readline().rstrip().split()]
data=[]
for i in range(N):
    data.append(int(input()))
target=[A,B,C]

ans=float("inf")
for j in (list(itertools.product(["none","A","B","C"],repeat=N))):
    if set(j) >= {"A","B","C"}:
        score=(j.count("A")-1)*10 + (j.count("B")-1)*10 + (j.count("C")-1)*10
        score_a=sum([data[k] for k in (get_index(j,"A"))])
        score_b=sum([data[l] for l in (get_index(j,"B"))])
        score_c=sum([data[m] for m in (get_index(j,"C"))])
        score=abs(A-score_a)+abs(B-score_b)+abs(C-score_c)+score
        if score < ans:
            ans=score
print(ans)
import sys
input = sys.stdin.readline

MOD = 10**9+7

class Comb:
    def __init__(self, N):
        self.fac = [1] * (N+1)
        for i in range(2, N+1): self.fac[i] = self.fac[i-1] * i % MOD

    def pow(self, a, b):
        res = 1
        while b:
            if b & 1: res = res * a % MOD
            a = a**2 % MOD
            b >>= 1
        return res

    def comb(self, n, r):
        if r < 0 or r > n: return 0
        return (self.fac[n] * self.pow(self.fac[r], MOD-2)) % MOD * self.pow(self.fac[n-r], MOD-2) % MOD

    def permutation(self, n, r):
        return self.fac[n] * self.pow(self.fac[n-r], MOD-2) % MOD

def dfs(par, chi, d):
    global ans, comb
    
    r = len(g[chi])-1
    if d == 0: k = K-1; r += 1
    else: k = K-2

    ans = ans * comb.permutation(k, r) % MOD
    for c in g[chi]:
        if c == par: continue
        dfs(chi, c, d+1)


N, K = list(map(int, input().split()))
g = [[] for i in range(N+1)]
ans = K

for i in range(N-1):
    a, b = list(map(int, input().split()))
    g[a].append(b)
    g[b].append(a)

comb = Comb(K)

dfs(-1, 1, 0)

print(ans%MOD)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import *

MOD = 10**9+7

class Comb:
    def __init__(self, N):
        self.fac = [1] * (N+1)
        for i in range(2, N+1): self.fac[i] = self.fac[i-1] * i % MOD

    def pow(self, a, b):
        res = 1
        while b:
            if b & 1: res = res * a % MOD
            a = a**2 % MOD
            b >>= 1
        return res

    def comb(self, n, r):
        if r < 0 or r > n: return 0
        return (self.fac[n] * self.pow(self.fac[r], MOD-2)) % MOD * self.pow(self.fac[n-r], MOD-2) % MOD

    def permutation(self, n, r):
        return self.fac[n] * self.pow(self.fac[n-r], MOD-2) % MOD

def main():
    N, K = list(map(int, input().split()))
    g = [[] for i in range(N+1)]
    ans = K

    for i in range(N-1):
        a, b = list(map(int, input().split()))
        g[a].append(b)
        g[b].append(a)

    comb = Comb(K)

    q = deque([(-1, 1)])
    while q:
        par, chi = q.pop()
        r = len(g[chi])-1
        if par == -1: k = K-1; r += 1
        else: k = K-2
        if k < r: ans = 0; break

        ans = ans * comb.permutation(k, r) % MOD
        for c in g[chi]:
            if c != par: q.append((chi, c))

    print(ans%MOD)
    
if __name__ == '__main__':
    main()
s = int(input())

x = []
for i in range(len(s) - 2):
    x.append(abs(int(x[i:i+3]) - 753))
    
print(min(x))

### FIXED CODE ###

s = list(str(input()))
m = []
for i in range(len(s)-2):
    x = s[i:i+3]
    a = 0
    a = int("".join(x))
    x = s
    m.append(abs(753-a))
print(min(m))
s=input()
k=int(input())
i=0
while s[i]=='1':
  i+=1
if k<=i or i==len(s):
  print(1)
else:
  print(s[i])

### FIXED CODE ###

s=input()
k=int(input())
i=0
while i<len(s) and s[i]=='1':
  i+=1
if k<=i or i==len(s):
  print(1)
else:
  print(s[i])
import numpy as np

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

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

scores = np.array(scores)
signs = [-1, 1]
answer = 0
for sign_k in signs:
    kireisa = sign_k
    for sign_o in signs:
        oishisa = sign_o
        for sign_n in signs:
            ninki = sign_n

            kireisa_score = scores[:, 0] * kireisa
            oishisa_score = scores[:, 1] * oishisa
            ninki_score = scores[:, 2] * ninki

            sorted_score = np.stack((kireisa_score, oishisa_score, ninki_score), axis=1)
            sums = [sum(s) for s in sorted_score]

            sums.sort()
            sums.reverse()
            if sum(sums[:M]) > answer:
                answer = sum(sums[:M])

print(answer)


### FIXED CODE ###

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

for i in range(16):
    if i % 2 == 0 and A > 0:
        A -= 1
    elif i % 2 == 1 and B > 0:
        B -= 1

if A == 0 and B == 0:
    print('Yay!')
else:
    print(':(')
a = input().split()
x =0
y =0
for i in range(len(a)):
  if len(a[i]) = 5:
    x = x+1
  if len(a[i]) = 7:
    y = y+1
if x =2 and y=1:
  print(YES)
else:
  print(NO)
    

### FIXED CODE ###

a = list(map(int,input().split()))
b = 0
c = 0
for i in a:
  if i == 7:
    b += 1
  elif i == 5:
    c += 1
 
if b == 1 and c == 2:
  print("YES")
else:
  print("NO")
N,K=map(int,input().split())
A=list(map(int,input().split()))
l,r=0,10**9+1
while r-l>1:
    t=(l+r)//2
    k=sum([(a+t-2)//(t-1)-1 for a in A])
    if K<k:
        l=t
    else:
        r=t
print(l)

### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
l,r=1,10**9+1
while r-l>1:
    t=(l+r)//2
    k=sum([(a+t-2)//(t-1)-1 for a in A])
    if K<k:
        l=t
    else:
        r=t
print(l)
n,k=map(int,input().split())
c=sorted(list(map(int,input().split())))
if k>n:
  print(0)
else:
  print(sum(c[:n-k])

### FIXED CODE ###

n,k=map(int,input().split())
if n==0:
  print(0)
else:
  c=sorted(list(map(int,input().split())))
  if k>=n:
    print(0)
  else:
    print(sum(c[:n-k]))
i,o,t,j,l,s,z=map(int,input().split())
ans=0
if i==0 or j==0 or l==0:
  ans+=o+(i//2)*2+min(j,l)*2
else:
  ans+=o+(i//2)*2+min(j,l)*2
  ans1=o+((i-1)//2)*2+max(0,min(j-1.l-1))*2
print(ans)

### FIXED CODE ###

i,o,t,j,l,s,z=map(int,input().split())
ans=0
if i==0 or j==0 or l==0:
  ans+=o+(i//2)*2+(j//2)*2+(l//2)*2
else:
  ans+=o+(i//2)*2+(j//2)*2+(l//2)*2
  ans1=o+((i-1)//2)*2+((j-1)//2)*2+((l-1)//2)*2+3
  ans=max(ans,ans1)
print(ans)
from collections import Counter
n, p = map(int, input().split( ))
s = input()
#n,p = 10000,7
#s = "1"*10000
#p=2,5は例外
#例外でなければ累積和
if p==2:
    ans = 0
    for i in range(n):
        if int(s[i])%2==0:
            ans += i+1
    print(ans)
    exit()
if p==5:
    for i in range(n):
        if int(s[i])%5==0:
            ans += i+1
    print(ans)
    exit()


accm = [0]
s = s[::-1]
sm = 0
beki_p = 1
for i in range(n):
    sm += int(s[i])*beki_p
    sm %=p
    accm.append(sm)
    beki_p *=10
    beki_p%=p

aC = Counter(accm)
ans = 0
for k in aC:
    ans += aC[k]*(aC[k]-1)//2
print(ans)


### FIXED CODE ###

from collections import Counter
n, p = map(int, input().split( ))
s = input()
#n,p = 10000,5
#s = "7"*10000
#p=2,5は例外
#例外でなければ累積和
if p==2:
    ans = 0
    for i in range(n):
        if int(s[i])%2==0:
            ans += i+1
    print(ans)
    exit()
if p==5:
    ans=0###
    for i in range(n):
        if int(s[i])%5==0:
            ans += i+1
    print(ans)
    exit()


accm = [0]
s = s[::-1]
#print(s)
sm = 0
beki_p = 1
for i in range(n):
    sm += int(s[i])*beki_p
    sm %=p
    accm.append(sm)
    beki_p *=10
    beki_p%=p

aC = Counter(accm)
ans = 0
for k in aC:
    ans += aC[k]*(aC[k]-1)//2
print(ans)
s=input()
#s="whbrjpjyhsrywlqjxdbrbaomnw"
minCost=len(s)
for char in char_set:
    m=max([len(_) for _ in s.split(char)])
    if m<minCost:
        minCost=m
print(minCost)

### FIXED CODE ###

s=input()
#s="whbrjpjyhsrywlqjxdbrbaomnw"
minCost=len(s)
char_set=set(s)
for char in char_set:
    m=max([len(_) for _ in s.split(char)])
    if m<minCost:
        minCost=m
print(minCost)
def dfs(v, c, total):
	if color[v] != -1:
		return
	color[v] = c
	for x in glaph[v]:
		u, w = x[0], x[1]
		total+=w
		if total%2 == 0:
			dfs(u, c, total)
		else:
			dfs(u, 1-c, total)
			
n = int(input())
glaph = [[]*n for _ in range(n)]
color = [-1]*n

for _ in range(n-1):
	u,v,w = map(int, input().split())
	glaph[u-1].append((v-1, w))
	glaph[v-1].append((u-1, w))	

dfs(v=0, c=0, total=0)
#for i in range(n):
#	print(i, glaph[i])
for i in color:
	print(i)

### FIXED CODE ###

import sys
sys.setrecursionlimit(pow(10, 7))

def dfs(v, c, parent):
	color[v] = c
	for x in glaph[v]:
		u, w = x[0], x[1]
		if color[u] != -1:
			continue
		if w%2 == 0:
			dfs(u, c, v)
		else:
			dfs(u, 1-c, v)
			
n = int(input())
glaph = [[]*n for _ in range(n)]
color = [-1]*n

for _ in range(n-1):
	u,v,w = map(int, input().split())
	glaph[u-1].append((v-1, w))
	glaph[v-1].append((u-1, w))	

dfs(v=0, c=0, parent=0)
#for i in range(n):
#	print(i, glaph[i])
for i in color:
	print(i)
import sys


def rec(i):
    #if(i==0):print(i,H[i])
    #if(i>=1):print(i,H[i],H[i-1])
    #if(i>=2):print(i,H[i],H[i-2])
    #print(i)
    if (dp[i] < float('inf')): return dp[i]
    if(i==0): return 0

    res = float('inf')
    res = rec(i-1)+abs(H[i]-H[i-1])
    if(i==1): return res

    calc = rec(i-2)+abs(H[i]-H[i-2])
    if(res > calc):
        res = calc

    dp[i] = res

    return res

N = int(input())
H = list(map(int,input().split()))
dp = [float('inf')]*N

#print(N)
#print(H)

print(rec(N-1))

#7
#2 9 4 5 1 6 10


### FIXED CODE ###

import sys


N = int(input())

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

dp = [float('inf')]*N

dp[0] = 0
#print(N)
#print(H)
#print(dp)


for i in range(1,N):
    if(i==1):
        dp[1] = abs(H[1]-H[0])
    else:
        dp[i] = dp[i-1]+abs(H[i]-H[i-1])
        if(dp[i] > dp[i-2]+abs(H[i]-H[i-2])):
            dp[i] = dp[i-2]+abs(H[i]-H[i-2])
        #
        #print(i,dp)

print(dp[-1])

#7
#2 9 4 5 1 6 10
x = int(input())
import math
y = int(math.sqrt(x)) - 2
for i in range(y,y+5):
    if i ** 2 <= x and (i + 1)** 2 > x and i > 0:
        print(i ** 2)
 


### FIXED CODE ###

a, b, c, d = map(int, input().split())
if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) < d):
    print("Yes")
else:
    print("No")
# @author 

import sys

class DBlueAndRedBalls:
    def solve(self):
        MOD = 10 ** 9 + 7
        MAX_N = 2001
        C = [[0] * MAX_N for _ in range(MAX_N)]
        for i in range(MAX_N):
            C[0][i] = 1
        for i in range(1, MAX_N):
            C[i][i] = 1
            for j in range(i + 1, MAX_N):
                C[i][j] = (C[i][j - 1] + C[i - 1][j - 1]) % MOD

        n, k = [int(_) for _ in input().split()]
        ans = [0] * (k + 1)
        if n == k:
            for i in range(k):
                ans[i] = 1
        ans[1] = n - k + 1
        for i in range(2, min(n - k + 1, k) + 1):
            ans[i] = (C[i - 1][k - 1] * C[i - 1 - 1][n - k - 1] +
                      2 * (sum(C[i - 1][k - 1] * C[i - 1 - 1][n - k - ext - 1] for ext in range(1, n - k - i + 1 + 1))) +
                      sum((ext - 1) * C[i - 1][k - 1] * C[i - 1 - 1][n - k - ext - 1] for ext in range(2, n - k - i + 1 + 1))) % MOD

        for x in ans[1:]:
            print(x)

solver = DBlueAndRedBalls()
input = sys.stdin.readline

solver.solve()


### FIXED CODE ###

# @author 

import sys

class AFiftyFifty:
    def solve(self):
        s = list(input().strip())
        s.sort()
        print("Yes" if (s[0] == s[1] and s[2] == s[3] and s[0] != s[2]) else "No")


solver = AFiftyFifty()
input = sys.stdin.readline

solver.solve()
NM = list(map(int, input().split()))
#NM = [5,2]
#A = [[1,4], [2,5]]
b = list(map(int, input().split()))
#b = [[1,4]]
for i in range(NM[1]-1):
	ab = list(map(int, input().split()))
#	ab = A[i]
	flag = 1
	for i in range(len(b)):
		if (b[i][1] >= ab[0] and b[i][0] <= ab[0] ):
			b[i][0] = ab[0]
			flag = 0
			break
		if(b[i][0] <= ab[1] and b[i][1] >= ab[1]):
			b[i][1] = ab[1] 
			print("he")
			flag = 0
			break
		if (flag):
			print("here")
			b.append(ab)
			flag = 1

#print(b)
print(len(b))

### FIXED CODE ###

N, M = map(int, input().split())
claim = []
for i in range(M):
	claim.append(list(map(int, input().split())))
claim.sort(key=lambda a:a[1])

ans = 0
inter = [-1,-1]
for land in claim:
    if inter[1] <= land[0]:
        inter = land
        ans += 1
print(ans)
from collections import deque

m, k = [int(i) for i in input().split()]

if k >= 2 ** m:
    print(-1)
    exit()

if k == 0:
    q = deque([])
    for i in range(2 ** m):
        q.append(i)
        q.appendleft(i)
    print(*q)
    exit()


S = set(i for i in range(2 ** m))

q = deque([0, k])
S.remove(0)
S.remove(k)

for i in range(m):
    if (k >> i) & 1:
        t = 1 << i
        if not t in:
            if t + 1 in S:
                t += 1
            else:
                print(-1)
                exit()
        q.append(t)
        q.appendleft(t)
        S.remove(t)

q.appendleft(0)
q.append(k)

for s in S:
    q.appendleft(s)
    q.append(s)

print(*q)


### FIXED CODE ###

from collections import deque

m, k = [int(i) for i in input().split()]

if k >= 2 ** m:
    print(-1)
    exit()

if k == 0:
    q = deque([])
    for i in range(2 ** m):
        q.append(i)
        q.appendleft(i)
    print(*q)
    exit()

if m == 1 and k == 1:
    print(-1)
    exit()

S = set(i for i in range(2 ** m))

q = deque([0, k])
S.remove(0)
S.remove(k)

for s in S:
    q.appendleft(s)
    q.append(s)

q.appendleft(0)
q.append(k)

print(*q)
A=[int(i) for i ininput().split()]
A.sort()
print(A[2]-A[0])

### FIXED CODE ###

A=[int(i) for i in input().split()]
A.sort()
print(A[2]-A[0])
c = 0
r = []
for i in input():
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
if not len(r):
  print(c)
else:
  print(max(c))

### FIXED CODE ###

c = 0
r = []
for i in input():
  if i=='R':
    c+=1
  else:
    r.append(c)
    c = 0
r.append(c)
if not len(r):
  print(c)
else:
  print(max(r))
a, b = input().split()
a= int(a)
b = int(b)
if a in range(1,9);
 if b in range(1,9)
  print(a*b)
else:
  print("-1")


### FIXED CODE ###

import sys
a, b = map(int, input().split())
k = range(1,10)
if a in k:
 if b in k:
  print(a*b)
  sys.exit()
 else:
  pass
print("-1")