Harryxun/stf_run huggingface dataset:
def hoge():
    X = int(input())
    for a in range(0,int(X**(1/5))+1):
        for b in range(0,a):
            #print(a,b)
            if a**5+b**5 == X:
                return (a,-b)
            elif a**5 - b**5 ==X:
                return (a,b)


result = hoge()
print(result[0], result[1])       


### FIXED CODE ###

def hoge():
    X = int(input())
    for a in range(0,int(X**(1/5))+1):
        for b in range(0,a+1):
            if a**5+b**5 == X:
                return (a,-b)
    for a in range(int(X**(1/5)),10**9):
        for b in range(0,a+1):
            if a**5-b**5 == X:
                return (a,b)


result = hoge()
print(result[0], result[1])
def getparent(parent, place):
    my_parent = parent[place]
    if my_parent == place:
        return place
    parent[place] = getparent(parent, my_parent)
    return parent[place]


def main():
    ans = []
    n, m = list(map(int, input().split()))
    broad = [[] for i in range(n)]
    b_pair = []
    parent = [i for i in range(n)]
    parent_sum = [1 for i in range(n)]
    for i in range(m):
        a, b = list(map(int, input().split()))
        a -= 1
        b -= 1
        broad[a].append(b)
        broad[b].append(a)
        b_pair.append((a, b))
    sum_count = n * (n - 1) // 2
    ans.append(sum_count)
    b_pair.reverse()
    b_pair.pop()
    for p, q in b_pair:
        np, nq = getparent(parent, p), getparent(parent, q)
        if np != nq:
            sum_count -= parent_sum[np] * parent_sum[nq]
            parent_sum[np] += parent_sum[nq]
            parent[nq] = np
        ans.append(sum_count)
    ans.reverse()
    for i in ans:
        print(i)


if __name__ == "__main__":
    main()



### FIXED CODE ###

def getparent(parent, place):
    childrens = [place]
    while place != parent[place]:
        place = parent[place]
        childrens.append(place)
    for i in childrens:
        parent[i] = place
    return place


def main():
    ans = []
    n, m = list(map(int, input().split()))
    pairs = []
    parent = [i for i in range(n)]
    parent_sum = [1 for _ in range(n)]
    for i in range(m):
        a, b = list(map(int, input().split()))
        pairs.append((a - 1, b - 1))
    sum_count = n * (n - 1) // 2
    ans.append(sum_count)
    for p, q in reversed(pairs[1:]):
        np, nq = getparent(parent, p), getparent(parent, q)
        if np != nq:
            sum_count -= parent_sum[np] * parent_sum[nq]
            parent_sum[np] += parent_sum[nq]
            parent[nq] = np
        ans.append(sum_count)
    ans.reverse()
    for i in ans:
        print(i)


if __name__ == "__main__":
    main()
mod = 10**9 + 7
N_str = input()
D = int(input())

max_k = len(N_str)
dp = [[[-1]*D for i in range(2)] for j in range(max_k) ]

def rec(k=0, tight=True, mod_sum=0):
    if k == max_k:
        return int(mod_sum==0)
    if dp[k][tight][mod_sum] >= 0:
        return dp[k][tight][mod_sum]
    top = 9 if not tight else int(N_str[k])
    res = 0
    for i in range(top+1):
        res += rec(k+1, tight and i==top, (mod_sum+i) % D)
        res %= mod
    dp[k][tight][mod_sum] = res
    return res

print(rec()-1)

### FIXED CODE ###

mod = 10**9 + 7

K = list(map(int, list(input())))
D = int(input())
keta = len(K)

dp = [[[0]*D for i in range(2)] for j in range(keta+1)]
dp[0][1][0] = 1

from itertools import product
for i, j, k in product(range(keta), range(2), range(D)):
    max_n = K[i] if j else 9
    for l in range(max_n+1):
        dp[i+1][j and l == max_n][(k+l)%D] += dp[i][j][k]
        dp[i+1][j and l == max_n][(k+l)%D] %= mod

