Harryxun/stf_run huggingface dataset:
import sys
HK,WK,M = map(int, input().split())
W = [0] * WK
H = [0] * HK
HW = [[0 for i in range(WK+1)] for _ in range(HK+1)]
# 3*10^5

for i in range(M):
    h, w = map(int, input().split())

    H[h] += 1
    W[w] += 1

    HW[h][w] = 1

answer = 0
HMAX = max(H)
WMAX = max(W)

HEMAX = H.count(HMAX)
WEMAX = W.count(WMAX)
if HEMAX * WEMAX > M:
    print(HMAX + WMAX)
    sys.exit(0)

HMAXES = [i for i, _ in enumerate(H) if _ == HMAX]
WMAXES = [i for i, _ in enumerate(W) if _ == WMAX]

# 3*10^5
answer = HMAX + WMAX
for h in HMAXES:
    for w in WMAXES:
        if HW[h][w] == 0:
            print(answer)
            sys.exit(0)
print(answer-1)

### FIXED CODE ###

import sys
HK,WK,M = map(int, input().split())
W = [0] * (WK + 1)
H = [0] * (HK + 1)
HW = {}
# 3*10^5

for i in range(M):
    h, w = map(int, input().split())

    H[h] += 1
    W[w] += 1

    HW[(h,w)] = 1

answer = 0
HMAX = max(H)
WMAX = max(W)

HEMAX = H.count(HMAX)
WEMAX = W.count(WMAX)
if HEMAX * WEMAX > M:
    print(HMAX + WMAX)
    sys.exit(0)

HMAXES = [i for i, _ in enumerate(H) if _ == HMAX]
WMAXES = [i for i, _ in enumerate(W) if _ == WMAX]

# 3*10^5
answer = HMAX + WMAX
for h in HMAXES:
    for w in WMAXES:
        if not (h,w) in HW:
            print(answer)
            sys.exit(0)
print(answer-1)
count = 0
a, b, c = map(int, input().split())
for i in range(a,b)
    if i % c ==0:
        count += 1
print(f'{c}')



### FIXED CODE ###

count = 0
a, b, c = map(int, input().split())
for i in range(a,b+1):
    if c % i == 0:
        count += 1
print(f'{count}')
from collections import defaultdict

from math import factorial

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

for num in nums:
    d[num] += 1

total = 0
for i in d:
    n = d[i]
    if n == 2:
        total += 1
    elif n > 2:
        total += factorial(n) / factorial(2) / factorial(n - 2)

for num in nums:
    tmp = d[num] - 1
#    if tmp >= 2:
#        hoge = factorial(tmp) / factorial(2) / factorial(tmp - 2)
    print(int(total - tmp))


### FIXED CODE ###

import math

N = int(input())
nums = list(map(int, input().split()))
numsB = nums[:]
d = dict()

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for num in nums:
    if num not in d:
        d[num] = 1
    else:
        d[num] += 1

total = 0
for i in d:
    n = d[i]
    if n == 2:
        total += 1
    elif n > 2:
        total += combinations_count(n, 2)

for num in numsB:
    tmp = d[num] - 1
#    if tmp >= 2:
#        hoge = factorial(tmp) / factorial(2) / factorial(tmp - 2)
    print(int(total - tmp))
def binaryinsertion(A,x):
    left=0;right=len(A)-1;centre = len(A)//2
    while(True):
        if(right - left < 2):
            if(x[0]<A[left][0]):
                A.insert(left,x)
                break
            else :
                A.insert(left+1,x)
                break
        else:
            if(x[0] < A[centre][0]) :
                right = centre - 1
            elif(A[centre][0] < x[0]) :
                left = centre + 1
            else : 
                A.insert(centre,x)
                break
            centre = left + (right-left)//2

[N,L] = [int(x) for x in input().split()]
A = [[int(x),int(i)] for i,x in enumerate(input().split())]
sweep = A[:L]
sweep = sorted(sweep)
ans = [str(sweep[0][0])]
for i in range(L,N) :
    sweep.remove(A[i-L])
    binaryinsertion(sweep,A[i])
    ans.append(str(sweep[0][0]))
print(" ".join(ans))
for i in range(L,N) :
    sweep.remove(A[i-L])
    binaryinsertion(sweep,A[i])
    ans.append(str(sweep[0][0]))
print(" ".join(ans))

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
import sys
import os
f = open('input.txt', 'r')
sys.stdin = f

