Harryxun/stf_run huggingface dataset:
n,m = map(int, input().split())
a = list(map(int, input().split()))
a = sorted(a)

a_count = [0]*110000
a_sum = [0]*110000

for i in range(n):
    a_count[a[i]] += 1
    a_sum[a[i]] += a[i]

for i in range(100005,0,-1):
    a_count[i] += a_count[i+1]
    a_sum[i] += a_sum[i+1]

def chk(x):
    case = 0
    for i in range(n):
        if x-a[i] <= 1:
            case += n
        else:
            case += a_count[x-a[i]]
    if case >= m:
        ch = True
    else:
        ch = False
    return ch


l = 2*a[-1]+1    #NG
r = 1 #OK

while abs(r-l) > 1:
    kk = (r+l)//2
    if chk(kk):
        r = kk
    else:
        l = kk

ans = 0
sm = sum(a)

l = r

from bisect import bisect_left
from bisect import bisect_right

case = 0
for i in range(n):
    num = n-bisect_right(a,l-a[i]-1)
    case += num
    ans += num*a[i]*2

ans -= (case-m)*l

print(ans)

### FIXED CODE ###

from bisect import bisect_left
from bisect import bisect_right

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

a_count = [0]*110000
a_sum = [0]*110000

for i in range(n):
    a_count[a[i]] += 1
    a_sum[a[i]] += a[i]

for i in range(100005,0,-1):
    a_count[i] += a_count[i+1]
    a_sum[i] += a_sum[i+1]

def chk(x):
    case = 0
    for i in range(n):
        case += n-bisect_right(a,x-a[i]-1)
    if case >= m:
        ch = True
    else:
        ch = False
    return ch


l = 2*a[-1]+1    #NG
r = 1 #OK

while abs(r-l) > 1:
    kk = (r+l)//2
    if chk(kk):
        r = kk
    else:
        l = kk

ans = 0
sm = sum(a)

l = r

case = 0
for i in range(n):
    num = n-bisect_right(a,l-a[i]-1)
    case += num
    ans += num*a[i]*2

ans -= (case-m)*l

print(ans)
import math
n,k = map(int,input().split())
twos = [1]
i = 0
while 2*twos[i] <= 10**5:
    twos.append(twos[i]*2)
    i += 1

ans = 0
for i in range(1,n+1):
    temp = 0
    while twos[temp] * i <= k-1:
        temp += 1
    ans += 1/n * 1/twos[temp]
print(ans)

### FIXED CODE ###

import math
n,k = map(int,input().split())
twos = [1]
i = 0
while 2*twos[i] <= 10**5:
    twos.append(twos[i]*2)
    i += 1
twos.append(twos[-1]*2)

ans = 0
for i in range(1,n+1):
    temp = 0
    while twos[temp] * i <= k-1:
        temp += 1
    ans += 1/n * 1/twos[temp]
print(ans)
import numpy as np

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

ST=[]
for i in range(a):
    k=int(input())
    ST.append([k,0,0])
for i in range(b):
    k=int(input())
    ST.append([k,1,0])

ST.sort()

le0=-1
le1=-1
ri0=1
ri1=1

for i in range(a+b):
    if ST[i][1]==0 :
        pa=1
        
        moyori=np.inf

        if le1>=0:
            moyori=min(moyori,abs(ST[i][0]-ST[le1][0]))
        if ri1<=i :
            ri1=i+1
            while ri1<=a+b-1 and ST[ri1][1]==ty :
                ri1+=1
        if ri1<=a+b-1:
            moyori=min(moyori,abs(ST[i][0]-ST[ri1][0]))
        ST[i][2]=moyori
        le0=i
    else:
        pa=0
        
        moyori=np.inf

        if le0>=0:
            moyori=min(moyori,abs(ST[i][0]-ST[le0][0]))
        if ri0<=i :
            ri0=i+1
            while ri0<=a+b-1 and ST[ri0][1]==ty :
                ri0+=1
        if ri0<=a+b-1:
            moyori=min(moyori,abs(ST[i][0]-ST[ri0][0]))
        ST[i][2]=moyori
        le1=i



#print(ST)

