Harryxun/stf_run huggingface dataset:
N = int(input())
A = list(map(int, input().split())) 

import copy

import math
from functools import reduce

ans = 1

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

for i in range(N):
    A_sub = copy.deepcopy(A)
    del(A_sub[i])
    ans_sub = gcd_list(A_sub)
    if ans < ans_sub:
        ans = ans_sub

print(ans)


### FIXED CODE ###

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


#累積GCD
L = [0]*(N+2)
R = [0]*(N+2)
for i in range(N):
    L[i+1] = fractions.gcd(L[i],A[i])
    R[i+1] = fractions.gcd(R[i],A[N-i-1])

M = []

# print(L,R)

for i in range(N):
    ans = fractions.gcd(L[i],R[N-i-1])
    M.append(ans)

print(max(M))
line=input().split()
N=int(line[0])
K=int(line[1])
D=input().rstrip().split()

for i in range(N,10*N+1):
	s=str(i)
	flag=True
	for x in D:
		if x in s:
			flag=False
			break

	if flag:
		print(s)
    	break
	else:
		continue

### FIXED CODE ###

s=input().rstrip().split()

if int(s[0])==5 and int(s[1])==5 and int(s[2])==7:
  print("YES")
elif int(s[0])==7 and int(s[1])==5 and int(s[2])==5:
  print("YES")
elif int(s[0])==5 and int(s[1])==7 and int(s[2])==5:
  print("YES")
else:
  print("NO")
Sz=list(input())
T=list(input())

for i in range(len(Sz)-len(T),-1,-1):
    Flag=1
    for s in range(len(T)):

        if not (Sz[i+s]=="?" or Sz[i+s]==T[s]):
            Flag=0
            break
    if Flag:
        for s in range(len(T)):
             Sz[i+s]=T[s]
        break
for i in range(len(Sz)):
    if Sz[i]=="?":Sz[i]="a"

if Flag:print("".join(Sz))
else:print("UNRESTORABLE ")


### FIXED CODE ###

Sz=list(input())
T=list(input())
Flag=0

for i in range(len(Sz)-len(T),-1,-1):
    Flag=1
    for s in range(len(T)):

        if not (Sz[i+s]=="?" or Sz[i+s]==T[s]):
            Flag=0
            break
    if Flag:
        for s in range(len(T)):
             Sz[i+s]=T[s]
        break
for i in range(len(Sz)):
    if Sz[i]=="?":Sz[i]="a"

if Flag:print("".join(Sz))
else:print("UNRESTORABLE ")
N, M = map(int, input().split())
Hs = list(map(int, input().split()))
edges = [[] for i in range(N)]
for i in range(M):
	a, b = map(int, input().split())
	edges[a-1].append(b) 
	edges[b-1].append(a)

ans = 0
for idx, aa in enumerate(edges):
	for a in aa:
		if Hs[idx] <= Hs[a]:
			break
		ans += 1
		break
print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
Hs = list(map(int, input().split()))
ans = [1 for i in range(N)]
for i in range(M):
	a, b = map(int, input().split())
	if Hs[a-1] <= Hs[b-1]:
		ans[a-1] = 0
	if Hs[b-1] <= Hs[a-1]:
		ans[b-1] = 0
print(sum(ans))
N = int(input())
A, B, C = [], [], []
for _ in range(N):
    a, b, c = map(int, input().split())
    A.append(a)
    B.append(b)
    C.append(c)

def helper(idx, happy, last):
    if idx >= N:
        return happy
    if last == 'a':
        return max(helper(idx+1, happy+B[idx], 'b'), helper(idx+1, happy+C[idx], 'c'))
    elif last == 'b':
        return max(helper(idx+1, happy+A[idx], 'a'), helper(idx+1, happy+C[idx], 'c'))
    else:
        return max(helper(idx+1, happy+A[idx], 'a'), helper(idx+1, happy+B[idx], 'b'))


happy_a = helper(1, A[0], 'a')
happy_b = helper(1, B[0], 'b')
happy_c = helper(1, C[0], 'c')

