Harryxun/stf_run huggingface dataset:
flag = 1
keta,n = map(int,input().split())
sc = []
for i in range(n):
    sc.append(list(map(int,input().split())))

ans = [None]*keta

for j in sc:
    if j[0] == 1 and j[1] == 0 and keta != 1:
        flag = 0
    elif keta == 1:
        ans[0] = j[0][1]
    else:
        try:
            if ans[j[0]-1] == None:
                ans[j[0]-1] = j[1]
            elif ans[j[0]-1] != None and ans[j[0]-1] != j[1]:
                flag = 0
        except:
            flag = 0
        
        
for k in range(len(ans)):
    if k == 0 and ans[0] == None:
        ans[0] = 1
    elif ans[k] == None:
        ans[k] = 0
            
ans_s = ""
for l in ans:
    ans_s += str(l)
    
if flag == 0:
    print("-1")        
else:
    print(ans_s)  

### FIXED CODE ###

flag = 1
keta,n = map(int,input().split())
sc = []
for i in range(n):
    sc.append(list(map(int,input().split())))

ans = [None]*keta

for j in sc:
    if j[0] == 1 and j[1] == 0 and keta != 1:
        flag = 0

    else:
        try:
            if ans[j[0]-1] == None:
                ans[j[0]-1] = j[1]
            elif ans[j[0]-1] != None and ans[j[0]-1] != j[1]:
                flag = 0
        except:
            flag = 0
        
        
for k in range(len(ans)):
    if k == 0 and ans[0] == None and keta != 1:
        ans[0] = 1
    elif ans[k] == None:
        ans[k] = 0
            
ans_s = ""
for l in ans:
    ans_s += str(l)
    
if flag == 0:
    print("-1")        
else:
    print(ans_s)
import collections


def calc(balla, ballb):
    xa, ya = balla
    xb, yb = ballb
    return xa - xb, ya - yb


n = int(input())
balls = [tuple(map(int, input().split())) for _ in range(n)]

a = []
for i in range(0, n - 1):
    for j in range(i + 1, n):
        tmp = calc(balls[i], balls[j])
        a += [tmp, tuple(-i for i in tmp)]
counts = collections.Counter(a)

print(n - max(counts.values()))


### FIXED CODE ###

import collections


def calc(balla, ballb):
    xa, ya = balla
    xb, yb = ballb
    return xa - xb, ya - yb


n = int(input())
balls = [tuple(map(int, input().split())) for _ in range(n)]

if n == 1:
    print(1)
    exit()

a = []
for i in range(0, n - 1):
    for j in range(i + 1, n):
        tmp = calc(balls[i], balls[j])
        a += [tmp, tuple(-i for i in tmp)]
counts = collections.Counter(a)

print(n - max(counts.values()))
import math
from functools import reduce

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

l.insert(0, X)
diff_list = [0] * (int(len(l)/2) + 1)

for ix,i in enumerate(l[1:]):
    diff_list.append(abs(l[ix] - i))

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

print(gcd_list(diff_list))

### FIXED CODE ###


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

l.insert(0, X)
diff_list = [0] * (int(len(l)/2) + 1)

ans = abs(l[0] - l[1])
ix = 2

#a,bの最大公約数
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

for i in l[1:len(l)-1]:
    tmp = abs(i - l[ix])
    ans = gcd(ans, tmp)
    ix += 1
print(ans)
s=input()
ptint('A'+s[8]+'C')

### FIXED CODE ###

s=input()
print('A' + s[8] + 'C')
N = int(input())
F= [list(map(int, input().split())) for _ in range(N)]
P= [list(map(int, input().split())) for _ in range(N)]

tmp = 0
ans = 0
for i in range(1, 2**10+1):
    tmp = 0
    for j in range(N):
        cnt = 0
        for k in range(10):
            if((i>> k)%2 == 1 and F[j][k] == 1):
                cnt += 1
        tmp += P[j][cnt+1]
    ans = max(ans, tmp)

print(ans)

### FIXED CODE ###

N = int(input())
F= [list(map(int, input().split())) for _ in range(N)]
P= [list(map(int, input().split())) for _ in range(N)]

ans = -10000000000
for mask in range(1, 2**10):
    tmp = 0
    for j in range(N):
        cnt = 0
        for k in range(10):
            if((mask>>k)%2 == 1 and F[j][k] == 1):
                cnt += 1
        tmp += P[j][cnt]
    ans = max(ans, tmp)

