Harryxun/stf_run huggingface dataset:
N, M, K = [int(x) for x in input().split(' ')]
A = [int(x) for x in input().split(' ')]
B = [int(x) for x in input().split(' ')]

def search(i, j, count, time):
  a = count 
  b = count 
  if i < N and K >= time + A[i]:
    a = search(i + 1, j, count + 1, time + A[i])
  if j < M and K >= time + B[j]:
    b = search(i, j + 1, count + 1, time + B[j])
  return max(a, b)

print(search(0, 0, 0, 0))

### FIXED CODE ###

N, M, K = [int(x) for x in input().split(' ')]
A = [int(x) for x in input().split(' ')]
B = [int(x) for x in input().split(' ')]

# N, M, K = [int(x) for x in [2e3, 2e3, 1e9]]
# A = [int(x) for x in range(N)]
# B = [int(x) for x in range(M)]

A_deep = 0
B_deep = 0
time = 0
while A_deep < N:
  if K >= time + A[A_deep]:
    time += A[A_deep]
    A_deep += 1
  else:
    break 
while B_deep < M:
  if K >= time + B[B_deep]:
    time += B[B_deep]
    B_deep += 1
  else:
    break 

i = A_deep - 1
j = B_deep
ans = i + j + 1
while i >= 0 and j < M:
  while i >= 0:
    time -= A[i]
    i -= 1
    if K - time >= B[j]:
      break 
  while j < M:
    if K >= time + B[j]:
      time += B[j]
      j += 1
      ans = max(ans, i + j + 1)
    else: 
      break 


print(ans)
S=input()
if 1<=int(S[:2])<=12 and 13<=int(S[2:]) or int(S[2:])==0:
    print("MMYY")
elif 1<=int(S[2:])<=12 and 13<=int(S[:2]) or int(S[:2])==0:
    print("YYMM")
elif 1<=int(S[2:])<=12 and 1<=int(S[:2])<=12:
    print("AMBIGUOUS")2
elif 13<=int(S[2:]) or int(S[2:])==0 and 13<=int(S[:2]) or int(S[:])==0:
    print("NA")

### FIXED CODE ###

S=input()
if 1<=int(S[:2])<=12 and (13<=int(S[2:]) or int(S[2:])==0):
    print("MMYY")
elif 1<=int(S[2:])<=12 and (13<=int(S[:2]) or int(S[:2])==0):
    print("YYMM")
elif 1<=int(S[2:])<=12 and 1<=int(S[:2])<=12:
    print("AMBIGUOUS")
elif (13<=int(S[2:]) or int(S[2:])==0) and (13<=int(S[:2]) or int(S[:])==0):
    print("NA")
N, K = map(int, input().split())
P = list(map(int, input().split()))
C = list(map(int, input().split()))
 
