Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

def gcd(a, b):
    if b == 0:
        return a
    a1 = b
    b1 = a % b
    return gcd(a1, b1)

while True:
    n = int(input())
    if n == 0:
        break
    line = []
    for loop in range(n):
        x1, y1, x2, y2 = list(map(int, input().split()))
        # ax + by + c = 0
        a = y1 - y2
        b = x2 - x1
        c = -x1 * a - y1 * b
        line.append((a, b, c))
    m = {}
    for i in range(n):
        for j in range(i + 1, n):
            l1 = line[i]
            l2 = line[j]
            det = l1[0] * l2[1] - l1[1] * l2[0]
            deta = int(abs(det))
            if det == 0:
                continue
            x = l2[1] * l1[2] - l1[1] * l2[2]
            y = -l2[0] * l1[2] + l1[0] * l2[2]
            if x > -100 * deta and x < 100 * deta and y > -100 * deta and y < 100 * deta:
                ans += 1
                G = gcd(gcd(int(abs(x)), int(abs(y))), int(abs(det)))
                x //= G
                y //= G
                det //= G
                if det < 0:
                    x *= -1
                    y *= -1
                    det *= -1
                m[(x, y, det)] = 1
    print(1 + n + len(m))


### FIXED CODE ###

#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

def gcd(a, b):
    if b == 0:
        return a
    a1 = b
    b1 = a % b
    return gcd(a1, b1)

while True:
    n = int(input())
    if n == 0:
        break
    line = []
    for loop in range(n):
        x1, y1, x2, y2 = list(map(int, input().split()))
        # ax + by + c = 0
        a = y1 - y2
        b = x2 - x1
        c = -x1 * a - y1 * b
        line.append((a, b, c))
    ans = n + 1
    m = {}
    for i in range(n):
        for j in range(i + 1, n):
            l1 = line[i]
            l2 = line[j]
            det = l1[0] * l2[1] - l1[1] * l2[0]
            deta = int(abs(det))
            if det == 0:
                continue
            x = l2[1] * l1[2] - l1[1] * l2[2]
            y = -l2[0] * l1[2] + l1[0] * l2[2]
            if x > -100 * deta and x < 100 * deta and y > -100 * deta and y < 100 * deta:
                ans += 1
                G = gcd(gcd(int(abs(x)), int(abs(y))), int(abs(det)))
                x //= G
                y //= G
                det //= G
                if det < 0:
                    x *= -1
                    y *= -1
                    det *= -1
                if (x, y, det) in m:
                    m[(x, y, det)] += 1
                else:
                    m[(x, y, det)] = 1
    for p in m:
        S = 0
        cnt = 0
        while True:
            S += cnt
            if m[p] == S:
                ans -= cnt * (cnt - 1) // 2
                break
            cnt += 1
    print(ans)
n = int(input())
s =[int(input()) for i in range(n)]
s.sort()
s_sum =sum(s)
if s_sum % 10 != 0:
  print(s_sum)
i = 0
else:
  while True:
    if s[i] % 10 != 0:
      s[i] = 0
      break
    i += 1    
  print(s_sum)

### FIXED CODE ###

n = int(input())
s = [0]
for i in range(n):
  s.append(int(input()))
m=sum(s)
s.sort()
for x in s:
  if (m-x)%10!=0:
    print(m-x)
    exit()
print(0)
a=[int(input()) for i in range(6)]
if a[4]-a[0]>=a[5]:
  print'Yay!'
  else print ':('

### FIXED CODE ###

a=[int(input()) for i in range(6)]
b=a[4]-a[0]
if a[5]>=b:
    print('Yay!')
else:
    print(':(')
N = int(input())
S = input()
k = 1
for i in range(N - 1):
    while True:
        if S[i : i + k] in S[i + k :]:
            k += 1
        else:
            break
print(l)

### FIXED CODE ###

N = int(input())
S = input()
r = 1
ans = 0
for i in range(N):
    while True:
        if S.rfind(S[i : r + 1]) >= r + 1:
            r += 1
            ans = max(ans, r - i)
        else:
            break