print(max(happy_a, happy_b, happy_c))

### FIXED CODE ###

N = int(input())
H = []
for _ in range(N):
    a, b, c = map(int, input().split())
    H.append([a, b, c])

dp = [[float('inf')] * 3 for _ in range(N+1)]
dp[0] = [0, 0, 0]
for i in range(1, N+1):
    dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + H[i-1][0] 
    dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + H[i-1][1]
    dp[i][2] = max(dp[i-1][0], dp[i-1][1]) + H[i-1][2]
print(max(dp[N]))
h,w = map(int,input().split())
l = [["."]*(w+2)]
for i in range(h):
    l.append(["."] + [i for i in input()] + ["."])
l.append(["."]*(w+2))
 
def count(i,j):
    if l[i][j] == "#":
        return "#"
    c = 0
    for n in range(i-1,i+2):
        for m in range(j-1,j+2):
            if l[n][m] == "#":
                c += 1
    return str(c)
 
ans = ["".join([count(i,j) for j in range(1,1+w)]) for i in range(1,1+h)]
 
print("\n".join(ans))
h,w = map(int,input().split())
l = [["."]*(w+2)]
for i in range(h):
    l.append(["."] + [i for i in input()] + ["."])
l.append(["."]*(w+2))

def count(i,j):
    if l[i][j] == "#":
        return "#"
    c = 0
    for n in range(i-1,i+2):
        for m in range(j-1,j+2):
            if l[n][m] == "#":
                c += 1
    return str(c)

ans = ["".join([count(i,j) for j in range(1,1+w)]) for i in range(1,1+h)]

print("\n".join(ans))



### FIXED CODE ###

h,w = map(int,input().split())
l = [["."]*(w+2)]
for i in range(h):
    l.append(["."] + [i for i in input()] + ["."])
l.append(["."]*(w+2))
 
def count(i,j):
    if l[i][j] == "#":
        return "#"
    c = 0
    for n in range(i-1,i+2):
        for m in range(j-1,j+2):
            if l[n][m] == "#":
                c += 1
    return str(c)
 
ans = ["".join([count(i,j) for j in range(1,1+w)]) for i in range(1,1+h)]
 
print("\n".join(ans))
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

lis = []
lis2 = []


while True:
  num = input()
  if num == 0:
    break
  else:
    lis = []
    for i in range(num):
      n = input()
      if i == 0:
        d = n
      else:
        d = max( d + n , n )
        lis.append(d)    
    print max(lis)

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

while True:
  num = input()
  if num == 0:
    break
  lis = [0]*num
  for i in range(num):
    n = input()
    if i == 0:
      lis[0] = n
    else:
      lis[i] = max( lis[i-1] + n , n )
  print max(lis)
S = input()

list = ["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"]

s_index = list.index(S)

print(list[s_index+1])

### FIXED CODE ###

S = input()
 
list = ["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"]
 
s_index = list.index(S)
 
print(list[s_index+1])
a, b, n = map(int, input().split())
 
tmp = 0
for x in (range(1, b+1, b-1) if b<n else range(1, n+1, n-1)):
#for x in range(1, n+1):
    calc = a*x//b - a*(x//b)
    if calc > tmp:
        tmp = calc
 
print(tmp)

### FIXED CODE ###

a, b, n = map(int, input().split())
 
tmp = 0
for x in (range(1, b+1, b-2) if b<=n else range(1, n+1, n-1)):
#for x in range(1, n+1):
    calc = a*x//b - a*(x//b)
    if calc > tmp:
        tmp = calc
 
print(tmp)
S=str(input())

S[3]=8

print(S)

### FIXED CODE ###

S=str(input())

S_changed=S[:3]+'8'+S[4:]

print(S_changed)
input()
n = map(int,input().split())
print(min(n),max(x),sum(s))

### FIXED CODE ###

input()
n = list(map(int,input().split()))
print(min(n),max(n),sum(n))
n,m=map(int,input().split())
sc=[]
for i in range(m):
  q=list(map(int,input().split()))
  if q not in sc:
    sc.append(q)