ans = -float('inf')
for s in range(N):
    S = [] 
    i = P[s] - 1
    S.append(C[i])
    while i != s:
        i = P[i] - 1
        S.append(S[-1] + C[i])
 
    if K <= len(S):
        score = max(S[:K])
    elif S[-1] <= 0:
        score = max(S)
    else:
        score1 = S[-1] * (K // len(S) - 1)
        score1 += max(S)
        score2 = S[-1] * (K // len(S))
        r = K % len(S)
        if r != 0:
            score2 += max(0, max(S[:r]))
        score = max(score1, score2)
 
    ans = max(ans, score)
 
print(ans)


### FIXED CODE ###

data = input()

if data[0]=="R" and data[1]=="R" and data[2]=="R":
    print(3)
elif (data[0]=="R" and data[1]=="R") or (data[1]=="R" and data[2]=="R"):
    print(2)
elif data[0]=="R" or data[1]=="R" or data[2]=="R":
    print(1)
else:
    print(0)
def combinations(N, K):
    N = int(N)
    K = int(K)
    k_ex = K
    n_ex = N
    n_k_ex = N - K
    for i in range(1, K + 1):
        k_ex *= i
    for i in range(1, N + 1):
        n_ex *= i
    for i in range(1, N - K + 1):
        n_k_ex *= i
    return int(n_ex / (k_ex * n_k_ex))
N, K = input().split(' ')

print(combinations(N, K))

### FIXED CODE ###

def combinations(N, K):
    N = int(N)
    K = int(K)
    if N == K:
        return 1
    else:
        return N - K + 1
    
N, K = input().split(' ')

print(combinations(N, K))
n=int(input())
m=int(input())
k =(n*(n-1))//2
j=(m*(m-1))//2
print(j+k)

### FIXED CODE ###

n, m = map(int, input().split())
 
ans = ((n*(n-1))+(m*(m-1)))//2
 
print(ans)
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
a = [a1,a2,a3]

m = [[0,0,0],[0,0,0],[0,0,0]]

n = int(input())
b = []
for i in range(n) :
    b = int(input())
    for j in range(3) :
        for k in range(3) :
            if a[j][k] == b :
                m[j][k] = 1

if a[0].count(1) == 3 :
    print('Yes')
elif a[1].count(1) == 3 :
    print('Yes')
elif a[2].count(1) == 3 :
    print('Yes')
else :
    print('No')


### FIXED CODE ###

import math
n = int(input())
print (math.ceil(n/2))
import sys
input = sys.stdin.readline


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

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x

def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])

dfs(1,0,0)

answer = ' '.join(map(str,value[1:]))
print(answer)


### FIXED CODE ###

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


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

graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)

value = [0] * (N+1)
for p,x in PX:
    value[p] += x

def dfs(v,parent,add):
    value[v] += add
    for x in graph[v]:
        if x == parent:
            continue
        dfs(x,v,value[v])

dfs(1,0,0)

answer = ' '.join(map(str,value[1:]))
print(answer)
n,p=map(int,input().split())

def yakusuSub(p,d,arr):
    if p==1:return arr
    if p/d==int(p/d):
        arr.append(d)
        return yakusuSub(p/d,d,arr)
    else:
        return yakusuSub(p,d+1,arr)
 
def yakusu(p):
    return yakusuSub(p,2,[])
 
if n==1:
    print(p)
    exit()
 
y=yakusu(p)
if not y:
    print(1)
    exit()
ans=1
cnt=1
before=0
f=False
for i in y:
    if i==before:
        cnt+=1
    else:
        cnt=1
    if cnt>=n:
        ans*=i
        cnt=1
        f=True
    before=i
if f:
    print(ans)
else:
    print(p)

### FIXED CODE ###

n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    for i in range(1, round(p**(1/n))+1):
        if p % i**n ==0:
            res = i
    print(res)
a = int(input())
if a == A or B or C or D or E or F or G or H or I or J or K or L or M or N or O or P or Q or R or S or T or U or V or W or X or Y or Z:
  print("A")
else:
  print("a")

### FIXED CODE ###

a = str(input())
if a.isupper() == True:
  print("A")
else:
  print("a")
a,b,c,k=map(int,input().split())
if k=<a+b:
  max_value=a
else:
  max_value=a-k+a+b
print(max_value)


### FIXED CODE ###

a,b,c,k=map(int,input().split())
if a<=k<=a+b:
  max_value=a
elif k<a:
	max_value=k
else:
  max_value=a*2-k+b
print(max_value)
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
memo = [[None] * (M + 1) for _ in range(N + 1)]
for i in range(1, len(A)):
    A[i] += A[i - 1]
for i in range(1, len(B)):
    B[i] += B[i - 1]
A.insert(0, 0)
B.insert(0, 0)
K = [[K - a - b for b in B] for a in A]
def solution(i=0, j=0):
    if i > N or j > M:
        return -1
    if memo[i][j] is not None:
        return memo[i][j]
    if K[i][j] == 0:
        memo[i][j] = 0
        return 0
    elif K[i][j] < 0:
        memo[i][j] = -1
        return -1
    memo[i][j] = 1 + max(
        solution(i + 1, j),
        solution(i, j + 1))
    return memo[i][j]
