akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main () {
  int H, N, A;
  cin >> H >> N;
  int sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> A;
    sum += A;
  }
  if (sum >= H) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main()
{
    int n;
    cin >> n;
    int k = 1;
    int ans = 0;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        while(a % 2 == 0){
            ans++;
            a /= 2;
        }  
    }
    cout << ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define inf (int)(3e18)
#define all(v) v.begin(),v.end()
#define mod (int)(1e9+7)

template<class T> inline void chmin(T &a, T b) {
	a = min(a, b);
}
template<class T> inline void chmax(T &a, T b) {
	a = max(a, b);
}

int N,X,Y;
vector<vector<int>>G;
int ans[2005];
signed main() {
	cin>>N>>X>>Y;
	G.resize(N);
	X--;Y--;
	rep(i,N-1){
		G[i].push_back(i+1);
		G[i+1].push_back(i);
	}
	G[X].push_back(Y);G[Y].push_back(X);
	rep(i,N){
		queue<int>que;
		vector<int>dis(N,inf);
		dis[i]=0;
		que.push(i);
		while(!que.empty()){
			int i=que.front();que.pop();
			for(int j:G[i]){
				if(dis[j]==inf){
					dis[j]=dis[i]+1;
					que.push(j);
					ans[dis[j]]++;
				}
			}
		}
	}
	REP(i,N)cout<<ans[i]/2<<endl;
}



Measured memory_bytes: 384
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std; 
int main(){
  int a,b,c,d,e,k,l;
   char g[6];
    cin >> a>>b>>c>>d>>e>>k;
 	l=max({abs(a-b),abs(a-c),abs(a-d),abs(a-e),abs(b-c),abs(b-d),abs(b-e),abs(c-d),abs(c-e),abs(d-e)});
      if(l<=k) cout <<"Yay!";
  else  cout <<":(";
      
}

Measured memory_bytes: 256
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
A = lr()

cur = A[0]
l = 0
answer = 1 #一番左の１つの数字
for i in range(1, N):
    x = A[i]
    while cur^x != cur + x:
        cur -= A[l]
        l += 1
    answer += i - l + 1
    cur += x

print(answer)


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

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))

map<s64, s64> fac;

void prime_factorization(s64 x)
{
    for (s64 i = 2; i * i <= x; ++i)
    {
        while (x % i == 0)
        {
            ++fac[i];
            x /= i;
        }
    }
    ++fac[x];
}

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

    s64 n;
    cin >> n;
    vs64 div;
    for (s64 i = 2; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            div.push_back(i);
            if (i * i != n) div.push_back(n / i);
        }
    }
    div.push_back(n);

    prime_factorization(n - 1);

    s64 ans = 0;
    rep (i, div.size())
    {
        s64 d = div[i];
        if (d == 1) continue;
        s64 temp = n;
        while (temp % d == 0) temp /= d;
        if (temp % d == 1) ++ans;
    }

    s64 temp = 1;
    for (auto x : fac)
    {
        if (x.first == 1) continue;
        temp *= x.second + 1;
    }

    cout << ans + temp - 1 << "\n";
    return 0;
}