print(ans)
from itertools import product

H, W = map(int, input().split())
L = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
S = [[str(_) for _ in input().split()] for _ in range(W)]

for i, j in product(range(H), range(W)):
    if S[i][j] == "snuke":
        break

res = L[i] + str(j+1)
print(res)

### FIXED CODE ###

from itertools import product

H, W = map(int, input().split())
L = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
S = [[str(_) for _ in input().split()] for _ in range(H)]

for i, j in product(range(H), range(W)):
    if S[i][j] == "snuke":
        break

res = L[j] + str(i+1)
print(res)
def CountingSort(A, B, k):
    C = [0 for i in range(k+2)]
    
    for j in range(n):
        C[A[j]] += 1
        
    for i in range(k+1):
        C[i] += C[i-1]
        
    for j in range(n-1, -1, -1):
        B[C[A[j]]-1] = A[j]
        C[A[j]] -= 1

if __name__=="__main__":
    n = int(input())
    D = list(map(int, input().split()))
    l = max(D)
    E = D[:]
    CountingSort(D, E, l)
    print(" ".join(map, str(E))))

### FIXED CODE ###

def CountingSort(A, B, k):
    C = [0 for i in range(k+2)]
    
    for j in range(n):
        C[A[j]] += 1
        
    for i in range(k+1):
        C[i] += C[i-1]
        
    for j in range(n-1, -1, -1):
        B[C[A[j]]-1] = A[j]
        C[A[j]] -= 1

if __name__=="__main__":
    n = int(input())
    D = list(map(int, input().split()))
    l = max(D)
    E = D[:]
    CountingSort(D, E, l)
    print(" ".join(map(str, E)))
def d_3n_numbers(N, A):
    import heapq

    def _heappush_max(heap, item):
        heap.append(item)
        heapq._siftdown_max(heap, 0, len(heap) - 1)
    setattr(heapq, '_heappush_max', _heappush_max)

    left = A[:N]
    heapq.heapify(left)
    right = A[2 * N:]
    heapq._heapify_max(right)
    left_sum, right_sum = [sum(left)], [sum(right)]

    # 同じ要素をleftとrightで取り合っても、相殺されるので問題ない
    for k in range(N, 2 * N):
        heapq.heappush(left, A[k])
        v = heapq.heappop(left)
        left_sum.append(left_sum[-1] + A[k] - v)
    for k in range(2 * N - 1, N - 1, -1):
        heapq._heappush_max(right, A[k])
        v = heapq._heappop_max(right)
        right_sum.append(right_sum[-1] + A[k] - v)
    right_sum = right_sum[::-1]

    ans_candidate = [a - b for a, b in zip(left_sum, right_sum)]
    return max(ans_candidate)

N = int(input())
A = [int(i) for i in input().split()]
print(d_3n_numbers(N, A))

### FIXED CODE ###

def d_3N_Numbers(N, A):
    import heapq
    left = A[:N]
    heapq.heapify(left)
    # heappopがキューの最小値を取り出す一方、rightからは最大値を取り出してほしいので、
    # -1を掛ける
    right = [-i for i in A[2 * N:]]
    heapq.heapify(right)
    left_sum = [sum(left)]
    right_sum = [-sum(right)]  # 定義で-1を付けた都合上

    # 同じ要素をleftとrightで取り合っても、相殺されるので問題ない
    for k in range(N, 2 * N):
        heapq.heappush(left, A[k])
        v = heapq.heappop(left)
        left_sum.append(left_sum[-1] + A[k] - v)
    for k in range(2 * N - 1, N - 1, -1):
        # -1をかけるのは、rightの定義の都合上
        heapq.heappush(right, -A[k])
        v = heapq.heappop(right)
        right_sum.append(right_sum[-1] + A[k] - (-v))
    right_sum = right_sum[::-1]
    ans = []
    for a, b in zip(left_sum, right_sum):
        ans.append(a - b)
    return max(ans)

