akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (ll i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (ll i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int n, k; cin >> n >> k;
    vi x(n);
    REP(i, n) cin >> x[i];

    ll ans = 0;
    REP(i, n) {
        ans += min(x[i], abs(x[i] - k)) * 2;
    }

    print(ans);

}

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

int main() {
  int n;
  cin >> n;
  vector< int > h(n);
  for(int i = 0; i<n;i++ ) {
    cin >> h[i];
  }
  int ans = 0;
  int maxh = 0;
  for(int i = 0; i<n;i++ ) {
    if(maxh <= h[i]) {
      maxh = h[i];
      ans ++;
    }
  }
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
using namespace std;

int main(){
  int N,L;
  cin >> N >> L;
  vector<int> taste(N);
  /*for(int i = 0;i < N;i++){
    taste.at(i) = 0;
  }*/
  for(int i = 1;i <= N;i++){
    taste.at(i - 1) = L + i - 1;
  }
  int count = 10000,countx = 10000,X = 10000;
  for(int i = 0;i < N;i++){
    count = min(count,abs(taste.at(i)));
    if(count != countx){
      X = i;
    }
    countx = count;
  }
  int ans = 0;
  for(int i = 0;i < N;i++){
    if(i != X){
      ans += taste.at(i);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3612
#include<iostream>
#include<string>
#include<queue>
#include<vector>
using namespace std;
const long long INF=200000000000000000LL;
typedef pair<int,int> P;
int main(){
	int N,A,B=0,t=0,ans=0;
	cin>>N;
	priority_queue<int,vector<int>,greater<int> >que;
	for(int i=0;i<N;++i){
		cin>>A;
		que.push(A);
	}
	while(!que.empty()){
		int p=que.top();que.pop();
		if(p!=B){
			ans+=t%2;
			t=0;
			B=p;
		}
		++t;
	}
	ans+=t%2;
	cout<<ans<<endl;
	return 0;
}


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

bool onmp(int x,int y){return x>=0&&y>=0&&x<n&&y<n;}

int count(int x,int y,const vector<string> &A){
  int res=0;  
  for(int i=-1;i<=1;i++)
    for(int j=-1;j<=1;j++){
      int nx = x+i,ny = y+j;
      if((!i&&!j)||!onmp(nx,ny))continue;
      res += A[ny][nx]=='#'||A[ny][nx]=='@';
    }
  return res;
}

bool check(const vector<string> &A){
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)if(A[i][j]=='#')return 0;
  return 1;
}


vector<string> mkmp(const vector<string> &A){
  vector<string> res(n,string(n,'.'));
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++){
      int cnt = count(j,i,A);
      if(A[i][j]=='#')res[i][j]=(cnt==2||cnt==3)? '#':'.';
      if(A[i][j]=='.')res[i][j]=(cnt==3)? '#':'.';
      if(A[i][j]=='@')res[i][j]='@';
    }
  return res;
}


map<vector<string>,int> mem;
int ans;
void dfs(int x,int y,int cnt,vector<string> A){
  if(check(A))ans=min(cnt,ans);
  if(cnt>=ans) return;
  if(mem.count(A)&&mem[A]<=cnt)return;
  mem[A]=cnt;
  A[y][x] = '.';
  for(int dy=-1;dy<=1;dy++){
    for(int dx=-1;dx<=1;dx++){
      int nx = x+dx,ny = y+dy;
      if((!dx&&!dy)||!onmp(nx,ny)||A[ny][nx]=='#')continue;
      A[ny][nx] = '@';
      dfs(nx,ny,cnt+1,mkmp(A));
      A[ny][nx] = '.';
    }
  }
}

int main(){
  while(cin>>n,n){
    vector<string> mp(n);
    for(int i=0;i<n;i++)cin>>mp[i];
    int sx,sy;
    for(int i=0;i<n;i++)
      for(int j=0;j<n;j++)if(mp[i][j]=='@')sy=i,sx=j;
    ans = 11;
    mem.clear();
    dfs(sx,sy,0,mp);
    cout<<(ans<11? ans:-1)<<endl;
  }
  return 0;
}

Measured memory_bytes: 6772
let last_i = ref 0

let parent i = int_of_float (floor (float_of_int i) /. 2.)

let left i = 2*i

let right i = 2*i + 1

let swap i j t = let tmp = t.(i) in t.(i) <- t.(j); t.(j) <- tmp

let extract (t : int array) =
  let ret = t.(1) in
  t.(1) <- t.(!last_i);
  decr last_i;
  let rec max_heapify i =
    let l = left i in
    let r = right i in
    let m = if l <= !last_i && t.(l) > t.(i) then l else i in
    let m = if r <= !last_i && t.(r) > t.(m) then r else m in
    if i = m then ()
    else begin
      swap i m t;
      max_heapify m
    end in
  max_heapify 1;
  ret

let insert x (t : int array) =
  incr last_i;
  t.(!last_i) <- x;
  let rec doit i =
    if i <= 1 || t.(parent i) >= t.(i) then ()
    else begin
      swap i (parent i) t;
      doit (parent i)
    end in
  doit !last_i

let split_on_char sep s =
  let open String in
  let r = ref [] in
  let j = ref (length s) in
  for i = length s - 1 downto 0 do
    if get s i = sep then begin
      r := sub s (i + 1) (!j - i - 1) :: !r;
      j := i
    end
  done;
  sub s 0 !j :: !r

let () =
  let t = Array.make 2000001 0 in
  while true do
    match read_line () |> split_on_char ' ' with
    | ["extract"] -> extract t |> Printf.printf "%d\n"
    | ["insert"; n] -> insert (int_of_string n) t
    | _ -> exit 0
  done

Measured memory_bytes: 20332
use proconio::{fastout, input};
use std::io::*;
use std::str::FromStr;

use std::cmp::{max, min};

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    }

    let mut maxv1 = 0;
    let mut maxv2 = 0;

    for i in 0..n {
        if maxv1 < a[i] {
            maxv1 = a[i];
            continue;
        }
        if maxv2 < a[i] {
            maxv2 = a[i];
        }
    }
    for i in 0..n {
        if maxv1 == a[i] {
            println!("{}", maxv2);
        } else {
            println!("{}", maxv1);
        }
    }
}


Measured memory_bytes: 4784
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void) {
  int i;
  char S[3+2];
  long cnt = 0;
  scanf("%s", S);
  if (S[1] == 'B') {
    printf("ARC\n");
  }
  else{
    printf("ABC\n");
  }
  return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>

#define REP(i,x) for(int i=0 ; i<(int)(x) ; i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long

using namespace std;

LL eval(const set<pair<int, int> > &red, const set<pair<int, int> > &blue){
    LL r = red.rbegin()->first - red.begin()->first;
    LL b = blue.rbegin()->first - blue.begin()->first;
    return r * b;
}

int main(){
    int N;
    cin >> N;
    vector<pair<int, int> > xy(N);
    REP(i, N){
        int x, y;
        cin >> x >> y;
        xy[i] = make_pair(min(x, y), max(x, y));
    }
    sort(ALL(xy));
    set<pair<int, int> > red;
    set<pair<int, int> > blue;
    REP(i, N){
        red.insert(make_pair(xy[i].first, i));
        blue.insert(make_pair(xy[i].second, i));
    }
    LL res = eval(red, blue);
    REP(i, N){
        red.erase(make_pair(xy[i].first, i));
        blue.erase(make_pair(xy[i].second, i));
        red.insert(make_pair(xy[i].second, i));
        blue.insert(make_pair(xy[i].first, i));
        res = min(res, eval(red, blue));
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 20608
#include <stdio.h>

/*
 
 */
int main()
{
	int return_code = 0;
	int comp[8] = {0};
	int i = 0;
	int j = 0;

	const unsigned int win_o = 0x006f6f6f;
	const unsigned int win_x = 0x00787878;
	
	char buff[9] = {0};
	char b[3][3];

	// read board
	while ( gets(buff) != NULL ) {
		
		for ( i=0; i<3; i++ ) {
			for ( j=0; j<3; j++ ) {
				b[i][j] =  buff[(i*3)+j];
			}
		}

		// clear before read data
		for ( i=0; i<8; i++ ) { comp[i] = 0; }
		return_code = 0;
		
		//read compare data
		// for horizontal compare
		for ( i=0; i<3; i++ ) {
			comp[i] = (b[i][0]) | (b[i][1]<<8) | (b[i][2]<<16);
		}
		// for vertical compare
		for ( j=0; j<3; j++ ) {
			comp[j+3] = (b[0][j]) | (b[1][j]<<8) | (b[2][j]<<16);
		}
		// for oblique compare
		comp[6] = (b[0][0]) | (b[1][1]<<8) | (b[2][2]<<16);
		comp[7] = (b[0][2]) | (b[1][1]<<8) | (b[2][0]<<16);
	
		for ( i=0; i<8; i++ ) {
		
			//printf("%08x\n", comp[i]);
		
			if ( memcmp(&comp[i], &win_o, sizeof(int)) == 0 ) {
				if ( return_code == 0 ) {
					return_code = 1;
				} else {
					printf("illigal input value\n");
					return -1;
				}
			}

			if ( memcmp(&comp[i], &win_x, sizeof(int)) == 0 ) {
				if ( return_code == 0 ) {
					return_code = 2;
				} else {
					printf("illigal input value\n");
					return -1;
				}
			}
		
		}

		switch ( return_code ) {
			case 0:
				printf("d\n");
				break;
			case 1:
				printf("o\n");
				break;
			case 2:
			printf("x\n");
				break;
			default:
				return -1;
		}
	}
	
	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#define dump(x) cerr << "LINE" << __LINE__ << " : " << #x << " = {";  \
	for(auto v: x) cerr << v << ","; cerr << "}" << endl;
#else
#define show(x) true
#define dump(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int X; cin >> X;
	rep(i,100000){
		if(i*100 > X) break;
		int f = X - i*100;
		if(f <= 5 * i){
			cout << "1" << endl;
			return 0;
		}
	}
	cout << 0 << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>
#define MN 105
using namespace std;
int n,a[MN],sum[MN],maxn;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&a[i]),sum[a[i]]++,maxn=max(maxn,a[i]);
	if(maxn%2==0){
		for(int i=1;i<maxn/2;i++)if(sum[i]){puts("Impossible");return 0;}
		if(sum[maxn/2]!=1){puts("Impossible");return 0;}
		for(int i=maxn/2+1;i<=maxn;i++)if(sum[i]<2){puts("Impossible");return 0;}
	}else {
		for(int i=1;i<(maxn+1)/2;i++)if(sum[i]){puts("Impossible");return 0;}
		if(sum[(maxn+1)/2]!=2){puts("Impossible");return 0;}
		for(int i=maxn/2+1;i<=maxn;i++)if(sum[i]<2){puts("Impossible");return 0;}
	}puts("Possible");
}



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

template<typename T>
T gcd(T a, T b){
    if (b==0) return a;
    else return  gcd(b,a%b);
}


void solve(int K){
    int ret =0;
    for (int i=1;i<=K;i++){
        for (int j=1;j<=K;j++){
            int gcd_ij = gcd(i,j);
            for (int l =1;l<=K;l++){
                ret+= gcd(gcd_ij,l);
            }
        }
    }
    printf("%d\n",ret);

}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long K;
    scanf("%lld",&K);
    solve(K);
    return 0;
}


Measured memory_bytes: 3828
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  ll n,a,b;
  cin>>n>>a>>b;
  if (b<a){
    cout << 0 << endl;
    return 0;
  }
  if (n==1){
    if (a==b) cout << 1 << endl;
    else cout << 0 << endl;
    return 0;
  }
  cout << (b-a)*(n-2)+1 << endl;
  return 0;
}



