akhauriyash/Code-Regression huggingface dataset:
/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const ll inf = 1LL<<50;
const int N =1100;
int n , m ;
int a,b,c;
bool vis[N][N];
ll mem[N][N];
ll x[N],y[N],z[N];
ll dp ( int i , int rem ) {
if ( rem == 0 ) {
    return 0LL ;
}
if  (i == n+1 ) {
    return -inf ;
}
if ( vis[i][rem] ) return mem[i][rem] ;
  vis[i][rem] =  1 ;
  mem[i][rem] = dp ( i+1 , rem );
  return mem[i][rem] = max ( mem[i][rem] , dp(i+1,rem-1)+a*x[i]+b*y[i]+c*z[i] );
}
int main ( )
{
    scanf("%d %d",&n,&m);
    for(int i= 1; i<=n; i++)scanf("%lld %lld %lld",x+i,y+i,z+i);
    ll ANS =0;

    for(a=-1; a<2; a+=2)
        for(b=-1; b<2; b+=2)
            for(c=-1; c<2; c+=2)
            {
                memset(vis,0,sizeof vis);
                ANS=max(ANS,dp(1,m));
            }
    printf("%lld\n",ANS);
    return 0 ;
}


Measured memory_bytes: 10112
#include <iostream>
#include <utility>
#include <set>

using namespace std;

int main()
{
    while (1)
    {
        int m, n, a, b;
        bool f;
        set<pair<int, int>> S;
        pair<int, int> M[200], N[1000];
        cin>>m;
        if (m==0) break;
        for (int i=0; i<m; i++) cin>>M[i].first>>M[i].second;
        cin>>n;
        for (int i=0; i<n; i++)
        {
            cin>>N[i].first>>N[i].second;
            S.insert({N[i].first, N[i].second});
        }
        for (int i=0; i<n; i++)
        {
            f=true;
            a=N[i].first-M[0].first;
            b=N[i].second-M[0].second;
            for (int j=0; j<m && f; j++) if (!S.count({M[j].first+a, M[j].second+b})) f=false;
            if (f)
            {
                cout<<a<<' '<<b<<'\n';
                i=n;
            }
        }
    }
    return 0;
}



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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define ALL(V) (V).begin(),(V).end()

using namespace std;
typedef long long ll;

const double PI = 3.1415926535897932384626;
const ll MODN = 1000000007;
const ll MODN2 = 998244353;
const double EPS = 1e-10;