for i in range(q):
    k=int(input())
    ST.append([k,2,0,i])

ST.sort()

ANS=[]
le0=-1
le1=-1
ri0=1
ri1=1
for i in range(a+b+q):
    if ST[i][1]==0 :
        le0=i
    elif ST[i][1]==1 :
        le1=i
    elif ST[i][1]==2 :
        moyori=np.inf
    
            
        if le0>=0:
            moyori=min(moyori,abs(ST[i][0]-ST[le0][0])+ST[le0][2])
            #print("L"+str(le[typ]))
            #print(moyori)
        if ri0<=i :
            ri0=i+1
            while ri0<=a+b+q-1 and (ST[ri0][1]==1 or ST[ri0][1]==2):
                ri0+=1
        if ri0<=a+b+q-1 :
            moyori=min(moyori,abs(ST[i][0]-ST[ri0][0])+ST[ri0][2])
            #print("R"+str(ri[typ]))
            #print(moyori)

        if le1>=0:
            moyori=min(moyori,abs(ST[i][0]-ST[le1][0])+ST[le1][2])
            #print("L"+str(le[typ]))
            #print(moyori)
        if ri1<=i :
            ri1=i+1
            while ri1<=a+b+q-1 and (ST[ri1][1]==0 or ST[ri1][1]==2):
                ri1+=1
        if ri1<=a+b+q-1 :
            moyori=min(moyori,abs(ST[i][0]-ST[ri1][0])+ST[ri1][2])
            #print("R"+str(ri[typ]))
            #print(moyori)



        ST[i][2]=moyori
        ANS.append([ST[i][3],moyori])

ANS.sort()

#print(ST)

for i in range(q):
    print(ANS[i][1])


### FIXED CODE ###

import bisect as bi

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

INF=10**15

S=[-INF]+[int(input()) for i in range(a)]+[INF]
T=[-INF]+[int(input()) for i in range(b)]+[INF]
X=[int(input()) for i in range(q)]

for i in range(q):
    d=bi.bisect_right(S,X[i])
    e=bi.bisect_right(T,X[i])
    as0=abs(X[i]-S[d-1])
    as1=abs(X[i]-S[d])
    at0=abs(X[i]-T[e-1])
    at1=abs(X[i]-T[e])
    ans=min(max(as0,at0),max(as1,at1),2*as0+at1,as0+2*at1,2*at0+as1,at0+as1*2)
    print(ans)
x = int(input(""))

if x >= 30:
    print("Yes")
Else:
    print("No")

### FIXED CODE ###

x = int(input(""))

if x >= 30:
    print("Yes")
else:
    print("No")
h,w = map(int, input().split())
c = []
a = []
for i in range(10):
  c.append(list(map(int, input().split())))
for i in range(h):
  a.append(list(map(int, input().split())))

for k in range(10):
  for i in range(10):
    for j in range(10):
      c[i][j] = min(c[i][j]), c[i][k] + c[k][j])
      
ans = 0
for i in range(h):
  for j in range(w):
    if a[i][j] != -1:
      ans += c[a[i][j]][1]


### FIXED CODE ###

h,w = map(int, input().split())
c = []
a = []
for i in range(10):
  c.append(list(map(int, input().split())))
for i in range(h):
  a.append(list(map(int, input().split())))
 
for k in range(10):
  for i in range(10):
    for j in range(10):
      c[i][j] = min(c[i][j], c[i][k] + c[k][j])
      
ans = 0
for i in range(h):
  for j in range(w):
    if a[i][j] != -1:
      ans += c[a[i][j]][1]
print(ans)
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import numpy

def main():
  n = input().strip()[::-1]
  dp = numpy.zeros((len(n), 2), dtype=numpy.int)
  dp[0][0] = int(n[0])
  dp[0][1] = 10 - int(n[0])
  for i, d in enumerate(map(int, n[1:]), 1):
    dp[i][0] = min(dp[i-1][0] + d,      dp[i-1][1] + 1 + d)
    dp[i][1] = min(dp[i-1][0] + 10 - d, dp[i-1][1] + 10 - (d + 1))
  print(min(dp[-1][0], dp[-1][1]+1))  

if __name__=='__main__':
  main()



