akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0)
#define scn(n) scanf("%d",&n)
#define lscn(n) scanf("%lld",&n)
typedef long long ll;
#define pri(n) printf("%d\n",n)
#define lpri(n) printf("%lld\n",n);
#define rep(i,st,ed) for(int i=st;i<ed;i++)
#define var(n) int n; scn(n)
#define F first
#define S second 
#define pb(n) push_back(n)
const int N=55;
const ll M=1e9+7;
const ll inf=1e18;

void add(int& a,int b)
{
	a+=b;
	a%=M;
}

int main()
{
	// a better implementation Thanks to Errichto
	ios;
	string s;
	int n;
	cin>>s>>n;
	int len = s.size();
	vector<vector<int>> dp(n,vector<int> (2));

	// dp states are
	// sum,<a boolean value which shows whether I have already taken some digit smaller than the corresponding to the digit in k or not>

	dp[0][0]=1; // base case this means that total number of ways taking the imaginary digit at position -1 which is equal to its corresponding digit in s;

	for(int i=0;i<len;i++)
	{
		vector<vector<int>> v(n,vector<int> (2));

		for(int sum=0;sum<n;sum++)
		{
			for(bool already : {false,true})
			{
				for(int dig = 0;dig<10;dig++)
				{
					if(dig>s[i]-48 and !already)
						break;
					add(v[(sum+dig)%n][already || dig<s[i]-48],dp[sum][already]);
				}
			}
		}
		dp = v;
	}

	int ans = (dp[0][0]+dp[0][1])%M;
	ans--;
	if(ans<0)
		ans+=M;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
//cwystc <--> 陈威宇是天才  --by cwy
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const double PI=acos(-1);
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for (int i=(a);i<=(b);i++)
#define per(i,a,b) for (int i=(a);i>=(b);i--)
#define Rep(i,a,b) for (int i=(a);i<(b);i++)
#define Per(i,a,b) for (int i=(a);i>(b);i--)
#define travel_set(it,a) for (set<int>::iterator (it)=(a).begin();(it)!=(a).end();(it)++)
#define travel_map(it,a) for (map<int>::iterator (it)=(a).begin();(it)!=(a).end();(it)++)
#define travel_vec(it,a) for (vector<int>::iterator (it)=(a).begin();(it)!=(a).end();(it)++)
#define p(x) cout << x << endl;
#define def cout << "find" << endl;
#define what_is(x) cout << #x << " is " << x << endl;
template <class T>T sqr(T x){return x*x;}
template <class T>T alex(T x){return (x>0)?x:-x;}
template <class T>void read(T&x){
	x=0;T f=1;char ch=getchar();
	while ((ch<48||ch>57)&&ch!=45)ch=getchar();
	if (ch==45)f=-1,ch=getchar();
	while (ch>=48&&ch<=57)x=x*10+ch-48,ch=getchar();
	x*=f;
}

//-------------------------------------------------head-------------------------------------------------

/*
ai = 1/2 (2 * ai+1 - ai) + 1/2 (2 * ai-1 - ai) = ai+1 + ai-1 - ai
[ai-1] [ai] [ai+1]  ->  [ai-1] [ai - ai-1] [ai+1 - ai]
[ai-1] [ai+1 + ai-1 - ai] [ai+1]  ->  [ai-1] [ai+1 - ai] [ai - ai-1]
<==> swap(ai+1 - ai , ai - ai-1)
*/

#define maxn 100005
int n,a[maxn],m;ll k;
int l[maxn];
bool vis[maxn];
void solve(int ind){
	vector<pi>_l;_l.clear();vis[ind]=true;_l.pb(mp(ind,a[ind]));
	for (int i=l[ind];i!=ind;i=l[i])vis[i]=true,_l.pb(mp(i,a[i]));
	Rep(i,0,_l.size())a[_l[i].fi]=_l[(k+i)%_l.size()].se;
}
int main(){
	read(n);
	rep(i,1,n)read(a[i]);
	read(m);read(k);
	rep(i,1,n)l[i]=i;
	rep(i,1,m){
		int x;read(x);
		swap(l[x],l[x+1]);
	}
	per(i,n,1)a[i]=a[i]-a[i-1];
	rep(i,1,n)if (!vis[i])solve(i);double res=0.0;
	rep(i,1,n)res+=a[i],printf("%lf\n",res);
	return 0;
}

Measured memory_bytes: 2916
import sys
import os
import math
import string

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: x * y / math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    P = il()
    ret = 0
    mi = P[0]
    for n in range(N):
        if mi >= P[n]: ret += 1
        mi = min(mi, P[n])
    print(ret)


if __name__ == '__main__':
    main()


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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
#define Size(n) (n).size()

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//long long int kaizyo(long long int hh){
  //  cmp=1;
    //while(hh>1){
      //  cmp=(cmp*hh)%MOD;
        //hh--;
    //}
    //return cmp;
//}
//long long int ruizyo(long long int aa, long long int bb){
  //  if(aa==0){
    //    return 1;
    //}
    //else if(aa%2==0){
      //  long long int tt=ruizyo(aa/2,bb);
        //return (tt*tt)%MOD;
    //}
    //else{
      //  return (ruizyo(aa-1,bb)*bb)%MOD;
    //}
//}フェルマ－のア


//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

//visited=vector<vector<bool>>(10,vector<bool>(10,false));アを全部falseに


long long int n,cnt=0,ans=0,a[101][30],b,c,cmp,cmpp,m,h,w,x,y,sum=0,pos,p[101][30];
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;

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

       cin >> n;
       rep(i,n){
           rep(j,10){
               cin>>a[i][j];
           }
       }
       rep(i,n){
           rep(j,11){
               cin>>p[i][j];
           }
       }
       ans=INF;
       ans*=-1;
       for(int  bit=1;bit<(1<<10);bit++){
           sum=0;
           rep(i,n){
                cnt=0;
               rep(j,10){
                   if(bit&(1<<j)&&a[i][j]){
                       cnt++;
                       //Cout(j);
                   }
               }
               sum+=p[i][cnt];
           }
            ans=max(ans,sum);
       }
       Cout(ans);
return 0;
}