ans = 0
for i in range(2):
    ans += dp[-1][i][0]
    ans %= mod
print(max(0, (ans - 1)%mod))
import numpy as np
N, K = map(int, input().split())
A = list(map(int, input().split()))
foo = np.ones((42, N), dtype = "int64")
for k in range(len(A)):
    foo[0][k] = A[k]
if K <42:
    for q in range(K):
        for k in range(N):
            for j in range(1, min(foo[q][k]+1, N-k)):
                foo[q+1][k+j] +=1
            for j in range(1, min(foo[q][k]+1, k+1)):
                foo[q+1][k-j] +=1
        count =0
        for l in range(N):
            if foo[q+1][l] < N:
                break
            else:
                count +=1
        
        if count == N:
            break
        
                        
        #print(foo)
    print(" ".join(map(str, foo[q+1])))

     
else:
    print((str(N)+" ")*(N-1)+str(N))




### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
foo = [[0 for k in range(N)] for k in range(42)]
for k in range(len(A)):
    foo[0][k] = A[k]
if K <42:
    for q in range(K):
        unko = [0 for k in range(N)]
        for k in range(N):
            if k + foo[q][k]+1 < N:
                unko[k + foo[q][k]+1] -=1
            unko[max(k - foo[q][k], 0)] +=1
        unchi = 0
        for k in range(N):
            unchi += unko[k]
            foo[q+1][k] = unchi
        #print(unko)
        #print(foo[q+1])
        count =0
        for l in range(N):
            if foo[q+1][l] < N:
                break
            else:
                count +=1
        
        if count == N:
            break
        
                        
        #print(foo)
    print(" ".join(map(str, foo[q+1])))

     
else:
    print((str(N)+" ")*(N-1)+str(N))
from math import factorial

n,k=map(int,input().split())
a=sorted(list(map(int, input().split())))
s=0

for i in range(n-k+1):
	for j in range(i+k-1,n):
		s+=(a[j]-a[i])*factorial(j-i-1)//factorial(k-2)//factorial(j-i-k+1)
		s%=10**9+7
print(s)

### FIXED CODE ###

def cmb(n, k, mod, fac, ifac):
    """
    nCkを計算する
    """
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % mod


def make_tables(mod, n):
    """
    階乗テーブル、逆元の階乗テーブルを作成する
    """
    fac = [1, 1] # 階乗テーブル・・・(1)
    ifac = [1, 1] #逆元の階乗テーブル・・・(2)
    inverse = [0, 1] #逆元テーブル・・・(3)

    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        ifac.append((ifac[-1] * inverse[-1]) % mod)
    return fac, ifac
    
n,k=map(int,input().split())
a=sorted(list(map(int, input().split())))
MOD=10**9+7

fac, ifac=make_tables(MOD,n)

s=0
for i in range(k-1,n):
	s+=(a[i]-a[n-i-1])*cmb(i,k-1,MOD,fac,ifac)
	s%=10**9+7
print(s)
A = []
n = input()

for i in range(n):
    command = [0, 0]
    temp = raw_input().split()
    command[0] = temp[0]
    command[1] = int(temp[1])

    if command[0] == "insert":
        A.insert(0, command[1])
    elif command[0] == "delete":
        A.remove(command[1])
    elif command[0] == "deleteFirst":
        A.pop(0)
    elif command[0] == "deleteLast":
        A.pop()

for i in range(len(A)):
    print A[i],

### FIXED CODE ###

A=[]
fp =0
bp =0
n=int(raw_input())
while n: 
    cmd = raw_input()
    if cmd[0] == 'i':
        A.append(int(cmd[7:]))
        fp += 1
    elif cmd[6] == ' ':
        try:
            i = A[::-1].index(int(cmd[7:]))
            if i!=-1:
                del A[-i-1]
                fp -=1
        except:
            pass
    elif cmd[6] == 'F':
        A.pop()
        fp -=1
    elif cmd[6] == 'L':
        bp +=1
    n -=1
 
