Harryxun/stf_run huggingface dataset:
import numpy as np

n, m = map(int, input().split())
hlist = np.array(list(map(int, input().split()))).astype(np.int64)
ab = [list(map(int, input().split())) for _ in range(m)]
connect = np.zeros((n,n)).astype(np.int64)
for a, b in ab:
  connect[a-1, b-1] = 1
  connect[b-1, a-1] = 1
ans = 0
#for i in range(n):
#  if (connect[i] * hlist >= hlist[i]).sum() == 0:
#    ans += 1
#print(ans)

### FIXED CODE ###

n, m = map(int, input().split())
hlist = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]

maxh = [0]*n
for a, b in ab:
  maxh[a-1] = max(maxh[a-1], hlist[b-1])
  maxh[b-1] = max(maxh[b-1], hlist[a-1])
ans = 0
for i in range(n):
  if maxh[i] < hlist[i]:
    ans += 1
print(ans)
from math import sqrt

# ??????
def cross(P0, P1, P2):
    x0, y0 = P0; x1, y1 = P1; x2, y2 = P2
    x1 -= x0; x2 -= x0
    y1 -= y0; y2 -= y0
    return x1*y2 - x2*y1

# ??????
def dot(P0, P1, P2):
    x0, y0 = P0; x1, y1 = P1; x2, y2 = P2
    x1 -= x0; x2 -= x0
    y1 -= y0; y2 -= y0
    return x1*x2 + y1*y2

# 2??????????????¢?????????
def dist2(P0, P1):
    x0, y0 = P0; x1, y1 = P1
    return (x1 - x0)**2 + (y1 - y0)**2

# ??????
# ??\???????????????????????§?¨???????
def convex_hull(PS):
    QS = []
    n = len(PS)
    for P in PS:
        while len(QS)>1 and cross(QS[-1], QS[-2], P) > 0:
            QS.pop()
        QS.append(P)
    k = len(QS)
    RS = reversed(PS); next(RS)
    for P in RS:
        while len(QS)>k and cross(QS[-1], QS[-2], P) > 0:
            QS.pop()
        QS.append(P)
    return QS



# ?????£???????????? (?????????????¨????)
def cross4(S0, S1, T0, T1):
    x0, y0 = S0; x1, y1 = S1
    X0, Y0 = T0; X1, Y1 = T1
    return (x1-x0)*(Y1-Y0) - (y1-y0)*(X1-X0)
def calipers(PS):
    QS = convex_hull(PS)
    n = len(QS)
    if n == 2:
        return sqrt(dist2(*QS))
    i = j = 0
    for k in range(n):
        if QS[k] < QS[i]: i = k
        if QS[j] < QS[k]: j = k
    res = 0
    si = i; sj = j
    while i != sj or j != si:
        res = max(res, dist2(QS[i], QS[j]))
        if cross4(QS[i], QS[i-n+1], QS[j], QS[j-n+1]) < 0:
            i = (i + 1) % n
        else:
            j = (j + 1) % n
    return sqrt(res)

n = int(input())
PS = [[*map(float, input().split())] for i in range(n)]
PS.sort()
print("%.09f" % calipers(PS))

### FIXED CODE ###

from math import sqrt

def cross(P0, P1, P2):
    x0, y0 = P0; x1, y1 = P1; x2, y2 = P2
    x1 -= x0; x2 -= x0
    y1 -= y0; y2 -= y0
    return x1*y2 - x2*y1

def dot(P0, P1, P2):
    x0, y0 = P0; x1, y1 = P1; x2, y2 = P2
    x1 -= x0; x2 -= x0
    y1 -= y0; y2 -= y0
    return x1*x2 + y1*y2

def dist2(P0, P1):
    x0, y0 = P0; x1, y1 = P1
    return (x1 - x0)**2 + (y1 - y0)**2

def convex_hull(PS):
    QS = []
    n = len(PS)
    if n==1:
        return PS[:]
    for P in PS:
        while len(QS)>1 and cross(QS[-1], QS[-2], P) > 0:
            QS.pop()
        QS.append(P)
    k = len(QS)
    RS = reversed(PS); next(RS)
    for P in RS:
        while len(QS)>k and cross(QS[-1], QS[-2], P) > 0:
            QS.pop()
        QS.append(P)
    return QS

