Harryxun/stf_run huggingface dataset:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    d = collections.defaultdict(set)
    for _ in range(n-1):
        a,b = LI()
        d[a].add(b)
        d[b].add(a)

    if n > 10**4*9.9:
        raise 't'

    f = collections.defaultdict(bool)
    rf = False
    def g(s, h, m):
        t = list(d[s] - set([m]))[-1]
        if len(d[t]) > 2:
            if h:
                if f[t]:
                    return True
                f[t] = True
            else:
                d[t].remove(s)
                d[s].remove(t)
                rf = True
            return False
        if len(d[t]) == 1:
            return not h
        return g(t,not h,s)

    tt = True
    gf = collections.defaultdict(bool)
    while tt:
        if rf:
            gf = collections.defaultdict(bool)
            f = collections.defaultdict(bool)
            rf = False
        tt = False
        for k,v in list(d.items()):
            if len(v) == 1:
                if gf[k]:
                    continue
                gf[k] = True
                res = g(k, True, -1)
                if res:
                    return 'First'
                tt = True
    return 'Second'


print(main())


### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    d = collections.defaultdict(set)
    kk = None
    for _ in range(n-1):
        a,b = LI()
        kk = [a,b]
        d[a].add(b)
        d[b].add(a)

    tt = True
    gf = collections.defaultdict(bool)
    while tt:
        tt = False
        for k,v in list(d.items()):
            if len(v) == 1:
                vt = list(v)[0]
                if len(d[vt]) == 1:
                    continue
                for vv in d[vt]:
                    if vv == k:
                        continue
                    if vt in d[vv]:
                        d[vv].remove(vt)
                d[vt] = set([k])
                tt = True
            elif len(v) == 0:
                return 'First'
    return 'Second'


print(main())
mod = 10**9+7
N, K = map(int,input().split())
A = sorted(list(map(int,input().split())))

p = 1
n = 0
ans = 1
cnt = 0
while cnt < K-1:
  if A[n]*A[n+1] > A[-p]*A[-p-1]:
    ans = ans*A[n]*A[n+1]%mod
    n += 2
    cnt += 2
    
  else:
    ans = ans*A[-p]%mod
    p += 1
    cnt += 1
    
if i == K-1:
  ans = ans*A[-p]%mod
  
if A[-1]<0 and K%2==1:
  ans = 1
  for i in A[N-K:]:
    ans = ans*cnt%mod

print(ans)

### FIXED CODE ###

from bisect import bisect_left,bisect_right
p=10**9+7
n,k=map(int,input().split())
a=sorted(list(map(int,input().split())))
pi=1
ni=0
ans=1
i=0
while i<k-1:
  if a[ni]*a[ni+1]>a[-pi]*a[-pi-1]:
    ans=ans*a[ni]*a[ni+1]%p
    ni+=2
    i+=2
  else:
    ans=ans*a[-pi]%p
    pi+=1
    i+=1
if i==k-1:
  ans=ans*a[-pi]%p
if a[-1]<0 and k%2==1:
  ans=1
  for i in a[n-k:]:
    ans=ans*i%p
print(ans)
import pandas as pd
n = int(input())
shops = [0]*n
points = [0]*n
nums = [i for i in range(1,n+1)]
for i in range(n):
    shops[i],points[i] = input().split()
d = pd.DataFrame({'shops':shops,'points':points,'nums':nums})    
l = d.sort_values('shops').sort_values('points', ascending=False)['nums'].tolist()
for i in range(len(l)):
    print(l[i])

### FIXED CODE ###

n = int(input())
l = []
for i in range(1,n+1):
    a, b = input().split()
    l += [[a,int(b),i]]
l = sorted(sorted(l, key=lambda x:x[1], reverse=True), key=lambda x:x[0])
for i in range(len(l)):
    print(l[i][2])
if a**2 + b**2 < c**2:
    print(Yes)
else:
    print(No)

### FIXED CODE ###

a, b, c = input().split()

a, b, c = int(a), int(b), int(c)

if c-a-b > 0 and 4*a*b < (c-a-b)**2:
    print('Yes')
else:
    print('No')
n,m,k = map(int,input().split())

