akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;   
#define ll long long
#define ull unsigned long long
// #define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> 
ll mod=1e9+7;
#define PI 3.1415926535897932385
#define inf 9e18
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
typedef pair<long long, long long> ii;
#define S second
#define F first
ll max(ll a,ll b){if(a>b){return a;}return b;}
ll min(ll a,ll b){if(a<b){return a;}return b;}
#define MAXN 200005
// Comment this out for interactice problem
// #define endl '\n'
// string to integer stoi() Remember: it takes string not character
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
 
// To compile--> g++ -std=c++0x -o output one.cpp
// To run--> ./output

int main() 
{ 
    fastio;
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    ll n,m,k;
    cin>>n>>m>>k;
    ll a[n+1];
    ll b[m+1];
    for (int i = 1; i < n+1; ++i)
    {
        cin>>a[i];
    }
    for (int i = 1; i < m+1; ++i)
    {
        cin>>b[i];
    }

    ll dp1[n+1];
    ll dp2[m+1];
    dp1[0]=0;
    dp2[0]=0;
    for (int i = 1; i < n+1; ++i)
    {
        dp1[i]=dp1[i-1]+a[i];
    }
    for (int i = 1; i < m+1; ++i)
    {
        dp2[i]=dp2[i-1]+b[i];
    }

    ll tot=0;
    for (int i = 0; i < n+1; ++i)
    {
        ll left = k-dp1[i];
        if(left>=0){
            auto pos = lower_bound(dp2, dp2+m+1, left)-dp2;
            if(pos>m){
                tot = max(tot, i+m);
            }
            else{
                ll total = dp1[i]+dp2[pos];
                if(total<=k){
                    tot = max(tot, i + pos);
                }
                else{
                    tot = max(tot, i + pos - 1);
                }
            }
        }
    }
    cout<<tot;


    return 0;
}

Measured memory_bytes: 9868
#[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::iter::FromIterator;
#[allow(unused_imports)]
use std::io::stdin;

mod util {
    use std::io::stdin;
    use std::str::FromStr;
    use std::fmt::Debug;

    #[allow(dead_code)]
    pub fn line() -> String {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.trim().to_string()
    }

    #[allow(dead_code)]
    pub fn gets<T: FromStr>() -> Vec<T>
    where
        <T as FromStr>::Err: Debug,
    {
        let mut line: String = String::new();
        stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|t| t.parse().unwrap())
            .collect()
    }
}

