akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>

using namespace std;
const int N=100005;
int a[N];

int main()
{
    int n;
    cin >> n;
    int k=0,h=0,s=0;
    for(int i=0;i<n;i++)
    {
        cin >> a[i];
        if(a[i]%4==0) k++;
        else if(a[i]%4==2) h++;
        else s++;
    }
    if((k>=s-1&&h==0)||(k>s-1)) printf("Yes\n");
    else printf("No\n");

    return 0;
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60
//struct edge {
//	int u;
//	int v;
//	int cost;
//	edge() {}
//	edge(int u, int v, int c) :u(u), v(v), cost(c) {}
//};

ll ans = INF;
void dfs(int n, int b, vector<int>& r, vector<vector<ll>>& G, int R,ll sum) {
	if (b == ((1 << R) - 1)) {
		ans = min(ans, sum);
		return;
	}
	for (int i = 0; i < R;i++) {
		if ((1 << i)&b) continue;
		dfs(r[i], b + (1 << i), r, G, R, sum + G[n][r[i]]);
	}
}
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
	ll N, M, R; cin >> N >> M >> R;
	vector<int> r(R);
	for (int i = 0; i < R;i++) { cin >> r[i]; r[i]--; }
	vector<vector<ll>> G(N, vector<ll>(N,INF));
	for (int i = 0; i < N;i++) G[i][i] = 0;
	for (int i = 0; i < M;i++) {
		ll A, B, C; cin >> A >> B >> C;
		A--; B--;
		G[A][B] = G[B][A] = C;
	}
	for (int i = 0; i < N;i++) {
		for (int j = 0; j < N;j++) {
			for (int k = 0; k < N;k++) {
				G[j][k] = min(G[j][k], G[j][i] + G[i][k]);
			}
		}
	}
	for (int i = 0; i < R;i++) {
		dfs(r[i], 1 << i, r, G, R, 0);
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 640
import fractions

test = ""
#test = \
"""
123 456
"""
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
    

a, b = map(int, input2().strip().split())
print(a * b // fractions.gcd(a, b))

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

int par[100010];
int treerank[100010];

void init(int n){
  for(int i=0; i<n; i++){
    par[i] = i;
    treerank[i] = 0;
  }
  return;
}

int find(int x){
  if(par[x] == x) return x;
  return par[x] = find(par[x]);
}

void unite(int x, int y){
  x = find(x);
  y = find(y);
  if(x == y) return;
  if(treerank[x] < treerank[y]){
    par[x] = y;
  }
  else{
    par[y] = x;
    if(treerank[x] == treerank[y]) treerank[x]++;
  }
}

bool same(int x, int y){
  return find(x) == find(y);
}

int main(){
  int N, M;
  cin >> N >> M;
  int p[N];
  for(int i=0; i<N; i++){
    cin >> p[i];
    p[i]--;
  }
  init(N);
  for(int i=0; i<M; i++){
    int x, y;
    cin >> x >> y;
    unite(x-1, y-1);
  }
  int ans = 0;
  for(int i=0; i<N; i++){
    if(same(i, p[i])) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define pb push_back
#define ll long long
#define l long
#define mk make_pair
#define fi first
#define se second
#define mod 1000000007
#define in insert
using namespace std;
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
  
    x = x % p;  // Update x if it is more than or  
                // equal to p 
  
    while (y > 0) 
    { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res*x) % p; 
  
        // y must be even now 
        y = y>>1; // y = y/2 
        x = (x*x) % p;   
    } 
    return res; 
} 
int main()
{

    ll n,i,j,ans=0;
    cin>>n;
    ll a[n+2];
    unordered_map<ll,ll> ma;
    for(i=1;i<=n;i++)
    {
    	cin>>a[i];
    	for(j=0;j<=60;j++)
    	{
    		if((a[i] >> (j)) & 1)
    		{
    			ma[j]++;
    		}
    	}
    }
    ll ta = n;
    for(i=1;i<=n;i++)
    {
    	ta--;
    	for(j=0;j<=60;j++)
    	{
    		if((a[i] >> (j)) & 1)
    		{
    			ma[j]--;
    		}
    	}
    	for(j=0;j<=60;j++)
    	{
    		if((a[i] >> (j)) & 1)
    		{
    			ans = (ans%mod + ((ta-ma[j])%mod * (power(2,j,mod))%mod)%mod)%mod;
    		}
    		else
    		{
    			ans = (ans%mod + (ma[j]%mod *(power(2,j,mod))%mod)%mod)%mod;
    		}
    	}
    }
    cout<<ans;
}

Measured memory_bytes: 2560
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n,d = mi()
dd = d**2
ans = 0
for i in range(n):
    x,y = mi()

    if x**2 + y**2 <= dd:
        ans += 1

print(ans)

Measured memory_bytes: 74516
#include<bits/stdc++.h>
#include <unistd.h>
using namespace std;
#define nl cout<<"\n"
#define pb push_back
#define se second
#define fi first
#define pi =3.14159265358979323846264338327950L;
typedef long long int ll;
int n;
int ar[100000][3];
int dp[100000][3];

int get(int ind, int last){
	if(ind==n) return 0;
	int ans=0;
	if(last!=-1){
		if(dp[ind][last]!=-1){
			return dp[ind][last];
		}
	}
	if(last>=0){
		for(int i=0;i<3;i++){
			if(i!=last){
				ans=max(ans,ar[ind][i]+get(ind+1,i));
			}
		}
	}
	else{
		for(int i=0;i<3;i++){
			ans=max(ans,ar[ind][i]+get(ind+1,i));
		}
	}
	dp[ind][last]=ans;
	return ans;
}

int main(){
	ios_base :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	//freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>ar[i][0]>>ar[i][1]>>ar[i][2];
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
				dp[i][j]=-1;
		}
	}
	cout<<get(0,-1);
    return 0;
}


Measured memory_bytes: 10368
def main():
    N = input()
    ans = "000"

    if len(N) == 1:
        ans = "ABC00" + N
    elif len(N) == 2:
        ans = "ABC0" + N
    else:
        ans = "ABC" + N

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
X=int(input())
if (400<=X<=599): print('8')
if (600<=X<=799): print('7')
if (800<=X<=999): print('6')
if (1000<=X<=1199): print('5')
if (1200<=X<=1399): print('4')
if (1400<=X<=1599): print('3')
if (1600<=X<=1799): print('2')
if (1800<=X<=1999): print('1')

Measured memory_bytes: 9192
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
int main(){
  string s; cin >> s;
  vector<long long> d(4, 0); d[0] = 1;
  for (int i = 0; i < (int) s.size(); i++) {
    if (s[i] == 'A') {
      d[1] += d[0]; d[1] %= mod;
    } else if (s[i] == 'B') {
      d[2] += d[1]; d[2] %= mod;
    } else if (s[i] == 'C') {
      d[3] += d[2]; d[3] %= mod;
    } else {
      d[3] = d[3] * 3 + d[2]; d[3] %= mod;
      d[2] = d[2] * 3 + d[1]; d[2] %= mod;
      d[1] = d[1] * 3 + d[0]; d[1] %= mod;
      d[0] = d[0] * 3; d[0] %= mod;
    }
  }
  cout << d[3] << endl;
  return 0;
}


Measured memory_bytes: 768
# GRL_4_B: Topological Sort
import sys


# input
v, e = map(int, sys.stdin.readline().strip().split())
G = [[] for _ in range(v)]
indeg = [0] * v
for i in range(e):
    s, t = map(int, sys.stdin.readline().strip().split())
    G[s].append(t)
    indeg[t] += 1
# print('G : {}\nindeg : {}'.format(G, indeg))

# calc
ans = []


def dfs(u):
    if indeg[u] == 0:
        ans.append(u)
        for i in G[u]:
            indeg[i] -= 1
            dfs(i)


indeg_start = indeg.copy()
for i in range(v):
    if indeg_start[i] == 0:  # 入ってくる辺がない = 最初のノードからスタート
        dfs(i)

# print(indeg)
for i in ans:
    print(i)


Measured memory_bytes: 8876
/*
*          Name : chaitanya
*
*     Institute : ANITS,Visakhapatnam
*
*/
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define mod  1e9+1
#pragma GCC optimization ("O3")
using namespace std;
const long long int N = 6999999;
#define all(x) begin(x),end(x)
int main()
{
 
  // freopen("input.txt","r",stdin);
  // freopen("output.txt","w",stdout);
  //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 int n;
 cin >> n;
 vector <int> v(n);
 int ans = 0;
 for (int i = 0; i < n; ++i)
 {
  cin >> v[i];
 }
 
 for (int i = 1; i < n-1; ++i)
 {
  int a[3] = {v[i-1],v[i],v[i+1]};
  sort(a,a+3);
  if (a[0] < v[i] && a[2] > v[i])
  {
    ans++;
  }
 }
 cout << ans;
  return 0;
}


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

using namespace std;

#define MP make_pair
#define PB push_back
#define f first
#define s second

typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef vector<int> vi;

//int dr1[] = {-1, 0, 1, 0};
//int dc1[] = {0, 1, 0, -1};
//int dr3[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
//int dc3[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
const int MOD = 1000000007;
const int INF = 1000000007;

ll modx(ll a)
{
    return (a%MOD+MOD)%MOD;
}

ll times(ll a, ll b)
{
    return modx(modx(a)*modx(b));
}

ll add(ll a, ll b)
{
    return modx(modx(a)+modx(b));
}

ll sub(ll a, ll b)
{
    return modx(MOD+modx(a)-modx(b));
}

ll fastExp(ll base, ll exp)
{
    if(exp == 0LL)
    {
        return 1LL;
    }

    if(exp%2==0)
    {
        return fastExp(times(base, base), exp/2);
    }
    else
    {
        return times(base, fastExp(times(base, base), exp/2));
    }
}


const int MAXN = (int)1e5+1;
int N, ans[MAXN], siz[MAXN];
int max_node = -1, max_num = -1;

vector<vector<int>> tree;
map<pii, int> m;
bool seen[MAXN];

void bfs(int st)
{
    queue<pii> q;

    q.push({st, 0});
    while(!q.empty())
    {
        //cout << "ran\n";
        int x = q.front().f;
        int col = q.front().s;
        q.pop();
        seen[x] = true;
        for(int i=0; i<tree[x].size(); i++)
        {
            if(!seen[tree[x][i]])
            {
                col = (col+1)%max_num;
                ans[m[{x, tree[x][i]}]] = col;
                q.push({tree[x][i], col});
            }
        }
    }
}

int main()
{
    //freopen("input.in","r",stdin);
    //freopen("output.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> N;
    tree.resize(N);
    for(int i=0; i<N-1; i++)
    {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        tree[x].PB(y);
        tree[y].PB(x);
        siz[x]++;
        siz[y]++;
        m[{x, y}] = m[{y, x}] = i;
    }

    for(int i=0; i<N; i++)
    {
        if(siz[i] > max_num)
        {
            max_node = i;
            max_num = siz[i];
        }
    }

    bfs(max_node);
    cout << max_num << "\n";
    for(int i=0; i<N-1; i++)
    {
        cout << ans[i]+1 << "\n";
    }
    return 0;
}



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

int main() {
  int a,b,ans = 1;
  cin >> a >> b;
  if(b == 1){
    cout << 0 << endl;
    return 0;
  }
  for(int i = 1;i*a-i+1 < b;i++){
    ans++;
  }
  cout << ans << endl;
}


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

using namespace std;
using namespace std;
#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
//rep…「0からn-1まで」の繰り返し
#define rep2(i,s,n) for(long long i=s; i<=(long long)(n);i++)
//rep2…「sからnまで」の繰り返し
#define repr(i,s,n) for(long long i=s;i>=(long long)(n);i--)
//repr…「ｓからnまで」の降順の繰り返し

typedef long long ll;

const ll inf = 1e9+7;
const ll mod = 1e9+7;

int main(){
    int n,m,x;
    cin>>n>>m>>x;

    vector<int>c(n);
    vector<vector<int>>a(n,vector<int>(m));

    ll mincost=inf;

    rep(i,n){
        cin>>c[i];
        rep(j,m){
            cin>>a[i][j];
        }
    }

    rep(i,1<<n){
        ll cost=0;
        vector<int>d(m,0);
        rep(j,n){
            if(i&(1<<j)){
                cost+=c[j];
                rep(k,m)d[k]+=a[j][k];
            }
        }

        bool jdg=true;

        rep(j,m){
            if(d[j]<x)jdg=false;
        }

        if(jdg)mincost=min(mincost,cost);
    }

    if(mincost==inf)cout<<-1<<endl;
    else cout<<mincost<<endl;

}



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

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr(i,n) for(int i=(int)(n-1);i>=0;i--)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout << #x" = " << x << endl
#define print(x) cout << x << endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<int, P> PIP;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;
typedef set<int> S;

#define INF INT_MAX/3
#define MAX_N 1000000001


int main(){
    cin.sync_with_stdio(false);
    int a, b;
    cin >> a >> b;

    if ((a < 0 && b > 0) || a == 0 || b == 0) {
        cout << "Zero" << endl;
    } else if (a > 0) {
        cout << "Positive" << endl;
    } else {
        if ((b - a) % 2 == 1) cout << "Positive" << endl;
        else cout << "Negative" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
#define TM_T template <class T>
using namespace std;
typedef long long ll;
TM_T T inp(){T it;cin >> it;return it;}

int N, K;
vector<ll> a;
vector<ll> b;

int input(){
  cin >> N >> K;
  REP(i,N) a.push_back( inp<ll>() );
}

int main()
{
  input();
  
  REP(i,N+2) b.push_back( INF );
  b[0] = 0;
  
  REP(i,N){
    REP(j,K) b[i+j+1] = min(b[i+j+1],b[i]+abs(a[i+j+1]-a[i]));
  }
  cout << b[N-1] << endl;
}

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

#define full(x,n) x,x+n+1
#define full(x) x.begin(),x.end()
#define finish return 0

#define putb push_back
#define f first
#define s second

#define putf push_front
#define gainb pop_back

#define gainf pop_front
#define len(x) x.size()

// 1/b%mod=b^(m-2)%mod

typedef double db;
typedef long long ll;

const ll ary=1e5+5;
const ll inf=1e18;

using namespace std;
ll n,k,a[ary];
int main(){
	cin>>n>>k;
	ll ans=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		if(a[i]>=k){
			ans++;
		}
	}
	cout<<ans;
}

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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()

int main(){
    string s;
    cin >> s;
    ll k;
    cin >> k;
    
    auto count = [](string s){
        ll c = 0;
        rep(i, (ll)s.size()-1){
            if(s[i]==s[i+1]){
                if(i+2<s.size()){
                    if(s[i+1]==s[i+2]) ++i; 
                }
                ++c;
            }
        }
        return c;
    };

    string s0 = s, s1 = s+s, s2 = s+s+s, s3 = s+s+s+s;
    ll c0 = count(s0);
    ll c1 = count(s1);
    ll c2 = count(s2);
    ll c3 = count(s3);

    if(k==1) cout << c0 << endl;
    else if(k==2) cout << c1 << endl;
    else if(k%2==0) cout << (c1 + (c3-c1)*(k/2-1)) << endl;
    else cout << (c0 + (c2-c0)*(k/2)) << endl;
}


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

// dump macro{{{
// http://www.creativ.xyz/dump-cpp-652
#define DUMPOUT cerr // 変数ダンプ先。coutかcerr

#ifdef PCM
// 引数はいくつでもどんな型でも可（ストリーム出力演算子があればOK）
#define dump(...) DUMPOUT<<"  "; \
  DUMPOUT<<#__VA_ARGS__; \
  DUMPOUT<<":=> "; \
  dump_func(__VA_ARGS__); DUMPOUT<<"in ["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl;
#define dump_1d(x,n) DUMPOUT <<"  " \
  <<#x<<"["<<#n<<"]"<<":=> {"; \
  rep(i,n){ DUMPOUT << x[i] << (((i)==(n-1))?"}":", "); } DUMPOUT <<" in [" << __LINE__ << "]" << endl;

#define dump_2d(x,n,m) DUMPOUT <<"  " \
    <<#x<<"["<<#n<<"]"<<"["<<#m<<"]"<<":=> \n"; \
    rep(i,n)rep(j,m){ DUMPOUT << ((j==0)?"     |":" ") << x[i][j] << (((j)==(m-1))?"|\n":" "); } \
    DUMPOUT <<"  in [" << __LINE__ << "]" << endl;
#else
#define dump(...) 42
#define dump_1d(...) 42
#define dump_2d(...) 42
#endif

// デバッグ用変数ダンプ関数
void dump_func() {
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail)
{
    DUMPOUT << head;
    if (sizeof...(Tail) == 0) {
        DUMPOUT << " ";
    }
    else {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}

// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec) {
    os << "{";
    for (int i = 0; i<vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}/*}}}*/

#define rep(i, x) for(int i = 0; i < (int)(x); i++)/*{{{*/
#define reps(i,x) for(int i = 1; i <= (int)(x); i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i >= n;i--)
#define foreach(x,a) for(auto& (x) : (a) )
#define all(x) (x).begin(),(x).end()
#define sum(v) accumulate(all(v), 0)
#define sz(x) ((int)(x).size())
#define fill(x,y) memset(x,y,sizeof(x))
#define pb(a) push_back(a)
#define INF 2147483647
#define INFLL 1000000000000000000LL
#define MOD 1000000007/*}}}*/

struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;/*{{{*/
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<vii> vvii;
typedef tuple<int,int,int> iii;
typedef set<int> si;
typedef complex<double> pnt;
typedef vector<pnt> vpnt;
typedef priority_queue<pii,vii,greater<pii> > spq;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

/*}}}*/

// global variables

ll dp[101][10001];

int main() {
  ll n;cin>>n;
  ll s[n];
  rep(i,n)cin>>s[i];

  dp[0][s[0]] = 1;
  dp[0][0] = 1;
  rep(i,n-1){
    rep(j,10001){
      dp[i+1][j] += dp[i][j];
      dp[i+1][j+s[i+1]] += dp[i][j];
    }
  }

  int res = 0;
  rep(j, 10001){
    if (dp[n-1][j]>0 and j%10){
      res = max(res, j);
    }
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 8064
program sample
    implicit none
    
    integer(8) :: a,b,c,i,j,m,n,k,a1,b1,c1
    integer(8), allocatable  ::x(:) 

    read(*,*) n
  
    allocate(x(n))
    read(*,*) x
    do i=1,n
        x(i)=x(i)*1000000+i
    end do
    call msort(x)
    do i=1,n
        write(*,*)mod(x(i),1000000)
    end do
   
    deallocate(x)
    stop

    contains

    recursive subroutine msort(x)
    implicit none
    integer(8), intent(inout) :: x(:)
 
    integer(8) :: n, mid, i, j, k
    integer(8), allocatable :: tmp(:)
    
    n = size(x)
    
    if(n == 1) then
      return
    end if
 
    !
    ! 前半と後半に分けてソート
    ! 1~midとmid+1~nをそれぞれソート済みにする
    !
    mid = n / 2
    call msort(x(:mid))
    call msort(x(mid+1:))
 
    !
    ! tmpという配列にxを一時的に保管
    ! マージソートは外部ソート
    !
    allocate(tmp(n))
    tmp = x
 
    ! tmpの後半部分を左右反転
    do k = n, mid+1, -1
      tmp(k) = x(mid + n - k + 1)
    end do
 
    ! iは前半のリストのうちまだ見ていないものの最小値
    ! jは後半のリストのうちまだ見ていないものの最小値
    ! kは見た回数の合計
    i = 1
    j = n
 
    do k = 1, n
      !
      ! 一番左と一番右のうち小さい方をxに入れていく
      ! ここが等号つき不等号なので、安定ソートとなる
      !
      if(tmp(i) <= tmp(j)) then
        x(k) = tmp(i)
        i = i + 1
      else
        x(k) = tmp(j)
        j = j - 1
      end if
    end do
    
    deallocate(tmp)
    return
  end subroutine msort
end program sample
  



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

struct node{
    int key;
    struct node *right, *left, *parent;
};

struct node *root, *NIL;

struct node * treeMinimum(struct node *x){
    while(x->left != NIL){
        x=x->left;
    }
    return x;
}

struct node * find(struct node *u, int k){
    while(u != NIL && k != u->key){
        if(k < u->key){
            u=u->left;
        }
        else{
            u=u->right;
        }
    }

    return u;
}

struct node * treeSuccessor(struct node *x){
    if(x->right != NIL){
        return treeMinimum(x->right);
    }
    struct node *y = x->parent;
    while(y!=NIL && x==y->right){
        x=y;
        y=y->parent;
    }

    return y;
}

void treeDelete(struct node *z){
    struct node *y;
    struct node *x;

    if(z->left == NIL || z->right == NIL){
        y=z;
    }else{
        y=treeSuccessor(z);
    }

    if(y->left != NIL){
        x=y->left;

    }
    else{
        x=y->right;
    }

    if(x != NIL){
        x->parent = y->parent;
    }

    if(y->parent==NIL){
        root = x;
    }
    else{
        if(y==y->parent->left){
            y->parent->left=x;
        }
        else{
            y->parent->right=x;
        }
    }

    if(y!=z){
        z->key=y->key;
    }


    free(y);


}

void insert(int k){
    struct node *y = NIL;
    struct node *x = root;
    struct node *z;

    z = (struct node *)malloc(sizeof(struct node));
    z->key=k;
    z->left=NIL;
    z->right=NIL;

    while(x != NIL){
        y=x;
        if(z->key < x->key){
            x=x->left;
        }
        else{
            x=x->right;
        }
    }

    z->parent=y;
    if(y==NIL){
        root=z;
    }else{
        if(z->key < y->key){
            y->left=z;
        }
        else{
            y->right=z;
        }
    }
}

void inorder(struct node *u){
    if(u==NIL){
        return;
    }
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(struct node *u){
    if(u==NIL){
        return;
    }
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(void){
    int n, i, x;
    char com[10];
    scanf("%d", &n);

    for(int i=0; i<n; i++){
        scanf("%s", com);
        if(com[0]=='f'){
            scanf("%d", &x);
            struct node *t = find(root, x);
            if(t!=NIL){
                
                printf("yes\n");
            }
            else{
                printf("no\n");
            }
        }
         else if(com[0]=='i'){
            scanf("%d", &x);
            insert(x);
        }
        else if(com[0]=='p'){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
        else if(com[0]=='d'){
            scanf("%d", &x);
            treeDelete(find(root, x));
        }
       
    }
    return 0;
}


Measured memory_bytes: 20600
/*
 * Author: FreeIdea
 * Created Time:  2011/8/31 12:42:48
 * File Name: I.cpp
 */
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <vector>
using namespace std;
const int maxint = -1u>>1;
template <class T> bool get_max(T& a, const T &b) {return b > a? a = b, 1: 0;}
template <class T> bool get_min(T& a, const T &b) {return b < a? a = b, 1: 0;}

int n, m, sum;

int main() {
    while(scanf("%d", &n) == 1 && n) {
        m = n * (n - 1) / 2;
        sum = 0;
        for(int i = 1; i <= m; i++) {
            int val;
            scanf("%d", &val);
            sum += val;
        }
        printf("%d\n", sum / (n - 1));
    }
    return 0;
}

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

using namespace std;
using ll = long long;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;
  ll md = 1e9 + 7;

  ll cur = 1;
  for (int i = 0; i < n; ++i) {
    cur = cur * (i + 1) % md;
  }

  cout << cur << '\n';

  return 0;
}

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

#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
  rd(int, r, m, x);
  int lo = 0, hi = 0;
  rep(i, m) {
    rd(int, a);
    (a < x ? lo : hi)++;
  }
  wt(min(lo, hi));
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std; 
int main() 
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);  
  long long a,b;cin>>a>>b;
  if(a>=10)cout<<b;
  else cout<<b+(100*(10-a));
 return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n; cin >> n;
  unordered_map<int, int> cnt;
  for (int i = 0; i < n; i++) {
    int a; cin >> a;
    (cnt.find(a) != cnt.end()) ? cnt[a]++ : cnt[a] = 1;
  }
  int res = 0;
  for (auto vc : cnt) {
    int v = vc.first;
    int c = vc.second;
    res += (c < v) ? c : c - v;
  }
  cout << res << '\n';
  return 0;
}

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

typedef pair <int, int> pii;
typedef long long LL;
const int N = 5007;
const int M = 202;

LL G[N][N], D[N];
int b[M][N], l[N], n, m;
stack <pii> st;

inline void add(int l, int m, int r, int val) {
  G[l][m] += val;
  G[l][r + 1] -= val;
  G[m + 1][m] -= val;
  G[m + 1][r + 1] += val;
}

int main() {
  scanf("%d%d", &n, &m);
  for (int i = 2; i <= n; i ++) {
    scanf("%lld", &D[i]);
    D[i] += D[i - 1];
  }
  for (int i = 1; i <= n; i ++)
    for (int j = 1; j <= m; j ++) scanf("%d", &b[j][i]);
  for (int j = 1; j <= m; j ++) {
    while (!st.empty()) st.pop();
    st.push(make_pair(0, 2e9));
    for (int i = 1; i <= n; i ++) {
      while (st.top().second < b[j][i]) st.pop();
      l[i] = st.top().first + 1;
      st.push(make_pair(i, b[j][i]));
    }
    while (!st.empty()) st.pop();
    st.push(make_pair(n + 1, 2e9));
    for (int i = n; i >= 1; i --) {
      while (st.top().second <= b[j][i]) st.pop();
      add(l[i], i, st.top().first - 1, b[j][i]);
      st.push(make_pair(i, b[j][i]));
    }
  }
  LL ans = 0;
  for (int i = 1; i <= n; i ++)
    for (int j = 1; j <= n; j ++) {
      G[i][j] += G[i - 1][j] + G[i][j - 1] - G[i - 1][j - 1];
      if (i <= j) ans = max(ans, D[i] - D[j] + G[i][j]);
    }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 199808
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long long llong;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

int n, m;
multiset<int> ss;

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n;
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		ss.insert(x);
	}
	cin >> m;
	for (int i = 0; i < m; ++i) {
		int x;
		cin >> x;
		auto it = ss.find(x);
		if (it == ss.end()) {
			cout << "NO\n";
			return 0;
		}
		ss.erase(it);
	}
	cout << "YES\n";
	return 0;
}




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

int main(){
    int N, W;
    cin >> N >> W;
    vector<int> v(N), w(N);
    for (int i = 0; i < N; i++) {
        cin >> v[i] >> w[i];
    }

    int dp[N+1][W+1];
    // DPテーブルの初期化
    for (int j = 0; j <= W; j++) {
        dp[0][j] = 0;
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            if(j >= w[i]){
                dp[i+1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
            }else{
                dp[i+1][j] = dp[i][j];
            }
        }
    }
    cout << dp[N][W] << endl;
}




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

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define ALL(v) v.begin(), v.end()

const int MAX = 111;

int N;
int W[MAX];

int solve() {
    int allsum = 0;
    REP (i, N) allsum += W[i];

    int ans = allsum, sum = 0;
    REP (i, N) {
        sum += W[i];
        ans = min(ans, abs(allsum - 2 * sum));
    }
    return ans;
}

int main() {
    cin >> N;
    REP (i, N) cin >> W[i];
    cout << solve() << endl;
}

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

using namespace std;

int main(){
  int n,m; cin >> n >> m;
  vector<int> a(m);
  for(int i=0;i<m;i++){
    cin >> a[i];
  }
  //dp[i]はi段目にたどり着くまでの移動方法
  //dpテーブルを-1で初期化
  long long dp[n+1];
  for(int i=0;i<n+1;i++){
    dp[i]=-1;
  }
  //0段目は1通りとする。
  dp[0]=1;
  //壊れている段は0で初期化
  for(int i=0;i<m;i++){
    dp[a[i]]=0;
  }
  //1段目が壊れていなければ、dp[1]=1
  if(dp[1]!=0){
    dp[1]=1;
  }
  for(int i=0;i<n-1;i++){
    if(dp[i+2]==0){
      dp[i+2]=0;
    }
    else{
      dp[i+2]=dp[i+1]+dp[i];
    }
    dp[i+2]%=1000000007;
  }
  cout << fixed << setprecision(10);
  cout << dp[n] << endl;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,i,j,biggest=0;
	long long sum=0;
	cin>>n;const int MAX=20;
	vector<int> ago(MAX,-1);
	for(i=0;i<n;i++)
	{
		int x;
		cin>>x;
		for(j=0;j<MAX;j++)
		{
			if(x&(1<<j))
			{
				biggest=max(biggest,ago[j]+1);
				ago[j]=i;
			}
		}
		sum=sum+i-biggest+1;
	}
	cout<<sum<<endl; 
	return 0;
}

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

int main() {
    int n, m;
    cin >> n >> m;
    priority_queue<int> q;
    rep(i,n) {
        int a;
        cin >> a;
        q.push(a);
    }
    rep(i,m) {
        int max = q.top(); q.pop();
        q.push(max/2);
    }
    ll ans = 0;
    rep(i,n) {
        ans += q.top(); q.pop();
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 892
s=input()
s=s.replace("BC","D")
s=s.replace("B","E")
s=s.replace("C","E")
s=s.split("E")

t=[]
for ss in s:
  if len(ss)!=0:
    t.append(ss)
ans=0

for tt in t:
  d_cnt=0
  for i,ttt in enumerate(tt):
    if ttt=="D":
      ans+=i-d_cnt
      d_cnt+=1
print(ans)

Measured memory_bytes: 5584
// https://atcoder.jp/contests/abc160/tasks/abc160_a
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
  private static class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
      reader = new BufferedReader(new InputStreamReader(in));
      tokenizer = null;
    }

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

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

      return tokenizer.nextToken("\n");
    }

    public long nextLong() {
      return Long.parseLong(next());
    }

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

    public double nextDouble() {
      return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
      int[] a = new int[n];
      for (int i = 0; i < n; i++)
        a[i] = nextInt();
      return a;
    }

    public long[] nextLongArray(int n) {
      long[] a = new long[n];
      for (int i = 0; i < n; i++)
        a[i] = nextLong();
      return a;
    }
  }

  public static void main(String[] args) {
    FastScanner sc = new FastScanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int[] a = sc.nextIntArray(n);
    StringBuilder sb = new StringBuilder();
    for (int i = k; i < n; i++) {
      if (sb.length() > 0) sb.append("\n");
      if (a[i] > a[i - k]) sb.append("Yes");
      else sb.append("No");
    }
    System.out.println(sb.toString());
  }
}

Measured memory_bytes: 55712
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

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

    string s;
    int k;
    cin>>s>>k;
    for(int i=0;i<s.size();i++){
        if(s[i]=='a' && i!=s.size()-1)continue;
        else if(k>='z'-s[i]+1){
            k-='z'-s[i]+1;
            s[i]='a';
        }
        if(i==s.size()-1){
            k%=26;
            s[i]+=k;
        }
    }
    cout<<s<<endl;

}

Measured memory_bytes: 592
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
typedef long long LL;
typedef long double LD;
typedef pair<LL, LL> PLL;
typedef pair<LD, LL> PDL;
typedef pair<LD, LD> PDD;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
//typedef boost::multiprecision::cpp_int bigint;

template<class T>
void in(T& x) {
	cin >> x;
}

template<class T1,class T2>
void in(pair<T1, T2>& p) {
	in(p.first);
	in(p.second);
}

template<class T>
void in(vector<T>& v,LL st=-1,LL en=-1) {
	if (st == -1) {
		st = 0;
		en = v.size() - 1;
	}
	for (LL n = st; n <= en; n++) {
		in(v[n]);
	}
}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	LL N, M;
	cin >> N >> M;
	vector<PLL> drinks(N);
	in(drinks);
	sort(drinks.begin(), drinks.end(), [](PLL a, PLL b) {
		return a.first < b.first;
	});
	LL ans = 0;
	LL co = 0;
	for (LL n = 0; n < N; n++) {
		LL a = drinks[n].first;
		LL b = drinks[n].second;
		if (co + b <= M) {
			ans += a * b;
			co += b;
		}
		else {
			ans += a * (M - co);
			co += M - co;
		}
		if (co == M)break;
	}
	cout << ans << "\n";
	return 0;
}

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

