Harryxun/stf_run huggingface dataset:
n, m, k = map(int,input().split())
friends = [[] for i in range(n)]
brock = [[] for i in range(n+1)]
for i in range(m):
    a, b = map(int,input().split())
    friends[a-1].append(b-1)
    friends[b-1].append(a-1)
for i in range(k):
    c, d = map(int,input().split())
    brock[c-1].append(d-1)
    brock[d-1].append(c-1)

group = []

def dfs(x):
    if not x in g:
        g.append(x)
        for l in friends[x]:
            dfs(l)

for i in range(n):
    flag = True
    for j in group:
        if i in j:
            flag = False
    if flag:
        g = [i]
        for j in friends[i]:
            dfs(j)
        group.append(g)

print(group)
'''
ans = [-1 for i in range(n)]
for i in range(n):
    for j in group:
        if i in j:
            ans[i] += len(j)
            break
    ans[i] -= len(friends[i])+len(brock[i])

print(" ".join(map(str,ans)))
'''


### FIXED CODE ###

'''
自宅用PCでの解答
'''
import math
#import numpy as np
import itertools
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7
dir = [(-1,0),(0,-1),(1,0),(0,1)]
alp = "abcdefghijklmnopqrstuvwxyz"


def main():
    n,m,k = map(int,ipt().split())
    fl = [[] for i in range(n)]
    bl = [set() for i in range(n)]
    for i in range(m):
        a,b = map(int,ipt().split())
        fl[a-1].append(b-1)
        fl[b-1].append(a-1)
    for i in range(k):
        c,d = map(int,ipt().split())
        bl[c-1].add(d-1)
        bl[d-1].add(c-1)

    ans = [-1]*n
    al = [True]*n
    for i in range(n):
        if al[i]:
            q = [i]
            al[i] = False
            st = set([i])
            while q:
                qi = q.pop()
                for j in fl[qi]:
                    if al[j]:
                        st.add(j)
                        al[j] = False
                        q.append(j)
            lst = len(st)
            for j in st:
                tmp = lst-len(fl[j])-1
                for k in bl[j]:
                    if k in st:
                        tmp -= 1
                ans[j] = tmp

    print(" ".join(map(str,ans)))


    return None

if __name__ == '__main__':
    main()
while True:
	x = map(str,raw_input().split(' '))
	if x[1] == '+':
		print int(x[0]) + int(x[2])
		continue
	elif x[1] == '-':
		print int(x[0]) - int(x[2])
		continue
	elif x[1] == '*':
		print int(x[0]) * int(x[2])
		continue
	elif x[1] == /+':
		print int(x[0]) / int(x[2])
		continue
	elif x[1] == '?':
		break

### FIXED CODE ###

while True:
	x = map(str,raw_input().split(' '))
	if x[1] == '+':
		print int(x[0]) + int(x[2])
		continue
	elif x[1] == '-':
		print int(x[0]) - int(x[2])
		continue
	elif x[1] == '*':
		print int(x[0]) * int(x[2])
		continue
	elif x[1] == '/':
		print int(x[0]) / int(x[2])
		continue
	elif x[1] == '?':
		break
from collections import defaultdict
N, M = map(int, input().split())
A = list(map(int, input().split()))

ans = 0
hash = defaultdict(int())
i = 0
for a in A:
    i = (i+a) % M
    hash[i] += 1
for h in list(hash.keys()):
    ans += hash[h] * (hash[h]-1) // 2

print(ans)

### FIXED CODE ###

from collections import defaultdict
N, M = map(int, input().split())
A = list(map(int, input().split()))

ans = 0
hash = defaultdict(int)
hash[0] = 1
i = 0
for a in A:
    i = (i+a) % M
    hash[i] += 1
for h in list(hash.keys()):
    ans += hash[h] * (hash[h]-1) // 2

print(ans)
s = input()
t = input()

print("Yes" if t in s*2 else "No")

### FIXED CODE ###

a,b,c = sorted(map(int, input().split()))
print(c-a)
text = input()

check_i = False

def checkHitachi(text):
  for i in range(len(text)):
    if check_i:
      if (text[i] != 'i'):
        return 'No'
      else:
        check_i = False
    else:
      if (text[i] != 'h'):
        return 'No'
      else:
        check_i = True
  return 'Yes'

print(checkHitachi(text))

### FIXED CODE ###

text = input()