int main(){

    int n;
    cin >> n;
    vector<ll> v(n);

    rep(i, n){
        cin >> v[i];
    }

    sort(ALL(v));
    reverse(ALL(v));

    ll ans = 0;
    ans += v[0];

    for(int i = 2; i < n; i++){
        ans += v[i / 2];
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4824
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <deque>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <locale>
#include <iomanip>
#include <cstring>

#define nl '\n'

using namespace std;

int n, m, a, b;

queue<pair <int, int> > Q; //distance, node
int dist[200005];
vector<int> G[200005];

int main(){

    cin >> n >> m;

    for(int i = 0; i < m; i++){
        cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    int SOURCE = 1;

    memset(dist, -1, sizeof(dist));

    Q.push(make_pair(0, SOURCE));

    while(!Q.empty()){
        int d = Q.front().first, u = Q.front().second;
        Q.pop();
        if(dist[u] != -1) continue;
        dist[u] = d; //the shortest distance to node u is d
        for(int i = 0; i < G[u].size(); i++){
            Q.push(make_pair(d+1, G[u][i]));
        }
    }

    if(dist[n] == 2){
        cout << "POSSIBLE";
    } else{
        cout << "IMPOSSIBLE";
    }


}

//g++ -std=c++14 comp.cpp -o b; ./b.exe
//g++ -std=c++14 comp.cpp && ./a.out


Measured memory_bytes: 14192
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int w, h;
  cin >> w >> h;
  vector<int> p(w);
  rep(i, w) cin >> p.at(i);
  vector<int> q(h);
  rep(i, h) cin >> q.at(i);
  sort(ALL(p)), sort(ALL(q));
  p.push_back(1e9), q.push_back(1e9);
  int ip = 0, iq = 0;
  ll ans = 0;
  while(ip != p.size()-1 || iq != q.size()-1){
    ll np = p.at(ip), nq = q.at(iq);
    // np *= h-iq+1; nq *= w-ip+1;
    if(np < nq){
      np *= h-iq+1;
      ans += np;
      ip++;
    }else{
      nq *= w-ip+1;
      ans += nq;
      iq++;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4572
// D - 756

// DFSを用いた解法

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

vector<pair<ll, ll>> prime_factorize(ll n) {
	vector<pair<ll, ll> > result;
	for (ll p=2; p*p<=n; p++) {
		if (n % p != 0) continue;
		ll num = 0;
		while (n % p == 0) {
			num++;
			n /= p;
		}
		result.push_back(make_pair(p, num));
    }
    if (n != 1) {
    	result.push_back(make_pair(n, 1));
    }
    return result;
}

vector<pair<int, int>> prime_cnt;
int ans = 0;

void dfs(int i, int cnt) {
	if (i == prime_cnt.size() - 1) {
		if (cnt == 75) ans++;
		return;
	}

	if (cnt > 75) return;

	for (int j=0; j<=prime_cnt[i].second; j++) {
		dfs(i+1, cnt * (j+1));
	}
}

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

	if (N == 1) {
		cout << 0 << endl;
		return 0;
	}

	map<int, int> primes;

	for (int i=2; i<=N; i++) {
		vector<pair<ll, ll>> pf = prime_factorize(i);

		for (auto p: pf) {
			primes[p.first] += p.second;
		}
	}

	for (auto itr : primes) {
		int prime = itr.first;
		int cnt = itr.second;
		//cout << itr.first << " " << itr.second << endl; // **** debug ****
		prime_cnt.push_back(make_pair(prime, cnt));
	}

	dfs(0, 1);

	cout << ans << endl;

	return 0;
}

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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
const   int            infi = numeric_limits<int>::max();
const   double         eps = 0;
const   int            ms  = 0;

vector<ll> B(51, 0), P(51, 0), H(51, 0);
ll n , x;


int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);
    cin >> n >> x;

    B[0] = 0;
    P[0] = 1;
    H[0] = 1;
    for(int i = 1; i <= 50; i++){
        B[i] = B[i-1]*2+2;
        P[i] = P[i-1]*2+1;
        H[i] = B[i] + P[i];
    }
    
    int l = n;
    ll ans = 0;
    while(1){
        
        debug(x);
        if(x == H[l]){
            ans += P[l];
            break;
        }
        if(x <= 1)break;
        if(l==0)break;
        if(1+H[l-1]+1 < x){
            
            x-=H[l-1]+1+1;
            ans+=1+P[l-1];
            l--;
        } else if(1+H[l-1]+1 == x){
            ans+=1+P[l-1];
            break;
        } else if(1+H[l-1]==x){
            ans+=P[l-1];
            break;
        }
        else{
            l--;
            x-=1;
        }
    }
    cout << ans << "\n";
    return 0;
}

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

int main() {
    int itien, Nen;
    int maisuu;

    cin >> Nen;
    cin >> itien;
    maisuu = Nen % 500;

    if (itien >= maisuu) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }

    return 0;
}

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

struct Point { double x; double y; };

Point a, b, c, d;
double f(Point p) {
  return (b.y - a.y) * (p.x - a.x) - (b.x - a.x) * (p.y - a.y);
}
double g(Point p) {
  return (d.y - c.y) * (p.x - c.x) - (d.x - c.x) * (p.y - c.y);
}

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

  ll Q; cin >> Q;
  for (ll i = 0; i < Q; i++) {
    cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y;
    double ans0 = g(a), ans1 = g(b),  ans2 = f(c), ans3 = f(d);
    int ans = 0;

    if (g(a) * g(b) <= 0 && f(c) * f(d) <= 0) {
      ans = 1;
    }
    if (g(a) == 0 && g(b) == 0 && f(c) == 0 && f(d) == 0) {
      ans = 0;
      if (a.x != b.x) {
        if (a.x > b.x) swap(a, b);
        if (c.x > d.x) swap(c, d);
        if (a.x <= c.x && c.x <= b.x || a.x <= d.x && d.x <= b.x) ans = 1;
        if (c.x <= a.x && a.x <= d.x || c.x <= b.x && b.x <= d.x) ans = 1;
      } else {
        if (a.y > b.y) swap(a, b);
        if (c.y > d.y) swap(c, d);
        if (a.y <= c.y && c.y <= b.y || a.y <= d.y && d.y <= b.y) ans = 1;
        if (c.y <= a.y && a.y <= d.y || c.y <= b.y && b.y <= d.y) ans = 1;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}


Measured memory_bytes: 3292
#include<bits/stdc++.h>
#define ll long long

ll max = 0, n, w, w0;
std::vector <ll> vec[10];

void dfs(ll n, ll weight, ll ans){
	if (n == 4){
		if (weight <= w){
			max = std::max(max, ans);
		}
		return;
	}
	ll sum = 0;
	for (ll i = 0, sz = vec[n].size(); i <= sz; ++ i){
		if (i){
			sum += vec[n][i - 1];
		}
		dfs(n + 1, weight + i * (w0 + n), ans + sum);
	}
}

int main(){
	scanf("%lld%lld", &n, &w);
	for (ll i = 0, x, y; i < n; ++ i){
		scanf("%lld%lld", &x, &y);
		if (!i){
			w0 = x;
		}
		vec[x - w0].push_back(y);
	}
	for (ll i = 0; i < 4; ++ i){
		sort(vec[i].begin(), vec[i].end(), std::greater <ll>());
	}
	dfs(0, 0, 0);
	return printf("%lld\n", max), 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {


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

}

Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int wei(int x)
{
	int i=0;
	while(x)
	{
		x/=10;
		++i;
	}
	return i;
}
int main()
{
	ios::sync_with_stdio(false);
	int a,b;
	cin>>a>>b;
	int a1,b1;
	a1=pow(10,wei(b))*a+b,  b1=pow(10,wei(a))*b+a;
	if(pow((int)(sqrt(a1)),2)==a1||pow((int)(sqrt(b1)),2)==b1) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}//a,bの最大公約数(gcd)を求める
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}//a,bの最小公倍数(lcm)を求める
vector<ll> enum_div(ll n){vector<ll> ret;for(int i=1 ; i*i<=n ; i++){if(n%i == 0){ret.push_back(i);if(i!=1 && i*i!=n)ret.push_back(n/i);}}ret.push_back(n);return ret;}
//↑nの約数を求める
vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
//↑エラトステネスの篩で素数を求める
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend //切り上げ割り算
#define all(x) (x).begin(),(x).end() //xの初めから終わりまでのポインタ
#define size_t ll //size_tは自動でllに変換される
#define pb(x) push_back(x)
#define gre greater //sortを降順にする
#define pri_queue priority_queue //優先度付きキュー
const int mod = 1000000007;
int n; bool ans=false;
int main(){
  cin >> n;
  for (size_t i = 1; i <= 9; i++) {
    for (size_t l = 1; l <= 9; l++) {
      if(i*l == n)ans = true;
    }
  }
  cout << (ans ? "Yes":"No") << endl; 
}


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

long long n, q, h, s, d, res;
vector<pair<long long, pair<int, double>>> v;

int main() {
	cin >> q >> h >> s >> d >> n;

	v.push_back({ q * 8,{q, 0.25 } });
	v.push_back({ h * 4, {h, 0.5} });
	v.push_back({ s * 2, {s, 1} });
	v.push_back({ d, {d, 2} });

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

	for (int i = 0; i < 4 && n > 0; ++i) {
		res += (long long)(n / v[i].second.second)*v[i].second.first;
		n -= (long long)(n / v[i].second.second)*v[i].second.second;
		//cout << res <<' ' << n << '\n';
	}

	cout << res;
}

Measured memory_bytes: 256
using System;

class Program
{
    static void Main(string[] args)
    {
        string str1 = Console.ReadLine();
        string[] arrayA = str1.Split(' ');
        long sum = 0;

        foreach( var strA in arrayA )
        {
            long Ai = Int32.Parse(strA);
            sum += Ai;

            if ( sum >= 22 )
            {
                Console.WriteLine("bust");
                return;
            }
        }

        Console.WriteLine("win");
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#define ll long long
using namespace std; 
signed
main()
{
long long int n;
cin>>n,n--;
int a[n+1];
int child[n+2]={0};
for(int i = 1 ; i <= n; i++ )
{
	cin>>a[i];
	child[a[i]]++;
}

for(int i = 1 ; i <= n+1; i++)
cout<<child[i]<<"\n";
		
}


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

#define ll long long
#define INF_LL 1LL << 60
#define INF 99999999
#define MOD (ll)1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, a, n) for(int i = a; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

void put_double(double obj){printf("%.12f\n",obj);};

template < typename T > std::string to_string( const T& n )
{
    std::ostringstream stm ;
    stm << n ;
    return stm.str() ;
}

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


int main()
{
    int W,H,N;
    cin >> W >> H >> N;

    vector<int> x(N);
    vector<int> y(N);
    vector<int> a(N);
    rep(i,N) cin >> x[i] >> y[i] >> a[i];

    vector<vector<int> > ans(W, vector<int>(H, 0));

    rep(i,N)
    {
        if( a[i] == 1 )
        {
            rep(X, x[i])
            {
                rep(Y, H) ans[X][Y] = 1;
            }
        }
        else if( a[i] == 2 )
        {
            REP(X, x[i], W)
            {
                rep(Y, H) ans[X][Y] = 1;
            }
        }
        else if( a[i] == 3 )
        {
            rep(X, W)
            {
                rep(Y, y[i]) ans[X][Y] = 1;
            }
        }
        else
        {
            rep(X, W)
            {
                REP(Y, y[i], H) ans[X][Y] = 1;
            }
        }
    }
    ll ANS = 0;
    rep(i, ans.size())
    {
        rep(j, ans[i].size())
        {
            if( ans[i][j] == 0 ) ANS++;
        }
    }
    cout << ANS << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>
#include <deque>

using namespace std;

int main()
{
  int64_t X;

  cin >> X;

  int64_t num_of_500yen = 0;
  int64_t num_of_5yen = 0;

  num_of_500yen = X / 500;
  num_of_5yen = (X % 500) / 5;

  cout << num_of_500yen * 1000 + num_of_5yen * 5 << endl;

  return 0;
}


Measured memory_bytes: 256
import heapq

N = int(input())
A_list = list(map(int, input().split()))
dic = {}

for a in A_list:
    if a in dic.keys():
        dic[a] += 1
    else:
        dic[a] = 1

counts = [-item for k,item in dic.items()]
heapq.heapify(counts)

max_cnt = -counts[0]
while max_cnt > 1:
    item1 = heapq.heappop(counts)
    if -item1 >= 3:
        item1 += 2
        if item1 < 0:
            heapq.heappush(counts, item1)
    else:
        item2 = heapq.heappop(counts)
        item1 += 1
        item2 += 1
        if item1 < 0:
            heapq.heappush(counts, item1)
        if item2 < 0:
            heapq.heappush(counts, item2)

    max_cnt = -counts[0]

res = 0
for v in counts:
    if v < 0:
        res += 1
    else:
        break

print(res)


Measured memory_bytes: 17144
N,X = map(int,input().split())
a,p = [1],[1]
for i in range(N):
    a.append(a[i]*2+3)
    p.append(p[i]*2+1)
def solve(N,X):
    if N==0:
        return 0 if X<=0 else 1
    elif X<=1+a[N-1]:
        return solve(N-1,X-1)
    else:
        return p[N-1]+1+solve(N-1,X-2-a[N-1])
print(solve(N,X))


Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define LLI long long int
#define FOR(v, a, b) for(LLI v = (a); v < (b); ++v)
#define FORE(v, a, b) for(LLI v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(LLI v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define fst first
#define snd second
#define popcount __builtin_popcount
#define UNIQ(v) (v).erase(unique(ALL(v)), (v).end())
#define bit(i) (1LL<<(i))

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(...) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}

struct Init{
  Init(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cerr << fixed << setprecision(12);
  }
}init;



int main(){
  string s,t;
  while(cin >> s >> t){
    cout << t << s << endl;
  }


  return 0;
}


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

namespace Program{
  class program{
    static void Main(){
      int[] input = Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();
      int N=input[0],K=input[1];
      int[] Cost = Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToArray();
      int[] MinCost = new int[N].Select(x=>0x7FFFFFFF).ToArray();
      
      MinCost[0] = 0;
      for(int i=1;i<N;i++)
        for(int s=1;s<=K;s++)
          if(i-s >= 0) MinCost[i] = Math.Min(MinCost[i], MinCost[i-s] + Math.Abs(Cost[i]-Cost[i-s]));
      
      Console.WriteLine(MinCost[N-1]);
    }
  }
}

Measured memory_bytes: 21472
import numpy as np
n,m,x=map(int,input().split())
a=2**64
b=[np.array(list(map(int,input().split())),"i8")for i in range(n)]
for i in range(2**n):
    c=bin(i)[2:]
    c="0"*(n-len(c))+c
    l=np.zeros(m)
    q=0
    for j in range(n):
        if c[j]=="1":
            q+=b[j][0]
            l+=b[j][1:]
    if np.min(l)>=x:
        a=min(a,q)
if a==2**64:
    print(-1)
else:
    print(a)

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

int main() {
  int a,b,c; cin>>a>>b>>c;
  if(c<a-b){cout<<0;}
  else{cout<<c-a+b;}
}
      



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		if(N*A < B) {
			System.out.println(N*A);
		}else {
			System.out.println(B);
		}
		
		
		
		sc.close();
		
	}

}

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

using namespace std;


#define ss second
#define ff first
#define int long long
//#define double long double
#define pb push_back

const int N = 2e6 + 1, MOD = 1e9 + 7, mod = 998244353, INF = 3e17;

mt19937 Flash_new_51(51515);

using vi = vector <int>;
using vp = vector <pair <int, int>>;

int n;

signed main() {
   cin.tie(0);
   ios_base::sync_with_stdio(0);
   cin >> n;
   bool ok = false;
   vi a(n + 1), ans;
   for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] > i + 1) ok = true;
   }
   if (ok) {
        cout << -1;
        return 0;
   }
   vi b(n + 1);
   int kol = n;
   while (kol != 0) {
       // b.clear();
        int m = 0;
        for (int i = kol - 1; i >= 0; i--) {
            if (a[i] == i + 1) {
                ans.pb(a[i]);
                for (int j = 0; j < kol; j++) if (i != j) b[m] = a[j], m++;
                break;
            }
        }
        a = b;
        kol--;
   }
   reverse(ans.begin(), ans.end());
   for (auto to : ans) cout << to << "\n";

}


