Harryxun/stf_run huggingface dataset:
import sys
from itertools import combinations, permutations, product, combinations_with_replacement, accumulate
from heapq import heapify, heappop, heappush, heappushpop
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from math import sqrt, log, floor, ceil, factorial, cos, sin, pi #, gcd
from fractions import gcd
from operator import mul
from functools import reduce
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
INF = float('inf')
LINF = 2**63-1
NIL = -LINF
MOD = 10**9+7
MGN = 4
def II(): return int(input())
def IF(): return float(input())
def IS(): return input().replace('\n', '')
def ILCI(n: int): return [II() for _ in range(n)]
def ILCF(n: int): return [IF() for _ in range(n)]
def ILI(): return list(map(int, input().split()))
def ILLI(n: int): return [[int(j) for j in input().split()] for i in range(n)]
def ILF(): return list(map(float, input().split()))
def ILLF(n: int): return [[float(j) for j in input().split()] for i in range(n)]
def LTOS(lst: list, sep: str = ' '): return sep.join(map(str, lst))
def DEC(lst: list): return list(map(lambda x: x-1, lst))
def INC(lst: list): return list(map(lambda x: x+1, lst))


def main():
    A,B,C = ILI()

    ans = "No"
    # A + 2sqrt(AB) + B < C
    assert C - A -B > 0 "C - A - B > 0"
    if C - A - B  > 0 and  4 * A * B < (C- A - B) ** 2:
        ans = "Yes"

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from itertools import combinations, permutations, product, combinations_with_replacement, accumulate
from heapq import heapify, heappop, heappush, heappushpop
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from math import sqrt, log, floor, ceil, factorial, cos, sin, pi #, gcd
from fractions import gcd
from operator import mul
from functools import reduce
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
INF = float('inf')
LINF = 2**63-1
NIL = -LINF
MOD = 10**9+7
MGN = 4
def II(): return int(input())
def IF(): return float(input())
def IS(): return input().replace('\n', '')
def ILCI(n: int): return [II() for _ in range(n)]
def ILCF(n: int): return [IF() for _ in range(n)]
def ILI(): return list(map(int, input().split()))
def ILLI(n: int): return [[int(j) for j in input().split()] for i in range(n)]
def ILF(): return list(map(float, input().split()))
def ILLF(n: int): return [[float(j) for j in input().split()] for i in range(n)]
def LTOS(lst: list, sep: str = ' '): return sep.join(map(str, lst))
def DEC(lst: list): return list(map(lambda x: x-1, lst))
def INC(lst: list): return list(map(lambda x: x+1, lst))


def main():
    A,B,C = ILI()

    ans = "No"
    # A + 2sqrt(AB) + B < C
    if C - A - B  > 0 and  4 * A * B < (C- A - B) ** 2:
        ans = "Yes"

    print(ans)


if __name__ == '__main__':
    main()
from collections import deque
while True:
    n = int(input())
    if n == 0:break
    a = [int(input()) for _ in range(n)]
    b = deque([0] * n)
    j = 0
    for i in range(n):
        if a[i] * b[j] >= 0:b[j] += a[i]
        else:j += 1;b[j] += a[i]
    if b[0] < 0:b.popleft()
    while b[-1] <= 0:b.pop()
    m = len(b) // 2 + 1
    v = [[0] * m for _ in range(m)]
    v[0][0] = b[0]
    for i in range(1, m):
        v[0][i] = v[0][i - 1] + b[2 * i] + b[2 * i - 1]
    for i in range(1, m):
        for j in range(i, m):
            v[i][j] = v[i - 1][j] - b[2 * i - 2] - b[2 * i - 1]
    print(max([max(i) for i in v]))


### FIXED CODE ###

