Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

x = int(input())
i = 0
while True:
    tres = x + i ** 5
    a = tres ** (1.0 / float(5))
    if a ** 5 == tres:
        print(int(a), i)
        exit()
    tres = x + (i * -1) ** 5
    a = tres ** (1.0 / float(5))
    if a ** 5 == tres:
        print(int(a), i * -1)
        exit()
    i += 1

### FIXED CODE ###

x = int(input())
i = 0
for i in range(-200, 201):
    for j in range(-200, 201):
        if (i ** 5 - j ** 5) == x:
            print(i, j)
            exit()
### BUGGY CODE ###

N=int(input())
S=input()
ans=N
for i in range(N):
    w=S[:i].count('W')
    e=S[i+1:].count('E')
    ans=min(ans,w+e)
    w=0
    e=0
print(ans)

### FIXED CODE ###

N=int(input())
S=input()

wsum=[0]*N
if S[0]=='W':
    wsum[0]=1
else:
    wsum[0]=0    
for i in range(1,N):
    if S[i]=='W':
        wsum[i]=wsum[i-1]+1
    else:
        wsum[i]=wsum[i-1]

SR=S[::-1]
esum=[0]*N
if SR[0]=='E':
    esum[0]=1
else:
    esum[0]=0
for i in range(1,N):
    if SR[i]=='E':
        esum[i]=esum[i-1]+1
    else:
        esum[i]=esum[i-1]
esum=esum[::-1]

ans=N
for i in range(N):
    ans=min(ans,wsum[i]+esum[i]-1)
print(ans)
### BUGGY CODE ###

numbers = input().split()
a = numbers[0]
b = numbers[1]
i = 1
while True:
    if a != i:
        i += 1
        continue
    else:
        if b < i:
            print(i - 1)
            break
        else:
            print(i)
            break


### FIXED CODE ###

numbers = input().split()
a = int(numbers[0])
b = int(numbers[1])
i = 1
while True:
    if a != i:
        i += 1
        continue
    else:
        if b < i:
            print(i - 1)
            break
        else:
            print(i)
            break
### BUGGY CODE ###

import fractions

def lcm(a, b):
    return a * b / fractions.gcd(a, b)

N = int(input())
A = [int(i) for i in input().split()]
mod = 10**9+7
ll = A[0]
for i in A:
    ll = lcm(ll, i)
ans = 0
for i in A:
    ans += ll // i
print(int(ans%mod))


### FIXED CODE ###

from fractions import gcd

def lcm(c,d):
    return c//gcd(c,d)*d
mod=10**9+7
n=int(input())
a=[int(i) for i in input().split()]
l=a[0]
for i in range(1,n):
    l=lcm(l,a[i])
ans=0
for i in range(n):
    ans+=l//a[i]
    #ans%=mod
print(ans%mod)
### BUGGY CODE ###

def main():
    n,m=map(int,input().split())
    a=sorted(list(map(int,input().split())))
    d=[]
    for _ in range(m):
        b,c=map(int,input().split())
        for _ in range(b):
    	    d.append(c)

    d=sorted(d,reverse=True)
    right=sum(a)
    left=0

    for i in range(min(n,len(d))):
        if a[i]<d[i]:
            left+=d[i]
            right-=a[i]
        else:
            break
    print(right+left)

if __name__ == "__main__":
    main()

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
arr=[]

for i in range(m):
    b,c=map(int,input().split())
    arr.append((b,c))

a=sorted(a)
arr=sorted(arr,key=lambda x:-x[1])

flag=0
left=0
for tup in arr:
    for i in range(left,min(left+tup[0],n)):
        if tup[1]>a[i]:
            a[i]=tup[1]
        else:
            flag=-1
            break
        if i==n-1:
            flag=-1
            break
    left+=tup[0]
    if flag==-1:
        break

print(sum(a))
### BUGGY CODE ###

