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

S=input()
ACGT=["A","C","G","T"]
m=0
for i in range(len(S)):
  n=0
  while S[i] in ACGT:
    n+=1
  m=max(m,n)
print(m)

### FIXED CODE ###

S=input()
SS=S+"X"
ACGT=["A","C","G","T"]
m=0
for i in range(len(S)):
  j=0
  while SS[i+j] in ACGT:
    j+=1   
  m=max(m,j)
print(m)
### BUGGY CODE ###

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

import copy

N = int(input())
A = [int(input()) for i in range(N)]

Amax = max(A)

for i in range(N):
        if A[i] == Amax:
                TMP = copy.deepcopy(A)
                TMP.pop(i)
                print(max(TMP))
        else:
                print(Amax)
                

### FIXED CODE ###

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

import copy

N = int(input())
A = [int(input()) for i in range(N)]

Amax = max(A)
TMP = copy.deepcopy(A)
TMP.remove(Amax)
Amax2 = max(TMP)

for i in range(N):
        if A[i] == Amax:
                print(Amax2)
        else:
                print(Amax)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
count = 0
for el in a:
    count += a.count(el)-1
count //= 2
for el in a:
    print(count - a.count(el)+1)

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
counter = Counter(a)
d = [0]*(n+1)
count = 0
for el, cnt in counter.most_common():
    d[el] = cnt
    count += cnt*(cnt-1)
count //= 2
for el in a:
    print(count - d[el] + 1)
### BUGGY CODE ###

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

