akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long int
#define pragi(a,b) for(ll i = a;i<b;i++)
#define pragj(a,b) for(ll j = a;j<b;j++)
#define pragk(a,b) for(ll k = a;k>=b;k--)
#define all(v) (v.begin(),v.end())
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define KAKA ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int mod = 1e9 + 7;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef long double ld;
typedef pair<int, int> pii;
//typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef pair<ll, ll> pll;

void Compute(ll h,ll n)
{
    KAKA
    vector<ll> a(n);
    vector<ll> b(n);
    pragi(0,n)
    {
        cin>>a[i]>>b[i];
    }
    vector<ll> dp(h+1);
    dp[0] = 0;
    pragi(1,h+1)
    {
        vector<ll> vec;
        pragj(0,n)
        {
         if((i-a[j]) >= 0) vec.eb(dp[i-a[j]] + b[j]);
         else vec.eb(b[j]);
        }
        dp[i] = *min_element(vec.begin(),vec.end());
        vec.clear();
    }
    cout<<dp[h]<<"\n";
}
int main()
{
    KAKA
    ll h,n;
    cin>>h>>n;
    Compute(h,n);
}

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

int main(){
  int x,y;cin>>x>>y;
  for(int turu = 0; turu<=100; turu++){
    for(int kame = 0; turu+kame<=100; kame++){
      if(2*turu+4*kame==y && turu+kame==x){
        cout<<"Yes\n";
        return 0;
      }
    }
  }
  cout<<"No\n";
}

Measured memory_bytes: 3648
#include <stdio.h>
int  gcd(int x,int y){
    int temp;
    if(x<y){
        temp=x;
        x=y;
        y=temp;
    }
    while(y>0){
        temp=x%y;
        x=y;
        y=temp;
    }
    return x;
}

int main(void){
    int a,b,g;
    while(scanf("%d %d",&a,&b) != EOF){
        g=gcd(a,b);
        printf("%d %.0f\n",g,(double)a*b/g);
    }
    return 0;
}

Measured memory_bytes: 632
#include<cstdio>
#include<algorithm>
using namespace std;
int n,s,ans;
void solve(int from,int now,int sum){
    if(now==n && sum==s) ans++;
    if(now<n && s-sum>=from*(n-now)){
        for(int i=from;i<=min(9,(s-sum)/(n-now));i++){
            solve(i+1,now+1,sum+i);
        }
    }
}

int main(){
    for(;;){
        scanf("%d%d",&n,&s);
        if(n==0 && s==0) break;
        ans=0;
        solve(0,0,0);
        printf("%d\n",ans);
    }
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int n=5;
	vector<int> a(n);
	for(int i=0;i<n;i++)
		cin >> a[i];
	for(int i=0;i<n;i++)
		if(a[i]==0)
		{
			cout << i+1 << endl;
			break;
		}
	




}

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

namespace CSharpSample01
{
	class Program
	{

		static void Main(string[] args)
		{
			var X = long.Parse(Console.ReadLine());
			long money = 100; ;

			long count = 0;
			while(X > money)
			{
				count++;
				money = (long)(money * 1.01);
			}

			Console.WriteLine(count);
		}
	}
}

Measured memory_bytes: 27536
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
#define pii pair<int,int>
using namespace std;
const int maxn = 200100;
ll dp[maxn][2][2];
ll arr[maxn], n;

int main() {
	cin>>n;
	for(int i=1;i<=n;i++) {
		cin>>arr[i];
	}

	dp[2][0][0] = arr[1];
	dp[2][1][0] = arr[2];

	dp[2][0][1] = 0LL;

	for(int i=4;i<=n;i+=2) {
		dp[i][0][0] = arr[i-1] + dp[i-2][0][0];
		dp[i][1][0] = arr[i] + max(dp[i-2][0][0], dp[i-2][1][0]);

		dp[i][0][1] = arr[i-1] + dp[i-2][0][1];
		dp[i][1][1] = arr[i] + max(dp[i-2][0][1], dp[i-2][1][1]);

		dp[i][0][1] = max(dp[i][0][1], max(dp[i-2][0][0], dp[i-2][1][0]));
		dp[i][1][1] = max(dp[i][1][1], max(dp[i-2][0][0], dp[i-2][1][0]));
	}

	if(n % 2 == 0) {
		cout<<max(dp[n][0][0], dp[n][1][0])<<"\n";
		return 0;
	}

	cout<<max(max(dp[n-1][0][0], dp[n-1][1][0]), arr[n] + dp[n-1][0][1])<<"\n";
}

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

