Harryxun/stf_run huggingface dataset:
import sys
#from bisect import bisect_left as bl
input = sys.stdin.readline

n,Q=map(int,input().split())
xs = []
for _ in range(n):
    s,t,x=map(int,input().split())
    xs += [(s-x-0.5,True,x), (t-x-0.5,False,x)]
xs.sort(key=lambda x:x[0])
xs += [(t-x,True,x)]

h=set()
q = int(input())
for t,r,x in xs:
    if q < t:
        if h:
            c = min(h)
        else:
            c = -1
        while True:
            if q >= t:
                break
            print(c)
            Q-=1
            if not Q:
                sys.exit()
            q = int(input())
    if r:
        h.add(x)
    else:
        h.remove(x)


### FIXED CODE ###

import sys
input = sys.stdin.readline

n,Q=map(int,input().split())
b_num = 2**(n-1).bit_length()
mx = 10**9
segl=[mx]*2*b_num 

def update( k, x):
    k += b_num-1
    segl[k] = x
    while k+1:
        k = (k-1)//2
        segl[k] = min(segl[k*2+1],segl[k*2+2])
    
if __name__ == '__main__':
    xs = []
    for i in range(n):
        s,t,x=map(int,input().split())
        xs += [(s-x-0.4,True,x,i), (t-x-0.5,False,x,i)]
    for _ in range(Q):
        xs.append((int(input()),2))
    xs.sort(key=lambda x:x[0])
    for x in xs:
        if x[1]==2:
            print(segl[0] if segl[0]!= mx else -1)
            continue
        update(x[3], x[2] if x[1] else mx)
a, b = input().split()
if a * b % 2 == 0:
  print("Even")
elif
  print("Odd")

### FIXED CODE ###

a, b = map(int,input().split())
if (a * b) % 2 == 0:
  print("Even")
else:
  print("Odd")
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

import numpy as np
N = int(input())
d = LI()
d.sort()
cnt_k = np.array([0 for i in range(max(d))])

for i in range(N):
    cnt_k[:d[i]] += 1