N, M = map(int, input().split( ))
i = 1
ViewH = {}
H_list = input().split( )
countlist = []
while i <= N:
    ViewH[i] = int(H_list[i-1])
    countlist.append(0)
    i += 1


for count in range(M - 1):
    A, B = map(int, input().split())
    if ViewH[A] > ViewH[B]:
        countlist[B-1] = 1
    elif ViewH[A] == ViewH[B]:
        countlist[A-1] = 1
        countlist[B-1] = 1
    else:
        countlist[A-1] = 1

print(countlist.count(0))


### FIXED CODE ###

N, M = map(int, input().split( ))
i = 1
ViewH = {}
H_list = input().split( )
countlist = []
while i <= N:
    ViewH[i] = int(H_list[i-1])
    countlist.append(0)
    i += 1
#print(ViewH)
#print(countlist)

for count in range(M):
    A, B = map(int, input().split())
    #print(str(A)+str(B))
    if ViewH[A] > ViewH[B]:
        countlist[B-1] = 1
    elif ViewH[A] == ViewH[B]:
        countlist[A-1] = 1
        countlist[B-1] = 1
    else:
        countlist[A-1] = 1
#print(countlist)
print(countlist.count(0))
import numpy as np
MAX = 10**6

sieve = [i for i in range(MAX+1)]

p = 2
while p * p <= MAX:
    if sieve[p] == p:
        for i in range(p*2, MAX+1, p):
            if sieve[i] == i:
                sieve[i] = p
    p += 1


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

for a in A:
    tmp = set()
    b = a
    while b != 1:
        tmp.add(sieve[b])
        b //= sieve[b]
    pf.append(tmp)


soin = [0] * (10 ** 6 + 1)
for f in pf:
    for n in f:
        soin[n] += 1

if max(soin[2:]) <= 1:
    print('pairwise coprime')
    exit()

flag = np.gcd.reduce(A)

if flag == 1:
    print('setwise coprime')
else:
    print('not coprime')

### FIXED CODE ###

#!/usr/bin/env python3

import sys
from math import gcd
from collections import Counter
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

dup = False
dup_key = None
counter = Counter(A)
for key, val in counter.items():
    if val > 1:
        dup = True
        if dup_key is None:
            dup_key = key
        else:
            dup_key = max(dup_key, key)


def max_gcd_pair(S):
    # Assumption 1: S is the list of numbers
    # Assumption 2: There are no duplicates in S
    s = set(S)
    m = max(S)
    res = 1
    i = m
    while i > 0:
        a = i
        cnt = 0
        while a <= m: # a maxed at max of the list
            if a in s:
                cnt += 1
            a += i
        if cnt >= 2:  # we have found the result
            res = i
            break
        i = i - 1
    return res


pair = max_gcd_pair(A)
if dup:
    pair *= dup_key

if pair == 1:
    print('pairwise coprime')
    sys.exit()


setw = A[0]
for j in range(N):
    setw = gcd(setw, A[j])
if setw == 1:
    print('setwise coprime')
else:
    print('not coprime')
def prim():
    distance[0] = 0
    parent[0] = -1

    while True:
        mincost = float('inf')
        for i in range(n):
            if color[i] != 'black' and distance[i] < mincost:
                mincost = distance[i]
                u = i
        if mincost == float('inf'):
            break

        color[u] = 'black'

        for v in range(n):
            if color[v] != 'black' and adjMat[u][v] != float('inf'):
                if adjMat[u][v] < distance[v]:
                    distance[v] = adjMat[u][v]
                    parent[v] = u
                    color[v] = 'gray'


n = int(input())
color = ['white'] * n
parent = [-1] * n
distance = [float('inf')] * n

adjMat = [[0] * n for _ in range(n)]
for i in range(n):
    adjRow = list(map(int, input().split()))
    for v in adjRow:
        if v == -1:
            adjMat[i][v] = float('inf')
        else:
            adjMat[i][v] = v

prim()

print(sum(distance))

### FIXED CODE ###

def prim():
    distance[0] = 0
    parent[0] = -1

    while True:
        mincost = float('inf')
        for i in range(n):
            if color[i] != 'black' and distance[i] < mincost:
                mincost = distance[i]
                u = i
        if mincost == float('inf'):
            break

        color[u] = 'black'

        for v in range(n):
            if color[v] != 'black' and adjMat[u][v] != float('inf'):
                if adjMat[u][v] < distance[v]:
                    distance[v] = adjMat[u][v]
                    parent[v] = u
                    color[v] = 'gray'