### FIXED CODE ###

#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n = input().strip()[::-1]
  dp = [[0, 0] for _ in range(len(n))]
  dp[0][0] = int(n[0])
  dp[0][1] = 10 - int(n[0])
  for i, d in enumerate(map(int, n[1:]), 1):
    dp[i][0] = min(dp[i-1][0] + d,      dp[i-1][1] + 1 + d)
    dp[i][1] = min(dp[i-1][0] + 10 - d, dp[i-1][1] + 10 - (d + 1))
  print(min(dp[-1][0], dp[-1][1]+1))  

if __name__=='__main__':
  main()
# -*- coding: utf-8 -*-
'''
11 3 2
ooxxxoxxxoo
'''

import numpy as np

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

oks = [idx for idx, i in enumerate(S) if i == 'o']
# print(oks)

for ok in oks:
    temp = oks.copy()
    temp.remove(ok)
    temp = np.array(temp)
    cnt = 0

    while True:
        if len(temp) == 0:
            print(ok + 1)
            break
        val = temp[0]
        temp = temp[temp > val + C]
        cnt += 1
        if cnt >= K:
            break


### FIXED CODE ###

a, b, c = map(int, input().split())
print(c, a, b)
n,k = map(int,input().split())
l = [int(input()) for i in range(n)]
l.sort()
ans = l[-1]
for i in range(n-k):
  ans = min(ans,l[i+k]-l[i])
  if ans = 0
  print(0)
  exit()
  
print(ans)
  

### FIXED CODE ###

n,k = map(int,input().split())
l = [int(input()) for i in range(n)]
l.sort()
ans = l[-1]
for i in range(n-k+1):
  ans = min(ans,l[i+k-1]-l[i])
  if ans == 0:
    print(0)
    exit()
  
print(ans)
# -*- coding:utf-8 -*-

import sympy
import math
from functools import reduce

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

def lcm_base(x, y):
	return (x * y) // math.gcd(x, y)
	
def lcm_list(numbers):
	return reduce(lcm_base, numbers, 1)
	
lcmNum = lcm_list(ANs)
lcmList = sympy.factorint(lcmNum)
#print(lcmNum)
#print(lcmList)


anss = []
f = 0
for a in ANs:
	f += (lcmNum-1)%a
print(f)

### FIXED CODE ###

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

m_1 = 0
for a in ANs:
	m_1 += a-1
	
print(m_1)
x = int(input())
slime = str(input())
i = 0
scount = 0
while(i < n-1):
    if(slime[i] != slime[i+1]):
        scount += 1
    i += 1
print(scount)

### FIXED CODE ###

x = int(input())
slime = str(input())
i = 0
scount = 1
while(i < x-1):
    if(slime[i] != slime[i+1]):
        scount += 1
    i += 1
print(scount)
N = int(input())
S = input()
cnt = 0
ans = 0
for i in range(N):
    if S[i] == "A":
        if cnt == 0:
            cnt += 1
        else:
            cnt = 1
    if S[i] == "B":
        if cnt == 1:
            cnt += 1
        else:
            cnt = 0
    if S[i] == "C":
        if cnt == 2:
            ans += 1
            cnt = 0
        else:
            cnt = 0

print(ans)

### FIXED CODE ###

K, X = map(int,input().split())
if 500 * K >= X:
    print("Yes")
else:
    print("No")
import bisect
n, m = list(map(int, input().split(' ')))
aaa = list(map(int, input().split(' ')))
aaa = sorted([-a for a in aaa])
len_aaa = len(aaa)

cccbbb = []
for i in range(m):
    b, c = list(map(int, input().split(' ')))
    cccbbb.append((-c, b))
cccbbb = sorted(cccbbb)
for c, b in cccbbb:
    index = bisect.bisect_left(aaa, c)
    if index < len_aaa:
        if b < len_aaa - index + 1:
            ccc = [c] * b
            aaa = (aaa[:index] + ccc + aaa[index:len(aaa) - b])
        else:
            ccc = [c] * (len_aaa - index)
            aaa = (aaa[:index] + ccc)
        print(aaa)
    else:
        break
print(abs(sum(aaa)))

### FIXED CODE ###