def cross4(S0, S1, T0, T1):
    x0, y0 = S0; x1, y1 = S1
    X0, Y0 = T0; X1, Y1 = T1
    return (x1-x0)*(Y1-Y0) - (y1-y0)*(X1-X0)
def calipers(PS):
    QS = convex_hull(PS)
    n = len(QS)
    if n == 2:
        return sqrt(dist2(*QS))
    i = j = 0
    for k in range(n):
        if QS[k] < QS[i]: i = k
        if QS[j] < QS[k]: j = k
    res = 0
    si = i; sj = j
    while i != sj or j != si:
        res = max(res, dist2(QS[i], QS[j]))
        if cross4(QS[i], QS[i-n+1], QS[j], QS[j-n+1]) < 0:
            i = (i + 1) % n
        else:
            j = (j + 1) % n
    return sqrt(res)

n = input()
PS = [map(float, raw_input().split()) for i in range(n)]
PS.sort()
print("%.09f" % calipers(PS))
import sys
n = int(input())

if n%7 != 0 and n%4 != 0 and n%11 != 0:
    for a in range(25):
        for b in range(14):
            if n%(7*b + 4*a) == 0:
                print('No')
                sys.exit()
else:
    print('No')
    sys.exit()
print('Yes')

### FIXED CODE ###

import sys
n = int(input())

if n%7 != 0 and n%4 != 0 and n%11 != 0:
    for a in range(1, 25):
        for b in range(1, 14):
            if n%(7*b + 4*a) == 0:
                print('Yes')
                sys.exit()
else:
    print('Yes')
    sys.exit()
print('No')
from collections import deque
H,W,K = list(map(int, input().split()))
A = [[0] * W for _ in range(H)]
n = 1
P = []
B = []
for i in range(H):
    B.append(input())

for i in range(H):
    for j in range(W):
        if B[i][j] == "#":
            A[i][j] = n
            n += 1
            P.append([i,j])
def change(A,x,y,z):
    if y-1 >= 0:
        if A[x][y-1] == 0:
            A[x][y-1] = z
            change(A,x,y-1,z)
    if y + 1 <= (W-1):
        if A[x][y+1] == 0:
            A[x][y+1] = z
            change(A,x,y+1,z)
for i in P:
    change(A,i[0],i[1],A[i[0]][i[1]])
next_ = []
next_ = deque(next_)
for k in range(H):
    if 0 in A[k]:
        next_.append(k)
while len(next_) > 0:
    l = next_.popleft()
    if l == H-1:
        A[l] = A[l-1]
        if 0 in A[l]:
            next_.append(next_.popleft())
    else:
        A[l] = A[l+1]
        if 0 in A[l]:
            next_.append(next_.popleft())
for w in range(H):
    print(*A[w])

### FIXED CODE ###

from collections import deque
H,W,K = list(map(int, input().split()))
A = [[0] * W for _ in range(H)]
n = 1
P = []
B = []
for i in range(H):
    B.append(input())

for i in range(H):
    for j in range(W):
        if B[i][j] == "#":
            A[i][j] = n
            n += 1
            P.append([i,j])
def change(A,x,y,z):
    if y-1 >= 0:
        if A[x][y-1] == 0:
            A[x][y-1] = z
            change(A,x,y-1,z)
    if y + 1 <= (W-1):
        if A[x][y+1] == 0:
            A[x][y+1] = z
            change(A,x,y+1,z)
for i in P:
    change(A,i[0],i[1],A[i[0]][i[1]])
next_ = []
next_ = deque(next_)
for k in range(H):
    if 0 in A[k]:
        next_.append(k)
while len(next_) > 0:
    l = next_.popleft()
    if l == H-1:
        A[l] = A[l-1]
        if 0 in A[l]:
            next_.append(l)
    elif l == 0:
        A[l] = A[l+1]
        if 0 in A[l]:
            next_.append(l)
    else:
        if l+1 in next_ and l - 1 in next_:
            next_.append(l)
        elif l + 1 not in next_:
            A[l] = A[l + 1]
        else:
            A[l] = A[l - 1]