Measured memory_bytes: 384
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,K;
	while(cin>>N>>K) {
		ll v = 1;
		REP(i, N) {
			v = min(v*2, v+K);
		}
		
		cout<<v<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <queue>

using namespace std;
typedef long long ll;
const int MAXN = 10010;
const int MAXM = 100010;
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3fLL;
int _w;

int read() {
	int x;
	_w = scanf( "%d", &x );
	return x;
}

namespace Dinic {
	struct Edge {
		int u, v, c, f;
		Edge() {}
		Edge( int u, int v, int c, int f ):
			u(u), v(v), c(c), f(f) {}
	};
	
	int n, m, s, t;
	int head[MAXN], nxt[MAXM];
	Edge edge[MAXM];
	
	void init( int _n ) {
		n = _n, m = 0;
		for( int i = 0; i < n; ++i )
			head[i] = -1;
	}
	void adde( int u, int v, int c ) {
		edge[m] = Edge(u, v, c, 0);
		nxt[m] = head[u], head[u] = m++;
		edge[m] = Edge(v, u, 0, 0);
		nxt[m] = head[v], head[v] = m++;
	}
	
	int dis[MAXN], cur[MAXN];
	queue<int> q;
	
	bool bfs() {
		for( int i = 0; i < n; ++i )
			dis[i] = INF;
		dis[s] = 0, q.push(s);
		while( !q.empty() ) {
			int u = q.front(); q.pop();
			for( int i = head[u]; ~i; i = nxt[i] ) {
				Edge &e = edge[i];
				if( e.c > e.f && dis[e.v] == INF ) {
					dis[e.v] = dis[u] + 1;
					q.push(e.v);
				}
			}
		}
		return dis[t] != INF;
	}
	ll dfs( int u, ll res ) {
		if( u == t || !res ) return res;
		ll flow = 0;
		for( int &i = cur[u]; ~i; i = nxt[i] ) {
			Edge &e = edge[i];
			if( e.c > e.f && dis[u] + 1 == dis[e.v] ) {
				ll f = dfs(e.v, min<ll>(e.c-e.f, res));
				flow += f, res -= f;
				e.f += int(f), edge[i^1].f -= int(f);
				if( !res ) break;
			}
		}
		return flow;
	}
	ll solve( int _s, int _t ) {
		s = _s, t = _t;
		ll flow = 0;
		while( bfs() ) {
			for( int i = 0; i < n; ++i )
				cur[i] = head[i];
			flow += dfs(s, INF);
		}
		return flow;
	}
}

int n, a[MAXN], s, t;
ll ans, sum;

int main() {
	n = read(), s = 0, t = n+1;
	Dinic::init(t+1);
	for( int i = 1; i <= n; ++i ) {
		a[i] = -read(), sum += a[i];
		if( a[i] >= 0 ) {
			ans += a[i];
			Dinic::adde(s, i, a[i]);
		} else {
			Dinic::adde(i, t, -a[i]);
		}
	}
	for( int i = 1; i <= n; ++i )
		for( int j = i+i; j <= n; j += i )
			Dinic::adde(i, j, INF);
	printf( "%lld\n", -(sum - (ans - Dinic::solve(s, t))) );
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
bool find(int remain,int now,int n,int m){
    int temp=gcd(n,m);
    n/=temp;
    m/=temp;
    if(remain==0){
        if(m==1&&n<3501&&n>=now){
            printf("%d",n);
            return true;
        }
        return false;
    }
    while(now<3501){
        if(m*now>n){
            if(find(remain-1,now,n*now,m*now-n)>0){
                printf(" %d",now);
                return true;
            }
        }
        now++;
    }
    return false;
}
int main(){
    int n,m=4;
    scanf("%d",&n);
    find(2,1,n,m);
}

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

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

using namespace std;

int main() {
	string S;
	cin >> S;
	string weather[] = { "Sunny", "Cloudy", "Rainy" };
	if (S == weather[0])cout << weather[1];
	if (S == weather[1])cout << weather[2];
	if (S == weather[2])cout << weather[0];
}



Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int n;
int a[1000][1000];
int dp[1000][1000];

string str;

int main() {
    //freopen( "/Users/macuser/Dropbox/Contest/input.in", "r", stdin );
    
    memset(a, 0, sizeof(a));
    n = 0; 
    int last = -1;
    while (cin >> str) {
        int tmp;
        for (int i = 0; i < str.size(); ++i) if (str[i] == ',') str[i] = ' ';
        istringstream sin(str);
        vint vec;
        while (sin >> tmp) vec.PB(tmp);
        
        if (vec.size() != n+1 && last == -1) {
            last = n;
        }
        
        if (last != -1) {
            reverse(ALL(vec));
            while (vec.size() < last) vec.PB(0);
            reverse(ALL(vec));
        }
        
        for (int i = 0; i < vec.size(); ++i) a[n][i] = vec[i];
        ++n;
    }
    
    //for (int i = 0; i <= n; ++i) { for (int j = 0; j <= n; ++j) cout << a[i][j] << ", "; cout << endl; }
    
    memset(dp, -1, sizeof(dp));
    dp[0][0] = a[0][0];
    
    int res = -1;
    for (int i = 0; i <= n; ++i) for (int j = 0; j <= n; ++j) {
        chmax(dp[i+1][j], dp[i][j] + a[i+1][j]);
        chmax(dp[i+1][j+1], dp[i][j] + a[i+1][j+1]);
        chmax(res, dp[i+1][j]);
        chmax(res, dp[i+1][j+1]);
    }
    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 9060
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;

string s;
vector<int> v(26, 0);

int main(void){
    
    cin >> s;
    for(int i = 0; i < s.size(); ++i) ++v[s[i] - 'a'];
    
    for(int i = 0; i < v.size(); ++i) if(v[i] == 0) { printf("%c\n", i + 'a'); return 0; };
    printf("None\n");
    
    return 0;
}


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

int main()
{
    ll a;
    cin >> a;
    ll ans = 1e18;
    for (ll i = 1; i * i <= a; i++)
    {
        if (a % i != 0)
            continue;
        ll j = a / i;
        ans = min(ans, i + j - 2);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#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 <ctime>
#include <string.h>
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%I64d",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)
#define INF                         (int)1e9
#define EPS                         1e-9
#define bitcount                    __builtin_popcount
#define gcd                         __gcd
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define MOD                         1000000007
typedef long long ll;
/*For you see , each day i love you
 more.Today more than yesterday
  less than tomorrow.*/
using namespace std;

int main()
{
	ll a;
	string b;
	cin>>a>>b;
	ll c = (b[0] - '0')*100 + (b[2] - '0')*10 + (b[3] - '0');
	printf("%lld",(a*c)/100);
	return 0;
}

Measured memory_bytes: 3700
import sys
input = sys.stdin.readline

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

D = []
for a in A:
    for b in B:
        D.append(a+b)
D.sort(reverse=True)

E = []
for i in range(min(K, len(D))):
    for c in C:
        E.append(D[i]+c)

E.sort(reverse=True)
for i in range(K):
    print(E[i])

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

const double PI=3.141592653589793;

int main()
{
  int S,K;
  cin >> K >> S;
  int cnt = 0;
  for (int i = 0; i <= K;i++)
  {
    for (int j = 0; j <= K;j++)
    {
      int k = S - i - j;
      if(k>=0&& k<=K)
        cnt++;
    }
  }

  cout << cnt << endl;
  return 0;
}


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

#define boost ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)

using namespace std;
using LL = long long;

constexpr int MAXN = 2e5 + 5;

struct node {
    node() = default;
    node(int _id, int _val, int _pop): id(_id), preVal(_val), pop(_pop) {}
    int id, preVal, pop;
};

int n, val[MAXN], ans[MAXN];
vector<int> G[MAXN], vec;
stack<node> s;

void dfs(int cur, int fa) {
    if (cur == 1) vec.emplace_back(val[cur]), s.push(node(0, 0, true));
    else {
        if (val[cur] > vec.back()) vec.emplace_back(val[cur]), s.push(node(0, 0, true));
        else {
            int pos = lower_bound(vec.begin(), vec.end(), val[cur]) - vec.begin();
            s.push(node(pos, vec[pos], false));
            vec[pos] = val[cur];
        }
    }
    ans[cur] = vec.size();
    for (auto &to : G[cur]) {
        if (to == fa) continue;
        dfs(to, cur);
    }
    node tmp = s.top();
    s.pop();
    if (tmp.pop) vec.pop_back();
    else vec[tmp.id] = tmp.preVal;
}

int main() {
    // freopen("test.in", "r", stdin);
    // freopen("test.out", "w", stdout);
    boost;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> val[i];
    for (int i = 1, u, v; i < n; i++) {
        cin >> u >> v;
        G[u].emplace_back(v), G[v].emplace_back(u);
    }
    dfs(1, 0);
    for (int i = 1; i <= n; i++)
        cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 32092
#include <iostream>
#include <string>
using namespace std;
int main(void){
    
    int N;
    cin >> N;
    
    if(N == 1){
        cout << "Hello World" << endl;
    }
    else{
        int A, B;
        cin >> A >> B;
        cout << A + B << endl;
    }
}


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

#define fr(i,b,e) for(int i=(b); i!=(e); ++i)
#define rep(i,e) for(int i=0; i!=(e); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long int li;
typedef long long int ll;
using graph = vector<vector<int>>;
using edgedp = vector<vector<pair<int,ll>>>;
constexpr int INF=1000000000;
//constexpr int MOD=998244353;
constexpr int MOD=1e9+7;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    int cnt=0;
    for(auto itr = s.rbegin(); itr != s.rend(); ++itr) {
        cnt+=*itr-'0';
    }
    if(cnt%9==0){
        cout << "Yes" << "\n";
    }else{
        cout << "No" << "\n";
    }
} 

Measured memory_bytes: 3760
import java.util.Scanner;

/**
 * Main
 */
public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int[] A = new int[N];
        int[] count = new int[N];

        for(int i = 0; i<N-1; i++){
            A[i] = sc.nextInt()-1;
            count[A[i]] = count[A[i]] + 1;
        }

        for(int i = 0; i<N; i++){
            System.out.println(count[i]);
        }
    }
}

Measured memory_bytes: 57376
#include<bits/stdc++.h>
const int N=5e5+5;
char c[N];
int n,i,a[N],x;
int main(){
	*c='0';scanf("%s",c+1);for(i=1,n=strlen(c+1);i<=n;++i)a[i]=c[i]-c[i-1];
	for(i=n;i;--i)if(a[i]<0)--a[i-1],a[i]+=10,++a[n];
	for(;a[n]>10;)for(i=n;a[i]>=10 && a[n];--i)++a[i-1],a[i]-=10,a[n]--;
	for(i=n-1;i;--i)if(a[i]==10 && a[n])a[i]=0,++a[i-1],--a[n];
	for(x=0,i=1;i<=n;++i)x+=a[i];printf("%d\n",(x+8)/9);
	return 0;
}

Measured memory_bytes: 2688
/*
 * atcoder/abc144_2nd/d.cpp
 */

// C++ 14
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring> // memset
#include <cassert>
using namespace std;
#define ll long long
#define loop(__x, __start, __end) for(int __x = __start; __x < __end; __x++)
template <class T> ostream & operator << (ostream & out, vector<T> const & v) {
  for (auto &&a: v) out << a << " "; out << endl; return out;
}
template <class T> void dump(T &a) { cout << a << endl; }
template <class T> bool chmin(T &a, T b) { if (a > b) {a = b; return true; } return false; }
template <class T> bool chmax(T &a, T b) { if (a < b) {a = b; return true; } return false; }

double a, b, x;
// 傾きthetaでの水の最大容量.
double cap(double theta) {
  // 半分以上
  if (x > a * b / 2) {
    return a * b - a * a * tan(theta) / 2;
  }

  return b * b * tan(M_PI/2 - theta) / 2;
}
double degree(double rad) {
  return rad * 180 / M_PI;
}

void solve() {
  cin >> a >> b >> x;
  x /= a;

  double left = 0, right = M_PI / 2, theta = 0;
  for (int i = 0; i<100; i++) {
    theta = (left + right) / 2;
    // 体積よりも容量が大きい <=> まだ傾けられる
    if (cap(theta) >= x) left = theta;
    else right = theta;
  }
  cout << degree(theta) << endl;
}
int main() {
  cout.precision(15); cout << fixed;

  solve();

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using vp = vector<pll>;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define repr(i, a, b) for(ll i = (a); i < (b); i++)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((ll)(x).size())
const ll MOD = 1000000007;
const ll INF = 100000000000000000LL;
inline ll GCD(ll a, ll b){ return b?GCD(b, a % b):a; }
inline ll LCM(ll a, ll b){ return a/GCD(a, b)*b; }
inline ll powint(ll x, ll y){ ll r=1; while(y){ if(y&1) r*=x; x*=x; y>>=1; } return r; }
inline ll powmod(ll x, ll y, ll m = MOD){ ll r=1; while(y){ if(y&1) r*=x; x*=x; r%=m; x%=m; y>>=1; } return r; }
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; }
#ifdef OJ_LOCAL
#include "dump.hpp"
#else
#define dump(...) ((void)0)
#endif

set<tuple<ll, ll, ll>> s;

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll a, b, c;
    cin >> a >> b >> c;
    ll ans = 0;
    while(1){
        if(a&1 || b&1 || c&1){
            cout << ans << endl;
            return 0;
        }
        if(s.find(make_tuple(a, b, c)) != s.end()){
            cout << -1 << endl;
            return 0;
        }else{
            s.emplace(a, b, c);
        }
        ans++;
        ll ta = (b+c)/2;
        ll tb = (a+c)/2;
        ll tc = (a+b)/2;
        a = ta;
        b = tb;
        c = tc;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<ctime>
using namespace std;

const int N=370;
const int M=30;

int D,ans,T,d,q,start;
int s[N][M],lst[M],c[M],t[N];

bool time_out(){
	return clock()-start>1950;
}

int calc(){
	int sum=0;
	for (int i=1;i<=26;i++) lst[i]=0;
	for (int i=1;i<=D;i++){
		sum+=s[i][t[i]];
		lst[t[i]]=i;
		for (int j=1;j<=26;j++) sum-=c[j]*(i-lst[j]);
	}
	return max(sum+1000000,0);
}

int main(){
	scanf("%d",&D);
	for (int i=1;i<=26;i++) scanf("%d",&c[i]);
	for (int i=1;i<=D;i++)
		for (int j=1;j<=26;j++) scanf("%d",&s[i][j]);
	for (int i=1;i<=D;i++) printf("1\n"); 
	return 0;
	srand(time(0));
	start=clock();
	for (int i=1;i<=D;i++) t[i]=1;
	ans=calc();
	while (!time_out()){
		int sum,tmp;
		d=rand()%D+1; q=rand()%26+1;
		tmp=t[d];
		t[d]=q; sum=calc();
		if (sum>ans) ans=sum;
		else t[d]=tmp;
	}
	for (int i=1;i<=D;i++) printf("%d\n",t[i]);
	return 0;
}

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

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int a = ni();
		int b = ni();
		int k = ni();

		int gcd = gcd(a, b);

		int kl = 0;

		for (int i = gcd; i >= 1; i--) {
			if (gcd % i == 0) {
				kl++;
			}

			if (kl == k) {
				out(i);
				break;
			}
		}

	}

	/*
	 * 以下メソッド集
	 */
	static int[] sort(int[] n) {
		Arrays.sort(n);
		return n;
	}

	static long[] sort(long[] n) {
		Arrays.sort(n);
		return n;
	}

	static int ketasuu(int n) {
		String str = "" + n;
		return str.length();
	}

	static int account(String str) {
		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

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

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static double max(double d, double e) {
		return Math.max(d, e);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static double min(double d, double e) {
		return Math.min(d, e);
	}

	static int min(int a, int b) {
		return (int) Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++) {
        cin >> p.at(i);
    }

    int ans = 0;
    for (int i = 1; i < n - 1; i++) {
        if ((p.at(i - 1) <= p.at(i) && p.at(i) <= p.at(i + 1)) || (p.at(i - 1) >= p.at(i) && p.at(i) >= p.at(i + 1))) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    int n, k;
    cin >> n >> k;

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

    vector<int> c(n);
    c[0] = 0;

    for (int i = 1; i < n; i++) {
        int t = 1 << 30;
        for (int j = 1; j <= k; j++) {
            if (i - j < 0) break;
            t = min(t, abs(h[i] - h[i - j]) + c[i - j]);
        }
        c[i] = t;
    }

    cout << c[n - 1] << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main() {
    int a, b;

    scanf("%d%d", &a, &b);
    if (a < b) {
        printf("a < b\n");
    } else if (a > b){
        printf("a > b\n");
    } else {
        printf("a == b\n");
    }

    return 0;
}


Measured memory_bytes: 2076
#include<bits/stdc++.h>
 
#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;
 
const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};


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

    ll n;
    cin >> n;
    vector<ll> a(n+1);
    rep(i,n+1){
        cin >> a[i];
    }
    auto tmp = a;
    for(ll i = n;i > 0;--i){
        tmp[i-1] += (tmp[i]+1)/2;
    }
    if(tmp[0] >= 2) {
        cout << -1 << endl;
        return 0;
    }
    vector<ll> max(n+1,1);
    for(ll i = 1;i <= n;++i){
        if(max[i-1] > 1e13) max[i] = 1e13;
        else max[i] = (2*max[i-1])-a[i];
    }
    ll ans = 0;
    int flag = 0;
    for(ll i = n;i > 0;--i){
        if(flag){
            ans += max[i] + a[i];
        }
        else if(a[i] <= max[i-1]){
            ans += a[i];
            a[i-1] += a[i];
        }else {
            ans += a[i];
            flag = 1;
        }
    }
    ans++;
    cout << ans << endl;
    cout << endl;
    return 0;
}


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

#define debug(x) cerr << x << " = "(x) << endl;
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int n; cin >> n;
    ll sum = 0;
    ll a[n];
    rep(i,0,n){
        cin >> a[i];
        sum ^= a[i];
    }
    rep(i,0,n){
        ll ans = sum^a[i];
        cout << ans << " ";
    }
    cout << endl;
    
    
}

Measured memory_bytes: 5180
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);

	long gcd(long a, long b) {

		while (a != b) {
			if (a > b)
				a -= b;
			else
				b -= a;
		}
		return a;
	}

	void run() {
		for (; sc.hasNextInt();) {
			long p = sc.nextInt();
			long q = sc.nextInt();
			long u = gcd(p, q);
			p /= u;
			q /= u;
			int zeroLength = 0;
			p %= q;
			long prefix = p / q;

			while (q % 10 == 0) {
				q /= 10;
				prefix *= 10;
				prefix += p / q;
				p %= q;
				zeroLength++;
			}
			while (q % 2 == 0) {
				q /= 2;
				p *= 5;
				prefix *= 10;
				prefix += p / q;
				p %= q;
				zeroLength++;
			}
			while (q % 5 == 0) {
				q /= 5;
				p *= 2;
				prefix *= 10;
				prefix += p / q;
				p %= q;
				zeroLength++;
			}
			prefix += p / q;
			// System.out.println(p + " " + q);
			if (q == 1) {
				System.out.printf("%0" + zeroLength + "d\n", prefix);
				continue;
			}
			p %= q;
			int length = 1;
			BigInteger nine = new BigInteger("9");
			for (;! nine.mod(new BigInteger(String.valueOf(q))).equals(
					BigInteger.ZERO);) {
				nine = nine.multiply(BigInteger.TEN).add(new BigInteger("9"));
				length++;
			}
			BigInteger circ = nine.multiply(new BigInteger(String.valueOf(p)))
					.divide(new BigInteger(String.valueOf(q)));
			if (zeroLength != 0) {
				System.out.printf("%0" + zeroLength + "d", prefix);
			}
			String s = circ.toString();
			for(int k = length-s.length(); k--> 0;){
				System.out.print("0");
			}
			System.out.println(circ);
			for (int z = zeroLength; z-- > 0;)
				System.out.print(' ');
			for (; length-- > 0;)
				System.out.print('^');
			System.out.println();
			/*
			 * 2/12 -> 10/6 -> 1 4/6 -> 1 20/3 -> 16 6666 1/6 -> 5/3 \1 2/3
			 * 0.16666
			 */
		}
	}

	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 13000
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] nums = new int[n];

    for(int i=0; i<n; i++){
      nums[i] = sc.nextInt();
    }

    Arrays.sort(nums);
    int cnt = 0;

    for(int i=0; i<n-2; i++){
      for(int j=i+1; j<n-1; j++){
        for(int k=j+1; k<n; k++){
          if(nums[k]<nums[i]+nums[j]){
            cnt++;
          }else{
            break;
          }
        }
      }
    }
    System.out.println(cnt);
  }
}