Measured memory_bytes: 256
'use strict'

/////////////////////////////////////
//コピペスペース//////////////////////

//定数
const INF  =  900719925474099 // Math.floor(Number.MAX_SAFE_INTEGER / 10);

//スペース区切りの数字列を数字の配列にして返す
function mapint(line){return line.split(' ').map((v)=>parseInt(v));}

function lower_bound(d,a,b,e){
    for(var c;1<b-a;)
        d[c=0|(a+b)/2]<e ? a=c : b=c;
    return d[a]<e?b:a
};

const N109 = 1000000000;
const MOD = N109+7;

//コピペスペース//////////////////////
/////////////////////////////////////

function Main(input){
	let temp = input.trim();
	let abc = mapint(temp);
	let a = abc[0];
	let b = abc[1];
	let c = abc[2];

	let ans = c-(a-b);
	if(ans<0) ans = 0;
	console.log(ans);
}

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


Measured memory_bytes: 7372
import java.util.*;

public class Main {
    public void main(Scanner sc) {
        int n = sc.nextInt();

        if (n < 105) {
            System.out.println(0);
        } else if (n < 135) {
            System.out.println(1);
        } else if (n < 165) {
            System.out.println(2);
        } else if (n < 189) {
            System.out.println(3);
        } else if (n < 195) {
            System.out.println(4);
        } else {
            System.out.println(5);
        }
    }

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


Measured memory_bytes: 25044
n, c = map(int, input().split())
r = []
for i in range(n):#h:高さ
    r.append([int(m) for m in input().split()])

r.sort(key=lambda x:(x[0], x[1],x[2]))

xli = []
p = 0
for i in range(n):
    if i == 0:
        xli.append(r[i])
    else:
        xli.sort(key=lambda x: (x[1]), reverse=True)
        for jnum, j in enumerate(xli, 0):
            if (j[1] < r[i][0]) or (j[1] <= r[i][0] and j[2] == r[i][2]):
                p = 1
                xli[jnum] = r[i]
                break
        if p == 0:
            xli.append(r[i])
        p = 0

print(len(xli))

Measured memory_bytes: 30060
#include <bits/stdc++.h>
#define f(i,a,b) for(int i=a;i<=b;++i)
#define fd(i,a,b) for(int i=a;i>=b;--i)
#define ll long long
#define name "stones"
#define maxn 100005

using namespace std;

int n,k,a[105];
bool b[maxn];

int main()
{
    ios_base::sync_with_stdio();
    cin.tie(NULL);
    cout.tie(NULL);

    cin>>n>>k;
    f(i,1,n)
    {
        cin>>a[i];
    }
    f(i,0,k)
    {
        f(j,1,n)
        {
            if(i+a[j]<=k && b[i]==0)
            {
                b[i+a[j]]=1;
            }
        }
    }
    if(b[k]==1)
    {
        cout<<"First";
    }
    else
    {
        cout<<"Second";
    }

}


Measured memory_bytes: 3740
#include<stdio.h>

int main(void)
{
    int x,a,b;
    scanf("%d%d%d",&x,&a,&b);
    while((1>x||x>1000000000)||(1>a||a>1000000000)||(1>b||b>1000000000))
    {
        scanf("%d%d%d",&x,&a,&b);
    }
    if(0<=b&&b<=a)
    {
        printf("delicious\n");
    }
    else if(a<b&&b<a+x+1)
    {
        printf("safe\n");
    }
    else
    {
        printf("dangerous\n");
    }
    return 0;
}

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

int tot(int a, int b) {
    int t = 0;
    while(a != 0 || b != 0) {
        t += (a%10+b%10);
        a /= 10;
        b /= 10;
    }
    return t;
}




int main(){
    int n;
    cin >> n;
    
    int ans = inf;
    for(int i = 1; i <= n-1; i++) {
        ans = min(ans, tot(i, n-i));
    }
    cout << ans << endl;

}

Measured memory_bytes: 3500
#include<stdio.h>
#include<string.h>

int main(){
  char cards[201], shuffle[201];
  int m, h, len, i;
  while(1)
  {
	  scanf("%s", cards);
	  if(!strcmp(cards, "-")) break;
	  len = strlen(cards);
	  scanf("%d", &m);
	  for (i = 0; i < m; i++) {
	  	scanf("%d", &h);
		strncpy(shuffle, &cards[h], len-h);
		strncpy(&shuffle[len-h], cards, h);
		strcpy(cards, shuffle);
	  }
	  cards[len] = 0;
	  printf("%s\n", cards);
  }
  return 0;
}



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

signed main(void)
{
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(a.begin(), a.end());
	cout << a[n - 1] - a[0] << endl;
	return 0;
}


Measured memory_bytes: 256
// author:  Harsh Nema
#include <bits/stdc++.h>
#define ll long long int
#define F first
#define S second
const ll mod = 1e9 + 7;
const ll INF = 10000000000000;
#define pb push_back
#define deb(x) cout << '>' << #x << ':' << x << endl;
#define fastio ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
int main()
{
    fastio;
    ll n=0;
    cin>>n;
    map<ll,ll>mp;
    ll x=0;
    for(ll i=0;i<n-1;++i) cin>>x,++mp[x];
    for(ll i=1;i<=n;++i) cout<<mp[i]<<"\n";
    return 0;
}


Measured memory_bytes: 16164
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>

using namespace std;

const int MAX = 1299710;
bool prime[MAX];
vector<int> V;

void make(){
  fill(prime,prime+MAX, 1);
  prime[0] = prime[1] = 0;
  for(int i = 2; i < sqrt(MAX); i++)
    if(prime[i]) for(int j = 2*i; j < MAX; j+=i) prime[j] = 0;

  for(int i = 2; i < MAX; i++) 
    if(prime[i]) V.push_back(i);
}
int main(){
  make();
  vector<int>::iterator ite;
  int in;
  while(cin >> in && in){
    ite = upper_bound(V.begin(),V.end(),in);
    if(!prime[in])cout << *ite-*(ite-1) << endl;
    else cout << "0" << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N, K, sum = 0;
    cin >> N >> K;
    for (int i = 0; i < N; i++){
        int x;
        cin >> x;
        if (x < K){
            if ( x < K -x){
                sum += x;
            }
            else sum += K - x;
        }
        else sum += x - K;
    }
    cout << sum * 2 << endl;
}

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

int main(){
  int n,v;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a[i];
  }
  
  for(int i=0;i<n;i++){
    cout << a[i];
    if(i==n-1)
      cout << endl;
    else
      cout << " ";
  }
  
  for(int i=1;i<n;i++){
    int j;
    v = a[i];
    j = i-1;
    while(j>=0&&a[j]>v){
      a[j+1] = a[j];
      j--;
    }
    a[j+1]=v;
    
    for(int i=0;i<n;i++){
      cout << a[i];
      if(i==n-1)
      cout << endl;
    else
      cout << " ";
    }
  }
  
  return 0;
}



Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define pp pair<int, int>
#define ppp pair<pp, int>
#define fi first
#define se second
#define esp 1e-15
#define inf 1000000001
#define mod 1000000007
#define N 11
#define base 311097
typedef long long ll;
typedef long double ld;
const long long oo = (ll)1e18;
using namespace std;
int n, m;
vector <int> a[N];
bool f[N];
int ret = 0;

void go(int u, int cnt) {
    f[u] = true;
    if (cnt == n) ret++;
    for (int i = 0; i < a[u].size(); i++) {
        int v = a[u][i];
        if (f[v] == false) {
            f[v] = true;
            go(v, cnt + 1);
            f[v] = false;
        }
    }
}

int main() {
   //  freopen("in.in", "r", stdin);

  //  freopen("in2.in", "r", stdin);
   // freopen("ou.ou", "w", stdout);
    cin >> n >> m;
    for (int i = 1; i <= m; i++) {
        int u, v;
        cin >> u >> v;
        a[u].pb(v);
        a[v].pb(u);
    }
    go(1, 1);
    cout << ret;
    /**/ return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>


using namespace std;

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

	int S[32] = { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };

	cout << S[N - 1] << endl;



	

	return 0;
}

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

int main() {
  long long N;
  vector<char> lst;
  cin >> N;

  long long n = N;
  string answer = "";
  long long amari = 0;
  
  for (long long i = 0; n > 0; i++) {
    
    n--;
    
    amari = n % 26;
    //cout << amari << endl;



    switch(amari) {
   	 case 0:
       answer = "a" + answer;
       break;
     case 1:
       answer = "b" + answer;
       break;
     case 2:
       answer = "c" + answer;
       break;
      case 3:
       answer = "d" + answer;
        break;
      case 4:
       answer = "e" + answer;
        break;
      case 5:
       answer = "f" + answer;
        break;
      case 6:
       answer = "g" + answer;
        break;
      case 7:
       answer = "h" + answer;
        break;
      case 8:
       answer = "i" + answer;
        break; 
      case 9:
       answer = "j" + answer;
        break;
      case 10:
       answer = "k" + answer;
        break;
      case 11:
       answer = "l" + answer;
        break;
      case 12:
        answer = "m" + answer;
        break;
      case 13:
        answer = "n" + answer;
        break;
      case 14:
        answer = "o" + answer;
        break;
      case 15:
        answer = "p" + answer;
        break; 
      case 16:
        answer = "q" + answer;
        break; 
      case 17:
        answer = "r" + answer;
        break; 
      case 18:
        answer = "s" + answer;
        break;
      case 19:
        answer = "t" + answer;
        break;
      case 20:
        answer = "u" + answer;
        break;
      case 21:
        answer = "v" + answer;
        break;
      case 22:
        answer = "w" + answer;
        break;
      case 23:
        answer = "x" + answer;
        break;
      case 24:
        answer = "y" + answer;
        break;
      case 25:
        answer = "z" + answer;
        break;
   }
    n = n / 26;

  }
  
  cout << answer  << endl;

   return 0;
}


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

using namespace std;

int main(void){
	int n;
	int a,b,c;
	int num[8],num2[10];
	string str;
	char ans[9],ans2[9];
	int max,min;
	cin >> n;
	for(c=0;c<n;c++){
		max=0,min=0;
		for(a=0;a<10;a++)num2[a]=0;
		cin >> str;
		for(a=0;a<8;a++)num[a]=str[a]-'0',ans[a]='\0',ans2[a]='\0';
		for(a=0;a<8;a++)num2[num[a]]++;
		a=9;
		b=0;
		while(a>=0){
			if(num2[a]>0)ans[b]=a+'0',num2[a]--,b++;
			else a--;
		}
		for(a=0;a<8;a++)ans2[7-a]=ans[a];
		max=atoi(ans);
		min=atoi(ans2);
		cout << max-min << endl;
	}
	return 0;
}

Measured memory_bytes: 0
eval"A,B,C,D="+`tr ' ' ,`
X=[s=0]*D*3
A.upto(C){|i|0.upto(D){|j|X<<s=1[i-A|j-B]+-2[j]*(s*i+X[~D]*j-X[-D-2]*~-i*~-j)%998244353}}
p s

Measured memory_bytes: 84660
#include<bits/stdc++.h>
#define ll long long int 
using namespace std;
int main()
{
      long double a,b,c;
       cin>>a>>b>>c;
    ll ok=0;
      long double e=1.0E-14;
        if((sqrt(a)+sqrt(b)+e)<sqrt(c))ok=1;
    printf(ok==1? "Yes\n":"No\n");
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.ArrayDeque;
public class Main {
    static int LIMIT = 200001;
    public static int[] sectionDiagrams = new int[LIMIT];
    public static void main (String[] args) {
	Scanner scan = new Scanner(System.in);
	char[] section = scan.nextLine().toCharArray();
	calculateDiagrams(section, 1);
	for (int i = 0; i < section.length; i++) {
	    if (section[i] == '\\') {
		section[i] = '/';
	    } else if (section[i] == '/') {
		section[i] = '\\';
	    }
	}
	calculateDiagrams(section, -1);
	ArrayDeque<Integer> diagrams = new ArrayDeque<Integer>();
	int sum = 0;
	for (int i = 0; i < LIMIT; i++) {
	    if (sectionDiagrams[i] != 0) {
		diagrams.add(sectionDiagrams[i]);
		sum += sectionDiagrams[i];
	    }
	}
	System.out.println(sum);
	System.out.print(diagrams.size());
	while (diagrams.size() != 0) {
	    System.out.print(" " + diagrams.poll());
	}
	System.out.println();
    }
    static void calculateDiagrams (char[] section, int direction) {
	boolean isIn = false;
	int outH = 0, nowH = 0;
	int sum = 0, inP = 0;
	int sp = 0;
	if (direction == -1) {
	    sp = section.length - 1;
	}
	for (int i = sp; i >=0 && i < section.length; i += direction) {
	    if (isIn == false) {
		if (section[i] == '\\') {
		    isIn = true;
		    outH = nowH;
		    nowH--;
		    inP = i;
		    sum = 1;
		} else if (section[i] == '/') {
		    nowH++;
		}
	    } else {
		if (section[i] == '\\') {
		    sum += outH - nowH + 1;
		    nowH--;
		} else if (section[i] == '/') {
		    nowH++;
		    sum += outH - nowH;
		} else if (section[i] == '_') {
		    sum += outH - nowH;
		}
		if (nowH == outH) {
		    if (direction == 1 && sectionDiagrams[inP] < sum) {
			sectionDiagrams[inP] = sum;
		    } else if (direction == -1 && sectionDiagrams[i] < sum){
			sectionDiagrams[i] = sum;
		    }
		    isIn = false;
		}
	    }
	}
    }
}

Measured memory_bytes: 30348
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
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; }
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

const ll MOD = 1e9+7;
const ll MAX_N = 3e6 + 10;
ll Inv[MAX_N];
ll fact[MAX_N];
ll factInv[MAX_N];
void Inv_init(){
    Inv[1] = 1;
    for(int i = 2; i < MAX_N; i++) {
        Inv[i] = Inv[MOD%i] * (MOD - MOD/i) % MOD;
    }
}
void fact_init(){
    fact[0] = fact[1] = factInv[0] = factInv[1] = 1;
    for(int i = 2; i < MAX_N; i++){
        fact[i] = (fact[i-1] * i) % MOD;
        factInv[i] = (factInv[i-1] * Inv[i])%MOD;
    }
}

// a^b % MOD;
ll powmod(ll a,ll b) {ll res=1;a%=MOD; for(;b;b>>=1){if(b&1)res=res*a%MOD;a=a*a%MOD;}return res;}
// 逆元 1/a % MOD
ll inversemod(ll a) { return powmod(a,MOD - 2);}

// 1 以上 N 以下の N 個の整数の中から，相異なる K 個の整数を選ぶパターンの数
ll nCr(int n,int r) {
    if(n < r) return 0;
    return (fact[n] * (factInv[r] * factInv[n-r] % MOD)) % MOD;
}
// 1 以上 N 以下の N 個の整数の中から，相異なる K 個の整数を選び，順番に並べるパターンの数
ll nPr(int n,int r){
    if(n < r) return 0;
    return (fact[n]*factInv[n-r])%MOD;
}
// 1 以上 N 以下の N 個の整数の中から，重複を許して K 個の整数を選ぶパターンの数
ll nHr(int n,int r){
    if(n == 0 && r == 0) return 1;
    return nCr(n+r-1,r);
}

void init(){
    Inv_init();
    fact_init();
}

ll solve(){
    init();
    ll res = 0;
    ll n,k; cin >> n >> k;
    if(n > k) return res;
    res = nCr(k,n);
    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    
    return 0;
}



Measured memory_bytes: 73476
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Main main = new Main();
        main.solve();
    }
    public void solve() throws Exception {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        long[] a_o = new long[N + 1];
        long[] a_f = new long[N + 1];
        long[] a_b = new long[N + 1];
        for (int i = 0; i < N + 1; i++) {
            a_f[i] = scan.nextLong();
            a_b[i] = a_f[i];
            a_o[i] = a_f[i];
        }
        long[] b_f = new long[N + 1];
        long[] b_b = new long[N + 1];
        for (int i = 0; i < N; i++) {
            b_f[i] = scan.nextLong();
            b_b[i] = b_f[i];
        }
        long answer = front(N, a_o, a_f, b_f);
        answer = Math.max(answer,back(N, a_o, a_f, b_f));
        System.out.println(answer);
    }
    private long front(int N, long[] o, long[] a, long[] b) {
        for (int i = 0; i < N; i++) {
            if (0 < b[i]) {
                if (b[i] < a[i]) {
                    a[i] -= b[i];
                    b[i] = 0;
                    continue;
                } else {
                    b[i] -= a[i];
                    a[i] = 0;
                }
            }
            if (b[i] < a[i+1]) {
                a[i+1] -= b[i];
                b[i] = 0;
            } else {
                b[i] -= a[i+1];
                a[i+1] = 0;
            }
        }
        long answer = 0;
        for (int i = 0; i < N + 1; i++) {
            answer += o[i] - a[i];
        }
        return answer;
    }
    private long back(int N, long[] o, long[] a, long[] b) {
        for (int i = N-1; 0 <= i; i--) {
            if (0 < b[i+1]) {
                if (b[i] < a[i+1]) {
                    a[i+1] -= b[i];
                    b[i] = 0;
                    continue;
                } else {
                    b[i] -= a[i+1];
                    a[i+1] = 0;
                }
            }
            if (b[i] < a[i]) {
                a[i] -= b[i];
                b[i] = 0;
            } else {
                b[i] -= a[i];
                a[i] = 0;
            }
        }
        long answer = 0;
        for (int i = 0; i < N + 1; i++) {
            answer += o[i] - a[i];
        }
        return answer;
    }
}


