peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
try:
    s = input()
    t = input()
    s_ = sorted(s)
    t_ = sorted(t, reverse=True)
    print(s_)
    print(t_)
    print('No' if s_>t_ else 'Yes')
except EOFError:
    pass
# Judge status: Accepted
n,t = map(int,input().split())
li = []
for i in range(n):
    a,b = map(int,input().split())
    if b <= t:
        li.append(a)
if len(li) >= 1:
    print(min(li))
else:
    print("TLE")
# Judge status: Accepted
a, b = map(int, input().split())
if b<a:
    print(a-1)
else:
    print(a)
# Judge status: Accepted
import math
x = int(input())
d = math.gcd(360, x)
print(360//d)
# Judge status: Wrong Answer
import itertools
import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    hoge = tuple(map(int, input().split()))
    sumn = 0
    for pair in list(itertools.combinations(hoge, 2)):
        sumn += (pair[0] * pair[1])
    print(sumn)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
# coding: utf-8

N = int(input())
S = input()

# ruisekiwa ba-jon

ruiseki_w = [0] * (N + 1)
ruiseki_e = [0] * (N + 1)

for i in range(0, len(S)):
    ruiseki_w[i+1] = ruiseki_w[i] + S[i].count("W")
    ruiseki_e[i+1] = ruiseki_e[i] + S[i].count("E")

res = 10**10
for i in range(1, len(S)):
    res = min(ruiseki_w[i-1] - ruiseki_w[0] + ruiseki_e[-1] - ruiseki_e[i+1], res)
print(res)
# Judge status: Accepted
N=int(input())
S=N//100
if N<=S*100+S*10+S:
    print(S*100+S*10+S)
else:
    print((S+1)*100+(S+1)*10+S+1)
# Judge status: Accepted
n = int(input())
for i in range(1, 10):
    for j in range(1, 10):
        if i * j == n:
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
# 幅優先探索（行きがけ）
import collections
import sys
import copy
import re


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    s = S()
    if s.isupper():
        print("A")
    else:
        print("a")


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a = int(input())
ans = a+a*2+a*3
print(ans)
# Judge status: Accepted
key = list(map(int, input().split()))
if 2 in key:
  print("No")
elif (key[0] in [4, 6, 9, 11] and key[1] in [4, 6, 9, 11]) or (key[0] in [1, 3, 5, 7, 8, 10, 12] and key[1] in [1, 3, 5, 7, 8, 10, 12]):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
A = sorted(list(map(int, input().split())))

n = A[-1]
r_val = -float('inf')
r_row = None
for idx in range(N - 1):
    if r_val < min(n - A[idx], A[idx]):
        r_val = min(n - A[idx], A[idx])
        r_row = A[idx]
print(n, r_row)
# Judge status: Wrong Answer
import math
n,c,k = map(int,input().split())
t = [int(input()) for i in range(n)]

t.sort(reverse=True)
key = t[0]-k
len_t = 0
ans = 0
for i in range(n):
    if t[i] >= key:
        len_t += 1
    else:
        ans += math.ceil(len_t/c)
        key = t[i]-k
        len_t = 1
ans += math.ceil(len_t/c)
print(ans)
# Judge status: Wrong Answer
s_a = input()
s_b = input()
if s_a[0] == s_b[2] and s_a[2] == s_a[0] and s_a[1] == s_b[1]:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))

def check(x,y,X,Y):
    # print(x,y)
    x.append(X)
    y.append(Y)
    # print(x,y)
    if min(y)>max(x):
        return True
    return False
if check(x,y,X,Y):
    print('No War')
else:
    print('War')
# Judge status: Wrong Answer
a,b = map(int,input().split())
s=a+b
if s%2 != 0:
	print("IMPOSSIBLE")
else:
	print(s/2)
# Judge status: Accepted
n, m = map(int, input().split())
A = list(map(int, input().split()))
count = 0
total = 0
for j in range(n):
    total += A[j]
for i in range(n):
    if A[i] >= total *(1/(4*m)):
        count += 1
if count >= m:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b, n = map(int, input().split())