for w in range(H):
    print(*A[w])
import heapq
import numpy as np 
n=int(input())
l=[list(map(int,input().split())) for i in range(n)]
for i in range(n):
    l[i][0],l[i][1]=-l[i][0],-l[i][1]
heapq.heapify(l)
ans=0
for i in range(n):
    ans-=l[0][0]*((-1)**i)
    minimum=heapq.heappop(l)
    for j in range(n-i-1):
        l[j][0],l[j][1]=l[j][1],l[j][0]
    #print(l)
print(ans)



### FIXED CODE ###

n=int(input())
l=[]
c=0
for i in range(n):
    a,b=map(int,input().split())
    c-=b
    l.append(a+b)
l.sort()
l=l[::-1]
for i in range(0,n,2):
    c+=l[i]
print(c)
N = int(input())
x = list(input())[::-1]

num = 0
pop_num = 0
for i in range(N):
    if x[i] == "1":
        num += 2 ** i
        pop_num += 1

def popcnt(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c

def calc(i,depth,n):
    if depth == 0:
        if x[N-i] == "1":
            tmp = (num - 2 ** (N - i)) % (pop_num - 1)
            return calc(i,depth+1,tmp)
        else:
            tmp = (num + 2 ** (N - i)) % (pop_num + 1)
            return calc(i,depth+1,tmp)
    else:
        if n == 0: return depth
        return calc(i,depth+1, n % popcnt(n))
        

for i in range(1,1+N):
    print(calc(i,0,0))



### FIXED CODE ###

N = int(input())
x = list(input())[::-1]
num = 0
nump = 0
numm = 0
pop_num = 0
for i in range(N):
        if x[i] == "1":
            pop_num += 1
for i in range(N):
    if x[i] == "1":
        num += pow(2,i,pop_num)
        num %= pop_num 
        nump += pow(2,i,pop_num+1)
        nump %= pop_num  + 1
        if pop_num-1 != 0:
            numm += pow(2,i,pop_num - 1)
            numm %= pop_num - 1



def popcnt(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c

x = x[::-1]
def calc(i,depth,n):
    if depth == 0:
        if x[i] == "1":
            tmp = numm
            if pop_num - 1 != 0:
                tmp -= pow(2,N-i-1,pop_num-1)
                tmp %= (pop_num - 1)
            else:
                return 0
            return calc(i,depth+1,tmp)
        else:
            tmp = nump
            tmp += pow(2,N-i-1,pop_num+1)
            tmp %= (pop_num + 1)
            return calc(i,depth+1,tmp)
    else:
        if n == 0: return depth
        return calc(i,depth+1, n % popcnt(n))
        

for i in range(N):
    print(calc(i,0,0))
H,W = map(int, input().split())
a = []
for_at = []
at = []
for i in range(H):
  new_a = str(input())
  for_at.append(list(new_a))
  a.append(new_a)

for i in range(W):
  ai = ''
  for j in range(H):
    ai = ai+for_at[j][i]
  at.append(ai)
tate=0
yoko=0
max_len = '.'*W
max_j = -1
for i in range(W):
  max_len = '.'*(W-i)
  for j in range(H):
    if max_len in a[j]:
      max_j = j
      tate=W-i
      break
  if max_j != -1:
    break


max_len = '.'*W
max_j = -1
for i in range(W):
  max_len = '.'*(W-i)
  for j in range(H):
    if max_len in at[j]:
      max_j = j
      yoko=W-i
      break
  if max_j != -1:
    break
print(tate+yoko-1)

### FIXED CODE ###

a=[int(x) for x in input().split()]
min_h = min([a[0]+a[1],a[1]+a[2],a[2]+a[0]])

print(min_h)
table = [0] * 4*3*10

n = int(input())

for i in range(n)
    b,f,r,v = map(int, input().split())
    table[30(b-1)+10(f-1)+(r-1)] += v

for i in range(120)
    if i % 30:
        print("####################")
    print(table[i], end="")
    if i%10 ==9:
        print()
    else:
        print(" ", end="")



### FIXED CODE ###

#
# 6c
#


def main():
    A = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
    n = int(input())
    for i in range(n):
        b, f, r, v = map(int, input().split())
        A[b-1][f-1][r-1] += v
    for i in range(4):
        for j in range(3):
            print(" ", end="")
            print(*A[i][j])
        if i < 3:
            print("#" * 20)


if __name__ == '__main__':
    main()
H,W= map(int,input().split())
mine = [list(input()) for i in range(H)]

def count(ch):
  return 1 if ch == '#' else 0

for i in range(H):
  for j in range(W):
    num = 0
    if mine[i][j] == '#':
      continue
    else:
      for k in range(-1,2):
        for l in range(-1,2):
          num += (1 if mine[i+k][j+l]=='#' else 0) 
      mine[i][j] = num
      
for i in range(1,H+1):
  for j in range(1,W+1):
    print(mine[i][j],end='')
  print()



### FIXED CODE ###

H,W= map(int,input().split())
emp_H= [['.']*(W+2)]
mine = [['.']+list(input())+ ['.'] for i in range(H)]
mine = emp_H + mine + emp_H

def count(ch):
  return 1 if ch == '#' else 0

for i in range(1,H+1):
  for j in range(1,W+1):
    if mine[i][j] == '#':
      continue
    else:
      mine[i][j] = count(mine[i-1][j-1])+count(mine[i][j-1])+count(mine[i+1][j-1])+count(mine[i-1][j])+count(mine[i][j])+count(mine[i+1][j])+count(mine[i-1][j+1])+count(mine[i][j+1])+count(mine[i+1][j+1])
for i in range(1,H+1):
  for j in range(1,W+1):
    print(mine[i][j],end='')
  print()
N = int(input())
t = [[]for i in range(N+1)]
for i in range(N-1):
    a,b,c = map(int,input().split())
    t[a].append([b,c])
    t[b].append([a,c])
Q,K = map(int,input().split())
#p is parent
#pcd is parent-child distance
d = [0 for i in range(N+1)]
def f(v,p,pcd):
    global t,d
    d[v] = pcd
    for c in t[v]:
        if c[0]!=p:
            f(c[0],v,pcd+c[1])
f(K,0,0)
for i in range(Q):
    x,y = map(int,input().split())
    print(d[x]+d[y])


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)
N = int(input())
T = [[]for i in range(N+1)]
for i in range(N-1):
    a,b,c = map(int,input().split())
    T[a].append((b,c))
    T[b].append((a,c))
Q,K = map(int,input().split())
D = [0]*(N+1)
def f(v,p,cost):
    global T,K,D
    for C in T[v]:
        if C[0]!=p:
            D[C[0]] = cost+C[1]
            f(C[0],v,cost+C[1])
f(K,0,0)
for i in range(Q):
    x,y = map(int,input().split())
    print(D[x]+D[y])
dp = [0 for i in range(100)]
dp[6] = 1
dp[3] = 1
for i in range(100):
  if i>=4 and dp[i-4]==1:
    dp[i] = 1
  if i>=7 and dp[i-7]==1:
    dp[i] = 1
if dp(int(input())-1)==1:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

dp = [0 for i in range(100)]
dp[6] = 1
dp[3] = 1
for i in range(100):
  if i>=4 and dp[i-4]==1:
    dp[i] = 1
  if i>=7 and dp[i-7]==1:
    dp[i] = 1
if dp[int(input())-1]==1:
  print("Yes")
else:
  print("No")
for c in input():
    if c.islower():
        s += c.upper()
    elif c.isupper():
        s += c.lower()
    else:
        s += c
print (s)

### FIXED CODE ###

print(input().swapcase())
from fractions import gcd
N = int(input())
a = int(input())
for i in range(N-1):
    b = int(input())
    c = a * b / gcd(a, b)
    a = b
    b = c
print(int(c))


### FIXED CODE ###

from fractions import gcd
from functools import reduce

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))
def lcm_base(x, y):
    return(x*y)//gcd(x,y)