print(solution())

### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
for i in range(1, len(A)):
    A[i] += A[i - 1]
for i in range(1, len(B)):
    B[i] += B[i - 1]
A.insert(0, 0)
B.insert(0, 0)
r = 0
for i, a in enumerate(A):
    min_idx = 0
    max_idx = len(B) - 1
    while min_idx < max_idx:
        j = (min_idx + max_idx + 1) // 2
        k = K - A[i] - B[j]
        if k < 0:
            max_idx = j - 1
        else:
            min_idx = j
    j = min_idx
    while j + 1 < len(B) and K - A[i] - B[j + 1] >= 0:
        j += 1
    if K - A[i] - B[j] >= 0:
        r = max(r, i + j)
print(r)
s = input()
t = input()
count = 0
for i in range(oad('a'),oad('z')+1):
    start[i] = -1
    goal[i] = -1
for i in range(0,len(s)):
    a = s[i]
    b = t[i]
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
else:
    print("Yes")

### FIXED CODE ###

s = input()
t = input()
start = [-1]*30
goal = [-1]*30
count = 0
for i in range(0,len(s)):
    a = ord(s[i])-ord("a")
    b = ord(t[i])-ord("a")
    if start[a] != -1 or goal[b] != -1:
        if start[a] != b or goal[b] != a:
            count = 1
            break
    else:
        start[a] = b
        goal[b] = a
if count == 1:
    print("No")
elif count == 0:
    print("Yes")
import math
b = list(map(int,input().split()))
ans=0
check=0
A=0
C=b[1]
max = math.floor(b[2]/b[1])

    for i in range(max):
        A=b[1]-1
        if A>0:
            check = math.floor((b[0]*A)/C) - b[0]*math.floor(A/C)
            if check > ans:
                ans=check
        b[1]+=b[1]
print(ans)

### FIXED CODE ###

import math
b = list(map(int,input().split()))
ans=0
check=0
if b[2]>b[1]-1:
    check = math.floor((b[0]*(b[1]-1))/b[1]) - b[0]*math.floor((b[1]-1)/b[1])
else:
    check = math.floor((b[0]*b[2])/b[1]) - b[0]*math.floor(b[2]/b[1])
if check>ans:
    ans=check
print(ans)
def cal(n):
	#dp=[]
	if n<2:
		return 1
	else:
		return n*cal(n-2)

n=int(input())
ans=cal(n)
cnt=0
while ans%10==0:
	ans//=10
	cnt+=1
#print(ans)
print(cnt)

### FIXED CODE ###

n=int(input())
cnt=0
div=5
if n%2!=0:
	print(0)
	exit()
else:
	n//=2
	while n>=1:
		n//=div
		cnt+=n
#print(ans)
print(cnt)
n,m,x,y = map(int,input().split())
xl = list(input().split())
yl = list(input().split())
xl.sort(reverse = True)
yl.sort()

if xl[0] < x and yl[0] >= y:
    print('No War')
else:
    print('War')

### FIXED CODE ###

n,m,x,y = map(int,input().split())
xl = list(map(int,input().split()))
yl = list(map(int,input().split()))
xl.append(x)
yl.append(y)
xl.sort()
yl.sort()

if xl[-1] < yl[0]:
    print('No War')
else:
    print('War')
class UnionFind:
    def __init__(self, size: int):
        self.parent = [-1 for _ in range(size)]
        self.size = [1 for _ in range(size)]

    def unite(self, x, y):
        px = self.find(x)
        py = self.find(y)
        if px == py:
            return
        if self.size[px] > self.size[py]:
            px, py = py, px
        self.parent[py] += self.parent[px]
        self.parent[px] = py
        return

    def find(self, x: int) -> int:
        if self.parent[x] < 0:
            return x
        self.parent[x] = self.find(self.parent[x])
        return self.parent[x]

    def size(self, x):
        return -self.parent[self.find(x)]

    def is_same(self, x: int, y: int) -> bool:
        return self.find(x) == self.find(y)


