Harryxun/stf_run huggingface dataset:
A, B, Q = map(int,input().split())

ss = [-10**10]+[int(input()) for _ in range(A)]+[2*10**10]
ts = [-10**10]+[int(input()) for _ in range(B)]+[2*10**10]
xs = [int(input()) for _ in range(Q)]

def binarysearch(ls,x):
    n = len(ls)
    width = n//2
    pos = n//2
    while True:
        width = (width+1)//2
        if ls[pos] < x < ls[pos+1]:
            index = pos
            break    
        elif x < ls[pos]:
            pos -= width
        elif ls[pos+1] < x:
            pos += width
    return index

for x in xs:
    sind = binarysearch(ss,x)
    tind = binarysearch(ts,x)
    
    s0,s1,t0,t1 = ss[sind],ss[sind+1],ts[tind],ts[tind+1]
    d1,d2,d3,d4 = 10**10,10**10,10**10,10**10
    
    d1 = max(x-s0,x-t0)
    d2 = min((t1-x)*2+(x-s0),(x-s0)*2+(t1-x))
    d3 = min((s1-x)*2+(x-t0),(x-t0)*2+(s1-x))
    d4 = max(s1-x, t1-x)
    print(min(d1,d2,d3,d4))

### FIXED CODE ###

from bisect import bisect_right as binarysearch
A, B, Q = map(int,input().split())

ss = [-10**10]+[int(input()) for _ in range(A)]+[2*10**10]
ts = [-10**10]+[int(input()) for _ in range(B)]+[2*10**10]
xs = [int(input()) for _ in range(Q)]
for x in xs:
    sind = binarysearch(ss,x)-1
    tind = binarysearch(ts,x)-1
    
    s0,s1,t0,t1 = ss[sind],ss[sind+1],ts[tind],ts[tind+1]
    d1,d2,d3,d4 = 10**10,10**10,10**10,10**10

    d1 = max(x-s0,x-t0)
    d2 = min((t1-x)*2+(x-s0),(x-s0)*2+(t1-x))
    d3 = min((s1-x)*2+(x-t0),(x-t0)*2+(s1-x))
    d4 = max(s1-x, t1-x)
    print(min(d1,d2,d3,d4))
n = int(input())
l=[0]*100
l[0]=2
l[1]=1
def ryuka(x):
    r = 0
    for i in range(2,x+1):
        l[i]=l[i-1]+l[i-2]
    return l[i]
print(ryuka(n))

### FIXED CODE ###

n = int(input())
l=[0]*100
l[0]=2
l[1]=1
def ryuka(x):
    r = 0
    for i in range(2,x+1):
        l[i]=l[i-1]+l[i-2]
    return l[i]
if n==1:
    print(1)
    exit()
else:
    print(ryuka(n))
# coding:utf-8
def inpl(): return list(map(int, input().split()))
N, M = inpl()
i = 2
tmp = []
MM = M
while i * i <= MM:
    if MM % i == 0:
        tmp.append(i)
        while MM % i == 0:
            MM //= i
    i += 1
if MM != 1:
    tmp.append(MM)
n = M // N
sub = tmp[0]
while n > 0:
    if M % n == 0:
        print(n)
        break
    else:
        n -= sub

### FIXED CODE ###

# coding:utf-8


def inpl(): return list(map(int, input().split()))


N, M = inpl()

n = M // N
while n > 0:
    if M % n == 0:
        print(n)
        break
    else:
        n -= 1
# -*- coding: utf-8 -*-
S = []
for i in range(3):
    S.append(input())
for i in range(3):
    S[i] = S[i].replace('a', '0').replace('b', '1').replace('c', '2')
    
idx = int(S[0][0])
S[0] = S[0][1:]

while True:
    tmp = int(S[idx][0])
    S[tmp] = S[tmp][1:]
    idx = tmp
    if len([i for i, x in enumerate(S) if len(x) == 0]) == 1:
        print(['A', 'B', 'C'][int([i for i, x in enumerate(S) if len(x) == 0][0])])
        break


