akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int mod = 1e9+7;
int a[300000];
LL s[300000];
int main(){
    int n;
    cin>>n;
    LL ss = 0;
    for (int k = 0; k < n; ++k) {
        scanf("%d", a + k);
        ss += a[k];
        ss %= mod;
        s[k] = ss;
    }
    LL ans = 0;
    for (int i = 1; i < n; ++i) {
        ans += s[i-1] * a[i];
        ans %= mod;
    }
    cout<<ans;
}

Measured memory_bytes: 5988
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<ll> a(n);
	REP(i,n) cin>>a[i];
	vector<P> lr(n);
	stack<P> st1;
	stack<P> st2;
	REP(i,n) {
		while(st1.size()!=0&&st1.top().first>a[i]) {
			st1.pop();
		}
		if(st1.size()==0) lr[i].first=0;
		else lr[i].first=st1.top().second+1;
		st1.push(P(a[i],i));
	}
	REP(i,n) {
		while(st2.size()!=0&&st2.top().first>a[n-1-i]) {
			st2.pop();
		}
		if(st2.size()==0) lr[n-1-i].second=n-1;
		else lr[n-1-i].second=st2.top().second-1;
		st2.push(P(a[n-1-i],n-1-i));
	}
	ll ret=0;
	REP(i,n) {
		ret+=a[i]*(i-lr[i].first+1)*(lr[i].second-i+1);
	}
	cout<<ret<<endl;
}


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

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC082_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            var left = str[0] + str[1];

            var right = str[2] + str[3];

            if (left > right)
            {
                Console.WriteLine("Left");
            }
            else if (right > left)
            {
                Console.WriteLine("Right");
            }
            else
            {
                Console.WriteLine("Balanced");
            }

        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define ll long long 
#define MAX 100001
using namespace std;

int dp[5001][5001];

int f(int x,int y){
	if (dp[x][y]) return dp[x][y];
	if (x<2 && y<2) return -1;
	if (x>y) swap(x,y);
	int i = 1;
	while(2*i<=x){
		int t = f(x-2*i,y+i);
		if (t==-1) return dp[x][y] = 1;
		i++;
	}
	i = 1;
	while(2*i<=y){
		int t = f(x+i,y-2*i);
		if (t==-1) return dp[x][y] = 1;
		i++;
	}
	return dp[x][y] = -1;
}

int main(){
	ll x,y;
	cin >> x >> y;
	if (abs(x-y)<2) cout << "Brown";
	else cout << "Alice";/*
	for (int i=0;i<=20;i++){
		for (int j=0;j<=i;j++){
			cout << i << ":" << j << " " << f(i,j) << "    ";
		}
		cout << endl;
	}*/
	return 0;
}

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

int main(){
    vector<long long> a(100000),b(100000),c(100000);
    cin >> a.at(0) >> b.at(0)>> c.at(0);

    if(a.at(0) % 2 ==1 || b.at(0)%2==1 || c.at(0)%2==1){
        cout << "0" << endl;
        return 0;
    }else if(a == b && b == c){
        cout << "-1" << endl;
        return 0;
    }

    int count = 1;
    for(int i=1;;i++){
        a.at(i) = b.at(i-1)/2 + c.at(i-1)/2;
        b.at(i) = a.at(i-1)/2 + c.at(i-1)/2;
        c.at(i) = a.at(i-1)/2 + b.at(i-1)/2;
        if(a.at(i) % 2 ==1 || b.at(i)%2==1 || c.at(i)%2==1){
            cout << count << endl;
            return 0;
        }

        count++;

    }
 }

    


Measured memory_bytes: 2560
import numpy as np
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

H, W = map(int, input().split())
A = np.array([input().split() for _ in range(H)], dtype=int)
B = np.array([input().split() for _ in range(H)], dtype=int)
dif = np.abs(A - B).tolist()

U = (H + W) * 80
Um = U // 2

dp = [[[] for _ in range(W)] for _ in range(H)]
X = np.zeros(U + 1, dtype=bool)
X[Um + dif[0][0]] = True
X[Um - dif[0][0]] = True
dp[0][0] = X


for i in range(H):
    for j in range(W):
        if i == j == 0:
            continue
        d = dif[i][j]
        X = np.zeros(U + 1, dtype=bool)
        if d:
            if i > 0:
                X[d:] |= dp[i - 1][j][:-d]
                X[:-d] |= dp[i - 1][j][d:]
            if j > 0:
                X[d:] |= dp[i][j - 1][:-d]
                X[:-d] |= dp[i][j - 1][d:]
        else:
            if i > 0:
                X |= dp[i - 1][j]
            if j > 0:
                X |= dp[i][j - 1]
        dp[i][j] = X

tmp = np.arange(U+1)[dp[H-1][W-1]]
ans = np.abs(tmp - Um).min()
print(ans)

Measured memory_bytes: 94320
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define FILL(Itr,n) fill((Itr).begin(),(Itr).end(),n)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;
#define MOD 1000000007

