akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <string>
#include <iomanip>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <complex>
#include <ctime>


using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef int itn;
const ll LINF = 1e18;
const int INF = 1e9;

//マクロ定義
#define vvint(vec,n,m,l) vector<vector<int>> vec(n, vector<int>(m,l));	// lで初期化
#define vvll(vec,n,m,l) vector<vector<ll>> vec(n,vector<ll>(m,l));
#define vint vector<int>
#define pint pair<int,int>
#define rep(i,a) for(int i=0;i<(a);i++)
#define all(x) (x).begin(),(x).end()
#define debug system("pause")				//デバッグ用
#define ret return 0

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; }

using Graph = vector<vector<ll>>;

#define ketasitei setprecision(15) //15桁表示

const ll MOD = 1000000007;
const double PI = 3.1415926535897932;


int main(void)

{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << ketasitei;

	ll a, b, n;
	cin >> a >> b >> n;

	ll ans;

	ll low = 0;
	ll high = n;
	int cnt = 500000;

	while (cnt--)
	{
		ll c1 = (low * 2LL + high) / 3LL;
		ll c2 = (low + high * 2LL) / 3LL;

		ll tmp1 = a * c1, tmp2 = c1 / b;
		ll tmp3 = (a * c2), tmp4 = c2 / b;
		if (tmp1/b - a * tmp2 <= tmp3 / b - a * tmp4) low = c1;
		else high = c2;
	}

	ll tmp1 = (a * low), tmp2 = (low / b);
	ans = tmp1 / b - a * tmp2;
	tmp1 = (a * high); tmp2 = (high / b);
	ans = max(ans, tmp1 / b - a * tmp2);
	ans = max(ans, 0LL);
	tmp1 = a * n; tmp2 = n / b;
	ans = max(ans, tmp1 / b - a * tmp2);

	for (ll i = 1; i <= 1000; i++)
	{
		if (high - 500LL + i >= 0 && high-500LL+i<=n)
		{
			tmp1 = a * (high - 500LL + i); tmp2 = (high - 500LL + i) / b;
			ans = max(ans, tmp1 / b - a * tmp2);
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3640
#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;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
const int maxn=2e5+5;
ll n,a[maxn],cnt[maxn];
ll sum,ans;
int main(){
    scanf("%lld",&n);
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        cnt[a[i]]++;
    }
    for(int i=1;i<=n;i++){
        if(cnt[i]>=2){
            sum=sum+cnt[i]*(cnt[i]-1)/2;
        }
    }
//    printf("%lld\n",sum);
    for(int i=1;i<=n;i++){
        if(cnt[a[i]]>=2){
            ans=sum+(cnt[a[i]]-1)*(cnt[a[i]]-2)/2-cnt[a[i]]*(cnt[a[i]]-1)/2;
        }else{
            ans=sum;
        }
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "No" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
#define PI (acos(-1))
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------
ll N;
ll dfs(ll x){
    if(x>N) return 0;
    ll ret=1;
    ll y=x,ct3=0,ct5=0,ct7=0;
    while(y){
        if(y%10==3) ++ct3;
        if(y%10==5) ++ct5;
        if(y%10==7) ++ct7;
        y/=10;
    }
    ret=( ct3==0 or ct5==0 or ct7==0 ? 0 : 1 );
    ret+=dfs(x*10+3);
    ret+=dfs(x*10+5);
    ret+=dfs(x*10+7);
    return ret;
}
//--MAIN-----------------------------------
void Main() {
    cin>>N;
    cout<< dfs(0) <<"\n";
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

ll power(int k,int n,int M){
  if(n==0) return 1;
  if(n==1) return (ll)k;
  
  ll ret = power(k,n/2,M);
  
  ret=(ret*ret)%M;
  
  if(n%2==1) ret=(ret*k)%M;
  
  return ret;
}


int main(){
  int n, k;

  cin >> n >> k;

  cout << power(k, n, mod) << endl;
  
  return 0;
}



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

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

int main(void) {
    int n, total = 0;
    scanf("%d", &n);
    int l[n];
    for(int i = 0; i < n; i++) {
        scanf("%d", &l[i]);
    }
    qsort(l, sizeof(l) / sizeof(int), sizeof(int), asc);
    for(int i = 1; i < n; i++) {
        total += l[i];
    }
    if(l[0] < total) printf("Yes\n");
    else printf("No\n");
    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define pb                  push_back
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define mk(arr,n,type)      type *arr=new type[n];
#define dbg(x) cerr << #x << " is " << x << endl;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
clock_t beg = clock();
const int inf=1e18;const int mod=1e9+7;const int N=2e5+9;
const double pi = 3.1415926535897932384626433;
void FILE_IO(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}

void JH(){
    int d=0,e=0,f=0,g=0,p=0,w=0,flag=0,ans=0,res=0,cnt=0,sum=0;double f1=0.0,f2=0.0,f3=0.0;
    int n,k;cin>>n>>k;
    int a[n];
    fo0(i,n){
        cin>>a[i];
    }

    for(int i=k;i<n;i++){
        if(a[i]>a[i-k])
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }

}

int32_t main()
{
    FILE_IO();FAST_IO;int t=1;
    // cin>>t;
    while(t--){JH();}cerr<<fixed<<setprecision(3)<<(double)(clock()-beg)/1000<<"s ";
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

    int n; std::cin >> n;
    vi a(n); rep(i, n) std::cin >> a[i];
    int ma1 = 0, ma2 = 0;
    rep(i, n) {
        if (ma1 < a[i]) {
            ma2 = ma1;
            ma1 = a[i];
        } else if (ma2 < a[i]) {
            ma2 = a[i];
        }
    }

    rep(i, n) {
        if (ma1 != a[i]) std::cout << ma1 << "\n";
        else std::cout << ma2 << "\n";
    }
}


Measured memory_bytes: 2432
S = list(input())
S_sort = set(sorted(S))
all_sort = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}
ans = all_sort - S_sort
print('None' if len(ans) == 0  else sorted(list(ans))[0])

Measured memory_bytes: 10832
import math
import sys

H = int(input())

if H == 1:
    print(1)
    sys.exit()

times = 0
while H > 1:
    H = math.floor(H/2)
    times += 1

ans = 1
tmp = 1
for i in range(0,times):
    tmp = tmp*2
    ans = ans + tmp
    
print(ans)

Measured memory_bytes: 3060
from collections import deque
from collections import defaultdict
import heapq

N,M=map(int, raw_input().split())
cost=map(int, raw_input().split())

par=[i for i in range(N)]

def root(x):
	if par[x]==x:
		return x
	else:
		r=root(par[x])
		par[x]=r
		return r

def unite(x,y):
	x=root(x)
	y=root(y)
	if x==y: return
	par[x]=y


for i in range(M):
	x,y=map(int,raw_input().split())
	unite(x,y)


group_cost=defaultdict(lambda: [])

for i in range(N):
	root(i)
	group_cost[par[i]].append(cost[i])


H = []

ans=0
for v in group_cost.values():
	v=sorted(v)
	ans+=v[0]
	H.append(v[1:])

nokori_cost=list(heapq.merge(*H))


if N < 2*(N-M-1):
	print "Impossible"
elif M == N-1:
	print 0
else:
	ans += sum(nokori_cost[:2*(N-M-1) - len(group_cost.keys())])
	print ans




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

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define DEBUG(x) ;
#define DEBUG(x) std::cerr << #x << " : " << (x) << std::endl;

int dx[4]{0, 1, 0, -1};
int dy[4]{1, 0, -1, 0};

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

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

template<class T>
bool chmax(T &a, initializer_list<T> l)
{
	return chmax(a, *max_element(l.begin(), l.end()));
}

template<class T>
bool chmin(T &a, initializer_list<T> l)
{
	return chmin(a, *min_element(l.begin(), l.end));
}


ll dp[3010][3010][4]{};
ll grid[3010][3010]{};

int main(int argc, char **argv)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	ll H, W, K;
	cin >> H >> W >> K;
	REP(i, K)
	{
		ll a, b, c; cin >> a >> b >> c;
		--a, --b;
		grid[a][b] = c;
	}

	if (grid[0][0] > 0)
		dp[0][0][1] = grid[0][0];
	for (ll hi = 0; hi < H + 5; ++hi)
	{
		for (ll wi = 0; wi < W + 5; ++wi)
		{
			for (ll k = 0; k < 4; ++k)
			{
				if (grid[hi][wi] > 0)
				{
					if (wi - 1 >= 0 && k - 1 >= 0)
						chmax(dp[hi][wi][k], dp[hi][wi-1][k-1] + grid[hi][wi]);

					if (hi - 1 >= 0)
						chmax(dp[hi][wi][1], dp[hi-1][wi][k] + grid[hi][wi]);
				}
				if (wi-1 >= 0) chmax(dp[hi][wi][k], dp[hi][wi-1][k]);
				if (hi-1 >= 0) chmax(dp[hi][wi][0], dp[hi-1][wi][k]);
			}
		}
	}

	ll res{-INF};
	REP(k, 4) chmax(res, dp[H-1][W-1][k]);

	std::cout << res << std::endl;
	return 0;
}


Measured memory_bytes: 356704
#include<iostream>
#include<algorithm>
using namespace std;
int h,w,n;
string s[30];
bool used[30][30];
bool check()
{
	string t[30];
	for(int i=0;i<h;i++)t[i]=s[i];
	int flag=1;
	while(flag)
	{
		flag=0;
		for(int cnt=0;cnt<h;cnt++)
		{
			for(int j=0;j<w;j++)for(int i=h;--i;)
			{
				if(t[i][j]=='.')t[i][j]=t[i-1][j],t[i-1][j]='.';
			}
		}
		for(int i=0;i<h;i++)for(int j=0;j<w;j++)used[i][j]=0;
		for(int i=0;i<h;i++)for(int j=0;j<=w-n;j++)
        {
            if(t[i][j]=='.')continue;
            bool f=1;
            for(int k=0;k<n;k++)f&=t[i][j]==t[i][j+k];
            if(f)
            {
                for(int k=0;k<n;k++)used[i][j+k]=1;
                flag=1;
            }
        }
        for(int i=0;i<=h-n;i++)for(int j=0;j<w;j++)
        {
            if(t[i][j]=='.')continue;
            bool f=1;
            for(int k=0;k<n;k++)f&=t[i][j]==t[i+k][j];
            if(f)
            {
                for(int k=0;k<n;k++)used[i+k][j]=1;
                flag=1;
            }
        }
		for(int i=0;i<h;i++)for(int j=0;j<w;j++)
			if(used[i][j])t[i][j]='.';
	}
	bool ans=1;
	for(int i=0;i<h;i++)for(int j=0;j<w;j++)ans&=t[i][j]=='.';
	return ans;
}
main()
{
	cin>>h>>w>>n;
	for(int i=0;i<h;i++)cin>>s[i];
	for(int i=0;i<h;i++)for(int j=0;j<w-1;j++)
	{
		swap(s[i][j],s[i][j+1]);
		if(check())
		{
			cout<<"YES"<<endl;
			return 0;
		}
		swap(s[i][j],s[i][j+1]);
	}
	cout<<"NO"<<endl;
}



Measured memory_bytes: 3220
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp(a, b) make_pair(a, b)
#define ls (rt << 1)
#define rs (rt << 1 | 1) 
typedef pair<int, int> pii; 
const ll mod = 1e9 + 7;
template <class T> T lowbit(T x){return ((x)&(-(x)));}
const int maxn = 2e5 + 10;
int k;
int f[maxn][10];
void dfs(int i, int j)
{
	printf("%d", j);
	if(i == 0) exit(0);
	if(j > 0)
	{
		if(k >= f[i - 1][j - 1]) k -= f[i - 1][j - 1];
		else dfs(i - 1, j - 1);
	}
	if(k >= f[i - 1][j]) k -= f[i - 1][j];
	else dfs(i - 1, j);
	dfs(i - 1, j + 1);
}	
int main()
{
	cin >> k;
	if(k <= 9)
	{
		cout << k << endl;
		return 0;
	}
	for(int j = 0; j <= 9; ++j) f[0][j] = 1;
	k -= 10;
	for(int i = 1; ; ++i)
	{
		for(int j = 0; j <= 9; ++j)
		{
			f[i][j] = f[i - 1][j]; 
			if(j > 0) f[i][j] += f[i - 1][j - 1];
			if(j < 9) f[i][j] += f[i - 1][j + 1];
			if(j > 0)
			{
				if(k >= f[i][j]) k -= f[i][j];
				else dfs(i, j);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vector<ll>>;
using vvc = vector<vector<char>>;

#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define repd(i, n) for (ll i = n - 1; i >= 0; i--)
#define all(x) x.begin(), x.end()

ll n, k, m, M = 1e9 + 7;

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

    cin >> n >> m;

    vl a(n);
    rep(i, n) cin >> a[i];

    vvl b(m, vl(2));
    rep(i, m) rep(j, 2) cin >> b[i][j];

    sort(all(a));
    sort(all(b), [](vl a, vl b) {return a[1] > b[1];});

    if(a[0] >= b[0][1]) {
        ll sum = 0;
        rep(i, n) sum += a[i];
        cout << sum << endl;
        return 0;
    }

    ll sum = 0, idx = 0, che = 0;
    rep(i, n) {
        if(a[i] < b[idx][1]) {
            sum += b[idx][1];
        } else {
            for(; i < n; i++) sum += a[i];
            break;
        }

        che++;
        if(che == b[idx][0]) {
            idx++;
            if(idx == m) {
                for(i++; i < n; i++) sum += a[i];
                break;
            }
            che = 0;
        }
    }

    cout << sum << endl;
}

Measured memory_bytes: 9536
#include<stdio.h>
#define MAX 100005
#define NIL -1
struct Node_struct{int p, l, r;}; /*p: 親(parent), l: 一番左の子(left child), r:右の兄弟(right sibling)*/
typedef struct Node_struct Node;
Node T[MAX];
int D[MAX];

void print(int u){
  int i, c;
  printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);

  if(T[u].p == NIL) printf("root, ");
  else if(T[u].l == NIL) printf("leaf, ");
  else printf("internal node, ");
  
  printf("[");
  for (i=0, c = T[u].l; c != NIL; i++, c = T[c].r){
    if(i) printf(", ");
    printf("%d", c);
  }
  printf("]\n");
  
}

void calcDepth(int u, int p){
  D[u] = p;
  if(T[u].r != NIL) calcDepth(T[u].r, p);
  if(T[u].l != NIL) calcDepth(T[u].l, p+1);
}

int main(){
  int i, j, k;
  int n;
  int id, sib, child;
  int root = NIL;
  scanf("%d", &n);
  for(i=0; i<n; i++) T[i].p = T[i].l = T[i].r = NIL;
  
  for(i=0; i<n; i++){
    scanf("%d %d", &id, &k);
    for(j = 0, sib = NIL; j<k; j++){ //子を入力する (input children)
      scanf("%d", &child);
      T[child].p = id;
      if(j == 0) T[id].l = child; //idの一番左の子 (the most left child of id)
      else T[sib].r = child; //左の兄弟に繋げる (connect to left sibling)
      sib = child;//次の子供の左の兄弟 (the left sibling of the next child)
    }
  }

  //根を求める (find the root)
  for(i=0; i<n; i++){
    if(T[i].p == -1) root = i;
  }
  
  //それぞれのノードの深さを求める (find depth of each node)
  calcDepth(root, 0);

  //出力 (output)
  for(i=0; i<n; i++) print(i);
  
  return 0;
}



Measured memory_bytes: 6452
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
using namespace std;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(e, elem) for(auto& (e) : (elem))
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define all(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
using ll = long long;
using ull = unsigned long long;

int main() {
    ll x;
    cin >> x;
    ll a = x / 500;
    x -= a * 500;
    ll b = x / 5;
    ll ans = a * 1000 + b * 5;
    println(ans);

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(a,b) for(ll i=a;i<b;i++)

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n; cin >> n;
	ll ar[n];
	ll c=0,sum =0;
	f(0,n){
		ll k; cin >> k;
		ll minus = c-k;
		if(minus>=0){
			sum += minus;
		}
		c = c>k?c:k;
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 3592
using System;
using System.Linq;

namespace abc136_c
{
    static class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine().ToInteger();
            var h = Console.ReadLine().ToIntArray();

            var ans = true;
            for (int i = h.Length - 1; i > 0; i--)
            {
                if (h[i] >= h[i - 1])
                {
                    // 何もしない
                }
                else if (h[i] >= h[i - 1] - 1)
                {
                    h[i - 1] -= 1;
                }
                else
                {
                    ans = false;
                    break;
                }
            }

            Console.WriteLine($"{(ans ? "Yes" : "No")}");
        }

        static int ToInteger(this string s)
        {
            return int.Parse(s);
        }

        static int[] ToIntArray(this string s, char separator = ' ')
        {
            return s.Split(separator).Select(m => m.ToInteger()).ToArray();
        }
    }
}


Measured memory_bytes: 27996
#pragma region header
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr int inf = INT32_MAX/2;
constexpr ll INF = LLONG_MAX/2;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------テンプレート------------------ */
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i % mod;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
bool isprime(int n) { //素数判定
    if(n==1)return false;
    if(n==2)return true;
    for(int i = 2;i<=sqrt(n);i++) {
        if(n%i==0) return false;
    }
    return true;
}
/* ----------------------end----------------------- */
#pragma endregion
int n,m;
int ans[114514];
signed main() {
    cin >> n >> m;
    vvi v(214514);
    rep(i, m) {
        int a,b;cin >> a >> b;
        a--;b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    queue<int> que;
    que.push(0);
    ans[0]=inf;
    while(!que.empty()) {
        int p = que.front();
        // cout << "p:" << p+1 << endl;
        que.pop();
        for(auto i:v[p]) {
            if(ans[i]!=0) continue;
            // cout << i+1 << "\n";
            ans[i]=p+1;
            que.push(i);
        }
    }
    rep1(i, n-1) {
        if(ans[i]==0) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;rep1(i, n-1) cout << ans[i] << endl;
    return 0;
}

Measured memory_bytes: 15608
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<string>
#include<cmath>
#include<queue>
#include<vector>
#include<sstream>
#include<algorithm>
#include<stack>
#include<bitset>
#include<map>
#include<set>
#define rep(i,n) for(int i=0;(i)<(n);i++)
#define rep1(i,n) for(int i=1;(i)<=(n);i++)
#define mst(a,b) memset(a,b,sizeof(a))
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define dbg(a) cout<<"* "<< #a <<" : "<<a<<endl
#define fr first
#define se second
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define lowbit(x) x&(-x)
#define ac cout<<ans<<endl
//#define DEBUG 0
using namespace std;
const double pi=acos(-1.0);
const double eps=1e-6;
const ull hashp=1e7+19;
const ll INF=0x3f3f3f3f3f3f3f3fll;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int maxn=2e5+100;
map<int ,int >mp;
int a[maxn];
int sum[maxn];
void solve()
{
	int n,k;scdd(n,k);
	rep1(i,n){
		scd(a[i]);
		a[i]--;
	}
	mp[0]=1;
	ll ans=0;
	rep1(i,n){
		sum[i]=(sum[i-1]+a[i])%k;
		if(i-k>=0)mp[sum[i-k]]--;
		if(mp.count(sum[i]))ans+=1ll*mp[sum[i]];
		mp[sum[i]]++;
		//dbg(ans);
	}
	ac;
}
int main(){
    //IOS;
    //freopen("D://data.txt","r",stdin);
    solve();
    return 0;
}


Measured memory_bytes: 11136
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define sz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<ll, ll> pll;
typedef long double ldouble;
typedef unsigned int uint;

ll A, B;

void solve(){
	cin >> A >> B;
	if(A == B){ puts("1");return;}
	for(int i=59;i>=0;i--) {
		if((1LL<<i&A) != (1LL<<i&B)) {
			ll ans = (1LL << i) - (A & ((1LL<<i)-1));
			ll cnt = (B & ((1LL<<i)-1));
			if(cnt == 0) cnt = 1;
			else cnt = 1LL << (64 - __builtin_clzll(cnt));
			cnt += ans;
			cnt = min(cnt, 1LL << i);
			printf("%lld\n", ans + cnt);
			break;
		}
	}
}

int main(){
	int Tc = 1; //scanf("%d\n", &Tc);
	for(int tc=1;tc<=Tc;tc++){
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
 import java.util.ArrayList;
 import java.util.List;
 
 public class Main{
 	public static void main(String[] args){
 		//データの読み取りの準備
 		Scanner sc = new Scanner(System.in);
 		
 		while(true){
 			//データの読み取り
 			int n = sc.nextInt();
 			int s = sc.nextInt();
 			
 			int result;
 			List<Integer> initalAvalable = new ArrayList<Integer>(){
 				{
 					add(0);
 					add(1);
 					add(2);
 					add(3);
 					add(4);
 					add(5);
 					add(6);
 					add(7);
 					add(8);
 					add(9);
 				}
 			};
 			
 			//終了条件の判定
 			if(n == 0 && s == 0){
 				break;	
 			}
 			
 			//確実に不可能な条件を分離
 			int max = 0;
 			int min = 0;
 			for (int i = 0; i < n; i++){
 				max += 9 - i;
 				min += i;
 			}
 			
 			if (s < min || max < s){
 				System.out.println(0);
 				continue;
 			}
 			
 			//探索を実行
 			result = search(n,s,initalAvalable);
 			
 			//結果の重複を除去
 			for (int k = 1; k <= n; k++){
 			   result /= k;
 		   }
 			
 			//結果を出力
 			System.out.println(result);
 		}
 	}
 	
 	//serch(使う数の残り個数,残りの合計,使える数のリスト)->パターンの数
 	private static int search(int num, int sum, List<Integer> avalable){
 	   
 		//結果の格納用変数
 		int result = 0;
 		
 		//再帰の一番下
 		if (num == 1){
 			//avalableを探索して、sumと一致するものがなければ0を返す
 			if (avalable.contains(sum)){
 			   return 1;
 			}else{
 				return 0;
 			}
 		}
 		
 		else{
 			//荒い条件フィルターをかけて、結果が存在しないものをフィルタリング
 			if (sum <= 0 || 9 * num <= sum){
 				return 0;
 			}else{
 				for (int j = 0; j < avalable.size(); j++){
 					//全てのパターンについて再帰処理
 					List<Integer> nextAvalable = new ArrayList<Integer>(avalable);
 					nextAvalable.remove(j);
 					result += search(num - 1, sum - avalable.get(j), nextAvalable);
  				}
 				return result;
 			}
 		}
 	}
 }


Measured memory_bytes: 62520
mod = 10**9+7
n = int(input())
a = list(map(int, input().split()))



def factorize(n):
    fct = []  # prime factor
    b, e = 2, 0  # base, exponent
    while b * b <= n:
        while n % b == 0:
            n = n // b
            e = e + 1
        if e > 0:
            fct.append((b, e))
        b, e = b + 1, 0
    if n > 1:
        fct.append((n, 1))
    return fct

l = [0] * (10 ** 6 + 1)

for i in range(n):
    soi = factorize(a[i])
    for j in range(len(soi)):
        l[soi[j][0]] = max(l[soi[j][0]], soi[j][1])

saiko = 1

for i in range(2, 10**6):
    saiko = (saiko * i ** l[i]) % mod

ans = 0

for i in range(n):
    ans += saiko * pow(a[i],mod - 2, mod)
    ans %= mod

print(ans)

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

struct Point {
    double x, y;
};

void koch(int n, Point p1, Point p2) {
    if (n == 0) {
        return;
    }
    
    Point s, t, u;
    s.x = (2 * p1.x + p2.x) / 3;
    s.y = (2 * p1.y + p2.y) / 3;
    t.x = (p1.x + 2 * p2.x) / 3;
    t.y = (p1.y + 2 * p2.y) / 3;
    u.x = (t.x - s.x) * cos(M_PI / 3) - (t.y - s.y) * sin(M_PI / 3) + s.x;
    u.y = (t.x - s.x) * sin(M_PI / 3) + (t.y - s.y) * cos(M_PI / 3) + s.y;

    koch(n - 1, p1, s);
    printf("%.8lf %.8lf\n", s.x, s.y);
    koch(n - 1, s, u);
    printf("%.8lf %.8lf\n", u.x, u.y);
    koch(n - 1, u, t);
    printf("%.8lf %.8lf\n", t.x, t.y);
    koch(n - 1, t, p2);
}

int main() {
    int n;
    cin >> n;
    Point p1, p2;
    p1.x = 0.0;
    p1.y = 0.0;
    p2.x = 100.0;
    p2.y = 0.0;

    printf("%.8lf %.8lf\n", p1.x, p1.y);
    koch(n, p1, p2);
    printf("%.8lf %.8lf\n", p2.x, p2.y);
}


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

using namespace std;

int n, val, x, ap1, ap2, i;

int main()
{
  //  freopen("input", "r", stdin);
    cin.sync_with_stdio(false);

    cin >> n >> val; ap1 = 1;
    for(i=2; i<=n; ++i)
    {
        cin >> x;
        if(x == val) ++ap1;
            else if(!ap2)
            {
                if(x == val-1) ap2 = ap1, ap1 = 1, --val;
                    else if(x == val+1) ap2 = 1;
                        else
                        {
                            cout << "No\n";
                            return 0;
                        }
            }
            else if(x == val+1) ++ap2;
                else
                {
                    cout << "No\n";
                    return 0;
                }
    }

    if(!ap2)
    {
        if(n/2 >= val || val == n-1) cout << "Yes\n";
            else cout << "No\n";
    }
    else
    {
        if(ap2 >= 2 && ap1 + ap2/2 >= val+1 && ap1 + 1 <= val + 1) cout << "Yes\n";
            else cout << "No\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>

int main() {
  size_t N;
  intmax_t H;
  scanf("%zu %jd", &N, &H);

  std::vector<intmax_t> a(N), b(N);
  for (size_t i = 0; i < N; ++i)
    scanf("%jd %jd", &a[i], &b[i]);

  std::sort(a.rbegin(), a.rend());
  std::sort(b.rbegin(), b.rend());

  int res = 0;
  for (auto bi: b) {
    if (bi <= a[0]) break;
    ++res;
    H -= bi;
    if (H <= 0) break;
  }

  if (H > 0)
    res += (H+a[0]-1) / a[0];
  printf("%d\n", res);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;

  if (k < e - a) {
    cout << ":(" << endl;
  } else {
    cout << "Yay!" << endl;
  }

}

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

#define int long long


signed main(){
  

  int H, W;
  int A, ans = 0;
  int num, num2, num3, num4;

  cin>>H>>W;

  num = H, num2 = H;

  for(int i = 0; i < H; i++){
    num3 = num4 = W;
    for(int j = 0; j < W; j++){
      cin>>A;
      ans += num*num3*A;
      //  cout<<i<<" "<<j<<" "<<num<<" "<<num3<<" "<<A<<endl;
      
      num4 -= 2;
      num3 += num4;
    }
    
    num2 -= 2;
    num += num2;
  }

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



Measured memory_bytes: 3104
import java.util.Scanner;

public class Main {
	public static void main(String arg[]) {

		Scanner sc = new Scanner(System.in);

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

		int a = 0;
		int b = 0;

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

		int dp[] = new int[N];
		dp[0] = 0;
		dp[1] = Math.abs(h[1] - h[0]);

		for (int i = 2; i < N; i++) {

			a = dp[i - 2] + Math.abs(h[i] - h[i - 2]);
			b = dp[i - 1] + Math.abs(h[i] - h[i - 1]);

			if (a < b) {
				dp[i] = a;
			} else {
				dp[i] = b;
			}
		}

		System.out.print(dp[N-1]);

	}
}


Measured memory_bytes: 50856
// template version 1.10
using namespace std;
#include <iostream>
#include <bits/stdc++.h>

// varibable settings {{{
#define infile "../test/sample-1.in"
#define int long long
const int INF=1e18;
const int MOD=1e9+7;
int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
// }}}

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)(b-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;
template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;
//}}}

// dump macro {{{
#if defined(PCM) || defined(LOCAL)
  #include "dump.hpp"
#else
  #define dump(...) 42
  #define dump_1d(...) 42
  #define dump_2d(...) 42
#endif
// }}}

vi res;
vector<vector<pii>> e;

int nuru(int x, int col){
  res[x] = col;
  each(ch, e[x]){
    int nx = ch.first;
    int cost = ch.second%2;
    if(res[nx]==-1) nuru(nx, col^cost);
  }
  return 0;
}

int solve(){
  int n;cin>>n;

  res = vi(n, -1);
  e = vector<vector<pii>>(n, vector<pii>());
  rep(i, n-1){
    int u,v,w;
    cin>>u>>v>>w;
    u--;v--;
    e[u].pb(mp(v, w));
    e[v].pb(mp(u, w));
  }
  dump(e);

  nuru(0, 0);

  each(x, res){
    cout << x << endl;
  }

  return 0;
}

signed main() { //{{{
#ifdef INPUT_FROM_FILE
  std::ifstream in(infile);
  std::cin.rdbuf(in.rdbuf());
#endif
  solve();
  return 0;
} //}}}


Measured memory_bytes: 9216
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
using namespace std;
typedef long long ll;
const double PI = acos(-1.0);
const double eps = 1e-6;
const int INF = 0x3f3f3f3f;

int main(){
	ll N =0;
	ll K = 0;
	ll ans = 0;
	scanf("%lld %lld",&N,&K);
	if(K!=0){
	for(int i = K+1;i<=N;i++){
		int zu = (N-i)/i;
		int yu = N%i;
		int cur = yu-K+1;
		if(cur>0){
			ans += cur;
		}
		ans +=zu*(i-K);
	}
//	printf("%lld\n",ans);
	ans+= (N-K+1)*(N-K)/2;
	
	printf("%lld\n",ans);
	}else{
		printf("%lld",N*N);
	}
	return 0;
}



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

int main() {
    ll K,A,B; cin>>K>>A>>B;
    ll biske=1;
    while(K>0){
        if(biske<A){
            biske++;
            K--;
        }
        else{
            if(K>1 && A+1<B){
                biske+=(B-A);
                K=K-2;
            }
            else{
                biske++;
                K--;
            }
        }
    }
    cout<<biske;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,m;
vi a;

int main(){
	cin>>n>>m;
	a=vi(n+1);
	for(int i=0;i<m;i++){
		int l,r;
		cin>>l>>r;
		a[l-1]++,a[r]--;
	}
	int res=0;
	for(int i=0;i<n;i++){
		if(i) a[i]+=a[i-1];
		if(a[i]==m) res++;
	}
	cout<<res<<endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define umax(x,y) x=max(x,y)
#define umin(x,y) x=min(x,y)
#define ll long long 
#define ii pair<int,int>
#define iii pair<int,ii>
#define iiii pair<ii,ii>
#define sz(x) ((int) x.size())
#define orta ((bas+son)/2)
#define all(x) x.begin(),x.end()
#define pw(x) (1<<(x))
#define inf 1000000005
#define MOD 924844033 
#define N 100005
#define M 1000003
#define LOG 20
#define KOK 250
#define EPS 0.0000001
using namespace std;

int n,k,ans;
vector<int> v[N];

int dfs(int node,int ata) {

	int cd=0;

	for(int i:v[node]) {

		umax(cd,dfs(i,node)+1);

	}

	if(cd>=k-1 && (ata!=1 && node!=1)) {

		ans++;
		cd=-1;

	}

	return cd;

}

int main() {

	scanf("%d %d",&n,&k);

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

		int x;

		scanf("%d",&x);

		if(i==1) {

			ans+=(x!=1);
			x=1;

			continue ;

		}

		v[x].pb(i);

	}

	dfs(1,0);

	printf("%d",ans);

}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
int powint(int a, int x){
	int res = 1;
	REP(i,x){
		res = res *a; 
	}
	return res;
}

#define int long long

using namespace std;

signed main(){
	string S;
	cin>>S;
	int ans=0;
	int N=S.size();
	int pre=N;
	bool wari=false;
	for(int i=N-1; i>=0; --i){
		if(S[i]=='B'){
			if(wari){
				ans+=pre-i-1;
				pre--;
				wari=true;
			} else {
				pre=i;
			}
		} else {
			wari=true;
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

class Main{



	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int[] data = {a,b,c};
		Arrays.sort(data);
		if(data[0] == 5 && data[1] == 5 && data[2] == 7){
			System.out.println("YES");
		}else{
			System.out.println("NO");

		}
	}
}

Measured memory_bytes: 21844
#include <iostream>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    if (a==b){
     cout << "a == b" << endl;
    } else if (a > b) {
     cout << "a > b" << endl;
    } else if (a < b) {
     cout << "a < b" << endl;
    }
}

Measured memory_bytes: 1156
while True:
    instr = input()
    instrSp = instr.split()
    x = int(instrSp[0])
    y = int(instrSp[1])
    if x == 0 and y == 0:
        break
    else:
        if x < y:
            print("{x} {y}".format(x=x, y=y))
        else:
            print("{y} {x}".format(y=y, x=x))



Measured memory_bytes: 5608
h,w = map(int, input().split())
#get hight and weidth 
glid = [0] * ( h+ 2)

h_index = [-1, 0, 0,  1]
w_index = [ 0, -1, 1, 0]



glid[0]=["."] * ( w + 2 )
glid[h + 1 ] = ["."] * ( w + 2 )

for i in range(h):
	temp1 = ["."]
	temp2 = list(input())
	temp1.extend(temp2)
	temp1.append(".")
	glid[ i + 1 ] = temp1

# get glids 

cnt = 0

for j in range(h):
	for k in range(w):
		if glid[ j + 1 ][ k + 1 ] == "#" and glid[ j ][ k + 1 ] == "." and glid[ j + 2 ][ k + 1 ] == "." and glid[ j + 1][ k  ] == "." and glid[ j + 1][ k +2 ] == "." :
			cnt += 1

if cnt > 0 :
	print("No")
else:
	print("Yes")


Measured memory_bytes: 3064
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;
typedef vector<int> vi;
typedef vector<ll> vl;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define IN cin >> 
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (m-1); i >= (int)(n); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - a) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - a) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}

//ll ncr[100][100];
//ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

//ll npr[100][100]={};
//ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

//ll nHr(int n,int r){ret nCr(n+r-1,r);}

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


int main(){
    
    int a,b;
    cin >> a >> b;

    P(max(a+b,max(a-b,a*b)));
  
    return  0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define dbg(x) cout<<"( "<<#x<<" -> "<<x<<" )"<<endl;
using namespace std;
int main()
{
    int n;
    scanf("%d",&n);
    int a[n];
    int cnt=0;
    for (int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
        if (a[i]==(cnt+1))
        cnt++;
    }
    if (cnt==0)
    printf("-1\n");
    else
    printf("%d\n",(n-cnt));
    return 0;
}


Measured memory_bytes: 4564
#include <iostream>
using namespace std;
using ll = long long;

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

    ll N; cin >> N;
    ll m = 1LL << 60;
    for (int i = 0; i < 5; i++) {
        ll x; cin >> x;
        m = min(m, x);
    }
    cout << 4 + (N + m - 1) / m << "\n";
}

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

int main(){

	//初期化
	int n, x;
	char c;
	bool cards[4][13];

	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 13; j++){
			cards[i][j] = false;
		}
	}

	//入力
	cin >> n;

	for(int i = 0; i < n; i++){

		cin >> c >> x;

		if(c == 'S') cards[0][x-1] = true;
		else if(c == 'H') cards[1][x-1] = true;
		else if(c == 'C') cards[2][x-1] = true;
		else if(c == 'D') cards[3][x-1] = true;
	}
	

	//表示
	for(int i = 0; i < 4; i++){
		for(int j = 0; j < 13; j++){
			if(cards[i][j] == false){
				if(i == 0) cout << 'S' << " " << j + 1 << endl;
				else if(i == 1) cout << 'H' << " " << j+1 << endl;
				else if(i == 2) cout << 'C' << " " << j+1 << endl;
				else if(i == 3) cout << 'D' << " " << j+1 << endl;
			}	
							
		}
	}

	return 0;

}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
int a,b,k;
int main(){
	cin>>k>>a>>b;
	for(int i=a;i<=b;i++){
		if(i%k==0){
			cout<<"OK";
			return 0;
		}
	}
	cout<<"NG";
	return 0;
}


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

int main(){
    long long int s;
    cin>>s;
    set<int>st;
    int x=s;
    while(st.count(x)==0){
        st.insert(x);
        if(x%2==0){
            x/=2;
        }
        else x=x*3+1;
    }
    cout<<st.size()+1<<endl;
}
    
    



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

int main()
{ int n,a,b,c;
     while(~scanf("%d",&n))
     {
         if(n==1)
            printf("Hello World\n");
         else
         {scanf("%d%d",&a,&b);
            printf("%d\n",a+b);}
     }

return 0;

}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define f_in freopen("test.in","r",stdin);
#define f_out freopen("test.in","w",stdout);
#define debug(x) cerr << #x << " : " << x << "\n";
#define _ cin.sync_with_stdio(0); cin.tie(0);
#define tl cout <<"\nTime elapsed: "<<(1000 * clock() / CLOCKS_PER_SEC)<<"ms\n"
#define Func {ans += solve(i); ++i;}


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

inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}

template<typename T = int>
inline T nxt(){
    char c=nc();T x=0; int f=1;
    for(;c>'9'||c<'0';c=nc())if(c=='-')f=-1;
    for(;c>='0'&&c<='9';x=x*10+c-'0',c=nc());
    x*=f;
    return x;
}


int main(){
#ifdef LOCAL_DEFINE
    f_in
#else
    _
#endif
    int n;
    cin >> n;
    int m = 0, a = 0, r = 0, c = 0, h = 0;
    rep(i,0,n){
        string s;
        cin >> s;
        if(s[0] == 'M' ) m ++;
        if(s[0] == 'A' ) a ++;
        if(s[0] == 'R' ) r ++;
        if(s[0] == 'C' ) c ++;
        if(s[0] == 'H' ) h ++;
    }
    ll ans = 0;
    ans += 1LL * m * a * r;
    ans += 1LL * m * a * c;
    ans += 1LL * m * a * h;
    ans += 1LL * m * r * c;
    ans += 1LL * m * r * h;
    ans += 1LL * m * c * h;
    ans += 1LL * a * r * c;
    ans += 1LL * a * r * h;
    ans += 1LL * a * c * h;
    ans += 1LL * r * c * h;
    cout << ans << '\n';
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	int n;
	string s;
	cin >> n >> s;
	
	int ans = 0;
	for(int i = 1; i < n - 1; ++i) {
		string tmp = s.substr(0, i);
		string tmp2 = s.substr(i, n - i);
		
		map<char, int> mp1, mp2;
		for(int i = 0; i < tmp.size(); ++i) {
			mp1[tmp[i]]++;
		}
		
		for(int i = 0; i < tmp2.size(); ++i) {
			mp2[tmp2[i]]++;
		}
		
		int cnt = 0;
		for(char c = 'a'; c <= 'z'; ++c) {
			if( mp1[c] > 0 && mp2[c] > 0 ) cnt++;
		}
		
		ans = max(ans, cnt);
	}
	
	cout << ans << endl;
	
	return 0;
}


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

int main(){
	int N, n=0, A;
	cin >> N;
	A=N;
	while(1){
		n+=A%10;
		A/=10;
		if(A==0) break;
	}
	if(N%n==0) cout << "Yes" << endl;
	else cout << "No" << endl;
}


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

int main() {
  int n,m=0;
  cin>>n>>m;
  vector<int> vec(n);
  rep(i,n){
    cin>>vec.at(i);
  }
  int sum=0;
  
  rep(i,n){
    sum+=vec.at(i);
  }
  
  if(n>=sum){
    cout<<n-sum;
  }else{
    cout<<-1;
  }
}

Measured memory_bytes: 7216
#include <stdio.h>

int main()
{
	int i, N, X, m, min = 1000, sum = 0;
	scanf("%d %d", &N, &X);
	for (i = 1; i <= N; i++) {
		scanf("%d", &m);
		sum += m;
		if (m < min) min = m;
	}
	printf("%d\n", N + (X - sum) / min);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 1732