Harryxun/stf_run huggingface dataset:
N,M,V,P=map(int,input().split())
A=list(map(int,input().split()))
B=sorted(A, reverse=True)
count=P
for i in range(P,N):
    dif=sum(B[P-1:i])
    if V<=(P-1)+(N-i) and B[P-1]<=B[i]+M:
        count+=1
    elif M*(V-((P-1)+(N-i)))+dif<=(B[i]+M)*(i-P+1):
        count+=1
    else:
      break()
print(count)

### FIXED CODE ###

N,M,V,P=map(int,input().split())
B = sorted(list(map(int, input().split())))[::-1]
count=P
dif=0
for i in range(P,N):
    dif+=B[i-1]
    if V<=(P-1)+(N-i) and B[P-1]<=B[i]+M:
        count+=1
    elif dif-B[i]*(i-P+1)<=M*(N-V) and B[P-1]<=B[i]+M:
        count+=1
print(count)
a,b,c=map(input().split())
if (a[len(a)-1]==b[0])&(b[len(b)-1]==c[0]):
    print('YES')
else:
    print('NO')


### FIXED CODE ###

a,b,c=input().split()
if (a[len(a)-1]==b[0])&(b[len(b)-1]==c[0]):
    print('YES')
else:
    print('NO')
n = int(input())
*A, = map(int, input().split())

C = {a:0 for a in A}

for a in A:
    C[a] = C[a]+1

maxA = max(A)

D = {a:0 for a in A}

for a in A:
    t = 2
    while a*t <= maxA:
        D[a*t] = D[a*t]+1
        t = t+1

counter = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        counter = counter+1
        
print(counter)

### FIXED CODE ###

n = int(input())
*A, = map(int, input().split())
maxA = max(A)
# C[a] = A内のaの個数
C = {a: 0 for a in A}
for a in A:
    C[a] += 1
# D[a]=1: Aにaより小さいaの約数が存在する
D = {a: 0 for a in A}
for a in A:
    if C[a] > 0:
        t = 2
        while a * t <= maxA:
            D[a * t] = 1
            t += 1
ans = 0
for a in A:
    if C[a] == 1 and D[a] == 0:
        ans += 1
print(ans)
N = input()
A = map(str,raw_input().split())
Ab = A[:]
As = A[:]

def BubbleSort(A,N):
    for i in range(N):
        flag = 0
        for i in range(1,N):
            j = N - i
            if A[j][1] < A[j-1][1]:
                v = A[j]
                A[j] = A[j-1]
                A[j-1] = v
                flag = 1

def SelectionSort(A,N):
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j][1] < A[minj][1]:
                minj = j
        v = A[i]
        A[i] = A[minj]
        A[minj] = v

def Output(A):
    for i in range(N-1):
        print A[i],
    print A[-1]

def Stable(AA):
    l = [AA[i] for i in range(N-1) if AA[i][1] == AA[i+1][1]]
    for item in l:
        for i in range(N-1):
            if A[i][1] == item[1]:
                if A[i] == item:
                    msg = "Stable"
                    break
                else:
                    msg = "Not stable"
                    break
    print msg

SelectionSort(As,N)
BubbleSort(Ab,N)

Output(Ab)
Stable(Ab)
Output(As)
Stable(As)

### FIXED CODE ###

N = input()
A = map(str,raw_input().split())
Ab = A[:]
As = A[:]

def BubbleSort(A,N):
    for i in range(N):
        flag = 0
        for i in range(1,N):
            j = N - i
            if A[j][1] < A[j-1][1]:
                v = A[j]
                A[j] = A[j-1]
                A[j-1] = v
                flag = 1

def SelectionSort(A,N):
    for i in range(N):
        minj = i
        for j in range(i,N):
            if A[j][1] < A[minj][1]:
                minj = j
        v = A[i]
        A[i] = A[minj]
        A[minj] = v

def Output(A):
    for i in range(N-1):
        print A[i],
    print A[-1]

def Stable(AA):
    n = []
    for i in range(N-1):
        if AA[i][1] == AA[i+1][1] and AA[i][1] not in n:
            n.append(AA[i][1])
    l = []
    m = []
    for item in n:
        for i in range(N):
            if AA[i][1] == item:
                l.append(AA[i])
            if A[i][1] == item:
                m.append(A[i])
    if l == m:
        msg = "Stable"
    else:
        msg = "Not stable"
    print msg