for k in A[bp:fp+1][::-1]:
    print int(k),
import numpy as np

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

x=[]
for i in range(n):
    x.append(np.array(list(map(int,input().split()))))

ans=0
for i in range(n-1):
    for j in range(i+1,n):
        if np.linalg.norm(x[i]-x[j]).is_integer():
#            print(np.linalg.norm(x[i]-x[j]))
            ans+=1

print(ans)

### FIXED CODE ###

import math

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

x=[]
for i in range(n):
    x.append(list(map(int,input().split())))

ans=0
for i in range(n-1):
    for j in range(i+1,n):
        nor = math.sqrt(sum([(x[i][k]-x[j][k])**2 for k in range(d)]))
        
        if nor.is_integer():
#            print(nor)
            ans+=1

print(ans)
import numpy as np
inf = np.iinfo(np.uint32).max



def solve():
    count_dists = np.zeros(n+1, dtype=int)
    for a in range(1,n+1):
        for b in range(1,a+1):
            dis = min(abs(b-a), abs(x-a)+ abs(y-b) + 1, abs(y-a) + abs(x-b) + 1)
            count_dists[dis] += 1
    #print(min_dists)
    for j in range(1,n):
        print(count_dists[j])


#
# def ceildiv(a, b):
#     return a // b + a % b



n, x, y = [int(i) for i in input().split(" ")]

solve()


### FIXED CODE ###

import numpy as np

inf = np.iinfo(np.uint32).max



# def solve():
#     dists_y = [abs(y-a) for a in range(0,n+1)]
#     dists_x = [abs(x-a) for a in range(0,n+1)]
#     count_dists = np.zeros(n+1, dtype=int)
#     for a in range(1,n+1):
#         for b in range(1,a+1):
#             dis = min(abs(b-a), dists_x[a] + dists_y[b] + 1, dists_y[a] + dists_x[b] + 1)
#             count_dists[dis] += 1
#     #print(min_dists)
#     for j in range(1,n):
#         print(count_dists[j])

