Problem:
かぐや
いよいよ今月末に「はやぶさ２」が打ち上げられます。４年前に「はやぶさ」が帰ってきたときは、日本中が盛り上がったのを覚えている人も多いと思います。７年前には、「かぐや」が打ち上げられ、月の周りを回りながらたくさんの鮮明な画像を地球に送ってくれました。
上の図は、地球を原点とした空間座標（z軸は紙面から垂直に下から上に向いているものとします）に、月の軌道といくつかの月の位置、月の周りを回るかぐやの軌道を描いたものです。月の軌道は、x軸とy軸を通る平面上にある、原点を中心とする円とします。月の周りを回るかぐやの軌道は、x軸とz軸を通る平面に平行な平面上にある円とし、その中心は月の中心と一致します。月は、その軌道に沿って描かれた矢印の方向に回っているものとします。
右の図で、月の位置はＡ，Ｂ，Ｃの３つが描かれています。月を横切る直線がかぐやの軌道です。かぐやは月の周りを回っているので軌道は円ですが、z軸の正の方向から見ているので、図のx軸に平行な直線に見えます（月の位置が変わっても、つねにx軸に平行であることに注意してください）。かぐやは、その軌道上に描かれた矢印の方向に回っているものとします。
かぐやが地球から見て月の裏側に隠れてしまうと、地球と直接通信ができなくなります。かぐやの管制を担当するあなたは、かぐやが月の裏側に隠れる時間が、与えられた時間の中でどれだけになるかをプログラムで求めようとしています。
月の地球に対する位置と分単位での時間tが与えられたとき、その位置から始めてt分後までの間に、かぐやが月の裏側に隠れる時間を求めるプログラムを作成してください。ただし、地球とかぐやは点、月は半径 1800 km の球と考えます。月は半径 380000 km の軌道を 2500000 秒で一周し、かぐやは月の表面から高度 100 km の円上を２時間で一周するものとします。かぐやの最初の位置は、かぐやの軌道がz座標で最大の値をとる位置とします。
入力
入力は以下の形式で与えられる。
m
t
m
(0 ≤
m
< 360) は月の位置を上の図のx軸の正の部分からy軸の正の部分に向かって反時計回りに測った角度を整数で表したものである。
t
(1 ≤
t
≤ 10000) は分で測った時間を表す整数である。
出力
はじめの位置から
t
分経過するまでの間に、かぐやが月の裏側に隠れる時間（分）を実数で出力する。ただし、誤差がプラスマイナス 1.0 分を超えてはならない。この条件を満たせば小数点以下何桁表示してもよい。
入出力例
入力例１
90 10
出力例１
0.0
入力例２
0 120
出力例２
47.73

Submitted solutions:

code_snippet: #include <cmath>
#include <iostream>
using namespace std;

uint64_t seed = 1234567891234567891;
uint64_t xorshift64() {
	seed ^= seed << 13;
	seed ^= seed >> 7;
	seed ^= seed << 17;
	return seed;
}
float rand_float() {
	return xorshift64() / float(uint64_t(-1));
}

int main() {
	int M, T;
	cin >> M >> T;
	const float pi = acos(-1.0);
	const float limit = -0.31565427002642061149526714494746;
	const float Z0 = 2 * pi * T / (2500000.0 / 60.0);
	const float Z1 = 2 * pi * T / 120.0;
	const float Z2 = 2 * pi * (M / 360.0);
	int success = 0;
	int samples = 0;
	while (true) {
		if (samples % 1000 == 0) {
			double p = (success + 0.5) / (samples + 1.0);
			double stdev = sqrt(p * (1.0 - p) / (samples + 1.0));
			if ((stdev * 2.0) * T < 1.0) {
				break;
			}
		}
		float t = rand_float();
		float x = cos(Z0 * t + Z2) * sin(Z1 * t);
		if (x < limit) {
			success += 1;
		}
		samples += 1;
	}
	cout.precision(6);
	cout << fixed << double(success) / samples * T << endl;
	return 0;
}
accuracy: 1
time_ms: 1670
memory_kb: 3644
final_rank: 13

code_snippet: #include <cmath>
#include <iostream>
using namespace std;

uint64_t seed = 1234567891234567891;
uint64_t xorshift64() {
	seed ^= seed << 13;
	seed ^= seed >> 7;
	seed ^= seed << 17;
	return seed;
}
double rand_double() {
	return xorshift64() / double(uint64_t(-1));
}