Measured memory_bytes: 26208
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if (a + b == 3){
      System.out.println(3);
    }else if (a + b == 4){
      System.out.println(2);
    }else{
      System.out.println(1);
    }
  }
}


Measured memory_bytes: 35552
//Vatsal Gupta
#ifdef __APPLE__
#include <iostream>
#include <cstring>
#include <string>
#include <cstdio>
#include <cctype>
#include <stack>
#include <list>
#include <queue>
#include <map>
#include <sstream>
#include <cmath>
#include <limits>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <bitset>
#include <utility>
#include <set>
#include <numeric>
#else
#include<bits/stdc++.h>
#endif

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<vi> vvi;

#define lli long long int
#define ulli unsigned long long int

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define ALL(a) a.begin(),a.end()
#define SZ(a) (int)(a.size())

#define loop(i,a,b) for(int i=a; i<b; i++)

int gcd(int a, int b) {return b==0?a:gcd(b,a%b);}
int lcm(int a, int b) {return a*(b/gcd(a,b));}

#define INF 1000000000  //(10^9)
#define MOD 1000000007  //(10^9+7)

//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);

vi arr(200010), temp;

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

	string s;
	cin>> s;
	int n= s.length();
	int len= s.length();
	loop(i,0,n)
	{
		if(s[i]=='S')
			temp.PB(i);
		if(i!=n-1)
			arr[i]= i+1;
	}
	for(int i=SZ(temp)-1; i>=0; i--)
	{
		if(temp[i]==n-1)
			continue;
		if(s[arr[temp[i]]]=='T')
		{
			len= len-2;
			if(temp[i]-1>=0)
				arr[temp[i]-1]= arr[arr[temp[i]]];
		}
	}
	cout<< len<< "\n";


	return 0;
}


