Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-

import sys

def prob_b(n, a, b):
    n, a, b = int(n), int(a), int(b)
    x = int(n / (a + b)) * a
    y = n % (a + b)
    print(x+y)


if __name__ == '__main__':
    args = sys.argv
    n = args[1]
    a = args[2]
    b = args[3]
    prob_b(n,a,b)


### FIXED CODE ###

# -*- coding: utf-8 -*-

import sys


def prob_b(n, a, b):
    x = int(n / (a + b)) * a
    y = min(n % (a + b), a)
    print(x+y)


if __name__ == '__main__':
    #args = sys.argv
    #n = args[1]
    #a = args[2]
    #b = args[3]
    n, a, b = map(int, input().split())
    prob_b(n,a,b)
# import itertools
# import math

import sys
input = sys.stdin.readline


def solve(N, A):
    for i in range(N):
        tmp = A
        tmp.pop(i)
        print(max(tmp))


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


A = []
for i in range(N):
    aa = int(input())
    A.append(aa)


solve(N, A)


### FIXED CODE ###

# import itertools
# import math

import sys
input = sys.stdin.readline


def solve(N, A):
    max_idx = A.index(max(A))
    s = sorted(A, reverse=True)

    for i in range(N):
        if i == max_idx:
            print(s[1])
        else:
            print(s[0])


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


A = []
for i in range(N):
    aa = int(input())
    A.append(aa)


solve(N, A)
n=int(input())
a=int(input())
b=int(input())
if n==1:
  print("Hello World")
else:
  print(a+b)

### FIXED CODE ###

n=int(input())
if n==1:
   print("Hello World")
else:
   a=int(input())
   b=int(input())
   print(a+b)
n,m=map(int,input().split())
st=[]
ch=[]
def mht(ax,ay,bx,by):
  return abs(ax-bx)+abs(ay-by)

for i in range(n):
  st.append(list(map(int,input().split())))
for i in range(m):
  ch.append(list(map(int,input().split())))
  
for i in st:
  ax=i[0]
  ay=i[1]
  mn=100000000
  for (j,k) in zip(ch,range(len(ch))):
    bx=j[0]
    by=j[1]
    mh=mht(ax,ay,bx,by)
    if mh<mn:
      mn=mh
      nm=k
  print(nm+1)


### FIXED CODE ###

n,m=map(int,input().split())
st=[]
ch=[]
def mht(ax,ay,bx,by):
  return abs(ax-bx)+abs(ay-by)

for i in range(n):
  st.append(list(map(int,input().split())))
for i in range(m):
  ch.append(list(map(int,input().split())))
  
for i in st:
  ax=i[0]
  ay=i[1]
  mn=1000000000
  for (j,k) in zip(ch,range(len(ch))):
    bx=j[0]
    by=j[1]
    mh=mht(ax,ay,bx,by)
    if mh<mn:
      mn=mh
      nm=k
  print(nm+1)
a=int(input())
b=int(input())
c=int(input())
if a < b < c:
   print("yes")
else:
   print("no") 


### FIXED CODE ###

c=input().split(" ")
a=int(c[0])
b=int(c[1])
c=int(c[2])
if a < b and b < c:
 print("Yes")
else:
   print("No")
s = input()
t = input()

including = True
for x in t:
    if x  not in s:
        including = False
        break
if not including:
    print(-1)
    return


x = 0
y = 0
while True:
    index = x % len(s)
    if s[index] == t[y]:
        y += 1
        if y == len(t):
            break
    x += 1

print(x + 1)

### FIXED CODE ###

import bisect

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

x = [[] for j in range(26)]

for i, s in enumerate(S):
    x[ord(s) - ord('a')].append(i)

sett = list(set(T))

for t in sett:
    if len(x[ord(t) - ord('a')]) == 0:
        print(-1)
        exit()

c = 0
z = 0

