Harryxun/stf_run huggingface dataset:
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()

t1 = t.replace("r","P")
t2 = t1.replace("s","R")
t3 = t2.replace("p","S")

# print(t3)
T = list(t3)
# print(T)
minus = 0
ls = ["R","S","P"]
for i in range(k,n):
    if i < n-k:
        tmp = T[i]
        before = T[i-k]
        after = T[i+k]
        if tmp == before:
            ls.remove(tmp)
            if tmp == after:
                T[i] = ls[0]
            else:
                ls.remove(after)
                T[i] = ls[0] 
                ls.append(after)
            ls.append(tmp)
            # if tmp == "R":
            #     minus += r
            # elif tmp == "S":
            #     minus += s
            # else:
            #     minus += p
            if T[i] == "R":
                minus += r
            elif T[i] == "S":
                minus += s
            else:
                minus += p
        else:
            pass
    else:
        tmp = T[i]
        before = T[i-k]
        # after = T[i+k]
        if tmp == before:
            ls.remove(tmp)
            # if tmp == after:
            #     T[i] = ls[0]
            # else:
            #     ls.remove(after)
            #     T[i] = ls[0] 
            #     ls.append(after)
            tmp = ls[0]
            ls.append(tmp)
            # if tmp == "R":
            #     minus += r
            # elif tmp == "S":
            #     minus += s
            # else:
            #     minus += p
            if T[i] == "R":
                minus += r
            elif T[i] == "S":
                minus += s
            else:
                minus += p
        else:
            pass


# print(T)

p1 = r * T.count("R")
# print(p1)
p2 = s * T.count("S")
# print(p2)
p3 = p * T.count("P")
# print(p3)
# print(minus)

print(p1+p2+p3-minus)

### FIXED CODE ###

n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = input()

t1 = t.replace("r","P")
t2 = t1.replace("s","R")
t3 = t2.replace("p","S")

# print(t3)
T = list(t3)
# print(T)
minus = 0
ls = ["R","S","P"]
for i in range(k,n):
    if i < n-k:
        tmp = T[i]
        before = T[i-k]
        after = T[i+k]
        if tmp == before:
            ls.remove(tmp)
            if tmp == after:
                T[i] = ls[0]
            else:
                ls.remove(after)
                T[i] = ls[0] 
                ls.append(after)
            ls.append(tmp)
            if T[i] == "R":
                minus += r
            elif T[i] == "S":
                minus += s
            elif T[i] == "P":
                minus += p
        else:
            pass
    elif i >= n-k:
        tmp = T[i]
        before = T[i-k]
        # after = T[i+k]
        if tmp == before:
            ls.remove(tmp)
            T[i] = ls[0]
            ls.append(tmp)
            if T[i] == "R":
                minus += r
            elif T[i] == "S":
                minus += s
            elif T[i] == "P":
                minus += p
        else:
            pass

# print(T)
p1 = r * T.count("R")
# print(p1)
p2 = s * T.count("S")
# print(p2)
p3 = p * T.count("P")
# print(p3)
# print(minus)

print(p1+p2+p3-minus)
x=[0,0,0,0,0,0,1,2,3,-1,-2,-3]
y=[1,2,3,-1,-2,-3,0,0,0,0,0,0]

def dfs(ty,tx):
    if L[ty][tx]==1:
        L[ty][tx]=0
        for i,j in zip(x,y):
            dx,dy=tx+i,ty+j
            if 0<=dx<=7 and 0<=dy<=7:
                dfs(dy,dx)
    return

n=input()
for i in range(n):
    L=[map(int,raw_input()) for j in range(8)]
    ax,ay=input(),input()
    dfs(ay-1,ax-1)
    print "Data %d:"%(i+1)
    for j in range(8):
        print "".join(map(str,L[j]))

### FIXED CODE ###

x=[0,0,0,0,0,0,1,2,3,-1,-2,-3]
y=[1,2,3,-1,-2,-3,0,0,0,0,0,0]