print(ans)
a= map(int, input().split())
s = input()
if 3200 <= a:
    print(s)
else:
    print('red')

### FIXED CODE ###

a= int(input())
s = input()
if 3200 <= a:
    print(s)
else:
    print('red')
import numpy as np
n = int(input())
l = np.array(list(map(int, input().split())))
b = 1
def multi(n,b,l):
    for i in range(n):
        b = b * l[i] 
    if b > 10 ** 18:
        b = -1
    return b
b = int(multi(b,l))
print(b)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

def input():
    return sys.stdin.readline()[:-1]
n = int(input())
l = list(map(int, input().split(" ")))
output = 1

if 0 in l:
    print(0)
    sys.exit()

for i in range(n):
    output = output * int(l[i])
    if output > 10 ** 18:
        output = -1
        break
print(output)
n=int(input())
a=list(map(int,input().split())
a.sort()
print(a[-1]-a[0])

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
print(max(a)-min(a))
import math
N, X = map(int, input().split())
x_list = list(map(int, input().split()))

x_list.sort()
if N ==1:
    print(x_list[0]-X)
    exit()

m0 = abs(X - x_list[0])

D = 10**9
for i in range(N-1):
    m1 = abs(x_list[i] - x_list[i+1])
    g = math.gcd(m1, m0)

    if D >= g:
        D = g
print(D)


### FIXED CODE ###

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

x_list.sort()
def gcd(a, b):
    if a >= b:
        return a if b == 0 else gcd(b, a % b)
    else:
        return gcd(b, a)


D = abs(X-x_list[0])
for i in range(0, N):
    D = gcd(D,  abs(x_list[i]-X))

print(D)
while True:
    try:
        h, w = map(int, (raw_input()).split())
        if h == 0 and w == 0:
            break
        if 3 <= h <= 100 and 3 <= w <= 100:
            print "{}".format("#" * w)
            for i in range((h - 2)):
                print "{}{}{}".format("#", "." * (w - 2), "#")
            print "{}".format("#" * w)
            print

### FIXED CODE ###

while True:
    try:
        h, w = map(int, (raw_input()).split())
        if h == 0 and w == 0:
            break

        for i in range(h):
            if i == 0 or i == (h - 1):
                print "{}".format("#" * w)
            else:
                print "{}{}{}".format("#", "." * (w - 2), "#")
        print

    except EOFError:
        break
from fractions import gcd
from functools import reduce

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)  

n = int(input())
aa = list(map(int,input().split()))
           
l = lcm(*aa)        
ans = 0
for ai in aa:
  ans += l//ai

print(ans % MOD)

### FIXED CODE ###

from fractions import gcd
from functools import reduce
MOD = 10**9+7
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)  

n = int(input())
aa = list(map(int,input().split()))
           
l = lcm(*aa)        
ans = 0
for ai in aa:
  ans += l//ai

print(ans % MOD)
N = int(input())
x = list(input())[::-1]
num = 0
nump = 0
numm = 0
pop_num = 0
for i in range(N):
    if x[i] == "1":
        pop_num += 1
for i in range(N):
    if x[i] == "1":
        num += pow(2,i,pop_num)
        num %= pop_num 
        nump += pow(2,i,pop_num+1)
        nump %= pop_num  + 1
        numm += pow(2,i,pop_num - 1)
        numm %= pop_num - 1