int main() {
	int M, T;
	cin >> M >> T;
	const double pi = acos(-1.0);
	const double limit = -0.31565427002642061149526714494746;
	const double Z0 = 2 * pi * T / (2500000.0 / 60.0);
	const double Z1 = 2 * pi * T / 120.0;
	const double Z2 = 2 * pi * (M / 360.0);
	int success = 0;
	int samples = 0;
	while (true) {
		if (samples % 1000 == 0) {
			double p = (success + 0.5) / (samples + 1.0);
			double stdev = sqrt(p * (1.0 - p) / (samples + 1.0));
			if ((stdev * 2.0) * T < 1.0) {
				break;
			}
		}
		double t = rand_double();
		double x = cos(Z0 * t + Z2) * sin(Z1 * t);
		if (x < limit) {
			success += 1;
		}
		samples += 1;
	}
	cout.precision(6);
	cout << fixed << double(success) / samples * T << endl;
	return 0;
}
accuracy: 1
time_ms: 2770
memory_kb: 3924
final_rank: 14

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 4000000000000000000 //オーバーフローに注意
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	double R_moon = 380000;
	double r_moon = 1800;
	double R_kaguya = 1900;

	double va_moon = (2*M_PI/2500000.0)*60.0;
	double va_kaguya = 2*M_PI/120.0;

	double first_angle,T;

	scanf("%lf %lf",&first_angle,&T);

	double first_rad = first_angle*(M_PI/180.0);

	double diff_t = 0.001;
	double ans = 0;

	for(double t = 0; t < T; t += diff_t){

		double now_rad = first_rad+va_moon*t;
		double x_moon = R_moon*cos(now_rad);
		double y_moon = R_moon*sin(now_rad);
		double z_moon = 0;


		double now_rad_k = va_kaguya*t;
		double x_kaguya = -R_kaguya*sin(now_rad_k)+x_moon;
		double y_kaguya = y_moon;
		double z_kaguya = R_kaguya*cos(now_rad_k);

		double A = x_kaguya*x_kaguya + y_kaguya*y_kaguya + z_kaguya*z_kaguya;
		double B = -2.0*(x_kaguya*x_moon + y_kaguya*y_moon + z_kaguya*z_moon);
		double C = x_moon*x_moon + y_moon*y_moon - r_moon*r_moon;

		double D = B*B -4*A*C;

		if(D > EPS){
			double tmp = (sqrt(D)-B)/(2.0*A);
			if(tmp < 1.0){

				ans += diff_t;
			}
		}
	}

	printf("%.10lf\n",ans);

	return 0;
}
accuracy: 1
time_ms: 1180
memory_kb: 3544
final_rank: 10

code_snippet: #include<iostream>
#include<cmath>
using namespace std;
int M,T;
double abs(double x,double y,double z){return sqrt(x*x+y*y+z*z);}
main()
{
	cin>>M>>T;
	int ans=0;
	for(int i=0;i<T*60;i++)
	{
		double r=M+360/25e5*i;
		r=r*M_PI/180;
		double t=360/72e2*i;
		t=t*M_PI/180;
		if(cos(r)>=0&&sin(t)>=0||cos(r)<=0&&sin(t)<=0)
		{
			continue;
		}
		double mx=38e4*cos(r),my=38e4*sin(r),mz=0;
		double px=mx-19e2*sin(t),py=my,pz=19e2*cos(t);
		double A=abs(mx,my,mz),B=abs(px,py,pz),C=abs(mx-px,my-py,mz-pz);
		double theta=acos((A*A+B*B-C*C)/2/A/B);
		double h=A*sin(theta);
		if(h<=1800)ans++;
	}
	cout<<ans/60.<<endl;
}
accuracy: 1
time_ms: 80
memory_kb: 3612
final_rank: 6

code_snippet: #include <iostream>
#include <cmath>

static const int MOD = 1000000007;
using namespace std;

int main() {
    double m; int T;
    cin >> m >> T;
    double pi = acos(-1);
    m /= 180/pi;
    double ans = 0;
    for (int _ = 0; _ < T*100; ++_) {
        double t = _/100.0;
        double x = 3800, p = 19;
        double cs = x*p*cos(m+t*pi*2*60/2500000)*sin(t/120*pi*2);
        double A = x*x+p*p-2*cs, B = x*x-cs, C = 3800*3800-18*18;
        double d = B*B-A*C;
        if(d > 0 && (B+sqrt(d))/A < 1) ans += 0.01;
    }
    printf("%.10lf\n", ans);
    return 0;
}
accuracy: 1
time_ms: 70
memory_kb: 3544
final_rank: 4

code_snippet: #include<cstdio>
#include<cmath>
using namespace std;
static const double pi = 2.0 * acos(0.0);

double m, t;

