Harryxun/stf_run huggingface dataset:
x, y = map(int,input().split())

if (y-2*x)%2==0:
  k = (y-2*x)//2
  t = x-k

if 0 <= k and 0 <= t:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

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

if (y-2*x)%2!=0:
  print("No")
else:
  k = (y-2*x)//2
  t = x-k

  if 0 <= k and 0 <= t:
    print("Yes")
  else:
    print("No")
def resolve():
    n = int(input())
    words = []
    for _ in range(n):
        words.append(str(sorted(list(input()))))
    a = collections.Counter(words)
    ans = 0
    for i in a.values():
        ans += i*(i-1)//2
    print(ans)
resolve()

### FIXED CODE ###

import collections
def resolve():
    n = int(input())
    words = []
    for _ in range(n):
        words.append(str(sorted(list(input()))))
    a = collections.Counter(words)
    ans = 0
    for i in a.values():
        ans += i*(i-1)//2
    print(ans)
resolve()
a,b = map(int, input())
if a > b:
  print(a*2-1)
else:
  print(b*2-1)

### FIXED CODE ###


a, b = map(int, input().split())
 
if a > b:
    print(a+a-1)
elif a < b:
    print(b+b-1)
else:
    print(a+b)
l = [int(i) for i in input().split()]
if max(abs(l[0-l[1]], abs(l[1]-l[2]))) <= l[3]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

l = [int(i) for i in input().split()]
print("Yes" if ((abs(l[0] - l[1]) <= l[3]) & (abs(l[1] - l[2]) <= l[3])) or (abs(l[0] - l[2]) <= l[3]) else "No")
k,x = map(int,input().split())
a = 500*k
if a >= x:
    print('Yes')
else:
    print('No')


### FIXED CODE ###

c = input()
ans = chr(ord(c)+1)
print(ans)
a = [int(i) for i in input().split() if i > 0 else break]
for i in range(0,len(a)):
    print('Case ', i+1, ': ', a[i], sep='')

### FIXED CODE ###

a =[]
x = 1
while x > 0:
    x = int(input())
    a.append(x)
for i in range(0,len(a)-1):
    print('Case ',i+1,': ',a[i],sep='')
def solve(n, m, h, a, b):
    for j in range(m):
        a[j] -= 1
        b[j] -= 1
    parents = [i for i in range(n)]
    def root(x):
        return x if parents[x] == x else root(parents[x])

    for a_j, b_j in zip(a, b):
        ra, rb = root(a_j), root(b_j)
        if ra != rb:
            if ra > rb:
                a_j, b_j = b_j, a_j
            parents[rb] = ra

    D = {}
    for j, pj in enumerate(parents):
        if not pj in D:
            D[pj] = []
        D[pj].append(h[j])
    ans = 0
    for k, v in D.items():
        if len(v) == 1:
            ans += 1
        else:
            v = sorted(v)
            ans += int(v[-1] > v[-2])
    return ans

n, m = map(int, input().split())
h = list(map(int, input().split()))
a = [0] * m
b = [0] * m
for j in range(m):
    a[j], b[j] = map(int, input().split())
print(solve(n,m, h, a, b))

### FIXED CODE ###

def solve(n, m, h, a, b):
    for j in range(m):
        a[j] -= 1
        b[j] -= 1
    E = {i:[] for i in range(n)}
    for x, y in zip(a, b):
        E[x].append(y)
        E[y].append(x)
    ans = 0
    for i in range(n):
        ok = True
        for j in E[i]:
            if h[i] <= h[j]:
                ok = False
        ans += ok
    return ans
n, m = map(int, input().split())
h = list(map(int, input().split()))
a = [0] * m
b = [0] * m
for j in range(m):
    a[j], b[j] = map(int, input().split())
print(solve(n,m, h, a, b))
whatMan = []

N, K = input().split()
for i in range(int(K)):
    whatMan.extend(input().split())
print(int(N) - set(wahtMan).count)

### FIXED CODE ###

whatMan = []

N, K = input().split()
for i in range(int(K)):
    input()
    whatMan.extend(input().split())