Measured memory_bytes: 1940
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    String[][] b;
    String s;

    void run(){
	while(sc.hasNext()){
	    s = sc.next();
	    b = new String[3][3];
	    for(int i=0; i<3; i++)
		for(int k=0; k<3; k++)
		    b[i][k] = s.substring(i*3+k, i*3+k+1);
	    //show();
	    System.out.println(check());
	}
    }

    String check(){
	// 横
	for(int i=0; i<3; i++)
	    if(b[i][0].equals(b[i][1]) && b[i][0].equals(b[i][2]))
		if(!b[i][0].equals("s")) return b[i][0];
	// 縦
	for(int i=0; i<3; i++)
	    if(b[0][i].equals(b[1][i]) && b[0][i].equals(b[2][i]))
		if(!b[0][i].equals("s")) return b[0][i];
	// 斜め
	if((b[0][0].equals(b[1][1]) && b[0][0].equals(b[2][2])) ||
	   (b[0][2].equals(b[1][1]) && b[0][2].equals(b[2][0])))
	    if(!b[1][1].equals("s")) return b[1][1];
	
	return "d";
    } 

    void show(){
	for(int i=0; i<3; i++){
	    for(int k=0; k<3; k++)
		System.out.print(b[i][k]+" ");
	    System.out.println();
	}
    }
}

