peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted

def main():
  n, m = map(int, input().split(' '))

  if m == 0:
    print(10 ** (n - 1) if n > 1 else 0)
    return

  num_list = [0] * n
  done_list = [-1] * n

  for _ in range(m):
    s, c = map(int, input().split(' '))

    if (n > 1 and s == 1 and c == 0) or (done_list[s - 1] != -1 and done_list[s - 1] != c):
      print(-1)
      exit()

    num_list[s - 1] = c
    done_list[s - 1] = c

  if num_list[0] == 0:
    num_list[0] = 0 if n == 1 else 1

  print("".join(map(str, num_list)))

main()
# Judge status: Accepted
from bisect import *
def solve():
    ans = 0
    N = int(input())
    A = [-int(input()) for _ in range(N)]
    lis = [A[0]]
    for i in range(1,N):
        if A[i]>=lis[-1]:
            lis.append(A[i])
        else:
            ind = bisect_right(lis,A[i])
            lis[ind] = A[i]
    ans = len(lis)
    return ans
print(solve())
# Judge status: Wrong Answer
a,b,k = map(int, input().split())

nums = []
for i in range(a, min(b,a+k)): nums.append(i)
for i in range(b, max(0,b-k), -1): nums.append(i)
for i in sorted(set(nums)): print(i)
# Judge status: Accepted
n = int(input())
t,a = map(int,input().split())
H = list(map(int,input().split()))
A = []

for i in range(n):
    tmp = abs((t-int(H[i])*0.006)-a)
    A.append(tmp)

B = min(A)
print(A.index(B)+1)
# Judge status: Wrong Answer
import math
X, Y = map(int, input().split())
n = math.log(Y / X, 2)
n = math.floor(n)
print(n + 1)
# Judge status: Accepted
N, K = map(int,input().split())
if N > 12:
    print(K)
elif N > 5:
    print(K//2)
else:
    print(0)
# Judge status: Wrong Answer
def f(x, y):
    return x-y, x+y


n = int(input())
p = [list(map(int, input().split())) for i in range(n)]

max_x = 0
min_x = 2000000000
max_y = 0
min_y = 2000000000
for xi, yi in p:
    x_, y_ = f(xi, yi)
    max_x = max(max_x, x_)
    min_x = min(min_x, x_)
    max_y = max(max_y, y_)
    min_y = min(min_y, y_)

print(max(max_x - min_x, max_y - min_y))
# Judge status: Wrong Answer
N,M = map(int,input().split())

a = [list(map(int,input().split())) for x in range(N)]
c = [list(map(int,input().split())) for x in range(M)]

min_cpoint = -1
num_stack = 999999

for i in range(N):
    for j in range(M):
        if num_stack > abs(a[i][0]-c[j][0]) + abs(a[i][1]-c[j][1]):
            num_stack = abs(a[i][0]-c[j][0]) + abs(a[i][1]-c[j][1])
            min_cpoint = j+1
    print(min_cpoint)
    min_cpoint = -1
    num_stack = 9999999
# Judge status: Accepted
t=input().strip()
print(t.replace('?', 'D'))
# Judge status: Accepted
n = int(input())
ln =list(map(int, input().split()))
a = 1

for i in sorted(ln):
    if a > 10**18 or a == 0:
        break
    else:
        a = a*i
        
    
    
if a> 10**18:
    print('-1')
else :
    print(a)
# Judge status: Accepted
x=int(input())

if(x>=30):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
w, a, b = map(int, input().split())

if w >= abs(a-b):
    print(0)
elif a > b:
    print(w-b)
elif b > a:
    print(w-a)
# Judge status: Accepted
N=input()
*A,=map(int,input().split())

a=float('inf')
for i in range(min(A),max(A)+1):a=min(a, sum([(k-i)**2 for k in A]))
print(a)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
flg_cnt = 0
for i in range(n):
    if i+1 != p[i]:
        flg_cnt += 1
    if flg_cnt > 2:
        print('No')
        exit()
print('Yes')
# Judge status: Wrong Answer
#ABC127_C
N,M=map(int,input().split())

L=[]
R=[]

for i in range(M):
    l,m=map(int,input().split())
    L.append(l)
    R.append(m)

if min(R)<=max(L):
    print(0)
else:
    print(min(R)-max(L)+1)
# Judge status: Wrong Answer
x = list(map(int, input().split()))

for i in range(len(x)-1):
    if x[i] == 0:
        print(i+1)
# Judge status: Accepted
N,M = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(M)]
ans = [0]*N
for a,b in ab:
    ans[a-1] += 1
    ans[b-1] += 1
