Harryxun/stf_run huggingface dataset:
N,W = map(int,input().split())
v = [0]*N;w = [0]*N

for i in range(N):
    v[i],w[i] = map(int,input().split())

value = [0 for i in range(W+1)]
for i in range(N):
    for j in range(W+1,-1,-1):
        if j<w[i]:
            value[j] = value[j]
        else:
            value[j] = max(value[j],value[j-w[i]]+v[i])

print(value[W])

### FIXED CODE ###

N,W = map(int,input().split())
v = [0]*N;w = [0]*N

for i in range(N):
    v[i],w[i] = map(int,input().split())

value = [0 for i in range(W+1)]
for i in range(N):
    for j in range(W,-1,-1):
        if j<w[i]:
            value[j] = value[j]
        else:
            value[j] = max(value[j],value[j-w[i]]+v[i])

print(value[W])
# -*- coding: utf-8 -*-

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

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

## Logic

ans = [0,0,0,0,0,0,0,0]
tmp = 0

for i in A:
    if A[i] >= 3200:
        tmp += 1
    else:
        ans[A[i]//400] = 1

print(max(1,sum(ans)),min(8,sum(ans)+tmp))



### FIXED CODE ###

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

## Library

import sys
from fractions import gcd
import math
from math import ceil,floor
import collections

## input

# n=int(input())
# A,B,C,D=map(int, input().split())
# string = input()
# yoko = list(map(int, input().split()))
# tate = [int(input()) for _ in range(N)]
# N, M = map(int,input().split()) 
#    P = [list(map(int,input().split())) for i in range(M)]

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

## Logic

ans = [0,0,0,0,0,0,0,0]
tmp = 0

for i in range(0,N):
    if A[i] >= 3200:
        tmp += 1
    else:
        ans[A[i]//400] = 1

print(max(1,sum(ans)),sum(ans)+tmp)
S=input()
n=len(S)
t=[]
for i in range(13):
  t.append(0)
s=t.copy()

t[0]=1
jkmap=[]
for j in range(10):
  jkmap.append([])
  for k in range(13):
    jkmap[j].append((10*k+j)%13)
for i in range(n):
  if S[i]=='?':
    if i%2==0:
      for j in range(10):
        for k in range(13):
          s[jkmap[j][k]]=(t[jkmap[j][k]]+t[k])%(10**9+7)
    
  else:
    j=int(S[i])
    for k in range(13):
      t[jkmap[j][k]]=(s[jkmap[j][k]]+t[k])%(10**9+7)
print(t[5])


### FIXED CODE ###

S=input()
n=len(S)
t=[]
for i in range(13):
  t.append(0)
t[0]=1
jkmap=[]
for j in range(10):
  jkmap.append([])
  for k in range(13):
    jkmap[j].append((10*k+j)%13)
for i in range(n):
  if S[i]=='?':
    tcopy=[0]*13
    for j in range(10):
      for k in range(13):
        tcopy[jkmap[j][k]]=(tcopy[jkmap[j][k]]+t[k])%(10**9+7)
    for j in range(13):
      t[j]=tcopy[j]
  else:
    j=int(S[i])
    tcopy=[0]*13
    for k in range(13):
      tcopy[jkmap[j][k]]=(tcopy[jkmap[j][k]]+t[k])%(10**9+7)
    for j in range(13):
      t[j]=tcopy[j]
print(t[5])
A,B,K=map(int,input().split())
l=[]

for i in range(2,min(A,B)+1):
    if A%i==0 and B%i==0:
        l.append(i)
sorted(l)[::-1]
print(l[K-1])

### FIXED CODE ###

A,B,K=map(int,input().split())
l=[]

for i in range(1,min(A,B)+1):
    if A%i==0 and B%i==0:
        l.append(i)
l=sorted(l)[::-1]
print(l[K-1])
N,K,X,Y=map(int,input().split(sep))
if N>K:
    print((K*X)+((N-K)*Y))
else:
    print(N*X)

### FIXED CODE ###

N=int(input())
K=int(input())
X=int(input())
Y=int(input())
if N>K:
    print(K*X+(N-K)*Y)
else:
    print(N*X)
MOD = 10**9 + 7
L = input()[::-1]

ans = [1]
for l in L:
  if l == '1':
    if len(ans) == 1:
      ans[0] *= 3
      ans[0] %= MOD
    else:
      ans = [sum(ans) % MOD]
  
  else:
    if len(ans) == 1:
      a = ans[0]
      ans = [a, a, a*3%MOD]
    else:
      a[2] *= 3
      a[2] %= MOD

print(ans[0])

### FIXED CODE ###

MOD = 10**9 + 7
L = input()[1:]

ans = [2, 1]
for l in L:
  ans[1] *= 3
  ans[1] %= MOD
  if l == '1':
    ans[1] += ans[0]
    ans[0] *= 2
    ans[0] %= MOD

print(sum(ans) % MOD)
import sys
input = sys.stdin.readline
import numpy as np

def print_sub(A, m, c):
    A -= 1
    print(m - np.nonzero(A)[0].size)
    c +=1
    if c < m:
        print_sub(A, m, c)
    else:
        print("0")
        

n= int(input())
A = [int(a) for a in input().split()]
A = np.array(A)
c = 0
print_sub(A, n-1, c)


### FIXED CODE ###

import sys
input = sys.stdin.readline

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

sub_list = [0] *n

for a in A:
  sub_list[a-1] +=1

for i in range(n):
  print(sub_list[i])
# -*- coding: utf-8 -*-
 
if 'o' == 'S'[:1] :
   x = 1
    
if 'o' == 'S'[1:2] :
   x = x + 1
 
if 'o' == 'S'[2:] :
   x = x + 1
 
y = 700 + x * 100
 
print(y)

### FIXED CODE ###

# -*- coding: utf-8 -*-
s = input()
a = s.count('o')
y = 700 + 100 * a
print(y)
import sys
N,M=map(int,input().split())
i=N
if(i%2==1):
    if(M%i==0):
        print(M//i)
        sys.exit(0)
    i+=1
if(M%i==0):
    print(M//i)
    sys.exit(0)
i+=1

    
while(i*2 <=M):
    if(M%i==0):
        break
    i+=2
if(i*2>M):
    i=M
print(M//i)

### FIXED CODE ###


n=int(input())
x=[0]*n
y=[0]*n
h=[0]*n
hizero=0
for i in range(n):
    x[i],y[i],h[i]=map(int,input().split())
    if(h[i]!=0):
        hizero=i

for i in range(101):
    for j in range(101):
        tmp_h=h[hizero]+abs(x[hizero]-i)+abs(y[hizero]-j)
        for k in range(0,n):
            if(max([0,tmp_h-abs(x[k]-i)-abs(y[k]-j)])!=h[k]):
                break
        if(max([0,tmp_h-abs(x[k]-i)-abs(y[k]-j)])==h[k]):
            break
    if(max([0,tmp_h-abs(x[k]-i)-abs(y[k]-j)])==h[k]):
        break
print("{} {} {}".format(i,j,tmp_h))
#include<iostream>
#include<vector>
using namespace std;
const long long INF = 1000000007ll;
int k[4];
void ku(int a) {
  for (int i = 3; i >= 0; i --) {
    k[i] = a % 4;
    a /= 4;
  }
}
bool ok(int a) {
  for (int i = 0; i < 4; i ++) {
    ku(a);
    if (i >= 1) swap(k[i - 1], k[i]);
    if (k[0] == 0 && k[1] == 1 && k[2] == 2) return false;
    if (k[1] == 0 && k[2] == 1 && k[3] == 2) return false;
  }
  return true;
}
int N;
vector<vector<long long>>memo(101, vector<long long>(64, -1));
long long dfs(int cur, int last3) {
  if (memo[cur][last3] != -1) return memo[cur][last3];
  if (cur == N) return 1;
  long long ret = 0;
  for (int i = 0; i < 4; i ++) {
    if (ok(last3 * 4 + i)) {
      int jun = last3 % 16;
      jun *= 4;
      jun += i;
      ret = (ret + dfs(cur + 1, jun)) % INF;
    }
  }
  memo[cur][last3] = ret;
  return ret;
}
int main () {
  cin >> N;
  cout << dfs(0, 63) << endl;
}
  


### FIXED CODE ###

N, MOD = int(input()), 10 ** 9 + 7
memo = [{} for i in range(N+1)]
def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i-1], t[i] = t[i], t[i-1]
        if ''.join(t).count('AGC') >= 1:
            return False
    return True
def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == N:
        return 1
    ret = 0
    for c in 'ACGT':
        if ok(last3 + c):
            ret = (ret + dfs(cur + 1, last3[1:] + c)) % MOD
    memo[cur][last3] = ret
    return ret
print(dfs(0, 'TTT'))
def main():
    *CMDs, = map(len, input().split('T'))
    X, Y = map(int, input().split())
    X -= CMDs[0]  # この操作だけは対称性がない

    def is_reachable(cmds, goal):
        SFT = 8000
        # [-SFT,SFT] -> [0,SFT*2]
        dp = 1 << SFT
        for d in cmds:
            dp = (dp >> d) | (dp << d)
        return (dp >> (SFT + goal)) & 1

    cond = is_reachable(CMDs[2::2], X) and is_reachable(CMDs[1::2], Y)
    print('Yes' if cond else 'No')


if __name__ == '__main__':
    main()


### FIXED CODE ###

# https://ikatakos.com/pot/programming_algorithm/contest_history/atcoder/2017/1216_arc087
# https://pitsbuffersolution.com/compro/atcoder/arc087d.php

# 最初の移動以外は、どんな操作手順後であっても、正負いずれの方向にも動けるのがミソ

def solve(s, x, y):
    X = 0
    Y = 1

    def update(move):
        st = set()
        for p in reachable[st_ind]:
            st.add(p + move)
            st.add(abs(p - move))
        reachable[st_ind] = st
        # 絶対値の等しい正負の値を取りうるので、正だけ扱う

    n = len(s)
    spl = map(len, s.split('T'))
    x -= next(spl)
    # ここでxを減らすと、
    # 個々のmove後のx,yは、原点対象になるので、正の座標の到達点だけ扱えばよくなる

    reachable = [{0}, {0}]
    st_ind = 1
    for move in spl:
        update(move)
        st_ind ^= 1

    return (abs(x) in reachable[X]) and (abs(y) in reachable[Y])
    # x,yが負であっても、それに対応した正の値が集合に含まれていれば、到達可能


if __name__ == '__main__':
    s = input()
    x, y = map(int, input().split())
    print('Yes' if solve(s, x, y) else 'No')
n=int(input())
A=list(map(int,input().split()))
c=[0]*(n+1)
for i in A:
  c[i] += 1
cnt=0
ans=0
for j in reversed(range(n)):
  if c[j]>=2 and cnt==0:
    ans=j
    cnt+=1
  elif c[j]>= 2 and cnt==1:
    ans*=j
    break
print(ans)

### FIXED CODE ###

c={}
input()
for i in list(map(int,input().split())):
    if i in c:
        c[i]+=1
    else:
        c[i]=1
d=[i for i in c.items() if i[1]>1]
c=sorted(d)
if len(d)==0 or (len(d)==1 and c[-1][1]<4):
    print(0)
else:
    if c[-1][1]>3:
        print(c[-1][0]**2)
    else:
        print(c[-1][0]*c[-2][0])
# a, b = map(int, input().split())
a = input()
b = input()

if b == 'H':
  print('H') if a == 'H' else print('D')
else:
  print('D') if a == 'H' else print('H')

### FIXED CODE ###

a, b = input().split()
print('H') if a == b else print('D')
a,b=map(int,input().split())
print(b//x-(a-1)//x)

### FIXED CODE ###

a,b,x=map(int,input().split())
print(b//x-(a-1)//x)
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
A = a%10
B = b%10
C = c%10
D = d%10
E = e%10
List =[A,B,C,D,E]
ans = 0
for i in range(5):
  if l[i] % 10 != 0:
    mini = min(9,l[i])
print(a+b+c+d+e+A+B+C+D+E-(10-mini))

### FIXED CODE ###

A = 0
B = []
B.append(0)
for i in range(5):
  I = int(input())
  A += I
  T = I % 10
  if T != 0:
    B.append(10 - T)
print(A + sum(B) - max(B))
a,b=map(int,input().split())
import math
c=math.gcd(a,b)
print((a*b)//c)


### FIXED CODE ###

import fractions
a,b=map(int,input().split())
c=fractions.gcd(a,b)
print((a*b)//c)
N,M = map(int,input().split())
dp = [float('inf')]*2 ** N
dp[0] = 0
for _ in range(N):
  a,b = map(int,input().split())
  c = sum([2**(int(i)-1) for i in input().split()])
  for s in range(2**N):
    t = s|c
    if dp[t] > dp[s] + a:
      dp[t] = dp[s] +a
ans = dp[-1]
if dp[-1] == float('inf'):
  print(-1)
else:
  print(ans)

### FIXED CODE ###

N,M = map(int,input().split())
dp = [float('inf')]*2 ** N
dp[0] = 0
for _ in range(M):
  a, b = map(int, input().split())
  c = sum([2**(int(i)-1) for i in input().split()])
  for s in range(2**N):
    t = s|c
    if dp[t] > dp[s] + a:
      dp[t] = dp[s] +a
ans = dp[-1]
if dp[-1] == float('inf'):
  print(-1)
else:
  print(ans)
n,k=map(int,input().split())
A=list(map(int,input().split()))


if k>=n:
  print(abs(A[k-1]-A[0]))
else:
  dp=list(range(n))
  for i in range(k):
    dp[i]=abs(A[i]-A[0])
  for i in range(n-k):
    temp=list(range(k))
    for j in range(k):
      temp[j-1]=dp[i]+abs(A[i+k]-A[i])
      dp[i+k]=min(temp1,temp2)
  print(dp[n-1])

### FIXED CODE ###

n,k=map(int,input().split())
A=list(map(int,input().split()))

if k>=n:
  print(abs(A[n-1]-A[0]))
else:
  dp=list(range(n))
  for i in range(k):
    dp[i]=abs(A[i]-A[0])
  for i in range(n-k):
    temp=list(range(k))
    for j in range(k):
      temp[j]=dp[i+j]+abs(A[i+k]-A[i+j])
    dp[i+k]=min(temp)
  print(dp[n-1])
l = int(input())

a = []
for i in range(1, l - 2 + 1):
    for j in range(1, i + 1):
        a.append(i * j * (l - i - j))
print(max(a))


### FIXED CODE ###

l = int(input())

print(l**3 / 27)
n,m,x=map(int,input().split())
c=[]
a=[]
for i in range(m):
	C,*A=map(int,input().split())
	c.append(C)
	a.append(A)

ans=[]
for i in range(2**n):
	A=[0]*m
	C=0
	lst=list(map(int,format(i,'b').zfill(n)))
	for j in range(m):
		if lst[j]==1:
			C+=c[j]
			for k in range(m):
				A[k]+=a[j][k]
	if all(elem>=x for elem in A):
		ans.append(C)
if len(ans):
	print(min(ans))
else:
	print(-1)

### FIXED CODE ###

n,m,x=map(int,input().split())
c=[]
a=[]
for i in range(n):
	C,*A=map(int,input().split())
	c.append(C)
	a.append(A)

ans=[]
for i in range(2**n):
	A=[0]*m
	C=0
	lst=list(map(int,format(i,'b').zfill(n)))
	for j in range(n):
		if lst[j]==1:
			C+=c[j]
			for k in range(m):
				A[k]+=a[j][k]
	if all(elem>=x for elem in A):
		ans.append(C)
if len(ans):
	print(min(ans))
else:
	print(-1)
N = int(input())
S = list(input())
#Dic={}
count=0

def ff(i,L):
    #global Dic
    global count

    if(len(S)>i):
        if(S[i] not in L):
            ff(i+1,L+S[i])
        ff(i+1,L)
    else:
        #Dic[L]=1
        count += 1

ff(0,"")
#print(len(Dic)-1)
print(count-1)

### FIXED CODE ###

n = int(input())
s = input()
l = {}
for c in s:
    if c in l:
        l[c] += 1
    else:
        l[c] = 1
ans = 1
for i in l.values():
    ans *= i+1
print((ans-1)%(10**9+7))
n, m = map(int, input().split())

j = []
for _ in range(n):
  a,b = map(int, input().split())
  if a <= m :
    j.append([a,b])

j.sort()
p = 0
temp = []
for i in range(1, m+1):
  while j and j[0][0] <= i:
      a,b = j.pop(0)
      temp.append(b)
  p+=max(temp)
  temp.remove(max(temp))
print(p)

### FIXED CODE ###


from heapq import *
n, m = map(int, input().split())

j = []
for _ in range(n):
    a,b = map(int, input().split())
    if a <= m :
        j.append((a,b))
j.sort(reverse=True)

ans = 0
q = []
for i in range(1, m+1):
    while j and j[-1][0] <= i:
        a,b = j.pop()
        heappush(q, -b)
    if q:
        ans -= heappop(q)
print(ans)
#!/usr/bin/env python3
import sys


def solve(N: int, P: int, S: int):
    if N == 1:
        print(1 if S[0]%P == 0 else 0)
    arr = [[int(S[i])%P for i in range(N)]]
    for i in range(2,N):
        prevArr = arr[-1]
        arr.append([0]*(N-i+1))
        for j in range(N-i+1):
            sum = 0
            for k in range(j):
                arr[-1][j] =(arr[-1][j]+prevArr[k])%P
    print(arr)


    # sum = 0
    # for i in range(N):
    #     sDiv = 0
    #     coeff = 1
    #     for j in range(i,N):
    #         sDiv= (sDiv*coeff + arr[j])%P
    #         coeff*=10
    #         if sDiv == 0:
    #             sum+=1
    # print(sum)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = int(next(tokens))  # type: int
    S = next(tokens)  # type: int
    solve(N, P, S)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from collections import defaultdict

def solve(N: int, P: int, S: str):
    if 10%P == 0:
        sum = 0
        for i in range(1,N+1):
            if int(S[-i]) % P == 0:
                sum += (N-i)+1
        print(sum)
        return
    else:
        current = 0
        C = 1
        counts = defaultdict(int)
        for i in range(1,N+1):
            if i == 1:
                current = int(S[-1])%P
            else:
                current = (int(S[-i])*C + current)%P
            counts[current]+=1
            C=C*10%P
        sum = 0
        for k in counts:
            c = counts[k]
            sum += int((c*(c-1)/2))
        sum += counts[0]
        print(sum)

    # sum = 0
    # for i in range(N):
    #     sDiv = 0
    #     coeff = 1
    #     for j in range(i,N):
    #         sDiv= (sDiv*coeff + arr[j])%P
    #         coeff*=10
    #         if sDiv == 0:
    #             sum+=1
    # print(sum)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = int(next(tokens))  # type: int
    S = next(tokens)  # type: int
    solve(N, P, S)

if __name__ == '__main__':
    main()
N, K = map(int, input().split())
Alist = list(map(int, input().split()))

gone = []


def dfs(index):
    if index in gone:
        return

    gone.append(index)
    dfs(Alist[index-1])


dfs(1)

for g in range(0, len(gone)-1):
    if Alist[gone[g]-1] == gone[-1]:
        gone = gone[g-1:]
        index = g-1


ansi = K % len(gone)

print(gone[ansi-index])


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
s = []
ord = [-1 for i in range(n+1)]
v = 1
c = 1
l = 0
while ord[v] == -1:
    ord[v] = len(s)
    s.append(v)
    v = a[v-1]
c = len(s) - ord[v]
l = ord[v]
if k < l:
    print(s[k])
else:
    k -= l
    k %= c
    print(s[l+k])
n= int(input())
m= int(input())
print((n-1)*(m-1))


### FIXED CODE ###

n,m =  (int(_) for _ in input().split())  
print((n-1)*(m-1))
import sys
sys.setrecursionlimit(2**5)

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

l=[list() for i in range(n)]
s=[0]*(n+1)

def dfs(t,p):
  s[t]+=s[p]
  for c in l[t]:
    if c!=p:
      dfs(c,t)

for i in range(n-1):
  a,b=map(int,input().split())
  l[a-1].append(b-1)
  l[b-1].append(a-1)

for i in range(q):
  p,q=map(int,input().split())
  s[p-1]+=q

dfs(0,n)

for i in range(n):
  print(s[i],' ',end="")
print()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input=sys.stdin.readline

n,q=map(int,input().split())
t=[[] for _ in range(n)]
c=[0 for _ in range(n)]

for i in range(n-1):
  a,b=map(int,input().split())
  t[a-1].append(b-1)
  t[b-1].append(a-1)

for i in range(q):
  p,x=map(int,input().split())
  c[p-1]+=x

def dsf(ci,pi):
  for i in t[ci]:
    if i != pi:
      c[i] += c[ci]
      dsf(i, ci)

dsf(0,-1)

print(*c)
import collections

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

L = [i+j for i, j in enumerate(A)]
R = [i-j for i, j in enumerate(A)]

l = collections.Counter(L)
r = collections.Counter(R)

for i in l.keys():
    ans += l[i]*r[i]

print(ans)

### FIXED CODE ###

import collections

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

L = [i+j for i, j in enumerate(A)]
R = [i-j for i, j in enumerate(A)]

l = collections.Counter(L)
r = collections.Counter(R)

ans = 0
for i in l.keys():
    ans += l[i]*r[i]

print(ans)
n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in a:
    while(i % 2 ==0):
        i // = 2
        ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = 0
for i in a:
    while not i %2:
        i//= 2
        ans += 1
print(ans)
a = int(input())
b = int(input())

s = 16
for i in range(16):
	if i%2 == 0:
		if a > 0:
			s -= 1
			a -= 1
	else:
		if b > 0:
			s -= 1
			b -= 1
	if s < 0:
		break

if a > 0 or b > 0:
	print(':(')
else:
	print('Yay!')

### FIXED CODE ###

a, b = list(map(int, input().split()))
 
s = 16
for i in range(16):
	if i%2 == 0:
		if a > 0:
			s -= 1
			a -= 1
	else:
		if b > 0:
			s -= 1
			b -= 1
	if s < 0:
		break
 
if a > 0 or b > 0:
	print(':(')
else:
	print('Yay!')
alphabet = [chr(i) for i in range(97, 97+26)]
n = int(input())
keta = 1
rest = 0
while True:
    if n <= 26 ** keta + rest:
        break
    rest += 26 ** keta
    keta += 1  
print(keta)
ans = ''
for i in range(keta-1,-1,-1):
    # 「26**iをいくつ含むか」をループで求める
    # 必ず1以上含む
    contain = 1
    while True:
        if n < contain * 26**i:
            break
        contain += 1
    contain -= 1
    ans += alphabet[contain-1]
    n -= contain * 26 ** i


print(ans)



### FIXED CODE ###

n = int(input())
alphabet = [chr(i) for i in range(97, 97+26)]
ans = ""
i = 0
while n - 26**i >= 0:
    n -= 26**i
    i += 1
# ここを抜けた時,iは桁数

for _ in range(i):
    q,r = divmod(n,26)
    n = q
    ans += alphabet[r]
print(ans[::-1])
H, W = map(int, input().split())
s = [input() for i in range(H)]

dx = [-1, 0, 0, 1]
dy = [0, 1, -1, 0]
for i in range(H):
    for j in range(W):
        flag = False
        for k in range(4):
            if s[i][j] == '#':
                nx = j + dx[k]
                ny = i + dy[k]
                if nx < 0 or nx >= W or ny < 0 or ny >= H:
                    continue
                if s[nx][ny] == '#':
                    flag = True
            else:
                flag = True
        if flag == False:
            print('No')
            exit()        

print('Yes')

### FIXED CODE ###

H, W = map(int, input().split())
s = [input() for i in range(H)]

dx = [-1, 0, 0, 1]
dy = [0, 1, -1, 0]
for i in range(H):
    for j in range(W):
        flag = False
        for k in range(4):
            if s[i][j] == '#':
                nx = j + dx[k]
                ny = i + dy[k]
                if nx < 0 or nx >= W or ny < 0 or ny >= H:
                    continue
                if s[ny][nx] == '#':
                    flag = True
            else:
                flag = True
        if flag == False:
            print('No')
            exit()        

print('Yes')
S = str(input())
i, ans = (0, 0)
while i>=0 and i<len(S)-1:
    print(S)
    if S[i]!=S[i+1]:
        S = S[:i]+S[i+2:] if i+2<len(S) else S[:i]
        ans += 2
        i = max(0, i-1)
    else:
        i+=1
print(ans)


### FIXED CODE ###

from collections import deque
sin = input()
queue = deque(maxlen=len(sin))
for s in sin:
    if len(queue)>0 and queue[-1] != s:
        queue.pop()
    else:
        queue.append(s)
#print("".join(arr))
print(len(sin)-len(queue))
N, M = map(int, input().split())

a = [int(input()) for i in range(M)]



dp = [0] * (N + 1)


if 1 in a and 2 in a:
    print(0)
    exit()

if 1 in a:
    dp[1] = 0
    dp[2] = 1
elif 2 in a:
    dp[1] = 1
    dp[2] = 0
else:
    dp[1] = 1
    dp[2] = 2

for i in range(3,N+1):
    if i in a:
        dp[i] = 0
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007

print(dp[N] % 1000000007)

### FIXED CODE ###

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

a = [int(input()) for i in range(M)]


for i in range(M - 1):
    if a[i] + 1 == a[i+1]:
        print(0)
        exit()

dp = [0] * (N + 1)
flag_a = [0] * (N + 1)

for i in range(M):
    flag_a[a[i]] = -1


if N == 1 and M != 1:
    print(1)
    exit()
elif N == 1 and M == 1:
    print(0)
    exit()

if 1 in a and 2 in a:
    print(0)
    exit()

if 1 in a:
    dp[1] = 0
    dp[2] = 1
elif 2 in a:
    dp[1] = 1
    dp[2] = 0
else:
    dp[1] = 1
    dp[2] = 2

for i in range(3,N+1):
    if flag_a[i] == -1:
        dp[i] = 0
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007

print(dp[N])
a, b = input()
print((a*3+b)//2)


### FIXED CODE ###

a,b =input().split()
print((int(a)*3+int(b))//2)
import collections
n = int (input())
ln = []
ln2 = []
for _ in range(n):
    ln.append( int (input()))

C = collections.Counter(ln)
 
ans = 0
for v in C.items():
    if (v%2 != 0):
        ans += 1

print(ans)

### FIXED CODE ###

import collections
n = int (input())
ln = []
ln2 = []
for _ in range(n):
    ln.append( int (input()))

C = collections.Counter(ln)
 
ans = 0
for k, v in C.items():
    if (v%2 != 0):
        ans += 1

print(ans)
s = ns()
atcg = set(["A", "T", "C", "G"])

ans = 0
tmp = 0
for si in s:
  if si in atcg:
    tmp += 1
  else:
    ans = max(ans, tmp)
    tmp = 0
    
ans = max(ans, tmp)
print(ans)

### FIXED CODE ###

s = input()
atcg = set(["A", "T", "C", "G"])

ans = 0
tmp = 0
for si in s:
  if si in atcg:
    tmp += 1
  else:
    ans = max(ans, tmp)
    tmp = 0
    
ans = max(ans, tmp)
print(ans)
data = input().split()  
n = int(data[0])
m = int(data[1])
x = [int(s) for s in input().split()]

x.sort()

y=[]
tmp=0
for i in x:
    y.append(i-tmp)
    tmp=i
y.pop(0)

y.sort()
y.reverse()

res=x[-1]-x[0]

if(len(y)+1 < n):
    n = len(y)+1

for i in range(n-1):
    res-=y[i]

print(res)

### FIXED CODE ###

data = input().split()
  
t = int(data[0])
x = int(data[1])


print(t/x)
s=str(input())

for i in range(len(s)):
  if s.index(s[i]) % 2 == 0:
    del s[i]
  else:
    continue
print(s)

### FIXED CODE ###

s=str(input())
ans=str('')
for i in range(0,len(s),2):
  ans+=s[i]
print(ans)