set<int> G[10];

bool judge(vector<int> a){
    a.insert(a.begin(),1);
    REP(i,a.size()-1){
        int from = a[i];
        int to = a[i+1];
        if(G[from].find(to)==G[from].end())return false;
    }
    return true;
}

int main(){
    
    int N,M; cin>>N>>M;
    REP(i,M){
        int a,b; cin>>a>>b;
        G[a].insert(b);
        G[b].insert(a);
    }
    
    vector<int> root;
    REP(i,N-1)root.push_back(2+i);
    
    int ans=0;
    do{
        if(judge(root))ans++;
    }while(next_permutation(root.begin(),root.end()));
    
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;

// LowestCommonAncestor using doubling
struct LCA_D {
    vector<int> depth;
    vector<vector<int>> pa;
    // G:tree, [0,n)
    LCA_D(vector<vector<int>>& G) {
        depth.resize(G.size());
        int k_max = sizeof(int)*8 - __builtin_clz((int)G.size());
        pa.assign(k_max+1, vector<int>(G.size()));
        // pa, depth
        int rt = 0;
        function<void(int,int)> dfs = [&](int v, int p) {
            pa[0][v] = p;
            depth[v] = p < 0 ? 0 : depth[p] + 1;
            for ( int u : G[v] ) {
                if ( u == p ) continue;
                dfs(u, v);
            }
        };
        dfs(rt,-1);
        // doubling
        for ( int k = 1; k <= k_max; k++ ) {
            for ( int i = 0; i < G.size(); i++ ) {
                if ( pa[k-1][i] < 0 ) pa[k][i] = -1;
                else pa[k][i] = pa[k-1][pa[k-1][i]];
            }
        }
    }
    int get_lca(int a, int b) {
        if ( depth[a] < depth[b] ) swap(a,b);
        int d = depth[a]-depth[b];
        if ( d > 0 ) {
            for ( int k = pa.size()-1; k >= 0; k-- ) {
                if ( (d >> k) & 1 ) a = pa[k][a];
            }
        }
        if ( a == b ) return a;
        for ( int k = pa.size()-1; k >= 0; k-- ) {
            if ( pa[k][a] != pa[k][b] ) {
                a = pa[k][a];
                b = pa[k][b];
            }
        }
        return pa[0][a];
    }
};

ll solve() {
    ll N, M, a, b;
    cin >> N;
    vector<vector<int>> G(N);
    for ( int i = 0; i < N-1; i++ ) {
        cin >> a >> b;
        a--, b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }
    cin >> M;
    vector<ll> U(M), V(M);
    for ( int i = 0; i < M; i++ ) {
        cin >> U[i] >> V[i];
        U[i]--, V[i]--;
    }
    
    LCA_D lca(G);
    vector<ll> pathEdges(M);
    for ( int i = 0; i < M; i++ ) {
        int u = U[i], v = V[i];
        int c = lca.get_lca(u,v);
        ll es = 0;
        while ( c != u ) {
            es |= 1LL << u;
            u = lca.pa[0][u];
        }
        while ( c != v ) {
            es |= 1LL << v;
            v = lca.pa[0][v];
        }
        pathEdges[i] = es;
    }

    ll ans = 0;
    for ( ll b = 0; b < 1LL<<M; b++ ) {
        ll es = 0;
        for ( int j = 0; j < M; j++ ) {
            if ( (b >> j) & 1LL ) es |= pathEdges[j];
        }
        int p = __builtin_parityll(b), bc = __builtin_popcountll(es);
        if ( p ) {
            ans -= 1LL << (N-1-bc);
        } else {
            ans += 1LL << (N-1-bc);
        }
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////

int a, b;
signed main(){
  cin>>a>>b;int ans = 0;
  int aa = a;
  for(int i = 2;i*i <= aa;i++){
    if(a%i == 0 && b%i == 0)ans++;
    while(a%i == 0){
      a /= i;
    }
  }
  if(a > 1 && b % a == 0)ans++;
  cout << ans+1 << endl;
}


Measured memory_bytes: 256
#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;
    cin >> n;
    vector<int> a(n), b(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];
    vector<int> t_up;
    ll sum = 0;
    rep(i,n){
        int diff = a[i] - b[i];
        if (diff >= 0){
            t_up.push_back(diff);
        }else if (diff < 0){
            sum += diff;
        }
    }
    sort(all(t_up));
    while (sum < 0){
        if (t_up.size() == 0) break;
        int last = t_up.back(); t_up.pop_back();
        sum += last;
    }
    if (sum < 0) cout << -1 << endl;
    else cout << n - t_up.size() << endl;

}

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

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

using namespace std;

int main(){
    int h,r;
    cin >>h>>r;
    int ans;
    if(abs(h)==r)ans=0;
    if(h+r>0)ans=1;
    if(h+r<0)ans=-1;
    cout <<ans<<endl;
    return 0;
}


Measured memory_bytes: 3104
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
    cin >> first;
    IN(rest...);
    return;
}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second < b.second; }

