Harryxun/stf_run huggingface dataset:
n, m = map(int, input().strip().split())
a = [[0 for j in range(m)] for i in range(n)]
b = [[0] for j in range(m)]
c = [[0] for j in range(n)]

for i in range(n):
    a[i] = list(map(int, input().strip().split()))

for i in range(m):
    b[i] = [int(input())]


for i in range(n):
    for j in range(m):
        c[0][i] += a[j][i]*b[0][j]
    print(c[0][i])

### FIXED CODE ###

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

for i in range(n):
    a[i] = list(map(int, input().strip().split()))

for i in range(m):
    b[i] = [int(input())]


for i in range(n):
    for j in range(m):
        c[i][0] += a[i][j]*b[j][0]
    print(c[i][0])
import numpy as np

N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
F = sorted(list(map(int, input().split())), reverse=True)

Asum = sum(A)

def test(X):
    return (Asum - np.minimum(A, X//F).sum() <= K)

l = -1
r = 10**13

while (l +1 < r):
    mid = (l + r) // 2
    if test(mid):
        r = mid
    else:
        l = mid

ans = r
print(ans)


### FIXED CODE ###

import numpy as np

N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))
F = sorted(list(map(int, input().split())), reverse=True)

A = np.array(A, np.int64)
F = np.array(F, np.int64)

Asum = sum(A)

