Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10**6)

def count(s: str):
    p=0
    for i in range(len(s)):
        if s[i]=="D":
            p+=1
        if s[i]=="P":
            if i<len(s)-1 and s[i+1]=="D":
                p+=1
    return p


t=input()

#print(len(t))

a=[]
j=0
for i in range(len(t)):
    if t[i]=="?":
        a.append(i)
        j+=1       
#print(a)

s=j
tt=t
#print(tt[1])
tt_list=list(tt)
#print(tt_list)

max_score=0
for i in range(2**s):
#    bin_str=bin(i).zfill(s+2)
    bin_str=format(i,'b').zfill(s)
#    print("bin_str=",bin_str)
#    print(bin_str[1])
    for j in range(len(bin_str)):
        if bin_str[j]=="0":
            tt_list[a[j]]="P"
        else: # :1
            tt_list[a[j]]="D"
    score=count("".join(tt_list))
#    print(score)
#    print("".join(tt_list))
    max_score=max(max_score,score)

for i in range(2**s):
    bin_str=format(i,'b').zfill(s)
#    print("bin_str=",bin_str)
#    print(bin_str[1])
    for j in range(len(bin_str)):
        if bin_str[j]=="0":
            tt_list[a[j]]="P"
        else: # :1
            tt_list[a[j]]="D"
    score=count("".join(tt_list))
    if score==max_score:
        print("".join(tt_list))
        exit()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

t=input()

a=[]
j=0
for i in range(len(t)):
    if t[i]=="?":
        a.append("D")
    else:
        a.append(t[i])

print("".join(a))
#print(a)
a,b = [int(i) i for i in input().split()]
if a*b == 15:
  print('*')
elif a+b == 15:
  print('+')
else:
  print('x')

### FIXED CODE ###

a,b = [int(i) for i in input().split()]

if a+b == 15:
    print('+')
elif a*b == 15:
    print('*')
else:
    print('x')
def gcd(a,b):
    if a%b==0:
        return b
    else:
        return gcd(b,a%b)

def gcd_list(lst):
    if len(lst)==2:
        return gcd(lst[0],lst[1])
    else:
        return gcd_list([gcd(lst[0],lst[1])]+lst[2:])

n,*h=map(int,open(0).read().split())

print(gcd_list(h))

### FIXED CODE ###

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

n,*h=map(int,open(0).read().split())

gh=gcd(h[0],h[1])
for i in range(2,n):
    gh=gcd(h[i],gh)

print(gh)
import sys
from math import factorial
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
def main():
    n, k = list(map(int, input().split()))
    modulo = 1000_000_000 + 7

    def combinations_count(n, r):
        return factorial(n) // (factorial(n - r) * factorial(r))

    for i in range(1, k+1):
        if i > n//2 + 1:
            print(0)
            continue
        # i分割する方法
        a = combinations_count(k-1, i-1) % modulo
        # 赤のボールを分割する方法
        b = combinations_count(n-k+1, i) % modulo
        print(a * b % modulo)

main()



### FIXED CODE ###

from operator import mul
from functools import reduce


def cmb(n, r):
	if n < r:
		return 0
	r = min(n - r, r)
	if r == 0:
		return 1
	numer = reduce(mul, range(n, n - r, -1))
	denom = reduce(mul, range(1, r + 1))
	return numer // denom % INF


N, K = map(int, input().split())
INF = 10 ** 9 + 7

for i in range(1, K + 1):
	print(cmb(K - 1, i - 1) * cmb(N - K + 1, i) % INF)
a1,a2,a3 = input().split()
if(a1+a2+a3<22):
 print("win")
else:
 print("bust")


### FIXED CODE ###

a1,a2,a3 = map(int,input().split())
if(a1+a2+a3<22):
 print("win")
else:
 print("bust")
c = 0

while True:
    x = int(input())
　　c +=1
    
    if x == 0:
        break
   
    print("Case {}: {}".format(c, x))


### FIXED CODE ###

c = 0