n = int(input())
color = ['white'] * n
parent = [-1] * n
distance = [float('inf')] * n

adjMat = [[0] * n for _ in range(n)]
for i in range(n):
    adjRow = list(map(int, input().split()))
    for v, weight in enumerate(adjRow):
        if weight == -1:
            adjMat[i][v] = float('inf')
        else:
            adjMat[i][v] = weight

prim()

print(sum(distance))
6 4 3

### FIXED CODE ###

A,B,C = list(map(int,input().strip().split()))
s = A - B
a = C - s
if a >= 0:
    print(a)
elif a < 0:
    print(0)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

tend = 1 if A[0] < A[1] else -1
count = 1
prev = A[1]

for a in A[2:]:
    if prev < a and tend < 0:
        tend = 0
        count += 1
    elif prev > a and tend > 0:
        tend = 0
        count += 1
    elif tend == 0:
        if prev < a:
            tend = 1
        elif prev > a:
            tend = -1
        else:
            tend = 0

    prev = a

print(count)


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

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

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

if A[0] < A[1]:
    tend = 1
elif A[0] > A[1]:
    tend = -1
else:
    tend = 0

count = 1
prev = A[1]

for a in A[2:]:
    if prev < a and tend < 0:
        tend = 0
        count += 1
    elif prev > a and tend > 0:
        tend = 0
        count += 1
    elif tend == 0:
        if prev < a:
            tend = 1
        elif prev > a:
            tend = -1
        else:
            tend = 0

    prev = a

print(count)
import sys

N, M = [int(_) for _ in input().split()]
A = [int(input()) for i in range(M)]
isBroken = [False] * (N + 1)
for i in A:
    isBroken[i] = True


def solve():

    # It's impossible
    temp = A[0]
    for a in A[1:]:
        if a - 1 == temp:
            return 0
        temp = a

    # We can
    memo = [0] * (N + 1)
    print("?")
    sys.exit()

    def rec(i):
        if i == 0:
            return 1
        if i < 0:
            return 0
        if isBroken[i]:
            return 0
        if memo[i] == 0:
            count1 = rec(i - 1) % 1000000007
            count2 = rec(i - 2) % 1000000007
            memo[i] = (count1 + count2) % 1000000007
            # print(f"memo[{i}] = {count1} + {count2} -> {memo[i]}")
        return memo[i]
    return rec(N)


print(solve())


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

N, M = [int(_) for _ in input().split()]
A = [int(input()) for i in range(M)]
isBroken = [False] * (N + 1)
for i in A:
    isBroken[i] = True


def solve():

    # It's impossible
    if M >= 1:
        temp = A[0]
        for a in A[1:]:
            if a - 1 == temp:
                return 0
            temp = a

    # We can
    memo = [0] * (N + 2)

    def rec(i):
        if i == 0:
            return 1
        if i < 0:
            return 0
        if isBroken[i]:
            return 0

        if memo[i] == 0:
            count1 = rec(i - 1) % 1000000007
            count2 = rec(i - 2) % 1000000007
            memo[i] = (count1 + count2) % 1000000007
        return memo[i]
    return rec(N)


print(solve())
import sys
input = sys.stdin.readline

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

inf = pow(10, 9)+7
key = max(a)

k = 1
while key > 1:
  k += 1
  key //= 2
sub = [0]*k

ans = 0
for i in range(n):
  value = a[i]
  value_bin = [0]*k
  q = 0
  p = 0
  while value > 0:
    if value%2 == 1:
      value_bin[p] += 1
    p += 1
    value //= 2
  if p > q:
    q = p
  if i == 0:
    for j in range(q):
      if value_bin[p] == 1:
        sub[p] = 1
  r = 1
  for j in range(q):
    if value_bin[j] == 1:
      ans += (r*(i-sub[j]))%inf
      sub[j] += 1
    else:
      ans += (r*sub[j])%inf
    r *= 2
    ans %= inf

print(ans)

### FIXED CODE ###

import numpy as np

n = int(input())
a = np.array([int(x) for x in input().split()])
inf = 10**9+7

ans = 0
p = 1
for i in range(61):
    a, b = a//2, a%2
    key = int(b.sum())
    ans += p*(n-key)*key
    ans = ans%inf
    p *= 2
    p %= inf