Measured memory_bytes: 17312
#include <bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
  int i,j,flag=1;
  string s,t;
  char temp,change;
  cin>>s>>t;
  if(s==t)
    cout<<"Yes";
   else{
        for (i = 0; i <= s.size(); i++){
            temp=s[s.size()-1];
            for(j=s.size();j>0;j--){
                change=s[j];
                s[j]=s[j-1];
                s[j-1]=change;}
        s[0]=temp;
        if(s==t){
            cout<<"Yes";
            flag=1;
            break;}
        else
            flag=0;}}
   if(flag==0)
        cout<<"No";
   return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool compare_by_b(pair<string,int> a, pair<string,int> b){
  if(a.first!=b.first){
    return a.first < b.first;
    }
  if(a.second!=b.second){
    return a.second > b.second;
  }
  else
    return true;
}

int main()
{
  int N;
  cin >> N;
  vector<pair<string,int>> A(N),B(N);
  for(int i=0; i<N; i++){
    string s;
    int p;
    cin >> s >> p;
    A.at(i)=make_pair(s,p);
    B.at(i)=make_pair(s,p);
  }
  sort(A.begin(),A.end(),compare_by_b);
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      if(A.at(i).first==B.at(j).first && A.at(i).second==B.at(j).second)
        cout << j+1 << endl;
    }
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>
#include <map>