#[allow(unused_macros)]
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
                   ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
                   ).collect::<Vec<_>>()
    };
    ($t:ty ;;) => {
        {
            let mut line: String = String::new();
            stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn main() {
    let (a, b, c) = get!(u64, u64, u64);

    if a % 2 == 0 || b % 2 == 0 || c % 2 == 0 {
        println!("{}", 0);
        return;
    }

    println!("{}", [a * b, b * c, a * c].into_iter().min().unwrap());
}


Measured memory_bytes: 4352
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<62)
typedef pair<ll, ll> P;
#define MOD (1000000007ll)
#define l_ength size
#define T ((ll)(2e12))

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

int main(void){
	int n,m,x,y,i,ball[123456],ans=0;
	bool flag[123456];
	fill(flag,flag+123456,false);
	fill(ball,ball+123456,1);
	flag[0] = true;
	cin >> n >> m;
	for(i=0; i<m; ++i){
		cin >> x >> y;
		x--; y--;
		--ball[x];
		++ball[y];
		if(flag[x]){
			flag[y] = true;
		}
		if(!ball[x]){
			flag[x] = false;
		}
	}
	for(i=0; i<n; ++i){
		if(flag[i]){
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 896
import sys
def popcount(n):
    return bin(n).count("1")

def main():
    from sys import stdin, stdout
    input = stdin.readline
    print = stdout.write
    n = int(input())
    x = input().rstrip()
    pc = sum(1 for i in x if i == '1')
    xint = int(x, 2)
    lpc = [1 for i in range(n)]
    upc = [1 for i in range(n)]
    dp = [1 for i in range(n+1)]
    for i in range(1, n+1):
        dp[i] = dp[i % popcount(i)] + 1
    lmod = xint % (pc - 1) if pc >= 2 else -1
    rmod = xint % (pc + 1)
    if pc >= 2:
        for i in range(1, n):
            lpc[i] = (lpc[i - 1] * 2) % (pc - 1)
    for i in range(1, n):
        upc[i] = (upc[i - 1] * 2) % (pc + 1)
    for i in range(n - 1, -1, -1):
        if x[n-1-i] == '1':
            if pc == 1:
                print('0\n')
            else:
                print('%d\n' % (dp[(lmod - lpc[i]) % (pc-1)]))
        else:
            print('%d\n' % (dp[(rmod + upc[i]) % (pc+1)]))

main()

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

using namespace std;

#define pb push_back
#define mem(a) memset(a,0,sizeof(a))

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

const int mn=2e3+5;

int n,m,q;
int a[mn],b[mn];
int mini;

int main() {
#ifdef LOCAL
	freopen("../1.txt", "r", stdin);
#endif
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),b[i]=a[i];
	sort(b+1,b+n+1);
	int ans=1e9;
	a[n+1]=-1;
	for(int i=1;i<=n;i++){
		int mini=b[i];
		int l=0;
		vector<int> candelete;
		//printf("in:%d %d %d\n",i,b[i]);
		for(int j=1;j<=n+1;j++){
			if (a[j]<b[i]){
				//printf("break in:%d %d\n",l,j);
				if (j-l-1<m) {
					l=j;
					continue;
				}
				vector<int> v;
				for(int k=l+1;k<j;k++){
					v.pb(a[k]);
					//printf("push:%d %d\n",k,a[k]);
				}
				sort(v.begin(),v.end());
				for(int k=1;k<=j-l-m;k++){
					candelete.pb(v[k-1]);
					//printf("repush:%d %d %d\n",i,j,v[k-1]);
				}
				l=j;
			}
		}
		sort(candelete.begin(),candelete.end());
		if (candelete.size()<q) break;
		ans=min(ans,candelete[q-1]-mini);
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

// 剰余体における逆元の算出用メソッド
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1)
      res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

ll modinv(ll a, ll mod) { return modpow(a, mod - 2, mod); }

ll modnCr(ll n, ll r, ll mod) {
  ll ans = 1;
  FOR(i, 1, n + 1) { ans = (ans * i) % mod; }
  ll inv = 1;
  FOR(i, 1, r + 1) { inv = (inv * i) % mod; }
  FOR(i, 1, n - r + 1) { inv = (inv * i) % mod; }

  ans = (ans * modinv(inv, mod)) % mod;
  return ans;
}

int main() {
  ll x, y;
  cin >> x >> y;
  if ((2 * x - y) < 0 || (2 * y - x) < 0) {
    cout << 0 << endl;
    return 0;
  }
  if ((2 * x - y) % 3 != 0 || (2 * y - x) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }

  ll k = (2 * y - x) / 3;
  ll l = (2 * x - y) / 3;

  cout << modnCr(k + l, k, MOD) << endl;
}


Measured memory_bytes: 256
/**********************************************************************/
/********                                                      ********/
/********                     Writer:孙~~                      ********/
/********                       Lang:C++                       ********/
/********                     Status:Unknow                    ********/
/********                                                      ********/
/**********************************************************************/
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <queue>
#include <list>
#include <cstdlib>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <cstring>
#include <cmath>
//#include<bits/stdc++.h>
using namespace std;
#define max(a,b,c) (max(a,max(b,c)))

const int INF=0x3f3f3f3f;
const int SIZE=1000005;

vector<pair<int,int> > mp[SIZE];
vector<int> path[SIZE];
bool vis[SIZE];
int par[SIZE],dist[SIZE*2],id[SIZE];
bool use[SIZE];

int getp(int a){
	if(par[a]==a) return a; else return par[a]=getp(par[a]);
}

void mer(int a,int b){
	par[getp(a)]=getp(b);
}

int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++){
		int p,q,c;
		scanf("%d%d%d",&p,&q,&c);
		mp[c].push_back(make_pair(p,q));
	}
	int sz=n;
	for(int col=1;col<SIZE;col++){
		for(int i=0;i<mp[col].size();i++){
			int a=mp[col][i].first,b=mp[col][i].second;
			par[a]=a;
			par[b]=b;
			use[a]=use[b]=false;
			id[a]=id[b]=-1;
		}
		for(int i=0;i<mp[col].size();i++){
			mer(mp[col][i].first,mp[col][i].second);
		}
		for(int i=0;i<mp[col].size();i++){
			int a=mp[col][i].first,b=mp[col][i].second;
			if(!use[a]){
				int r=getp(a);
				use[a]=true;
				if(id[r]==-1) id[r]=++sz;
				path[a].push_back(id[r]);
				path[id[r]].push_back(a);
			}
			if(!use[b]){
				int r=getp(b);
				use[b]=true;
				if(id[r]==-1) id[r]=++sz;
				path[b].push_back(id[r]);
				path[id[r]].push_back(b);
			}
		}
	}
	memset(dist,-1,sizeof(dist));
	dist[1]=0;
	queue<int> que;
	que.push(1);
	while(!que.empty()){
		int d=que.front();
		que.pop();
		for(int i=0;i<path[d].size();i++){
			int to=path[d][i];
			if(dist[to]==-1){
				dist[to]=dist[d]+1;
				que.push(to);
			}
		}
	}
	int ans=dist[n];
	if(ans!=-1) ans/=2;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 75008
#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 pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

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

const ll mod=1000000007;
//head

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

    int n; string s;
    cin >> n >> s;

    vi occ[10];

    for(int i = 0; i < n; i++) {
        int digit = s[i] - '0';
        occ[digit].pb(i);
    }

    int cnt = 0;
    for(int i = 0; i < 10; i++) {
        auto x = lower_bound(all(occ[i]), 0);
        if(x == occ[i].end()) continue;
        int ind = *x;
        for(int j = 0; j < 10; j++) {
            auto y = lower_bound(all(occ[j]), ind + 1);
            if(y == occ[j].end()) continue;
            int ind2 = *y;
            for(int k = 0; k < 10; k++) {
                auto z = lower_bound(all(occ[k]), ind2 + 1);
                if(z == occ[k].end()) continue;
                //cout << ind << " " << ind2 << " " << z - occ[k].begin() << endl;
                cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


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

// @@ !! LIM()

int main(/* int argc, char *argv[] */) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N, M; cin >> N >> M;
  vector<string> A(N), B(M);
  for (ll i = 0; i < N; i++) cin >> A.at(i);
  for (ll i = 0; i < M; i++) cin >> B.at(i);
  for (ll i = 0; i <= N - M; i++) {
    for (ll j = 0; j <= N - M; j++) {
      bool trial = true;
      for (ll k = 0; k < M; k++) {
	if (B.at(k) != A.at(i + k).substr(j, M)) {
	  trial = false;
	  break;
	}
      }
      if (trial) {
	cout << "Yes\n";
	return 0;
      }
    }
  }
  cout << "No\n";
  return 0;
}



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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
//#define int ll
//#define int __int128
//#define ll __int128
//typedef __int128 long long;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;
typedef complex<double> base;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef MAX_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";

template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}



void smain();

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

#ifdef MAX_HOME
    freopen("input.txt", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef MAX_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
}

const int N = 1e5 + 100;


void smain() {


    int n;
    cin >> n;
    vl a(n);
    vl b(n);
    fori (i, n) {
        cin >> b[i];
        a[i] = i + 1;
    }
    vl op;
    fori (i, n) {
        bool ok = false;
        for (int j = n - 1; j >= 0; --j) if (b[j] != -1 && a[j] == b[j]) {

            ok = true;
            for (int k = j; k < n; ++k) a[k]--;
            op.push_back(b[j]);
            b[j] = -1;
            break;
        }
        if (!ok) {
            cout << "-1";
            return;
        }
    }
    reverse(ALL(op));
    for (auto x : op) cout << x << ' ';
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<map>
#include<ctime>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<bitset>
#define ll long long 
#define ull unsigned long long 
#define mem(a) memset(a,0,sizeof(a))
#define rint register int 
#define rll register long long 
#define rull register unsigned long long 
#define rchar register char
#define rstring register string 
#define rfloat register float
#define rdouble register double 
#define fio ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define For(i,a,b) for(int i=a;i<b;i++)
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define cFor(i,a,b) for(int i=a;i>b;i--)
#define cFOR(i,a,b) for(int i=a;i>=b;i--)
#define lFor(i,a,b) for(ll i=a;i<b;i++)
#define lFOR(i,a,b) for(ll i=a;i<=b;i++)
#define lcFor(i,a,b) for(ll i=a;i>b;i--)
#define lcFOR(i,a,b) for(ll i=a;i>=b;i--)
using namespace std;
int main(){
	fio;
	int n,m;
	cin>>n>>m;
	if(m>=n)
		cout<<"Yes\n";
	else
		cout<<"No\n";	
}

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

using ll = long long;

int main()
{
    int N; cin >> N;
    vector<ll> A(N); for (auto& e : A) cin >> e;

    vector<ll> s(N);
    partial_sum(A.begin(), A.end(), s.begin());

    ll ans = LLONG_MAX;
    for (int c = 2; c <= N-2; c++) {
        auto it_l = upper_bound(s.begin(), s.begin() + c, s[c-1]/2);
        int l = max(1, (int)distance(s.begin(), it_l));
        if (l + 1 != c) {
            ll d1 = abs(s[c-1] - s[l-1] - s[l-1]);
            ll d2 = abs(s[c-1] - s[l] - s[l]);
            if (d2 < d1) l++;
        }

        auto it_r = upper_bound(s.begin() + c, s.end(), (s[c-1]+s.back())/2);
        int r = max(c+1, (int)distance(s.begin(), it_r));
        if (r + 1 != N) {
            ll d1 = abs((s[r-1] - s[c-1]) - (s.back() - s[r-1]));
            ll d2 = abs((s[r  ] - s[c-1]) - (s.back() - s[r]));
            if (d2 < d1) r++;
        }
        vector<ll> pqrs(4);
        pqrs[0] = s[l-1];
        pqrs[1] = s[c-1]   - s[l-1];
        pqrs[2] = s[r-1]   - s[c-1];
        pqrs[3] = s.back() - s[r-1];

        ll a = *max_element(pqrs.begin(), pqrs.end()) - *min_element(pqrs.begin(), pqrs.end());
        ans = min(ans, a);
    }

    cout << ans << endl;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using edge = pair<ll, P>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
using Graph = vector<vector<ll>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif

template<class T>
class SegmentTree {

public:
    /**
     * @param N size
     * @param e identity element
     * @param operation operation for query
     * @param updater operation for update
     */
    SegmentTree(size_t N, T e, function<T(T, T)> operation, function<T(T, T)> updater)
            : e(e), operation(std::move(operation)), updater(move(updater)) {
        n = 1;
        while (n < N) {
            n *= 2;
        }
        data = vector<T>(2 * n - 1, e);
    }

    /**
     * iの値をxに更新
     * @param i index ( 0-indexed )
     * @param x  value
     */
    void update(int i, T x) {
        i += n - 1;
        data[i] = updater(data[i], x);
        while (i > 0) {
            i = (i - 1) / 2;
            data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
        }
    }

    /**
     * [a, b)の区間でクエリを実行
     */
    T query(int a, int b) {
        return query(a, b, 0, 0, n);
    }

    /**
     * 添字でアクセス
     * @param i index ( 0-indexed )
     */
    T operator[](int i) {
        return data[i + n - 1];
    }

private:
    int n;
    vector<T> data;
    T e;
    function<T(T, T)> operation;
    function<T(T, T)> updater;

    T query(int a, int b, int k, int l, int r) {
        // 交差しない
        if (r <= a || b <= l) return e;
        // 区間 [a, b) に l, r が含まれる
        if (a <= l && r <= b) return data[k];
        // 左の子
        T c1 = query(a, b, 2 * k + 1, l, (l + r) / 2);
        // 右の子
        T c2 = query(a, b, 2 * k + 2, (l + r) / 2, r);
        return operation(c1, c2);
    }
};

void Main() {
    ll N, M;
    cin >> N >> M;
    string S;
    cin >> S;
    reverse(S.begin(), S.end());
//    print(S);
    vector<ll> query;
    ll i = 0;
    while (i != N){
        if (S[i] == '0') {
            ll idx = min(N, i + M);
            while (idx > i + 1 && S[idx] != '0') {
                idx --;
            }
//            print(i,idx);
            if (S[idx] == '0') {
                query.push_back(idx - i);
                i = idx;
            }else{
                cout << -1 << '\n';
                return;
            }
        }
    }
    rrep(i, query.size() - 1, 0) {
        cout << query[i] << ' ';
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


Measured memory_bytes: 1480
#!/usr/bin/env python3
import sys


def solve(N: int, p: "List[int]"):

    ans = 0
    
    for i in range(N-1):
        
        if(i+1 == p[i]):
            p[i],p[i+1] = p[i+1],p[i]
            ans += 1

    for i in range(N-1,-1,-1):
        if(i+1 == p[i]):
            p[i],p[i-1] = p[i-1],p[i]
            ans += 1    

    print(ans)

    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    p = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, p)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14452
//#define BUG
#include <bits/stdc++.h>

using namespace std;

#define sz(x) (int)((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define fi first
#define se second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fore(i, a, b) for (int i = (a), _b = (b); i < _b; ++i)
#define fort(i, a, b) for (int i = (a), _b = (b); i <= _b; ++i)
#define ford(i, a, b) for (int i = (a), _b = (b); i >= _b; --i)
#ifdef BUG
#define bug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << ": " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " /";
    __f(comma + 1, args...);
}
#endif

template <class T> bool mini(T& a, T b) { return a > b ? (a = b, 1) : 0; }
template <class T> bool maxi(T& a, T b) { return a < b ? (a = b, 1) : 0; }

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vii> vvii;

const int INF = (int)1e9 + 7;

int main() {
#ifdef LOCAL
    freopen("CP.inp", "r", stdin);
//    freopen("CP.out", "w", stdout);
#endif // LOCAL
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s; cin >> s;
    if (sz(s) == 2) {
        cout << (s[0] == s[1] ? "1 2\n" : "-1 -1\n");
        return 0;
    }
    fore(i, 0, sz(s) - 2) if (s[i] == s[i + 1] || s[i] == s[i + 2] || s[i + 1] == s[i + 2]) {
        cout << i + 1 << ' ' << i + 3 << '\n';
        return 0;
    }
    cout << "-1 -1\n";
    return 0;
}


Measured memory_bytes: 512
#include <stdio.h>

int main()
{
	int a=0, b=0, c=0;

	scanf("%d %d %d", &a, &b, &c);

	if(a<b && b<c) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}

	return 0;
}



Measured memory_bytes: 2684
function Main (input) {
  input = String(input.split("\n")[0]).split("");
  var ans = "No";
  for (var i of input) {
    if (i == "7") {
      ans = "Yes";
    }
  }
  console.log(ans);
}

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

Measured memory_bytes: 29472
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll x, n;
  cin >> x >> n;
  map<ll, ll> mp;
  REP(i, n){
    ll p;
    cin >> p;
    mp[p]++;
  }
  FORe(i, 0, 100){
    if(mp[x-i] == 0){
      cout << x-i << endl;
      return 0; 
    }
    if(mp[x+i] == 0){
      cout << x+i << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3636
nd = $stdin.gets.chomp.split(" ")
nd.map! do |a_j|
    a_j.to_i
end

n = nd[0]
d = nd[1]

arr = []
n.times do
    tmp = $stdin.gets.chomp.split(" ")
    tmp.map! do |a_j|
        a_j.to_i
    end
    arr << tmp
end

def isSquare(x)
    lim = 40 * 40 * 10
    for i in 0..lim
        if x == i * i 
            return true
        end
    end
    return false
end

ans = 0
for i in 0..n-2
    for j in i + 1..n-1
        dist = 0
        for k in 0..d-1
            dist += (arr[i][k] - arr[j][k])**2
        end
        if isSquare(dist)
            ans += 1
        end
    end
end 
puts ans

Measured memory_bytes: 3836
N = int(input())
ABC = [list(map(int,input().split())) for _ in range(N)]
hap = [[0,0,0] for _ in range(N)]
hap[0] = ABC[0]
for j in range(1,N):
  for i1,i2,i3 in [[0,1,2],[1,2,0],[2,0,1]]:
    hap[j][i2] = max(hap[j][i2], hap[j-1][i1]+ABC[j][i2])
    hap[j][i3] = max(hap[j][i3], hap[j-1][i1]+ABC[j][i3])
print(max(hap[-1][:]))

Measured memory_bytes: 76964
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

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

	set<int> s;
	rep(i,n){
		int a;
		cin >> a;
		s.emplace(a);
	}
	cout << s.size() << endl;
}


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

int arr[N];
long long dp_table[N];
int find_min(int idx,int n)
{
    if(idx==n){
        return 0;
    }
    if(dp_table[idx]!=-1){
        return dp_table[idx];
    }
    int s1,s2;
    if(idx+2<=n-1){
        s1=abs(arr[idx+1]-arr[idx])+find_min(idx+1,n);
        s2=abs(arr[idx+2]-arr[idx])+find_min(idx+2,n);
        dp_table[idx]=min(s1,s2);
    }
    else{
        s1=abs(arr[idx+1]-arr[idx])+find_min(idx+1,n);
        dp_table[idx]=s1;
    }
    return dp_table[idx];
}
int main()
{
    int n,i,j,s1,s2,k;
    long long mn;
    cin>>n>>k;
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
        dp_table[i]=-1;
    }
    dp_table[n-1]=0;
    if(n>=2){
        dp_table[n-2]=abs(arr[n-1]-arr[n-2]);
        for(j=n-3;j>=0;j--){
            //s1=abs(arr[j]-arr[j+1]);
            //s2=abs(arr[j]-arr[j+2]);
            //dp_table[j]=(long long)(min(dp_table[j+1]+s1,dp_table[j+2]+s2));
            s1=abs(arr[j]-arr[j+1]);
            mn=(long long)(dp_table[j+1]+s1);
            for(i=2;i<=k;i++){
                if(j+i<=n-1){
                    s1=abs(arr[j]-arr[j+i]);
                    long long tmp=(long long)(dp_table[j+i]+s1);
                    if(tmp<mn){
                        mn=tmp;
                    }
                }
            }
            dp_table[j]=mn;
        }
        cout<<dp_table[0];
    }
    else{
        cout<<dp_table[0];
    }
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1e14;
const int ZERO = 0;
const int MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

signed main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    for(int i = 0;i < S.size();i++) {
        int A = S.at(i) - 'A';
        A += N;
        A = A % 26;
        S.at(i) = 'A' + A;
    }
    cout << S << endl;
}

Measured memory_bytes: 256
def yumiri(L, n):
  for i in range(len(L)):
    if L[i] > n:
      return i - 1

def parunyasu(a, b, p, q, T):
  reans = ans
  rd1, rq1, d1, nd1, nq1, q1, newans = naobou(a, q, reans)
  rd2, rq2, d2, nd2, nq2, q2, newans = naobou(b, p, newans)

  Flag = False
  if reans <= newans:
    Flag = True
  else:
    k = pow(2.71, (newans - reans) / T)
    if random.random() < k:
      Flag = True

  if Flag:
    t[d1 - 1] = q1
    t[d2 - 1] = q2
    return newans
  else:
    ayaneru(rd2, rq2, d2, nd2, nq2)
    ayaneru(rd1, rq1, d1, nd1, nq1)
    return reans

def ayaneru(rd, rq, d, nd, nq):
  ZL[rd].insert(rq, d)
  del ZL[nd][nq + 1]

def gaochan(d, q, T):
  reans = ans
  rd1, rq1, d1, nd1, nq1, q1, newans = naobou(d, q, ans)

  Flag = False
  if reans <= newans:
    Flag = True
  else:
    k = pow(2.71, (newans - reans) / T)
    if random.random() < k:
      Flag = True

  if Flag:
    t[d1 - 1] = q1
    return newans
  else:
    ayaneru(rd1, rq1, d1, nd1, nq1)
    return reans

def naobou(d, q, ans):
  newans = ans

  rd = t[d - 1] - 1
  rq = yumiri(ZL[rd], d)
  newans += SUMD[ZL[rd][rq] - ZL[rd][rq - 1] - 1] * c[rd]
  newans += SUMD[ZL[rd][rq + 1] - ZL[rd][rq] - 1] * c[rd]
  newans -= SUMD[ZL[rd][rq + 1] - ZL[rd][rq - 1] - 1] * c[rd] 
  del ZL[rd][rq]

  nd = q - 1
  nq = yumiri(ZL[nd], d)
  newans += SUMD[ZL[nd][nq + 1] - ZL[nd][nq] - 1] * c[nd]
  newans -= SUMD[d - ZL[nd][nq] - 1] * c[nd]
  newans -= SUMD[ZL[nd][nq + 1] - d - 1] * c[nd]
  ZL[nd].insert(nq + 1, d)

  newans -= s[d - 1][rd]
  newans += s[d - 1][nd]

  return rd, rq, d, nd, nq, q, newans

def rieshon():
  ans = 0
  for i in range(D):
    ans += s[i][t[i] - 1]
    for j in range(26):
      if t[i] - 1 == j:
        L[j] = 0
        ZL[j].append(i + 1)
      else:
        L[j] += 1
        ans -= L[j] * c[j]
  for i in range(26):
    ZL[i].append(D + 1)
  return ans

import time
import random
startTime = time.time()

D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]

L = [0] * 26
ZL = [[0] for _ in range(26)]
SUMD = [0] * (D + 1)
for i in range(1, D + 1):
  SUMD[i] = SUMD[i - 1] + i

RD = [0] * 26
t = [0] * D
for i in range(D):
  RD[0] += 1
  ma = s[i][0] + RD[0] * c[0]
  man = 0
  for j in range(1, 26):
    RD[j] += 1
    k = s[i][j] + RD[j] * c[j]
    if k > ma:
      ma = k
      man = j
  t[i] = man + 1
  RD[man] = 0

ans = rieshon()
cnt = 0
T0 = 2000
T1 = 60
tt = 0
T = T0
TL = 1.8
while tt < 1:
  n = random.randrange(3)
  if n == 1:
    d = random.randrange(D) + 1
    q = random.randrange(26) + 1
    if t[d - 1] == q: continue
    ans = gaochan(d, q, T)
  else:
    l = random.randrange(min(D - 1, 13)) + 1
    d = random.randrange(D - l) + 1
    p = t[d - 1]
    q = t[d + l - 1]
    if p == q: continue
    ans = parunyasu(d, d + l, p, q, T)
  cnt += 1
  if cnt >= 100:
    tt = (time.time() - startTime) / TL
    T = pow(T0, 1 - tt) * pow(T1, tt)
    cnt = 0
for i in range(D):
  print(t[i])


Measured memory_bytes: 96236
#include<stdio.h>
typedef long long ll;
int main(void)
{
  ll n,m;
  scanf("%lld %lld",&n,&m);
  if(n==1&&m==1){
    puts("1");
    return 0;
  }
  if(n==1){
    printf("%lld\n",m-2);
    return 0;
  }
  if(m==1){
    printf("%lld\n",n-2);
    return 0;
  }
  printf("%lld\n",n*m-((n*2)+(m-2)*2));
  return 0;
}


Measured memory_bytes: 1736
# Problem https://atcoder.jp/contests/abc095/tasks/abc095_b
# Ruby 1st Try
n,x = gets.chomp.split(' ').map(&:to_i)
m = Array.new(n,0)
for j in 0...n do
    m[j] = gets.chomp.to_i
end
count = 0
onedonus = 0
minpowder = 1000
for j in 0...n do
    onedonus = onedonus + m[j]
    count = count + 1
    if m[j] <= minpowder
        minpowder = m[j]
    end
end
count = count + (x-onedonus)/minpowder
puts(count)

Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T> inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }

string stow(int y) {
    if (y <= 1911)return 'M' + to_string(y - 1867);
    if (y <= 1925)return 'T' + to_string(y - 1911);
    if (y <= 1988)return 'S' + to_string(y - 1925);
    return 'H' + to_string(y - 1988);
}

int d[5] = { -1,1867,1911,1925,1988 };
int wtos(int n,int y) {
    return d[n] + y;
}

int main() {
    init();
    
    int e, y;
    cin >> e >> y;
    if (e == 0)cout << stow(y) << "\n";
    else cout << wtos(e, y) << "\n";
}


Measured memory_bytes: 3268
s=int(input())
mod=10**9+7
p=[1]
for i in range(1,2001):
    a=p[-1]*i
    a%=mod
    p.append(a)
ans=0
for i in range(1,s//3+1):
    k=s-i*3
    n=k+i-1
    ans+=p[n]*pow(p[i-1],mod-2,mod)*pow(p[k],mod-2,mod)
    ans%=mod
print(ans)

Measured memory_bytes: 9224
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>
#include <cstdint>
#include <cmath>
#include <algorithm>
using namespace std;

#define N 200000

int n;
int a[N];

int main()
{
	long long ans = 0;

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

	for( int i = 0; i < n; i++ ) {
		a[i] = a[i] - i - 1;
	}
	sort(a, a+n);

	int b = a[n/2];

	for( int i = 0; i < n; i++ ) {
		ans += abs(a[i] - b);
	}

	cout << ans << endl;

	return 0;
}


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

int main()
{
    int A, B ,C;
    cin >> A >> B >> C;
    cout << (C-(A-B)>=0?C-(A-B):0);
}


Measured memory_bytes: 3600
#include<iostream>
// #include<vector>
// #include<algorithm>
// #include<math.h>

using namespace std;

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

	if(N>=(K-1)*2+1){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}

	return 0;
} // g++ -std=c++11 test.cpp -o test && ./test

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

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    final int MOD = 1000000007;
    int N = scanner.nextInt();
    int M = scanner.nextInt();

    List<Integer> factorials = new ArrayList<>();
    int k = M;
    for (int i = 2; i <= M && k > 1; i++) {
      int count = 0;
      while (k % i == 0) {
        count++;
        k /= i;
      }
      if (count > 0) factorials.add(count);
    }

    long count = 1;
    for(long f : factorials) {
      count = (count * choose(f + N - 1, f, MOD)) % MOD;
    }
    System.out.println(count);
  }

  public static long choose(long n, long k, long mod) {
    if (k > n - k) return choose(n, n - k, mod);
    long res = 1;
    for (int i = 0; i < k; i++) {
      res = (res * (n - i)) % mod;
    }
    for (int i = 1; i <= k; i++) {
      res = (res * inverse(i, mod)) % mod;
    }
    return res % mod;
  }

  public static long inverse(long a, long mod) {
    return modpow(a, mod - 2, mod);
  }

  public static long modpow(long a, long n, long mod) {
    long res = 1;
    while (n > 0) {
      if (n % 2 == 1) res = (res * a) % mod;
      a = (a * a) % mod;
      n >>= 1;
    }
    return res % mod;
  }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, a, b) for (int i = a; i <= b; i++)
using namespace std;
typedef long long ll;
typedef pair <int, int> pii;
typedef vector <int> vi;

int rt[10005], sz[10005];

int find(int u) {
    if (rt[u] == u) return u;
    else return rt[u] = find(rt[u]);
}

bool qry(int u, int v) {
    return find(u) == find(v);
}

void uni(int u, int v) {
    int rtu = find(u), rtv = find(v);
    if (sz[rtu] < sz[rtv]) {
        rt[rtu] = rtv;
        sz[rtv] += sz[rtu];
    }
    else {
        rt[rtv] = rtu;
        sz[rtu] += sz[rtv];
    }
    return;
}

int main() {
    int n, q; cin >> n >> q;
    rep(i, 0, n - 1)
        rt[i] = i, sz[i] = 1;
    while (q--) {
        int c, x, y; cin >> c >> x >> y;
        if (c) cout << qry(x, y) << endl;
        else uni(x, y);
    }
}


Measured memory_bytes: 3196
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	char s[10010];
	int j,i;
	while(cin>>s){
		i=0;
		j=0;
		for(int k=0;k<strlen(s);k++){
			if(strncmp(&s[k],"JOI",3)==0)
			j++;
			if(strncmp(&s[k],"IOI",3)==0)
			i++;
		}
		cout<<j<<endl<<i<<endl;
		
		
		
	}
	return 0;
}