print(int(N) - len(set(whatMan)))
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)]
def fibo(i, memo={}):
    if i == 0, 1:
        memo[i] = 1
        return memo[i]
    else:
        if i in memo:
            return memo[i]
        else:
            memo[i] = fibo(i-1, memo) + fibo(i-2, memo)
            return memo[i]
m = a[0] + 1
num = fibo(m - 2)
for i in range(M - 1):
    m = a[i + 1] - a[i]
    num = num * fibo(m - 2)
    if m == 1:
        num = 0
        break
num = num * fibo(N - a[M - 1] - 1)
print(num % 1000000007)


### FIXED CODE ###

N, M = map(int, input().split())
kaidan = [0] * (N + 1)
for i in range(M):
    tmp = int(input())
    kaidan[tmp] = -1
kaidan[0] = 1
for i in range(1,N + 1):
    if i == 1:
        if kaidan[i] != -1:
            kaidan[i] = 1
        else:
            kaidan[i] = 0
    else:
        if kaidan[i] != -1:
            kaidan[i] = kaidan[i -1] + kaidan[i - 2]
        else:
            kaidan[i] = 0
print(kaidan[N] % (10 ** 9 + 7))
n=int(input())
ans_list=[[0]*(n+1) for i in range(n+1)]
kotaezyun=[]
renketu=[[] for i in range(n+1)]
for i in range(n-1):
    a,b=map(int, input().split())
    renketu[a].append(b)
    kotaezyun.append([a,b])

from collections import deque
que=deque()

que.append(1)

iro=[-1]*(n+1)
iro[1]=0
irokazu=0

tansaku_moto=[1]

while que:
    tansaku_moto=que.popleft()
    ironuri=1
    for tansaku_saki in renketu[tansaku_moto]:
        if ironuri==iro[tansaku_moto]:
            ironuri+=1
        ans_list[tansaku_moto][tansaku_saki]=ironuri
        iro[tansaku_saki]=ironuri
        que.append(tansaku_saki)
        irokazu=max(irokazu,ironuri)
        ironuri+=1
        
print(irokazu)
for i in range(n-1):
    print(ans_list[kotaezyun[i][0]][kotaezyun[i][1]])

### FIXED CODE ###

n=int(input())
kotaezyun=[]
renketu=[[] for i in range(n+1)]
ans_dict={}
for i in range(n-1):
    a,b=map(int, input().split())
    renketu[a].append(b)
    kotaezyun.append([a,b])

from collections import deque
que=deque()

que.append(1)

iro=[-1]*(n+1)
iro[1]=0
irokazu=0

tansaku_moto=[1]

while que:
    tansaku_moto=que.popleft()
    ironuri=1
    for tansaku_saki in renketu[tansaku_moto]:
        if ironuri==iro[tansaku_moto]:
            ironuri+=1
        iro[tansaku_saki]=ironuri
        ans_dict[tansaku_moto,tansaku_saki]=ironuri
        que.append(tansaku_saki)
        irokazu=max(irokazu,ironuri)
        ironuri+=1
        
print(irokazu)
for i in range(n-1):
    tmp=(kotaezyun[i][0],kotaezyun[i][1])
    print(ans_dict[tmp])
c1 = input()
c2 = input()
res = "YES" if c1[0] == c2[0] and c1[2] == c2[2] "NO"
print(res)

### FIXED CODE ###

c1 = input()
c2 = input()
c1 = c1[2] + c1[1] + c1[0]
res = "YES" if c1 == c2 else "NO"
print(res)
s=input()
l=len(s)

dp = [[0 for i in range(13)] for j in range(l+1)]
dp[0][0] = 1
#dp[i][j]=i桁目までを13で割った時、
#そのあまりがjになる場合の数

for i in range(1,l+1):
	num = s[-i]
	print('num=',num)
	if num == '?':
		for j in range(10):
			tmp = int(j) * pow(10,i-1)
			tmp %= 13
			for k in range(13):
				index = (tmp + k) % 13
				dp[i][index] += dp[i-1][k]
	else:
		tmp = int(num) * pow(10,i-1)
		tmp %= 13
		for k in range(13):
			index = (tmp + k) % 13
			dp[i][index] += dp[i-1][k]
	print(dp)