using namespace std;

int main(){

    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    
    map<int, int> m;
    for(int i = 0; i < n; i++){
        m[a[i]]++;
    }

    if((int)m.size() > 3){
        cout << "No" << endl;
        return 0;
    }

    int mSize = (int)m.size();
    if(mSize == 1){
        if(a[0] == 0){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
        return 0;
    }

    if(n % 3 != 0){
        cout << "No" << endl;
        return 0;
    }

    if(mSize == 2){
        vector<pair<int, int>> A(2);
        int i = 0;
        for(auto temp: m){
            A[i] = temp;
            i++;
        }
        sort(A.begin(), A.end());
        if(A[0].first == 0){
            if(A[0].second == (n / 3) && A[1].second == (n / 3) * 2){
                cout << "Yes" << endl;
            }
            else{
                cout << "No" << endl;
            }
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
        vector<pair<int, int>> A(3);
        int i = 0;
        for(auto temp: m){
            A[i] = temp;
            i++;
        }

        if(A[0].second == A[1].second && A[1].second == A[2].second){
            if((A[0].first ^ A[1].first) == A[2].first){
                cout << "Yes" << endl;
            }
            else{
                cout << "No" << endl;
            }
        }
        else{
            cout << "No" << endl; 
        }
    }

    return 0;
}

Measured memory_bytes: 4224
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back

using namespace std;
const long long MOD = (long long)1e9 + 7;

int n, c[200009], pre[200009], nxt[200009], dp[200009];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++) cin >> c[i];
	for (int i = 1; i <= 200000; i++) pre[i] = -1;
	for (int i = 0; i < n; i++) {
		if (pre[c[i]] != -1) 
			nxt[pre[c[i]]] = i;
		pre[c[i]] = i;
	}
	dp[0] = 1;
	for (int i = 0; i < n; i++) {
		dp[i + 1] += dp[i];
		dp[i + 1] = dp[i + 1] % MOD;
		if (nxt[i] > i + 1) {
			dp[nxt[i]] += dp[i];
			dp[nxt[i]] = dp[nxt[i]] % MOD;
		}
	}
	cout << dp[n - 1] << "\n";
	//system("pause");
	return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;

struct Node {
	int parent;
	vector<int> children;
	int num;
};
vector<Node> tree;

vector<int> divisor(int n)
{
	vector<int> ret;
	for (int i = 0; i * i <= n; ++i) {
		if (n % i == 0) {
			ret.push_back(i);
			if (i * i != n)	ret.push_back(n / i);
		}
	}
	return ret;
}
void prime_factorize(int n, map<int, int> &prime)
{
	if (n <= 1)	return;
	int last = sqrt(n);
	for (int i = 2; i <= last; i++) {
		if (n % i == 0) {
			prime_factorize(i, prime);
			prime_factorize(n / i, prime);
			return;
		}
	}
	prime[n]++;
	return;
}
void addNumberToChildren(int p, int num) {
	if (tree[p].children.size() == 0)	return;
	for (int a : tree[p].children) {
		tree[a].num += num;
		addNumberToChildren(a, num);
	}
	return;
}

vector<vector<int>> to;
vector<int> ans;
void dfs(int v, int p = -1) {
	for (int u : to[v]) {
		if (u == p)	continue;
		ans[u] += ans[v];
		dfs(u, v);
	}
}

int main()
{
	int n, q;
	cin >> n >> q;
    to.resize(n);
	rep(i, n-1) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		to[a].push_back(b);
		to[b].push_back(a);
	}
	ans.resize(n);
	rep(i, q) {
		int p, x;
		cin >> p >> x;
		p--;
		ans[p] += x;
	}
	dfs(0);
	rep(i, n) {
		cout << ans[i] << endl;
	}
	return 0;
}


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

