Harryxun/stf_run huggingface dataset:
n=int(input())
s=input()
x=n
for i in range(n):
    if s[i]=="#":
      x=i
      break
for i in range(1,n):
    if s[n-i]=="#":
        s=s[:-i]
    else:
        break
b=s[x:].count("#") 
w=len(s[x:])-b
print(b if b<w else w)


### FIXED CODE ###

n=int(input())
s=input()


w=s.count(".")
ans = w

for i in range(n):

    if s[i]=="#":
        w+=1
    if s[i]==".":
        w-=1
    ans=min(ans,w)
    
print(ans)
def read_line():
    return input().rstrip()

def read_ints():
    return [int(x) for x in read_line().split()]

def read_int():
    return int(read_line())

def main():
    a, b = read_int()
    
    c = a + b
    if c >= 10:
        print('error')
    else:
        print(c)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def read_line():
    return input().rstrip()

def read_ints():
    return [int(x) for x in read_line().split()]

def read_int():
    return int(read_line())


a, b = read_ints()

c = a + b
if c >= 10:
    print('error')
else:
    print(c)
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
int n = 0
if e-a > k or e-b > k or d-a > k or e-c > k or d-b > k or c-a > k or e-d > k or d-c > k or c-b > k or b-a > k:
    n = 1

if n = 1:
    print(":(")
if n = 0:
    print("Yay!")

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
n = 0
if e-a > k or e-b > k or d-a > k or e-c > k or d-b > k or c-a > k or e-d > k or d-c > k or c-b > k or b-a > k:
    n = 1

if n == 1:
    print(":(")
if n == 0:
    print("Yay!")
def a(s):
    count = 0
    for i in range(len(s) - 2):
        if s[i] == s[i + 1]:
            s = s[:i + 1] + 'A' + s[i + 2:]
            count += 1
    if s[-1] == s[-2]:
        count +=1
    return count


s = str(input())
k = input()
if s[0] != s[-1] or k==1:
    print(a(s) * k)
else:
    new_s = s * 2
    org_count = a(s)
    new_count = a(new_s)
    diff = 2 * org_count - new_count
    print(org_count * k - diff * (k - 1))

### FIXED CODE ###

def a(s):
    count = 0
    test = s[0]
    for i in range(len(s) - 1):
        if s[i] == s[i + 1] and test[i] != 'A':
            # s = s[:i + 1] + 'A' + s[i + 2:]
            test += 'A'
            count += 1
        else:
            test += s[i]
    return count


s = input()
k = int(input())
if s[0] != s[-1] or k == 1:
    print(a(s) * k)
elif k == 2:
    new_s = s * 2
    print(a(new_s))