Measured memory_bytes: 0
[K, N] = list(map(int, input().split(' ')))
A = list(map(int, input().split(' ')))

max_distance = K - A[-1] + A[0]
for i in range(len(A)-1):
    max_distance = max(max_distance, A[i+1] - A[i])

print(K - max_distance)




Measured memory_bytes: 32376
#include <iostream>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <climits>
#include <map>

using namespace std;

int main() {
	string a, b;
	cin >> a >> b;
	int num = stoi(a+b);
	int sq = (int) sqrt(num);
	if(sq*sq == num) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
#define __lcm(a,b) ((a)/__gcd(a,b)*(b))
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288419716939937510582097;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}
const int MAX_N=105;
int A[MAX_N];
int main()
{
	int N,D,X;
	cin>>N>>D>>X;
	rep(i,0,N)cin>>A[i];
	rep(i,0,N)X+=ceil(1.0*D/A[i]);
	cout<<X<<endl;
	return 0;
}



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

int main() {
    int n,k;
    cin >> n >> k;

    double ans = 0;

    for(int i = 1; i <= n; ++i){
        double h = 1 / double(n);
        int l = i;
        while(l < k){
            l *= 2;
            h *= 0.5;
        }

        ans += h;
    }

    cout << fixed << setprecision(15) << ans << endl;
}


