Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-

N = int(input())

values = [0]*N
value_count_map = {}
for i in range(N):
    in_value = int(input())
    values[i] = in_value
    value_count = 0
    if in_value in value_count_map:
        value_count = value_count_map[in_value]
    value_count_map[in_value] = value_count + 1

sorted_values = sorted(value_count_map.keys(), reverse=True)
max_value = sorted_values[0]
next_max_value = sorted_values[1]
for row in range(N):
    if value_count > 1:
        print(max_value)
    elif values[row] == max_value:
        print(next_max_value)
    else:
        print(max_value)


### FIXED CODE ###

# -*- coding: utf-8 -*-

N = int(input())

values = [0]*N
value_count_map = {}
for i in range(N):
    in_value = int(input())
    values[i] = in_value
    value_count = 0
    if in_value in value_count_map:
        value_count = value_count_map[in_value]
    value_count_map[in_value] = value_count + 1

max_value = max(value_count_map.keys())
value_count = value_count_map.pop(max_value)
if value_count == 1:
    next_max_value = max(value_count_map.keys())
for row in range(N):
    if value_count > 1:
        print(max_value)
    elif values[row] == max_value:
        print(next_max_value)
    else:
        print(max_value)
mod=10**9+7
n,k=map(int,input().split())
arr=list(map(int,input().split()))
arr=sorted(arr,reverse=True,key=lambda x:abs(x))
if k==n:
  ans=1
  for i in range(n):
    ans*=arr[i]
    ans%=mod
  print(ans)
else:
  if k%2==1 and max(arr)<0:
    ans=1
    for i in range(k):
      ans*=arr[n-1-i]
      ans%=mod
    print(ans)
  else:
    ans=1
    cnt=0
    for i in range(k):
      if arr[i]<0:
        cnt+=1
      ans*=arr[i]
      ans%=mod
    if cnt%2==0:
      print(ans)
    else:
      min_plus=0
      min_minus=0
      for i in range(k):
        if arr[i]>=0:
          min_plus=arr[i]
        else:
          min_minus=arr[i]
      max_plus=0
      max_minus=0
      for i in range(k,n):
        if arr[i]>=0 and max_plus==0:
          max_plus=arr[i]
        if arr[i]<0 and max_minus==0:
          max_minus=arr[i]
      if min_plus*max_plus>=min_minus*max_minus:
        arr.remove(min_minus)
        ans=1
        for i in range(k-1):
          ans*=arr[i]
          ans%=mod
        ans*=max_plus
        ans%=mod
      else:
        arr.remove(min_plus)
        ans=1
        for i in range(k-1):
          ans*=arr[i]
          ans%-mod
        ans*=max_minus
        ans%=mod
      print(ans)

### FIXED CODE ###

import heapq
 
mod=10**9+7
n,k=map(int,input().split())
arr=list(map(int,input().split()))
q=[]
cnt_plus=0
for i in range(n):
  if arr[i]>0:
    cnt_plus+=1
    heapq.heappush(q,(-arr[i],1))
  elif arr[i]<0:
    heapq.heappush(q,(arr[i],-1))
  else:
    heapq.heappush(q,(0,0))
pick=[]
prev_plus=0
prev_minus=0
cnt=0
for i in range(k):
  tmp,flag=heapq.heappop(q)
  tmp*=-1
  if flag==0:
    print(0)
    exit()
  if flag==1:
    pick.append(tmp)
    prev_plus=tmp
  if flag==-1:
    if cnt==0:
      prev_minus=tmp
      cnt+=1
    else:
      cnt=0
      pick.append(prev_minus)
      pick.append(tmp)
if cnt==0:
  ans=1
  for i in range(k):
    ans*=pick[i]
    ans%=mod
  print(ans%mod)