SelectionSort(As,N)
BubbleSort(Ab,N)

Output(Ab)
Stable(Ab)
Output(As)
Stable(As)
N,M=map(int, input().split())
SC=list(list(map(int, input().split())) for i in range(M))

def get_unique_list(seq):
    seen = []
    return [x for x in seq if x not in seen and not seen.append(x)]
sc=get_unique_list(SC)

if (N==3) & (max(sc)[0]!=3):
    sc.append([1,1])
if (N==2) & (max(sc)[0]!=2):
    sc.append([2,1])

res=0
if M==0:
    res=-1
for i in range(len(sc)):
    for j in range(len(sc)):
        if (i!=j) & (sc[i][0]==sc[j][0]):
            res=-1
            break
    break
for i in range(len(sc)):
    if (M!=1) & (sc[i][0]==1) & (sc[j][1]==0):
        res=-1
        break
if N<len(sc):
    res=-1
if res!=-1:
    for i in range(len(sc)):
        res = res + sc[i][1]*(10**(N-sc[i][0]))
print(res)

### FIXED CODE ###

n=int(input())
if n%2==0:
    print(n//2)
else:
    print(n//2+1)
import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product
from math import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,m,l=map(int,input().split())
abc=[list(map(int,input().split())) for i in range(m)]
q=int(input())
st=[list(map(int,input().split())) for i in range(q)]

def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

n,w = n,m #n:頂点数　w:辺の数

d = [[float("inf") for i in range(n)] for i in range(n)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(w):
    x,y,z = abc[i]
    x,y=x-1,y-1
    d[x][y] = z
    d[y][x] = z
for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０
tmp=warshall_floyd(d)

newd = [[float("inf") for i in range(n)] for i in range(n)]

for i in range(n):
    for j in range(i+1,n):
        if d[i][j]<=l:
            newd[i][j]=1
            newd[j][i]=1
for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０

tmp=warshall_floyd(newd)

for i in range(q):
    s,t=st[i]
    s,t=s-1,t-1

    print(newd[s][t]-1 if newd[s][t]!=float('inf') else -1)

### FIXED CODE ###

import bisect
import copy
import heapq
import math
import sys
from collections import *
from itertools import accumulate, combinations, permutations, product

def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

n,m,l=map(int,input().split())
abc=[list(map(int,input().split())) for i in range(m)]
q=int(input())
st=[list(map(int,input().split())) for i in range(q)]

def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

n,w = n,m #n:頂点数　w:辺の数

d = [[float("inf") for i in range(n)] for i in range(n)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(w):
    x,y,z = abc[i]
    x,y=x-1,y-1
    d[x][y] = z
    d[y][x] = z
for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０
tmp=warshall_floyd(d)

newd = [[float("inf") for i in range(n)] for i in range(n)]

for i in range(n):
    for j in range(i+1,n):
        if d[i][j]<=l:
            newd[i][j]=1
            newd[j][i]=1
for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０

tmp=warshall_floyd(newd)

for i in range(q):
    s,t=st[i]
    s,t=s-1,t-1

    print(newd[s][t]-1 if newd[s][t]!=float('inf') else -1)
import sys
from functools import reduce
from fractions import gcd


def main():
    n, x = list(map(int, input().split()))
    values = list(map(int, input().split()))
    values.append(x)
    values.sort()
    v = [values[i + 1] - values[i] for i in range(len(values) - 1)]
    res = v[0]
    print(reduce(gcd, v[1:], v[0]))


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys


def main():
    a, b = list(map(int, input().split()))
    for i in range(1, 4):
        if a * b * i % 2 == 1:
            print('Yes')
            return

    print('No')


if __name__ == "__main__":
    main()
n = int(input())
r = int(input())

if n > 10:
  print(r)
elif n = 10:
  print(r)
else:
  print(r+100*(10-n))

### FIXED CODE ###

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

if n >= 10:
  print(r)
else:
  print(r+100*(10-n))
import sys

import numba as nb
import numpy as np

input = sys.stdin.readline


@nb.njit("void(i8,i8,i8,i8[:,:],i8[:,:])", cache=True)
def dfs(H, W, D, A, mp):
    position = [(-1, -1)] * (H * W + 1)
    for h in range(H):
        for w in range(W):
            position[A[h][w]] = (h, w)

    for i in range(1, H * W + 1 - D):
        h, w = position[i]
        y, x = position[i + D]
        mp[i][i + D] = abs(x - w) + abs(y - h)

    for i in range(1, H * W + 1 - 2 * D):
        for j in range(i + 2 * D, H * W + 1, D):
            mp[i][j] = mp[i][j - D] + mp[j - D][j]


def main():
    H, W, D = map(int, input().split())
    A = np.zeros(shape=(H, W), dtype=np.int64)
    for i in range(H):
        A[i] = list(map(int, input().split()))
    Q = int(input())
    L = [0] * Q
    R = [0] * Q
    for i in range(Q):
        L[i], R[i] = map(int, input().split())

    mp = np.zeros(shape=(H * W + 1, H * W + 1), dtype=np.int64)
    dfs(H, W, D, A, mp)

    ans = [mp[l, r] for l, r in zip(L, R)]
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

import numba as nb
import numpy as np

input = sys.stdin.readline


@nb.njit("void(i8,i8,i8,i8[:,:],i8,i8[:,:],i8[:])", cache=True)
def dfs(H, W, D, A, Q, LR, ans):
    position = [(-1, -1)] * (H * W + 1)
    for h in range(H):
        for w in range(W):
            position[A[h][w]] = (h, w)

    mp = np.zeros(shape=(H * W + 1), dtype=np.int64)

    for i in range(1, H * W + 1 - D):
        h, w = position[i]
        y, x = position[i + D]
        mp[i + D] = abs(x - w) + abs(y - h)

    for d in range(1, D + 1):
        mp[d::D] = np.cumsum(mp[d::D])

    for i in range(Q):
        l, r = LR[i]
        ans[i] = mp[r] - mp[l]


def main():
    H, W, D = map(int, input().split())
    A = np.zeros(shape=(H, W), dtype=np.int64)
    for i in range(H):
        A[i] = tuple(map(int, input().split()))
    Q = int(input())
    LR = np.zeros(shape=(Q, 2), dtype=np.int64)
    for i in range(Q):
        LR[i] = tuple(map(int, input().split()))

    ans = np.zeros(shape=Q, dtype=np.int64)
    dfs(H, W, D, A, Q, LR, ans)

    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()
N = int(input())
d = [int(input()) for i in range(N)]
sum = 0
for i in range(N):
    if i > 0:
        for j in range(i):
            sum = sum + d[i] * d[j]
print(sum)

### FIXED CODE ###

N = int(input())
d = list(map(int,input().split()))
sum = 0
for i in range(N):
    if i > 0:
        for j in range(i):
            sum = sum + d[i] * d[j]
print(sum)
a, b, h = map(int, input().split())
print(int((a + b) * h / 2))

### FIXED CODE ###

a, b, h = [int(input()) for _ in range(3)]
print(int((a + b) * h / 2))
from bisect import bisect_left as bl
import sys
N, Q = map(int, input().split())
stx = [tuple(map(int, sys.stdin.readline().split()))[::-1] for _ in range(N)]

stx.sort()

D = [int(sys.stdin.readline()) for _ in range(Q)] 
A = [0]*Q
X = [0]*N
for i, (x, t, s) in enumerate(stx):
    il = bl(D, s-x)
    ir = bl(D, t-x)
    A[il] += 2**i
    A[ir] += 2**i
    X[i] = x
for i in range(1, Q):
    A[i] = A[i]^A[i-1]
for a in A:
    if not a:
        print(-1)
    else:
        print(X[(a & -a).bit_length() - 1])

### FIXED CODE ###

from heapq import heappop as hpp, heappush as hp
import sys
N, Q = map(int, input().split())
stx = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]
stx = [(s-x, t-x, x) for s, t, x in stx]
stx.sort(reverse = True)

D = [int(sys.stdin.readline()) for _ in range(Q)] 
H = []
ans = [None]*Q

for i, d in enumerate(D):
    while stx and stx[-1][0] <= d:
        hp(H, stx.pop()[1:][::-1])    
    while H and H[0][1] <= d:
        hpp(H)
    if not H:
        ans[i] = -1
    else:
        ans[i] = H[0][0]

for a in ans:
    print(a)
N = int(input())
d = list(map(int, input().split()))


def combinations(d, out, i, j):
    if (j >= N):
        i += 1
        if (i >= N):
            return out
        else:
            j = i + 1
            if (j >= N):
                return out
    out += d[i] * d[j]

    return combinations(d, out, i, j + 1)


out = combinations(d, 0, 0, 1)

print(out)

### FIXED CODE ###

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

out = 0
for i in range(N):
    for j in range(i + 1, N):
        out += d[i] * d[j]

print(out)
def knapsack(n,W):
  if n==0 or W==0 :
    return 0
  elif dp[n][W]!=-1:
    return dp[n][W]
  
  else:
    if wt[n-1]<=W:
      
      dp[n][W]=max(knapsack(W,n-1),p[n-1]+knapsack(W-wt[n-1],n-1))
      return cache[(W,n)]
    else:
      dp[n][W]=knapsack(W,n-1)
      return cache[(W,n)]
    
wt,p=[],[]
n,w=map(int,input().split())

dp=[[-1 for i in range(W+1)]for j in range(n+1)]


for _ in range(n):
    temp_wt,temp_pr=map(int,input().split())
    wt.append(temp_wt)
    p.append(temp_pr)
print(knapsack(n,W))

### FIXED CODE ###

n,W=map(int,input().split())
t = [[-1 for i in range(W + 1)] for j in range(n + 1)] 
  
  
def knapsack(wt, val, W, n):     
  
    # base conditions 
    if n == 0 or W == 0: 
        return 0
    if t[n][W] != -1: 
        return t[n][W] 
  
    # choice diagram code 
    if wt[n-1] <= W: 
        t[n][W] = max(val[n-1] + knapsack(wt, val, W-wt[n-1], n-1),knapsack(wt, val, W, n-1)) 
        return t[n][W] 
    elif wt[n-1] > W: 
        t[n][W] = knapsack(wt, val, W, n-1) 
        return t[n][W] 

weight,profit=[],[]
for _ in range(n):
  w,p=map(int,input().split())
  weight.append(w)
  profit.append(p) 
print(knapsack(weight,profit, W, n))
import math
a,b,c = map(int,input().split())
L = a**2*b
l = L/2
# print(L,l)

if c <= l:
    t = 2*c/(a*b)
    T = t/b
    # print(t,T)
    atan1 = math.degrees(math.atan(T))
    print(90-atan1)
else:
    x = 2*c/a**2 - b
    t = a/(b-x)
    atan1 = math.degrees(math.atan(t))
    print(90-atan1)

### FIXED CODE ###

import math
a,b,c = map(int,input().split())
L = a**2*b
l = L/2
# print(L,l)
# if l:
#     print(0)
#     exit()
if c <= l:
    t = 2*c/(a*b)
    T = t/b
    # print(t,T)
    atan1 = math.degrees(math.atan(T))
    print(90-atan1)
elif L == c:
    print(0)
else:
    x = 2*c/a**2 - b
    t = a/(b-x)
    atan1 = math.degrees(math.atan(t))
    print(90-atan1)
def main():
    R, G, B, N = map(int, input().split())
    ans = 0
    cnt = 0
    for r in range(N + 1):
        for g in range(N + 1 - (R * r)):
            if (N - (R * r) - (G * g)) % B == 0 and N - (R * r) - (G * g) >= 0:
                cnt += 1
 
    print(cnt)
 
 
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    R, G, B, N = map(int, input().split())
    ans = 0
    cnt = 0
    for r in range(N + 1):
        for g in range(N + 1 - (R * r)):
            if (N - (R * r) - (G * g)) % B == 0 and N - (R * r) - (G * g) >= 0:
                cnt += 1

    print(cnt)


if __name__ == '__main__':
    main()
import sys, numpy as np, heapq
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson  
from collections import defaultdict
from itertools import product, permutations, combinations

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

N, u, v = map(int, input().split())



def dijkstra_heap(s,edge):
#始点sから各頂点への最短距離
    d = [10**20] * N
    used = [True] * N #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

AB = [list(map(int, input().split())) for _ in range(N-1)]

adjl = [[] for _ in range(N)]
for ab in AB:
    a, b = ab[0]-1, ab[1]-1
    adjl[a].append([1, b])
    adjl[b].append([1, a])

du = dijkstra_heap(u-1, adjl)
dv = dijkstra_heap(v-1, adjl)
dOK = [j for i, j in zip(du, dv) if i < j]

print(int(max(dOK)-1))


### FIXED CODE ###

import sys, heapq
from collections import defaultdict
from itertools import product, permutations, combinations

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

N, u, v = map(int, input().split())



def dijkstra_heap(s,edge):
#始点sから各頂点への最短距離
    d = [10**20] * N
    used = [True] * N #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d

AB = [list(map(int, input().split())) for _ in range(N-1)]

adjl = [[] for _ in range(N)]
for ab in AB:
    a, b = ab[0]-1, ab[1]-1
    adjl[a].append([1, b])
    adjl[b].append([1, a])

du = dijkstra_heap(u-1, adjl)
dv = dijkstra_heap(v-1, adjl)
dOK = [j for i, j in zip(du, dv) if i < j]

print(int(max(dOK)-1))
import sys
input = sys.stdin.readline

s = input()
q = int(input())

for i in range(q):
  tfc = input().split()
  if tfc[0] == '1':
    s.reverse()
    #s = s[::-1]
  else:
    if tfc[1] == '1':
      s = tfc[2] + s
    else:
      s = s + tfc[2]
print(s)

### FIXED CODE ###

from collections import deque

s = deque(input())
q = int(input())
 
r = 0
for i in range(q):
  tfc = input().split()
  if tfc[0] == '1':
    r += 1
  else:
    if tfc[1] == '1':
      if r % 2 == 0:
        s.appendleft(tfc[2])
        #s.insert(0, tfc[2])
      else:
        s.append(tfc[2])
    if tfc[1] == '2':
     if r % 2 == 1:
        s.appendleft(tfc[2])
     else:
        s.append(tfc[2])          
if r % 2 == 0:
  for i in s:
      print(i, end='')
else:
  for i in (reversed(s)):
    print(i, end='')
N = int(input())
 
list=[int(i) for i in input().split()]
 
answer=1
if 0 in list:
  print(0)
else:
  for i in range(N):
    answer = answer*A[i]
    if answer>10**18:
      print(-1)
      break
  else:
    print(answer)

### FIXED CODE ###

n =int(input())
ls =[]
ls =list(map(int,input().split()))
if 0 in ls:
	print(0)
else:
	ans = 1
	for a in ls:
		ans *= a
		if ans > 10 ** 18:
			ans = -1;
			break
		
	print(ans)
a,b,c,d = map(int,input().split())

if a - b <= d and b - c <= d or a - c <= d:
    print"Yes"
else:
    print"No"


### FIXED CODE ###

a = input().split()
if (abs(int(a[0]) - int(a[1])) <= int(a[3]) and abs(int(a[1]) - int(a[2])) <= int(a[3])) or abs(int(a[0]) - int(a[2])) <= int(a[3]):
    print("Yes")
else:
    print("No")
import sys
import numpy as np

def main(A):
    return 0

def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main', 'i8(i8[:])')(main)
    cc.compile()

if sys.argv[-1] == 'ONLINE_JUDGE':
    cc_export()
    exit(0)
if sys.argv[-1] != 'LOCAL':
    from my_module import solve

A = np.ones(10, dtype=np.int32)
ans = main(A)
print(ans)


### FIXED CODE ###

from functools import lru_cache
import sys
sys.setrecursionlimit(10**7)

T = int(input())
INF = 10**18

for _ in range(T):
    N, A, B, C, D = map(int, input().split())
    V = set()

    @lru_cache(maxsize=None)
    def search(now):
        if now == 0:
            return 0

        ret = INF
        for div, cost in zip((2, 3, 5), (A, B, C)):
            q, r = divmod(now, div)
            ret = min(
                ret,
                search(q) + cost + r * D,
                search(q + 1) + cost + (div - r) * D if q + 1 < now else INF,
                now * D
            )
        return ret

    print(search(N))
x, y = map(in
t, input().split())
ans = 0 if x>y else 1
while x*2<=y:
    ans+=1
    x=x*2
print(ans)

### FIXED CODE ###

x, y = map(int, input().split())
ans = 0 if x>y else 1
while x*2<=y:
    ans+=1
    x=x*2
print(ans)
r = int(input())
def cir(r):
  return math.pi*r**2
print(cir(r))

### FIXED CODE ###

import math
r = int(input())
def cir(r):
  return 2*math.pi*r
print(cir(r))
n = input()
  maxv = -1*10**9
  minv = 10**9

  for j in range(n-1):
    num = input()
    if maxv < num - minv:
      maxv = num -minv
    if minv > num:
      minv = num

  print maxv

### FIXED CODE ###

n = int(raw_input())
minv = int(raw_input())
maxv = -1*10**9
  
for j in range(n-1):
  nums = int(raw_input())  
  diff = nums - minv
  if maxv < diff:
    maxv = diff
  if nums < minv:
    minv = nums
  
print maxv
r**2

### FIXED CODE ###

r = int(input())
print(r**2)
def pin(type=int):
    return map(type,input().rstrip().split())
from math import gcd
def resolve():
    A,B=pin()
    ans=0
    plug=1
    while(1):
        ans+=1
        plug=plug-1+A
        if plug>=B:
            print(ans)
            break
resolve()

### FIXED CODE ###

def pin(type=int):
    return map(type,input().rstrip().split())

def resolve():
    A,B=pin()
    ans=0
    plug=1
    while(1):
        if plug>=B:
            print(ans)
            break
        ans+=1
        plug=plug-1+A
        
resolve()
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
time = 0
while time < K:
    if not A:
        ans += 1
        time += B[0]
        B.pop(0)
    elif not B:
        ans += 1
        time += A[0]
        A.pop(0)
    elif A[0] == B[0]:
        if A[1] > B[1]:
            time += B[0]
            ans += 1
            B.pop(0)
        else A[1] < B[1]:
            time += B[0]
            ans += 1
            A.pop(0)
    elif A[0] > B[0] :
        time += B[0]
        ans += 1
        B.pop(0)
    elif A[0] < B[0]:
        time += B[0]
        ans += 1
        A.pop(0)
print(ans)


### FIXED CODE ###

#import sys
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

a=[0]
b=[0]
for i in range(N):
    a.append(a[i]+A[i])
for j in range(M):
    b.append(b[j]+B[j])
ans = 0
l = M
for k in range(N+1):
    if a[k] > K:
        break
    while b[l] > K - a[k]:
        l -= 1
    ans = max(ans,k+l)
print(ans)
n=int(input())
al=[chr(ord('a') + i) for i in range(26)]
sakai=[]
k=0
for i in range(10):
  k+=26**(i+1)
  sakai.append(k)


for i in range(10):
  if (sakai[i]<n<=sakai[i+1]):
    n-=sakai[i]
    u=i+2
  elif (n>sakai[9]):
    n-=sakai[9]
    u=12

def base(n):
  ans=[]
  while(n>26):
    r=n%26
    n=(n-r)//26
    ans.append(r)
  ans.append(n)
  return ans

p=base(n-1)
if u-len(p)>0:
  ans_3='a'
  if u-len(p)>1:
    for j in range(u-len(p)-1):
      ans_3+='a'
    
for i in range(len(p)):
  if i==0:
    ans_2=al[p[len(p)-i-1]]
  else:
    ans_2=ans_2+al[p[len(p)-i-1]]
if u-len(p)>0:
  print(ans_3+ans_2)
else:
  print(ans_2)
               
    

### FIXED CODE ###

n=int(input())
al=[chr(ord('a') + i) for i in range(26)]
sakai=[]
k=0
for i in range(10):
  k+=26**(i+1)
  sakai.append(k)

if n<=26:
  n-=1
  u=1
elif n>sakai[9]:
  n-=sakai[9]+1
  u=11
for i in range(9):
  if (sakai[i]<n<=sakai[i+1]):
    n-=sakai[i]+1
    u=i+2

def base(n):
  ans=[]
  while(n>=26):
    r=n%26
    n=(n-r)//26
    ans.append(r)
  ans.append(n)
  return ans


p=base(n)

if u-len(p)>0:
  ans_3='a'
  if u-len(p)>1:
    for j in range(u-len(p)-1):
      ans_3+='a'
    
for i in range(len(p)):
  if i==0:
    ans_2=al[p[len(p)-i-1]]
  else:
    ans_2=ans_2+al[p[len(p)-i-1]]
if u-len(p)>0:
  print(ans_3+ans_2)
else:
  print(ans_2)
a, b = int(input().split())
print(a if a <= b else a - 1)


### FIXED CODE ###

a, b = map(int, input().split())
print(a if a <= b else a - 1)