Measured memory_bytes: 256
#include <iostream>

using namespace std;

typedef struct {
	int p;
	int d;
} Patient;

static const int MAX_N = 10000;

Patient P[MAX_N];

int main(int argc, char**)
{
	int n, d1, d2;

	while( 1 )
	{
		cin >> n;
		if(n==0) break;

		for(int i=0; i<n; i++)
		{
			cin >> P[i].p; 
			cin >> d1;
			cin >> d2;
			P[i].d = d1 + d2;
		}

		int idx = 0;
		for(int i=0; i<n; i++)
		{
			if(P[idx].d < P[i].d)
			{
				idx = i;
			}
		}

		cout << P[idx].p << " " << P[idx].d << endl;
	}
}

Measured memory_bytes: 944
from operator import itemgetter


def get_identity():
    return list(range(1, n + 1))


def composition(ppp, qqq):
    return [ppp[q - 1] for q in qqq]


def reverse_composition(ppp, qqq):
    return [ppp[i] for i, q in sorted(enumerate(qqq), key=itemgetter(1))]


def solve(k, ppp, qqq):
    qp = reverse_composition(qqq, ppp)
    qpq = reverse_composition(qp, qqq)
    qpqp = composition(qpq, ppp)
   
    l, m = divmod(k - 1, 6)
    res = get_identity()
    tmp = qpqp
    while l:
        if l % 2 == 1:
            res = composition(res, tmp)
        tmp = composition(tmp, tmp)
        l >>= 1

    m = (k - 1) % 6
    if m == 0:
        base = ppp
    elif m == 1:
        base = qqq
    elif m == 2:
        base = reverse_composition(qqq, ppp)
    elif m == 3:
        res = composition(res, qqq)
        base = reverse_composition(get_identity(), ppp)
    elif m == 4:
        res = composition(res, qqq)
        res = reverse_composition(res, ppp)
        base = reverse_composition(get_identity(), qqq)
    elif m == 5:
        res = composition(res, qqq)
        res = reverse_composition(res, ppp)
        base = reverse_composition(get_identity(), qqq)
        base = composition(base, ppp)
    else:
        raise NotImplementedError

    ans = composition(res, base)
    ans = reverse_composition(ans, res)
    return ans