else:
  cand_plus=0
  cand_minus=0
  while len(q)!=0:
    tmp,flag=heapq.heappop(q)
    tmp*=-1
    if flag==1 and cand_plus==0:
      cand_plus=tmp
    if flag==-1 and cand_minus==0:
      cand_minus=tmp
  if (k%2==1 and cnt_plus==0) or (cand_plus==0 and cand_minus==0):
    if arr.count(0)!=0:
      print(0)
      exit()
    else:
      q=[]
      for i in range(n):
        heapq.heappush(q,abs(arr[i]))
      ans=1
      for _ in range(k):
        ans*=heapq.heappop(q)
        ans%=mod
      print((-ans)%mod)
  else:
    if prev_plus*cand_plus>=prev_minus*cand_minus:
      pick.append(cand_plus)
    else:
      if prev_plus!=0:
        pick.remove(prev_plus)
        pick.append(prev_minus)
        pick.append(cand_minus)
      else:
        pick.append(cand_plus)
    ans=1
    for i in range(k):
      ans*=pick[i]
      ans%=mod
    print(ans%mod)
n,k,q = map(int, input().split())
a = [0]*n
for i in range(n):
  a[int(input())] += 1

for x in a:
  if k - q + x > 0:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

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

for x in a:
  if k - q + x > 0:
    print("Yes")
  else:
    print("No")
N = int(input())
H_list = list(map(int,input().split()))
Flag = False
if N == 1:

    print("Yes")
    
else:
    for i in range(N):
        if H_list[N-1-i-1] - H_list[N-1-i] > 1:
            print("No")
            break
        elif H_list[N-1-i-1] - H_list[N-1-i] == 1:
            H_list[N-1-i-1] = H_list[N-1-i-1] -1
        else:
            continue
     
Flag = True

if Flag == True:
    print("Yes")

### FIXED CODE ###

List = list(map(int,input().split()))
A = List[0]
B = List[1]
C = List[2]

if (C - A + B) >= 0:

	C = C - (A - B)
	print(C)
else:
	print(0)
A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0
for i in range(A):
  for j in range(B):
    for k in range(C):
    if 500*i + 100*j + 50*k == X:
      cnt += 1
print(cnt)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())
cnt = 0
for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i + 100*j + 50*k == X:
        cnt += 1
print(cnt)
a,b,x=map(int,input().split())
L=list(range(a,b+1))
L_2=[]
for i in L:
    if i % x != 0:
        continue
    L_2.append(i)
print(len(L_2))

### FIXED CODE ###

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

if a%x==0:
    print(b_p-a_p+1)
else:
    print(b_p-a_p)
k=set("aqwertyuioplkjhgfdsazxcvbnm")
s=set(input())
ks=list(k-s)
ks.sort()
print(ks[0])

### FIXED CODE ###

k=set("aqwertyuioplkjhgfdsazxcvbnm")
s=set(input())
ks=list(k-s)
if len(ks)==0:
  print("None")
else:
  ks.sort()
  print(ks[0])
w = input()

s = "Sunny"
c = "Cloudy"
r = "Rainy"

if w == s:
  print(c)
elif w == c:
  print(r)
else w == r:
  print(s)

### FIXED CODE ###

w = input()

s = "Sunny"
c = "Cloudy"
r = "Rainy"
 
if w == s:
  print(c)
elif w == c:
  print(r)
else:
  print(s)
from itertools import combinations
N, M, Q = map(int,input().split())
P = [list(map(int,input().split())) for i in range(Q)]

A = list(itertools.combinations(range(1,M+1), N))
number = len(A)

amount = 0
max_amount = 0
for i in range(number): # 0,1,2,3 A
    
    for j in range(Q): # 0,1,2
        bi = P[j][1]
        ai = P[j][0]
        
        
        if(A[i][bi-1] - A[i][ai-1] == P[j][2]):
            amount += P[j][3]
    
   # print(amount)
    if(amount >= max_amount):
        max_amount = amount
    
    amount = 0
    
print(max_amount)

### FIXED CODE ###

import itertools
N, M, Q = map(int,input().split())
P = [list(map(int,input().split())) for i in range(Q)]

A = list(itertools.combinations_with_replacement(range(1,M+1), N))
number = len(A)

amount = 0
max_amount = 0
for i in range(number): #A
    
    for j in range(Q): # P
        bi = P[j][1]
        ai = P[j][0]
        if(A[i][bi-1] - A[i][ai-1] == P[j][2]):
            amount += P[j][3]
        
   # print(amount)
    
   # print(amount)
    if(amount >= max_amount):
        max_amount = amount
    
    amount = 0
    