def solve():
    dists_y = [abs(y-a) for a in range(1,n+1)]
    dists_x = [abs(x-a) for a in range(1,n+1)]

    aa = np.tile(np.arange(1, n+1), (n, 1))
    bb = aa.transpose().copy()
    base_dists = np.abs(aa-bb).copy()
    aa = np.tile(dists_y, (n, 1))
    bb = np.tile(dists_x, (n, 1)).transpose().copy()
    ab_dists = aa + bb + 1
    ba_dists = ab_dists.transpose().copy()
    min_dists = np.minimum(ab_dists, ba_dists)
    min_dists = np.minimum(min_dists, base_dists)
    count_dists = np.bincount(min_dists.reshape(n**2))
    for j in range(1,n):
        if j+1>len(count_dists):
            print(0)
        else:
            print(count_dists[j]//2)



#
# def ceildiv(a, b):
#     return a // b + a % b



n, x, y = [int(i) for i in input().split(" ")]

# import time
# t = time.time()
# n, x, y = 2000, 200, 600


solve()
#print(time.time()- t)
N=int(input())
t=[0]*N
r=set(range(N))
for _ in[0]*N:
 e=list(map(int,input().split()))
 t[e[0]]=e[1:]+[0]*5
 r-={e[1:]}
def f(i,p,s,d):
 if i<0:return-1
 l,r=t[i][:2]
 t[i][2:]=[p,s,(l!=-1)+(r!=-1),d,max(f(l,i,r,d+1),f(r,i,l,d+1))+1]
 return t[i][-1]
f(r.pop(),-1,-1,0)
for i in range(N):
 print('node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}'.format(i,*t[i][2:],'root'if not t[i][5]else'internal node'if t[i][4]else'leaf'))


### FIXED CODE ###

N=int(input())
t=[0]*N
r=set(range(N))
for _ in[0]*N:
 x,y,z=map(int,input().split())
 t[x]=[y,z]+[0]*5
 r-={y,z}
def f(i,p,s,d):
 if i<0:return-1
 k=t[i]
 l,r=k[:2]
 k[2:]=[p,s,(l!=-1)+(r!=-1),d,max(f(l,i,r,d+1),f(r,i,l,d+1))+1]
 return t[i][-1]
f(r.pop(),-1,-1,0)
for i in range(N):
 print('node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}'.format(i,*t[i][2:],'root'if not t[i][5]else'internal node'if t[i][4]else'leaf'))
def main():
    L = int(input())
    S, T = (input() for _ in [0] * 2)

    s = S * len(T)
    t = T * len(S)
    if s < t:
        a = S
        b = T
    else:
        a = T
        b = S

    i = 0
    while 1:
        x = L - (len(b) * i)
        div_, mod_ = divmod(x, len(a))
        if not mod_:
            ans = a * div_ + b * i
            break
        i += 1
    print(ans)

main()


### FIXED CODE ###

def main():
    L = int(input())
    S, T = (input() for _ in [0] * 2)

    ans = []
    apnd = ans.append
    a = S
    b = T
    i = 0
    for _ in [0] * 2:
        while 1:
            x = L - (len(b) * i)
            div_, mod_ = divmod(x, len(a))
            if not mod_:
                apnd(a * div_ + b * i)
                break
            i += 1
        i = 0
        a, b = b, a
    print(min(ans))

main()
N = int(input())
S = [list(input()) for i in range(N)]
T = ['' for m in range(N)]

for l in range(N):
  S[l].sort()
  T[l] = ''.join(S[l])

ans = 0
for j in range(N):
  for k in range(j+1,N):
    if S[j][0] == S[k][0]:
      if S[j][N-1] == S[k][N-1]:
        if T[j] == T[k]:
          ans += 1

print(ans)


### FIXED CODE ###

from operator import itemgetter
N = int(input())
S = [list(input()) for i in range(N)]

for l in range(N):
  S[l].sort()
  S[l] = ''.join(S[l]) 

S.sort()

X = []
p = 1

for j in range(N-1):
  if S[j] == S[j+1]:
    p +=1
  else:
    X.append(p)
    p = 1
X.append(p)


def comb(n):
  if n == 2: return 1
  else:
    return int(n*(n-1)/2)

ans = 0

for k in range(len(X)):
  ans += comb(X[k])

print(ans)
N, M = map(int, input().split())
a_k = [list(map(int, input().split())) for i in range(N)]
a_k.sort()

for i in range(1, len(a_k)):
    a_non = []

    for j in range(1, len(a_k[0])):
        if a_k[0][j] not in a_k[i][1:]:
            a_non.append(j)

    for j in range(len(a_non)):
        a_k[0].pop(a_non[j])


print(len(a_k[0]) - 1)


### FIXED CODE ###

N, M = map(int, input().split())
k = [i[1:] for i in [list(map(int, input().split())) for i in range(N)]]
k_1 = [flatten for inner in k for flatten in inner]
count_k = 0
for i in range(1, M + 1):
    if k_1.count(i) == N:
        count_k += 1

print(count_k)
S = list(map(str, input()))
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == "L":
      unreadble += 1
  else:
    if S[i] == "R":
  	  unreadble += 1
if unreadble >= 1:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

S = list(map(str, input()))
unreadble = 0
for i in range(len(S)):
  if i % 2 == 0:
    if S[i] == "L":
      unreadble += 1
  else:
    if S[i] == "R":
  	  unreadble += 1
if unreadble >= 1:
  print("No")
else:
  print("Yes")
x, y =  = map(int,input().split())
if abs(x-y) < 1:
    print('Brown')
else:
    print('Alice')

### FIXED CODE ###

x, y = map(int,input().split())
if abs(x-y) <= 1:
    print('Brown')
else:
    print('Alice')
import math

def dictcheck(dict):
    min = 0
    for k,v in dict.items():
#        print("k:",k ,"+", "v:",v)
        if min == 0:
            min=(int(k)-1)+(int(v)-1)
        elif min > (int(k)-1)+(int(v)-1):
            min = (int(k)-1)+(int(v)-1)
        else:
            continue
    print(min)

def main():
    N = int(input())
    i = 2
    tmpdict= {}
    while i < math.sqrt(N):
        if N % i == 0:
            tmpdata = {i:N/i}
            tmpdict.update(tmpdata)
            i+=1
        else:
            i+=1
    if len(tmpdict)==0:
        tmpdata = {1,N-1}
        tmpdict.update(tmpdata)
#    print(tmpdict)
    dictcheck(tmpdict)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import math

def dictcheck(dict):
    min = 0
    for k,v in dict.items():
        if k == 1:
            min = v
            break
        elif min == 0:
            min=(int(k)-1)+(int(v)-1)
        elif min > (int(k)-1)+(int(v)-1):
            min = (int(k)-1)+(int(v)-1)
        else:
            continue
    print(min)

def main():
    N = int(input())
    i = 2
    tmpdict= {}
    while i <= math.sqrt(N):
        if N % i == 0:
            tmpdata = {i:N/i}
            tmpdict.update(tmpdata)
            i+=1
        else:
            i+=1
    if len(tmpdict)==0:
        tmpdata = {1:N-1}
        tmpdict.update(tmpdata)
#    print(tmpdict)
    dictcheck(tmpdict)

if __name__ == "__main__":
    main()
counter = 0
for s[i] in range(2):
  if s[i] == 1:
    counter += 1
  else:
    pass
print(counter)


### FIXED CODE ###

print(input().count('1'))
n,s = int(raw_input()),map(int,raw_input().split())
s.sort(key = x:-x)
print sum(s[0:n:2]) - sum(s[1:n:2])

### FIXED CODE ###

n,s = int(raw_input()),map(int,raw_input().split())
s.sort(key = lambda x:-x)
print sum(s[0:n:2]) - sum(s[1:n:2])
N,X=map(int,input().split())
length=list(map(int,input().split()))
ans=0
D=0
i=0
while True:
    if D<=X:
        ans+=1
    else:
        break
    D=D+length[i]
    i+=1
print(ans)

### FIXED CODE ###

N, X = map(int, input().split())
S = list(map(int, input().split()))
l = len(S)

ans = 1
num = 0

for i in range(l):
	num += S[i]
	if num <= X:
		ans += 1

print(ans)
a=[]
for i in range(0,2):
  	a.append(input())
print(a[0]**2-a[1])

### FIXED CODE ###

a=[]
for i in range(0,2):
  a.append(int(input()))
print(a[0]**2-a[1])
from collections import deque

H,W=map(int,input().split())
grid=[input() for i in range(H)]
dist=[[-1]*W for _ in range(H)]

black_cells=deque()
for h in range(H):
    for w in range(W):
        if grid[h][w] == "#":
            black_cells.append((h,w))
            dist[h][w]=0

def bfs(black_cells,dist,grid):
        d=0
        while black_cells:
            h,w=black_cells.popleft()
            d=dist[h][w]
            for dx, dy in ((1,0),(0,1),(-1,0),(0,-1)):
                new_h=h+dy
                new_w=w+dx
                if new_h <0 or H <= new_h or new_w < 0 or W<=new_w:
                    continue
                if dist[new_h][new_w]==-1:
                    dist[new_h][new_w]=d+1
                    black_cells.append((new_h,new_w))
        return d

d=bfs(black_cells,dist)
print(d)


### FIXED CODE ###

from collections import deque

H,W=map(int,input().split())
grid=[input() for i in range(H)]
dist=[[-1]*W for _ in range(H)]

black_cells=deque()
for h in range(H):
    for w in range(W):
        if grid[h][w] == "#":
            black_cells.append((h,w))
            dist[h][w]=0

def bfs(black_cells,dist):
        d=0
        while black_cells:
            h,w=black_cells.popleft()
            d=dist[h][w]
            for dx, dy in ((1,0),(0,1),(-1,0),(0,-1)):
                new_h=h+dy
                new_w=w+dx
                if new_h <0 or H <= new_h or new_w < 0 or W<=new_w:
                    continue
                if dist[new_h][new_w]==-1:
                    dist[new_h][new_w]=d+1
                    black_cells.append((new_h,new_w))
        return d

d=bfs(black_cells,dist)
print(d)
N = int(input()) 

list = []
for i in range(N) :
    a = input()
    list.append(a)

print(int(list[N])-int(list[0]))


### FIXED CODE ###

input()
a = sorted(map(int, input().split()))
print(a[-1]-a[0])
import itertools
import fractions
from functools import reduce
k = int(input())
num = []
for i in range(1, k+1):
    num.append(i)
    num.append(i)
    num.append(i)
permutation_num = set(itertools.permutations(num, 3))
x = []
for j in s:
    y = reduce(fractions.gcd, j)
    x.append(y)

print(sum(x))

### FIXED CODE ###

import math
k = int(input())
a = []
for i in range(1, k+1):
    for j in range(1, k+1):
        x = math.gcd(i, j)
        for l in range(1, k+1):
            y = math.gcd(l, x)
            a.append(y)
print(sum(a))
# Problem D - String Formation

# input process
S = input()
Q = int(input()) # query number

# initialization
sento = 1
mae_str = []
usiro = []

# process
for i in range(Q):
    query_num = input()
    # クエリが１の時
    if query_num=="1" and sento==1:
        sento = 10
    elif query_num=="1":
        sento = 1
    else: # query num 2
        n, f, c = query_num.split()
        f = int(f)
        if f==1: # 先頭追加処理
            # 先頭の位置によって変わる
            if sento==1:
                mae_str.append(c)
            else:
                usiro.append(c)
        else: # 末尾追加処理
            if sento==1:
                usiro.append(c)
            else:
                mae_str.append(c)

# output process
if sento==1:
    ans = ""
    for m in mae_str[::-1]:
        ans = ans + m
    ans = ans + S
    for u in usiro:
        ans = ans + s
    print(ans)
else:
    ans = ""
    for u in usiro[::-1]:
        ans = ans + u
    ans = ans + S[::-1]
    for m in mae_str:
        ans = ans + m
    print(ans)


### FIXED CODE ###

# Problem D - String Formation

from collections import deque

# input process
S = input().replace("\n", "")
S = deque(list(S))
Q = int(input()) # query number

# initialization
sento = 1

# process
for i in range(Q):
    query_num = input()
    # クエリが１の時
    if query_num[0]=="1":
        # 反転処理
        if sento==1:
            sento = 10
        elif sento==10:
            sento = 1
    elif query_num[0]=="2":
        n, f, c = query_num.split()
        f = int(f)
        if f==1: # 先頭追加処理
            # 先頭の位置によって変わる
            if sento==1:
                S.appendleft(c)
            elif sento==10:
                S.append(c)
        elif f==2: # 末尾追加処理
            if sento==1:
                S.append(c)
            elif sento==10:
                S.appendleft(c)

# output process
if sento==1:
    print("".join(S))
else:
    print("".join(list(S)[::-1]))
n = int(input())
if n==1:
  print("Hello World")
else:
  a,b = map(int,input().split())
  print(int(a+b))

### FIXED CODE ###

n = int(input())
if n==1:
  print("Hello World")
else:
  a = int(input())
  b = int(input())
  print(int(a+b))
H, W = map(int, input().split())

inpt =[]
for h in H:
    i = str(input())

string = 'No'

for h in range(H):
    for w in range(W):
        if h == H-1 or w == W-1:
            continue
        if inpt[h][w] == '#':
            if inpt[h+1][w] == '#' or inpt[h][w+1] == '#':
                 string = 'Yes'
                 
print(string)


### FIXED CODE ###

class UnionFind:
    def __init__(self, N:int):
        """N: 大きさ
        size: 連結成分の大きさ
        """
        self.par = [i for i in range(N)]
        self.size = [1]*N
        self.rank = [1]*N
        
    def root(self, x:int)->int:
        """根を求める"""
        if self.par[x] == x: # if root
            return x
        else:
            self.par[x] = self.root(self.par[x]) # 経路圧縮
            return self.par[x]
        
    def is_same(self, x:int, y:int)->bool:
        """x と y が同じ集合に属するか否か"""
        return self.root(x)==self.root(y)
    
    def unite(self, x:int, y:int):
        """y を x の属する集合に併合"""
        root_x = self.root(x)
        root_y = self.root(y)
        if root_x == root_y: return
        if self.rank[root_x] == self.rank[root_y]:
            self.rank[root_x] += 1
        elif self.rank[root_x]<self.rank[root_y]:
            root_x,root_y = root_y,root_x
        # 短いほう(y)を長いほう(x)にくっつける
        self.par[root_y] = root_x
        self.size[root_x] += self.size[root_y]
        self.size[root_y] = 0 # もういらない
        
    def get_size(self, x:int)->int:
        """xの属するグループのサイズ"""
        return self.size[self.root(x)]

H,W = map(int, input().split())
grid = [input() for _ in range(H)]
uf = UnionFind(H*W)
for h in range(H):
    for w in range(W):
        for i,j in zip([0,0,1,-1], [1,-1,0,0]):
            if not (0 <= h+i < H and 0 <= w+j < W): 
                continue
            if grid[h][w]=="#" and grid[h+i][w+j]=="#":
                uf.unite(h*W + w, (h+i)*W + w+j) 
                
        #print([uf.root(n) for n in range(H*W)])

ans = "Yes"
for h in range(H):
    for w in range(W):
        if grid[h][w]=="#":
            if uf.get_size(h*W + w)<2:
                ans = "No"
print(ans)
N,M,K = map(int, input().split())
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))