n, k = map(int, input().split())
ppp = list(map(int, input().split()))
qqq = list(map(int, input().split()))
print(*solve(k, ppp, qqq))


Measured memory_bytes: 35460
N,M = map(int,input().split())

H = list(map(int,input().split()))

S = [True for i in range(N)]
A = []

for i in range(M):
  a,b = list(map(int,input().split()))
  if H[a-1] < H[b-1]:
    S[a-1]= False
  elif H[a-1] > H[b-1]:
    S[b-1]= False
  elif H[a-1] == H[b-1]:
    S[a-1]= False
    S[b-1]= False
print(sum(S))

Measured memory_bytes: 84908
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }

        static readonly long Mod = 1000000000 + 7;

        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            var ai = new List<long>((int)N);
            for (var i = 0; i < N; ++i)
                ai.Add(Sarray()[0] - 1);
            var pushed = new bool[N];
            var now = 0L;
            var ans = 0L;
            while (1 != now && !pushed[now])
            {
                pushed[now] = true;
                now = ai[(int)now];
                ++ans;
            }
            if (now == 1)
                WriteLine(ans);
            else
                WriteLine(-1);

            //Out.Flush();
        }
    }
}

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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



int n, a[202020], d[202020];
void solve(){
	cin >> n;
	for(int i = 0; i < n-1; i++){
		cin >> a[i];
		d[a[i]]++;
	}
	
	for(int i = 1; i <= n; i++){
		cout << d[i] << endl;
	}
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

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

int main() {
    int r,g,b; cin >> r >> g >> b;
    int S = r*100+g*10+b;
    if (S % 4 == 0) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <stdint.h>

using namespace std;

int main()
{
  uint64_t N;
  cin >> N;

  uint64_t step = UINT64_MAX;
  
  for (uint64_t ii=1; ii*ii<=N; ++ii) {
    if (N%ii==0) {
      step = min(step, ii+N/ii-2);
    }
  }

  cout << step << endl;

  return 0;
}


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

const int INF= 1e9;

struct edge{
  int from, to, cost;
  edge(int x,int y, int z):from(x),to(y),cost(z){}
  bool operator<(const edge &x)const{ return cost<x.cost; }
};


class Prim{
  int n;
  vector< vector<edge> > g;
public:
  Prim(int a=0):n(a){ g.resize(n); }

  void AddEdge(int a, int b, int cost){
    g[a].push_back(edge(a,b,cost));
    g[b].push_back(edge(b,a,cost));
  }

  int MinSpanningTree(){
    int res = 0;
    vector<int> d(n,INF); d[0] = 0;
    vector<bool> use(n,0);

    for(;;){
      int v = -1;
      for(int u=0;u<n;u++){
	if(!use[u] && (v<0 || d[v] > d[u]))v = u;
      }
      if(v<0)break;
      use[v] = 1; res += d[v];

      for(int i=0;i<(int)g[v].size();i++){
	d[g[v][i].to] = min( d[g[v][i].to], g[v][i].cost);
      }
    }
    return res;
  }
};

int main(){
  int n,m;
  while(scanf("%d",&n),n){
    Prim p(n);
    cin >> m;
    for(int i=0;i<m;i++){
      int a,b,c;
      scanf("%d,%d,%d",&a,&b,&c);
      p.AddEdge(a,b,c/100-1);
    }
    cout << p.MinSpanningTree() << endl;
  }
}

Measured memory_bytes: 1408
'use strict'

function Main(input) {
  const N = Number(input);
  const Nlist = input.split('').map(x => Number(x));
  let digit = 0;

  for(let i=0; i<Nlist.length; i++) {
    digit += Nlist[i];
  }

  if(N % digit === 0) {
    console.log('Yes');
  } else {
    console.log('No');
  }

}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());

Measured memory_bytes: 7372
#include "bits/stdc++.h"
#define F first
#define S second
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ll n = 0, k = 0;
  cin >> n >> k;
  ll ans = 0;
  while (n) {
    n /= k, ++ans;
  }
  cout << ans;
}