for i in range(m+1):
  if k - n*i == 0 or (k - n*i > 0 and (k - n*i) % (m - 2*i) == 0):
    print('Yes')
    exit()
  elif k - n*i < 0:
    print('No')
    exit()
print('No')

### FIXED CODE ###

n,m,k = map(int,input().split())

for i in range(m+1):
  for j in range(n+1):
    if n*i + m*j - 2*i*j == k:
      print('Yes')
      exit()
print('No')
k, n = list(map(int, input().split()))
x = list(map(int, input().split()))
x.sort()
df = [0] * (n - 1)
for i in range(n - 1):
    df[i] = abs(x[i + 1] - x[i])

df = sorted(df, reverse=True)
print(sum(df[k - 1 :]))


### FIXED CODE ###

import math

n = int(input())
t = [0] * 5
for i in range(5):
    t[i] = int(input())
print(math.ceil(n / min(t)) + 4)
n = int(input())
S = list(map(int, input().split()))
SENTINEL = 10 ** 9 + 1
count = 0

def merge(A, left, mid, right):
    n1 = mid - left
    n2 = right - mid
    L = A[left:mid]
    R = A[mid:right]
    for i in range(n1):
        L[i] = A[left + i]
    for i in range(n2):
        R[i] = A[mid + i]
    L[n1] = r[n2] = SENTINEL
    i = j = 0
    for k in range(left, right):
        count += 1
        if(L[i] <= R[i]):
            A[k] = L[i]
            i += 1
        else:
            A[k] = R[j]
            j += 1

mergeSort(A, left, right):
    if(left + 1 < right):
        mid = (left + right) // 2
        mergeSort(A, left, mid)
        mergeSort(A, mid, right)
        merge(A, left, mid, right)

mergeSort(A, 0, n)
print(*A)
print(count)

### FIXED CODE ###

n = int(input())
S = list(map(int, input().split()))
SENTINEL = 10 ** 9 + 1
count = 0
 
def merge(S, left, mid, right):
    L = S[left:mid] + [SENTINEL]
    R = S[mid:right] + [SENTINEL]
    i = j = 0
    global count
    for k in range(left, right):
        count += 1
        if (L[i] <= R[j]):
            S[k] = L[i]
            i += 1
        else:
            S[k] = R[j]
            j += 1
 
def mergeSort(S, left, right):
    if(left + 1 < right):
        mid = (left + right) // 2
        mergeSort(S, left, mid)
        mergeSort(S, mid, right)
        merge(S, left, mid, right)
 
mergeSort(S, 0, n)
print(*S)
print(count)
from collections import Counter
S = []
N = int(input())
for i in range(N):
    s = input()
    S.append(s)

c = collections.Counter(S)
max_num = max(c.values())
max_list = [i for i,j in c.items() if j==max_num]
max_list.sort()
print('\n'.join(max_list))

### FIXED CODE ###

from collections import Counter
S = []
N = int(input())
for i in range(N):
    s = input()
    S.append(s)

c = Counter(S)
max_num = max(c.values())
max_list = [i for i,j in c.items() if j==max_num]
max_list.sort()
print('\n'.join(max_list))
v, c=list(map(int, input().split()))
n=int(input())
s=0
for i in range(n):
  if v[i]-c[i]>0:
    s=s+v[i]-c[i]
  else:
    continue
print(s)

### FIXED CODE ###

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

s = 0
for i in range(n):
  if v[i] - c[i] >= 0:
    s += v[i] - c[i]
  else:
    continue
print(s)
def print_character(str1, str2):
      str outputWord
      outputWord = str1 + str2
      print(outputWord)

### FIXED CODE ###

s = input()
ls = s.split()
print(ls[1] + ls[0])
from collections import deque

N, K = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
visited = deque()
next = 1
while True:
  present = next
  cnt += 1
  visited.append(present)
  next = A[present-1]
  if next in visited:
    ind = visited.index(next)
    l = len(visited[ind:])
    break

rest = (K-cnt) % l
present = visited[ind + rest]
print(present)


### FIXED CODE ###