def popcnt(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c

x = x[::-1]
def calc(i,depth,n):
    if depth == 0:
        if x[i] == "1":
            tmp = numm
            tmp -=  2 ** (N - i - 1)
            tmp %= (pop_num - 1)
            return calc(i,depth+1,tmp)
        else:
            tmp = nump
            tmp +=  2 ** (N - i - 1)
            tmp %= (pop_num + 1)
            return calc(i,depth+1,tmp)
    else:
        if n == 0: return depth
        return calc(i,depth+1, n % popcnt(n))
        

for i in range(N):
   # print(calc(i,0,0))



### FIXED CODE ###

N = int(input())
x = list(input())[::-1]
num = 0
nump = 0
numm = 0
pop_num = 0
for i in range(N):
        if x[i] == "1":
            pop_num += 1
for i in range(N):
    if x[i] == "1":
        num += pow(2,i,pop_num)
        num %= pop_num 
        nump += pow(2,i,pop_num+1)
        nump %= pop_num  + 1
        if pop_num-1 != 0:
            numm += pow(2,i,pop_num - 1)
            numm %= pop_num - 1



def popcnt(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c

x = x[::-1]
def calc(i,depth,n):
    if depth == 0:
        if x[i] == "1":
            tmp = numm
            if pop_num - 1 != 0:
                tmp -= pow(2,N-i-1,pop_num-1)
                tmp %= (pop_num - 1)
            else:
                return 0
            return calc(i,depth+1,tmp)
        else:
            tmp = nump
            tmp += pow(2,N-i-1,pop_num+1)
            tmp %= (pop_num + 1)
            return calc(i,depth+1,tmp)
    else:
        if n == 0: return depth
        return calc(i,depth+1, n % popcnt(n))
        

for i in range(N):
    print(calc(i,0,0))
N,M = map(int,input().split())
a,b=map(int,input().split())
 
l_=[int(n) for n in range(a,b+1)]
 
for i in range(M-1):
  c,d=map(int,input().split())
  if max(c,d)<= a or min(c,d) => b:
    pass
  else:
    l__=[n for n in range(c,d+1)]
    l_=list(set(l_)&set(l__))
  
  
print(len(l_))

### FIXED CODE ###

n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
L=[]
R=[]
for i in range(m):
  L.append(l[i][0])
  R.append(l[i][1])
print(max(min(R)-max(L)+1,0))
a=max(list(map(int,input().split()))
print(':('if a>8else'Yay!')

### FIXED CODE ###

a=max(list(map(int,input().split())));print(':('if a>8 else'Yay!')
def mod_combination(n, k, mod):
    def mod_permutation(n, k, mod):
        if n<=k:
            return 1
        else:
            return (n * mod_permutation(n-1,k,mod))%mod

    def mod_inv_permutation(k, mod):
        k, mod = int(k), int(mod)
        if k<=1:
            return 1
        else:
            return (pow(k,mod-2,mod) * mod_inv_permutation(k-1, mod))%mod

    return (mod_permutation(n,n-k,mod) * mod_inv_permutation(k, mod))%mod

n,a,b=map(int,input().split())
mod=1000000007
print(pow(2,n,mod)-1-mod_combination(n, a, mod)-mod_combination(n, b, mod))

### FIXED CODE ###

def power(x, a):
    if a == 0:
        return 1
    elif a == 1:
        return x
    elif a % 2 == 0:
        return power(x, a//2) **2 % mod
    else:
        return power(x, a//2) **2 * x % mod

def modinv(x):
    return power(x, mod-2)

def binomial_coefficients(n, k):
    numera = 1  
    denomi = 1  

    for i in range(k):
        numera *= n-i
        numera %= mod
        denomi *= i+1
        denomi %= mod
    return numera * modinv(denomi) % mod

n,a,b=map(int,input().split())
mod=1000000007
print((pow(2,n,mod)-1-binomial_coefficients(n, a)-binomial_coefficients(n, b))%mod)
import sys
import math
from collections import deque
import copy

input = sys.stdin.readline

s = input()
t = input()

dp = [[0 for _ in range(len(s) + 10)] for _ in range(len(s) + 10)]

for i in range(1, len(s)):
    for l in range(1, len(t)):
        if s[i - 1] == t[l - 1]:
            dp[i][l] = max(max(dp[i - 1][l - 1] + 1, dp[i][l - 1]), dp[i - 1][l])
        else:
            dp[i][l] = max(dp[i][l - 1], dp[i - 1][l])
length = dp[len(s) - 1][len(t) - 1]
if length == 0:
    print("")
else:
    ans = ""
    i = len(s) - 1
    l = len(t) - 1
    while i > 0 and l > 0:
        if dp[i][l] == dp[i - 1][l - 1] + 1:
            ans = s[i - 1] + ans
            i -= 1
            l -= 1
        elif dp[i-1][l] == dp[i][l]:
            i -= 1
        elif dp[i][l-1] == dp[i][l]:
            l -= 1
    print(ans)



### FIXED CODE ###

import sys
import math
from collections import deque
import copy

input = sys.stdin.readline

s = input()
t = input()

dp = [[0 for _ in range(len(t) + 10)] for _ in range(len(s) + 10)]

for i in range(1, len(s)):
    for l in range(1, len(t)):
        if s[i - 1] == t[l - 1]:
            dp[i][l] = max(max(dp[i - 1][l - 1] + 1, dp[i][l - 1]), dp[i - 1][l])
        else:
            dp[i][l] = max(dp[i][l - 1], dp[i - 1][l])
length = dp[len(s) - 1][len(t) - 1]
if length == 0:
    print("")
else:
    ans = ''
    i = len(s) - 1
    l = len(t) - 1
    while i > 0 and l > 0:
        if dp[i-1][l] == dp[i][l] and i >= 1:
            i -= 1
        elif dp[i][l-1] == dp[i][l] and l >= 1:
            l -= 1
        else:
            ans = s[i - 1] + ans
            i -= 1
            l -= 1
    print(ans)
import math
from functools import reduce
def g(x):return reduce(math.gcd,x)
print(g([int(input().split()[1])]+list(map(int,input().split()))))

### FIXED CODE ###

N,X=map(int,input().split())
x=sorted(map(lambda x:int(x)-X if int(x)-X>0 else -(int(x)-X),input().split()))
for i in range(x[0]+1)[::-1]:
    if x[0]%i:continue
    if sum(map(lambda x:x%i,x))==0:
        print(i)
        break
a,b,k=map(int,input().split())
count=0
for i in range(ab):
  if a%i==0 and b%i==0:
    count+=1
    if count==k:
      print(k)
      exit()
    


### FIXED CODE ###

a,b,k=map(int,input().split())
count=0
for i in range(105):
  j=101-i
  if a%j==0 and b%j==0:
    count+=1
    if count==k:
      print(j)
      exit()
N,Z,W = map(int,input().split())
a = list(map(int,input().split()))

std = abs(Z-W)
last = a[0]

absList = [abs(last-i) for i in a]

ans = ans(last-W)
for i in range(N-1):
	testList = absList[i+1:]
	if min(absList) > ans:
		ans = max(absList)
print(ans)

### FIXED CODE ###

N,Z,W = map(int,input().split())
a = list(map(int,input().split()))

std = abs(Z-W)
last = a[N-1]

absList = [abs(last-i) for i in a]
absList.pop(N-1)
ans = max(abs(last-W), abs(last-a[N-2]))
for i in range(N-1):
	testList = absList[i+1:]
	if min(absList) > ans:
		ans = max(absList)
print(ans)
import sys
sys.setrecursionlimit(1000000000)

def dfs(x, y, sym):
	tile[x][y] = '.'
	for i in range(len(DX)):
		nx = x + DX[i]
		ny = y + DY[i]
		if nx>=0 and nx<N and ny>=0 and ny<M and tile[nx][ny]==sym:
			dfs(nx, ny, sym)

def solve():
	res = 0
	for i in range(N):
		for j in range(M):
			if not tile[i][j] == '.':
				if tile[i][j] == '@':
					dfs(i, j, '@')
					res += 1
				elif tile[i][j] == '#':
					dfs(i, j, '#')
					res += 1
				elif tile[i][j] == '*':
					dfs(i, j, '*')
					res += 1
	print(res)

index = 0	
counter=0 
DX = [-1, 0, 1, 0]
DY = [0, -1, 0, 1]

while True:
	counter+=1
	line = input()
	
	if ' ' in line:
		N = int(line.split(' ')[0])
		M = int(line.split(' ')[1])
		tile = [[0 for i in range(N)]for j in range(M)]
	else:
		tile[counter-2] = list(line)

	if N==0 and M==0:
		break

	if counter-1==M:
		solve()
		counter = 0

### FIXED CODE ###

# -*- coding:utf-8 -*-
import sys
def dfs(x, y, sym):
	tile[x][y] = "."
	for i in range(len(DX)):
		nx = x + DX[i]
		ny = y + DY[i]
		if (0<=nx and nx<N and 0<=ny and ny<M and tile[nx][ny] is sym):
			dfs(nx, ny, sym)

def solve():
	res = 0
	for i in range(N):
		for j in range(M):
			sym = tile[i][j]
			if tile[i][j] != ".":
				if tile[i][j] is sym:
					dfs(i, j, sym)
					res += 1
	print(res)

counter=0
DX = [-1,0,1,0]
DY = [0,-1,0,1]
sys.setrecursionlimit(10**7)
while True:
	line = input()
	if " " in line:
		nums = line.split(" ")
		N = int(nums[0])
		M = int(nums[1])
		tile = [[0 for i in range(M)] for j in range(N)]
	else:
		tile[counter-1] = list(line)
	if N is 0 and M is 0:
		break
	counter += 1
	if counter-1 is N:
		solve()
		counter = 0
S = int(input())
h = 46979 / 3600
m = 46979 % 3600 /60
s = 46979 % 3600 % 60
print(h,m,s,sep=':')

### FIXED CODE ###

S = int(input())
h = S // 3600
m = S % 3600 // 60
s = S % 3600 % 60
print(h,m,s,sep=':')
N,D= map(int, input().split())
xy = [map(int, input().split()) for i in range(N)]
x,y= [list(i) for i in zip(*xy)]

def f(x,y,D):
  s=0
  for i in range(N)
  　　if (x[i]*x[i] + y[i]*y[i])<= D*D:
     　　s=s+1
  return s

print(f(x,y,D))

### FIXED CODE ###

N,D = map(int, input().split())
XY = [map(int, input().split()) for _ in range(N)]
X,Y = [list(i) for i in zip(*XY)]

s=0
for i in range (N):
  if X[i]*X[i]+Y[i]*Y[i]<=D*D:
    s=s+1
print(s)
# coding: utf-8

def is_prime2(q,k=100):
  q = abs(q)
  if q == 2: return True
  if q < 2 or q&1 == 0: return False
  for i in xrange(3,k):
    x,y = q,i
    while y:
      x, y =  y, x % y
    if x != 1: continue
    if pow(i, q-1, q) != 1:
      return False
  return True

X = int(input())

for i in range(X,10**5+4):
  if is_prime(i):
    print(i)
    exit()

### FIXED CODE ###

# coding: utf-8
 
def is_prime2(q,k=100):
  q = abs(q)
  if q == 2: return True
  if q < 2 or q&1 == 0: return False
  for i in range(3,k):
    x,y = q,i
    while y:
      x, y =  y, x % y
    if x != 1: continue
    if pow(i, q-1, q) != 1:
      return False
  return True
 
X = int(input())
 
for i in range(X,10**5+4):
  if is_prime2(i):
    print(i)
    exit()
s = list(input())
if s[o]==s[1] and s[1]==s[2] and s[0]==s[2]:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

x,y,z = map(int,input().split())	
if y == x and y == z and x == z:
  print("No")
elif  x != y and y != z and x != z:
  print("No")
else:
  print("Yes")
A=int(input)
B=int(input)
if 1<=A<=9 and 1<=B<=9:
  print(A*B)
else:
  print(-1)

### FIXED CODE ###

A,B = map(int,input().split())
if 1<=A<=9 and 1<=B<=9:
  print(A*B)
else:
  print('-1')
# -*- coding: <encoding name> -*-
'''
T, X = int(input())
print(T / X)
'''
 T, X = map(int(input()))
 print(T / X)



### FIXED CODE ###

# -*- coding: <encoding name> -*-
'''
T, X = int(input())
print(T / X)
'''
T, X = map(int, input().split())
print(T / X)
n=int(input())

lists=[tuple(map(int,input().split())) for i in range(n-1)]
visitedlist=[-1 for  i in range(n)]
kilist=[[] for i in range(n)]
for i in lists:
    kilist[i[0]-1].append(i[1:])
    kilist[i[1]-1].append(i[0:3:2])
visitedlist[0]=1
anslist=[0 for i in range(n)]
#開始地点1のところは0を基準としている
#1には初めに訪れる
def search(i):
        flag=False
        for j in kilist[i-1]:
            if visitedlist[j[0]-1]<0:
                visitedlist[j[0]-1]=1
                flag=True
                if j[1]%2==0:
                    anslist[j[0]-1]=anslist[i-1]
                elif j[1]%2!=0:
                    anslist[j[0]-1]=1-anslist[i-1]      
        if flag:    
            for j in kilist[i-1]:
                return search(j[0])
            
search(1)
for k in anslist:
    print(k)

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

n=int(input())
visitedlist=[-1 for  i in range(n)]
kilist=[[] for i in range(n)]
anslist=[0 for i in range(n)]
searchedlist=[-1 for i in range(n)]
for i in range(n-1):
        a,b,c=map(int,input().split())
        kilist[a-1].append((b,c))
        kilist[b-1].append((a,c))
def search(i):
        searchedlist[i-1]=1
        visitedlist[i-1]=1
        flag=0
        for j in kilist[i-1]:
            if visitedlist[j[0]-1]<0:
                visitedlist[j[0]-1]=1
                flag+=1
                anslist[j[0]-1]=anslist[i-1]+j[1]
        else:
            pass

        if flag>0:    
            for k in kilist[i-1]:
                if searchedlist[k[0]-1]==-1:
                    search(k[0])
search(2)
for i in anslist:
    print(i%2)
n, m = map(int, input().split())

s = [0] * m
c = [0] * m
for i in range(m):
    s[i], c[i] = map(int, input().split())

num = 0
t = 0
s2 = [0]*n

if s == 1:
    for i in range(m):
      for j in range(m):
        if c[i] != c[j] :
            print(-1)
            break
    print(c[0])
    
 
 
else:
    if len(set(s)) != len(s):
  
        for i in range(m):
          for j in range(m):
            if s[i] == s[j] and c[i] != c[j] and i !=j:
                #print(-1)
                t = 1
                break

        #m = len(set(s))
        #s = sorted(set(s), key=s.index)
        #c = sorted(set(c), key=c.index)
        
        for i in range(m):
          s2[s[i]-1] = c[i]
          
        
    for i in range(m):
        
        
        num += 10**(n-(i+1))*s2[i]
        
    if t == 0 and num >= 10**(n-1)-1 and m != 0:
        
    	print(num)
    else :
        print(-1)

### FIXED CODE ###

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

s = [0] * m
c = [0] * m
for i in range(m):
    s[i], c[i] = map(int, input().split())

num = 0
t = 0
s2 = [0]*n
if n>1:
	s2[0] = 1

if s == 1:
    for i in range(m):
      for j in range(m):
        if c[i] != c[j] :
            print(-1)
            break
    print(c[0])
    
 
else:
    if len(set(s)) != len(s):
  
        for i in range(m):
          for j in range(m):
            if s[i] == s[j] and c[i] != c[j] and i !=j:
                #print(-1)
                t = 1
                break
        
    for i in range(m):
        s2[s[i]-1] = c[i]
          
        
    for i in range(n):
        
        
        num += 10**(n-(i+1))*s2[i]
        
    if t == 0 and num >= 10**(n-1)-1 :
        
    	print(num)
    else :
        print(-1)
from functools import lru_cache

inf = 1000000000

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

@lru_cache(maxsize=1000)
def dp(i):

    if i == 0:
        return 0
    elif i == 1:
        return abs(h[1] - h[0])
    elif 2 <= i:
        return min(dp(i-1) + abs(h[i]-h[i-1]), dp(i-2) + abs(h[i] - h[i-2]))
    else:
        return inf

print(dp(n-1))


### FIXED CODE ###

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

dp = [100000] * n

dp[0] = 0

for i in range(0, n):
    if i == 0:
        dp[i] = 0
    elif i == 1:
        dp[i] = abs(h[i-1] - h[i])
    else:
        a = dp[i-1] + abs(h[i] - h[i-1])
        b = dp[i-2] + abs(h[i] - h[i-2])
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]))

print(dp[-1])
a, b = input().splitf(' ')

plus = a + b

minus = a - b

kakeru = a * b


if plus >= minus:
  if plus >= kakeru:
    print(plus)
elif minus >= kakeru:
  print(minus)
else:
  print(kakeru)


### FIXED CODE ###

a, b = map(int, input().split())
 
plus = a + b
 
minus = a - b
 
kakeru = a * b

list = [plus, minus, kakeru]

print(max(list))
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces


li = []
n = int(input())
for i in range(5):
    li.append(int(input()))
if n <= min(li):
    print(5)
else:
    if n % min(li) == 0:
        print(5 + n // min(li) -1)
    else:
        print(5 + n // min(li))

### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, q = na()
s = input()
ct = [0] * n
for i in range(n-1):
    if s[i:i+2] == 'AC':
        ct[i+1] = 1
for i in range(n-1):
    ct[i+1] += ct[i]
for i in range(q):
    l, r = na()
    l -= 1
    r -= 1
    print(ct[r] - ct[l])
h,w=map(int,input().split())
lis = []
for _ in range(h):
 lis.append(input())
for i in range(h):
 for j in range(w):
  if lis[i][j] = "#":
    if (i == 0 or lis[i-1][j] == ".") and (j==0 or lis[i][j-1] == ".")  and (i == h-1 or lis[i+1][j] == ".") and (j == w-1 or lis[i][j+1] == "."):
      print("No")
      quit()
print("Yes")

### FIXED CODE ###

h,w=map(int,input().split())
lis = []
for _ in range(h):
 lis.append(input())
for i in range(h):
 for j in range(w):
  if lis[i][j] == "#":
    if (i == 0 or lis[i-1][j] == ".") and (j==0 or lis[i][j-1] == ".")  and (i == h-1 or lis[i+1][j] == ".") and (j == w-1 or lis[i][j+1] == "."):
      print("No")
      quit()
print("Yes")