Measured memory_bytes: 3644
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;
const int maxn = 1e6 + 5;
long long a[maxn], b[maxn], c[maxn];

int main()
{
    long long n;
    long long sum = 0;
    scanf("%lld", &n);
    for(int i = 1; i <= n; i++)
        scanf("%lld", &a[i]);
    for(int i = 1; i <= n; i++)
        scanf("%lld", &b[i]);
    for(int i = 1; i <= n; i++)
        scanf("%lld", &c[i]);
    sort(a + 1, a + n + 1);
    sort(b + 1, b + n + 1);
    sort(c + 1, c + n + 1);
    long long l = 0, r = 0;
    for(int i = 1; i <= n; i++)
    {
        while(a[l + 1] < b[i] && l + 1 <= n)
            l++;
        while(c[r + 1] <= b[i] && r + 1 <= n )
            r++;
        sum += l * (n - r);
    }
    printf("%lld\n", sum);
    return 0;
}


Measured memory_bytes: 9216
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define printclock cerr << "Time : " << 1000 * (ld)clock() / (ld)CLOCKS_PER_SEC << "ms\n";
#define deb2(x, y) cout << #x << ": " << x << " | " << #y << ": " << y << endl
#define deb1(x) cout << #x << ": " << x << endl
#define rep(i, a, n) for (int i = (a); i < (n); ++i)
#define prec(n) fixed << setprecision(n)
#define all(a) a.begin(), a.end()
#define fast                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define pii pair<int, int>
#define vii vector<int>
#define ld long double
#define int long long
#define MOD LLONG_MAX
#define mp make_pair
#define pb push_back
#define endl "\n";
inline void get(vector<int> &arr, int n)
{
    int a;
    for (int i = 0; i < n; i++)
    {
        cin >> a;
        arr.push_back(a);
    }
}
inline void print(vector<int> &arr, int n)
{
    for (int i = 0; i < n; i++)
        cout << arr[i] << " ";
    cout << endl;
}
/*----------------------------------TEMPLATE------------------------------------*/
int32_t main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    fast;
    /*----------------------------PEEPEEPOOPOO-------------------------------------*/
    int t;
    //cin >> t;
    t =1;
    while (t--)
    {
        string s;
        cin >> s;
        int n = s.size();
        if(s[n-1]=='s') s += "es";
        else s += "s";
        cout << s << endl; 
    }
    return 0;
}
/*--------------------------------PEEPEEPOOPOO-------------------------------------*/

