akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
#define ll long long
int n,p[11],a[11]={0,1,2,4,7,12,20,29,38,52,73};
ll g[11][11],M;
int main()
{
    scanf("%d",&n);
    for(int i=2;i<=n;++i)
    {
        for(int j=1;j<i;++j)g[i][j]=g[j][i]=(M+1)*a[j];
        if(i==n)break;
        for(int j=1;j<=i;++j)p[j]=j;
        do
        {
            ll s=0;
            for(int j=1;j<i;++j)s+=g[p[j]][p[j+1]];
            M=max(M,s);
        }while(next_permutation(&p[1],&p[i+1]));
    }
    for(int i=1;i<=n;++i,puts(""))
        for(int j=1;j<=n;++j)
            printf("%lld ",g[i][j]);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, d;
    int cnt = 0;
    cin >> n >> d;
    for(int i = 1; i <= n; i++)
    {
        cnt++;
        i += 2 * d;
    }
    cout << cnt;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)


int main()
{
    int N, T;
    cin >> N >> T;
    vector<pair<int,int>> dish(N);
    REP(i, N) cin >> dish[i].first >> dish[i].second;

    sort(dish.begin(), dish.end());

    int ans = 0;
    vector<int> dp(T, 0);
    REP(i, N){
        int A = dish[i].first;
        int B = dish[i].second;
        ans = max(ans, dp[T-1]+B);
        for(int j = T-1; j >= A; --j) dp[j] = max(dp[j], dp[j-A]+B);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
from copy import copy
from itertools import product
h, w = map(int, input().split())
maze = []
max_d = 0
for i in range(h):
    maze.append(input())
for i, j in product(range(h), range(w)):
    if maze[i][j] == '#':
        continue
    s = (i, j)
    pathes = [[s]]
    seen = {s}
    while pathes:
        path = pathes.pop(0)
        a, b = path[-1]
        for point in [(0, 1), (1, 0), (0, -1),(-1, 0)]:
            di, dj = point
            if a + di >= 0 and a + di < h and b + dj >= 0 and b + dj < w and (a+di, b+dj) not in seen and maze[a+di][b+dj]=='.':
                copy_path = copy(path)
                copy_path.append((a + di, b + dj))
                seen.add((a+di, b+dj))
                pathes.append(copy_path)
                max_d = max(max_d, len(copy_path)-1)
print(max_d)
                



Measured memory_bytes: 3572
import math
a,b,h,m = map(int,input().split())
theta_a = 30*h + 0.5*m
theta_b = 6*m
if abs(theta_a - theta_b) < 180:
    theta_diff = abs(theta_a-theta_b)
elif abs(theta_a - theta_b) > 180:
    theta_diff = 360-abs(theta_a-theta_b)
if abs(theta_a - theta_b)==180:
    ans = a+b
else:
    ans = math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(theta_diff)))
print(abs(ans))


Measured memory_bytes: 9576
N = int(input())
A = list(map(int, input().split()))
tmp = A[0]

for i in range(1, N):
  if i % 2 == 0:
    tmp = tmp + A[i]
  else:
    tmp = tmp - A[i]
X = [tmp]*N
for i in range(0, N-1):
  X[i+1] = (A[i] - X[i] // 2) * 2
print(" ".join(list(map(str, X))))

Measured memory_bytes: 19180
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int num = in.nextInt(), WeightLimit = in.nextInt();

		int vmax = (int) Math.pow(10, 5);
		long wmin[] = new long[vmax + 1];
		Arrays.fill(wmin, 1, vmax + 1, Integer.MAX_VALUE);
		
		for ( int i = 1; i <= num; i++ ) {
			int weight = in.nextInt(), value = in.nextInt();

			for ( int targv = vmax; targv - value >= 0; targv-- ) {
				if ( wmin[targv] > wmin[targv - value] + weight ) {
					wmin[targv] = wmin[targv - value] + weight;
				}
			}
		}
		in.close();

		for ( int v = vmax; 0 <= v; v-- ) {
			if ( wmin[v] <= WeightLimit ) {
				System.out.println(v);
				return;
			}
		}		
	}
}

Measured memory_bytes: 23252
#include <iostream>
#define ll long long int
#define endl "\n"
using namespace std;