def lcm(numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm(T))
a,b,k=map(int,input().split())
tar=[1]
r=min(a,b)
for i in range(2,r):
    if a%i==0 & b%i==0:
        tar.append(i)
print(tar[-k])

### FIXED CODE ###

a,b,k=map(int,input().split())
tar=[1]
r=min(a,b)
for i in range(2,r+1):
    if a%i==0 and b%i==0:
        tar.append(i)
print(tar[-k])
def is_kaibunn(str): return 1 if str == str[::-1] else 0
word_front = input()
flag = 0
num = len(word)
word_back = word_front
while num > 1:
    if is_kaibunn(word_front) and is_kaibunn(word_back):
        flag = 1
    else:
        flag = 0
        break;
    
    if num%2 == 1:
        num_flag = 1
    else:
        num_flag = 0
    num = int(num/2)
    if num_flag == 1:
        word_front = word_front[0:num]
        word_back = word_back[num+1:]
    else:
        word_front = word_front[0:num]
        word_back = word_back[num:]       
if flag:
    print('Yes')
else:
    print('No')


### FIXED CODE ###


def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

even,odd = map(int,input().split())
if even != 1 or odd != 1:
    numa = cmb(even,2)
    numb = cmb(odd,2)
    if even == 1 or even == 0:
        numa = 0
    if odd == 1 or odd == 0:
        numb = 0
    print(numa+numb)