Measured memory_bytes: 3652
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define ll int128_t
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
#define smax(a,b) a=max(a,b)
// #if !defined(ONLINE_JUDGE)
// #include "debugging.h"
// #endif
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// erase,insert same as normal set

// int const mod = 7340033;
int const mod = 1e9+7;
int power(int a,int b,int m){
    int res = 1;
    while(b){
        if(b&1){
            res = res*a;
            res %= m;
        }
        a=a*a;
        a%=m;
        b=b/2;
    }
    return res;
}
 
int inverse(int x){
    return power(x,mod-2,mod);
}

int const N = 2e5+555;
int const inf = 2e16;

void solve(){  
    int n,i,j,l,m;
    string s;
    cin>>s;
    n = s.size();
    j=n-1;
    i=0;
    while(i<j){
        if(s[i] != s[j]){
            cout<<"No"<<endl;
            return;
        }
        i++;
        j--;
    }

    j = (n)/2 - 1;
    i=0;
    while(i<j){
        if(s[i] != s[j]){
            cout<<"No"<<endl;
            return;
        }
        i++;
        j--;
    }
    i=(n+1)/2;
    j=n-1;
    while(i<j){
        if(s[i] != s[j]){
            cout<<"No"<<endl;
            return;
        }
        i++;
        j--;
    }
    cout<<"Yes"<<endl;
}       


int32_t main(){
    IOS;
    int t;
    t = 1;
    // precompute();
    // cin>>t;
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}

/*

*/

Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli n;
vll a;
lli ans = 0;

int main(){
    cin >> n;
    a = vll(3*n);
    for(lli i = 0;i < 3*n;i++){
        cin >> a[i];
    }
    sort(a.rbegin(),a.rend());
    for(lli i = 0;i < 2*n;i+=2){
        ans += a[i+1];
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define whlie while
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repr(i,N) for(int i = (N) - 1; i >= 0; i--)
#define rep1(i,N) for(int i = 1; i <= (N) ; i++)
#define repr1(i,N) for(int i = (N) ; i > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define vrep(v,it) for(auto it = v.begin(); it != v.end(); it++)
#define vrepr(v,it) for(auto it = v.rbegin(); it != v.rend(); it++)
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) ll __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; using vl = vector<ll>;
using vi = vector<int>; using vvi = vector< vector<int> >;
constexpr int inf = 1001001001;
constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif

using P = pair<int,int>; using vp = vector<P>;
constexpr int MOD = /** 1000000007; //*/ 998244353;
////////////////

void solve(){
  ini(a,b);
  out(max(0 , a - 2 * b));

}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>

using namespace std;

int main(void) {

	stack<int> st;
	int a, b;
	string s;

	while (cin >> s) {
		if (s[0] == '+') {
			a = st.top(); st.pop();
			b = st.top(); st.pop();
			st.push(a + b);
		}
		else if (s[0] == '-') {
			b = st.top(); st.pop();
			a = st.top(); st.pop();
			st.push(a - b);
		}
		else if (s[0] == '*') {
			a = st.top(); st.pop();
			b = st.top(); st.pop();
			st.push(a * b);
		}
		else if (s[0] == '\n')
			break;
		else
			st.push(atoi(s.c_str()));
	}

	cout << st.top() << endl;

	return 0;
}

Measured memory_bytes: 3192
#include <algorithm>
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <climits>
#include <utility>
#include <deque>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<pair<int, int>> xys(n);
	for (auto& xy : xys)cin >> xy.first >> xy.second;

	vector<vector<pair<int, int>>> dist(n, vector<pair<int, int>>(n));
	map<pair<int, int>, int> distFreq;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			dist[i][j] = make_pair<int, int>(xys[i].first - xys[j].first, xys[i].second - xys[j].second);
			if(i != j) distFreq[dist[i][j]] += 1;
		}
	}
	
	auto maxNum = 0;
	auto maxPair = pair<int, int>();
	for (auto freq : distFreq) {
		if (maxNum < freq.second) {
			maxNum = freq.second;
			maxPair = freq.first;
		}
	}

	set<pair<int, int>> costZeroCandXYs;
	set<int> costZeroCandIndices;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (dist[i][j] == maxPair) {
				costZeroCandXYs.insert(make_pair(i, j));
				costZeroCandIndices.insert(i);
				costZeroCandIndices.insert(j);
			}
		}
	}

	int groupCount = 0;
	int costZeroSize = costZeroCandIndices.size();
	pair<int, int> grouper = *costZeroCandXYs.begin();
	costZeroCandXYs.erase(costZeroCandXYs.begin());
	bool isFound = true;
	while (!costZeroCandXYs.empty()) {
		if (!isFound) {
			groupCount++;
			grouper = *costZeroCandXYs.begin();
			costZeroCandXYs.erase(costZeroCandXYs.begin());
		}
		isFound = false;
		for (auto it = costZeroCandXYs.begin(); it != costZeroCandXYs.end();) {
			if (grouper.first == (*it).second) {
				grouper.first = (*it).first;
				it = costZeroCandXYs.erase(it);
				isFound = true;
			}
			else if (grouper.second == (*it).first) {
				grouper.second = (*it).second;
				it = costZeroCandXYs.erase(it);
				isFound = true;
			}
			else {
				++it;
			}
		}
	}
	groupCount++;

	cout << xys.size() - costZeroSize + groupCount << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

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

    int n, m;
    cin >> n >> m;
    
    if(n > 1 && m > 1) cout << (n-2) * (m-2) << endl;
    else if(n > 1) cout << (n-2) << endl;
    else if(m > 1) cout << (m-2) << endl;
    else cout << 1 << endl;
}