print(dp[l][5] % (pow(10,9)+7))


### FIXED CODE ###

INF = 10 ** 9 + 7

S = input()
# dp[i][j]はうしろからi桁を13で割った余りがjであるものの個数
dp = [[0] * 13 for _ in range(len(S) + 1)]
dp[0][0] = 1
mul = 1

for i in range(len(S)):
    x = S[-(i + 1)]
    if x == "?":
        for k in range(10):
            for j in range(13):
                dp[i + 1][(mul * k + j) % 13] += dp[i][j]
                dp[i + 1][(mul * k + j) % 13] %= INF
    else:
        k = int(x)
        for j in range(13):
            dp[i + 1][(mul * k + j) % 13] += dp[i][j]
            dp[i + 1][(mul * k + j) % 13] %= INF
    mul = mul * 10 % 13  # 計算量削減のためここで13で割っている

print(dp[len(S)][5])
import sys

def test(k,s):
    cnt=0

    length = len(s)
    if k<length:
        return s[:k]+'...'
    return s

if __name__ == '__main__':
    print(test(sys.argv[0],sys.argv[1]))

### FIXED CODE ###



if __name__ == '__main__':
    k = int(input());
    s = input();

    cnt=0
    for i in s:
        print(i, end='')
        cnt+=1
        if cnt>=k:
            break

    if k < len(s):
        print('...')
K,A,B=map(int,input().split())


ans=1+K
count=0
count=(K-(A-1))//2
ANS=(K-2*count)+abs(A-B)*count

print(max(ANS,ans))

### FIXED CODE ###

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

ans='NO'

if N%2==0 and K<=(N/2):
    ans='YES'
if N%2==1 and K<=((N+1)/2) :
    ans='YES'

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

n=0
def power(figure):
    if figure%2==0:
        return True
    else:
        return False

while len(list(filter(power,l)))==N:
    n+=1
    k=map(lambda x: x/2,l)
    l=list(k)


print(n)

### FIXED CODE ###

k=input()
n=0
if int(k[0])==1:
    n+=1
if int(k[1])==1:
    n+=1
if int(k[2])==1:
    n+=1
print(n)
n = int(raw_input())
stuck = ["" for i in range(n)]
while True:
    a = raw_input().split()
    if a[0] == "quit":
        break
    if a[0] == "push":
        stuck[a[1]] += a[2]
    elif a[0] == "pop":
        l = len(stuck[a[1]]) - 1
        print stuck[a[1]][l]
        stuck[a[1]] = stuck[a[1]][:l]
    elif a[0] == "move":
        l = len(stuck[a[1]]) - 1
        stuck[a[2]] += stuck[a[1]][l]
        stuck[a[1]] = stuck[a[1]][:l]

### FIXED CODE ###

n = int(raw_input())
s = ["" for i in range(n)]

while True:
    a = raw_input().split()
    if a[0] == "quit":
        break

    i = int(a[1]) - 1
    if a[0] == "push":
        s[i] += a[2]

    elif a[0] == "pop":
        l = len(s[i]) - 1
        print s[i][l]
        s[i] = s[i][:l]

    elif a[0] == "move":
        j = int(a[2]) - 1 
        l = len(s[i]) - 1
        s[j] += s[i][l]
        s[i] = s[i][:l]
lst = [[1,2], [2, 5], [3, 5], [4, 4], [5, 5], [6, 6], [7, 3], [8, 7], [9, 6]]
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse = True)
# print (A)

def num(k):
    return lst[k-1][1]

# for i in A:
    # print (num(i), end = ', ')
# print ()

INF = 10 ** 9
dp_lst = [-INF] * (N + 1)
dp_lst[0] = 0
def dp(i):
    if dp_lst[i] != -INF:
        return dp_lst[i]
    tmp = -INF
    for j in A:
        if i >= num(j):
            tmp = max(tmp, dp(i - num(j)) + 1)
    dp_lst[i] = tmp
    return dp_lst[i]

a = dp(N)
# print (a)
# print (dp_lst)   
# print ([0] * 10 +[i+1 for i in range(20)])

# print (len(str(71111111111111111111111111111111111111111111111111)))

