Harryxun/stf_run huggingface dataset:
import math
a,b,x= map(int, input().split())
x/=a

if a*b>=2*x:
    print (math.degrees(math.pi/2-math.atan(2*x/(b**2))))
else:
    y=2*x/a-b
    print(math.degrees(math.pi/2-math.atan(a/(b-y))))


### FIXED CODE ###

import math
a,b,x= map(int, input().split())
x/=a

if a*b>=2*x:
    print (math.degrees(math.pi/2-math.atan(2*x/(b**2))))
else:
    y=2*x/a-b
    try:
        print(math.degrees(math.pi/2-math.atan(a/(b-y))))
    except ZeroDivisionError:
        print(0)
# -*- coding:utf-8 -*-
import copy

INF = 2*(10**8)+1
memo = INF  # メモ化用変数

def solve():
    N, K = list(map(int, input().split(" ")))
    X = [0]
    X.extend(list(map(int, input().split(" "))))
    X.sort()


    def dfs(depth, cost, i, Xs):
        global memo
        if depth == K:
            memo = min(cost, memo)
            return cost
        
        if cost >= memo:
            # 探索を打ち切る
            return INF
        
        ret1, ret2 = INF, INF
        if i+1 < len(Xs):
            # 右に移動
            tmpCost = abs(Xs[i] - Xs[i+1])
            tmpXs = copy.deepcopy(Xs)
            del tmpXs[i]
            ret1 = dfs(depth+1, cost+tmpCost, i, tmpXs)
        if i-1 >= 0:
            # 左に移動
            costCost = abs(Xs[i] - Xs[i-1])
            tmpXs = copy.deepcopy(Xs)
            del tmpXs[i]
            ret2 = dfs(depth+1, cost+tmpCost, i-1, tmpXs)
        
        return min(ret1, ret2)

    # 0座標のインデックスは？
    for i in range(len(X)):
        if X[i] == 0:
            break
    ans = dfs(0, 0, i, X)
    print(ans)


if __name__ == "__main__":
    solve()

### FIXED CODE ###

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

"""解説
https://www.youtube.com/watch?v=5O4k1n5Ejzw

区間を考える問題

-30 -10 0 10 20 50

・K = 3のとき、

0座標を必ず含める、ある連続するK個のロウソクについて考える

・-30 -10 0 10
・-10 0 10 20
・0 10 20 50

左端と右端に到達する最小値を求めていけばよくて、間のロウソクは無視してよい（必ず移動中に火をつけるので）

すべての場合について求めて、その中の最小値が答え
"""
def solve():
    N, K = list(map(int, input().split()))
    X = list(map(int, input().split()))
    if 0 in X:
        # 0座標にロウソクがあるなら、火をつけるロウソクをひとつ減らしてよい
        K -= 1
    else:
        X.append(0)
    X.sort()

    origin_i = X.index(0)
    left_i = max(origin_i-K, 0)

    INF = 10**12
    ans = INF
    while left_i <= origin_i:
        if left_i+K < len(X):
            tmp1 = abs(X[left_i]-0)*2 + abs(X[left_i+K]-0)
            tmp2 = abs(X[left_i]-0) + abs(X[left_i+K]-0)*2
        else:
            break
        ans = min(ans, tmp1, tmp2)
        left_i += 1
    print(ans)

if __name__ == "__main__":
    solve()
S = input()
T = input()

Slen = len(S)
Tx = T[0:Slen]

if S == Tx:print("Yes")
else: print("No")


### FIXED CODE ###

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

sum1 = 0
sum2 = 0
sum3 = 0

if k < a: sum = k
if k >= a and k < a+b: sum = a
if k >= a+b: sum = a-(k-a-b)

print(sum)
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
print(A)
ans = A[0]
if N >= 3:
    a = (N - 2) // 2
    b = (N - 2)  % 2
print(a)
print(b)
if b == 0:
    for i in range(a):
        ans += (A[i+1] * 2)
else:
    for i in range(a):
        ans += (A[i+1] * 2)
    ans += A[a+1]
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
# print(A)
ans = A[0]
if N >= 3:
    a = (N - 2) // 2
    b = (N - 2)  % 2
# print(a)
# print(b)
    if b == 0:
        for i in range(a):
            ans += (A[i+1] * 2)
    else:
        for i in range(a):
            ans += (A[i+1] * 2)
        ans += A[a+1]
