akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
using namespace std;

int map[16][16]={0},memo[16][16]={0};
int root(int x,int y){
	if(memo[x][y]==0){
		int number=0;
		if(x==0&&y==0)return 1;
		if(x!=0&&map[x-1][y]!=-1)number+=root(x-1,y);
		if(y!=0&&map[x][y-1]!=-1)number+=root(x,y-1);
		memo[x][y]=number;
		return number;
	}
	else return memo[x][y];
}
int main() {
	int a,b,n,x,y;
	while(1){
		cin >> a >> b;
		if(a==0&&b==0)break;
		cin >> n;
		for(int i=0;i<n;i++){
			cin >> x >> y;
			map[x-1][y-1]=-1;
		}
		cout << root(a-1,b-1) << endl;
		for(int i=0;i<16;i++){
			for(int j=0;j<16;j++){
				map[i][j]=0;
				memo[i][j]=0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3084
#include<iostream>
using namespace std;
int main()
{
    string s;
    cin>>s;
    if(s=="SUN")
        cout<<"7"<<endl;
    else if(s=="SAT")
        cout<<"1"<<endl;
    else if(s=="MON")
        cout<<"6"<<endl;
    else if(s=="TUE")
        cout<<"5"<<endl;
    else if(s=="WED")
        cout<<"4"<<endl;
    else if(s=="THU")
        cout<<"3"<<endl;
    else if(s=="FRI")
        cout<<"2"<<endl;
    return 0;
}



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

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

	long long int total = 0;
	int n, x;
	cin >> n;
	vector<int> a;
	for (int i = 0; i < 3*n; ++i){
		cin >> x;
		a.push_back(x);
	}
	sort(a.begin(), a.end(), greater<int>());
	for (int i = 1; i <= n; ++i){
		total += a[2*i-1];
	}
	cout << total << "\n";
	return 0;
}

Measured memory_bytes: 2420
#include <iostream>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>

using namespace std;

#define REP(i,n) for(ll (i) = (0); (i) < (n); ++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define ALL(v) v.begin(),v.end()
#define Decimal fixed << setprecision(20)
#define SHOWP(x) cerr<<"["<<(x).FI<<", "<<(x).SE<<"]";
#define SHOWX(x) cerr<<#x<<": "<<x<<endl;
#define SHOWVEC(v, e) REP(i, e) cerr << (v[i]) << ' '; cerr << endl;
#define SHOW2D(a, h, w) REP(i, h){REP(j, w)cerr<<setw(3)<<(a[i][j])<<' ';cerr<<endl;}
constexpr int INF = 1100000000;
constexpr long long LLINF = 1100000000000000000LL;
constexpr long long MOD = 1000000007;

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

int tate[310000], yoko[310000];
int main()
{
  int N, W, H;
  cin >> N >> W >> H;
  REP(i, N) {
    int x, y, w;
    cin >> x >> y >> w;
    tate[max(0, x - w)]++; tate[x + w]--;
    yoko[max(0, y - w)]++; yoko[y + w]--;
  }
  REP(i, 300000) {
    tate[i + 1] += tate[i];
    yoko[i + 1] += yoko[i];
  }

  bool f1 = true;
  REP(i, W) {
    if (tate[i] <= 0) {
      f1 = false;
      break;
    }
  }

  bool f2 = true;
  REP(i, H) {
    if (yoko[i] <= 0) {
      f2 = false;
      break;
    }
  }
  if (f1 || f2) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}



Measured memory_bytes: 5440
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define EPS 1e-10
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
#define first_more_idx(ve, num) upper_bound(all(ve), num)-ve.begin() // idx = first_more_idx(ve,num); if(idx = ve.size()) , then not exist
#define first_lessequal_idx(ve, num) lower_bound(all(ve), num)-ve.begin()
#define pq_pair_tB priority_queue <pair<ll,ll>, vector<pair<ll,ll> > , greater<pair<ll,ll> > >
#define pq_pair_ts priority_queue <pair<ll,ll> > // only sort first param
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}
ll power(ll x, ll n){if(n == 0) return 1;return  (n%2)? x*power(x, n-1)%MOD : power(x*x%MOD, n/2);}
ll dx[]={0, 0, -1, 1};
ll dy[]={1, -1, 0, 0};// up,down,left right


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

    ll N , K, C;
    cin >> N >> K >> C;
    
    string S; cin >> S;
    
    
    ll idx;
    
    vector<ll> l;
    idx= 0 ;
    while(idx < S.size()){
        if(S[idx] == 'o'){
            l.pb(idx);
            idx += C;
        }
        idx ++;
    }

    reverse(all(S));
    
    vector<ll> r;
    idx= 0 ;
    while(idx < S.size()){
        if(S[idx] == 'o'){
            r.pb(idx);
            idx += C;
        }
        idx ++;
    }

    reverse(all(r));
    rep(i, r.size()) r[i] = S.size() - r[i] - 1;

    
    if(l.size() > K or l.size() != r.size()){
        cout << endl;
    }else{
        rep(i, l.size()){
            if(l[i] == r[i]) cout << l[i] + 1 << endl;
        }
    }
        

    
    //cout << fixed << setprecision(16) << ans << endl;
    return 0;
}


Measured memory_bytes: 5128
S = input()


def judge(s):
    if s[0] != 'A':
        return 'WA'

    if S[2:-1].count('C') != 1:
        return 'WA'

    t = s.find('C')
    s[1:t]

    return 'AC' if s[1:t].islower() and s[t+1:].islower() else 'WA'


print(judge(S))


Measured memory_bytes: 2940
//----------------------------------------------------------------------
#include <iostream>
//----------------------------------------------------------------------
using namespace std;

int main(int argc, char *argv[]) {
    int input[3];
    for(int i = 0; i < 3; ++i) {
        cin >> input[i];
    }
    int flag = 0;
    for(int i = 0; i < 2; ++i) {
        int ii = input[i];
        for(int j = i + 1; j < 3; ++j) {
            int ji = input[j];
            if(ii == ji) {
               flag++; 
            }
        }
    }
    if(flag==1) {
        cout << "Yes" << endl;;
    }else {
        cout << "No" << endl;
    }
}



Measured memory_bytes: 256
func readInt() -> Int {
    return Int(readLine()!)!
}

func mainD() {
    let X = readInt()

    let n = 1000

    for i in -n...n {
        for j in -n...n {
            let A = i * i * i * i * i
            let B = j * j * j * j * j

            if (A - B) == X {
                print(i, j)
                return
            }
        }
    }
}
mainD()

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

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

    for(int i = 1; i <= x; i++) {
        int y = i;
        if(y % 3 == 0) {
            cout << " " << i;
        } else {
            while(y) {
                if(y % 10 == 3) {
                    cout << " " << i;
                    break;
                }
                y /= 10;

            } 
        
        }
    }
    cout << endl;
}