for t in T:
    y = bisect.bisect_left(x[ord(t) - ord('a')], c)
    if y == len(x[ord(t) - ord('a')]):
        z += 1
        c = x[ord(t) - ord('a')][0] + 1
    else:
        c = x[ord(t) - ord('a')][y] + 1

print(z * len(S) + c)
import numpy as np

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

dp = [np.array([[0]*(N*A+1) for _ in range(N+1)])]
#dp[0]: [0, 0]～[N, N*A]

for x in X:
  new_dp = dp[-1]
  new_dp[1:, x:] += dp[-1][0:N, 0:N*A+1-x]
  new_dp[1, x] += 1
  
  dp.append(new_dp)
print(dp[-1])
  
print(sum([dp[-1][i, i*A] for i in range(1, N+1)]))



### FIXED CODE ###

import numpy as np

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

dp = [np.array([[0]*(N*A+1) for _ in range(N+1)])]
#dp[0]: [0, 0]～[N, N*A]

for x in X:
  new_dp = dp[-1].copy()
  new_dp[1:, x:] += dp[-1][0:N, 0:N*A+1-x]
  if x<=N*A:
    new_dp[1, x] += 1
  
  dp.append(new_dp)
#print(dp[-1])
  
print(sum([dp[-1][i, i*A] for i in range(1, N+1)]))
N=int(input())
S=list(input())

t=0
for i in range(N-1):
    if S[i+1] == S[i]:
        t+=1
print(N-t)


### FIXED CODE ###

A,B = map(int,input().split())
if A>=B*2:
    print(A-B*2)
else:
    print(0)
#

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def main():
    N = int(input())
    xy = []
    for _ in range(N):
        x, y = map(int, input().split())
        xy.append((x, y))

    xy.sort(key=lambda p: (p[0], p[1]))
    # print(xy)

    cand = defaultdict(lambda :0)
    ans = 0
    for i in range(N-1):
        for j in range(1, N):
            p = xy[j][0] - xy[i][0]
            q = xy[j][1] - xy[i][1]
            key = '{},{}'.format(p, q)
            cand[key] += 1
    counter = Counter(cand)
    pq_count = counter.most_common()[0][1]
    # print(counter.most_common()[0])
    print(N - pq_count)




if __name__ == '__main__':
    main()


### FIXED CODE ###

#

import itertools
from collections import Counter
from collections import defaultdict
import bisect
from heapq import heappush, heappop

def main():
    N = int(input())
    xy = []
    for _ in range(N):
        x, y = map(int, input().split())
        xy.append((x, y))

    if N == 1:
        print(1)
        exit()

    xy.sort(key=lambda p: (p[0], p[1]))
    # print(xy)

    cand = defaultdict(lambda:0)

    for i in range(N-1):
        for j in range(i+1, N):
            p = xy[j][0] - xy[i][0]
            q = xy[j][1] - xy[i][1]
            key = '{},{}'.format(p, q)
            cand[key] += 1
    counter = Counter(cand)
    pq_count = counter.most_common()[0][1]
    # print(counter.most_common()[0])
    print(N - pq_count)


if __name__ == '__main__':
    main()
N=int(input())
L=[list(map(int,input().split())) for _ in range(N)]

for x in range(101):
    for y in range(101):
        cond=True
        H=abs(x-L[0][0])+abs(y-L[0][1])+L[0][2]
        if H<=0:
            cond=False
            continue
        for i in range(1,N):
            if H!=L[i][2]+abs(x-L[i][0])+abs(y-L[i][1]):
                cond=False
                break
        if cond:
            ans=[x,y,H]

print(ans[0],ans[1],ans[2])


### FIXED CODE ###

N=int(input())
L=[]
for h in range(N):
    Cx,Cy,h=map(int,input().split())
    L.append([h,Cx,Cy])
L.sort(reverse=True)

for x in range(101):
    for y in range(101):
        cond=True
        H=L[0][0]+abs(x-L[0][1])+abs(y-L[0][2])
        for i in range(1,N):
            h=L[i][0]+abs(x-L[i][1])+abs(y-L[i][2])
            if L[i][0]>0:
                if h!=H:
                    cond=False
                    break
            else:
                if h<H:
                    cond=False
                    break
        if cond:
            break
    if cond:
        break