from collections import deque
while True:
    n = int(input())
    if n == 0:break
    a = [int(input()) for _ in range(n)]
    b = deque([0] * n)
    j = 0
    for i in range(n):
        if a[i] * b[j] >= 0:b[j] += a[i]
        else:j += 1;b[j] += a[i]
    if b[0] < 0 and len(b) > 1:b.popleft()
    while b[-1] <= 0 and len(b) > 1:b.pop()
    if len(b) == 1 and b[0] <= 0:print(max(a))
    else:
        m = len(b) // 2 + 1
        v = [[0] * m for _ in range(m)]
        v[0][0] = b[0]
        for i in range(1, m):
            v[0][i] = v[0][i - 1] + b[2 * i] + b[2 * i - 1]
        for i in range(1, m):
            for j in range(i, m):
                v[i][j] = v[i - 1][j] - b[2 * i - 2] - b[2 * i - 1]
        print(max([max(i) for i in v]))
A, B, K = map(int, raw_input().split())
AB = range(A, B + 1)
if len(AB) > 2 * K:
	for i in AB[:K]:
		print i
	for i in AB[-K:]:
		print i
else:
	for i in AB:
		print i


### FIXED CODE ###

A, B, K = map(int, raw_input().split())
if B - A + 1 > 2 * K:
	for i in range(A, A + K):
		print i
	for i in range(B - K + 1, B + 1):
		print i
else:
	for i in range(A, B + 1):
		print i
import numpy as np

s = int( input() )
ss = str( s )
l = len( ss )
#print( s, l )

ans = int( 0 )
for i in range( l-4 ):
    for j in range( i+4, l+1 ):
        ssij = ss[ i:j ]
        sij = int( ssij )
#        print( i, j, sij )
        if sij % 2019 == 0:
#            print( "Yes" )
            ans = ans + 1

print( ans )


### FIXED CODE ###

import numpy as np

s = input()

d = [ int( 0 ) ] * 2019
d[ 0 ] = int( 1 )
r = int( 0 )
t = int( 1 )

for si in reversed( s ):
#    print( si )

    r = int( si ) * t + r
    r = r % 2019

    t = t * 10
    t = t % 2019

    d[ r ] = d[ r ] + 1

ans = int( 0 )
for di in d:
    ans = ans + di * ( di - 1 ) // 2

print( ans )
N = int(input())
A = list(map(int, input().split())) 
correct_answer_count = 0
for i in range(1, N + 1):
    bat_answer_count = 0
    for j in range(1, i+1):
        if len(A) < j:
            continue
        if not (A[i] <= A[j]):
            bat_answer_count += 1

    if bat_answer_count == 0:
        correct_answer_count += 1

print(correct_answer_count)    

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
 
cnt = 0
p_min = p[0]
for i in range(n):
  pi = p[i]
  if pi <= p_min:
    cnt += 1
    p_min = pi
print(cnt)
N=int(input())
import itertools
A = list(map(int, input().split())) 

count=0
for ｔ in itertools.combinations(A, 3):
    if list(t)[0]<list(t)[1]+list[2] and list(t)[1]<list(t)[2]+list(t)[0] and list(t)[2]<list(t)[0]+list(t)[1]:

        cout+=1

print(count)

### FIXED CODE ###

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

count=0
if len(A)<=2:
    print(0)
else:
    for ｔ in itertools.combinations(A, 3):
        if t[2]<t[0]+t[1] and t[1]<t[0]+t[2] and t[0]<t[1]+t[2] and t[0]!=t[1]!=t[2]!=t[0]:

            count+=1

    print(count)
H, W = map(int, input().split())
S = ['.'+input()+'. ' for _ in range(H)]

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

flg = 0
for i in range(1, W+1):
    for j in range(1, H+1):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                flg = 1
                break
    else:
        continue
    break
    
if flg==0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

H, W = map(int, input().split())
S = ['.'+input()+'. ' for _ in range(H)]

S.insert(0, '.'*(W+2))
S.insert(H+1, '.'*(W+2))