Measured memory_bytes: 3088
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	// 割れない数字の組み合わせを作る = 一つ大きい数字で割る (最後に1が余るので、nの最大数は割り切れる)
	// 1 + 2 + 3 + 4 + ... + n-1

	fmt.Println((n * (n - 1)) / 2)
}


Measured memory_bytes: 512
import math
def combi(n,r):
    if n < r:
        return 0
    return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

def main():
    n,m = map(int,input().split())
    print(combi(n,2)+combi(m,2))

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <stdio.h>
int main()
{
  int sum,k,i,t;
  while(1){
    scanf("%d",&k);
    if(k==0)break;
    sum=0;
    for(i=0;i<k/4;i++){
      scanf("%d",&t);
      sum+=t;
    }
    printf("%d\n",sum);
  }
  return 0;
}

Measured memory_bytes: 1024
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int main(){
    int N,K; R(N,K);
    if(K>(N-1)*(N-2)/2)W(-1);
    else{
        VPII AA;
        int need=N*(N-1)/2-K;
        FOR(i,2,N)AA.PB({1,i}),need--;
        FOR(i,2,N){
            FOR(j,2,i-1){
                if(need>0){
                    need--;
                    AA.PB({j,i});
                }
            }
        }
        W(SZ(AA));
        for(auto x:AA)W(x);
    }
    return 0;
}


Measured memory_bytes: 384
import bisect
q = int(input())
LR = [tuple(map(int,input().split())) for i in range(q)]
ans = []
sosuu = set([2])
A = 100000
for L in range(3, A, 2): # 2 以外の素数は奇数なので
    for L2 in sosuu:
        if L % L2 == 0:
            break # 素数でないことがわかったらそれ以上ループする必要はない
    else: # break で抜けることがなかったら L は素数（Python 特有の制御構文）
        sosuu.add(L)
        if (L+1)/2 in sosuu:
          ans.append(L)
for lr in LR:
  print(bisect.bisect_right(ans,lr[1]) - bisect.bisect_left(ans,lr[0]))

Measured memory_bytes: 91760
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}

template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}

template<typename T,typename Y>
ostream& operator<<(ostream& os,const pair<T,Y>& p){
   return os<<"{"<<p.fs<<","<<p.sc<<"}";
}
template<typename T> ostream& operator<<(ostream& os,const V<T>& v){
   os<<"{";
  for(auto e:v)os<<e<<",";
  return os<<"}";
}
template<typename ...Args>
void debug(Args&... args){
  for(auto const& x:{args...}){
    cerr<<x<<' ';
  }
  cerr<<ENDL;
}