def check(A):
    if dp_lst[N-num(A)] == dp_lst[N] - 1:
        return True
    else:
        return False

# print (a)
while a > 0:
    for i in A:
        if check(i):
            print (i, end = '')
            N -= num(i)
            a -= 1
            break
        else:
            pass
            # print ('B')
print ()
# print (71111111111111111111111111111111111111111111111111)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 5)
lst = [[1,2], [2, 5], [3, 5], [4, 4], [5, 5], [6, 6], [7, 3], [8, 7], [9, 6]]
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse = True)
# print (A)

def num(k):
    return lst[k-1][1]

# for i in A:
    # print (num(i), end = ', ')
# print ()

INF = 10 ** 5
dp_lst = [-INF] * (N + 1)
dp_lst[0] = 0
def dp(i):
    if dp_lst[i] != -INF:
        return dp_lst[i]
    tmp = -INF
    for j in A:
        if i >= num(j):
            tmp = max(tmp, dp(i - num(j)) + 1)
    dp_lst[i] = tmp
    return dp_lst[i]

a = dp(N)
# print (a)
# print (dp_lst)   
# print ([0] * 10 +[i+1 for i in range(20)])

# print (len(str(71111111111111111111111111111111111111111111111111)))

def check(A):
    if N - num(A) < 0:
        return False
    if dp_lst[N-num(A)] == dp_lst[N] - 1:
        return True
    else:
        return False

# print (a)
while a > 0:
    for i in A:
        if check(i):
            print (i, end = '')
            N -= num(i)
            a -= 1
            break
        else:
            pass
            # print ('B')
print ()
# coding: utf-8
# Your code here!
import math
from collections import Counter

def P(n, r):
    return math.factorial(n)//math.factorial(n-r)

def C(n, r):
    return P(n, r)//math.factorial(r)

N = int(input())
arr = [input() for i in range(N)]
mar_arr = [j for j in arr if j[0] == "M" or j[0] == "A" or j[0] == "R" or j[0] == "C" or j[0] == "H"]
ini_arr = [arr[k][0] for k in range(N) if arr[k][0] == "M" or arr[k][0] == "A" or arr[k][0] == "R" or arr[k][0] == "C" or arr[k][0] == "H"]
dic = Counter(ini_arr)
num = sum(v for v in dic.values())
if num <= 2:
    print(0)
else:
    total = C(len(ini_arr), 3)
    for i in dic.values():
        if i == 2:
            total -= C(num - i, 1)
        elif i >= 3:
            total -= C(i, 2) * C(num - i, 1)  + C(i, 3)
    print(total)

### FIXED CODE ###

# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

n = int(input())
t = [0] * n
for i in range(n):
    t[i] =input()[0]
t2 = [t.count(i) for i in ["M","A","R","C","H"]]
ans = 0
for i in range(5):
    for j in range(5):
        if j == i:
            break
        for k in range(5):
            if k == j:
                break
            ans += t2[i] * t2[j] * t2[k]
print(ans)
xyz=input().split()
a=int(xyz[0])
b=int(xyz[1])
c=int(xyz[2])
s=[]
d=[]
flag=0
if a==1 and b==1 and c==1:
  flag=1
for i in range(1,max(a,b)):
  if a%i==0 and b%i==0:
    s.append(i)
if flag==1 or len(s)==0:
  print(1)
else:
  s.sort()
  s.reverse()
  print(s[c-1])
  

### FIXED CODE ###

a,b,k=map(int,input().split())
z=min(a,b)
n=0
while(z>=1):

    if(a%z==0 and b%z==0):
        n+=1;
        if n==k:
            break
    z-=1

print(z)
n, m = map(int,input().split())
A = list(map(int,input().split()))

lim = 1/(4*m)
A = A/sum(A)
ans = 0
for a in A:
  if a>=lim:
    ans += 1
    
if ans >= m:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

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

lim = 1/(4*m)

ans = 0
for a in A:
  a /= sum(A)
  if a>=lim:
    ans += 1
    
if ans >= m:
  print("Yes")
else:
  print("No")
S = int(input())

if S =< 10**9:
  print(0,0,S,0,0,1)