if n < b:
	print((a * n) // b)
else:
	print((a * (b - 1) )//b)
# Judge status: Accepted
from decimal import Decimal
a,b=input().split()
print(int(Decimal(a)*Decimal(b)))
# Judge status: Accepted
## C Many Requirements
import itertools
N, M, Q = map(int, input().split() )
X = [list( map( int,input().split() ) ) for x in range(Q)]

listd = []
A = list( itertools.combinations_with_replacement( [i for i in range(1, M+1) ], N ) )
for a in A:
    sumd = 0
    for q in range(Q):
        if a[X[q][1]-1] - a[X[q][0]-1] == X[q][2]:
            sumd += X[q][3]
    listd.append(sumd)
print( max(listd) )
# Judge status: Accepted
n=int(input())
h=[int(i) for i in input().split(' ')]


dp=[0]*(n)
dp[1]=abs(h[1]-h[0])

for i in range(2,n):
    t1=dp[i-2]+abs(h[i]-h[i-2])
    t2=dp[i-1]+abs(h[i]-h[i-1])
    dp[i]=min(t1,t2)

    
print(dp[n-1])
# Judge status: Accepted
n, *a = map(int, open(0).read().split())
s = [a - i - 1 for i, a in enumerate(a)]
b = sorted(s)[n // 2]
print(sum(abs(s - b) for s in s))
# Judge status: Accepted
n=int(input())
for i in range(8):
  if 2**i > n:
    print(2**(i-1))
    break
# Judge status: Accepted
import itertools
n = int(input())
N = [int(i) for i in range(1, n+1)]
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
c = 0
a = 0; b = 0
for i in itertools.permutations(N):
    c += 1
    if i == P: a = c
    if i == Q: b = c
print(abs(a-b))
# Judge status: Wrong Answer
from itertools import accumulate
n=int(input())
x=[]
for i in range(1,33000):
  x+=[i]
y=list(accumulate(x))
for i in range(32999):
  if y[i]>=n:
    print(i+1)
    break
# Judge status: Accepted
def resolve():
    N, M, X, Y = map(int, input().split())
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    ans = 0
    for z in range(X+1, Y+1):
        if max(x)<z and z<=min(y):
            ans += 1
    print("No War" if ans != 0 else "War")
resolve()
# Judge status: Wrong Answer
N = int(input())
print(N*(N-1)//2)
# Judge status: Accepted
import math
a,b = [float(i) for i in input().split()]
ans = 1000000000
flag = False

for i in range(1,10000):
    ans8 = int(math.floor(i*0.08))
    ans10 = int(math.floor(i*0.1))
#     print(ans8,ans10)
    if ans8 == a and ans10 == b:
        ans = min(ans, i)
        flag = True

if flag is True:
    print(ans)
else:
    print(-1)
# Judge status: Accepted
import time
from math import ceil
from collections import defaultdict, deque


def A(s):
  if s[-1] == 's':
    return s + 'es'
  return s + 's'


def B(n, d):
  for i in range(n - 2):
    if (d[i][0] == d[i][1] and d[i + 1][0] == d[i + 1][1] and
        d[i + 2][0] == d[i + 2][1]):
      return 'Yes'
  return 'No'


def main():
  n = int(input())
  d = [list(map(int, input().split())) for i in range(n)]
  print(B(n, d))


if __name__ == '__main__':
  main()
# Judge status: Accepted
N = int(input())
kurai_1 = N % 10
hon_yomi = {
    0:'pon',
    1:'pon',
    2:'hon',
    3:'bon',
    4:'hon',
    5:'hon',
    6:'pon',
    7:'hon',
    8:'pon',
    9:'hon'
}
print(hon_yomi[kurai_1])
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
c = 0
for i in range(n):
    if p[i]!=i+1:
        c+=1
if c>2:
    print("NO")
else:
    print("YES")
# Judge status: Accepted
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    h1,m1,h2,m2,k = LI()
    t = (h2 * 60 + m2) - (h1*60 + m1)
    print(t-k)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = input()
m = int(n)
c = n[0]
k = len(n)
tmp = int(c + "9"*(k-1))
ans = int(c) + (k-1)*9
if tmp > m:
    ans = (int(c)-1) + (k-1)*9
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())

K = []
A = []
for i in range(n):
    k,*a = input().split()
    K.append(k)
    A.append(a)

ans = 0

for i in range(m):
    sum = 0
    for j in range(n):
        sum += str(i+1) in A[j]
    if sum == n:
        ans+=1

print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
ans = 0
cmds = ['']*n
for i, c in enumerate(t):
    if c == 'r':
        cmd = 'p'
        pt = p
    elif c == 's':
        cmd = 'r'
        pt = r
    elif c == 'p':
        cmd = 's'
        pt = s
    if i-k >= 0 and cmds[i-k] == cmd:
        cmd = ''
        pt = 0
    ans += pt
    cmds[i] = cmd

print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
check = [0 for i in range(m)]

for _ in range(n):
    A = list(map(int, input().split()))
    for a in A[1:]:
        check[a-1] += 1
        print(check)

ans = sum([c == n for c in check])
print(ans)
# Judge status: Wrong Answer
a,b,c=input().split()
d=[a,b,c]
print(d.count("5"))
if d.count("5")==2 and d.count("7")==1:
    print("YES")

else:
    print("NO")
# Judge status: Accepted
a, b, c = map(int, input().split())

if a == b :
    if b == c :
        print('No')
    else :
        print('Yes')
elif b == c :
    if b == a :
        print('No')
    else :
        print('Yes')
elif c == a :
    if c == b :
        print('No')
    else :
        print('Yes')
else :
    print('No')
# Judge status: Accepted
a, b = map(int, input().split())
print('Possible' if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0 else 'Impossible')
# Judge status: Wrong Answer
S = sorted(input())
T = sorted(input())

reg = [None]*26
reg_flag = [0]*26

for i in range(len(S)):
    index = ord(S[i])-97
    if reg_flag[index] == 0:
        reg[index] = T[i]
        reg_flag[index] = 1

        index_T = ord(T[i])-97
        if reg_flag[index_T] == 0:
            reg[index_T] = S[i]
            reg_flag[index_T] = 1

    if reg[index] == T[i]:
        pass
    else:
        print('No')
        exit()

print('Yes')
# Judge status: Accepted
s=input()
t=input()
n=len(s)
d={}
for i in range(n):
    ss=s[i]
    tt=t[i]
    if ss in d and (ss,tt) not in d.items():
        print("No")
        exit()
    if tt in d.values() and (ss,tt) not in d.items():
        print("No")
        exit()
    if ss not in d:
        d[ss]=tt    
print("Yes")
# Judge status: Wrong Answer
import  math as m
N,K=map(int,input().split())
r=m.log(N,K)
if r>int(r):
    print(int(r+1))
else:
    print(int(r))
# Judge status: Wrong Answer
S=str(input())
if S=="SUN":
  print(7)
elif S=="MON":
  print(6)
elif S=="TUE":
  print(5)
elif S=="WED":
  print(4)
elif S=="TUE":
  print(3)
elif S=="FRI":
  print(2)
else:
  print(1)
# Judge status: Accepted
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

a = s()
b = s()

sample = ""
for i in range(len(a)):
	a = a[-1] + a[0:-1]
	if a == b:
		print("Yes")
		exit()
print("No")
# Judge status: Accepted
a, b, c, d = map(int, input().split())
print(max(a*c,a*d,b*c,b*d))
# Judge status: Accepted
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations

def main():
    A, B = map(int, input().split())

    print('Possible') if not A%3 or not B%3 or not (A+B)%3 else print('Impossible')

if __name__ == '__main__':
    main()
# Judge status: Accepted
N = int(input())
for i in range(14):
    for j in range(25):
        if 7*i + 4*j == N:
            print("Yes")
            exit()
print("No")
# Judge status: Accepted
N = int(input())
v = list(map(int, input().split()))

v = sorted(v)
ans = v[0]
for i in range(1, N):
    ans = (ans + v[i]) / 2
    
print(ans)
# Judge status: Accepted
def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def main():
    n, m = Input()
    x = sorted(Input())

    data = sorted((abs(x[i]-x[i+1]) for i in range(m-1)), reverse=True)
    print(sum(data[n-1:]))


main()
# Judge status: Accepted
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)
# Judge status: Wrong Answer
x=int(input())
if(360%x==0):
  print(360//x)
# Judge status: Accepted
N = int(input())
A = [int(i) for i in input().split()]

d = {
    "4":0,
    "2":0,
    "1":0
}

for i in A:
  if i%4==0:
    d["4"] += 1
  elif i%2==0:
    d["2"] += 1
  else:
    d["1"] += 1

if d["1"] == 0:
  print("Yes")
elif d["1"] <= d["4"]:
  print("Yes")
elif d["1"] + -(-d["2"]//2) - 1 <= d["4"]:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n,a,b=map(int,input().split())

ans=0
for i in range(1,n+1):
  for j in str(i):
    count=0
    count+=int(j)
  if a<=count<=b:
      ans+=i
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
s = input()

if s[k-1] =='A':
  s2 = 'a'
elif s[k-1] =='B':
  s2 = 'b'
else:
  s2 = 'c'
  
if k == 1:
  print(s2+s[1:n])
elif k == n:
  print(s[:k-1]+s2)
else:
  print(s[:k-1]+s2+s[k:n])
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)
x = sum(A)
min_ = x / (4*M)
flag = 0

for i, a in enumerate(A):
  if i == M:
    flag = 1
    break
  if a < min_:
    break
if flag == 1:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
import sys
s = sorted(list(input()))
t = sorted(list(input()))

str_long = min([len(s), len(t)])

i = 0
while i < str_long:
    if ord(s[i]) == ord(t[-1-i]):
        i += 1
        continue
    elif ord(s[i]) < ord(t[-i-1]):
        print("Yes")
        sys.exit()
    else:
        break
print("No")
# Judge status: Wrong Answer
N, A, B = map(int, input().split())
S = input()
y = 0
k = 0
for i in S:
    if i=='c':
        print('No')
    elif (i=='a'):
        if (y<(A+B)):
            print('Yes')
            y += 1
        else:
            print('No')
    else:
        if (y<(A+B))and(k<=B):
            print('Yes')
            y += 1
            k += 1
        else:
            print('No')
# Judge status: Wrong Answer
n=int(input())
s=[input() for _ in range(n)]
m=int(input())
t=[input() for _ in range(m)]
ans=0
buf=0
s.sort()
t.sort()
for i in range(n):
    buf=0
    for j in range(i,n):
        if s[i]==s[j]:
            buf+=1
        elif s[i]>s[j]:
            break
    for j in range(m):
        if s[i]==t[j]:
            buf-=1
        elif s[i]>t[j]:
            break
    if buf>ans:
        ans=buf
print(ans)
# Judge status: Accepted
import math  

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

diff = [abs(x - X) for x in Coordinates]

if len(diff) == 1:
  print(min(diff))
else:
  ans = diff[0]
  for i in range(1, len(diff)):
    ans = math.gcd(ans, diff[i])
  print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))

a.sort(reverse=True)

score = a[0]

for i in range(2,n):
    score += min(a[i-1],a[i-2])

print(score)
# Judge status: Wrong Answer
X = int(input())
ans = 0
for b in range(1,X):
    for p in range(2, X):
        if X >= b**p:
            if ans < b**p:
                ans = b**p
                break
print(ans)
# Judge status: Accepted
a,b,c,d=map(int,input().split())
if min(b,d)-max(a,c)>0:
    print(min(b,d)-max(a,c))
else:
    print(0)
# Judge status: Wrong Answer
N = int(input())
a = []
for i in range(N):
    a.append(int(input()))
#
count = 0
for i in range(N):
    count += a[i]//2
    a[i] = a[i]%2

for i in range(N-1):
    if a[i]==1:
        if a[i+1]==1:
            a[i] = 0
            a[i+1] = 0
            count += 1
print(count)
# Judge status: Wrong Answer
a,b,x = map(int,input().split())
ans = ((b-a)+1)//x
if a%x == 0:
    ans += 1
if a != b and b%x == 0:
    ans += 1
    if (b-a)%x == 0:
        ans -= 1
print(ans)
# Judge status: Accepted
N = int(input())
A = []
B = []

for i in range(N):
    a, b = list(map(int, input().split()))
    A.append(a)
    B.append(b)

A = sorted(A)
B = sorted(B)

if N % 2:
    ans = B[N//2] - A[N//2] + 1
else:
    l = A[N//2-1] + A[N//2]
    r = B[N//2-1] + B[N//2]
    ans = r-l+1
print(ans)
# Judge status: Wrong Answer
from math import floor
n = int(input())

for x in range(n):
    cost = floor(x * 1.08)
    if cost == n:
        print(x)
        exit()
print(":(")
# Judge status: Accepted
n,m=map(int,input().split())
s,t=map(int,input().split())
for i in range(m-1):
  x,y=map(int,input().split())
  if s<x:
    s=x
  if t>y:
    t=y
print(max(0,t-s+1))
# Judge status: Wrong Answer

n = int(input())
data = ["a"] * n
ans = ["".join(data)]
def print_str(ans, data, i):
    if i == n:
        return
    data[i] = "a"
    ans.append("".join(data))
    while ord(data[i]) + 1 <= ord(data[i - 1]) + 1:
        data[i] = chr(ord(data[i]) + 1)
        ans.append("".join(data))
        print_str(ans, data, i + 1)
    data = ["a"] * n
    print_str(ans, data, i + 1)
print_str(ans, data, 1)
ans = sorted(set(ans))
for i in range(len(ans)):
    print(ans[i])
# Judge status: Accepted
n, k, *_ = map(int, open(0).read().split())
print((n - 2) // (k - 1) + 1)
# Judge status: Accepted
a, b, c = map(int, input().split())
print((b // c) - (a - 1) // c)
# Judge status: Accepted
def main():
    a, b, m = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    ans = min(A) + min(B)
    for _ in range(m):
        x, y, c = map(int, input().split())
        ans = min(ans, A[x - 1] + B[y - 1] - c)
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
import math

a=int(input())

print(math.ceil(a/2))
# Judge status: Accepted
def main():
    K,A,B = map(int,input().split())
    if B-A<=2:
        print(1+K)
        exit()
    now = 1
    K -= (A-1)
    now = A
    if K%2==0:
        now += (B-A)*(K//2)
    else:
        now += (B-A)*((K-1)//2)
        now += 1
    print(now)  
if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
ans = []
start = "a"
stack = []
stack.append(start)
num = ord("a")
while stack:
    v = stack.pop()
    if len(v) == n:
        ans.append(v)
        continue
    nex_num = ord(v[-1])
    for i in range(num, nex_num + 2):
        tuika = chr(i)
        stack.append(v + tuika)

print(*ans[::-1], sep="\n")
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

for i in range(N-K):
  if A[i] < A[i+K]:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
a, b, c = map(int, input().split())
k = int(input())

cnt = 0

while b <= a:
  b *= 2
  cnt += 1

while c <= b:
  c *= 2
  cnt += 1
if cnt <= k:
  print ('Yes')
else:
  print ('No')
# Judge status: Wrong Answer
count=1
n=int(input())
mina=int(input())
for _ in range(n-1):
    a=int(input())
    if mina>=a:
        count+=1
        mina=a
print(count)
# Judge status: Accepted
from collections import Counter
s = list(input())
ans = Counter(s)
flag = True
for i in ans.values():
    if i>1:
        flag = False
print('yes' if flag else 'no')
# Judge status: Accepted
N = int(input())
c = input()
l = 0
r = N-1
cnt = 0
while(l<r):
    if c[l] == "W" and c[r] == "R":
        cnt += 1
        l += 1
        r -= 1
    elif c[l] == "R":
        l += 1
    elif c[r] == "W":
        r -= 1
print(cnt)
# Judge status: Accepted
import math
n,h=map(int,input().split())
A=[]
B=[]
for i in range(n):
    a,b=map(int,input().split())
    A.append(a)
    B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)
amax=A[0]
while B[-1]<amax:
    B.pop()
S=0
if sum(B)>=h:
    for i in range(n):
        S+=B[i]
        if S>=h:
            print(i+1)
            break
else:
    h-=sum(B)
    print(math.ceil(h/amax)+len(B))
# Judge status: Accepted
A, B, C, K = map(int, input().split())
if K%2==0:
  ans = A-B
else:
  ans = B-A
if abs(ans)>10**18:
  ans = 'unfair'
print(ans)
# Judge status: Wrong Answer
S = input()
min = 1000
for i in range(len(S) - 2):
	x = int(S[i:i+3])
	print(x)
	x = abs(753 - x)
	if min > x:
		min = x
print(min)
# Judge status: Wrong Answer
X = int(input())
money = 100
year = 0

while X > money:
    year += 1
    money += money * 101 // 100

print(year)
# Judge status: Wrong Answer
import math

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

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

sum = 0
for i in range(b, a+1):
  sum += combinations_count(a+1, i)
  
print(sum)
# Judge status: Accepted
n = int(input())
li = [0]*(10001)
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            tmp = x*x+y*y+z*z+x*y+y*z+z*x
            if tmp>10000:
                continue
            li[tmp] += 1
for i in range(1, n+1):
    print(li[i])
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n, m = map(int, input().split())

aa = n//2
bb = aa+1

for i in range(m):
    print(aa,bb)
    aa-=1
    bb+=1
# Judge status: Accepted
n,m = map(int,input().split())
x = sorted(map(int,input().split()))
if n >= m:
  print(0)
else:
  d = sorted([x[i]-x[i-1] for i in range(1,m)])
  print(sum(d[:m-1-(n-1)]))
# Judge status: Wrong Answer
list = input().split()
list.sort(reverse=True)
list = [int(n) for n in list]

if list[0] == list[1] + list[2]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N = int(input())
ans = (10 ** N - 2 * 9 ** N + 8 ** N) % (10 ** 9 + 7)
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

now = k
res = 1
while now < n:
    now += k-1
    res += 1

print(res)
# Judge status: Wrong Answer
A=int(input())
B=int(input())
C=int(input())
x=int(input())
s=0
for i in range(A+1):
  for t in range(B+1):
    if x<0: break
    elif 50*C>=x:
      s+=1
      x-=100
    else: x-=100
  x-=500
print(s)
# Judge status: Wrong Answer
from fractions import gcd

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

n = gcd(N, M)
# print(n)
ans = 1

for i in range(2, int(n**(1/2))+2):
    flag = 0
    # print("i", i)
    while True:
        if n%i == 0:
            n //= i
            # print(n)
            flag = 1
        else:
            break
    ans += flag

print(ans)
# Judge status: Wrong Answer
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


n, a, b = LI()

min_s = a * (n - 1) + b
max_s = a + (n - 1) * b
print(f'{min_s=}, {max_s=}')
ans = max_s - min_s + 1
if ans < 0:
    ans = 0
print(ans)
# Judge status: Accepted
N,K=map(int,input().split())

if (N%K==0):
    print("0")
else:
    print("1")
# Judge status: Accepted
import math
n,d = map(int,input().split())
l = []
for i in range(n):
  l.append(list(map(int,input().split())))
count = 0
for i in range(n-1):
  for j in range(i+1,n):
    ans = 0
    for k in range(d):
      ans += (int(l[i][k])-int(l[j][k]))**2

    if float.is_integer(math.sqrt(ans)) == True:
      count += 1
print(count)
# Judge status: Wrong Answer
N = int(input())
A = [int(a) for a in input().split()]

ans = 1
L = [0]*(N+2)
for i in range(N+1):
    L[i+1] = L[i]+A[i]

v = 1
for i in range(1, N+1):
    v = min(2*v, L[-1]-L[i])
    ans += v
    v -= A[i]
    if v < 0:
        ans = -1
        break
if A[0] > 0 or A[-1] == 0:
    ans = -1

print(ans)
# Judge status: Accepted
sx,sy,tx,ty = map(int,input().split())
root = ''
dx = tx-sx
dy = ty-sy

for i in range(dy):
    root += 'U'
for j in range(dx):
    root += 'R'
for k in range(dy):
    root += 'D'
for j in range(dx):
    root += 'L'
    
root += 'L'

for i in range(dy+1):
    root += 'U'
for j in range(dx+1):
    root += 'R'
    
root += 'D'
root += 'R'

for k in range(dy+1):
    root += 'D'
for j in range(dx+1):
    root += 'L'
    
    
root += 'U'    
    
print(root)
# Judge status: Accepted
num=(int)(input())
n=num//100
amari=num%100
if num <= 99 or amari / n > 5:
  print(0)
else:
  print(1)