JerryL/AlgoSimBench huggingface dataset:
361_B. Levko and Permutation

Levko loves permutations very much. A permutation of length n is a sequence of distinct positive integers, each is at most n.

Let’s assume that value gcd(a, b) shows the greatest common divisor of numbers a and b. Levko assumes that element pi of permutation p1, p2, ... , pn is good if gcd(i, pi) > 1. Levko considers a permutation beautiful, if it has exactly k good elements. Unfortunately, he doesn’t know any beautiful permutation. Your task is to help him to find at least one of them.

Input

The single line contains two integers n and k (1 ≤ n ≤ 105, 0 ≤ k ≤ n).

Output

In a single line print either any beautiful permutation or -1, if such permutation doesn’t exist.

If there are multiple suitable permutations, you are allowed to print any of them.

Examples

Input

4 2


Output

2 4 3 1

Input

1 1


Output

-1

Note

In the first sample elements 4 and 3 are good because gcd(2, 4) = 2 > 1 and gcd(3, 3) = 3 > 1. Elements 2 and 1 are not good because gcd(1, 2) = 1 and gcd(4, 1) = 1. As there are exactly 2 good elements, the permutation is beautiful.

The second sample has no beautiful permutations.

Example input:
1 1

4 2


Example output:
-1

2 1 3 4


Tags: constructive algorithms
math
number theory
Difficulty rating: 1200

Solution:
n, k = map(int, input().split())

if n < k+1:
    print(-1)
else:
    print(*range(2, n-k+1), 1, *range(n-k+1, n+1))
1009_D. Relatively Prime Graph

Let's call an undirected graph G = (V, E) relatively prime if and only if for each edge (v, u) ∈ E GCD(v, u) = 1 (the greatest common divisor of v and u is 1). If there is no edge between some pair of vertices v and u then the value of GCD(v, u) doesn't matter. The vertices are numbered from 1 to |V|.

Construct a relatively prime graph with n vertices and m edges such that it is connected and it contains neither self-loops nor multiple edges.

If there exists no valid graph with the given number of vertices and edges then output "Impossible".

If there are multiple answers then print any of them.

Input

The only line contains two integers n and m (1 ≤ n, m ≤ 10^5) — the number of vertices and the number of edges.

Output

If there exists no valid graph with the given number of vertices and edges then output "Impossible".

Otherwise print the answer in the following format:

The first line should contain the word "Possible".

The i-th of the next m lines should contain the i-th edge (v_i, u_i) of the resulting graph (1 ≤ v_i, u_i ≤ n, v_i ≠ u_i). For each pair (v, u) there can be no more pairs (v, u) or (u, v). The vertices are numbered from 1 to n.

If there are multiple answers then print any of them.

Examples

Input

5 6


Output

Possible
2 5
3 2
5 1
3 4
4 1
5 4


Input

6 12


Output

Impossible

Note

Here is the representation of the graph from the first example: <image>

Example input:
5 6

6 12


Example output:
Possible
1 2
1 3
1 4
1 5
2 3
2 5

Impossible


Tags: brute force
constructive algorithms
graphs
greedy
math
Difficulty rating: 1700

Solution:
from fractions import *
n,m=map(int,input().split())
a,c='Possible',0
for i in range(1,n+1):
    for j in range(i+1,n+1):
        if gcd(i,j)==1:
            c+=1; a+='\n%d %d'%(i,j)
            if c==m: break
    if c==m: break
print(a if c==m and m>n-2 else 'Impossible')
p02624 AtCoder Beginner Contest 172 - Sum of Divisors

For a positive integer X, let f(X) be the number of positive divisors of X.

Given a positive integer N, find \sum_{K=1}^N K\times f(K).

Constraints

* 1 \leq N \leq 10^7

Input

Input is given from Standard Input in the following format:


N


Output

Print the value \sum_{K=1}^N K\times f(K).

Examples

Input

4


Output

23


Input

100


Output

26879


Input

10000000


Output

838627288460105

Example input:
4
100
10000000

Example output:
23
26879
838627288460105

Difficulty rating: 0