elif S == 10*18:
  print(0,0,10**9,0,0,10**9)
  end
else:
  q,r = divmod(S,10**9)
  if r = 0:
    print(0,0,0,10**9,q,0)
  else:
  	print(0,0,1,10**9,q+1,10**9-r)

### FIXED CODE ###

S = int(input())
 
if S <= 10**9:
  print(0,0,S,0,0,1)
elif S == 10*18:
  print(0,0,10**9,0,0,10**9)
  end
else:
  q,r = divmod(S,10**9)
  if r == 0:
    print(0,0,0,10**9,q,0)
  else:
    print(0,0,1,10**9,q+1,10**9-r)
n=int(input())
n=input().split()
for i in range(n):
   n[1]=n[i]
   s=sum(n)
   m=min(n)
   ma=max(n)
   print(m ma s)


### FIXED CODE ###

n=int(input())
r=input().split()
for i in range(len(r)):
    r[i]=int(r[i])
s=sum(r)
m=min(r)
ma=max(r)
print(m,ma,s)
import collections
import sys

def solve(n, A, B):
  Ac = {}
  ABc = {}
  for a in A:
    Ac[a] = 1 + Ac.get(a, 0)
    ABc[a] = 1 + ABc.get(a, 0)
  Bc = {}
  for b in B:
    Bc[b]  = 1 + Bc.get(b, 0)
    ABc[b] = 1 + ABc.get(b, 0)
  cAB = sorted([(c, ab) for ab, c in ABc.items()])
  #print(cAB)
  pool = collections.deque()  #[bbbb]   # [(b, count)], FIFO to match at the end

  matched = {}  # {a: bbbb}    # {a: {b, count}
  current = n   # how many are not matched yet
  for c, ab in cAB[::-1]:
    if c > current + len(pool):
      print('No')
      return
    matched[ab] = []
    while c > current:
      # take c - current from pool, add to matched
      c -= 1
      matched[ab].append(pool.popleft())
    # add (ab, Bc[ab]) to pool
    current -= Bc[ab]
    for _ in range(Bc[ab]):
      pool.append(ab)
  #print(pool, matched)
  skipped = []
  for c, ab in cAB[::-1]:
    # take c - matched[ab] from pool, add to matched
    nn = Ac[ab]-len(matched[ab])
    while skipped and  Ac[ab]-len(matched[ab]) > 0:
      matched[ab].append(skipped.pop())
    while Ac[ab]-len(matched[ab]) > 0:
      p = pool.pop()
      if p == ab:
        skipped.append(p)
      else:
        matched[ab].append(p)
      #print(pool, matched)

  ans = []
  for a, bb in sorted(matched.items()):
    ans += [str(b) for b in bb]
  print('Yes')
  print(' '.join(ans))


def main():
  input = sys.stdin.readline
  n = int(input())
  A = list(map(int, input().split()))
  B = list(map(int, input().split()))
  solve(n, A, B)

main()


### FIXED CODE ###

import collections
import sys

def solve(n, A, B):
  Ac = {}
  ABc = {}
  Bc = {}
  for a in A:
    Ac[a] = 1 + Ac.get(a, 0)
    ABc[a] = 1 + ABc.get(a, 0)
    Bc[a] = Bc.get(a, 0)
  for b in B:
    Ac[b] = Ac.get(b, 0)
    Bc[b]  = 1 + Bc.get(b, 0)
    ABc[b] = 1 + ABc.get(b, 0)
  cAB = sorted([(c, ab) for ab, c in ABc.items()])
  #print(cAB)
  pool = collections.deque()  #[bbbb]   # [(b, count)], FIFO to match at the end

  matched = {}  # {a: bbbb}    # {a: {b, count}
  current = n   # how many are not matched yet
  for c, ab in cAB[::-1]:
    if c > current + len(pool):
      print('No')
      return
    matched[ab] = []
    while c > current:
      # take c - current from pool, add to matched
      c -= 1
      matched[ab].append(pool.popleft())
    # add (ab, Bc[ab]) to pool
    current -= Bc[ab]
    for _ in range(Bc[ab]):
      pool.append(ab)
  #print(pool, matched)
  skipped = []
  for c, ab in cAB:
    # take c - matched[ab] from pool, add to matched
    nn = Ac[ab]-len(matched[ab])
    while skipped and  Ac[ab]-len(matched[ab]) > 0:
      matched[ab].append(skipped.pop())
    while Ac[ab]-len(matched[ab]) > 0:
      p = pool.popleft()
      if p == ab:
        skipped.append(p)
      else:
        matched[ab].append(p)
      #print(ab, pool, matched, skipped)

  ans = []
  for a, bb in sorted(matched.items()):
    ans += [str(b) for b in bb]
  print('Yes')
  print(' '.join(ans))


