Harryxun/stf_run huggingface dataset:
import sys
import numpy as np

input = sys.stdin.readline

S = input()
T = input()

def lcs(S, T):
    s = [ch for ch in S]
    t = [ch for ch in T]

    # s[:i]とt[:j]のLCS
    dp = np.empty((len(s)+1, len(t)+1), dtype="U3000")

    for i in range(1, len(s)+1):
        for j in range(1, len(t)+1):
            if s[i-1] == t[j-1]:
                dp[i, j] = dp[i-1, j-1] + s[i-1]
            else:
                case1 = dp[i, j-1]
                case2 = dp[i-1, j]
                if len(case1) > len(case2):
                    dp[i, j] = case1
                else:
                    dp[i, j] = case2
    return dp[-1, -1]

print(lcs(S, T))



### FIXED CODE ###

import sys

input = sys.stdin.readline

s = input()[:-1]
t = input()[:-1]

N = len(s) + 1
M = len(t) + 1


# dp[i][j] := s[i] t[j]までのLCS
dp = [[0]*M for _ in range(N)]


for i in range(1, N):
    for j in range(1, M):
        if s[i-1] == t[j-1]:
            dp[i][j] = dp[i-1][j-1] + 1
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1])

"""
復元
もしdp[i][j] == dp[i][j-1]ならt[j-1]は使われていないことがわかる
もしdp[i][j] == dp[i-1][j]ならs[i-1]は使われていないことがわかる
それ以外の場合、s[i-1], t[j-1]が使われていることがわかる
"""

ans = ""
i = len(s)
j = len(t)

while i > 0 and j > 0:
    if dp[i][j] == dp[i-1][j]:
        i -= 1
    elif dp[i][j] == dp[i][j-1]:
        j -= 1
    else:
        ans = s[i-1] + ans  # t[j-1] + ansでも同じ
        i -= 1
        j -= 1
print(ans)
print("YES" if int(input())-2*int(input())+int(input()) == 0 else "NO")

### FIXED CODE ###

a,b,c=map(int,input().split())
print("YES" if a+c==2*b else "NO")
a,b,x=map(int,input().split())
if b == 0:
    print(1)