dp = [[[-1]*(n+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 0

def dfs(i, j, k, n):
    if dp[i][j][k] != -1:
        return dp[i][j][k]
    if k == 0:
        res1 = 0
    else:
        res1 = (k/n) * dfs(i, j, k-1, n)
    if j == 0:
        res2 = 0
    else:
        res2 = (j/n) * dfs(i, j-1, k+1, n)
    if i == 0:
        res3 = 0
    else:
        res3 = (i/n) * dfs(i-1, j+1, k, n)
    dp[i][j][k] = (n/(i+k+j)) * (1 + res1 + res2 + res3)
    return dp[i][j][k]

cnt1 = a.count(1)
cnt2 = a.count(2)
cnt3 = a.count(3)

dfs(cnt3, cnt2, cnt1, n)
print(dp[cnt3][cnt2][cnt1])

### FIXED CODE ###

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

dp = [[[0]*(n+1) for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 0

cnt1 = a.count(1)
cnt2 = a.count(2)
cnt3 = a.count(3)

for i in range(cnt3 + 1):
    for j in range(cnt3 + cnt2 + 1 - i):
        for k in range(cnt3 + cnt2 + cnt1 + 1 - i - j):
            if i + j + k == 0:
                continue
            res = 1
            if k > 0:
                res += (k/n) * dp[i][j][k-1]
            if j > 0:
                res += (j/n) * dp[i][j-1][k+1]
            if i > 0:
                res += (i/n) * dp[i-1][j+1][k]
            dp[i][j][k] = (n/(i+k+j)) * res

print(dp[cnt3][cnt2][cnt1])
### BUGGY CODE ###

import sys
import math

input=sys.stdin.readline

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

a=sorted(a,reverse=True)
b=sorted(b)

def ok(N):
    sums=0
    for i in range(n):
        sums+=max(0,a[i]-N//b[i])
    if sums<=k:
        return True
    else:
        return False
    


left=0
right=10**12

for _ in range(40):
    if ok(math.floor((left+right)/2)):
      left=left
      right=(left+right)/2
    elif not ok(math.floor((left+right)/2)):
      left=(left+right)/2
      right=right
print(math.floor(right))
   


### FIXED CODE ###

# いきぬきreview　忘れた問題
# gluttony
N, K = map(int, input().split())
A = list(map(int, input().split()))
F = list(map(int, input().split()))
F.sort()
A.sort(reverse=True)


def func(X):
    s = 0
    for i in range(N):
        a, f = A[i], F[i]
        s += max(0, a-X//f)
    return s <= K


R = 10**12
L = -1
while R-L > 1:
    m = (R+L)//2
    if func(m):
        R = m
    else:
        L = m
print(R)
### BUGGY CODE ###

N = int(input())
L = list(map(int, input().split()))
def tri(a, b, c):
  if a < b + c and b < a + c and c < a + b:
    return True
  else:
    return False
ans = 0
for a in range(0,N-2):
  for b in range(a+1,N-1):
    for c in range(b+1,N):
      if tri(L[a],L[b],L[c]):
        ans += 1
        
print(ans)



### FIXED CODE ###

N = int(input())
L = list(map(int, input().split()))
L.sort(reverse = True)

def binary(mini,maxi,a,b): #a>b
  if maxi == mini + 1:
    if L[maxi] > a - b:
      return maxi
    elif L[mini] > a - b:
      return mini
    else:
      return False
  elif maxi == mini:
    if L[maxi] > a - b:
      return maxi
    else:
      return False
  else:
    mid = (mini+maxi)//2
    if L[mid] > a - b:
      return binary(mid,maxi,a,b)
    else:
      return binary(mini,mid,a,b)
ans = 0
for a in range(0, N-2):
  for b in range(a+1, N-1):
    tmp = binary(b+1, N-1, L[a], L[b])
    if tmp:
      ans += tmp - b
print(ans)
### BUGGY CODE ###

def calc(a, b):
    m = min(a, b)
    l = max(a, b)
    while m != 0:
        s = m
        m = l % m
        l = s
    return l

K = int(input())
ans = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            ans += calc(calc(i+1, j+1), k+1)

print(ans)

### FIXED CODE ###

def calc(a, b):
    m = min(a, b)
    l = max(a, b)
    while m != 0:
        s = m
        m = l % m
        l = s
    return l

K = int(input())
ans = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            ans += calc(calc(i+1, j+1), k+1)

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



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

INF = 10**15
dp = list([INF for _ in range(100010)] for _ in range(N+1))
dp[0][0] = 0

nap = []
for i in range(N):
    w1,v1  = map(int,input().split())
    nap.append([w1,v1])

for i in range(N):
    w1, v1 = nap[i]
    for j in range(100010):
        if j - v1 >= 0:
            dp[i+1][j] = min (dp[i][j] , dp[i][j-v1] + w1 )
        else:
            dp[i+1][j] = min(dp[i][j],dp[i+1][j])
ans = 0
for j in range(100001):
    if dp[N][j] <= W:
        ans = j

print(ans)



### FIXED CODE ###


import sys
input = sys.stdin.readline

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

nap = []
sum_values = 0
for i in range(N):
    w1,v1  = map(int,input().split())
    nap.append([w1,v1])
    sum_values += v1

INF = 10**15
dp = list([INF for _ in range(sum_values+1)] for _ in range(N+1))
dp[0][0] = 0

for i in range(N):
    w1, v1 = nap[i]
    for j in range(sum_values+1):
        if j - v1 >= 0:
            dp[i+1][j] = min (dp[i][j] , dp[i][j-v1] + w1 )
        else:
            dp[i+1][j] = min(dp[i][j],dp[i+1][j])
ans = 0

for j in range(sum_values+1):
    if dp[N][j] <= W:
        ans = j

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

import numpy
N = int(input())
ary = list(map(int, input().split(' ')))
count = 0
zero_count = 0
for i in range(N):
    if ary[0] == 0:
        zero_count += 1
        ary.pop(0)
        continue
    elif len(ary)>=2 and ary[0] == ary[1]:
        ary.pop(0)
        continue
    else:
        if zero_count != 0:
            count += zero_count * (zero_count + 1) / 2
            zero_count = 0
        ary_int = numpy.cumsum(ary)
        count += ary_int.tolist().count(0)
        ary.pop(0)
if zero_count != 0:
    count += zero_count * (zero_count + 1) / 2
    zero_count = 0

print(int(count))

### FIXED CODE ###

import numpy
N = int(input())
ary = list(map(int, input().split(' ')))
ary_int = numpy.cumsum(ary).tolist()
ary_int.sort()
ary_int.append(float('inf'))

count = 0
same_count = 0
for i in range(N):
    if ary_int[i] == ary_int[i+1]:
        same_count += 1
    else:
        count += same_count * (same_count + 1) // 2
        same_count = 0
count += ary_int.count(0)
print(int(count))
### BUGGY CODE ###

def main():
    N, P = map(int,input().split())

    if N == 1:
        print(P)
        exit()

    C = 1
    while pow(C, N) <= P:
        C += 1

    for i in range(C, 0, -1):
        if P % pow(i, N) == 0:
            print(i)
            exit()

    print(1)
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    N, P = map(int,input().split())

    if N == 1:
        print(P)
        exit()

    ans = 1
    d = 2
    while d * d <= P:
        cnt = 0
        while P % d == 0:
            P //= d
            cnt += 1
        ans *= pow(d, cnt//N)
        d += 1

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

from sys import stdin
import sys
import collections
import numpy as np

##  input functions for me
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def rip(sep = ''):
    if sep == '' :
        return map(int, input().split()) 
    else: return map(int, input().split(sep))
def ria(sep = ''): 
    return list(rip(sep))
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##
def main():
    H, W = rip()
    S = [rs() for i in range(H)]
    min = np.full((H,W),-1, dtype = 'int')
    q = collections.deque()
    def enc(h, w): return h * W + w
    def inRange(t, l, r): return l <= t and t < r
    dx = [0,1,0,-1]
    dy = [1,0,-1,0]

    for i in range(H):
        for j in range(W):
            if S[i][j] == '#':
                q.append(enc(i,j))
                min[i][j] = 0
    while(len(q) > 0):
        rc = q.popleft()
        y = rc // W
        x = rc % W
        for t in range(4):
            nx = x + dx[t]
            ny = y + dy[t]
            if (not inRange(nx,0,W)) or (not inRange(ny,0,H)): continue
            if min[ny][nx] == -1:
                min[ny][nx] = min[y][x] + 1
                q.append(enc(ny,nx))
    
    ma = 0
    for i in range(H):
        for j in range(W):
            ma = max(ma, min[i][j])
    print(ma)





if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import stdin
import sys
import collections


##  input functions for me
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def rip(sep = ''):
    if sep == '' :
        return map(int, input().split()) 
    else: return map(int, input().split(sep))
def ria(sep = ''): 
    return list(rip(sep))
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##
def main():
    H, W = rip()
    S = [rs() for i in range(H)]
    #min = np.full((H,W),-1, dtype = 'int')
    min = [[-1] * W for i in range(H)]
    q = collections.deque()
    def enc(h, w): return h * W + w
    def inRange(t, l, r): return l <= t and t < r
    dx = [0,1,0,-1]
    dy = [1,0,-1,0]

    for i in range(H):
        for j in range(W):
            if S[i][j] == '#':
                q.append(enc(i,j))
                min[i][j] = 0
    while(len(q) > 0):
        rc = q.popleft()
        y = rc // W
        x = rc % W
        for t in range(4):
            nx = x + dx[t]
            ny = y + dy[t]
            if (not inRange(nx,0,W)) or (not inRange(ny,0,H)): continue
            if min[ny][nx] == -1:
                min[ny][nx] = min[y][x] + 1
                q.append(enc(ny,nx))
    
    ma = 0
    for i in range(H):
        for j in range(W):
            ma = max(ma, min[i][j])
    print(ma)





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

import numpy as np


def set_values(marr, harr):
    for i in range(len(harr)):
        value = 0
        for j in range(len(harr[i])):
            if marr[i][j]:
                value += 1
                harr[i][j] = value
            else:
                value = 0

    for i in range(len(harr)):
        for j in range(len(harr[i]) - 2, -1, -1):
            if marr[i][j]:
                harr[i][j] = max(harr[i][j], harr[i][j+1])


def solve():
    h, w = [int(x) for x in input().split()]
    marr = []
    harr = []
    varr = []

    for i in range(h):
        line = str(input())
        marr.append([True] * w)
        harr.append([0] * w)
        varr.append([0] * w)

        for j in range(w):
            if line[j] == '#':
                marr[i][j] = False

    marr = np.array(marr)
    harr = np.array(harr)
    varr = np.array(varr)
    set_values(marr, harr)

    t_marr = marr.transpose()
    t_varr = varr.transpose()
    set_values(t_marr, t_varr)
    varr = t_varr.transpose()

    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(ans, harr[i][j] + varr[i][j])

    print(ans - 1)


if __name__ == '__main__':
    solve()



### FIXED CODE ###

import numpy as np
from pprint import pprint


def solve(MM, H, W):

    L, R, U, D = np.zeros((H, W), dtype=int), np.zeros((H, W), dtype=int), np.zeros((H, W), dtype=int), np.zeros((H, W), dtype=int)

    for i in range(H):
        i_r = H - 1 - i

        # L, U
        for j in range(W):
            j_r = W - 1 - j

            # L
            if MM[i][j]:
                if j == 0:
                    L[i][j] = 1
                else:
                    L[i][j] = L[i][j - 1] + 1

            # R
            if MM[i][j_r]:
                if j_r == W - 1:
                    R[i][j_r] = 1
                else:
                    R[i][j_r] = R[i][j_r + 1] + 1

            # U
            if MM[i][j]:
                if i == 0:
                    U[i][j] = 1
                else:
                    U[i][j] = U[i - 1][j] + 1

            # D
            if MM[i_r][j]:
                if i_r == H - 1:
                    D[i_r][j] = 1
                else:
                    D[i_r][j] = D[i_r + 1][j] + 1

    print((L + R + U + D - 3).max())


def solve2(MM, H, W):
    L, R, U, D = [MM.copy() for _ in range(4)]

    # U, D
    for i in range(1, H):
        U[i] = (U[i - 1] + 1) * MM[i]
        i_r = H - 1 - i
        D[i_r] = (D[i_r + 1] + 1) * MM[i_r]

    MM_T = MM.T
    L_T, R_T = L.T, R.T

    # L, R
    for i in range(1, W):
        L_T[i] = (L_T[i - 1] + 1) * MM_T[i]
        i_r = W - 1 - i
        R_T[i_r] = (R_T[i_r + 1] + 1) * MM_T[i_r]

    L, R = L_T.T, R_T.T
    print((L + R + U + D).max() - 3)


def stdin():
    H, W = [int(x) for x in input().split()]
    MM = np.zeros((H, W), dtype=int)

    for i in range(H):
        line = str(input())

        for j in range(W):
            if line[j] != '#':
                MM[i][j] = 1

    solve2(MM, H, W)


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

n = int(input())
alist = []
for i in range(n):
    alist.append(int(input()))
mod = 998244353
asum = sum(alist)


asum_half = (asum + 1) // 2
dp = [[0] * (asum_half + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
    for j in range(asum_half + 1):
        inext = i + 1
        dp[inext][j] = (dp[inext][j] + dp[i][j] * 2) % mod
        jsum = min(j + alist[i], asum_half)
        dp[inext][jsum] = (dp[inext][jsum] + dp[i][j]) % mod
dp_sum = dp[n][asum_half] % mod
dp_sum *= 3
dp_sum = dp_sum % mod


dp_dup = [[0] * (asum_half + 1) for _ in range(n + 1)]
dp_dup[0][0] = 1
if asum % 2 == 0:
    for i in range(n):
        for j in range(asum_half + 1):
            inext = i + 1
            dp_dup[inext][j] = (dp_dup[inext][j] + dp_dup[i][j]) % mod
            jsum = j + alist[i]
            if jsum > asum_half:
                continue
            dp_dup[inext][jsum] = (dp_dup[inext][jsum] + dp_dup[i][j]) % mod
dp_dup_sum = dp_dup[n][asum_half]
dp_dup_sum *= 3
dp_dup_sum = dp_dup_sum % mod


ans = pow(3, n, mod)
ans -= dp_sum
ans += dp_dup_sum

print(ans % mod)


### FIXED CODE ###

n = int(input())
alist = []
for i in range(n):
    alist.append(int(input()))
mod = 998244353
asum = sum(alist)


asum_half = (asum + 1) // 2
dp = [[0] * (asum_half + 1) for _ in range(n + 1)]
dp[0][0] = 1
for i in range(n):
    for j in range(asum_half + 1):
        inext = i + 1
        dp[inext][j] = (dp[inext][j] + dp[i][j] * 2) % mod
        jsum = min(j + alist[i], asum_half)
        dp[inext][jsum] = (dp[inext][jsum] + dp[i][j]) % mod
dp_sum = dp[n][asum_half] % mod
dp_sum *= 3
dp_sum = dp_sum % mod


dp_dup = [[0] * (asum_half + 1) for _ in range(n + 1)]
dp_dup[0][0] = 1
if asum % 2 == 0:
    for i in range(n):
        for j in range(asum_half + 1):
            inext = i + 1
            dp_dup[inext][j] = (dp_dup[inext][j] + dp_dup[i][j]) % mod
            jsum = j + alist[i]
            if jsum > asum_half:
                continue
            dp_dup[inext][jsum] = (dp_dup[inext][jsum] + dp_dup[i][j]) % mod
dp_dup_sum = dp_dup[n][asum_half]
dp_dup_sum *= 3
dp_dup_sum = dp_dup_sum % mod


ans = pow(3, n, mod)
ans -= dp_sum
ans += dp_dup_sum

print(ans % mod)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
import numpy as np
H,W = map(int,input().split())
Gd,L,R,U,D=[None]*H,[None]*H,[None]*H,[None]*H,[None]*H
for _ in range(H):
  Gd[_] = list(input())
  L[_], R[_], D[_], U[_] = [0]*W, [0]*W, [0]*W, [0]*W
L=np.array(L)
R=np.array(R)
U=np.array(U)
D=np.array(D)

for h in range(H):
  for w in range(W):
    if Gd[h][w]=='#':
      R[h][w]=0
    else:
      if w==0:
        R[h][w]=1
      else:
        R[h][w]=R[h][w-1]+1
    wr=W-w-1
    if Gd[h][wr]=='#':
      L[h][wr]=0
    else:
      if w==0:
        L[h][wr]=1
      else:
        L[h][wr]=L[h][wr+1]+1

for w in range(W):
  for h in range(H):
    if Gd[h][w]=='#':
      D[h][w]=0
    else:
      if h==0:
        D[h][w]=1
      else:
        D[h][w]=D[h-1][w]+1
    hr=H-h-1
    if Gd[hr][w]=='#':
      U[hr][w]=0
    else:
      if h==0:
        U[hr][w]=1
      else:
        U[hr][w]=U[hr+1][w]+1
ret = np.max(D+U+L+R-3)
print(ret)

### FIXED CODE ###

import numpy as np
H,W = map(int,input().split())
HL=list(range(H))
WL=list(range(W))
Gd = np.array([list(input()) for _ in HL])
Gd = np.where(Gd=='.', 1, 0)
L=np.zeros((H,W),dtype=np.int64)
R=np.zeros((H,W),dtype=np.int64)
U=np.zeros((H,W),dtype=np.int64)
D=np.zeros((H,W),dtype=np.int64)

for w in WL:
  R[:,w]=(R[:,w-1]+1)*Gd[:,w]
  L[:,-w-1]=(L[:,-w]+1)*Gd[:,-w-1]
for h in HL:
  D[h,:]=(D[h-1,:]+1)*Gd[h,:]
  U[-h-1,:]=(U[-h,:]+1)*Gd[-h-1,:]
print(np.max(D+U+L+R-3))
### BUGGY CODE ###

N,K=map(int,input().split())
Points=[[int(i) for i in input().split()] for i in range(N)]
List_x=[Points[i][0] for i in range(N)]
List_x.sort(key=lambda x:x)
List_y=[Points[i][1] for i in range(N)]
List_y.sort(key=lambda x:x)
n=0
S=[]
for x1 in range(N-1):
  for x2 in range(x1+K-1,N):
    for y1 in range(N-1):
      for y2 in range(y1+K-1,N):
        for p in Points:
          if List_x[x1]<=p[0]<=List_x[x2] and List_y[y1]<=p[1]<=List_y[y2]:
            n+=1
          if n>=K:
            x_delta=List_x[x2]-List_x[x1]
            y_delta=List_y[y2]-List_y[y1]
            S.append(x_delta*y_delta)
            break
        if n>=K:
          n=0
          break  
        n=0
print(min(S))  

### FIXED CODE ###

N,K=map(int,input().split())
Points=[[int(i) for i in input().split()] for i in range(N)]
List_x=[Points[i][0] for i in range(N)]
List_x.sort(key=lambda x:x)
List_y=[Points[i][1] for i in range(N)]
List_y.sort(key=lambda x:x)
n=0
Y=0
S=[]
for x1 in range(N-1):
  for x2 in range(x1+K-1,N):
    for y1 in range(N-1):
      for y2 in range(max([y1+K-1,Y]),N):
        for p in Points:
          if List_x[x1]<=p[0]<=List_x[x2] and List_y[y1]<=p[1]<=List_y[y2]:
            n+=1
          if n==K:
            x_delta=List_x[x2]-List_x[x1]
            y_delta=List_y[y2]-List_y[y1]
            S.append(x_delta*y_delta)
            break
        if n>=K:
          n=0
          Y=y2
          break  
        n=0
    Y=0    
print(min(S))
### BUGGY CODE ###

# 入力
n = int(input())
org_nums = list(map(int, input().split()))
# ソートは一回だけして、取り去る順番を明確にしてから１つずつ取り去り計算を行いたい
sorted_nums = sorted(org_nums) # 入力数列のソート
sorted_index = sorted(range(len(org_nums)), key=lambda k: org_nums[k]) #ソートされたリストから取り去る順番がわかる
extract_index = sorted(range(len(sorted_index)), key=lambda k: sorted_index[k]) #ソートされたリストから取り出すインデックスを取り出す順に並べる
#print(sorted_index)
#print(extract_index)
for i in extract_index:
    tmp = sorted_nums.copy()
    tmp.pop(i)
    print(tmp[(n-1)//2])

### FIXED CODE ###

# AC
# 入力
n = int(input())
org_nums = list(map(int, input().split()))
# ソートは一回だけして、取り去る順番を明確にしてから１つずつ取り去り計算を行いたい
sorted_nums = sorted(org_nums) # 入力数列のソート
sorted_index = sorted(range(len(org_nums)), key=lambda k: org_nums[k]) #ソートされたリストから取り去る順番がわかる
extract_index = sorted(range(len(sorted_index)), key=lambda k: sorted_index[k]) #ソートされたリストから取り出すインデックスを取り出す順に並べる
#print(extract_index)
for i in extract_index:
    if i+1 <= n // 2:
        print(sorted_nums[n//2])
    else:
        print(sorted_nums[n//2-1])
### BUGGY CODE ###

import math

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

N = int(input())
S = ["".join(sorted(input())) for i in range(N)]

S_ = S[:]
S_ = set(S_)

a = [combinations_count(S.count(i), 2) for i in S_ if not S.count(i) == 1]

print(int(sum(a)))


### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]
existed = {}
c = 0
for i in range(n):
  sorted_s = ''.join(sorted(s[i]))

  if sorted_s in existed:
    c += existed[sorted_s]
    existed[sorted_s] += 1
  else:
    existed[sorted_s] = 1
print(c)
### BUGGY CODE ###

n = int(input())
s = input()
se = set()
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            a=s[i]+s[j]+s[k]
            se.add(a)
print(len(se))


### FIXED CODE ###

n = int(input())
s = input()
se = set()
for i in range(1000):
    se.add(str(i).zfill(3))

ans = 0
for i in se:
    t1=s.find(i[0])
    if t1!=-1:
        t2=s.find(i[1],t1+1,)
        if t2!=-1:
            t3=s.find(i[2],t2+1,)
            if t3!=-1:
                ans+=1
print(ans)
### BUGGY CODE ###

def lcm(x, y):
  greater = max(x, y)
  
  while True:
    if (greater % x == 0) and (greater % y == 0):
      lcm = greater
      break
    
    greater += 1
          
  return lcm

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

print(lcm(a, b))


### FIXED CODE ###

def gcd(x, y):
  while(y):
    x, y = y, x % y
  return x

def lcm(x, y):
  lcm = (x*y) // gcd(x,y)
  return lcm

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

print(lcm(a, b))
### BUGGY CODE ###

# 引き出したいお金の額を入力する
N = int(input())

# 整数aの累乗のうち、整数N以下かつ最も大きいものを返す関数を定義
def func(N, a):
    index = 0
    while True:
        if a ** (index + 1) <= N:
            index += 1
        else:
            break
    return a ** index

# 引き出し回数を再帰的に求める関数を定義
def search_times_re(N):
    times = 0
    if N < 6:
        times = N
        return times
    elif N < 9:
        times = 1 + (N - 6)
        return times
    else:
        N1 = search_times_re(N - func(N, 6))
        N2 = search_times_re(N - func(N, 9))
        if N1 < N2:
            return 1 + N1
        else:
            return 1 + N2

print(search_times_re(N))

### FIXED CODE ###

N = int(input())
ans = N
for i in range(0, N + 1, 6):
    cnt = 0
    j = N - i
    while i > 0:
        cnt += i % 6
        i //= 6
    while j > 0:
        cnt += j % 9
        j //= 9
    ans = min(ans, cnt)
print(ans)
### BUGGY CODE ###

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

ans = 0

for i in range(n):
    sums = a[i:]
    for j in range(n - i - 1):
        sums[j + 1] = sums[j] + sums[j + 1]
    ans += sums.count(0)
        
print(ans)

### FIXED CODE ###

from collections import Counter

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

ans = 0

b = [0]
for i in range(n):
	b.append(b[i] + a[i])

c = Counter(b)

for value in c.values():
	ans += value * (value - 1) // 2
    
print(ans)
### BUGGY CODE ###

from sys import exit
import copy
# import numpy as np
from collections import deque

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

cnt = 0

a_sum = [0]
b_sum = [0]

a_sum.extend(a)
b_sum.extend(b)


for i in range(1, n+1):
    a_sum[i] += a_sum[i-1]

for i in range(1, m+1):
    b_sum[i] += b_sum[i-1]


for i in range(n+1):
    for j in range(m+1):
        if a_sum[i] + b_sum[j] <= k:
            pass
        else:
            if a_sum[i] + b_sum[j-1] <= k:
                cnt = max(cnt, i + j - 1)
            break
    else:
        if a_sum[i] + b_sum[j] <= k:
            cnt = max(cnt, i + j)
print(cnt)


### FIXED CODE ###

from sys import exit
import copy
# import numpy as np
from collections import deque

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

cnt = 0


a.insert(0, 0)
b.insert(0, 0)


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

for i in range(1, m+1):
    b[i] += b[i-1]

tmp = m
for i in range(n+1):
    for j in range(tmp, -1, -1):
        if a[i] + b[j] <= k:
            cnt = max(cnt, i + j)
            tmp = j
            break


print(cnt)