flg = 0
for i in range(1, H+1):
    for j in range(1, W+1):
        if S[i][j]=='#':
            if S[i+1][j]=='.' and S[i-1][j]=='.' and S[i][j+1]=='.' and S[i][j-1]=='.':
                flg = 1
                break
    else:
        continue
    break
    
if flg==0:
    print('Yes')
else:
    print('No')
N = int(input())
h = list(map(int,input().split()))

memo = [-1]*N

def func(i):
  # メモのロード
  if memo[i]!=-1:
    return memo[i]
  # 初期値の部分
  if i==0:
    return 0
  elif i==1: 
    return abs(h[1]-h[0])
  # 二択の部分
  a = func(i-1)+abs(h[i]-h[i-1])
  b = func(i-2)+abs(h[i]-h[i-2])
  memo[i] = min(a,b) # メモのセーブ
  return memo[i]

print(func(N-1))


### FIXED CODE ###


N = int(input())
h = list(map(int,input().split()))
#print(h)

dp = [0]*N
dp[0] = 0
dp[1] = abs(h[1]-h[0])
for n in range(2,N):
	step1 = abs(h[n]-h[n-1])+dp[n-1]
	step2 = abs(h[n]-h[n-2])+dp[n-2]
	dp[n] =  min(step1,step2)

ans = dp[N-1]
print(ans)
N = int(input())
a = list(map(int, input().split())).sort()
print(a[-1] - a[0])

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
a.sort()
print(a[-1] - a[0])
S=input()
max_v =0
v =0
for i in S:
  if i=="I":
    v+=1
    if v>max_v:
      max_v=v
  else:
    v-=


### FIXED CODE ###

N=input()
S=input()
max_v =0
v =0
for i in S:
  if i=="I":
    v+=1
    if v>max_v:
      max_v=v
  else:
    v-=1
print(max_v)
a,b=list(map(int,input().split()))
c=list(input())
d=c[b-1].swapcase()
c[b]=d
c=''.join(c)
print(c)

### FIXED CODE ###

a,b=list(map(int,input().split()))
c=list(input())
d=c[b-1].swapcase()
c[b-1]=d
c=''.join(c)
print(c)
import sys
import collections