int main(){
	scanf("%lf %lf", &m, &t);
	double res = 0.0;
	for(double ct = 0.0; ct < t; ct += 0.01){
		double theta = 0.5 * pi + pi / 60.0 * ct;
		double z = 1900.0 * sin(theta);
		double x2 = 1900.0 * cos(theta);
		double theta2 = -pi / 180.0 * m + pi / 2.0 - 2.0 * pi * ct / (2500000.0 / 60.0);
		double y = x2 * sin(theta2);
		double x = x2 * cos(theta2);
		if(y < 0.0) continue;
		double L = 380000.0;
		double l = 1800.0;
		double r_ = L * l / sqrt(L * L - l * l);
		double r = r_ * (1.0 + y / 380000.0);
		if(sqrt(z * z + x * x) < r) res += 0.01;
	}
	printf("%.3lf\n", res);
	return 0;
}
accuracy: 1
time_ms: 90
memory_kb: 3148
final_rank: 2

code_snippet: #include<cstdio>
#include<cmath>
using namespace std;
static const double pi = 2.0 * acos(0.0);

double m, t;

int main(){
	scanf("%lf %lf", &m, &t);
	double res = 0.0;
	for(double ct = 0.0; ct < t; ct += 0.01){
		double theta = 0.5 * pi + pi / 60.0 * ct;
		double z = 1900.0 * sin(theta);
		double x2 = 1900.0 * cos(theta);
		double theta2 = -pi / 180.0 * m + pi / 2.0 - 2.0 * pi * ct / (2500000.0 / 60.0);
		double y = x2 * sin(theta2);
		double x = x2 * cos(theta2);
		double lim = 1800.0 * 1800.0 / 380000.0;
		if(y < -lim) continue;
		double r = 1800.0 * (1.0 + y / 380000.0);
		if(sqrt(z * z + x * x) < r) res += 0.01;
	}
	printf("%.3lf\n", res);
	return 0;
}
accuracy: 1
time_ms: 90
memory_kb: 3064
final_rank: 1

code_snippet: #include<cstdio>
#include<cmath>
using namespace std;
static const double pi = 2.0 * acos(0.0);

double m, t;

int main(){
	scanf("%lf %lf", &m, &t);
	double res = 0.0;
	for(double ct = 0.0; ct < t; ct += 0.01){
		double theta = 0.5 * pi + pi / 60.0 * ct;
		double z = 1900.0 * sin(theta);
		double x2 = 1900.0 * cos(theta);
		double theta2 = -pi / 180.0 * m + pi / 2.0 - 2.0 * pi * ct / (2500000.0 / 60.0);
		double y = x2 * sin(theta2);
		double x = x2 * cos(theta2);
		if(y < 0.0) continue;
		double r = 1800.0 * (1.0 + y / 380000.0);
		if(sqrt(z * z + x * x) < r) res += 0.01;
	}
	printf("%.3lf\n", res);
	return 0;
}
accuracy: 1
time_ms: 90
memory_kb: 3148
final_rank: 2

code_snippet: #include <cmath>
#include <vector>
#include <iostream>
using namespace std;
const double moondist = 380000;
const double kaguyadist = 1900;
const double moontime = 2500000;
const double kaguyatime = 7200;
const double moonradius = 1800;
const double pi = acos(-1.0);
double sqr(double x) {
    return x * x;
}
int main() {
    double l = moondist, r = moondist + kaguyadist;
    for(int i = 0; i < 100; ++i) {
        double m = (l + r) * 0.5;
        double tcos = (m * m + moondist * moondist - kaguyadist * kaguyadist) / (2 * m * moondist);
        double tsin = sqrt(1.0 - sqr(tcos));
        if(tsin < moonradius / moondist) r = m;
        else l = m;
    }
    double threshold = l;
    int M, T;
    cin >> M >> T; T *= 60;
    double theta = (M / 360.0) * (2 * pi);
    int sep = 1000000;
    double ans = 0.0;
    for(int i = 0; i <= 2 * sep; ++i) {
        double t = double(T) * i / (2 * sep);
        double mx = moondist * cos(theta + t / moontime * (2 * pi));
        double my = moondist * sin(theta + t / moontime * (2 * pi));
        double mz = 0.0;
        double vx = -kaguyadist * sin(t / kaguyatime * (2 * pi));
        double vy = 0.0;
        double vz = kaguyadist * cos(t / kaguyatime * (2 * pi));
        double kx = mx + vx;
        double ky = my + vy;
        double kz = mz + vz;
        double dist = sqrt(sqr(kx) + sqr(ky) + sqr(kz));
        if(dist > threshold) {
            if(i == 0 || i == 2 * sep) ans += 1;
            else if(i % 2 == 0) ans += 2;
            else ans += 4;
        }
    }
    ans /= 6 * sep;
    ans *= T;
    cout.precision(15);
    cout << fixed << ans / 60.0 << endl;
    return 0;
}
accuracy: 1
time_ms: 240
memory_kb: 3684
final_rank: 9