Measured memory_bytes: 256
#include<stdio.h>

int eat(int rem){
  
  if(rem%2==1)rem-=1;
  
  return rem;
  
}
  

int main(void){
  
  int A,B,K;
  
  scanf("%d %d %d",&A,&B,&K);
  
  for(int i=0;i<K;i++){
    
    if(i%2==0){
      
      eat(A);
      
      A=A/2;
      
      B+=A;
      
    }else{
      
      eat(B);
      
      B=B/2;
      
      A+=B;
      
    }
    
  }
  
  printf("%d %d\n",A,B);
  
  return 0;
}

Measured memory_bytes: 128
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int x;
    cin >> x;
    cout << (x<1200?"ABC":"ARC") << endl;
    return 0;
}


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

int main(){
	int n;
  	cin >> n;
  	vector<int> d(n);
  	rep(i, n) cin >> d[i];
  
  	int ans = 0;
  	rep(i, n-1){
    	for(int j = i+1; j < n; j++){
        	ans += d[i]*d[j];
        }
    }
  
  	cout << ans << endl;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define show(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define show(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<62;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    string n;
    int k;
    cin >> n >> k;
    vector<bool> ok(10,true);
    rep(i,0,k){
        char ch;
        cin >> ch;
        ok[ch-'0']=false;
    }

    function<string(int,bool,bool)> rec=[&](int i,bool f1,bool f2){
        if(i==0) return string();
        string res="9999999999999";
        rep(j,0,10){
            if(!f2 and !j) continue;
            if(!ok[j]) continue;
            char ch='0'+j;
            if(!f1 and ch<n[n.size()-i]) continue;
            bool f1_=f1||ch>n[n.size()-i],f2_=f2||j!=0;
            string tmp=rec(i-1,f1_,f2_);
            if(tmp=="9999999999999") continue;
            res=min(res,ch+tmp);
        }
        return res;
    };
    rep(i,n.size(),inf){
        string tmp=rec(i,i>n.size(),false);
        if(tmp!="9999999999999"){
            cout << tmp << endl;
            return;
        }
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
int main(){

  int i,N;
  int a[100];
  int MAX=0,MIN=1000;

  scanf("%d", &N);
  for(i=0;i<N;i++){
    scanf("%d", &a[i]);
  }

  for(i=0;i<N;i++){
    if(MAX < a[i]){
      MAX = a[i];
    }
    if(MIN > a[i]){
      MIN = a[i];
    }
  }
  
  printf("%d",(MAX-MIN));
 return 0; 
}

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

using namespace std;
using ll = long long;
const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint operator-() const { return mint(-x); }

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const { return mint(*this) += a; }

    mint operator-(const mint a) const { return mint(*this) -= a; }

    mint operator*(const mint a) const { return mint(*this) *= a; }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }

    mint &operator/=(const mint a) { return *this *= a.inv(); }

    mint operator/(const mint a) const { return mint(*this) /= a; }
};

istream &operator>>(istream &is, const mint &a) { return is >> a.x; }

ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }

multiset<int> s[202020], t;

vector<int> A[101010];
int M[101010];
bool B[101010];

int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        A[a].push_back(b);
        A[b].push_back(a);
    }
    queue<int> q;
    q.push(0);
    while (!q.empty()) {
        int from = q.front();
        q.pop();
        for (int to:A[from]) {
            if (B[to])continue;
            q.push(to);
            M[to] = from;
            B[to] = true;
        }
    }


    cout << "Yes" << endl;
    for (int i = 1; i < n; ++i) {
        cout << M[i] + 1 << endl;
    }


    return 0;
}