print(ans)
N,A = map(int,input().split())
X = list(map(int,input().split()))

ma = max(X)

dp = [[[0 for s in range(N*ma+1)] for k in range(N+1)] for j in range(N+1)]

dp[0][0][0] = 1

for j in range(1,N+1) :
    for k in range(N+1) :
        for s in range(N*ma+1) :
            if s < X[j-1] :
                dp[j][k][s] = dp[j-1][k][s]
            elif (k >= 1) and (s >= X[j-1]) :
                dp[j][k][s] = dp[j-1][k][s] + dp[j-1][k-1][s-X[j-1]]
            else :
                dp[j][k][s] = 0

ans = 0

for k in range(1,N+1) :
    ans += dp[N][k][k*A]

print(ans)


### FIXED CODE ###

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

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

ma = max(X)

dp = [[[0 for s in range(ma*N+1)] for k in range(N+1)] for i in range(N+1)]

dp[0][0][0] = 1

for i in range(1,N+1) :
    for k in range(i+1) :
        for s in range(ma*N+1) :
            if (k >= 1) and (s >= X[i-1]) :
                dp[i][k][s] = dp[i-1][k][s] + dp[i-1][k-1][s-X[i-1]]
            else :
                dp[i][k][s] = dp[i-1][k][s]

ans = 0

for k in range(1,N+1) :
    if k*A > ma*N :
        break
    ans += dp[N][k][k*A]

print(ans)
list=list(map(int,input().split()))
k=list[1]
y=max(list)%min(list)
z=k-y
if z >=y:
  print(y)
else:
  print(z)
  

### FIXED CODE ###

list=list(map(int,input().split()))
x=list[0]
k=list[1]
if list[0]>=list[1]:
  x=x%k
z=abs(k-x)
if z >=x:
  print(x)
else:
  print(z)
n,k = map(int,input().split())
A = [0]+list(map(int,input().split()))
visited = [False for _ in range(n+1)]
pos = 1
x = []
flg = False
for i in range(k):
    if visited[pos] == False:
        x.append(pos)
        visited[pos] = True
        pos = A[pos]
    else:
        flg = True
        pre = x.index(pos)
        loop = x[pre:]
        break
if not flg:
    print(pos)
else:
    print(loop[(k-pre)%len(loop)])
~                                   

### FIXED CODE ###

n,k = map(int,input().split())
A = [0]+list(map(int,input().split()))
visited = [False for _ in range(n+1)]
pos = 1
x = []
flg = False
for i in range(k):
    if visited[pos] == False:
        x.append(pos)
        visited[pos] = True
        pos = A[pos]
    else:
        flg = True
        pre = x.index(pos)
        loop = x[pre:]
        break
if not flg:
    print(pos)
else:
    print(loop[(k-pre)%len(loop)])
import sys
input = sys.stdin.readline
H,W=map(int,input().split())
s=[]
s.append("".join("#" for _ in range(W+2)))
cnt=0
for i in range(H):
    ss=input().strip()
    s.append("#"+ss+"#")
    for w in range(W):
        if ss[w]==".":
            cnt+=1

s.append("".join("#" for _ in range(W+2)))
#print(s)

def solv(h,w,cnt):
    #print(h,w)
    #print(a)
    #print(s)
    if a[h][w]>cnt+1 and s[h][w]==".":
        a[h][w]=cnt+1
        solv(h-1,w,cnt+1)
        solv(h,w-1,cnt+1)
        solv(h+1,w,cnt+1)
        solv(h,w+1,cnt+1)

a=[[1000000]*(W+2) for _ in range(H+2)]
solv(1,1,0)
print(cnt-a[-2][-2])


### FIXED CODE ###

import sys
input = sys.stdin.readline
H,W=map(int,input().split())
s=[]
s.append("".join("#" for _ in range(W+2)))
cnt=0
for i in range(H):
    ss=input().strip()
    s.append("#"+ss+"#")
    for w in range(W):
        if ss[w]==".":
            cnt+=1

s.append("".join("#" for _ in range(W+2)))
#print(s)
import sys
sys.setrecursionlimit(300000)
def solv(h,w,cnt):
    #print(h,w)
    #print(a)
    #print(s)
    if a[h][w]>cnt+1 and s[h][w]==".":
        a[h][w]=cnt+1
        solv(h-1,w,cnt+1)
        solv(h,w-1,cnt+1)
        solv(h+1,w,cnt+1)
        solv(h,w+1,cnt+1)
    return