def solve(N: int, A: "List[int]"):
    counter = sorted(list(collections.Counter(A).values()),reverse=True)
    for i in range(1,N+1):
        c_index = 0
        n = N
        while counter[c_index]*i > N and c_index<len(counter) and i>1:
            n-=counter[c_index]
            c_index+=1
            i-=1
        
        print(n//i)
    return

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 collections

def solve(N: int, A: "List[int]"):
    counter = sorted(list(collections.Counter(A).values()),reverse=True)
    c_index = 0
    k=0
    for i in range(1,N+1):
        k+=1
        if len(counter)<i:
            print(0)
            continue
        while counter[c_index]*k > N and c_index<len(counter)-1:
            N-=counter[c_index]
            c_index+=1
            k-=1
        print(N//k)
    return

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()
S = input().sprit()
N = int(S[0])
A = int(S[1])
B = int(S[2])
if B > A*N:
  print(A*N)
else:
  print(B)

### FIXED CODE ###

S = list(map(int, input().split()))
N = int(S[0])
A = int(S[1])
B = int(S[2])
if B > A*N:
  print(A*N)
else:
  print(B)
H, W = map(int, input().split())
s_list = []
for i in range(W):
    s_list.append(input())
cnt = 0
for i in range(1, H):
    for j in range(1, W):
        if s_list[i][j] == '#' and s_list[i][j-1] != '#' and\
           s_list[i-1][j] != '#' and s_list[i][j+1] !='#' and\
                                                       s_list[i+1][j] != '#':
            cnt += 1
if cnt == 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

h, w = map(int, input().split())
s = ['.' * (w+2)] + ['.' + input() + '.' for _ in [0]*h] + ['.' * (w+2)]
a = 'Yes'
for i in range(1, h+1):
    for j in range(1, w+1):
        if s[i][j] == '#':
            if s[i-1][j] == '.' and s[i+1][j] == '.' and s[i][j-1] == '.' and\
               s[i][j+1] == '.':
                a = 'No'
print(a)
while True:
  x, y = map(int, raw_input.split())
  if x == 0 and y == 0:
    break
  elif x < y:
    print "%d %d" %(x, y)
  else:
    print "%d %d" %(y, x)

### FIXED CODE ###

while True:
  x, y = map(int, raw_input().split())
  if x == 0 and y == 0:
    break
  elif x < y:
    print "%d %d" %(x, y)
  else:
    print "%d %d" %(y, x)
main(int_list):
  sorted_list = sort(int_list)
  for i in sorted_list:
    print i

input_string = raw_input()
input_list = raw_input().split(' ')
for i in input_list:
  int_list = int(i)

main(int_list)

### FIXED CODE ###

a, b, c = sorted(map(int, raw_input().split()))
print a, b, c
a,b,c=map(int,input().split())
if (a,b)==(0,0):
  print(a,b)
  exit(0)
if(a-k<0):
  print (0,max(0,k-(b-a))
else:
        print(a-k,b)


### FIXED CODE ###

a, b, k = map(int, input().split())
if (a, b) == (0, 0):
    print(0, 0)
    exit(0)
if a - k < 0:
    print(0, max(0, b - (k-a)))
else:
    print(a-k, b)
a = int(input().split()[0])
alle = []
counter = 0
output = []
for i in range(a):
	p = input().split()
	p = [int(j)%2 for j in p]
	for j in range(len(p) - 1):
		if p[j] % 2 == 1:
			output.append([i + 1, j + 1, i + 1, j + 2])
			counter += 1
			p[j + 1] += 1
		alle.append(p[-1])
	
for i in range(a - 1):
	if alle[i] % 2 == 1:
		output.append([i + 1, 1,  i + 2, 1])
		counter += 1
		alle[i + 1] = alle[i] + 1
		
print (counter)
for i in output:
	print (i[0],i[1],i[2],i[3])

### FIXED CODE ###

a = int(input().split()[0])
alle = []
counter = 0
output = []
for i in range(a):
	p = input().split()
	p = [int(j)%2 for j in p]
	for j in range(len(p) - 1):
		if p[j] % 2 == 1:
			output.append([i + 1, j + 1, i + 1, j + 2])
			counter += 1
			p[j + 1] += 1
	alle.append(p[-1])
	
for i in range(a - 1):
	if alle[i] % 2 == 1:
		output.append([i + 1, len(p),  i + 2, len(p)])
		counter += 1
		alle[i + 1]  += 1
		
print (counter)
for i in output:
	print (i[0],i[1],i[2],i[3])
from collections import Counter

N, M = map(int, input().split())
A_list = []
for _ in range(N):
    a = list(map(int, input().split()))
    A_list.append(a)

ans = N
for _ in range(N-1):
    most_like_list = []
    for i in range(N):
        most_like_list.append(A_list[i][0])
    most_like, ans_new = Counter(most_like_list).most_common()[0]
    ans = min(ans, ans_new)
    for i in range(N):
        A_list[i].remove(most_like)

print(ans)


### FIXED CODE ###

from collections import Counter

N, M = map(int, input().split())
A_list = []
for _ in range(N):
    a = list(map(int, input().split()))
    A_list.append(a)

ans = N
for _ in range(M-1):
    most_like_list = []
    for i in range(N):
        most_like_list.append(A_list[i][0])
    most_like, ans_new = Counter(most_like_list).most_common()[0]
    ans = min(ans, ans_new)
    for i in range(N):
        A_list[i].remove(most_like)

print(ans)
N=int(input())
h=list(map(int,input().split()))
idou=[]
i=0
cnt=0
while i<=N-2:
    if h[i]>=h[i+1]:
        cnt+=1
        if i==N-2:
            idou.append(cnt)
    else:
        idou.append(cnt)
        cnt=0
    i+=1

print(max(idou))        

### FIXED CODE ###

N=int(input())
h=list(map(int,input().split()))
idou=[]
i=0
cnt=0
if N==1:
    print(0)
elif N==2:
    if h[1]-h[0]<=0:
        print(1)
    else:
        print(0)
else:
    while i<=N-2:
        if h[i]>=h[i+1]:
            cnt+=1
            if i==N-2:
                idou.append(cnt)
        else:
            idou.append(cnt)
            cnt=0
        i+=1

    print(max(idou))
n,m,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))

akari = [0]*(n+1)
bkari = [0]*(m+1)
for i in range(n):
	akari[i+1] = akari[i] + a[i]

for i in range(m):
	bkari[i+1] = bkari[i] + b[i]

def bin(ls,s,e,sikii):
	if e - s <= 1:
		return s
	mid = (s+e)//2
	if sikii < ls[mid]:return bin(ls,s,mid,sikii)
	else:return bin(ls,mid,e,sikii)

ans = 0
for i in range(n+1):
	time = akari[i]
	if k - time <= 0:break
	ref = bin(bkari,0,m+2,k-time)
	ans = max(ans,ref+i)

print(ans)


### FIXED CODE ###

n,m,k = list(map(int,input().split()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
import random
import bisect

#n,m,k = random.randint(1,1000),random.randint(1,1000),random.randint(1,10**8)
##a = [random.randint(1,10**5) for i in range(n)]
#b = [random.randint(1,10**5) for i in range(m)]

def solv():
	global a,b,n,m,k
	akari = [0]*(n+1)
	bkari = [0]*(m+1)
	for i in range(n):
		akari[i+1] = akari[i] + a[i]

	for i in range(m):
		bkari[i+1] = bkari[i] + b[i]

	def bin(ls,s,e,sikii):
		if e - s <= 1:
			return s
		mid = (s+e)//2
		if sikii < ls[mid]:return bin(ls,s,mid,sikii)
		else:return bin(ls,mid,e,sikii)

	ans = 0
	for i in range(n+1):
		time = akari[i]
		if k - time < 0:break
		#ref = bin(bkari,0,m+1,k-time)
		ref = bisect.bisect_right(bkari,k-time)
		ans = max(ans,ref+i)
	return ans

def karisolv():
	global a,b,n,m,k
	akari = [0]*(n+1)
	bkari = [0]*(m+1)
	for i in range(n):
		akari[i+1] = akari[i] + a[i]

	for i in range(m):
		bkari[i+1] = bkari[i] + b[i]

	ans = 0
	for i in range(n+1):
		time = akari[i]
		ref = 0
		if k - time <= 0:break
		cost = 0
		for j in range(m+1):
			if k - time - bkari[j] >= 0:
				ans = max(ans,j+i)
		
	return ans

def makedata():
	global a,b,n,m,k
	n,m,k = random.randint(1,10000),random.randint(1,10000),random.randint(1,1000000)
	a = [random.randint(1,10**5) for i in range(n)]
	b = [random.randint(1,10**5) for i in range(m)]
import sys
def main():
	for i in range(1000000):
		makedata()
		kari = karisolv()
		kotae = solv()
		if kari != kotae:
			print(n,m,k,a,b)
			sys.exit()
print(solv()-1)
import math
a, b = map(int, input().split())
print(int(a*b/math.gcd(a, b)))


### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
a, b = map(int, input().split())
print(int(a * b / gcd(a, b)))
from collections import deque, defaultdict
from functools import reduce
from operator import mul

N = int(input())
MOD = 10**9 + 7

# 素数の一覧
prime_nums = set([2]) if N > 1 else set()
prime_nums = prime_nums.union(set(range(3, N+1, 2)))
queue = deque([i for i in prime_nums if i*i <= N+1])
while queue:
    num = queue.popleft()
    prime_nums.difference_update({i for i in range(num*2, N+1, num)})
prime_nums = sorted(list(prime_nums))

# 素因数分解
factors = defaultdict(int)
for i in range(2, N+1):
    for j in prime_nums:
        while True:
            if i % j == 0:
                factors[j] += 1
                i //= j
            else:
                break


ans = reduce(mul, [(v+1) % MOD for v in factors.values()])
print(ans % MOD)


### FIXED CODE ###

from collections import deque, defaultdict
from functools import reduce
from operator import mul

N = int(input())
MOD = 10**9 + 7

# 素数の一覧
prime_nums = set([2]) if N > 1 else set()
prime_nums = prime_nums.union(set(range(3, N+1, 2)))
queue = deque([i for i in prime_nums if i*i <= N+1])
while queue:
    num = queue.popleft()
    prime_nums.difference_update({i for i in range(num*2, N+1, num)})
prime_nums = sorted(list(prime_nums))

# 素因数分解
factors = defaultdict(int)
for i in range(2, N+1):
    for j in prime_nums:
        while True:
            if i % j == 0:
                factors[j] += 1
                i //= j
            else:
                break

if N == 1:
    ans = 1
else:
    ans = reduce(mul, [(v+1) % MOD for v in factors.values()])
print(ans % MOD)
N, H = map(int, input().split())
A = []
B = []

max_a = 0
max_a_b = 0
max_a_i = 0

max_b = 0
max_b_a = 0
max_b_i = 0

for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

    if max_a < a:
        max_a = a
        max_a_b = b
        max_a_i = i

    if max_b < b:
        max_b = b
        max_b_a = a
        max_b_i = i

def get_count(N, H, max_a, max_a_b, max_a_i):
    count = 0
    for i in range(N):
        # 残すやつは何もしない
        if i == max_a_i:
            continue

        # 投げる
        if B[i] >= max_a:
            H -= B[i]
            count += 1

    # 近いところまでまとめて引く
    x = ((H-max_a_b) // max_a) - 1
    H -= (max_a * x)
    count += x

    while H > 0:
        if H <= max_a_b:
            # 投げて終わり
            count += 1
            break

        H -= max_a
        count += 1

    return count

ans = INF
count = get_count(N, H, max_a, max_a_b, max_a_i)
if count < ans:
    ans = count

count = get_count(N, H, max_b_a, max_b, max_b_i)
if count < ans:
    ans = count

print(ans)


### FIXED CODE ###


import sys
input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# A = [ int(input()) for _ in range(N) ]
##############################

N, H = map(int, input().split())
A = []
B = []

for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

max_a = max(A)

t = B[:]
t.sort(reverse=True)

count = 0
for i in range(N):
    # 先に投げても後で投げても同じなので、最初に全部投げちゃう
    # ただし強いものから投げないと、投げ終わる前に倒すケースで引っかかる
    if t[i] >= max_a:
        H -= t[i]
        count += 1

    if H <= 0:
        print(count)
        exit()


# 近いところまでまとめて引く
x = (H // max_a) - 1
H -= (max_a * x)
count += x

while H > 0:
    H -= max_a
    count += 1


print(count)
S=input()
h,r1=S//3600,S%3600
m,s=r1//60,r1%60
print("h:m:s")

### FIXED CODE ###

S=int(input())
print(S//3600,(S%3600)//60,S%60,sep=":")
from functools import reduce


def factors(n):
    return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))


a1, b1 = map(int, input().split())
temp = factors(a1).intersection(factors(b1))
s = set(range(2, max(temp)))
li = []
while s:
    m = min(s)
    li.append(m)
    s -= set(range(m, max(temp) + 1, m))
c = 0
for i in temp:
    if i == 1:
        c += 1
    if i in li:
        c += 1
print(c)


### FIXED CODE ###

n = int(input())
if n % 2 == 0:
    print(str.format('{0:.9f}', (n//2)/n))
else:
    print(str.format('{0:.9f}', ((n//2)+1)/n))
s = input()
a = [s]
def f(n):
    if n % 2 == 0:
        return(n//2)
    else:
        return(3*n+1)
i = 0
while True:
    if f(a[i]) in a:
        print(i+1)
        break
    a.append(f(a[i])
    i += 1


### FIXED CODE ###

s = int(input())

a = [s]
def f(n):
    if n % 2 == 0:
        return(n//2)
    else:
        return(3*n+1)

for i in range(1000001):
    if f(a[i]) in a:
        print(i+2)
        break
    a.append(f(a[i]))
def Qc():
    x, n = map(int, input().split())
    if 0 < n:
        p = map(int, input().split())

        targets = list(range(1, 101))
        outer = set(targets) - set(p)
        res = [abs(x - v) for v in outer]
        i = res.index(min(res))
        res = list(outer)[i]
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        res = x
    print(res)


if __name__ == "__main__":
    Qc()


### FIXED CODE ###

def Qc():
    x, n = map(int, input().split())
    if 0 < n:
        p = list(map(int, input().split()))
        for i in range(101):
            if x - i not in p:
                print(x - i)
                exit()
            if x + i not in p:
                res = x + 1
                print(x + i)
                exit()
    else:
        # 整数列がなにもない場合は自分自身が含まれていない最近値になる
        print(x)
        exit()


if __name__ == "__main__":
    Qc()
n = int(input())
s,t = input().split()
new = ''
for i in range(0, n):
	new += s[i]
  	new += t[i]
print (new)

### FIXED CODE ###

n = int(input())
s,t = input().split()
new = ''
for i in range(n):
  new += s[i]
  new += t[i]
print (new)
s = input()

if len(s)%2:
  l1 =s[0:len(s)//2]
  l2 =s[len(s)//2:]
  count=0
  for i in range(len(l1)):
    if l1[i] != l2[i]:
      count += 1
else:
  l1 =s[0:len(s)//2]
  l2 =s[len(s)+1//2:]
  count=0
  for i in range(len(l1)):
    if l1[i] != l2[i]:
      count += 1

print(count)

### FIXED CODE ###

s = input()
num = int(len(s)/2)
count = 0

for i in range(num):
  if s[i] != s[len(s)-i-1]:
    count+=1
print(count)
a,b = map(float,input().split())
print(int(a/b))

### FIXED CODE ###

from decimal import Decimal
a,b = map(Decimal,input().split())
print(int(a*b))
[x,n]=[int(i) for i in input().split()]

if n!=0:
    p_list=[int(i) for i in input().split()]


    abs_list=[]
    a_list=list(range(min(p_list),max(p_list)+1))

    for i in p_list:
        a_list.remove(i)

   

    for i in a_list:
     abs_list.append(abs(x-i))
    
    num=abs_list.index(min(abs_list))
    print(a_list[num])

else:
    print(x)
    

### FIXED CODE ###

[x,n]=[int(i) for i in input().split()]

if n!=0:
    p_list=[int(i) for i in input().split()]
    
    if x not in p_list:
        print(x)
        
    else:
        i=1
        while True:
            if (x-i) not in p_list:
                print(x-i)
                break
            elif (x+i) not in p_list:
                print(x+i)
                break
            else:
                i+=1
                


else:
    print(x)
# using-utf8
#codebegin
R=input()
r=int(R)
if r<1200:
    print("ABC"):
if r>(1200-1) and r<2800:
    print("ARC")
if r>(2800-1):
    print("AGC")

### FIXED CODE ###

# coding: utf-8
# Your code here!

R=input()
r=int(R)
if r<1200:
    print("ABC")
elif r<2800:
    print("ARC")
else:
    print("AGC")
x=input()
y=input()
A,B,C,D,E,F=1,2,3,4,5,6
if x > y:
  print(">")
elif x==y:
  print("=")
else:
  print("<")

### FIXED CODE ###

x,y=input().split()
if x > y:
  print(">")
elif x==y:
  print("=")
else:
  print("<")