import bisect
n, m = list(map(int, input().split(' ')))
aaa = list(map(int, input().split(' ')))
aaa = sorted([-a for a in aaa])[::-1]
len_aaa = len(aaa)

cccbbb = []
for i in range(m):
    b, c = list(map(int, input().split(' ')))
    cccbbb.append((-c, b))
cccbbb = sorted(cccbbb)
ccc = []
for c, b in cccbbb:
    ccc += [c] * b
    if len(ccc) > len_aaa:
        break
ans = 0
for i in range(len_aaa):
    c = ccc[i] if i < len(ccc) else 0
    ans += min(aaa[i], c)
print(abs(ans))
import math
K = int(input())
s = 0
for a in range(1,K+1):
  for b in range(1,K+1):
    x = math.gcd(a,b)
    for c in range(1,K+1):
      s += gcd(x,c)
print(s)

### FIXED CODE ###

import math
K =int(input())
L = [0 for _ in range(K)]
for a in range(1,K+1):
  for b in range(1,K+1):
    L[math.gcd(a,b)-1] +=1
s = 0
for c in range(1,K+1):
    for k in range(K):
        for _ in range(L[k]):
            s += math.gcd(c,k+1)
print(s)
import math
 
a= int(input)
 
print(2 * a * math.pi)

### FIXED CODE ###

import math
 
a= int(input())
 
print(2 * a * math.pi)
a = input()

t, c = int(a.split(" ")[0]), int(a.split(" ")[1])

if not c:
    print(t)

b = input()
lst = [int(x) for x in b.split(" ")]

for i in range(c):
    if t - i not in lst:
        print(t - i)
        break
    if t + i not in lst:
        print(t + i)
        break


### FIXED CODE ###

a = input()

t, c = int(a.split(" ")[0]), int(a.split(" ")[1])

if not c:
    print(t)
else:
    b = input()
    lst = [int(x) for x in b.split(" ")]

    for i in range(c+2):
        if t - i not in lst:
            print(t - i)
            break
        if t + i not in lst:
            print(t + i)
            break
def memoize(f):
    cache={}
    def helper(*args):
        if args not in cache:
            cache[args] = f(*args)
        return cache[args]
    return helper

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

@memoize
def f(n):
    if n==1:
        return 0
    elif n==2:
        return abs(h[1]-h[0])
    elif n==3:
        return abs(h[2]-h[0])
    else:
        return min(f(n-1)+abs(h[n-1]-h[n-2]),f(n-2)+abs(h[n-1]-h[n-3]))

print(f(N))


### FIXED CODE ###

def memoize(f):
    cache={}
    def helper(*args):
        if args not in cache:
            cache[args] = f(*args)
        return cache[args]
    return helper

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

import sys
sys.setrecursionlimit(1000000)

@memoize
def f(n):
    if n==1:
        return 0
    elif n==2:
        return abs(h[1]-h[0])
    elif n==3:
        return abs(h[2]-h[0])
    else:
        return min(f(n-1)+abs(h[n-1]-h[n-2]),f(n-2)+abs(h[n-1]-h[n-3]))

print(f(N))
S1, S2, S3 = map(str,input().split())
input_sum = str(S1+S2+S3)

print(input_sum.count("1"))

### FIXED CODE ###

print(input().count("1"))
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)

### 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)
import sys
import math
from collections import deque
import copy

N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]
INF = 10 ** 9 + 7
dp = [[INF for _ in range(N * 300 + 1)] for _ in range(N + 1)]

for i in dp:
    i[0] = 0
for i in range(1, wv[0][1]+1):
    dp[1][i] = wv[0][0]

for i in range(2, N + 1):
    for l in range(1, N * 300 + 1):
        if l - wv[i - 1][1] >= 0:
            dp[i][l] = min(dp[i - 1][l], dp[i - 1][l - wv[i - 1][1]] + wv[i - 1][0])
        elif dp[i][l] == 10**9+7:
            dp[i][l] = min(wv[i-1][0], dp[i-1][l])
        else:
            dp[i][l] = dp[i - 1][l]
for i, l in enumerate(dp[-1]):
    if l <= W < dp[-1][i + 1]:
        print(i)
        break