else:
    print(0)
K,S = map(int,input().split())

ans=[1 for x in (K+1) for y in (K+1) if K-x-y <= K]

print(len(ans))

### FIXED CODE ###

K,S = map(int,input().split())

ans=[1 for x in range(K+1) for y in range(K+1) if 0<=S-x-y <= K]

print(len(ans))
s=input()

ans="No"
if len(s)%2==0:
  if s=="hi"*(len(s)//2):
    ans="Yes"

print(ans

### FIXED CODE ###

s=input()
 
ans="No"
if len(s)%2==0:
  if s=="hi"*(len(s)//2):
    ans="Yes"

print(ans)
a,b,c = map(int,input().split())
print(b+c-a,0)[b+c-a<=0:]

### FIXED CODE ###

a,b,c = map(int,input().split())
print(max(0,b+c-a))
# inputList = list(map(int, '''6
# 5 2 4 6 1 3'''.split()))
# N = inputList.pop(0)

N = input()

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

def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i],end=' ')
        else:
            print(nums[i])


def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]

            j-=1
        A[j+1] = v
        formatting(A)

formatting(inputList)
insertionSort(inputList, N)



### FIXED CODE ###

# inputList = list(map(int, '''6
# 5 2 4 6 1 3'''.split()))
# N = inputList.pop(0)


def formatting(nums):
    for i in range(len(nums)):
        if i != len(nums) - 1:
            print(nums[i], end=' ')
        else:
            print(nums[i])


def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]

            j-=1
        A[j+1] = v
        formatting(A)


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

formatting(inputList)
insertionSort(inputList, N)
def foo (s):
    ans = 0
    count = 0
    for i in s:
        if i == 'W':
            count += 1
    elif count :
        count -= 1
        ans += 1
    else:
        pass
    return ans
  
  n = input()
s = input()
 
print(foo(s))

### FIXED CODE ###

def foo (s):
	ans = 0
	count = 0
	for i in s:
		if   (not count) and (i == 'E'):pass
		elif not count: count += 1
		elif i == 'E': count -= 1; ans += 1
		else: count += 1
	return ans

n = input()
s = input()

print(foo(s))
from collections import Counter

c = Counter([*input()])
if len(c) <= 2:
    print("NO")
else:
    dif = c.most_common()[0][1] - c.most_common()[2][1]
    print("YES" if dif<=1 else "NO")

### FIXED CODE ###

from collections import Counter

S = [i for i in input()]
c = Counter(S)
if len(c) == 1:
    if len(S) == 1:
        print("YES")
    else:
        print("NO")