print(x,y,H)
import numpy as np
import sys
sys.setrecursionlimit(10**9)

def main():
    N = int(input())
    A = np.array(list(map(int,input().split())))

    X = np.zeros((N,N))
    for i in range(N-1):
        for j in range(2):
            X[i][j+i] = 1

    X[N-1][0] = 1
    X[N-1][N-1] = 1

    ans = map(lambda y: int(y)*2, np.dot(np.linalg.pinv(X),A))
    print(*ans)


if __name__ == "__main__":
  main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

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

    s = sum(A)
    x1 = s

    for k in range(N//2):
        x1 -= 2 * A[2*k+1]

    X = [x1]
    for i in range(N):
        x = 2 * A[i] - X[i]
        X.append(x)

    print(*X[:-1])


if __name__ == "__main__":
  main()
#!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect

MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

List = [str(i) for i in range(0, 10)]
prev_num = 10
K = int(input())
if K <= 9:
    print(List[K])
else:
    while True:
        List2 = []
        for i in List:
            if i != "0":
                List2.append(i + str(i[-1]))
                if i[-1] != "9":
                    List2.append(i + str(int(i[-1]) + 1))
                if i[-1] != "0":
                    List2.append(i + str(int(i[-1]) - 1))
        List = List2
        if prev_num + len(List) >= K:
            List = list(map(int, List))
            List.sort()
            print(List[K - prev_num])
            sys.exit()
        prev_num += len(List)

### FIXED CODE ###

#!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect

MOD = 10 ** 9 + 7
INF = float('inf')
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

List = [str(i) for i in range(0, 10)]
prev_num = 10
K = int(input())
if K <= 9:
    print(List[K])
else:
    while True:
        List2 = []
        for i in List:
            if i != "0":
                List2.append(i + str(i[-1]))
                if i[-1] != "9":
                    List2.append(i + str(int(i[-1]) + 1))
                if i[-1] != "0":
                    List2.append(i + str(int(i[-1]) - 1))
        List = List2
        if prev_num + len(List)-1 >= K:
            List = list(map(int, List))
            List.sort()
            print(List[K - prev_num])
            sys.exit()
        prev_num += len(List)
money = int(input())
kane = 100
years = 0

while kane <= money:

    kane = kane * 1.01 
    math.floor(kane)
    years = years + 1
print(years)

### FIXED CODE ###

# coding: utf-8

hage = int(input())
hoge = input().split()
 
hoge[0] = int(hoge[0])
hoge[1] = int(hoge[1])

renji = int(hoge[0]) - int(hoge[1])
 
e = hage
 
while e <= hoge[1]:
    if hoge[0] <= e and hoge[1] >= e:
        print("OK")
        break
    e = e + hage
if e > hoge[1] or e < hoge[0]:
    print("NG")
N = input()
b_list = list(map(int, input().split()))

# N = 3
# b_list = [1,1,3,1,2]
# b_list = [1, 1, 1, 2, 2, 1, 2, 3, 2]
# b_list = [1,1,1,2,2,1,2,3,2]

a_list = []

def insert(tmp_list, x, new):

    tmp = tmp_list[x:]
    tmp_list[x] = new
    tmp_list += tmp
    return tmp_list

p_list = []
m_list = []
z_list = []

for num, b in enumerate(b_list):
    num+=1
    
    idx = b-num
    
#     " 実現不可能 "
    if idx>0:
        print(-1)
#         exit()
    elif idx<0:
        m_list.append(b)
    elif idx==0:
        if num==1:
            continue
        z_list.append(b)

m_list.sort(reverse=True)
z_list.sort()

sol_list = []
sol_list.append(1)

m_max = max(m_list)

import numpy as np
care_dict = {}
for num, i in enumerate(n_list):
    if i!=m_max:
        continue
    d_list = []
    for j in n_list[num+1:]:
        diff = i-j
        d_list.append(diff)
    d_list = np.array(d_list)
    d_list = d_list[d_list>0]
    if len(d_list):
        care_dict[i] = len(d_list)
        
m_list = iter(m_list)
o_list = []

for m in m_list:
    
    for o in o_list:
        gr = care_dict[o]
        if len(sol_list)>= o+(gr-1):
            sol_list.append(o)
            o_list.remove(o)
    
    if m in care_dict.keys():
        gr = care_dict[m]
        
#         print(len(sol_list), m+(gr-1))
        
        if len(sol_list)>= m+(gr-1):
            sol_list.append(m)
        else:
            o_list.append(m)
    else:
        sol_list.append(m)
        
for o in o_list:
    gr = care_dict[o]
    if len(sol_list)>= o+(gr-1):
        sol_list.append(o)
        o_list.remove(o)
        
for z in z_list:
    sol_list.append(z)

for s in sol_list:        
    print(s)

### FIXED CODE ###

"""
A - Limited Insertion
"""
import numpy as np

N = input()
b_list = list(map(int, input().split()))
# N = 9
# b_list = [1, 1, 1, 2, 2, 1, 2, 3, 2]
# b_list = [1,1,1,2,2,1,2,3,2]
# b_list = [1,1,3,1,2]
# b_list = [2,2]


def make_idx(tmp_list):
    return np.arange(1, len(tmp_list)+1, 1)[::-1]

b_list = b_list[::-1]
idx_list = make_idx(b_list)
rm_list = []

while len(b_list):
    for idx, b in zip(idx_list, b_list):
        if idx==b:
            b_list = b_list[::-1]
            b_list.remove(b)
            rm_list.append(b)
            b_list = b_list[::-1]
            break
        elif idx-b<0:
            print(-1)
            exit()
    idx_list = make_idx(b_list)
    
for r in rm_list[::-1]:
    print(r)
H, W = map(int, input().split())
M = [input() for i in range(H)]
dp = [[0 for i in range(W)] for j in range(H)]
dp[0][0] = 1

for i in range(H):
  for j in range(W):
    if i+1 < H and M[i+1][j] == ".":
      dp[i+1][j] = dp[i][j]
    if j+1 < W and M[i][j+1] == ".":
      dp[i][j+1] += dp[i][j]

print(dp[H][W] % (10**9+7))


### FIXED CODE ###

H, W = map(int, input().split())
M = [input() for i in range(H)]
dp = [[0 for i in range(W+1)] for j in range(H+1)]
dp[1][1] = 1

for i in range(1, H+1):
  for j in range(1, W+1):
    if i == 1 and j == 1:
      continue
    if M[i-1][j-1] == "#":
      continue
    dp[i][j] = dp[i-1][j] + dp[i][j-1]
print(dp[H][W] % (10**9+7))
import sys
import itertools
import numpy as np
import networkx as nx

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
S = np.frombuffer(read(), 'S1').reshape(N, -1)[:, :M].astype('U1')

A = []
B = []
E = []

for i, j in itertools.product(range(N), range(M)):
    if S[i, j] == '#':
        continue
    elif (i + j) & 1:
        A.append((i, j))
    else:
        B.append((i, j))

for i, j in A:
    for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
        i1, j1 = i + dx, j + dy
        if 0 <= i1 < N and 0 <= j1 < M and S[i1, j1] != '#':
            E.append(((i, j), (i1, j1)))

G = nx.Graph()
G.add_nodes_from(A, bipartite=0)
G.add_nodes_from(B, bipartite=1)
G.add_edges_from(E)

M = nx.bipartite.hopcroft_karp_matching(G)
for key, item in M.items():
    i, j = key
    i1, j1 = item
    if i1 == i + 1:
        a, b = 'v', '^'
    elif i1 == i - 1:
        a, b = '^', 'v'
    elif j1 == j + 1:
        a, b = '>', '<'
    else:
        a, b = '<', '>'
    S[i, j], S[i1, j1] = a, b

print(len(M) // 2)
for row in S:
    print(''.join(row))


### FIXED CODE ###

import sys
import itertools
import numpy as np
import networkx as nx

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
S = np.frombuffer(read(), 'S1').reshape(N, -1)[:, :M].astype('U1')

G = nx.DiGraph()
G.add_nodes_from(['S', 'T'])
for i, j in itertools.product(range(N), range(M)):
    if S[i, j] == '#':
        continue
    if (i + j) % 2 == 0:
        G.add_edge('S', (i, j), capacity=1)
    else:
        G.add_edge((i, j), 'T', capacity=1)
    if (i + j) % 2 == 0:
        for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            i1, j1 = i + dx, j + dy
            if 0 <= i1 < N and 0 <= j1 < M and S[i1, j1] != '#':
                G.add_edge((i, j), (i1, j1), capacity=1)

flow_value, flow = nx.maximum_flow(G, 'S', 'T')
for i, j in itertools.product(range(N), range(M)):
    if (i, j) in flow:
        for v, f in flow[(i, j)].items():
            if v == 'T' or f == 0:
                continue
            i1, j1 = v
            if i1 == i + 1:
                a, b = 'v', '^'
            elif i1 == i - 1:
                a, b = '^', 'v'
            elif j1 == j + 1:
                a, b = '>', '<'
            else:
                a, b = '<', '>'
            S[i, j], S[i1, j1] = a, b

print(flow_value)
for row in S:
    print(''.join(row))
l=raw_input().split(" ")
a,b=int(l[0]),int(l[1])
print a*b+" "+2*a+2*b

### FIXED CODE ###

l=raw_input().split(" ")
a,b=int(l[0]),int(l[1])
print str(a*b)+" "+str(2*a+2*b)
N = int(input())
A = [int(a) for a in input().split()]

M = 10**6+1
L = [0]*M

for a in A:
    if L[a] >= 1:
        L[a] = 2
        continue
    L[a] = 1
    i = 2
    while a*i <= M:
        L[a*i] = 2
        i += 1

ans = 0
for a in A:
    if L[a] == 1:
        ans += 1
print(ans)

### FIXED CODE ###

N = int(input())
A = [int(a) for a in input().split()]

M = 10**6+1
L = [0]*M

for a in A:
    if L[a] >= 1:
        L[a] = 2
        continue
    L[a] = 1
    i = 2
    while a*i < M:
        L[a*i] = 2
        i += 1

ans = 0
for a in A:
    if L[a] == 1:
        ans += 1
print(ans)
from scipy.sparse.csgraph import dijkstra

class UnionFind():
  def __init__(self,n):
    self.n=n
    self.root=[-1]*(n+1)
    self.rank=[0]*(n+1)
  def FindRoot(self,x):
    if self.root[x]<0:
      return x
    else:
      self.root[x]=self.FindRoot(self.root[x])
      return self.root[x]
  def Unite(self,x,y):
    x=self.FindRoot(x)
    y=self.FindRoot(y)
    if x==y:
      return
    else:
      if self.rank[x]>self.rank[y]:
        self.root[x]+=self.root[y]
        self.root[y]=x
      elif self.rank[x]<=self.rank[y]:
        self.root[y]+=self.root[x]
        self.root[x]=y
        if self.rank[x]==self.rank[y]:
          self.rank[y]+=1
  def isSameGroup(self,x,y):
    return self.FindRoot(x)==self.FindRoot(y)
  def Count(self,x):
    return -self.root[self.FindRoot(x)]

n=int(input())
arr=[list(map(int,input().split())) for _ in range(n)]
edge=[]
for i in range(n):
  for j in range(n):
    if i>=j:
      continue
    edge.append((arr[i][j],(i,j)))
edge=sorted(edge,key=lambda x:x[0])
g=[[float('inf')]*n for _ in range(n)]
ans=0
cnt=0
i=0
t=UnionFind(n)
checked=[0]*((n*(n-1))//2)
while cnt<n-1:
  w,(a,b)=edge[i]
  if t.isSameGroup(a,b)==False:
    g[a][b]=w
    g[b][a]=w
    checked[i]=1
    ans+=w
    t.Unite(a,b)
    cnt+=1
  i+=1
for i in range((n*(n-1))//2):
  if checked[i]==1:
    continue
  w,(a,b)=edge[i]
  cost=int(dijkstra(g,indices=a)[b])
  print(w,a,b,cost)
  if w==cost:
    continue
  elif w<cost:
    g[a][b]=w
    g[b][a]=w
    ans+=w
  elif w>cost:
    print(-1)
    break
else:
  print(ans)

### FIXED CODE ###

def Warshall_Floyd(edges,N):
  for k in range(N):
    for i in range(N):
      for j in range(N):
        edges[i][j]=min(edges[i][j],edges[i][k]+edges[k][j])
  return edges

n=int(input())
arr=[list(map(int,input().split())) for _ in range(n)]
edge=[]
for i in range(n):
  for j in range(n):
    if i>=j:
      continue
    edge.append((arr[i][j],(i,j)))
edge=sorted(edge,key=lambda x:x[0])
g=[[float('inf')]*n for _ in range(n)]
for i in range(n):
  for j in range(n):
    g[i][j]=arr[i][j]
d=Warshall_Floyd(g,n)
ans=0
for w,(a,b) in edge:
  if d[a][b]<w:
    print(-1)
    break
  else:
    tmp=10**10
    for k in range(n):
      if k==a or k==b:
        continue
      tmp=min(tmp,d[a][k]+d[k][b])
    if w==tmp:
      continue
    else:
      ans+=w
else:
  print(ans)
list1 = [int(i) for i in input().split()]
print(int(list[0]))

### FIXED CODE ###

item = [int(i) for i in input().split()]
print(item[0]*item[1],2*(item[0]+item[1]))
s=input()
import collections
c = collections.Counter(l)

for i in c.values():
  if i!=1:
    print("no")
    exit()
print("yes")

### FIXED CODE ###

s=input()
import collections
c = collections.Counter(s)

for i in c.values():
  if i!=1:
    print("no")
    exit()
print("yes")
import sys

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

loop = 1

while (1):
  for i in l:
    if (i % (2 ** loop) != 0):
      print(loop - 1)
      sys.exit(0)
  loop = loop + 1


### FIXED CODE ###

l = input()

b = 0

for i in l[0], l[1], l[2]:
  if (int(i) == 1):
    b = b+1

print(b)
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = [0]*(N+1)
b = [0]*(M+1)
X = 0
Y = 0
cnt = 0
for n in range(N):
    a[n+1] = a[n] + A[n]
for n in range(M):
    b[n+1] = b[n] + B[n]
for n in range(1, N+1):
    if a[n] <= K:
        X = n
for m in range(1, M+1):
    if b[m] <= K:
        Y = m 
if a[X] < b[Y]:
    K = K - a[X]
    cnt += X
    if K - b[Y] == 0:
        cnt += Y
    else:
        for y in range(1, Y+1):
            if b[y] < K:
                cnt += 1
else:
    K = K - b[Y]
    cnt += Y
    if K - a[X] == 0:
        cnt += X
    else:
        for x in range(1, X+1):
            if a[x] < K:
                cnt += 1
print(cnt)

### FIXED CODE ###

a = int(input())

print(a + a**2 + a**3)
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def leven(s1, s2):
    n1 = len(s1)
    n2 = len(s2)
    dp = [[0]*(n1+1) for _ in range(n2+1)]

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

    for j in range(1, n2+1):
        for k in range(1, n1+1):
            m = min(dp[j-1][k]+1, dp[j][k-1])
            if s1[j-1] == s2[k-1]:  # 最後の文字削除
                m = min(m, dp[j-1][k-1])
            else:
                m = min(m, dp[j-1][k-1]+1)
            dp[j][k] = m
    print(dp[-1][-1])


s1 = input()[:-1]
s2 = input()[:-1]
leven(s1, s2)



### FIXED CODE ###

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def leven(s1, s2):
    n1 = len(s1)
    n2 = len(s2)
    dp = [[0]*(n1+1) for _ in range(n2+1)]

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

    for j in range(1, n2+1):
        for k in range(1, n1+1):
            m = min(dp[j-1][k], dp[j][k-1])+1
            if s1[k-1] == s2[j-1]:  # 最後の文字削除
                m = min(m, dp[j-1][k-1])
            else:
                m = min(m, dp[j-1][k-1]+1)
            dp[j][k] = m
    print(dp[-1][-1])


s1 = input()[:-1]
s2 = input()[:-1]
leven(s1, s2)
if N <=999:
    print("ABC")
else:
    print("ABD")

### FIXED CODE ###

N = int(input())
if N <=999:
    print("ABC")
else:
    print("ABD")
from bisect import bisect_right
n,d,a=map(int,input().split())
xh=[list(map(int,input().split()))for _ in range(n)]
xh.sort()
x=[]
h=[]
for xx,hh in xh:
  x.append(xx)
  h.append(hh)

not_imos=[0]*(n+1)
atk_n=0
ans=0
for i in range(n):
  atk_n-=imos[i]
  h[i]-=atk_n*a
  if h[i]<0:h[i]=0
  atk_i=0--h[i]//a
  ans+=atk_i
  atk_n+=atk_i
  imos[bisect_right(x,x[i]+d*2)]+=atk_i
print(ans)

### FIXED CODE ###

from bisect import bisect_left,bisect_right
n,d,a=map(int,input().split())
xh=[list(map(int,input().split()))for _ in range(n)]
xh.sort()
x=[]
h=[]
for xx,hh in xh:
  x.append(xx)
  h.append(hh)
imos=[0]*(n+1)
mi=0
ans=0
for i in range(n):
  mi-=imos[i]
  h[i]=max(h[i]-mi*a,0)
  atk=0--h[i]//a
  ans+=atk
  mi+=atk
  point=x[i]+d*2
  index=bisect_right(x,point)
  imos[index]+=atk
print(ans)
T = list(input())
for i in range(len(T)):
    if i == 0:
        if T[i] == "?":
            if T[i+1] == "D":
                T[i] = "P"
            else:
                T[i] = "D"
    else:
        if T[i] == "?":
            T[i] = "D"
print("".join(T))

### FIXED CODE ###

T = list(input())
for i in range(len(T)):
    if i == 0:
        if T[i] == "?":
            if len(T) == 1:
                T[i] = "D"
                break
            if T[i+1] == "D":
                T[i] = "P"
            else:
                T[i] = "D"
    else:
        if T[i] == "?":
            T[i] = "D"
print("".join(T))
def main():
    n = int(input())
    s = list(input().split())

    ans = 0
    now = 0
    for i, i_d in enumerate(s):
        if i_d == 'I':
            now += 1
            ans = max(ans, now)
        else:
            now -= 1

    print(ans)
if __name__ = '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input())
    s = list(input())

    ans = 0
    now = 0
    for i, i_d in enumerate(s):
        if i_d == 'I':
            now += 1
            ans = max(ans, now)
        else:
            now -= 1

    print(ans)
if __name__ == '__main__':
    main()
n,k,q=map(int,input().split())
a=[int(input()) for _ in range(q)]
point=[-k]*n
for i in range(q):
  point[a[i]]+=1
for i in range(n):
  if point[i]>-2k+q:
    print('Yes')
  else:
    print('No')
    
  


### FIXED CODE ###

n,k,q=map(int,input().split())
a=[int(input()) for _ in range(q)]
point=[-k]*n
for i in range(q):
  point[a[i]-1]+=1
for i in range(n):
  if point[i]>-2*k+q:
    print('Yes')
  else:
    print('No')