Measured memory_bytes: 256
program main
	implicit none
	integer :: N, Z, W
	integer, allocatable :: a(:)
	read(*, *) N, Z, W
	allocate(a(0:N))
	read(*, *) a(1:N)
	a(0) = W
	write(*, *) max(abs(a(N) - W), abs(a(N) - a(N-1)))
end program main

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

using namespace std;

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

	string s;
	cin>>s;

	int countr=0;
	for(char c:s)
	{
		if(c=='R')
			countr++;
	}

	int ans=0;	
	for(int i=0;i<countr;i++)
	{
		if(s[i]=='R')
			ans++;
	}

	cout<<countr-ans;
	return 0;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i< (n) ; ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main(){
  int n,m,l;
  cin >> n >> m >> l;
  if( ((10*m+l)%4) == 0) {
    printf("YES");
  }
  else{
    printf("NO");
  }
    return 0;
}


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

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for (int i=a; i<b; i++)
#define M00(i, a) for (int i=0; i<a; i++)
#define MOOd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define M00d(i,a) for (int i = (a)-1; i >= 0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _<< " _ " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ld,ld> pd;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;

int main() { FAST
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	//a c are health
	while(a > 0 && c > 0) {
		c -= b;
		if(c <= 0) {
			finish("Yes");
		}
		a -= d;
		if(a <= 0) {
			finish("No");
		}
	}
}