const int MOD = 1000000007;



int main() {
    SS(ll,a,b);
    for(int i=1;i<=100000;i++){
        if(floor(i*0.08)==a&&floor(i*0.1)==b){
            p(i);
            return 0;
        }
    }
    p(-1);
}

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

using namespace std;

#define LL long long
#define ULL unsigned LL
#define LD long double

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	double l;
	cin>>l;
	double x = l / 3.0;
	double w = x*x*x;
	cout<<fixed<<setprecision(10)<<w;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
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, n, m) for (int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;
/**
 * C問以降は ll を使う.
 * double型にするのを忘れない.
 * nC2の求め方 (1/2)*n*(n-1)
 * vector<型> 変数名(要素数, 初期値)
*/
int main()
{
    int A, B, C;
    cin >> A >> B >> C;
    if(A+B+C >= 22) {
        cout << "bust" << endl;
    } else {
        cout << "win" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int n, m, Mod = 1000000007;
int D[3010][3010], D2[3010][3010];
int main(){
    int i, j;
    scanf("%d%d",&n,&m);
    n--,m--;
    D[0][0] = 1;
    D2[0][0] = 1;
    for(i=0;i<m;i++){
        for(j=0;j<=n;j++){
            D[i+1][j+1] = (D[i+1][j+1] + D[i][j])%Mod;
            D[i+1][j] = (D[i+1][j] + D[i][j]*2ll)%Mod;
            if(j)D[i+1][j-1] = (D[i+1][j-1] + D[i][j])%Mod;
            if(j==n)continue;
            D2[i+1][j+1] = (D2[i+1][j+1] + D2[i][j])%Mod;
            D2[i+1][j] = (D2[i+1][j] + D2[i][j]*2ll)%Mod;
            if(j)D2[i+1][j-1] = (D2[i+1][j-1] + D2[i][j])%Mod;
        }
    }
    int res = 0;
    for(i=0;i<=m;i++){
        int ss = 0, t = 0;
        for(j=0;j<=n;j++)ss = (ss + D[i][j])%Mod;
        if(i==m)t = 1;
        else{
            for(j=0;j<=n-1;j++) t = (t + D2[m-1-i][j])%Mod;
        }
        res = (res + 1ll*t*ss)%Mod;
    }
    printf("%lld\n",res*4ll%Mod);
}

Measured memory_bytes: 70784
S = input()
if (S[0] == '0'and S[1]!='0') or (S[0] == '1'and (S[1] == '0' or S[1] == '1' or S[1]=='2')):
  if (S[2] == '0'and S[3]!='0') or (S[2]=='1' and (S[3]=='0' or S[3]=='1' or S[3]=='2')):
    print('AMBIGUOUS')
  else:
    print('MMYY')
elif (S[2] == '0'and S[3]!='0') or (S[2]=='1' and (S[3]=='0' or S[3]=='1' or S[3]=='2')):
  print('YYMM')
else:
  print('NA')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#include<vector>
#include<algorithm>
#include<iterator>
using namespace std;

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 ***/
void vp(vector<string> x,int a){
    for(int i=0;i<a-1;i++){
        printf("%s ",x[i].c_str());
    }
    printf("%s\n",x[a-1].c_str());
}

int main(){
    double pai=3.141592653589;
    int n;
    string t="Stable", f="Not stable";
    vector<string> str, bub, sel;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        char s[2];
        scanf("%s",&s);
        str.push_back(s);

    }
    copy(str.begin(), str.end(), back_inserter(bub));
    copy(str.begin(), str.end(), back_inserter(sel));
    for(int i=0;i<n;i++){
        for(int j=n-1;j>i;j--){
            if(bub[j].substr(1)<bub[j-1].substr(1)){
                string tmp=bub[j];
                bub[j]=bub[j-1];
                bub[j-1]=tmp;
            }
        }
    }

    for(int i=0;i<n;i++){
        int minj=i;
        for(int j=i;j<n;j++){
            if(sel[j].substr(1)<sel[minj].substr(1)){
                minj=j;
            }
        }
        string tmp=sel[i];
        sel[i]=sel[minj];
        sel[minj]=tmp;
    }
    vp(bub,n);
    printf("%s\n",t.c_str());

    vp(sel,n);
    if(equal(bub.cbegin(),bub.cend(),sel.cbegin())){
        printf("%s\n",t.c_str());
    }else{
        printf("%s\n",f.c_str());
    }
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define collect(arr, size) rep(i,size) cin >> arr[i];
#define int long long

signed main(){
    int N, Y;
    cin >> N >> Y;
    rep(x,N+1){
        rep(y,N+1){
            int z = N - x - y;
            if(x<0 || y<0 || z<0) continue;
            if(10000*x + 5000*y + 1000*z == Y && x+y+z==N){
                cout << x << " " << y << " " << z << endl;
                return 0;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;

int main(){
  ll a,b;
  cin >> a >> b;
  if(a%b == 0){
    cout<<-1<<endl;
    return 0;
  }

  for(ll i = 1; i < 1145141919; i++){
    if(a * i % b != 0){
      cout << a*i<<endl;
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007

#A
def A():
    n = II()
    print("ABC"+str(n))
    return

#B
def B():
    ni = [2 ** i for i in range(1, 10)]
    n = II()
    ans = 1
    for i in range(1, n + 1):
        if i in ni:
            ans = i
    print(ans)        
    return

#C
def C():
    n, m = LI()
    edg = [[] for i in range(n)]
    for _ in range(m):
        a, b = LI_()
        edg[a].append(b)
        edg[b].append(a)
    next = []
    for i in edg[0]:
        next.append(i)
    for ne in next:
        for i in edg[ne]:
            if i == n - 1:
                print("POSSIBLE")
                return
    print("IMPOSSIBLE")
    return

#D
def D():
    k = II()
    a = k // 50
    b = k % 50
    print(50)
    a = [49 + a] * 50
    for i in range(b):
        for j in range(50):
            if i == j:
                a[j] += 50
            else:
                a[j] -= 1
    print(" ".join(map(str, a)))
    return

#Solve
if __name__ == '__main__':
    D()


Measured memory_bytes: 39024
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), cout, ", ") << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, ostream &os = cout, string sep = " ")
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), os, ", ") << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    IN(ll, M);
    AIN(string, A, N);
    AIN(string, B, M);
    bool yes = false;
    REP(i, N - M + 1)
    {
        REP(j, N - M + 1)
        {
            bool ok = true;
            REP(u, M)
            {
                REP(v, M)
                {
                    ok &= A[i + u][j + v] == B[u][v];
                }
            }
            yes |= ok;
        }
    }
    YES(yes);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  long long curr_num, sum;
  int n;
  bool to_continue=true;
  cin >> n;
  cin >> sum;
  for (int i = 1; i < n; i++) {
    cin >> curr_num;
    if (curr_num == 0) {
      sum =0;
      to_continue = false;
    }
    if (to_continue) {
      if (1000000000000000000/curr_num < sum) {
        to_continue = false;
        sum = -1;
      }
      else if (curr_num * sum > 1000000000000000000) {
        to_continue = false;
        sum = -1;
      }
      else {
        sum *= curr_num;
      }
    }
  }
  cout << sum;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {

		DoProb x = new DoProb();
		int r = x.result(0, 0);
		System.out.println(r);
		System.exit(0);
	}
}

class DoProb {
	private int town;
	private int day;
	private int[] nD;
	private int[] mW;
	private int[][] cost;

	DoProb() {
		@SuppressWarnings("resource")
		Scanner scan = new Scanner(System.in);
		town = scan.nextInt();
		day = scan.nextInt();

		nD = new int[town];
		mW = new int[day];
		for (int i = 0; i < town; i++)
			nD[i] = scan.nextInt();
		for (int i = 0; i < day; i++)
			mW[i] = scan.nextInt();

		cost = new int[town][day];
		for (int i = 0; i < town; i++)
			for (int j = 0; j < day; j++)
				cost[i][j] = -1;

	}

	public int result(int start, int currday) {
		if (start >= town)
			return (0);

		if (cost[start][currday] > 0)
			return cost[start][currday];

		int r;
		int go = result(start + 1, currday + 1) + (nD[start] * mW[currday]);

		if (day - currday == town - start)
			r = go;
		else {
			int wait = result(start, currday + 1);
			if (wait < go)
				r = wait;
			else
				r = go;
		}

		cost[start][currday] = r;
		return r;
	}

}

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

int main(void) {
 int n;
 cin >> n;
  
 vector<int> d(n);
 for(int i = 0; i < n; i++) {
  cin >> d[i];
 }
 
  sort(d.begin(), d.end());
  if(n == 2) {
    if(d[0] == d[1]) {
     cout << 0 << endl; 
    }
    else {
      cout << d[1] - d[0] << endl;
    }
    return 0;
  }
  
  int middle = d[n/2 - 1];
  int middle_down = d[n/2];
  
  //cout << middle << " " << middle_down << endl;

  cout << middle_down - middle << endl;
 
  
 return 0; 
}

Measured memory_bytes: 640
#include <cstdio>

constexpr int INSUU = 64;
constexpr int SOSUU = 10000;

int Eratosthenes(int* primes){
  primes[0] = 2;
  primes[1] = 3;
  primes[2] = 5;
  primes[3] = 7;
  int prime_p = 4;
  for(int p = 11; p <= 10000; p+=2){
    bool is_prime = true;
    for(int i = 0; i < prime_p; i++){
      if((p % primes[i]) == 0){
	is_prime = false;
	break;
      }
    }
    if(is_prime){
      primes[prime_p++] = p;
    }
  }
  return prime_p;
}
int main(){
  int primes[SOSUU];
  int prime_count = Eratosthenes(primes);
  int insuus[INSUU];
  int insuu_count = 0;
  int n;
  scanf("%d", &n);
  int c = n;
  for(;;){
    bool c_is_prime = true;
    for(int i = 0; i < prime_count; i++){
      if((c % primes[i]) == 0){
  	insuus[insuu_count++] = primes[i];
  	c /= primes[i];
  	c_is_prime = false;
  	break;
      }
    }
    if(c == 1) { break; }
    if(c_is_prime){
      insuus[insuu_count++] = c;
      break;
    }
  }
  printf("%d:", n);
  for(int i = 0; i < insuu_count; i++){
    printf(" %d", insuus[i]);
  }
  printf("\n");
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
int main()
{
	int N, K;
	std::cin >> N >> K;
	std::string S;
	std::cin >> S;

	if (S.at(K-1) == 'A')
		S.at(K-1) = 'a';
	else if (S.at(K-1) == 'B')
		S.at(K-1) = 'b';
	else if (S.at(K-1) == 'C')
		S.at(K-1) = 'c';

	std::cout << S << '\n';		

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main() {
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < s.length(); i++) {
		int sum = 0;
		for (int j = i; j < s.length(); j++) {
			if (s[j] == 'A' || s[j] == 'C' || s[j] == 'G' || s[j] == 'T') {
				sum++;
			}
			else {
				break;
			}
			ans = max(ans, sum);
		}
	}
	
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int arr[100005][3];
int dp[1000005][3];
int go(int i , int j){
    if(i == n)
        return 0;
    int &ans = dp[i][j];
    if(ans)
        return ans;

    ans = arr[i][j] + max(go(i + 1 , (j + 1) % 3) , go(i + 1 , (j + 2) % 3));
    return ans;
}
int main(){
    cin >> n;
    for(int i = 0 ; i < n ; i++)
        for(int j = 0 ; j < 3 ; j++)
            cin >> arr[i][j];
    int res1 = go(0,0);
    int res2 = go(0,1);
    int res3 = go(0,2);
    cout<<max(res1 , max(res2 , res3));
}


Measured memory_bytes: 10368
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <iostream>
#include <vector>
#include <queue>
#include <unordered_map>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

#define bug(x) cout<<"zdongdebug1: "<<x<<endl;
#define bug2(x, y) cout<<"zdongdebug2: "<<x<<" "<<y<<endl;
#define bug3(x, y, z) cout<<"zdongdebug3: "<<x<<" "<<y<<" "<<z<<endl;
using namespace std;
typedef long long ll;
const int maxn = 55;
const int mod = 1000000007;


int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
  //freopen("/Users/suiyuan2009/CLionProjects/icpc/output.txt", "w", stdout);
#endif
  int n;
  unordered_set<int> st;
  cin>>n;
  bool sign = 0;
  for(int i=0;i<n;i++){
    int x;
    cin>>x;
    if(st.find(x)!=st.end())sign=1;
    st.insert(x);
  }
  cout<<(sign?"NO":"YES")<<endl;
  return 0;
}

Measured memory_bytes: 8520
h, n = map(int, input().split())

A = [0] * n
B = [0] * n
for i in range(n):
    A[i], B[i] = map(int, input().split())

dp = [float("inf")] * (h+1)
dp[0] = 0

for i in range(h):
    for j in range(n):
        next_index = min(i + A[j], h)
        dp[next_index] = min(dp[next_index], dp[i] + B[j])

print(dp[-1])


Measured memory_bytes: 42972
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
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; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }


int main() {
    int n;
    string s;
    cin >> n >> s;
    
    int nn = sz(s);
    int dp[nn + 1][nn + 1];
    fill_n(*dp, (nn + 1) * (nn + 1), 0);
    
    rep(i, n) rep3(j, i + 1, n) {
        if (s[i] == s[j]) {
            dp[i + 1][j + 1] = dp[i][j] + 1;
        }
    }
    
    // rep(i, n + 1) { rep(j, n + 1) cout << dp[i][j] << " "; cout << endl; }
    
    int ans = 0;
    rep(i, n + 1) rep(j, n + 1) {
        if (dp[i][j] == 0) continue;
        if (i - dp[i][j] + dp[i][j] <= j - dp[i][j]) {
            chmax(ans, dp[i][j]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 98048
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
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;
}
const int dx[8] = { -1,0,1,-1,1,-1,0,1 };
const int dy[8] = { 1,1,1,0,0,-1,-1,-1 };


//LOVE NyantakoGG	https://www.youtube.com/channel/UC6XdFs8T6Ei54O0FYl3PVVA


using namespace std;



int main() {
	int N;
	cin >> N;
	vector<int>ans(1000002);
	vector<int>l(N), r(N);
	for (int i = 0; i < N; i++) {
		cin >> l[i] >> r[i];
		ans[l[i]]++;
		ans[r[i] + 1]--;
	}
	int out = 0;
	for (int i = 1; i < 1000002; i++) {
		ans[i] += ans[i - 1];
		out += ans[i];
	}
	cout << out << endl;
}


Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
int main()
{
    int h,w,i,j,k,n;
    char c;
    cin>>h>>w;
    int dp[h+1][w+1];
    for(i = 0 ; i <=w; i++)
        dp[0][i]  =0;
    for(i = 0 ; i <= h; i++)
        dp[i][0]  =0;
    dp[1][1] = 1;
    for(i = 1;i<=h ; i++)
    {
        for(j = 1 ; j <= w ; j++)
        {
            cin>>c;
            if(i==1 && j==1)
                continue;

            if(c=='#')
                dp[i][j] = 0;
            else
                {dp[i][j] = (dp[i-1][j]%mod+dp[i][j-1]%mod)%mod;

                //cout<<dp[i][j]<<" = "<<dp[i-1][j]<<"+"<<dp[i][j-1]<<endl;
                }
        }
    }

    /*for(i = 0;i<=h ; i++)
    {
        for(j = 0 ; j <= w ; j++)
        {cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }*/
    cout<<dp[h][w]%mod;
    return 0 ;
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef long long ll;
typedef unsigned long long llu;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
typedef pair<char, int> pci;
typedef pair<int, char> pic;
const int MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

ll fac[1] = {1}, inv[1] = {1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll mp(ll a,ll b){ll ret=1;while(b){if(b&1)ret=ret*a%MOD;a=a*a%MOD;b>>=1;}return ret;}
ll cmb(ll r, ll c) {return (c>r||c<0) ? 0:fac[r] * inv[c] % MOD * inv[r - c] % MOD;}

// 3이상만 사용 가능
pii vec[200000];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) scanf("%d %d", &vec[i].first, &vec[i].second);

    ll mav = -1e18;
    ll maxy = -1e18, mixy = 1e18;
    ll mayx = -1e18, miyx = 1e18;

    for (int i = 0; i < n; i++) {
        ll xy = vec[i].first + vec[i].second;
        ll yx = vec[i].first - vec[i].second;
        maxy = max(maxy, xy);
        mixy = min(mixy, xy);

        mayx = max(mayx, yx);
        miyx = min(miyx, yx);
    }
    mav = max(mav, maxy-mixy);
    mav = max(mav, mayx-miyx);
    printf("%lld", mav);
}


// author: rdd6584


Measured memory_bytes: 5332
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.*;
import java.lang.Math.*;
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        HashMap<Integer, Integer> mem = new HashMap<>();
        LinkedList<Integer> dic = new LinkedList<>();
        int n = in.nextInt();
        int k = in.nextInt();
        String s = in.next();
        char p = s.charAt(0);
        int c=1;
        for(int i=1;i<n;i++){
            if(s.charAt(i)==p){
                c++;
            }
            else {
                dic.add(c);
                c=1;
                p=s.charAt(i);
            }

        }
        dic.add(c);
//        System.out.println(dic);
        int count =0;
        int sum =0;
        while (k>0 && dic.size()>0){
            sum+=dic.removeFirst();
            count++;
            if (count==3){
                k--;
                count=1;
            }
        }
        int ans=0;
        ans+= sum-1;
        while (dic.size()>0){
            ans+=dic.removeFirst()-1;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 28544
#include <bits/stdc++.h>
using namespace std;
/*---define tricks---*/
#define ALL(v) v.begin(),v.end()
#define UN(v) sort(ALL(v)),v.erase(unique(ALL(v)),v.end())
#define FILL(x,y) memset(x,y,sizeof(x))
#define EACH(v,it) for(__typeof(v.begin()) it=v.begin();it!=v.end();it++)
#define FIO ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define rsort(v) sort(ALL(v)),reverse(ALL(v))
/*---define types---*/
typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pii> vii;
/*---define variables---*/
int n;
ll ans;
vi L,R;
/*---define function---*/

/*---main code---*/
int main()
{
	FIO;
	cin>>n;
	L.resize(n+1),R.resize(n+1);
	for(int i=0;i<n;++i)
	{
		cin>>L[i]>>R[i];
	}
	rsort(L),sort(ALL(R));
	for(int i=0;i<n;++i)
	{
		if(L[i]>R[i])
		{
			ans+=(L[i]-R[i])*2;
		}
	}
    cout<<ans<<'\n';
	return 0;
}


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

typedef long long ll;
typedef struct ERA{
  string name;
  ll l, f;
}era;

era mk(string s, ll l, ll f){
  era ret;
  ret.name=s;
  ret.l=l;
  ret.f=f;
  return ret;
}

int main(){
  ll N, Q;
  while(cin>>N>>Q, !(N==0&&Q==0)){
    vector<era> v;
    for(ll i=0; i<N; i++){
      string s;
      ll l, f;
      cin>>s>>l>>f;
      v.push_back(mk(s, l, f));
    }
    for(ll i=0; i<Q; i++){
      ll q;
      cin>>q;
      bool flag=false;
      for(int j=0; j<v.size(); j++){
	if((v[j].f-v[j].l)<q && q<=v[j].f){
	  cout<<v[j].name<<" "<<v[j].l-(v[j].f-q)<<endl;
	  flag=true;
	break;
	}
      }
      if(!flag)cout<<"Unknown"<<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1288
import java.util.*;
import java.lang.*;

import static java.lang.StrictMath.abs;

class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Data[] list = new Data[n];
        //データの格納
        for(int i =0; i < n ; i++){
            Data data = new Data(i+1, sc.next(), sc.nextInt());
            list[i] = data;
        }
        //ソート
        Arrays.sort(list, new Comparator<Data>() {
            public int compare(Data data1, Data data2) {
                if (data1.getA().equals(data2.getA())){
                    return data2.getB() - data1.getB();
                }
                return data1.getA().compareTo(data2.getA());
            }
        });
        for(int l =0 ; l < n; l++) {
            System.out.println(list[l].getN());
        }



    }

}

class Data{
    private int N;
    private String A;
    private int B;
    public Data(int n, String a, int b){
        this.N = n;
        this.A = a;
        this.B = b;
    }
    public int getN(){
        return N;
    }
    public String getA() {
        return A;
    }
    public int getB(){
        return B;
    }
}



Measured memory_bytes: 21844
#include <cstdio>
int main(void){
    int N, K;
    scanf("%d %d", &N, &K);
    
    int result = 1, count = 0;
    while (count < N && result <= K)
    {
        result *= 2;
        ++count;
    }
    while (count < N)
    {
        result += K;
        ++count;
    }
    printf("%d", result);
    return 0;
}


Measured memory_bytes: 128
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int D = sc.nextInt();
        int T = sc.nextInt();
        int S = sc.nextInt();
        if(D <= S*T){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}   

Measured memory_bytes: 35660
import java.util.*;

public class Main {
    private static long f(long a) {
        if (a < 0) a = 0;

        long[] ret = new long[] {a, 1, a+1, 0};
        return ret[(int)(a % 4)];
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String in[];
        long a, b, ret;
        in = scanner.nextLine().split(" ");
        a = Long.parseLong(in[0]);
        b = Long.parseLong(in[1]);

        ret = f(b) ^ f(a-1);

        System.out.println(ret);
    }
}

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

int main()
{
  int m, n;
  cin >> n >> m;
  int a, b;
  cin >> a >> b;
  int x[n], y[m];
  for (int i = 0; i < n; i++) cin >> x[i];
  for (int i = 0; i < m; i++) cin >> y[i];
  sort(x, x + n);
  reverse(x, x + n);
  sort(y, y + m);
  for (int i = a + 1; i <= b; i++) {
    if (x[0] < i && i <= y[0]) {
      cout << "No War" << endl;
      return 0;
    }
  }
  cout << "War" << endl;
  return 0;
}


Measured memory_bytes: 256
// Hovalhagh
// AliReza Kaboli

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5 + 100;

int cnt[N], dp[N];

vector <int> g[N], go, ans, sa[N];

int main() {
	int n, m, maxx = 0;
	cin >> n >> m;
	for (int i = 1; i <= m; ++i) {
		int u, v;
		cin >> u >> v;
		g[u].push_back(v);
		sa[v].push_back(u);
		++cnt[v];
	}
	for (int i = 1; i <= n; ++i)
		if (cnt[i] == 0)
			go.push_back(i);
	while (go.size()) {
		int tmp = go[go.size() - 1];
		go.pop_back();
		ans.push_back(tmp);
		for (int e: g[tmp]) {
			--cnt[e];
			if (cnt[e] == 0)
				go.push_back(e);
		}
	}
	/*for (int i = 0; i < ans.size(); ++i)
		cout << ans[i] << ' ';*/
	for (int i = 0; i < ans.size(); ++i) {
		for (int e: sa[ans[i]])
			dp[ans[i]] = max(dp[ans[i]], dp[e]);
		++dp[ans[i]];
		maxx = max(maxx, dp[ans[i]]);
	}
	cout << maxx - 1 << '\n';
}


Measured memory_bytes: 12540
#include<iostream>
using namespace std;
int main(){
	int n,list[100];
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> list[i];
	}
	for (int i = n-1; 0<=i; i--){
		cout << list[i];
		if(i!=0) cout << " ";
	}
	cout << endl;
}


Measured memory_bytes: 3084
import java.util.Scanner;

public class Main {

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

		final int a = sc.nextInt();
		final int b = sc.nextInt();
		final String s = sc.next();

		final String matchpattern = "[0-9]{" + a + "}-[0-9]{" + b + "}";

		System.out.println(s.matches(matchpattern) ? "Yes" : "No");

	}

}


Measured memory_bytes: 23764
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <numeric>
#include <cctype>

// BEGIN CUT HERE
#ifdef _MSC_VER
#include <agents.h>
#endif
// END CUT HERE 

#define FOR(i, a, b) for(int i = (a); i < (int)(b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define REV(v) v.rbegin(), v.rend()
#define MEMSET(v, s) memset(v, s, sizeof(v))
#define MP make_pair
#define MT make_tuple
#define X first
#define Y second

using namespace std;

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

const int N = (1 << 16);
int cnt[N];

int main(){
	rep(i, 190) rep(j, i+1) rep(k, j+1) rep(l, k+1){
		cnt[min(i*i + j*j + k*k + l*l, N-1)]++;
	}

	ios::sync_with_stdio(false);

	int n;
	while (cin >> n, n){
		cout << cnt[n] << endl;
	}

	return 0;
}

Measured memory_bytes: 1444
// atcoder/abc170/D/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/

#include <bits/stdc++.h>

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

template<typename P, typename Q> ostream& operator << (ostream& os, pair<P, Q> p) { os << "(" << p.first << "," << p.second << ")"; return os; }
template<typename P, typename Q> istream& operator >> (istream& is, pair<P, Q>& p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator << (ostream& os, vector<T> v) { os << "("; for (auto& i: v) os << i << ","; os << ")"; return os; }
template<typename T> istream& operator >> (istream& is, vector<T>& v) { for (auto& i: v) is >> i; return is; }
template<typename T> ostream& operator << (ostream& os, set<T> s) { os << "#{"; for (auto& i: s) os << i << ","; os << "}"; return os; }
template<typename K, typename V> ostream& operator << (ostream& os, map<K, V> m) { os << "{"; for (auto& i: m) os << i << ","; os << "}"; return os; }

template<typename T> inline T setmax(T& a, T b) { return a = std::max(a, b); }
template<typename T> inline T setmin(T& a, T b) { return a = std::min(a, b); }

using lli = long long int;
using ull = unsigned long long;
using point = complex<double>;
using str = string;
template<typename T> using vec = vector<T>;

constexpr array<int, 8> di({0, 1, -1, 0, 1, -1, 1, -1});
constexpr array<int, 8> dj({1, 0, 0, -1, 1, -1, -1, 1});
constexpr lli mod = 1e9 + 7;

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.setf(ios_base::fixed);
  cout.precision(15);

  int n;
  while (cin >> n) {
    vec<int> a(n);
    cin >> a;
    sort(a.begin(), a.end());

    const int N = 1e6 + 5;
    int x[N];

    fill(x, x + N, 0);
    each (i, a) ++x[i];
    for (lli i = 1; i < N; ++i) {
      if (x[i]) {
        for (lli j = 2; i * j < N; ++j) {
          x[i * j] = 0;
        }
      }
    }

    lli sum = 0;
    for (int i = N - 1; 0 < i; --i) {
      if (x[i] == 1) sum += x[i];
    }
    cout << sum << endl;
  }

  return 0;
}


Measured memory_bytes: 7932
import bisect
N = int(input())
A = [int(input()) for i in range(N)]


S = []
for i in range(N):
    posi = bisect.bisect_left(S,A[i])
    if posi == 0:
        S.insert(0,A[i])
    else:
        S[posi-1] = A[i]

print(len(S))

Measured memory_bytes: 84260
#include<stdio.h>
int main(void){
  int n,ans = 1;
  scanf("%d",&n);
  int h[n];
  for(int i = 0;i < n;i++){
    scanf("%d",&h[i]);
    if(i > 0){
      int fl = 1;
      for(int j = 0;j < i;j++){
        if(h[j] > h[i]){
          fl = 0;
        }
      }
      if(fl){
        ans++;
      }
    }
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 128
A = list(map(int, input().strip().split(' ')))
flag = True

while flag:
    A[2] = A[2] - A[1]
    if not A[2] > 0:
        print('Yes')
        break
    A[0] = A[0] - A[3]
    if not A[0] > 0:
        print('No')
        flag = False

Measured memory_bytes: 9056
#include <iostream>

using namespace std;

long int pow2(long int n);
int main(){
  long int i = 0;
  long int H;
  long int act = 0;

  cin >> H;
  
  while(H > 0){
    act += pow2(i); 
    i++;
    H = H/2;
  }
  
  cout << act << endl;
  
  return 0;
}

long int pow2(long int n){
  if(n){
    return 2*pow2(n-1);
  }
  else{
    return 1;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ll n,ans=0,tmp=1;
    scanf("%lld",&n);
    while(n)
    {
        ans+=tmp;
        n/=2;
        tmp*=2;
    }
    printf("%lld",ans);
    return 0;
}


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

#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>

int main() {
    int X;
    cin>>X;
    int ans = 0;
    if(1800 <= X) ans = 1;
    else if(1600 <= X) ans = 2;
    else if(1400 <= X) ans = 3;
    else if(1200 <= X) ans = 4;
    else if(1000 <= X) ans = 5;
    else if(800 <= X) ans = 6;
    else if(600 <= X) ans = 7;
    else if(400 <= X) ans = 8;
    cout << ans << endl;
}

Measured memory_bytes: 3632