int main() {
  

  // ここにプログラムを追記
  char c;
  cin >> c;
  
  if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int a,b,c;
  cin >> a >> b >> c;
  int ans = 0;
  ans = ans + min(b/a,c);
  cout << ans << "\n";
  return 0;
}

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

template <class T>
T Vec(T v) { return v; }

template <class T, class... Ts>
auto Vec(size_t l, Ts... ts) {
    return std::vector<decltype(Vec<T>(ts...))>(l, Vec<T>(ts...));
}

const int INF = 1 << 28;

int main() {
    int N, M;
    std::cin >> N >> M;

    int ans = 0;
    std::vector<int> deg(N, 0);
    auto dist = Vec<int>(N, N, INF);

    for (int v = 0; v < N; ++v) dist[v][v] = 0;
    for (int i = 0; i < M; ++i) {
        int u, v, d;
        std::cin >> u >> v >> d;
        ++deg[u], ++deg[v];
        ans += d;
        if (d < dist[u][v]) dist[u][v] = dist[v][u] = d;
    }

    // Warshall-Floyd
    for (int k = 0; k < N; ++k) {
        for (int u = 0; u < N; ++u) {
            for (int v = 0; v < N; ++v) {
                dist[u][v] = std::min(dist[u][v], dist[u][k] + dist[k][v]);
            }
        }
    }

    int S = 0;  // 次数が奇数の頂点集合
    for (int v = 0; v < N; ++v) {
        if (deg[v] & 1) S += (1 << v);
    }

    // 最小マッチング
    std::vector<int> dp(1 << N, INF);
    dp[S] = 0;
    for (int b = S; b > 0; b = ((b - 1) & S)) {
        if (__builtin_popcount(S) & 1) continue;

        for (int i = 0; i < N; ++i) {
            if (((b >> i) & 1) == 0) continue;
            for (int j = i + 1; j < N; ++j) {
                if (((b >> j) & 1) == 0) continue;
                // iとjをマッチング
                dp[b - (1 << i) - (1 << j)] = std::min(dp[b - (1 << i) - (1 << j)], dp[b] + dist[i][j]);
            }
        }
    }

    std::cout << ans + dp[0] << std::endl;
    return 0;
}