ai = 0
bi = 0
cnt = 0
while True:
    if ai == N and bi == M:
        break
    elif ai == N:
        if B_list[bi] <= K:
            cnt += 1
            K -= B_list[bi]
            bi += 1
        else:
            break
    elif bi == N:
        if A_list[ai] <= K:
            cnt += 1
            K -= A_list[ai]
            ai += 1
        else:
            break

    elif A_list[ai] < B_list[bi]:
        if A_list[ai] <= K:
            cnt += 1
            K -= A_list[ai]
            ai += 1
        else:
            break
    else:
        if B_list[bi] <= K:
            cnt += 1
            K -= B_list[bi]
            bi += 1
        else:
            break
print(cnt)

### FIXED CODE ###

import bisect

def main():
    N,M,K = map(int, input().split())
    A_list = list(map(int, input().split()))
    B_list = list(map(int, input().split()))

    # cumsum
    A_cum = [0] * (N+1)
    B_cum = [0] * (M)
    ap = 0
    for i, a in enumerate(A_list):
        A_cum[i+1] = ap + a
        ap += a
    bp = 0
    for i, b in enumerate(B_list):
        B_cum[i] = bp + b
        bp += b

    max_cnt = 0
    for i in range(N+1):
        a = A_cum[i]
        if a > K:
            break
        bi = bisect.bisect_right(B_cum, K-a)
        max_cnt = max(max_cnt, i+bi)

    print(max_cnt)

if __name__ == "__main__":
    main()