Solution:
n=int(input())
print(n+sum(n//i*(i+n-n%i)//2for i in range(1,n)))
914_C. Travelling Salesman and Special Numbers

The Travelling Salesman spends a lot of time travelling so he tends to get bored. To pass time, he likes to perform operations on numbers. One such operation is to take a positive integer x and reduce it to the number of bits set to 1 in the binary representation of x. For example for number 13 it's true that 1310 = 11012, so it has 3 bits set and 13 will be reduced to 3 in one operation.

He calls a number special if the minimum number of operations to reduce it to 1 is k.

He wants to find out how many special numbers exist which are not greater than n. Please help the Travelling Salesman, as he is about to reach his destination!

Since the answer can be large, output it modulo 109 + 7.

Input

The first line contains integer n (1 ≤ n < 21000).

The second line contains integer k (0 ≤ k ≤ 1000).

Note that n is given in its binary representation without any leading zeros.

Output

Output a single integer — the number of special numbers not greater than n, modulo 109 + 7.

Examples

Input

110
2


Output

3


Input

111111011
2


Output

169

Note

In the first sample, the three special numbers are 3, 5 and 6. They get reduced to 2 in one operation (since there are two set bits in each of 3, 5 and 6) and then to 1 in one more operation (since there is only one set bit in 2).

Example input:
110
2

111111011
2


Example output:
3

169


Tags: brute force
combinatorics
dp
Difficulty rating: 1800

Solution:
M=1000000007
x=map(int,raw_input())
n=len(x)
k=input()
v=[0,0]
p=[1,1]
for i in range(2,n+1):
    v+=v[bin(i).count('1')]+1,
    p+=p[-1]*i%M,
t=(1,0)[k>0]
for i in range(1,n+1):
    if v[i]==k-1:
        d=i
        for j in range(n):
            if x[j]:
                if d<n-j:
                    t+=p[n-1-j]*pow(p[d]*p[n-1-j-d]%M,M-2,M)%M
                d-=1
                if not d:
                    t+=i>1
                    break
print t%M
451_E. Devu and Flowers

Devu wants to decorate his garden with flowers. He has purchased n boxes, where the i-th box contains fi flowers. All flowers in a single box are of the same color (hence they are indistinguishable). Also, no two boxes have flowers of the same color.

Now Devu wants to select exactly s flowers from the boxes to decorate his garden. Devu would like to know, in how many different ways can he select the flowers from each box? Since this number may be very large, he asks you to find the number modulo (109 + 7). 

Devu considers two ways different if there is at least one box from which different number of flowers are selected in these two ways.

Input

The first line of input contains two space-separated integers n and s (1 ≤ n ≤ 20, 0 ≤ s ≤ 1014).

The second line contains n space-separated integers f1, f2, ... fn (0 ≤ fi ≤ 1012).

Output

Output a single integer — the number of ways in which Devu can select the flowers modulo (109 + 7).

Examples

Input

2 3
1 3


Output

2


Input

2 4
2 2


Output

1


Input

3 5
1 3 2


Output

3

Note

Sample 1. There are two ways of selecting 3 flowers: {1, 2} and {0, 3}.

Sample 2. There is only one way of selecting 4 flowers: {2, 2}.

Sample 3. There are three ways of selecting 5 flowers: {1, 2, 2}, {0, 3, 2}, and {1, 3, 1}.

Example input:
3 5
1 3 2

2 4
2 2

2 3
1 3


Example output:
3

1

2


Tags: bitmasks
combinatorics
number theory
Difficulty rating: 2300

Solution:
#include <bits/stdc++.h>
const int M = 1000000007;
using namespace std;
long long inv[25];
long long comb(long long n, long long r) {
  long long res = 1;
  for (long long i = 0; i < r; i++)
    res = res * ((n - i) % M) % M * inv[i + 1] % M;
  return res;
}
int main() {
  long long sum, s, f[25], ans = 0;
  int i, j, k, n, c;
  cin >> n >> s;
  for (i = 0; i < n; i++) cin >> f[i];
  inv[1] = 1;
  for (i = 2; i <= 20; i++) inv[i] = (M - M / i * inv[M % i] % M) % M;
  for (j = 0; j < (1 << n); j++) {
    sum = 0;
    c = 1;
    for (k = 0; k < n; k++) {
      if (j & (1 << k)) {
        sum += f[k] + 1;
        c = -c;
      }
    }
    if (s - sum >= 0)
      ans = ((ans + c * comb(n + s - sum - 1, n - 1)) % M + M) % M;
  }
  cout << ans << endl;
  return 0;
}
p02794 AtCoder Beginner Contest 152 - Tree and Constraints

We have a tree with N vertices numbered 1 to N. The i-th edge in this tree connects Vertex a_i and Vertex b_i.
Consider painting each of these edges white or black. There are 2^{N-1} such ways to paint the edges. Among them, how many satisfy all of the following M restrictions?

* The i-th (1 \leq i \leq M) restriction is represented by two integers u_i and v_i, which mean that the path connecting Vertex u_i and Vertex v_i must contain at least one edge painted black.

Constraints

* 2 \leq N \leq 50
* 1 \leq a_i,b_i \leq N
* The graph given in input is a tree.
* 1 \leq M \leq \min(20,\frac{N(N-1)}{2})
* 1 \leq u_i < v_i \leq N
* If i \not= j, either u_i \not=u_j or v_i\not=v_j
* All values in input are integers.

Input

Input is given from Standard Input in the following format:


N
a_1 b_1
:
a_{N-1} b_{N-1}
M
u_1 v_1
:
u_M v_M


Output

Print the number of ways to paint the edges that satisfy all of the M conditions.

Examples

Input

3
1 2
2 3
1
1 3


Output

3


Input

2
1 2
1
1 2


Output

1


Input

5
1 2
3 2
3 4
5 3
3
1 3
2 4
2 5


Output

9


Input

8
1 2
2 3
4 3
2 5
6 3
6 7
8 6
5
2 7
3 5
1 6
2 8
7 8


Output

62

Example input:
2
1 2
1
1 2
5
1 2
3 2
3 4
5 3
3
1 3
2 4
2 5
3
1 2
2 3
1
1 3
8
1 2
2 3
4 3
2 5
6 3
6 7
8 6
5
2 7
3 5
1 6
2 8
7 8

Example output:
1
9
3
62

Difficulty rating: 0

Solution:
#include <bits/stdc++.h>
using namespace std;
int n,m,x[55];
vector<pair<int,int>> v[55];
long long dp[1<<20];
bool dfs1(int a,int b,int c,int d){
	if (a==c)
		return 1;
	for (auto& i : v[a])
		if (i.first!=b && dfs1(i.first,a,c,d)){
			x[i.second]^=1<<d;
			return 1;
		}
	return 0;
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<n;i++){
		int ta,tb;
		scanf("%d%d",&ta,&tb);
		v[ta].emplace_back(tb,i);
		v[tb].emplace_back(ta,i);
	}
	scanf("%d",&m);
	for (int i=0;i<m;i++){
		int ta,tb;
		scanf("%d%d",&ta,&tb);
		dfs1(ta,0,tb,i);
	}
	dp[0]=1;
	for (int i=1;i<n;i++)
		for (int j=(1<<m)-1;j>=0;j--)
			dp[j|x[i]]+=dp[j];
	printf("%lld\n",dp[(1<<m)-1]);
}
414_B. Mashmokh and ACM

Mashmokh's boss, Bimokh, didn't like Mashmokh. So he fired him. Mashmokh decided to go to university and participate in ACM instead of finding a new job. He wants to become a member of Bamokh's team. In order to join he was given some programming tasks and one week to solve them. Mashmokh is not a very experienced programmer. Actually he is not a programmer at all. So he wasn't able to solve them. That's why he asked you to help him with these tasks. One of these tasks is the following.

A sequence of l integers b1, b2, ..., bl (1 ≤ b1 ≤ b2 ≤ ... ≤ bl ≤ n) is called good if each number divides (without a remainder) by the next number in the sequence. More formally <image> for all i (1 ≤ i ≤ l - 1).

Given n and k find the number of good sequences of length k. As the answer can be rather large print it modulo 1000000007 (109 + 7).

Input

The first line of input contains two space-separated integers n, k (1 ≤ n, k ≤ 2000).

Output

Output a single integer — the number of good sequences of length k modulo 1000000007 (109 + 7).

Examples

Input

3 2


Output

5


Input

6 4


Output

39


Input

2 1


Output

2

Note

In the first sample the good sequences are: [1, 1], [2, 2], [3, 3], [1, 2], [1, 3].

Example input:
3 2

6 4

2 1


Example output:
5
39
2

Tags: combinatorics
dp
number theory
Difficulty rating: 1400

Solution:

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

dp = [1] * (n+1)


for i in range(k-1):
    for j in range(1, n+1):
        for t in range(2*j, n+1, j):
            dp[j] += dp[t]


            

print(sum(dp[1:]) % (10**9 + 7))
149_D. Coloring Brackets

Once Petya read a problem about a bracket sequence. He gave it much thought but didn't find a solution. Today you will face it.

You are given string s. It represents a correct bracket sequence. A correct bracket sequence is the sequence of opening ("(") and closing (")") brackets, such that it is possible to obtain a correct mathematical expression from it, inserting numbers and operators between the brackets. For example, such sequences as "(())()" and "()" are correct bracket sequences and such sequences as ")()" and "(()" are not.

In a correct bracket sequence each bracket corresponds to the matching bracket (an opening bracket corresponds to the matching closing bracket and vice versa). For example, in a bracket sequence shown of the figure below, the third bracket corresponds to the matching sixth one and the fifth bracket corresponds to the fourth one.

<image>

You are allowed to color some brackets in the bracket sequence so as all three conditions are fulfilled: 

  * Each bracket is either not colored any color, or is colored red, or is colored blue. 
  * For any pair of matching brackets exactly one of them is colored. In other words, for any bracket the following is true: either it or the matching bracket that corresponds to it is colored. 
  * No two neighboring colored brackets have the same color. 



Find the number of different ways to color the bracket sequence. The ways should meet the above-given conditions. Two ways of coloring are considered different if they differ in the color of at least one bracket. As the result can be quite large, print it modulo 1000000007 (109 + 7).

Input

The first line contains the single string s (2 ≤ |s| ≤ 700) which represents a correct bracket sequence. 

Output

Print the only number — the number of ways to color the bracket sequence that meet the above given conditions modulo 1000000007 (109 + 7).

Examples

Input

(())


Output

12


Input

(()())


Output

40


Input

()


Output

4

Note

Let's consider the first sample test. The bracket sequence from the sample can be colored, for example, as is shown on two figures below. 

<image> <image>

The two ways of coloring shown below are incorrect. 

<image> <image>

Example input:
(())

()

(()())


Example output:
12
4
40

Tags: dp
Difficulty rating: 1900

Solution:
D=10**9+7
M=1024
s=raw_input()
n=len(s)
z=[0]*M
a=[]
for i in range(n):
  if '('==s[i]:
    a+=[i]
  else:
    z[a.pop()]=i
m={}
def go(u,v,x,y):
  r=m.get((u,x,y))
  if r is None:
    if u<v:
      m[(u,x,y)]=r=0
      e=z[u]
      for i in (1,2):
        if i!=x:r=(r+go(u+1,e-1,i,0)*go(e+1,v,0,y))%D
        if e<v or i!=y:r=(r+go(u+1,e-1,0,i)*go(e+1,v,i,y))%D
    else:
      r=1
    m[(u,x,y)]=r
  return r
print go(0,n-1,0,0)
148_D. Bag of mice

The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch fairies dancing in the moonlight, while the princess thinks they should just go to bed early. They are desperate to come to an amicable agreement, so they decide to leave this up to chance.

They take turns drawing a mouse from a bag which initially contains w white and b black mice. The person who is the first to draw a white mouse wins. After each mouse drawn by the dragon the rest of mice in the bag panic, and one of them jumps out of the bag itself (the princess draws her mice carefully and doesn't scare other mice). Princess draws first. What is the probability of the princess winning?

If there are no more mice in the bag and nobody has drawn a white mouse, the dragon wins. Mice which jump out of the bag themselves are not considered to be drawn (do not define the winner). Once a mouse has left the bag, it never returns to it. Every mouse is drawn from the bag with the same probability as every other one, and every mouse jumps out of the bag with the same probability as every other one.

Input

The only line of input data contains two integers w and b (0 ≤ w, b ≤ 1000).

Output

Output the probability of the princess winning. The answer is considered to be correct if its absolute or relative error does not exceed 10 - 9.

Examples

Input

1 3


Output

0.500000000


Input

5 5


Output

0.658730159

Note

Let's go through the first sample. The probability of the princess drawing a white mouse on her first turn and winning right away is 1/4. The probability of the dragon drawing a black mouse and not winning on his first turn is 3/4 * 2/3 = 1/2. After this there are two mice left in the bag — one black and one white; one of them jumps out, and the other is drawn by the princess on her second turn. If the princess' mouse is white, she wins (probability is 1/2 * 1/2 = 1/4), otherwise nobody gets the white mouse, so according to the rule the dragon wins.

Example input:
1 3

5 5


Example output:
0.500000000

0.658730159


Tags: dp
games
math
probabilities
Difficulty rating: 1800

Solution:
w,b,k,p,q=map(float,raw_input().split()+[0,0,1])
s=w+b
while q and k<s:
    d=q*w/s
    p+=d;q-=d;s-=1
    d=q*w/s
    q-=d;s-=1;k+=1
print p
518_D. Ilya and Escalator

Ilya got tired of sports programming, left university and got a job in the subway. He was given the task to determine the escalator load factor. 

Let's assume that n people stand in the queue for the escalator. At each second one of the two following possibilities takes place: either the first person in the queue enters the escalator with probability p, or the first person in the queue doesn't move with probability (1 - p), paralyzed by his fear of escalators and making the whole queue wait behind him.

Formally speaking, the i-th person in the queue cannot enter the escalator until people with indices from 1 to i - 1 inclusive enter it. In one second only one person can enter the escalator. The escalator is infinite, so if a person enters it, he never leaves it, that is he will be standing on the escalator at any following second. Ilya needs to count the expected value of the number of people standing on the escalator after t seconds. 

Your task is to help him solve this complicated task.

Input

The first line of the input contains three numbers n, p, t (1 ≤ n, t ≤ 2000, 0 ≤ p ≤ 1). Numbers n and t are integers, number p is real, given with exactly two digits after the decimal point.

Output

Print a single real number — the expected number of people who will be standing on the escalator after t seconds. The absolute or relative error mustn't exceed 10 - 6.

Examples

Input

1 0.50 1


Output

0.5


Input

1 0.50 4


Output

0.9375


Input

4 0.20 2


Output

0.4

Example input:
1 0.50 1

4 0.20 2

1 0.50 4


Example output:
0.500000000000

0.400000000000

0.937500000000


Tags: combinatorics
dp
math
probabilities
Difficulty rating: 1700

Solution:
n, p, t = input().split()
n, p = int(n), float(p)
f = [p] * n + [0]
for i in range(int(t) - 1): f = [f[k] * (1 - p) + p * (1 + f[k - 1]) for k in range(n)] + [0]
print(f[-2])
p02884 AtCoder Beginner Contest 144 - Fork in the Road

There is a cave consisting of N rooms and M one-directional passages. The rooms are numbered 1 through N.

Takahashi is now in Room 1, and Room N has the exit. The i-th passage connects Room s_i and Room t_i (s_i < t_i) and can only be traversed in the direction from Room s_i to Room t_i. It is known that, for each room except Room N, there is at least one passage going from that room.

Takahashi will escape from the cave. Each time he reaches a room (assume that he has reached Room 1 at the beginning), he will choose a passage uniformly at random from the ones going from that room and take that passage.

Aoki, a friend of Takahashi's, can block one of the passages (or do nothing) before Takahashi leaves Room 1. However, it is not allowed to block a passage so that Takahashi is potentially unable to reach Room N.

Let E be the expected number of passages Takahashi takes before he reaches Room N. Find the value of E when Aoki makes a choice that minimizes E.

Constraints

* 2 \leq N \leq 600
* N-1 \leq M \leq \frac{N(N-1)}{2}
* s_i < t_i
* If i != j, (s_i, t_i) \neq (s_j, t_j). (Added 21:23 JST)
* For every v = 1, 2, ..., N-1, there exists i such that v = s_i.

Input

Input is given from Standard Input in the following format:


N M
s_1 t_1
:
s_M t_M


Output

Print the value of E when Aoki makes a choice that minimizes E. Your output will be judged as correct when the absolute or relative error from the judge's output is at most 10^{-6}.

Examples

Input

4 6
1 4
2 3
1 3
1 2
3 4
2 4


Output

1.5000000000


Input

3 2
1 2
2 3


Output

2.0000000000


Input

10 33
3 7
5 10
8 9
1 10
4 6
2 5
1 7
6 10
1 4
1 3
8 10
1 5
2 6
6 9
5 6
5 8
3 6
4 8
2 7
2 9
6 7
1 2
5 9
6 8
9 10
3 9
7 8
4 5
2 10
5 7
3 5
4 7
4 9


Output

3.0133333333

Example input:
4 6
1 4
2 3
1 3
1 2
3 4
2 4
3 2
1 2
2 3
10 33
3 7
5 10
8 9
1 10
4 6
2 5
1 7
6 10
1 4
1 3
8 10
1 5
2 6
6 9
5 6
5 8
3 6
4 8
2 7
2 9
6 7
1 2
5 9
6 8
9 10
3 9
7 8
4 5
2 10
5 7
3 5
4 7
4 9

Example output:
1.5000000000
2.0000000000
3.0133333333

Difficulty rating: 0

Solution:
N,M=map(int,input().split())
s,t=0,0
G=[[] for i in range(N)]
for i in range(M):
  s,t=map(int,input().split())
  G[s-1].append(t-1)
A=1000
for x in range(N):
  DP=[0]*N
  for i in range(N-2,-1,-1):
    s=0
    for j in range(len(G[i])):
      s=max(s,DP[G[i][j]])
      DP[i]+=DP[G[i][j]]
    if i==x and len(G[i])!=1:
      DP[i]-=s
      DP[i]/=(len(G[i])-1)
    else:
      DP[i]/=len(G[i])
    DP[i]+=1
  A=min(A,DP[0])
print(A)
600_D. Area of Two Circles' Intersection

You are given two circles. Find the area of their intersection.

Input

The first line contains three integers x1, y1, r1 ( - 109 ≤ x1, y1 ≤ 109, 1 ≤ r1 ≤ 109) — the position of the center and the radius of the first circle.

The second line contains three integers x2, y2, r2 ( - 109 ≤ x2, y2 ≤ 109, 1 ≤ r2 ≤ 109) — the position of the center and the radius of the second circle.

Output

Print the area of the intersection of the circles. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6.

Examples

Input

0 0 4
6 0 4


Output

7.25298806364175601379


Input

0 0 5
11 0 5


Output

0.00000000000000000000

Example input:
0 0 4
6 0 4

0 0 5
11 0 5


Example output:
7.25298806364175601379
0


Tags: geometry
Difficulty rating: 2000

Solution:
#include <bits/stdc++.h>
using namespace std;
long double x, y, r, X, Y, R, d, a, b, pi = acos(-1), ans;
int main() {
  cin >> x >> y >> r >> X >> Y >> R;
  d = sqrt((X - x) * (X - x) + (Y - y) * (Y - y));
  if (R + r <= d)
    ans = 0;
  else if (R + d <= r || r + d <= R)
    ans = pi * min(r, R) * min(r, R);
  else {
    a = acos((r * r + d * d - R * R) / (2.0 * d * r));
    b = acos((R * R + d * d - r * r) / (2.0 * d * R));
    ans = (long double)(r * r * (a - sin(a) * cos(a)) +
                        R * R * (b - sin(b) * cos(b)));
  }
  cout << fixed << setprecision(20) << ans << endl;
  return 0;
}
p02805 AtCoder Beginner Contest 151 - Enclose All

Given are N points (x_i, y_i) in a two-dimensional plane.

Find the minimum radius of a circle such that all the points are inside or on it.

Constraints

* 2 \leq N \leq 50
* 0 \leq x_i \leq 1000
* 0 \leq y_i \leq 1000
* The given N points are all different.
* The values in input are all integers.

Input

Input is given from Standard Input in the following format:


N
x_1 y_1
:
x_N y_N


Output

Print the minimum radius of a circle such that all the N points are inside or on it.

Your output will be considered correct if the absolute or relative error from our answer is at most 10^{-6}.

Examples

Input

2
0 0
1 0


Output

0.500000000000000000


Input

3
0 0
0 1
1 0


Output

0.707106781186497524


Input

10
10 9
5 9
2 0
0 0
2 7
3 3
2 5
10 0
3 7
1 9


Output

6.726812023536805158

Example input:
3
0 0
0 1
1 0
2
0 0
1 0
10
10 9
5 9
2 0
0 0
2 7
3 3
2 5
10 0
3 7
1 9

Example output:
0.707106781186497524
0.500000000000000000
6.726812023536805158

Difficulty rating: 0

Solution:
#include<bits/stdc++.h>
int n,i,j,f;
double x[1<<10],y[1<<10],X,Y,d,e,P=0.1;
int main(){
	auto dist=[](double a,double b){return a*a+b*b;};
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%lf%lf",&x[i],&y[i]);
		X+=x[i];Y+=y[i];
	}
	X/=n;Y/=n;
	for(i=0;i<30000;i++){
		f=0;
		d=dist(X-x[0],Y-y[0]);
		for(j=1;j<n;j++){
			e=dist(X-x[j],Y-y[j]);
			if(d<e)d=e,f=j;
		}
		X+=(x[f]-X)*P;
		Y+=(y[f]-Y)*P;
		P*=0.999;
	}
	printf("%.10lf",sqrt(d));
}