a=[[1000000]*(W+2) for _ in range(H+2)]
solv(1,1,0)
print(cnt-a[-2][-2] if a[-2][-2]!= 1000000 else -1)
from math import floor, log2


def solve(string):
    x, y = map(int, string.split())
    return str(floor(log2(y) - log2(x)) + 1)


if __name__ == '__main__':
    print(solve(input()))


### FIXED CODE ###

#!/usr/bin/env python3
# coding=utf-8

import sys

x, y = sys.stdin.readline().split(" ")

x = int(x)
y = int(y)
ans = 0
while x <= y:
    ans += 1
    x *= 2
print(ans)
N = int(input())

from itertools import combinations

def get_sieve_of_eratosthenes(n):
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]
    
def is_prime(n):
    import math
    for i in range(2, int(math.sqrt(n))+1):  
        if n % i == 0:
            return False

    return True

lst = get_sieve_of_eratosthenes(55555)

base = [11, 3, 7, 5, 31]
i = 5
cnt = 5
while cnt<N:
    flg = 0
    tmp = lst[i]
    comb = list(combinations(base, 4))
    for j in range(len(comb)):
        if is_prime(sum(comb[j])+tmp):
            flg = 1
            
    if flg==0:
        base.append(tmp)   
        cnt+=1
    i+=1
    
for k in range(N):
    print(base[k], end=' ')

### FIXED CODE ###

N = int(input())
 
from itertools import combinations
 
def get_sieve_of_eratosthenes(n):
    prime = [2]
    limit = int(n**0.5)
    data = [i + 1 for i in range(2, n, 2)]
    while True:
        p = data[0]
        if limit <= p:
            return prime + data
        prime.append(p)
        data = [e for e in data if e % p != 0]

primes = get_sieve_of_eratosthenes(55555)

lst = []
for p in primes:
    if p%5==1:
        lst.append(p)

for i in range(N):
    print(lst[i], end=' ')
import numpy as np
MOD = 10**9 + 7

def fft_convolve(f, g):
  Lf, Lg = f.shape[-1], g.shape[-1]
  L = Lf + Lg - 1
  fft_len = 1 << L.bit_length()
  fh, fl = f >> 15, f & (1 << 15) - 1
  gh, gl = g >> 15, g & (1 << 15) - 1
  def conv(f, g):
    Ff = np.fft.rfft(f, fft_len)
    Fg = np.fft.rfft(g, fft_len)
    h = np.fft.irfft(Ff * Fg)
    return np.rint(h)[..., :L].astype(np.int64) % MOD
  x = conv(fl, gl)
  z = conv(fh, gh)
  y = conv(fl + fh, gl + gh) - x - z
  return (x + (y << 15) + (z << 30)) % MOD

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

Rob = list(s.split("T"))

X = [len(r) for r in Rob[::2]]
Y = sorted([len(r) for r in Rob[1::2]])

Xst = X[0]
X = sorted(X[1:])

if abs(x-Xst) <= sum(X) and y <= sum(Y):
  f = np.array([1], np.int64)
  for i in X:
    L = [0]*(2*i+1)
    L[0], L[-1] = 1, 1
    f = np.convolve(f, np.array(L, np.int64))
  FlagX = f[abs(x-Xst)+sum(X)]

  g = np.array([1], np.int64)
  for j in Y:
    L = [0]*(2*j+1)
    L[0], L[-1] = 1, 1
    g = np.convolve(g, np.array(L, np.int64))
  FlagY = g[abs(y)+sum(Y)]

  if FlagX and FlagY:
    print("Yes")
  else:
    print("No")
else:
  print("No")


### FIXED CODE ###

import numpy as np
MOD = 10**9 + 7

def fft_convolve(f, g):
  Lf, Lg = f.shape[-1], g.shape[-1]
  L = Lf + Lg - 1
  fft_len = 1 << L.bit_length()
  fh, fl = f >> 15, f & (1 << 15) - 1
  gh, gl = g >> 15, g & (1 << 15) - 1
  def conv(f, g):
    Ff = np.fft.rfft(f, fft_len)
    Fg = np.fft.rfft(g, fft_len)
    h = np.fft.irfft(Ff * Fg)
    return np.rint(h)[..., :L].astype(np.int64) % MOD
  x = conv(fl, gl)
  z = conv(fh, gh)
  y = conv(fl + fh, gl + gh) - x - z
  return (x + (y << 15) + (z << 30)) % MOD

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