Measured memory_bytes: 20080
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N,K = map(int,input().split())
    A = list(map(int,input().split()))

    L = [0] * (N + 1)
    for i in range(N):
        L[i + 1] = L[i]
        if A[i] > 0:
            L[i + 1] += A[i]
    
    R = [0] * (N + 1)
    for i in range(N - 1,-1,-1):
        R[i] = R[i + 1]
        if A[i] > 0:
            R[i] += A[i]
    
    ans = 0
    range_sum = sum(A[:K])
    for i in range(K,N + 1):
        ret = max(L[i - K] + range_sum + R[i],L[i - K] + R[i])
        ans = max(ans,ret)
        range_sum -= A[i - K]
        if i < N:
            range_sum += A[i]
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 16900
#define __LOCAL_DEBUG__
#include<bits/stdc++.h>
using namespace std;
#ifdef __LOCAL_DEBUG__
# define _debug(x) { cerr << "\033[94m" << __func__ << " " << #x << ": " << (x) << "\n\033[0m"; }
#else
# define _debug(x) {((void) 0);}
#endif
#define rep(i, n) for (int i = (0); i < (n); i++)
#define repp(i, a, b) for (int i = (a); i < (b); i++)
#define CLR(x, v) memset(x, v, sizeof (x))
#define all(x) x.begin(), x.end()
#define SZ(x) (int) x.size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
using ll = signed long long;
using PII = pair<int, int>;
using VI = vector<int>;
using VVI = vector<VI>;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int MAXN = 700;

const int N = 200005;

// #define __LOCAL_DEBUG__
int n ,k;
int a[N];
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    scanf("%d%d",&n,&k);
    repp(i, 1, k + 1) scanf("%d", a + i);
    a[0] = a[k];
    int ma = 0;
    repp(i, 1, k + 1) amax(ma, (a[i] - a[i - 1] + n)% n);
    printf("%d\n", n - ma);

    return 0;
}




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

int main() {
    long long A, B, H, M;
    cin >> A >> B >> H >> M;

    double kakuA = H / 12.0 * 2 * M_PI + M / 60.0 * M_PI / 6.0;
    double kakuB = M / 60.0 * 2 * M_PI;
    cerr << "kakuA: " << kakuA << ", kakuB: " << kakuB << endl;

    double kakuabs = abs(kakuA - kakuB);

    printf("%.15lf\n", sqrt(A * A + B * B - 2 * A * B * cos(kakuabs)));

    return 0;
}


Measured memory_bytes: 4224
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int n, a[100009], b[100009], c[100009];
int main() {
	cin >> n;
	for (int i = 0; i < n; i++) cin >> a[i]; sort(a, a + n);
	for (int i = 0; i < n; i++) cin >> b[i]; sort(b, b + n);
	for (int i = 0; i < n; i++) cin >> c[i]; sort(c, c + n);
	int cl = 0, cr = 0; long long ret = 0;
	for (int i = 0; i < n; i++) {
		while (cl != n && a[cl] < b[i]) cl++;
		while (cr != n && c[cr] <= b[i]) cr++;
		ret += 1LL * cl * (n - cr);
	}
	cout << ret << endl;
	return 0;
}

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,a; cin>>n;
	bool ok=true;
	for (int i=0; i<n; i++){
		cin>>a;
		if (a%2) continue;
		if (a%3&&a%5) 
			ok=false;
	}
	cout<<(ok?"APPROVED":"DENIED")<<"\n";
	return 0;
}


Measured memory_bytes: 256
s = input()
n = len(s)
s2 = s[:n-1]

if s[0] != '1' or s[-1] != '0' or (s2[::-1] != s2):
    print("-1")
    exit(0)

ans = "{0} {1}"
par = n
for i in range(n-2,-1,-1):
    print(ans.format(par,i+1))
    if s[i] == '1':
        par = (i+1)


Measured memory_bytes: 45400
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DWaterBottle solver = new DWaterBottle();
        solver.solve(1, in, out);
        out.close();
    }

    static class DWaterBottle {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            double a = in.nextInt();
            double b = in.nextInt();
            double x = in.nextInt();
            double y = (a * a * b - x) / (a * a / 2);
            if (b - y >= 0) {
                out.println(Math.atan(y / a) * 180 / Math.PI);
                return;
            }
            out.println(Math.atan((a * b * b) / (2 * x)) * 180 / Math.PI);

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 21460
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll x;cin>>x;
  vector<ll>dp(x+1,0);
  vector<ll>cost(6);
  rep(i,6)cost[i]=100+i;
  dp[0]=1;
  rep(i,1000){
    auto tdp=dp;
    rep(j,6)rep(k,x+1-cost[j]){
      if(dp[k]){
        tdp[k+cost[j]]=1;
      }
    }
    dp=tdp;
  }
  cout<<dp[x]<<endl;
  return 0;

}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    int r,g,b,n,cnt=0;
    int n1=0,n2=0,n3=0;
    cin >> r >> g >> b >> n;
    for(int i=0;i*r<=n;i++){
        for(int j=0;j*g+i*r<=n;j++){
            int k = (n-r*i-g*j)/b;
            if(k*b+i*r+g*j==n)  cnt++;
        }
    }
    cout << cnt << endl;
}

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