def main():
  input = sys.stdin.readline
  n = int(input())
  A = list(map(int, input().split()))
  B = list(map(int, input().split()))
  solve(n, A, B)

main()
import sys

N, K= map(int, input().split())
S = input()

ones_list = S.split('0')
zeros_list = S.split('1')

ones = []
if S[0] == '0':
    ones.append(0)
for k in range(len(ones_list)):
    if ones_list[k] != '':
        ones.append(len(ones_list[k]))
if S[-1] == '0':
    ones.append(0)

zeros = []
for k in range(len(zeros_list)):
    if zeros_list[k] != '':
        zeros.append(len(zeros_list[k]))

if K >= len(zeros):
    print(len(S))
    sys.exit

result = []
maximum = 0
for k in range(K):
    maximum += ones[k]
    maximum += zeros[k]
maximum += ones[K]
result.append(maximum)


for j in range(len(ones) - K - 1):
    maximum += zeros[K+j] + ones[K+1+j] - ones[j] - zeros[j]
    result.append(maximum)
print(max(result))

### FIXED CODE ###

import sys

N, K= map(int, input().split())
S = input()

ones_list = S.split('0')
zeros_list = S.split('1')

ones = []
if S[0] == '0':
    ones.append(0)
for k in range(len(ones_list)):
    if ones_list[k] != '':
        ones.append(len(ones_list[k]))
if S[-1] == '0':
    ones.append(0)

zeros = []
for k in range(len(zeros_list)):
    if zeros_list[k] != '':
        zeros.append(len(zeros_list[k]))

if K >= len(zeros):
    print(len(S))
    sys.exit()

result = []
maximum = 0
for k in range(K):
    maximum += ones[k]
    maximum += zeros[k]
maximum += ones[K]
result.append(maximum)


for j in range(len(ones) - K - 1):
    maximum += zeros[K+j] + ones[K+1+j] - ones[j] - zeros[j]
    result.append(maximum)
print(max(result))
n=int(input())
ans=0
d={}
if n==1:
    print(1)
for a in range(1,n+1):
    for b in range(1,n+1):
        p=math.gcd(a,b)
        if d.get(p)!=None:
            d[p]+=1
        else:
            d[p]=1
for c in range(1,n+1):
    for e in range(1,n+1):
        p=math.gcd(c,e)
        ans+=d[e]*p
print(ans)        

### FIXED CODE ###

import math
n=int(input())
ans=0
d={}
for a in range(1,n+1):
    for b in range(1,n+1):
        p=math.gcd(a,b)
        if d.get(p)!=None:
            d[p]+=1
        else:
            d[p]=1
for c in range(1,n+1):
    for e in range(1,n+1):
        p=math.gcd(c,e)
        ans+=d[e]*p
print(ans)
a,b=map(int,input());print('IMPOSSIBLE' if (b-a)%2!=0 else int((a+b)/2))

### FIXED CODE ###

a,b=map(int,input().split());print('IMPOSSIBLE' if (b-a)%2!=0 else int((a+b)/2))
n,d=[int(i) for i in input().strip().split(" ")]
ans=0
for _ in range(n):
  x,y=[int(i) for i in input().strip().split(" ")]
  if x*x+y*y==d*d:
    ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
if n>=30:
  print("Yes")
else:
  print("No")
a, b, h = [int(input()) for _ i in range(3)]
print(int((a+b)*h/2))

### FIXED CODE ###