Rob = list(s.split("T"))

X = [len(r) for r in Rob[::2]]
Y = [len(r) for r in Rob[1::2]]

if x < 0:
  y = abs(y)
  Xst = X[0]
  X = sorted(X[1:])
  if abs(x-Xst) <= sum(X) and y <= sum(Y):
    f = np.array([1], np.int64)
    for i in X:
      L = [0]*(2*i+1)
      L[0], L[-1] = 1, 1
      f = np.convolve(f, np.array(L, np.int64))
    FlagX = f[abs(x-Xst)+sum(X)]
    g = np.array([1], np.int64)
    for j in Y:
      L = [0]*(2*j+1)
      L[0], L[-1] = 1, 1
      g = np.convolve(g, np.array(L, np.int64))
    FlagY = g[y+sum(Y)]
    if FlagX and FlagY:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  x, y = abs(x), abs(y)
  if x <= sum(X) and y <= sum(Y):
    f = np.array([1], np.int64)
    for i in X:
      L = [0]*(2*i+1)
      L[0], L[-1] = 1, 1
      f = np.convolve(f, np.array(L, np.int64))
    FlagX = f[x+sum(X)]
    g = np.array([1], np.int64)
    for j in Y:
      L = [0]*(2*j+1)
      L[0], L[-1] = 1, 1
      g = np.convolve(g, np.array(L, np.int64))
    FlagY = g[y+sum(Y)]
    if FlagX and FlagY:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
K = int(input())
S = list(input())
len_S = int(len(S))
S1 = ' '

if len_S <= K:
  print(K)
else:
  del S[K:]
  for x in S:
    S1 += x
  print(S1 + '...')

### FIXED CODE ###

N = int(input())
a = N % 100
b = a % 10
if b == 2 or b == 4 or b == 5 or b == 7 or b == 9:
  print('hon')
elif b == 0 or b == 1 or b == 6 or b == 8:
  print('pon')
else:
  print('bon')
import math, copy

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

dp = [a[1], a[0], math.gcd(a[0], a[1])]
for i in range(2, n):
    for j in range(i+1):
        if j != i:
            dp[j] = math.gcd(a[i], dp[j])
    dp += [math.gcd(a[i], dp[i])]


print(max(dp))

### FIXED CODE ###

def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

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

l = [0 for i in range(n+1)]
r = [0 for i in range(n+1)]

for i in range(1, n+1):
    l[i] = gcd(l[i-1], a[i-1])

for i in range(n)[::-1]:
    r[i] = gcd(r[i+1], a[i])

m = [0 for i in range(n)]

for i in range(n):
    m[i] = gcd(l[i], r[i+1])

print(max(m))
n = int(input())

if n %2 ==1:
  print(0)
else:
  mod = 10
  ans = n//mod
  x = n//mod
  while(x>0):
    mod *= 5
    x = n//mod
    ans+=x
print(ans)

### FIXED CODE ###

n = int(input())

if n %2 ==1:
  print(0)
else:
  mod = 10
  ans = 0
  x = 0
  while True:
    x = n//mod
    if x==0: break
    ans+=x
    mod *= 5
  print(ans)
N,M,K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

sumt = 0
cnt = 0
Ai = 0
Bi = 0

if (sum(A) + sum(B)) <= K:
    print(N+M)
    exit(0)
    
for i in range(N+M):
    if A[0] <= B[0]:
        sumt += A.pop(0)
    else:
        sumt += B.pop(0)

    if sumt > K:
        print(cnt)
        exit(0)
        
    cnt += 1



### FIXED CODE ###

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

SumA = [0]
SumB = [0]
cnt = 0
for i in range(N):
    SumA.append(SumA[i] + A[i])
for i in range(M):
    SumB.append(SumB[i] + B[i])

for i in range(N+1):
    if SumA[i] > K:
        break
    tmpcnt = bisect.bisect_right(SumB, K - SumA[i]) - 1
    #print([SumA,SumB])
    #print(SumA[i])
    #print(K - SumA[i])
    #print(tmpcnt)
    #print([i,tmpcnt])
    cnt = max(cnt, i + tmpcnt)
print(cnt)