N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
#print(A)
ans = 0
time = 0
#i = 0
#j = 0
while time < K:
    if not A:
        ans += 1
        time += B[0]
        #print(A)
        #print(B)
        B.pop(0)
    elif not B:
        ans += 1
        time += A[0]
        A.pop(0)
        #print(A)
    #    print(B)
    elif A[0] > B[0] :
        #print(B[0])
        time += B[0]
        ans += 1
        B.pop(0)
        #print(A)
        #print(B)
    elif A[0] < B[0]:
        #print(A[0])
        time += B[0]
        ans += 1
        A.pop(0)
        #print(A)
        #print(B)
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)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import numpy as np
import sys


def main():
    N, K, Q = map(int, input().split())
    score = []
    for i in range(Q):
        score.append(int(input())-1)
    score = np.array(score)
    for i in range(N):
        if K - Q +len(score[score==i]) > 0:
            print("Yes")
        else:
            print("No")




if __name__ =='__main__':
    main()

### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
import sys


def main():
    N, K, Q = map(int, input().split())
    score = np.zeros(N)
    for i in range(Q):
        score[int(input())-1] += 1
    for i in range(N):
        if K - Q +score[i] > 0:
            print("Yes")
        else:
            print("No")








if __name__ =='__main__':
    main()
### BUGGY CODE ###

# -*- coding: utf-8 -*-
#https://atcoder.jp/contests/abc141/tasks/abc147_d
import sys
#import collections

n= int(input())

tmp = input().split()
s = list(map(lambda a: int(a), tmp))

total=0
a=[]
for i in range(0,60):
	a.append(0)

for i in range(0,n):
	tmp = s[i]
	for j in range(0,60):
		if(tmp==0):
			break
		if(tmp%2==1):
			a[j]+=1
		tmp=tmp//2

total=0
for j in range(60,0,-1):
	total*=2
	if(a[j-1]>0):
		total=total+(a[j-1])*(n-a[j-1])
	if(total>1000000007):
		total=total%1000000007
total=total%1000000007

print(total)





### FIXED CODE ###

# -*- coding: utf-8 -*-
#https://atcoder.jp/contests/abc141/tasks/abc147_d
import sys
#import collections

n= int(input())

tmp = input().split()
s = list(map(lambda a: int(a), tmp))

total=0
a=[]
for i in range(0,60):
	a.append(0)

for i in range(0,n):
	tmp = s[i]
	for j in range(0,60):
		if(tmp==0):
			break
		if(tmp%2==1):
			a[j]+=1
		tmp=tmp//2

total=0
for j in range(60,0,-1):
	total*=2
	if(a[j-1]>0):
		total=total+(a[j-1])*(n-a[j-1])
	if(total>1000000007):
		total=total%1000000007
total=total%1000000007

print(total)
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
mod = 1000000000 + 7
sum = 0
for i in range(N):
    for j in range(i+1,N):
        sum += (A[i] * A[j])
print(sum%mod)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
mod = 1000000000 + 7
add = 0
tmp = sum(A)
for i in range(N):
    tmp -= A[i]
    add += tmp * A[i]
print(add%mod)
### BUGGY CODE ###

a,b = map(int,input().split())

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

l = []
for i in range(a):
    l += [c[i]]
    for j in range(i+1,a):
        l += [l[-1] + c[j]]
co = 0
la = 0
for i in range(40,-1,-1):
	for j in range(len(l)):
		if l[j] & (la + 2 ** i) == (la + 2 ** i):
			co += 1
	if co >= b:
		la += (2 ** i)
	co = 0

print(la)


### FIXED CODE ###

a,b = map(int,input().split())

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

aa = []
aa.append(0)
aa.append(c[0])

l = []
for i in range(1,a):
	aa.append(aa[i]+c[i])
d = 0
p = len(aa)
for i in range(p):
	for j in range(i+1,p):
		l.append(aa[j]-aa[i])