def main():
    # input
    N, M = map(int, input().split())
    A, B = [], []

    for _ in range(M):
        a, b = map(int, input().split())
        A.append(a-1)
        B.append(b-1)

    # solve
    # ref: http://drken1215.hatenablog.com/entry/2019/03/03/224600
    # ref: https://atcoder.jp/contests/abc120/submissions/4450601
    uf = UnionFind(N)
    ans = [N*(N-1)//2]
    for i in range(M-1, 0, -1):
        p1 = uf.find(A[i])
        p2 = uf.find(B[i])
        if p1 != p2:
            ans.append(ans[-1] - uf.size[p1]*uf.size[p2])
        else:
            ans.append(ans[-1])
        uf.unite(p1, p2)
    return ans


print(*list(reversed(main())), sep="\n")


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)


class UnionFind:
    def __init__(self, size: int):
        self.parent = [-1 for _ in range(size)]
        self.size = [1 for _ in range(size)]

    def unite(self, x, y):
        px = self.find(x)
        py = self.find(y)
        if px != py:
            if self.parent[px] > self.parent[py]:
                self.parent[py] = px
                self.parent[px] -= 1
                self.size[px] += self.size[py]
                self.size[py] = 0
            else:
                self.parent[px] = py
                self.parent[py] -= 1
                self.size[py] += self.size[px]
                self.size[px] = 0
        return

    def find(self, x: int) -> int:
        if self.parent[x] < 0:
            return x
        self.parent[x] = self.find(self.parent[x])
        return self.parent[x]

    def is_same(self, x: int, y: int) -> bool:
        return self.find(x) == self.find(y)