def checkHitachi(text):
  # odd length
  if (len(text)%2 != 0): 
    return 'No'
  # even length
  for i in range(0, len(text)-1, 2):
    if (text[i:i+2]!='hi'):
      return 'No'

  return 'Yes'
 
print(checkHitachi(text))
import math
a, b, c, d = map(int, input().split())

lcm = (c * d) // math.gcd(c, d)

total = b - (b//c + b//d - b//lcm)
total_del = a-1 -((a-1)//c + (a-1)//d - (a-1)//lcm)

print(total - total_del)

### FIXED CODE ###

import fractions
a, b, c, d = map(int, input().split())

lcm = (c * d) // fractions.gcd(c, d)

total = b - (b//c + b//d - b//lcm)
total_del = a-1 -((a-1)//c + (a-1)//d - (a-1)//lcm)

print(total - total_del)
#! /usr/bin/env python3

from fractions import gcd
# from math import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement

import copy

N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for i in range(M)]

road = [ [] for i in range(N) ]

for ab in AB:
    road[ab[0]-1] += [ab[1]-1]
    road[ab[1]-1] += [ab[0]-1]

rets_ct = [N for i in range(N)]
rets = [0 for i in range(N)]

def dfs(second, num, ct, done):
    global road, rets_ct, rets
    
    if ct > rets_ct[start]:
        return

    if num == 0:
        rets[start] = second
        rets_ct[start] = ct
        return

    if done[num]:
        return
    done[num] = 1
    
    ct += 1
    next = road[num]
    for i in next:
        if second == 0:
            dfs(i, i, ct, copy.copy(done))
        else:
            dfs(second, i, ct, copy.copy(done))

for start in range(1, N):
    ct = 0
    done = [0 for i in range(N)]
    dfs(0, start, ct, done)

print("Yes")
for i in rets[1:]:
    print(i+1)


### FIXED CODE ###

#! /usr/bin/env python3

# from math import gcd
from fractions import gcd
from collections import Counter, deque, defaultdict
from heapq import heappush, heappop, heappushpop, heapify, heapreplace, merge
from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
from itertools import accumulate, product, permutations, combinations, combinations_with_replacement
import copy

N, M = [int(_) for _ in input().split()]
AB = [[int(_) for _ in input().split()] for i in range(M)]

graph = [[] for i in range(N)]

for A, B in AB:
    graph[A-1] += [B]
    graph[B-1] += [A]

D = deque([0])
visited = [0] * N
visited[0] = 1

ret = [0 for i in range(N)]

while D:
    v = D.popleft()
    for i in graph[v]:
        i -= 1
        if visited[i]: continue
        visited[i] = 1
        ret[i] = v + 1
        D.append(i)

if any(ret[1:]):
    print("Yes")
    for i in ret[1:]:
        print(i)
else:
    print("No")
import math
A,B = map(int,input().split())
print(math.floor(A*B))

### FIXED CODE ###

import math
A,B = input().split()
print (int(A)*int(B.replace('.',''))//100)
N = int(input())

p_n = list(input().split())

result = 0
min_tmp = N + 1
for x in range(N):
    if p_n[x] < min_tmp:
        result += 1
    min_tmp = min(min_tmp,p_n[x])

print(result)

### FIXED CODE ###

N = int(input())

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

result = 0
min_tmp = N + 1
for x in range(N):
    if p_n[x] < min_tmp:
        result += 1
    min_tmp = min(min_tmp,p_n[x])

print(result)
from collections import defaultdict
import itertools


def analyze(string):
  s_count = defaultdict(int)
  for s in string:
    s_count[s] += 1
  return s_count

def count_up(s_count):
  strings = list(s_count.keys())
  ans = 0
  for num in range(1, len(strings) + 1):
    for s_list in itertools.combinations(strings, num):
      num_list = [s_count[s] for s in s_list]
      ans += reduce((lambda x, y: x * y), num_list)
  print(ans % (10**9 + 7))

N = int(input())
string = input()

s_count = analyze(string)
count_up(s_count)


### FIXED CODE ###

from collections import defaultdict
import itertools
from functools import reduce


def analyze(string):
  s_count = defaultdict(int)
  for s in string:
    s_count[s] += 1
  counts = tuple(s_count.values())
  return counts

N = int(input())
string = input()

def search(N, string):
    memo = {}
    def count(counts, num_set):
        if (counts, num_set) in memo:
            return memo[(counts, num_set)]

        if num_set == 1:
            ans = sum(counts)
        elif num_set == 2:
            num_sum = sum(counts)
            ans = 0
            for i in range(len(counts)):
                num_sum -= counts[i]
                ans += counts[i] * num_sum
        else:
            ans = 0
            for i in range(len(counts) - 1):
                ans += counts[i] * count(counts[i + 1:], num_set - 1)

        memo[(counts, num_set)] = ans
        return ans

    counts = analyze(string)
    ans = 0
    for i in range(1, len(counts) + 1):
        ans += count(counts, i)
    print(ans % (10**9 + 7))

search(N, string)
def resolve():
    import math
    a,b,x = map(int, input().split())
    if 10**((x//b)-1) < 10:
        pmax = min (x//a, 10**((x//b)-1))
    else:
        pmax = x//a
    if pmax ==0:
        print(0)
        exit()
    elif pmax > 10**9:
        pmax = 10**9

    for i in range(10**9):
        n1 = pmax-i
        logn1 = int(math.log(n1,10))+1
        if a*n1+b*logn1 <= x:
            print(n1)
            exit()
resolve()

### FIXED CODE ###

def resolve():
    s = input()
    if s == "SUN":
        print(7)
    elif s == "MON":
        print(6)
    elif s == "TUE":
        print(5)
    elif s == "WED":
        print(4)
    elif s == "THU":
        print(3)
    elif s == "FRI":
        print(2)
    elif s == "SAT":
        print(1)
resolve()
N = int(input())
S = input()

cnt = 0

for i in range(1000):
    if 0 <= i < 10:
        a = "00" + str(i)
    elif 10 <= i < 100:
        a = "0" + str(i)
    elif 100 <= i:
        a = str(i)
    
    idx = 0
    for j in range(N):
        if S[i] == a[idx]:
            idx += 1
            if idx == 3:
                cnt += 1
                break

print(cnt)

### FIXED CODE ###

N = int(input())
S = list(map(int, list(input())))

cnt = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            pin = [i, j, k]
            x = 0

            for a in S:
                if a == pin[x]:
                    x += 1
                    if x == 3:
                        cnt += 1
                        break

print(cnt)
import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))



X=int(input())

prime_l=[0]*(2*X)
for  i in range(2,X):
    if(prime_l[i]==0):
        for j in range(1,(2*X)//i):
            prime_l[i*j]+=1
        
while(1):
    X+=1
    if(prime_l[X]==0):
        print(X)
        sys.exit(0)


### FIXED CODE ###

import sys
import  math
import fractions
from collections import defaultdict
stdin = sys.stdin
     
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

S=ns().split()
print(S[1]+S[0])
n = int(raw_input())

d = [99999 for i in range(n)]
G = [0 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
g = [0 for i in range(n)]
temp_d = [0]

def BFS_visit(s, temp_d):
    if temp_d == 99999:
        temp_d = 0
    if d[s] > temp_d:
        d[s] = temp_d
    temp_d += 1
    for e in range(n):
        if M[s][e] == 1 and s != e:
            BFS_visit(e, temp_d)

def BFS():
    s = 0
    BFS_visit(0, d[s])
    for s in range(n):
        if d[s] == 99999:
            d[s] = -1
    for s in range(n):
        print'{0} {1}'.format(s+1, d[s])

for i in range(n):
    G = map(int, raw_input().split())
    for j in range(G[1]):
        M[G[0]-1][G[2+j]-1] = 1
    g[i] = G[1]
BFS()

### FIXED CODE ###

n = int(raw_input())
 
d = [99999 for i in range(n)]
G = [0 for i in range(n)]
M = [[0 for i in range(n)] for j in range(n)]
 
def BFS(s):
    for e in range(n):
        if M[s][e] == 1:
            if d[e] > d[s] + 1:
                d[e] = d[s]+1
                BFS(e)
 
for i in range(n):
    G = map(int, raw_input().split())
    for j in range(G[1]):
        M[G[0]-1][G[2+j]-1] = 1
 
d[0] = 0
for s in range(n):
        BFS(s)
for s in range(n):
    if d[s] == 99999:
        d[s] = -1
for s in range(n):
    print'{0} {1}'.format(s+1, d[s])
import collections
N = map(int, input().split())
A = list(map(int, input().split()))
Q = map(int, input().split())
B, C = list(map(int, input().split())),list(map(int, input().split()))

base = 0
cnt = collections.Counter(A)

for i in range(N):
    base += A[i]

Ans = []
Ans.append(base + (C[0]-B[0]) * cnt[B[0]])

for i in range(Q-1):
    if cnt[B[i+1]] != 0:
        Ans.append(Ans[i] + (C[i+1]-B[i+1]) * cnt[B[i+1]])
        for j in range(i+1):
            Ans[i+1] += B.count(C[j]) * (C[i+1] - C[j])
    else:
        Ans.append(Ans[i])

print(Ans)

### FIXED CODE ###

import collections

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

CNT = collections.Counter(A)
ANS = []
ans = sum(A)

for i in range(q):
    b, c = map(int, input().split())
    t = CNT[b]
    ans +=(c - b) * t
    ANS.append(ans)
    CNT[c] += t
    CNT[b] = 0

for i in ANS:
    print(i)
MOD = (10**9) + 7
n = int(input())
a = list(map(int,intput().split()))

cnt = [0] * 60

for num in a:
  for j in range(60):
    cnt[j] += num >> j
ans = 0
for b in range(60):
  ans += cnt[b] * (n-cnt[b]) << b % 2
  
ans %= MOD
print(ans)

### FIXED CODE ###

MOD = (10**9) + 7
n = int(input())
a = list(map(int,input().split()))

cnt = [0] * 60

for num in a:
  for j in range(60):
    cnt[j] += (num >> j) % 2
ans = 0
for b in range(60):
  ans += cnt[b] * (n-cnt[b]) << b
  
ans %= MOD
print(ans)
import math

N = int(input())
min_f = 10
for n in range(1, math.sqrt(N)):
    a = n
    if N % n != 0:
        continue
    b = N / n
    f = max(len(str(a)), len(str(b)))
    min_f = min(min_f, f)
print(min_f)

### FIXED CODE ###

import math

N = int(input())
min_f = 10
for n in range(1, int(math.sqrt(N)) + 1):
    a = n
    if N % n != 0:
        continue
    b = int(N / n)
    f = max(len(str(a)), len(str(b)))
    min_f = min(min_f, f)
print(min_f)
print(sum([x for x in range(a,int(input())+1) if (x%3!=0)and(x%5!=0)]))

### FIXED CODE ###

def sum(x):
    a=int(x//3)
    b=int(x//5)
    c=int(x//15)
    sall=int((1+x)*(x/2))
    #print(sall)
    s3=int((3*(a-1)+6)*(a/2))
    #print(s3)
    s5=int((5*(b-1)+10)*(b/2))
    #print(s5)
    s15=int((15*(c-1)+30)*(c/2))
    #print(s15)
    ans=int(s15-s3-s5+sall)
    print(ans)
n=int(input())
sum(n)
n = int(input())

sayTable = []
for i in range(n):
	a = int(input())
	
	sayArray = []
	for j in range(a):
		x, y = [int(v) for v in input().split()]
		sayArray.append((x-1, y+1))
	sayTable.append(sayArray)

def count(honest):
	count = 0
	for v in honest:
		if v == 2:
			count += 1
	return count

def checkHonest(sayArray, honest):
	for x, y in sayArray:
		if y == 2 and honest[x] != 2:
			return False
	return True

def checkHonestAll(sayTable, honest):
	for i in range(n):
		h = honest[i]
		if h != 2:
			continue
		for x, y in sayArray:
			if honest[x] != y:
				return False
	return True

def setHonest(sayArray, honest):
	for x, y in sayArray:
		honest[x] = y

def search(sayTable, honest, i):
	if i >= n;
		if checkHonestAll(sayTable, honest):
			return count(honest)
		else:
			return 0

	count = 0
	h = honest[i]
    sayArray = sayTable[i]
	if (h == 0 or h == 2) and checkHonest(sayArray, honest):
		copyHonest = honest[:]
		setHonest(sayArray, copyHonest)
		copyHonest[i] = 2
		c = search(sayTable, copyHonest, i + 1)
		if count < c:
			count = c

	honest[i] = 1
	c = search(sayTable, honest, i+1)
	if count < c:
		count = c
	return count

print(search(sayTable, [0] * n, 0));


### FIXED CODE ###

n = int(input())

sayTable = []
for i in range(n):
	a = int(input())
	
	sayArray = []
	for j in range(a):
		x, y = [int(v) for v in input().split()]
		sayArray.append((x-1, y+1))
	sayTable.append(sayArray)

def countHonest(honest):
	count = 0
	for v in honest:
		if v == 2:
			count += 1
	return count

def checkHonest(sayArray, honest):
	for x, y in sayArray:
		if honest[x] == 0:
				continue
		if y == 2 and honest[x] != 2:
			return False
	return True

def checkHonestAll(sayTable, honest):
	for i in range(n):
		h = honest[i]
		if h != 2:
			continue
		sayArray = sayTable[i]
		for x, y in sayArray:
			if y != honest[x]:
				return False
	return True

def setHonest(sayArray, honest):
	for x, y in sayArray:
		honest[x] = y

def search(sayTable, honest, i):
	if i >= n:
		if checkHonestAll(sayTable, honest):
			return countHonest(honest)
		else:
			return 0

	count = 0
	h = honest[i]
	sayArray = sayTable[i]
	if (h == 0 or h == 2) and checkHonest(sayArray, honest):
		copyHonest = honest[:]
		setHonest(sayArray, copyHonest)
		copyHonest[i] = 2
		c = search(sayTable, copyHonest, i+1)
		if count < c:
			count = c

	honest[i] = 1
	c = search(sayTable, honest, i+1)
	if count < c:
		count = c
	return count

print(search(sayTable, [0] * n, 0))
s = list(str(input()))
s1 = list(set(s1))

print('yes' if len(s)==len(s1) else 'no')

### FIXED CODE ###

s = list(str(input()))
s1 = list(set(s))

print('yes' if len(s)==len(s1) else 'no')
n = int(raw_input())
s = range(1,14)
h = range(1,14)
c = range(1,14)
d = range(1,14)
 
for i in range(n):
    r = raw_input().split()
    if hd == 'S':
        s[int(r)-1] = 0
    elif hd == 'H':
        h[int(r)-1] = 0
    elif hd == 'C':
        c[int(r)-1] = 0
    elif hd == 'D':
        d[int(r)-1] = 0
 
a = 'S'
for i in range(13):
    if s[i] != 0:
        print a + str(s[i])
a = 'H'
for i in range(13):
    if h[i] != 0:
        print a + str(h[i])
a = 'C'
for i in range(13):
    if c[i] != 0:
        print a + str(c[i])
a = 'D'
for i in range(13):
    if d[i] != 0:
        print a + str(d[i])

### FIXED CODE ###

n = int(raw_input())
s = range(1,14)
h = range(1,14)
c = range(1,14)
d = range(1,14)
 
for i in range(n):
    q,r = raw_input().split()
    if q == 'S':
        s[int(r)-1] = 0
    elif q == 'H':
        h[int(r)-1] = 0
    elif q == 'C':
        c[int(r)-1] = 0
    elif q == 'D':
        d[int(r)-1] = 0
 
a = 'S '
for i in range(13):
    if s[i] != 0:
        print a + str(s[i])
a = 'H '
for i in range(13):
    if h[i] != 0:
        print a + str(h[i])
a = 'C '
for i in range(13):
    if c[i] != 0:
        print a + str(c[i])
a = 'D '
for i in range(13):
    if d[i] != 0:
        print a + str(d[i])
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


import bisect
from math import gcd
n = int(input())
l = [None] * n
for i in range(n):
    a,b = map(int, input().split())
    g = gcd(a,b)
    l[i] = (a//g, b//g)

l.sort()
M = 1000000007
seen = [False] * n
vals = []

def sub(item):
    item1 = (item[1], -item[0])
    item2 = (-item[1], item[0])
    tmp = None
    count = 0
    li = bisect.bisect_left(l, item1)
    ri = bisect.bisect_right(l, item1)
    count += (ri-li)
    for v in range(li, ri):
        seen[v] = True
    if ri>li:
        tmp = l[li]
        
    li = bisect.bisect_left(l, item2)
    ri = bisect.bisect_right(l, item2)
    count += (ri-li)
    for v in range(li, ri):
        seen[v] = True
    if ri>li:
        tmp = l[li]
    
    return count, tmp

for i,item in enumerate(l):
    if seen[i]:
        continue
    count,tmp = sub(item)
    if count>0:
        count2, tmp = sub(tmp)
        vals.append((pow(2,count,M)+pow(2,count2,M)-1)%M)
    else:
        vals.append(2)
ans = 1
for v in vals:
    ans *= v
    ans %= M
print(ans-1)

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



import bisect
from math import gcd
n = int(input())
l = [None] * n
for i in range(n):
    a,b = map(int, input().split())
    g = gcd(a,b)
    if g==0:
        g = 1
    l[i] = (a//g, b//g)

l.sort()
M = 1000000007
seen = [False] * n
vals = []

def sub(item):
    item1 = (item[1], -item[0])
    item2 = (-item[1], item[0])
    tmp = None
    count = 0
    li = bisect.bisect_left(l, item1)
    ri = bisect.bisect_right(l, item1)
    count += (ri-li)
    for v in range(li, ri):
        seen[v] = True
    if ri>li:
        tmp = l[li]
        
    li = bisect.bisect_left(l, item2)
    ri = bisect.bisect_right(l, item2)
    count += (ri-li)
    for v in range(li, ri):
        seen[v] = True
    if ri>li:
        tmp = l[li]
    
    return count, tmp
zcount = 0
for i,item in enumerate(l):
    if seen[i]:
        continue
    elif item==(0,0):
        zcount += 1
        continue
    count,tmp = sub(item)
    if count>0:
        count2, tmp = sub(tmp)
        vals.append((pow(2,count,M)+pow(2,count2,M)-1)%M)
    else:
        vals.append(2)
ans = 1
for v in vals:
    ans *= v
    ans %= M
ans -= 1
ans = (ans+zcount) % M
print(ans)
def actual(X, N, P):
    for i in range(X, -1, -1):
        if i not in P:
            left = i
            break

    for i in range(X, 101):
        if i not in P:
            right = i
            break

    if abs(left - X) <= abs(right - X):
        return left
    else:
        return right


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

if N == 0:
    print(X)
else:
    P = list(map(int, input().split()))
    print(actual(X, N, P))


### FIXED CODE ###

def actual(X, N, P):
    for i in range(X, -1 - 1, -1):
        if i not in P:
            left = i
            break

    for i in range(X, 101 + 1):
        if i not in P:
            right = i
            break

    if abs(left - X) <= abs(right - X):
        answer = left
    else:
        answer = right

    return answer


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

if N == 0:
    P = []
    print(actual(X, N, P))
else:
    P = list(map(int, input().split()))
    print(actual(X, N, P))
N = int(input())

a = list(map(int, input().split()))
ans = 1
if a.index(0):
    ans = (0)
else :
    for i in range(N):
        ans = ans * a[i]
        if ans > 10**18:
            ans = -1
            break
print(ans)

### FIXED CODE ###

a, b = map(int, input().split())
print(a * b)
while True:
    S = input().lower()
    a = [0 for i in range(26)]
    for c in S:
        if ord(c) >= 97\
        and ord(c) <= 122:
            i = ord(c) - 97
            a[i] += 1

    for i in range(26):
        print("{0} : {1}".format(chr(i + 97), a[i]))

### FIXED CODE ###

import sys
cnts = {}
for line in sys.stdin:
    for c in list(line.lower()): cnts[c] = cnts.get(c,0) + 1
  
for c in range(ord('a'),ord('z')+1): print(chr(c),':',cnts.get(chr(c),0))
intxt = input()
p = ""
ok = 0
for i in intxt:
  if i != p:
    ok += 1
  p = i
if ok == 1:
  print("Yes")
else:
  print("No)

### FIXED CODE ###

s = input()
if s[0] == s[1] and s[1] == s[2]:
  print("No")
else:
  print("Yes")
n,m = map(int,input().split())
keta = []
number = []

for i in range(m):
    n,a=input().split()
    keta.append(int(n))
    number.append(a)

ccount = 0
count = 0   
ans = 0
if max(keta) == 3:
   ans = 100
if max(keta) == 2:
   ans = 10
if max(keta) == 1:
   ans = 0

while count == 0:
   ans = str(ans)
   for i in range(0,m):
      if ans[keta[i]-1] == number[i]:
         ccount += 1
   if ccount == m:
      count += 1
   ccount = 0
   ans = int(ans)
   ans += 1
print(ans - 1)

### FIXED CODE ###

n,m = map(int,input().split())
keta = []
number = []

for i in range(m):
    b,a=input().split()
    keta.append(int(b))
    number.append(a)

ccount = 0
count = 0   
ans = 0
if n == 3:
   ans = 100
else:
   pass
if n == 2:
   ans = 10
else:
   pass
if n == 1:
   ans = 0
else:
   pass

while count == 0:
   ans = str(ans)
   for i in range(0,m):
      if ans[keta[i]-1] == number[i]:
         ccount += 1
   if ccount == m:
      count += 1
   ccount = 0
   ans = int(ans)
   ans += 1
   if n == 3 and (ans - 1) == 1000:
      ans = 0
      break
   if n == 2 and (ans - 1) == 100:
      ans = 0
      break
   if n == 1 and (ans - 1) == 10:
      ans = 0
      break
print(ans - 1)