Measured memory_bytes: 3616
//
//  main.cpp
//  ABC
//
//  Created by Amarsanaa Davaasuren on 2019/08/31.
//  Copyright © 2019 Amarsanaa Davaasuren. All rights reserved.
//
# include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstdio>
#include <string>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i,i0,n) for(int (i)=(i0);(i)<(n);(i)++)
#define rn return
typedef std::pair<int,int> P;

using namespace std;
using ll = long long;

int main(){
    int d,g,p[11],c[11]; cin >> d >> g;
    rep(i,d) cin >> p[i] >> c[i];
    
    int ans = 1e9;
    
    int restmax = 0;
    for(int mask = 0; mask < 1<<d; ++mask){
        int need = 0;
        int sougo = 0;
        rep(i,d){
            if (mask >> i&1){
                sougo += 100*(i+1)*p[i] + c[i];
                need += p[i];
            }
            else restmax = i;
        }
        if (sougo<g){
            int add = (g-sougo + 100*(restmax+1) - 1)/(100*(restmax+1));
            need += add;
            if (add >= p[restmax]) continue;
        }
        ans = min(ans,need);
    }
    cout << ans;
    rn 0;
    
}

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

int a[110];
int cnt;
char s[99];

int main(){
	while(~scanf("%s",s)){
		switch(*s){
			case'+':a[cnt-2]+=a[cnt-1];cnt--;break;
			case'*':a[cnt-2]*=a[cnt-1];cnt--;break;
			case'-':a[cnt-2]-=a[cnt-1];cnt--;break;
			case'/':a[cnt-2]/=a[cnt-1];cnt--;break;
			default:a[cnt++]=atoi(s);
		}
	}
	printf("%d\n",a[0]);
}


