akhauriyash/Code-Regression huggingface dataset:
a = list(map(int, input().split()))

def Base_10_to_n(X, n):
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

x10 = a[0]
x2 = Base_10_to_n(x10, a[1])

print(len(str(x2)))

Measured memory_bytes: 3060
X = int(input())

def is_prime(val):
    factor = 2
    ret = True
    while factor * factor <= val:
        if val % factor == 0:
            ret = False
            break
        factor += 1
    return ret

ans = X
while True:
    if is_prime(ans):
        break
    ans += 1

# simple, but more memory consumption of range
# for ans in range(X, X*X):
#     if is_prime(ans):
#         break
    
print(ans)

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

#define ran 111

int n, m;
int cnt[ran];

int main() {
	scanf("%d%d", &n, &m);
	for(int i=0;i<m;i++){
		int s;
		scanf("%d", &s);
		for(int j=0;j<s;j++) {
			int x;
			scanf("%d", &x);
			cnt[x]++;
		}
	}
	int ans = 0;
	for(int i=1;i<=n;i++)
		if(!cnt[i]) ans++;
	printf("%d\n", ans);
	
	return 0;
}

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

int main(){
	int b, c, n, a, i, j;
	bool executable;
	cin >> n;
	for(i=0;i<n;i++){
		executable = true;
		cin>>a;
		b=a;
		c=0;
		for(j=1;j<10;j++){
			cin>>a;
			if(a-b < 0){
				if(a-c < 0){
					executable = false;
				}else{
					c = a;
				}
			}else{
				if(a-c < 0){
					b = a;
				}else{
					if(c < b){
						b = a;
					}else{
						c = a;
					}
				}
			}
		}
		if(executable){
			cout << "YES\n";
		}else{
			cout << "NO\n";
		}
	}
	return 0;
}

Measured memory_bytes: 1120
#include <stdio.h>
#include <stdlib.h>

int compare_int(const void *a, const void *b){
  return *(int *)b - *(int *)a;
}

int main(int argc, char const *argv[]) {

  int N, M, sum;
  sum = 0;
  scanf("%d", &N);
  scanf("%d", &M);

  int A[100];
  for (int i = 0; i < N; i++) {
    scanf("%d", A + i);
    sum = sum + A[i];
  }

  qsort(A, N, sizeof(int), compare_int);

  int min = sum / (4 * M);

  if (A[(M - 1)] < min) {
    printf("No\n");
  }else if(A[(M - 1)] > min){
    printf("Yes\n");
  }else if(A[(M - 1)] == min){
    if (sum % (4 * M)) {
      printf("No\n");
    }else{
      printf("Yes\n");
    }
  }

  return 0;
}


Measured memory_bytes: 128
n = int(input())
s = list(input())
dp = [ [0]*n for _ in range(2) ]
if s[0] == ".":
  dp[1][0] = 1
else:
  dp[0][0] = 1
for i in range(n-1):
  if s[i+1] == ".":
    dp[0][i+1] = dp[0][i]
    dp[1][i+1] = min(dp[0][i], dp[1][i]) + 1
  else:
    dp[0][i+1] = dp[0][i] + 1
    dp[1][i+1] = min(dp[0][i], dp[1][i])
print(min(dp[0][n-1], dp[1][n-1]))

Measured memory_bytes: 14220
//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
//入力マクロここまで

fn main() {
    input! {
        k: i64,
        s: i64,
    }

    let mut cnt = 0;

    for x in 0..k + 1 {
        for y in 0..k + 1 {
            if s - x - y >= 0 && s - x - y <= k {
                cnt += 1;
            }
        }
    }

    println!("{}", cnt);
}


Measured memory_bytes: 4352
#include<stdio.h>