def main():
    # input
    N, M = map(int, input().split())
    brs = [list(map(int, input().split())) for _ in range(M)]

    # solve
    # ref: http://drken1215.hatenablog.com/entry/2019/03/03/224600
    # ref: https://atcoder.jp/contests/abc120/submissions/4450601
    uf = UnionFind(N)
    ans = [N*(N-1)//2]
    for i in range(M-1, 0, -1):
        a, b = brs[i][0], brs[i][1]
        a, b = a-1, b-1
        p1 = uf.find(a)
        p2 = uf.find(b)
        if p1 != p2:
            ans.append(ans[-1] - uf.size[p1]*uf.size[p2])
        else:
            ans.append(ans[-1])
        uf.unite(p1, p2)
    return ans


print(*list(reversed(main())), sep="\n")
N,M=map(int,input().split())


A=list(map(int,input().split()))
Sum=sum(A)
pop=[]
l=Sum/(4*M)
for i in range(N):
    if(A[i]>l):
        pop.append(A[i])
        
print("Yes" if len(pop)=M else "No")

### FIXED CODE ###

A,B,C=map(int,input().split())
print(C,A,B)
import numpy as np
A, B = map(int, input().split())
l = max(len(bin(A)[2:]), len(bin(B)[2:]))
arr = np.zeros(l)
ans = 0
for i in range(A, B+1):
    c = np.array(list(map(int, bin(i)[2:])))
    arr[l-len(c):] += c
arr = np.flip(arr % 2)
for i in range(l):
    if arr[i] != 0:
        ans += 2 ** i
print(ans)

### FIXED CODE ###

def F(N):
    if ((N+1) // 2) % 2 == 0:
        bit = 0
    else:
        bit = 1
    if N % 2 == 0:
        return bit ^ N
    else:
        return bit

A, B = map(int, input().split())
ans = F(A-1) ^ F(B)
print(ans)
s = input()
if s == "SUN":
    print(7)
elif s == "SAT":
    print(1)
elif s == "FRI":
    print(2)
elif s == "THU":
    print(3)
elif s == "WED":
    print(4)
elif s == "TUE":
    print(5)
elif s == "MON":
    print(6)
~               

### FIXED CODE ###

s = input()
if s == "SUN":
    print(7)
elif s == "SAT":
    print(1)
elif s == "FRI":
    print(2)
elif s == "THU":
    print(3)
elif s == "WED":
    print(4)
elif s == "TUE":
    print(5)
elif s == "MON":
    print(6)
MOD = 10 ** 9 + 7

N, K = map(int, input().split())
A = list(map(int, input().split()))
minus = []
plus = []
for a in A:
    if a < 0:
        minus.append(a)
    else:
        plus.append(a)

ans = 1
if len(minus) == N:
    if K % 2 == 0:
        A.sort()
    else:
        A.sort(reverse=True)
    for i in range(K):
        ans = ans * A[i] % MOD
    print(ans)
    exit(0)

minus.sort()
plus.sort()

if  K % 2:
    ans *= plus.pop()

B = []

while len(minus) > 1:
    a = minus.pop()
    b = minus.pop()
    B.append(a * b)

while len(plus) > 1:
    a = plus.pop()
    b = plus.pop()
    B.append(a * b)

B.sort()

for i in range(K // 2):
    ans = ans * B.pop() % MOD

print(ans)


### FIXED CODE ###

MOD = 10 ** 9 + 7

N, K = map(int, input().split())
A = list(map(int, input().split()))
ans = 1
if N == K:
    for a in A:
        ans = ans * a % MOD
    print(ans)
    exit(0)

minus = []
plus = []
for a in A:
    if a < 0:
        minus.append(a)
    else:
        plus.append(a)

if len(minus) == N:
    if K % 2 == 0:
        A.sort()
    else:
        A.sort(reverse=True)
    for i in range(K):
        ans = ans * A[i] % MOD
    print(ans)
    exit(0)

minus.sort(reverse=True)
plus.sort()

if  K % 2:
    ans *= plus.pop()

B = []

while len(minus) > 1:
    a = minus.pop()
    b = minus.pop()
    B.append(a * b)

while len(plus) > 1:
    a = plus.pop()
    b = plus.pop()
    B.append(a * b)

B.sort()

for i in range(K // 2):
    ans = ans * B.pop() % MOD

print(ans)
result = 0
for n in range(int(input())):
    result += len(n+1)%2
print(result)

### FIXED CODE ###

result = 0
for n in range(int(input())):
    result += len(str(n+1))%2
print(result)
import math
A,B,H,M=map(int,input().split())
c=abs(H*15-M*6)
k=A*A+B*B-2*A*B*math.cos(c)
l=sqrt.(k)
print(l)

### FIXED CODE ###

import math
A,B,H,M=map(int,input().split())
c=abs(H*30-M*5.5)
k=A*A+B*B-2*A*B*math.cos(c*math.pi/180)
l=math.sqrt(k)
print(l)
from scipy.sparse import*
(n,m,s,*D),*t=[map(int,t.split())for t in open(0)]
R,C=[],[]
r=range(2501)
for u,v,a,b in t[:m]:
 for i in r:k=(i+a)*51;R+=k+u,k+v;C+=i*51+v,i*51+u;D+=b,b
i=0
for c,d t[m:]:
 i+=1
 for j in r:R+=j*51+i,;C+=(j+c)*51+i,;D+=d,
d=csgraph.dijkstra(csr_matrix((D,(R,C))),1,min(2500,s)*51+1)
for i in range(2,n+1):print(int(min(d[i::51])))

### FIXED CODE ###

from scipy.sparse import*
n,m,s,*t=map(int,open(0).read().split())
row,col,dat=[],[],[]
for u,v,a,b in zip(*[iter(t[:m*4])]*4):
    for i in range(2501-a):
        row+=(i+a)*51+u,(i+a)*51+v
        col+=i*51+v,i*51+u
        dat+=b,b
for i,(c,d)in enumerate(zip(*[iter(t[m*4:])]*2),1):
    for j in range(2501-c):
        row+=j*51+i,
        col+=(j+c)*51+i,
        dat+=d,
d=csgraph.dijkstra(csr_matrix((dat,(row,col)),[8**6]*2),1,min(2500,s)*51+1)
for i in range(2,n+1):print(int(d[i::51].min()))
a,b,c= int(input().split())


### FIXED CODE ###

a,b,c = input().split()

a = int(a)
b = int(b)
c = int(c)

if a < b < c:
    print("Yes")
else:
    print("No")
def switch(S):
    tmp = S[0]
    S[0] = S[-1]
    S[-1] = tmp
    return S


def d2():
    S = str(input())
    Q = int(input())

    for i in range(Q):
        # print(S)
        q = list(input().split())

        if q[0] == '1':
            S = switch(S)
        elif q[0] == '2':
            if q[1] == '1':
                S = q[2] + S
            elif q[1] == '2':
                S = S + q[2]
            else:
                raise ValueError(
                    'F({}) is {}, which is invalid!'.format(i, q[1]))
        else:
            raise ValueError('T({}) is {}, which is invalid!'.format(i, q[0]))

    print(''.join(S))


##########
d2()


### FIXED CODE ###

def d():
    from collections import deque
    S = deque(str(input()))
    Q = int(input())
    rvs = False

    for i in range(Q):
        q = list(input().split())

        if q[0] == '1':
            rvs = not rvs
        elif q[0] == '2':
            if q[1] == '1':
                if rvs:
                    S.append(q[2])
                else:
                    S.appendleft(q[2])
            elif q[1] == '2':
                if rvs:
                    S.appendleft(q[2])
                else:
                    S.append(q[2])
            else:
                raise ValueError(
                    'F({}) is {}, which is invalid!'.format(i, q[1]))
        else:
            raise ValueError('T({}) is {}, which is invalid!'.format(i, q[0]))

    if rvs:
        ans = list(S)[::-1]
    else:
        ans = list(S)
    print(''.join(ans))


##########
if __name__ == "__main__":
    d()
N = int(input())
H = input().split()
i = int(0)
j = int(0)
n = int(1)
m = int(0)
for i in range(N-1):
    for j in range(i+1):
        if H[i] >= H[j]:
            m = m + 1
    if m == i+1:
        n = n + 1
print(n)

### FIXED CODE ###

A, B = map(int, input().split())
C_1 = 2*A - 1
C_2 = A + B
C_3 = 2*B - 1
print(max([C_1, C_2, C_3]))
n = int(input())
l = list(input().split())
s = ""
for i in range(n):
  s += (l[0][n] + l[1][n])
print(s)

### FIXED CODE ###

n = int(input())
l = list(input().split())
s = ""
for i in range(n):
  s += (l[0][i] + l[1][i])
print(s)
A = int(input())
B = int(input())

print(A*B - A - B + 1)

### FIXED CODE ###

A, B = map(int, input().split())
print(A*B - A - B + 1)
def main():
    N, Q = map(int, input().split(" "))
    S = input()
    result = [0] * (N + 1)
    for i in range(1, Q + 1):
        if S[i-1:i+1] == "AC":
            result[i] = result[i - 1] + 1
        else:
            result[i] = result[i - 1]
    for _ in range(Q):
        l, r = map(int, input().split(" "))
        print(result[l] - result[r - 1])


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    N, Q = map(int, input().split(" "))
    S = input()
    result = [0] * (N + 1)
    for i in range(1, N + 1):
        if S[i-1:i+1] == "AC":
            result[i] = result[i - 1] + 1
        else:
            result[i] = result[i - 1]
    for _ in range(Q):
        l, r = map(int, input().split(" "))
        print(result[r - 1] - result[l - 1])


if __name__ == '__main__':
    main()
def matrixChainMultiplication(p):
    # p = [p_0, p_1, ..., p_n]
    n = len(p) - 1
    # n+1 x n+1 zero matrix?????????(0,...,n)
    # cost(i,j): (M_i...M_j)???????°??????????
    cost = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
    for numOfMatrices in range(2, n + 1):
        for i in range(1, n - numOfMatrices + 2):
            j = i + numOfMatrices - 1
            cost[i][j] = float('inf')
            for k in range(i, j):
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k + 1][j] + p[i - 1] * p[k] * p[j])
    print(m[1][n])

p = []
n = int(input())

for _ in range(n):
    listed_input = input().split()
    p.append(int(listed_input[0]))
p.append(int(listed_input[1]))

matrixChainMultiplication(p)

### FIXED CODE ###

def matrixChainMultiplication(p):
    # p = [p_0, p_1, ..., p_n]
    n = len(p) - 1
    # n+1 x n+1 zero matrix?????????(0,...,n)
    # cost(i,j): (M_i...M_j)???????°??????????
    cost = [[0 for _ in range(n + 1)] for _ in range(n + 1)]
    for numOfMatrices in range(2, n + 1):
        for i in range(1, n - numOfMatrices + 2):
            j = i + numOfMatrices - 1
            cost[i][j] = float('inf')
            for k in range(i, j):
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k + 1][j] + p[i - 1] * p[k] * p[j])
    print(cost[1][n])