def dfs(ty,tx):
    if L[ty][tx]==1:
        L[ty][tx]=0
        for i,j in zip(x,y):
            dx,dy=tx+i,ty+j
            if 0<=dx<=7 and 0<=dy<=7:
                dfs(dy,dx)
    return

n=input()
for i in range(n):
    skip=raw_input()
    L=[map(int,raw_input()) for j in range(8)]
    ax,ay=input(),input()
    dfs(ay-1,ax-1)
    print "Data %d:"%(i+1)
    for j in range(8):
        print "".join(map(str,L[j]))
l = raw_input().split()

time=(l[0]+l[1])%24

print time

### FIXED CODE ###

l = map(int, raw_input().split())

time=(l[0]+l[1])%24

print time
n = input()
if 9 in n:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n = input()
if n[0] == '9' or n[1] == '9':
    print('Yes')
else:
    print('No')
A = int(input())
B = int(input())
C = int(input())
K = int(input())
S = A + B + C

if A >=K :
  print(1*A)
elif A + B >=K :
  print(1*A + 0*B)
else :
  print(1*A + 0*B -1*(K-A-B))

### FIXED CODE ###

A,B,C,K = map(int,input().split())

if K >A+B:
  print(A-1*(K-A-B))
elif A > K :
  print(K)
else :
  print(A)
X = int(input())
A = int(input())

if X<A:
	print(0)
else:
	print(10)


### FIXED CODE ###

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

if X<A:
	print(0)
else:
	print(10)
# -*- coding: utf-8 -*-
n,y = map(int,input().split())
for i in range(n+1):
    for j in range(n-i+1):
        k = n-i-j
        if y == 10000*i + 5000*j + 1000*(k):
            print('{0} {1} {2}'.format(i,j,k))
            exit()
print('-1 -1 -1')

### FIXED CODE ###

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

year, mon, day = input().split('/')
if year != 2018:
    year = 2018