int main()
{
    int n, i, ans[3] = {};

    scanf(" %d", &n);


    for(i = 0; i < 3; i++)
    {
        if(i != 2)
        {
            ans[2-i] = n%10;
        }
        else
        {
            ans[0] = n;
        }
        n /= 10;
    }

    for(i = 0; i < 3; i++)
    {
        if(ans[i] == 1)
        {
            ans[i] = 9;
        }
        else if(ans[i] == 9)
        {
            ans[i] = 1;
        }
        printf("%d", ans[i]);
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 128
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var arr=(input.trim()).split("");
var x="";
arr.forEach(function(v){
if(v=="0")x+="w";
if(v=="1")x+="";
if(v=="2")x+="k";
if(v=="3")x+="s";
if(v=="4")x+="t";
if(v=="5")x+="n";
if(v=="6")x+="h";
if(v=="7")x+="m";
if(v=="8")x+="y";
if(v=="9")x+="r";
if(v=="T")x+="a";
if(v=="L")x+="i";
if(v=="U")x+="u";
if(v=="R")x+="e";
if(v=="D")x+="o";
});
x=x.replace(/wu/g,"nn");
console.log(x);

Measured memory_bytes: 8424
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <set>
#include <utility>
#include <cstdlib>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <map>

using namespace std;

using ll = long long;

int main(){
    //入力
    int n;
    cin >> n;
    //それぞれの駅の値を入力。
    //駅からかかる時間と駅の出発時間、何秒おきに出発しているか。
    vector<int> c(n), s(n), f(n);
    for(int i = 0; i < n-1; i++){
        cin >> c[i] >> s[i] >> f[i];
    }

    //それぞれの駅にの場所からの時間を調べる。
    for(int i = 0; i < n; i++){
        //毎回答えを初期化する。
        int res = 0;
        //駅に訪れる回数ループする。
        for(int j = i; j < n-1; j++){
            //もし訪れた駅の出発時間が今までにかかった時間より遅かったらその時間まで待つことになるのでその時間を代入する。
            if(res < s[j]){
                res = s[j];
            }
            //もし訪れた駅の出発はもう済んでいて、その出発時間の間隔がちょうどの時間に駅に着いたなら何もしない。
            else if(res%f[j] == 0);
            //もし訪れた駅の出発はもう済んでいて、出発までまだ時間がある時、その時間の分を足す。
            else{
                res = res+f[j] - res%f[j];
            }
            //次の駅に行くまでの時間を足し合わせる。
            res += c[j];
        }
        //出力
        cout << res << endl;
    }
    return 0;
}



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

#define INF (1<<29)
typedef long long ll;

const ll MAX_V = 100100;

ll V, E;
vector<ll> G[MAX_V];

ll d[2][MAX_V], cnt[2];
bool f[2][MAX_V];

void dfs(ll s, ll n) {

	for (ll i = 0; i < G[s].size(); i++) {
		ll u = G[s][i];
		if(f[n][u]) continue;
		f[n][u] = true;
		d[n][u] = d[n][s]+1;
		dfs(u, n);
	}
}

int main() {
	cin >> V;
	for (ll i = 0; i < V-1; i++) {
		ll a, b; cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	for(int i=0; i<V; i++) d[0][i] = d[1][i] = INF;
	d[0][0] = 0; d[1][V-1] = 0;

	f[0][0] = f[0][V-1] = true;
	f[1][0] = f[1][V-1] = true;

	dfs(0, 0);
	dfs(V-1, 1);

	for (int i = 1; i < V-1; i++) {
		if(d[0][i] <= d[1][i]) cnt[0]++;
		else cnt[1]++;
	}

	if(cnt[0] > cnt[1]) cout << "Fennec" << endl;
	else cout << "Snuke" << endl;
}

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

#define rep(i, m, n) for(int(i) = (int)(m); i < (int)(n); ++i)
#define rep2(i, m, n) for(int(i) = (int)(n)-1; i >= (int)(m); --i)
#define REP(i, n) rep(i, 0, n)
#define REP2(i, n) rep2(i, 0, n)
#define all(hoge) (hoge).begin(), (hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll)1e9 + 7;
//constexpr long long MOD = 998244353LL;
using ld = long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;

template <class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

struct Edge {
    ll to, rev;
    long double cap;
    Edge(ll _to, long double _cap, ll _rev) {
        to = _to;
        cap = _cap;
        rev = _rev;
    }
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph &G, ll from, ll to, long double cap, bool revFlag,
              long double revCap) {
    G[from].push_back(Edge(to, cap, (ll)G[to].size()));
    if(revFlag)
        G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve() {
    ll n, m;
    cin >> n >> m;
    vec<ll> x(n);
    map<ll, ll> mp;
    vec<ll> con(m, 0);
    vec<ll> pairs(m, 0);
    REP(i, n) {
        cin >> x[i];
        con[x[i] % m]++;
        mp[x[i]]++;
    }
    for(auto i : mp) {
        pairs[i.first % m] += i.second / 2;
    }

    ll ans = 0;
    REP(i, m) {
        int j = (m - i) % m;
        if(i > j)
            break;
        else if(i == j) {
            ans += con[i] / 2;
        } else {
            ll t = min(con[i], con[j]);
            ans += t;
            ans += min((con[i] - t) / 2, pairs[i]);
            ans += min((con[j] - t) / 2, pairs[j]);
        }
    }
    cout << ans << en;
}

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

    solve();
    /*
    ll t;
    cin >> t;
    REP(i, t)
    solve();
    */

    return 0;
}


Measured memory_bytes: 11720
#include<iostream>
#include<vector>
#include<algorithm>
#include<cassert>
#include<map>

#define MAX_V 5000
#define INF (1<<29)

using namespace std;

struct edge{int to,cap,rev;};

vector<edge>g[MAX_V];
bool used[MAX_V];

void add_edge(int from,int to,int cap){
  g[from].push_back((edge){to,cap,g[to].size()});
  g[to].push_back((edge){from,0,g[from].size()-1});
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  used[v]=true;
  for(int i=0;i<g[v].size();i++){
    edge &e=g[v][i];
    if(!used[e.to] && e.cap>0){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
        e.cap-=d;
        g[e.to][e.rev].cap+=d;
        return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow=0;
  for(;;){
    fill(used,used+MAX_V,false);
    int f=dfs(s,t,INF);
    if(f==0)return flow;
    flow+=f;
  }
}
int main(void){

  int n;
  while(cin >> n,n){

    for(int i=0;i<MAX_V;i++)g[i].clear();

    vector<int>a;
    map<int,int>mp;
    int m,in,tmp;
    cin >> tmp;
    for(int i=0;i<tmp;i++){
      cin >> in;
      add_edge(n+tmp,i,1);
      a.push_back(in);
      mp[in]=i;
    }

    for(int i=0;i<n;i++){
      cin >> m;
      vector<int>b(m);
      for(int j=0;j<m;j++)cin >> b[j];
      for(int j=0;j<m;j++){
        if(mp.count(b[j])){
          add_edge(mp[b[j]],i+tmp,1);
        }
      }
    }

    for(int i=0;i<n;i++){
      add_edge(i+tmp,n+tmp+1,1);
    }
    cout << max_flow(n+tmp,n+tmp+1) << endl;
  }
  return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << min(b / a, c) << endl;
  return 0;
}

Measured memory_bytes: 256
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const K = nextInt()
    const [A, B] = nextIntArray()
    let tmp = 0
    while(tmp<=B){
        tmp = tmp + K
        if(A <= tmp && tmp <=B){
            console.log("OK")
            return
        } 
    }
    console.log("NG")
}
Main()


Measured memory_bytes: 29680
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main(){
    LL n;
    cin >> n;
    LL ans1 = 1;
    LL ans2 = 1;
    for(int i = 0; i < n; i++){
        int b;
        cin >> b;
        ans1 *= 3;
        if(b % 2 == 0){
            ans2 *= 2;
        }
    }
    cout << ans1 - ans2 << endl;
}

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

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

struct LowLink {
	const vector<vector<ll>>& g;
	vector< ll > used, ord, low;
	vector< ll > articulation;
	vector< pair< ll, ll > > bridge;

	LowLink(const vector<vector<ll>>& g) : g(g) {}

	ll dfs(ll idx, ll k, ll par) {
		used[idx] = true;
		ord[idx] = k++;
		low[idx] = ord[idx];
		bool is_articulation = false;
		ll cnt = 0;
		for (auto& to : g[idx]) {
			if (!used[to]) {
				++cnt;
				k = dfs(to, k, idx);
				low[idx] = min(low[idx], low[to]);
				is_articulation |= ~par && low[to] >= ord[idx];
				if (ord[idx] < low[to]) bridge.emplace_back(minmax(idx, (ll)to));
			}
			else if (to != par) {
				low[idx] = min(low[idx], ord[to]);
			}
		}
		is_articulation |= par == -1 && cnt > 1;
		if (is_articulation) articulation.push_back(idx);
		return k;
	}

	void build() {
		used.assign(g.size(), 0);
		ord.assign(g.size(), 0);
		low.assign(g.size(), 0);
		int k = 0;
		for (int i = 0; i < g.size(); i++) {
			if (!used[i]) k = dfs(i, k, -1);
		}
	}
};

int main() {
	ll n, m;
	cin >> n >> m;
	vector<vector<ll>> graph(n);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	LowLink link(graph);
	link.build();
	cout << link.bridge.size() << endl;
	return 0;
}


Measured memory_bytes: 3608
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=1e9+7;
ll powmod(ll a, ll k){
    ll ap=a, ans=1;
    while(k){
        if(k&1){
            ans*=ap;
            ans%=MOD;
        }
        ap=ap*ap;
        ap%=MOD;
        k>>=1;
    }
    return ans;
}
ll inv(ll a){
	return powmod(a, MOD-2);
}
ll f[2000001], invf[2000001];
void fac(int n){
    f[0]=1;
    for(ll i=1; i<=n; i++) f[i]=f[i-1]*i%MOD;
    invf[n]=inv(f[n]);
    for(ll i=n-1; i>=0; i--) invf[i]=invf[i+1]*(i+1)%MOD;
}
ll comb(int x, int y){
    if(!(0<=y && y<=x)) return 0;
    return f[x]*invf[y]%MOD*invf[x-y]%MOD;
}
int n, m;
ll solve(int r){
  if(r==0) return 1;
  ll ret=comb(r+n, n);
  for(int i=0; i<=r; i++){
    for(int j=0; r-(ll)(m+j)*(i+1)>=0; j++){
      ll c=comb(n, m)*comb(n-m, j)%MOD*comb(r-(m+j)*(i+1)+n, n)%MOD;
      if(j&1) (ret+=c)%=MOD;
      else (ret+=MOD-c)%=MOD;
    }
  }
  for(int i=1; i<=r; i++){
    for(int j=0; r-(ll)m*(i+1)-(ll)j*i>=0; j++){
      ll c=comb(n, m)*comb(n-m, j)%MOD*comb(r-m*(i+1)-j*i+n, n)%MOD;
      if((j&1)==0) (ret+=c)%=MOD;
      else (ret+=MOD-c)%=MOD;
    }
  }
  return ret;
}
int main()
{
	int l, r; cin>>n>>m>>l>>r;
  fac(r+n);
  cout<<(solve(r)-solve(l-1)+MOD)%MOD<<endl;
	return 0;
}

Measured memory_bytes: 12544
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;
const double EPS = 1e-6;

int main(void) {
    int n;
    cin >> n;
    vector<double> t_tag(n), t(n+1), v(n);
    repeat(i, n) cin >> t_tag[i];
    repeat(i, n) cin >> v[i];
    t[0] = 0.0;
    repeat(i, n) t[i + 1] = t[i] + t_tag[i];
    
    struct func {double start, stop, maxspeed;};
    vector<func> f(n + 2);
    f[0].start = f[0].stop = t[0]; f[0].maxspeed = 0.0;
    f[n+1].start = f[n+1].stop = t[n]; f[n+1].maxspeed = 0.0;
    repeat_from_to (i, 1, n) {
        f[i].start = t[i - 1];
        f[i].stop  = t[i];
        f[i].maxspeed = v[i - 1];
    }   
    
    auto eval = [](func f, double x) -> double {
        double ret;
        if (x < f.start) 
            ret = f.maxspeed + f.start - x;
        else if (f.stop < x)
            ret = f.maxspeed + x - f.stop;
        else 
            ret = f.maxspeed;
        return ret;
    };
    
    double ans = 0.0;
    double inspeed = 0.0;
    double outspeed = 0.0;
    for (double x = 0.0; x < t[n] + EPS; x += 0.5) {
        vector<double> evals;
        repeat_from_to (i, 0, n + 1) {
            evals.emplace_back( eval(f[i], x) );
        }
        outspeed = *min_element(evals.begin(), evals.end());
        ans += (inspeed + outspeed) * 0.5 / 2;
        inspeed = outspeed;
        //dump(x); dump(inspeed); dump(outspeed); dump(ans); el;
    }
    cout << fixed << setprecision(12) << ans << endl;
}
    
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T> inline T mpow(T a, T n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,ans=0,now=1;cin>>n;
  V<ll> v(n);
  rep(i,0,n)cin>>v[i];

  rep(i,0,n){
    if(now==v[i]){
      now++;
    }else{
      ans++;
    }
  }
  if(ans==n)cout<<-1<<ENDL;
  else cout<<ans<<ENDL;
  

}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

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

template <typename InputIterator>
typename InputIterator::value_type summation(InputIterator first,
                                             InputIterator last) {
  return std::accumulate(first, last, typename InputIterator::value_type());
}
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v);
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p);
template <typename T>
std::istream &operator>>(std::istream &stream, std::vector<T> &v) {
  for (auto &i : v) {
    stream >> i;
  }
  return stream;
}
template <typename T1, typename T2>
std::istream &operator>>(std::istream &stream, std::pair<T1, T2> &p) {
  stream >> p.first >> p.second;
  return stream;
}

int main() {
  int64_t n;
  std::cin >> n;
  std::vector<int64_t> l(n);
  std::cin >> l;
  std::sort(l.begin(), l.end());

  int64_t ans = 0;

  for (int64_t i = 0; i < n; i++) {
    for (int64_t j = 0; j < n; j++) {
      if (i == j) {
        continue;
      }
      const auto min = std::abs(l[i] - l[j]) + 1;
      const auto max = std::abs(l[i] + l[j]) - 1;

      const auto min_itr = std::lower_bound(l.cbegin(), l.cend(), min);
      if (min_itr == l.cend()) {
        continue;
      }
      const auto max_itr = std::upper_bound(l.cbegin(), l.cend(), max);

      auto d = std::distance(min_itr, max_itr);
      if (min <= l[i] && l[i] <= max) {
        d--;
      }
      if (min <= l[j] && l[j] <= max) {
        d--;
      }
      ans += d;
    }
  }

  std::cout << ans / 6 << std::endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int N;
string T,P;
int z_algorithm[1010005];

void calc_Z(){

	P = P+'@'+T;

	int P_length = P.length();

	z_algorithm[0] = P_length;
	int index = 1,diff = 0,diff_2;

	while(index < P_length){
		while(index+diff < P_length && P[index+diff] == P[diff])diff++;
		z_algorithm[index] = diff;

		if(diff == 0){
			index++;
			continue;
		}else{

			diff_2 = 1;

			while(index+diff_2 < P_length && z_algorithm[diff_2] < diff-diff_2){

				z_algorithm[index+diff_2] = z_algorithm[diff_2];
				diff_2++;
			}

			index += diff_2;
			diff -= diff_2;
		}
	}
}

int main(){

	cin >> T >> P;

	int len = P.length();

	calc_Z();

	for(int i = len+1; i < P.length(); i++){

		if(z_algorithm[i] == len){

			printf("%d\n",i-(len+1));
		}
	}

	return 0;
}



Measured memory_bytes: 9004
/*
A0205
Rock, Paper, Scissors
*/
#include <stdio.h>

int hand[5];

extern void hantei();
main()
{	int h;
	int i;
	i = 0;
	while(1)
          {for(i=0;i<5;i++)
            {	scanf("%d",&h);
              if(h == 0)goto OWARI;
		hand[i]= 1<<(h-1);	/**hand=>BitField**/
            }
            hantei();
          }
OWARI:
	return(0);
}

void hantei()
{	int i,ac=0;
	for(i=0;i<5;i++)
		ac |= hand[i];

	if((ac == 7)||(ac == 1)||(ac== 2)||(ac == 4))       /* DRAW*/
		for(i=0;i<5;i++)
			printf("3\n");
	if(ac == 3)				            /* G C only */
		for(i=0;i<5;i++)
			printf("%d\n",(hand[i]==2)?2:1);
	if(ac == 6)                                         /* G P */
		for(i=0;i<5;i++)
			printf("%d\n",(hand[i]==4)?2:1);
	if(ac == 5)                                         /* C P */
		for(i=0;i<5;i++)
			printf("%d\n",(hand[i]==1)?2:1);

}

Measured memory_bytes: 0
#include<iostream>
using namespace std;
int a, v, b, w, t, dist;
int main(){
    cin>> a >> v >> b >> w >> t;
    if(v <= w){
        cout<<"NO";
    }
    else{
        dist = b - a;
        if(dist < 0){
            dist = -dist;
        }
        if(dist <= (v - w) * 1LL * t){
            cout<<"YES";
        }
        else{
            cout<<"NO";
        }
    }
}


Measured memory_bytes: 3636
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long 
using namespace std;
int main(){
  int a;
  cin >>a;
  int b=a/100;
  int c=(a%100)/10;
  int d=a%10;
  if(b==7||c==7||d==7){
    cout <<"Yes"<<endl;
  }else{
    cout <<"No"<<endl;
  }
}


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

nums = [1, 2]
for i in range(2, N+1):
  plus = nums[i-2] + nums[i-1]
  nums.append(plus)
  
stairs = [0]*N
stairs[0] = 1
stairs.append(1)
flag = True
for i in range(M):
  m = int(input())
  if stairs[m] == 1:
    flag = False
    break
  else:
    stairs[m-1], stairs[m], stairs[m+1] = 1, 1, 1
  
ans = 1
mode = False
left = -1
right = -1
for i in range(N+1):
  if stairs[i] == 0:
    if not mode:
      left = i
      mode = True
  else:
    if mode:
      right = i
      n = right - left
      ans *= nums[n]
      mode = False
      
if flag:
  print(ans%(10**9+7))
else:
  print(0)

Measured memory_bytes: 466812
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define debug2(x, y)                       \
  cerr << "(" << #x << "," << #y << ") = " \
       << "(" << x << "," << y << ")\n"
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5LL << 40, MOD = 1e9 + 7;

int N, M, L;

const int MXV = 305;
int d[305][305];
int wd[305][305];
int Q;
vector<pii> vq;

void input() {
  cin >> N >> M >> L;
  int a, b, c;
  rep(i, 0, 304) {
    rep(j, 0, 304) {
      wd[i][j] = INF;
      if (i == j) wd[i][j] = 0;
    }
  }
  rep(i, 1, M) {
    cin >> a >> b >> c;
    // if (c > L) {
    //   continue;
    // }
    d[a][b] = c;
    d[b][a] = c;
    wd[a][b] = c;
    wd[b][a] = c;
  }

  //=
  cin >> Q;
  vq.resize(Q);
  rep(i, 0, Q - 1) { cin >> vq[i].first >> vq[i].second; }
}

int nxtg[MXV][MXV];
void solve() {
  rep(k, 1, N) {
    rep(i, 1, N) {
      rep(j, 1, N) {
        // if (wd[i][k] == INF || wd[k][j] == INF) continue;  // 道がない場合
        wd[i][j] = min(wd[i][j], wd[i][k] + wd[k][j]);
      }
    }
  }

  rep(i, 1, N) {
    rep(j, 1, N) {
      if (i == j) {
        nxtg[i][j] = 0;
      } else {
        nxtg[i][j] = INF;
      }
    }
  }

  rep(i, 1, N) {
    rep(j, 1, N) {
      if (i == j) continue;
      if (wd[i][j] <= L) {
        nxtg[i][j] = 1;
      }
    }
  }

  rep(k, 1, N) {
    rep(i, 1, N) {
      rep(j, 1, N) {
        // if (nxtg[i][k] == INF || nxtg[k][j] == INF) continue;
        nxtg[i][j] = min(nxtg[i][j], nxtg[i][k] + nxtg[k][j]);
      }
    }
  }

  for (auto query : vq) {
    int asa = nxtg[query.first][query.second];
    if (asa < INF) {
      cout << asa - 1 << endl;
    } else {
      cout << -1 << endl;
    }
  }
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 4096
using System;
namespace ITP1_7_B
{
    class Program
    {
        static void Main(string[] args)
        {
            while(true)
            {
                string[] S = Console.ReadLine().Split();
                var n = int.Parse(S[0]);
                var x = int.Parse(S[1]);
                if(n == 0 && x == 0)
                {
                    break;
                }
                var count = 0;
                for(int i = 1; i <= n; i++)
                {
                    for(int j = i + 1; j <= n; j++)
                    {
                        for(int k = j + 1; k <= n; k++)
                        {
                            if(i + j + k == x)
                            {
                                count++;
                            }
                        }
                    }
                }
                Console.WriteLine(count);
            }
        }
    }
}


Measured memory_bytes: 18012
#include <stdio.h>

int main(void)
{
	int D, N;
	int ans = 1;
	
	scanf("%d %d", &D, &N);
	
	if (D == 0){
		if (N == 100){
			ans *= 101;
		}
		else {
			ans *= N;
		}
	}
	else {
		while (D != 0){
			ans *= 100;
			D--;
		}
		if (N == 100){
			ans *= 101;
		}
		else {
			ans *= N;
		}
	}
	
	printf("%d\n", ans);
	
	return (0);
}
	

Measured memory_bytes: 128
import math
A, B, H, M = map(int, input().split())


deg_h = 0.5 * (60 * H + M)
deg_m = 6 * M
rad_h = math.radians(deg_h)
rad_m = math.radians(deg_m)

theta = abs(rad_h - rad_m)
c2 = (A ** 2) + (B ** 2) - (2 * A * B * math.cos(theta))
print(math.sqrt(c2))

Measured memory_bytes: 9472
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,e,mod=1000000007,dp[100009][13],f[100009],xar[100009];
string s;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>s;
	xar[0]=1;
	for(c=1; c<=100005; c++){
	    xar[c]=xar[c-1]*10;
	    xar[c]%=13;
	}
	s.insert(0,"0");
	a=s.size()-1;
	dp[a+1][0]=1;
	for(b=1; b<=a; b++) if(s[b]!='?') f[b]=s[b]-'0';
	for(b=a; b>=1; b--){
		if(s[b]!='?'){
			for(c=0; c<=12; c++){
				dp[b][c]+=dp[b+1][(13*xar[a-b]+c-f[b]*xar[a-b])%13];
				dp[b][c]%=mod;
			}
		}else{
			for(c=0; c<=12; c++){
				for(d=0; d<=9; d++){
					dp[b][c]+=dp[b+1][(13*xar[a-b]+c-d*xar[a-b])%13];
					dp[b][c]%=mod;
				}
			}
		}
	}
	cout<<dp[1][5];
	return 0;
}

Measured memory_bytes: 12240
//AC
#include <stdio.h>

int main(void){

    int N;
    scanf("%d",&N);

    for(int n=1;n<=N;n++){ 

        int count=0;
        for(int i=1;i*i+2*i<=n;i++){
            for(int j=1;j*j+2*j<=n&&j<=i;j++){
                for(int k=1; k*k+2*k<=n&&k<=j;k++){
                    if(i*i+j*j+k*k+i*j+j*k+k*i==n){
                        if(i==j&&i==k){count++;}
                        else if(i!=j&&j!=k&&k!=i){count+=6;}
                        else{count+=3;}
                    }
                }
            }
        }

        printf("%d\n",count);
    }

}



Measured memory_bytes: 1700
#include <algorithm>
#include <climits>
#include <iostream>

using namespace std;
using ll = long long;

struct p
{
    ll z, w; // z = x + y, w = x - y;
};

const int maxn = 2e5 + 5;

p points[maxn];

int main(void)
{
    int n;
    cin >> n;
    ll x, y;
    for (int i = 0; i < n; ++i)
    {
        cin >> x >> y;
        points[i].z = x + y;
        points[i].w = x - y;
    }

    ll ans = 0;
    sort(points, points + n, [](const p &l, const p &r) -> bool {
        return l.z < r.z;
    });
    ans = points[n - 1].z - points[0].z;
    sort(points, points + n, [](const p &l, const p &r) -> bool {
        return l.w < r.w;
    });
    ans = max(ans, points[n - 1].w - points[0].w);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6780
/*
  author: ruruvuvu
  GitHub account: colon-ku

  created at: 2020-02-22 21:06:12
*/

#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(),(x).end()
#define rep(x, y) for (int x = 0; x < y; x++)
#define MOD 1000000007

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

ostringstream oss_global;
string s_global = oss_global.str();

int main()
{
    int n;
    cin >> n;
    vector<int> x(n);
    for (int i = 0; i < n; i++)
        cin >> x[i];

    sort(all(x));

    int temp = 0;
    float avg;
    for (int i = 0; i < n; i++)
        temp += x[i];
    avg = (float)temp/n;
    temp = (int)avg;

    int par;
    if (avg - temp > temp + 1 - avg) {
        // held at temp + 1
        par = temp + 1;
    } else {
        // held at temp
        par = temp;
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += (x[i] - par) * (x[i] - par);
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#n, m, q = map(int, input().split())
#List = list(map(int, input().split()))
#req = [list(map(int, input().split())) for _ in range(q)]
#t = t[:-1]
#print(ans[j], end = "") 改行無しで出力
#[0]*n
a = int(input())

print(a+(a*a)+(a*a*a))


Measured memory_bytes: 9164
d, n = map(int,input().split())

def cal(x):
  if x % 100 != 0: return 0
  return cal(x/100) + 1

cnt = 0
tmp = 1
while True:
  if cal(tmp) == d:
    cnt += 1
  if cnt == n:
    break
  tmp += 1
print(tmp)

Measured memory_bytes: 9072
// let coding = begin

#include <bits/stdc++.h>

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

using namespace std;
const int MOD = 1e9 + 9;
const int MAX = 1e5 + 9;
const int MIN = -1e9;
const double PI = 3.14159265;

int n, k;
string s;

int main()
{
  clock_t start;

  cin >> n >> k;
  cin >> s;
  for (int i = 0; i < n; i++)
  {
    if (i == k - 1)
      cout << (char)tolower(s[i]);
    else
      cout << s[i];
  }
  cout << endl;
  cerr << "Time: " << (clock() - start) / (double)(CLOCKS_PER_SEC / 1000) << " ms" << endl;
  return 0;
}

Measured memory_bytes: 256
from functools import reduce

n = int(input())
a = [int(i) for i in input().split()]

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

c = lcm_list(a) - 1

f = 0
for i in a:
    f += c % i

print(f)


Measured memory_bytes: 3812
eval"H,W,*A="+`dd`.split*?,
t=7**5
i=0
A.pop(H*W).zip(A){|a,b|a=(a-b).abs
i%W<1&&N=0
N|=$*[-W]||0**i<<t
$*<<N=N<<a|N>>a
i+=1}
p (0..t).find{|i|N[t+i]+N[t-i]>0}

Measured memory_bytes: 50688
#include <iostream>

using namespace std;

#define MAX 36

struct Card { char suit, value; };

void bubble(struct Card C[MAX], int N) {
  for (int i = 0; i < N; i++) {
    for (int j = N - 1; j > i; j--) {
      if (C[j].value < C[j - 1].value) {
        swap(C[j], C[j - 1]);
      }
    }
  }
}

void selection(struct Card C[MAX], int N) {
  for (int i = 0; i < N; i++) {
    int minj = i;
    for (int j = minj; j < N; j++) {
      if (C[j].value < C[minj].value) {
        minj = j;
      }
    }
    swap(C[i], C[minj]);
  }
}

void output(struct Card C[MAX], int N) {
  for (int i = 0; i < N; i++) {
    if (i > 0) {
      cout << " ";
    }
    cout << C[i].suit << C[i].value;
  }
  cout << endl;
}

bool is_stable(struct Card CB[MAX], struct Card CS[MAX], int N) {
  for (int i = 0; i < N; i++) {
    if (CB[i].suit != CS[i].suit) {
      return false;
    }
  }
  return true;
}

int main() {
  int N;
  cin >> N;
  struct Card CB[MAX], CS[MAX];
  for (int i = 0; i < N; i++) {
    cin >> CB[i].suit >> CB[i].value;
    CS[i] = CB[i];
  }

  bubble(CB, N);
  selection(CS, N);

  output(CB, N);
  cout << "Stable" << endl;
  output(CS, N);
  if (is_stable(CB, CS, N)) {
    cout << "Stable" << endl;
  } else {
    cout << "Not stable" << endl;
  }

  return 0;
}


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

int main()
{
	int A, B, r = 0, t1, t2;
	cin >> A >> B;
	for (int i = A; i <= B; ++i)
	{
		t1 = i / 1000;
		t2 = i % 100;
		if (t1 / 10 == t2 % 10 && t1 % 10 == t2 / 10)
			++r;
	}
	cout << r;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;

public class Main {
	Scanner sc;
	int N, K;
	int[] a;
	int sum;
	
//=============
// constructor
//
	public Main() {
		sc = new Scanner(System.in);
	}
	
//==================
// instance methods
//
	/**
	 * アルゴリズム本体
	 */
	private void calc() {
		N = sc.nextInt();
		K = sc.nextInt();
		a = new int[N+1];
		sum = 0;
		for (int i = 1; i <= N; i++) {
			a[i] = sc.nextInt();
			sum += a[i];
		}
		// sort しておく
		
		// 解は sum の約数の中にある
		// 約数の集合を divisor に入れる
		Set<Integer> divisors = new HashSet<>(); // 昇順
		
		int sqrt = (int)Math.sqrt(sum);
		for (int d = 1; d <= sqrt; d++) {
			if (sum % d != 0) continue;
			divisors.add(d);
			divisors.add(sum/d);
		}

		// check(n) <= K となる最大の n を見つける
		int max = -1;
		for (int d : divisors) {
			int c = check(d);
			if (c > K) continue;
			if (max < d) max = d;
		}
		out(max);
	}
	
	/**
	 * d で割り切れる数にできる最小の K を求める。
	 * (1) 各数字を d の倍数(の小さいほう)に設定
	 * (2) sum との差分(d の倍数)を差が大きいものから d ずつ配分
	 */
	private int check(int d) {
		int[] diff = new int[N+1];
		int remain = 0; // 配分すべき sum の残り
		for (int i = 1; i <= N; i++) {
			diff[i] = a[i] % d;
			remain += diff[i];
		}
		Arrays.sort(diff, 1, diff.length); // diff 昇順
		int result = remain; // K
		for (int i = N; i >= 1; i--) { // 必ず途中で終わる
			if (remain == 0) break;
			remain -= d;
			result = result + (d-diff[i]) - diff[i];
			diff[i] -= d;
		}
		return result/2;
	}
	
	private void out(Object o) {
		System.out.println(o);
		System.out.flush();
	}
	
//======
// main
//
	public static void main(String[] args) {
		Main m = new Main();
		m.calc();
	}

}

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

int gcd(int a, int b)
{
  return b ? gcd(b, a % b) : a;
}

int main()
{
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 0; i < n; ++i)
  {
    int a;
    cin >> a;
    ans += a - 1;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
A_list_yoko1 = list(map(int, input().split()))
A_list_yoko2 = list(map(int, input().split()))
A_list_yoko3 = list(map(int, input().split()))
N = int(input())
B_list = []
for i in range(N):
    B_list.append(int(input()))

A_list_tate1 = []
A_list_tate2 = []
A_list_tate3 = []
A_list_naname1 = []
A_list_naname2 = []

A_list_tate1.append(A_list_yoko1[0])
A_list_tate1.append(A_list_yoko2[0])
A_list_tate1.append(A_list_yoko3[0])
A_list_tate2.append(A_list_yoko1[1])
A_list_tate2.append(A_list_yoko2[1])
A_list_tate2.append(A_list_yoko3[1])
A_list_tate3.append(A_list_yoko1[2])
A_list_tate3.append(A_list_yoko2[2])
A_list_tate3.append(A_list_yoko3[2])
A_list_naname1.append(A_list_yoko1[0])
A_list_naname1.append(A_list_yoko2[1])
A_list_naname1.append(A_list_yoko3[2])
A_list_naname2.append(A_list_yoko1[2])
A_list_naname2.append(A_list_yoko2[1])
A_list_naname2.append(A_list_yoko3[0])

A_list_yoko1_c = []
A_list_yoko2_c = []
A_list_yoko3_c = []
A_list_tate1_c = []
A_list_tate2_c = []
A_list_tate3_c = []
A_list_naname1_c = []
A_list_naname2_c = []
for i in B_list:
    if i in A_list_yoko1:
        A_list_yoko1_c.append(A_list_yoko1.index(i))
    if i in A_list_yoko2:
        A_list_yoko2_c.append(A_list_yoko2.index(i))
    if i in A_list_yoko3:
        A_list_yoko3_c.append(A_list_yoko3.index(i))
    if i in A_list_tate1:
        A_list_tate1_c.append(A_list_tate1.index(i))
    if i in A_list_tate2:
        A_list_tate2_c.append(A_list_tate2.index(i))
    if i in A_list_tate3:
        A_list_tate3_c.append(A_list_tate3.index(i))
    if i in A_list_naname1:
        A_list_naname1_c.append(A_list_naname1.index(i))
    if i in A_list_naname2:
        A_list_naname2_c.append(A_list_naname2.index(i))

if len(A_list_naname1_c) == 3 or len(A_list_naname2_c) == 3 or len(A_list_tate1_c) == 3 or len(A_list_tate2_c) == 3 or len(A_list_tate3_c) == 3 or len(A_list_yoko1_c) == 3 or len(A_list_yoko2_c) == 3 or len(A_list_yoko3_c) == 3:
    print("Yes")
else:
    print("No")



Measured memory_bytes: 3188
import java.util.Scanner;

public class Main {
	
	public static void main(String []args) {
		Scanner sc = new Scanner(System.in);
		
		String s = sc.next();
		if(s.equals("ABC")) {
			System.out.println("ARC");
		}
		else {
			System.out.println("ABC");
		}
				
	}

}


Measured memory_bytes: 35712
#include<bits/stdc++.h>
using namespace std;
const float pi=2*acos(0);
int main(){
	int a,b,x;
	scanf("%d%d%d",&a,&b,&x);
	
	float t;
	if(1.0*x<=1.0*a*a*b/2){
		t=1.0*a*b*b/2/x;
		printf("%.10f",atan(t)*2.0/pi*90);
	}
	else{
		t=2.0*(a*a*b-x)/a/a/a;
		printf("%.10f",atan(t)*2.0/pi*90);
	}
		
}

Measured memory_bytes: 384
func main(){
   let split = (readLine()!).split(separator: " ").map({ Int($0)! })
   let h = split[0]
   let w = split[1]
   let k = split[2]

   var c: [[Character]] = []
   for _ in 0..<h {
      let s = Array(readLine()!)
      c.append(s)
   }

   var columnDict: [Int: Int] = [:]
   for i in 0..<w {
      columnDict[i] = 1
   }
   var rowDict: [Int: Int] = [:]
   for i in 0..<h {
      rowDict[i] = 1
   }

   let answer = recurse(crMap: ["col": columnDict, "row": rowDict], array: c, rowIndex: 0, colIndex: 0, k: k)
   print(answer)
}

func recurse(crMap: [String: [Int: Int]], array: [[Character]], rowIndex: Int, colIndex: Int, k: Int) -> Int {
   if rowIndex == array.count && colIndex == array[0].count {
      return good(array: array, crMap: crMap, k: k) ? 1 : 0
   }
   
   var tempMap = crMap
   var tempAns = 0
   if rowIndex < array.count {
      if colIndex < array[0].count {
         tempAns += recurse(crMap: crMap, array: array, rowIndex: rowIndex + 1, colIndex: colIndex + 1, k: k)

         var tempMap1 = crMap
         tempMap1["col"]![colIndex] = 0
         tempMap1["row"]![rowIndex] = 1
         tempAns += recurse(crMap: tempMap1, array: array, rowIndex: rowIndex + 1, colIndex: colIndex + 1, k: k)
         
         var tempMap2 = crMap
         tempMap2["col"]![colIndex] = 0
         tempMap2["row"]![rowIndex] = 0
         tempAns += recurse(crMap: tempMap2, array: array, rowIndex: rowIndex + 1, colIndex: colIndex + 1, k: k)
         
         var tempMap3 = crMap
         tempMap3["col"]![colIndex] = 1
         tempMap3["row"]![rowIndex] = 0
         tempAns += recurse(crMap: tempMap3, array: array, rowIndex: rowIndex + 1, colIndex: colIndex + 1, k: k)
      } else {
         tempMap["row"]![rowIndex] = 0
         tempAns = recurse(crMap: crMap, array: array, rowIndex: rowIndex + 1, colIndex: colIndex, k: k) +
         recurse(crMap: tempMap, array: array, rowIndex: rowIndex + 1, colIndex: colIndex, k: k)
      }
   } else if colIndex < array[0].count {
      tempMap["col"]![colIndex] = 0
      tempAns += recurse(crMap: crMap, array: array, rowIndex: rowIndex, colIndex: colIndex + 1, k: k) +
      recurse(crMap: tempMap, array: array, rowIndex: rowIndex, colIndex: colIndex + 1, k: k)
   }
   return tempAns
}

func good(array: [[Character]], crMap: [String: [Int: Int]], k: Int) -> Bool {
   var tempK = 0
   for i in 0..<array.count {
      for j in 0..<array[0].count {
         if crMap["col"]![j] == 1 && crMap["row"]![i] == 1 && array[i][j] == "#" {
            tempK += 1
         }
      }
   }
   return tempK == k
}
main()

Measured memory_bytes: 8328
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N = I()
S = [''] + LS2()

R = [0]*(N+1)
G = [0]*(N+1)
B = [0]*(N+1)
for i in range(1,N+1):
    s = S[i]
    R[i] = R[i-1]
    G[i] = G[i-1]
    B[i] = B[i-1]
    if s == 'R':
        R[i] += 1
    elif s == 'G':
        G[i] += 1
    else:
        B[i] += 1

ans = 0
for i in range(2,N):
    if S[i] == 'R':
        ans += G[i-1]*(B[-1]-B[i])
        ans += B[i-1]*(G[-1]-G[i])
        for j in range(1,N+1):
            if 1 <= i-j <= N and 1 <= i+j <= N:
                if (S[i-j] == 'G' and S[i+j] == 'B') or (S[i-j] == 'B' and S[i+j] == 'G'):
                    ans -= 1

    elif S[i] == 'G':
        ans += R[i-1]*(B[-1]-B[i])
        ans += B[i-1]*(R[-1]-R[i])
        for j in range(1,N+1):
            if 1 <= i-j <= N and 1 <= i+j <= N:
                if (S[i-j] == 'R' and S[i+j] == 'B') or (S[i-j] == 'B' and S[i+j] == 'R'):
                    ans -= 1
    else:
        ans += G[i-1]*(R[-1]-R[i])
        ans += R[i-1]*(G[-1]-G[i])
        for j in range(1,N+1):
            if 1 <= i-j <= N and 1 <= i+j <= N:
                if (S[i-j] == 'R' and S[i+j] == 'G') or (S[i-j] == 'G' and S[i+j] == 'R'):
                    ans -= 1

print(ans)


Measured memory_bytes: 74136
#include <iostream>
#include <string>
#include <vector>
#define REP(i, n) for(int i = 0;i < n;i++)
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<string> w(n);
  REP(i,n){
    cin>>w[i];
    
    if(i>0){
      if(w[i-1][w[i-1].size()-1] != w[i][0]){
        cout<<"No"<<endl;
        return 0;
      }
    }
    
    REP(j,i-1){
      if(w[j]==w[i]){
        cout<<"No"<<endl;
        return 0;
      }
    }
  }
  
  cout<<"Yes"<<endl;
  return 0;
}

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

using namespace std;
#define int long long
const int MOD = 1000000007;

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B;
	cin >> A >> B;
	string X = string(B, A + '0');
	string Y = string(A, B + '0');
	cout << min(X, Y) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


struct Edge {
    ll to;
    ll weight;
    Edge(ll t, ll w) : to(t), weight(w) { }
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, ll>;


typedef vector<vector<int> > Matrix;

const int INF = 100000000;
Matrix d;

void warshall_floyd(int n) { // nは頂点数
    for (int i = 0; i < n; i++)      // 経由する頂点
        for (int j = 0; j < n; j++)    // 開始頂点
            for (int k = 0; k < n; k++)  // 終端
                d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
}

ll modnum = 1e9+7;

int main() {
    vector<int> a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.begin(), a.end());
    if(a[2] == a[1] + a[0]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << 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;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const ll mod = 1e9 + 7;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    
    while (true) {
        c -= b;
        if (c <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if (a <= 0) {
            cout << "No" << endl;
            return 0;
        }
    }
}


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

int main() {
	int a,b,c;
	cin >> a;
	cin >> b;
	if(a==1){
		if(b==2){
			cout << 3<< endl;
		}else if(b==3){
			cout << 2<< endl;
		}
	}else if(a==2){
		if(b==1){
			cout << 3<< endl;
		}else if(b==3){
			cout << 1<< endl;
		}
	}else if(a==3){
		if(b==2){
			cout << 1<< endl;
		}else if(b==1){
			cout << 2<< endl;
		}
	}
	
return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

def main():
	n=II()

	print((n-1)//2)









if __name__ == "__main__":
	main()


Measured memory_bytes: 61928
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
#include<utility>
#include<vector>

using namespace std;
//--------------------

int main() {
	long N; cin >> N;
	long A[300009]; for (int i = 1; i <= pow(2,N); i++) cin >> A[i];

	while (N) {
		for (int i = 1; i <= pow(2, N) / 2; i++) A[i] = (A[2 * i - 1] == A[2 * i]) ? A[2 * i] : abs(A[2 * i - 1] - A[2 * i]);
		N--;
	}

	cout << A[1] << endl;
}

Measured memory_bytes: 2432
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c;
  cin>>a>>b>>c;
  if(a==b && b==c && c==a && a%2==0){cout<<-1;return 0;}
  int n=0,tempa,tempb,tempc;
  while(a%2==0 && b%2==0 && c%2==0){
  	tempa = (b+c)/2;
    tempb = (a+c)/2;
    tempc = (a+b)/2;
    n+=1;
    a = tempa;b=tempb;c=tempc;
  }
  cout<<n;
}

Measured memory_bytes: 256
t,*A=*$<
p=*0..t.to_i
f=->a{a!=p[a]?p[a]=f[p[a]]:a}
p A.map(&:split).transpose.sum([]){|a|i=0
(x,i),*y=a.map{[_1.to_i,i+=1]}.sort
y.map{[-x+x=_1,i,i=_2]}}.sort.sum{(a=f[_2])!=(b=f[_3])?(p[b]=a
_1):0}

Measured memory_bytes: 56284