int main(){
    int N;
    cin>>N;
    int arr[N+1];
    for(int i = 1;i<N+1;i++)
        cin>>arr[i];
    int dp[N+1];
    dp[0] = 0;
    dp[1] = 0;
    dp[2] = abs(arr[2] - arr[1]);
    for(int i = 3;i<N+1;i++)
        dp[i] = min(dp[i-1]+abs(arr[i]-arr[i-1]), dp[i-2]+abs(arr[i]-arr[i-2]));
    cout<<dp[N]<<endl;
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<utility>

using namespace std;

pair<string,bool> solve(string str){
	bool check = false;
	vector<char> strv(str.begin(), str.end());
	stack<char> inside;
	int count = 0;
	int left = 0, right = 0;
	for(char ch:strv){
		inside.push(ch);
		if(ch == '['){
			left = count;
			stack<char> empty;
			swap(inside, empty);
		}
		if(ch == ']'){
			check = true;
			right = count;
			inside.pop();
			strv.erase(strv.begin()+left);
			strv.erase(strv.begin()+right-1);
			int i = 0;
			while(!inside.empty()){
				strv[left+i] = inside.top();
				inside.pop();
				i++;
			}
			break;
		}
		count++;
	}
	string res(strv.begin(), strv.end());
	pair<string,bool> result = make_pair(res, check);
	return result;
}

char reading(char c, int &count){
	if(c == '+') count++;
	else if(c == '-') count--;
	else if(c != '[' && c != ']' && c != '?'){
		int zover = count / ('Z'-'A');
		count -= ('Z'-'A'+1)*zover;
		char newchar = (char)c+count;
		while(newchar>'Z')	newchar = 'A' + newchar - 'Z' - 1;
		while(newchar<'A')	newchar = 'Z' - ('A' - newchar)+1;
		count = 0;
		return (char)newchar;
	}else if(c == '?'){
		count = 0;
		return 'A';
	}else return c;
	return 0;
}
		

int main(){
	string str;
	while(cin >> str,str != "."){
		int count = 0;
		vector<char> res;
		for(char s:str){
			char ch = reading(s, count);
			if(ch != 0)	res.push_back(ch);
		}

		bool check = true;
		string finals(res.begin(), res.end());
		while(check){
			pair<string, bool> pair_res = solve(finals);
			finals = pair_res.first;
			check = pair_res.second;
		}

		cout << finals << endl;
	}

	return 0;
}

Measured memory_bytes: 3200
from math import gcd

K = int(input())
ans = 0
for a in range(1,K+1):
    for b in range(1,K+1):
        g = gcd(a,b)
        if g == 1:
            ans += K
        else:
            for c in range(1,K+1):
                ans += gcd(g,c)

print(ans)

Measured memory_bytes: 9188
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cctype>
#include <map>

const int INT_INF = 1e9;
const long long LONG_INF = 1e18;
const long long MOD = 1e9 + 7;

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> v(m + 1, 0);
    vector<long long> dp(n + 1, 0);
    for (int i = 0; i < m; i++)
    {
        cin >> v[i];
    }

    int index = 0;
    dp[0] = 1;
    if (v[index] != 1)
    {
        dp[1] = 1;
    }
    else
    {
        dp[1] = 0;
        index++;
    }

    for (int i = 2; i <= n; i++)
    {
        if (v[index] == i)
        {
            dp[i] = 0;
            index++;
        }
        else
        {
            dp[i] = (dp[i - 1] + dp[i - 2]) % MOD;
        }
    }

    cout << dp[n] << endl;

    return 0;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const int N = 2e5 + 10;
int q[N];
int n;

void solve() {
	scanf("%d", &n);
	ll sum = 0;
	for(int i = 1; i <= n; i++) scanf("%d", &q[i]);
	sort(q + 1, q + 1 + n);
	sum += q[n];
	int k = n - 2, now = n - 1;
	while(k) {
		sum += q[now], k--;
		if(k) sum += q[now], k--, now--;
		else break;
	}
	printf("%lld\n", sum);
	
}

int main()
{
	int T = 1;
	//scanf("%d", &T);
	while(T--) {
		solve();
	}
}

Measured memory_bytes: 4536
#include<bits/stdc++.h>
using namespace std;

int main()
{

long long n ,a,b;

            cin >>n >>a >>b;

            long long fuck = n % (a+b);

                            long long has = n /(a+b);

                     has = has *a;

           has = has + min(fuck,a);

    cout << has;

return 0;}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

namespace _20190629_ABC
{
    class Program
    {
        static void Main(string[] args)
        {
var N = int.Parse(Console.ReadLine());
            var di = Console.ReadLine().Split(' ');
            int X, Y; // X:配列の中央の大きいほう、 Y:配列の真ん中の小さいほう

            int[] int_di = new int[N];
            for (int i = 0; i < N; i++)
            {
                int_di[i] = int.Parse(di[i]);
            }
            // diを降順に整列し、平均値を求める
            Array.Sort(int_di);
            X = int_di[(int_di.Length / 2)];
            Y = int_di[((int_di.Length / 2) - 1)];
            Console.WriteLine(X - Y);
    }
}
}

Measured memory_bytes: 18784
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#define N 210000
using namespace std;
int n,m,a[N],s[N],cnt[N],ans;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),s[a[i]]++;
	for(int i=1;i<=n;i++) cnt[max(1,i-s[i]+1)]++,cnt[i+1]--;
	for(int i=1;i<=n;i++) {cnt[i]+=cnt[i-1];if(cnt[i]) ans++;}
	while(m--)
	{
		int x,y,p;scanf("%d%d",&x,&y);
		p=a[x]-s[a[x]]+1;
		if(p>=1)
		{
			cnt[p]--;
			if(cnt[p]==0) ans--;
		}
		s[a[x]]--;
		
		a[x]=y;
		s[a[x]]++;
		p=a[x]-s[a[x]]+1;
		if(p>=1)
		{
			if(cnt[p]==0) ans++;
			cnt[p]++;
		}
		printf("%d\n",n-ans);
	}
	return 0;
}