elif len(s) == s.count(s[0]):
    new_s = s * 2
    count_2 = a(new_s)
    print(count_2 * (k // 2) + a(s) * (k % 2))
else:
    new_s = s * 2
    count_2 = a(new_s)
    count_3 = a(new_s + s)
    diff = count_3 - count_2
    print(count_3 + (k-3) * diff)
import math

def is_prime(n):
  if n == 1: 
    return 1

  for k in range(2, int(math.sqrt(n)) + 1):
    if n % k == 0:
      return 0

  return 1
  
a, b = map(int, input().split())
max_d = math.gcd(a, b)
ans = 0
for i in range(1, max_d + 1):
  if a % i == 0 and b % i == 0:
    ans += is_prime(i)
    
print(ans)
    


### FIXED CODE ###

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table
  
a, b = map(int, input().split())
la = prime_decomposition(a)
lb = prime_decomposition(b)
la_lb_and = list(set(la) & set(lb))
    
print(len(la_lb_and) + 1)
n = int(input())
if n == 1:
  print("Yes")
  exit()

h_list = [int(h) for h in input().split()]

for index in range(0,n-1):
  if h_list[index] > h_list[index+1]:
    h_list[index] = h_list[index]-1

for index in range(1, n):
  if h_list[index-1] > h_list[index]:
    print("No")
    exit()
print("Yes")

### FIXED CODE ###

if __name__ == "__main__":
  a, b, c = map(int, input().split())
  
  res_1 = a - b
  
  res_2 = c - res_1
  if res_2 <= 0:
    print(0)
  else:
    print(res_2)
N, Q = map(int, input().split())

def find(nodes, key):
  if len(nodes[key]) == 1:
    return [key]
  else:
    x = [key]
    for node in nodes[key]:
      if key != node:
        x.extend(find(nodes, node))
    return x

nodes = {}
nodes_p = {}
for _ in range(N-1):
  a,b = map(int, input().split())
  if a in nodes:
    nodes[a].append(b)
  else:
    nodes_p[a] = 0
    nodes[a] = [a]
    nodes[a].append(b)

  if b not in nodes:
    nodes_p[b] = 0
    nodes[b] = [b]

for key in nodes:
  nodes[key] = find(nodes, key)

for _ in range(Q):
  p, x = map(int, input().split())
  for key in nodes[p]:
    nodes_p[key] += x

print(" ".join(map(str, [ v for v in nodes_p.values()])))


### FIXED CODE ###

N, Q = map(int, input().split())

nodes = [0 for _ in range(N)]

parents = {}
for _ in range(N-1):
  a, b = map(int, input().split())
  parents[b] = a

for _ in range(Q):
  p, x = map(int, input().split())
  nodes[p-1] += x

for i in range(N):
  if i+1 in parents:
    nodes[i] += nodes[parents[i+1]-1]

print(" ".join(map(str, nodes)))
L,R = map(int,input().split())

ans = (L+R)/2

if ans.is_integer():
  return int(ans)
else:
  return "IMPOSSIBLE"

### FIXED CODE ###

L,R = map(int,input().split())

ans = (L+R)/2

if ans.is_integer():
  print(int(ans))
else:
  print("IMPOSSIBLE")
S288C_reference_genome_R64-1-1_20110203

### FIXED CODE ###

x = input()
print x * x * x
def main():
    n = int(input())
    a = [list(map(lambda x: int(x)-1, input().split())) for _ in range(n)]
    id = [[0]*n for _ in range(n)]
    V = 0
    for i in range(n):
        for j in range(n):
            if i<j:
                id[i][j] = V
                V += 1
    def toID(i, j):
        if i<j:
            return id[i][j]
        else:
            return id[j][i]
    
    to = [[] for _ in range(V)]
    for i in range(n):
        for j in range(n-1):
            a[i][j] = toID(i, a[i][j])
        for j in range(n-2):
            to[a[i][j+1]].append(a[i][j])

    dp, visited, calculated = [1] * V, [0] * V, [0] * V

    def dfs(v, dp, visited, calculated):
        if visited[v]:
            if not calculated[v]:
                return -1
            return dp[v]
        visited[v] = 1
        for u in to[v]:
            res = dfs(u, dp, visited, calculated)
            if res == -1:
                return -1
            dp[v] = max(dp[v], res+1)
        calculated[v] = 1
        return dp[v]

    ans = 0
    for v in range(V):
        res = dfs(v, dp, visited, calculated)
        if res == -1:
            print(-1)
            return
        ans = max(ans, res)
    print(ans)
    return

main()


### FIXED CODE ###

def main():
    n = int(input())
    a = [list(map(lambda x : int(x)-1, input().split())) for _ in range(n)]
    for i in range(n):
        a[i].reverse()
    # print(a)
    s = set()

    def check(i, s):
        if len(a[i]) == 0:
            return
        j = a[i][-1]
        if len(a[j]) == 0:
            return
        if a[j][-1] == i:
            if i < j:
                s.add((i, j))
            else:
                s.add((j, i))
    
    for i in range(n):
        check(i, s)
    day = 0
    while s:
        day += 1
        prevS = set()
        s, prevS = prevS, s
        for p in prevS:
            i = p[0]
            j = p[1]
            a[i].pop()
            a[j].pop()
        for p in prevS:
            i = p[0]
            j = p[1]
            check(i, s)
            check(j, s)
    
    for i in range(n):
        if len(a[i]):
            print(-1)
            return
    print(day)
    return

main()
import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

#n,m = ips()
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(m)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#a.pop(0)は10^5あるときTLEしやすい!注意!抜くなら逆ソート!
a = []
for i in range(n):
    b = iprow()
    a.append([b[1],b[0]])
a.sort()
sumtime = 0
for i in range(n):
    sumtime += a[i][1]
    if sumtime > a[i][0]:
        j(0)
j(1)

### FIXED CODE ###

import math
import fractions
import copy
import numpy as np
def j(q):
    if q==1: print("Yes")
    elif q == 0:print("No")
    exit(0)
rem = pow(10,9)+7
"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def printrow(a):
    for i in a:
        print(i)
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

#n,m = ips()
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
n = ip()                      #入力セット(整数改行あり)(1/2)
#a=[ip() for i in range(m)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#a.pop(0)は10^5あるときTLEしやすい!注意!抜くなら逆ソート!
a = []
for i in range(n):
    b = iprow()
    a.append([b[1],b[0]])
a.sort()
sumtime = 0
for i in range(n):
    sumtime += a[i][1]
    if sumtime > a[i][0]:
        j(0)
j(1)
k,x = int(input().split())

print(i for i in range(x+1-k,x+k))

### FIXED CODE ###

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

print(" ".join(map(str,range(x-k+1,x+k))))
numbers = input().split(" ")
a = numbers[0]
b = numbers[1]
c = a*b
if c%2==0:
  print("Even")
elif c%2==0:
  print("Odd")

### FIXED CODE ###

numbers = input().split(" ")
a= int(numbers[0])
b= int(numbers[1])
c=a*b
if c%2==0:
  print("Even")
else:
  print("Odd")
s=list(map(int,input().split()))
 
if s[0]<=2018:
  print(Heisei)
elif s[0]=2019 and s[1]<5:
  print(Heisei)
else:
  print(TBD)

### FIXED CODE ###

s=list(map(int,input().split("/")))
 
if s[0]<=2018:
  print("Heisei")
elif s[0]==2019 and s[1]<5:
  print("Heisei")
else:
  print("TBD")
N=int(input())
scores=[input() for _ in range(N)]
AC=WA=TLE=RE=0
for score in scores:
  if score == 'AC':
    AC += 1
  elseif score == 'WA':
    WA += 1
  elseif score == 'TLE':
    TLE += 1
  else:
    RE += 1
print('AC x ' + str(AC))
print('WA x ' + str(WA))
print('TLE x ' + str(TLE))
print('RE x ' + str(RE))

### FIXED CODE ###

N=int(input())
scores=[input() for _ in range(N)]
AC=WA=TLE=RE=0
for score in scores:
  if score == 'AC':
    AC += 1
  elif score == 'WA':
    WA += 1
  elif score == 'TLE':
    TLE += 1
  else:
    RE += 1
print('AC x ' + str(AC))
print('WA x ' + str(WA))
print('TLE x ' + str(TLE))
print('RE x ' + str(RE))
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
V = []
W = []
for _ in range(n):
    v, w = LI()
    V.append(v)
    W.append(w)

q = I()
vl = []
maxL = 0
for _ in range(q):
    v, l = LI()
    maxL = max(maxL, l)
    vl.append([v,l])

m = min(n, 1 << 10)
dp = [[0]*(maxL + 1) for _ in range(m + 1)]

for i in range(1, m+1):
    v, w = V[i-1], W[i-1]
    for j in range(maxL+1):
        if j < w:
            dp[i][j] = dp[i>>1][j]
        else:
            dp[i][j] = max(dp[i>>1][j], dp[i>>1][j - w] + v)


for i in range(q):
    v, L = vl[i]
    if v <= m:
        print(dp[v][L])
        continue
    x = v.bit_length() - m.bit_length()
    ret = 0
    for j in range(1 << x):
        weight_sum = 0
        value_sum = 0
        tmp = v
        idx = j
        for _ in range(x):
            if idx & 1:
                weight_sum += W[tmp - 1]
                if weight_sum > L:
                    break
                value_sum += V[tmp - 1]
            tmp >>= 1
            idx >>= 1
        else:
            value_sum += dp[tmp][L - weight_sum]
            ret = max(ret, value_sum)
    print(ret)


### FIXED CODE ###

#!/usr/bin/env python3

def main():
    import sys
    def I(): return int(sys.stdin.readline())
    def LI(): return list(map(int,sys.stdin.readline().split()))

    n = I()
    V = []
    W = []

    maxL = 10**5
    m = min(n, 1 << 10)
    dp = [[0]*(maxL + 1)]
    
    for i in range(n):
        v, w = LI()
        if i <= m:
            d_ = dp[(i+1)>>1][:]
            for j in range(w, maxL+1)[::-1]:
                d_[j] = max(d_[j], d_[j - w] + v)
            dp.append(d_)
        V.append(v)
        W.append(w)
    
    q = I()
    for i in range(q):
        v, L = LI()
        if v <= m:
            print(dp[v][L])
            continue
        cnt = 0
        v_ = []
        w_ = []
        while v > m:
            v_.append(V[v-1])
            w_.append(W[v-1])
            v >>= 1
            cnt += 1
        ret = dp[v][L]
        v_tmp = [0] * (1 << cnt)
        w_tmp = [0] * (1 << cnt)
        for b in range(1, 1 << cnt):
            lsb = b & -b
            l = lsb.bit_length()
            w_t = w_tmp[b - lsb] + w_[l-1]
            w_tmp[b] = w_t
            if w_t <= L:
                v_t = v_tmp[b - lsb] + v_[l-1]
                v_tmp[b] = v_t
                ret = max(ret, v_t + dp[v][L - w_t])
        print(ret)
    return

if __name__ == "__main__":
    main()
import numpy as np
n = int(input())
keta = len(str(n))
field = np.array([[0 for _ in range(0)] for _ in range(9)])
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result


for k in range(1, n+1):
    i = int(str(k)[0])
    j = int(str(k)[1])
    field[i, j] += 1
total = 0
for i in range(9):
    val = field[i,i]
    total += cmb(val+1, 2)
for i in range(9):
    for j in range(9):
        if i==j:
            continue
        else:
            val = field[i,j]
            total += 2*cmb(val, 2)
print(val)

### FIXED CODE ###

import numpy as np
def cmb(n, r):
    if n<r:
      return 0
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

n = int(input())
field = np.array([[0 for _ in range(9)] for _ in range(9)])

for i in range(1, n+1):
    stri = str(i)
    mae = int(stri[0])
    ushiro = int(stri[-1])
    if mae != 0 and ushiro != 0:
        field[mae-1, ushiro-1] += 1

total = 0
for i in range(9):
    val = field[i, i]
    #print(val)
    #print(cmb(val, 2))
    total += val
    total += 2*cmb(val, 2)

for i in range(9):
    for j in range(i, 9):
        if i==j:
            continue
        else:
            total += 2*field[i,j]*field[j,i]
#print(field)
print(total)
n,k=map(int,open(0).split())
print(0--~-n//~-k)

### FIXED CODE ###

n,k,*_=map(int,open(0).read().split())
print(0--~-n//~-k)
import numpy as np
n,m = [int(i) for i in input().split()]
l = [[int(i) for i in input().split()] for _ in range(n)]
ans = np.zeros(10**10+100,dtype = np.int64)
start = 0
end = 0
for i,j in l:
    end += j
    ans[start:end] = i
    start = end
    
print(ans[m-1])

### FIXED CODE ###

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

temp = 0
l = sorted([[int(i) for i in input().split()] for _ in range(a)],key = lambda x: x[0])
for i in l:
    temp += i[1]
    if temp >= b:
        ans = i[0]
        break
print(ans)
n, m = map(int, input().split())
g = []
for _ in range(m):
    a, b, c = map(int, input().split())
    g.append([a - 1, b - 1, -c])

def bellman_ford(s):
    d = [float('inf')]*n # 各頂点への最小コスト
    d[s] = 0 # 自身への距離は0
    for i in range(n):
        update = False # 更新が行われたか
        for x, y, z in g:
            if d[y] > d[x] + z:
                d[y] = d[x] + z
                update = True
        if not update:
            break
        if i == n - 1:
            inf_flg = d[-1]
            flg = True
    if flg:
        for i in range(n):
            update = False # 更新が行われたか
            for x, y, z in g:
                if d[y] > d[x] + z:
                    d[y] = d[x] + z
                    update = True
            if not update:
                break
            if i == n - 1:
                if inf_flg != d[-1]:
                    return "inf"
    return -1 * d[-1]

print(bellman_ford(0))

### FIXED CODE ###

n, m = map(int, input().split())
g = []
for _ in range(m):
    a, b, c = map(int, input().split())
    g.append([a - 1, b - 1, -c])

def bellman_ford(s):
    d = [float('inf')]*n # 各頂点への最小コスト
    d[s] = 0 # 自身への距離は0
    flg = False
    for i in range(n):
        update = False # 更新が行われたか
        for x, y, z in g:
            if d[y] > d[x] + z:
                d[y] = d[x] + z
                update = True
        if not update:
            break
        if i == n - 1:
            inf_flg = d[-1]
            flg = True
    if flg:
        for i in range(n):
            update = False # 更新が行われたか
            for x, y, z in g:
                if d[y] > d[x] + z:
                    d[y] = d[x] + z
                    update = True
            if not update:
                break
            if i == n - 1:
                if inf_flg != d[-1]:
                    return "inf"
    return -1 * d[-1]

print(bellman_ford(0))
n, k, s = map(int, input().split())
A = [0]*n
for i in range(1, n+1):
    if i <= k:
        A[i] = s
    else:
        if s == 10**9:
          A[i] = 1
        else:
          A[i] = 10**9
print(*A)

### FIXED CODE ###

H = int(input())
W = int(input())
N = int(input())
if N%max(H,W)==0:
  print(N//max(H,W))
else:
  print(N//max(H,W)+1)
n = int(input())

def prime():
    p = [2]
    m = 3
    while m < 1400:
        for i in p:
            if m % i == 0:
                break
        else:
            p.append(m)
        m += 2
    return p

ans = []
q = p[1:]

while len(ans) < n:
    for i, q_ in enumerate(q):
        if q_ % 5 == 1:
            ans.append(q_)
            del q[i]
            break

print(' '.join([str(s) for s in ans]))

### FIXED CODE ###

n = int(input())

def prime():
    p = [2]
    m = 3
    while m < 1400:
        for i in p:
            if m % i == 0:
                break
        else:
            p.append(m)
        m += 2
    return p

ans = []
p = prime()
q = p[1:]

while len(ans) < n:
    for i, q_ in enumerate(q):
        if q_ % 5 == 1:
            ans.append(q_)
            del q[i]
            break

print(' '.join([str(s) for s in ans]))
a = input().split(" ")
h1 = int(a[0])
h2 = int(a[1])
h3 = int(a[2])

if h1 <= h3 && h3 <= h2:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a = input().split(' ')
h1 = int(a[0])
h2 = int(a[1])
h3 = int(a[2])
 
if h1 < h3 and h3 < h2:
  print('Yes')
else:
  if h2 < h3 and h3 < h1:
    print('Yes')
  else:
    print('No')
a = int(input())
b = input()
c = int(input())
d = b[k-1]
new = [e for e in b if e == d]

### FIXED CODE ###

N=int(input())
S=str(input())
K=int(input())
W=S[K-1]
for i in range(N):
  if S[i]!=W:
    S=S.replace(S[i],'*')
print(S)
import sys
input = sys.stdin.buffer.readline
import bisect
N = int(input())
S = input()

dic = {}
for i in range(N):
    if S[i] in dic:
        dic[S[i]].append(i+1)
    else:
        dic[S[i]] = [i+1]

Q = int(input())
for _ in range(Q):
    a,b,c = map(str, input().split())
    if a == "1":
        b = int(b)
        dic[S[b-1]].remove(b)
        if c in dic:
            idx = bisect.bisect_left(dic[c], b)
            dic[c].insert(idx, b)
        else:
            dic[c] = [b]
    else:
        l = int(b)
        r = int(c)
        cnt = 0
        for key in dic:
            if len(dic[key]) == 0:
                continue
            elif len(dic[key]) == 1:
                if l <= dic[key][0] <= r:
                    cnt += 1
                continue
            elif bisect.bisect_left(dic[key], r)-bisect.bisect_left(dic[key], l) > 0:
                cnt += 1
        print(cnt)

### FIXED CODE ###

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

seg = [0]*(2*N-1)

def update(k, x):
    k += N-1
    seg[k] = 2**x
    while k:
        k = (k-1)//2
        seg[k] = seg[2*k+1] | seg[2*k+2]
        
def query(p, q):
    p += N-1
    q += N-2
    res = 0
    while q-p > 1:
        if p&1 == 0:
            res = res | seg[p]
        if q&1 == 1:
            res = res | seg[q]
            q -= 1
        p //= 2
        q = (q-1)//2
    if p == q:
        res |= seg[q]
    else:
        res |= seg[p] | seg[q]
    return bin(res).count("1")

def f(s):
    return ord(s) - ord("a") + 1

for i in range(N):
    update(i, f(S[i]))
    
Q = int(input())
for _ in range(Q):
    a,b,c = map(str, input().split())
    if a == "1":
        update(int(b)-1, f(c))
    else:
        print(query(int(b)-1, int(c)))
n = input()
a = input().split(' ')
result = 0
for i in range(len(a)):
	for j in range(i+1, len(a)):
		diff = abs(a[i]-a[j])
		if diff > result:
			result = diff
print(result)

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
	print(N)
else:
	print(N*2)
import numpy as np
n,k=map(int,input().split())
a=list(map(int,input().split()))
f=list(map(int,input().split()))
a.sort()
if sum(a)<=k:
    print(0)
    exit()
f.sort(reverse=True)
m=0
a=np.array(a)
f=np.array(f)
for i in range(n):
    m=max(m,a[i]*f[i])
x=m//2
l=0
r=m
def check(x):
    x=np.array([x]*n)
    p=np.sum(np.max(0,a-x//f))
    if p>k:
        return False
    else:
        return True
while l<r:
    if check(x):
        r=x
        x=(r+l)//2
    else:
        l=x
        x=(r+l)//2
print(r)


### FIXED CODE ###

import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)

a = []
f = []
n = 0

def rec(l, r, k):
    if l+1 < r:
        mid = (l + r) // 2
        s = 0
        for i in range(n):
            s += max(a[i] - mid // f[i], 0)
        if s <= k:
            return rec(l, mid, k)
        else:
            return rec(mid, r, k)
    else:
        return r

def main():
    global a, f, n
    n, k = map(int, input().strip().split())
    a = list(map(int, input().strip().split()))
    f = list(map(int, input().strip().split()))
    a = sorted(a)
    f = sorted(f, reverse=True)
    print(rec(-1, 10**12, k))

if __name__ == '__main__':
    main()