co = 0
la = 0
for i in range(40,-1,-1):
	for j in range(len(l)):
		if l[j] & (la + 2 ** i) == (la + 2 ** i):
			co += 1
	if co >= b:
		la += (2 ** i)
	co = 0

print(la)
### BUGGY CODE ###

def makelist2(n,m):
    return[[float("inf") for k in range(m)]for i in range(n)]

n, m = map(int,input().split())
dist = makelist2(n,n)
for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    dist[a][b] = 1
    dist[b][a] = 1
for i in range(n):
    dist[i][i] = 0

for i in range(n):
    for j in range(n):
        for k in range(n):
            dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k])

Q = int(input())
vbc = [list(map(int,input().split())) for i in range(Q)][::-1]
ans = [0 for i in range(n)]


for q in range(Q):
    for i in range(n):
        if dist[vbc[q][0]-1][i] <= vbc[q][1] and ans[i] == 0:
            ans[i] = vbc[q][2]

for p in ans:
    print(p)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n, m = map(int,input().split())
nei =[[i] for i in range(n)]

for i in range(m):
    a, b = map(int,input().split())
    a -= 1
    b -= 1
    nei[a].append(b)
    nei[b].append(a)

color = [0 for i in range(n)]
depth = [-1 for i in range(n)]

def paint(v,d,c,pre):
    if d <= depth[v]:
        return
    depth[v] = d
    if color[v] == 0:
        color[v] = c
    if d == 0:
        return
    for next in nei[v]:
        if next == pre:
            continue
        paint(next,d-1,c,v)

q = int(input())
vbc = [list(map(int,input().split())) for i in range(q)][::-1]

for i in range(q):
    paint(vbc[i][0]-1,vbc[i][1],vbc[i][2],-1)
    #print(color)


for co in color:
    print(co)
### BUGGY CODE ###

from collections import deque
from copy import deepcopy, copy
dy = [-1, 0, 0, 1]
dx = [0, -1, 1, 0]
N = 3
f = lambda x: "\n".join(" ".join(map(str, x[i])) for i in range(3))
def MAIN():
    MAP = [list(map(int, input().split())) for _ in range(N)]
    goal = [[1, 2, 3], [4, 5, 6], [7, 8, 0]]
    ans = 0
    dp = deque([[0, MAP]])
    LOG = [MAP]
    while dp:
        cnt, M = dp.popleft()
        if M == goal:
            print(cnt)
            break
        y, x = divmod(sum(M, []).index(0), N)
        cnt += 1
        for i in range(4):
            ny = y + dy[i]
            nx = x + dx[i]
            if 0 <= ny < N and 0 <= nx < N:
                CM = deepcopy(M)
                CM[y][x], CM[ny][nx] = CM[ny][nx], CM[y][x]
                if not CM in LOG:
                    dp.append([cnt, CM])
                    LOG.append(CM)
MAIN()



### FIXED CODE ###

from collections import deque
N = 3
m = {8: {7, 5}, 7: {8, 6, 4}, 6: {7, 3}, 5: {8, 4, 2}, 4: {7, 5, 3, 1}, 3: {6, 4, 0}, 2: {5, 1}, 1: {4, 2, 0},
     0: {3, 1}}
goal = 123456780
def g(i, j, a):
    t = a // (10 ** j) % 10
    return a - t * (10 ** j) + t * (10 ** i)
def solve():
    MAP = "".join(input().replace(" ", "") for _ in range(N))
    zero = 8 - MAP.find("0")
    start = int(MAP)
    if start == goal:
        return 0
    dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])
    TABLE = {start: (1, 0), goal: (0, 0)}
    while dp:
        cnt, M, yx, flg = dp.popleft()
        cnt += 1
        for nyx in m[yx]:
            key = g(yx, nyx, M)
            if key in TABLE:
                if TABLE[key][0] != flg:
                    return TABLE[key][1] + cnt
                continue
            TABLE[key] = (flg, cnt)
            dp.append((cnt, key, nyx, flg))