Measured memory_bytes: 3712
#include<bits/stdc++.h>
#define fi first
#define se second
#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define rrep(i, n) for (int (i) = 1; (i) <= (n); (i++))
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define yn {puts("Yes");}else {puts("No");}
#define print(x) cout << (x) << endl;
#define printa(x, n) for(ll i = 0; i < n; i++) {cout << (x[i]) << " ";} cout << endl;
#define printd(x) printf("%.12f\n", ans);
#define Yes() cout << "Yes" << endl;
#define No() cout << "No" << endl;
#define YES() cout << "YES" << endl;
#define NO() cout << "NO" << endl;
template<class T> bool chmin(T& a, const T& b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> bool chmax(T& a, const T& b) {if (a < b) {a = b; return 1;} return 0;}
using namespace std;
using ll = long long;
using Pll = pair<ll, ll>;
using P = pair<int, int>;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

int main(void) {

    ios::sync_with_stdio(false); cin.tie(0);

    int n;
    cin >> n;
    V<ll> ab(n);

    ll ans = 0;

    rep (i, n) {
        int a, b;
        cin >> a >> b;
        ans -= b;
        ab[i] = a + b;
    }
    
    sort(rrng(ab));

    for (int i = 0; i < n; i += 2) {
        ans += ab[i];
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;
int A[128],N;
int main() {
  while(cin>>N && N>0) {
  A[0] = 1;
    for (int i=1; i<=N; ++i) {
      A[i] = A[i-1];
      if(i>=2) A[i] += A[i-2];
      if(i>=3) A[i] += A[i-3];
    }
    cout << ceil(A[N]/3650.0) << endl;
  }
}

Measured memory_bytes: 3208
S = input()
N = len(S)

if N%2 == 0:
    S_1 = "01"*(N//2)
    S_2 = "10"*(N//2)
else:
    S_1 = "01"*(N//2) + "0"
    S_2 = "10"*(N//2) + "1"
    
    
def distance(S,T,N):
    cnt = 0
    for i in range(N):
        if S[i] != T[i]:
            cnt += 1
    return cnt

print(min(distance(S,S_1,N),distance(S,S_2,N)))

Measured memory_bytes: 40944
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    ll ans = 0;
    ll imax = 0;
    for (int i = 0; i < n - 1; i++)
    {
        imax = max(imax, a[i]);
        ans += max(imax - a[i + 1], 0LL);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4828
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
sumA = [A[0]]
for i in range(1, N):
    sumA.append(sumA[-1] + A[i])
c, ans = Counter(sumA), 0
for x in list(c.keys()):
    if x == 0:
        ans += c[0] * (c[0] + 1) // 2
    else:
        ans += c[x] * (c[x] - 1) // 2
print(ans)

Measured memory_bytes: 41704
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;

int main()
{
    string s, ans;
    cin >> s;
    for (auto i : s) {
        if (i == '0') ans.push_back('0');
        if (i == '1') ans.push_back('1');
        if (i == 'B' && (!ans.empty())) ans.pop_back();
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define dump(x) cerr << #x << "=" << x << endl

#define rep(i, n) for (int i = 0; i < n; i++)

ll N;
vector<ll> A;

void solve() {
  ll result = 0;
  map<int, int> mp;

  rep(i, N) {
    result += mp[i - A.at(i)];
    mp[i + A.at(i)]++;
  }

  cout << result << endl;
}

int main() {
  cin >> N;
  A.resize(N);

  rep(i, N) { cin >> A.at(i); }

  solve();

  return 0;
}


Measured memory_bytes: 21784
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;
const lli mod = 1e9+7;

int main(){
    int n,t;
    cin >> n >> t;
    vector<int> s(n);
    for(int i=0; i<n; i++){
        cin >> s[i];
    }
    sort(s.begin(), s.end());
    
    lli ans = 1;
    for(int i=0; i<n; i++){
        vector<int>::iterator it;
        it = lower_bound(s.begin(), s.end(), s[i]-t);
        ans = ( ans *(i- (it-s.begin()) +1) )%mod;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3156
def resolve():
    n, m = map(int, input().split())
    a = list(map(lambda x:int(x)*-1, input().split()))
    import heapq
    heapq.heapify(a)
    for i in range(m):
        b = heapq.heappop(a)
        b /= 2
        heapq.heappush(a, b)
    import math
    c = list(map(lambda x: math.floor(x*-1), a))
    print(sum(c))
resolve()


Measured memory_bytes: 104348
#include<iostream>
#include<bitset>
#include<cmath>
using namespace std ;

int main()
{
  int x ;
  cin>>x ;
  int A[4] ;
  for(int i=0;i<4;i++){
    A[i]=x/pow(10,3-i) ;
    x-=A[i]*pow(10,3-i) ;
  }
  for(int tmp=0;tmp<(1<<3);tmp++){
    bitset<3>opt(tmp) ;
    int sum=A[0] ;
    char s[3] ;
    for(int k=0;k<3;k++){
      if(opt.test(k)){  //1なら+
        sum+=A[k+1] ;
        s[k]='+' ;
      }else{
        sum-=A[k+1] ;
        s[k]='-' ;
      }
    }
    if(sum==7){
      for(int k=0;k<3;k++) cout<<A[k]<<s[k] ;
      cout<<A[3]<<"=7"<<endl ;
      return 0 ;
    }
  }
  
  return 0 ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

double value[45];
int size[45];

double get_value(string &pile){
    bool b_can_move = 0, w_can_move = 0;
    double b_max, w_min;
    double last_value = 0;
    for(int i=0;i<pile.length();i++){
        double value;
        if(pile[i]=='B'){
            /*if(b_can_move){
                b_max = max(b_max,last_value);
            }
            else{
                b_max = last_value;
            }*/
            b_max = last_value;
            b_can_move = 1;
            if(w_can_move){
                value = (b_max + w_min) / 2;
            }
            else{
                value = b_max + 1;
            }
        }
        if(pile[i]=='W'){
            /*if(w_can_move){
                w_min = min(w_min,last_value);
            }
            else{
                w_min = last_value;
            }*/
            w_min = last_value;
            w_can_move = 1;
            if(b_can_move){
                value = (b_max + w_min) / 2;
            }
            else{
                value = w_min - 1;
            }
        }
        last_value = value;
    }
    return last_value;
}

#define map unordered_map

void enumerate(int st, int ed,map<double,int> &table ,double value_sum = 0, int size_sum = 0){
    if(st==ed){
        if(table.count(value_sum)){
            table[value_sum] = max(table[value_sum], size_sum);
        }
        else{
            table[value_sum] = size_sum;
        }
    }
    else{
        enumerate(st+1, ed, table, value_sum, size_sum);
        enumerate(st+1, ed, table, value_sum + value[st], size_sum + size[st]);
    }
}

int find_zero_value(int st,int ed,map<double,int> &table ,double value_sum = 0, int size_sum = 0){
    if(st==ed){
        if(table.count(-value_sum)){
            return table[-value_sum] + size_sum;
        }
        else return 0;
    }
    else{
        int get1 = find_zero_value(st+1, ed, table, value_sum, size_sum);
        int get2 = find_zero_value(st+1, ed, table, value_sum + value[st], size_sum + size[st]);
        return max(get1, get2);
    }
}

map<double,int> table, table2;

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        string pile;
        cin>>pile;
        size[i] = pile.length();
        value[i] = get_value(pile);
    }
    if(n<=20){
        enumerate(0,n,table);
        printf("%d\n",table[0]);
    }
    else{
        enumerate(0,20,table);
        printf("%d\n",find_zero_value(20,n,table));
    }

    return 0;
}

Measured memory_bytes: 43904
// created by mtnshh
 
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
 
#define ll long long
#define ld long double
 
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>=b;i--)
 
#define err() cout<<"=================================="<<endl;
#define errA(A) for(auto i:A)   cout<<i<<" ";cout<<endl;
#define err1(a) cout<<#a<<" "<<a<<endl
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<endl
 
#define pb push_back
#define all(A)  A.begin(),A.end()
#define allr(A)    A.rbegin(),A.rend()
#define ft first
#define sd second
 
#define pll pair<ll,ll>
#define V vector<ll>
#define S set<ll>
#define VV vector<V>
#define Vpll vector<pll>
 
#define endl "\n"
 
const ll logN = 20;
const ll M = 1000000007;
const ld eps = 1e-9;
const ll INF = 1e12;
#define PI 3.14159265
 
const ll N = 55;

ll n;
ld X[N], Y[N];
ld ans = M;

void findCircle(ld x1, ld y1, ld x2, ld y2, ld x3, ld y3) 
{ 
    ld x12 = x1 - x2; 
    ld x13 = x1 - x3; 
    ld y12 = y1 - y2; 
    ld y13 = y1 - y3; 
    ld y31 = y3 - y1; 
    ld y21 = y2 - y1; 
    ld x31 = x3 - x1; 
    ld x21 = x2 - x1; 
    ld sx13 = x1*x1 - x3*x3; 
    ld sy13 = y1*y1 - y3*y3; 
    ld sx21 = x2*x2 - x1*x1; 
    ld sy21 = y2*y2 - y1*y1; 
    ld f,g;
    if(abs((y31) * (x12) - (y21) * (x13)) < eps)
		return;
    f = ((sx13) * (x12) 
             + (sy13) * (x12) 
             + (sx21) * (x13) 
             + (sy21) * (x13)) 
            / (2 * ((y31) * (x12) - (y21) * (x13))); 
    g = ((sx13) * (y12) 
             + (sy13) * (y12) 
             + (sx21) * (y13) 
             + (sy21) * (y13)) 
            / (2 * ((x31) * (y12) - (x21) * (y13)));
    ld c = -x1*x1 - y1*y1 - 2 * g * x1 - 2 * f * y1; 
    ld h = -g; 
    ld k = -f; 
    ld sqr_of_r = h * h + k * k - c; 
    ld r = sqrt(sqr_of_r);
    bool f1 = 0;
    rep(i,0,n){
    	if(((X[i]-h)*(X[i]-h) + (Y[i]-k)*(Y[i]-k)) > (r * r  + eps)) 
    		f1 = 1;
    }
    if(!f1)
    	ans = min(ans, r);
}

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	rep(i,0,n)
		cin>>X[i]>>Y[i];
	rep(i,0,n)	rep(j,i+1,n)	rep(k,j+1,n){
		findCircle(X[i],Y[i],X[j],Y[j],X[k],Y[k]);
	}
	rep(i,0,n)	rep(j,i+1,n){
		ld h = (X[i]+X[j])/2;
		ld k = (Y[i]+Y[j])/2;
		ld r = sqrt((X[i]-X[j])*(X[i]-X[j]) + (Y[i]-Y[j])*(Y[i]-Y[j]))/2;
		bool f1=0;
		rep(i,0,n){
	    	if(((X[i]-h)*(X[i]-h) + (Y[i]-k)*(Y[i]-k)) > (r * r  + eps)) 
	    		f1 = 1;
    	}
    	if(!f1)
	    	ans = min(ans, r);
	}
	cout<<fixed<<setprecision(9)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int m[10];
  for(int i=0;i<10;i++){
    cin >> m[i];
      }
  sort(m,m+10,greater<int>());
  cout << m[0] << endl << m[1]  << endl << m[2] <<endl;
  return 0;
}

Measured memory_bytes: 1176
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

#define MAX 100

void initialize(void);
int isEmpty(void);
int isFull(void);
void push(int);
int pop(void);

int top;
int S[MAX];

int main(){
  int x,a,b;
  char s[100];

  initialize();

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      a = pop();
      b = pop();
      push(b+a);
    } else if ( s[0] == '-' ){
      a = pop();
      b = pop();
      push(b-a);
    } else if ( s[0] == '*' ){
      a=pop();
      b=pop();
      push(b*a);
    } else {
      x = atoi(s);
      push(x);
    }
  }

  printf("%d\n",pop());

  return 0;
}

void initialize(void){
  top = 0;
}

int isEmpty(void){

  if(top == 0){
    return 1;
  }
  else return 0;
}

int isFull(void){

  if(top > MAX - 1){
    return 1;
  }
  else return 0;
}
void push(int x){

  if(isFull()){
    fprintf(stderr,"Overflow\n");
    exit(1);  
  }
  top++;
  S[top] = x;
}

int pop(){
  if(isEmpty()){
    fprintf(stderr,"Underflow\n");
    exit(2);
  }
  top--;
  return S[top+1];
}

Measured memory_bytes: 548
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

int main() {
	int N, P; cin >> N >> P;
	string S; cin >> S;
	ll res = 0;
	if (P == 2 || P == 5) {
		for (int i = 0; i < N; ++i)
			if ((S[i] - '0') % P == 0)
				res += i + 1LL;
	}
	else {
		vector<int> modS(N + 1, 0);
		ll tmp = 1;
		for (int i = 1; i <= N; ++i) {
			modS[i] = (modS[i - 1] + (S[N - i] - '0') * tmp) % P;
			tmp = (tmp * 10) % P;
		}
		map<int, ll> cnt;
		for (int m : modS) ++cnt[m];
		for (auto& e : cnt)
			res += (e.second - 1) * e.second / 2;
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 1796
#include <bits/stdc++.h>

using namespace std;

const string color = "RYGB";

int H,W,d;

int main() {
    cin>>H>>W>>d;
    for (int h=0;h<H;h++) {
        for (int w=0;w<W;w++) {
            int d1 = h+w;
            int d2 = h-w+W-1;
            int num = d1/d % 2 * 2 + d2/d % 2  * 3;
            cout << color[num%4];
        }
    cout<<endl;
    }
}




Measured memory_bytes: 512
n, x = gets.split(" ").map(&:to_i)
ls = gets.chomp.split(" ").map(&:to_i)

records = []
records << 0
previous = 0

ls.each_with_index do |l, index|
  previous += l
  records << previous
end

count = 0
records.each do |record|
  if record <= x
    count += 1
  end
end

puts count

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int>P;//Pre val
#define fi first
#define se second

const int SIZE=16777216;
int dat[SIZE*2-1];
const int INF=LLONG_MAX/100;
void update(int k,int x){
    k+=SIZE-1;
    dat[k]=x;
    while(k){
        k=(k-1)/2;
        dat[k]=max(dat[k*2+1],dat[k*2+2]);
    }
}

int getMax(int a,int b,int k=0,int l=0,int r=SIZE){
    if(a<=l&&b>=r)return dat[k];
    if(r<=a||b<=l)return -INF;

    int m=(l+r)/2;
    int vl=getMax(a,b,k*2+1,l,m);
    int vr=getMax(a,b,k*2+2,m,r);
    return max(vl,vr);
}

int N,D;
int X[30],Y[30];

vector<P>A,B;
void Latte(int cur,int last,int val,int pre,bool after){
    if(cur==last){
        if(after)B.push_back(P(pre,val));
        else A.push_back(P(pre,val));
        return;
    }

    Latte(cur+1,last,val+X[cur],pre+Y[cur],after);
    Latte(cur+1,last,val-X[cur],pre-Y[cur],after);
    Latte(cur+1,last,val,pre,after);
}


signed main(){
    cin>>N>>D;
    for(int i=0;i<N;i++)cin>>Y[i]>>X[i];

    Latte(0,N/2,0,0,false);
    Latte(N/2,N,0,0,true);

    sort(A.rbegin(),A.rend());
    sort(B.begin(),B.end());
    fill_n(dat,SIZE*2-1,-INF);
    for(int i=0;i<B.size();i++){
        update(i,B[i].second);
    }

    int ans=-INF;
    int lb=0,ub=0;
    for(int i=0;i<A.size();i++){
        while(lb<B.size()&&-D-A[i].fi>B[lb].fi)lb++;
        while(ub<B.size()&&D-A[i].fi>=B[ub].fi)ub++;
        ans=max(ans,A[i].se+getMax(lb,ub));
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 713080
package main

import "fmt"

import "math"

func main() {
	var a, b, h, m int
	fmt.Scanf("%d %d %d %d", &a, &b, &h, &m)
	s := h*60 + m
	angA := float64(s) * 0.5
	angB := float64(m) * 6.0
	var c float64
	if angA > angB {
		c = angA - angB
	} else {
		c = angB - angA
	}
	fmt.Println(math.Sqrt(float64(a)*float64(a) + float64(b)*float64(b) - 2*float64(a)*float64(b)*math.Cos((math.Pi*c)/180)))
}

Measured memory_bytes: 1820
#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000

int main(){
	
	string S,T;
	cin>>S>>T;
	
	int ans = 0;
	for(int i=0;i<S.size();i++){
		if(S[i]!=T[i])ans++;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3900
#include<bits/stdc++.h>
#define re    return
#define pii   pair<int,int>
#define hell  1000000007
#define rep(i,a,b)  for (__typeof(b) i=(a)-((a)>(b));i!=(b)-((a)>(b));i+=1-2*((a)>(b)))
#define boost ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define pb  push_back
#define ff          first
#define ss          second
#define sz(x)       (int)x.size()
#define all(a)      (a).begin(),(a).end()

//v.resize(distance(v.begin(),unique(v.begin(),v.end())));

typedef long long  ll;
using namespace std;

const ll INF=(1LL<<60)-1;
const int N=1e5+20;

int main(){
   
    boost;
    
    int n; cin >> n;
    string s; cin >> s;
    
    int dp1[n], dp2[n];
    
    if(s[0] == 'E') dp1[0] = 1, dp2[0] = 0;
    else dp2[0] = 1, dp1[0] = 0;
    
    for(int i = 1; i < n; i++){
    	if(s[i] == 'E'){
    		dp2[i] = dp2[i-1];
    		dp1[i] = dp1[i-1]+1;
		} 
    	if(s[i] == 'W'){
    		dp2[i] = dp2[i-1]+1;
    		dp1[i] = dp1[i-1];
		}
	}
	
	int dp3[n], dp4[n];
    
    if(s[n-1] == 'E') dp3[n-1] = 1, dp4[n-1] = 0;
    else dp4[n-1] = 1, dp3[n-1] = 0;
    
    for(int i = n-2; i >= 0; i--){
    	if(s[i] == 'E'){
    		dp4[i] = dp4[i+1];
    		dp3[i] = dp3[i+1]+1;
		} 
    	if(s[i] == 'W'){
    		dp4[i] = dp4[i+1]+1;
    		dp3[i] = dp3[i+1];
		}
	}
	
    
    int ans = 1e9;
    
    if(s[0] == 'E') ans = dp4[0];
    else ans = dp3[0];
    
	rep(i,1,n-1){
			ans = min(ans, dp2[i-1]+dp3[i+1]);
	}
    
	if(s[n-1] == 'E') ans = min(ans, dp2[n-1]);
	else ans = min(ans, dp1[n-1]);
	
	cout << ans;
	
   	return 0;
}

Measured memory_bytes: 5396
n,m=map(int,input().split())
xyz=[list(map(int,input().split())) for _ in range(n)]
t=[[0]*n for _ in range(8)]
i=0
for x,y,z in xyz:
    t[0][i]=x+y+z
    t[1][i]=-x+y+z
    t[2][i]=x-y+z
    t[3][i]=x+y-z
    t[4][i]=-x-y+z
    t[5][i]=x-y-z
    t[6][i]=-x+y-z
    t[7][i]=-x-y-z
    i+=1
ans=0
for tk in t:
    tk.sort(reverse=True)
    ans=max(ans,sum(tk[:m]))
print(ans)


Measured memory_bytes: 3572
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = 1; i <= n; i++)
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
using P = pair <int, int>;
 

int main() {
   int n,l;
   cin >> n>>l;
   vector<string> s(n);
   rep(i,n) cin >> s[i];
   sort(s.begin(),s.end());
   rep(i,n){
   cout << s[i];
   }
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.print(a*b);
        System.out.print(" ");
        System.out.println(2*(a+b));
    }
}



Measured memory_bytes: 26148
import scala.io.StdIn.{readLine, readInt}

object Main extends App {
  val n = readInt
  val A = readLine.split(" ").map(_.toInt)
  var ans = new Array[Int](n)

  for (i <- 0 until n) {
    val a = i + 1
    ans(A(i) - 1) = a
  }

  println(ans.mkString(" "))
}


Measured memory_bytes: 45680
function Main(input) {
  input = input.split("\n");
  var N = parseInt(input[0].split(" ")[0]);
  var A = parseInt(input[0].split(" ")[1]);
  var B = parseInt(input[0].split(" ")[2]);
  var C = parseInt(input[0].split(" ")[3]);
  var D = parseInt(input[0].split(" ")[4]);
  var S = input[1].split("");
  var sflag=0;
  var ss=0;
  var bg=0;
  var bs=0;
  var th=0;
  var thflag=0;
  if(S[D-2]=="#"||S[D]=="#"){
    bg=1;
  }
  if(S[B-2]=="#"||S[B]=="#"){
    bs=1;
  }
  var gyaku=0;
  if(B<C&&C<D){
    for(var i=A-1;i<Math.max(C,D);i++){
      if(sflag==1){
        if(S[i]=="#"){
          ss=1;
          break;
        }else{
          sflag=0;
        }
      }else{
        if(S[i]=="#"){
          sflag=1;
        }else{
          sflag=0;
        }
      }
    }
  }else if(B<C&&D<C){
    var gyaku=1;
    for(var i=A-1;i<Math.max(C,D);i++){
      if(i>B-1&&i<D&&th>=2){
        if(S[i]=="."){
          thflag=1;
        }else{
          th=0;
        }
      }
      if(sflag==1){
        if(S[i]=="#"){
          ss=1;
          break;
        }else{
          sflag=0;
          th++;
        }
      }else{
        if(S[i]=="#"){
          sflag=1;
          th=0;
        }else{
          sflag=0;
          th++;
        }
      }


    }

  }else{
    for(var i=A-1;i<C;i++){
      if(sflag==1){
        if(S[i]=="#"){
          ss=1;
          break;
        }else{
          sflag=0;
        }
      }else{
        if(S[i]=="#"){
          sflag=1;
        }else{
          sflag=0;
        }
      }
    }
    for(var i=B-1;i<D;i++){
      if(sflag==1){
        if(S[i]=="#"){
          ss=1;
          break;
        }else{
          sflag=0;
        }
      }else{
        if(S[i]=="#"){
          sflag=1;
        }else{
          sflag=0;
        }
      }
    }
  }
  var ans="Yes";
  if(gyaku==1){
    ans="No";
    if(bs==0||bg==0||thflag==1){
      ans="Yes";
    }
  }
  if(ss==1){
    ans="No";
  }
  console.log('%s', ans);
  return ans;
}

function debug(n){
  var input = document.getElementById("input"+n).value;
  var ans=Main(input);
  var result="WA";
  if(ans==document.getElementById("output"+n).value.split("\n")[0]){
    result="AC";
  }
  document.getElementById("result"+n).innerHTML=result;
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21192
#include <iostream>

using namespace std;

int main(void){
	int a, b;

	cin >> a >> b;

	if(a % 3 == 0 || b % 3 == 0 || (a+b) % 3 == 0){
		cout << "Possible";
	}else {
		cout << "Impossible";
	}
	cout << '\n';
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  int64_t N,ans=2;
  cin >> N;
  if (N==1){
  cout << 1 << endl;
  }
  else {
  for (int i=0;;i++){
  if (N!=1){
  N/=2;
  ans*=2;
  }
  else if (N==1){
  ans--;
    break;
  }
  }
  cout << ans << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

vector<pair<char, ll>> RLE(const string &S) {
    ll cnt = 0;
    vector<pair<char, ll>> res;
    for (ll i = 0; i < (ll) S.size(); i++) {
        cnt++;
        if (i == (ll) S.size() - 1) {
            res.emplace_back(S[i], cnt);
            break;
        }
        if (S[i] != S[i + 1]) {
            res.emplace_back(S[i], cnt);
            cnt = 0;
        }
    }
    return res;
}

void Main() {
    string S;
    cin >> S;
    ll N = S.size();
    vector<pair<char, ll>> res = RLE(S);

    // R...RL...L のブロックごとに分割して考える
    ll cnt = 0;
    ll start_ind = 0;
    ll ans[N]; rep(i, N){ans[i] = 0;}
    while (true){
        if (cnt >= res.size()){break;}
        if (res[cnt].first == 'L'){
            cnt += 1;
            start_ind += res[cnt].second;
        } else {
            ll r_cnt = res[cnt].second;
            ll l_cnt = res[cnt + 1].second;
            ll tmp = r_cnt / 2 + (l_cnt + 1) / 2;
            ans[start_ind + r_cnt] = tmp;
            ans[start_ind + r_cnt - 1] = r_cnt + l_cnt - tmp;
            cnt += 2;
            start_ind += (r_cnt + l_cnt);
        }
    }
    rep(i, N){cout << ans[i] << " ";}
}


int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3008
#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

string S,coded;

int gcd(int a,int b){
	if (b==0) return a;
	return gcd(b,a%b);
}
							
int main(){
	int n;
	cin>>n;
	cin.ignore();
	REP(t,n){
		getline(cin,S);
		REP(a,26){
			if (gcd(a,26)!=1) continue;
			REP(b,26){
				coded.clear();
				REP(i,S.length()	){
					if (S[i]==' '){
						coded.push_back(' ');
					}else{
						int y=S[i]-'a';
						int c=a*y+b;
						c%=26;
						coded.push_back((char)(c+'a'));
					}
				}
				if (coded.find("that")!=string::npos || coded.find("this")!=string::npos){
					cout<<coded<<endl;
					a=b=26;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
typedef long long ll;
typedef std::vector<long long> vll;
typedef std::vector<std::vector<long long>> vvll;
typedef long double ld;
typedef std::vector<long double> vld;
typedef std::vector<std::vector<long double>> vvld;
using namespace std;
void yesno(bool state);

void Main(){
    ll A,B,C;
    cin >> A>>B>>C;
    ll K;
    cin >> K;
    ll ans = 0;
    while(A >= B){
        ans += 1;
        B*= 2;
    }

    while(B >= C){
        ans += 1;
        C*= 2;
    }
    // cout << ans << endl;
    if(ans <= K)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

int main(int argc, char const *argv[])
{
    Main();
    return 0;
}

void yesno(bool state){
    if(state)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3676
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n;
    cin >> n;

    double ans = 0;

    rep(i,n){
        double a;
        cin >> a;
        ans += (double)1 / a;
    }

    cout <<(double)1 / ans << endl;
    return 0;
}
 
 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int(i)=0;i<(n);i++)
typedef long long ll;
int ans,n,m,q,x[11],a[51],b[51],c[51],d[51];

void dfs(int i, int j){
    x[i]=j;
    if(i==n){
        int t=0;
        REP(k,q) if(x[b[k]]-x[a[k]]==c[k]) t+=d[k];
        ans=max(ans,t);
    }else for(int k=j;k<=m;k++) dfs(i+1,k);
}

int main(){
    ans=0;
    cin>>n>>m>>q;
    REP(i,q) cin>>a[i]>>b[i]>>c[i]>>d[i];
    for(int i=1;i<=m;i++) dfs(1,i);

    cout<<ans;
}

Measured memory_bytes: 3596
bingo = [ list(map(int, input().split())) for _ in range(3) ]
t_or_f = [ [False]*3 for _ in range(3) ]

nums = [ r[i]for i in range(3) for r in bingo ]

n = int(input())
appear = [ int(input()) for _ in range(n) ]

for x in range(3):
  for y in range(3):
    if bingo[x][y] in appear:
      t_or_f[x][y] = True

is_bingo = False
if t_or_f[0][0] and t_or_f[1][1] and t_or_f[2][2]:
  is_bingo = True
elif t_or_f[0][2] and t_or_f[1][1] and t_or_f[2][0]:
  is_bingo = True
else:
  for i in range(3):
    if t_or_f[i][0] and t_or_f[i][1] and t_or_f[i][2]: is_bingo = True
    if t_or_f[0][i] and t_or_f[1][i] and t_or_f[2][i]: is_bingo = True

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

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main()
{
   char c ;
   cin>> c ;
   if(c=='a' || c=='e')
    cout<<"vowel"<<endl;
   else if (c=='i'||c=='o')
        cout<<"vowel"<<endl ;
   else if (c=='u')
        cout<< "vowel"<<endl;
   else
    cout << "consonant" << endl ;
   return 0 ;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <sstream>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long int ll;


int main()
{
	int h, w;
	cin >> h >> w;
	vector<vector<char>> charList(h);
	for (int i = 0; i < h; i++) {
		charList[i] = vector<char>(w);
		for (int j = 0; j < w; j++) {
			cin >> charList[i][j];
		}
	}
	for (int i = 0; i < w+2; i++) {
		cout << "#";
	}
	cout << endl;
	for (int i = 0; i < h; i++) {
		cout << "#";
		for (int j = 0; j < w; j++) {
			cout << charList[i][j];
		}
		cout << "#" << endl;
	}

	for (int i = 0; i < w+2; i++) {
		cout << "#";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3060
clause_list = list(map(int, input().split()))

for index, clause in enumerate(clause_list):
  if clause == 5:
    clause_list.pop(index)
    break

for index, clause in enumerate(clause_list):
  if clause == 7:
    clause_list.pop(index)
    break

for index, clause in enumerate(clause_list):
  if clause == 5:
    clause_list.pop(index)
    break

print('YES' if len(clause_list) == 0 else 'NO')


Measured memory_bytes: 8852
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll =  long long;
using P = pair<int,int>;
const int INF = 1001001001;
const int mod = 1000000007;


int main() {
    ll K, A, B;
    cin >> K >> A >> B;
    ll now = 1;

    K -= (A - now);
    now = A;
    if(B - A >= 2){
        ll cnt = K / 2;
        now += cnt * (B - A);
        if(K % 2 == 1){
            now++;
        }
    }else{
        now += K;
    }
    cout << now << endl;
    return 0;
}


Measured memory_bytes: 256
using System;

namespace oasobi
{
    static class MainClass
    {
        public static void Main()
        {
            string[] input = Console.ReadLine().Split(' ');

            var n = long.Parse(input[0]);
            var a = long.Parse(input[1]);
            var b = long.Parse(input[2]);

            var i = n % (a + b);
            var j = (n - i) / (a + b);

            if(i <= a)
            {
                var ans = j * a + i;
                Console.WriteLine(ans);
            }
            else
            {
                var ans = j * a + a;
                Console.WriteLine(ans);
            }
        }
    }
}

Measured memory_bytes: 13140
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>

#include <iomanip>

using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define FIND(x, target) find(x.begin(),x.end(),target)
#define pb(x) push_back(x)
#define pob(x) pop_back(x)
#define output(x) cout<<x<<endl
#define ERASE(x, n) x.erase(x.begin()+n)
// #define int long long
// #define P pair<int, int>
typedef long long ll;

const long long int MOD = 1e9+7;
const ll INF = 1e17;
ll dp[100005][13];

signed main(void) {
  double a, b, x;
  cin >> a >> b >> x;
  double length = x*2/(a*b);
  double radian = atan(b/length);
  double pi = 2.0 * asin(1.0);
  if (length > a) {
    double y = a*a*b-x;
    length = y*2/(a*a);
    radian = atan(length/a);
  }
  
  cout << setprecision(10) << radian*180/pi << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

int main() {
  string S; cin >> S;
  int len = S.length();

  int ans1{};
  for (int i{}; i < len; ++i) {
    if (S[i] != (i % 2 == 0 ? '0' : '1')) ++ans1;
  }

  int ans2{};
  for (int i{}; i < len; ++i) {
    if (S[i] != (i % 2 == 1 ? '0' : '1')) ++ans2;
  }

  cout << min(ans1, ans2) << endl;
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
 
int main(void){
	int yoko,tate;
	int kari1,kari2;
	while(1){
		scanf("%d %d",&tate,&yoko);
		if(yoko == 0 && tate == 0){
			break;
		}else{
			kari1 = 0,kari2 = 0;
            for ( kari1 = 0; kari1 < tate; kari1++ ){
                for ( kari2 = 0; kari2 < yoko; kari2++ ){
                printf("#");
				}
			printf("\n");
			}
		}
		printf("\n");
	}
    return(0);
}

Measured memory_bytes: 1000
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <string>
#include <set>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define pb push_back
#define mp make_pair
#define fs first
#define sc second

typedef long long ll;

int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.size();
    int ans = n;
    forn (c, 26) {
        string t = s;
        forn (q, n) {
            bool ok = true;
            forn (i, t.size()) {
                if (t[i] != 'a' + c) {
                    ok = false;
                }
            }
            if (ok) {
                ans = min(ans, q);
                break;
            }
            string nt = "";
            forn (i, t.size() - 1) {
                if (t[i + 1] == 'a' + c) {
                    nt += t[i + 1];
                } else {
                    nt += t[i];
                }
            }
            t = nt;
//            cerr << t << endl;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
use proconio::*;
use proconio::marker::Chars;

fn run() {
    input! {
        s: Chars,
        t: Chars,
    }
    let n = s.len();
    let ans = if s.as_slice() == &t[..n] {
        "Yes"
    } else {
        "No"
    };
    println!("{}", ans);
}

fn main() {
    run();
}

Measured memory_bytes: 2064
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n; cin>>n;
  int num[n];
  for(int i=0;i<n;i++){
    cin>>num[i];
  }
  while(true){
    int x;
    sort(num,num+n);
    for(int i=0;i<n;i++){
      if(num[i]!=0){
        if(i==n-1){
          cout<<num[i]<<endl;
          return 0;
        }
        x=i;
        break;
      }
    }
    for(int i=x+1;i<n;i++){
      num[i]%=num[x];
    }
  }
} 

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;i < (n);(i)++)
#define ll long long

using namespace std;

// input
int n,r;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  cin >> n >> r;

  int rate = (n < 10)? r + (100 * (10-n)) : r;
  cout << rate;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        List<Integer> A = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            A.add(sc.nextInt());
        }

        System.out.println(Math.abs(Collections.max(A) - Collections.min(A)));
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h> 

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < n; i++)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string S;
    cin >> S;

    if (S[0] == S[1] || S[1] == S[2] || S[2] == S[3]) {
        cout << "Bad" << endl;
    } else {
        cout << "Good" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;

int N;
int A[210];         // 最大 200 個なので余裕を持って 210 に --- 200 以上ならなんでもよいです

int main() {
    cin >> N;
    for (int i = 0; i < N; ++i) cin >> A[i];

    int res = 0;

    // 操作が行える限り操作を繰り返す
    while (true) {
        bool exist_odd = false;  // A[i] がすべて偶数かどうかを判定するフラグ
        for (int i = 0; i < N; ++i) {
            if (A[i] % 2 != 0) exist_odd = true;  // 奇数があったらフラグを立てる
        }

        if (exist_odd) break;  // 奇数があったら break

        // 操作を行えるなら操作を実際に行う
        for (int i = 0; i < N; ++i) {
            A[i] /= 2;
        }
        ++res;  // 操作回数をインクリメント
    }

    cout << res << endl;
}

Measured memory_bytes: 3512
#include<iostream>
#include<algorithm>
 
using namespace std;
typedef long long Int;
#define INF (1LL<<60)

Int N, C;
Int s[200000],t[200000],c[200000];
Int sm[200002],tt[200002];

int solve(int x){

    
}

int main(){
	cin.tie(0);
    ios::sync_with_stdio(false);

	cin >> N>> C;
	for(Int i=0;i<N;i++){
		cin>>s[i]>>t[i]>>c[i];
	}

	for(Int j=0;j<200002;j++) sm[j]=0;

	for(Int i=1;i<=C;i++){
		for(Int j=0;j<200002;j++) tt[j]=0;
		for(Int j=0;j<N;j++){
			if(c[j] == i){
				tt[s[j]*2-1]++;
				tt[t[j]*2]--;
			}
		}
		for(Int j=1;j<200002;j++) tt[j]+=tt[j-1];
		for(Int j=0;j<200002;j++) if(tt[j]>0) sm[j]++;
	}

	int ans=0;
	for(Int j=0;j<200002;j++) if(ans<sm[j]) ans=sm[j];
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 7168
add_b :: Int -> Int -> Int -> Int
add_b x b c
    | x < b = 0
    | otherwise = 1 + add_b x (b + c) c

main = do
    
    xs <- getLine
    as <- getLine
    bs <- getLine

    let a = read as
        b = read bs
        x = read xs
    
    print $ x - a - ((add_b (x - a) b b) * b)

Measured memory_bytes: 508
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;
typedef long long ll;

int main()
{
	std::ios::sync_with_stdio(false);

	string s;
	ll res = 0;

	cin >> s;

	ll n = s.length();

	vector<ll> t(n);
	unordered_map<ll, ll> counts;

	counts[0] = 1;
	ll p10 = 1;

	for (int i = n-1; i >= 0; i--)
	{
		ll ai = s[i] - '0';
		//cout << "ai = " << ai << endl;

		if (i == n-1)
		{
			t[i] = ai % 2019;
			counts[t[i]]++;
		}
		else
		{
			t[i] = (p10*ai + t[i+1]) % 2019;
			//cout << "t[i] = " << t[i] << endl;
			res += counts[t[i]];
			counts[t[i]]++;
		}

		p10 *= 10;
		p10 %= 2019;
	}

	/*
	for (auto x : counts)
	{
		ll m = x.second;

		cout << "x.first, x.second = " << x.first << ", " << x.second << endl;

		res += (m*(m-1))/2;
	}
	*/

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 5252
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  int64_t N, K;
  cin >> N >> K;
  // const int64_t L = static_cast<int64_t>(T.length());
  vector<int64_t> A(N + 2, 0);
  for (int64_t i = 1; i <= N; ++i) {
    cin >> A[i];
  }
  for (int64_t k = 0; k < K; ++k) {
    vector<int64_t> prev(N + 2, 0);
    swap(A, prev);
    for (int64_t i = 1; i <= N; ++i) {
      ++A[max(i - prev[i], 0L)];
      --A[min(i + prev[i] + 1, N + 1)];
    }
    bool same = true;
    for (int64_t i = 1; i <= N + 1; ++i) {
      A[i] += A[i - 1];
      if (A[i] != prev[i]) {
        same = false;
      }
    }
    if (same) {
      break;
    }
  }
  for (int64_t i = 1; i <= N; ++i) {
    if (i != 1) {
      cout << " ";
    }
    cout << A[i];
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 6356
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
int main(void){
    long double n,k;
    cin >> n >> k;
    long double su = 0;
    if(n>=k){
        su += (n-k+1.0)/n;
        for(int i=k-1;i>0;i--){
            int x = 0;
            int s = i;
            while(s<k){
                s *= 2;
                x++;
            }
            su += 1.0/n*pow(0.5,x);
        }
    }else{
        for(int i=n;i>0;i--){
            int x = 0;
            int s = i;
            while(s<k){
                s *= 2;
                x++;
            }
            su += 1.0/n*pow(0.5,x);
        }
    }
    cout << setprecision(12) << su << endl;
}


Measured memory_bytes: 256