struct Tree {
  int node;
  int depth;
  int parent;
  vector<int> childs;
  Tree(int id,int depth,int parent,vector<int> childs) {
    this->node = id;
    this->depth = depth;
    this->parent = parent;
    this->childs = childs;
  }
  void fix_tree(int depth,int parent) {
    this->depth = depth;
    this->parent = parent;
  }
};

Tree* serach_parent(vector<Tree*>& trees,int n) {
  int index = 0;
  Tree* current = trees[0];
  while(true) {
    bool is_parent = true;
    // ????????????????????¨???????????§Parent?????§??°?????????
    for(int i=0;i<n;i++) {
      vector<int> childs = trees[i]->childs;
      for(int j=0;j<childs.size();j++) {
        if(childs[j] == index) {
          // ??????!
          index = i;
          current = trees[i];
          is_parent = false;
        }
      }
    }
    if(is_parent) {
      return current;
    }
  }
  return NULL;
}

void rec(Tree* tree, vector<Tree*> &trees) {
  if(tree->childs.size() == 0) {
    return;
  }
  int parent = tree->node;
  int depth = tree->depth + 1;
  for(int i=0;i<tree->childs.size();i++) {
    Tree* child = trees[tree->childs[i]];
    child->fix_tree(depth,parent);
    rec(child,trees);
  }
}

int main() {
  int n; cin >> n;
  vector<Tree*> tree_list(n,NULL);

  for(int i=0;i<n;i++) {
    int id,k; cin >> id >> k;
    vector<int> c(k);
    for(int j=0;j<k;j++)
      cin >> c[j];

    // Tree????????????
    tree_list[id] = new Tree(id,0,0,c);
  }

  Tree* parent = serach_parent(tree_list,n);
  parent->fix_tree(0,-1);
  rec(parent,tree_list);

  //node 0: parent = -1, depth = 0, root, [1, 4, 10]
  for(int i=0;i<n;i++) {
    cout << "node " << tree_list[i]->node << ": ";
    cout << "parent = " << tree_list[i]->parent << ", ";
    cout << "depth = " << tree_list[i]->depth << ", ";
    if(tree_list[i]->parent == -1) {
      cout << "root" << ", ";
    }
    else if(tree_list[i]->childs.size()==0) {
      cout << "leaf" << ", ";
    }
    else {
      cout << "internal node" << ", ";
    }
    cout << "[";
    int size = tree_list[i]->childs.size();
    if(size != 0) {
      for(int j=0;j<size-1;j++) {
        cout << tree_list[i]->childs[j] << ", ";
      }
      cout << tree_list[i]->childs[size-1];
    }
    cout << "]" << endl;
  }
}

Measured memory_bytes: 7336
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main(){
    int n;
    cin >>n;
    vector<int> a(n);
    rep(i,n) cin >>a[i];

    int p=0,m=0;
    int o=0;
    rep(i,n){
        if(a[i]==2) ++p;
        else if(a[i]==-2) ++m;
        else if(a[i]==-1) ++o;
    }

    if(m%2==1){
        if(o==0) --m;
        else o=1;
    }
    else{
        o = 0;
    }

    vector<int> ans;
    rep(i,n){
        if(a[i]==2){
            if(p){
                ans.pb(i+1);
                --p;
            }
        }
        else if(a[i]==-2){
            if(m){
                ans.pb(i+1);
                --m;
            }
        }
        else if(a[i]==-1){
            if(o){
                ans.pb(i+1);
                --o;
            }
        }
    }

    cout << ans.size() << endl;
    for(int i:ans) cout << i << endl;
    return 0;
}



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