Measured memory_bytes: 2112
N, A, B = map(int, input().split())


def digitSum(n):
    s = str(n)
    array = list(map(int, s))
    return sum(array)


result = 0
for i in range(N+1):
    s = digitSum(i)
    if A <= s and s <= B:
        result += i

print(result)


Measured memory_bytes: 3060
N = int(input())
S = input()
 
def im(l, x):
    return [i for i, _x in enumerate(l) if _x == x]
R = im(S, "R")
G = im(S, "G")
B = im(S, "B")
 
ext = 0
if N >= 3:
    for i in range((N-3)//2+1):
        for j in range(N-(3+2*i)+1):
            if S[j] != S[j+i+1] and S[j] != S[j+2*(i+1)] and S[j+i+1] != S[j+2*(i+1)]:
                ext += 1
 
ans = len(R)*len(G)*len(B) - ext
print(ans)

Measured memory_bytes: 9108
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (Scanner sc = new Scanner(System.in)) {
            int N = sc.nextInt();
            String S = sc.next();

            if (N % 2 == 0) {
                if (S.substring(0, S.length() / 2).equals(S.substring(S.length() / 2))) {
                    System.out.println("Yes");
                    return;
                }
            }

            System.out.println("No");
        }
    }

}


Measured memory_bytes: 22740
// Ryo Kamoi