N, K = map(int, input().split())
A = list(map(int, input().split()))
visited = [-1] * N
visited[0] = 0
next = A[0]
for i in range(1, K+1):
    present = next
    visited[present - 1] = i

    next = A[present - 1]
    if visited[next - 1] != -1:
        loopLength = visited[present - 1] - visited[next - 1] + 1
        rest = (K - i) % loopLength
        if rest > 0:
            present = visited.index(visited[next - 1] + rest - 1) + 1
        break

print(present)
h, w = map(int, input().split())

lists = []
iti_h = []
iti_w = []
cnt = 0

for i in range(h):
    s = list(input())
    lists.append(s)
    

while True:
    check = 0
    for i in range(h):
        for j in range(w):
            if lists[i][j] == "#":
                iti_h.append(i)
                iti_w.append(j)
                check += 1
    if check == h * w:
        break
    cnt += 1
    for i in range(check):
        if iti_h[i] - 1 >= 0:
            lists[iti_h[i] - 1][iti_w[i]] = "#"
        if iti_w[i] - 1 >= 0:
            lists[iti_h[i]][iti_w[i] - 1] = "#"
        if iti_w[i] + 1 <= w - 1:
            lists[iti_h[i]][iti_w[i] + 1] = "#"
        if iti_h[i] + 1 <= h - 1:
            lists[iti_h[i] + 1][iti_w[i]] = "#"
    iti_h.clear()
    iti_w.clear()
    


print(cnt)
            


### FIXED CODE ###

from collections import deque

h,w = map(int,input().split())
matrix = [["a" for _ in range(w+2)]] + [list("a" + input() + "a") for _ in range(h)] + [["a" for _ in range(w+2)]]

matrix_list1 = deque()
cnt = 0

for i in range(1,h+1):
    for j in range(1,w+1):
        if matrix[i][j] == "#":
            matrix_list1.append([i,j])

while len(matrix_list1) != 0:     
    for _ in range(len(matrix_list1)):
        x,y = matrix_list1.popleft()
        if matrix[x+1][y] == ".":
            matrix[x+1][y] = "#"
            matrix_list1.append([x+1,y])
        if matrix[x-1][y] == ".":
            matrix[x-1][y] = "#"
            matrix_list1.append([x-1,y])
        if matrix[x][y+1] == ".":
            matrix[x][y+1] = "#"
            matrix_list1.append([x,y+1])
        if matrix[x][y-1] == ".":
            matrix[x][y-1] = "#"
            matrix_list1.append([x,y-1])
    else:
        if len(matrix_list1) > 0:
            cnt += 1
    
print(cnt)
k = int(input())
count1 = 0
count2 = 0
for i in range(k):
    if i % 2 == 0:
        count1 += 1
    else:
        count2 += 1
print(count1 * count2

### FIXED CODE ###

k = int(input())
count1 = 0
count2 = 0
for i in range(k):
    if i % 2 == 0:
        count1 += 1
    else:
        count2 += 1
print(count1 * count2)
N = int(input())
A = [0 for i in range(N)]
for i in range(N):
    A[i] = list(map(str,input().split()))
for i in range(N):
    A[i].append(str(i))


B = sorted(A, key=lambda x: x[1], reverse=True)

C = sorted(B, key=lambda x: x[0])

for i in range(N):
    print(int(C[i][2]+1)


### FIXED CODE ###

input_AP = list(map(int, input().split()))
A = input_AP[0]
P = input_AP[1]

result = (A*3 + P)//2
print(result)
n = int(input())
l = sorted([int(i) for i in input().split()])
if l[-1] < sum(l-l[-1]):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n = int(input())
l = sorted([int(i) for i in input().split()])
if l[-1] < sum(l)-l[-1]:
    print("Yes")
else:
    print("No")
import sys

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


if(N > K):
    if(N % K == 0):
        print(0)
        sys.exit()
    else:
        tmp=N % K
        print(min(tmp,abs(K - tmp)))
        sys.exit()
else:
    tmp = abs(N - K)
    if(tmp <= N):
        print(tmp)
    else:

### FIXED CODE ###

import sys

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


if(N > K):
    if(N % K == 0):
        print(0)
        sys.exit()
    else:
        tmp=N % K
        print(min(tmp,abs(K - tmp)))
        sys.exit()
else:
    tmp = abs(N - K)
    if(tmp <= N):
        print(tmp)
    else:
        print(N)
from sys import setrecursionlimit
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parent = [i for i in range(n)]  # 親
        self.rank = [1] * n  # 木の高さ
        self.size = [1] * n  # size[i] は i を根とするグループのサイズ

    def find(self, x):  # x の根を返す
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])  # 経路圧縮
            return self.parent[x]

    def unite(self, x, y):  # x, y の属する集合を併合する
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                self.parent[x] = y
                self.size[y] += self.size[x]
            else:
                self.parent[y] = x
                self.size[x] += self.size[y]
                if self.rank[x] == self.rank[y]:
                    self.rank[x] += 1
    def roots(self):  # すべての根をリストで返す
        return [i for i, x in enumerate(self.parent) if i == x]