signed main(){
  cin.tie(0);cerr.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll a,b;cin>>a>>b;
  cout<<a*b<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;
using namespace std;
int main() {
    int s,w;
    cin >> s >> w;
    if(s <= w) {
        cout << "unsafe";
    } else {
        cout << "safe ";
        
    }
}

Measured memory_bytes: 3652
#include <iostream>
#include <iostream>
#include <string.h>
#include <vector>
#include <queue>
#include <cstdio>
#include <math.h>
#include <map>
#include <algorithm>
#include <deque>
#include <stack>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<int,int>pa;
const int N =2e5+100;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int modd=1e9+5;

ll a[2010];
void jc()
{
    a[0]=a[1]=1;
    for(int i=2;i<=2000;i++)
        a[i]=a[i-1]*i%mod;
}
ll ksm(ll x,ll y)
{
     if(x==0) return 0;
     ll sum=1;
     while(y){
        if(y&1) sum=sum*x%mod;
        x=x*x%mod;
        y>>=1;
     }
     return sum;
}
long long C(int n,int m)
{
    if(m>n) return 0;
    if(m==n) return 1;
    ll result;
    result=(a[n]*ksm(a[n-m],modd)%mod)*ksm(a[m],modd)%mod;
    return result;
}
int main()
{
    int n,k;
    jc();
    scanf("%d%d",&n,&k);
    for(int i=1;i<=k;i++){
        //ll ans1=(a[k-1]*ksm(a[i-1],modd)%mod)*ksm(a[k-i-1],modd)%mod;
       // ll ans2=(a[n-k+1]*ksm(a[i],modd)%mod)*ksm(n-k+1-i,modd)%mod;
       // ans1=ans1*ans2%mod;
       ll ans=C(n-k+1,i)*C(k-1,i-1)%mod;
        printf("%lld\n",ans);
    }
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	int n = s.size();
	map<int, int> d;
	d[0]++;
	int now = 0;
	int p = 1;
	for(int i = n - 1; i >= 0; --i){
		now = ((s[i] - '0') * p + now) % 2019;
		p = p * 10 % 2019;
		d[now]++;
	}
	int ans = 0;
	for(auto i : d){
		ans += i.second * (i.second - 1) / 2;
	}
	cout << ans << endl;
}

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

string s;
int p,flg;
int bnf();
bool check(char ch){return ch&&ch!='+'&&ch!='-'&&ch!='*'&&ch!=')';}

bool check2(){
  if(s[p]!='(')return 1;
  int i=p+1;
  while(isdigit(s[i]))i++;
  if(s[i]==')')return 0;
  
  i=p+2;
  int c=s[p+1]=='(';
  while(i<s.size()&&c) c+=(s[i]=='(')-(s[i++]==')');
  return c==0&&s[i]!=')';
}
bool check3(int a){return 0<=a&&a<1024;}


int Num(){
  int res=0;
  flg&=check2();
  if(s[p]=='('){
    p++;
    res=bnf(),flg&=s[p++]==')';
    return res;
  }

  while(isdigit(s[p]))res=res*2+s[p++]-'0';
  flg&=check3(res);
  return res;
}

int calc(){
  int res;
  flg&=check(s[++p])&check2();
  if(s[p]=='(')res=bnf();
  else res=Num()*((s[p]=='*')? calc():1);
  flg&=check3(res);
  return res;
}

int bnf(){
  flg&=check(s[p]);
  int res=Num();
  while(p<s.size()&&flg&&s[p]!=')'){
    flg&=check3(res)&&s[p]!='('&&check(s[p+1]);
    if(s[p]=='+')res+=calc();
    else if(s[p]=='-')res-=calc();
    else if(s[p]=='*')res*=calc();
    else break;
  } 
  if(!flg||!check3(res))res=-INF;
  return res;
}

int dfs(int idx){
  char ch[]={'0','1','+','-','*','(',')'};
  while(idx<s.size()&&s[idx]!='.')idx++;
  if(idx==s.size()){p=0,flg=1;return max(-1.0,bnf()-(p!=s.size())*INF);}
  
  int res=-1;
  for(int i=0;i<7;i++)s[idx]=ch[i],res=max(res,dfs(idx+1));
  s[idx]='.';
  return res;
}

int main(){
  cin>>s;
  cout<<dfs(0)<<endl;
  return 0;
}

Measured memory_bytes: 3168
s = list(map(str, input()))
t = list(map(str, input()))

smax = max(s)
tmax = max(t)
smin = min(s)
tmin = min(t)

ans = False

if tmax > smin:
    ans = True
elif tmax < smax:
    ans = False
else:
    if len(t) > len(s):
        ans = True

if ans:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
typedef long long int lli;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

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

int main(){
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    vector<pair<int, int>> lr;
    lr.push_back(make_pair(-1, -1));
    int l = 0;
    int sum = 0, ans = 0;
    bool ok = false;
    rep(i,n){
        if (s[i] == '1' && ok){
            lr.push_back(make_pair(l, i-1));
            ok = false;
            sum++;
        }
        if (s[i] == '0'){
            if (!ok) l = i;
            ok = true;
            ans = max(ans, sum);
            sum = 0;
        }
    }
    if (s[n-1] == '0') lr.push_back(make_pair(l, n-1));
    lr.push_back(make_pair(n, n));

    if (lr.size()-2 <= k){
        cout << n << endl;
        return 0;
    }

    for(int i = 0; i < lr.size()-1; i++){
        int oneSum = 0;
        int cnt = k;
        int j;
        for(j = i+1; j < lr.size()-1; j++){
            if (cnt == 0) break;
            oneSum += lr[j].second - lr[j-1].second;
            cnt--;
        }
        oneSum += lr[j].first - lr[j-1].second - 1;
        ans = max(ans, oneSum);
    }
    cout << ans << endl;
}

Measured memory_bytes: 4088
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ in >> p.first >> p.second; return in; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
template <char d = ' ', class T>
ostream& operator << (ostream& out, vector<T>& v){ for(auto& e : v){ out << e << d; } return out; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a, b;
    cin >> n >> a >> b;
    vector<int> v;
    int num = n, bnum = 0;
    while(num){
        int lst = num;
        // num -= a;
        bnum++;
        // while(lst - num + 1 < a && num > 1 && bnum + num - 1 > b){
        //     num--;
        // }
        num = max({lst + 1 - a, 1, b - bnum + 1});
        for(int i = num; i <= lst; i++){
            v.push_back(i);
        }
        num--;
    }
    vector<int> anss({a, b});
    for(int i = 0; i < 2; i++){
        vector<int> dp(n + 1, M);
        for(auto& e : v){
            *lower_bound(dp.begin(), dp.end(), e) = e;
        }
        if(find(dp.begin(), dp.end(), M) - dp.begin() != anss[i]){
            cout << -1 << '\n';
            return 0;
        }
        reverse(v.begin(), v.end());
    }
    cout << v << '\n';
}


Measured memory_bytes: 4572
#include <iostream>

using namespace std;

int main()
{
   int N,K;
   cin >> N >> K;
   int S[N+1],d[K+1],i,j,k,l,h,count=0;
   for(i=1;i<=N;i++){
       S[i] = 0;
   }
   for(j=1;j<=K;j++){
       cin >> d[j];
       for(k=1;k<=d[j];k++){
           cin >> h;
           S[h]+=1;
       }
   }
   for(i=1;i<=N;i++){
       if(S[i] == 0) count+=1;
   }
   cout << count;
   
   return 0;
}

Measured memory_bytes: 3632
#[allow(dead_code)]
fn main() {
    let n = i::u();
    let mut a = i::uv(n);
    let mut b = i::uv(n);
    let mut c = i::uv(n);
    a.sort();
    b.sort();
    c.sort();

    let mut ans = 0usize;
    let mut a_i = 0usize;
    let mut c_i = 0usize;
    //中央を固定して、左右の個数を求める
    for b_i in 0..n {
        loop {
            if a_i == n {
                break;
            }
            if a[a_i] < b[b_i] {
                a_i += 1;
            } else {
                break;
            }
        }
        loop {
            if c_i == n {
                break;
            }
            if c[c_i] <= b[b_i] {
                c_i += 1;
            } else {
                break;
            }
        }
        ans += a_i * (n - c_i);
    }
    println!("{}", ans);
    //dbg!(a, b, c);
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 8444
/*  ***  In The Name of God ... ***  */
#include <bits/stdc++.h>

using namespace std ;
 
typedef long long ll ;
typedef long double ld ;

 
#define int long long
#define all(v) v.begin() , v.end()

template<typename T> inline bool smin(T &a, const T &b){ return b < a ? a = b,1:0;}
template<typename T> inline bool smax(T &a, const T &b){ return a < b ? a = b,1:0;}

const int N = 3e5 + 10 ; 

int n , ar [ N ] ; 

int32_t main()                     
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n ;
	for ( int i = 1 ; i <= 3 * n ; ++ i )
		cin >> ar [ i ] ;
	multiset < int > st ;
	for ( int i = 1 ; i <= 3 * n ; ++ i )
		st . insert ( ar [ i ] ) ;
	int res = 0 ; 
	while ( !st . empty ( ) ) {
		int x = *st . begin ( ) , z = *st . rbegin ( ) ;
		st . erase ( st . find ( z ) ) ;
		int y = *st . rbegin ( ) ;
		res += y ;
		st . erase ( st . find ( x ) ) ;
		st . erase ( st . find ( y ) ) ; 
	}
	cout << res << endl ; 
}


Measured memory_bytes: 16640
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <list>
#include <bitset>
#include <iostream> 
#include <set>
#include <map>
#include <string>
#include <sstream>
#include <climits>
#include <cmath>
#include <stack>
#include <queue>
#include <cfloat>
#include <initializer_list>
#include <iomanip>
#include <functional>
#include <unordered_map>
#include <regex>

using namespace std;

int main(int argc, char *argv[])
{  
  long long a, b, x;
  cin >> a >> b >> x;
  cout << (b / x + 1) - (a == 0 ? 0 : (a - 1) / x + 1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    string S;
    cin >> S;
    map<char, int> C;
    for( char c : S ) {
        C[c]++;
    }
    string ans = "Yes";
    for( auto x : C ) {
        if ( x.second != 2 ) ans = "No";
    }
    
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <iomanip>
#include<algorithm>
using namespace std;
int main()
{
	int n,a[105];
	while(cin>>n)
	{
	for(int i=0;i<n;i++)
		cin>>a[i];
	for(int i=n-1;i>=0;i--)
		{
			cout<<a[i];
	    if(i!=0)
			cout<<" ";//???????§?????????????????????????????????????????????????
		if(i==0)
			cout<<endl;
	}

	}
	


	
}

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

bool memo[104730]={false};

void prime(void){
	bool flag;
	
	memo[2]=true;
	
	for(int i=3;i<104730;i=i+2){
		flag=true;
		for(int j=3;j<=sqrt((double)i);j=j+2){
			if(i%j==0){
				flag=false;
				break;
			}
		}
		if(flag==true){
			memo[i]=true;
		}
	}
	return;
}

int main(){
	int n;
	int sum;
	prime();
	
	while(cin>>n,n){
		sum=0;
		for(int i=0,j=0;j<n;i++){
			if(memo[i]==true){
				sum=sum+i;
				j++;
			}
		}
		cout<<sum<<endl;
	}
}

Measured memory_bytes: 1260
#include <bits/stdc++.h>
 
using namespace std;
 
using ll = long long;
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define reps(i,n) for(ll i=0;i<=n;i++)
 
 
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
 
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
int main(){
    string S;
    cin >> S;
    for(int i=0;i<S.size();i++){
        cout << "x";
    }

    cout << endl;
    
    return 0;
}

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

int main() {
	int n,l;
	cin >> n >> l;
	int dist=1e9;
	int sum = ((1+n)*n)/2;
	int flav=l*n-n+sum;
	int ans=0;
	for (int i=1; i<=n; i++){
		 int flav1=l*(n-1)-(n-1)+(sum-i);
		 if (abs(flav1-flav)<dist){
		 	ans=flav1;
		 	dist = abs(flav1-flav);
		 }
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
import sys
from collections import deque
sys.setrecursionlimit(10**6)
if sys.platform in (['ios','darwin','win32']):
	sys.stdin=open('Untitled.txt')
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return [int(s) for s in input().split()]

def main():
	N = INT()
	G = [[] for _ in range(N)]
	for _ in range(N-1):
		a, b, c = MAP()
		a -= 1
		b -= 1
		G[a].append([b, c])
		G[b].append([a, c])
	
	Q, K = MAP()
	queue = deque()
	queue.append(K-1)
	dist = [-1] * N
	dist[K-1] = 0
	while queue:
		v = queue.popleft()
		for nv in G[v]:
			edge, distance = nv
			if dist[edge] != -1: continue
			dist[edge] = dist[v] + distance
			queue.append(edge)
	
	# print(dist)
	for _ in range(Q):
		a, b = MAP()
		print(dist[a-1]+dist[b-1])

if __name__ == '__main__':
	main()

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

int  A, B, C;
int main() {
	cin >> A >> B >> C;
	if (A==B){
		cout << C << endl;
	} else if (B==C) {
		cout << A << endl;
	} else {
		cout << B << endl;
	}
}
	



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

using namespace std;

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

  if (x < 1200) {
	cout << "ABC" << endl;
  }
  else {
	cout << "ARC" << endl;
  }


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
int gcd(int a,int b){return b?gcd(b,a%b):a;}    //最大公約数
int lcm(int a, int b) {return a * b / gcd(a, b);}   //最小公倍数

int main()
{
	ll a;
	ll b;
	ll c;
	cin >> a>>b>>c;
	ll n = a - b;
	ll m = c - n;
	if (m < 0)
		cout << 0 << endl;
	else 
	cout << m << endl;
	return 0;
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

ll A, B, C, D; 

ll gcd(ll a, ll b){
	if(b == 0) return a;
	else gcd(b, a % b);
}
ll lcm(ll a, ll b){
	return a*b / gcd(a, b);
}

ll f(ll x){

	ll l = lcm(C, D);
	ll ans = x - x / C  - x / D + x / l;
	return ans;
}


int main(void){

	cin >> A >> B >> C >> D;
	cout << f(B) - f(A-1) << endl;
	
	


	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(long long int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
 
using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;
 
 
int main(void) {
	int h, w;
	bool flag = true;
	char s[60][60];
 
	cin >> h >> w;
	FOR(i, 0, h - 1) {
		cin >> s[i];
	}
	FOR(i, 0, h - 1) {
		FOR(t, 0, w - 1) {
			if (s[i][t] == '.') {
				continue;
			}
 
			if (i - 1 >= 0) {
				if (s[i - 1][t] == '#') {
					continue;
				}
			}
			if (t - 1 >= 0) {
				if (s[i][t - 1] == '#') {
					continue;
				}
 
			}
			if (i + 1 <= h - 1) {
				if (s[i + 1][t] == '#') {
					continue;
				}
			}
			if (t + 1 <= w - 1) {
				if (s[i][t + 1] == '#') {
					continue;
				}
			}
			flag = false;
		}
	}
 
	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
 
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(false), cin.tie(0);
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl '\n'

using namespace std;

main()
{
    fast;
    int n,k,i;
    cin>>n>>k;
    ll h[n];
    for (i=0;i<n;i++)
        cin>>h[i];
    sort(h,h+n);
    ll ans=1e10;
    for (i=0;i<n-k+1;i++)
        ans=min(ans,h[i+k-1]-h[i]);
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
#include <stdio.h> 
int main(){
 int n,x,count;
 while(true){ scanf("%d %d",&n,&x);
 if(n == 0 && x == 0) break; 
count = 0; for(int min = 1; 
min < x/3 && min <= n-2;min++){ for(int middle = min+1;middle < x - (min+middle) && middle <= n-1;
 middle++){ if(x-(min+middle) <= n) count++; 
}
 } printf("%d\n",count);
}
}


Measured memory_bytes: 2696
N,M=input().split()
list01=[]
for i in range(int(M)):
	list01.append(input().split())
min_list=[]
max_list=[]
for i in range(int(M)):
	min_list.append(int(list01[i][0]))
	max_list.append(int(list01[i][1]))
min_num=max(min_list)
max_num=min(max_list)
list_N=list(range(1,int(N)+1))
score=0
for i in range(len(list_N)):
	if int(min_num)<=list_N[i]<=int(max_num):
		score+=1
print(score)

Measured memory_bytes: 44072
n = int(input())

ans = [0 for i in range(n)]

for x in range(1, 99):
    for y in range(1, 99):
        for z in range(1, 99):
            m = x*x + y*y + z*z + x*y + x*z + y*z
            if m > n:
                break
            ans[m-1] += 1
            
    
for i in range(n):
    print(ans[i])
                

Measured memory_bytes: 69272
//----AUTHOR:kkdrummer----/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <boost/multiprecision/cpp_int.hpp> 
using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
typedef    long long   ll;
typedef    long double   ld;
//typedef    unordered_set<ll>   usll;
//typedef    unordered_multiset<ll>   umsll;
typedef    multiset<ll>   msll;
typedef    set<ll>   sll;
typedef    vector<ll>   vll;
typedef    pair<ll,ll>   pll;
typedef    vector<pll>   vpll;
typedef    priority_queue<ll>   pqll;
typedef    vector<int>   vi;
typedef    set<int>   si;
typedef    multiset<int>   msi;
//typedef    unordered_multiset<int>   umsi;
//typedef    unordered_set<int>   usi;
typedef     pair<int,int>   pi;
typedef    vector<pi>   vpi;
typedef    set<pi>   spi;
typedef    priority_queue<int>   pqi;
typedef    tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>   ind_set;
typedef    tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>   ind_setll;
#define    in   insert
#define    fi   first
#define    se   second
#define    pb   push_back
#define    mp   make_pair
#define    be   begin
#define    en   end
#define    itr   iterator
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define    mo   1000000007
#define    inf  9223372036854775807
#define    ninf   -inf
#define    ima   2147483647
#define    imi   -ima
#define    oncnt    __builtin_popcount
#define    zerobegin   __builtin_clz
#define    zeroend   __builtin_ctz
#define    parity   __builtin_parity
#define    all(x)   x.be(),x.en()
#define    eps   1e-9
#define    coutd   cout<<setprecision(10)<<fixed
#define    mems(dp,x)   memset(dp,x,sizeof(dp))
const    ld   PI=3.1415926535897932384626433832792884197169399375105820974944;
inline ll modpow(ll x,ll n){if(n==0)return 1;if(n==1)return(x%mo);ll u=(modpow(x,n/2));u=(u*u)%mo;if(n%2!=0)u=(u*x%mo)%mo;return u;}
inline ll modinv(ll x){return modpow(x,mo-2);}
inline ll mmul(ll a,ll b){    if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll madd(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;if(a+b>=mo)return(a+b)%mo;return(a+b);}
inline ll msub(ll a, ll b){if(a>=mo)a=a%mo;if(b>=mo)b=b%mo;return(((a-b)%mo+mo)%mo);}
inline ll mdiv(ll a,ll bb){if(a>=mo)a=a%mo;ll b=modinv(bb);if(b>=mo)b=b%mo;if(a*b>=mo)return(a*b)%mo;return(a*b);}
inline ll gcd(ll a,ll b){return __gcd(a,b);}
inline ll lcm(ll a,ll b){return ((a*b)/gcd(a,b));}




int main()
{
io
int testcases=1;//cin>>testcases;
while(testcases--)
{
	
	
cpp_int x;
cin>>x;



ll t=0;
cpp_int cur=100;
cpp_int nu=101;
cpp_int de=100;
while(true)
{

	if(cur>=x)
	break;
	t++;
	cur=(cur*nu)/de;
	
}
cout<<t;	
	
	
	

}return 0;}


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

int main() {
    int a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;
    a *= 100, b *= 100;
    double ma = -1.0;
    int a1 = 0, a2 = 0;
    for (int i = 0; i <= 100; i++) {
        for (int j = 0; j <= 100; j++) {
            for (int k = 0; k <= 100; k++) {
                for (int l = 0; l <= 100; l++) {
                    int water = a * i + b * j;
                    int sugar = c * k + d * l;
                    if (water + sugar > f) continue;
                    if (water * e < sugar * 100) continue;
                    double t = 100.0 * (double)sugar / (double)(water + sugar);
                    if (ma <= t) {
                        ma = t;
                        a1 = water + sugar;
                        a2 = sugar;
                    }
                }
            }
        }
    }
    cout << a1 << " " << a2 << endl;
    return 0;
}

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

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = (long long)1e9 + 7; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}

#define MAX
int N, S;
vector<int> A;

bool check(int x){
	vector<int> B(N), C(A);
	x -= x%2;
	B[0] = x;
	int sum = x;
	// if(x >= A[0]) return false;
	C[N-1] -= x;
	
	for(int i = 1; i < N; i++){
		B[i] = (C[i-1] - B[i-1]/2)*2;
		// if(B[i] < 0) B[i] = 0;
		sum += B[i];
		// cout<<"i = "<<i<<" "<<B[i]<<endl;
		// if(B[i]/2 + B[i-1]/2 > A[i-1]) return false;
		// if(B[])
	}
// cout<<sum<<endl;
	if(sum >= S) return true;
	else return false;
	
	// if(B[N-1]/2 + B[0]/2 == A[N-1]) return true;
	// else return false;
}

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	
	cin>>N;
	
	A.resize(N);
	
	for(int i = 0; i < N; i++){
		cin>>A[i];
		S += A[i];
	}
	
	int l = -1, m, h = A[0]+A[N-1]+2;
	
	// for(int i = 0; i < 10; i++){
		// cout<<"check "<<i<<" "<<check(i)<<endl;
	// }
	while(l+1 < h){
		m = (l+h)/2;
		
		if(check(m)){
			h = m;
		} else {
			l = m;
		}
	}
	
	// cout<<h<<endl;
	vector<int> B(N);
	h -= h%2;
	B[0] = h;
	
	for(int i = 1; i < N; i++){
		// B[i] = A[i-1] - B[i-1]/2;
		B[i] = (A[i-1] - B[i-1]/2)*2;
	}
	
	for(int i = 0; i < N; i++){
		if(i) cout<<" ";
		cout<<B[i];
	}
	
	cout<<endl;
	
	return 0;
}

Measured memory_bytes: 2968
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int quant = sc.nextInt();

        Queue<String> qTask = new ArrayDeque<>();
        Queue<Integer> qTime = new ArrayDeque<>();
        
        for (int i = 0; i < n; i++) {
            qTask.add(sc.next());
            qTime.add(sc.nextInt());
        }
        
        int timePoint = 0;
        while (!qTask.isEmpty()) {
            String task = qTask.poll();
            int time = qTime.poll();

            if (time > quant) {
                timePoint += quant;
                qTime.add(time - quant);
                qTask.add(task);
               
            } else {
                timePoint += time;
                System.out.println(task + " " + timePoint);
            }
        }
    }
}


Measured memory_bytes: 70412
fun main(args: Array<String>) {
    var n=readLine()!!.toInt()
    var strings= mutableListOf<String>()
    var max:Int=0
    var tmp=0
    var before=""
    for(i in 0 until n){
        strings.add(readLine()!!.toString())
    }
    strings.sort()
    for(string in strings){
        if(before!=string){
            if(tmp>max){
                max=tmp
            }
            tmp=0
            before=string
        }
        tmp++
    }
    if(tmp>max){
        max=tmp
    }
    tmp=0
    for(string in strings){
        if(before!=string){
            if(tmp==max){
                println(before)
            }
            tmp=0
            before=string
        }
        tmp++
    }
    if(tmp==max){
        println(before)
    }
}

Measured memory_bytes: 64460
import math
a,b=map(int,input().split())
j=[]
for i in range(1,1001):
  if math.floor(i*0.08)==a and math.floor(i*0.1)==b:
    j.append(i)
    print(min(j)) 
    break;
if len(j)==0:
 print(-1) 


Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int main()
{
   int a , b , ret;
   cin >> a >> b ;
   if(a >= 13){

   ret = b;
   } else if( a >= 6 && a <= 12){
    ret = b/2 ;

   }else{
    ret = 0 ;
   }
   cout << ret << endl;
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<cstring>

char s[200005];
long long ans,sum,b,bb,w,ww;

int main()
{
	scanf("%s",s);
	int len = strlen(s);
	for(int i = 1;i <= len; i++){
		if(s[i - 1] == 'W') {
			sum ++;
		}
	}
	if(sum == len) {
		printf("0\n");
		return 0;
	}
	for(int i = 1;i <= sum; i++){
		if(s[i - 1] == 'B') {
			b ++;
			bb += i;
		}
	}
	for(int i = len;i >= 1; i--){
		if(s[i - 1] == 'W'){
			w ++;
			ww += i;
		}
		if(w == b) break;
	}
	ans = ww - bb;
	printf("%lld\n",ans);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
 
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m);i>=(int)(n);--i)
#define debug(x) cout << #x << "=" << (x) << endl;
 
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<typename T> void fail(T v){cout << v << endl;exit(0);}
//template end

void solve(){
  int N,W,H;
  cin>>N>>W>>H;
  vector<int> hs(H+1),ws(W+1);
  rep(i,N){
    int x,y,w;
    cin>>x>>y>>w;
    hs[max(0,y-w)]++;
    hs[min(H,y+w)]--;
    ws[max(0,x-w)]++;
    ws[min(W,x+w)]--;
  }
  rep(i,H){
    hs[i+1]+=hs[i];
    if(!hs[i])goto BR1;
  }
  fail("Yes");
  BR1:;
  rep(i,W){
    ws[i+1]+=ws[i];
    if(!ws[i])goto BR2;
  }
  fail("Yes");
  BR2:;
  cout<<"No"<<endl;
}
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  solve();
  return 0;
}


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

using ll = long long;
using vi = vector<int>;
using vi2 = vector<vector<int>>;
#define MP(a,b) make_pair((a),(b))
#define MT(...) make_tuple(__VA_ARGS__)

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl;
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl;

#define DCOUT(x,n) cout << fixed << setprecision(n) << (x) << endl;

#define sz(x) (int)(x).size()
#define HOGE cout << "hoge" << endl;
using P = pair<ll,ll>;

template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,sz(v))i>>v[j];return i;}

const int INF = 1e9;

int main(){
    int x;
    cin >> x;
    if(x>=30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

using namespace std;

int main(){

  int D;

  cin >> D;
  
  if(D == 25){
    cout << "Christmas" << "\n";
  }
  else if(D == 24){
    cout << "Christmas Eve" << "\n";
  }
  else if(D == 23){
    cout << "Christmas Eve Eve" << "\n";
  }
  else{
    cout << "Christmas Eve Eve Eve" << "\n";
  }
  
  return 0;
}


Measured memory_bytes: 256
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        d: usize,
        c: [usize; 26],
        s: [[usize; 26]; d],
        b: [usize1; d],
    }
    let mut last = vec![0; 26];
    let mut sum = 0isize;
    for i in 0..d {
        sum += s[i][b[i]] as isize;
        last[b[i]] = i + 1;
        for j in 0..26 {
            sum -= (c[j] * (i + 1 - last[j])) as isize;
        }
        println!("{}", sum);
    }
}


Measured memory_bytes: 2228
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>

#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;
const long double PI = (acos(-1));
const long long MOD = 1000000007;
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

///////////////////////////////////////////////////
// -------------------- I/O -------------------- //
///////////////////////////////////////////////////
// https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords
template<typename T> void outputVec(const std::vector<T>& vec, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	for (auto it = vec.begin(); it != vec.end() - 1; ++it) { std::cout << *it << " "; }
	std::cout << *(vec.end() - 1) << "\n";
}
template<typename T> void outputVal(const T& res, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	std::cout << res << "\n";
}
template<typename T> T inputVal() { T a; std::cin >> a; return a; }
template<typename T> std::vector<T> inputVec(int N) {
	std::vector<T> vec(N);
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
	return vec;
}
template<typename T> void inputVec(std::vector<T>& vec) {
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
}

///////////////////////////////////////////////////
// ------------------- utils ------------------- //
///////////////////////////////////////////////////
// change min/max
template<class T> inline bool chMin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chMax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

///////////////////////////////////////////////////
// ------------------- main -------------------- //
///////////////////////////////////////////////////

template<class T> T getDigits(const T N) { return static_cast<T>(std::floor(std::log10(N) + 1.0)); }

void Main() {
	const int N = inputVal<int>();
	vector<int> h(N);
	if (N == 1) {
		cout << "Yes" << endl;
		return;
	}

	rep(i, N) {
		cin >> h[i];
	}

	bool res = true;
	for (int i = N - 2; i >= 0; --i) {
		if (h[i] - h[i + 1] > 1) {
			res = false;
			break;
		}
		if (h[i] - h[i + 1] == 1) {
			--h[i];
		}
	}

	cout << (res ? "Yes" : "No") << endl;
}

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

	double tmp;
	cin >> tmp;

	return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int sum = sc.nextInt();
        
        for (int i = 0; i <= n; i++) {
            for (int j = 0; i + j <= n; j++) {
                int k = n - i - j;
                int tmp = 10000 * i + 5000 * j + 1000 * k;
                if (tmp == sum) {
                    System.out.println(i + " " + j + " " + k);
                    return;
                }
            }
        }
        
        System.out.println("-1 -1 -1");
    }
}

Measured memory_bytes: 23636