Harryxun/stf_run huggingface dataset:
import sys

def get_bit_order(b):
  bo = format(b, 'b')
  return len(bo) - 1


def dp(A, N, K, start):
  ans = 0
  K_order = get_bit_order(K)
  S = 1 << (K_order - start)
  for b in range(40, -1, -1):
    power = 1 << b
    bit_count = sum([a & power != 0 for a in A])
    
    if (power <= S) and (N - bit_count >  bit_count):
      opt_count = N - bit_count
      S -= power
    else:
      opt_count = bit_count
    
    ans += power * opt_count
  return ans


def main():
  input = sys.stdin.readline
  N, K = map(int, input().split())
  A = [int(a) for a in input().split()]
  
  dp_from_1st_Kbit = dp(A, N, K, 0)
  dp_from_2nd_Kbit = dp(A, N, K, 1)

  ans = max(dp_from_1st_Kbit, dp_from_2nd_Kbit)
  print(ans)


if __name__ == '__main__':
  main()

### FIXED CODE ###

import sys

def get_k_order(k):
  kb = format(k, 'b')
  return len(kb) - 1


def dp(A, N, K, start):
  ans = 0
  S = 1 << start
  for b in range(40, -1, -1):
    power = 1 << b
    bit_count = sum([a & power != 0 for a in A])
    
    if (power <= S) and (power <= K) and (N - bit_count >  bit_count):
      opt_count = N - bit_count
      K -= power
    else:
      opt_count = bit_count
    
    ans += power * opt_count
  return ans


def main():
  input = sys.stdin.readline
  N, K = map(int, input().split())
  A = [int(a) for a in input().split()]
  ko = get_k_order(K)
  
  dp_from_1st_order = dp(A, N, K, ko)
  if ko > 0:
    dp_from_2nd_order = dp(A, N, K, ko-1)
  else:
    dp_from_2nd_order = 0
  ans = max(dp_from_1st_order, dp_from_2nd_order)
  print(ans)


if __name__ == '__main__':
  main()
def main():
    N = int(input().strip())
    res = int(input().strip())
    if N == 1:
        print(res)
        return
    for _ in range(1, N):
        t = int(input().strip())
        res = lcm(res, t)
    print(res)


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


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

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N = int(input().strip())
    res = int(input().strip())
    if N == 1:
        print(res)
        return
    for _ in range(1, N):
        t = int(input().strip())
        res = lcm(res, t)
    print(res)


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


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

if __name__ == '__main__':
    main()
a=[]
for i in range(5):
  a.append(int(input()))
bs=[]
cs=[]
for i in range(5):
    if a[i]%10!=0:
        b=int(a[i]/10)*10+10
        c=str(a[i])[-1]
        cs.append(int(c))
    else:
        b=a[i]
    bs.append(b)
print(sum(bs)+min(cs)-10)

### FIXED CODE ###

a=[]
for i in range(5):
  a.append(int(input()))
bs=[]
cs=[]
cnt=0
for i in range(5):
    if a[i]%10!=0:
        b=int(a[i]/10)*10+10
        c=str(a[i])[-1]
        cs.append(int(c))
    else:
        b=a[i]
        cnt+=1
    bs.append(b)
if cnt==5:
  	print(sum(a))
else:
	print(sum(bs)+min(cs)-10)
N = int(input())
S = input()

cnt = 0
for i in range(N):
    if S[i] == 'A':
        if S[i+1] == 'B':
            if S[i+2] == 'C':
                cnt += 1

print(cnt)

### FIXED CODE ###

N = int(input())
S = input()
 
cnt = 0
for i in range(N-2):
    if S[i] == 'A':
        if S[i+1] == 'B':
            if S[i+2] == 'C':
                cnt += 1
 
print(cnt)
A,B,C,D = map(int, input().split())
if D<A or B<C: print("0")
else if D-A < B-C: print(D-A)
else: print(B-C)

### FIXED CODE ###

N = input()
if N[0] == N[2]: print("Yes")
else: print("No")
n = int(input())
if n % 2 == 0:
  return 1/2
else:
  return (n/2 + 0.5)/n