setrecursionlimit(10**6)
N,M = map(int,input().split())
uf = UnionFind(N)
for i in range(M):
    a,b = map(int,input().split())
    uf.unite(a,b)
ans = len(uf.roots())-1
print(ans)

### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(10**8)
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parent = [i for i in range(n)]  # 親
        self.rank = [1] * n  # 木の高さ
        self.size = [1] * n  # size[i] は i を根とするグループのサイズ

    def find(self, x):  # x の根を返す
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])  # 経路圧縮
            return self.parent[x]

    def unite(self, x, y):  # x, y の属する集合を併合する
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                self.parent[x] = y
                self.size[y] += self.size[x]
            else:
                self.parent[y] = x
                self.size[x] += self.size[y]
                if self.rank[x] == self.rank[y]:
                    self.rank[x] += 1
    def roots(self):  # すべての根をリストで返す
        return [i for i, x in enumerate(self.parent) if i == x]

N,M = map(int,input().split())
uf = UnionFind(N+1)
for i in range(M):
    a,b = map(int,input().split())
    uf.unite(a,b)
ans = len(uf.roots())-2
print(ans)
#
import sys
import math
import numpy as np
import itertools
# いくつか入力
n,t = (int(i) for i in input().split())

# n行の複数列ある数値を二次元配列へ。x[n][?]
ab = [[int(i) for i in input().split()] for i in range(n)]
# 0:weight 1:value

ab = sorted(ab,key=lambda x: x[1])

dp = np.zeros((n+1,t),int)
dp2 = np.zeros((n+1,t),int)

for i in range(n):
    for w in range(t):
        if w >= ab[i][0] :
            dp[i+1][w] = np.max(dp[i][w-ab[i][0]] + ab[i][1], dp[i][w])
        else:
            dp[i+1][w] = dp[i][w]
        if w >= ab[i][0] :
            dp2[i+1][w] = np.max(dp2[i][w-ab[i][0]] + ab[i][1],dp[i][w] + ab[i][1], dp[i][w])
        else:
            dp2[i+1][w] = np.max(dp[i][w] + ab[i][1], dp[i][w])

answer =0
for i in range(n+1):
    for w in range(t):
        answer = np.max(answer, dp2[i][w])
print(answer)

#print(dp2)


### FIXED CODE ###

#
import sys
import math
import numpy as np
import itertools
# いくつか入力
n,t = (int(i) for i in input().split())

# n行の複数列ある数値を二次元配列へ。x[n][?]
ab = [[int(i) for i in input().split()] for i in range(n)]
# 0:weight 1:value

ab = sorted(ab,key=lambda x: x[1])

dp = np.zeros((n+1,t),int)
dp2 = np.zeros((n+1,t),int)

for i in range(n):
    w = ab[i][0]
    dp[i+1][w:] = np.fmax(dp[i][:-w] + ab[i][1], dp[i][w:])
    dp2[i+1][w:] = np.fmax(dp2[i][:-w] + ab[i][1],dp[i][w:] + ab[i][1], dp2[i][w:])
    dp[i+1][:w] = dp[i][:w]
    dp2[i+1][:w] = np.fmax(dp[i][:w] + ab[i][1], dp2[i][:w])