### FIXED CODE ###

SA = input()
SB = input()
SC = input()

Aidx, Bidx, Cidx = 0, -1, -1
X = SA[0]
i = 0

while True:
    if X == 'a':
        Aidx += 1
        if Aidx == len(SA):
            ans = 'A'
            break
        X = SA[Aidx]
    elif X == 'b':
        Bidx += 1
        if Bidx == len(SB):
            ans = 'B'
            break
        X = SB[Bidx]
    elif X == 'c':
        Cidx += 1
        if Cidx == len(SC):
            ans = 'C'
            break
        X = SC[Cidx]


print(ans)
x,n = map(int,input().split())

p = [int(input()) for i in range(n)]
s = 1000000000

for i in range(1,101):
    if i in p:
        continue
    s = min(abs(x-i),s)
    

if not x-s in p:
    print(x - s)
else:
    print(x + s)

### FIXED CODE ###

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

if n != 0:
    p = list(map(int,input().split()))
else:
    print(x)
    exit()

s = 1000000000

for i in range(-100,102):
    if i in p:
        continue
    s = min(abs(x-i),s)
    

if not x-s in p:
    print(x - s)
else:
    print(x + s)
N = int(input())
A = list(map(int, input().split()))
q = len(set(A))
if q % 2 == 0:
    print(q - 1)
else:
    print(q)


### FIXED CODE ###

x=int(input())
if x<1200:
    print('ABC')
else:
    print('ARC')
N, K, M = map(int,input().split())
A = list(map(int,input().split()))

if sum(A) > N * M:
    print(0)
elif N * M - sum(A) - K < 0:
    print(N * M - sum(A))
else:
    print(-1)

### FIXED CODE ###

C = input()

nb = lambda xx: chr(ord(xx) + 1) 
print(nb(C))
import numpy as np
N = int(input())
arr = np.array(list(map(int, input().split())))
u, count = np.unique(arr, return_counts=True)
total = 0
for i in count:
    total += (i*(i-1)/2)
for i in arr:
    print(int(total- count[u==i][0]+1))

### FIXED CODE ###

import collections
N = int(input())
arr = list(map(int, input().split()))
count = collections.Counter(arr)
total = 0
for i in count.values():
    total += (i*(i-1)/2)
for i in arr:
    print(int(total- count[i]+1))
sentence = input()

d ={}
for i in [chr(i) for i in range(97,97+26)]:
    d[i] = 0

for char in sentence:
    if char.isalpha():
        d[char] += 1
for key, value in sorted(d.items()):
    print('%s : %s' % (key, value))

### FIXED CODE ###

import sys
sentence = ''
data = 'abcdefghijklmnopqrstuvwxyz'
for line in sys.stdin:
    sentence += line.lower()
for i in data:
    print(i + ' : ' + str(sentence.count(i)))
import sys
sys.setrecursionlimit(10**10+5)
n,q=map(int,input().split())
edge=[[] for _ in range(n)]
for i in range(n-1):
    x,y=map(int,input().split())
    edge[x-1].append(y-1)
    edge[y-1].append(x-1)
ans=[0]*n
def count(p,x):
    ans[p]+=x
    for i in edge[p]:
        if i<p:
            continue
        count(i,x)
for i in range(q):
    p,x=map(int,input().split())
    count(p-1,x)