Measured memory_bytes: 88840
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define int ll
using pint = pair<int,int>;
using Graph = vector<vector<int>>;
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 1e10; //10^10
const double PI = acos(-1.0L);
/*mod逆元*/long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}
template< typename T >T mod_pow(T x, T n, T p=MOD) {T ret = 1;while(n > 0) {if(n & 1) (ret *= x) %= p;(x *= x) %= p;n >>= 1;}return ret;}
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 T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}

//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    double n; cin >> n;
    int ans = (int)(n/1.08);
    if(ans*1.08==n) out(ans);
    else if((int)((ans+1)*1.08)==n) out(ans+1);
    else out(":(");

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <random>
#include <chrono>
#include <tuple>
#include <random>
#include <cmath>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

const ll SIZE = 1e5 * 2 + 10, INF = 1e9 * 1e9 + 10;

int main()
{
    fastInp;

    ll a, b, c;
    cin >> a >> b >> c;
    ll d = (c - a - b);
    if (d > 0 && d * d > 4 * a * b) {
        cout << "Yes";
    } else {
        cout << "No";
    }
    return 0;
}

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

struct Node{
    int parent, left, right;
};

Node T[10000];
int n;

void pre(int u){
    if(u == -1){
        return;
    }
    
    cout << " " << u;
    pre(T[u].left);
    pre(T[u].right);
}

