Harryxun/stf_run huggingface dataset:
n,m = map(int,input().split())
sc_inputs = [[int(j) for j in input().split()] for i in range(m)]

dic={}
for sc in sc_inputs:
    s,c = map(int,sc)
    if s in dic and dic.get(s)!=c:
        print(-1);exit()
    dic[s]=c

if dic[1]==0:
    print(-1);exit()
for i in range(10**(n-1),10**n):
    s = str(i)
    flag = True
    for key,value in dic.items():
        if s[key-1]!=str(value):
            flag=False
    if flag:
        print(s);exit()
    




### FIXED CODE ###

import sys
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())

for i in range(1000):
    string = str(i)
    if len(string) != N:
        continue
    flag = True
    for j in range(M):
        if string[S[j] - 1] == str(C[j]):
            None
        else:
            flag = False
            break
    if flag:
        print(i)
        sys.exit(0)
print("-1")
S = str,input().split()
T = str,input().split()

print(T + S)

### FIXED CODE ###

S,T = map(str,input().split())
print(T + S)
n = int(input())

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

from fraction import gcd
from functools import reduce


def gcd(numbers):
    return reduce(gcd, numbers)


g = gcd(a)
a = [a[i]//g for i in range(n)]


m = 1
for i in range(n):
    b = a[:]
    del b[i]
    gg = gcd(b)
    m = max(m, gg)


print(g * m)


### FIXED CODE ###


n = int(input())

a = list(map(int, input().split()))
a.sort(reverse=True)


from functools import lru_cache
import sys
if n == 2:
    print(max(a))
    sys.exit()


@lru_cache(maxsize=100000)
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x


def gcd_list(li):
    if len(li) == 1:
        return li[0]
    g = gcd(li[0], li[1])
    for i in range(2, len(li)):
        g = gcd(g, li[i])
    return g


def gcd_list_2(li):
    g = gcd(li[0], li[1])
    if g == 1:
        return max(gcd_list([li[0]] + li[2:]), gcd_list(li[1:]))
    for i in range(2, n):
        if gcd(g, li[i]) == 1:
            if i == n - 1:
                return gcd_list(li[:i])
            gg = gcd_list(li[i+1:])
            bb = [gcd(li[x], gg) for x in range(i+1)]
            bb.sort()
            return bb[1]
        else:
            g = gcd(g, li[i])
    return g


def max_gcd(a):
    g = gcd_list(a)
    a = [a[i]//g for i in range(n)]
    m = gcd_list_2(a)
    print(g * m)


max_gcd(a)
N = int(input())
if N[0] == N[2]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N = input()
if N[0] == N[2]:
    print("Yes")
else:
    print("No")
N, K = map(int, input().split())
l = sorted(map(int, input().split()), reversed=True)
print(sum(l[:K]))

### FIXED CODE ###

N, K = map(int, input().split())
l = sorted(map(int, input().split()), reverse=True)
print(sum(l[:K]))
import sys
# input = sys.stdin.readline
from itertools import accumulate

def readlines(n):
    for _ in range(n):
        yield map(int, input().split())


def main():
    s = input()

    subst = 0
    for i in range(len(s)):
        if s[i] in "ACGT":
            subst += 1
        else:
            yield subst
            subst = 0
        
    

print(max(main()))


### FIXED CODE ###

import sys
# input = sys.stdin.readline

def readlines(n):
    for _ in range(n):
        yield map(int, input().split())


def main():
    s = input()

    subst = 0
    for i in range(len(s)):
        if s[i] in "ACGT":
            subst += 1
        else:
            yield subst
            subst = 0
    
    yield subst
    

print(max(main()))
n, k = [int(s) for s in input().split()]
s = input()

print(s[:k-1] + lower(s[k-1]) + s[k])


### FIXED CODE ###

n, k = map(int, input().split())
s = input()

newS = s[:k-1]+s[k-1].lower()+s[k:]

print(newS)
H,W = map(int,input().split())
mas = [list(input()) for i in range(H)]
new_mas = [row for row in mas if "#" in row:]
new_mas2 = [column for column in list(zip(*new_mas)) if "#" in column]
for i in list(zip(*new_mas2)):
    for j in i:
        print(j,end="")
    print()


### FIXED CODE ###

H,W = map(int,input().split())
mas = [list(input()) for i in range(H)]
new_mas = []
new_mas2 = []
for row in mas:
    if "#" in row:
        new_mas.append(row)
    elif "#" not in row:
        continue

for column in list(zip(*new_mas)):
    if "#" in column:
        new_mas2.append(column)
    elif "#" not in column:
        continue

for i in list(zip(*new_mas2)):
    for j in i:
        print(j,end="")
    print()
H,W,M=map(int,input().split())
MX=[0]*H
MY=[0]*W
MA=[0]*M

for i in range(M):
  x,y=map(int,input().split())
  x-=1
  y-=1
  MX[x]+=1
  MY[y]+=1
  MA[i]=(x,y)
xmax=max(MX)
ymax=max(MY)
ix=[x[0] for x in enumerate(MX) if x[1]==xmax]
iy=[x[0] for x in enumerate(MY) if x[1]==ymax]

i=0
j=0
for x,y in MA:
  if x in ix or y in iy:
    pass
  else:
    i+=1
  
  j+=1
  
  if len(ix)*len(iy)-j>M-i:
    print(xmax+ymax)
else:
  print(xmax+ymax-1)


### FIXED CODE ###

N,X,T=input().split()

print(((int(N)-1)//int(X)+1)*int(T))
from sys import stdin
readline = stdin.buffer.readline

def main():
    H , W, M = map(int, readline().rstrip().split())
    HW = [[0] * (W + 1) for _ in range(H + 1)]
    HB = [0] * (H + 1)
    HS = set()
    WB = [0] * (W + 1)
    WS = set()
    for _ in range(M):
        h, w = map(int, readline().rstrip().split())
        HW[h][w] = 1
        HB[h] += 1
        HS.add(h)
        WB[w] += 1
        WS.add(w)
    ans = 0
    for h in HS:
        for w in WS:
            tmp = HB[h] + WB[w]
            if HW[h][w] == 1:
                tmp -= 1
            ans = max(ans, tmp)
    print(ans)

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    import sys
    from collections import defaultdict
    readline = sys.stdin.readline

    H, W, M = map(int, readline().rstrip().split())
    HB = [0] * H
    WB = [0] * W
    HW = defaultdict(lambda : False)
    for _ in range(M):
        h, w = map(int, readline().rstrip().split())
        h -= 1
        w -= 1
        HW[(h,w)] = True
        HB[h] += 1
        WB[w] += 1
    hb = max(HB)
    max_h = [i for i, x in enumerate(HB) if x == hb]
    wb = max(WB)
    max_w = [i for i, x in enumerate(WB) if x == wb]
    
    ans = hb + wb
    for mh in max_h:
        for mw in max_w:
            if HW[(mh, mw)] == False:
                print(ans)
                sys.exit(0)
    print(ans - 1)

if __name__ == "__main__":
    main()
cnt = 0
i = 0
while H > 0:
    H //= 2
    cnt += 2 ** i
    i += 1
print(cnt)

### FIXED CODE ###

H = int(input())

cnt = 0
i = 0
while H > 0:
    H //= 2
    cnt += 2 ** i
    i += 1
print(cnt)
# -*- coding: utf-8 -*-

# input
s = input()

# solve
for f in range(len(s)):
    if s[i] == 'A':
        a = i
        break

for f in reversed(range(len(s))):
    if s[i] == 'Z':
        z = i
        break

# output
print(z - a + 1)


### FIXED CODE ###

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

# input
s = input()

# solve
for i in range(len(s)):
    if s[i] == 'A':
        a = i
        break

for i in reversed(range(len(s))):
    if s[i] == 'Z':
        z = i
        break

# output
print(z - a + 1)
N = long(input())

print(long(N*(N-1)*0.5))

### FIXED CODE ###

N = int(input())
print(N*(N-1)//2)
def koch(n, a_x, a_y, b_x, b_y):
  if n == 0:
    return

  th = math.pi*60.0/180.0

  s_x = (2.0*a_x + 1.0*b_x)/3.0
  s_y = (2.0*a_x + 1.0*b_x)/3.0
  t_x = (1.0*a_x + 2.0*b_x)/3.0
  t_y = (1.0*a_x + 2.0*b_x)/3.0
  u_x = (t_x - s_x)*math.cos(th) + (t_y - s_y)*math.sin(th) + s_x
  u_y = (t_x - s_x)*math.sin(th) + (t_y - s_y)*math.cos(th) + s_y

  koch(n-1, a_x, a_y, s_x, s_y)
  print '%.8f %8.f' % (s_x, s_y)
  koch(n-1, s_x, s_y, u_x, u_y)
  print '%.8f %8.f' % (u_x, u_y)
  koch(n-1, u_x, u_y, t_x, t_y)
  print '%.8f %8.f' % (t_x, t_y)
  koch(n-1, t_x, t_y, b_x, b_y)



n = input()
a_x = 0.0
a_y = 0.0
b_x = 100.0
b_y = 0.0

print '%.8f %8.f' % (a_x, a_y)
koch(n-1, a_x, a_y, b_x, b_y)
print '%.8f %8.f' % (b_x, b_y)

### FIXED CODE ###

def koch(n, a_x, a_y, b_x, b_y):
  if n == 0:
    return
 
  th = math.pi*60.0/180.0
 
  s_x = (2.0*a_x + 1.0*b_x)/3.0
  s_y = (2.0*a_y + 1.0*b_y)/3.0
  t_x = (1.0*a_x + 2.0*b_x)/3.0
  t_y = (1.0*a_y + 2.0*b_y)/3.0
  u_x = (t_x - s_x)*math.cos(th) - (t_y - s_y)*math.sin(th) + s_x
  u_y = (t_x - s_x)*math.sin(th) + (t_y - s_y)*math.cos(th) + s_y
 
  koch(n-1, a_x, a_y, s_x, s_y)
  print '%.8f %.8f' % (s_x, s_y)
  koch(n-1, s_x, s_y, u_x, u_y)
  print '%.8f %.8f' % (u_x, u_y)
  koch(n-1, u_x, u_y, t_x, t_y)
  print '%.8f %.8f' % (t_x, t_y)
  koch(n-1, t_x, t_y, b_x, b_y)
 
 

import math
n = input()
a_x = 0.0
a_y = 0.0
b_x = 100.0
b_y = 0.0
 
print '%.8f %.8f' % (a_x, a_y)
koch(n, a_x, a_y, b_x, b_y)
print '%.8f %.8f' % (b_x, b_y)
a=input()
b=input()
c=input()
if(a==b and a == c):
  print("No")
elif(a != b and b == c):
  print("Yes")
elif(a != b and a == c):
  print("Yes")
elif(a!=c and a == b):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a=input()
b=a[2]
c=a[4]
a=a[0]
if(a==b and a == c):
  print("No")
elif(a != b and b == c):
  print("Yes")
elif(a != b and a == c):
  print("Yes")
elif(a!=c and a == b):
  print("Yes")
else:
  print("No")
r = int(intput())
print(3 * r * r)

### FIXED CODE ###

r = int(input())
print(3 * r * r)
import sys

s = input()
N = len(s)
j = int((N-1)/2)
i = 0
while i!=j:
  if s[i] == s[j]:
    print("YES")
  else:
    print("No")
    sys.exit()
  i = i+1
  j = j-1
p = int((N+3)/2 -1)
q = N
while p!=q:
  if s[p] == s[q]:
    pass
  else:
    print("No")
    sys.exit()
  p = p+1
  q = q-1

a = 0
while a != N:
  if s[a] == s[N]:
    pass
  else:
    print("No")
    sys.exit()
  a = a+1
  N = N-1
if a >= (N-1)/2:
  print("Yes")

### FIXED CODE ###

s = input()
N = len(s)
t = s[::-1]
a = s[0:int((N-1)/2)]
b = a[::-1]
if s == t and a == b:
  print("Yes")
else:
  print("No")
if __name__ == '__main__':
    K = input()
    odds = int(K+1)/2
    even = K/2
    print(odds*even)

### FIXED CODE ###

if __name__ == '__main__':
    K = int(input())
    odds = int((K+1)/2)
    even = int(K/2)
    print(odds*even)
a = int(input())
b = float(input())
c = float(a) * b
ans = int(c//1)
print(ans)

### FIXED CODE ###

a, b = input().split()

c = int(a)
d = int(float(b) * 1000)

e = c * d

ans = e // 1000
print(ans)
from fractions import gcd

n = int(input())
ans = 1

for _ in range(n):
	i = int(input())
	ans = int(ans / gcd(ans, i) * i)

print(ans)

### FIXED CODE ###

from fractions import gcd

n = int(input())
ans = 1

for _ in range(n):
	i = int(input())
	ans = ans // gcd(ans, i) * i

print(ans)
N = int(input())
seq = [int(input()) for _ in range(N)]
LIS = deque([seq[0]])
for i in range(1,len(seq)):
    if seq[i] <= LIS[0]:
        LIS.appendleft(seq[i])
    else:
        LIS[bisect.bisect_left(LIS, seq[i])-1] = seq[i]
 
print(len(LIS))

### FIXED CODE ###

N = int(input())
seq = [int(input()) for _ in range(N)]
from collections import deque
import bisect
LIS = deque([seq[0]])
for i in range(1,len(seq)):
    if seq[i] <= LIS[0]:
        LIS.appendleft(seq[i])
    else:
        LIS[bisect.bisect_left(LIS, seq[i])-1] = seq[i]

print(len(LIS))
X,Y,Z,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort(reverse= True)
B.sort(reverse= True)
C.sort(reverse= True)
LIS = []
S = 0
T = 0
for s in range(X):
    for t in range(Y):
        for u in range(min((3000//(s+1)*(t+1))+1,Z))
            SU = A[s] + B[t] + C[u]
            LIS.append(SU)
LIS.sort(reverse = True)
for i in range(K):
    print(LIS[i])

### FIXED CODE ###

import math
A, B = map(int,input().split())
if A == 0:
    if B % 4 ==0:
        print(B)
    elif B % 4 == 1:
        print(1)
    elif B % 4 == 2:
        print(B+1)
    else:
        print(0)
elif A == B:
    print(A)
else:
    LA = []
    LB = []
    for i in range(int(math.log2(A))+1):
        P = A % (2**(i+1))
        Q = P % (2**i)
        R = (P-Q)//(2**i)
        LA.append(R)
    for i in range(int(math.log2(B))+1):
        P = B % (2**(i+1))
        Q = P % (2**i)
        R = (P-Q)//(2**i)
        LB.append(R)
    LS = []
    def Q(a,b):
        return (a%2,b%2)
    if A == B-1:
        if Q(A,B) == (0,1):
            print(1)
        else:
            LS.append(1)
            if len(LA) == len(LB):
                for i in range(1,len(LA)):
                    LS.append((LA[i]+LB[i])%2)
            else:
                for i in range(len(LA)):
                    LS.append(1)
            ANS = 0
            for i in range(len(LS)):
                ANS += (2**i)*LS[i]
            print(ANS)
    else:
        if Q(A,B) == (0,0):
            if (B-A+1)%4 ==1:
                print(B)
            else:
                print(B+1)
        elif Q(A,B) == (0,1):
            if (B-A+1)%4 == 0:
                print(0)
            else:
                print(1)
        elif Q(A,B) == (1,0):
            if (B-A+1)%4 == 0:
                LS.append(0)
            else:
                LS.append(1)
            if len(LA) > 1:
                for i in range(1,len(LA)):
                    LS.append((LA[i]+LB[i])%2)
            if len(LB) > len(LA):
                for i in range(len(LA),len(LB)):
                    LS.append(LB[i])
            ANS = 0
            for i in range(len(LS)):
                ANS += (2**i)*LS[i]
            print(ANS)
        else:
            if (B-A+1)%4 == 1:
                print(A)
            else:
                print(A-1)
s = input()
q = int(ionput())
h,t = [],[]
p = 0

for i in range(q):
    c = input().split()
    if c[0] =='1':
        h,t = t,h
        p = 1-p
    else:
        if c[1] =='1':
            h.append(c[2])
        else:
            t.append(c[2])
if p ==1:
    s = s[::-1]
print("".join(h[::-1])+s+"".join(t))

### FIXED CODE ###

s = input()
q = int(input())
h,t = [],[]
p = 0

for i in range(q):
    c = input().split()
    if c[0] == '1':
        h,t = t,h
        p = 1-p
    else:
        if c[1] =='1':
            h.append(c[2])
        else:
            t.append(c[2])
if p ==1:
    s = s[::-1]
print("".join(h[::-1])+s+"".join(t))
S = int(input())
mod = 10**9+7
memo = [-1]*(S+1)
def redis(s):
  if memo[s] != -1:
    return memo[s]
  else:
    if s < 3:
      memo[s] = 0
      return 0
    elif s < 6:
      memo[s] = 1
      return 1
    else:
      tmp = 0
      for num in range(s):
        tmp += (redis(num)*redis(s-num))%mod
      memo[s] = tmp
      return tmp%mod
print(redis(S))
    



### FIXED CODE ###

S = int(input())
mod = 10**9+7
memo = [-1]*(S+1)
memo[0] = 1
def redis(s):
  if memo[s] != -1:
    return memo[s]
  else:
    if s < 3:
      memo[s] = 0
      return 0
    elif s < 6:
      memo[s] = 1
      return 1
    else:
      tmp = 0
      for num in range(s-2):
        tmp += redis(num)%mod
      memo[s] = tmp
      return tmp%mod
print(redis(S))
N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.append(keys)
    
ans.sort()

for i in ans:
  print(ans[i])


### FIXED CODE ###

N = int(input())
S = [input() for _ in range(N)]

dic = {}

for i in range(N):
  if S[i] not in dic.keys():
    dic[S[i]] = 1
    
  else:
    dic[S[i]] += 1
    
maxim = max(dic.values())
ans = []

for keys in dic.keys():
  if dic[keys] == maxim:
    ans.append(keys)
    
ans.sort()

for i in range(len(ans)):
  print(ans[i])
string = input()
a, b = input().split(' ')
if a > b:
    print('a > b')
elif a < b:
    print('a < b')
else:
    print('a == b')


### FIXED CODE ###

string = input()
a, b = map(int, (string.split(' ')))
if a > b:
    print('a > b')
elif a < b:
    print('a < b')
else:
    print('a == b')
a,b=map(int, input().split())
s = [list(map(int, input().split())) for i in range(b)]
s = sum(s, [])
L =[0]*a
ans = 0
ab = 10**(a-1)

for i in range(b):
    if L[s[i*2]-1] == 0:
        L[s[i*2]-1] = s[i*2+1]
    if L[s[i*2]-1] != 0 and L[s[i*2]-1] == s[i*2+1]:
        pass
    if L[s[i*2]-1] != 0 and L[s[i*2]-1] != s[i*2+1]:
        ans += 1

if ans == 0:
    if a == 1 and b == 0:
        print(0)
    if a != 1 and b == 0:
        print(ab)
    if b !=0 and L[0] == 0:
        T = ''.join(map(str,L[1:a]))
        ab = ab + int(T)
        print(ab)
    if b !=0 and L[0] != 0:
        T = ''.join(map(str,L))
        print(T)
if ans != 0:
    print('-1')

### FIXED CODE ###

import sys
 
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for f in range(m)]
if n == 1:
    start = 0
    end = 10
else:
    start = 10**(n-1)
    end = 10**n
for i in range(start, end):
  x = False
  for j in sc:
    if str(i)[j[0]-1] != str(j[1]):
      x = True
      break
  if x:
    continue
  print(i)
  sys.exit()
print(-1)
# -*- coding; utd-8 -*-
X = int(input())
import math
a = [math.pow(i,j) for j in range(2,10) for i in range(1,32) if math.pow(i,j)<X]
print(int(max(a)))

### FIXED CODE ###

# -*- coding; utd-8 -*-
X = int(input())
import math
a = [math.pow(i,j) for j in range(2,11) for i in range(1,32) if math.pow(i,j)<=X]
print(int(max(a)))
n, m = map(int, input().split())
sc = {}
for m2 in range(m):
    sc[m2]=input().split()
ok_list= []
ok_list= []
for al in range(10**(n-1), 10**(n)):
    ynli = []
    li = list(str(al))
    for mm in range(m):
        if li[int(sc[int(mm)][0])-1] != sc[int(mm)][1]:
            ynli.append("NO")
    if "NO" in ynli:
        pass
    else:
        ok_list.append(al)
print(min(ok_list))

### FIXED CODE ###

n, m = map(int, input().split())
sc = {}
for m2 in range(m):
    sc[m2]=input().split()
ok_list= []
for al in range(0, 10**(n)):
    ynli = []
    li = list(str(al))
    if len(li) == n:
        for mm in range(m):
            if li[int(sc[int(mm)][0])-1] != sc[int(mm)][1]:
                ynli.append("NO")
        if "NO" in ynli:
            pass
        else:
            ok_list.append(al)
    else:
        pass
if ok_list == []:
    print(-1)
else:
    print(min(ok_list))
x, t = = map(int, input().split())
print(x/t)

### FIXED CODE ###

x, t = map(int, input().split())
print(x/t)
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))

ans = 0
count = 0
for i in range(n):
    if a[i] < 0:
        a[i] = -a[i]
        count += 1
    ans += a[i]

if count % 2 == 0:
    print(ans)
else:
    print(ans - min(a) * 2)


### FIXED CODE ###

# -*- coding: utf-8 -*-
a, b, t = map(int, input().split())

print(b * (t // a))
A = raw_input()
B = raw_input()
C = raw_input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())



### FIXED CODE ###

A = input()
B = input()
C = input()

cnt = {'a': 0, 'b': 0, 'c': 0}
S = {'a': A, 'b': B, 'c': C}
turn = 'a'

while True:
	if cnt[turn] >= len(S[turn]):
		break	
	pop = S[turn][cnt[turn]]
	cnt[turn] += 1	
	turn = pop

print(turn.upper())
a,b,c = map(int.input())
print(a+b+c)

### FIXED CODE ###

n = input()
result = sum(list(map(int,str(n))))
print(result)
s1=input()
s2=input()
s3=input()
s_list=[s1, s2, s3]
next=0
while(len(s_list[0])>=1 and len(s_list[1])>=1 and len(s_list[2])>=1):
    temp=s_list[next][0]
    s_list[next]=s_list[next][1:]
    next=temp
if len(s_list[0])==0:
    print("A")
elif len(s_list[1])==0:
    print("B")
else:
    print("C")

### FIXED CODE ###

s1=input()
s2=input()
s3=input()
s_list=[s1, s2, s3]
next_item=0
while(1):
    if len(s_list[0])==0 and next_item==0:
        print("A")
        break
    elif len(s_list[1])==0 and next_item==1:
        print("B")
        break
    elif len(s_list[2])==0 and next_item==2:
        print("C")
        break
    temp=s_list[next_item][0]
    s_list[next_item]=s_list[next_item][1:]
    if(temp=='a'):
        next_item=0
    elif(temp=='b'):
        next_item=1
    else:
        next_item=2
h,a=map(int,input.split())
print(h//a)

### FIXED CODE ###

h,a=map(int,input().split())
print(h//a if h%a==0 else (h//a)+1)
x, y = map(int, input().split())

for a in range(x + 1):
    if (2 * a + 4 * (x - a) == y):
        print('Yes')
        exit(1)

print('No')

### FIXED CODE ###

x, y = map(int, input().split())

for a in range(x + 1):
    tem = 2 * a + 4 * (x - a)
    if (tem == y):
        #  and (2 * x <= y <= 4 * x):
        print('Yes')
        exit()

print('No')
n = int(input())
a = [int(x) for x in input().split()]

num = {}
for v in a:
  if v in num:
    num[v] = num[v] + 1
  else:
    num[v] = 1
m = int(input())
t = [int(x) for x in input().split()]

ok = True
for v in t:
  if v not in num:
    ok = False
  elif num[v] <= 0:
    ok = False
  else:
    num[v] = num[v] - 1

if ok:
  print("Yes")
else:
  ptint("No")


### FIXED CODE ###

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

num = {}
for v in a:
  if v in num:
    num[v] = num[v] + 1
  else:
    num[v] = 1
m = int(input())
t = [int(x) for x in input().split()]

ok = True
for v in t:
  if v not in num:
    ok = False
  elif num[v] <= 0:
    ok = False
  else:
    num[v] = num[v] - 1

if ok:
  print("YES")
else:
  print("NO")
s = input()
t = input()
counter = 0
idx = -1
if set(t) <= set(s):
  for i in range(len(t)):
    idx = s.find(t[i],idx+1)
    if idx == -1:
      counter += 1
      idx = s.find(t[i],idx+1)
  print(counter * len(s) +idx +1)
elsse:
  print(-1)

### FIXED CODE ###

s = input()
t = input()
counter = 0
idx = -1
if set(t) <= set(s):
  for i in range(len(t)):
    idx = s.find(t[i],idx+1)
    if idx == -1:
      counter += 1
      idx = s.find(t[i],idx+1)
  print(counter * len(s) +idx +1)
else:
  print(-1)
N = int(input())
g = {i:[] for i in range(N)}
AB = []
K = -float('inf')
for _ in range(N-1):
  a,b = map(int,input().split())
  AB.append([a-1,b-1])
  g[a-1].append(b-1)
  g[b-1].append(a-1)
  K = max(K,len(g[a-1]), len(g[b-1]))

print(K)
k = 1
print(k)
for i in range(1,N-1):
  a,b = AB[i]
  if AB[i][0] in g[a-1] + g[b-1] or AB[i][1] in g[a-1] + g[b-1]:
    k +=1
    k = 1 if k==5 else k
  print(k)

### FIXED CODE ###

from collections import deque
def bfs(si):
  q = deque()
  q.append([si,-1])
  used.add(si)
  while len(q)>0:
    prvi, prvcol = q.popleft()
    col = 1 
    for i in g[prvi]:
      if i in used:continue
      if col == prvcol: col += 1
      cols[eds[str(min(prvi,i))+'-'+str(max(prvi,i))]] = col
      q.append([i,col])
      used.add(i)
      col += 1

N = int(input())
g = {i:[] for i in range(N)}
eds = {}
for i in range(N-1):
  a,b = map(int,input().split())
  eds[str(a-1)+'-'+str(b-1)] = i
  g[a-1].append(b-1)
  g[b-1].append(a-1)

used = set([])
cols = [-1 for _ in range(N-1)]  
bfs(0)
print(max(cols))
[print(col) for col in cols]
import sys
input = sys.stdin.readline

import numpy as np

def main():
    #1:初期化
    N,W = map(int,input().split())
    wv = []
    for _ in range(N):
        wv.append(list(map(int,input().split())))
    dp = np.zeros((W+1,N+1), dtype=int)
    #dp = [[0]*(W+1) for i in range(N+1)]

    #print(wv)
    #print(dp)
    #2:初期値(元からゼロなので記述無し)

    #3:dp実行部(貰うDP)
    for i in range(1,N+1):
        for j in range(1,W+1):
            if wv[i-1][0] <= j:
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-wv[i-1][0]]+wv[i-1][1])
            else:
                dp[i][j] = dp[i-1][j]
            #print(i,j)
            #print(*dp,sep="\n")

    #4:出力
    print(dp[N][W])

if __name__ == '__main__':
    main()

### FIXED CODE ###

"""memo
    numpyでやるときは配列を一気に更新するが(numpy使いたくないのでやらない)，
    このやり方は後ろの方から更新することで後の更新に影響を与えない(考え方すごい)．
    (参考#9889377)
"""

import sys
input = sys.stdin.readline

def main():
    #1:初期化
    N,W = map(int,input().split())
    dp = [0]*(W+1)

    #2:初期値(元からゼロなので記述無し)

    #3:dp実行部(貰うDP)
    for i in range(N):
        w, v = map(int,input().split())
        for i in range(W, w-1, -1):
            tmp = dp[i-w] + v
            if dp[i] < tmp:
                dp[i] = tmp
        #print(dp,sep="\n")

    #4:出力
    print(max(dp))

if __name__ == '__main__':
    main()
w ,k = map(int, input().split())
x = w - (k*2)
if 0 <= x:
  print(x)
 else:
  print(0)

### FIXED CODE ###

w, k = map(int, input().split())
x = w - (k*2)
if 0 <= x:
    print(x)
else:
    print(0)