elif a == 0:
    print(b//x)+1
else:
    print(b//x-(a-1)//x)


### FIXED CODE ###

a,b,x=map(int,input().split())
print((b//x)-((a-1)//x))
N=int(input())
L=list(input().split())
NL=sorted(L)
P=int(NL[int(N/2)-1])
Q=int(NL[int(N/2)])
print(Q+1-P)

### FIXED CODE ###

S=input()
L=[str(c) for c in S]
if L[0]==L[1]==L[2]==L[3]:
  print("No")
elif L[0] ==L[1]:
  if L[2]==L[3]:
    print("Yes")
  else:
    print("No")
elif L[0]==L[2]:
  if L[1]==L[3]:
    print("Yes")
  else:
    print("No")
elif L[0]==L[3]:
  if L[1]==L[2]:
    print("Yes")
  else:
    print("No")
else:
  print("No")
a=input(int())
print(a+a**2+a**3)

### FIXED CODE ###

a = int(input())
print(a+a**2+a**3)
n = int(input())
s = input()
t = input()

for i in range(n):
  if t.startswith(s[i:]):
    x = n + i

print(x)

### FIXED CODE ###

n = int(input())
s = input()
t = input()
x = 2 * n
for i in range(n):
  if t.startswith(s[i:]):
    x = n + i
    print(x)
    exit()
print(x)
from collections import Counter

n = int(input())
if(n == 2):
    print(0)
else:
    n2 = n/2
    v = [int(i) for i in input().split()]
    v1 = Counter(v[::2])
    v2 = Counter(v[1::2])
    v1mc = v1.most_common()
    v2mc = v2.most_common()
    if(v1mc[0][0] == v2mc[0][0]):
        print(n - max(v1mc[0][1]+v2mc[1][1], v2mc[0][1]+v1mc[1][1]))
    else:
        print(n - (v1mc[0][1]+v2mc[0][1]))


### FIXED CODE ###

from collections import Counter

n = int(input())
v = [int(i) for i in input().split()]
v1 = Counter(v[::2])
v2 = Counter(v[1::2])
v1mc = v1.most_common()
v2mc = v2.most_common()
if(v1mc[0][0] == v2mc[0][0]):
    if(len(v1mc) == 1 and len(v2mc) == 1):
        print(int(n/2))
    elif(len(v1mc) == 1):
        print(n - (v1mc[0][1]+v2mc[1][1]))
    elif(len(v2mc) == 1):
        print(n - (v2mc[0][1]+v1mc[1][1]))
    else:
        print(n - max(v1mc[0][1]+v2mc[1][1], v2mc[0][1]+v1mc[1][1]))
else:
    print(n - (v1mc[0][1]+v2mc[0][1]))
from fractions import gcd
a,b,c,d = map(int,input().split())
l = (c*d) // gcd(c,d)

x = b//c - (a-1)//c
y = b//d - (a-1)//d
z = b//l - (a-1)//l

s = (x+y-z)
print(b-a+1-s)

### FIXED CODE ###

s = ''
for i in input():
    if s == i:
        print("Bad")
        exit()
    s = i
print("Good")
import math as mt
a, b, c = map(double, input().split())
if a + b + 2*mt.sqrt(a*b) < c:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

import math as mt
a, b, c = map(int, input().split())
d = c - a - b
if d>0 and d**2 > 4*a*b:
  print("Yes")
else:
  print("No")
N,T = map(int,input().split(' '))

for _ in range(N):
  list = list(map(int,input().split(' ')))
  List.append(list)

List = [x[0] for x in List if x[1]<=T]
  
print(min(List))

### FIXED CODE ###

N,T = map(int,input().split(' '))

clist = []
tlist = []

for _ in range(N):
  L = list(map(int,input().split(' ')))
  clist.append(L[0])
  tlist.append(L[1])
  
List = [c for c,t in zip(clist,tlist) if t<=T]

if len(List):
  print(min(List))
else:
  print('TLE')
k,s = map(int,input().split())
if s/k == 3 or k/s == 3:
    print(1)
elif k < s:
    print(int((1/2)*(k+1)*(k+2)))
elif k >= s:
    print(int((1/2)*(s+1)*(s+2)))

### FIXED CODE ###

k,s = map(int,input().split())
d = 0
for a in range(0,k+1):
    for b in range(0,k+1):
        if 0 <= s-a-b <= k:
                d += 1
print(d)
str=list(input())

count1=0
count2=0
if str[0]=="A":
  for i in range(len(str)-3):
    if str[i+2]=="C":
      count1 += 1
  for i in range(len(str)):
    if str[i]==str[i].capitalize():
      count2 += 1
  if count1 == 1 && count2 !=0 :
    print("AC")
  else:
    print("WA")
else:
  print("WA")
    
    
  
  

### FIXED CODE ###

str=list(input())

count1=0
count2=0
if str[0]=="A":
  for i in range(len(str)-3):
    if str[i+2]=="C":
      count1 += 1
  for i in range(len(str)):
    if str[i]==str[i].capitalize():
      count2 += 1
  if count1 == 1 and count2 ==2 :
    print("AC")
  else:
    print("WA")
else:
  print("WA")
n, x = map(int, input().split())
l = ["P"]
def lvup(n):
  if n == 0:
    pass
  else:
    lvup(n-1)
    l.append("B"+l[n-1]+"P"+l[n-1]+"B")
print(l[n][0:x].count("P"))

### FIXED CODE ###

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

def count_p(n, x):
  if x == 0:
    return 0
  elif n == 0:
    return 1
  elif x > 2**(n+1)-2:
    return 2**(n)-1 + 1 + count_p(n-1, min(x-(2**(n+1)-1), 2**(n+1)-3))
  else:
    return count_p(n-1, x-1)
  
print(count_p(n,x))
l = [int(x) for x in input().split()]

if l[0] == 7 or l[1] == 7 or l[2] == 7:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

s = input() 
l = [int(x) for x in s]

if l[0] == 7 or l[1] == 7 or l[2] == 7:
    print('Yes')
else:
    print('No')
from copy import deepcopy
n = int(input())
s = input().rstrip()

def solve1(n, s):
    # 全探索
    cnt = 0
    for v in range(0, 1000):
        v = str(v)
        v = "0" * (3 - len(v)) + v
        idx = 0
        for i in range(len(s)):
            if s[i] == v[idx]:
                idx += 1
            if idx == 3:
                cnt += 1
                break
    print(cnt)

def solve2(n, s):
    # DP
    dp = [[[False for _ in range(1000)] for _ in range(4)] for _ in range(n+1)]
    dp[0][0][0] = True

    for i in range(n):
        for j in range(3):
            for k in range(100):
                if dp[i][j][k]:
                    num = k*10 + int(s[i])
                    dpp[i+1][j+1][num] = True
    cnt = 0
    for i in range(1000):
        if dp[3][i]:
            cnt += 1
    print(cnt)

solve2(n, s)

### FIXED CODE ###

n = int(input())
s = input().rstrip()

def solve(n, s):
    # 全探索
    cnt = 0
    for v in range(0, 1000):
        v = str(v)
        v = "0" * (3 - len(v)) + v
        idx = 0
        for i in range(len(s)):
            if s[i] == v[idx]:
                idx += 1
            if idx == 3:
                cnt += 1
                break
    print(cnt)
solve(n, s)
j = 0
input = input()
a,b,c = map(int, input.split())
for i in range(a,b + 1):
    if c % i == 0
        j += 1
print(j)


### FIXED CODE ###

j = 0
input = input()
a,b,c = map(int, input.split())
for i in range(a,b + 1):
    if c % i == 0:
        j += 1
print(j)
from collections import deque

N, M = map(int, input().split())
matches = []
used = [False] * N
q = deque(range(N))
i = 0
l = 1
while len(matches) < M:
    i = q.popleft()
    j = (i + l) % N
    if used[i] or used[j]: continue
    used[i], used[j] = True, True
    matches.append((i+1, j+1))
    l += 1
    i += 1
for a, b in matches:
    print(a, b)

### FIXED CODE ###

N, M = map(int, input().split())
matches = []
i = 1
l = N // 2 - 1 if N % 2 == 0 else N // 2
while len(matches) < M:
    if l <= 0:
        i = N // 2 + 1 if N % 2 == 0 else N // 2 + 2
        l = N // 2 - 2 if N % 2 == 0 else N // 2 - 1
        continue
    matches.append((i, i+l))
    i += 1; l -= 2
for a, b in matches: print(a, b)
a = input()
b = input()
f = False
x = []
if len(a)> len(b):
    b.append(0)
    f = True
for i in range(len(a)):
    x.append(a[i]+b[i])
if f:
    x.pop()
print("".join(x))

### FIXED CODE ###

a = list(input())
b = list(input())
f = False
x = []
if len(a)> len(b):
    b.append(0)
    f = True
for i in range(len(a)):
    x.append(a[i])
    x.append(b[i])
if f:
    x.pop()
print("".join(x))
N,X,Y=map(int,input().split())
N=[0]*(N+1)
for i in range(1,N):
  for j in range(i+1,N+1):
    m=min(j-i,abs(Y-j)+abs(X-i)+1)
    N[m]+=1
for k in range(1,N):
  print(A[k])


### FIXED CODE ###

N,X,Y=map(int,input().split())
A=[0]*(N+1)
for i in range(1,N):
  for j in range(i+1,N+1):
    m=min(j-i,abs(Y-j)+abs(X-i)+1)
    A[m]+=1
for k in range(1,N):
  print(A[k])
N = int(input())

A = [int(input()) for b in range(N)]
Ans = 0

for i in range(N):
    v += 1 / a[i]
print(1 / Ans)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
 
ans = 0
 
for i in range(N):
    ans = ans + 1 / A[i]
 
ans = 1 / ans 
 
print(ans)
import sys
input = sys.stdin.readline

S = input().strip()
T = input().strip()

dic = defaultdict(list)

def check(d):
    for k, i in d.items():
        if k != i:
            return False
    else:
        return True

for s, t in zip(S, T):
    if s not in dic:
        dic[s] = t
    elif dic[s] != t:
        print('No')
        exit()

if len(dic) != len(set(dic.values())):
    print('No')
else:
    print('Yes')

### FIXED CODE ###

import sys
input = sys.stdin.readline

S = input().strip()
T = input().strip()
dic = {}

for s, t in zip(S, T):
    if s not in dic:
        dic[s] = t
    elif dic[s] != t:
        print('No')
        exit()

if len(dic) != len(set(dic.values())):
    print('No')
else:
    print('Yes')
while True:
  H,W = map(int,input().split())
    if H == 0 and W == 0:
        break
    for i in range(H):
        for k in range(W):
            if (i+k)%2 == 0:
                print("#",end = "")
            else:
                print(".",end = "")
        print()


### FIXED CODE ###

while 1:
    (H,W) = [int(i) for i in input().split()]
    if H==W==0:
        break
    for i in range(H):
        for j in range(W):
            if (i+j)%2==0: print('#',end="")
            else: print('.',end="")
        print('')
    print('')
n = int(input())
s = input()
print("Yes" if n % 2 == 0 and s[:n/2] == s[n/2:] else "No")


### FIXED CODE ###

n = int(input())
s = input()
print("Yes" if n % 2 == 0 and s[:int(n/2)] == s[int(n/2):] else "No")
a, b = map(int, input().split())
if ((a*b)%2 == 0)
  print("Odd")
else
  print("Even")

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
import math
def c(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1)
    num2 = c(N-K+1,i)
    ans = (num1*num2) % (10**9+7)
    print(ans)

### FIXED CODE ###

def c(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    num1 = c(K-1,i-1,mod)
    num2 = c(N-K+1,i,mod)
    ans = (num1*num2) % (10**9+7)
    print(ans)
a, b, c, d = map(str,input().split())
sign = "+-"
for i in range(2):  # 1つ目の記号
    for j in range(2):  # 2つ目の記号
        for k in range(2):  # 3つ目の記号
            if eval(a+sign[i]+b+sign[j]+c+sign[k]+d) == 7:
                print(str(a+sign[i]+b+sign[j]+c+sign[k]+d)+"=7")

### FIXED CODE ###

N = input()
a = int(N[0])
b = int(N[1])
c = int(N[2])
d = int(N[3])

if a+b+c+d ==7:
	print(str(a)+'+'+str(b)+'+'+str(c)+'+'+str(d)+'=7')
	
elif a-b+c+d ==7:
	print(str(a)+'-'+str(b)+'+'+str(c)+'+'+str(d)+'=7')
	
elif a-b-c+d ==7:
	print(str(a)+'-'+str(b)+'-'+str(c)+'+'+str(d)+'=7')
	
elif a+b+c-d ==7:
	print(str(a)+'+'+str(b)+'+'+str(c)+'-'+str(d)+'=7')
	
elif a+b-c-d ==7:
	print(str(a)+'+'+str(b)+'-'+str(c)+'-'+str(d)+'=7')
	
elif a-b+c-d ==7:
	print(str(a)+'-'+str(b)+'+'+str(c)+'-'+str(d)+'=7')
	
elif a+b-c+d ==7:
	print(str(a)+'+'+str(b)+'-'+str(c)+'+'+str(d)+'=7')

elif a-b-c-d ==7:
	print(str(a)+'-'+str(b)+'-'+str(c)+'-'+str(d)+'=7')
import math
HW = input().split()
H = int(HW[0])
W = int(HW[1])
print(math.ceil(H*W/2))

### FIXED CODE ###

K = int(input())
x = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(x[K-1])
test_dict = {}
result = ''
for temp in a:
    try:
        result += '\n' + str(test_dict[string[temp[0]-1:temp[1]]])
    except:
        test_dict[string[temp[0]-1:temp[1]]] = string[temp[0]-1:temp[1]].count('AC')
        result += '\n' + str(test_dict[string[temp[0]-1:temp[1]]])
print(result.lstrip())

### FIXED CODE ###

N, Q = map(int, raw_input().split())
string = raw_input()
cnt = [0]
for i in range(N):
#    print(i)
#    print(string[i-2:i])
#    if i == 0:
#        cnt.append(0)
#        continue
    if string[i-1:i+1] == 'AC':
        cnt.append(cnt[i]+1)
        continue
    cnt.append(cnt[i])

for j in range(Q):
    #print(j)
    pare = map(int, raw_input().split())
    print(cnt[pare[1]] - cnt[pare[0]])
x, y = [int(i) for i in input().split()]
if x < y:
    buff = x
    x = y
    y = buff

r = x % y

for i in range(1, r):
    if y % i == 0 and r % i == 0:
        gcd = i

print(gcd)

### FIXED CODE ###

# GCD
def gcd(x, y):
    if x % y > 0:
        r = x % y
        d = gcd(y, r)
    else:
        d = y

    return d


x, y = [int(i) for i in input().split()]

if x < y:
    buff = x
    x = y
    y = buff
elif x == y:
    print(x)
    exit()

d = gcd(x, y)

print(d)
N = int(input())
A = input()
a = A.split()
sum = 1
if "0" in a :
    print(0)
else:
    for i in range(N):
        sum *= int(a[i])
        if sum > 10**18:
            print(-1)
            flag = 1
            break
    if flag == 0:
        print(sum)


### FIXED CODE ###

N = int(input())
A = input()
a = A.split()
s = 1
flag = 0
if "0" in a:
    print(0)
else:
    for i in range(N):
        s *= int(a[i])
        if s > 10**18:
            print(-1)
            flag = 1
            break
    if flag == 0:
        print(s)
N = int(input())
S = list(input())

# ordで文字からunicode数字を返す
# chrでunicode数字から文字を返す

def chr_change(chr, N):
    """ print("chr is", chr)
    print("N is", N)
    print("ord(chr) is ", ord(chr))
     """
    Num_AtoZ = ord("Z") - ord("A")
    if ord(chr) + N > ord("Z"):
        chg_chr = ord(chr) + N - Num_AtoZ -1
    else:
        chg_chr = ord(chr) + N
    #print("chg_chr is", chg_chr)
    return chg_chr


for i in range(N):
    tmp_chr = S[i]
    print(chr(chr_change(tmp_chr, N)), end = "")
print("\n")


### FIXED CODE ###


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

# ordで文字からunicode数字を返す
# chrでunicode数字から文字を返す

def chr_change(chr, N):
    """ print("chr is", chr)
    print("N is", N)
    print("ord(chr) is ", ord(chr))
     """
    Num_AtoZ = ord("Z") - ord("A")
    if ord(chr) + N > ord("Z"):
        chg_chr = ord(chr) + N - Num_AtoZ -1
    else:
        chg_chr = ord(chr) + N
    #print("chg_chr is", chg_chr)
    return chg_chr


for i in range(len(S)):
    tmp_chr = S[i]
    print(chr(chr_change(tmp_chr, N)), end = "")
print("\n")
day=input()
resMax=0
resTemp=0
for i in range(len(day)):
  if day[i]=='S':
    resTemp=0
  elif day[i]=='R':
    while(day[i]!='S'):
      resTemp+=1
      i+=1
  if resMax<resTemp:
    resMax=resTemp
print(resMax)
    

### FIXED CODE ###

day = input()
resMax = 0
resTemp = 0
for i in range(len(day)):
  if day[i]=='S':
    resTemp=0
  elif day[i]=='R':
    resTemp=0
    while (i<len(day)) and (day[i]!='S'):
      resTemp+=1
      i+=1
    if resTemp>resMax:
      resMax=resTemp
print(resMax)
def Ask(x):
    ans = 0
    while (x):
        ans += x % 10
        x //= 10
    return ans

def Check(x, y):
    return x * Ask(y) > y * Ask(x)


k = int(input())
no = st = 1
while (k):
    k -= 1
    print(no)
    if (Check(no + st, no + st * 10)): st *= 10
    no += st

### FIXED CODE ###

n, k = map(int, input().split())
print((n - 2) // (k - 1) + 1)
from collections import *
H,W=map(int,input().split())
S=[input() for i in range(H)]
count=0
stack=deque([[0,0,0,S[0][0]=="#"]])
RuiW=[[0] for i in range(H)]
RuiH=[[0] for i in range(W)]
if S[0][0]=="#":
    RuiW[0][0]=1
    RuiH[0][0]=1

for h in range(H):
    flag=0
    for w in range(1,W):
        RuiW[h].append(RuiW[h][-1]+bool(S[h][w]=="#" and S[h][w-1]=="."))
for w in range(W):
    for h in range(1,H):
        RuiH[w].append(RuiH[w][-1]+bool(S[h][w]=="#" and S[h-1][w]=="."))

Range=range(1,100)
idle_max=10**9
visited=[[idle_max for i in range(W)] for m in range(H)]
#print(RuiW)
#print(RuiH)
while stack:
    h,w,m,Flag=stack.popleft()
    if visited[h][m]<m:
        continue
    for i in Range:
        if h+i>=H:
            break
        M=RuiH[w][h+i]-(RuiH[w][h]-RuiH[w][h]%2)+m

        if visited[h+i][w]>M:
            visited[h+i][w]=M
            stack.append([h+i,w,M,0])
    for i in Range:
        if w+i>=W:
            break
        M=RuiW[h][w+i]-(RuiW[h][w]-RuiW[h][w]%2)+m
        if visited[h][w+i]>M:
            visited[h][w+i]=M
            stack.append([h,w+i,M,0])
#print(visited)
print(visited[-1][-1])


### FIXED CODE ###

from collections import *
from heapq import *
H,W=map(int,input().split())
S=[input() for i in range(H)]
if S[0][0]=="#":
    count=1
else:
    count=0
idlemax=10**5
visited=[[idlemax for w in range(W)] for h in range(H)]
stack=deque([[0,0,bool(S[0][0]=="#")*1,bool(S[0][0]=="#")*1]])
while stack:

    h,w,m,flag=stack.popleft()
    if m>visited[h][w]:
        continue
    for y,x in [[0,1],[1,0]]:
        Y=h+y;X=w+x
        if Y<H and X<W:
            if flag:
                if visited[Y][X]>m:
                    if S[Y][X]==".":
                        nflag=0
                    else:
                        nflag=1
                    visited[Y][X]=m
                    stack.append([Y,X,m,nflag])
            else:
                if S[Y][X]=="#":
                    nflag=1
                    M=m+1
                else:
                    nflag=0
                    M=m
                if visited[Y][X]>M:
                    visited[Y][X]=M
                    stack.append([Y,X,M,nflag])
#print(visited)
print(visited[-1][-1])
x,k,d = map(int,input().split())
x = abs(x)
if (x<=k*d):
  print(x-k*d)
else:
  if((k-x//d)%2==1):
    print(abs(x-(x//d;1)*d))
  else:
    print(abs(x-(x//d)*d))

### FIXED CODE ###

x,k,d = map(int,input().split())
x = abs(x)
jud = x//d
if(k<=jud):
  print(abs(abs(x)-d*k))
else:
  if((k-jud)%2 == 1):
    print(abs(abs(x)-(jud+1)*d))
  else:
    print(abs(abs(x)-(jud)*d))
factorial = [0] * 2000
factorial[0] = 1
factorial[1] = 1
for i in range(2, 2000):
    factorial[i] = i * factorial[i - 1]


def combination(n, r):
    return factorial[n] / (factorial[r] * factorial[n - r])


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

for i in range(k):
    x = int(combination(n - k + 1, i + 1) % MOD)
    y = int(combination(k - 1, i) % MOD)
    print(x * y % MOD)

### FIXED CODE ###

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

inv = [0] * 2000
inv[1] = 1
for i in range(2, 2000):
    inv[i] = (MOD - (MOD // i) * inv[MOD % i] % MOD) % MOD

fact = [0] * 2000
finv = [0] * 2000
fact[0] = 1
finv[0] = 1
for i in range(1, 2000):
    fact[i] = (i * fact[i - 1]) % MOD
    finv[i] = (inv[i] * finv[i - 1]) % MOD


def modcomb(n, r):
    if n < r or r < 0:
        return 0
    return fact[n] * finv[r] % MOD * finv[n - r] % MOD


for i in range(k):
    x = modcomb(n - k + 1, i + 1)
    y = modcomb(k - 1, i)
    print(x * y % MOD)
a = [int(i) for i in input().split()] 
if a[0] == 1:
  a[0] = a[0] +13
if a[1] ==1:
  a[1] = a[1] + 13
if a[0] > a[1]:
  print("Alice")
elif a[0] < a[1]:
  print("Bob")
else
  print("Draw")

### FIXED CODE ###

a = [int(i) for i in input().split()] 
if a[0] == 1:
  a[0] = a[0] + 13

if a[1] == 1:
  a[1] = a[1] + 13

  
if a[0] > a[1]:
  print("Alice")
elif a[0] < a[1]:
  print("Bob")
else:
  print("Draw")
import sys
input = sys.stdin.readline #高速化期待
from collections import deque

def main():
    N = int(input())
    A = [deque()] + [deque( map( int, input().split())) for _ in range(N)]
    NOW = [0]*(N+1)
    Days = [0]*(N+1)
    q = deque( [ i+1 for i in range(N)])
    while q:
      i = q.popleft()
      if not A[i]:
        continue
      
      a = A[i].popleft()
      
      if NOW[a] == i:
        NOW[a] = 0
        Days[a] = Days[i] = max((Days[i], Days[a])) + 1
        q.apppend(i)
        q.apppend(a)
      else:
        NOW[i] = a
    for i in range(N+1):
      if A[i]:
        print(-1)
        return
    print(max(Days))
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline #高速化期待
from collections import deque

def main():
    N = int(input())
    A = [deque()] + [deque( map( int, input().split())) for _ in range(N)]
    NOW = [0]*(N+1)
    Days = [0]*(N+1)
    q = deque( [ i+1 for i in range(N)])
    while q:
      i = q.popleft()
      if not A[i]:
        continue
      
      a = A[i].popleft()
      
      if NOW[a] == i:
        NOW[a] = 0
        Days[a] = Days[i] = max((Days[i], Days[a])) + 1
        q.append(i)
        q.append(a)
      else:
        NOW[i] = a
    for i in range(N+1):
      if A[i]:
        print(-1)
        return
    print(max(Days))
if __name__ == '__main__':
    main()
S = input()
N = len(S)
ans = 0
for i in range(N):
  for j in range(i, N):
    for c in S[i:j+1]:
    if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
      ans = max(ans, j - i + 1)
print(ans)

### FIXED CODE ###

S = input()
N = len(S)
ans = 0
for i in range(N):
  for j in range(i, N):
    if all('ACGT'.count(c) == 1 for c in S[i : j + 1]):
      ans = max(ans, j - i + 1)
print(ans)
N = int(input())
A = []
for i in range(N):
    a = int(input())
    A.append(a)
    
    
B = []
B.append(A[0])
pre = A[0]
cnt = 0
for i in range(1, len(A)):
    if A[i] > B[cnt] and A[i] > pre:
        pre = A[i]
    elif A[i] <= pre:
        if A[i] <= B[cnt]:
            pre = A[i]
            B.append(A[i])
            cnt += 1
        else:
            del B[-1]
            if A[i] > max(B):
                pre = A[i]
            else:
                cnt += 1
                pre = A[i]
print(cnt+1)

### FIXED CODE ###

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

A = [0] + A
for i in range(N//2, 0, -1):
    A[i] = sum(A[i::i])%2
ans = [i for i in range(N+1) if A[i]]
print(len(ans))
print(*ans)
n, k = map(int, input().split())
s = int(input())

cnt = 0
for i in range(n-1):
    if s[i] != s[i+1]:
        cnt += 1
ans = min(count+2*k, n-1)
print(ans)

### FIXED CODE ###

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

cnt = 0
for i in range(n-1):
    if s[i] == s[i+1]:
        cnt += 1
ans = min(cnt+2*k, n-1)
print(ans)
# To change this license header, choose License Headers in Project Properties.
# To change this template file, choose Tools | Templates
# and open the template in the editor.

__author__ = "c0117054"
__date__ = "$2019/02/18 19:31:49$"

if __name__ == "__main__":

    a=int(input('>>'))
    b=int(input('>>'))
    
    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)