Harryxun/stf_run huggingface dataset:
from fractions import Fraction
from decimal import Decimal

n=int(input())
a=[Fraction(Decimal(input())) for _ in range(n)]

num=[aa.numerator*10**9//aa.denominator for aa in a]

cnt=[[0]*20 for _ in range(20)]
pair=[]

for nu in num:
    c2=0
    c5=0
    while nu>0 and nu%2==0:
        nu//=2
        c2+=1
    
    while nu>0 and nu%5==0:
        nu//=5
        c5+=1
    
    cnt[c2][c5]+=1
    pair.append((c2,c5))
ans=0

for c2,c5 in pair:
    for cc2 in range(18-c2,20):
        for cc5 in range(18-c5,20):
            ans+=cnt[cc2][cc5]
    if c2>=9 and c5>=9:
        ans-=1

print(ans//2)

### FIXED CODE ###

from fractions import Fraction
from decimal import Decimal

n=int(input())
a=[Fraction(Decimal(input())) for _ in range(n)]

num=[aa.numerator*10**9//aa.denominator for aa in a]

cnt=[[0]*50 for _ in range(50)]
pair=[]

for nu in num:
    c2=0
    c5=0
    while nu>0 and nu%2==0:
        nu//=2
        c2+=1
    
    while nu>0 and nu%5==0:
        nu//=5
        c5+=1
    
    cnt[c2][c5]+=1
    pair.append((c2,c5))
ans=0

for i in range(49,-1,-1):
    for j in range(49,-1,-1):
        if i+1<49:
            cnt[i][j]+=cnt[i+1][j]
        if j+1<49:
            cnt[i][j]+=cnt[i][j+1]

        if i+1<49 and j+1<49:
            cnt[i][j]-=cnt[i+1][j+1]

for c2,c5 in pair:
    ans+=cnt[max(0,18-c2)][max(0,18-c5)]
    if c2>=9 and c5>=9:
        ans-=1

print(ans//2)
a, b, k = map(int, input().split())

l = list(range(a, b + 1))
l_low = l[:k]
l_up = l[-k:]

ll = sorted(list(set(l_low + l_up)))
for i in ll:
    print(i)



### FIXED CODE ###

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

a_upper = min(b, a+k-1)
b_lower = max(a, b-k+1)

u = set(range(a, a_upper+1))
v = set(range(b_lower, b+1))

for i in sorted(list(u | v)):
    print(i)
import math as m
from functools import reduce
 
n=int(input())
l=[]
def f(a,b):
    return int(a*b/m.gcd(a,b))
for i in range(n):
    l.add(int(input()))
print(reduce(f,l))

### FIXED CODE ###


a=input()
if a[0]==a[2]:
    print("Yes")
else:print("No")
n = int(input())
li1 = list(map(int, input().split()))

li2 = []
for i in range(1, len(li1)):
    li2.append(li1[i-1] - li1[i])
    
cnt1 = 0
cnt2 = 0
li3 = []

for i in li2:
    cnt2 += 1
    if i < 0:
        li3.append(cnt1)
        cnt1 = 0
    else:
        cnt1 += 1
    if cnt2 == len(li2):
        li3.append(cnt1)

print(max(li3))

### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)

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

li2 = []
for i in range(1, len(li1)):
    li2.append(li1[i-1] - li1[i])
    
cnt1 = 0
cnt2 = 0
li3 = []

for i in li2:
    cnt2 += 1
    if i < 0:
        li3.append(cnt1)
        cnt1 = 0
    else:
        cnt1 += 1

li3.append(cnt1)

print(max(li3))
import math
n=int(raw_input())
sq=math.sqrt(n)
ans=None



if str(sq)[-2]=='.':
    print len(str(sq))-2
else:
    nu=[]
    while sq>1:
        sq=int(sq)
        if n%sq==0:
            nu.append(str(sq))
            nu.append(str(n/sq))
            sq-=1
            break
        else:
            sq-=1
    if len(nu)!=0:
        nu.sort()
        print len((nu[1]))
    else:
        print len(str(n))

### FIXED CODE ###

a,b=map(int,raw_input().split())
print (a+b)%24
c=list(map(int, input().split()))

W = c[0]
H = c[1]
x = c[2]
y = c[3]



if W*y <= W*H / 2:
    S1 = W*y
else:
    S1 = W*H - W*y

if H*x <= W*H / 2:
    S2 = H*x
else:
    S2 = W*H - H*x

if S1 < S2:
    Sm = S2
    co = 0
elif S1 > S2:
    Sm = S1
    co = 0
else:
    Sm = S1
    co = 1
    
print(float(Sm),co)

### FIXED CODE ###

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

if x < a:
    print(0)
else:
    print(10)
a = input()
print("A" if a = "T" else "T" if a ="A" else "G" if a ="C" else "C")

### FIXED CODE ###

a = input()
print("A" if a =="T" else "T" if a =="A" else "G" if a =="C" else "C")
while 1:
    n = 1000 - input()
    if n==0:break
    m = [500,100,50,10,5,1]
    for i in range(6):
        x = n / m[i]; n -= m[i] * x; m[i] = x;
    print reduce(lambda a, x: a+x, m)

### FIXED CODE ###

while 1:
    n = 1000-input()
    if n==1000:break
    m = [500,100,50,10,5,1]
    for i in range(6):
        m[i],n = divmod(n,m[i])
    print reduce(lambda a, x: a+x, m)
a, b = map(int, input().split())

if a =< 0 and b >= 0:
    ans = 'Zero'
elif a < 0 and b < 0:
    if (abs(a) - abs(b) + 1) % 2 == 0:
        ans = 'Positive'
    else:
        ans = 'Negative'
elif a > 0 and b > 0:
    ans = 'Positive'
    
print(ans)

### FIXED CODE ###

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

if a <= 0 and b >= 0:
    ans = 'Zero'
elif a < 0 and b < 0:
    if (abs(a) - abs(b) + 1) % 2 == 0:
        ans = 'Positive'
    else:
        ans = 'Negative'
elif a > 0 and b > 0:
    ans = 'Positive'
    
print(ans)
r,s=map(int,input().split())
a=d=1,b=c=0
while r:
 q=r//s
 r,s,a,c,b,d=s,r%s,c,a-q*c,d,b-q*d
print(a,b)


### FIXED CODE ###

r,s=map(int,input().split())
a=d=1;b=c=0
while s:q=r//s;r,s,a,c,b,d=s,r%s,c,a-q*c,d,b-q*d
print(a,b)
a,v,b,w,t=int(input().split())
 
if a<b and b+w*t<=a+v*t:
    print('YES')

if a>b and a-v*t<=b-w*t:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

a,v=map(int, input().split())
b,w=map(int, input().split())
t=int(input())
 
if a<b:
  if b+w*t<=a+v*t:
    print('YES')
  else:
    print('NO')
if a>b:
  if a-v*t<=b-w*t:
    print('YES')
  else:
    print('NO')
import random
N = int(input())
engine = [list(map(int, input().split())) for i in range(N)]

used = [True]*N

x = 0
y = 0
for i in range(N):
    x += engine[i][0]
    y += engine[i][1]

for _ in range(2500000):
    i = random.randint(0, N-2)
    xtemp = x
    ytemp = y
    if used[i]:
        xtemp -= engine[i][0]
        ytemp -= engine[i][1]
    else:
        xtemp += engine[i][0]
        ytemp += engine[i][1]
    j = random.randint(i+1, N-1)
    if used[j]:
        xtemp -= engine[j][0]
        ytemp -= engine[j][1]
    else:
        xtemp += engine[j][0]
        ytemp += engine[j][1]


    if x*x+y*y <= xtemp**2+ytemp**2:
        used[i] = not used[i]
        used[j] = not used[j]
        x = xtemp
        y = ytemp
print((x*x+y*y)**(1/2))


### FIXED CODE ###

from math import *
n = int(input())
engine = [list(map(int, input().split())) for i in range(n)]

args = []
for i in range(n):
    x, y = engine[i]
    if x == 0:
        if y < 0:
            args.append((-pi/2, x, y))
        elif y > 0:
            args.append((pi/2, x, y))

    elif y == 0:
        if x > 0:
            args.append((0, x, y))
        elif x < 0:
            args.append((pi, x, y))

    else:
        args.append((atan2(y, x), x, y))

args.sort()
l = len(args)
args = args[:] + args[:]
ans = 0
for i in range(1, l+1):
    for j in range(l):
        x, y = 0, 0
        for k in range(j, j+i):
            x += args[k][1]
            y += args[k][2]
        ans = max(ans, hypot(x, y))

print(ans)
from collections import deque
import bisect
N, M = map(int, input().split())
A = sorted(list(map(int, input().split())))
A = deque(A)
for i in range(M):
    A[N-1] //= 2
    if N >=2 and A[N-1] > A[N-2]:
        continue
    p = A.pop()
    index = bisect.bisect_left(A, p)
    A.insert(index, p)
print(sum(A))

### FIXED CODE ###

import heapq
import bisect
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [(-x, x) for x in A]
heapq.heapify(A)
for i in range(M):
    P = heapq.heappop(A)
    p = P[1] // 2
    heapq.heappush(A, (-p, p))
s = 0
for i in range(N):
    s += A[i][1]
print(s)
N = map( int , raw_input().split() )

if N[0] < N[1] < N[2]:
  print 'N[0] N[1] N[2]'
elif N[0] < N[2] < N[1]:
  print 'N[0] < N[2] < N[1]'
elif N[1] < N[0] < N[2]:
  print 'N[1] < N[0] < N[2]'
elif N[1] < N[2] < N[0]:
  print 'N[1] < N[2] < N[0]'
elif N[2] < N[0] < N[1]:
  print 'N[2] < N[0] < N[1]'
else N[2] < N[1] < N[0]:
  print 'N[2] < N[1] < N[0]'

### FIXED CODE ###

N = map( int , raw_input().split() )
 
if N[0] < N[1] < N[2] or N[0] == N[1] == N[2] or N[0] < N[1] == N[2] or N[0] == N[1] < N[2]:
  print "%d %d %d" %(N[0],N[1],N[2])
elif N[0] < N[2] < N[1]:
  print "%d %d %d" %(N[0],N[1],N[2])
elif N[1] < N[0] < N[2]:
  print "%d %d %d" %(N[1],N[0],N[2])
elif N[1] < N[2] < N[0] or N[1] < N[2] == N[0] or N[1] == N[2] < N[0]: 
  print "%d %d %d" %(N[1],N[2],N[0])
elif N[2] < N[0] < N[1] or N[2] < N[0] == N[1] or N[2] == N[0] < N[1]:
  print "%d %d %d" %(N[2],N[0],N[1])
elif N[2] < N[1] < N[0]:
  print "%d %d %d" %(N[2],N[1],N[0])
import sys
from collections import deque
inputs = sys.stdin.readlines()

n = int(inputs[0])
edges = [tuple(map(int, x.split())) for x in inputs[1:]]
B = [e[1] for e in edges] 

E = [[] for _ in range(N + 1)]
for a, b in edges:
    E[a].append(b)

Q = deque([1])
C = [0] * (N + 1)
while Q:
    v = Q.popleft()
    c = 0
    for u in E[v]:
        c += 1 + (c + 1 == C[v])
        C[u] = c
        Q.append(u)

print(max(C))
for b in B:
    print(C[b])

### FIXED CODE ###

from collections import deque
 
N, *AB = map(int, open(0).read().split())
B = AB[1::2]
 
E = [[] for _ in range(N + 1)]
for a, b in zip(*[iter(AB)] * 2):
    E[a].append(b)

Q = deque([1])
C = [0] * (N + 1)
while Q:
    v = Q.popleft()
    c = 0
    for u in E[v]:
        c += 1 + (c + 1 == C[v])
        C[u] = c
        Q.append(u)

print(max(C))
for b in B:
    print(C[b])
import math
n=int(input())
a=list(map(int,input().split()))
a.sort()
ls=[0]
cnt=0
for i in range(1,2**n):
  if a[i]>a[i-1]:
    cnt+=1
  ls.append(cnt)
for i in range(2**n):
  if i<2**n-1:
    lmt=n-int(math.log2(2**n-i-1))-1
    if ls[i]<lmt:
      print("No")
      break
  if i==2**n-1:
    if ls[i]<n:
      print("No")
      break
else:
  print("Yes")

### FIXED CODE ###

import math
def cmb(n,r):
  return math.factorial(n)//(math.factorial(r)*math.factorial(n-r))
n=int(input())
a=list(map(int,input().split()))
a.sort()
ls=[0]
cnt=0
for i in range(1,2**n):
  if a[i]>a[i-1]:
    cnt+=1
  ls.append(cnt)
lmt = []
for i in range(n+1):
  lmt.extend([i]*cmb(n,i))
bias = ls[-1]-lmt[-1]
jdg = 0
ulmt = 0
for i in range(n):
  jdg += ls.count(i)
  ulmt += 2**(n-i-1)
  if jdg > ulmt:
    print("No")
    exit()
for x,l in zip(ls,lmt):
  if x-l > bias:
    print("No")
    break
else:
  print("Yes")
N = int(input())
X = N // 4 + 1
Z = N // 7 + 1
Y = sum(4*a + 7*b == N for a in range(X) for b in range(Z))
if (Y != 0):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N,K = map(int,input().split())
if(N%K == 0):
  print("0")
else:
  print("1")
a, b, c = input(int(i) for i in input().split())
if a + b >= c:
  result = c + b
elif a + b < c:
  result = a + b
print(result)

### FIXED CODE ###

a, b, c = (int(i) for i in input().split())
if a + b + 1 >= c:
  result = b + c
else:
  result = a + 2 * b + 1
print(result)
f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
a=[i*100 for i in a]
# Binary Search
def ok(x):
    c=0
    for i in a:
      c+=0--i//x
    return c<=n+k
l,r=1,10**11+1
while r-l>1:
  m=l+r>>1
  if ok(m): r=m
  else: l=m
t=0--r//100
print(t-ok(t-1))

### FIXED CODE ###

f=lambda:[*map(int,input().split())]
n,k=f()
a=f()
a=[i*100 for i in a]
# Binary Search
def ok(x):
    c=0
    for i in a:
      c+=0--i//x
    return c<=n+k
l,r=0,10**11+1
while r-l>1:
  m=l+r>>1
  if ok(m): r=m
  else: l=m
t=0--r//100
print(t-ok(t-1) if t>1 else t)
N = input()
if N % 2 == 0:
  print(N)
else:
  print(2*N)

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
  print(N)
else:
  print(2*N)
while True:
    h, w = map(int, raw_input().split())

    if h == 0 and w == 0:
        break
    
    hcnt = 1
    for i in range(0, h):
        wid = ""
        if hcnt == 1 or hcnt == h:
            for j in range(0, w):
                 wid += "#"
             print wid
        else:
            wid += "#"
            for j in range(1, w-1):
                 wid += "."
            wid += "#"
            print wid
        hcnt += 1

### FIXED CODE ###

while True:
    h, w = map(int, raw_input().split())

    if h == 0 and w == 0:
        break
    
    hcnt = 1
    for i in range(0, h):
        wid = ""
        if hcnt == 1 or hcnt == h:
            for j in range(0, w):
                wid += "#"
            print wid
        else:
            wid += "#"
            for j in range(1, w-1):
                wid += "."
            wid += "#"
            print wid
        hcnt += 1
    print ""
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(5, [2, 6, 1, 4, 5])
    YES
    >>> print_ans(6, [4, 1, 3, 1, 6, 2])
    NO
    >>> print_ans(2, [10000000, 10000000])
    NO
    """
    b_list = np.zeros(10**9 + 1, dtype = int)
    flg = True
    for a in ar:
        if b_list[a] == 1:
            flg = False
            break
        b_list[a] = 1
    if flg:
        print("YES")
    else:
        print("NO")
    
    

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = list(map(int,input().rstrip().split()))
    print_ans(N, ar)




### FIXED CODE ###

import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, ar):
    """Test Case
    >>> print_ans(5, [2, 6, 1, 4, 5])
    YES
    >>> print_ans(6, [4, 1, 3, 1, 6, 2])
    NO
    >>> print_ans(2, [10000000, 10000000])
    NO
    """
    br = set(ar)
    print("YES" if len(br) == N else "NO")
    

if __name__ == '__main__':
    N = int(input().rstrip())
    ar = list(map(int,input().rstrip().split()))
    print_ans(N, ar)
w, h = list(map(int, input().split()))
xs = [int(input()) for _ in range(w)]
ys = [int(input()) for _ in range(h)]

x_cnt = w + 1
y_cnt = h + 1

i = 0
j = 0
xs.sort()
ys.sort()

ans = 0
while i < len(xs) or j < len(ys):
    if i >= len(xs) or ys[j] < xs[i]:
        ans += x_cnt * ys[j]
        j += 1
        y_cnt -= 1
    else:
        ans += y_cnt * xs[i]
        i += 1
        x_cnt -= 1
print(ans)




### FIXED CODE ###

w, h = list(map(int, input().split()))
xs = [int(input()) for _ in range(w)]
ys = [int(input()) for _ in range(h)]

x_cnt = w + 1
y_cnt = h + 1

i = 0
j = 0
xs.sort()
ys.sort()

ans = 0
while i < len(xs) or j < len(ys):
    if i >= len(xs) or (j < len(ys) and ys[j] < xs[i]):
        ans += x_cnt * ys[j]
        j += 1
        y_cnt -= 1
    else:
        ans += y_cnt * xs[i]
        i += 1
        x_cnt -= 1
print(ans)
a = raw_input()
b = raw_input()
a = int(a)
b = int(b)
s = a * b
print s

### FIXED CODE ###

l = map(int, raw_input().split())
print l[0] * l[1], 2 * (l[0] + l[1])
n,hp=map(int,input().split(" "))
la=[0 for i in range(n)]
lb=[0 for i in range(n)]
for i in range(n):
    la[i],lb[i]=map(int,input().split(" "))
cnt=0
ma=max(la)
lma=[i for i ,x in enumerate(la)  if x==ma]
mib=10**9
for i in lma:
    if lb[i]<mib:
        mib=lb[i]
        k=i
for i in range(n):
    if lb[i]>ma and i!=k:
        hp-=lb[i]
        cnt+=1
        if hp<0:
            print(cnt)
            exit(0)
        if hp<lb[k]:
            print(cnt+1)
            exit(0)
while hp>0:
    hp-=ma
    cnt+=1
    if hp<lb[k]:
        print(cnt+1)
        exit(0)
print(cnt)

### FIXED CODE ###

N,H=map(int,input().split())
ab=[]
a=[]
b=[]

for i in range(N):
    ab.append(list(map(int,input().split())))
    a.append(ab[i][0])
    b.append(ab[i][1])

a.sort(reverse=True)
b.sort(reverse=True)
k=0
cnt=0

while a[0]<b[k]:
    H-=b[k]
    cnt+=1
    if H<=0:
        break
    k+=1
    if k==len(b):
        break

#print(cnt,H)
H=max(H,0)

if H%a[0]==0:
    cnt+=H//a[0]
else:
    cnt+=H//a[0]+1

print(cnt)
N = int(input())
X = input()
popcount_X = X.count('1')
numX = int(X, 2)
a, b = numX % (popcount_X + 1), numX % (popcount_X - 1)
for i, x in enumerate(X, 1):
    if x == '1' and popcount_X == 1:
        print(0); continue
    ans = 1
    if x == '1':
        temp = (b - pow(2, N-i, popcount_X - 1)) % (popcount_X - 1)
    else:
        temp = (a + pow(2, N-i, popcount_X + 1)) % (popcount_X + 1)
    while temp:
        p = bin(temp)[2:].count('1')
        temp %= p
        ans += 1
    print(ans)

### FIXED CODE ###

N = int(input())
X = input()
popcount_X = X.count('1')
numX = int(X, 2)
a, b = numX % (popcount_X + 1), numX % (popcount_X - 1) if popcount_X != 1 else 0
for i, x in enumerate(X, 1):
    if x == '1' and popcount_X == 1:
        print(0); continue
    ans = 1
    if x == '1':
        temp = (b - pow(2, N - i, popcount_X - 1)) % (popcount_X - 1)
    else:
        temp = (a + pow(2, N - i, popcount_X + 1)) % (popcount_X + 1)
    while temp:
        p = format(temp, 'b').count('1')
        temp %= p
        ans += 1
    print(ans)
import sys
sys.setrecursionlimit(10000)


def add_node_2_tree_dic(tree_dic, x, y):
    if x not in tree_dic:
        tree_dic[x] = [y]
    else:
        tree_dic[x].append(y)

#   深さ優先探索で行けそう

N = int(input())
tree_dic = {}
for _ in range(N-1):
    a, b = map(int, input().split())
    add_node_2_tree_dic(tree_dic, a, b)
    add_node_2_tree_dic(tree_dic, b, a)

c_lst = list(map(int, input().split()))
c_lst.sort()
ans_lst = [0]*N

def search_next_node_and_add_side_wate(tree_dic, ans, current_node, c_lst, ans_lst):
    
    if len(tree_dic) == 0:  #   これなしでいい？
        return ans
    for next_node in tree_dic[current_node]:    #   ここでエラーになる理由をJupyterでテストしつつ理解する
#        if next_node not in tree_dic[current_node]:#   これなしでいい？
#            print("second time")
#            continue    #   深さ優先探索の過程ですでに通ったノードをもう一度通ろうとしたとき
#        else:
        c = c_lst.pop()
        ans += c
        ans_lst[next_node - 1] = c

        tree_dic[current_node].remove(next_node)    #   今回通った枝を取り払う
        tree_dic[next_node].remove(current_node)
        if len(tree_dic[current_node]) == 0:
            del tree_dic[current_node]#   探索し終えたノードの削除
        if len(tree_dic[next_node]) == 0:
            del tree_dic[next_node]#   探索し終えたノードの削除
#                print()
            
        else:   #   次のノードにつながっている辺があるとき
            ans = search_next_node_and_add_side_wate(tree_dic, ans, next_node, c_lst, ans_lst)

    return ans


ans = 0
current_node = 1
ans_lst[0] = c_lst.pop()
ans = search_next_node_and_add_side_wate(tree_dic, ans, current_node, c_lst, ans_lst)


ans_str = ""
for i in range(N):
    ans_str += str(ans_lst[i])
    if i != N - 1:
        ans_str += " "


print(ans)
print(ans_str)


### FIXED CODE ###

import sys
sys.setrecursionlimit(20000)

def add_node_2_tree_dic(tree_dic, x, y):
    if x not in tree_dic:
        tree_dic[x] = [y]
    else:
        tree_dic[x].append(y)

#   深さ優先探索で行けそう

N = int(input())
tree_dic = {}
for _ in range(N-1):
    a, b = map(int, input().split())
    add_node_2_tree_dic(tree_dic, a, b)
    add_node_2_tree_dic(tree_dic, b, a)

c_lst = list(map(int, input().split()))
c_lst.sort()
ans_lst = [0]*N

def search_next_node_and_add_side_wate(tree_dic, ans, current_node, c_lst, ans_lst):
    next_node_lst = tree_dic[current_node][:]

    for next_node in next_node_lst:
        c = c_lst.pop()
        ans += c
        ans_lst[next_node - 1] = c

        tree_dic[current_node].remove(next_node)    #   今回通った枝を取り払う
        tree_dic[next_node].remove(current_node)

        if len(tree_dic[current_node]) == 0:
            del tree_dic[current_node]#   探索し終えたノードの削除
        if len(tree_dic[next_node]) == 0:
            del tree_dic[next_node]#   探索し終えたノードの削除
        else:   #   次のノードにつながっている辺があるとき
            ans = search_next_node_and_add_side_wate(tree_dic, ans, next_node, c_lst, ans_lst)

    return ans


ans = 0
current_node = 1
ans_lst[0] = c_lst.pop()
ans = search_next_node_and_add_side_wate(tree_dic, ans, current_node, c_lst, ans_lst)


ans_str = ""
for i in range(N):
    ans_str += str(ans_lst[i])
    if i != N - 1:
        ans_str += " "


print(ans)
print(ans_str)
N = int(input())
S = list(input())
count_E = S.count("E")
count_W = 0
count = count_E + count_W
ans = count + 1
for e in range S:
    if e == "E":
        count_E -= 1
    elif e == "W":
        count_W += 1
    if count < ans :
        ans = count
print(ans)

### FIXED CODE ###

N = int(input())
S = list(input())
count_E = S.count("E")
count_W = 0
ans = count_E
for i in range(N):
    if S[i] == "E":
        count_E -= 1
    if S[i-1] == "W" and i != 0:
        count_W += 1
    if count_E + count_W < ans :
        ans = count_E + count_W
print(ans)
# coding: utf-8
# Your code here!

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

print(max(0,a-2b))

### FIXED CODE ###

# coding: utf-8
# Your code here!

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

print(max(0,a-2*b))
N, L = map(int, input().split())
s = []
ans = []
dj = list(arange(N))
for i in range(N):
    s.append(input())
s = sorted(s)
ans = "".join(s)

### FIXED CODE ###

N, L = map(int, input().split())
s = []
for i in range(N):
    s.append(input())
s = sorted(s)
ans = "".join(s)
print(ans)
a,b=int(input().split())
s=0
g=0
if a==1:
  s=300000
elif a==2:
  s=200000
elif a==3:
  s=100000
else:
  pass
if b==1:
  g=300000
elif b==2:
  g=200000
elif b==3:
  g=100000
else:
  pass
if a=1 and b=2:
  print(g+s+400000)
else:
  print(s+g)

### FIXED CODE ###

a,b=map(int,input().split())
s=0
g=0
if a==1:
  s=300000
elif a==2:
  s=200000
elif a==3:
  s=100000
else:
  s=0
if b==1:
  g=300000
elif b==2:
  g=200000
elif b==3:
  g=100000
else:
  g=0
if a==1 and b==1:
  print(g+s+400000)
else:
  print(s+g)
#!python3.4.3

x_str = input()
x = int(x_str)

a = int(x_str[:-2])
b = int(x_str[-2:])

if a > b:
    print(1)
else:
    count = 0
    d = b
    for i in range(5, 0, -1):
        if d % i == 0:
            print(1)
            break
        c = d // i
        count += c
        if a < count:
            print(0)
            break
        d = d - c*i

### FIXED CODE ###

#!python3.4.3

x_str = input()
x = int(x_str)

if x < 100:
    print(0)
else:
    a = int(x_str[:-2])
    b = int(x_str[-2:])

    if a > b:
        print(1)
    else:
        count = 0
        d = b
        for i in range(5, 0, -1):
            c = d // i
            count += c
            if a < count:
                print(0)
                break
            if d % i == 0:
                print(1)
                break
            d = d - c*i
from collections import Counter
n, k = map(int, input().split())
a = Counter((i for i in input().split()))

sort_count = sorted(a.items(), key=lambda x: x[1])

total = 0
for i in range(k):
    total += sort_count[i][1]

print(n-total)


### FIXED CODE ###

from collections import Counter


n, k = map(int, input().split())
a = Counter((i for i in input().split()))

sort_count = sorted(a.values())


total = 0
l = len(sort_count)

if len(sort_count) <= k:
    print(0)
else:
    print(sum(sort_count[:l-k]))
# Aizu Problem 00150: Twin Prime
#
import sys, math, os, bisect

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def primes2(n):
    """ Input n>=6, Returns a list of primes, 2 <= p < n """
    n, correction = n-n%6+6, 2-(n%6>1)
    sieve = [True] * (n//3)
    for i in range(1,int(n**0.5)//3+1):
      if sieve[i]:
        k=3*i+1|1
        sieve[      k*k//3      ::2*k] = [False] * ((n//6-k*k//6-1)//k+1)
        sieve[k*(k-2*(i&1)+4)//3::2*k] = [False] * ((n//6-k*(k-2*(i&1)+4)//6-1)//k+1)
    return [2,3] + [3*i+1|1 for i in range(1,n//3-correction) if sieve[i]]

primes = primes2(10000)

while True:
    n = int(input())
    if n == 0:
        break
    idx = bisect.bisect_left(primes, n)
    while True:
        #if idx == len(primes):
        #    idx -= 1
        if primes[idx] >= n:
            idx -= 1
        if primes[idx] - primes[idx - 1] == 2:
            print(primes[idx - 1], primes[idx])
            break
        idx -= 1

### FIXED CODE ###

# Aizu Problem 00150: Twin Prime
#
import sys, math, os, bisect

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")


def primes2(n):
    """ Input n>=6, Returns a list of primes, 2 <= p < n """
    n, correction = n-n%6+6, 2-(n%6>1)
    sieve = [True] * (n//3)
    for i in range(1,int(n**0.5)//3+1):
      if sieve[i]:
        k=3*i+1|1
        sieve[      k*k//3      ::2*k] = [False] * ((n//6-k*k//6-1)//k+1)
        sieve[k*(k-2*(i&1)+4)//3::2*k] = [False] * ((n//6-k*(k-2*(i&1)+4)//6-1)//k+1)
    return [2,3] + [3*i+1|1 for i in range(1,n//3-correction) if sieve[i]]

primes = primes2(10050)

while True:
    n = int(input())
    if n == 0:
        break
    idx = bisect.bisect_left(primes, n)
    while True:
        #if idx == len(primes):
        #    idx -= 1
        if primes[idx] > n:
            idx -= 1
        if primes[idx] - primes[idx - 1] == 2:
            print(primes[idx - 1], primes[idx])
            break
        idx -= 1