print(max_amount)
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    counter = collections.Counter(A)
    keys = [False]*N
    keys[(N - 1) % 2] = True
    for n in range(1, N//2+1):
        keys[((N - 1) % 2)+2*n] = True
    if N % 2 != 0 and counter[0] != 1:
        print(0)
        exit()

    cnt = 0
    for k, v in counter.items():
        if k == 0: continue
        if not keys[k] or v != 2:
            print(0)
            exit()
        cnt += 1

    print((N // 2) * cnt)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    A = il()
    cnt = collections.Counter(A)

    for k, v in cnt.items():
        if k == 0 and v != 1:
            print(0)
            exit()
        elif k != 0 and v != 2:
            print(0)
            exit()
    print((2 ** (N // 2))%MOD)


if __name__ == '__main__':
    main()
n = int(input())
h = list(map(int, input().split()))

cnt = 0
ansers = []

for i in range(len(h)-1):
  if h[i] >= h[i+1]:
    cnt += 1
  else:
    ansers.append(cnt)
    cnt = 0
  ansers.append(cnt)

print(max(ansers))


### FIXED CODE ###

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

cnt = 0
ansers = []

for i in range(len(h)-1):
  if h[i] >= h[i+1]:
    cnt += 1
  else:
    ansers.append(cnt)
    cnt = 0
else:
  ansers.append(cnt)

print(max(ansers))
n = int(input().split())
list = list(map(int, input().split()))

sum = 0
for i in range(n):
    sum += list[i]

print(min(list), max(list), sum)


### FIXED CODE ###

#
# 4d
#


def main():
    n = int(input())
    a = list(map(int, input().split()))
    print(f"{min(a)} {max(a)} {sum(a)}")


if __name__ == '__main__':
    main()
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

N = int(input())
A = [int(_) for _ in input().split()]

print(gcd_list(A))

### FIXED CODE ###

import fractions
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

N = int(input())
A = [int(_) for _ in input().split()]

print(gcd_list(A))
n = input()
for i in range(1,n+1):
    if(i%3==0):
        print('%d'%(i))
    elif(i%10==3):
        print('%d' % (i))


### FIXED CODE ###

n = int(input())
print(" ",end="")
print(*[i for i in range(1,1+n) if i%3==0 or'3' in str(i)])
garage = []
while True:
    num = int(input())
    if num == 0:
        print(garage.pop())
    else:
        garage.append(num)

### FIXED CODE ###

garage = []
while True:
    try:
        car = int(input())
    except:
        break
    if car == 0:
        print(garage.pop())
    else:
        garage.append(car)
import sys

n, m, *xyz = map(int, sys.stdin.read().split())
xyz = zip(*[iter(xyz)] * 3)

root = list(range(n+1))
height = [0] * (n + 1)

def find_root(v):
    u = root[v]
    if u == v:
        return u
    w = find_root(u)
    root[v] = w
    return w

def unite(u, v):
    ru = find_root(u)
    rv = find_root(v)
    if ru == rv:
        return
    if height[u] >= height[v]:
        root[rv] = ru
        height[ru] = max(height[ru], height[rv] + 1)
    else:
        root[ru] = rv

def main():
    for x, y, z in xyz:
        unite(x, y)
    
    for i in range(1, n+1):
        find_root(i)

    return len(set(root[1:]))

if __name__ == '__main__':
    ans = main()
    print(ans)

### FIXED CODE ###

import sys

n, m, *xyz = map(int, sys.stdin.read().split())
xyz = zip(*[iter(xyz)] * 3)

root = list(range(n+1))
height = [0] * (n + 1)

sys.setrecursionlimit(10**7)
def find_root(v):
    u = root[v]
    if u == v:
        return u
    w = find_root(u)
    root[v] = w
    return w

def unite(u, v):
    ru = find_root(u)
    rv = find_root(v)
    if ru == rv:
        return
    if height[u] >= height[v]:
        root[rv] = ru
        height[ru] = max(height[ru], height[rv] + 1)
    else:
        root[ru] = rv

def main():
    for x, y, z in xyz:
        unite(x, y)
    
    for i in range(1, n+1):
        find_root(i)

    return len(set(root[1:]))

if __name__ == '__main__':
    ans = main()
    print(ans)
import sys
inputs = sys.stdin.readline
def main():
	ans = 1
	a = 0
	b = 0
	flg2 = 0
	N, M = map(int,inputs().split())
	A =[0]*(M+1)
	for i in range(M):
		a = int(inputs())
		A[i] = a-1-b
		b = a + 1
	A[M] = N - b
	A.sort()
	if A [0] < 0:
		print(0)
		flg2 = 1
	p = 1
	q = 1
	t = 0
	flg = 0
	while (A[t]<2):
		t = t+1
		if t > M:
			print(0)
			flg2 = 1
	for k in range(2,N+1):
		r = p + q
		p = q
		q = r
		while (A[t] == k):
			ans = ans*r%1000000007
			t += 1
			if t == M+1:
				flg = 1
				break
		if flg == 1:
			break
	if flg2 == 0:
		print(ans%1000000007)
main()

### FIXED CODE ###

import sys
inputs = sys.stdin.readline
def main():
	ans = 1
	a = 0
	b = 0
	flg2 = 0
	N, M = map(int,inputs().split())
	A =[0]*(M+1)
	for i in range(M):
		a = int(inputs())
		A[i] = a-1-b
		b = a + 1
	A[M] = N - b
	A.sort()
	if A [0] < 0:
		flg2 = 1
	p = 1
	q = 1
	t = 0
	flg = 0
	while (A[t]<2):
		t = t+1
		if t > M:
			flg = 1
			break
	for k in range(2,N+1):
		r = p + q
		p = q
		q = r
		if flg == 1:
			break
		while (A[t] == k):
			ans = ans*r%1000000007
			t += 1
			if t == M+1:
				flg = 1
				break
		if flg == 1:
			break
	if flg2 == 0:
		print(ans%1000000007)
	else:
		print(0)
main()
N = int(input())
M = int(input())

# 偶数＋偶数
pattern_1 = N*(N-1)/2

# 奇数＋奇数
pattern_2 = M*(M-1)/2

print(pattern_1 + pattern_2)

### FIXED CODE ###

A = list(map(int, input().split()))
N = A[0]
M = A[1]

# 偶数＋偶数
pattern_1 = N*(N-1)/2

# 奇数＋奇数
pattern_2 = M*(M-1)/2

print(int(pattern_1 + pattern_2))
n=int(input())

s=input()
l=len(s)
if l>n:
  print(s[:n].join'...')
else:
  print(s)

### FIXED CODE ###

n=int(input())
 
s=input()
l=len(s)
if l>n:
  print(s[:n]+'...')
else:
  print(s)
#!/usr/bin/env python3
import sys
import math
from functools import reduce

def solve(N: int, A: "List[int]"):
    print(reduce(math.gcd,A))

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import math

def gcd(x,y):
    if y == 0:
        return x
    else:
        return gcd(y,x%y)

def solve(N: int, A: "List[int]"):
    res = A[0]
    B = A[1:]
    for a in B:
        res = gcd(res,a)

    print(res)

# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()
n,x,m=map(int,input().split())
l=[0]*m
s=[0]*m
t=p=0
while l[x]<1:
  l[x]=t
  s[x]=s[p]+x
  p=x
  x=pow(p,2,m)
  t+=1
T=t-l[x]
S=s[p]+x-s[x]
if n<l[x]:
  print(s[l.index((n-1)%m)])
else:
  print(S*((n-l[x])//T)+s[l.index((l[x]+(n-l[x])%T-1)%m)])

### FIXED CODE ###

n,x,m=map(int,input().split())
l=[-1]*m
s=[0]*m
t=p=0
while l[x]<0:
  t+=1
  l[x]=t
  s[x]=s[p]+x
  p=x
  x=pow(p,2,m)
T=t+1-l[x]
S=s[p]+x-s[x]
if n<l[x]:
  print(s[l.index(n)])
else:
  print(S*((n-l[x])//T)+s[l.index(l[x]+(n-l[x])%T)])
# -*- coding: utf-8 -*-
# 整数の入力
a = int(input())
# スペース区切りの整数の入力
b, c = map(int, input().split())
# 文字列の入力
s = input()
# 出力
print("{} {}".format(a+b+c, s))

### FIXED CODE ###

s=input()
print(s[0]+str((len(s)-2))+s[-1])
a = []
while 1:
 s = input()
 if s == 'END_OF_TEXT':
  break
 else:
  s = list(s.split('.'))
  s.remove('.')
  s = list(s[0].split())
  a.append(s)

print(a.count(a[0]) - 1)

### FIXED CODE ###

word = input()
counter = 0
while 1:
 s = input()
 if s == 'END_OF_TEXT':
  break
 else:
  s = list(s.lower().split())
  counter += s.count(word)
  counter += s.count(word + '.')

print(counter)
import collections
n = int(input())
s = [input() for i in range(n)]
c = collections.Counter(s)
print(len(a))

### FIXED CODE ###

import collections
n = int(input())
s = [input() for i in range(n)]
c = collections.Counter(s)
print(len(c))
def checker(bbit,listN,N):
    i = 0
    j = 0
    ng = False
    #print(N)
    #print(listN)
    #print(bin(bbit))
    while N > i :
        j=0
        checkFig = 3
        ibit = 1 << i
        while N > j :
            cbit = 1 << j
            if bbit & cbit == 0 :
                #print("A:{} {}".format(j,i))
                pass
            elif listN[j][i] == 3 :
                #print("B:{} {}".format(j,i))
                pass
            elif (listN[j][i] == 0) and (bbit & ibit != 0):
                ng = True
                break
            elif checkFig == 3 :
                #print("C:{} {}".format(j,i))
                checkFig = listN[j][i]
            elif checkFig != listN[j][i] :
                ng = True
                #print("D:{} {}".format(j,i))
                break
            j += 1
        if ng :
            #print(ng)
            break
        else :
            i +=1
    return (not ng)


def main():
    N = int(input())
    listA = [[3 for j in range(N)] for k in range(N)]
    n = 0
    while N > n :
        a = int(input())
        i = 0
        while a > i:
           x,y  = map(int,input().split())
           listA[n][x-1] = y
           i += 1
        n += 1
        
    honestBit = pow(2, N)-1
    honest = 0
    
    while honestBit > 0:
        ok = checker(honestBit,listA,N)
        if ok :
            okbit = honestBit
            oknum = 0
            while okbit > 0 :
                oknum += (okbit % 2) 
                okbit /= 2
            
            if oknum > honest :
                honest = oknum 
        honestBit -= 1
    

main()

### FIXED CODE ###

a, b, c = map(int, input().split())
if a+b+c >= 22 :
    print("bust")
else:
    print("win")
l = [[int(i) for i in input().split()] * 3]
print(l[0][0] + l[1][1] + l[2][2])

### FIXED CODE ###

s = ''
for i in range(3): s += input()[i]
print(s)
N, M = [int(i) for i in input().split()]
left = 0
right = M
for _ in range(N):
  L, R = [int(i) for i in input().split()]
  if left < L:
    left = L
  if right > R:
    right = R
print(R-L+1)

### FIXED CODE ###

N, M = [int(i) for i in input().split()]
left = 1
right = N
for _ in range(M):
  L, R = [int(i) for i in input().split()]
  if left < L:
    left = L
  if right > R:
    right = R
if left <= right:
  print(right-left+1)
else:
  print(0)
weather = imput()

if (weather == 'Sunny')
    print 'Cloudy'
if (weather == 'Cloudy')
    print 'Rainy'
if (weather == 'Rainy')
    print 'Sunny'

### FIXED CODE ###

weather = input()

if weather == 'Sunny':
    print('Cloudy')

if weather == 'Cloudy':
    print('Rainy')

if weather == 'Rainy':
    print('Sunny')
a = input()
b = input()

if(a*b % 2 == 0):
  print('Even')
else:
  print('Odd')

### FIXED CODE ###

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

if(a[0]*a[1] % 2 == 0):
  print('Even')
else:
  print('Odd')
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
s = [0] * n
for i in sc:
    s[i[0]-1] = str(i[1])
ans = ""
cnt = True
for i in s:
    #print(i)
    if i == '0' and cnt and len(s) != 1:
        ans += str(1)
        cnt = False
    ans += str(i)
#print(ans)
if len(ans) != len(int(ans)):
    print(-1)
else:
    print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(m)]
if n == 3:
    l = range(100, 1000)
if n == 2:
    l = range(10, 100)
if n == 1:
    l = range(0, 10)
flag = False
for i in l:
    num = str(i)
    if all([num[s-1] == str(c) for s, c in sc]):
        #print(num)
        #exit()
        flag = True
        ans = num
        break
if flag:
    print(num)
else:
    print(-1)
#print(-1)
n,k = map(int,input().split())
line = list(map(int,input().split()))

inf = float('inf')
line.extend([inf for i in range(k)])
box = [inf for i in range(n + k)]
#out of rangeを避けるため
  
def frog(x):
  box[0] = 0
  if x == n-1:
    return box[n-1]
  else:    
    for i in range(1,k+1):
      cost = abs(line[x] - line[x+i])
      if box[x+i] >= box[x] + cost:
        box[x+i] = box[x] + cost
    return frog(x+1)
print(frog(0))

### FIXED CODE ###

n,k = map(int,input().split())
line = list(map(int,input().split()))
 
inf = float('inf')
line.extend([inf for i in range(k)])
box = [inf for i in range(n + k)]
#out of rangeを避けるため

box[0] = 0
for x in range(n):   
  for i in range(1,k+1):
    cost = abs(line[x] - line[x+i])
    if box[x+i] >= box[x] + cost:
      box[x+i] = box[x] + cost
print(box[n-1])
n,m=map(int,input().split())
a=['.']
a*=n
ans=0
for i in range(m):
    si,ci=input().split()
    si=int(si)
    ci=str(ci)
    if a[si-1]=='.':
        a[si-1]=ci
    else:
        if a[si-1]==ci:
            continue
        else:
            ans=-1
            break

if ans==-1 or (n>=2 and a[0]=='0'):
    print(-1)
else:
    if a[0]=='.':
        a[0]=1
    for i in range(1,n):
        if a[i]=='.':
            a[i]='0'
    a=''.join(a)
    print(a)

### FIXED CODE ###

n,m=map(int,input().split())
a=['.']
a*=n
ans=0
for i in range(m):
    si,ci=input().split()
    si=int(si)
    ci=str(ci)
    if a[si-1]=='.':
        a[si-1]=ci
    else:
        if a[si-1]==ci:
            continue
        else:
            ans=-1
            break

if ans==-1 or (n>=2 and a[0]=='0'):
    print(-1)
else:
    if n==1 and a[0]=='.':
        a[0]='0'
    elif a[0]=='.':
        a[0]='1'
    for i in range(1,n):
        if a[i]=='.':
            a[i]='0'
    a=''.join(a)
    print(a)
#merci drken
from fractions import Fraction
from 
N,X = map(int,input().split())
L = [(_-X) for _ in map(int,input().split())]
def gcd_list(numbers):
  return reduce(math.gcd,numbers)
print(gcd_list(L))
  

### FIXED CODE ###

#starting from X is equivalent to go to x1-X,x2-X,... starting from 0.
#donc x1-X est multiple de D, x2-X l'est aussi...donc gcd des xi-X.
import fractions
from functools import reduce
N,X = map(int,input().split())
L = [abs(i-X) for i in map(int,input().split())]
def gcd_list(numbers):
  return reduce(fractions.gcd,numbers)
print(gcd_list(L))
import math
a,b,h,m=map(int,input().split())

if 30*h+m/2-6*m>=0:
  x=30*h+m/2-6*m
else:
  x=6*m-30*h-m/2
  
print((a^2+b^2-2*a*b*math.cos(x))**(1/2))



### FIXED CODE ###

import math
a,b,h,m=map(int,input().split())

if 30*h+m/2-6*m>=0:
  x=30*h+m/2-6*m
else:
  x=6*m-30*h-m/2
  
print((a**2+b**2-2*a*b*math.cos(math.radians(x)))**(1/2))