int main(){
      int n,m;cin >> n >> m;
      char arr[n + 10][m + 10];
      set<int> forbidr;
      set<int> forbidc;
      bool currC[m + 10];
      for(int i = 0;i < m;i++)currC[i] = false;
      for(int i = 0;i < n;i++){
            bool currR = false;
            for(int j = 0;j < m;j++){
                  cin >> arr[i][j];
                  if(arr[i][j] == '#'){
                        currR = true;
                        currC[j] = true;
                  }
                  if(i == n - 1){
                        if(currC[j] == false)forbidc.insert(j);
                  }
            }
            if(!currR)forbidr.insert(i);
      }
      for(int i = 0;i < n;i++){
            bool flag = false;
            for(int j = 0;j < m;j++){
                  if(forbidc.count(j) == 0 && forbidr.count(i) == 0){
                        cout << arr[i][j];
                        flag = true;
                  }
            }
            if(flag)cout << "\n";
      }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    int n;
    cin >> n;
    vl a(n), b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    vl c(n);
    int cnt = 0;
    rep(i, n) c[i] = a[i] - b[i];
    sort(rall(c));
    if(c.back() >= 0) {
        cout << 0 << endl;
        return 0;
    }
    rep(i, c.size()) {
        if(c[i] < 0) {
            cout << -1 << endl;
            return 0;
        }
        if(c.back() >= 0) continue;
        ++cnt;
        while(c[i] > 0 && c.back() < 0) {
            if(c[i] >= -c.back()) {
                c[i] += c.back();
                c.pop_back();
                ++cnt;
            }
            else {
                c.back() += c[i];
                c[i] = 0;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

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

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, a, b;
	cin>>n;
	int ma=-1, ans=0;
	REP(i, n){
		cin>>a>>b;
		if(a>ma){
			ma=a;
			ans=ma+b;
		}
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 892
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;
// << fixed << setprecision(0) <<

int main() {
ll k,n;
cin >> n >> k;
double p[n];
double sum[n+1]={0};
REP(i,n) {
  cin >> p[i];
  p[i] = (1+p[i])/2;
  if(i==0) {
    sum[i+1]=p[i];
  } else {
    sum[i+1]+=sum[i]+p[i];
  }
}

double ma=mINF;
double temp;
REP(i,n-k+1) {
  temp=abs(sum[i]-sum[i+k]);
  ma=max(ma,temp);
}
cout << fixed << setprecision(10) << ma << endl;
return 0;
}


Measured memory_bytes: 3328
import sys, math
def input():
    return sys.stdin.readline()[:-1]
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from fractions import gcd
e = enumerate

sys.setrecursionlimit(10**7)
H, N = map(int, input().split())
A = list(map(int, input().split()))

if H<=sum(A):
    print('Yes')
else:
    print('No')



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

/** defines and macros */
#define ll long long
#define ull unsigned long long
#define loop(n) for(int i = 0; i < n; i++)
#define loop1(n) for(int i = 1; i <= n; i++)
#define all(v) (v.begin(), v.end())
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define vvi vector<vi>
#define vvpii vector<vii>
#define PB push_back

#define fw(fileName) freopen(fileName, "w", stdout)
#define fr(fileName) freopen(fileName, "r", stdin)
#define fc(stream) fclose(stream);

#define faster_IO_stream ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"

/*To compile and run

	g++ -o main main.cpp && ./main

*/

/*
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣀⣤⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣤⣀⡀⠄⠄⠄⠄⠄⣰⣷⡀⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⣀⣀⣀⠄⠄⠄⠄⠄⣠⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⣄⠄⠄⢠⣿⣿⣷⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠤⠒⠛⠛⠛⠛⠻⠷⣦⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⣿⣿⣿⠟⠁⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⢀⣤⣤⣶⣶⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣡⡤⠐⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⢀⣶⣿⣿⠿⢛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠁⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⢠⣿⠟⠉⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠘⠁⠄⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠻⣿⣿⣿⣿⣿⣿⣿⡛⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⣾⣿⡿⣽⡿⢹⣿⣿⣟⣿⢻⠇⢀⢹⣿⢿⣿⣿⣿⣿⣿⣦⣙⢿⣿⢷⣈⠻⢿⣟⢿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⢿⡿⠁⡿⠁⢸⣿⣿⢹⡇⢸⠄⠈⠄⠻⣏⠻⣿⡿⣿⣿⣿⣌⠛⢿⡌⠙⢧⣀⠙⢳⡹⢻⣿⣿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠘⡇⠄⡇⢠⣼⣿⣿⠈⡇⠘⠤⠤⠤⠤⢜⣢⣘⡻⢮⡛⢿⣿⣷⣬⡤⠤⠤⠤⠥⠤⠥⢬⣿⣧⡄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠁⠄⠄⠘⢿⡏⠛⠄⠄⠄⠄⠄⠄⠄⠄⠄⠙⣿⣿⣿⡿⠋⠉⠛⠉⠄⠄⠄⠄⠄⠄⠄⢹⡿⠃⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⡟⠁⠈⢳⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠱⡀⠄⠄⠄⠄⠄⠄⠄⠄⠄⡜⠁⠄⠄⠈⢇⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⡇⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠑⠦⢄⣀⣀⣀⣀⣀⠴⠊⠄⠄⠄⠄⠄⠄⠑⠤⢀⣀⣀⣀⡀⠠⠔⠋⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣶⣦⣄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢀⣤⣶⣆⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸⣿⣿⣿⣿⣶⣄⣀⣀⣀⣀⣤⣾⣿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢸⣿⣿⣿⣿⣿⣿⠿⠿⠿⢿⣿⣿⣿⣿⣿⣿⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⣿⣿⣿⣿⠟⠁⠄⠄⠄⠄⠙⢿⣿⣿⣿⡟⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⠟⠋⠁⠄⠄⠄⠄⠄⠄⠄⠄⠉⠛⠿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄
 */

int modulo = 1e9 + 7;

int main() {
	faster_IO_stream

	int n;
	cin >> n;

	vector<ull> nums(n);
	ll sum = 0, res = 0;
	loop(n) { cin >> nums[i]; sum += nums[i]; sum %= modulo; }

	loop(n) {
		sum -= nums[i]; if(sum < 0) sum += modulo;
		res += (nums[i] * sum) % modulo; res %= modulo;
	}

	cout << res << endl;

	return 0;
}



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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int GCD(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   if(_a % _b == 0){
      return _b;
   }
   else{
      return GCD(_b, _a % _b);
   }
}

int LCM(const int& a, const int& b){
   const int& _a = max(a,b);
   const int& _b = min(a,b);
   return (_a*_b)/(GCD(_a, _b));
}

int main(){
   int N;
   cin >> N;
   cout << N / 3 << endl;

   return 0;
}

Measured memory_bytes: 256
n = int(input())
alist = list(map(int,input().split()))
query = int(input())
bc = [list(map(int,input().split()))for i in range(query)]

ssum = 0
amx = max(alist)
bcmx = 0
for i in range(query):
    if bcmx < bc[i][1]:
        bcmx = bc[i][1]
mx = max(amx,bcmx)
qlist = [0]*(mx+1)
for a in alist:
    qlist[a] += 1
    ssum += a
anslist = []
for q in range(query):
    b = bc[q][0]
    c = bc[q][1]
    ssum += qlist[b]*(c-b)
    qlist[c] += qlist[b]
    qlist[b] = 0
    anslist.append(ssum)
for ans in anslist:
    print(ans)


'''
adic = {}
ssum = 0
for a in alist:
    if a not in adic:
        adic[a] = 0
    adic[a] += 1
    ssum += a
for q in range(query):
'''

Measured memory_bytes: 98328
// luogu-judger-enable-o2
#include<bits/stdc++.h>
using namespace std;
int a[100001];
int main()
{
	int n,max=0;
	cin>>n;
	for(int i=1;i<=n*2;i++) cin>>a[i];
	sort(a+1,a+2*n+1);
	for(int i=1;i<=n*2;i+=2)
	{
		max+=min(a[i],a[i+1]);
	}
	cout<<max<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void) {
   int N;
   int Q;
   scanf("%d%d", &N, &Q);
   string S;
   vector<int> accumulate(N+2);
   cin >> S;
   int cnt = 0;
   for (int i = 0; i < N; i++) {
      if (S[i] == 'A' && S[i+1] == 'C') {
         cnt++;
      }
      accumulate[i+1] = cnt;
   }

   for (int i = 0; i < Q; i++) {
      int l1;
      int l2;
      scanf("%d%d", &l1, &l2);
      printf("%d\n",accumulate[l2 - 1] - accumulate[l1 - 1]);
   }
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
string alp="abcdefghijklmnopqrstuvwxyz";
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main(){
    string s;cin>>s;
    ll n;n=s.size();
    ll i=0,j=n-1;
    ll ans=0;
    while(i<j){
        if(s[i]=='x' && s[j]=='x'){
            i++;
            j--;
        }else if(s[i]=='x' && s[j]!='x'){
            i++;
            ans++;
        }else if(s[i]!='x' && s[j]=='x'){
            j--;
            ans++;
        }else if(s[i]==s[j]){
            i++;
            j--;
        }else{
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<ans<<endl;
    
    return 0;
}



Measured memory_bytes: 512
//pragma
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define YOU using
#define DONT namespace
#define SAY std

YOU DONT SAY;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
typedef pair<int,ll> pil;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define REPP(i,a,b,d) for(int i=a;i<=b;i+=d)
#define REP(i,a,b) REPP(i,a,b,1)
#define REVV(i,a,b,d) for(int i=a;i>=b;i-=d)
#define REV(i,a,b) REVV(i,a,b,1)

#define FOR(i,a) for(int i=0; i<a; i++)
#define FORD(i,a) for(int i=(int)a-1; i>=0; i--)

#define pb push_back
#define F first
#define S second

const int OO = 1e9;
const ll INF = 1e18;

const int irand(int lo,int hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

const ll lrand(ll lo,ll hi){
	return ((double)rand()/(RAND_MAX + 1.0)) * (hi-lo+1) + lo;
}

#define getc getchar
template<typename T>
T getnum(){
	int sign = 1;
	T ret = 0;
	char c;

	do{
		c = getc();
	}while(c == ' ' || c == '\n');
	if(c == '-')sign = -1;
	else ret = c-'0';
	while(1){
		c = getc();
		if(c < '0' || c > '9')break;
		ret = 10*ret + c-'0';
	}
	return sign * ret;
}

inline void ini(int& x){
	x = getnum<int>();
}

inline void scani(int& x){
	scanf("%d",&x);
}

//end of macro

const ll MOD = 1e9 + 7;
inline ll addmod(ll a, ll b){
    if(a+b<MOD)return a+b;
    return a+b-MOD;
}
inline ll mulmod(ll a, ll b){
    return (a*b)%MOD;
}
inline ll expmod(ll a, ll e){
    ll ret = 1;
    while(e){
        if(e&1)ret = mulmod(ret, a);
        a = mulmod(a, a);
        e >>= 1;
    }
    return ret;
}

const int N = 1e5 + 5;

int mob[N];

int n,k;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    #define endl '\n'
    cout.setf(ios::fixed);
    cout.setf(ios::showpoint);
    cout.precision(10);

    mob[1] = 1;
    REP(i,2,N-1){
        if(mob[i] < 0){
            mob[i] = 0;
        }else{
            if(mob[i] == 0){
                REPP(j,i,N-1,i)mob[j]++;
                for(ll j = (ll)i*i; j < N; j += (ll)i*i) mob[j] = -OO;
            }
            mob[i] = (mob[i]&1) ? -1 : 1;
        }
    }

    cin>>n>>k;
    ll ans = 0;
    REP(g,1,k){ // gcd == g
        ll curr = 0;
        int lim = k/g;
        REP(i,1,lim){ // i as in multiplier
            curr = addmod(curr, mulmod(mob[i], expmod(lim/i, n)));
        }
        // printf("g = %d, ans = %lld\n",g,curr);
        ans = addmod(ans, mulmod(g, curr));
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4044
/* ****GT_18**** */

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define INF			1000000000000000
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define repr(i,a,b) for(ll int i=a;i>=b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;
using namespace __gnu_pbds;

#define N  2005

ll n;
ll dp[N];

ll solve(ll s){
	if(s==0)return 1;
	if(s<0)return 0;
	ll ret=0;
	if(dp[s]!=-1)return dp[s];
	rep(i,3,n+1){
		ret = (ret+solve(s-i))%hell;
	}
	return dp[s]=ret;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
//	cin>>TESTS;
	while(TESTS--)
	{
		cin>>n;
		memset(dp,-1LL,sizeof(dp));
		cout<<solve(n)<<endl;

	}
	return 0;
}

Measured memory_bytes: 3688
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <cstdlib>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional> 
#include <iomanip>
#include <unordered_map>
#include <memory.h>
#include <cstring>
#include <fstream>

using namespace std;

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

	int res = 0;
	string s;

	cin >> s;

	int n = s.length();

	for (int i = 0; i < (n / 2); i++)
	{
		if (s[i] != s[n - 1 - i])
		{
			res++;
		}
	}

	cout << res << '\n';

	return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int n,counter=0;
    cin>>n;
    for(int i=1 ; i<=n ; i++){
            int a;
       cin>>a;
       if(a%2==0){
        counter+=0;
       }
       else{
        if(i%2==0){
            counter+=0;
        }
        else{
            counter+=1;
        }
       }

    }

   cout<<counter;


}


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

const int INF = 1e9 + 7;

ll merge(vector<int> &A, int left, int mid, int right) {
    int n1 = mid - left;
    int n2 = right - mid;
    vector<int> L(n1 + 1);
    vector<int> R(n2 + 1);
    for (int i = 0; i < n1; ++i) {
        L.at(i) = A.at(left + i);
    }
    for (int i = 0; i < n2; ++i) {
        R.at(i) = A.at(mid + i);
    }
    L.at(n1) = INF;
    R.at(n2) = INF;
    ll cnt = 0;
    int i = 0;
    int j = 0;
    for (int k = left; k < right; ++k) {
        if (L.at(i) <= R.at(j)) {
            A.at(k) = L.at(i);
            ++i;
        } else {
            A.at(k) = R.at(j);
            ++j;
            cnt += (mid - left) - i;
        }
    }
    return cnt;
}

ll mergeSort(vector<int> &A, int left, int right) {
    ll cnt = 0;
    if (right - left > 1) {
        int mid = (left + right) / 2;
        cnt += mergeSort(A, left, mid);
        cnt += mergeSort(A, mid, right);
        cnt += merge(A, left, mid, right);
    }
    return cnt;
}

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

    int n;
    cin >> n;
    vector<int> A(n);
    for (int i = 0; i < n; ++i) {
        cin >> A.at(i);
    }
    cout << mergeSort(A, 0, n) << endl;

    return 0;
}


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

using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define INF 1000000007
// cin.eof() 入力個数の問題
int keta(int s){
  int i=0;
  while(s>0){
    s/=10;
    i++;
  }
  return i;
}
void zero(int s){
  int i=6-keta(s);
  rep(e,i){
    cout<<0;
  }
}
int main(){
int n,m;
cin>>n>>m;
pair<int,int> p[m],P[m];

rep(i,m){
  int N,q;
  cin>>N>>q;
  p[i]=make_pair(N,q);
  P[i]=make_pair(N,q);
}
p[m]=make_pair(INF,0);
sort(p,p+m);
vector<map<int,int>> mp(n+1);
int I=0;
rep(i,m){
  I++;
  mp[p[i].first][p[i].second]=I;
  if(p[i].first!=p[i+1].first) I=0;
}

rep(i,m){
  zero(P[i].first);
  cout<<P[i].first;
  zero(mp[P[i].first][P[i].second]);
  cout<<mp[P[i].first][P[i].second];
  cout<<endl;
}

  return 0;
}


Measured memory_bytes: 12416
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
  int N, M;
  cin >> N >> M;
  
  priority_queue<int> nedan;
  int A;
  for( int i = 0; i < N; i++ ){
    cin >> A;
    nedan.push(A);
  }
  
  for( int i = 0; i < M; i++ ){
    int B = nedan.top() / 2;
    nedan.pop();
    nedan.push(B);
  }
  
  int ans = 0;
  while( !nedan.empty() ){
    ans += nedan.top();
    nedan.pop();
  }
  cout << ans << endl;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define print(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

void test();

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto &i : a){
        cin >> i;
    }
    sort(all(a));
    int g1[n],g2[n];
    g1[0] = a[0];
    g2[n-1] = a[n-1];
    f(i,1,n){
        g1[i] = __gcd(g1[i-1],a[i]);
    }
    for(int i=n-2;i>=0;i--){
        g2[i] = __gcd(g2[i+1],a[i]);
    }
    int ans = 0;
    f(i,0,n){
        if(i==0){
            ans = max(ans,g2[i+1]);
        }else if(i==n-1){
            ans = max(ans,g1[i-1]);
        }else{
            ans = max(ans,__gcd(g1[i-1],g2[i+1]));
        }
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1408
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::{stderr, stdin, stdout, BufRead, BufWriter, Read, StdoutLock, Write};
#[allow(unused_imports)]
use std::iter::FromIterator;
#[allow(unused_imports)]
use std::{i64, u64, usize};
#[allow(unused_macros)]
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;($($r :tt ) *) =>{let mut s ={use std ::io ::Read ;let mut s =String ::new () ;std ::io ::stdin () .read_to_string (&mut s ) .unwrap () ;s } ;let mut iter =s .split_whitespace () ;input_inner !{iter ,$($r ) *} } ;}
#[allow(unused_macros)]
macro_rules !input_inner {($iter :expr ) =>{} ;($iter :expr ,) =>{} ;($iter :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($iter ,$t ) ;input_inner !{$iter $($r ) *} } ;}
#[allow(unused_macros)]
macro_rules !read_value {($iter :expr ,($($t :tt ) ,*) ) =>{($(read_value !($iter ,$t ) ) ,*) } ;($iter :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($iter ,$t ) ) .collect ::<Vec <_ >>() } ;($iter :expr ,chars ) =>{read_value !($iter ,String ) .chars () .collect ::<Vec <char >>() } ;($iter :expr ,usize1 ) =>{read_value !($iter ,usize ) -1 } ;($iter :expr ,$t :ty ) =>{$iter .next () .unwrap () .parse ::<$t >() .expect ("Parse error" ) } ;}
#[allow(unused_macros)]
macro_rules !dbg {($($a :expr ) ,*) =>{writeln !(&mut stderr () ,concat !($(stringify !($a ) ," = {:?}, " ) ,*) ,$($a ) ,*) .unwrap () ;} }
#[allow(dead_code)]
///refer to https://github.com/hatoo/competitive-rust-snippets
pub const MOD: u64 = 1_000_000_007;
#[allow(dead_code)]
pub fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}
#[allow(non_snake_case)]
#[allow(dead_code)]
fn main() {
    input! {
        n: u64,
        k: u64,
    }
    let ans: u64 = min(n % k, ((n % k) as i64 - k as i64).abs() as u64);
    println!("{}", ans);
}

Measured memory_bytes: 4352
W, H, x, y = map(int, input().split())

x1, x2 = max(x, W - x), min(x, W - x)
y1, y2 = max(y, H - y), min(y, H - y)

S = W * H / 2
flag = (x1 == x2) and (y1 == y2)
v = 1 if flag else 0

print('{} {}'.format(S, v))


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

using namespace std;
const int MAX = 131072;

int bitl[MAX];
int bitr[MAX];

int suml(int i) {
    int s = 0;
    while (i > 0) {
        s += bitl[i];
        i -= i & -i;
    }
    return s;
}
void addl(int i, int x) {
    while (i <= MAX) {
        bitl[i] += x;
        i += i & -i;
    }
}

int sumr(int i) {
    int s = 0;
    while (i > 0) {
        s += bitr[i];
        i -= i & -i;
    }
    return s;
}
void addr(int i, int x) {
    while (i <= MAX) {
        bitr[i] += x;
        i += i & -i;
    }
}

int main(void){
    int n;
    string s;
    cin >> n >> s;
    int l=0, r=0, tl=0, tr=0;
    for (int i = 0; i < n; i++) {
        if (s[i]=='<') addl(l+1, tr);
        else addr(r+1, tl);
        
        if (s[i]=='<') l++,tl++,tr=0;
        else r++,tr++,tl=0;
    }
    
    int ans = 0, t = 0;
    tl = 0, tr = 0;
    for (int i = 0; i < s.size(); i++) {
        if (s[i]=='<') {
            tl++;
            if (tr > l-tl) {
                int left_rcnt = tr-(l-tl); 
                ans = max(ans, n-(left_rcnt-1)-sumr(left_rcnt));
            }
            else {
                int left_l = tl;
                int right_l = tr;
                ans = max(ans, left_l+right_l+suml(tl+tr));
            }
        }
        else {
            tr++;
            if (l-tl >= tr) ans = max(ans, tl+tr+suml(tl+tr));
            else {
                int left_rcnt = tr-(l-tl);
                ans = max(ans, n-(left_rcnt-1)-sumr(left_rcnt));
            }
        }
    }
    cout << ans << endl;
}

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

using namespace std;

#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define REV(i,n) for(ll (i) = (n) - 1;(i) >= 0;--i)
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {REP(WW,n)cerr << v[WW] << ' ';cerr << endl << endl;}
#define SHOW2d(v,WW,HH) {REP(W_,WW){REP(H_,HH)cerr << v[W_][H_] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 998244353

typedef long long ll;
typedef pair<ll,ll> P;

bool check(vector<ll> v){
	REP(i, v.size() - 1) {
		if(v[i] > v[i+1]){
			return false;
		}
	}
	return true;
}

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

	ll n;cin >> n;
	vector<ll> v(n);
	REP(i, n)cin >> v[i];

	REP(i, n){
		REP(j, i){
			swap(v[i], v[j]);
			if(check(v)){
				cout << "YES" << endl;
				return 0;
			}
			swap(v[i], v[j]);
		}
	}

	if(check(v)){
		cout << "YES" << endl;
		return 0;
	}

	cout << "NO" << endl;

	return 0;
}


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



int main() {
	map<string,bool> dic;
	int N; cin >> N;
	string com, s;
	for (int i = 0; i < N; i++) {
		cin >> com >> s;
		if (com[0] == 'i') {
			dic[s] = true;
		}
		else {
			if (dic[s])cout << "yes" << endl;
			else cout << "no" << endl;
		}
	}
}


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

int main(){
    int n;
    cin >> n;
    int a;
    cin >> a;
    rep(i,n-1){
        int b;
        cin >> b;
        a = __gcd(a,b);
        if(a == 1) break;
    }
    cout << a << endl;
    return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()
#define INF 1<<25

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int a[105];
int dp[105][105];

int main()
{
	memset (a, 0, sizeof (a ) );
	memset (dp, 0, sizeof (dp ) );

	ios_base::sync_with_stdio(0);
	int n; cin >> n;

	rep (i, n+1 ) for (int j = i+1; j < n+1; j++ ) dp[i][j] = INF;

	
	rep (i, n ){
		int r, c; cin >> r >> c;
		a[i] = r; a[i+1] = c;
	} // end rep

	for (int i = n; i >= 1; i-- ){
		for (int j = i; j <= n; j++ ){
			for (int k = i; k < j; k++ ){
				int curr = dp[i][k] + dp[k+1][j];
				dp[i][j] = min (dp[i][j], curr + a[i-1]*a[k]*a[j] );
			} // end for
		} // end for
	} // end for

	int res = dp[1][n];
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 1244
#include <iostream>
#include <vector>
#include <deque>
#include <set>
#include <cmath>
#include <bits/stdc++.h>
#include <limits>

#define MOD 1000000007

using namespace std;

int main(void){
    // Your code here!
    char a, b;
    
    cin >> a >> b;
    
    if(a > b)
        cout << '>' << endl;
    else if(a < b)
        cout << '<' << endl;
    else
        cout << '=' << endl;
        
    return 0;
}

Measured memory_bytes: 256
N = int(raw_input())
A = map(int, raw_input().split())
i = 0
flag = 1
while flag:
    flag = 0
    for j in range(N-1, 0, -1):
        if A[j] < A[j-1]:
            A_j = A[j]
            A[j] = A[j-1]
            A[j-1] = A_j
            flag = 1
            i += 1
print " ".join(map(str, A))
print i

Measured memory_bytes: 6456
# include <bits/stdc++.h>
# define ll long long
using namespace std;
const int N = 2e5 + 10;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int k, a, b;
	cin >> k >> a >> b;
	for(int j = k; j <= b; j += k){
		if(j >= a){
			cout << "OK\n";
			return 0;
		}
	}
	cout << "NG\n";
}

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

int main() {
  int n;
  cin >> n;
  vector<int> p(n), q(n);
  rep(i, n) cin >> p.at(i);
  rep(i, n) cin >> q.at(i);
  vector<int> a(n);
  rep(i, n) a.at(i) = i+1;
  
  map<vector<int>, int> mp;
  do {
    mp[a] = mp.size();
  } while (next_permutation(a.begin(), a.end()));
  int ans = abs(mp[p] - mp[q]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define sz size()
#define all(a) a.begin(), a.end()
#define allr(a) a.rbegin(), a.rend()
#define mod 1000000007
#define forn(i, n) for (int i = 0; i < (int) (n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string s;
    cin >> s;

    while(s.size() > 4){
        if((s.substr(s.size()-5,s.size())) == "erase" || (s.substr(s.size()-5,s.size())) == "dream"){
            s.erase(s.size()-5,s.size());
        }else
        if((s.substr(s.size()-6,s.size())) == "eraser"){
            s.erase(s.size()-6,s.size());
        }else
        if((s.substr(s.size()-7,s.size())) == "dreamer"){
            s.erase(s.size()-7,s.size());
        }else{
            break;
        }
    }
    
    if(s.size() == 0){
        cout << "YES";
        return 0;
    }
    cout << "NO";
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int a[1010];
int main()
{
	int n;
	int i;
	scanf("%d",&n);
	for(i=0; i<n; i++) a[i] = i+1;
	do{
		for(i=0; i<n; i++)
		{
			if(i == n-1) printf("%d\n",a[i]);
			else printf("%d ",a[i]);
		}
	}while(next_permutation(a, a+n));
	return 0;
}


Measured memory_bytes: 3212
#include<bits/stdc++.h>
#define ll                long long int
#define ld                long double
#define pb                push_back
#define pf                push_front
#define ppb               pop_back
#define ppf               pop_front
#define sz                size()
#define pi                acos(-1.0)
#define mod               1000000007
#define F                 first
#define S                 second
#define C                 continue
#define G                 goto done
#define maxe              max_element
#define mine              min_element
#define min3(a,b,c)       min(a,min(b,c))
#define max3(a,b,c)       max(a,max(b,c))
#define min4(a,b,c,d)     min(a,min(b,min(c,d)))
#define max4(a,b,c,d)     max(a,max(b,max(c,d)))
#define mem(a,b)          memset(a,b,sizeof(a))
#define all(a)            (a).begin(),(a).end()
#define gcd(a,b)          __gcd(a,b)
#define lcm(a,b)          ((a)*((b)/gcd(a,b)))
#define case(a)           cout<<"Case "<<(a)<<": "
#define point(a)          fixed<<setprecision(a)
#define get(a)            for(auto &x:a) cin>>x
#define print(a)          for(auto x:a) cout<<x<<" "; cout<<endl
#define see(x)            cout<<#x<<" = "<<x<<endl
#define uniq(a)           sort(all(a)); (a).erase(unique((a).begin(),(a).end()),(a).end())
#define big(a)            transform((a).begin(),(a).end(),(a).begin(),::toupper)
#define small(a)          transform((a).begin(),(a).end(),(a).begin(),::tolower)
#define ischar(a)         (('a'<=a&&a<='z')('A'<=a&&a<='Z'))
#define isvowel(a)        (a=='a'||a=='e'||a=='i'||a=='o'||a=='u'||a=='A'||a=='E'||a=='I'||a=='O'||a=='U')
#define fast              ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define tc                int test; cin>>test; while(test--)
using namespace std;
int main()
{
    string s; cin>>s;
    if(s=="Sunny") cout<<"Cloudy";
    else if(s=="Cloudy") cout<<"Rainy";
    else cout<<"Sunny";
}




















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

int main(){
  int n;
  cin >> n;
  long long d[n];
  for(int i=0;i<n;i++) cin >> d[i];
  if(d[0]!=0){
    cout << 0 << endl;
  }
  else{
    map<long long,long long> mp;
    for(int i=0;i<n;i++) mp[d[i]]++;
    long long cnt = 1;
    for(int i=1;i<n;i++){
      cnt*=mp[d[i]-1];
      cnt %= 998244353;
    }
    cout << cnt << endl;
  }
}


Measured memory_bytes: 7296
#include <bits/stdc++.h>
#define rep(i,a,n)  for (int i=(int)(a); i<=(int)(n); ++i)
#define rrep(i,a,n) for (int i=(int)(a); i>=(int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) rep(i, x.size()) cerr << x[i] << (i == x.size() - 1 ? "\n" : " ")
#define all(x) x.begin(),x.end()
#define int long long
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = ((1LL << 30) + (1LL << 29));
const int MOD = 1000000007;

//=============================
int N,M,K;

string S,T;
int A,B,C,D;
//=============================
void input()
{
    cin>>A>>B>>C>>D;

}
//=============================
void func(){}
//=============================
void solve()
{
    cout<<min(A,B)+min(C,D)<<endl;

}
//=============================
signed main()
{
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <bitset>
using namespace std;
template <typename T = int>
T in() {
    T temp;
    cin >> temp;
    return temp;
}
/*
uint64_t GetXor (uint64_t A, uint64_t B) {
    uint64_t ret;
    for (uint64_t i = A; i <=B; i++) {
        if (i == A) ret = i;
        else ret ^= i;
    }
    return ret;
}
*/
class XorWorld {
    uint64_t A;
    uint64_t B;
    uint64_t diff;
public : 
    XorWorld(uint64_t A_p, uint64_t B_p) : A(min(A_p, B_p)), B(max(A_p,B_p)), diff(B - A + 1) {}
    uint64_t GetXor (uint64_t A, uint64_t B) {
        uint64_t ret;
        for (uint64_t i = A; i <=B; i++) {
            if (i == A) ret = i;
            else ret ^= i;
        }
                        

        return ret;
    }

    uint64_t Calculate() {
        uint64_t ret;
     if (diff < 5) {
            ret = GetXor(A, B);
        } else {
                    
            if ((A & 1) == 0) {
                
                diff = (diff & 3);
                A = B - diff + 1;
                ret = GetXor(A, B);
               
            } else if ((B & 1) == 1) {
                diff = (diff & 3);
                B = A + diff - 1;
                ret = GetXor(A, B);

            // Both are odd numbers
            } else {
                uint64_t A1 = A + 1;
                diff--;
                diff = (diff & 3);
                A1 = B - diff + 1;
                ret = A ^ GetXor(A1, B);
            }
        }
        return ret;   
    }

};
int main() {
    uint64_t A(in<uint64_t>()), B(in<uint64_t>());
//    uint64_t diff = B - A + 1;
    XorWorld world(A, B);
   
//     cout << exa << endl; 
    cout << world.Calculate() << endl;
    return 0;
}




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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> lamp(m);
  for (int i = 0; i < m; i++) {
    int k;
    cin >> k;
    vector<int> l(k);
    for (int j = 0; j < k; j++) {
      int s;
      cin >> s;
      s--;
      l[j] = s;
    }
    lamp[i] = l;
  }
  vector<int> p(m);
  for (int i = 0; i < m; i++) {
    cin >> p[i];
  }
  int ans = 0;
  for (int i = 0; i < (1 << n); i++) {
    bool ok = true;
    for (int j = 0; j < m; j++) {
      int count = 0;
      for (auto it : lamp[j]) {
        if ((i & (1 << it)) != 0) {
          count++;
        }
      }
      if (count % 2 != p[j]) {
        ok = false;
      }
    }
    if (ok)
      ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int x,y,s,ma,d,pa;
	while(cin>>x>>y>>s){
		if(x==0&&y==0&&s==0) break;
		ma=0;
		for(int s1=1;s1<s;s1++){
			for(int s2=1;s2<s;s2++){
				d=s1*(100+x)/100+s2*(100+x)/100;
				if(d==s){
					pa=s1*(100+y)/100+s2*(100+y)/100;
					ma=max(ma,pa);
				}
			}
		}
		cout<<ma<<endl;
	}
    return 0;
}

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

int main(){
    int n, d;
    int x[20][20];
    cin >> n >> d;

    for(int i = 0;i < n;i++){
        for(int j = 0;j < d;j++){
            cin >> x[i][j];
        }
    }

    int ans = 0;
    for(int i = 0;i < n;i++){
        for(int j = i+1;j < n;j++){
            int sum = 0;
            for(int k = 0;k < d;k++){
                sum += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
            }

            int k;

            for(k = 1;k*k < sum;k++);

            if(k*k == sum) ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		new Main().solve();
	}
	
	void solve(){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int m=sc.nextInt();
		int[]a=new int[m];
		int[]b=new int[m];
		ArrayList<Integer>[] go=new ArrayList[n];
		for(int i=0;i<n;i++){
			go[i]=new ArrayList<Integer>();
		}
		for(int i=0;i<m;i++){
			a[i]=sc.nextInt()-1;
			b[i]=sc.nextInt()-1;
			go[a[i]].add(b[i]);
			go[b[i]].add(a[i]);
		}
		for(int i=0;i<n;i++){
			boolean flag1=false;
			boolean flag2=false;
			for(int j=0;j<go[i].size();j++){
				if(go[i].get(j)==0)flag1=true;
				if(go[i].get(j)==n-1)flag2=true;
			}
			if(flag1 && flag2){
				System.out.println("POSSIBLE");
				return;
			}
		}
		System.out.println("IMPOSSIBLE");
		
	}
}

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

int x, y, s;

int main() {
    while (cin >> x >> y >> s, x) {
        int ans = 0;
        for (int i = 1; i < s; i++) {
            for (int j = 1; j < s; j++) {
                int a = i * (100 + x) / 100;
                int b = j * (100 + x) / 100;
                if (a + b != s) continue;
                ans = max(ans, i * (100 + y) / 100 + j * (100 + y) / 100);
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 2984
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

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

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T &data, vector<int> &iter)
{
  cout << data << " ";
}
template <typename T>
void dump(const vector<T> &data, vector<int> &iter)
{
  for (auto elem : data)
    dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>> &data, vector<int> &iter)
{
  for (auto elem : iter)
  {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++)
  {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T> &data, int dummy)
{
  for (int i = 0; i < data.size(); i++)
  {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T &data)
{ // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

void solve(long long N, std::vector<long long> A)
{
  vector<int> cnt(N, 0);
  for (int i = 0; i < N - 1; i++)
  {
    cnt[A[i] - 1]++;
  }
  for (auto a : cnt)
    cout << a << endl;
}

int main()
{
  cout << setprecision(10);
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N - 2 + 1);
  for (int i = 0; i < N - 2 + 1; i++)
  {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}


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

// Range Minimum Query in sqrt decomposition.

// 各バケットの区間幅。だいたい√max(N)くらいになるように設定しよう。
const int width = 512;

struct sqrt_decomposition{
  // minの単位元 2^31-1 の値を持つ。
  const int INF = INT_MAX;
  
  // n:元の配列のサイズ。
  // k:バケットの総数。
  int n, k;
  
  // data:元の配列
  // bucket:バケット。widthごとの最小値を持つ。
  vector<int> data, bucket;

  // @param sz 初期化したい、元の配列のサイズ。
  // 各メンバ変数を初期化する。
  sqrt_decomposition(int sz){
    n = sz;
    // n/widthの切り上げ。バケットはこれだけあれば十分
    k = (n+width-1) / width;
    // 配列外参照しないように、配列自体はバケットが覆う区間全てを持っておく。
    data.assign(k*width, INF);
    // バケットを初期化。
    bucket.assign(k,INF);
  }
  
  // 区間[l,r)のminを調べる。
  int find(int l, int r){
    int res = INF; //返り値。単位元INFで初期化しておく。
    
    // バケットを全て探索し、バケットの管理する区間[a,b)が
    // [l,r)の外側ならスキップ。
    // [l,r)の内側ならバケットの値とresを比較し小さい方を代入。
    // [l,r)の境界上にあるなら、[a,b)との共通区間である[max(l,a),min(r,b))を全て調べる。
    for(int i=0; i<k; ++i){
      // 各バケットが管理する区間[a,b)
      int a = i*width, b = (i+1)*width;
      // 外側：スキップ
      if(b <= l || r <= a) continue;
      // 内側：バケットの値とresを比較
      else if(l <= a && b <= r) res = min(res, bucket[i]);
      // 境界：[l,r)と[a,b)の共通部分を全て調べ、resと比較。
      else{
        for(int j = max(a,l); j < min(b,r); ++j){
          res = min(res, data[j]);
        }
      }
    }
    return res;
  }

  // i番目の要素をxに更新し、影響するバケットも確認して更新する。
  void update(int i, int x){
    // 大元のデータを更新。
    data[i] = x;
    // 該当するバケットのindex
    int bid = i/width;
    // そのバケットの管理する区間[a,b)
    int a = bid*width, b = (bid+1)*width;
    // 最終的にバケットに代入される値。[a,b)の最小値。
    int minval = x;
    // [a,b)内の全ての要素を確認し、minvalと比較、更新する。
    for(int j = a; j < b; ++j){
      minval = min(minval, data[j]);
    }
    // バケットをその値で更新する。
    bucket[bid] = minval;
  }
};

int main(){
  int n,q;
  cin >> n >> q;
  sqrt_decomposition rmq(n);
  for(int i=0;i<q;++i){
      int com,x,y;
      cin >> com >> x >> y;
      if(com==0){
          rmq.update(x,y);
      }else{
          cout << rmq.find(x,y+1) << endl;
      }
  }
}




Measured memory_bytes: 3104
#include <stdio.h>

int main(void)
{
    int num[5];
    int i, j;
    int tmp;

    scanf("%d %d %d %d %d", &num[0], &num[1], &num[2], &num[3], &num[4]);

    for (i = 0; i < 5; i++){
        for (j = i + 1; j < 5; ++j){
            if (num[i] < num[j]){
                tmp = num[i];
                num[i] = num[j];
                num[j] = tmp;
            }
        }
    }

    for (i = 0; i < 4; i++){
        printf("%d ", num[i]);
    }

    printf("%d\n", num[4]);

    return (0);
}

Measured memory_bytes: 596
awk '$0=NR%2FS$NF' RS=\ |sort|uniq -c|sort -nr|awk 's+=t=$1{$2?a?b||b=t:(a=t)>c=$3:d?e||e=t:(d=t)>f=$3}END{print s-(c~f?a+e<b+d?b+d:a+e:a+d)}'

Measured memory_bytes: 11720
#include <cstdio>
#include <cstring>
using namespace std;

#define L 3194304
bool HA[L];
char T[256];

int main() {
    int n, sum, t;
    char c;
    T['A'] = (char)1, T['C'] = (char)2, T['G'] = (char)3, T['T'] = (char)4;
    scanf("%d", &n);
    while ( getchar() != '\n' );
    for ( register int i = 0; i++ < n; ) {
        sum = 0;
        t = 1;
        bool flag = ( c = getchar() ) == 'i';
        while ( ( c = getchar() ) != ' ' );
        while ( ( c = T[getchar()] ) != 0 ) {
            sum += c * t;
            t *= 4;
        }
        if ( flag ) {
            HA[sum] = true;
        } else {
            puts( HA[sum] ? "yes" : "no" );
        }
    }
    return 0;
}

Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pf push_front

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

#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)



int main(){ 
 int y, m, d;
  char c1, c2;
  cin >> y >> c1 >> m >> c2 >> d;
  cout << (m <= 4 ? "Heisei" : "TBD") << endl;
  return 0;
}


Measured memory_bytes: 256