elif len(c) == 2:
    if len(S) == 2:
        print("YES")
    else:
        print("NO")
else:
    dif = c.most_common()[0][1] - c.most_common()[2][1]
    print("YES" if dif<=1 else "NO")
N = int(input())
edge = [[] for _ in range(N+1)]
for _ in range(N-1):
    a,b,c = map(int,input().split())
    edge[a].append((b,c))
    edge[b].append((a,c))
Q,K = map(int,input().split())
distance = [None] * (N+1)
def dfs(v1,d):
    distance[v1] = d
    for v2,dd in edge[v1]:
        if distance[v2] is not None:
            continue
        dfs(v2,d+dd)

dfs(K,0)

ans = [0] * Q
for i in range(Q):
    x,y = map(int,input().split())
    ans[i] = distance[x]+distance[y]
for a in ans:
    print(a)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
N = int(input())
edge = [[] for _ in range(N+1)]
for _ in range(N-1):
    a,b,c = map(int,input().split())
    edge[a].append((b,c))
    edge[b].append((a,c))
Q,K = map(int,input().split())
distance = [None] * (N+1)
def dfs(v1,d):
    distance[v1] = d
    for v2,dd in edge[v1]:
        if distance[v2] is not None:
            continue
        dfs(v2,d+dd)

dfs(K,0)

ans = [0] * Q
for i in range(Q):
    x,y = map(int,input().split())
    ans[i] = distance[x]+distance[y]
for a in ans:
    print(a)
n=int(input())
v=list(map(int,input().split()))
v0=[]
v1=[]
m=int(n/2)
for i in range(m):
    v0.append(v[i*2])
    v1.append(v[i*2+1])
v0.sort()
v1.sort()
mv0=[0,0]
mv1=[0,0]
jmv0=[0,0]
jmv1=[0,0]
c0=[0,0]
c1=[0,0]
for i in range(m):
    if c0[0]==v0[i]:
        c0[1]+=1
    else:
        if mv0[1]<=c0[1]:
            jmv0=mv0
            mv0=c0
        elif jmv0<=c0[1]:
            jmv0=c0
        c0=[v0[i],1]

    if c1[0]==v1[i]:
        c1[1]+=1
    else:
        if mv1[1]<=c1[1]:
            jmv1=mv1
            mv1=c1
        elif jmv1<=c1[1]:
            jmv1=c1
        c1=[v1[i],1]

if mv0[1]<=c0[1]:
            jmv0=mv0
            mv0=c0
elif jmv0<=c0[1]:
            jmv0=c0

if mv1[1]<=c1[1]:
            jmv1=mv1
            mv1=c1
elif jmv1<=c1[1]:
            jmv1=c1

if mv0[0]!=mv1[0]:
    print(n-mv0[1]-mv1[1])
else:
    print(min(n-mv0[1]-jmv1[1],n-jmv0[1]-mv1[1]))

### FIXED CODE ###

n=int(input())
v=list(map(int,input().split()))
v0=[]
v1=[]
m=int(n/2)
for i in range(m):
    v0.append(v[i*2])
    v1.append(v[i*2+1])
v0.sort()
v1.sort()
mv0=[0,0]
mv1=[0,0]
jmv0=[0,0]
jmv1=[0,0]
c0=[0,0]
c1=[0,0]
for i in range(m):
    if c0[0]==v0[i]:
        c0[1]+=1
    else:
        if mv0[1]<=c0[1]:
            jmv0=mv0
            mv0=c0
        elif jmv0[1]<=c0[1]:
            jmv0=c0
        c0=[v0[i],1]

    if c1[0]==v1[i]:
        c1[1]+=1
    else:
        if mv1[1]<=c1[1]:
            jmv1=mv1
            mv1=c1
        elif jmv1[1]<=c1[1]:
            jmv1=c1
        c1=[v1[i],1]

if mv0[1]<=c0[1]:
            jmv0=mv0
            mv0=c0
elif jmv0[1]<=c0[1]:
            jmv0=c0

if mv1[1]<=c1[1]:
            jmv1=mv1
            mv1=c1