a, b, h = [int(input()) for _ in range(3)]
print((a+b)*h//2)
N, M = map(int, input().split())

first = N*M
ans = 0

def reverse(x):
    if x == 0:
        return(1)
    else:
        return(0)


field = [[0]*(M+2) for i in range(N+2)]

for i in range(1, N+1):
    for j in range(1, M+1):
        field[i-1][j-1] = reverse(field[i-1][j-1])
        field[i][j-1] = reverse(field[i][j-1])
        field[i+1][j-1] = reverse(field[i+1][j-1])
        field[i-1][j] = reverse(field[i-1][j])
        field[i][j] = reverse(field[i][j])
        field[i+1][j] = reverse(field[i+1][j])
        field[i-1][j+1] = reverse(field[i-1][j+1])
        field[i][j+1] = reverse(field[i][j+1])
        field[i+1][j+1] = reverse(field[i+1][j+1])
ans = 0

for i in range(1, N+1):
    ans += sum(field[i][1:M+1])

print(ans)


### FIXED CODE ###

N, M = map(int, input().split())
ans = 0
if N >= 3:
    if M >= 3:
        ans = (N-2)*(M-2)
    else:
      if M == 2:
        ans=0
      else:
        ans=N-2
else:
    if N == 2:
      ans=0
    else:
      if M == 2:
        ans=0
      elif M == 1:
        ans=1
      else:
        ans=M-2
print(ans)
Bob, Alice = list(map(int,input().split()))
ans = ["Bob", "Alice", "Draw"]

if Bob == Alice:
  print(ans[2])
elif Bob = 1 or Bob > Alice:
  print(ans[0])
else:
  print(ans[1])

### FIXED CODE ###

Alice, Bob = list(map(int,input().split()))
ans = ["Bob", "Alice", "Draw"]

if Bob == Alice:
  print(ans[2])
elif Alice == 1:
  print(ans[1])
elif Bob == 1:
  print(ans[0])
elif Bob > Alice:
  print(ans[0])
else:
  print(ans[1])
N, R = [int(x) for x in input()]

if N > 9:
  print(R)
else:
  print(R - 100 * (10 - K))

### FIXED CODE ###

N, R = [int(x) for x in input().split(' ')]

if N > 9:
  print(R)
else:
  print(R + 100 * (10 - N))
n=int(input())
a=list(map(int,input().split()))
arr= [0] * 10**5
for val in a:
  arr[val]+=1
sums=sum(a)
q=int(input())
for _ in range(q):
  b,c=map(int,input().split())
  diff=(c-b)*(arr[b])
  sums+=diff
  print(sums) 
  arr[c]+=arr[b]
  arr[b]=0

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
arr = [0] * 100005
for val in a:
  arr[val] += 1
sums = sum(a)
q = int(input())
for _ in range(q):
  b, c = map(int,input().split())
  diff = (c-b) * (arr[b])
  sums += diff
  print(sums) 
  arr[c] += arr[b]
  arr[b] = 0
S=str(input())
s=len(S)
Sk=[]
Sg=[]
for i in range(0,s,2):
    Sk.append(Sstr[i])
for i in range(1,s,2):
    Sg.append(Sstr[i])
Sk0=Sk.count('0')
Sk1=Sk.count('1')
Sg0=Sg.count('0')
Sg1=Sg.count('1')
Stotal=[Sk0,Sk1,Sg0,Sg1]
if Sk0+Sg1<Sk1+Sg0:
    print(Sk0+Sg1)
else:
    print(Sk1+Sg0)

### FIXED CODE ###

S=str(input())
s=len(S)
Sk=[]
Sg=[]
for i in range(0,s,2):
    Sk.append(S[i])
for i in range(1,s,2):
    Sg.append(S[i])
Sk0=Sk.count('0')
Sk1=Sk.count('1')
Sg0=Sg.count('0')
Sg1=Sg.count('1')
Stotal=[Sk0,Sk1,Sg0,Sg1]
if Sk0+Sg1<Sk1+Sg0:
    print(Sk0+Sg1)
else:
    print(Sk1+Sg0)
n=int(input())
print((1000-n%1000)%1000))

### FIXED CODE ###

n=int(input())
print((1000-n%1000)%1000)