for num in ans:
    print(num)
# Judge status: Accepted
N=int(input())
p=list(map(int,input().split()))
count=0
for i in range(N):
  if p[i]!=i+1:
    count+=1
if count==0 or count==2:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
from math import fabs
a, b = map(int, input().split())
if a <= 0 and 0 <= b:
    print("Zero")
else:
    if a > 0:
        print("Positive")
    else:
        if (fabs(b - a) + 1) % 2 == 0:
            print("Positive")
        else:
            print("Negative")
# Judge status: Accepted
A,B,C = (int(i) for i in input().split())

K = int(input())

ans = "No"

for i in range(K):
  if A < B*(2**i) and B*(2**i) < C*(2**(K-i)):
    ans = "Yes"
    break

print(ans)
# Judge status: Accepted
def main():
    N = input()
    L = list(map(int, input().split()))
    a = max(L)
    b = sum(L) - a
    if a < b:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
# Judge status: Accepted
import math
a,b,x = map(int,input().split())
if a*a*b/2 <= x:
    j = 2*(b/a - x/(a**3))
else:
    j = b*b*a/(2*x)
ans = math.degrees(math.atan(j))
print(ans)
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())

ans = x*min(n, k) + max(y*(n - k), 0)

print(ans)
# Judge status: Wrong Answer
S = input ()
T = S.replace('A', '')
T = T.replace('C', '')
U = T.lower ()
if S[0]=='A' and S[2:-2].count('C')==1 and T==U:
  print ('AC')
else:
  print ('WA')
# Judge status: Wrong Answer
import numpy as np

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

a = np.array(list(map(int,input().split())))

print(a)

for j in range(k):
    if j > 41:
        break

    new_a = np.zeros(n, dtype=int)

    for i, x in enumerate(a):
        new_a[i-x if i-x >= 0 else 0:i+x + 1] += 1
    
    print(new_a)
    a = new_a

print(*a)
# Judge status: Accepted
import sys

MOD=10**9+7
N,M=map(int,input().split())
bad=set(map(int,sys.stdin))

a,b=0,1
for i in range(1,N+1):
    if i in bad:
        a,b=b,0
        if a==0:
            break
    else:
        a,b=b,(a+b)%MOD

print(b)
# Judge status: Accepted
#!/usr/bin/env python3
n = int(input())
cnt = [0] * (1 + n)
for a in range(1, 100):
    for b in range(1, 100):
        for c in range(1, 100):
            k = a ** 2 + b ** 2 + c ** 2 + a * b + b * c + c * a
            if k > n:
                continue
            else:
                cnt[k] += 1
for i in range(1, n + 1):
    print(cnt[i])
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))

num = [0]*(max(A)+1)

for i in A:
    num[i] += 1

ans = 0
for i in range(1,len(num)-1):
    tmp = num[i-1] + num[i] + num[i+1]
    ans = max(ans,tmp)

print(ans)
# Judge status: Wrong Answer
S = list(input())
for i in range(len(S)):
    S[i] = int(S[i])

K = int(input())

start = 0
loc = 0
for i in range(len(S)):
    if S[i] != 1:
        start = S[i]
        loc = i
        break

if K > 100:
    print(start)
elif K-1 >= loc:
    print(start)
else:
    print(1)
# Judge status: Wrong Answer
import itertools
import numpy as np

n, m, x = map(int, input().split())
books = [list(map(int, input().split())) for i in range(n)]

coin = []
for i in range(1, m+1):
  for v in itertools.combinations(books, i):
    comb = list(v)
    result = np.sum(comb, axis = 0)
    flag = True
    for j in range(1,m+1):
      if result[j] < x:
        flag = False
        break
    if flag:
      coin.append(result[0])

if len(coin) > 0:
  sorted(coin, reverse=False)
  print(coin[0])
else:
  print(-1)
# Judge status: Accepted
n = int(input())
d = {}
for i in range(n):
  s = input()
  d[s] = d.get(s, 0) + 1
m = max(d.values())
maxKeys = [x[0] for x in d.items() if x[1] == m]
so = sorted(maxKeys)
for e in so:
  print(e)
# Judge status: Accepted
# https://atcoder.jp/contests/abc141/tasks/abc141_d
from copy import deepcopy
from heapq import heappop, heappush, heapify
n, m = map(int, input().split())