void ino(int u){
    if(u == -1){
        return;
    }
    
    ino(T[u].left);
    cout << " " << u;
    ino(T[u].right);
}

void pos(int u){
    if(u == -1){
        return;
    }
    
    pos(T[u].left);
    pos(T[u].right);
    cout << " " << u;
}

int main(){
    int i, v, l, r, rt;
    
    cin >> n;
    for(i = 0;i<n;++i){
        T[i].parent = -1;
    }
    
    for(i = 0;i<n;++i){
        cin >> v >> l >> r;
        T[v].left = l;
        T[v].right = r;
        if(l != -1){
            T[l].parent = v;
        }
        if(r != -1){
            T[r].parent = v;
        }
    }
    
    for(i=0;i<n;++i){
        if(T[i].parent == -1){
            rt = i;
        }
    }
    
    cout << "Preorder" << endl;
    pre(rt);
    cout << endl;
    
    cout << "Inorder" << endl;
    ino(rt);
    cout <<endl;
    
    cout << "Postorder" << endl;
    pos(rt);
    cout <<endl;
    
    return 0;
}


Measured memory_bytes: 3084
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
using namespace std;
int main() {
	string s;
	cin >> s;
	bool flag1 = false;
	for (int i = 0; i < s.size();i++) {
		if (s[i] == 'C')
			flag1 = true;
		if(flag1==true)
			if (s[i] == 'F') {
				cout << "Yes" << endl;
				return 0;
			}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
/*
 ABC148 D
 auther: takeheroaf
 created at 2020-1-10 10:10:21
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vc vector
#define a first
#define b second
#define pb push_back
#define INF (1000000000)
#define MOD (1000000007)
#define MAX (100000)

/////////////////////////////////////////////////////////

template<typename T1, typename T2>
void chmin(T1 &a, T2 b) {if(a > b) a = b;}
template<typename T1, typename T2>
void chmax(T1 &a, T2 b) {if(a < b) a = b;}

template<typename T1, typename T2>
ll mypow(T1 a, T2 n){
  if(n == 0) return 1;
  if(n == 1) return a;
  if(n % 2) return a * mypow(a, n - 1);
  ll tmp = mypow(a, n / 2);
  return tmp * tmp;
}

ll comb(ll n, ll r){
	ll res = 1;
  rep(i, 0, r){
    res *= n - i;
    res /= i + 1;
  }
  return res;
}

/////////////////////////////////////////////////////////

void Main(){
  int N; cin >> N;
  vc<int> A(N);
  rep(i, 0, N) cin >> A[i];
  int cur = 1;
  rep(i, 0, N){
    if(A[i] == cur){
      cur++;
    }
  }
  if(cur == 1){
    cout << -1 << endl;
  }else{
    cout << N - (cur - 1) << endl;
  }
  return;
}

/////////////////////////////////////////////////////////

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

  Main();

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define FOR(i, x, y) for (decay<decltype(y)>::type i = (x), _##i = (y); i < _##i; ++i)
#define FORD(i, x, y) for (decay<decltype(x)>::type i = (x), _##i = (y); i > _##i; --i)
#ifdef zerol
#define dbg(x...) do { cout << "\033[32;1m" << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
// -----------------------------------------------------------------------------

typedef pair<LL, LL> P;
typedef vector<P> VT;
const LL INF = 1E9;

struct E {
    LL pos;
    int t;
};

int main() {
    LL n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    n--; LL x = b - a;
    FOR (i, 0, n + 1) {
        if (x >= i * c - (n - i) * d && x <= i * d - (n - i) * c) {
            puts("YES");
            return 0;
        }
    }
    puts("NO");
}

Measured memory_bytes: 384
#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)

int main(){
    vector<ll> count(26, 0);
    char c;
    for(; (cin >> c);){
        if(!isalpha(c)){ continue; }
        if(isupper(c)){
            count.at(c - 'A')++;
        }else{
            count.at(c - 'a')++;
        }
    }
    REP(i, count.size()){
        cout << (char)((char)i + 'a') << " : " << count.at(i) << endl;
    }
    return 0;
}



Measured memory_bytes: 3092
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <vector>
#include <chrono>
#include <cstdlib>
#include <bitset>
using namespace std;
int main(){
    int x;
    cin >> x;
    if(x%10 == 2) cout << "hon" << endl;
    else if(x%10 == 4) cout << "hon" << endl;
    else if(x%10 == 5) cout << "hon" << endl;
    else if(x%10 == 7) cout << "hon" << endl;
    else if(x%10 == 9) cout << "hon" << endl;
    else if(x%10 == 0) cout << "pon" << endl;
    else if(x%10 == 1) cout << "pon" << endl;
    else if(x%10 == 6) cout << "pon" << endl;
    else if(x%10 == 8) cout << "pon" << endl;
    else cout << "bon" << endl;
}


Measured memory_bytes: 3608