### FIXED CODE ###

n = int(input())
if n % 2 == 0:
  print(1/2)
else:
  print((n/2 + 0.5)/n)
import sys

X, N = map(int, input().split())
if N == 0:
    print(X)
    sys.exit()
p = list(map(int, input().split()))

comp = 101

for i in range(1, 101):
    x = abs(X - i)
    if x == comp:
        sys.exit()
    if comp > x and i not in p and:
        comp = x
        result = i

print(result)

### FIXED CODE ###

import sys

X, N = map(int, input().split())
p = list(map(int, input().split()))

if N == 0:
    print(X)
    sys.exit()

comp = 101
for i in range(102):
    x = abs(X - i)
    if comp > x and i not in p:
        comp = x
        result = i

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

A_set=set(A)
A_lst=list(A_set)

# すべてが0のとき
if sum(A_set)==0:
    print('Yes')
    exit()

# x…2N/3,0…N/3
if 0 in A_set and A_set.count(sum(A_set)//2)==2 and len(A)%3==0:
    print('Yes')
    exit()

# x^y^z==0
if A_lst[0]^A_lst[1]^A_lst[2]==0 and len(A)%3==0:
    print('Yes')
    exit()

# それ以外
print('No')

### FIXED CODE ###

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

A_set=set(A)
A_lst=list(A_set)

# すべてが0のとき
if sum(A_set)==0 and len(A_set)==1:
    print('Yes')
    exit()

# x…2N/3,0…N/3
if len(A_set)==2 and A_lst.count(0)==1 and len(A)%3==0:
    cnt=0
    for i in range(N):
        if A[i]==0:
            cnt+=1
    if cnt==N//3:
        print('Yes')
    else:
        print('No')
    exit()

# x^y^z==0
if len(A_set)==3 and A_lst[0]^A_lst[1]^A_lst[2]==0 and len(A)%3==0:
    cnt_x,cnt_y,cnt_z=0,0,0
    x,y,z=A_lst[0],A_lst[1],A_lst[2]
    for i in range(N):
        if A[i]==x:
            cnt_x+=1
            continue
        if A[i]==y:
            cnt_y+=1
            continue
        if A[i]==z:
            cnt_z+=1
    if cnt_x==cnt_y==cnt_z:
        print('Yes')
    else:
        print('No')
    exit()

# それ以外
print('No')
k, x = map(int, input().split())

axis = list(range(-10, 11, 1))
df = pd.DataFrame(axis)
df = df.rename(columns = {0 : 'var'})

res = []

if k == 1:
    print(x)
else:
    for i in range(1, k):

        a = df[df['var'] == x + i]
        a = list(a['var'])
        res.append(a)
        
        a = df[df['var'] == x - i]
        a = list(a['var'])
        res.append(a)
    res.append([x])
    res = sum(res, []) #リスト一段解除
    res = sorted(res) #並び替え
    print(*res)


### FIXED CODE ###

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

x = a + b
y = a - b
z = a * b
print(max(x, y, z))
#include <iostream>

using namespace std;

int main(){
    int n, card[13*4]={0};

    cin >> n;
    for (int i = 0; i < n; i++) {
        char s;
        int r;
        cin >> s >> r;
        switch (s) {
            case 'S': card[13*0 + r-1] = 1; break;
            case 'H': card[13*1 + r-1] = 1; break;
            case 'C': card[13*2 + r-1] = 1; break;
            case 'D': card[13*3 + r-1] = 1; break;
        }
    }

    for (int i = 0; i < 13*4; i++) {
        if (card[i] > 0) {
            if (i < 13*1)      cout << "S ";
            else if (i < 13*2) cout << "H ";
            else if (i < 13*3) cout << "C ";
            else               cout << "D ";
            cout << i%13+1 << endl;
        }
    }

    return 0;
}


### FIXED CODE ###

n=int(input())
e=[input()for _ in[0]*n]
for s in"SHCD":
 for r in range(1,14):
  if f'{s} {r}'not in e:print(s,r)
import numpy as np
import math
a, b = map(int, input().split())
gcd = math.gcd(a, b)

def primes(n):
    ass = []
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass, is_prime

ass, is_prime = primes(gcd)
is_prime[1] = True

ans = 0
for p, isprime in enumerate(is_prime):
    
    if p == 0:
        continue
    if is_prime[p] == True and a%p==0 and b%p==0:
#         print(p, isprime)
        ans += 1
print(ans)

### FIXED CODE ###

import numpy as np
a, b = map(int, input().split())
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
n = gcd(a, b)

table = []
i = 2
while i*i <= n:
    if n%i == 0:
        table.append(i)
        n //= i
    else:
        i += 1
if n > 1:
    table.append(n)

print(len(set(table))+1)
import math
a,b,c,d=list(map(int,input().split()))
a-=1
s=math.floor(b/c)-math.floor(a/c)
e=math.floor(b/d)-math.floor(a/d)
count=b-a-s-e
def lcm(x, y):
    return (x * y) // math.gcd(x, y)


com=lcm(c, d)
tmp=math.floor(b/com)-math.floor(a/com)
print(count+tmp)

### FIXED CODE ###

import math
import fractions
a,b,c,d=list(map(int,input().split()))
a-=1
calc_c=(b-b//c)-(a-a//c)
calc_d=(b-b//d)-(a-a//d)
count=calc_c+calc_d
def lcm(x, y):
    #return (x * y) // math.gcd(x, y)
    return math.floor((x * y) /fractions.gcd(x, y))


com=lcm(c, d)
tmp=(b-b//com)-(a-a//com)
print(count-tmp)
S = int(input())

if 0 < S // 100 <= 12 and 0 < S % 100<= 12:
    print("AMBIGUOUS")
elif 0 < S // 100 <= 12:
    print("MMYY")
elif 0 < S % 100 <= 12:
    print("YYMM")
else :
    print("NA")

### FIXED CODE ###

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

print(S[0:K-1] + S[K-1].lower() + S[K:N])
N=int(input())
S=[input() for _ in range(N)]

MARCH=[0]*5
for i in range(N):
  if S[i][0]=="M":
    MARCH[0]+=1
  elif S[i][0]=="A":
    MARCH[1]+=1
  elif S[i][0]=="R":
    MARCH[2]+=1
  elif S[i][0]=="C":
    MARCH[3]+=1
  elif S[i][0]=="H":
    MARCH[4]+=1

ans=0
for i in range(3):
  for j in range(i+1,4):
    for k in range(j+1,5):
      ans+=MARCH[i]*MARCH[j]*MARCH[k]
print(ans)


### FIXED CODE ###

N = int(input())
ans = N//3
print(ans)
a = list(map(int,input().split()))
if a[0] <= 5:
  print(0)
elif a[0] <= 12:
  print(int(a[1]//2)
else:
  print(a[1])

### FIXED CODE ###

a = list(map(int,input().split()))
if a[0] <= 5:
  print(0)
elif a[0] <= 12:
  print(a[1]//2)
else:
  print(a[1])
s=list(input())
a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
d=list(set(s))
d.sort()
ans="None"
for i in range(len(a)):
    if d[i]!=a[i]:
        ans=a[i]
        break
print(ans)

### FIXED CODE ###

s=list(input())
a=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
d=list(set(s))
d.sort()
ans="None"
for i in range(min(len(a),len(d))):
    if d[i]!=a[i]:
        ans=a[i]
        break
    u=i
if len(d)<len(a) and ans=="None":
    ans=a[u+1]
print(ans)
import sys
input = sys.stdin.readline

n = int(input())
x = [list(input().split()) for _ in range(n)]

for i in range(n):
    x[i][1] = int(x[i][1])

X = []
for i in range(len(x)):
    X.append(int(x[i][1]))
xx = sorted(x)
flag = True
temp = xx[0][0]
l = []
ans = []
l.append(xx[0][1])
for i in range(1, n):
    if temp == xx[i][0]:
        l.append(xx[i][1])
        flag = True
    else:
        flag = False
        l.sort(reverse=True)
        for j in l:
            ans.append(j)

        l = []
        temp = xx[i][0]
        l.append(xx[i][1])



if flag:
    l.sort(reverse=True)
    for j in l:
        ans.append(j)
    
ans = [int(a) for a in ans]

for i in range(n):
    print(X.index(ans[i]) + 1)



### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
x = [list(input().split()) for _ in range(n)]

for i in range(n):
    x[i][1] = int(x[i][1])

X = []
for i in range(len(x)):
    X.append(int(x[i][1]))
    
xx = sorted(x)
flag = True
temp = xx[0][0]
l = []
ans = []
l.append(xx[0][1])
for i in range(1, n):
    if temp == xx[i][0]:
        l.append(xx[i][1])
        flag = True
    else:
        flag = False
        l.sort(reverse=True)
        for j in l:
            ans.append(j)

        l = []
        temp = xx[i][0]
        l.append(xx[i][1])

if flag:
    l.sort(reverse=True)
    for j in l:
        ans.append(j)
    
ans = [int(a) for a in ans]

if len(ans) != len(X):
    ans.append(xx[i][1])
for j in range(n):
    print(X.index(ans[j]) + 1)
import sys 
sys.setrecursionlimit(10**5+10)
f_inf = 10 ** 9
dp = [f_inf] *(10**5 +10)
n,k  = map(int, input().split())
h = list(map(int, input().split()))
def chmin(a,b):
    if a<b:
        return a
    else:
        return b

def rec(i):
    if dp[i] < f_inf: #更新されてたらそのまま返す
        return dp[i]

    if i == 0 :
        return 0
    
    res = f_inf
    for j in range(1,k+1):
        if i-j < 0:
            res = chmin(res, rec(i-j) + abs(h[i]-h[i-j]))
        
    dp[i] = res

    return res
def main():
    
    print(rec(n-1))

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
def chmin(a, b):
    if a > b:
        return b
    else:
        return a
  
n,k = map(int,input().split())
h = [int(i) for i in input().split()]
# dpの最小値を変更する関数

# 無限大の値
f_inf = 10 ** 9 
# DP テーブルを初期化　(最小化問題なので INF に初期化)
dp = [f_inf] * (10**5+10)
# 初期条件
dp[0] = 0
# 足場 i-1 から足場 i へ移動する。コストは|h[i]−h[i-1]|
# 足場 i-2 から足場 i へと移動する コストは |h[i]−h[i-2]|
for i in range(1, n):
    for j in range(1,k+1):
        if i-j < 0 :
            continue
        else:
            dp[i] = chmin(dp[i], dp[i - j] + abs(h[i] - h[i-j]))
print(dp[n-1])
MOD = 10**9+7

H, W = list(map(int, input().split()))
a = [input() for _ in range(H)]

dp = [[-1]*W for _ in range(H)]
def rec(h, w):
    if dp[h][w]!=-1:
        return dp[h][w]
    else:
        dp[h][w] = 0
        if h<H-1:
            if a[h+1][w]!='#':
                dp[h][w] = rec(h+1, w)%MOD
        if w<W-1:
            if a[h][w+1]!='#':
                dp[h][w] += rec(h, w+1)%MOD
        if h==H-1 and w==W-1:
            dp[h][w] = 1
        return dp[h][w]%MOD

print(rec(0,0))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5+100)
MOD = 10**9+7

H, W = list(map(int, input().split()))
a = [input() for _ in range(H)]

dp = [[-1]*W for _ in range(H)]
def rec(h, w):
    if dp[h][w]!=-1:
        return dp[h][w]
    else:
        dp[h][w] = 0
        if h<H-1:
            if a[h+1][w]!='#':
                dp[h][w] = rec(h+1, w)%MOD
        if w<W-1:
            if a[h][w+1]!='#':
                dp[h][w] += rec(h, w+1)%MOD
        if h==H-1 and w==W-1:
            dp[h][w] = 1
        return dp[h][w]%MOD

print(rec(0,0))
sys.setrecursionlimit(200000)
S = [-1]*(101010)
def opt_S(h,n):
    if(n == 0):return 0
    elif(n == 1):return abs(h[1]-h[0])
    else :
        if(S[n] != -1):return S[n]
        s1 = opt_S(h,n-1) + abs(h[n-1]-h[n])
        s2 = opt_S(h,n-2) + abs(h[n-2]-h[n])
        S[n] = min(s1,s2)
        return S[n]



N = int(input())
h = list(map(int,input().split()))
print(opt_S(h,N-1))



### FIXED CODE ###

import sys
sys.setrecursionlimit(200000) #追加
S = [-1]*(101010)
def opt_S(h,n):
    if(n == 0):return 0
    elif(n == 1):return abs(h[1]-h[0])
    else :
        if(S[n] != -1):return S[n]
        s1 = opt_S(h,n-1) + abs(h[n-1]-h[n])
        s2 = opt_S(h,n-2) + abs(h[n-2]-h[n])
        S[n] = min(s1,s2)
        return S[n]



N = int(input())
h = list(map(int,input().split()))
print(opt_S(h,N-1))
import math
list1=(input()).split()
A=int(list1[0])
B=int(list1[1])
H=int(list1[2])
M=int(list1[3])
p=math.pi
HM=(A**2+B**2-2*A*B*(math.cos(abs(p*H/6-p*M/30))))**0.5
print(HM)

### FIXED CODE ###

K=int(input())
S=input()
list1=[]
if len(S)<=K:
  print(S)
else:
  for i in range(K):
    list1.append(S[i])
  list1.append("...")
  S2="".join(list1)
  print(S2)
while True:
    input=input()
    a,b=map(int,input.split())
    if a==b==0:
        break
    if a<b:
        print(f"{a} {b}")
    else:
        print(f"{b} {a}")
    


### FIXED CODE ###

while True:
    a,b=map(int,input().split())
    if (a==b):
        if (a==0):
            break
    if (a<b):
        print(f"{a} {b}")
    else:
        print(f"{b} {a}")
n,m = (int(i) for i in input().split())
a=[]
b=[]
jobs = [[] for i in range(m)]
for i in range(n):
    tmp,tmp2 = (int(i) for i in input().split())
    if(tmp>m):
        continue
    a.append(tmp)
    b.append(tmp2)
    jobs[m-tmp].append(tmp2)
    
ans = 0
h=[]
for i in range(m-1,-1,-1):
    for b in jobs[i]:
        heapq.heappush(h,b)
        heapq._heapify_max(h)
        
    if(len(h)!=0):
        ans += heapq._heappop_max(h)

print(ans)

### FIXED CODE ###

import heapq

n,m = (int(i) for i in input().split())
jobs = [[] for i in range(m)]
for i in range(n):
    tmp,tmp2 = (int(i) for i in input().split())
    if(tmp>m):
        continue
    jobs[m-tmp].append(tmp2)
    
ans = 0
h=[]
for i in range(m-1,-1,-1):
    for b in jobs[i]:
        heapq.heappush(h,-b)
        
    if(len(h)!=0):
        a = -heapq.heappop(h)
        ans += a

print(ans)
S,W=map(int,input().split())
if S=<W:
    print("unsafe")
else:
    print("safe")

### FIXED CODE ###

S,W=map(int,input().split())
if S <= W:
    print("unsafe")
else:
    print("safe")
def judge(s):
    ok = True
    n = len(s)
    m = (n - 1) // 2
    if (m == 0):
        ok = (s[0] == s[1])
    else:
        for i in range(m):
            if s[i] != s[(n-1)-i]:
                ok = False
                break
    return ok

def strong_judge(s):
    ok = judge(s)
    n = len(s)
    m = (n - 1) // 2
    kf = (m - 1) // 2
    kb = m + kf + 1
    sf = s[0:m]
    sb = s[(m + 1):n]
    if ok:
        ok = judge(sf) & judge(sb)
    return ok

s = str(input())

if strong_judge(s):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

def judge(s):
    ok = True
    n = len(s)
    m = (n - 1) // 2
    if (n == 1):
        ok = True
    else:
        if (m == 0):
            ok = (s[0] == s[1])
        else:
            for i in range(m):
                if s[i] != s[(n-1)-i]:
                    ok = False
                    break
    return ok

def strong_judge(s):
    ok = judge(s)
    n = len(s)
    m = (n - 1) // 2
    kf = (m - 1) // 2
    kb = m + kf + 1
    sf = s[0:m]
    sb = s[(m + 1):n]
    if ok:
        ok = judge(sf) and judge(sb)
    return ok

s = str(input())

if ((len(s) % 2 == 0) or (len(s) > 99) or (len(s) < 3)):
    print("No")
else:
    if strong_judge(s):
        print("Yes")
    else:
        print("No")
H,W = list(map(int, input().split()))
moji = ''
char = {}
for i in range(H):
    moji += input()
for m in moji:
    if m in char:
        char[m] += 1
    else:
        char.update({m:1})

four = 0
two = 0
one = 0
for c in char:
    four += int(char[c] / 4)
    two += int(char[c]%4/2)
    one += int(char[c]%2)

ans = [(H//2)*(W//2), (H//2)*(W%2)+(H%2)*(W//2), (H%2)*(W%2)]
four -= ans[0]
while(four > 0):
    four -= 1
    ans[1] -= 2
if two == ans[1] and one == ans[2]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

present = input()
if(present[:4] == 'YAKI'):
    print("Yes")
else:
    print("No")
n = int(input())
xy = [[[] for _ in range(10**5+1)] for __ in range(2)]

for _ in range(n):
    x,y = map(int,input().split())
    xy[0][x].append(y)
    xy[1][y].append(x)

ans = 0
used = [[False for _ in range(10**5+1)] for __ in range(2)]

def dfs(i,flag):
    for v in xy[flag][i]:
        if not used[1-flag][v]:
            used[1-flag][v] = True
            dfs(v,1-flag)
            count[1-flag] += 1

for i in range(10**5+1):
    if xy[0][i] and not used[0][i]:
        used[0][i] = True
        count = [1,0]
        dfs(i,0)
        ans += count[0]*count[1]

ans -= n
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

n = int(input())
xy = [[[] for _ in range(10**5+1)] for __ in range(2)]

for _ in range(n):
    x,y = map(int,input().split())
    xy[0][x].append(y)
    xy[1][y].append(x)

ans = 0
used = [[False for _ in range(10**5+1)] for __ in range(2)]

def dfs(i,flag):
    for v in xy[flag][i]:
        if not used[1-flag][v]:
            used[1-flag][v] = True
            dfs(v,1-flag)
            count[1-flag] += 1

for i in range(10**5+1):
    if xy[0][i] and not used[0][i]:
        used[0][i] = True
        count = [1,0]
        dfs(i,0)
        ans += count[0]*count[1]

ans -= n
print(ans)
N = int(input())

if N%2==0:
    print(1/2)
else:
    print((a+1)/(a*2))


### FIXED CODE ###

N = int(input())

if N%2==0:
    print(1/2)
else:
    print((N+1)/(N*2))
def inverse_lookup(d, x):
    a = []
    for k,v in d.items():
        if x == v:
          a.append(k)
    return a

n = int(input())
w = {}
for i in range(n):
  if i in w:
    w[i] += 1
  else:
    w[i] = 1
m = max(w.values())
for i in inverse_lookup(w,m).sort(reverse=True):
  print(i)

### FIXED CODE ###

def inverse_lookup(d, x):
    a = []
    for k,v in d.items():
        if x == v:
          a.append(k)
    return sorted(a)

n = int(input())
w = {}
for _ in range(n):
  i = input()
  if i in w:
    w[i] += 1
  else:
    w[i] = 1
m = max(w.values())
for j in inverse_lookup(w,m):
  print(j)
N=int(input())
a=list(map(int, input().split()))
Flag=True

#print(bin(a[N-1] ^ a[1]))
#print(bin(a[0]))

if bin(a[N-2] ^ a[0]) == bin(a[N-1]):
  if bin(a[N-1] ^ a[1]) == bin(a[0]):
    for i in range(0,N-3):
      print(bin(a[N] ^ a[N+2]),bin(a[N+1]))
      if Falg:
        if bin(a[N] ^ a[N+2])!=bin(a[N+1]):
          Flag=False
          break  
    else:
      print("Yes")
  else:
    print("No")
    
else:
  print("No")

### FIXED CODE ###

from collections import Counter,OrderedDict

N=int(input())
a=list(map(int,input().split()))
d=OrderedDict(Counter(a))
e=list(d)
e.sort()

if len(d)>3:
    ans="No"
else:
    ans="No"
    if len(d)==1:
        if e[0]==0:
            ans="Yes"
    elif len(d)==2:
        if N%3==0:
            if e[0]==0 and d[0]==N//3 and d[e[1]]==2*N//3:
                ans="Yes"
    else:
        if N%3==0:
            if d[e[0]]==d[e[1]]==d[e[2]]:
                if e[0]^e[1]^e[2]==0:
                    ans="Yes"
                   
print(ans)
q = int(input())

def lcss(x,y):
    
    lcs = [0]*(len(x)+1)
    for i in range(len(y)):
        w1 = y[i]
        lcs_2 = lcs[:]
        for j in range(len(x)):
            if x[j] == w1:
                lcs[j+1] = lcs_2[j] + 1  
            elif lcs[j+1] < lcs[j]:
                lcs[j+1] = lcs[j]
    return lcs[-1]

ret = []
for i in range(q):
    x = input()
    y = input()
    ret.append(lcss())
print(*ret,sep= "\n")

### FIXED CODE ###

q = int(input())
 
def lcss(x,y):
     
    lcs = [0]*(len(x)+1)
    for i in range(len(y)):
        w1 = y[i]
        lcs_2 = lcs[:]
        for j in range(len(x)):
            if x[j] == w1:
                lcs[j+1] = lcs_2[j] + 1  
            elif lcs[j+1] < lcs[j]:
                lcs[j+1] = lcs[j]
    return lcs[-1]
 
for i in range(q):
    x = input()
    y = input()
    print(lcss(x,y))
A,B,C,X = map(int, input().split())

cnt = 0
for i in range(A+1):
        for j in range(B+1):
                for k in range(C+1):
                        if 500*i + 100*j + 50*k == X:
                            cnt += 1
                        else:
                            cnt += 0
print(cnt)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
for i in range(0, A+1):
        for j in range(0, B+1):
                for k in range(0, C+1):
                        if int(500*i + 100*j + 50*k) == X:
                            cnt += 1
                     
print(cnt)
a,b=map(int,input().split())
s=str(input())
e=[0,1,2,3,4,5,6,7,8,9]
for i in range(len(s)):
  if a=i:
    if s[i]!='-':
      print("No")
      exit()
  else:
    if s[i] not in e:
      print("No")
      exit()

print("Yes")

### FIXED CODE ###

a,b=map(int,input().split())
s=str(input())
e=["0",'1','2','3','4','5','6','7','8','9']
for i in range(len(s)):
  if a==i:
    if s[i]!='-':
      print("No")
      exit()
  else:
    if s[i] not in e:
      print("No")
      exit()

print("Yes")
while 1:
    n,x=map(int,input().split())
    if n == 0 and x == 0: break
    print(len([1 for a in range(1,n+1), for b in range(a+1,n+1), for c in range(b+1,n+1), a + b + c == x]))

### FIXED CODE ###

while 1:
    n,x=map(int,input().split())
    if n == 0 and x == 0: break
    print(len([1 for a in range(1,n+1) for b in range(a+1,n+1) for c in range(b+1,n+1) if a + b + c == x]))
import fraction
N = int(input())
A = list(map(int, input().split()))
import math
A.sort()
ans = 10000000000000000000000000000000000000000000

for i in A:
    ans = fraction.gcd(ans, i)

print(ans)

### FIXED CODE ###

import fractions
N = int(input())
A = list(map(int, input().split()))
import math
A.sort()
ans = A[0]

for i in A:
    ans = fractions.gcd(ans, i)

print(ans)
import math
R = int(input())
circumference = 2 * math.pi * R
print("%.20f" % circumference())

### FIXED CODE ###

import math
R = float(input())
circumference = 2 * math.pi * R
print("%.20f" % circumference)