long long memo[200000];
int initMemo(){
    for(int i = 0; i < 200000; i++){
        memo[i] = -1;
    }
    memo[0] = 1;
    memo[1] = 1;
}
long long MOD = 1000000007;
long long calc(int step){
    if(memo[step] == -2){
        return 0;
    }else if(memo[step] != -1){
        return memo[step];
    }else{
        memo[step] = (calc(step - 1) % MOD + calc(step - 2) % MOD) % MOD;
        return memo[step];
    }
}
int main() {
    int N,M;
    cin >> N >> M;
    initMemo();
    for(int i = 0; i < M; i++){
        int tmp;
        cin >> tmp;
        memo[tmp] = -2;
    }
    cout << calc(N) << endl;
}

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

int main(){
  string s;
  cin >> s;
  int ans =0;
  if(s[0]== '1') ans ++;
  if(s[1]== '1') ans ++;
  if(s[2]== '1') ans ++;
  cout << ans << endl;
}

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 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int main(){

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

	int sum = 0,tmp = N;

	while(tmp > 0){

		sum += tmp%10;
		tmp /= 10;
	}

	if(N%sum == 0){

		printf("Yes\n");
	}else{

		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 256
#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 irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define rrep(i, n)    for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n)   for (int i = (int)(n); i >= 1; --i)
#define allrep(V, v)  for (auto &&V : v)
#define all(x)        (x).begin(), (x).end()
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = 1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;

using Weight = int;
struct Edge {
  int src, dst;
  Weight weight;
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;

class UnionFind {
  std::vector<int> parent_;

  public:
  UnionFind(int size_num) : parent_(size_num, -1) {}
  int find(int x) {
    if (parent_[x] < 0) return x;
    return parent_[x] = find(parent_[x]);
  }
  bool unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return false;
    if (parent_[x] > parent_[y]) std::swap(x, y);
    parent_[x] += parent_[y];
    parent_[y]  = x;
    return true;
  }
  bool same(int x, int y) {
    return find(x) == find(y);
  }
  int size(int x) {
    return -parent_[find(x)];
  }
};

Edges kruskal(Edges &edges, const int n) {
  std::sort(edges.begin(), edges.end(), [](const Edge &a, const Edge &b) { return a.weight < b.weight; });
  Edges ret;
  UnionFind uf(n);
  for (const auto &e : edges) {
    if (uf.unite(e.src, e.dst)) ret.push_back(e);
  }
  return ret;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n;
  cin >> n;
  using ipair = pair<int, int>;
  set<ipair> xyset;
  rep (i, n) {
    int x, y;
    cin >> x >> y;
    xyset.insert({x, y});
  }
  vector<pair<int, ipair>> xy;
  auto itr = xyset.begin();
  rep (i, xyset.size()) {
    xy.push_back({i, *itr});
    ++itr;
  }
  int   v = xy.size();
  Edges edges;
  sort(all(xy), [](pair<int, ipair> &a, pair<int, ipair> &b) { return a.second.first < b.second.first; });
  rep (i, v - 1) {
    Edge edge;
    edge.src = xy[i].first;
    edge.dst = xy[i + 1].first;
    edge.weight = xy[i + 1].second.first - xy[i].second.first;
    edges.push_back(edge);
  }
  sort(all(xy), [](pair<int, ipair> &a, pair<int, ipair> &b) { return a.second.second < b.second.second; });
  rep (i, v - 1) {
    Edge edge;
    edge.src = xy[i].first;
    edge.dst = xy[i + 1].first;
    edge.weight = xy[i + 1].second.second - xy[i].second.second;
    edges.push_back(edge);
  }
  Edges tree = kruskal(edges, v);
  lint  ans  = accumulate(all(tree), 0, [](lint acc, const Edge &e) { return acc += e.weight; });
  cout << ans << endl;
  return 0;
}

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

int main()
{
	int N,K;
	cin >> N >> K;
	for (int i = 0; i < N; ++i)
	{
		cin >> h[i];
	}
	sort(h,h+N);
	int ans = 1e9+5;
	for (int i = 0; i < N-K+1; ++i)
	{
		ans = min(ans,h[i+K-1] - h[i]);
	}

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

Measured memory_bytes: 640
#include <iostream>
#include <math.h>
#include <stdlib.h>
using namespace std;
int n,a[100003],f[100003],i,j;
int main()
{
    cin>>n;
    for (i=1;i<=n;i++)
        cin>>a[i];
    f[0]=0;
    f[1]=0;
    f[2]=abs(a[2]-a[1]);
    for (i=3;i<=n;i++)
    {
        f[i]=min(f[i-1]+abs(a[i-1]-a[i]),f[i-2]+abs(a[i-2]-a[i]));
    }
    cout<<f[n];
    return 0;
}


Measured memory_bytes: 1024