def MAIN():
    print(solve())
MAIN()
### BUGGY CODE ###

n, m = map(int, input().split())
k = []
for _ in range(m):
    a, b = map(int, input().split())
    c = list(map(int, input().split()))
    k.append((a, sum([2 ** (i-1) for i in c])))

C = 2 ** n
INF = 10 ** 6

dp = [[INF for _ in range(C)] for __ in range(m + 1)]
for i in range(m+1):
    dp[i][0] = 0

for i, ki in enumerate(k):
    for j in range(C):
        dp[i+1][j] = dp[i][j]
    for j in range(C):
        dp[i+1][j | k[i][1]] = min(dp[i+1][j | k[i][1]], dp[i][j] + k[i][0])

ans = dp[m][C-1]
if ans == INF:
    print(-1)
else:
    print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline
n, m = map(int, input().split())
k = []
for _ in range(m):
    a, b = map(int, input().split())
    c = list(map(int, input().split()))
    k.append((a, sum([2 ** (i-1) for i in c])))

C = 2 ** n
INF = 10 ** 6

dp = [[INF for _ in range(C)] for __ in range(m + 1)]
for i in range(m+1):
    dp[i][0] = 0

for i, ki in enumerate(k):
    for j in range(C):
        dp[i+1][j] = dp[i][j]
    for j in range(C):
        dp[i+1][j | ki[1]] = min(dp[i+1][j | ki[1]], dp[i][j] + ki[0])

ans = dp[m][C-1]
if ans == INF:
    print(-1)
else:
    print(ans)
### BUGGY CODE ###

# C - Exception Handling

N = int(input())
A = [int(input()) for _ in range(N)]
for i in range(N):
    print(max(A[:i] + A[i + 1:]))

### FIXED CODE ###

# C - Exception Handling

N = int(input())
A = [int(input()) for _ in range(N)]
mx1 = sorted(A)[-1]
mx2 = sorted(A)[-2]
for i in range(N):
    if A[i] != mx1:
        print(mx1)
    else:
        print(mx2)
### BUGGY CODE ###

N = int(input())
X = input()
ans = [1 for _ in range(N)]
#original 1 count
l = 0
for k in range(N):
  if X[k] == '1':
    l+=1


intN = int(X, 2)
if l >1:
  N1 = intN %(l-1)
N0 = intN % (l+1)


start = []
if N == 1:
  if X[0] == '1':
    print(0)
    exit()
  else:
    print(1)
    exit()

else:
  for k in range(N):
    if X[k] == '1':
      if l == 1:
        ans[k] = 0
        ia =0
      else:  
        ia = (N1 - pow(2,N-k-1))%(l-1)
    else:
      ia = (N0 + pow(2, N-k-1))%(l+1)
    start.append(ia)