items = [-int(i) for i in input().split()]
heapify(items)
while m:
    m -= 1
    item = -1 * heappop(items)
    item //= 2
    heappush(items, -1 * item)
pay = 0
for i in items:
    pay += -1 * i
print(pay)
# Judge status: Accepted
N = int(input())
s = input()
t = input()

ans = 0
for i in range(N):
    if s[i:] == t[:N - i]:
        ans = N - i
        break
print(2 * N - ans)
# Judge status: Accepted
S = input()

if set(S) == set("abc"):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from decimal import *
a,b = map(Decimal, input().split())
print(int(a*b))
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
count = 1
for i in range(N):
    if a[i] == count:
        count += 1
if count == 1:
    print(-1)
else:
    print(N + 1 -count)
# Judge status: Accepted
s = input()
if s == 'hi' * (len(s) // 2):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
if n == 0 or n == 1:
    print(1)
elif n % 2 == 1:
    print(0)
else:
    m = int(n/2)
    count = 0
    i = 1
    while m >= 5 ** i:
      d = m // (5 ** i)
      count += d
      i += 1
    print(int(count))
# Judge status: Wrong Answer
n,m=map(int,input().split())
a=[input() for _ in range(n)]
b=[input() for _ in range(m)]

for i in range (n-m+1):#行
  g=1
  for j in range(n-m+1):#列
    for k in range(m):#m
     # print(a[i+k][j:j+m],"__",b[k])
      if a[i+k][j:j+m]!=b[k]:
        g*=0
        break
    if g==1:
      print("Yes")
      import sys
      sys.exit()
else:
  print("No")
# Judge status: Accepted
s = int(input())
t = 1
for i in range(1,8,1):
  if(s >= (2 ** i)):t = 2 ** i
print(t)
# Judge status: Accepted
a, b, c, d = (int(x) for x in input().split())
if abs(a - c) <= d or (abs(a - b) <= d and abs(b - c) <= d):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from collections import Counter
S = str(input())
CS = Counter(S)
V = list(CS.values())
ans = 'YES'
if len(V) == 1:
  ans = 'NO'
elif len(V) == 2:
  if V[0] >= 2*V[1]:
    ans = 'NO'
else:
  if V[0] >= 2*V[1] and V[0] >= 6*V[2]:
    ans = 'NO'

print(ans)
# Judge status: Accepted
import math

k = int(input())
gusu = math.floor(k/2)
kisu = math.ceil(k/2)

# n個からr個を選ぶ組み合わせを算出する
def combinations_count(n, r):
   return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

ans = combinations_count(gusu,1)*combinations_count(kisu,1)
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

x=sum(a)-a[0]
ans=0

for i in range(n):
    ans = (ans + a[i]*x)%(10**9 + 7)
    if i!=n-1:
        x-=a[i+1]
print(ans)
# Judge status: Wrong Answer
s = list(str(input()))

if s[0] == s[1] == s[2] == s[3]:
    print('Bad')
else:
    print('Good')
# Judge status: Accepted
S = input()
print(len(S) - S[::-1].index('Z') - S.index('A'))
# Judge status: Accepted
n=int(input())
s=input()
sum=0
r=int(s.count('R'))
g=int(s.count('G'))
b=int(s.count('B'))
for k in range(n):
    for j in range(k):
        i=2*j-k
        if i+1>0:
            if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
                sum=sum+1
print(r*g*b-sum)
# Judge status: Accepted
X, Y = map(int, input().split())

if X * 4 >= Y and X * 2 <= Y and Y % 2 == 0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
A = list(input())
B = list(input())
C = list(input())

cards = [A, B, C]

target = 0
ans = None
while True:
    if len(cards[target]) == 0:
        ans = target
        break

    card = cards[target][0]
    if card == 'a':
        target = 0
    elif card == 'b':
        target = 1
    elif card == 'c':
        target = 2
    
    del cards[target][0]

if ans == 0:
    print('A')
elif ans == 1:
    print('B')
elif ans == 2:
    print('C')
# Judge status: Accepted
import random
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for _ in range(d)]

for i in range(14):
    for j in range(26):
        print(26-j)
print(23)
# Judge status: Accepted
a = [int(j) for i in range(3) for j in input().split(' ')]
n = int(input())
nn = [int(input()) for i in range(n)]

cnt = 0
for ni in nn:
  if ni in a:
    cnt += 1
    a[a.index(ni)] = 0

judge = "No"
for i in range(3):
  if sum(a[i::3])==0 or sum(a[i*3:i*3+3])==0:
    judge = "Yes"
    