while True:
    x = int(input())
    c +=1
    
    if x == 0:
        break
   
    print("Case {}: {}".format(c, x))
import numpy as np
 
N, M = map(int, input().split())
base = [[int(l) for l in input().split()] for i in range(M)]
sort_target = np.sort(base, axis=0).tolist()
 
prefecture_index = sort_target[0][0]
i=0
result = []
for target in sort_target:
  i = i + 1 if prefecture_index == target[0] else 1
  prefecture_index = target[0]
  result.append([base.index(target), "{:0=6}{:0=6}".format(target[0], i)])
sorted_result = sorted(result)
 
for result in sorted_result:
  print(result[1])

### FIXED CODE ###

N, M = map(int, input().split())
base = []
for i in range(M):
  (a, b) = map(int, input().split())
  base.append((a, b, i))
sorted_target = sorted(base) 

prefecture_index = sorted_target[0][0]

i=0
result = {}

for target in sorted_target:
  if prefecture_index == target[0]:
    i+=1
  else:
    prefecture_index = target[0]
    i = 1
  result[target[2]] = [prefecture_index, i]

for i in range(M):
  print("{:0=6}{:0=6}".format(result[i][0], result[i][1]))
N,X=map(int,input().split())
L=list(map(int,input().split()))
count=1
tmp=0
for i in range(N):
  tmp+=L[i]
  if tmp<=X:
    count+=1
print(count)

### FIXED CODE ###

X, A = map(int,input().split())
if X < A:
  print(0)
else:
  print(10)
x=int(input())
x1=int(input())
print(x*x1, (x+x1)*2)

### FIXED CODE ###

a,b=map(int,input().split())
print(a*b,(a+b)*2)
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, X, mod = mapint()
first = set()
second = set()
in_loop = []
ans = 0
for i in range(min(10**5*2, N)):
    if X in first:
        if X in second:
            break
        in_loop.append(X)
        second.add(X)
    first.add(X)
    ans += X
    X = pow(X, 2, mod)
else:
    print(ans)