slist=[i[0] for i in sc]
if len(slist)!=len(set(slist)):
  print("-1")
  exit()
if n!=1 and [1,0] in sc:
  print(-1)
  exit()

sc.sort()
num=""
k=0
sc.append(n+1)
for i in range(1,n+1):
  if sc[k][0]==i:
    num += str(sc[k][1])
    k+=1
  else:
    if i==1:
      num+="1"
    else:
      num += "0"
print(int(num))
    

### FIXED CODE ###

n,m=map(int,input().split())
sc=[list(map(int,input().split())) for i in range(m)]
# 全探索
if n==1:
  for i in range(10):
    memo=0
    for li in sc:
      if str(i)[li[0]-1]!=str(li[1]):
        break
      else:
        memo+=1
    if memo==m:
      print(i)
      exit()
  print("-1")
elif n==2:
  for i in range(10,100):
    memo=0
    for li in sc:
      if str(i)[li[0]-1]!=str(li[1]):
        break
      else:
        memo+=1
    if memo==m:
      print(i)
      exit()
  print("-1")
else:
  for i in range(100,1000):
    memo=0
    for li in sc:
      if str(i)[li[0]-1]!=str(li[1]):
        break
      else:
        memo+=1
    if memo==m:
      print(i)
      exit()
  print("-1")
import math

n,x = map(int,input().split())
xlist = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans = math.gcd(xlist[i]-x,ans)
print(ans)

### FIXED CODE ###

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
  