print(ans)
j = set('abcdefghijklmnopqrstuvwxyz')
s = set(input())
k = sorted(j - s)

if k != '':
    print(k[0])
else:
    print('None')

### FIXED CODE ###

j = set('abcdefghijklmnopqrstuvwxyz')
s = set(input())
k = sorted(j - s)

if len(k)==0:
    print('None')
else:
    print(k[0])
n = min[int(i) for in in input().split()]
print(str(n)*int(n))

### FIXED CODE ###

n = [int(i) for i in input().split()]
print(str(min(n)) * max(n))
X = int(input())

a = X // 100
b = X % 100
print(1 if (b // a in [0,1,2,3,4,5]) and (b % a in [0,1,2,3,4,5]) else 0)

### FIXED CODE ###

X = int(input())

l = [1,2,3,4,5]
a = X // 100
b = X % 100

ans = 0
for i in l:
    if b % i == 0:
        if b // i <= a:
            ans = 1
            break

print(ans)
num = input()

first_place = int(str(num)[-1])

if first_place == 3:
  print('bon')
elif first_place in [0, 1, 6, 8]:
  print('pon')
 else:
  print('hon')
 

### FIXED CODE ###

num = input()
 
first_place = int(str(num)[-1])
 
if first_place == 3:
  print('bon')
elif first_place in [0, 1, 6, 8]:
  print('pon')
else:
  print('hon')
N,C = map(int,input().split())
cum = [0]*(10**5+1)
d = {}
for i in range(10**5):
    d[i] = []
for i in range(N):
    s,t,c = map(int,input().split())
    if c not in d[s]:
        cum[s-1] += 1
        cum[t] -= 1
    else:
        cum[s] += 1
        cum[t] -= 1
    d[t].append(c)
import numpy as np
print(np.cumsum(cum).max())

### FIXED CODE ###

N,C = map(int,input().split())
r = [[0]*(10**5) for c in range(C)]
for i in range(N):
    s,t,c = map(int,input().split())
    r[c-1][s-1:t] = [1]*(t-s+1)
print(max(map(sum,zip(*r))))
import collections
N = int(input())
A = input().split(' ')

c = max(collections.Counter(A).values())
if c = = 1:
	print('YES')
else:
	print('NO')


### FIXED CODE ###

import collections
N = int(input())
A = input().split(' ')

c = max(collections.Counter(A).values())
if c == 1:
	print('YES')
else:
	print('NO')
s = sorted(set(input()))
for i in range(26):
    if s[i] != chr(97+i):
        print(chr(97+i))
        break
else:
    print('None')

### FIXED CODE ###

s = sorted(set(input()))
a = len(set(s))
s.append(0)
for i in range(26):
    if s[i] != chr(97+i):
        print(chr(97+i))
        break
else:
    print('None')
n,m = map(int,input().split())
a = list(map(int,input.split()))
A = 0
for i in range(m):
  A += a[i]
if(A<=N):
  print(N-A)
else:
  print(-1)


### FIXED CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))
A = 0
for i in range(m):
  A += a[i]
k = n-A
if(k>=0):
  print(k)
else:
  print(-1)
A, B, K = map(int, input().split())
num = range(A, B+1)
res = set(num[:K] | set(num[len(num) - K:]))
[print(i) for i in res]

### FIXED CODE ###

A, B, K = map(int, input().split())

l = [i for i in range(A, A + K) if i <= B]
li = l + [i for i in range(B - K + 1, B + 1) if i >= A]

for i in sorted(set(li)):
    print(i)
N, X = map(int, input().split())


def num(N,X):
    number = 0
    for x in X:
        num = x-N

        num2 = num**2

        number += num2

    return number
    
kekka = str(num(N,X))
print(kekka)
    

### FIXED CODE ###

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

def num(P, X):
    number = 0
    for x in X:
        num = x-P
        #print(str(num))
        num2 = num**2
        number += num2
    return number

nList = []
for p in range(min(X), max(X) + 1):
    nList.append(num(p, X))

n = str(min(nList))
print(n)
n, y = map(int, input().split())

y = y // 1000
print(n, y)


def find_by_for(v, n):
    """
        the tuple by example
        ((0, 0, 0), (10, 5, 1), 100, 10)
    """
    queue = []
    queue.append(((0, 0, 0), (1, 5, 10), v, n))
    while queue:
        xs, fv, v, n = queue.pop()
        if v == 0 and n == 0:
            return "%d %d %d"%(xs[2], xs[1], xs[0])
        elif not fv or v <= 0 or n <= 0:
            pass
        else:
            queue.append((xs, fv[:-1], v, n))
            z = list(xs) 
            idx = len(fv) -1
            z[idx] +=1
            queue.append((tuple(z), fv, v - fv[idx], n -1))
    return "-1 -1 -1"

print(find_by_for(y, n))
    


### FIXED CODE ###



import re 

print(re.sub("2017/01", "2018/01", input()))
n=int(input())
A=list(map(int,input().split()))
B=[0]*(10**10)
res=0

for i in range(n):
	B[A[i]+i]+=1
for i in range(n):
	if i-A[i]>0:
		res+=B[i-A[i]]

print(res)

### FIXED CODE ###

from collections import defaultdict

n=int(input())
A=list(map(int,input().split()))
B=defaultdict(int)
res=0

for i in range(n):
	B[A[i]+i]+=1
	if i-A[i] in B:
		res+=B[i-A[i]]

print(res)
N,K = list(map(int,input().split()))
A = list(map(int,input().split()))
 
if K<=N:
  nex=0
  for i in range(K):
    
    ans=A[nex]
    nex=ans
  print(ans)
  sys.exit()
    
n=[0]*(N+1) #行った場所
 
n[0]=A[0] #1回目にどこにいるか
nex=A[0]
 
for i in range(1,N): #2回目以降にどこにいるか 
  n[i]=A[nex-1] #いる場所
  nex=A[nex-1]
  
  if n[nex-1]!=0:
    d=n[nex-1]
    break
 
roop_start=n.index(d)
length=i+1-roop_start
 
k_remain=(K-len(n[:roop_start])+length)%length
 
print(n[roop_start:length+1][k_remain-1])

### FIXED CODE ###

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

n=[-1]*(N+2)
n[1]=0
i=0 #カウンター
place_now=1 #いる場所

while True:
  
  i+=1 #何回飛んだか
  place_now=A[place_now-1] #飛んだ時の場所
  
  
  if n[place_now] != -1:
    a=n[place_now] #ループの開始点
    loop=i-a #ループする長さ
    break
  
  n[place_now]=i #その場所につくのに何回飛んだか
  
if a>=K:
  print(n.index(K))
elif a<K:
  k_remain=(K-a)%loop+a
  print(n.index(k_remain))
import math
a,b = map(float, input().split())
for i in range(1,11):
    if i <= b <i+1:
        c = i
        d = b - i
        
e = a * c
f = a * d
g = math.floor(f)
h = e + g
print(math.floor(h))

### FIXED CODE ###

re = input().split()
a = int(re[0])
b = re[1]

c = int(b[0])
d = int(b[2] + b[3])
e = a * c
f = a * d
g = f // 100
h = e + g
print(h)
a,b,c=map(int,input().split())
st="NO"
for i in range(a,b*a+1):
  if i%b==c:
    st="YES"
    break

print(st)


### FIXED CODE ###

#n=int(input())
a,b,c=map(str,input().split())
#al=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(m)]

if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")
for i in range(1,10):
     for j in range(1,10):
         print(i, x, j, =, i * j)
     print()


### FIXED CODE ###

print ("1x1=1")
print ("1x2=2")
print ("1x3=3")
print ("1x4=4")
print ("1x5=5")
print ("1x6=6")
print ("1x7=7")
print ("1x8=8")
print ("1x9=9")
print ("2x1=2")
print ("2x2=4")
print ("2x3=6")
print ("2x4=8")
print ("2x5=10")
print ("2x6=12")
print ("2x7=14")
print ("2x8=16")
print ("2x9=18")
print ("3x1=3")
print ("3x2=6")
print ("3x3=9")
print ("3x4=12")
print ("3x5=15")
print ("3x6=18")
print ("3x7=21")
print ("3x8=24")
print ("3x9=27")
print ("4x1=4")
print ("4x2=8")
print ("4x3=12")
print ("4x4=16")
print ("4x5=20")
print ("4x6=24")
print ("4x7=28")
print ("4x8=32")
print ("4x9=36")
print ("5x1=5")
print ("5x2=10")
print ("5x3=15")
print ("5x4=20")
print ("5x5=25")
print ("5x6=30")
print ("5x7=35")
print ("5x8=40")
print ("5x9=45")
print ("6x1=6")
print ("6x2=12")
print ("6x3=18")
print ("6x4=24")
print ("6x5=30")
print ("6x6=36")
print ("6x7=42")
print ("6x8=48")
print ("6x9=54")
print ("7x1=7")
print ("7x2=14")
print ("7x3=21")
print ("7x4=28")
print ("7x5=35")
print ("7x6=42")
print ("7x7=49")
print ("7x8=56")
print ("7x9=63")
print ("8x1=8")
print ("8x2=16")
print ("8x3=24")
print ("8x4=32")
print ("8x5=40")
print ("8x6=48")
print ("8x7=56")
print ("8x8=64")
print ("8x9=72")
print ("9x1=9")
print ("9x2=18")
print ("9x3=27")
print ("9x4=36")
print ("9x5=45")
print ("9x6=54")
print ("9x7=63")
print ("9x8=72")
print ("9x9=81")
print(" ".join((a[1::2][::-1] + a[::2])[::1 if len(a)%2==0 else -1]))


### FIXED CODE ###

n = int(input())
a = input().split(" ")

print(" ".join((a[1::2][::-1] + a[::2])[::1 if len(a)%2==0 else -1]))
N = int(input())
X = [0 for i in range(N)]
Y = [0 for i in range(N)]
H = [0 for i in range(N)]
tmp = []
for i in range(N):
    X[i], Y[i], H[i] = map(int, input().split())
for cx in range(0,101):
    for cy in range(0, 101):
        for i in range(N):
            if h != 0:
                ch = abs(X[i]-cx) + abs(Y[i]-cy) + H[i]
                tmp.add([cx, cy, ch])
for x, y, h in tmp:
    flag = True
    for i in range(N):
        if H[i] != max(h - abs(X[i]-x) - abs(Y[i]-y), 0)
            flag = False
            break
    if flag:
        print(x, y, h)
        break


### FIXED CODE ###

N = int(input())
xyh = [list(map(int, input().split())) for i in range(N)]
ansx = 0
ansy = 0
ansh = 0
for x in range(101):
  for y in range(101):
    hset = set()
    for i in range(N):
      xyhi = xyh[i]
      if xyhi[2] == 0:
        continue
      hset.add(abs(xyhi[0]-x) + abs(xyhi[1]-y) + xyhi[2])

    if len(hset) == 1 and list(hset)[0] != 0:
      flag = True
      for i in range(N):
        xyhi = xyh[i]
        if xyhi[2] != 0:
          continue
        elif xyhi[2] == 0 and max(list(hset)[0] - abs(xyhi[0]-x) - abs(xyhi[1]-y), 0) == 0:
          continue
        flag = False
        break
      if flag:
        ansx = x
        ansy = y
        ansh = list(hset)[0]

print(ansx, ansy, ansh)
n=int(input());minn=100
def digit_sum(x):
  a,b=0,str(x)
  for i in range(len(b)):a+=int(b[i])
  return a
for i in range(1,n//2+1):
  a=digit_sum(i),digit_sum(n-i)
  minn=min(100,a)
print(minn)

### FIXED CODE ###

n=int(input());minn=100
def digit_sum(x):
  a,b=0,str(x)
  for i in range(len(b)):a+=int(b[i])
  return a
for i in range(1,n//2+1):a=digit_sum(i)+digit_sum(n-i);minn=min(minn,a)
print(minn)
s=list(input())
t=list(input())
s.sort()
t.sort()
for i in range(min(len(s),len(t))):
  if s[-1*(i+1)]==t[-1*(i+1)]:
    x=1
    continue
  elif ord(s[-1*(i+1)])>ord(t[-1*(i+1)]):
    print('No')
    x=0
    break
  else:
    x=0
    print('Yes')
    break
if x=1:
  if len(s)<len(t):
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

s=list(input())
t=list(input())
s.sort()
t.sort()
if s==t and s.count(s[0])==len(s) and t.count(s[0])==len(t):
    print('No')
elif s.count(s[0])==len(s) and t.count(s[0])==len(t):
    if len(s)<len(t):
      print('Yes')
    else:
      print('No')
else:
    if ord(s[0])==ord(t[-1]):
      print('No')
    elif ord(s[0])<ord(t[-1]):
      print('Yes')
    else:
      print('No')
import math

N,M = map(int,input().split())
A = M//N
L = []
flag = False
if (A <= 10**8):
  for i in range(1,A+1):
    if (M%(A+1-i) == 0):
      flag = True
      break
  if flag:
    print(A+1-i)
else:
  for i in range(1,math.sqrt(A)):
    if (M%i == 0):
      L.append(i)
  print(max(L))

### FIXED CODE ###

import math

N,M = map(int,input().split())
A = M//N
L = []
for i in range(1,int(math.sqrt(M))+1):
  if (M%i == 0 and i <= A):
    L.append(i)
    if (M//i <= A):
      L.append(M//i)
print(max(L))
s=input()
N=len(s)
t=input()
M=len(t)

alphabetlist=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
def al(str):
    return alphabetlist.index(str)+1

dp=[[0 for i in range(0,M)] for i in range(0,N)]

firsts=N
for i in range(0,N):
    if s[i]==t[0]:
        firsts=i
        break

firstt=M
for i in range(0,M):
    if t[i]==s[0]:
        firstt=i
        break

for i in range(0,N):
    if i>=firsts:
        dp[i][0]=1

for i in range(0,M):
    if i>=firstt:
        dp[0][i]=1

for i in range(1,N):
    for j in range(1,M):
        if s[i]==t[j]:
            dp[i][j]=dp[i-1][j-1]+1
        else:
            if dp[i][j-1]>dp[i-1][j]:
                dp[i][j]=dp[i][j-1]
            else:
                dp[i][j]=dp[i-1][j]

ans=[]
i=N-1
j=M-1
while i>-1:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    else:
        while s[i]==t[j]:
            j-=1
        ans.append(s[i])
        i-=1
        
ans=ans[::-1]
print(''.join(ans))

### FIXED CODE ###

s=input()
N=len(s)
t=input()
M=len(t)

alphabetlist=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
def al(str):
    return alphabetlist.index(str)+1

dp=[[0 for i in range(0,M+1)] for i in range(0,N+1)]

for i in range(0,N):
    for j in range(0,M):
        if s[i]==t[j]:
            dp[i+1][j+1]=dp[i][j]+1
        else:
            if dp[i+1][j]>dp[i][j+1]:
                dp[i+1][j+1]=dp[i+1][j]
            else:
                dp[i+1][j+1]=dp[i][j+1]

ans=[]
i=N
j=M
while i>0 and j>0:
    if dp[i][j]==dp[i-1][j]:
        i-=1
    elif dp[i][j]==dp[i][j-1]:
        j-=1
    else:
        ans.append(s[i-1])
        i-=1
        j-=1

ans=ans[::-1]
print(''.join(ans))
n, m = map(int, input().split())
a = list(map(int, input().split()))

a.sort(reverse=True)
ans = [i for i in range(max(a)//2,(m + 1)//2)]

for j in a:
    if a % 2 == 1:
        break
    n_ans = []
    for i in ans:
        if ((i / j - 0.5) % 1 == 0):
            n_ans.append(i)
    ans = n_ans[:]

print(len(ans))


### FIXED CODE ###

from fractions import gcd
import sys

n, m = map(int, input().split())
a = list(map(int, input().split()))
a = [i // 2 for i in a]

cnt = 1
min_a = min(a)
while min_a % 2 == 0:
    cnt *= 2
    min_a = min_a // 2

ans = 1
for i in a:
    if (i // cnt) % 2 == 0:
        print(0)
        sys.exit()
    ans = (ans * i) // gcd(ans, i)

print((m//ans+1)//2)
n,k = map(int,input().split())
a = list(map(int,input().split()))
a = sorted(a,reverse=True)
s = sum(a)
x = [0]*n
y = 0
for i in range(n):
    y = int(a[i]/s*k)
    x[i] = [i, (a[i]/s*k)%1, y]

x.sort(key= lambda val : val[1],reverse=True)
for i in range(k-y):
    x[i][2] += 1
ans = 0
z = 0
for i in range(n):
    ans = max(ans, a[x[i][0]-1]/(x[i][2]+1))
    z += x[i][2]
print(int(-(-ans//1)))

### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
s = sum(a)
x = [0]*n
y = 0
r = 0
for i in range(n):
    y = int(a[i]/s*k)
    x[i] = [i, y, a[i]/(y+1), a[i]]
    r += y
x.sort(key= lambda val : val[2],reverse=True)
for i in range(k-r):
    x[i][1] += 1
ans = 0
for i in range(n):
    ans = max(ans, x[i][3]/(x[i][1]+1))
print(int(-(-ans//1)))
n, m = list(map(int, input().split()))
data = []
for i in range(m):
    data.append([i + 1] + list(map(int, input().split())))
data = sorted(data, key = lambda x: (x[1], x[2]))
print(data)
ans = [[0,0,0,0,0,0], [0,0,0,0,0,0] for i in range(m)]
print(ans)
for i in range(m):


### FIXED CODE ###

n, m = list(map(int, input().split()))
data = []
for i in range(m):
    data.append([i + 1] + list(map(int, input().split())))
    #data[0::] = cityNumber,
    #data[:0:] = prefect,
    #data[::0] = year
data = sorted(data, key = lambda x: (x[1], x[2]))
#prefect => year
ans = [[0,0,0] for i in range(m)]
#ans[::0] = city Number
#ans[0::] = prefect
#ans[:0:] = ID

pre = data[0][1]
num = 0
for i in range(m):
    ans[i][0] = data[i][1] # prefect
    ans[i][2] = data[i][0] #cityNumber
    if pre == data[i][1]:
        num += 1
    else:
        num = 1
    ans[i][1] = num
    pre = data[i][1]
ans = sorted(ans, key = lambda x:x[2])
for i in range(m):
    print("{:0=6}{:0=6}".format(ans[i][0],ans[i][1]))
C = input()
print(chr(ord(C)+1)    

### FIXED CODE ###

C = input()
print(chr(ord(C)+1) )
n, m = map(int, input().split())
votes = list(map(int, input().split()))
total = sum(votes)
satisfied = [x for x in votes if x >= votes * (1/(4*m))]
if len(satisfied) > m:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n, m = map(int, input().split())
votes = list(map(int, input().split()))
total = sum(votes)
satisfied = [x for x in votes if x >= total * (1/(4*m))]
if len(satisfied) >= m:
    print("Yes")
else:
    print("No")
import numpy as np

N,K = list(map(int, input().split(" ")))
A = list(map(int, input().split(" "))) # consumption coefficient of members
F = list(map(int, input().split(" "))) # difficulty of food

# pair fastest eaters (low consumption coefficient) with most difficult foods
A.sort()
F.sort(reverse=True)
A = np.array(A)
F = np.array(F)

def how_many_K(A,F,T,K):
    """
    Returns whether the number of training sessions needed for group A with foods F to have a score equal to T is less than K
    """
    num_trains = 0
    for i in range(len(A)):
        a = A[i]
        f = F[i]
        num_trains += max(0, a-T//f)

    if num_trains > K:
        return False
    else:
        return True

maxT = np.max(A*F)
# use binary search to find lowest possible T
left = -1
right = maxT
while left+1< right:
    mid = (left+right)//2
    if how_many_K(A,F,mid,K):
        right  = mid
    else:
        left = mid
print(right)



### FIXED CODE ###

A, B = list(map(int, input().split(" ")))
if not A >9 and not B >9:
    print(A*B)
else:
    print("-1")
A = int(input())
B = int(input())
S = 4*(((A-1)/2) *((B-1)/2))
print(int(S))

### FIXED CODE ###

l = input().split()
S = 4*(((int(l[0])-1)/2) *((int(l[1])-1)/2))
print(int(S))
k, n = input().split()
a = list(map(int, input().split()))
a.sorted()
max_diff = 0
for idx in range(len(a)-1):
  diff = a[idx+1] - a[idx]
  if max_diff < diff:
    max_diff = diff

ans = k - max_diff
print(ans)

### FIXED CODE ###

k, n = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
max_diff = k - a[n-1] + a[0]
for idx in range(len(a)-1):
  diff = a[idx+1] - a[idx]
  if max_diff < diff:
    max_diff = diff
max_diff = max_diff
ans = k - max_diff
print(ans)
input_data = input().split("\n")
N = int(input_data[0])
ls = [int(b) for b in input_data[1]]
if len(ls) == 1:
  print(ls[0]*2)

first = ls[0]
als = [ls[0]]

for n in range(1, N-1):
  als.append(min(ls[n-1], ls[n]))
als.append(ls[-1])
print(sum(als))

### FIXED CODE ###

N = int(input())
ls = [int(i) for i in input().split()]
if len(ls) == 1:
  print(ls[0]*2)
else:
  als = [ls[0]]
  for n in range(1, N-1):
    als.append(min(ls[n-1], ls[n]))
  als.append(ls[-1])
  print(sum(als))
l = sorted(map(int,raw_input().split())))
print str(l[0]),str(l[1]),str(l[2])

### FIXED CODE ###

l=list(map(int,input().split()))
L=sorted(l)
print(L[0],L[1],L[2])
xs = sorted(map(int, input().split()))

if xs[0] != xs[1]:
    print(xs[0])
if xs[1] != xs[2]:
    print(xs[2])





### FIXED CODE ###

print(48 - int(input()))
a, b, c = input().split(,)
print(a, b, c)

### FIXED CODE ###

a, b, c = input().split(',')
print(a, b, c)
n = int(input())
s = int(input())
#a = list(map(int,input().split()))

if n % 2 != 0 :
    print("No")
else:
    mae = s[0:int(n/2)]
    usi = s[int(n/2):]
    if mae == usi :
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

n = int(input())
s = input()
#a = list(map(int,input().split()))

if n % 2 != 0 :
    print("No")
else:
    mae = s[0:int(n/2)]
    usi = s[int(n/2):]
    if mae == usi :
        print("Yes")
    else:
        print("No")
l=[]
for i in range(3):
    l.append(input())
turn=0
next_turn=0
while True:
    s=l[turn][0]
    l[turn]=l[turn][1:]
    if s=="a":
        turn=0
    elif s=="b":
        turn=1
    else:
        turn=2
    if l[0]=="":
        print("A")
        break
    elif l[1]=="":
        print("B")
    elif l[2]=="":
        print("C")

### FIXED CODE ###

import sys
a=input()
b=input()
c=input()
turn=0
ap=0
bp=0
cp=0
while True:
    if turn==0:
        ap+=1
        if ap==len(a)+1:
            print("A")
            sys.exit()
        if a[ap-1]=="a":
            turn=0
        elif a[ap-1]=="b":
            turn=1
        else:
            turn=2
    if turn==1:
        bp+=1
        if bp==len(b)+1:
            print("B")
            sys.exit()
        if b[bp-1]=="a":
            turn=0
        elif b[bp-1]=="b":
            turn=1
        else:
            turn=2
    if turn==2:
        cp+=1
        if cp==len(c)+1:
            print("C")
            sys.exit()
        if c[cp-1]=="a":
            turn=0
        elif c[cp-1]=="b":
            turn=1
        else:
            turn=2
# A = [list(map(int, input().split())) for _ in range(3)]
# n = int(input())
# B = [int(input()) for _ in range(n)]
# X = list(map(int, input().split()))
n, m = map(int, input().split())
S = []
C = []
for i in range(m):
    s, c = map(int, input().split())
    S.append(s)
    C.append(c)
ans = [0, 0, 0]
for i in range(m):
    ans[S[i]-1] = C[i]
if n == 3 and ans[0] == 0:
    print(-1)
    exit()
if n == 2 and ans[1] == 0:
    print(-1)
    exit()
if n == 3:
    print("".join(map(str, ans[:n])))
elif n == 2:
    print("".join(map(str, ans[1:3])))
elif n == 1:
    print("".join(map(str, ans[2])))


### FIXED CODE ###

# A = [list(map(int, input().split())) for _ in range(3)]
# n = int(input())
# B = [int(input()) for _ in range(n)]
# X = list(map(int, input().split()))
n, m = map(int, input().split())
S = []
C = []
for i in range(m):
    s, c = map(int, input().split())
    S.append(s)
    C.append(c)
for i in range(1000):
    d = list(str(i))
    if len(d) != n:
        continue
    else:
        judge = True
        for i in range(m):
            if d[S[i]-1] != str(C[i]):
                judge = False
        if judge:
            print("".join(d))
            exit()
print(-1)