print('{0}/{1}/{2}'.format(year,mon,day))
N=int(input())
print(N(N-1)//2)

### FIXED CODE ###

N=int(input())
print(N*(N-1)//2)
N = int(input()) K = int(input())
h = list(map(int, input().split()))
 
num =0
for i in range(N):
    if h[i]>K or h[i] == K:
        num =num+ 1
print(num)

### FIXED CODE ###

N,K = map(int, input().split())
h = list(map(int, input().split()))
 
num =0
for i in range(N):
    if h[i]>K or h[i] == K:
        num =num+ 1
print(num)
# -*- coding: utf-8 -*-

"""
計算式は以下のように示される
C_n = (1/n)*(1+C_(n-1)) + ((n-1)/n)*C_(n-1)  =  C_(n-1)+(1/n)
"""
import math
N = int(input())
X = list(map(int, input().split()))

def calc(i):
    if i==1:
        return 1
    return calc(i-1)+(1.0/i)

result = []
for i in range(1, N):
    temp = (X[i]-X[i-1])*calc(i)
    result.append(temp)
    
print(int(sum(result)*math.factorial(N-1))%(10**9+7))

### FIXED CODE ###

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

mod = 10**9 +7
N = int(input())
X = list(map(int, input().split()))

factorial=[1]
for i in range(1,N):
    factorial.append(factorial[-1] *i %mod)

ans=0
for i in range(1,N):
    ans = (ans*i + (X[-1]-X[i-1])*factorial[i-1]) %mod

print(ans)
n = input()

sum(list(map(int, str(n))))
a = sum % 9

if a == 0:
  print("Yes")

else:
  print("No")


### FIXED CODE ###

N = input()
s = len(N)
sum = 0

for i in range(s):
  sum += int(N[i])
  
if sum % 9 == 0:
  print("Yes")
  
else:
  print("No")
a, b = input().split()
d = {'A':0, 'B':1, 'C':2,'D':3, 'E':4}
if d[a]>d[b]:
    print('>')
elif d[a]<d[b]:
    print('<')
else:
    print('=')


### FIXED CODE ###

a, b = input().split()
d = {'A':0, 'B':1, 'C':2,'D':3, 'E':4, 'F':5}
if d[a]>d[b]:
    print('>')
elif d[a]<d[b]:
    print('<')
else:
    print('=')
n = map(int, input().split())
while n > 0:
    a += n
    n -= 1
print(a)

### FIXED CODE ###

n = int(input())
a = 0
while n > 0:
    a += n
    n -= 1
print(a)
import math
n,X=map(int,input().split())
z=list(map(int,input().split()))
x=[]
for j in range(n):
        x.append(abs(X-z[j]))
g=x[0]
for i in range(1,n):
        g=math.gcd(g,x[i])
print(g)

### FIXED CODE ###

from fractions import gcd
from functools import reduce

N, X = map(int,input().split()) 
nums=list(map(int,input().split()))
nums=list(map(lambda i: abs(i - X),nums))
 
D = reduce(gcd, nums)
print(D)
n=int(input())
def alpha2num(alpha):
    num=0
    for index,item in enumerate(list(alpha)):
        num+=pow(26,len(alpha)-index-1)*(ord(item)-ord("A")+1)
    return num
if 1<=n<=26:
    n=n
    print(alpha2num(n))
elif 27<=n<=702:
    n-=26
    print(alpha2num(n))
elif 703<=n<=18278:
    n-=702
    print(alpha2num(n))
elif 18279<=n<=475254:
    n-=18278
    print(alpha2num(n))
else:
    n-=475254
    print(alpha2num(n))

### FIXED CODE ###

n=int(input())
def alpha2num(alpha):
    if alpha<=26:
        return chr(64+alpha)
    elif alpha%26==0:
        return alpha2num(alpha//26-1)+chr(90)
    else:
        return alpha2num(alpha//26)+chr(64+alpha%26)
print(alpha2num(n).lower())
def combination_to_index(a,b,n):
    if(b<a):
        c = a
        a = b
        b = c
    return (2*n-a)*(a-1)//2+b-a

def dfs(gp):
    max_d = 0
    stk = []
    stk.append((0,set(),0))
    while stk:
        nxt = []
        n,seen,d = stk.pop()
        res = -1
        if(n in seen):
            continue
        max_d = max(max_d,d)
        for x in gp[n]:
            nxt.append((x,seen.union(set([n])),d+1))
        stk = nxt+stk
    return max_d

def main():
    N = int(input())
    M = N*(N-1)//2
    gp = [[] for _ in range(M+1)]
    for a in range(1,N+1):
        A = [int(x) for x in input().split()]
        for ind,b in enumerate(A[:-1]):
            gp[combination_to_index(a,b,N)].append(combination_to_index(a,A[ind+1],N))
    cnts = [0]*(M+1)
    for i in gp:
        for j in i:
            cnts[j]+=1

    for ind,i in enumerate(cnts):
        if(i==0 and ind!=0):
            gp[0].append(ind)

    d = dfs(0,set(),gp,0)
    if(d==0):
        print(-1)
    else:
        print(d)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import deque
input = sys.stdin.readline
def combination_to_index(a,b,n):
    if(b<a):
        a,b = b,a
    return (2*n-a)*(a-1)//2+b-a

def main():
    N = int(input())
    M = N*(N-1)//2
    gp = [[] for _ in range(M+1)]
    cnts = [0]*(M+1)
    for a in range(1,N+1):
        A = [int(x) for x in input().split()]
        for ind,b in enumerate(A[:-1]):
            fr = combination_to_index(a,b,N)
            to = combination_to_index(a,A[ind+1],N)
            gp[fr].append(to)
            cnts[to] += 1

    for ind,i in enumerate(cnts):
        if(i==0 and ind!=0):
            gp[0].append(ind)
            cnts[ind]+=1

    ans = 0
    cnt = 0
    stk = deque()
    stk.append((0,0))
    while stk:
        n,ans = stk.popleft()
        for x in gp[n]:
            cnts[x]-=1
            if(cnts[x]==0):
                stk.append((x,ans+1))
                cnt += 1
    if(cnt!=M):
        print(-1)
    else:
        print(ans)

if __name__ == '__main__':
    main()
X,N = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]

if N != 0:
    sorted_p = sorted(p)
    flag = 0

    for x in range(N-1):
        diff = abs(X - sorted_p[x])
        if diff == 0:
            flag = 1
            break
        if diff <= abs(X-sorted_p[x+1]):
            break

    def checknum(d,loweridx,upperidx):
        upper = sorted_p[upperidx]
        lower = sorted_p[loweridx]
        if X-d == lower:
            if X+d == upper:
                if loweridx == 0:
                    print(X-d-1)
                elif upperidx == N-1:
                    print(X+d+1)
                else:
                    checknum(d+1,loweridx-1,upperidx+1)
            elif X-d == lower and X+d != upper:
                print(X+d)        
        else:
            return print(X-d)

    if not(X in sorted_p):
        print(X)
    elif x == 0:
        print(X-1)
    elif x == N-1:
        a=1
        while(sorted_p[x-a] == X):
            a -= 1
        if sorted_p[x] != X-1:
            print(X-1)
        else:
            print(X+1)
    else:
        checknum(1,x-1,x+1)
else:
    print(X)

### FIXED CODE ###

X,N = [int(x) for x in input().split()]
p = [int(x) for x in input().split()]

for d in range(X+1):
    for f in [-1,1]:
        a = X + d*f
        if p.count(a) == 0:
            print(a)
            exit()
S = list(input())
T = list(input())

cnt = 0

for i in range(0,3):
  if S[i] == T[i]:
    cnt += 1

pirn(cnt)
  

### FIXED CODE ###

S = list(input())
T = list(input())

cnt = 0

for i in range(0,3):
  if S[i] == T[i]:
    cnt += 1

print(cnt)
n = int(input())
#a,b = map(int,input().split())
li = list(map(int,input().split()))
li.sort()
#print(li)
num = 0

for i in range(n-4):
    if li[i] == li[i+1] ==li[i+2] == li[i+3]:
        li.remove(li[i])
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if li[i]+li[j]>li[k] and li[i]<li[j]+li[k] and li[i]+li[k]>li[j]:
                num += 1
print(num)

### FIXED CODE ###

n = int(input())
li = list(map(int,input().split()))
li.sort()

num = 0
import bisect
for i in range(n):
    for j in range(i+1,n):
        num += bisect.bisect_left(li,li[i]+li[j])-(j+1)
print(num)
a = input()
if a == type.lower():
    print('a')
elif a == type.upper():
    print('A') 
	

### FIXED CODE ###

a = input()
if a.islower():
    print('a')
elif a.isupper():
    print('A')
x,y.z=map(int,input().split())
print(z,x,y)

### FIXED CODE ###

x,y,z=map(int,input().split())
print(z,x,y)
H,W=map(int,input().split())
A=[[int(j) for j in input().split()] for _ in range(H)]
from collections import defaultdict
d=defaultdict(int)
for a in A:
  for j in a:
    d[j]+=1

four=0
two=0
one=0

for i in  range(26):
  c=chr(ord("a")+i)
  if d[c]>=4:
    four+=d[c]//4 
    d[c]%=4
  if d[c]>=2:
    two+=d[c]//2
    d[c]%=2
  if d[c]>=1:
    one+=d[c]
    d[c]-=1
    
if four<=(H//2)*(W//2):    
  print("No")
  exit(0)
four-=(H//2)*(W//2)
two+=four*2

if H%2==1:
  if two < W//2:
    print("No")
    exit()
  two-=W//2
if W%2==1:
  if two <H//2:
    print("No")
    exit()
  two-=H//2

print("Yes")
  

### FIXED CODE ###

H,W=map(int,input().split())
A=[input() for _ in range(H)]
from collections import defaultdict
d=defaultdict(int)
for a in A:
  for j in a:
    #print("j: ",j)
    d[j]+=1

four=0
two=0
one=0

for i in  range(26):
  c=chr(ord("a")+i)
  if d[c]>=4:
    four+=d[c]//4 
    d[c]%=4
  if d[c]>=2:
    two+=d[c]//2
    d[c]%=2
  if d[c]>=1:
    one+=d[c]
    d[c]-=1

if four<(H//2)*(W//2):    
  print("No")
  exit(0)
four-=(H//2)*(W//2)
two+=four*2

if H%2==1:
  if two < W//2:
    print("No")
    exit()
  two-=W//2
if W%2==1:
  if two <H//2:
    print("No")
    exit()
  two-=H//2

print("Yes")
import numpy as np

def penetrate(x, y, idx):
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]

        if 0 <= nx < h and 0 <= ny < w and A[nx][ny] == "." and d[nx][ny] == -1:
            d[nx][ny] = idx + 1


h, w = map(int, input().split())
d = [[-1] * w for _ in range(h)]

A = [[] for i in range(h)]

for i in range(h):
    A[i] = list(input())
    for j in range(w):
        if A[i][j] == "#":
            d[i][j] = 0

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

idx = 0
while True:
    count = 0
    for i in range(h):
        for j in range(w):
            if d[i][j] == idx:
                penetrate(i, j, idx)
            if d[i][j] == -1:
                count += 1
    idx += 1
    if count == 0:
        break

print(np.max(d))


### FIXED CODE ###

from collections import deque

def penetrate(x, y, count):
    global max_idx
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]

        if 0 <= nx < h and 0 <= ny < w and A[nx][ny] == "." and d[nx][ny] == -1:
            d[nx][ny] = count + 1
            q.append((nx, ny, d[nx][ny]))
            max_idx = max(max_idx, d[nx][ny])


h, w = map(int, input().split())
d = [[-1] * w for _ in range(h)]

A = [[] for i in range(h)]
q = deque()

for i in range(h):
    A[i] = list(input())
    for j in range(w):
        if A[i][j] == "#":
            d[i][j] = 0
            q.append((i, j, d[i][j]))

dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
max_idx = 0

while len(q) > 0:
    idx = q.popleft()
    penetrate(idx[0], idx[1], idx[2])

print(max_idx)
n, k = map(int, input().split())
x = list(map(int, input().split()))
mintime = 10**20
for i in range(n-k+1):
    left = x[i]
    right = x[i+k-1]
    abss = (abs(left), abs(right))
    if left * right >= 0:
        mintime = min(mintime, max(abss))
    else:
        mintime = min(mintime, min(abss) * 2 + max(abss))
print(mintime)


### FIXED CODE ###

n, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(n)]
inf = 10 ** 10
def dfs(k, a, b, c):
    if k == n:
        if 0 in (a,b,c):
            return inf
        return abs(A - a) + abs(B - b) + abs(C - c) - 30
    ret = [0] * 4
    ret[0] = dfs(k+1, a + l[k], b, c) + 10
    ret[1] = dfs(k+1, a, b + l[k], c) + 10
    ret[2] = dfs(k+1, a, b, c + l[k]) + 10
    ret[3] = dfs(k+1, a, b, c)
    return min(ret)
print(dfs(0, 0, 0, 0))
import sys

N,M, K = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(M)]
CD = [list(map(int,input().split())) for i in range(K)]


#xの木の根を求める
def root(x,li): 
    if li[x] == x:
        return x
    else:
        li[x] = root(li[x],li)
        return li[x]

#xとyが同じ集合に属するかの判定
def find(x,y,li):
    return root(x,li) == root(y,li)

#xとｙを併合
def union(x,y,li):
    x = root(x,li)
    y = root(y,li)
    if x==y:
        return
    else:
        li[x]=y

li1 = [i for i in range(N)]
li2 = [i for i in range(N)]

for i in range(M):
    a = AB[i][0]
    b = AB[i][1]
    union(min(a-1,b-1),max(a-1,b-1),li1)
# for i in range(K):
#     c = CD[i][0]
#     d = CD[i][1]
#     union(c-1,d-1,li2)

mm = [0 for i in range(max(li1))]
for i in range(N):
    m = root(i,li1)
    mm[m-1] += 1

# print(li1)
# print(mm)
ans = [mm[li1[i]-1]-1 for i in range(N)]
# print(ans)

for i in range(M):
    a = AB[i][0]
    b = AB[i][1]
    ans[a-1] -= 1
    ans[b-1] -= 1


for i in range(K):
    c = CD[i][0]
    d = CD[i][1]
    if find(c-1,d-1,li1):
        ans[c-1] -= 1
        ans[d-1] -= 1
print(*ans)





### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

N,M, K = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(M)]
CD = [list(map(int,input().split())) for i in range(K)]


#xの木の根を求める
def root(x,li): 
    if li[x] == x:
        return x
    else:
        li[x] = root(li[x],li)
        return li[x]

#xとyが同じ集合に属するかの判定
def find(x,y,li):
    return root(x,li) == root(y,li)

#xとｙを併合
def union(x,y,li):
    x = root(x,li)
    y = root(y,li)
    if x==y:
        return
    else:
        li[x]=y

li1 = [i for i in range(N)]
li2 = [i for i in range(N)]

for i in range(M):
    a = AB[i][0]
    b = AB[i][1]
    # print(str(i)+" ",end="")
    union(min(a-1,b-1),max(a-1,b-1),li1)
# for i in range(K):
#     c = CD[i][0]
#     d = CD[i][1]
#     union(c-1,d-1,li2)

mm = [0 for i in range(max(li1)+1)]
for i in range(N):
    m = root(i,li1)
    mm[m] += 1

# print(li1)
# print(mm)
ans = [mm[li1[i]]-1 for i in range(N)]
# print(ans)

for i in range(M):
    a = AB[i][0]
    b = AB[i][1]
    ans[a-1] -= 1
    ans[b-1] -= 1


for i in range(K):
    c = CD[i][0]
    d = CD[i][1]
    if find(c-1,d-1,li1):
        ans[c-1] -= 1
        ans[d-1] -= 1
print(*ans)
from collections import Counter, deque

N, K = map(int, input().split())
A = list(map(int, input().split()))
INF = 10**18

cnt = Counter()
cnt[0] = 1
que = deque([-INF] * (K - 1) + [0])
sumR = 0
ans = 0
for right, a in enumerate(A, start=1):
    cnt[que.popleft()] -= 1
    sumR = (a + sumR) % K
    D = (sumR - right) % K
    ans += cnt[D]
    cnt[D] += 1
    que.append(D)
print(ans)


### FIXED CODE ###

from collections import defaultdict, deque

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

cumA = [0] * (N + 1)
for i in range(1, N + 1):
    cumA[i] = cumA[i - 1] + A[i - 1]

cnt = defaultdict(int)
que = deque([])
ans = 0

for i, c in enumerate(cumA):
    while que and que[0][0] <= i - K:
        cnt[que.popleft()[1]] -= 1
    diff = (i - c) % K
    ans += cnt[diff]
    cnt[diff] += 1
    que.append((i, diff))
print(ans)
x=input()
print(x**3)

### FIXED CODE ###

x=int(input())
print(x**3)
n,*a=map(int,open(0).read().split())
a.sort()
num=[True for i in range(a[-1]+1)]
for i in range(n):
  if num[i]:
    for j in range(a[-1]//a[i]):
      if j<2:
        continue
      num[a[i]*j]=False
    if i!=n-1 and a[i]==a[i+1]:
      num[a[i]]=False
  else:
    pass
ans=0
for i in range(n):
  if num[a[i]]:
    ans+=1
print(ans)

### FIXED CODE ###

n,*a=map(int,open(0).read().split())
a.sort()
num=[True for i in range(a[-1]+1)]
for i in range(n):
  if num[a[i]]:
    for j in range(a[-1]//a[i]+1):
      if j<2:
        continue
      num[a[i]*j]=False
    if i==n-1:
      pass
    elif a[i]==a[i+1]:
      num[a[i]]=False
    else:
      pass
  else:
    continue
ans=0
for i in range(n):
  if num[a[i]]:
    ans+=1
print(ans)
n,m = map(int,input().split())

max = m//n
lis = []


for i in range(int(m**0.5)):
    if m%i == 0:
        lis.append(i)

lis = lis[::-1]

if m%n == 0:
    print(max)
else:
    for line in lis:
        if line > max:
            continue
        else:
            if lis%n == 0:
                print(lis)
                break





### FIXED CODE ###

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

max = m//n
lis = []


for i in range(int(m**0.5)):
    if i != 0 and m%i == 0:
        lis.append(i)
l = len(lis)
for i in range(l):
    if m/lis[i] != lis[i]:
        lis.append(m//lis[i])

lis.sort()
lis = lis[::-1]

if m%n == 0:
    print(max)
else:
    for line in lis:
        if line > max:
            continue
        else:
            if m/line > n:
                print(line)
                break
a = int(input())
print(int(a+a^2+a3))

### FIXED CODE ###

a = int(input())
print(int(a+a*a+a*a*a))
def factor(x):
  factor=[]
  if x==1:
    return
  else:
    i=2
    while x>1:
      if x%i==0:
        factor.append([i,1])
        x/=i
        while x%i==0:
          factor[-1][1]+=1
          x/=i
      i+=1
    return factor

n,m=(int(i) for i in input().split(' '))
factor=factor(m)
ans=1
for data in factor:
  data[1]=data[1]//n
  ans=ans*(data[0]**data[1])
print(ans)


### FIXED CODE ###

import random

def is_prime(q,k=50):
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    d = (q-1)>>1
    while d&1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1,q-1)
        t = d
        y = pow(a,t,q)
        while t != q-1 and y != 1 and y != q-1: 
            y = pow(y,2,q)
            t <<= 1
        if y != q-1 and t&1 == 0:
            return False
    return True

n,m=(int(i) for i in input().split(' '))
for i in range(1,n):
  if m%i==0 and (is_prime(i) or i==1) and is_prime(m//i) and (i==1 or m//i<n):
    print('1')
    exit()
for i in range(n,m+1):
  if i==m:
    print(1)
    break
  if m%i==0:
    print(m//i)
    break
  if m-i-n>0 and m%(m-i-n)==0 and m//(m-i-n)>n:
    print(m-i-n)
    break
N, K = map(int, input().split())

xneg = []
xpos = []

for tmp in input().split():
    if int(tmp) < 0:
        xneg.append(int(tmp))
    else:
        xpos.append(int(tmp))

xneg.sort(reverse=True)
xpos.sort()

xp = 0
xn = 0
pre = 0
last1 = 0
last2 = 0
for i in range(K):
    if i == K-1:
        last1 = pre
        if len(xpos) > 0 and len(xneg) > 0:
            if xpos[xp] <= abs(xneg[xn]):
                last2 = xpos[xp]
            else:
                last2 = xneg[xn]
        elif len(xpos) > 0:
            last2 = xpos[xp]
        else:
            last2 = xneg[xn]
    else:
        if len(xpos) > 0 and len(xneg) > 0:
            if xpos[xp] <= abs(xneg[xn]):
                pre = xpos[xp]
                xp += 1
            else:
                pre = xneg[xn]
                xn += 1
        elif len(xpos) > 0:
            ans = xpos[K-1]
            print(ans)
            exit()
        else:
            ans = xneg[K-1]
            print(abs(ans))
            exit()

ans = 2*abs(min(last1,last2)) + abs(max(last1,last2))
print(ans)
    

### FIXED CODE ###

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

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

if N == 1 or K == 1:
    print(x[0])
    exit()

ans = 10**100
for i in range(N):
    if i < N-K+1:
        tmp1 = abs(x[i]) + abs(x[i] - x[i+K-1])
        tmp2 = abs(x[i+K-1]) + abs(x[i] - x[i+K-1])
        ans = min(tmp1, tmp2, ans)

print(ans)
n,k=map(int,input().split())
p=list(map(int(input().split()))
p.sort()
q=p[:k]
print(sum(q))
       

### FIXED CODE ###

n,k=map(int,input().split())
p=list(map(int,input().split()))
p.sort()
q=p[:k]
print(sum(q))