elif jmv1[1]<=c1[1]:
            jmv1=c1

if mv0[0]!=mv1[0]:
    print(n-mv0[1]-mv1[1])
else:
    print(min(n-mv0[1]-jmv1[1],n-jmv0[1]-mv1[1]))
S = input()
list_num = S.split(' ')
list_num = map(int, list_num)
N, A, B = list_num[0], list_num[1], list_num[2]

if A+B>N:
  print(N-A-B)
elif A+B=N:
  print(A)

### FIXED CODE ###

N,A,B= input().split()
if int(N)%(int(A)+int(B))>=int(A):
    ans=int(N)//(int(A)+int(B))*int(A)+int(A)
    print(ans)
else:
    ans=int(N)//(int(A)+int(B))*int(A)+int(N)%(int(A)+int(B))
    print(ans)
# https://atcoder.jp/contests/abc081/tasks/abc081_b

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


# リスト内の要素に奇数が含まれているかどうかを判断する
# 戻り値：Boolean
def judge_hasOdd(A):
    hasOdd = False
    for a in A:
        if a % 2 == 0:
            continue
        else:
            hasOdd = True
            break
    return hasOdd


# リスト内の全要素を２で割る
# リスト内に奇数が現れるまで上記操作を繰り返す
count = 0
while True:
    if judge_hasOdd(A) == False:
        A = list(map(lambda x: x/2, A))
        count += 1
            break
    else:
        break

print(count)



### FIXED CODE ###

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


def judge_hasOdd(A):
    hasOdd = False
    for a in A:
        if a % 2 == 0:
            continue
        else:
            hasOdd = True
            break
    return hasOdd


count = 0
while True:
    if judge_hasOdd(A) == False:
        A = list(map(lambda x: x/2, A))
        count += 1
    else:
        break

print(count)
k,s = map(int, input().split())

l = 0

if s <= k:
  l = int((k+2)(k+1)/2)
else:
  for x in range(0,k+1):
    if s-x > 2*k:
      l += 0
    elif k < s-x <= 2*k:
      l += 2*k - s + x + 1
    elif s-x <= k:
      l += s-x+1      
print(l)


### FIXED CODE ###

k,s = map(int, input().split())

l = 0

if s <= k:
  l = int((s+2)*(s+1)/2)
else:
  for x in range(0,k+1):
    if s-x > 2*k:
      l += 0
    elif k < s-x <= 2*k:
      l += 2*k - s + x + 1
    elif s-x <= k:
      l += s-x+1      
print(l)
# -*- coding: utf-8 -*-
"""
Created on Fri Apr  5 14:11:52 2019

@author: adachi-lab
"""

input_code = str(input('入力;'))
L1 = len(input_code)

list_3 = []
for w in range(L1):
    list_3.append(w)


x = 0
for i in range(L1):
    code = input_code[i]
    if code == 'A' or code == 'C' or code == 'G' or code == 'T':
        list_3.remove(x)
    
    x+=1

L3 = len(list_3)
list_4 = []

if list_3[0] == 0:
    for q in range(L3-1):
        list_4.append(list_3[q+1]-list_3[q]-1)
    list_4.append(L1-list_3[L3-1]-1)
    print(list_4)
    
else:
    list_3.insert(0,0)
    list_4.append(list_3[1])
    for q in range(L3):
        list_4.append(list_3[q+1]-list_3[q]-1)
    list_4.append(L1-list_3[L3]-1)
    list_4.pop(1)
    print(list_4)
    


print(max(list_4))

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Fri Apr  5 16:48:09 2019

@author: adachi-lab
"""

input_code = input()
L1 = len(input_code)
list_3 = []
list_4 = []
list_5 = []

for w in range(L1):
    list_3.append(0)
    list_4.append(0)


for i in range(L1):
    code = input_code[i]
    if code == 'A' or code == 'C' or code == 'G' or code == 'T':
        list_3[i] = 1
        
c = 0

for n,m in zip(list_3,list_4):
    
    if n == m:
        c = 0
        list_5.append(c)
        
    else:
        c += 1
        list_5.append(c)
        
print(max(list_5))