ml = len(bin(l+1))-2
poplist = [0 for _ in range(N)]
t = 1
while t < N + 1:
  t *= 2
  for k in range(t//2, N, t):
    for j in range(t//2):
      if k+j>N-1:
        break
      poplist[k+j] += 1


for k in range(len(start)):
  for count in range(10*5):
    if start[k] == 0:
      ans[k] += count
      break
    else:
      start[k] = start[k] % poplist[start[k]]

for k in range(N):
  print(ans[k])

### FIXED CODE ###

N = int(input())
X = input()
ans = [1 for _ in range(N)]
#original 1 count
l = 0
for k in range(N):
  if X[k] == '1':
    l+=1
if l == 0:
  for _ in range(N):
    print(1)
  exit()
if l == 1:
  if X[-1] == '1':
    for _ in range(N-1):
      ans[_] = 2
  else:
    ans[-1] = 2 
  for k in range(N):
    if X[k] =='1':
      ans[k] = 0 
  for _ in range(N):
    print(ans[_])
  exit()


intN = int(X, 2)
N1 = intN %(l-1)
N0 = intN % (l+1)


start = []
if N == 1:
  if X[0] == '1':
    print(0)
    exit()
  else:
    print(1)
    exit()
else:
  s1 = 1
  s0 = 1
  for k in range(N-1, -1, -1):
    if X[k] == '1':      
      ia = (N1 - s1)%(l-1)
    else:
      ia = (N0 + s0)%(l+1)
    start.append(ia)
    s1 = s1*2%(l-1)
    s0 = s0*2%(l+1)
start = start[::-1]
"""
ml = len(bin(l+1))-2
poplist = [0 for _ in range(N)]
t = 1
while t < N + 1:
  t *= 2
  for k in range(t//2, N, t):
    for j in range(t//2):
      if k+j>N-1:
        break
      poplist[k+j] += 1
"""

def popcount(n):
  c = 0
  n = bin(n)[2:]
  for k in range(len(n)):
    if n[k] == '1':
      c+=1
  return c

for k in range(len(start)):
  for count in range(10*5):
    if start[k] == 0:
      ans[k] += count
      break
    else:
      start[k] = start[k] % popcount(start[k])

for k in range(N):
  print(ans[k])
### BUGGY CODE ###

input_lines = input().split()
N = int(input_lines[0])
M = int(input_lines[1])
S = input()
T = input()

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

def lcm(a, b):
  return a*b/gcd(a, b)

L = int(lcm(N,M))
x = 1
count = 0
while True:
    k = L*x
    flag = 1
    for i in range(N):
        for j in range(M):
            if((i-1)*k/N+1 < (j-1)*k/M+1):
                break
            if((i-1)*k/N+1 == (j-1)*k/M+1):
                if(S[i-1] != T[j-1]):
                    flag = 0
                    count += 1
                    break
        if(flag == 0):
            break
    if(flag == 1):
        print(k)
        break
    if(count == 2):
        print(-1)
        break
    x += 1


### FIXED CODE ###

input_lines = input().split()
N = int(input_lines[0])
M = int(input_lines[1])
S = input()
T = input()

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

def lcm(a, b):
  return a*b/gcd(a, b)

L = int(lcm(N,M))
x = 1
count = 0
while True:
    k = L*x
    flag = 1
    starti = 0
    startj = 0
    for i in range(starti, N):
        for j in range(startj, M):
            hoge = i*k/N+1
            fuga = j*k/M+1
            if(hoge < fuga):
                startj = j - 1
                break
            elif(hoge == fuga):
                if(S[i] != T[j]):
                    flag = 0
                    count += 1
                    break
        if(flag == 0):
            break
    if(flag == 1):
        print(k)
        break
    if(count == 2):
        print(-1)
        break
    x += 1
### BUGGY CODE ###

def f_c():

    n = int(input())
    s = ["".join(sorted(input())) for _ in range(n)]

    c = 0
    for _ in range(n):
        si = s.pop()
        if si in s:
            c += s.count(si)
    print(c)

if __name__ == "__main__":
    f_c()

### FIXED CODE ###

def f_c():

    n = int(input())
    d = {}
    dc = {}
    for _ in range(n):
        s = "".join(sorted(input()))
        if s in d:
            dc[s] += d[s]
            d[s] += 1
        else:
            d[s] = 1
            dc[s] = 0
    print(sum(dc.values()))

if __name__ == "__main__":
    f_c()
### BUGGY CODE ###

import re
S = input()
count=0
while True:
    pS=S
    S=re.sub("BW", "WB", S,1)
    if pS==S:
        break
    else:
        count+=1
print(count)


   
   


### FIXED CODE ###

S =list(input())
count=0
w_count=0
for i in range(len(S)):
    if S[i]=="W":
        count+=i
        w_count+=1
print(int(count-w_count*(w_count-1)/2))
### BUGGY CODE ###

mod = 10**6 + 3

fac = [0]*mod
fac[0] = 1
for i in range(1, mod):
    fac[i] = fac[i - 1] * i
    fac[i] %= mod

def gcd(a, b):
    def calc(a, b, first, second):
        if a < b:
            a, b = b, a
        r = a % b
        q = -(a - r)//b
        if r == 0:
            return b, second
        # first += q * second
        first = [x + q * y for (x, y) in zip(first, second)]
        return calc(r, b, second, first)
    first = [1, 0]
    second = [0, 1]
    return calc(a, b, first, second)

def mod_inv(n, mod):
    table = gcd(n, mod)
    inv = table[1][1]
    if inv < 0:
        inv += mod
    return inv

def mod_pow(x, n, mod):
    ret = 1
    while n > 0:
        if n & 1 != 0:
            ret *= x
            ret %= mod
        x *= x
        x %= mod
        n >>= 1
    return ret

l = input().split()
Q = int(l[0])
X = []
D = []
N = []
for i in range(Q):
    l = input().split()
    X.append(int(l[0]))
    D.append(int(l[1]))
    N.append(int(l[2]))


for i in range(Q):
    x = X[i]
    d = D[i]
    n = N[i]
    if d == 0:
        print(mod_pow(x, n, mod))
        continue
    inv_d = mod_inv(d, mod)
    x_d = (x * inv_d) % mod
    # print(i, x, d, n, inv_d, x_d, x_d + n - 1)
    if x_d + n - 1 >= mod:
        print(0)
        continue
    ans1 = fac[x_d + n - 1]
    ans2 = fac[x_d - 1]
    # print(ans1, ans2)
    ans = ans1 * mod_inv(ans2, mod)
    ans %= mod
    d_n = mod_pow(d, n, mod)
    ans = ans * d_n
    ans %= mod
    print(ans)

### FIXED CODE ###

mod = 10**6 + 3

fac = [0]*mod
fac[0] = 1
for i in range(1, mod):
    fac[i] = fac[i - 1] * i
    fac[i] %= mod

def gcd(a, b):
    def calc(a, b, first, second):
        if a < b:
            a, b = b, a
        r = a % b
        q = -(a - r)//b
        if r == 0:
            return b, second
        # first += q * second
        first = [x + q * y for (x, y) in zip(first, second)]
        return calc(r, b, second, first)
    first = [1, 0]
    second = [0, 1]
    return calc(a, b, first, second)

def mod_inv(n, mod):
    table = gcd(n, mod)
    inv = table[1][1]
    if inv < 0:
        inv += mod
    return inv

def mod_pow(x, n, mod):
    ret = 1
    while n > 0:
        if n & 1 != 0:
            ret *= x
            ret %= mod
        x *= x
        x %= mod
        n >>= 1
    return ret

l = input().split()
Q = int(l[0])
X = []
D = []
N = []
for i in range(Q):
    l = input().split()
    X.append(int(l[0]))
    D.append(int(l[1]))
    N.append(int(l[2]))


for i in range(Q):
    x = X[i]
    d = D[i]
    n = N[i]
    if d == 0:
        print(mod_pow(x, n, mod))
        continue
    inv_d = mod_inv(d, mod)
    x_d = (x * inv_d) % mod
    # print(i, x, d, n, inv_d, x_d, x_d + n - 1)
    if x_d + n - 1 >= mod:
        print(0)
        continue
    ans1 = fac[x_d + n - 1]
    ans2 = fac[x_d - 1]
    # print(ans1, ans2)
    ans = ans1 * mod_inv(ans2, mod)
    ans %= mod
    d_n = mod_pow(d, n, mod)
    ans = ans * d_n
    ans %= mod
    print(ans)
### BUGGY CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
n_a = 0
n_b = 0
t_a = 0
t_b = 0

for i in range(N):
    if sum(A[0:i + 1]) <= K:
        n_a += 1
        t_a += A[i]
        continue
    else:
        break
# print(n_a)
# print(t_a)

for i in range(M):
    if sum(B[0:i + 1]) <= K:
        n_b += 1
        t_b += B[i]
        continue
    else:
        break
# print(n_b)
# print(t_b)

if n_a >= n_b:
    n_b = 0
    t_b = 0
    for i in range(M):
        if sum(B[0:i + 1]) <= K - t_a:
            n_b += 1
            t_b += B[i]
            continue
        else:
            break
    # print(n_b)
    # print(t_b)

else:
    n_a = 0
    t_a = 0
    for i in range(N):
        if sum(A[0:i + 1]) <= K - t_b:
            n_a += 1
            t_a += A[i]
            continue
        else:
            break
    # print(n_a)
    # print(t_a)

print(n_a + n_b)


### FIXED CODE ###

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

# A,Bそれぞれの累積和を作る
# 初期値は0冊目まで読んだときの値（ここでは0）を入れておく
a = [0]
b = [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

# 読める最大の冊数
ans = 0

# Bは全て（=M冊目まで）読めることを初期値とする
# Aの山で読む本を増やすにつれて、jは（広義）単調減少する
j = M

# Aの山について、何冊目まで読むか
for i in range(N + 1):

    # Aの山だけでK分オーバーの場合
    # これ以上iを増やしても無意味なので打ち切る
    if a[i] > K:
        break

    # a[i]+b[j] > K　ならjをデクリメント
    # Bの山を全て読めると仮定した後、下の方から一冊ずつ諦める
    # jはiの増加に対して広義単調減少（しゃくとり法）、Mから0まで一回走査するだけで良い
    while b[j] > K - a[i]:
        j -= 1

    # 冊数はi+j、全てのiに対してi+jを比較、最大のものが答え
    ans = max(ans, i + j)

print(ans)
### BUGGY CODE ###

import math
import copy

N = int(input())
As = input().split()
A = [0 for i in range(N)]
for i in range(N):
  A[i] = int(As[i])

# relabel A's elements
A_unique = list(set(A))
to_unique = {}
for i,a in enumerate(A_unique):
  to_unique[a] = i
for i in range(N):
  A[i] = to_unique[A[i]]

# count number of each label appearing
counts = [0 for i in range(len(A_unique))]
for i,A_i in enumerate(A):
  counts[A_i] += 1

answer = [-1 for i in range(N)]
spoiler = {}
for k in range(N):
  if A[k] in spoiler:
    answer[k] = spoiler[A[k]]
  else:
    appnums = copy.copy(counts)
    appnums[A[k]] -= 1
    answer[k] = 0
    for appnum in appnums:
      if appnum>1: answer[k] += int(appnum*(appnum-1)/2)
    spoiler[A[k]] = answer[k]

for k in range(N):
  print(answer[k])


### FIXED CODE ###

import math
import copy
import numpy as np

N = int(input())
As = input().split()
A = [0 for i in range(N)]
for i in range(N):
  A[i] = int(As[i])

# relabel A's elements
A_unique = list(set(A))
num_unique = len(A_unique)
to_unique = {}
for i,a in enumerate(A_unique):
  to_unique[a] = i
for i in range(N):
  A[i] = to_unique[A[i]]

# count number of each label appearing
counts = [0 for i in range(num_unique)]
for _,A_i in enumerate(A):
  counts[A_i] += 1
answer_total = 0
for count in counts:
  answer_total += int(count*(count-1)/2)

spoiler = [-1 for i in range(num_unique)]
for k in range(N):
  if spoiler[A[k]]<0:
    answer_k = answer_total - (counts[A[k]]-1)
    spoiler[A[k]] = answer_k
  else:
    answer_k = spoiler[A[k]]
  print(answer_k)
### BUGGY CODE ###

v = int(raw_input())
i = 1
while v != 0:
  print("Case " + str(i) + ": " + str(v))

### FIXED CODE ###

v = int(raw_input())
i = 1
while v != 0:
  print("Case " + str(i) + ": " + str(v))
  v = int(raw_input())
  i = i+1