n,x = map(int,input().split())
xlist = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans = gcd(abs(xlist[i]-x),ans)
print(ans)
A, B, C, D, E, F = map(int, input().split())
sugar = 0
s_water = 0
for a in range(F//(100*A)+1):
  for b in range((F-100*A*a)//(100*B)+1):
    f = F - 100*(a+b)
    max_s = min((a+b)*E, f)
    sugar_temp = 0
    s_water_temp = 0
    print(max_s)
    if max_s%C >= max_s%D:
      sugar_temp = max_s-max_s%D
    else:
      sugar_temp = max_s-max_s%C
    s_water_temp = 100*(a+b) + sugar_temp
    if sugar_temp/s_water_temp > sugar/s_water:
      sugar = sugar_temp
      s_water = s_water_temp
print(s_water, sugar)
    

### FIXED CODE ###

A, B, C, D, E, F = map(int, input().split())
ans_sw = 1
ans_s = 0
for a in range(F//(100*A)+1):
  for b in range(F//(100*B)+1):
    if 100*A*a + 100*B*b > F or 100*A*a+100*B*b == 0:
      continue
    for c in range((A*a+B*b)*E+1):
      for d in range((A*a+B*b)*E+1):
        sw = 100*A*a+100*B*b+C*c+D*d
        s = C*c+D*d
        if 0 < sw <= F and s <= (A*a+B*b)*E and ans_s/ans_sw < s/sw:
          ans_s = s
          ans_sw = sw
if ans_sw == 1:
  print(100*A ,0)
else:
  print(ans_sw, ans_s)
a = int(input())
str = list(input())

if a%2 :
	print("No")
	exit()
  
n_str_1 = ""
n_str_2 = ""
  
fot i in range(a/2):
	n_str_1 += str[i]
    n_str_2 += str[i+a/2]

if n_str_1 == n_str_2 :
	print("Yes")
else :
  	print("No")

### FIXED CODE ###

a = int(input())
str = list(input())

if a%2 :
	print("No")
	exit()
  
n_str_1 = ""
n_str_2 = ""
  
for i in range(int(a/2)):
    n_str_1 += str[i]
    n_str_2 += str[i+int(a/2)]

if n_str_1 == n_str_2 :
	print("Yes")
else :
  	print("No")
A, B, K = input().split()

C = int(K)-int(A)
B = int(B)-C

print(str(C) +" "+ str(B))

### FIXED CODE ###

S, T = input().split()

print(T+S)
n,m=map(int,input().split())
step=list(range(n+1))
mod=10**9+7
for i in range(m):
    step.remove(int(input()))
dp=[0]*n+1
dp[0]=1
if step[1]==1:
    dp[1]=1
    step.remove(1)
step.remove(0)
for i in step:
    dp[i]=(dp[i-1]+dp[i-2])
print(dp[n]%mod)

### FIXED CODE ###

N, M = list(map(int, input().split()))
A = {i: 0 for i in range(N+1)}
mod = 10 ** 9 + 7
for _ in range(M):
    A[int(input())] = 1
 
dp = [0 for _ in range(N+1)]
dp[0] = 1
 
for i in range(N+1):
    if A.get(i+1) == 0:
        dp[i + 1] += dp[i]
    if A.get(i+2) == 0:
        dp[i + 2] += dp[i]
 
print(dp[N]%mod)
from collections import deque

s = deque(input())
n=int(input())
l = [input().split(" ") for _ in range(n)]

x = 0
for i in range(n):
    if l[i][0]=='1':
        if x == 0:
            x = 1
        else:
            x = 0
    elif l[i][0]=='2':
        if x == 0:
            if l[i][1]=='1':
                s.appendleft(l[i][2])
            else:
                s.append(l[i][2])
        else:
            if l[i][1]=='1':
                s.append(l[i][2])
            else:
                s.appendleft(l[i][2])

if x == 0:
    print(''.join(s))
else:
    print(''.join(s[::-1]))

### FIXED CODE ###

from collections import deque

s = deque(input())
n = int(input())
l = [input().split(" ") for _ in range(n)]

x = 0
for i in range(n):
    if l[i][0]=='1':
        if x == 0:
            x = 1
        else:
            x = 0
    elif l[i][0]=='2':
        if x == 0:
            if l[i][1]=='1':
                s.appendleft(l[i][2])
            else:
                s.append(l[i][2])
        else:
            if l[i][1]=='1':
                s.append(l[i][2])
            else:
                s.appendleft(l[i][2])

if x == 0:
    print(''.join(s))
else:
    print(''.join(reversed(s)))
MOD = 1000000007
n = int(input())
l = list(map(int,input().split()))
a = {}
for i in l:
    if i in a:
        a[i] += 1
    else:
        a[i] = 1

cur = 1 if n % 2 == 0 else 0

ok = True
while cur < n:
    x = 1 if cur == 0 else 2
    if a[cur] != x:
        ok = False
        break
    cur += 2

ans = 0
if ok:
    ans = 1
    for _ in range(n // 2):
        ans = ans * 2 % MOD

print(ans)

### FIXED CODE ###

MOD = 1000000007
n = int(input())
l = list(map(int,input().split()))
a = {}
for i in l:
    if i in a:
        a[i] += 1
    else:
        a[i] = 1

cur = 1 if n % 2 == 0 else 0

ok = True
while cur < n:
    x = 1 if cur == 0 else 2
    if cur in a and a[cur] != x:
        ok = False
        break
    cur += 2

ans = 0
if ok:
    ans = 1
    for _ in range(n // 2):
        ans = ans * 2 % MOD

print(ans)
def main():
  _range, _input = range, stdin.readline
  h, w = map(int, _input().split())
  s = [_input() + '#' for _ in _range(h)]
  s.append('#' * (w + 1))
  t = [[-1] * w for _ in _range(h + 1)]
  tstart = [-1] * (w + 1)
  for i in _range(h + 1):
    ystart = -1
    si = s[i]
    ti = t[i]
    for j in _range(w + 1):
      tj = tstart[j]
      if si[j] == '#':
        if ystart != -1:
          n = j - ystart
          for k in _range(ystart, j):
            ti[k] += n
          ystart = -1
        if tj != -1:
          n = i - tj
          for k in _range(tj, i):
            t[k][j] += n
          tstart[j] = -1
      else:
        if ystart == -1:
          ystart = j
        if tj == -1:
          tstart[j] = i
  print(max(map(max, t)))
main()

### FIXED CODE ###

h, w = map(int, input().split())
s = [input() + '#' for _ in range(h)]
s.append('#' * w)

yoko = [[0] * w for _ in range(h)]
for i in range(h):
  if s[i][0] == '.':
    start = 0
  else:
    start = -1
  for j in range(1, w + 1):
    if s[i][j] == '#':
      if start != -1:
        for k in range(start, j):
          yoko[i][k] = j - start
        start = -1
    else:
      if start == -1:
        start = j

tate = [[0] * w for _ in range(h)]
for i in range(w):
  if s[0][i] == '.':
    start = 0
  else:
    start = -1
  for j in range(1, h + 1):
    if s[j][i] == '#':
      if start != -1:
        for k in range(start, j):
          tate[k][i] = j - start
        start = -1
    else:
      if start == -1:
        start = j
result = 0
for i in range(h):
  for j in range(w):
    t = yoko[i][j] + tate[i][j] - 1
    if t > result:
      result = t

print(result)
def solve(A, N, day=0):
    # check if end
    if all([len(a) == 0 for a in A]):
        return day
    # get available games
    available_games = set()
    for i in range(N):

        if len(A[i]) == 0:
            continue

        j = A[i][0]

        if len(A[j]) == 0:
            continue

        if A[j][0] == i:
            if i > j:
                i, j = j, i
            available_games.add((i, j))
    if len(available_games) == 0:
        return -1

    for game in available_games:
        i, j = game
        A[i].pop(0)
        A[j].pop(0)
    return solve(A, N, day + 1)


if __name__ == '__main__':
    N = int(input())
    A = [list(map(int, input().split())) for _ in range(N)]
    for i in range(N):
        for j in range(N - 1):
            A[i][j] -= 1

    answer = solve(A, N)
    print(answer)


### FIXED CODE ###

import sys
from collections import deque

input = sys.stdin.readline

n = int(input())

to_battle_with = [deque([i - 1 for i in map(int, input().split())]) for _ in range(n)]


def update_battle(player, battle_set, to_battle_with):
    if not to_battle_with[player]:
        return
    next_opponent = to_battle_with[player][0]
    if not to_battle_with[next_opponent]:
        return
    if to_battle_with[next_opponent][0] == player:
        if player > next_opponent:
            player, next_opponent = next_opponent, player
        battle_set.add((player, next_opponent))


battles_today = set()
for player in range(n):
    update_battle(player, battles_today, to_battle_with)

day_count = 0
battle_count = 0
num_all_battles = (n * (n - 1)) // 2

while battles_today:
    battles_tomorrow = set()
    for p1, p2 in battles_today:
        battle_count += 1
        to_battle_with[p1].popleft()
        to_battle_with[p2].popleft()
        for p in [p1, p2]:
            update_battle(p, battles_tomorrow, to_battle_with)
    battles_today = battles_tomorrow
    day_count += 1

if battle_count == num_all_battles:
    print(day_count)
else:
    print(-1)
S=input()
K=int(input())

if list(S).count(S[0])==len(S):
    print(len(S)*K//2)

else:
    S_count=0
    i=0
    while i<len(S)-1:
        if S[i]==S[i+1]:
            S_count+=1
            i+=1
        i+=1

    if S[0]==S[-1]:
        a=0
        i=0
        while i<len(S)-1:
            if S[i]==S[i+1]:
                a+=1
                i+=1
            else:
                break
        b=0
        i=len(S)-1
        while i>0:
            if S[i]==S[i-1]:
                b+=1
                i+=-1
            else:
                break

        S_count*=K
        S_count-=(K-1)*(a//2 + b//2 - (a+b)//2)
        print(unko)
    else:
        S_count*=K
    print(S_count)


### FIXED CODE ###

S=input()
K=int(input())

if list(S).count(S[0])==len(S):
    print(len(S)*K//2)

else:
    S_count=0
    i=0
    while i<len(S)-1:
        if S[i]==S[i+1]:
            S_count+=1
            i+=1
        i+=1

    if S[0]==S[-1]:
        a=1
        i=0
        while i<len(S)-1:
            if S[i]==S[i+1]:
                a+=1
                i+=1
            else:
                break
        b=1
        i=len(S)-1
        while i>0:
            if S[i]==S[i-1]:
                b+=1
                i+=-1
            else:
                break

        S_count*=K
        S_count-=(K-1)*(a//2 + b//2 - (a+b)//2)

    else:
        S_count*=K
    print(S_count)
import numpy as np
bins = np.array([list(map(int, list('{number:0>40}'.format(number=bin(i)[2:])))) for i in range(A, B+1)]).T
bins = np.sum(bins, axis=1) % 2
result = 0
for d, i in enumerate(bins[::-1]):
    if i == 1:
        result += 2 ** d
print(result)

### FIXED CODE ###

A, B = map(int, input().split())
if A % 2 == 0:
    num = B - A
    result = 0
else:
    num = (B - (A + 1))
    result = A
if num // 2 % 2 == 0:
    result ^= 0
else:
    result ^= 1
if num % 2 == 1:
    result ^= (B-1)
result ^= B
print(result)
count = 0
N = int(input())
S = list(input())
# for i in range(N):
#     for j in range(i+1, N):
#         for k in range(j+1, N):
#             if(S[i] != S[j] and S[i] != S[k] and S[j] != S[k] and (j - i) != (k - j)):
#                 count+=1
# print(count)

countSecond = 1
countThird = 1
for i in range(N):
    while(S[i] == S[i+countSecond]):
        if(countSecond < N):
            countSecond+=1
        else:
            break
            
    while(S[i+countSecond] == S[i + countThird]):
        if(countThird < N):
            countThird += 1
        else:
            break
    if((countSecond - i) != (countThird - i)):
        count+=1
print(count)

### FIXED CODE ###

# 先に組み合わせの数を決める
# RとGとBの数を先に数え上げると、Rの数 * Gの数 * Bの数が組み合わせの数になる
# 累積和でもできる

#組み合わせの数は
kumiawase = 0
countR=0
countG=0
countB=0
N = int(input())
S = list(input())
for i in range(N):
    if(S[i] == "R"):
        countR += 1
    elif(S[i] == "G"):
        countG += 1
    elif(S[i] == "B"):
        countB += 1
kumiawase = countR * countG * countB

count = 0
#その組み合わせの数から、j-i = k-jをみたす数を引けばいい
#条件を満たし、かつ1つ目の条件を満たすものは
for i in range(N):
    for j in range(i+1, N):
        k = 2 * j - i
        if(k < N):
            if(S[i] != S[j] and S[i] != S[k] and S[j] != S[k]):
                count+=1

print(kumiawase - count)
import bisect

n = int(input())
a = list(map(int, input().split()))
a.sort()
k = len(a)
ok = [0] * k
for i in range(k):
    if i < k - 1 and a[i] == a[i + 1]:
        ok[i] = 1
        ok[i + 1] = 1
        continue
    """"if a[i] < 2 * 100:
        for j in range(i + 1, k):
            if a[j] % a[i] == 0:
                ok[j] = 1"""
    else:
        times = 2
        while a[i] * times < a[-1]:
            l = bisect.bisect_left(a, a[i] * times)
            r = bisect.bisect_right(a, a[i] * times)
            if r != l:
                for idx in range(l, r):
                    ok[idx] = 1
            times += 1
# print(ok)
print(len([i for i in ok if i == 0]))
# print(ok) WAはどこ？


### FIXED CODE ###

import bisect

n = int(input())
a = list(map(int, input().split()))
a.sort()
k = len(a)
ok = [0] * k
for i in range(k):
    if i < k - 1 and a[i] == a[i + 1]:
        ok[i] = 1
        ok[i + 1] = 1
        continue
    if a[i] < 2 * 100:
        for j in range(i + 1, k):
            if a[j] % a[i] == 0:
                ok[j] = 1
    else:
        times = 2
        while a[i] * times < a[-1]:
            l = bisect.bisect_left(a, a[i] * times)
            r = bisect.bisect_right(a, a[i] * times)
            if r != l:
                for idx in range(l, r):
                    ok[idx] = 1
            times += 1
# print(ok)
print(len([i for i in ok if i == 0]))
# print(ok) WAはどこ？
a, b = map(int, input().split())
if a=>b:
  print('10')
else:
  print('0')

### FIXED CODE ###

a, b = map(int, input().split())
if a >= b:
  print('10')
else:
  print('0')
N = int(input())
A = list(map(int, input().split())

for k in range(1, N+1):
         A = A.remove(k)
         ans = 0
         for i in range(1,N+1):
         	n = sum(A[j] == i for j in range(1,N))
         	nc2 = n * (n-1) / 2
         	ans += nc2
         
         print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(max(a)+1)]
for x in a:
    b[x] += 1
c = sum([x*(x-1)//2 for x in b])
for i in range(n):
    print(c-b[a[i]]+1)
n = int(input())
a = list(map(int,input().split()))
ans = []

for i in range(n):
	j = n - 1 - i
	k = (j + 1) + (j + 1)
	if k > n:
		if a[j] == 1:
			ans.append(j+1)
	else:
		count = 0
		while k <= n:
			if k in ans:
				count = count + 1
			k = k + (j + 1)
		count_01 = count % 2
		if a[j] == 0:
			if count_01 == 1:
				ans.append(j+1)
		elif a[j] == 1:
			if count_01 == 0:
				ans.append(j+1)
if not ans:
	print(0)
else:
	print(str(len(ans))+"\n" + " ".join(list(map(str,ans))))


### FIXED CODE ###

r = int(input())
print(3 * r * r)
a=[0]*10000
b=[0]*10000
ct=0
a_scores=[]
b_scores=[]
while True:
    a_score=0
    b_score=0
    n=input()
    if n==0:
        break
    else :
        for i in xrange(n):
            a[ct+i],b[ct+i]=map(int,raw_input().split())
            if a[ct+i]>b[ct+i]:
                a_score+=a[ct+i]+b[ct+i]
            elif a[ct+i]==b[ct+i]:
                a_score+=a[ct+i]
                b_score+=b[ct+i]
            else:
                b_score+=b[ct+i]+a[ct+i]
        a_scores.append(a_score)
        b_scores.append(b_score)
        ct+=n
for i in xrange(len(a_scores)):
    print a_scores[i],b_scores[i]
    

### FIXED CODE ###

while 1:
    n=input()
    if n==0:break
    ascore=0
    bscore=0
    for i in xrange(n):
        a,b=map(int,raw_input().split())
        if a>b:
            ascore+=a+b
        elif a==b:
            ascore+=a
            bscore+=b
        else:
            bscore+=a+b
    print ascore,bscore
S = input()
A = int(S[0:2])
B = int(S[2:4])

if 0 < A and A <= 12:
  if 0 < B and B <= 12:
    print(AMBIGUOUS)
  else:
    print(MMYY)
else:
  if 0 < B and B <= 12:
    print(YYMM)
  else:
    print(NA)

### FIXED CODE ###

S = input()
A = int(S[0:2])
B = int(S[2:4])

if 0 < A and A <= 12:
  if 0 < B and B <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 0 < B and B <= 12:
    print("YYMM")
  else:
    print("NA")
n, k = map(int, input().split())
sum = 0
coin_count = 0


for i in range(n):
    k = coin(i, k)
    sum += (1/n) * ((0.5) ** k)

print(sum)


def coin(j,k):
    point = j
    count = 0
    while k <= point:
        point = point * 2
        count += 1
    return count


### FIXED CODE ###

import sys
input = sys.stdin.readline
N,K = map(int, input().split())
ans = 0
for i in range(1,N+1):
	coin = 0
	point = i
	if K <= i:
		ans += 1/N
	else:
		while point < K:
			point *= 2
			coin += 1
		ans += (1/N) * (0.5)**coin

print(ans)