### FIXED CODE ###

import sys
import math
from collections import deque
import copy

INF = 10 ** 9 + 7
N, W = map(int, input().split())
weight = []
value = []
for i in range(N):
    tempW, tempV = map(int, input().split())
    weight.append(tempW)
    value.append(tempV)

dp = [[INF for _ in range(N * 1000 + 1)] for _ in range(N + 1)]
dp[0][0] = 0

for i in range(1, N + 1):
    for l in range(N * 1000 + 1):
        if l - value[i - 1] >= 0:
            dp[i][l] = min(dp[i - 1][l], dp[i - 1][l - value[i - 1]] + weight[i - 1])
        else:
            dp[i][l] = dp[i - 1][l]
for i in range(N * 1000 + 1):
    if dp[N][i] <= W:
        ans = i
print(ans)
N = int(input())
nums = [int(x) for x in input().split()]
cnt = 0
loop = True
if loop:
  if not all([n%2 is 0 for n in nums]):
    break
  for i, n in enumerate(nums):
    nums[i] = n//2
  cnt +=1
print(cnt)

### FIXED CODE ###

N = int(input())
nums = [int(x) for x in input().split()]
cnt = 0
loop = True
while loop:
  if not all([n % 2 is 0 for n in nums]):
    loop = False 
    break
    
  for i, n in enumerate(nums):
    nums[i] = n//2
  cnt += 1
print(cnt)
import math
n = int(input())
arr = []
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
        cnt=0
        while temp%i==0:
            cnt+=1
            temp //= i
        arr.append(cnt)

if temp!=1:
    arr.append(1)
if arr==[]:
    arr.append(1)
for i in range(len(arr)):
    if arr[i] == 1:
        arr[i] = 1
    else:
        s = (-1+math.sqrt(1+8*arr[i]))/2
        arr[i] = s
if n = 1:
    print(0)
else:
    print(int(sum(arr)))

### FIXED CODE ###

import math
N = int(input())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append(cnt)

    if temp!=1:
        arr.append(1)

    if arr==[]:
        arr.append(1)

    return arr
A = factorization(N)
if N == 1:
    print(0)
else:
    for i in range(len(A)):
        if A[i] == 1:
            A[i] = 1
        else:
            s = (-1+int(math.sqrt(1+8*A[i])))/2
            A[i] = int(s)
    print(int(sum(A)))