print(*ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
n,q=map(int,input().split())
edge=[[] for _ in range(n)]
for i in range(n-1):
    x,y=map(int,input().split())
    edge[x-1].append(y-1)
    edge[y-1].append(x-1)
ans=[0]*n
for i in range(q):
    p,x=map(int,input().split())
    ans[p-1]+=x
def dfs(c,p):
    for i in edge[c]:
        if i==p:
            continue
        ans[i]+=ans[c]
        dfs(i,c)
dfs(0,-1)
print(*ans)
age = int(input())
if age == 1:
  print('Hello world")
elif age == 2:
  A = input()
  B = input()
  print(A+B)

### FIXED CODE ###

age = int(input())

if age == 1 :
    print('Hello World')
elif age ==2:
    A=int(input())
    B=int(input())
    print(A+B)
input().isupper
if ture:
  print("A")
else:
  print("a")

### FIXED CODE ###

a = input().islower()

if a == 0:
  print("A")
else:
  print("a")
from math import atan,degrees
a, b, x = map(int, input().split())
h = x / (a * a)
if x < b / 2:
    print(90-degrees(atan(2*x/(a*b*b))))
else:
    print(90-degrees(atan(a/(2*(b-x/(a*a))))))




### FIXED CODE ###

import math
a, b, x = map(int, input().split())
h = x / (a * a)
if x < a*a*b / 2:
    print(90-math.degrees(math.atan(2*x/(a*b*b))))
else:
    print(math.degrees(math.atan((2*(b-x/(a*a)))/a)))
import math
from collections import Counter
A, B = map(int, input().split())
C = math.gcd(A, B)

prime_count = Counter()
for i in range(2, math.ceil(math.sqrt(C))+1):
  while C % i == 0:
    C /= i
    prime_count[i] += 1
if C > 1:
  prime_count[int(C)] += 1

print(len(prime_count)+1)

### FIXED CODE ###

import fractions
import math
from collections import Counter
a, b = map(int, input().split())
n = fractions.gcd(a, b)

prime_count = Counter()
for i in range(2, math.ceil(math.sqrt(n))+1):
  while n % i == 0:
    n /= i
    prime_count[i] += 1
if n > 1:
  prime_count[int(n)] += 1

print(len(prime_count)+1)
import sys


input = list()
N, D = sys.stdin
for item in sys.stdin:
    input.append(item)

count = 0
for item in input:
    if 1 <= N and N <= 2*10**5:
        if D <= 0 and D <= 2*10**5:
            if abs(item[0]) <= 2*10**5 and abs(item[1]) <= 2*10**5:            
                if D >= (int(item[0])**2 + item(item[1])**2)**1/2:
                    count += 1
print(count)

### FIXED CODE ###

import sys


input_array = list()
N, D = map(int, input().split())
if 1 <= N and N <= 2*10**5:
    for _ in range(N):
        input_array.append(map(int, input().split()))

count = 0
for x0, x1 in input_array:
    if 0 <= D and D <= 2*10**5:
        if abs(x0) <= 2*10**5 and abs(x1) <= 2*10**5:            
            if D >= (int(x0)**2 + int(x1)**2)**(1/2):
                count += 1
print(count)
N=int(input())
XY=[]
for i in range(N):
  A=int(input())
  XY_i=[]
  for _ in range(A):
    x,y = map(int, input().split())
    x-=1
    XY_i.append([x,y])
  XY.append(XY_i)

ans=0
for bit_state in range(1<<N):
  flag=True
  for i in range(N):
    if (bit_state>>i)&1:
      for x, y in XY[i]:
        if (bit_state >>x)&1 != y:
          flag=False
  if flag:
    ans=max(ans, bin(bit_state>>x).count("1"))
    
print(ans) 

### FIXED CODE ###

N=int(input())
XY=[[] for _ in range(N)]
for i in range(N):
  A=int(input())
  for _ in range(A):
    x,y = map(int, input().split())
    x-=1
    XY[i].append([x,y])

ans=0
for bit_state in range(2**N):
  flag=True
  for i in range(N):
    if (bit_state>>i)&1:
      for x, y in XY[i]:
        if (bit_state >>x)&1 != y:
          flag=False
  if flag:
    ans=max(ans, bin(bit_state).count("1"))
    
print(ans)
n=int(input())
arr=list(map(int,input().split()))
dummy=len(arr)
ans=0
if dummy>2:
  for i in range(dummy-2):
      for j in range(i+1,dummy-1):
          for k in range(j+1,dummy):
              if arr[i]!=arr[j] and arr[j]!=arr[k] and arr[k]!=arr[i]:
                  if arr[i]<arr[j]+arr[k] and arr[j]<arr[k]+arr[i] and arr[k]<arr[j]+arr[i]:
                      ans+=1
	print(ans)
else:
  print(0)

### FIXED CODE ###

n=int(input())
arr=list(map(int,input().split()))
dummy=len(arr)
ans=0
if dummy>2:
    for i in range(dummy-2):
        for j in range(i+1,dummy-1):
            for k in range(j+1,dummy):
                if arr[i]!=arr[j] and arr[j]!=arr[k] and arr[k]!=arr[i]:
                    if arr[i]<arr[j]+arr[k] and arr[j]<arr[k]+arr[i] and arr[k]<arr[j]+arr[i]:
                        ans+=1
    print(ans)
else:
    print(0)
direction = input()

def next(direction, current):
	output = [0] * len(current)

	for i in range(len(direction)):
		if direction[i] == 'R':
			output[i+1] += current[i]
		if direction[i] == 'L':
			output[i-1] += current[i]

	return output

def solve(direction):
	original = [1] * len(direction)

	prev2 = next(direction, original)
	prev1 = next(direction, prev2)

	count = 2
	while True:
		next_state = next(direction, prev1)
		count += 1
		if next_state == prev2:
			if count % 2 == 0:
				print ' '.join(map(str, prev2))
				return
			else:
				print ' '.join(map(str, prev1))
				return
		prev2 = prev1
		prev1 = next_state

### FIXED CODE ###

direction = input()

def next(direction, current):
	output = [0] * len(current)

	for i in range(len(direction)):
		if direction[i] == 'R':
			output[i+1] += current[i]
		if direction[i] == 'L':
			output[i-1] += current[i]

	return output

def s(inp):
	r = len([x for x in inp if x == 'R'])
	l = len([x for x in inp if x == 'L'])

	R = L = 0
	for i in range(0, r, 2):
		R += 1
	for i in range(1, r, 2):
		L += 1
	for i in range(0, l, 2):
		L += 1
	for i in range(1, l, 2):
		R += 1
	
	output = [0 for _ in range(len(inp))]
	output[r-1] = R
	output[r] = L
	return output

def solve(inp):
	r = len([x for x in inp if x == 'R'])
	l = len([x for x in inp if x == 'L'])

	output = [0] * len(inp)
	if r == l:
		output[r-1] = output[r] = r
	else:
		m = max(l-1, r-1)
		if m % 2 == 1:
			output[r-1] = r
			output[r] = l
		else:
			output[r-1] = l
			output[r] = r
		


def solve(direction, start, end, output):
	original = [1] * (end-start)

	sub_direction = direction[start:end]

	prev2 = next(sub_direction, original)
	prev1 = next(sub_direction, prev2)

	count = 2

	output.append(s(direction[start:end]))

	# while True:
	# 	next_state = next(sub_direction, prev1)
	# 	count += 1
	# 	if next_state == prev2:
	# 		if count % 2 == 0:
	# 			output.append(prev2)
	# 			# print(' '.join(map(str, prev2)))
	# 			return
	# 		else:
	# 			output.append(prev1)
	# 			# print(' '.join(map(str, prev1)))
	# 			return
	# 	prev2 = prev1
	# 	prev1 = next_state

# direction = 'RRRLLRLLRRRLLLLL'
parts = []
prev = 0
for i in range(len(direction)-1):
	if direction[i] == 'L' and direction[i+1] == 'R':
		parts.append((prev,i+1))
		prev = i+1

parts.append((prev,len(direction)))

# print(parts)
output = []
for start,end in parts:
	solve(direction, start, end, output)

# print(output)
final = [x for  y in output for x in y]
print(' '.join(map(str, final)))


# print(solve('RRLRL'))
# print(solve('RRLLLLRLRRLL'))
n,m = map(int, input().split())
l = []
for i in range(n):
    a = input()
    a.split()
    l.append(a)
def f(x,y):
    global l ,n,m
    ans = -3
    if l[x][y] == "#":
        return 0
    else :
        for i in range(x,n):
            if l[i][y] == ".":
                ans += 1
            else :
                break
        for i in range(x+1):
            if l[x-i][y] == ".":
                ans += 1
            else :
                break
        for i in range(y,m):
            if l[x][i] == ".":
                ans += 1
            else :
                break
        for i in range(y+1):
            if l[x][y-i] == ".":
                ans += 1
            else:
                break
        return ans
k = 1
for i in range(n):
    for j in range(m):
        k = max(k,f(i,j))
        if k == n + m - 1:
            break
print(k)


### FIXED CODE ###

n,m = map(int, input().split())
u = [0]*(n+1)
for i in range(m):
    u[int(input())] = 1
ll = [0]*(n+2)
ll[1] = 1
for i in range(2,n+2):
    if not u[i-1]:
        ll[i] = ll[i-1] + ll[i - 2]
print(ll[-1] % 1000000007)
# ANSHUL GAUTAM
# IIIT-D

'''

'''

def solve(grid):
	H,W = len(grid),len(grid[0])
	q = []
	dist = [0]*H
	for i in range(H):
		dist[i] = []
	for i in range(H):
		for j in range(W):
			if(grid[i][j] == '#'):
				q.append([i,j])
				grid[i][j] = 0
	maxx = 0
	while(q):
		qq = []
		for i,j in q:
			for r,c in [[i+1,j],[i-1,j],[i,j+1],[i,j-1]]:
				if(0 <= r < H and 0 <= c < W and grid[r][c] == '.'):
					grid[r][c] = grid[i][j] + 1
					maxx = max(maxx,grid[r][c])
					qq.append([r,c])
		q = qq
	return maxx

H,W = map(int, input().split())
grid = []
for h in range(H):
	s = list(input())
	grid.append(s)
ans = solve(grid)
print(ans)



### FIXED CODE ###

# ANSHUL GAUTAM
# IIIT-D

'''

'''

def solve(grid):
	H,W = len(grid),len(grid[0])
	q = []
	dist = [0]*H
	for i in range(H):
		dist[i] = []
	for i in range(H):
		for j in range(W):
			if(grid[i][j] == '#'):
				q.append([i,j])
				grid[i][j] = 0
	maxx = 0
	while(q):
		qq = []
		for i,j in q:
			for r,c in [[i+1,j],[i-1,j],[i,j+1],[i,j-1]]:
				if(0 <= r < H and 0 <= c < W and grid[r][c] == '.'):
					grid[r][c] = grid[i][j] + 1
					maxx = max(maxx,grid[r][c])
					qq.append([r,c])
		q = qq
	return maxx

H,W = map(int, raw_input().split())
grid = []
for h in range(H):
	s = list(raw_input())
	grid.append(s)
ans = solve(grid)
print(ans)
print(input()//3)

### FIXED CODE ###

import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.readline().rstrip())
    print(N//3)


if __name__ == '__main__':
    main()
N, M = map(int, input().split())
A = sorted(map(int, input().split()))
BC = sorted([ list(map(int, input().split())) for _ in range(M)], key=lambda x:x[1], reverse=True)

s = 0
i = 0
B = 0
for a in A:
  if B == 0:
    if i < len(BC):
      B, C = BC[i]
      i += 1

  if B > 0 and C > a:
    s += C
    B -= 1
  else
    s += a

print(s)


### FIXED CODE ###

N, M = map(int, input().split())
A = sorted(map(int, input().split()))
BC = sorted([ list(map(int, input().split())) for _ in range(M)], key=lambda x:x[1], reverse=True)

s = 0
i = 0
B = 0
for a in A:
  if B == 0:
    if i < len(BC):
      B, C = BC[i]
      i += 1

  if B > 0 and C > a:
    s += C
    B -= 1
  else:
    s += a

print(s)
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall

import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    H, W = map(int, input().split())

    graph = [[i for i in list(map(int, input().split()))] for _ in range(10)]
    graph = csr_matrix(graph)

    dist_matrix = floyd_warshall(csgraph=graph, directed=True, return_predecessors=False)
    dist_matrix = list(dist_matrix)

    wall = [[i for i in list(map(int, input().split()))] for _ in range(H)]

    cnt = 0
    for h in range(H):
        for w in range(W):
            val = wall[h][w]
            if val != -1 and val != 1:
                cnt += dist_matrix[val][1]
    print(int(cnt))


resolve()


### FIXED CODE ###

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import floyd_warshall

import sys

sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    H, W = map(int, input().split())

    graph = [[i for i in list(map(int, input().split()))] for _ in range(10)]
    graph = csr_matrix(graph)

    dist_matrix = floyd_warshall(csgraph=graph, directed=True, return_predecessors=False)
    dist_matrix = list(dist_matrix)

    wall = [[i for i in list(map(int, input().split()))] for _ in range(H)]

    cnt = 0
    for h in range(H):
        for w in range(W):
            val = wall[h][w]
            if val != -1 and val != 1:
                cnt += dist_matrix[val][1]
    print(int(cnt))


resolve()
from math import gcd
a,b=map(int,input().split())
print(gcd(a,b))


### FIXED CODE ###

a,b=map(int,input().split())
if a>b:
    ans=a
    a-=1
else:
    ans=b
    b-=1
print(ans+max(a,b))
a,p = map(int,input().split()))
print((a*3+p)//2)

### FIXED CODE ###

a,p = map(int,input().split())
print((a*3+p)//2)
n,m=map(int,input().split())
AC=0
WA=0
AC_list=[0]*(m+1)
WA_list=[0]*(m+1)

for i in range(m):
  p,s=input().split()
  p=int(p)
  if s=="AC":
    if AC_list[p]==0:
      AC=AC+1
      AC_list[p]=1
  else:
    if AC_list[p]==0:
      WA=WA+1
    
print(AC,WA)

### FIXED CODE ###

n, m = map(int,input().split())
 
AC = 0
# 各問題でACがとれているか確認用
# 0 = まだ正解していない, 1 = すでに正解済み
AC_list = [0] * (n + 1)
WA = 0
WA_List = [0] * (n + 1)
 
for i in range(m):
    p,S = input().split()
    p = int(p)
 
    if S == "AC":
        # 初めての正解
        if AC_list[p] == 0:
            AC += 1
            WA += WA_List[p]
            AC_list[p] = 1
        # ※すでに正解している場合は加算しない
    else:
        # まだ正解していない場合
        if AC_list[p] == 0:
            WA_List[p] += 1
        # ※すでに正解している場合は加算しない
 
print(AC,WA)
N = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(0, N+1, 2):
    if a[i] % 2 != 0:
        cnt += 1
print(cnt)

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
cnt = 0
for i in range(0, N):
    if (i+1) % 2 != 0 and a[i] % 2 != 0:
        cnt += 1
print(cnt)
n,k=map(int,input().split())
l=list(map(int,input().split()))
l1=[]
for i in range(n-1):
    l1.append(l[i+1]-l[i])
l1=sorted(l1)
for i in range(k-1):
    del l1[-1]
s=0
for i in l1:
    s+=i
print(s)


### FIXED CODE ###

t=int(input())
for j in range(t):
  n,k=map(int,input().split())
  l=list(map(int,input().split()))
  l1=[]
  for i in range(n-1):
      l1.append(l[i+1]-l[i])
  l1=sorted(l1)
  if n<=k:
    print(0)
  else:
    for i in range(k-1):
      del l1[-1]
    s=0
    for i in l1:
        s+=i
    print(s)
N,M=map(int,input().split())
ac_list = [0] * N
wa_list = [0] * N
#Piは問題番号、answerは正解したかどうか
for i in range(M):
    Pi, answer = input().split()
    number=int(Pi)
    if answer =='AC':
        #正解は一回だけカウントされるので1を入れるだけで良い
        ac_list[number] =1
        #ACの箱に1が入っていなければWAの箱に1を足す、不正解は何回もカウントされる
    else:
        if ac_list[number]!=1:
            wa_list[number] =wa_list[number]+1

wa_num = 0
ac_num = 0
for i in range(N):
    if ac_list[i] == 1:
       ac_num=ac_num+1
       wa_num=wa_list[i]
    
print(ac_num, wa_num)


### FIXED CODE ###

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

ac = [0] * (n+1)
wa = [0] * (n+1)
pena = 0

for i in range(m):
    question, answer = input().split()
    question = int(question)
    if (answer == "AC") and (ac[question] == 0):
        ac[question] = 1
        pena += wa[question]
    elif (answer == "WA") and (ac[question] == 0):
        wa[question] += 1

print(sum(ac), pena)
a, b, c = map(int, raw_input().split())
return "Yes" if a + b >= c else "No"

### FIXED CODE ###

a, b, c = map(int, raw_input().split())
print "Yes" if a + b >= c else "No"
a,b = int(input().split())
if b % a == 0:
    print(a+b)
else:
    print(b-a)
    

### FIXED CODE ###

a,b = map(int,input().split())
if b % a == 0:
    print(a+b)
else:
    print(b-a)
N,Q = map(int,input().split())
S = input()
X = [list(map(int, input().split())) for _ in range(Q)]
L =[0]*(N+1)
for i in range(N):
  if S[i]=="A" and S[i+1]=="C":
    L[i+1] = L[i]+1 
  else:
    L[i+1] = L[i]
for x in X:
  print(L[x[1]-1]-L[x[0]-1])

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
L = [list(map(int, input().split())) for _ in range(Q)]
t, I = 0, [0]
for i in range(1, N):
  if S[i-1]=="A":
    if S[i]=="C":
      t += 1
  I.append(t)
for l in L:
  print(I[l[1]-1]-I[l[0]-1])
N = int(input())
nodes = [set() for _ in range(N)]
for line in sys.stdin:
    u, v, w = map(int, line.split())
    u, v = (u - 1, v - 1)
    nodes[u].add((v, w))
    nodes[v].add((u, w))


ans = [-1 for _ in range(N)]
q = [(0, 0, -1)]

while q:
    v, dist, parent = q.pop()

    if dist % 2 == 0:
        ans[v] = 0
    else:
        ans[v] = 1

    for u, w in nodes[v]:
        if u == parent:
            continue

        q.append((u, dist + w, v))

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


### FIXED CODE ###

N = int(input())
nodes = [set() for _ in range(N)]
for _ in range(N - 1):
    u, v, w = map(int, input().split())
    u, v = (u - 1, v - 1)
    nodes[u].add((v, w))
    nodes[v].add((u, w))


ans = [-1 for _ in range(N)]
q = [(0, 0, -1)]

while q:
    v, dist, parent = q.pop()

    if dist % 2 == 0:
        ans[v] = 0
    else:
        ans[v] = 1

    for u, w in nodes[v]:
        if u == parent:
            continue

        q.append((u, dist + w, v))

print("\n".join(map(str, ans)))
n=int(input())
s=[list(map(int,list(input()))) for i in range(h)]

print(sum(s)-1/2max(s))

### FIXED CODE ###

n=int(input())
s=[int(input()) for i in range(n)]
 
print(sum(s)-max(s)//2)