code_snippet: #include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

struct Vector{
	double x,y,z;
	Vector(double x,double y,double z):x(x),y(y),z(z){}
};

double norm(Vector v){
	return v.x*v.x+v.y*v.y+v.z*v.z;
}
double abs(Vector v){
	return sqrt(norm(v));
}

Vector operator-(Vector a,Vector b){
	return Vector(a.x-b.x,a.y-b.y,a.z-b.z);
}
double dot(Vector a,Vector b){
	return a.x*b.x+a.y*b.y+a.z*b.z;
}
double cross(Vector a,Vector b){
	return abs(Vector(a.x*b.z-a.z*b.y,a.z*b.x-a.x*b.z,a.x*b.y-a.y*b.x));
}

int main(){
	double m,t;cin>>m>>t;t*=60;
	m=m/180*M_PI;
	double speed=2*M_PI/2500000;
	double speed2=2*M_PI/7200;
	double R=380000,r=1900;
	double cnt=0;
	for(int i=0;i<t;i++){
		double theta=m+speed*i;
		double theta2=(M_PI/2)+speed2*i;
		double Ex=0,Ey=0,Ez=0;
		double Mx=R*cos(theta),My=R*sin(theta),Mz=0;
		double Kx=Mx+r*cos(theta2),Ky=My,Kz=r*sin(theta2);
		Vector E(Ex,Ey,Ez),M(Mx,My,Mz),K(Kx,Ky,Kz);
		if(dot(E-K,M-K)<0)continue;
		double dist=abs(cross(K-E,M-E)/abs(K-E));
		if(dist<=1800){
			cnt+=1;
		}
	}
	printf("%.5lf\n",cnt/60);
}
accuracy: 1
time_ms: 70
memory_kb: 3580
final_rank: 5

code_snippet: #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
const ld R=380000,r=1800,s=100,t1=2500000,t2=7200;
bool judge(ld a,ld b,ld c){
/*  ld a=(R*X-(r+s)*Y)*(R*X+(r+s)*Y)+1-X*X-Y*Y;
  ld b=-2*(R*R*X*X-R*(r+s)*X*Y+Y*Y);
  ld c=(R*R-1)*X*X+1-r*r; */

  ld d=b*b-4*a*c;
  if(d<0) return true;
  ld ans=(-b-sqrt(d))/(a*2);
  if(ans>1) return true;
  return false;
}
int main(){
  int m,t_;
  cin>>m>>t_;
  ld m2=(ld)m;
  //return 0;
  ld ans=0;
  for(int i=0;i<t_*60;i++){
    ld t=(ld)i;
    ld xm=R*cos(2*M_PI*((t/t1)+(m2/360)));
    ld ym=R*sin(2*M_PI*((t/t1)+(m2/360)));
    ld zm=0;

    ld xk=-(r+s)*sin(2*M_PI*(t/t2))+xm;
    ld yk=ym;
    ld zk=(r+s)*cos(2*M_PI*(t/t2));

    //if(i==0) cout<<xm<<" "<<ym<<" "<<zm<<" "<<xk<<" "<<yk<<" "<<zk<<endl;

    ld a=xk*xk+yk*yk+zk*zk;
    ld b=-2*(xk*xm+yk*ym);
    ld c=R*R-r*r;
    if(!judge(a,b,c)) ans+=1;
  }
  cout<<(ans/60)<<endl;
}
accuracy: 1
time_ms: 170
memory_kb: 3612
final_rank: 7

code_snippet: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
#define PB push_back
#define M 1000000007
#define B 500
double pi=3.1415926535;
int m,tt;
int judge(double t){
    double xk,yk,zk,xm,ym,zm;
    double arg;
    arg=pi/180*m;
    arg+=(t/41667*2*pi);
    zm=0;
    xm=cos(arg)*380000;
    ym=sin(arg)*380000;
    arg=t*2*pi/120;
    yk=ym;
    zk=zm+cos(arg)*1900;
    xk=xm-sin(arg)*1900;
    double k;
    k=(xk*xm+yk*ym+zk*zm)/(xk*xk+yk*yk+zk*zk);
    double xh,yh,zh;
    xh=xk*k;
    yh=yk*k;
    zh=zk*k;
    double xd,yd,zd;
    xd=xh-xm;
    yd=yh-ym;
    zd=zh-zm;
    if(k<=1&&xd*xd+yd*yd+zd*zd<1800*1800){
        return 1;
    }
    else return 0;
}
int main(void){
   scanf("%d%d",&m,&tt);
   double ans=0;
   for(int i=0;i<=tt*B;i++){
       ans+=judge(D(i)/B);
   }
   printf("%lf\n",ans/B);
}
accuracy: 1
time_ms: 610
memory_kb: 3564
final_rank: 8

