Harryxun/stf_run huggingface dataset:
a,b,k=map(int, input().split())
ans=[]
for i in range(1,max(a,b)):
    if a%i==0 and b%i==0:
        ans.append(i)
print(ans[-k])

### FIXED CODE ###

a,b,k=map(int, input().split())
ans=[]
for i in range(max(a,b)):
    if a%(i+1)==0 and b%(i+1)==0:
        ans.append(i+1)
print(ans[-k])
n,a,b,c = list(map(int,input().split()))
an=0;d={};l=[];x=y=z=0
for i in range(n):
  s=input();l.append(s)
  x+=int(s[0]=='A')
  z+=int(s[-1]=='C')
  y+=int(s[-1]=='B')+int(s[0]=='B')
x=a-x;y=b-y;z=c-z
if (x<0)+(y<0)+(z<0)>=2:
  print("No");exit()
a=[]
for i in range(n):
  if l[i]=='AC':
    if x>=0:
      z+=1;a.append('C')
    else:
      x+=1;a.append('A')
  if l[i]=='AB':
    if x>=0:
      y+=1;a.append('B')
    else:
      x+=1;a.append('A')
  if l[i]=='BC':
    if y>=0:
      z+=1;a.append('C')
    else:
      y+=1;a.append('B')
print("Yes")
for i in a:
  print(i)

### FIXED CODE ###

p=list(input())
p[1]='R' if p[1]=='B' else 'B'
print(''.join(p))
x=int(input())
y, z=map(int, input().split())
if y*z > 10**18:
  print(-1)
else:
  print(y*z)

### FIXED CODE ###

x=int(input())
y=list(map(int, input().split()))
z=1
if 0 in y:
  print(0)
  exit()

for i in range(x):
  z = z*y[i]
  if z > 10**18:
    z=-1
    break
print(z)
N = int(input())
A = [int(input()) for _ in range(N)].sorted()

B = []
for i in range(N):
    if i==0 or i==N-1:
        B.append((-1)**i)
    else:
        B.append(((-1)**i)*2)
B.sort()

print(max(abs(sum([A[i]*B[i] for i in range(N)])),abs(sum([A[i]*B[N-1-i] for i in range(N)]))))

### FIXED CODE ###

N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))

A.sort()

B = []
for i in range(N):
    if i==0 or i==N-1:
        B.append((-1)**i)
    else:
        B.append(((-1)**i)*2)
B.sort()

print(max(abs(sum([A[i]*B[i] for i in range(N)])),abs(sum([A[i]*B[N-1-i] for i in range(N)]))))
s = list(input())
print(''.join(li[0:2]))

### FIXED CODE ###

s = input()
print(s[0:3])
import math

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

a = sorted(A)
B = [a[0]]
C = []
for i in range(1,N):
    x = a[i]%a[0]
    if x != 0:
        B.append(x)
b =sorted(B)
for i in range(len(b)-1):
    y = math.gcd(b[i],b[-1])
    C.append(y)
    
if len(b) == 1:
    print(b[0])
else:
    print(min(C))

### FIXED CODE ###

from fractions import gcd

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

a = sorted(A)
B = [a[0]]
C = []
for i in range(1,N):
    x = a[i]%a[0]
    if x != 0:
        B.append(x)
b =sorted(B)
for i in range(len(b)-1):
    y = gcd(b[i],b[-1])
    C.append(y)
    
if len(b) == 1:
    print(b[0])
else:
    print(min(C))
n =int(input())
s = [input() for i in range(n)]
z = list(set(s))
ans = []
x = 0
for i in z:
    sc = s.count(i)
    if sc > x:
        ans = [i]
        x = sc
    elif sc == x:
        ans.append(i)
for i in sorted(ans):
    print(i)


### FIXED CODE ###

s = list(map(int,input().split()))
n = list(set(s))
if len(n) == 2:
    print('Yes')
else:
    print('No')
a,b= map(int(input()).split())
if (a*b)%2==0:
  print("Even")
else :
  print("Odd")


### FIXED CODE ###

a,b= map(int, (input()).split())
if (a*b)%2==0:
  print("Even")
else :
  print("Odd")
def resolve():
    s = int(input())
    ans = [s]
    count = 0
    while True:
        if ans[count]%2 == 0:
            ans.append(ans[count]/2)
        else:
            ans.append(ans[count]*3+1)
        count += 1
        for i in range(count):
            if ans[i] == ans[count]:
                print(k+1)
                exit()