if sum(a[::4])==0 or (a[2]+a[4]+a[6])==0:
  judge = "Yes"
  
print(judge)
# Judge status: Accepted
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
l=[]
a,b=map(int,input().split())
import fractions
g=fractions.gcd(a,b)
for i in range(len(prime_decomposition(g))):
  if prime_decomposition(g)[i] not in l:
    l.append(prime_decomposition(g)[i])
print(len(l)+1)
# Judge status: Wrong Answer
from operator import mul
from functools import reduce


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


N = int(input())
ans = 0
amari = int(N % 3)
shou = int(N // 3)

for i in range(shou):
    amari += 3
    shou -= 1
    ans = (ans + combinations_count((amari + shou - 1), amari)) % (10**9 + 7)
print(ans)
# Judge status: Accepted
S = list(input())
S = [int(s) for s in S]
#N = len(S)
#print('S:', S)

print((min(S.count(0), S.count(1)))*2)
# Judge status: Wrong Answer
x=sorted(list(input()))
y=sorted(list(input()),reverse=True)
a=""
b=""
for (p,q) in zip(x,y):
  a+=p
  b+=q
if a<b:
  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):
  if a <= sum(list(map(int, list(str(i))))) <= b:
    ans += 1
print(ans)
# Judge status: Accepted
# coding: utf-8
# Your code here!
N,K=map(int,input().split())

A=list(map(float, input().split()))

low=0
high=10**9+1