#include<iostream>
#include<math.h>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>

using namespace std;

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

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

int INF = 1000000000;

int a, b, c;
int main(){
    cin >> a >> b >> c;
    bool flag = true;
    if (a!=b) flag = false;
    if (b!=c) flag = false;

    if(flag) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 256
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include <random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ");
//#define double long double

template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
const int MAX = 200060;
const double pi = acos(-1);
const ll INF = 1e16;


void solve() {
	int N; cin >> N;
	vector<int>A(N);
	REP(i, N)cin >> A[i];
	sort(all(A));
	ll ans = 0;
	REP(i, N - 2) {
		FOR(j, i + 1, N - 1) {
			FOR(k, j + 1, N) {
				//if (A[i] + A[j] <= A[k])break;
				if (A[i] < A[j] + A[k] && A[j] < A[i] + A[k] && A[k] < A[i] + A[j])ans++;
			}
		}
	}
	print(ans);
}


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

	solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[33]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51} ;
int main(){
	 int t ;
	 cin>>t;
	 cout<<a[t-1]<<endl;
}


Measured memory_bytes: 256
main(N){
    int a=1000000,b=-a,t;
    long c=0;
    for(scanf("%d",&N);N--;c+=t){
        scanf("%d",&t);
        if(a>t)a=t;
        if(b<t)b=t;
    }
    printf("%d %d %ld\n",a,b,c);
}

Measured memory_bytes: 1824