N = int(input())
A = [int(i) for i in input().split()]
print(d_3N_Numbers(N, A))
import sys
input = sys.stdin.readline
H,W = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(H)]
B = [list(map(int,input().split())) for _ in range(H)]
D = [[abs(A[h][w]-B[h][w]) for w in range(W)] for h in range(H)]
dp = [[{} for _ in range(W)] for _ in range(H)]
dp[0][0][D[0][0]] = 0
for h in range(H):
    for w in range(W):
        for v in dp[h][w]:
            if w != W-1:
                v1 = v+D[h][w+1]
                v2 = v-D[h][w+1]
                if v1<0:
                    v1 *= -1
                if v2<0:
                    v2 *= -1
                dp[h][w+1][v1] = 0
                dp[h][w+1][v2] = 0
            if h != H-1:
                v1 = v+D[h+1][w]
                v2 = v-D[h+1][w]
                if v1<0:
                    v1 *= -1
                if v2<0:
                    v2 *= -1
                dp[h+1][w][v1] = 0
                dp[h+1][w][v2] = 0
ans = min(dp[H-1][W-1])
print(ans)

### FIXED CODE ###

from collections import defaultdict
N,X,D = map(int,input().split())
d = defaultdict(list)
if D<0:
    D *= -1
    X *= -1

if D != 0:
    for m in range(N+1):
        a = X*m+(m*(m-1)*D)//2
        b = X*m+(m*(2*N-m-1)*D)//2
        d[a%D].append([a,b])


    ans = 0
    for k in d:
        q = d[k]
        q.sort()
        l,r = q[0]
        for i in range(len(q)):
            a,b = q[i]
            if a<=r:
                r = max(r,b)
            else:
                ans += (r-l)//D+1
                l = a
                r = b
        ans += (r-l)//D+1

if D == 0:
    ans = N+1
    if X == 0:
        ans = 1
print(ans)
import math

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

div=[]
for i in range(1,min(A,B)+1):
  if A%i==0 and B%i==0:
    div.append(i)

div.pop(0)
ans=1
val=1
for i in range(len(div)):
  if math.gcd(val,div[i])==1:
    ans+=1
    val*=div[i]
print(ans)

### FIXED CODE ###

def gcd(a,b): # 最大公約数を求める
  while b:
    a,b=b,a%b
  return abs(a)
  
def solve(A:int, B:int):
  a=gcd(A,B)
  ap=a
  ct=0
  x=2
  if a%x==0:
    ct+=1
    while a%x==0:
      a=a//x
  
  x=3
  while x*x<ap+1:
    if a%x==0:
      ct+=1
      while a%x==0:
        a=a//x
    x+=2
  
  if a!=1:
    ct+=1
  print(ct+1)
  
  return

def main():
  A,B=map(int,input().split())
  solve(A,B)

if __name__=="__main__":
  main()
n = int(input())
s=[]
alp = [chr(i) for i in range(97, 97+26)]
word = []
while n > 0:
    s.append(n % 26)
    n = n // 26
for m in s:
    if m == 0:
        word.append("z")
    else:
        word.append(alp[m - 1])
word.reverse()
if word[0] == "a" and word[1] == "z":
    word.pop(0)
print("".join(word))

### FIXED CODE ###

from collections import deque
n = int(input())
st  = deque()
while n > 0:
    num = (n - 1) % 26
    n = (n - 1) // 26
    st.appendleft(chr(num + 97))
print(*st, sep = "")
while True :
    a,b=input().split()
    h =int(a)
    w=int(b)
    if a==0 and b==0:
        break
    for i in range(h):
        if i %2==0:
            print(".#"*(w/2))
            if w==1:
                print(".")
        elif h ==1 :
            print("#")
        else:
            print("#."*(w-1)/2))
            if w==1:
                print("#")

    print("")

### FIXED CODE ###