code_snippet: #include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <utility>
using namespace std;
const double EPS = 1e-10;
const double INF = 1e12;
const double PI = acos(-1);
 
struct Point{
    double x,y,z;
    Point(double x, double y, double z):x(x), y(y), z(z){}
    Point(){}
    Point &operator +=(const Point &a){ x+=a.x; y+=a.y; z+=a.z; return *this; }
    Point &operator -=(const Point &a){ x-=a.x; y-=a.y; z-=a.z; return *this; }
    Point &operator *=(const double &a){ x*=a; y*=a; z*=a; return *this; }
    Point operator +(const Point &a) const{ return Point(x+a.x, y+a.y, z+a.z); }
    Point operator -(const Point &a) const{ return Point(x-a.x, y-a.y, z-a.z); }
    Point operator *(const double &a) const{ return Point(a*x, a*y, a*z); }
    Point operator -() { return Point(-x, -y, -z); }
};
 
double dot(const Point &a, const Point &b){
    return a.x*b.x +a.y*b.y +a.z*b.z;
}
Point cross(const Point &a, const Point &b){
    return Point(a.y*b.z -a.z*b.y, a.z*b.x -a.x*b.z, a.x*b.y -a.y*b.x);
}
double abs(const Point &a){
    return sqrt(dot(a, a));
}
Point unit(const Point &a){
    return a *(1/abs(a));
}
bool operator ==(const Point &a, const Point &b){
    return abs(a-b) < EPS;
}

Point projectionLP3(Point p, Point q, Point c){
    double t = dot(unit(q-p), c-p);
    return p +unit(q-p) *t;
}
double distanceSP3(Point p, Point q, Point c){
    Point r = projectionLP3(p, q, c);
    if(dot(q-p, r-p) < 0) return abs(c-p);
    if(dot(p-q, r-q) < 0) return abs(c-q);
    return abs(c-r);
}

pair<Point, Point> calcpos(double t, double m){
    using P2d = complex<double>;
    double arg1 = m*PI/180 +t/2500000 *2*PI;
    P2d moon2d = P2d(380000, 0) *P2d(cos(arg1), sin(arg1));
    Point moon = Point(moon2d.real(), moon2d.imag(), 0);
    double arg2 = t/7200 *2*PI;
    P2d kaguya2d = P2d(0, 1900) *P2d(cos(arg2), sin(arg2));
    Point kaguya = moon + Point(kaguya2d.real(), 0, kaguya2d.imag());
    return make_pair(moon, kaguya);
}

int main(){
    cout << fixed << setprecision(3);
    double m,t;
    cin >> m >> t;
    t *= 60;
    double dt = 1e-1;
    double ans = 0;
    Point origin(0, 0, 0);
    for(double time=dt/2; time<t; time+=dt){
        pair<Point, Point> pos = calcpos(time, m);
        if(distanceSP3(origin, pos.second, pos.first) < 1800){
            ans += dt;
        }
    }
    cout << fixed << setprecision(3);
    cout << ans/60 << endl;
    return 0;
}
accuracy: 1
time_ms: 950
memory_kb: 3668
final_rank: 11