def solve(N):
    ans = []
    for i in range(1, int(N**0.5)):
        if N % i == 0:
            ans.append(i+N//i-2)
    return min(ans)

N = int(input())
ans = solve(N)
print(ans)

### FIXED CODE ###

def solve(N):
    ans = []
    for i in range(1, int(N**0.5)+1):
        if N % i == 0:
            ans.append(i+N//i-2)
    return min(ans)

N = int(input())
ans = solve(N)
print(ans)
product = []

for i in range(1,10):
    for j in range(1,10):
        product.append(i * j)

if N in product:
    result = 'Yes'
else:
    result = 'No'

print(result)


### FIXED CODE ###

N = int(input())

product = []

for i in range(1,10):
    for j in range(1,10):
        product.append(i * j)

if N in product:
    result = 'Yes'
else:
    result = 'No'

print(result)
S = input()
T = input()
m = len(S)
n = len(T)

ans = 0
if m >= n:
    for i in range(m+1-n):
        for j in range(n):
            if S[i+j] != T[j] and S[i+j] != "?":
                break
        else:
            S = S[0:i] + T + S[i+n+1:]
            ans = 1

if ans == 1:
    print(S.replace("?", "a"))
else:
    print("UNRESTORABLE") 

### FIXED CODE ###

S = input()
T = input()
m = len(S)
n = len(T)

Sa = []

if m >= n:
    for i in range(m+1-n):
        for j in range(n):
            if S[i+j] != T[j] and S[i+j] != "?":
                break
        else:
            s = S[:i] + T + S[i+n:]
            Sa.append(s.replace("?", "a"))
            

if Sa:
    print(min(Sa))
else:
    print("UNRESTORABLE")
N,K =map(int,input().split())
arr = [int(x) for x in input().split()]
ps = []
ms = []
for i in range(N):
    if arr[i] == 0:
        K -= 1
    elif arr[i] < 0:
        ms.append(abs(arr[i]))
    elif arr[i] > 0:
        ps.append(arr[i])
ms = ms[::-1]
if K <= 0:
    ans = 0
else:
    ans = ps[K-1] if K <= len(ps) else 10**18
    ans = min(ans,ms[K-1]) if K <= len(ms) else ans
if len(ps) > 0 and len(ms) > 0:
    for i in range(K):
        if i == len(ms):
            break
        ans = min(ans,ms[i]*2 + ps[K-(i+1)-1])
    for i in range(K):
        if i == len(ps):
            break
        ans = min(ans,ps[i]*2 + ms[K-(i+1)-1])
print(ans)
    

### FIXED CODE ###

N, K = map(int, input().split())
arr = [int(x) for x in input().split()]
ps = []
ms = []
for i in range(N):
    if arr[i] == 0:
        K -= 1
    elif arr[i] < 0:
        ms.append(abs(arr[i]))
    elif arr[i] > 0:
        ps.append(arr[i])
ms = ms[::-1]
if K <= 0:
    ans = 0
else:
    ans = ps[K-1] if K <= len(ps) else 10**18
    ans = min(ans, ms[K-1]) if K <= len(ms) else ans
if len(ps) > 0 and len(ms) > 0:
    for i in range(len(ms)):
        if K-(i+1)-1 < len(ps):
            ans = min(ans, ms[i]*2 + ps[K-(i+1)-1])
    for i in range(len(ps)):
        if K-(i+1)-1 < len(ms):
            ans = min(ans, ps[i]*2 + ms[K-(i+1)-1])
print(ans)
x,y = map(int, input().split())
S = X * y
L = 2 * (x + y)
print(S + " " + L)
 

### FIXED CODE ###

a,b = map(int, input().split())
S = a * b
L = 2 * (a + b)
print(str(S) + " " + str(L))
N = int(input())
ln = [i for i in range(1,N+1)]
for i in range(N):
  if ln[i] % 3 == 0:
    nl.pop(i)
  elif ln[i] % 5 == 0:
    nl.pop(i)
  elif ln[i] % 15 == 0:
    nl.pop(i)
print(sum(nl))

### FIXED CODE ###

N = int(input())
ln = [i for i in range(1,N+1)]

for i in range(N):
  if ln[i] % 3 == 0:
    ln[i] = 0
  elif ln[i] % 5 == 0:
    ln[i] = 0
  elif ln[i] % 15 == 0:
    ln[i] = 0
print(sum(ln))
from functools import lru_cache
mod=10**9+7
n,m=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
#dp=[ [0 for _ in range(m)] for _ in range(n)]
@lru_cache(None)
def solve(i,j):
    if i==0 and j==0:
        if s[i]==t[j]:
            return 1
        else:
            return 0
    if i<0 or j<0:
        return 0
    ret=0
    ret=solve(i-1,j)+solve(i,j-1)-solve(i-1,j-1)
    ret%=mod
    if s[i]==t[j]:
        ret+=1+solve(i-1,j-1)
    return ret%mod
print((solve(n-1,m-1)+1)%mod)



### FIXED CODE ###

import sys
mod=10**9+7
input=sys.stdin.buffer.readline
n,m=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
dp=[ [0 for _ in range(m)] for _ in range(n)]
for i in range(0,n):
    for j in range(0,m):
        ret=0
        if i-1>=0:
            ret+=dp[i-1][j]
        if j-1>=0:
            ret+=dp[i][j-1]
        if i-1>=0 and j-1>=0:
            ret-=dp[i-1][j-1]
        if s[i]==t[j]:
            ret+=1
            if i-1>=0 and j-1>=0:
                ret+=dp[i-1][j-1]
        if ret>=mod:
            ret%=mod
        if ret<0:
            ret+=mod
        dp[i][j]=ret
print((dp[n-1][m-1]+1))
import sys

args = sys.argv

if(args[1]>8 or args[2]>8):
    print(":(")
else:
    print("Yay!")

### FIXED CODE ###

args = (input())
a = int( args.split(" ")[0])
b = int(args.split(" ")[1])

if(a>8 or b>8):
    print(":(")
else:
    print("Yay!")
n, m = list(map(int, input().split()))
# a, b, c = list(map(int, input().split()))
a = [int(input()) for i in range(m)]

mod = pow(10, 9)+7
point = [0]*(n+1)
point[0] = 1
j = 0
if 1 in a:
    point[1] = 0
    j += 1
else:
    point[1] = 1

if m == 0:
    a = [0]

for i in range(2, n+1):
    if i == a[j]:
        if j < m-1:
            j += 1
    else:
        point[i] = point[i-1]+point[i-2]
        point[i] %= mod

print(point[-1] % mod)


### FIXED CODE ###

n, m = list(map(int, input().split()))
# a, b, c = list(map(int, input().split()))
a = [int(input()) for i in range(m)]

mod = pow(10, 9)+7
point = [0]*(n+1)
point[0] = 1
j = 0
if 1 in a:
    point[1] = 0
    if m >= 2:
        j += 1
else:
    point[1] = 1

if m == 0:
    a = [0]

for i in range(2, n+1):
    if i == a[j]:
        if j < m-1:
            j += 1
    else:
        point[i] = point[i-1]+point[i-2]
        point[i] %= mod

print(point[-1] % mod)
L, N = map(int, raw_input().split())
if L > 100 or L < 1:
 print 'error'
 exit()
if N > 100 or N < 1:
 print 'error'
 exit()
 
 
input = []
for i in range(0, N):
 sentence = raw_input()
 if len(sentence) != L:
  print 'error'
  exit()
 for j in range(0, L):
  if sentence[j] < 'a' or sentence[j] > 'z':
   print 'error'
   exit()
 input.append(sentence)
for x in sorted(input):
    print x

### FIXED CODE ###

input = map(int, raw_input().split())
ans = [5, 7, 5]
for data in input:
 if int(data) < 1 or int(data) > 10:
  print 'error'
  exit()
for data in input:
 if data in ans:
   ans.remove(data)
if len(ans) == 0:
 print 'YES'
else:
 print 'NO'
D = int(input())
T = int(input())
S = int(input())

res = D/S
if(res <= T):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

D, T, S = map(int,input().split())

if(D/S <= T):
    print("Yes")
else:
    print("No")
from fraction import gcd
from functools import reduce

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

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcm = lcm_list(a)
aa = []
for i in range(len(a)):
    aa.append(lcm // a[i])
ans = sum(aa) % 1000000007
print(ans)

### FIXED CODE ###

# from math import gcd
from fractions import gcd
from functools import reduce

def lcm_list(numbers):
    return reduce(lambda x, y: (x * y) // gcd(x, y), numbers, 1)

def main():
    n = int(input())
    a = [int(x) for x in input().split()]
    lcm = lcm_list(a)
    aa = []
    for i in range(len(a)):
        aa.append(lcm // a[i])
    ans = sum(aa) % 1000000007
    print(ans)

if __name__ == '__main__':
    main()
S = input()
T = input()

L = 0
judge = False

for i in range(len(T), 0, -1):
    # print(i)
    for j in range(len(T)-i+1):
        print(S[j:])
        if T[j:j+i] in S[j:]:
            L = i
            # print(T[j:j+i])
            judge = True
            # print(i, j)
            break
    if judge:
        break

print(len(T)-L)


### FIXED CODE ###

S = input()
T = input()

ls = len(S)
lt = len(T)
ans = lt

for i in range(ls-lt+1):
    cnt = 0
    for j in range(lt):
        if S[j+i] != T[j]:
            cnt += 1
    ans = min(ans, cnt)

print(ans)
import sys
a = int(input())
b = int(input())

max = a + b

if a - b > max:
    print(a-b)
elif a*b > max:
    print(a*b)
else:
    print(max)

### FIXED CODE ###

import sys
a,b=map(int, input().split())

if a-b > a+b:
    if a-b > a*b:
        print(a-b)
    else:
        print(a*b)
elif a*b > a+b:
    if a*b > a-b:
        print(a*b)
    else:
        print(a-b)
else:
    print(a+b)