while True:
    a,b=input().split()
    h = int(a)
    w=int(b)
    if h==0 and w==0:
        break
    odd = "#."*300
    even= ".#"*300
    for i in range(h):
        if (i%2)==0:
            print(odd[:w])
        else:
            print(even[:w])
    print("")
N, L = (int(nl) for nl in input().split())
tastes = [L+i-1 for i in range(1, N+1)]
min_taste = 0
min_taste_abs = 100
for taste in tastes:
    if min_taste_abs > abs(taste):
        min_taste_abs = abs(taste)
        min_taste = taste

min_taste_index = tastes.index(min_taste)
if len(tastes) == min_taste_index+1:
    print(sum(tastes[:min_taste_index]))
else:
    print(sum(tastes[:min_taste_index]+tastes[min_taste_index+1:]))

### FIXED CODE ###

N, L = (int(nl) for nl in input().split())
tastes = [L+i-1 for i in range(1, N+1)]
min_taste = 100
min_taste_abs = 100
for taste in tastes:
    if min_taste_abs >= abs(taste):
        min_taste_abs = abs(taste)
        min_taste = taste

min_taste_index = tastes.index(min_taste)
if len(tastes) == min_taste_index+1:
    print(sum(tastes[:min_taste_index]))
else:
    print(sum(tastes[:min_taste_index]+tastes[min_taste_index+1:]))
n=int(input())
s=[[]for i in range(n+1)]
for i in range(n-1):
    a,b=map(int,input().split())
    s[a].append(b)
    s[b].append(a)
def f(a,b):
    c,flag,ans=[[a,[0,a]]],False,[]
    while c or flag=False:
        p,q=c.pop()
        for i in s[p]:
            if i==b:
                ans=q[1:]+[b]
                break
            else:
                if q[-2]!=i:
                    c.append([i,q+[i]])
    else:
        return ans
def f(x,l):
    c=0
    p,d=[x],[0]*(n+1)
    while p:
        a=p.pop()
        if a not in x or a==x:
            c+=1
            d[a]=1
            for i in s[a]:
                if d[i]==0:
                    p.append(i)
    else:
        return c