Measured memory_bytes: 3216
#include <stdio.h>
#define MAX 10

int* sort(int* hill){
	int i,j,temp;
	
	for(i = 0; i < MAX; i++){
		for(j = 0; j < MAX - i - 1; j++){
			if(hill[j] > hill[j + 1]){
				temp = hill[j];
				hill[j] = hill[j + 1];
				hill[j + 1] = temp;
			}
		}
	}
	return hill;
}

int main(){
	int hill[MAX],i;
	for(i = 0; i < MAX; i++)
		scanf("%d", &hill[i]);
	
	sort(hill);
	
	for(i = 0; i < 3; i++){
		printf("%d\n", hill[MAX - 1 - i]);
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
#define ALL(obj) (obj).begin(),(obj).end()
#define sortall(obj) sort(ALL(obj))
#define revall(obj) reverse(ALL(obj))
#define SortRevAll(obj) revall(sortall(obj))
typedef string str;
typedef long long ll;
const int mod=1e9+7;
const int INF=1e9;
const ll LINF=1e18;
#define V vector
#define P pair
#define F first()
#define S second()
#define PB(a) push_back(a)
#define IN(a) insert(a)
#define ins(a) int a;cin >> a
#define lls(a) ll a;cin >> a
#define in(a) cin >> a
#define sts(a) string (a);cin >> a
#define For(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) For(i,0,n)
#define Forr(i,m,n) for(int i=n-1;i>=m;i--)
#define repr(i,n) Forr(i,0,n)
#define print(a) cout << a << endl
#define Endl cout << endl
#define YES(n) cout << ((n)? "YES" : "NO") << endl
#define Yes(n) cout << ((n)? "Yes" : "No") << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE" ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

bool check(str s)
{
    if(s.size()%2){
        return false;
    }else{
        string p=s.substr(0,s.size()/2),q=s.substr(s.size()/2,s.size()/2);
        if(p==q){
            return true;
        }else{
            return false;
        }
    }
}

int main(){
    ins(a);ins(b);ins(c);
    Yes((a<=c)&&(b>=c));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

using ll = long double;
const ll pi = 3.14159265358979323846264338327950L;

int main(void) {
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    ll rad = pi * 2 * ((ll)h / 12.0 + ((ll)m / 60.0) / 12.0 - (ll)m / 60.0);
    ll rsq = (ll)(a*a + b*b) - (ll)(2*a*b) * cosl(rad);
    cout << fixed << setprecision(16) << sqrtl(rsq) << endl;
}


Measured memory_bytes: 4156
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
using namespace std;

int main(void) {
	int x = 0, i, m = 0, n;
	string s;
	cin >> n >> s;

	for (i = 0; i < n; i++) {
		if (s[i] == 'I') {
			x++;
		}
		else {
			x--;
		}
		m = max(m, x);
	}
	cout << m << endl;
	return 0;
}

Measured memory_bytes: 256
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = getLine >> getList >>= print . f . sort

f (a:b:c) = a + f c
f [] = 0


Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) FOR(i,0,b)
#define INF 1e18
#define dump(x) cerr<<#x<<"="<<x<<endl
#define all(a) (a).begin(),(a).end()
typedef pair<int,int> P;
template <class T> void chmin(T & a, T const & b) { if (b < a) a = b; }
template <class T> void chmax(T & a, T const & b) { if (b > a) a = b; }
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
using ll = long long;
const ll mod = LLONG_MAX;


int a,b;
int main(){
    cin>>a>>b;
    cout<<max({a*2-1,b*2-1,a+b})<<endl;;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,ans=0;
int num[100011];
int main()
{
	cin >>n;
	for(int i=0;i<n;i++)
	{
		int x;
		cin >>x;
		num[x-1]++;
		num[x]++;
		num[x+1]++;
	}
	for(int i=0;i<100011;i++)
	ans=max(ans,num[i]);
	cout <<ans<<endl;
	return 0;
}


Measured memory_bytes: 640
/*
author:Manson
date:7.7.2018
theme:
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int N = 105;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,m,x,y;
	cin>>n>>m>>x>>y;
	int a[N],b[N];
	for(int i = 0;i < n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	for(int j =0;j < m;j++){
		cin>>b[j];
	}
	sort(b,b+m);
	if(a[n-1]<b[0] && x < y && x<b[0] && y >a[n-1]){
		cout<<"No War"<<endl;
	}
	else{
		cout<<"War"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <memory.h>

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

#define mod 1000000007

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

Measured memory_bytes: 256
#include<stdio.h>

int main (void){

    int n,a;
    int h,i,j,k;

    while(scanf("%d",&n) != EOF){

        int b = 0;

        for(h=0;h<10;h++){
            for(i=0;i<10;i++){
                for(j=0;j<10;j++){
                    for(k=0;k<10;k++){
                        a = h + i + j + k;
                        if(a == n)
                            b++;

                    }
                }
            }
        }

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

    }
    return 0;
}

Measured memory_bytes: 596
a,b = list(map(int,input().split()))
str_a = ""
str_b = ""
for i in range(b):
    str_a += str(a)
for i in range(a):
    str_b += str(b)

if str_a >= str_b:
    print(str_b)
else:
    print(str_a)







Measured memory_bytes: 2940
#include<stdio.h>
int main()
{
	int W, H, x, y, r;
	scanf("%d %d %d %d %d\n", &W, &H, &x, &y, &r);
	if (0 <=x - r && x + r <=W && 0 <=y - r && y + r <=H)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 588
/*
AuThOr GaRyMr
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	int n;
	string s[55];int t[55];
	cin>>n;
	rb(i,1,n)
		cin>>s[i]>>t[i];
	string x;
	cin>>x;
	int flag=0;
	int res=0;
	rb(i,1,n){
		if(flag==1){
			res+=t[i];
		}
		if(x==s[i])
			flag=1;
	}
	cout<<res;
	return 0;
}


Measured memory_bytes: 256
//Partition

#include<stdio.h>
#define N 100000

int main()
{
  int n = 0;
  int i = 0;
  int arr[N];
  int a = 0;
  int b,k;
  int x = 0;
  int swit = 0;
  int p = 0;
  int y = 0;
  
  
  //input data
  scanf("%d",&n);
  for(i = 0; i < n; i++)
    {
      scanf("%d",&arr[i]);
    }

  //work
 
  a = p - 1;
  x = arr[n - 1];


  for(b = p; b <= n - 1; )
    {
     
      if(b == n - 1)
	{
	  swit = arr[b];
	  arr[b] = arr[a + 1];
	  arr[a + 1] = swit;

	  y = a + 1;
	  
	}
    
      if(arr[b] <= x)
	{
	  a++;
	  swit = arr[b];
	  arr[b] = arr[a];
	  arr[a] = swit;
	  b++;
	}
      if(arr[b] > x)
	{
	  b++;
	}
      
    }

  //output data
  printf("%d",arr[0]);
  for(k = 1; k < n; k++)
    {
      if(k == y)
	{
	  printf(" [");
	  printf("%d",x);
	  printf("]");
	}
      if(k != y)
	{	
	  printf(" %d",arr[k]);
	}
    }
  printf("\n");
  
  return 0;
}



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

void makeCombiUtil(vector<vector<int> >& ans, vector<int>& tmp, int n, int left, int k) {
    if (k == 0) {
        ans.push_back(tmp);
        return;
    }
    for (int i = left; i <= n; ++i) {
        tmp.push_back(i);
        makeCombiUtil(ans, tmp, n, i, k - 1);
        tmp.pop_back();
    }
}

vector<vector<int> > makeCombi(int n, int k) {
    vector<vector<int> > ans;
    vector<int> tmp;
    makeCombiUtil(ans, tmp, n, 1, k);
    return ans;
}

int main(void) {
    int N, M, Q;
    cin >> N >> M >> Q;
    vector<int> a(Q), b(Q), c(Q), d(Q);
    for (int i = 0; i < Q; i++)
        cin >> a.at(i) >> b.at(i) >> c.at(i) >> d.at(i);
    vector<vector<int> > ans = makeCombi(M, N);
    int max = 0;
    for (long unsigned int i = 0; i < ans.size(); i++) {
        // for (int j = 0; j < ans[i].size(); j++) {
        //     cout << ans.at(i).at(j) << " ";
        // }
        int sum = 0;
        for (int j = 0; j < Q; j++) {
            if (ans.at(i).at(b.at(j)-1) - ans.at(i).at(a.at(j)-1) == c.at(j))
                sum += d.at(j);
        }
        if (max < sum)
            max = sum;
        // cout << sum;
        // cout << endl;
    }
    cout << max << endl;
    return 0;
}

Measured memory_bytes: 9740
a = input()
A = list(a)
for i in range(1):
    if A[0] == A[1]:
        if A [0] == A[2]:
            print('Yes')
            break
    if A[1] == A[2]:
        if A[1] == A[3]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')

Measured memory_bytes: 9060
using System;

namespace Rextester
{
         public class Program
         {
                public static void Main(String[] args)
                {
                       int a, b;
                       string[] str = Console.ReadLine().Split(' ');
                       a = int.Parse(str[0]);
                       b = int.Parse(str[1]);
                       Console.WriteLine(a*b + " " + 2*(a+b));
                }
         }
}


Measured memory_bytes: 15960
while True:
    h,w = map(int,input().split())
    if h == 0 and w == 0:
        exit ()
    for i in range(h):
        if i == 0 or i == h-1:
            for j in range(w):
                print ("#",end="")
        else:
            for j in range(w):
                if j == 0 or j == w-1:
                    print ("#",end="")
                else:
                    print (".",end="")
        print ()
    print ()


Measured memory_bytes: 7000