answer = np.amax(dp2)
print(answer)
n = int(input())
dp = [0] * (n+1) 
for i in range(2,n+1):
  dp[i] = dp[i-1]+(i-1)
print(dp[-1])

### FIXED CODE ###

n = int(input())
print(n*(n-1)//2)
import math


def main():
    n, x = map(int, input().split())
    x_lst = list(map(int, input().split()))
    x_lst.sort()

    if n == 1:
        minimum = abs(x_lst[0] - x)
    else:
        lst1 = []
        for i in range(n):
            if i != n - 1:
                lst1.append(abs(x_lst[i + 1] - x_lst[i]))

        minimum = math.gcd(lst1[0], lst1[1])
        for i in range(n - 1):
            if i != n - 2:
                minimum = min(minimum, math.gcd(lst1[i], lst1[i + 1]))

        lst2 = []
        for i in range(n):
            lst2.append(abs(x_lst[i] - x))

        lst2.sort()
        lst2.reverse()
        for i in range(n):
            if minimum % lst2[i] == 0:
                minimum = lst2[i]
                break

    print(minimum)


if __name__ == '__main__':
    main()

### FIXED CODE ###

import math


def main():
    n, x = map(int, input().split())
    x_lst = list(map(int, input().split()))
    x_lst.sort()

    if n == 1:
        minimum = abs(x_lst[0] - x)
    elif n == 2:
        minimum = abs(x_lst[1] - x_lst[0])
        lst = [abs(x_lst[1] - x), abs(x_lst[0] - x)]
        lst.sort()
        lst.reverse()
        for i in range(2):
            if minimum % lst[i] == 0:
                minimum = lst[i]
                break
    else:
        lst1 = []
        for i in range(n):
            if i != n - 1:
                lst1.append(abs(x_lst[i + 1] - x_lst[i]))

        minimum = math.gcd(lst1[0], lst1[1])
        for i in range(n - 1):
            if i != n - 2:
                minimum = min(minimum, math.gcd(lst1[i], lst1[i + 1]))

        lst2 = []
        for i in range(n):
            lst2.append(abs(x_lst[i] - x))

        lst2.sort()
        lst2.reverse()
        for i in range(n):
            if minimum % lst2[i] == 0:
                minimum = lst2[i]
                break

    print(minimum)


if __name__ == '__main__':
    main()
from math import gcd

def gcd(a, b, c):
    g = gcd(a, b)
    return gcd(g, c)

K = int(input())
ans = 0

for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            ans += gcd(i, j, k)

print(ans)


### FIXED CODE ###

from math import gcd

def gcd_3(a, b, c):
    g = gcd(a, b)
    return gcd(g, c)

K = int(input())
ans = 0

for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            ans += gcd_3(i, j, k)

print(ans)
import collections

N = int(input())

xy = []
for _ in range(N):
    xy.append(list(map(int, input().split())))

xy = np.array(xy)

diff_xy = []

for i in range(N-1):
    for j in range(i+1, N):
        diff_xy.append(list(xy[j] - xy[i]))

cs = []
for c in diff_xy:
    cs.append(diff_xy.count(c))
    
print(1 + (N - (max(cs) + 1)))

### FIXED CODE ###

import collections
import numpy as np

N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]

xy = np.array(xy)

dic_xy = {}

for i in range(N):
    for j in range(N):
        if i != j:
            diff_xy = xy[i] - xy[j]
            diff_xy = tuple(diff_xy)
            
            if dic_xy.get(diff_xy) is None:
                dic_xy[diff_xy] = 1
            else:
                dic_xy[diff_xy] += 1

max_diff = 0
for x in dic_xy:
    max_diff = max(max_diff, dic_xy[x])
    
print(N - max_diff)
S = input()


count_1 = 0
count_0 = 0

for i in range(len(S)):
  if S[i]=="1":
    count_1 = count_1 + 1
  elif S[i]=="0":
    count_0 = count_0 + 1
    

if count_1 >= count_0:
  print(count_0*2)
elif:
  print(count_1*2)

### FIXED CODE ###

S = input()


count_1 = 0
count_0 = 0