p = []
n = int(input())

for _ in range(n):
    listed_input = input().split()
    p.append(int(listed_input[0]))
p.append(int(listed_input[1]))

matrixChainMultiplication(p)
n = int(input())
count = 0
 
for i in n:
  if len(i)//2 != 0:
    count += 1
 
print(count)

### FIXED CODE ###

n = int(input())
count = 0
 
for i in range(1,n+1):
  if len(str(i))%2 == 1:
    count += 1
 
print(count)
n,m = map(int,input().split())

s = input()

if len(s) == 2 and s[0] != s[-1]:
    print(0)
    exit()

if s == 'LRL' or s == 'RLR':
    print(0)
    exit()

if s[0] == 'L':
  count = s.count('LR')
else:
  count = s.count('RL')

count = count - m

if s[0] != s[-1]:
  print(n - 2 * max(count, 0) - 1 * (count <= 0))

else:
  if count > 0:
    print(n - 2 * count - 1)
  else:
    print(n - 2 - max(count, -1))

### FIXED CODE ###

print(int(input())**3)
# -*- coding: utf-8 -*-

a = int(input())

if a < 2:
    print(0)
elif a%3 == 0:
    print(int(a/3))
elif a%3 == 1:
    print(int(a/3) - 1)
else:
    print(int(a/3)

### FIXED CODE ###

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

a = int(input())

if a < 2:
    print(0)
elif a%3 == 0:
    print(int(a/3))
elif a%3 == 1:
    print(int(a/3))
else:
    print(int(a/3))
from heapq import heappop, heappush
inputs = open(0).readlines()

n, m = map(int, inputs[0].split())
*A, = map(int, inputs[1].split())
heapify(A)
BC = [tuple(map(int, bc.split())) for bc in inputs[2:]]

for b, c in BC:
    for _ in range(b):
        if c > A[0]:
            _ = heappushpop(A, c)
        else:
            break
print(sum(A))

### FIXED CODE ###

from heapq import heapify, heappushpop
from operator import itemgetter
inputs = open(0).readlines()

n, m = map(int, inputs[0].split())
*A, = map(int, inputs[1].split())
heapify(A)
BC = [tuple(map(int, bc.split())) for bc in inputs[2:]]
BC.sort(key=itemgetter(1), reverse=True)

for b, c in BC:
    for _ in range(b):
        if c > A[0]:
            _ = heappushpop(A, c)
        else:
            break
print(sum(A))
R = float(input())

print(2*R*math.pi)

### FIXED CODE ###

import math

R = float(input())

print(2*R*math.pi)
A = []
x,y = map(int,input()A.split())

if 500*x-y >= 0:
  print("Yes")
  
  else:
    print("No")

### FIXED CODE ###

i = input()
x,y = map(int,i.split())

if 500*x-y>=0:
    print("Yes")
else:
        print("No")