Measured memory_bytes: 256
import numpy as np
H, W, K = map(int, input().split())
c = []
for i in range(H):
  s = str(input())
  l = [0 if t=='.' else 1 for t in s]
  c.append(l)
c = np.array(c)

ans = 0
tmp = c
for i in range(2**H-1):
  for j in range(H):
    if i >> j & 1:
      tmp[j] = 0
  tm = tmp
  for a in range(2**W-1):
    for b in range(W):
      if a >> b & 1:
        tmp[:, b] = 0
    t = np.sum(tmp)
    if t == K:
      ans += 1
    tmp = np.array(tm)
  tmp = np.array(c)
print(ans)

Measured memory_bytes: 26856
#include<iostream>
#include<string>

using namespace std;



int main() {
	
	string work;
	cin >> work;
	 
	for (int i = 0; i < work.length(); i++) {
		if (work[i] == '?') {
			work[i] = 'D';
		}
	}
	cout << work;
	return 0;
}

Measured memory_bytes: 3372
#include <stdio.h>

int main(void){
  int k, s;
  scanf("%d%d", &k, &s);
  int ans = 0;
  
  for(int i = 0; i <= k; i++){
    for(int j = 0; j <= k; j++){
      if(0 <= s - i - j && s - i - j <= k) ans++;
    }
  }
  
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

A,V=map(int,input().split())
B,W=map(int,input().split())
T=int(input())
if V<=W:
    print('NO')
else:
    if abs(A-B)<=(V-W)*T:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 61852
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main(){
  ll N, T; cin >> N >> T;
  vector<ll> a(N);
  REP(i, N) cin >> a[i];

  ll mini = a[0];
  ll maxi = -1e18;
  FOR(i,1,N){
    maxi = max(maxi, a[i]-mini);
    mini = min(mini, a[i]);
  }

  mini = a[0];
  ll ans = 0;
  FOR(i,1,N){
    if(a[i]-mini == maxi) ans++;
    mini = min(mini,a[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;

ll a1, a2, arest, c;


map<pair<ll, bool>, ll> cache;

ll solve(ll pos, bool is_le){
    if(pos < 0){ return 0; }
    if(cache.count({pos, is_le})){
        return cache.at({pos, is_le});
    }

    const bool br = (arest >> pos) & 1;
    const bool bc = (c >> pos) & 1;
    assert(!(br && bc));
    const bool b1 = (a1 >> pos) & 1;

    ll ret = 0;
    if(is_le){
        ret = solve(pos - 1, true);
        if(ret != -1 && (br || bc)){
            ret += (1LL << pos);
        }
    }else{
        if(b1){
            // 0 or 1
            if(br && !bc){
                ll ret1 = solve(pos - 1, false);
                if(ret1 != -1){
                    ret1 += 1LL << pos;
                }
                ll ret2 = solve(pos - 1, true);
                ret = max(ret1, ret2);
            }else if(!br && bc){
                ret = solve(pos - 1, false);
                if(ret != -1){
                    ret += (1LL << pos);
                }
            }else{
                assert(!br && !bc);
                ret = solve(pos - 1, true);
            }
        }else{
            // 0 only
            if(!br && bc){
                ret = -1;
            }else{
                ret = solve(pos - 1, is_le);
            }
        }
    }
    cache[{pos, is_le}] = ret;
    return ret;
}

int main(){
    ll n;
    cin >> n;
    cin >> a1 >> a2;
    arest = 0;
    REP(i, n - 2){
        ll ai;
        cin >> ai;
        arest ^= ai;
    }

    const ll s = a1 + a2;
    if(s < arest || (s - arest) % 2 == 1){
        cout << -1 << endl;
        return 0;
    }

    c = (s - arest) / 2;
    if((arest & c) != 0){
        cout << -1 << endl;
        return 0;
    }

    ll tmp = solve(60, false);
    assert(tmp <= a1);
    if(tmp < 1){
        cout << -1 << endl;
    }else{
        cout << a1 - tmp << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v), std::end(v)
#define REP(i, k) for (std::decay_t<decltype(k)> i = 0; i < k; i++)
#define LOOP(k) REP (ngtkana_is_a_genius, k)

using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using usize = std::size_t;

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/

int main() {
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    u32 n, k; std::cin >> n >> k;
    vec<u32> a(n);
    for (u32& x: a) std::cin >> x;
    std::sort(ALL(a));
    std::cout << std::accumulate(a.begin(), a.begin() + k, u32{0}) << '\n';
}


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

long long cost(long long a,int b)
{
	if (b==0||b==4)
	{
		return a;
	}
	else if (b==1||b==3)
	{
		if (a==0LL)
		{
			return 2LL;
		}
		else if (a%2LL==1)
		{
			return 1LL;
		}
		else
		{
			return 0LL;
		}
	}
	else if (b==2)
	{
		if (a%2LL==1LL)
		{
			return 0LL;
		}
		else
		{
			return 1LL;
		}
	}
}

int main(int argc, char const *argv[])
{
	int l;
	cin>>l;
	long long a[l];
	for (int i = 0; i < l; ++i)
	{
		cin>>a[i];
	}
	long long dp[l+5][5];
	for (int i = 0; i < l+5; ++i)
	{
		for (int j = 0; j < 5; ++j)
		{
			dp[i][j]=1000000000000000LL;
		}
	}
	dp[0][0]=0LL;
	for (int i = 1; i <= l; ++i)
	{
		for (int j = 0; j < 5; ++j)
		{
			for (int k = 0; k <= j; ++k)
			{
				dp[i][j]=min(dp[i][j],dp[i-1][k]+cost(a[i-1],j));
			}
		}
	}
	long long ans=1000000000000000LL;
	for (int i = 0; i < 5; ++i)
	{
		ans=min(ans,dp[l][i]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 9600
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <typeinfo>
#include <functional>
#include <iomanip>
#include <string.h>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
typedef long long ll;

int  a[100000];
int  b[100000];
int  c[100000];

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

	int Amin = 1000000, Bmin = 1000000;

	int SumMin;

	for (int i = 0; i < A; i++)
	{
		cin >> a[i];
		if (Amin >= a[i])
		{
			Amin = a[i];
		}
	}

	for (int i = 0; i < B; i++)
	{
		cin >> b[i];
		if (Bmin >= b[i])
		{
			Bmin = b[i];
		}
	}

	SumMin = Amin + Bmin;

	for (int i = 0; i < M; i++)
	{
		int x, y, c;
		cin >> x >> y >> c;
		int Sum = a[x-1] + b[y-1] - c;
		if (Sum < SumMin)
		{
			SumMin = Sum;
		}

	}

	cout << SumMin << endl;

	return 0;
}

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

int main(){
	int a[200],b[200];
	int i=0;	
	while(cin >> a[i] >> b[i] ){i++;}

	for (int j=0;j<i;j++){
	int c = a[j] +b[j];
	int s=0;
	while(c/10!=0){
		s++;
		c = c/10;
	}
	cout << s+1 <<endl;
	}
		
    return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
using namespace std;
typedef long long ll;
#define fori(n) for ( int i = 0; i < (n);i++)
#define forj(n) for ( int j = 0; j < (n);j++)
#define fork(n) for ( int k = 0; k < (n);k++)
#define forghj(n) for ( int ghj = 0; ghj < (n);ghj++)
#define fori1(n) for ( int i = (n)-1; i >= 0;i--)
#define all(vector) (vector).begin(),(vector).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
/*
                            |~~~~~~~|
                            |       |
                            |       |
                            |       |
                            |       |
                            |       |
 |~.\\\_\~~~~~~~~~~~~~~xx~~~         ~~~~~~~~~~~~~~~~~~~~~/_//;~|
 |  \  o \_         ,XXXXX),                         _..-~ o /  |
 |    ~~\  ~-.     XXXXX`)))),                 _.--~~   .-~~~   |
  ~~~~~~~`\   ~\~~~XXX' _/ ';))     |~~~~~~..-~     _.-~ ~~~~~~~
           `\   ~~--`_\~\, ;;;\)__.---.~~~      _.-~
             ~-.       `:;;/;; \          _..-~~
                ~-._      `''        /-~-~
                    `\              /  /
                      |         ,   | |
                       |  '        /  |
                        \/;          |
                         ;;          |
                         `;   .       |
                         |~~~-----.....|
                        | \             \
                       | /\~~--...__    |
                       (|  `\       __-\|
                       ||    \_   /~    |
                       |)     \~-'      |
                        |      | \      '
                        |      |  \    :
                         \     |  |    |
                          |    )  (    )
                           \  /;  /\  |
                           |    |/   |
                           |    |   |
                            \  .'  ||
                            |  |  | |
                            (  | |  |
                            |   \ \ |
                            || o `.)|
                            |`\\\\) |
                            |       |
                            |       |
                            |       |
*/


int main() {
    ios::sync_with_stdio(false);
    int x;
    cin >> x;
    vector < int > a;
    a.pb(1);
    for (int i = 2; i <= 1000;i++) {
        int kek = i*i;
        while(true) {
            if (kek > x) break;
            a.pb(kek);
            kek*=i;
        }
    }
    int kek = 0;
    fori(a.size()) {
        if (a[i] <= x) kek = max(kek,a[i]);
    }
    cout << kek;
}














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

bool isPrime(int a) {
  for (int i = 2; i <= sqrt(a); i++) {
    if (a % i == 0) {
      return false;
    }
  }

    return true;
}

int main() {

  int n;
  cin >> n;

  int sum = 0;
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (isPrime(x)) sum += 1; 
  }

  cout << sum << endl;
  
  return 0;
}



Measured memory_bytes: 3096
#include <stdio.h>

int main(void) {
    char s[5];
    scanf("%s",s);
    int flag = 0;
    for(int i = 0; i < 4; i++) {
        int count = 0;
        for(int j = i; j < 4; j++) {
            if(s[i] == s[j]) count++;
        }
        if(count == 2) flag++;
    }
    if(flag == 2) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
import std.stdio,std.string,std.conv;

int main()
{
	string s;
	while((s = readln.chomp).length != 0)
	{
		string[] _s = s.split(" ");
		int a = _s[0].to!int;
		int b = _s[1].to!int;
		int n = _s[2].to!int;
		int ans = 0;
		a %= b;
		foreach(i;0..n)
		{
			a *= 10;
			ans += (a/b);
			a %= b;
		}
	
		ans.writeln;
	}
	return 0;
}

Measured memory_bytes: 1068
#include <iostream>
using namespace std;
 
int main() {
	int n;
	cin>>n;
	int arr[n];
	for (int i=0; i<n; i++){
		cin >> arr[i];
	}
	int max=arr[0];
	int min=arr[0];
	for (int i=0; i<n; i++){
		if (arr[i]<min) min=arr[i];
		if (arr[i]>max) max=arr[i];
	}
	cout << max-min << endl;
}

Measured memory_bytes: 256
#include <iostream>

int a, b, kekka, count;
int main()
{
	std::cin >> a;
	b = a;
	count = 1;
	while(true)
	{
		a = b * count;
		if(a % 2 == 0)
		{
			kekka = a;
			break;
		}
		count++;
	}
	std::cout << kekka << std::endl;
}

Measured memory_bytes: 256
/*
    Believe!
    @Author : tpriyanshu
*/
#include <bits/stdc++.h>
using namespace std;

typedef long long int lli;
typedef unsigned long int uli;
typedef pair<int,int> pi;
typedef pair<lli,lli> plli;
typedef vector<int> vi;
#define mod 1000000007
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define point(n) fixed<<setprecision(n)
#define endl "\n"
#define mem(a,val) memset(a,val,sizeof(a))
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define w(x) lli x; cin>>x; while(x--)
#define forn(i, a, n) for (int i = a; i < int(n); ++i)
#define inf 1e18
#define N int(2*1e5+10)
#define all(v) v.begin(),v.end()
mt19937 rnd(time(NULL));

void out(vi& v) {
	for (lli i = 0; i < v.size(); i++) {
		cout << v[i]  << " ";
	}
	cout << endl;  
}
int main(){
    fastIO
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    bool flag,f=true;
    while(true){
        if(a<=0){
            flag=true;
            break;
        }
        if(c<=0){
            flag=false;
            break;
        }
        if(f){
            c-=b;
        } else{
            a-=d;
        }
        f^=true;
    }
    if(flag==false){
        cout<<"Yes";
    } else{
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 3640
import java.io.*;
public class Main{
 
   
  public static void main(String[] args) throws IOException
  {
     
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    int n=Integer.parseInt(br.readLine());
    String line=br.readLine();
    String str[]=line.trim().split("\\s+");
    int arr[]=new int[n];
    
    for(int i=0;i<n;i++)
    {
      arr[i]=Integer.parseInt(str[i]);
     
    }
    
    int dp[]=new int[n];
    
    	
    dp[0]=0;
    dp[1]=Math.abs(arr[0]-arr[1]);
    
    if(n>2) {
    dp[2]=Math.min(Math.abs(arr[2]-arr[1]), Math.abs(arr[1]-arr[0]));
    for(int i=2;i<n;i++)
    {
	   dp[i]=Math.min(dp[i-1]+Math.abs(arr[i]-arr[i-1]), dp[i-2]+Math.abs(arr[i]-arr[i-2]));
			 
    
    }
    }
    System.out.print(dp[n-1]);
    
  }
}

Measured memory_bytes: 34136
#include <cstdio>

int cnt[100010];
bool val[100010];

int main(){
  int N, M; scanf("%d%d", &N, &M);

  for(int i = 1; i <= N; i++) cnt[i] = 1;
  val[1] = true;

  for(int i = 0; i < M; i++){
    int x, y; scanf("%d%d", &x, &y);
    cnt[x]--; cnt[y]++;

    if(val[x]){
      if(cnt[x] == 0) val[x] = false;
      val[y] = true;
    }
  }

  int ans = 0;
  for(int i = 1; i <= N; i++) if(val[i]) ans++;

  printf("%d\n", ans);
  return 0;
}

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

using namespace std;

const int maxn = 110;
long long int n, x, ans, a[maxn];

int main()
{
    cin >> n >> x;
    for (int i = 0; i < n; i++)
        cin >> a[i];
    sort (a , a + n);
    while (x > 0  && ans < n)
    {
        x -= a[ans];
        ans++;
    }
    if (x < 0 || x > 0)
        ans -= 1;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>


using namespace std;
using namespace __gnu_pbds;

template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template<class T, class U>
void ckmin(T &a, U b)
{
	if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
	if (a < b) a = b;
}

#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
#define SZ(x) ((int) ((x).size()))
#define ALL(x) (x).begin(), (x).end()
#define INF 1000000007
#define LLINF 2696969696969696969ll
#define MAXN 200013

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;

ll overpass(pll x, pll y)
{
	//when does x beat y?
	ll dm = y.fi - x.fi, db = x.se - y.se;
	if (dm == 0)
	{
		return (db < 0 ? -LLINF : LLINF);
	}
	return db / dm + (db % dm > 0);
}
void insert(ordered_set<pll> &a, pll x)
{
	// cerr << "INSERT " << x.fi << ' ' << x.se << endl;
	if (a.empty())
	{
		a.insert(x);
		return;
	}
	auto it = a.LB(x);
	if (it == a.end())
	{
		if (a.rbegin() -> fi == x.fi)
		{
			return;
		}
		it--;
		while(it != a.begin() && overpass(*prev(it), *it) <= overpass(*it, x))
		{
			it = a.erase(it);
			it--;
		}
		a.insert(x);
		return;
	}
	else if (it == a.begin())
	{
		while(next(it) != a.end() && overpass(x, *it) <= overpass(*it, *next(it)))
		{
			it = a.erase(it);
		}
		a.insert(x);
		return;
	}
	bool change = false;
	do
	{
		change = false;
		while(next(it) != a.end() && overpass(x, *it) <= overpass(*it, *next(it)))
		{
			change = true;
			it = a.erase(it);
		}
		it--;
		while(it != a.begin() && overpass(*prev(it), *it) <= overpass(*it, x))
		{
			change = true;
			it = a.erase(it);
			it--;
		}
		it++;
	}
	while (change);
	it--;
	if (overpass(*it, x) > overpass(x, *next(it)))
	{
		a.insert(x);
	}
	return;
}
ll query(ll x, ordered_set<pll> &a)
{
	int lo = 0, hi = a.size() - 1;
	while(hi > lo)
	{
		int mid = (lo + hi) / 2;
		auto it = a.find_by_order(mid);
		pll pl = *it, pr = *next(it);
		if (overpass(pl, pr) <= x)
		{
			hi = mid;
		}
		else
		{
			lo = mid + 1;
		}
	}
	auto it = a.find_by_order(lo);
	return it -> fi * x + it -> se;
}

ordered_set<pll> hull;
int N;
ll C;
ll arr[MAXN];
ll dp[MAXN];

int32_t main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	cin >> N >> C;
	FOR(i, 0, N) cin >> arr[i];
	FOR(i, 1, N)
	{
		insert(hull, {-2 * arr[i - 1], dp[i - 1] + arr[i - 1] * arr[i - 1]});
		dp[i] = C + arr[i] * arr[i] + query(arr[i], hull);
	}
	// FOR(i, 0, N)
	// {
	// 	cerr << dp[i] << ' ';
	// }
	// cerr << endl;
	cout << dp[N - 1] << '\n';
	return 0;
}


Measured memory_bytes: 15872
import java.util.*;

public class Main {
	static int read;
	static long[] heap;

	public static void maxHeapify(int i) {
		int left = i * 2 + 1;
		int right = i * 2 + 2;
		int largest;
		
		if (left < read && heap[left] > heap[i]) {
			largest = left;
		} else {
			largest = i;
		}
		if (right < read && heap[right] > heap[largest]) {
			largest = right;
		}

		if (largest != i) {
			long tmp = heap[i];
			heap[i] = heap[largest];
			heap[largest] = tmp;
			maxHeapify(largest);
		}
	}

	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);
		read = in.nextInt();
		heap = new long[read];
		for (int i = 0; i < read; i++) {
			heap[i] = in.nextLong();
		}
		for (int i = read / 2; i >= 0; i--) {
			maxHeapify(i);
		}
		for (int i = 0; i < read; i++) {
			System.out.print(" " + heap[i]);
		}
		System.out.println("");
		in.close();
	}
}


Measured memory_bytes: 167708
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef map<int,int> mii;
typedef map<ll,ll> mll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll>   vl;
#define f(i,n)  for(i=0;i<n;i++)
#define f1(i,n)  for(i=1;i<n;i++)
#define fr(i,n) for(i=n-1;i>=0;i--)
#define em emplace_back
#define mp make_pair
#define in insert
#define fi first
#define sc second
#define b begin
#define e end
#define er erase
#define l length
#define c clear
#define si size
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
const double pi=3.141592653;
const ll infi=1000000001;
const ll MOD=1000000007;
const ll mod=998244353;
const string no="NO\n",yes="YES\n";

// ll gcd(ll a,ll b){
//     if(a==0)    return b;
//     gcd(b%a,a);
// }

// void dfs(vl v[],ll node,ll hai[]){
//     hai[node]=1;
//     for(auto i:v[node]){
//         if(hai[i]==0){
//             dfs(v,i,hai);
//         }
//     }
// }

// ll con(vl v[],ll hai[],ll sz){
//     ll count=0;
//     for(int i=1;i<sz;i++){
//         if(hai[i]==0){
//             count++;
//             dfs(v,i,hai);
//         }
//     }
    // return count;
// }

// void gcde(int a,int b,int *x,int *y){
//     if(a==0){
//         *x=0;
//         *y=1;
//         return;
//     }    
//     int x1,y1;
//     gcde(b%a,a,&x1,&y1);
    
//     *x=y1-(b/a)*x1;
//     *y=x1;
// }


// ll recur(vl v,ll in,ll m,ll n){
//     if(in==-1)  return 1000000000001;
//     ll d,e,c;
//     d=max(m/v[in],n*v[in]);
//     c=recur(v,in-1,m/v[in],n*v[in]);
//     e=recur(v,in-1,m,n);
//     return min(c,min(e,d));
// }

// ll bexpo(ll a,ll p){
//     ll x=1;
//     while(p){
//     if(p&1){
//         x=(x*a)%mod;
//     }
//     a=(a*a)%mod;
//     p>>=1;
//     }
//     return x;
// }
// ll fact[500001],invf[500001];
// int dx[8]{-1,0,0,1,-1,-1,1,1};
// int dy[8]{0,-1,1,0,-1,1,-1,1};
// ll dp[200001];


int main() {
    fastio
    string s,t;
    cin>>s>>t;
    int sl=s.l(),tl=t.l(),i,j;
    int ans=10000,c=0;
    for(int i=0;i<sl-tl+1;i++){
        c=0;
        f(j,tl){
            if(t[j]!=s[j+i])    c++;
        }
        ans=min(ans,c);
    }
    cout<<ans;

	return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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


int main() {
    int A, B;
    cin >> A >> B;
    int ans = B - A;
    if (B % A == 0) ans = A + B;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入
		double w = sc.nextDouble();
		double h = sc.nextDouble();
		double x = sc.nextDouble();
		double y = sc.nextDouble();

		double s = w *h;

		System.out.println(s/2);

		if(w<2 || h<2){
			System.out.println(0);
		}else if(w/2 == x  && h/2 == y ){
			System.out.println(1);
		}else{
			System.out.println(0);
		}
	}
}


Measured memory_bytes: 23252
#include<iostream>
#include<string>
#include<vector>
using namespace std;
typedef vector<int> vi;
int main()
{
  int n,m;
  while(1) 
  {
    cin >> n >> m;
    if(n==0) break;
    vi h(n+1);
    vi w(m+1);
    int totalh=0,totalw=0;
    int count=0;
    for(int i=0;i<n;i++)
    {
      cin >> h[i];
      totalh+=h[i];
    }
    for(int i=0;i<m;i++)
    {
      cin >> w[i];
      totalw+=w[i];
    }
    vi htype(totalh+1);
    vi wtype(totalw+1);
    for(int i=0;i<n;i++)
    {
      int height=h[i];
      htype[height]++;
      for(int j=i+1;j<n;j++)
      {
				height+=h[j];
				htype[height]++;
      }
    }
    for(int i=0;i<m;i++)
    {
      int width=w[i];
      wtype[width]++;
      for(int j=i+1;j<m;j++)
      {
				width+=w[j];
				wtype[width]++;
      }
    }
    for(int i=1;i<=min(totalh,totalw);i++)
    {
      count+=htype[i]*wtype[i];
    }
    cout << count << endl;
  }
  return 0;
}



Measured memory_bytes: 6968
import sys
#sys.setrecursionlimit(10**9)
input = sys.stdin.readline
n, m = map(int, input().split())
d = {}
for i in range(n):
    d[i] = 0

for i in range(m):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    d[a] += 1
    d[b] += 1

for v in d.values():
    if v%2 != 0:
        print('NO')
        exit()
else:
    print('YES')


Measured memory_bytes: 49392
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using namespace std;


void solve(std::string S, std::string T, long long A, long long B, std::string U){
  if (S == U) {
    std::cout << A-1 << " " << B << std::endl;
  } else {
    std::cout << A << " " << B-1 << std::endl;
  }
}

int main(){
  std::string S;
  std::cin >> S;
  std::string T;
  std::cin >> T;
  long long A;
  scanf("%lld",&A);
  long long B;
  scanf("%lld",&B);
  std::string U;
  std::cin >> U;
  solve(S, T, A, B, U);
  return 0;
}


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

int n;
vector<int> v;
vector<int> vfront, vback;

int getmodevector(vector<int> vec) {
    int count;
    vector<int> countarray(100010);
    for (auto x: vec) countarray[x]++;
    vector<int>::iterator maxiter = max_element(countarray.begin(), countarray.end());
    int maxindex = distance(countarray.begin(), maxiter);
    return maxindex;
}

void eraseelement(vector<int> &vec, int element) {
    int N = vec.size();
    for (int i = 0; i < N; i++) {
        if (vec[i] == element) {
            vec.erase(vec.begin() + i);
            i--; N--;
        }
    }
}

int main() {
    scanf("%d", &n);
    v.resize(n);
    for (int i = 0; i < n; i++) scanf("%d", &v[i]);

    for (int i = 0; i < n; i++) {
        if (i % 2) vfront.push_back(v[i]);
        else vback.push_back(v[i]);
    }

    int modefront = getmodevector(vfront);
    int modeback = getmodevector(vback);
    int modefrontcount = count(vfront.begin(), vfront.end(), modefront);
    int modebackcount = count(vback.begin(), vback.end(), modeback);
    if (modefront == modeback) {
        int modefront2, modeback2;
        int modefrontcount2, modebackcount2;

        eraseelement(vfront, modefront);
        if (vfront.size() != 0) {
            modefront2 = getmodevector(vfront);
            modefrontcount2 = count(vfront.begin(), vfront.end(), modefront2);
        }else{
            modefrontcount2 = 0;
        }

        eraseelement(vback, modeback);
        if (vback.size() != 0) {
            modeback2 = getmodevector(vback);
            modebackcount2 = count(vback.begin(), vback.end(), modeback2);
        }else{
            modebackcount2 = 0;
        }

        if (modefrontcount2 + modebackcount > modebackcount2 + modefrontcount) {
            modefrontcount = modefrontcount2;
        }else{
            modebackcount = modebackcount2;
        }
    }
    int ans = n - modefrontcount - modebackcount;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1660
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define ii pair<int,int>
#define MAX 1000000007

using namespace std;


int main(void){
  ll n,m;
  cin >> n >> m;
  ll ans = (n-2)*(m-2);
  if(m == 1) ans = n-2;
  if(n == 1) ans = m-2;
  if(m == 1 && n == 1) ans = 1;
  
  cout << ans << endl;
  return 0;

}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(final String[] args) {
    final Scanner sc = new Scanner(System.in);
    String s = sc.next();
    String t = sc.next();
    int a = sc.nextInt();
    int b = sc.nextInt();
    String u = sc.next();
    sc.close();

    if (s.equals(u)) {
      System.out.println((a - 1) + " " + b);
    } else {
      System.out.println(a + " " + (b - 1));
    }
  }
}

Measured memory_bytes: 23764
n = int(input())
a = list(map(int,input().split()))
rates = {}

def add_rates(i):
    if i not in rates:
        rates[i] = 1
    else:
        rates[i] += 1

for i in range(n):
    if a[i] < 400:
        add_rates(0)
    elif 400 <= a[i] < 800:
        add_rates(1)
    elif 800 <= a[i] < 1200:
        add_rates(2)
    elif 1200 <= a[i] < 1600:
        add_rates(3)
    elif 1600 <= a[i] < 2000:
        add_rates(4)
    elif 2000 <= a[i] < 2400:
        add_rates(5)
    elif 2400 <= a[i] < 2800:
        add_rates(6)
    elif 2800 <= a[i] < 3200:
        add_rates(7)
    elif 3200 <= a[i]:
        add_rates(8)

cnt = len(rates)
if 8 not in rates:
    print(cnt, cnt)
else:
    if cnt == 1:
        print(1, rates[8])
    else:
        print(cnt-1, cnt-1+rates[8])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;

ll memo[100];

ll lucas(int x){
  if(x==0) return memo[0]=2;
  if(x==1) return memo[1]=1;
  if(memo[x]!=0) return memo[x];
  return memo[x]=lucas(x-1)+lucas(x-2);
}

int main() {
  int n;
  cin>>n;
  cout<<lucas(n)<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

ll num(ll n){
    return pow(2,n+2)-3;
}

ll solve(ll n,ll x){
    if(n==0) return 1;
    if(x==1) return 0;
    if(x<=num(n-1)+1) return solve(n-1,x-1);
    if(x==num(n-1)+2) return solve(n-1,num(n-1))+1;
    if(x==num(n)) return 2*solve(n-1, num(n-1))+1;
    return solve(n-1,num(n-1))+solve(n-1,x-num(n-1)-2)+1;
}

int main() {
    ll n,x;
    cin >> n >> x;
    cout << solve(n,x) << endl;
}

Measured memory_bytes: 512
# 下記ページを参考に実装してる
# https://qiita.com/drken/items/56a6b68edef8fc605821#%E5%95%8F%E9%A1%8C-3-atcoder-abc-122-c---get-ac

n, q = map(int, input().split())
s = input()

sl = [0] * (n+1)
for i in range(1, n):
  if s[i] == 'C' and s[i-1] == 'A':
    sl[i+1] = sl[i] + 1
  else:
    sl[i+1] = sl[i]

#print(sl)
for i in range(q):
  l, r = map(int, input().split())
  print(sl[r] - sl[l])

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

int value[100];
int sp = 0;

void push(const int val)
{
    value[sp++] = val;
}

int pop()
{
    return value[--sp];
}

void operand(const char operand)
{
    int ch, val = operand - '0';
    while( (ch = getchar()) != ' ' ){
        val = val * 10 + (ch - '0'); 
    }
    push(val);
}

void operator(const char operator)
{
    int tmp1 = pop(), tmp2 = pop();

    switch( operator ){
    case '+': push(tmp2 + tmp1); break;
    case '-': push(tmp2 - tmp1); break;
    case '*': push(tmp2 * tmp1); break;
    default : break;
    }
}

int main()
{
    while( 1 ){
        int ch = getchar();
        if( ch == ' ' || ch == '\n' ) continue;
        if( ch == EOF ) break;
        
        switch( ch ){
        case '+': case '-': case '*': operator(ch); break;
        default : operand(ch); break;
        }
    }

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

    return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;
typedef long long ll;

int main(){

    ll n, m, d;
    cin >> n >> m >> d;
    if(d == 0){
        cout << (double) (m-1) / n << endl;
    }
    else{
        cout << fixed << setprecision(9) <<(double) (m-1) * (n-d) * 2 / (n*n) << endl;
    }
    return 0;
}


Measured memory_bytes: 256
/*...Part - 01...*/

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <iterator>
#include <bitset>
#include <assert.h>
#include <new>
#include <sstream>
//#include <bits/stdc++.h>
using namespace std ;

/*...Part - 02...*/

typedef long long               ll ;
typedef long double             ld ;
typedef unsigned long long      ull ;
typedef pair<int,int>           pii ;
typedef pair<ll,ll>             pll ;
typedef vector<int>             vi ;
typedef vector<ll>              vll ;
typedef vector<vector<int>>     vvi ;

int Int(){int x ; scanf("%d",&x) ; return x ;}
ll Long(){ll x ; scanf("%lld",&x) ; return x ;}

/*...Part - 03...*/
/*....Debugger....*/

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl ;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}

/*...Part - 04...*/
/*...Needed to change according to problem requirements...*/

const int N          = (int)2e5 + 5 ;
const int maxN       = (int)1e6 + 6 ;
const ll  Mod        = (ll)1e9 + 7 ;
const int inf        = (int)2e9 ;
const ll  Inf        = (ll)1e18 ;

/*..........................................................*/
/*...Part - 05...*/

#define     debug(x)    cerr << #x << " = " << x << '\n' ;
#define     rep(i,b,e)  for(__typeof(e) i = (b) ; i != (e + 1) - 2 * ((b) > (e))  ; i += 1 - 2 * ((b) > (e)))
#define     Int         Int()
#define     Long        Long()
#define     all(x)      x.begin() , x.end()
#define     sz(x)       (int)x.size()
#define     ff          first
#define     ss          second
#define     pb          push_back
#define     eb          emplace_back
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)

/*...Part - 06...*/
/*...... ! Code start from here ! ......*/

const int max_n = 405 ;

ll dp[max_n][max_n], sum[max_n] ;
int a[max_n] ;

ll call(int l, int r){
	if(l >= r)return 0 ;
	ll &ret = dp[l][r] ;
	if(~ret)return ret ;
	ret = Inf ;
	for(int i = l ; i <= r ; ++i){
		ret = min(ret, call(l, i) + call(i + 1, r) + sum[r] - sum[l - 1]) ;
	}
	return ret ;
}

int main(){
    int test = 1 , tc = 0 ;
    while(test--){
        int n = Int ;
        for(int i = 1 ; i <= n ; ++i)a[i] = Int, sum[i] += sum[i - 1] + a[i] ;
        memn(dp) ;
    	cout << call(1, n) << '\n' ;
    }
    return 0 ;
}

/*...Always look at the part - 04...*/
/*...............END................*/




Measured memory_bytes: 1536
/*by freesteed*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define pb push_back
#define fill(x,c) memset(x,c,sizeof(x))
#define fi first
#define se second
#define sz(A) (int)(A.size())
#define all(x) (x).begin(),(x).end()
#define caset int ___T; cin>>___T; for(int cs=1;cs<=___T;cs++)
#define get_be(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
//get_be biger & equal
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
const ll mod=1e9+7;
const ll oo=1e9+10;
const int Max = 1e6+10;
#define PI acos(-1)
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll n,ans;
void solve(){
	double a,b,x;
	cin>>a>>b>>x;
	double y = x;
	x = a*a*b-x;
	if(x<=y){
		double t = 2*x/a/a/a;
		cout<<fixed<<setprecision(9)<<atan(t)/PI*180;
	}else{
		double t = 2*y/b/b/a;
		cout<<fixed<<setprecision(9)<<90-atan(t)/PI*180;
	}	
}
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//caset{
		solve();
	//}
  	return 0;
}





Measured memory_bytes: 384
#include <stdio.h>
int main(void){
  int i,j,k,n,m,l,a[100][100],b[100][100];
  long int s;
  scanf("%d%d%d",&n,&m,&l);
//行列A
  for(i=0;i<n;i++)
    for(j=0;j<m;j++)
      scanf("%d",&a[i][j]);
//行列B
  for(i=0;i<m;i++)
    for(j=0;j<l;j++)
      scanf("%d",&b[i][j]);
//行列C
  for(i=0;i<n;i++)
    for(j=0;j<l;j++){
      s = 0;
      for(k=0;k<m;k++)
        s += a[i][k] * b[k][j] ;
      printf("%ld", s);
      if(j+1 == l)
        printf("\n");
      else
        printf(" ");
    }
  return 0;
}


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

int main() {
  double a;
  while(cin >> a) {
    double sum = a;
    for(int i=1;i<10;i++) 
      if(i % 2 == 1) a*=2, sum+=a; 
      else a/=3, sum += a;
    printf("%.10f\n",sum);
  }
  return 0;
}

Measured memory_bytes: 1236
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "yes" : "no");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int n;
  cin >> n;
  vector<int> A(n);
  rep(i, n)
  {
    cin >> A[i];
  }
  int q;
  cin >> q;
  vector<int> m(q);
  rep(i, q)
  {
    cin >> m[i];
  }

  vector<int> is_ok(2000 * 200, false);
  rep(div, 1 << (n + 1) - 1)
  {
    int sum = 0;
    rep(bit, n)
    {
      if (div >> bit & 1)
      {
        sum += A[bit];
      }
    }
    is_ok[sum] = true;
  }

  rep(i, q)
  {
    printYesNo(is_ok[m[i]]);
  }

  return 0;
}


Measured memory_bytes: 4404
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
#define dcml(n) fixed<<setprecision(n)
//CONST
//------------------------------------------
const ll INF=1010000000000000017LL;
const ll MOD=1000000007LL;
const ld EPS=1e-12;
const ld PI=3.14159265358979323846;
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define  FORS(i,m,n) for(ll (i)=(m);   (i)<=(n); (i)++)
#define  RFOR(i,m,n) for(ll (i)=(n)-1; (i)>=(n); (i)--)
#define RFORS(i,m,n) for(ll (i)=(n);   (i)>(n);  (i)--)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
#define WREPS(i,in,j,jn) REPS(i,in)REPS(j,jn)
//-----------------------------------------
//namespace
using namespace std;
//ライブラリはここに
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

//-----------------------------------------
int main(void){
    ll a,b,c;cin>>a>>b>>c;
    if(a+b+c>=22)cout<<"bust";
    else cout<<"win";
    cout<<"\n";
}

Measured memory_bytes: 256
import itertools

n = int(input())
p_list = list(map(int,input().split()))
q_list = list(map(int,input().split()))

per_list = itertools.permutations([x+1 for x in range(n)])

p_dict_i = -1
q_dict_i = -1
for dict_i, per in enumerate(per_list):
    p_flg = True
    for i, num in enumerate(per):
        if num != p_list[i]:
            p_flg = False
            break
    q_flg = True
    for i, num in enumerate(per):
        if num != q_list[i]:
            q_flg = False
            break
    if p_flg: p_dict_i = dict_i
    if q_flg: q_dict_i = dict_i

print(abs(p_dict_i-q_dict_i))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
const ll INF = 1e18;
#define print(x) cout << (x) << endl;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<int> A(N);
    ll sum = 0;
    ll A1sum = 0;
    int a = 0;
    rep(i,0,N) {
        cin >> A.at(i);
        sum += A.at(i);
        if (i % 2 == 0) {
            A1sum += A.at(i);
        }
    }
    a = (A1sum - sum / 2) * 2;
    cout << a << " ";
    rep(i,0,N-1) {
        cout << A.at(i) * 2 - a << " ";
        a = A.at(i) * 2 - a;
    }
    cout << endl;
}

Measured memory_bytes: 1792
score = list(map(int,input().split()))
if score[0] == score[1] and score[0] != score[2]:
    print('Yes')
elif score[1] == score[2] and score[0] != score[2]:
    print('Yes')
elif score[2] == score[0] and score[1] != score[2]:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 61792
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

C = input()
print(chr(ord(C)+1))


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

using namespace std;

#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define REP(i,j,k) for(int i=j;i<(int)(k);++i)
#define foreach(i,c) for(__typeof(c.begin()) i=c.begin();i!=c.end();++i)
#define all(x) (x).begin(),(x).end()
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
typedef long long ll;
const int INF = 99999999;
const double EPS = 1e-9;

int s,d,in;
vvi S,D;

int main()
{
    while(cin>>s>>d,s&&d){
        S.resize(s,vi(d));
        D.resize(d,vi(d,0));
        rep(i,s)rep(j,d) cin >> S[i][j];
        rep(i,d-1)REP(j,i+1,d){
            cin >> in;
            D[i][j]=D[j][i]=in;
        }
//        rep(i,s)rep(j,d) printf("%2d%s",S[i][j],j!=d-1?" ":"\n");
//        rep(i,d)rep(j,d) printf("%2d%s",D[i][j],j!=d-1?" ":"\n");

        priority_queue<P,vector<P>, greater<P> > pq;
        vi end(d,0);
        P p;
        int ans=0,res=d;

        rep(i,s)rep(j,d)if(S[i][j]!=0) pq.push(P(S[i][j],j));

        while(!pq.empty()){
            p = pq.top(),pq.pop();
            if(end[p.second]) continue;
            end[p.second]=1;
            ans+=p.first;
            if(--res==0) break;

            rep(i,d)if(!end[i]&&D[p.second][i]!=0){
                pq.push(P(D[p.second][i],i));
            }
        }
        cout << ans << endl;
        S.clear(),D.clear();
    }
    return 0;
}

Measured memory_bytes: 0