print(np.count_nonzero(cnt_k==N//2))


### FIXED CODE ###

# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

def LI(): return list(map(int, sys.stdin.readline().split()))

import numpy as np
N = int(input())
d = LI()
d.sort()
cnt = 0
ans = d[N//2]-d[N//2-1]
print(ans)
def main():
    mod = 10**9+7
    n, m, k = list(map(int, input().split()))
    # 　ある配置を固定した時、その2つの配置でmanhattan距離が計算される回数は、他の組み合わせ数。
    combination = mod_combination(n*m-2, k-2)
    x=y=0
    for i in range(1, n):
        x += i * (n-i)
    for j in range(1, m):
        y += j * (m-j)
    return (((m ** 2) % mod * x % mod) + ((n ** 2) % mod * y % mod)) * combination % mod


def mod_combination(n, r, mod=10**9+7):
    fact = 1
    for i in range(n-r+1, n+1):
        fact = fact * i % mod
    divisor = 1
    for j in range(1, r+1):
        divisor = divisor * j % mod
    return int(fact/divisor)


print(main())

### FIXED CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial


INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LIM(): return list(map(lambda x:int(x) - 1, sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def LIRM(n): return [LIM() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
mod = 1000000007


a, b = LI()
if a>=13:
    print(b)
elif 12>=a>=6:
    print(b//2)
else:
    print(0)
def main():
  S=input()
  N=len(S)
  s=0
  for i in range(N//2):
      if S[i]!=S[N-1-i]:
        S[N-1-i]=S[i]
        s+=1
     else:
       s=s
  print(s)
main()

### FIXED CODE ###

def main():
  S=input()
  s=0
  N=len(S)
  for i in range(N//2):
    if S[i]!=S[N-1-i]:
      s+=1
  print(s)
main()
n = int(input())
S = map(int, input(). split())
q = int(input())
T = map(int, input(). split())

print(len(S & T))

### FIXED CODE ###

n = int(input())
S = list(map(int, input().split()))
q = int(input())
T = list(map(int, input().split()))

Sum = 0

for i in T:
  if i in S:
    Sum += 1
print(Sum)
import sys
for line in sys.stdin:
????????xy = sorted(map(int , line.split()))
????????if xy[0] == 0 and xy[1] == 0: break
????????print(*xy)

### FIXED CODE ###

import sys
 
#ff = open("test.txt", "r")
ff = sys.stdin
 
while True :
    a, b = map(int, ff.readline().split())
    if (a == 0) & (b == 0) :
        break
 
    if a < b : print(a, b)
    else : print(b, a)
 
exit()
N = int(input())
S = input()

if N%2 != 0:
  print('No')
elif S[0:int(N/2)] == S[int(N/2):int(N+1)]:
  print('Yes')
else:
  print('No')
    

### FIXED CODE ###

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

if N%2 != 0:
  print('No')
elif S[0:int(N/2)] == S[int(N/2):int(N+1)]:
  print('Yes')
else:
  print('No')
from math import ceil
k = int(input())
A = list(map(int,input().split()))[::-1]
if A[0]!=2:
    print(-1)
    exit()

flg = True
ans = [2,3]
for i in range(1, k):
    m = A[i]*(ceil(ans[0]/A[i]))
    n = A[i]*(ceil(ans[1]/A[i]))
    
    if not m<=ans[1]<=n:
        flg = False
        break
    else:
        ans = [m,n-1]

if flg:
    print(*ans)
else:
    print(-1)


### FIXED CODE ###

def is_fin(x,y):
    if abs(x-y)==1:
        return False
    return True
n,a,b = map(int,input().split())
turn = 0
while is_fin(a,b):
    if turn%2==0:
        a += 1
    else:
        b -= 1
    turn += 1
print('Alice' if turn%2==1 else 'Borys')
A=[]
for _ in range(3):
    A.append(int(input()))
a=A[0]
b=A[1]
c=A[2]
x=int(input())
count=0
for p in range(a):
    for q in range(b):
        for r in range(c):
            if 500*p+100*q+50*r==x:
                count=count+1
			else:
				count=count
print(count)

### FIXED CODE ###

A=[]
for _ in range(3):
    A.append(int(input()))
a=A[0]
b=A[1]
c=A[2]
x=int(input())
count=0
for p in range(a+1):
    for q in range(b+1):
        for r in range(c+1):
            if 500*p+100*q+50*r==x:
                count=count+1
            else:
              count=count
print(count)
X,Y = map(int.input().split())
if X%Y == 0:
  print(-1)
else:
  print(X*Y-1)

### FIXED CODE ###

X,Y = map(int,input().split())
if X%Y == 0:
  print(-1)
else:
  print(X*(Y-1))
import numpy as np
import math
N , M = map(int, input().split())
a = list()
for n in range(M):
    a.append(int(input()))
dp = np.zeros(N+1)
dp[0] = 1
dp[1] = 0 if a[0] == 1 else 1
for n in range(2,N+1):
    if n in a:
        dp[n] = 0
    else:
        dp[n] = (int(dp[n-1])+int(dp[n-2]))%(math.pow(10,9)+7)
print(int(dp[N]))


### FIXED CODE ###

import numpy as np
N , M = map(int, input().split())
a = list()
for n in range(M):
    a.append(int(input()))
dp = np.zeros(N+1)
dp[0] = 1
if M == 0:
    dp[1] = 1
else:
    dp[1] = 0 if a[0] == 1 else 1
ok = [False]*(N+1)
for x in a:
    ok[x] = True
for n in range(2,N+1):
    if ok[n]:
        continue
    dp[n] = (dp[n-1]+dp[n-2])%(10**9+7)
print(int(dp[N]))
6 6
#####.
#.#.##
####.#
.#..#.
#.##..
#.#...


### FIXED CODE ###

h, w = [int(x) for x in input().split()]
matrix = [list(input()) for _ in range(h)]
surrounding_distances = (-1, 0, 1)


def count_bombs(i, j):
    for da in surrounding_distances:
        for db in surrounding_distances:
            if da == db == 0:
                # Not surrounidings.
                continue
            si = i + da
            sj = j + db
            if si < 0 or si >= h or sj < 0 or sj >= w:
                continue
            if matrix[si][sj] == '#':
                yield 1


for i in range(h):
    for j in range(w):
        if matrix[i][j] == '.':
            matrix[i][j] = str(sum(count_bombs(i, j)))

[print(''.join(row)) for row in matrix]
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(M, K):
    if K != 0:
        print(-1)
        return

    for i in range(2**(M-1)+1):
        print(i, i, '', end='')
    return


def main():
    M, K = read_int_n()
    (slv(M, K))


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(M, K):
    if M == 0:
        if K == 0:
            print(0, 0)
        else:
            print(-1)
    elif M == 1:
        if K == 0:
            print(0, 0, 1, 1)
        else:
            print(-1)
    else:
        if K < 2**M:

            for i in range(2**M):
                if i == K:
                    continue
                print(i, '', end='')
            print(K, '', end='')

            for i in range(2**M-1, -1, -1):
                if i == K:
                    continue
                print(i, '', end='')
            print(K, '', end='')

        else:
            print(-1)


def main():
    M, K = read_int_n()
    (slv(M, K))


if __name__ == '__main__':
    main()
S = input()
K = int(input())
if(S[0]!='1'):
  print(S[0])
else:
  i=0
  while(S[i]=='1'):
    i += 1
  if(K<=i):
    print('1')
  else:
    print(S[i])

### FIXED CODE ###

S = input()
K = int(input())
if(S[0]!='1'):
  print(S[0])
else:
  i=0
  while(S[i]=='1'):
    i += 1
    if(i==len(S)):
      break
  if(K<=i):
    print('1')
  else:
    print(S[i])
import heapq

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

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

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

ans = 0
a = []
j = 0
for i in range(m-1,-1,-1):
  while j<len(ls) and ls[j][0] == m-i:
    heapq.heappush(a,ls[j][1]*(-1))
    j += 1
  g = -1*heapq.heappop(a)
  ans += g

print(ans)

### FIXED CODE ###

import heapq

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

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

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

ans = 0
a = []
j = 0
for i in range(m-1,-1,-1):
  while j<len(ls) and ls[j][0] == m-i:
    heapq.heappush(a,ls[j][1]*(-1))
    j += 1
  
  if a:
    ans += -1*heapq.heappop(a)

print(ans)
X = int(input())
if X<=30:
    print(Yes)
else:
    print(No)

### FIXED CODE ###

x=int(input())
if x>=30:
    print("Yes")
else:
    print("No")
n=int(input())
*a,=map(int,input().split())
cnt=0
mode=0
for i in range(n-1):
    if mode==0:
        if a[i]<a[i+1]:
            cnt+=1
            mode="inc"
        elif a[i]>a[i+1]:
            cnt+=1
            mode="dec"
    if a[i]<a[i+1]:
        if mode=="inc":
            pass
        else:
            mode=0
    elif a[i]>a[i+1]:
        if mode=="dec":
            pass
        else:
            mode=0
if mode==0:
    print(cnt+1)
else:
    prnt(cnt)

### FIXED CODE ###

n=int(input())
*a,=map(int,input().split())
cnt=0
mode=0
for i in range(n-1):
    if mode==0:
        if a[i]<a[i+1]:
            cnt+=1
            mode="inc"
        elif a[i]>a[i+1]:
            cnt+=1
            mode="dec"
    if a[i]<a[i+1]:
        if mode=="inc":
            pass
        else:
            mode=0
    elif a[i]>a[i+1]:
        if mode=="dec":
            pass
        else:
            mode=0
if mode==0:
    print(cnt+1)
else:
    print(cnt)
import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def cnt(x,A,An,Ap,N,Nz):
    res = 0
    if x >= 0:
        res += N * Nz
    res += np.searchsorted(A,x//Ap,side='right').sum()
    res += N * len(An) - np.searchsorted(A,-(-x//An),side='left').sum()
    res -= np.count_nonzero(A*A<=x)
    return res//2


def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))

    print(len(A))

    A = np.array(A)
    A.sort()

    An = A[A<0]
    Az = A[A==0]
    Ap = A[A>0]

    Nz = np.count_nonzero(A==0)

    INF = 10 ** 18

    l = - INF - 1
    r = INF + 1

    while r-l > 1:
        m = (l+r)//2
        if cnt(m,A,An,Ap,N,Nz) >= K:
            r = m
        else:
            l = m

    print(r)





main()


### FIXED CODE ###

import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def cnt(x,A,An,Ap,N,Nz):
    res = 0
    if x >= 0:
        res += N * Nz
    res += np.searchsorted(A,x//Ap,side='right').sum()
    res += N * len(An) - np.searchsorted(A,-(-x//An),side='left').sum()
    res -= np.count_nonzero(A*A<=x)
    return res//2


def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))

    A = np.array(A)
    A.sort()

    An = A[A<0]
    Az = A[A==0]
    Ap = A[A>0]

    Nz = np.count_nonzero(A==0)

    INF = 10 ** 18

    l = - INF - 1
    r = INF

    while r-l > 1:
        m = (l+r)//2
        if cnt(m,A,An,Ap,N,Nz) >= K:
            r = m
        else:
            l = m

    print(r)





main()
import math
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(n):
    flag = True
    for j in range(i):
        if a[i] % a[j] == 0:
            flag = False
            break
    if flag:
        ans += 1
if a[0] == a[1]:
    ans -= 1
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.sort()
cnt = [0 for _ in range(10**6+5)]
ans = 0
if n == 1:
    print(1)
    exit()
if a[0] == 1:
    if a[1] != 1:
        print(1)
    else:
        print(0)
    exit()
for x in a:
    for i in range(x, 10**6+5, x):
        cnt[i] += 1
for x in a:
    if cnt[x] == 1:
        ans += 1
print(ans)
N = int(input())
memo={0:1,1:1,2:2}

def func(n):
    if n in memo:
        return memo[n]
    memo[n] = n*func(n-2)
    return memo[n]

f = list(str(func(N)))  
ans = 0

for i in range(1,len(f)):
    if f[-i]== "0":
        ans += 1
    else:
        break
print(ans)

### FIXED CODE ###

N = int(input())
ans = 0
if N%2 == 1:
    print(0)
else:
    for i in range(1,len(str(N))+100):
        ans += N//(2*5**i)
    print(ans)
a =map(int, input().split())
print(a[0]*a[1], 2(a[0]+a[1]))


### FIXED CODE ###

a,b = [int(x) for x in input().split()]
print(a*b,2*(a+b))
x,y = map(int, input().split())
print(x+(y//2)

### FIXED CODE ###

x,y = map(int, input().split())
print(x+(y//2))
def isOver(a,b):
    return True if (a[0]-b[0])**2 + (a[1]-b[1])**2 =< 4.0 else False

def largestGroup(mtrx,num):
	mx = 1
	ls = [num]
	for i in mtrx[num]:
		if i == num:
			continue
		m = youKnow(mtrx,ls,i)
		mx = max(mx,m)
	return mx

def youKnow(mtrx,ls,num):
	mx = len(ls)
	if set(ls) <= set(mtrx[num]):
		if num not in ls:
			ls.append(num)
		for i in list(set(mtrx[num])-set(ls)):
			m = youKnow(mtrx,ls,i)
			mx = max(mx,m)
	return mx

while True:
	max_over = 0
	n = int(raw_input())
	if n == 0: break
	seals = [map(float, raw_input().split(",")) for i in range(n)]

	overs = []
	for i in range(n):
		over = []
		for j in range(n):
			if isOver(seals[i],seals[j]):
				over.append(j)
		overs.append(over)
		
	ref = [i for i in range(n)]
	for i in ref:
		num_over = largestGroup(overs,i)
		for j in overs[i]:
			ref.remove(j)
		if num_over > max_over:
			max_over = num_over
	print max_over

### FIXED CODE ###

def isOver(array,x,y):
	return True if (array[0]-x)**2+(array[1]-y)**2 <= 1.01 else False
	
while True:
    mx = 0
    n = int(raw_input())
    if n == 0: break
    seals = [map(float, raw_input().split(",")) for i in range(n)]
    x = 0
    while x < 10.0:
    	y = 0.0
    	while y < 10.0:
    		num = 0
    		for seal in seals:
    			if isOver(seal,x,y):
    				num += 1
    		mx = max(mx,num)
    		y += 0.1
        x += 0.1
    print mx
import sys
sys.setrecursionlimit(1000000000)

n = int(input())
x = input()
value = [0, 1]
for i in range(2, 2 * (10 ** 5) + 1):
    ans = 1
    i = i % bin(i).count('1')
    value.append(ans + value[i])

for i in range(n):
    t = x[:i] + ('0' if x[i] == '1' else '1') + x[i + 1:]
    ans = 1
    t = (int(t, 2) % (t.count('1')))
    print(ans + value[t])

### FIXED CODE ###

n = int(input())
x = input()
count_1 = x.count('1')
value = [0, 0]
x_int = int(x, 2)
value[0] = x_int % (count_1 - 1) if count_1 > 1 else 0
value[1] = x_int % (count_1 + 1)
for i in range(n):
    if x[i] == '0':
        tmp = (pow(2, n - i - 1, count_1 + 1) + value[1]) % (count_1 + 1)
    else:
        if count_1 == 1:
            print(0)
            continue
        tmp = (-pow(2, n - i - 1, count_1 - 1) + value[0]) % (count_1 - 1)
    ans = 1
    while tmp > 0:
        tmp = tmp % (bin(tmp).count('1'))
        ans += 1
    print(ans)
import math
from decimal import Decimal
 
n = int(input())
 
if n == 0:
  print(':(')
else:
  for i in range(1, n):
    if math.floor(Decimal(str(i)) * Decimal("1.08")) == n:
      print(i)
      break
  else:
    while True:
	  pass

### FIXED CODE ###

n = int(input())
 
ans = -1
for i in range(1, n+1):
  if int(i  * 1.08) == n:
    ans = i
if ans == -1:
  print(':(')
else:
  print(ans)
k = int(input())
print((k//2)*((k+1)//2)


### FIXED CODE ###

x1, y1, x2, y2 = map(int, input().split())

# 回転行列が王道らしい
x3 = x2-(y2-y1)
y3 = y2+(x2-x1)
x4 = x1-(y2-y1)
y4 = y1+(x2-x1)

print(x3, y3, x4, y4)
inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=0;
else:
  ans=1;
printf('%d %d'%(inp[0]*inp[1]*0.5,ans))

### FIXED CODE ###

inp=list(map(int,input().split()))
if 2*inp[2]==inp[0] and 2*inp[3]==inp[1]:
  ans=1;
else:
  ans=0;
print('%.6f %d'%(inp[0]*inp[1]*0.5,ans))
from sys import stdin
X,Y,A,B,C = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]
Q = [int(x) for x in stdin.readline().rstrip().split()]
R = [int(x) for x in stdin.readline().rstrip().split()]
 
P.sort()
Q.sort()
R.sort()
 
P = P[A-X:]
Q = Q[B-Y:]

ans = 0
while True:
    if P and Q:
        if P[-1] > Q[-1] and X > 0:
            if P[-1] > R[-1]:
                ans += P.pop()
            else:
                ans += R.pop()
            X -= 1
        else:
            if Q[-1] > R[-1]:
                ans += Q.pop()
            else:
                ans += R.pop()
            Y -= 1
    elif P and R:
        if P[-1] > R[-1]:
                ans += P.pop()
        else:
            ans += R.pop()
        X -= 1
    elif Q and R:
        if Q[-1] > R[-1]:
                ans += Q.pop()
        else:
            ans += R.pop()
        Y -= 1
    elif P:
        ans += P.pop()
        X -= 1
    elif Q:
        ans += Q.pop()
        Y -= 1
        
    if X == 0 and Y == 0:
            break
print(ans)

### FIXED CODE ###

from sys import stdin
X,Y,A,B,C = [int(x) for x in stdin.readline().rstrip().split()]
P = [int(x) for x in stdin.readline().rstrip().split()]
Q = [int(x) for x in stdin.readline().rstrip().split()]
R = [int(x) for x in stdin.readline().rstrip().split()]

P.sort(reverse=True)
Q.sort(reverse=True)

res = P[:X] + Q[:Y] + R
res.sort(reverse=True)

print(sum(res[:X+Y]))
#  入力
#  足場の高さ
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))


#  方針
#  i番目の足場にいるという状態に対して
#  その足場に最も少ないコストを記録する．

#  A_Frog.pyでわかることだが，pythonはver2のappendを使う方が処理が早い
#  足場0のコストは0
dp = [0 for i in range(len(h))]

for i in range(1, n):
    #  i番目の足場のコストの候補
    temp = [dp[j] + abs(h[i] - h[j]) for j in range(i - k, i) if j >= 0]
    #  候補の最小値をコストに記録
    dp[i] = min(temp)

print(dp[n - 1])


### FIXED CODE ###

#  入力
#  足場の高さ
input()
h = list(map(int, input().split()))


#  方針
#  i番目の足場にいるという状態に対して
#  その足場に最も少ないコストを記録する．

#  初期化は大きは数で
dp = [1e20 for i in range(len(h))]
#  スタートはコスト0
dp[0] = 0

#  i番目の足場でのコストを利用して
#  i+1, i+2番目のコストを計算する
for i in range(len(h) - 1):
    dp[i + 1] = (
        dp[i + 1]
        if dp[i + 1] < dp[i] + abs(h[i + 1] - h[i])
        else dp[i] + abs(h[i + 1] - h[i])
    )
    if i + 2 < len(h):
        dp[i + 2] = (
            dp[i + 2]
            if dp[i + 2] < dp[i] + abs(h[i + 2] - h[i])
            else dp[i] + abs(h[i + 2] - h[i])
        )

print(dp[len(h) - 1])
a, b, c, d = map(int, input().split())
 
before = 0
after = 0
 
if a >= c:
  before = a - c
else:
  before = c - a
 
if b >= d:
  after = d
else:
  after = b
print(after - before)

### FIXED CODE ###

n = input()

if n[0] == n[2]:
  print("Yes")
else:
  print("No")
n=int(input())
l=list()
if n<=5:
  print("Yes")
  exit()
for i in range(2, n//2+1):
    if n % i == 0: 
        if (n//i,i) not in l:
            l.append((i,n//i))
flag=0
for i in l:
    if i[0]<=9 and i[1]<=9:
        flag=1
        print("Yes")
        exit()
if not flag:
    print("No")


### FIXED CODE ###

a,b=map(int,input().split(' '))
count=0
if (a<=9 and a>=1) and (b<=9 and b>=1) :
    print(a*b)
else:
    print("-1")
n = int(input())
A = list(map(int, input().split()))

Colors = []
High_scorer = []
for a in A:
    if a < 400:
        Colors.append("Gray")
    if 400 <= a and a < 800:
        Colors.append("Brown")
    if 800 <= a and a < 1200:
        Colors.append("Green")
    if 1200 <= a and a < 1600:
        Colors.append("Light_blue")
    if 1600 <= a and a < 2000:
        Colors.append("Blue")
    if 2000 <= a and a < 2400:
        Colors.append("Yellow")
    if 2400 <= a and a < 2800:
        Colors.append("Orange")
    if 2800 <= a and a < 3200:
        Colors.append("Red")
    if 3200 <= a:
        High_scorer.append(a)

MIN = len(set(Colors))
H = len(High_scorer)

MIN >= 1:
    print(MIN, (MIN+H))
MIN = 0:
    print(1, H)

### FIXED CODE ###

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

Colors = []
High_scorer = []
for a in A:
    if a < 400:
        Colors.append("Gray")
    if 400 <= a and a < 800:
        Colors.append("Brown")
    if 800 <= a and a < 1200:
        Colors.append("Green")
    if 1200 <= a and a < 1600:
        Colors.append("Light_blue")
    if 1600 <= a and a < 2000:
        Colors.append("Blue")
    if 2000 <= a and a < 2400:
        Colors.append("Yellow")
    if 2400 <= a and a < 2800:
        Colors.append("Orange")
    if 2800 <= a and a < 3200:
        Colors.append("Red")
    if 3200 <= a:
        High_scorer.append(a)

MIN = len(set(Colors))
H = len(High_scorer)

if MIN >= 1:
    print(MIN, (MIN+H))
elif MIN == 0:
    print(1, H)
n = int(input())
s = 0
for i in len(n):
    s += n[i]

print(["No","Yes"][n%s == 0])

### FIXED CODE ###

n = int(input())
s = 0
for i in str(n):
    s += int(i)
print("Yes" if n%s == 0 else "No")