code_snippet: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const double EPS = 1e-8, INF = 1e12, PI = acos(-1.0);
typedef complex<double> P;
namespace std{
	bool operator<(const P& a, const P& b){
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
inline double cross(const P& a, const P& b){ return imag(conj(a)*b); }
inline double dot(const P& a, const P& b){ return real(conj(a)*b); }
struct L : public vector<P>{
	L(const P &a, const P &b) {
		push_back(a); push_back(b);
	}
};
typedef vector<P> G;
inline int ccw(P a, P b, P c) {
	b -= a; c -= a;
	if(cross(b, c) >  EPS)   return +1;      // counter clockwise
	if(cross(b, c) < -EPS)   return -1;      // clockwise
	if(dot(b, c)   < -EPS)   return +2;      // c--a--b on line
	if(norm(b)+EPS <norm(c)) return -2;      // a--b--c on line
	return 0;                                   // c is between a and b (inclusive)
}
G intersect(P c, double r, P p1, P p2) {
  P u = p2 - p1, v = p1 - c;
  auto a = dot(u,u), b = dot(u,v)/a, t = (dot(v,v) - r*r)/a;
  auto det = b*b - t;
  if (det <  -EPS) return {};          // no solution

  auto t1 = -b - sqrt(det), t2 = -b + sqrt(det);
  G ps;
  auto insert_if_possible = [&](P p) {
    for (auto q: ps) if (abs(dot(p-q, p-q)) < EPS) return;
    ps.push_back(p);
  };
  if (r - norm(p1-c) > - EPS) insert_if_possible(p1);
  if (t1 > -EPS && 1-t1 > -EPS) insert_if_possible(p1+t1*u);
  if (t2 > -EPS && 1-t2 > -EPS) insert_if_possible(p1+t2*u);
  if (r - norm(p2-c) > -EPS) insert_if_possible(p2);
  return ps;
}

const double rm = 1800;
const double om = 380000;
const double pm = 2500000;

const double ok = rm + 100;
const double pk = 2 * 3600;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int m, t; cin >> m >> t; t *= 60;
	double ans = 0;
	const int ITER = t * 10;
	
	rep(it, ITER){
		double T = t * (it + 0.5) / ITER;
		double tm = m / 180.0 * PI + T * 2 * PI / pm;
		double tk = PI / 2 + T * 2 * PI / pk;
		
		double mx = om * cos(tm), my = om * sin(tm);
		double kx = ok * cos(tk), kz = ok * sin(tk), ky = 0;
		kx += mx; ky += my;
		
		P K(kx, ky);
		P M0 (mx, my);
		P M = K * dot(M0, K) / norm(K);
		double d = abs(M - M0);
		double mr;
		if(d > rm - EPS) mr = 0;
		else mr = sqrt(rm * rm - d * d);
		
		bool hide = !intersect(P(abs(M), 0), mr, P(0, 0), P(abs(K), kz)).empty();
		if(hide) ans += 1.0 * t / ITER;
	}
	printf("%.20f\n", ans / 60);
	return 0;
}
accuracy: 1
time_ms: 1340
memory_kb: 3604
final_rank: 12

code_snippet: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const double EPS = 1e-8, INF = 1e12, PI = acos(-1.0);
typedef complex<double> P;
namespace std{
	bool operator<(const P& a, const P& b){
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
inline double cross(const P& a, const P& b){ return imag(conj(a)*b); }
inline double dot(const P& a, const P& b){ return real(conj(a)*b); }
struct L : public vector<P>{
	L(const P &a, const P &b) {
		push_back(a); push_back(b);
	}
};
typedef vector<P> G;
inline int ccw(P a, P b, P c) {
	b -= a; c -= a;
	if(cross(b, c) >  EPS)   return +1;      // counter clockwise
	if(cross(b, c) < -EPS)   return -1;      // clockwise
	if(dot(b, c)   < -EPS)   return +2;      // c--a--b on line
	if(norm(b)+EPS <norm(c)) return -2;      // a--b--c on line
	return 0;                                   // c is between a and b (inclusive)
}
G intersect(P c, double r, P p1, P p2) {
  P u = p2 - p1, v = p1 - c;
  auto a = dot(u,u), b = dot(u,v)/a, t = (dot(v,v) - r*r)/a;
  auto det = b*b - t;
  if (det <  -EPS) return {};          // no solution

  auto t1 = -b - sqrt(det), t2 = -b + sqrt(det);
  G ps;
  auto insert_if_possible = [&](P p) {
    for (auto q: ps) if (abs(dot(p-q, p-q)) < EPS) return;
    ps.push_back(p);
  };
  if (r - norm(p1-c) > - EPS) insert_if_possible(p1);
  if (t1 > -EPS && 1-t1 > -EPS) insert_if_possible(p1+t1*u);
  if (t2 > -EPS && 1-t2 > -EPS) insert_if_possible(p1+t2*u);
  if (r - norm(p2-c) > -EPS) insert_if_possible(p2);
  return ps;
}

const double rm = 1800;
const double om = 380000;
const double pm = 2500000;

const double ok = rm + 100;
const double pk = 2 * 3600;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int m, t; cin >> m >> t; t *= 60;
	double ans = 0;
	const int ITER = t * 10;
	
	rep(it, ITER){
		double T = t * (it + 0.5) / ITER;
		double tm = m / 180 * PI + T * 2 * PI / pm;
		double tk = PI / 2 + T * 2 * PI / pk;
		
		double mx = om * cos(tm), my = om * sin(tm);
		double kx = ok * cos(tk), kz = ok * sin(tk), ky = 0;
		kx += mx; ky += my;
		
		P K(kx, ky);
		P M0 (mx, my);
		P M = K * dot(M0, K) / norm(K);
		double d = abs(M - M0);
		double mr;
		if(d > rm - EPS) mr = 0;
		else mr = sqrt(rm * rm - d * d);
		
		bool hide = !intersect(P(abs(M), 0), mr, P(0, 0), P(abs(K), kz)).empty();
		if(hide) ans += 1.0 * t / ITER;
	}
	printf("%.20f\n", ans / 60);
	return 0;
}
accuracy: 0.5
time_ms: 1080
memory_kb: 3600
final_rank: 16

code_snippet: #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const double EPS = 1e-8, INF = 1e12, PI = acos(-1.0);
typedef complex<double> P;
namespace std{
	bool operator<(const P& a, const P& b){
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
inline double cross(const P& a, const P& b){ return imag(conj(a)*b); }
inline double dot(const P& a, const P& b){ return real(conj(a)*b); }
struct L : public vector<P>{
	L(const P &a, const P &b) {
		push_back(a); push_back(b);
	}
};
typedef vector<P> G;
inline int ccw(P a, P b, P c) {
	b -= a; c -= a;
	if(cross(b, c) >  EPS)   return +1;      // counter clockwise
	if(cross(b, c) < -EPS)   return -1;      // clockwise
	if(dot(b, c)   < -EPS)   return +2;      // c--a--b on line
	if(norm(b)+EPS <norm(c)) return -2;      // a--b--c on line
	return 0;                                   // c is between a and b (inclusive)
}
G intersect(P c, double r, P p1, P p2) {
  P u = p2 - p1, v = p1 - c;
  auto a = dot(u,u), b = dot(u,v)/a, t = (dot(v,v) - r*r)/a;
  auto det = b*b - t;
  if (det <  -EPS) return {};          // no solution

  auto t1 = -b - sqrt(det), t2 = -b + sqrt(det);
  G ps;
  auto insert_if_possible = [&](P p) {
    for (auto q: ps) if (abs(dot(p-q, p-q)) < EPS) return;
    ps.push_back(p);
  };
  if (r - norm(p1-c) > - EPS) insert_if_possible(p1);
  if (t1 > -EPS && 1-t1 > -EPS) insert_if_possible(p1+t1*u);
  if (t2 > -EPS && 1-t2 > -EPS) insert_if_possible(p1+t2*u);
  if (r - norm(p2-c) > -EPS) insert_if_possible(p2);
  return ps;
}

const double rm = 1800;
const double om = 380000;
const double pm = 2500000;

const double ok = rm + 100;
const double pk = 2 * 3600;

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	int m, t; cin >> m >> t; t *= 60;
	double ans = 0;
	const int ITER = t * 10;
	
	rep(it, ITER){
		double T = t * (it + 0.5) / (ITER - 1);
		double tm = m / 180 * PI + T * 2 * PI / pm;
		double tk = PI / 2 + T * 2 * PI / pk;
		
		double mx = om * cos(tm), my = om * sin(tm);
		double kx = ok * cos(tk), kz = ok * sin(tk), ky = 0;
		kx += mx; ky += my;
		
		P K(kx, ky);
		P M0 (mx, my);
		P M = K * dot(M0, K) / norm(K);
		double d = abs(M - M0);
		double mr;
		if(d > rm - EPS) mr = 0;
		else mr = sqrt(rm * rm - d * d);
		
		bool hide = !intersect(P(abs(M), 0), mr, P(0, 0), P(abs(K), kz)).empty();
		if(hide) ans += t / (ITER - 1.0);
	}
	printf("%.20f\n", ans / 60);
	return 0;
}
accuracy: 0.5
time_ms: 1110
memory_kb: 3524
final_rank: 15

code_snippet: #include <bits/stdc++.h>
#define double long double
#define EPS 1e-10
#define PI 3.141592653589793238462643383279
using namespace std;

int cnt = 0;

bool ok(double s){
	double phi = s * 2.0L * PI / 2500000.0L,shi = s * 2.0L * PI / 7200.0L;
	double fiv = cos(phi) * cos(phi) * sin(1.5L * PI - shi) * sin(1.5L * PI - shi) + sin(phi) * sin(phi);
	double fou = cos(phi) * cos(1.5L * PI - shi) + 200.0L;
	double a = asin(1800.0L / 380000.0L),c;
	fou *= fou;
	c = fou;
	fou *= tan(a) * tan(a);
	c += sin(phi) * sin(phi);
	return fiv < fou - EPS && 380000.0L * cos(a) * cos(a) < 1900.0L * (cos(phi) * cos(1.5L * PI - shi) + 200.0L) - EPS;
}

int main(){
double m,t,ans = 0;
cin >> m >> t;
double sa = m * 2500000.0 / 360.0;
for(double s = 0;s <= t * 60.0;s += 0.001){
if(ok(sa + s) && ok(sa + s + 0.001)) ans += 0.001;
}
printf("%.9Lf\n",ans / 60.0);
return 0;
}
accuracy: 0.375
time_ms: 1580
memory_kb: 3340
final_rank: 18

code_snippet: #include <bits/stdc++.h>
#define double long double
#define EPS 1e-9
#define PI 3.141592653589793238462643383279
using namespace std;

int cnt = 0;

bool ok(double s){
double phi = s * 2.0L * PI / 2500000.0L,shi = s * 2.0L * PI / 7200.0L;
double fiv = cos(phi) * cos(phi) * sin(1.5L * PI - shi) * sin(1.5L * PI - shi) + sin(phi) * sin(phi);
double fou = cos(phi) * cos(1.5L * PI - shi) + 200.0L;
double a = asin(1800.0L / 380000.0L),c;
fou *= fou;
c = fou;
fou *= tan(a) * tan(a);
c += sin(phi) * sin(phi);
return fiv < fou - EPS && 380000.0L * cos(a) * cos(a) < 1900.0L * (cos(phi) * cos(1.5L * PI - shi) + 200.0L) - EPS;
}

int main(){
double m,t,ans = 0;
cin >> m >> t;
double sa = m * 2500000.0 / 360.0;
for(double s = 0;s <= t * 60.0;s += 0.001){
if(ok(sa + s) && ok(sa + s + 0.001)) ans += 0.001;
}
printf("%.9Lf\n",ans / 60.0);
return 0;
}
accuracy: 0.375
time_ms: 1440
memory_kb: 3544
final_rank: 20

code_snippet: #include <bits/stdc++.h>
#define double long double
#define PI 3.141592653589793238462643383279
using namespace std;

int cnt = 0;

bool ok(double s){
	double phi = s * 2.0L * PI / 2500000.0L,shi = s * 2.0L * PI / 7200.0L;
	double fiv = cos(phi) * cos(phi) * sin(1.5L * PI - shi) * sin(1.5L * PI - shi) + sin(phi) * sin(phi);
	double fou = cos(phi) * cos(1.5L * PI - shi) + 200.0L;
	double a = asin(1800.0L / 380000.0L),c;
	fou *= fou;
	c = fou;
	fou *= tan(a) * tan(a);
	c += sin(phi) * sin(phi);
	return fiv < fou && 380000.0L * cos(a) * cos(a) < 1900.0L * (cos(phi) * cos(1.5L * PI - shi) + 200.0L);
}

int main(){
	double m,t,ans = 0;
	cin >> m >> t;
	double sa = m * 2500000.0 / 360.0;
	for(double s = 0;s <= t * 60.0;s += 0.001){
		if(ok(sa + s) && ok(sa + s + 0.001)) ans += 0.001;
	}
	printf("%.9Lf\n",ans / 60.0);
	return 0;
}
accuracy: 0.375
time_ms: 1440
memory_kb: 3400
final_rank: 19

code_snippet: #include <bits/stdc++.h>
#define double long double
#define PI 3.141592653589793238462643383279
using namespace std;

int cnt = 0;

bool ok(double s){
	double phi = s * 2.0L * PI / 2500000.0L,shi = s * 2.0L * PI / 7200.0L;
	double fiv = cos(phi) * cos(phi) * sin(1.5L * PI - shi) * sin(1.5L * PI - shi) + sin(phi) * sin(phi);
	double fou = cos(phi) * cos(1.5L * PI - shi) + 200.0L;
	double a = asin(1800.0L / 380000.0L),c;
	fou *= fou;
	c = fou;
	fou *= tan(a) * tan(a);
	c += sin(phi) * sin(phi);
	return fiv < fou && 380000.0L * cos(a) * cos(a) < 1900.0L * (cos(phi) * cos(1.5L * PI - shi) + 200.0L);
}

int main(){
	double m,t,ans = 0;
	cin >> m >> t;
	double sa = m * 2500000.0 / 360.0;
	for(double s = 0;s <= t * 60.0;s += 0.001){
		if(ok(sa + s + 0.0005)) ans += 0.001;
	}
	printf("%.9Lf\n",ans / 60.0);
	return 0;
}
accuracy: 0.375
time_ms: 1120
memory_kb: 3456
final_rank: 17