using namespace std;

int N, ans = 0;

bool check(string s){
	int n = 0;
	bool isSmaller = false, isContainAll = false;
	for(int i = s.size() - 1; i >= 0; --i){
		n += (s[i] - '0' ) * pow(10, i);
	}
	if(n <= N) isSmaller = true;
	bool isThree = false, isFive = false, isSeven = false;
	for(int i = 0; i < s.size(); ++i){
		if(s[i] == '3') isThree = true;
		else if(s[i] == '5') isFive = true;
		else if(s[i] == '7') isSeven = true;
		if(isThree && isFive && isSeven){
			isContainAll = true;
			break;
		}
	}
	return isSmaller && isContainAll;
}

void rec(string s, int d){
	if(d <= 0){
		if(check(s)) ans++;
		return;
	}
	rec(s + '3', d - 1);
	rec(s + '5', d - 1);
	rec(s + '7', d - 1);
}

int main(){
	int digit = 0;
	cin >> N;
	for(int i = 0;; ++i){
		if(N >= pow(10, i)) digit = i;
		else{
			digit++;
			break;
		}
	}
	for(int i = 0; i < digit; ++i){
		rec("", digit - i);
	}
	cout << ans << endl;
}

Measured memory_bytes: 512
#include<stdio.h>
int main()
{
  int a,b,c;
  int five;
  int seven;
  scanf("%d %d %d",&a,&b,&c);
  five=((a==5)?1:0)+((b==5)?1:0)+((c==5)?1:0);
  seven=((a==7)?1:0)+((b==7)?1:0)+((c==7)?1:0);
  if((five==2)&&(seven==1)){
    printf("YES\n");
  }
  else{
  	printf("NO\n");
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi; 
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(a) int((a).size())
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define trav(x, c) for(auto &x : c)
#define rep(i, n) for(int i = 0; i < n; i++)
#define repa(i, b, e) for(int i = (b)-((b)>(e)); i != (e)-((b)>(e)); i += 1-2*((b)>(e)))

#define debug(args...) { string s_(#args); replace(all(s_), ',', ' '); stringstream ss_(s_); istream_iterator<string> it_(ss_); cerr_(it_, args); }
void cerr_(istream_iterator<string> it) { (void) it; }
template<class T, class... Args> void cerr_(istream_iterator<string> it, T a, Args... args) { cerr << *it << " = " << a << endl; cerr_(++it, args...); }

template<class T, class S>  ostream& operator<<(ostream& os, const pair<T, S>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<class T> ostream& operator<<(ostream &os, const set<T> &s) { os << '{'; string sep; for (const auto &x : s) os << sep << x, sep = ", "; return os << '}'; }
template<class T, class S> ostream& operator<<(ostream &os, const map<T, S> &m) { os << '{'; string sep; for (const auto &x : m) os << sep << x, sep = ", "; return os << '}'; }
template<class T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }

//=========================

void run_test() {
	int n; cin >> n;
	cout << (1000 - (n % 1000)) % 1000 << endl;
}

//=========================

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//int t_ = 1, t__; cin >> t__; while(t_ <= t__) { cout << "Case #" << t_++ << ": "; run_test(); }
	// int t_; cin >> t_; while(t_--) run_test();
	run_test();
	return 0;	
}


Measured memory_bytes: 3608
n = int(input())
divisors = []
for i in range(1, int(n**0.5)+1):
  if n % i == 0:
    divisors.append(i)
    if i != n // i:
      divisors.append(n//i)
divisors.sort()
S=len(divisors)

if S%2 == 0:
  print(divisors[int((S/2)-1)] + divisors[int(S/2)] - 2)
else:
  print((divisors[int((S-1)/2)]-1)*2)


Measured memory_bytes: 3316
#include <stdio.h>

int main(void) {
	char moji[1201];
	int i=0;

	fgets(moji,1201,stdin);
	while(1){
		if(moji[i] >= 'A' && moji[i] <= 'Z'){
			moji[i] += 32;
		}else if(moji[i] >= 'a' && moji[i] <= 'z'){
			moji[i] -= 32;
		}else if(moji[i] == 0){
			break;
		}
		printf("%c",moji[i]);
		i++;
	}
	//printf("\n");
	return 0;
}


Measured memory_bytes: 2040