while high-low!=1:
    mid=(high+low)//2
    cut_temp=0
    ans=-1
    
    for a in A:
        cut_temp+=-(-a//mid)-1
    if cut_temp>K:
        low=mid
    else:
        high=mid
    
print(high)
# Judge status: Accepted
l=["SUN","MON","TUE","WED","THU","FRI","SAT" ]
a=l.index(str(input()))
print(7-a)
# Judge status: Accepted
s=input()
print("no" if len(s)-len(set(s)) else "yes")
# Judge status: Wrong Answer
S, T = input().split()
A, B = map(int, input().split())
U = input()

if S == U:
  A = A - 1
else:
  B = B - 1
  print(' '.join(map(str, [A, B])))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
if n==1:
  print(1)
  exit()
ans=0
data=[0]*(n-1)
for i in range(n-1):
  data[i]=a[i+1]-a[i]
for i in range(1,n-2):
  if data[i]<0:
    if data[i-1]>0 or data[i+1]>0:
      ans+=1
if data[0]<0 and data[1]>0:
  ans+=1
if data[n-2]<0 and data[n-3]>0:
  ans+=1
print(ans+1)
# Judge status: Accepted
s,c = map(int, input().split())

# c*2 = s -> scc

scc = 0
if s*2 <= c:
    scc += s
    c -= s*2
    s = 0
    scc += c//4
else:
    print(c//2)
    exit()
print(scc)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
ans = 0
dp = [0 for _ in range(N+1)]
dp[0] = 1
for i in range(N):
    dp[i+1] = min((dp[i]-A[i]) * 2, 10000000000000)
    if dp[i+1] < A[i]:
        print(-1)
        exit()
if(dp[N] < A[N]):
    print(-1)
    exit()
S = [0 for _ in range(N+1)]
S[0] = A[N]
for i in range(1, N+1):
    S[i] = S[i-1] + A[N-i]
for i in range(N+1):
    ans += min(S[N-i], dp[i])
print(ans)
# Judge status: Accepted
n = int(input())
l = list(input())

x,y = 0,0
for i in range(n):
    if l[i] == 'I':
        x += 1
        y = max(x,y)
    elif l[i] == 'D':
        x -= 1

print(y)
# Judge status: Accepted
s = input().split()[1]

print('A' + s[0] + 'C')
# Judge status: Accepted
N, K, S = map(int, input().split())

anss = [S] * K
rest = N-K
if S == 10**9:
    anss += [1]*rest
else:
    anss += [S+1]*rest

print(' '.join(map(str, anss)))
# Judge status: Wrong Answer
s=str(input())
t=str(input())
temps=list(set(s))
tempt=list(set(t))
temps=sorted(temps)
tempt=sorted(tempt)
temps1=[0]*len(temps)
tempt1=[0]*len(tempt)

for i in range(0,len(temps)):
  temps1[i]=s.count(temps[i])
for i in range(0,len(tempt)):
  tempt1[i]=t.count(tempt[i])
if temps1==tempt1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
a.sort(reverse=True)
if n%2 == 1:
  a.append(0)
  n += 1
s = 0
for i in range(n//2):
  s += a[2*i]-a[2*i+1]
print(s)
# Judge status: Wrong Answer
import fractions

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

n = int(input())
t = [int(input()) for _ in range(n)]

a = t[0]
for i in range(1, n):
    b = t[i]
    a = lcm(a, b)

print(int(a))
# Judge status: Accepted

n = int(input())
flag = False
for i in range(-(-n // 4) + 1):
    for j in range(-(-n // 7) + 1):
        if n == 4 * i + j * 7:
            flag = True
            break

print("Yes" if flag == True else "No")
# Judge status: Accepted
t = list(input())

for i in range(len(t)):
    if t[i] == "?":
        t[i] = 'D'
        
print(''.join(t))
# Judge status: Wrong Answer
n=int(input())

max_n=10**4+5
ans=[0]*(max_n)
for x in range(1,34):
    for y in range(1,34):
        for z in range(1,34):
            total=x**2+y**2+z**2+x*y+y*z+z*x
            if total<=max_n:
                ans[total]+=1

for i in range(1,n+1):
    print(ans[i])
# Judge status: Accepted
x = int(input())
count = 0
y = 100
while True:
    y*=1.01
    y = int(y)
    count+=1
    if y>=x:
        print(count)
        exit()
# Judge status: Accepted
ABCD = list(input())

for i in range(2 ** 3):
    ptn = ['-'] * 3
    for j in range(3):
        if (i >> j) & 1:
            ptn[len(ptn) - j - 1] = '+'

    formula = ''.join([n + op for n, op in zip(ABCD, ptn + [''])])
    if eval(formula) == 7:
        print(formula + '=7')
        exit()
# Judge status: Wrong Answer
l = list(map(int,input().split()))
for i in range(5):
    if l[i] == 0:
        print(i + 1)
    break
# Judge status: Wrong Answer
N, K = input().split()
A = [int(n) for n in input().split()]
B = list()
for n in A:
    if n not in B:
        B.append(n)
ANS = len(B) - int(K)
if ANS > 0:
    print(ANS)
else:
    print(0)
# Judge status: Wrong Answer
s = input()
N = int(s)
odd_num = 0
for i in range(1,N+1):
    cnt = 1
    num = i
    while (num // 10) > 0:
        cnt += 1
        num = num//10
        print(num)
    if cnt % 2:
        odd_num += 1
print(odd_num)
# Judge status: Accepted
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
n, = [int(num) for num in lines.pop(0).split(" ")]
words = lines
prev_last_char = None
words_already_used = {}
for w in words:
    if w in words_already_used:
        print("No")
        break
    else:
        words_already_used[w] = True
    if prev_last_char is not None:
        if w[0] != prev_last_char:
            print("No")
            break
    prev_last_char = w[-1]
else:
    print("Yes")
# Judge status: Accepted
N = int(input())
A = []
for i in range(N):
    a = int(input())
    A.append(a)

x = dict()
for i in range(N):
    if A[i] in x:
        if x[A[i]] == 1:
            x[A[i]] -=1
        else:
            x[A[i]] += 1
    else:
        x[A[i]] = 1
ans = 0
for idx in x:
    ans += x[idx]
print(ans)
# Judge status: Wrong Answer
def main():
    N = int(input())
    P = [int(i) for i in input().split()] + [-1]
    ans = 0
    pre = -1
    flag = False
    for i, p in enumerate(P):
        if i+1 == p:
            ans += 1
            if i > 0 and i == pre:
                flag = True
        elif flag:
            ans -= 1
            flag = False
        pre = p
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=0
c=0
for i in range(n-1):
    if b==1:
        if a[i+1]<a[i]:
            b=0
            c+=1
    elif b==-1:
        if a[i+1]>a[i]:
            b=0
            c+=1
    else:
        if a[i+1]>a[i]:
            b=1
        if a[i+1]<a[i]:
            b=-1
print(c+1)
# Judge status: Accepted
a,b,c = map(int, input().split())
if a > c:
  print("NO")
elif c-a <= b:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
X, Y = map(int, input().split())
print(-1 if X % Y == 0 or Y % X == 0 else X)
# Judge status: Accepted
n, k = input().split()
ds = input().split()
ns = {_n for _n in n} 
ds = { d for d in ds}

result = 1
while(True):
    rs = {r for r in str(result)}
    if result >= int(n) and len(rs&ds) == 0 :
        print(result)
        break
    else:
        result += 1
# Judge status: Accepted
import sys
import re
input = sys.stdin.readline

N = int(input())

alpha = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
ans = []
for i in range(N):
    if not i:
        ans.append(['a'])
    else:
        l = []
        p = []
        for x in ans[-1]:
            m = max([alpha.index(a) for a in x])
            l.extend([x + a for a in alpha[:m + 2]])

        ans.append(l)

for x in ans[N - 1]:
    print(x)
# Judge status: Wrong Answer
A, B, T = map(int, input().split())
tc = 0
n = 0
cnt = 0

if A > T:
    pass
elif A == T:
    cnt += 1
else:
    while tc < T + 0.5:
        n += B
        cnt += 1
        tc += cnt*A

print(n)
# Judge status: Accepted
table = list(map(int, input()))
diff_nagomi = 1000
ans = 0
for i in range(len(table)-2):
    diff = abs(table[i] * 100 + table[i + 1] * 10 + table[i + 2] - 753)
    if diff_nagomi > diff:
        ans = diff
        diff_nagomi = diff
print(ans)
# Judge status: Accepted
import heapq

N,M=list(map(int,input().split()))
A=list(map(lambda x: -int(x),input().split()))

heapq.heapify(A)

while M>0:
    a=heapq.heappop(A)
    a=-a
    a=a>>1
    a=-a
    heapq.heappush(A,a)

    M-=1
print(-sum(A))
# Judge status: Accepted
N = int(input())
s = input()
t = input()

if s == t:
    print(N)
    exit(0)

for i in range(1, N):
    if s[i:] == t[:-i]:
        ans = s[:i] + s[i:] + t[-i:]
        print(len(ans))
        exit(0)

print(2 * N)
# Judge status: Accepted
N, L = map(int,input().split())

a = [str(input()) for i in range(N)]

print("".join(list(sorted(a))))
# Judge status: Accepted
S = input()
T = input()
dis = {}
dit = {}
for s, t in zip(S,T):
    if s in dis:
        if dis[s]!=t:
            print('No')
            break
    else:
        dis[s] = t
    if t in dit:
        if dit[t]!=s:
            print('No')
            break
    else:
        dit[t] = s
else:
    print('Yes')
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))
count = 0
cur = 0
for i in range(n-1):
    if h[i+1] <= h[i]:
        count += 1
        if count > cur:
            cur = count
    else:       
        count = 0
print(cur)
# Judge status: Wrong Answer
import fractions
A,B = map(int,input().split())
print(A*B/fractions.gcd(A,B))
# Judge status: Accepted
def main():
    S = input().rstrip()
    for idx, s in enumerate(S, start=1):
        if idx % 2 == 1 and s not in ["R", "U", "D"]:
            print("No")
            exit()
        elif idx % 2 == 0 and s not in ["L", "U", "D"]:
            print("No")
            exit()
    print("Yes")


if __name__ == '__main__':
    main()
# Judge status: Accepted
H, N = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N)]

max_ab = max(AB)
dp = [10**10]*(H+max_ab[0])
dp[0] = 0

for i in range(1, H + max_ab[0]):
    dp[i] = min(dp[i - a] + b for a, b in AB)

print(min(dp[H:]))
# Judge status: Accepted
n=int(input())

ans=0
for i in range(n):
  ans+=i
print(ans)
# Judge status: Wrong Answer
K, X = map(int, input().split())
print(range((X-K+1), (X+K)))
# Judge status: Accepted
A, B, C = map(int, raw_input().split())
print min(A%2*B*C, B%2*C*A, C%2*A*B)
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))

ans = set()
for i in range(1, n-1):
	print(i)
	a = []
	a.append(p[i-1])
	a.append(p[i])
	a.append(p[i+1])
	a.sort()
	if a[0] < a[1] and a[1] < a[2]:
	  ans.add(a[1])
	elif a[0] == a[1]:
	 	ans.add(a[2])
	elif a[1] == a[2]:
		ans.add(a[1])
	
print(len(ans))
# Judge status: Wrong Answer
k,a,b=map(int,input().split())

if a+1<b:
    ans=0
    if k<=a:
        ans=k+1
    else:
        ans=a+1
        k-=a
        if k%2==0:
            ans+=(k//2)*(b-a)
        else:
            ans+=(k//2)*(b-a)+1


    print(ans)


else:
    print(1+k)
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))

x_ = sorted(X)
m0 = x_[N // 2 - 1]
m1 = x_[N // 2]

for x in X:
    if x <= m0:
        print(m1)
    else:
        print(m0)