t=f(a,b)
t=[f(i,ans)for i in t]
print("Fennec"if sum(t[:-len(t)//2])>sum(t[-len(t)//2:]) else"Snuke")

### FIXED CODE ###

from heapq import *
n=int(input())
s=[[]for i in range(n+1)]
for i in range(n-1):
    a,b=map(int,input().split())
    s[a].append(b)
    s[b].append(a)
def f(a):
    p=[float("INF")for i in range(n+1)]
    p[a],q=0,[[0,a]]
    while q:
        i,j=heappop(q)
        for w in s[j]:
            if p[w]>i+1:
                p[w]=i+1
                heappush(q,[i+1,w])
    else:
        return p[1:]
s1,t1=f(1),f(n)
a,b=0,0
for i in range(n):
    if s1[i]<=t1[i]:
        a+=1
    else:
        b+=1
print("Fennec" if a>b else "Snuke")
dict={}
output=[]

iteration=read()
if(iteration.isdigit()):
    iteration=int(iteration)
else:
    iteration=int(float(iteration))
for _ in range(iteration):
    item=read()
    
    if dict.get(item) is None:
        dict[item]=0 
    dict[item]+=1 
max_val=max(dict.values())
while(bool(dict)):
    max_key=max(dict,key=dict.get)
    if(max_val!=dict[max_key]):
        break
    output.append(max_key)
    
    del dict[max_key]
output.sort()
print('\n'.join(output))


### FIXED CODE ###


from sys import stdin
def read():
    return stdin.readline().strip()

dict={}
output=[]

iteration=int(read())

max_val=-1

for _ in range(iteration):
    item=read()
    
    if dict.get(item) is None:
        dict[item]=0 
    dict[item]+=1 
    max_val = max(dict[item],max_val)
#max_val=max(dict.values())
for k,v in dict.items():
    
    if(max_val==v):
        output.append(k)
    
    
output.sort()
print('\n'.join(output))
import math
import copy

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

if N==2:
    print(max(A))
    exit()
else:
    max=0
    for i in range(N):
        x = copy.deepcopy(A)
        del x[i]
        c = math.gcd(x[0], x[1])
        for i in range(2,N-1):
            c = math.gcd(c,x[i])
        if c >= max:
            max = c
    print(max)

### FIXED CODE ###

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

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

AL=[0]*N
AR=[0]*N
for i in range(N):
    if i == 0:
        AL[0] = A[0]
        AR[0] = A[N-1]
    else:
        AL[i] = gcd(AL[i-1],A[i])
        AR[i] = gcd(AR[i-1],A[N-i-1])

max=0
for i in range(N):
    if i == 0:
        n_ex_gcd =  AR[N-2]
    elif i == N-1:
        n_ex_gcd = AL[N-2]
    else:
        n_ex_gcd = gcd(AL[i-1],AR[N-i-2])
    if n_ex_gcd > max:
        max = n_ex_gcd
print(max)
n, x = map(int, raw_input().split())

if x == n:
	print 'Yes':
	for i in range(1, 2 * n):
		print i
else:
	print 'No'

### FIXED CODE ###

n = input()
s = raw_input()
t = raw_input()



z = n + n
for i in range(0, n + 1):
	if s[-i:] == t[:i]:
		z = min(z, n + n - i)

print z
N=int(input())
H=[int(x) for x in input().split()]
cnt=1
tall=H[0]
for i in range(1,n):
    if tall<=H[i]:
        tall=H[i]
        cnt+=1
print(cnt)


### FIXED CODE ###

N=int(input())
H=[int(x) for x in input().split()]
cnt=1
tall=H[0]
for i in range(1,N):
    if tall<=H[i]:
        tall=H[i]
        cnt+=1
print(cnt)
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())
m1 == m2 if ans = 0 else ans = 1
print(ans)


### FIXED CODE ###

m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())
print(0 if m1 == m2 else 1)
a=int(input())
b=list(map(int,input().split()))
print(b)
c=1
for i in range(a):
  c=c*b[i]
if(c>1000000000000000000):
  print(-1)
else:
  print(c)

### FIXED CODE ###

a,b=map(int,input().split())
print(a*b)
h, w = [int(i) for i in input().split()]
_, _ = input()

print(h * w - (h + w - 1))

### FIXED CODE ###

h, w = [int(i) for i in input().split()]
h1, w1 = [int(i) for i in input().split()]
 
print(h * w - (h * w1 + w * h1 - h1 * w1))
n,k=map(int,input().split())
x=list(map(int,input().split()))
a=[x[i] for i in range(n) if x[i]<0]
b=[x[i] for i in range(n) if x[i]>=0]
na=len(a)
nb=len(b)
if b[0]==0:
    k-=1
ans=10**10
if na>=k and na!=0:
    ans=-a[-k]
if nb==0:
    print(-a[-k])
    exit()

for i in range(1,nb+1):
    m=k-i
    if m>na or m<0:
        continue
    elif 0<m<=na:
        ans=min(ans,min(b[i-1]-2*a[-m],2*b[i-1]-a[-m]))
    elif m==0:
        ans=min(ans,b[k-1])
print(ans if k!=0 else 0)

### FIXED CODE ###

n,k=map(int,input().split())
x=list(map(int,input().split()))
a=[x[i] for i in range(n) if x[i]<0]
b=[x[i] for i in range(n) if x[i]>=0]
na=len(a)
nb=len(b)
if 0 in x:
    k-=1
    b=[x[i] for i in range(n) if x[i]>0]
    nb=nb-1

if k==0:
    print(0)
    exit()
ans=10**10
if na>=k:
    ans=-a[-k]

if nb>=k:
    ans=min(ans,b[k-1])

if nb==0:
    print(-a[-k])
    exit()

if na==0:
    print(b[k-1])
    exit()

for i in range(1,nb+1):
    m=k-i
    if m>na or m<0:
        continue
    elif 0<m<=na:
        ans=min(ans,min(b[i-1]-2*a[-m],2*b[i-1]-a[-m]))
    elif m==0:
        ans=min(ans,b[k-1])
print(ans if k!=0 else 0)
if input() == "Sunny":
  print("Cloudy")
elif input() == "Cloudy":
  print("Rainy")
elif input() == "Rainy":
  print("Sunny")


### FIXED CODE ###

s = input()
if s == "Sunny":
  print("Cloudy")
elif s == "Cloudy":
  print("Rainy")
else:
  print("Sunny")
N = int,input().split()
A = list(map(int,input().split()))

A1 = sorted(A)
a = int(n/2)
for i in range(N):
    if A1[i] <= A1[a-1]:
        print(A1[a])
    else:
        print(A1[a-1])

### FIXED CODE ###

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

AB = sorted(A)
C = int(N//2)
for i in range(N):
    if A[i] <= AB[C-1]:
        print(AB[C])
    else:
        print(AB[C-1])
a = int(input())
b = int(input())
c = int(input())
x = int(input())
counts = 0
for A in range(a + 1):
    for B in range(b + 1):
        for C in range(c + 1):
            if (500 * a + 100 * b + 50 * c) == X:
                counts += 1
print(counts)

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
x = int(input())
counts = 0
for A in range(a + 1):
    for B in range(b + 1):
        for C in range(c + 1):
            if (500 * A + 100 * B + 50 * C) == x:
                counts += 1
print(counts)
n,m=map(int,input().split())
aru=1
a=[1]*n
ans=set()
for i in range(m):
  x,y=map(int,input().split())
  if a[x-1]==0:continue
  else:
    a[x-1]-=1
    a[y-1]+=1
    if aru==x:
      aru=y
      if a[x-1]!=0:
        ans.add(x)
      else:ans.remove(x)
print(len(ans))

### FIXED CODE ###

n,m=map(int,input().split())
a=[1]*n
ans=set([1])
for i in range(m):
  x,y=map(int,input().split())
  if a[x-1]==0:continue
  else:
    a[x-1]-=1
    a[y-1]+=1
    if x in ans:
      ans.add(y)
      if a[x-1]==0:ans.remove(x)
print(len(ans))
from fractions import gcd
from functools import reduce
import copy

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

fValueList = []
lValueList = []
maxList = []

if n == 2:
  print(gcd(a[0], a[1]))
else:
  fValueList.append(a[0])
  lValueList.append(a[n-1])
  for i in range(1,n-1):
    g = fValueList[i-1]
    fValueList.append(gcd(g, a[i]))

  for i in range(1,n-1):
    g = lValueList[i-1]
    lValueList.append(gcd(g, a[n-1-i]))
  
  maxList.append(fValueList[n-1])
  maxList.append(lValueList[n-1])
  for k in range(n-2):
    g = gcd(fValueList[k], lValueList[n-2-k])
    maxList.append(g)
    
  print(max(maxList))


### FIXED CODE ###

a, b, t = map(int,input().split())
print(t // a * b)
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # # mがlcmの半分よりも小さかったら0
        # if (a_lcm / 2) > m:
        #     print(0)
        #     exit()
    # mがlcmの半分よりも小さかったら0
    if (a_lcm / 2) > m:
        print(0)
        exit()
    for a in A:
        if a_lcm / 2 % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import copy
# from math import gcd


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

def lcm(a, b):
    return (a // gcd(a, b)) * b
def main():
    n, m = map(int, input().split())
    A = set([int(x) for x in input().split()])
    a_lcm = 1
    for a in A:
        a_lcm = lcm(a_lcm, a)
        # mがlcmの半分よりも小さかったら0
        if (a_lcm / 2) > m:
            print(0)
            exit()
    for a in A:
        if (a_lcm / 2) % a == 0:
            print(0)
            exit()
    # # あとは定数倍の数調べて終わり
    ans = int((m - (a_lcm / 2)) // a_lcm) + 1
    print(ans)

if __name__ == '__main__':
    main()
def getNumNeg(L):
    return sum([i<0 for i in L])

def findmax(L):
    numNeg = getNumNeg(L)
    if numNeg % 2 == 0: # end-point: all positive
         while getNumNeg(L) != 0:
            i = L.index(min(L[:-1]))
            j = i + 1
            L[i] = L[i] * (-1)
            L[j] = L[j] * (-1)
        print(sum(L))
    else: # end-point: smallest abs(number) is negative
        absL = list(map(abs, L))
        stop = min(absL)*(-1)
        while (getNumNeg(L) != 1) or (min(L) != stop):
            i = L.index(min(L[:-1]))
            j = i + 1
            L[i] = L[i] * (-1)
            L[j] = L[j] * (-1)
        print(sum(L))

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


### FIXED CODE ###

def getNumNeg(L):
  return sum([i<0 for i in L])
  
def findmax2(L):
  numNeg = getNumNeg(L)
  absL = list(map(abs, L))
  if numNeg % 2 == 0:
    print(sum(absL))
  else:
    print(sum(absL)-2*min(absL))
        
n = int(input())
a = list(map(int, input().split()))
findmax2(a)
N = int(input())
s = [sorted(input()) for _ in range(N)]
s_dict = {}
sum = 0
for i in range(N):
    if s[i] in s_dict.keys():
        s_dict(s[i]) += 1
        sum +=s_dict(s[i])
    else:
        s_dict(s[i]) = 1
print(sum)

### FIXED CODE ###

N = int(input())
s = [''.join(sorted(input())) for _ in range(N)]

s_dict ={}
ans = 0
for i in range(N) :
    if s[i] in s_dict.keys() :
        ans += s_dict[s[i]]
        s_dict[s[i]] += 1
    else :
        s_dict[s[i]] = 1
print(ans)
import sys
input = sys.stdin.readline
def print_ans(N):
    """Test Case
    >>> print_ans(11)
    9
    >>> print_ans(136)
    46
    >>> print_ans(100000)
    90909
    """
    # counter = 0
    # for i in range(1, N + 1):
    #     if len(str(i)) % 2 != 0:
    #         counter +=1
    # print(counter)
    length = len(str(N))
    ans = []

    for i in reversed(range(length - 1)):
        if i % 2 == 0:
            ans.append("9")
        else:
            ans.append("0")
    answer = int("".join(ans))
    if length % 2 != 0:
        answer += N % (10 ** (length -1)) + 1
    print(answer)


if __name__ == '__main__':
    N = int(input().rstrip())
    print_ans(N)


### FIXED CODE ###

import sys
input = sys.stdin.readline
def print_ans(N):
    """Test Case
    >>> print_ans(11)
    9
    >>> print_ans(136)
    46
    >>> print_ans(100000)
    90909
    """
    counter = 0
    for i in range(1, N + 1):
        if len(str(i)) % 2 != 0:
            counter +=1
    print(counter)

if __name__ == '__main__':
    N = int(input().rstrip())
    print_ans(N)
n = input()
for i in range(len(n)):
    if(n[i] == '1'):n[i] = '9'
    elif(n[i] == '9'):n[i] = '1'
print(n)

### FIXED CODE ###

n = list(input())
for i in range(len(n)):
    if(n[i] == '1'):n[i] = '9'
    elif(n[i] == '9'):n[i] = '1'
print(''.join(n))
lists = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(lists(k))

### FIXED CODE ###

lists = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k = int(input())
print(int(lists[k-1]))
n = int(input())
s = input()
print(max(len(s[:i]&s[i:]) for i in range(n)))

### FIXED CODE ###

N = int(input())
S = input()
max = 0
for i in range(1, N-1):
  X = set(S[0:i])
  Y = set(S[i:N])
  if max < len(X&Y):
    max = len(X&Y)
print(max)