loop_len = len(in_loop)
rest = N-len(first)-len(in_loop)
ans += (rest//loop_len)*sum(in_loop)
amari = rest%loop_len
for i in range(amari):
    ans += in_loop[i]
print(ans)

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, sX, mod = mapint()

X = sX
s = set()
s.add(X)
s_loop = set()
ans = X
loop = 0
loops = []
i = -1
for i in range(min(10**5*2+10, N-1)):
    X = pow(X, 2, mod)
    if X in s:
        if X in s_loop:
            loops.append(X)
            break
        loop += X
        s_loop.add(X)
        loops.append(X)
    s.add(X)
    ans += X

rest = N-i-2
if rest:
    ans += (rest//len(s_loop))*loop
    amari = rest%len(s_loop)+1
    for i in range(amari):
        ans += loops[i]
    print(ans)
else:
    print(ans)
def Warshall_Floyd(d):
    #dist[i][j]:iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k]+d[k][j])
    return d
############################
n, m, l = map(int, input().split())

f_inf = float('inf')
dist = [[f_inf for _ in range(n)] for _ in range(n)]
for i in range(m): dist[i][i] = 0

for _ in range(m):
    a, b, c = map(int, input().split())
    dist[a-1][b-1] = c
    dist[b-1][a-1] = c

Warshall_Floyd(dist)

dist2 = [[f_inf for _ in range(n)] for _ in range(n)]
for i in range(n):
    for j in range(n):
        if dist[i][j] <= l:
            dist2[i][j] = 1

Warshall_Floyd(dist2)

q = int(input())
for _ in range(q):
    s, t = map(int, input().split())
    ans = dist2[s-1][t-1] 
    if dist2[s-1][t-1] == f_inf:
      ans = -1
      
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N, M, L = map(int, input().split())
    dist = [[float('inf')] * N for _ in range(N)]
    for _ in range(M):
        A, B, C = map(int, input().split())
        if C > L:
            continue
        A -= 1
        B -= 1
        dist[A][B] = C
        dist[B][A] = C

    for k in range(N):
        for i in range(N):
            for j in range(N):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

    e = [[float('inf')] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if dist[i][j] <= L:
                e[i][j] = 1
    
    for k in range(N):
        for i in range(N):
            for j in range(N):
                e[i][j] = min(e[i][j], e[i][k] + e[k][j])


    Q = int(input())
    for _ in range(Q):
        s, t = map(int, input().split())
        s -= 1
        t -= 1
        if e[s][t] == float('inf'):
            print(-1)
            continue
        ans = e[s][t]
        print(ans-1)


if __name__ == "__main__":
    main()
x,y=map(int,input().split())
if x>y:
  x,y=y,x

A=[1,3,5,,7,8,10,12]
B=[4,6,9,11]

if x==2 or y==2:
  print('No')
elif (x in A and y in B):
  print('No')
else:
  print('Yes')


### FIXED CODE ###

x,y=map(int,input().split())
 
A=[1,3,5,7,8,10,12]
B=[4,6,9,11]
 
if x==2 or y==2:
  print('No')
elif (x in A and y in A) or (x in B and y in B):
  print('Yes')
else:
  print('No')
def binary_search(cards,n,number):
    low=0
    high=len(cards)-1

    while high-low>1:
        mid=(low+high)//2
        base=cards[mid]
        if base==number:
            for i in range(n):
                cards.insert(mid,number)
            return cards,mid
        if base<number:
            low=mid
        else:
            high=mid

    if cards[high]==cards[low]:
        if number>cards[high]:
            for i in range(n):
                cards.insert(high+1, number)
        else:
            for i in range(n):
                cards.insert(low, number)
    else:
        for i in range(n):
            cards.insert(high,number)
    return cards,mid

#1 3 5 7 9 11 <=8
#1 3 [5] 7 9 11 <= 8
#1 3 (5) 7 9 (11) <=8
#1 3 5 [7] 9 11 <= 8
#1 3 5 (7) 9 (11) <= 8
#1 3 5 7 [9] 11 <= 8
#1 3 5 (7) (9) 11
#1 3 5 [7] 9 11 <=8
#1 3 5 (7)

def main():
    inp1=list(map(lambda x:int(x),input().split()))
    cards=list(map(lambda x:int(x),input().split()))
    N=inp1[0]
    M=inp1[1]
    B=[]
    C=[]
    for i in range(M):
        changes=list(map(lambda x:int(x),input().split()))
        B.append(changes[0])
        C.append(changes[1])

    cb=zip(C,B)
    cb=sorted(cb)
    C,B=zip(*cb)

    cards.sort()

    for i in range(M):
        cards,pointer=binary_search(cards,B[i],C[i])
        if len(cards)-pointer>N:
            break
    cards=cards[len(cards)-N:len(cards)]

    print(sum(cards))

if __name__=="__main__":
    main()

### FIXED CODE ###

from heapq import heappush,heappop

def main():
    inp1=list(map(lambda x:int(x),input().split()))
    cards=list(map(lambda x:int(x),input().split()))
    cards_heap=[]
    for i in cards:
        heappush(cards_heap,i)

    N=inp1[0]
    M=inp1[1]
    B=[]
    C=[]
    for i in range(M):
        changes=list(map(lambda x:int(x),input().split()))
        B.append(changes[0])
        C.append(changes[1])

    cb=zip(C,B)
    cb=sorted(cb,reverse=True)


    for C,B in cb:
        for _ in range(B):
            a=heappop(cards_heap)
            if C>a:
                heappush(cards_heap,C)
            else:
                heappush(cards_heap,a)
                break

    print(sum(cards_heap))

if __name__=="__main__":
    main()
import fractions

primes = [2]


def is_prime(n):
    for p in primes:
        if p * p > n:
            break
        if n % p == 0:
            return False

    return True


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

G = fractions.gcd(A, B)

res = 1

if G % 2 == 0:
    res += 1
    G /= 2

for i in range(3, G, 2):
    if i > G:
        break
    if not is_prime(i):
        continue
    primes.append(i)
    if G % i == 0:
        res += 1
        G /= i

if G > 1 and is_prime(G) and G not in primes:
    res += 1

print(res)


### FIXED CODE ###

import fractions

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

G = fractions.gcd(A, B)

res = 1

for i in [2] + list(range(3, int(G ** 0.5) + 1, 2)):
    if G % i == 0:
        res += 1
        while G % i == 0:
            G //= i

if G > 2:
    res += 1

print(res)
n,a,b,c,d = ( int(i) for i in input().split())
s = input()

a_to_c = s[a-1:c-1]
b_to_d = s[b-1:d-1]
if (b-1)-1 >= 0:
    b_to_d2 = s[b-1-1:d-1]
else:
    b_to_d2 = s[b-1:d-1]

possibility = True

if a_to_c.find("##")!=-1 or b_to_d.find("##")!=-1:
    possibility = False
if c>d:
    if s[d-1]='#':
        if not(s[b-3:d-1].find("...")!=-1):
            possibility = False
    if not(b_to_d2.find('...')!=-1):
        possibility = False


if possibility:
    print("Yes")
else:
    print("No")
    

### FIXED CODE ###

n,a,b,c,d = ( int(i) for i in input().split())
s = input()

a_to_c = s[(a-1)+1:(c-1)-1 +1]

possibility = True

if c>d:
    b_to_d = s[(b-1)-1:(d-1)+1 +1]
    if "##" in a_to_c or "..." not in b_to_d:
        possibility = False
else:
    b_to_d = s[(b-1)+1:(d-1)-1 +1]
    if "##" in a_to_c or "##" in b_to_d:
        possibility = False

if possibility:
    print("Yes")
else:
    print("No")
while True:
 n,x=map(int,raw_input().split())
 if n==0 && x==0:break
 count=0
 for i in range(1,n+1):
  for j in range(i+1,n+1):
   for k in range(j+1,n+1):
    print str(i)+" "+str(j)+" "+str(k)
    if i+j+k==x:
	 count+=1	 
 print count

### FIXED CODE ###

while True:
 n,x=map(int,raw_input().split())
 if n==0 and x==0:break
 count=0
 for i in range(1,n+1):
  for j in range(i+1,n+1):
   for k in range(j+1,n+1):
    
    if i+j+k==x:
	 count+=1	 
 print count
#coding: utf-8
from collections import deque
N, M = map(int, input().split())
dd = {i:[] for i in range(N)}
for i in range(N):
    d[i][i] = 0
for i in range(M):
    a, b = map(int, input().split())
    dd[a-1].append(b-1)
    dd[b-1].append(a-1)
ans = [0 for _ in range(N)]
visited = [False for _ in range(N)]
queue = []
for i in range(len(dd[0])):
    queue.append([0, dd[0][i]])
queue = deque(queue)
while queue:
    q = queue.popleft()
    if visited[q[1]]:
        continue
    visited[q[1]] = True
    ans[q[1]] = q[0] + 1
    for v in dd[q[1]]:
        if not visited[v]:
            queue.append([q[1], v])
print("Yes")
print(*ans[1:], sep="\n")


### FIXED CODE ###

#coding: utf-8
from collections import deque
N, M = map(int, input().split())
dd = {i:[] for i in range(N)}
for i in range(M):
    a, b = map(int, input().split())
    dd[a-1].append(b-1)
    dd[b-1].append(a-1)
ans = [0 for _ in range(N)]
visited = [False for _ in range(N)]
queue = []
for i in range(len(dd[0])):
    queue.append([0, dd[0][i]])
queue = deque(queue)
while queue:
    q = queue.popleft()
    if visited[q[1]]:
        continue
    visited[q[1]] = True
    ans[q[1]] = q[0] + 1
    for v in dd[q[1]]:
        if not visited[v]:
            queue.append([q[1], v])
print("Yes")
print(*ans[1:], sep="\n")
s = input()

a = int(s[:2])
b = int(s[2:])

if a == 0 and b == 0
  print("NA")
elif a > 12 and b <= 12:
  print("YYMM")
elif a <= 12 and b > 12:
  print("MMYY")
elif a <= 12 and b <= 12: 
  print("AMBIGUOUS")
else:
  print("NA")  

### FIXED CODE ###

s = input()

a = int(s[:2])
b = int(s[2:])

if (a == 00 or a > 12) and b <= 12 and b >= 1:
  print("YYMM")
elif a <= 12 and a >= 1 and (b == 00 or b > 12):
  print("MMYY")
elif a <= 12 and a >= 1 and b <= 12 and b >= 1:
  print("AMBIGUOUS")
else:
  print("NA")
while True:
    n = input()
 
    if n == "0000":
        break
    if n.count(n[0]) == 4:
        print("NA")
        continue
 
    cnt = 0
    while n != "6174":
        n, l = sorted(list(n)), sorted(list(n), reverse=True)
        n = str(int("".join(l)) - int("".join(n))).zfill(4)
        cnt += 1
 
    print(cnt)

### FIXED CODE ###

while True:
    n = input()
 
    if n == "0000":
        break
    if n.count(n[0]) == 4:
        print("NA")
        continue
 
    cnt = 0
    while n != "6174":
        n, l = sorted(list(n)), sorted(list(n), reverse=True)
        n = str(int("".join(l)) - int("".join(n))).zfill(4)
        cnt += 1
 
    print(cnt)
import numpy as np

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

print(np.lcm(A,B))

### FIXED CODE ###

# import math
import fractions # Python 3.4ではこちらにgcdがある

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

def lcm(A,B):
    return A * B // fractions.gcd(A,B)

print(lcm(A,B))
x=int(input())
beki=[]
for i in range(1,33):
    for j in range(2,10):
        if (i**j<x):
            beki.append(i**j)
print(max(beki))

### FIXED CODE ###

x=int(input())
beki=[]
for i in range(1,33):
    for j in range(2,10):
        if (i**j<=x):
            beki.append(i**j)
print(max(beki))
a = int(input())
b = int(input())
al = [1,2,3]

remain = al.remove(a)
re_remain = remain.remove(b)
print(re_remain[0])



### FIXED CODE ###

a = int(input())
b = int(input())
al = [1,2,3]

al.remove(a)
al.remove(b)
print(al[0])
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a.sort(reverse = True)
b.sort(reverse = True)
cnt = 0
while(min(a[-1],b[-1]) <= k):
    if a[-1] == min(a[-1],b[-1]):
        k = k-min(a[-1],b[-1])
        a.pop()

    else:
        k = k-min(a[-1],b[-1])
        b.pop()

    cnt = cnt+1

print(cnt)

### FIXED CODE ###

n,m,k = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
a = [0]
b = [0]
for i in range(n):
    a.append(a[i]+A[i])

for i in range(m):
    b.append(b[i]+B[i])

i = 0
ans = 0
j = m
while(i < len(a)):
    if a[i] > k:
        break

    else:
        while(b[j] > k-a[i]):
            j = j-1

        ans = max(ans,i+j)

    i = i+1

print(ans)
i=input()
n=len(i)

res=0
for i in range(n):
  for j in range(i,n):
    sub=s[i:j+1]
    flg=True
    for k in sub:
      if(k not in ['A','G','C','T']):
        flg=False
    if(flg):
      res=max(res,len(sub))
      
print(res)

### FIXED CODE ###

s=input()
n=len(s)
 
res=0
for i in range(n):
  for j in range(i,n):
    sub=s[i:j+1]
    flg=True
    for k in sub:
      if(k not in ['A','G','C','T']):
        flg=False
    if(flg):
      res=max(res,len(sub))
      
print(res)
import numpy as np
n = int(input())
a = list(map(int, input().split()))
res = np.prod(a)
if res > (10**18):
    print(-1)
else:
    print(res)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
res = 1
A.sort()
for i in range(N):
    res *= A[i]
    if res > (10 ** 18):
        print(-1)
        exit()
    elif res == 0:
        print(0)
        exit()
print(res)
def a():
    n = int(input()) % 10
    if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
        print('hon')
    elif n == 3:
        print('bon')
    else:
        print('pon')




def b():

def c():
    

# def d():


a()

### FIXED CODE ###

def a():
    n = int(input()) % 10
    if n == 2 or n == 4 or n == 5 or n == 7 or n == 9:
        print('hon')
    elif n == 3:
        print('bon')
    else:
        print('pon')




# def b():

# def c():
    

# def d():


a()
A = list(int, input().split())

for i in A:
  if 0 == A[i]:
    print(i + 1)
   

### FIXED CODE ###

l = list(map(int,input().split()))
print (l.index(0)+1)
a = int(input())
b = input()

if a>+= 3200:
  print('red')
else:
  print(b)

### FIXED CODE ###

a = int(input())
b = input()

if a>= 3200:
  print(b)
else:
  print('red')
S = input()
if re.match("^(dream|dreamer|erase|eraser)+$", S):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

import re
S = input()
'''
メタ文字：
^ = 文字列の先頭、
| = OR
+ = 直前のパターンを1回以上繰り返し、
$ = 文字列の末尾
'''
if re.match("^(dream|dreamer|erase|eraser)+$", S):
    print('YES')
else:
    print('NO')
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import heapq

N, D, A = map(int, readline().split())
m = map(int,read().split())
XH = list(zip(m,m))
heapq.heapify(XH)
width = 2*D

ans = 0
while len(XH) != 0:
  xh_min = heapq.heappop(XH)
  # left + D の位置で攻撃する
  left = xh_min[0]
  right = left + width
  nAttack = (xh_min[1] + A - 1) // A
  damage = nAttack * A
    
  target = []
  while len(XH) != 0:
    xh = heapq.heappop(XH)
    if xh[0] <= right:
      if xh[1] > damage:
        target.append(xh)
    else:
      heapq.heappush(XH, xh)
      break
  if len(XH) == 0:
    maxH = max(xh_min[1], target[-1][1])
    nAttack = (maxH + A - 1) // A
    ans += nAttack
  else:
    ans += nAttack
    for t in target:
      heapq.heappush(XH, (t[0], t[1] - damage))
  
print(ans)


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import heapq

N, D, A = map(int, readline().split())
m = map(int,read().split())
XH = list(zip(m,m))
heapq.heapify(XH)
width = 2*D

ans = 0
while len(XH) != 0:
  xh_min = heapq.heappop(XH)
  # left + D の位置で攻撃する
  left = xh_min[0]
  right = left + width
  nAttack = (xh_min[1] + A - 1) // A
  damage = nAttack * A
    
  target = []
  while len(XH) != 0:
    xh = heapq.heappop(XH)
    if xh[0] <= right:
      if xh[1] > damage:
        target.append(xh)
    else:
      heapq.heappush(XH, xh)
      break
  if len(XH) == 0:
    maxH = xh_min[1]
    if len(target):
      maxH = max(xh_min[1], max([t[1] for t in target]))
    nAttack = (maxH + A - 1) // A
    ans += nAttack
  else:
    ans += nAttack
    for t in target:
      heapq.heappush(XH, (t[0], t[1] - damage))
  
print(ans)
n = int(input())
ac = wa = tle = re = 0
for i in range(n):
  m = int(input())
  if m == 'AC':
    ac += 1
  elif m == 'WA':
    wa += 1
  elif m == 'TLE':
    tle += 1
  else:
    re += 1
print('AC x', ac)
print('WA x', wa)
print('TLE x', tle)
print('RE x', re)

### FIXED CODE ###

n = int(input())
ac = wa = tle = re = 0
for i in range(n):
  m = input()
  if m == 'AC': ac += 1
  elif m == 'WA': wa += 1
  elif m == 'TLE': tle += 1
  else: re += 1
print('AC x', ac)
print('WA x', wa)
print('TLE x', tle)
print('RE x', re)
n=int(input())
l=[]
for i in range(n):
  a=int(input())
  l.append(1/a)

print(sum(l))

### FIXED CODE ###

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

ll=[1/x for x in l]

print(1/sum(ll))
S,W=map(int,input().split())
if W>=s:
  print("unsafe")
else:
  print("safe")

### FIXED CODE ###

S,W=map(int,input().split())
if W>=S:
  print("unsafe")
else:
  print("safe")
m,n = map(int,input().split())
a = []*m
b = []*n
flag = False
for i in range(m):
    a.append(input())
for j in range(n):
    b.append(input())

for i in range(0, m-n):#比較開始を縦方向に動かす
    for j in range(0, m-n):#比較開始を横方向へ動かす
        for k in range(0,n):
            if b[k] != a[i][j:j+n]:
                break
            flag = True

if flag:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

s = input()
n = len(s)
ans = 0
for i in range(n):
    if s[i] == 'A':
        ans -= i
##        print('i')
        break

for j in reversed(range(0, n)):
    if s[j] == 'Z':
        ans += j
        break

print(ans + 1)
s = input()
ss = []

key = s[0]
cnt = 1
for i in range(1,len(s)):
    if key == s[i]:
        cnt += 1
    else:
        ss.append(cnt)
        key = s[i]
        cnt = 1

ss.append(cnt)

ans = 0
maxs = max(ss)
#print(ss)
# 端かどうかの判定。端ならそのまま。
if len(ss)==2:
    ans = maxs
elif max(ss[1:len(s)-1]) < maxs and ss[0] != ss[len(ss)-1]:
    ans = maxs
# 端じゃないなら、短いほうも入る
else:
    ans = maxs + min(ss[0],ss[len(ss)-1])

print(ans)


### FIXED CODE ###

import math

s = input()
minpos = len(s)

for i in range(1,len(s)):
    if s[i] != s[i-1]:
        pos = max(i,len(s)-i)

        if pos < minpos:
            minpos = pos

print(minpos)
import math
input = list(map(int,input().split()))
A = input[0]
B = input[1]
C = input[2]
D = input[3]

betweenAandB = B-A+1

cA = math.ceil(A/C)
cB = int(B/C)
cDiv = cB - cA + 1

dA = math.ceil(A/D)
dB = int(B/D)
dDiv = dB - dA + 1

GCD = math.gcd(C,D)
LCM = C*D/GCD

lcmA = math.ceil(A/LCM)
lcmB = int(B/LCM)
lcmDiv = max(lcmA, lcmB) - min(lcmA, lcmB) + 1

ans = betweenAandB - cDiv - dDiv + lcmDiv
print(ans)


### FIXED CODE ###

import math
A,B,C,D = map(int, input().split())

def gcd(x, y):
    while y != 0:
        (x, y) = (y, x % y)
    return x

betweenAandB = B-A+1

cA = (A-1)//C
cB = B//C
cDiv = cB - cA

dA = (A-1)//D
dB = B//D
dDiv = dB - dA

GCD = gcd(C,D)
LCM = C*D//GCD

lcmA = (A-1)//LCM
lcmB = B//LCM
lcmDiv = lcmB - lcmA

ans = betweenAandB - cDiv - dDiv + lcmDiv
print(ans)
W, H, x, y = map(int, input().split())

if (W == x and H == Y):
    res1 = W * H / 2
    res2 = 0
else:
    tate1 = (W - x) * H
    tate2 = x * H 
    tate = min(tate1, tate2)

    yoko1 = W * (H - y)
    yoko2 = W * y
    yoko = min(yoko1, yoko2)

    res1 = max(yoko, tate)
    res2 = int(yoko == tate)

print(res1, res2)

### FIXED CODE ###

W, H, x, y = map(int, input().split())
     
res1 = W * H / 2
res2 = int((2*x == W) and (2*y == H))
     
print(res1, res2)
import math
r=int(input())
x=r*math.pi
print("{:.6f}".format(r*x)+' '+"{:.6f}".format(2*x))

### FIXED CODE ###

from math import pi
r=float(input())
print("{} {}".format(r*r*pi,2*r*pi))