def test(X):
    return (Asum - np.minimum(A, X//F).sum() <= K)

l = -1
r = 10**12

while (l + 1 < r):
    mid = (l + r) // 2
    if test(mid):
        r = mid
    else:
        l = mid

ans = r
print(ans)
n = int(input())

s = list(map(int, input().split()))
t = []
v = 0

for i in range(n):
  c = 1/s[i]
  t.append(c)
  
for j in range(n):
  v += t[j]
  
ans = 1/v

print(ans)

### FIXED CODE ###

a = int(input())

s = input()

if a >= 3200:
  print(s)
else:
  print('red')
n = int(inpur())

if n % 2 == 0:
  print(int(n/2))
else:
  print(int((n/2)+1))

### FIXED CODE ###

n = int(input())
 
if n % 2 == 0:
  print(int(n/2))
else:
  print(int((n/2)+1))
n = int(input())
v = list(map(int, input().split()))
#n = 3
#v = list(map(int, "500 300 200".split()))
v.sort()
ans = v[0]
for i in range(1,3):
    ans = (v[i] + ans)/2
print(ans)



### FIXED CODE ###

n = int(input())
v = list(map(int, input().split()))
#n = 3
#v = list(map(int, "500 300 200".split()))
v.sort()
ans = v[0]
for i in range(1,n):
    ans = (v[i] + ans)/2
print(ans)
N = int(input())
a = list(map(int,input().split()))
s = []
for i in range(1,101):
    b = sum((a[j]-i-1)**2 for j in range(N))
    s.append(b) 
print(min(b))


### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
s = []
for i in range(1,101):
    b = sum((a[j]-i)**2 for j in range(N))
    s.append(b) 
print(min(s))
n = str(input())
if n[0]='7' or n[1]='7' or n[2]='7':
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = str(input())
a=n[0]
b=n[1]
c=n[2]

if a=='7' or b=='7' or c=='7':
  print("Yes")
else:
  print("No")
import math
a, b,c = map(float, input().split())
if c - a - b > 0 or 4*a*b < (c - a - b)**2
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a, b,c = map(int, input().split())
if (0 < c - a - b) and (4*a*b < (c - a - b)*(c - a - b)):
    print("Yes")
else:
    print("No")
w,h,n = map(int,input().split())
lx,hx,ly,hy = 0,w,0,h
for i in range(n):
  x,y,a = map(int,input().split())
  if a == 1:
    lx = max(lx, x)
  elif a == 2:
    hx = min(hx, x)
  elif a == 3:
    ly = max(ly, y)
  elif a == 4:
    hy = min(hy, y)
print(max(0,(hx-lx)*(hy-ly))

### FIXED CODE ###

w,h,n = map(int,input().split())
lx,hx,ly,hy = 0,w,0,h
for i in range(n):
  x,y,a = map(int,input().split())
  if a == 1:
    lx = max(lx, x)
  elif a == 2:
    hx = min(hx, x)
  elif a == 3:
    ly = max(ly, y)
  elif a == 4:
    hy = min(hy, y)
print(max(0, hx-lx) * max(0, hy-ly))
# -*- coding: utf-8

import sys


def leftside_reverse(s, turn):
    for num in range(len(s)):
        if s[num] == turn:
            break
        else:
            s[num] = turn

    return s


def rightside_reverse(s, turn):
    for num in range(len(s) - 1, -1):
        if s[num] == turn:
            break
        else:
            s[num] = turn

    return s


def function(s, first):
    count = 0
    turn = first

    while True:

        if s.count(first) == len(s):
            break

        if s[0] == turn:
            s = rightside_reverse(s, turn)
            count += 1
        else:
            s = leftside_reverse(s, turn)
            count += 1

        if turn == 'B':
            turn = 'W'
        else:
            turn = 'B'

    return count


if __name__ == '__main__':

    s = list(input())
    b = 'B'
    w = 'W'

    if s.count(b) == len(s) or s.count(w) == len(s):
        print('0')
        sys.exit(1)

    b_count = function(s, b)
    w_count = function(s, w)

    print(min(b_count, w_count))


### FIXED CODE ###

# -*- coding: utf-8

s = list(input())
count = 0

if s.count('W') == len(s) or s.count('B') == len(s):
    print('0')
else:
    turn = s[len(s) - 1]
    s.pop()
    while s:
        if s[len(s) - 1] == turn:
            s.pop()
        else:
            count += 1
            if turn == 'B':
                turn = 'W'
            else:
                turn = 'B'
    print(count)
def triv(a, b, c):  
    if (a + b <= c) or (a + c <= b) or (b + c <= a) : 
        return False
    else: 
        return True  
count = 0
m = int(input())
arr = list(map(int,input()))
for i in range(len(arr)):
  for j in range(i,len(arr)):
    for x in range(j,len(arr)):
      if triv(i,j,x):
        count += 1
print(count)

### FIXED CODE ###

count = 0
n = int(input())
arr = list(map(int,input().split()))
arr.sort()
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if arr[i]==arr[j] or arr[i]==arr[k] or arr[j]==arr[k]:
        continue
      if arr[i]+arr[j]>arr[k]:
        count+=1
print(count)
a, b, c = map(input().split())
if b == +:
  print(a + c)
else:
  print(a - c)

### FIXED CODE ###

a, b, c = input().split()
a = int(a)
c = int(c)
if b == '+':
  print(a + c)
else:
  print(a - c)
N,M = map(int,input().split())
A = []
for i in range(N):
  A.append(list(input()))
B = []
for j in range(M):
  B.append(list(input()))
for k in range(N-M+1):
  for l in range(N-M+1):
    cnt = 0
    if B[0][0:M] == A[k][l:l+M]:
      p = k
      q = l
      for m in range(N-M+1):
        if B[m][0:M] == A[p+m][q:q+M]:
          cnt += 1
        if cnt == M:
          print('Yes')
          exit()
print('No')

### FIXED CODE ###

N,M = map(int,input().split())
A = []
for i in range(N):
  A.append(list(input()))
B = []
for j in range(M):
  B.append(list(input()))
for k in range(N-M+1):
  for l in range(N-M+1):
    cnt = 0
    if B[0][0:M] == A[k][l:l+M]:
      p = k
      q = l
      for m in range(M):
        if B[m][0:M] == A[p+m][q:q+M]:
          cnt += 1
        if cnt == M:
          print('Yes')
          exit()
print('No')
import math
r = int(input())
PI = math.pi
men = (r**2) * PI
sen = (r * 2) * PI
print('%.6f %.6f' % (men,sen))

### FIXED CODE ###

import math
PI = math.pi

r = input()
men = r*r * PI
sen = r*2 * PI

print('%.6f %.6f' % (men, sen))
N,Ma,Mb = map(int,input().split())
dp = [[[10**9 for i in range(400)] for j in range(400)] for k in range(N+1)]
dp[0][0][0] = 0
for i in range(1,N+1):
    a,b,c = map(int,input().split())
    for j in range(401):
        for k in range(401):
            if j < a:
                d[i][j][k] = d[i-1][j][k]
            else:
                if k < b:
                    d[i][j][k] = d[i-1][j][k]
                else:
                    d[i][j][k] = min(d[i-1][j][k],d[i-1][j-a][k-b] + c)
m = max(Ma,Mb)
import math
n = math.floor(400 / m)
ans = 10**9
for i in range(n):
    x = Ma*i
    y = Mb*i
    ans = min(dp[N][x][y])
print(ans)

### FIXED CODE ###

N,Ma,Mb = map(int,input().split())
dp = [[[10**9 for i in range(401)] for j in range(401)] for k in range(N+1)]
dp[0][0][0] = 0
for i in range(1,N+1):
    a,b,c = map(int,input().split())
    for j in range(401):
        for k in range(401):
            if j < a:
                dp[i][j][k] = dp[i-1][j][k]
            else:
                if k < b:
                    dp[i][j][k] = dp[i-1][j][k]
                else:
                    dp[i][j][k] = min(dp[i-1][j][k],dp[i-1][j-a][k-b] + c)
m = max(Ma,Mb)
import math
n = math.floor(400 / m)
ans = 10**9
for i in range(1,400):
    x = Ma*i
    y = Mb*i
    if x > 400:
        break
    if y > 400:
        break
    ans = min(dp[N][x][y],ans)
if ans == 10**9:
    print(-1)
    quit()
print(ans)
n = int(input())
a = map(int,input().split())
a.sort()
t = 1
 
for i in range(len(a)):
  t *= a[i]
  if t > 10**18:
    break

if t > 10**18 :
  print("-1")
else:
  print(str(t))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
t = 1
 
for i in range(len(a)):
  t *= a[i]
  if t > 10**18:
    break
 
if t > 10**18 :
  print("-1")
else:
  print(str(t))
n = int(import())
if n == 25:
  print("Christmas")
elif n == 24:
  print("Christmas Eve")
elif n == 23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")


### FIXED CODE ###

n = int(input())
if n == 25:
    print("Christmas")
elif n == 24:
    print("Christmas Eve")
elif n == 23:
    print("Christmas Eve Eve")
else:
    print("Christmas Eve Eve Eve")
start_num = 0
ans_num = 0
count = 0


if d == 0:
    start_num = 1
elif d == 1:
    start_num = 100
else:
    start_num = 10000


while not count == n:
    ans_num += start_num
    count += 1


print(ans_num)

### FIXED CODE ###

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

i = 0
count = 0
beki = 0


if d == 0:
    beki = 1
elif d == 1:
    beki = 100
else:
    beki = 10000


while not count == n:
    i += 1
    if i % 100 == 0:
        continue
    count += 1

print(i * beki)
N = int(input())
P = []
for i in range(N):
  P.append(int(input())
print(sum(P) - max(P) / 2)

### FIXED CODE ###

N = int(input())
P = []
for i in range(N):
  P.append(int(input()))
print(sum(P) - max(P) // 2)
a, b, c  = list(map(int, input().split()))
if len(set(a)) == 2:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a = list(map(int, input().split()))
if len(set(a)) == 2:
    print('Yes')
else:
    print('No')
n=int(input())
print(int((n-1)*n//2))

### FIXED CODE ###

#(A-1)n+1　とB

A,B=map(int,input().split())
n=0
while (A-1)*n+1 <B:
    n += 1
print(n)
S = input()
N = len(S)+1
a = [-1]*N
l = []
for i in range(1,N-1):
    if S[i-1] == '>' and S[i] == '<':
        a[i] = 0
        l.append(i)

for i in l:
    j = i-1
    while 0<=j<=N-2 and S[j]=='>' and S[j-1]=='>':
        a[j] = a[j+1]+1
        j -= 1
    j = i+1
    while 0<=j<=N-2 and S[j]=='<' and S[j+1]=='<':
        a[j] = a[j-1]+1
        j += 1

if S[0] == '>':
    a[0] = a[1]+1
else:
    a[0] = 0
if S[-1] == '<':
    a[N-1] = a[N-2]+1
else:
    a[N-1] = 0

for i in range(N):
    if a[i] == -1:
        a[i] = max(a[i-1],a[i+1])+1

print(sum(a))

### FIXED CODE ###

S = input()
N = len(S)+1
a = [-1]*N
l = []
for i in range(1,N-1):
    if S[i-1] == '>' and S[i] == '<':
        a[i] = 0
        l.append(i)

if S[0] == '<':
    a[0] = 0
    l.append(0)
if S[-1] == '>':
    a[N-1] = 0
    l.append(N-1)

for i in l:
    j = i-1
    while 0<=j<=N-2 and S[j]=='>' and S[j-1]=='>':
        a[j] = a[j+1]+1
        j -= 1
    j = i+1
    while 0<=j<=N-3 and S[j]=='<' and S[j+1]=='<':
        a[j] = a[j-1]+1
        j += 1

for i in range(1,N-1):
    if a[i] == -1:
        a[i] = max(a[i-1],a[i+1])+1


if S[0] == '>':
    a[0] = a[1]+1

if S[-1] == '<':
    a[N-1] = a[N-2]+1

print(sum(a))
a = sorted(list(int, input().split()))

print(a[0]*b[1])



### FIXED CODE ###

# coding: utf-8

a, b, c = map(int, input().split())
M = max(a,b,c)
x = a*b*c//(M*2)
print(x)
def solve(A, b):
    for i in xrange(3):
        if A[i][i] == 0.0:
            for j in xrange(i+1, 3):
                if A[j][i]!=0.0:
                    A[i], A[j] = A[j], A[i]
                    b[i], b[j] = b[j], b[i]
        for j in xrange(3):
            if i==j:
                continue
            a = A[j][i] / A[i][i]
            for k in xrange(3):
                A[j][k] -= a * A[i][k]
            b[j] -= a * b[i]
    for i in xrange(3):
        b[i] /= A[i][i]
        A[i][i] /= A[i][i]

u = map(float, raw_input().split())
e = map(float, raw_input().split())
o = map(float, raw_input().split())
p = map(float, raw_input().split())
q = map(float, raw_input().split())
A = [[p[i]-o[i], q[i]-o[i], e[i]-u[i]] for i in xrange(3)]
b = [e[i] - o[i] for i in xrange(3)]
solve(A, b)
s, t, x = b
j = lambda x: -0.0000001 < x < 1.0000001
if j(s) and j(t) and j(s+t) and j(x):
    print "MISS"
else:
    print "HIT"

### FIXED CODE ###

def solve(A, b):
    for i in xrange(3):
        if A[i][i] == 0.0:
            for j in xrange(i+1, 3):
                if A[j][i]!=0.0:
                    A[i], A[j] = A[j], A[i]
                    b[i], b[j] = b[j], b[i]
                    break
        for j in xrange(3):
            if i==j:
                continue
            a = A[j][i] / A[i][i]
            for k in xrange(3):
                A[j][k] -= a * A[i][k]
            b[j] -= a * b[i]
    for i in xrange(3):
        b[i] /= A[i][i]
        A[i][i] = 1.0

u = map(float, raw_input().split())
e = map(float, raw_input().split())
o = map(float, raw_input().split())
p = map(float, raw_input().split())
q = map(float, raw_input().split())

n = [(p[i-2]-o[i-2])*(q[i-1]-o[i-1])-(p[i-1]-o[i-1])*(q[i-2]-o[i-2]) for i in xrange(3)]
v = [e[i]-u[i] for i in xrange(3)]
if sum(n[i]*v[i] for i in xrange(3))==0.0:
    print "HIT"
    exit(0)

A = [[p[i]-o[i], q[i]-o[i], e[i]-u[i]] for i in xrange(3)]
b = [e[i] - o[i] for i in xrange(3)]
solve(A, b)
s, t, x = b
j = lambda x: -0.0000001 < x < 1.0000001
if j(s) and j(t) and j(s+t) and j(x):
    print "MISS"
else:
    print "HIT"
s=input()
if s="ooo"print(1000)

### FIXED CODE ###

print(input().count("o")*100+700)
s=input()
K=int(input())
ans=[]

for c in s:
  if c=="a":
    ans.append(c)
    continue
  if ord("z")+1- ord(c)<=K:
    K-=ord("z")+1-ord(c)
    ans.append("a")
    continue
    
  ans.append(c)
    
if K:
  ans[-1]=chr( ord(ans[-1])+K)
print("".join(ans))

### FIXED CODE ###

s=input()
K=int(input())
ans=[]

for c in s:
  if c=="a":
    ans.append(c)
    continue
  if ord("z")+1- ord(c)<=K:
    K-=ord("z")+1-ord(c)
    ans.append("a")
    continue
    
  ans.append(c)
    
if K:
  ans[-1]=chr( (ord(ans[-1])+K%26 -ord("a"))%26+ord("a") )
print("".join(ans))
s = input()
fl = 0
for i in range(len(s)):
    for j in range(len(s)):
        if i <= j:
            tmp = s[:i] + s[j:]
            if tmp == "keyence":
                flg = 1
if flg == 1:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

s = input()
flg = 0
for i in range(len(s)):
    for j in range(len(s)):
        if i <= j:
            tmp = s[:i] + s[j:]
            if tmp == "keyence":
                flg = 1
if flg == 1:
    print("YES")
else:
    print("NO")
import math

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

X = []
Y = []

def nasu(n):
  return math.ceil(math.log(n, 2))

def honya(n, L, X, Y):
  if len(L) >= 2:
    X.append(L[0])
    Y.append(L[1:])
    return True
  cnt = 0
  for i in Y:
    if (i >> (n - 1)) & 1:
      cnt += 1
  if cnt % 2 == 1:
    X.append(L)
    return True


A.sort(reverse = True)

M = nasu(A[0])

D = [0] * M
for i in range(N):
  t = A[i]
  for j in range(M):
    if t & 1:
      D[j] += 1
    t >>= 1

cnt = 0
ans = 0
X = []
Y = []
for i in range(M, 0, -1):
  L = []
  while nasu(A[cnt]) == i:
    L.append(A[cnt])
    cnt += 1
    if cnt == N:
      break
  else:
    if D[i - 1] % 2 == 1:
      X.append(L)
      ans += pow(2, i - 1)
    else:
      if honya(i, L, X, Y):
        ans += pow(2, M - 1) * 2
    continue
  break
print(ans)

### FIXED CODE ###

import math

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

def honya(n, L):
  k = 0
  E = len(L)
  for i in range(n - 1, -1, -1):
    for j in range(k, E):
      if (L[j] >> i) & 1:
        L[k], L[j] = L[j], L[k]
        break
    else:
      continue
    k += 1
    for j in range(k, E):
      if (L[j] >> i) & 1:
        L[j] ^= L[k - 1]
  return L

def nasu(n):
  return math.ceil(math.log(n + 1, 2))

A.sort(reverse = True)
M = nasu(A[0])
P = [1]
for i in range(M):
  P.append(P[-1] * 2)

D = [0] * M
for i in range(N):
  t = A[i]
  for j in range(M):
    if t & 1:
      D[j] += 1
    t >>= 1

ans = 0
for i in range(M - 1, -1, -1):
  if D[i] % 2 == 1:
    ans += P[i]
    for j in range(N):
      A[j] &= ~(1 << i)

L = honya(M, A)
t = 0
for i in range(N):
  if L[i] == 0: break
  if (t & (1 << (nasu(L[i]) - 1))) == 0:
    t ^= L[i]

for i in  range(M - 1, -1, -1):
  if (t >> i) & 1:
    ans += P[i] * 2
    
print(ans)
from numba import njit
s=input()
K=int(input())

N=len(s)
L=[]
@njit
def solve():
    for i in range(N):
        for j in range(i,N):
            L.append(s[i:j+1])
L=sorted(list(set(L)))
print(L[K-1])

### FIXED CODE ###

s=input()
K=int(input())
abc=list("abcdefghijklmnopqrstuvwxyz")

N=len(s)
L=[]
flag=False
for a in abc:
    for i in range(N):
        if s[i]==a:
            L.append(s[i:])
            
    if flag:
        break
L=sorted(L)
#print(L)
ans=[]
for l in L:
    n=len(l)
    for i in range(n):
        t=l[:i+1]
        if t not in ans:
            ans.append(l[:i+1])
    if len(ans)>=K:
        break
#print(ans)
print(ans[K-1])
A, B, C, D = map(int, input())
if A+B+C+D==7:
    a = "+"
    b = "+"
    c = "+"
elif A+B+C-D==7:
    a = "+"
    b = "+"
    c = "-"
elif A+B-C+D==7:
    a = "+"
    b = "-"
    c = "+"
elif A+B-C-D==7:
    a = "+"
    b = "-"
    c = "-"
elif A-B+C+D==7:
    a = "-"
    b = "+"
    c = "+"
elif A-B+C-D==7:
    a = "-"
    b = "+"
    c = "-"
elif A-B-C+D==7:
    a = "-"
    b = "-"
    c = "+"
elif A-B-C-D==7:
    a = "-"
    b = "-"
    c = "-"

print(f"{A}{a}{B}{b}{C}{c}{D}=7")

### FIXED CODE ###

A, B, C, D = map(int, input())
if A+B+C+D==7:
    a = "+"
    b = "+"
    c = "+"
elif A+B+C-D==7:
    a = "+"
    b = "+"
    c = "-"
elif A+B-C+D==7:
    a = "+"
    b = "-"
    c = "+"
elif A+B-C-D==7:
    a = "+"
    b = "-"
    c = "-"
elif A-B+C+D==7:
    a = "-"
    b = "+"
    c = "+"
elif A-B+C-D==7:
    a = "-"
    b = "+"
    c = "-"
elif A-B-C+D==7:
    a = "-"
    b = "-"
    c = "+"
elif A-B-C-D==7:
    a = "-"
    b = "-"
    c = "-"

print(str(A)+a+str(B)+b+str(C)+c+str(D)+"=7")
import math

MOD = 1000000000 + 7

n = list(map(int,input().split()))
N = n[0]
K = n[1]

for i in range(1,K+1):
    blue = math.factorial(K-1)/(math.factorial(K-i) * math.factorial(i-1)) % MOD
    red = math.factorial(N-K+1)/(math.factorial(N-K-i+1) * math.factorial(i)) % MOD
    print((int)((red * blue) % MOD))

### FIXED CODE ###

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

fact_ans=[1 for _ in range(n+1)]
for i in range(1,n+1):
    fact_ans[i]=fact_ans[i-1]*i

def fact(n):
    if(n<0):
        return 1
    else:
        return fact_ans[n]

for i in range(1,k+1):
    blue=fact(k-1)//(fact(k-i)*fact(i-1))
    red=( fact(n-k+1)//( fact(i)*fact(n-k+1-i))  )
    print((blue*red)%MOD)
N, K = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort()
res = 0
MOD = 10**9+7
nCk_2 = dict()
def fact(n, k=1):
    if n == 0:
        return 1
    if n <= k:
        return 1
    return n*fact(n-1)
def comb(n, k):
    if n-k > k:
        return fact(n,k)/fact(n-k)
    else:
        return fact(n,n-k)/fact(k)
for k in range(K-2,N):
    nCk_2[k] = int(comb(k, K-2))%MOD
for i in range(N):
    for j in range(N):
        if N-i-j >= K:
            res += int((A[N-1-j]-A[i])*nCk_2[N-j-2-i]%MOD)
        if N-1-j < i:
            break
print(res)


### FIXED CODE ###

N, K = map(int, input().split())
A = [int(x) for x in input().split()]
A.sort()
res = 0
MOD = 10**9+7
nCk_2 = dict()
fac, finv, inv = [0]*(N+1), [0]*(N+1), [0]*(N+1)
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2,N+1):
    fac[i] = fac[i-1]*i%MOD
    inv[i] = MOD-inv[MOD%i]*(MOD//i)%MOD
    finv[i] = finv[i-1]*inv[i]%MOD
def comb(n, k):
    return (fac[n]*((finv[k]*finv[n-k])%MOD))%MOD
s = [1,-1]
for m in range(2):
    for i in range(K-1,N):
        res = (res + s[m]*int((A[i])*comb(i,K-1)))%MOD
    A = sorted(A, reverse=True)
print(res)
letter=input()
n=int(input())
for i in range(n):
    ope=input().split(" ")
    o1=int(ope[0])
    if o1 ==1:
        letter="".join(list(reversed(letter)))
    else:
        o2,o3_s=int(ope[1]),ope[2]
        if o2==1:
            letter=o3_s+letter
        else:
            letter=letter+o3_s
print(letter)

### FIXED CODE ###

letter=input()
if "A" not in letter:
  print("No")
elif "B" not in letter:
  print("No")
else:
  print("Yes")
a = int(input())
b = int(input())
c = int(input())
d = int(input())
sum = []
sum.append(a*c)
sum.append(a*d)
sum.append(b*c)
sum.append(b*d)
print(max(sum))

### FIXED CODE ###

a = input()
arr = [int(i)  for i in a.split()]

sum = []
sum.append(arr[0]*arr[2])
sum.append(arr[0]*arr[3])
sum.append(arr[1]*arr[2])
sum.append(arr[1]*arr[3])
print(max(sum))
N=int(input())
ans=0
for i in range(N+1):
  if i%3!=0 and a%5!=0:
    ans+=i
print(ans)

### FIXED CODE ###

N=int(input())
ans=0
for i in range(N+1):
  if i%3!=0 and i%5!=0:
    ans+=i
print(ans)
import numpy as np

h , w = map(int, input().split())
visited = np.zeros((h,w))

for y in range(h):
    _in = input()
    for x, value in enumerate(_in):
        if value == '.':
            visited[y][x] = 10**9
for i in range(1,h):
    visited[i,:] = np.minimum(visited[i,:],visited[i-1,:]+1)
for i in reversed(range(h-1)):
    visited[i,:] = np.minimum(visited[i,:],visited[i+1,:]+1)
for j in range(1,h):
    visited[:,j] = np.minimum(visited[:,j],visited[:,j-1]+1)
for j in reversed(range(h-1)):
    visited[:,j] = np.minimum(visited[:,j],visited[:,j+1]+1)
print(np.max(visited))

### FIXED CODE ###

from collections import deque
 
 
def dfs(field):
    q = deque([(0, 0, 0)])
    visited = [[False] * w for _ in range(h)]
    while q:
        i, j, d = q.popleft()
        if i == h - 1 and j == w - 1:
            return d
        if visited[i][j]:
            continue
        visited[i][j] = True
        if i > 0 and field[i - 1][j] == '.':
            q.append((i - 1, j, d + 1))
        if i < h - 1 and field[i + 1][j] == '.':
            q.append((i + 1, j, d + 1))
        if j > 0 and field[i][j - 1] == '.':
            q.append((i, j - 1, d + 1))
        if j < w - 1 and field[i][j + 1] == '.':
            q.append((i, j + 1, d + 1))
    else:
        return -1
 
 
h, w = map(int, input().split())
field = [input() for _ in range(h)]
dot_cnt = sum(r.count('.') for r in field)
d = dfs(field)
if d == -1:
    print(-1)
else:
    print(dot_cnt - (d+1))
from scipy.misc import comb
N,M = map(int,input().split())
even = comb(N,2)
odd = comb(M,2)
print(int(even) + int(odd))

### FIXED CODE ###

S = [c for c in input()]
N = len(S) - 1
s1 = S[:(N-1)//2 + 1]
s2 = S[(N+3)//2:]

rs = list(reversed(S))
rs1 = list(reversed(s1))
rs2 = list(reversed(s2))
if S == rs and s1 == rs1 and s2 == rs2:
    print("Yes")
else:
    print("No")
def main():
    import numpy as np
    n, l = map(int,input().split())
    inlis = []
    taishou = 10 *10000
    flag = 0

    for i in range(l, l+n):
        if taishou > np.abs(i):
            taishou = np.abs(i)
            if i < 0:
                flag = 1
        inlis.append(i)
    if flag == 0:
        print(sum(inlis) - taishou)
    else:
        print(sum(inlis) + taishou)

    
        

    
if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    import numpy as np
    n, l = map(int,input().split())
    inlis = []
    taishou = 10 *10000
    flag = 0

    for i in range(l, l+n):
        if taishou > np.abs(i):
            taishou = np.abs(i)
            if i < 0:
                flag = 1
        inlis.append(i)
    if flag == 0:
        print(sum(inlis) - taishou)
    else:
        print(sum(inlis) + taishou)

    
        

    
if __name__ == "__main__":
    main()