resolve()

### FIXED CODE ###

def resolve():
    s = int(input())
    ans = [s]
    count = 0
    while True:
        if ans[count]%2 == 0:
            ans.append(ans[count]/2)
        else:
            ans.append(ans[count]*3+1)
        count += 1
        for i in range(count):
            if ans[i] == ans[count]:
                print(count+1)
                exit()
resolve()
S = int(input())
print (S//3600:S//60:S%60)


### FIXED CODE ###

S = int(input())
print (S//3600, (S%3600)//60, S%60, sep = ":")
import sys
sys.setrecursionlimit(10**7)

debug = True
#debug = False

def dprint(*objects):
    if debug == True:
        print(*objects)

class Event:
    def __repr__(self):
            return str(self.__dict__)

class User:
    def __repr__(self):
            return str(self.__dict__)

def solve():
    n, q = map(int, input().split())
    l_event = []
    for i in range(n):
        s, t, x = map(int, input().split())

        # 追加イベント
        e = Event()
        e.time = s-x
        e.type = 1 # add
        e.pos = x
        l_event.append(e)

        # 削除イベント
        e = Event()
        e.time = t-x
        e.type = -1 # delete
        e.pos = x
        l_event.append(e)

    l_user = []
    for i in range(q):
        d = int(input())

        # ユーザ評価イベント
        u = User()
        u.time = d + 0.5 # ユーザが出発する時刻までのイベントを先に処理したいので、0.5ずらす
        u.idx = i
        l_user.append(u)

    # リストを時刻でソート O(NlogN)
    l_event = sorted(l_event, key=lambda e: e.time)

    # ユーザも時刻でソート O(QlogQ)
    l_user = sorted(l_user, key=lambda e: e.time)


    ans = []
    s_stop = set()
    current_user_idx = 0

    # リストを順に処理する 全体 O(N + Qlog(2N))
    for e in l_event: # 中身が O(1) なら O(N)

        # 次処理するイベントの時刻より前のユーザをすべて処理する
        while(True): # この while 文は最大Q回しか回らないので、全体 O(Qlog(2N))
            u = l_user[current_user_idx]
            if u.time < e.time:
                if len(s_stop) != 0:
                    ans.append(min(s_stop))
                else:
                    ans.append(-1)

                current_user_idx += 1 # 次のユーザへ
                if current_user_idx >= q:  # 人の処理が終わっている場合、終わり
                    break
            else:
                # 次のイベントを処理
                break

        if e.type == 1: # add
            s_stop.add(e.pos)
        else: # delete
            s_stop.remove(e.pos)

    ans += [-1] * (q - current_user_idx)

    import numpy as np
    arg = [u.idx for u in l_user]
    ans = np.array(ans)[arg]
    for i in range(q):
        print(ans[i])

solve()

### FIXED CODE ###

import sys;input=sys.stdin.readline

n,q=map(int, input().split())
event=[]
for _ in range(n):
    s,t,x=map(int,input().split())
    event.append((s-x-0.5,1,x))
    event.append((t-x-0.5,-1,x))
for i in range(q):
    event.append((int(input()),0,i))

event.sort()
is_stop=False
stop=set()
minstop=float('inf')
ans=[-1]*q
for t,e,x in event:
    if e > 0:
        stop.add(x)
        if x<minstop:
            minstop=x
            is_stop=True
    elif e<0:
        stop.remove(x)
        if minstop==x:
            is_stop=False
    elif len(stop)>0:
        if not is_stop:
             minstop=min(stop)
             is_stop=True
        ans[x]=minstop

print('\n'.join(map(str, ans)))
a,b,x = map(int, input().split())
c = int((a-1)/x)
d = int(b/x)
if a!=0:
  print(d-c)
elif a==0:
  print(d)



### FIXED CODE ###

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

ans = int(b // x) - int((a - 1) // x)

print(ans)
a,b,m = map(int,input().split())

ref = list(map(int,input().split()))
mic = list(map(int,input().split()))

ans = min(ref)+min(mic)


for i in range(m):
    x,y,c = map(int,input().split())
    x-=1
    y-=1

    if ref[x]+ref[y]-c < ans:
        ans = ref[x]+ref[y]-c

print(ans)

### FIXED CODE ###

a,b,m = map(int,input().split())

ref = list(map(int,input().split()))
mic = list(map(int,input().split()))

ans = min(ref)+min(mic)


for i in range(m):
    x,y,c = map(int,input().split())
    x-=1
    y-=1

    if ref[x]+mic[y]-c < ans:
        ans = ref[x]+mic[y]-c

print(ans)
from collections import Counter


def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    b = [int(i) for i in input().split()]
    ca = Counter(a)
    cb = Counter(b)
    for k in cb.keys():
        if cb[k] > n - ca[k]:
            raise Exception
    print("No")


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import Counter
import numpy as np


def main():
    n = int(input())
    a = np.array([int(i) for i in input().split()])
    b = np.array([int(i) for i in input().split()])
    ca = Counter(a)
    cb = Counter(b)
    for k in cb.keys():
        if cb[k] > n - ca[k]:
            print("No")
            return
    while any(a == b):
        s = max(ca[k] for k in cb.keys())
        b = np.roll(b, s)
    print("Yes")
    print(*b)


if __name__ == '__main__':
    main()
print "Yes" if len(set(input().split())) == 2 else "No"

### FIXED CODE ###

print("Yes" if len(set(input().split())) == 2 else "No")
A, B, C, K = map(int, input().split())
if (K=<A):
  print(K)
elif (K=<A+B):
  print(A)
else:
  print(2*A+B-K)

### FIXED CODE ###

A, B, C, K = map(int, input().split())
if K <= A:
  print(K)
elif K <= A+B:
  print(A)
else:
  print(2*A+B-K)
P, Q, R =map(int ,input().split(','))
print(min(P+Q, Q+R, R+P))

### FIXED CODE ###

P, Q, R =map(int ,input().split())
print(min(P+Q, Q+R, R+P))
N = int(input())
H = list(map(int, input().split()))
H[1] -= 1
for i in range(1, N-1):
    if H[i-1] > H[i] or H[i] > H[i+1]:
        H[i] -= 1
        if H[i-1] > H[i] or H[i] > H[i+1]:
            print("No")
            break
        else:
            continue
else:
    print("Yes")

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
for i in range(N-1):
    if H[i] - H[i+1] > 1:
        print("No")
        quit()

for i in range(1, N-1):
    if H[i] > H[i+1] or H[i-1] < H[i]:
        H[i] -= 1
        if H[i-1] > H[i] or H[i] > H[i+1]:
            print("No")
            break
    else:
        continue
else:
    print("Yes")
N, D = map(int, input().split())
X = list(map(int, input().split()))
count = 0
for i in range(N):
    for j in range(i + 1, N):
        r = 0
        for k in range(D):
            r += (X[i][k] - X[j][k]) ** 2
        if r ** 0.5 % 1 == 0:
            count += 1
print(count)

### FIXED CODE ###

N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
count = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        r = 0
        for k in range(D):
            r += (X[i][k] - X[j][k]) ** 2
        if r ** 0.5 % 1 == 0:
            count += 1
print(count)
import math

a, b = map(int, input().split())
x    = math.gcd(a, b)
y    = int(math.sqrt(x))
ps   = [1, 2, 3, 5, 7, 11, 13]
p    = ps[-1]

def check(p):
	q = int(math.sqrt(p))
	
	for i in range(2, len(ps)):
		if p % ps[i] == 0:
			return False
		if q < ps[i]:
			break
	
	return True

while p <= y:
	p += 2
	while check(p) == False:
		p += 2
	ps.append(p)

print(sum(1 for p in ps if x % p == 0))


### FIXED CODE ###

import math
 
def gcd(x, y):
	while y != 0:
		z = x % y
		x = y
		y = z
	return x
 
a, b = map(int, input().split())
x    = gcd(a, b)
y    = int(math.sqrt(x))
c    = 1

for i in range(2, y + 1):
	if y < i:
		break;
	if x % i == 0:
		c += 1
		while x % i == 0:
			x //= i
			
if 1 < x:
	c += 1

print(c)
import math
import sys
sys.setrecursionlimit(100000)

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

br = [list(map(int, input().split())) for _ in range(m)]

ans = []

def nc2(n):
    if n<2:
        return 0
    return n * (n-1) // 2

subg = {i+1:i+1 for i in range(n)}

nodes = {i+1:1 for i in range(n)}

res = []
r = nc2(n)

def fetch(i):
    if i == subg[i]:
        return i
    j = fetch(subg[i])
    subg[i] = min(j, subg[i])
    return j

for a, b in reversed(br):
    # print(subg, nodes)

    if len(nodes.keys()) == 1:
        res.append(0)
        continue
    else:
        res.append(r)

    mi, ma = min(a,b), max(a,b)
    v, w = max(fetch(mi), fetch(ma)), min(fetch(mi), fetch(ma))
    
    x = nodes[v] 
    y = nodes[w]

    r += nc2(x) + nc2(y)
    r -= nc2(x+y)

    nodes[w] += nodes[v]
    del nodes[v]
    subg[mi] = w
    subg[ma] = w

for i in reversed(res):
    print(i)



### FIXED CODE ###


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

br = [list(map(int, input().split())) for _ in range(m)]

ans = []

def nc2(n):
    if n<2:
        return 0
    return n * (n-1) // 2


class UnionFind:

    def __init__(self, size):
        self.table = [-1 for _ in range(size+1)]
        self.size = [1 for _ in range(size+1)]

    def find(self, x):
        while self.table[x] >= 0:
            x = self.table[x]
        return x

    def union(self, x, y):
        s1 = self.find(x)
        s2 = self.find(y)
        if s1 != s2:
            if self.table[s1] != self.table[s2]:
                if self.table[s1] < self.table[s2]:
                    self.table[s2] = s1
                    self.size[s1] += self.size[s2]
                    self.size[s2] = 0
                else:
                    self.table[s1] = s2
                    self.size[s2] += self.size[s1]
                    self.size[s1] = 0
            else:
                self.table[s1] += -1
                self.table[s2] = s1
                self.size[s1] += self.size[s2]
                self.size[s2] = 0

    def get_size(self, x):
        s1 = self.find(x)
        return self.size[s1]

    def check_same(self, x, y):
        return self.find(x) == self.find(y)

res = []
r = nc2(n)

uf = UnionFind(n)

for a, b in reversed(br):

    res.append(r)

    if not uf.check_same(a,b):
        r -= uf.get_size(a)*uf.get_size(b)

    uf.union(a,b)

for i in reversed(res):
    print(i)
s = input()
k = int(input())
ans = "1"
for i in range(k+1):
    ss = s[i]
    if ss != "1":
        ans = ss
        break
print(ans)

### FIXED CODE ###

s = input()
n = len(s)
k = int(input())
ans = "1"
for i in range(min(n, k)):
    ss = s[i]
    if ss != "1":
        ans = ss
        break
print(ans)
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = readline().decode().rstrip()

res = 0
b_cnt = 0

for c in S:
    if c == 'B':
        b_cnt += 1
    elif c == 'W':
        res += b_cnt

print(res)


### FIXED CODE ###

#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

S = readline().decode().rstrip()

res = 0
b_cnt = 0

for c in S:
    if c == 'B':
        b_cnt += 1
    elif c == 'W':
        res += b_cnt

print(res)
w,h,n=map(int,input().split())

min_x=0
min_y=0

for i in range(n):
    x,y,a=map(int,input().split())

    if a==1:
       min_x=max(min_x,x)

    elif a==2:
        w=min(w,x)

    elif a==3:
        min_y=max(min_y,y)

    else:
        h=min(h,y)

white=(w-min_x)*(h-min_y)
print(white)


### FIXED CODE ###

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

answer=sorted(nums,reverse=True)

if sum(answer)%2==0 and answer[0]==answer[1]+answer[2]:
	print("Yes")

else:
	print("No")
from collections import Counter
from scipy.special import comb

N = int(input())
A = list(map(int, input().split()))
l = Counter()
for i in range(N):
    l.update(str(A[i]))

gsum = 0
combD = {}
for key in l.keys():
    tmp = comb(l[key], 2, exact=True)
    gsum += tmp
    combD[str(key)] = int(tmp - (tmp*(1-2/l[key])))

for i in range(N):
    print(gsum - combD[str(A[i])])


### FIXED CODE ###

from collections import Counter


from operator import mul
from functools import reduce


def cmbf(n, r):
    if (n < r):
        return 0
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N = int(input())
A = list(map(int, input().split()))
c = [0]*(N+1)

for A_i in A:
    c[A_i] += 1

gsum = 0
for i in range(1, N + 1):
    if (c[i] != 0):
        gsum += cmbf(c[i], 2)

for i in A:
    print(gsum-(c[i]-1))
n,x,y=map(int, input().split())

ans=[0]*n

def func2(np, nd, state):
    #print(np, nd, state)
    nxp=[]
    for p in np:
        if p > 0 and not state[p-1]:
            nxp.append(p-1)
            ans[nd]+=1
        if p < n-1 and not state[p+1]:
            nxp.append(p+1)
            ans[nd]+=1
        if p == x-1 and not state[y-1]:
            nxp.append(y-1)
            ans[nd]+=1
        if p == y-1 and not state[x-1]:
            nxp.append(x-1)
            ans[nd]+=1
#    if nd == 1:
#        print(nd, nxp)

    nxp=list(set(nxp))
    for i in nxp:
        state[i]=True
    if len(nxp) == 0:
        return
    else:
        func2(nxp, nd+1, state)

for i in range(n):
    st=[False]*n
    st[i]=True
    func2([i], 0, st)

for i in ans:
    print(i//2)


### FIXED CODE ###

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

ans=[0]*(n-1)

for i in range(1, n+1):
    for j in range(i+1, n+1):
        d=min(j-i, abs(x-i)+1+abs(j-y), abs(y-i)+1+abs(j-x))
        #print(i,j,d)
        ans[d-1]+=1

for a in ans:
    print(a)
if __name__ == '__main__':
  a, b = map(int, input().split())
  if a >= b:
    print(a)
  elif a < b:
	print(a-1)

### FIXED CODE ###

if __name__ == '__main__':
    a, b = map(int, input().split())
    if a > b:
        print(a-1)
    elif a <= b:
        print(a)
n = int(input())

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

l = [0]*9

for i in a:
    
    l[i//400] +=1

b = [i for i in l[:8] if i > 0]

mx = len(b)+l[8]
mn = len(b)
print(mn,mx)

### FIXED CODE ###

n = int(input())

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

l = [0]*9


for i in a:
    if i >= 3200:
        l[8] +=1
    else:    
        l[i//400] +=1

b = [i for i in l[:8] if i > 0]
mx = 0
mn = 0

if len(b) >= 1:
    mx = len(b)+l[8]
    mn = len(b)
else:
    mx = len(b)+l[8]
    mn = 1
    
print(mn,mx)
Age = int(input())
if Age ==1:
  	print("Hello World")
else:
	AB = [int(input()) for i in range(2)]
    print(AB[0]+AB[1])

### FIXED CODE ###

Age = int(input())
if Age ==1:
    print("Hello World")
else:
    AB = [int(input()) for i in range(2)]
    print(AB[0]+AB[1])
def min_diag(A,B,C):
  segments=[A,B,C]
  segments.sort()
  return (segments[0]**2+segments[1]**2)**(1/2)

while True:
  # input one dataset
  A,B,C = tuple(map(int,input().split()))
  if (A,B,C) == (0,0,0):
    break
  n = int(input())
  R = [None]*n
  for i in range(n):
    R[i] = int(input())

  # process
  min_diag = min_diag(A,B,C)

  # judge & output
  for r in R:
    if min_diag < 2*r:
      print("OK")
    else:
      print("NA")

### FIXED CODE ###

def min_diam(A,B,C): # returns a "diameter"
  segments=[A,B,C]
  segments.sort()
  return (segments[0]**2+segments[1]**2)**(1/2)

while True:
  # input one dataset
  A,B,C = tuple(map(float,input().split()))
  if (A,B,C) == (0,0,0):
    break
  n = int(input())
  R = [None]*n
  for i in range(n):
    R[i] = float(input())
  # process
  diam = min_diam(A,B,C)
  # judge & output
  for r in R:
    if diam < 2*r:
      print("OK")
    else:
      print("NA")
N = int(input())
if(N[:-1] == 0||1||6||8):
  print('pon')
else if(N[:-1] == 3):
  print('bon')
else:
  print('hon')

### FIXED CODE ###

N = int(input())
S = N % 10
if(S == 0):
  print("pon")
elif(S == 1):
  print("pon")
elif(S == 6):
  print("pon")
elif(S == 8):
  print("pon")
elif(S == 3):
  print("bon")
else:
  print("hon")
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())

if k >= max(a - e):
    print('Yay!')
else:
    print(':(')



### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if e - a <= k:
    print('Yay!')
else:
    print(':(')
s = input()
if s == 'ABC'
	print('ARC')
else:
	print('ABC')

### FIXED CODE ###

s = input()
if s == 'ABC':
    print('ARC')
else:
    print('ABC')
n=int(input())
n1=len(str(n))

x=0
if n1=1:
  x=n
elif n1=2:
  x=9
elif n1=3:
  x=9+(n-99)
elif n1=4:
  x=9+90
elif n1=5:
  x=9+900+(n-999)
elif n1=6:
  x=9+900+90000
  
print(x)

### FIXED CODE ###

n=int(input())

if n<100:
  print(min(n,9))
elif n<10000:
  print(min(n-90,909))
else:
  print(min(n-9090,90909))
#!/usr/bin/env python3
# coding=utf-8

import sys

import numpy as np

n, k = map(int, sys.stdin.readline().strip().split(" "))
xyc = [l.strip().split(" ") for l in sys.stdin.readlines()]
xy = [tuple((int(_x), int(_y) if _c == "W" else int(_y) + k)) for (_x, _y, _c) in xyc]
xy = [tuple((_x % (2 * k), _y % (2 * k))) for (_x, _y) in xy]

ans = np.zeros((n, 2 * k, 2 * k), dtype=int)
for _i, (_x, _y) in enumerate(xy):
    check = np.zeros((2 * k, 2 * k), dtype=int)
    check[_x:_x + k, :] = 1
    if _x > k:
        check[:_x - k, :] = 1
    check[:, _y:_y + k] = 1 - check[:, _y:_y + k]
    if _y > k:
        check[:, :_y - k] = 1 - check[:, :_y - k]
    check = 1 - check
    ans += check
print(np.max(ans))

### FIXED CODE ###

import numpy as np
N, K = map(int, input().split())
ub = K * 2
b = [[0 for j in range(ub + 1)] for i in range(ub + 1)]
ADD = {"B": 0, "W": K}


def create_bound(p, K, ub):
    if p - K + 1 >= 0:
        return [(p - K + 1, p + 1)]
    else:
        return [(0, p + 1), ((p - K + 1) % ub, ub)]


for i in range(N):
    x, y, c = input().split()
    nx = int(x) % ub
    ny = (int(y) + ADD[c]) % ub
    for add in [0, K]:
        for xlb, xub in create_bound((nx + add) % ub, K, ub):
            for ylb, yub in create_bound((ny + add) % ub, K, ub):
                b[xlb][ylb] += 1
                b[xlb][yub] -= 1
                b[xub][ylb] -= 1
                b[xub][yub] += 1

b_arr = np.array(b)
for i in range(ub):
    b_arr[i + 1, :] += b_arr[i, :]
for j in range(ub):
    b_arr[:, j + 1] += b_arr[:, j]
print(b_arr.max())
k,x = map(str, input().split())
x.count("ABC")

### FIXED CODE ###

n = int(input())
s = str(input())
cnt = 0
# s.count("ABC")
for i in range(n):
#   print(s[i:i+3].find("ABC"))
  if s[i:i+3].find("ABC") ==0:
    cnt = cnt+1
print(cnt)
while 1:
   x, y = int(raw_input())
      if x == 0 and y == 0:
      break
   print '%s %s' %(x, y)

### FIXED CODE ###

while 1:
   x,y = map(int, raw_input().split())
   if x == 0 and y == 0:
      break
   if y >= x:
      print '%s %s' % (x, y)
   else:
      print '%s %s' % (y, x)
N=int(input())
A=list(map(it,input().split()))
A.sort()
for i in range(N-1):
  if A[i]=A[i+1]:
    print('NO')
    break
else:
  print('YES')
  

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
A.sort()
for i in range(N-1):
  if A[i]==A[i+1]:
    print('NO')
    break
else:
  print('YES')
n, m = [int(i) for i in input().split()]
a = [[int(j) for j in input().split()] for i in range(n)]
b = [int(input()) for i in range(m)]

ans = [sum([a[j][i] * b[i] for i in range(4)]) for j in range(3)]
print(*ans, sep='\n')


### FIXED CODE ###

n, m = [int(i) for i in input().split()]
a = [[int(j) for j in input().split()] for i in range(n)]
b = [int(input()) for i in range(m)]

ans = [sum([a[j][i] * b[i] for i in range(m)]) for j in range(n)]
print(*ans, sep='\n')
x=int(input())
y=int(input())
if x==1 and y==1:
  print(1000000)

### FIXED CODE ###

x,y=map(int,input().split())
if x==1 and y==1:
  print(1000000)
elif x<=3 and y>=4:
  print((x-4)*(-100000))
elif x>=4 and y<=3:
  print((y-4)*(-100000))
elif x<=3 and y<=3:
  print((x-4)*(-100000)+(y-4)*(-100000))
else:
  print(0)