for i in range(len(S)):
  if S[i]=="1":
    count_1 = count_1 + 1
  elif S[i]=="0":
    count_0 = count_0 + 1
    

if count_1 >= count_0:
  print(count_0*2)
else:
  print(count_1*2)
import math
a = int(input())
b = float(input())
Z = a*b
print(math.floor(Z))


### FIXED CODE ###

import decimal
Deci = decimal.Decimal

a, b = input().split()
x, y = Deci(a), Deci(b)
ans = int(x * y)
print(ans)
n,m=map(int,input().split())
c=[]
for _ in range:
    a,b=map(int,input().split())
    c.append(a)
    c.append(b)
for i in range(1,n+1):
    print(c.count(i))

### FIXED CODE ###

n,m=map(int,input().split())
c=[]
for _ in range(m):
    a,b=map(int,input().split())
    c.append(a)
    c.append(b)
for i in range(1,n+1):
    print(c.count(i))
l, r = map(int, input().split())
if (r-l) >= 2019:
    print(0
    exit()
ans = 2019
for i in range(l, r+1):
    for j in range(i+1, r+1):
        ans = min(ans, (i*j)%2019)
print(ans)

### FIXED CODE ###

l, r = map(int, input().split())
if (r-l) >= 2019:
    print(0)
    exit()
ans = 2019
for i in range(l, r+1):
    for j in range(i+1, r+1):
        ans = min(ans, (i*j)%2019)
print(ans)
N = int(input())
S = input()

ans = []

for i in range(1, N-1):
    l = set(S[:i])
    r = set(S[i:])
    ans.append(len(l & r))
print(max(ans))

### FIXED CODE ###

N = int(input())
S = input()

ans = []

for i in range(1, N):
    l = set(S[:i])
    r = set(S[i:])
    ans.append(len(l & r))
print(max(ans))
import math
x = int(input())
y = []
for i in range(70):
    y.append(i**5)
for j in range(70):
    for k in range(j,70):
        if y[k]+ y[j] ==x:
            a = k
            b = j            
print(a,-b)

### FIXED CODE ###

import math
x = int(input())
y = []
for i in range(1000):
    y.append(i**5)
for j in range(1000):
    for k in range(j,1000):
        if y[k]+ y[j] == x:
            a = k
            b = -j 
        if y[k] - y [j] == x:
            a = k
            b = j
            
print(a,b)
a , b = map(int,input(),split())
if (a*b)%2 == 1:
  print('Odd')
else:
  print('Even')

### FIXED CODE ###

a,b=map(int,input().split())
if (a*b)%2 == 1:
  print('Odd')
else:
  print('Even')
import math
def length(X,Y,c):
    sum_=0
    for i in range(len(c)-1):
        sum_+=math.sqrt((X[c[i]]-X[c[i+1]])**2 + (Y[c[i]]-Y[c[i+1]])**2)
    #print(sum_)
    return sum_
N=int(input())
X=[0]*N
Y=[0]*N
for i in range(N):
    X[i], Y[i] = map(int,input().split())
C = list(itertools.permutations(range(0,N)))
sum_=0
for c in C:
    sum_+=length(X,Y,c)
print(sum_/len(C))

### FIXED CODE ###

import math
import itertools
def length(X,Y,c):
    sum_=0
    for i in range(len(c)-1):
        sum_+=math.sqrt((X[c[i]]-X[c[i+1]])**2 + (Y[c[i]]-Y[c[i+1]])**2)
    #print(sum_)
    return sum_
N=int(input())
X=[0]*N
Y=[0]*N
for i in range(N):
    X[i], Y[i] = map(int,input().split())
C = list(itertools.permutations(range(0,N)))
sum_=0
for c in C:
    sum_+=length(X,Y,c)
print(sum_/len(C))
import math.pi as pi
r  = input()
print(r*r*pi)

### FIXED CODE ###

R = int(input())
print(2*R*3.14159265)
H,W=map(imt,input().split())
if H==1 or W==1:
	print(1)
else:
	print((H*W+1)//2)

### FIXED CODE ###

H,W=map(int,input().split())
if H==1 or W==1:
	print(1)
else:
	print((H*W+1)//2)