Problem:
Problem J
Cover the Polygon with Your Disk A convex polygon is drawn on a flat paper sheet. You are trying to place a disk in your hands to cover as large area of the polygon as possible. In other words, the intersection area of the polygon and the disk should be maximized. Input The input consists of a single test case, formatted as follows. All input items are integers.  $n$ $r$ $x_1$ $y_1$ . . . $x_n$ $y_n$  $n$ is the number of vertices of the polygon ($3 \leq n \leq 10$). $r$ is the radius of the disk ($1 \leq r \leq 100$).
$x_i$ and $y_i$ give the coordinate values of the $i$-th vertex of the polygon ($1 \leq i \leq n$). Coordinate values satisfy $0 \leq x_i \leq 100$ and $0 \leq y_i \leq 100$. The vertices are given in counterclockwise order. As stated above, the given polygon is convex. In other words, interior angles at all of its vertices are less than 180$^{\circ}$. Note that the border of a convex polygon never crosses or touches itself. Output Output the largest possible intersection area of the polygon and the disk. The answer should not have an error greater than 0.0001 ($10^{-4}$). Sample Input 1 4 4
0 0
6 0
6 6
0 6 Sample Output 1 35.759506 Sample Input 2 3 1
0 0
2 1
1 3 Sample Output 2 2.113100 Sample Input 3 3 1
0 0
100 1
99 1 Sample Output 3 0.019798 Sample Input 4 4 1
0 0
100 10
100 12
0 1 Sample Output 4 3.137569 Sample Input 5 10 10
0 0
10 0
20 1
30 3
40 6
50 10
60 15
70 21
80 28
90 36 Sample Output 5 177.728187 Sample Input 6 10 49
50 0
79 10
96 32
96 68
79 90
50 100
21 90
4 68
4 32
21 10 Sample Output 6 7181.603297

Solution (Python):
from math import sqrt, atan2
def intersection01(cx, cy, r, x1, y1, x2, y2):
    xd = x2 - x1; yd = y2 - y1
    X = x1 - cx; Y = y1 - cy
    a = xd**2 + yd**2
    b = xd * X + yd * Y
    c = X**2 + Y**2 - r**2
    D = b**2 - a*c
    result = []
    if D > 0:
        d = sqrt(D)
        if 0 < -b - d < a:
            s = (-b - d) / a
            result.append((x1 + xd*s, y1 + yd*s))
        if 0 < -b + d < a:
            s = (-b + d) / a
            result.append((x1 + xd*s, y1 + yd*s))
    elif D == 0:
        if 0 < -b < a:
            s = -b / a
            result.append((x1 + xd*s, y1 + yd*s))
    return result
def calc(x0, y0, x1, y1, rr):
    if x0**2 + y0**2 - rr <= 1e-8 and x1**2 + y1**2 - rr <= 1e-8:
        return (x0 * y1 - x1 * y0) / 2.
    theta = atan2(x0*y1 - x1*y0, x0*x1 + y0*y1)
    return theta*rr/2.

n, r = map(int, input().split())
P = [list(map(int, input().split())) for i in range(n)]

rr = r**2
def solve(xb, yb):
    ans = 0
    for i in range(n):
        x0, y0 = P[i-1]; x1, y1 = P[i]
        x0 -= xb; y0 -= yb
        x1 -= xb; y1 -= yb
        result = intersection01(0, 0, r, x0, y0, x1, y1)
        px = x0; py = y0
        for x, y in result:
            ans += calc(px, py, x, y, rr)
            px = x; py = y
        ans += calc(px, py, x1, y1, rr)
    return ans

x0 = sum(x for x, y in P)/n
y0 = sum(y for x, y in P)/n
ans = solve(x0, y0)
import random
random.seed()
randint = random.randint
for i in range(1000):
    ma = ans; nxt = None
    for j in range(100):
        dx = randint(-1000000, 1000000) / 10000 / (i+1)
        dy = randint(-1000000, 1000000) / 10000 / (i+1)
        res = solve(x0 + dx, y0 + dy)
        if ma < res:
            ma = res
            nxt = (x0 + dx, y0 + dy)
    if nxt is not None:
        ans = ma
        x0, y0 = nxt
print(ans)