akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <algorithm>

// Definitions
#define MAXN 5000010
#define MAXA MAXN
#define elif else if
typedef long long int64;
typedef long double num128;
typedef unsigned long long uint64;

#define PUTLINE printf("[%d] current line.\n", __LINE__)
#define STARTFUNC printf("[%s] function start.\n", __FUNCTION__)
#define File(s) freopen(#s".in", "r", stdin), freopen(#s".out","w", stdout)

// Improve the speed of read-in.
inline bool IsNum(char x) { return ('0' <= x) && (x <= '9'); }
inline int64 ReadNum() {
  int64 sign = 1, val = 0; char tmp = getchar();
  while (!IsNum(tmp)) { if (tmp == '-') {sign = -sign;} tmp = getchar(); }
  while (IsNum(tmp)) { val = val * 10 + tmp - 48; tmp = getchar(); }
  return val * sign;
}

// Variables
int n, a[MAXN], maxnum;
bool pairwise = true, setwise = true, keg[MAXA];

// GCD
inline int gcd(int _x, int _y) {
  if (_x < _y)
    std::swap(_x, _y);
  int _z = 0;
  while (_y)
    _z = _x % _y,
    _x = _y,
    _y = _z;
  return _x;
}

// Functions
inline void Process() {
  bool mark = false;
  for (int base = 2; base <= maxnum; base++) {
    mark = false;
    for (int times = 1; times * base <= maxnum; times++) {
      if (keg[base * times]) {
        if (mark)
          pairwise = false;
        else
          mark = true;
      }
    }
  }
  int ggcd = a[1];
  for (int i = 2; i <= n; i++)
    ggcd = gcd(ggcd, a[i]);
  if (ggcd != 1)
    setwise = false;
}
inline void ReadIn() {
  n = ReadNum();
  for (int i = 1; i <= n; i++)
    a[i] = ReadNum(),
    keg[a[i]] = true,
    maxnum = std::max(maxnum, a[i]);
}
inline void PrintAns() {
  if (setwise && pairwise)
    puts("pairwise coprime");
  elif (setwise)
    puts("setwise coprime");
  else
    puts("not coprime");
}

int main() {
  #ifndef ONLINE_JUDGE
    File(data);
  #endif
  ReadIn();
  Process();
  PrintAns();
  return 0;
}
/*

*/


Measured memory_bytes: 8420
// package app;

import java.util.Arrays;
import java.util.Scanner;
import java.util.stream.Stream;

public class Main {

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

        // final String S = sc.next();
        // final int A = sc.nextInt();
        // final int A = sc.nextInt();
        // final int B = sc.nextInt();
        // final int C = sc.nextInt();
        int N = sc.nextInt();

        // System.out.println();
        System.out.println(N / 3);

        // System.out.println(A <= X && A + B >= X ? "YES" : "NO");

    }
}

Measured memory_bytes: 21204
//By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define ln '\n'
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM=1e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main(){
	fastio;

	int n;
	cin>>n;
	string s[n];
	int t[n];
	forn(i,n){
		cin>>s[i]>>t[i];
	}
	string g;cin>>g;
	int x;
	forn(i,n){
		if(s[i] == g) x = i+1;
	}
	int ans = 0;
	forsn(i,x,n){
		ans += t[i];
	}
	cout<<ans<<ln;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007

using namespace std;



int main(int argc, char* argv[])
{
    long a,b,c;
    scanf("%ld%ld%ld", &a,&b,&c);

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

    return 0;
}


Measured memory_bytes: 128
//#define DEB1 //input from input.txt
//#define NDEBUG
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <thread>
#include <mutex>
#include <iomanip>
#include <cassert>

#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define INF(a) memset(a, 0x3f, sizeof(a))
#define ALL(t) (t).begin(),(t).end()
#define FILL(a,c) fill(a, a+ sizeof(a)/sizeof(*a),c)
#define FILL2D(A,c) fill(A[0], A[0] +sizeof(A)/sizeof(**A),c)
#define FILL3D(A,c) fill(A[0][0], A[0][0] +sizeof(A)/sizeof(***A),c)
#define REP(i,m) for(int i=0;i<(m);++i)
// closed interval, inverse repeat
#define CIREP(i,start,fin) for(int i=(start);i>=(fin);i--)
#define CREP(i,start,fin) for(int i=(start);i<=(fin);i++)
#define RNG(i,start,fin) for(int i=(start);i<(fin);i++)
#define IN(a, x, b) (a<=x && x<b)
#define PB push_back
#define SZ(x) (int)(x).size()

using namespace std;

using LL = long long;
using PAIR = pair<int, int>;
using PAIRLL = pair<LL,LL>;
using VI = vector<int>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VVI = vector<VI>;
const LL LINF = 1001002003004005006ll;
/* 
template<typename T>inline istream& operator>>(istream&i,vector<T>&v)
{REP(j,SZ(v))i>>v[j];return i;}

template<typename T>string join(const vector<T>&v)
{stringstream s;REP(i,SZ(v))s<<' '<<v[i];return s.str().substr(1);}

template<typename T>inline ostream& operator<<(ostream&o,const vector<T>&v)
{if(SZ(v))o<<join(v);return o;}
*/

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




/*
constant values
*/

//const int dx[] = {1,0,-1,0};
//const int dy[] = {0,1,0,-1};
//const int MX = 31001;

//const ll INF= 1LL<<60 ;//INF = 1001001001001; //1e9


// Main program
void solve(){
    int N;
    VI X;
    cin >> N;
    REP(i,N){
        int tmp;
        cin >> tmp;
        X.PB(tmp);
    }
    int ans = 1000000000;
    REP(i,100){
        int sum = 0;
        REP(j,N){
            sum+= pow( (X[j]-i),2);
        }
        chmin(ans,sum);
    }

    cout << ans << endl;
    return;
}

// ----------------------------------------------
int main(){

#ifdef DEB1
    cout << "DEBUG MODE"  << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf()); //for debug
#endif

    int T=1; 

    for (int i = 0; i < T; ++i) {
        solve();
    }

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;

#define ran 200005
#define edge_type long long int
int n;
vector<pair<edge_type,pair<int,int> > > alle;
vector<pair<int,int> > e[ran];
int w[ran];

namespace ctdcp{

bool bad[ran];
int fat[ran],sz[ran];
int u[ran];
int rt;

vector<pair<edge_type,int> > lis;

void dfs(int x,int tot,int&mx,int&z){
	int now = 0;
	sz[x] = 1;
	for(vector<pair<int,int> >::iterator it = e[x].begin(); it!=e[x].end(); it++){
		int y = it->first;
		if(y == fat[x] || bad[y])continue;
		fat[y] = x;
		dfs(y, tot, mx, z);
		sz[x] += sz[y];
		now = max(now, sz[y]);
	}
	now = max(now, tot - sz[x]);
	if(now < mx){
		mx = now;
		z = x;
	}
}

void dfs2(int x,int fat,edge_type dis){
	lis.push_back(make_pair(w[x] + dis, x));
	for(vector<pair<int,int> >::iterator it = e[x].begin(); it!=e[x].end(); it++){
		int y = it->first;
		if(y == fat || bad[y])continue;
		dfs2(y, x, dis+it->second);
	}
}
int process(int x,int tot){
	int mx = tot, z = -1;
	fat[x] = x;
	dfs(x,tot,mx,z);

	x = z;
	bad[x] = true;

	lis.clear();
	dfs2(x, x, 0);
	sort(lis.begin(), lis.end());
	for(int i=1; i<lis.size(); i++)
		alle.push_back(make_pair(lis[0].first+lis[i].first,make_pair(lis[0].second,lis[i].second)));
	
	for(vector<pair<int,int> >::iterator it = e[x].begin(); it!=e[x].end(); it++){
		int y = it->first;
		if(bad[y]) continue;
		u[process(y, y == fat[x]?tot - sz[x]:sz[y])] = x;
	}
	return x;
}
void init(){
	memset(bad,0,sizeof(bad));
	fat[1] = 1;
	rt = process(1, n);
}

}

int ace[ran];int ancestor(int x){return x-ace[x]?ace[x]=ancestor(ace[x]):x;}
edge_type o;
int main(){
	scanf("%d",&n);
	for(int i=1; i<=n; i++){
		scanf("%d",&w[i]);
		ace[i] = i;
	}
	for(int i=1; i<n; i++){
		int x,y,z;
		scanf("%d%d%d",&x,&y,&z);
		e[x].push_back(make_pair(y,z));
		e[y].push_back(make_pair(x,z));
	}
	ctdcp::init();
	sort(alle.begin(),alle.end());
	for(vector<pair<edge_type,pair<int,int> > >::iterator it = alle.begin(); it != alle.end(); it++){
		int X = ancestor(it->second.first), Y = ancestor(it->second.second);
		if(X == Y)continue;
		o += it->first;
		ace[X] = Y;
	}
	printf("%lld\n",o);
	return 0;
}

Measured memory_bytes: 104928
#include <bits/stdc++.h>
//#include <atcoder/all>
#define ll long long
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
#define repm(i, a, b) for (ll i = (ll)(a); i > (ll)(b); i--)
#define all(v) v.begin(), v.end()
#define rall(x) (x).rbegin(), (x).rend()
#define pll pair<long long, long long>
#define pb emplace_back
#define mp make_pair
#define mt make_tuple
#define vc vector<char>
#define vvc vector<vc>
using namespace std;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<long long>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vvb = vector<vb>;
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;}
//snippets:tmp,cl,cvl,cs,co,coy,con,cov,setp


int main(){
  ll k;
  cin >> k;
  rep(i,k){
    cout<<"ACL";
  }
  cout<<endl;
}


Measured memory_bytes: 3636
s = input()
n = len(s)
sum = 0
for b in range(1 << n-1):
    t = 0
    for i in range(n-1):
        if b & (1 << i):
            sum += int(''.join(s[t:i+1]))
            t = i+1
    sum += int(''.join(s[t:]))
print(sum)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define int long long int
#define boost ios_base::sync_with_stdio(false)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repp(i,a,b) for(int i=a;i<=b;i++)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
//#define test int t;cin>>t; while(t--)
#define vi vector<int> 
#define mi map<int,int> 
#define rrep(i,a,b) for(int i=a;i>=b;i--)
//typedef pair <int,int> pii
//typedef vector<pii> vpi
#define build(arr,n) { int arr[n+1]; repp(i,1,n)cin>>arr[i]; }
#define buildv(v,n) { vi v; repp(i,1,n){int x; cin>>x; v.pb(x);} } 
#define in_edges(m) repp(i,1,m){int a,b; cin>>a>>b; adj[a].pb(b); adj[b].pb(a);}
#define mod 998244353
#define mx(arr) {*max_element(arr+1,arr+n+1);}
using namespace std;
 
signed main()
{
    int n,k; cin>>n>>k;
    int arr[n+1];
    repp(i,1,n)cin>>arr[i];
    int dp[k+1]={0};
    repp(i,1,k)
    {
        repp(j,1,n)
        {
            if(i-arr[j] < 0)break;
            if(dp[i-arr[j]]==0)dp[i]=1;
        }
    }
    if(dp[k])cout<<"First";
    else cout<<"Second";
}

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int ans = 0;

  for(int i=0; i < n; i++) {
    int cnt = 0;
    for(int j=i; j < n; j++) {
      char c = s[j];
      if (c == 'A' || c == 'C' || c == 'G' || c == 'T') cnt++;
      else break;
    }
    ans = max(ans, cnt);
  }

  cout << ans << endl;

  return 0;
}

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

int main() {

  int X, N;
  cin >> X >> N;

  vector<bool> p(101);
  for (int i = 0; i < N; i++) {
    int P;
    cin >> P;
    p[P] = true;
  }

  if (p[X] == false) {
    cout << X << endl;
    return 0;
  }
  
  int d = 1000;
  int ans = 100;

  for (int i = 0; i < 102; i++) {
    if (p[i] == false) {
      int D = abs(i - X);
      if (D < d && D != 0) {
        d = D;
        ans = i;
      }
    }
  }

  cout << ans << endl;
  
  return 0;

}

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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

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

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;

int dfs(int v, int par, VVI &g) {
    int ans = 0;
    
    for (int u : g[v]) if (u != par) {
        ans ^= (1 + dfs(u, v, g));
    }
    
    return ans;
}

/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    int n;
    cin >> n;
    
    VVI g(n);
    FOR(i,1,n-1) {
        int u, v;
        cin >> u >> v; u--; v--;
        
        g[u].pb(v);
        g[v].pb(u);
    }
    
    cout << (dfs(0, -1, g) ? "Alice" : "Bob");

    return 0;
}

/*************************************************************************/


Measured memory_bytes: 12032
#include <iostream>
using namespace std;
int main()
{
    long long w, h;
    int x, y;
    cin >> w >> h >> x >> y;
    cout << (long long)(w * h) / 2.0 << " ";
    if (x == w / 2.0 && y == h / 2.0)
        cout << 1;
    else
        cout << 0;
}

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

using namespace std;

void solve(){
	int n, k; cin>>n>>k;
	int a[n];
	for(int i = 0; i < n; i++){
		cin>>a[i];
	}
	sort(a,a+n);
	long long int ans = 0;
	for(int i = 0; i < k; i++){
		ans += a[i];
	}
	cout << ans << "\n";
}
int main() {
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
#define INF 1020304050
#define n_max 1000000

int main()
{
  int n;cin>>n;
  int i,j;
  vector<int> dp(n_max+1,INF);
  vector<int> dp2(n_max+1,INF);
  vector<int> ss(300,0);
  dp[0]=0;
  dp2[0]=0;
  rep(i,300)
  {
    ss[i]=(i+1)*(i+2)*(i+3)/6;
  }
  for(i=1;i<=n_max;i++)
  {
    rep(j,300)
    {
      if(i-ss[j]<0)break;
      dp[i]=min(dp[i],dp[i-ss[j]]+1);
      if(ss[j]%2==1)
      {
        dp2[i]=min(dp2[i],dp2[i-ss[j]]+1);
      }
    }
  }
  while(n!=0)
  {
    cout<<dp[n]<<' '<<dp2[n]<<endl;
    cin>>n;
  }
}


Measured memory_bytes: 10656
nums = [int(e) for e in input().split()]

a = (nums[0] + nums[1])
b = (nums[0] - nums[1])
c = (nums[0] * nums[1])
if (a) >= (b) and (a) >= (c):
    print(a)
elif (b) >= (a) and (b) >= (c):
    print(b)
else:
    print(c)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N, Q;
	cat M;
	cin >> N >> M >> Q;
	vector< vector<int> > G0(N), G1(N);
	for(int i = 0; i < Q; i++) {
		int a, b, c;
		cin >> a >> b >> c;
		if(c == 0) {
			G0[a].push_back(b);
			G0[b].push_back(a);
		}
		else {
			if(M == N-1) {
				cout << "No\n";
				return 0;
			}
			G1[a].push_back(b);
			G1[b].push_back(a);
		}
	}
	if(M == N-1) {
		cout << "Yes\n";
		return 0;
	}
	vector<int> comp_br(N, -1);
	int C = 0;
	queue<int> q;
	for(int i = 0; i < N; i++) if(comp_br[i] == -1) {
		comp_br[i] = C;
		q.push(i);
		while(!q.empty()) {
			for(auto v : G0[q.front()]) if(comp_br[v] == -1) {
				comp_br[v] = C;
				q.push(v);
			}
			q.pop();
		}
		C++;
	}
	for(int i = 0; i < N; i++) for(auto v : G1[i]) if(comp_br[i] == comp_br[v]) {
		cout << "No\n";
		return 0;
	}
	cat max_M = N-C + 1LL*C*(C-1)/2;
	if(max_M < M) cout << "No\n";
	else cout << "Yes\n";
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 9344
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef vector<int> vi;

int main(){
  int l; cin >> l;
  while(l--){
    vi seq;
    int n=0;
    {
      int tmp;
      while(cin >> tmp, tmp){
	seq.pb(tmp);
	if(tmp>0)n++;
      }
    }
    
    vi d(n,0), s;
    vector<vi> a(n);
    int id = 0;
    s.pb(0); d[0] = seq[0];

    for(int i=1;i<(int)seq.size();i++){
      if(seq[i]>0){
	id++;

	a[s.back()].pb(id);
	a[id].pb(s.back());
	d[id] = seq[i]-1;
	d[s.back()]--;

	s.pb(id);
      }else{
	int u = s[s.size()-1+seq[i]];

	a[s.back()].pb(u);
	a[u].pb(s.back());
	d[u]--;
	d[s.back()]--;
      }
      while(s.size() && d[s.back()]==0)s.pop_back();
    }

    for(int i=0;i<n;i++){
      cout << i+1;
      sort(a[i].begin(), a[i].end());
      for(int u : a[i])cout << " " << u+1;
      cout << endl;
    }
  }
}

Measured memory_bytes: 1240
import java.util.Scanner;

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

        int sum = 0;

        for (int i = 0; i < n; i++) {
            sum += sc.nextInt();
        }

        sc.close();

        System.out.println(sum - n);
    }
}

Measured memory_bytes: 27192
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;

void solve(){
  long long a, b, ans = 0; cin >> a >> b;
  if(a != 0) a--;
  for(long long i = 2; i <= b * 2; i *= 2){
    if(i == 2){
      long long c, d;
      if(a % 2 == 0) c = a / 2;
      else c = a / 2 + 1;
      if(b % 2 == 0) d = b / 2;
      else d = b / 2 + 1;
      if((d - c) % 2 == 1) ans++;
      continue;
    }
    long long x = a % i, y = b % i;
    //cout << x << " " << y << endl;
    if(x < i / 2){
      if(y >= i / 2 && y % 2 == 0) ans += i / 2;
    }
    else if(x % 2 == 0){
      if(y < i / 2 || y % 2 == 1) ans += i / 2;
    }
    else{
      if(y >= i / 2 && y % 2 == 0) ans += i / 2;
    }
  }
  cout << ans << endl;
  return;
}

int main(){
  solve();
  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=list(map(int,input().split()))
ac=[]
pre=0
for i in range(n):
    ac.append(a[i]+pre)
    pre+=a[i]
s=ac[-1]
ans=abs(s-2*a[0])
for i in range(n-1):
    ans=min(ans,abs(ac[i]-(s-ac[i])))
print(ans)



Measured memory_bytes: 87000
#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 <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#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 <codecvt>
#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>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, n) for(int i = 1; i <= (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld inf=pow(10,10);
const ld pi=acosl((ld)1);
//const ll mod = 1000000007;
const ll mod = 1000003;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};

void solve(){
  ll n;cin>>n;
  cout<<(n+1)/2<<endl;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
	cout<<setprecision(30);
	solve();
}

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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    ll N, M;
    cin >> N >> M;
    vec A(N);
    vector<pll> P(M);
    REP(i,0,N) cin >> A[i];
    REP(i,0,M) cin >> P[i].second >> P[i].first;
    
    ASC(A);
    DESC(P);

    ll k = 0, l = 0;
    while(l < N && k < M) {
        bool f = true;
        REP(i,0,P[k].second) {
            if(l + i >= N) break;
            if(A[l+i] < P[k].first) A[l+i] = P[k].first;
            else {
                f = false;
                l += i;
            }
        }
        if(f) l += P[k].second;
        else ++l;
        ++k;
    }

    ll sum = 0;
    REP(i,0,N) sum += A[i];
    PR(sum);

    return 0;
}

/*



*/

Measured memory_bytes: 5532
import sys
import os
N,A,B = map(int,input().split())
X = list(map(int,input().split()))
tired = 0
cur = X[0]
for x in X:
    if A*(x - cur) <= B:
        tired += A*(x - cur)
    else:
        tired += B
    cur = x
print(tired)


Measured memory_bytes: 14480
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  vector<int> a(n);
  for(int i=0;i<n;i++)
    cin>>a[i];
  vector<int> dp(n);
  dp[0]=0;dp[1]=abs(a[1]-a[0]);
  
  for(int i=2;i<n;i++)
  {
      
   	if(i<k)
    {
      int x=INT_MAX;

      for(int j=0;j<i-1;j++)
      {
        //   cout<<"hgfv"<<endl;
        x=min(dp[j]+abs(a[i]-a[j]),x);
      }
   	dp[i]=x;
  	}
	else
    {
        int x=INT_MAX;
        for(int j=i-1;j>=(i-k);j--)
        {
            // cout<<"gbhn"<<endl;
            x=min(dp[j]+abs(a[i]-a[j]),x);
        }
        dp[i]=x;
    }
    // cout<<dp[i]<<endl;
  }
  cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 3952
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n) ; ++i)
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define emb emplace_back
#define fcout cout << fixed << setprecision(15)

using namespace std;
using ll = long long;
using P = pair<int,int>;

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

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

  int q = x / 500;
  int five = (x % 500) / 5;

  cout << q * 1000 + five * 5 << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
  int a, b;
  cin >> a;
  cin >> b;
  
  int c = b % a;
  int result;
  if(c)
  {
	result = b - a;
  }
  else
  {
	result = a + b;
  }
  
  cout << result << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>
#include<map>
#include<bitset>

using namespace std;
typedef long long ll;
#define i_7 1000000007
#define i_5 1000000005


ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=1000000000000;/*10^12*/
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}


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



int main(){
    int n;cin>>n;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    ll ans=0;
    rep(i,0,n-1){
        ans+=a[i]/2;
        a[i]-=2*(a[i]/2);
        if(i<=n-2&&a[i]>0&&a[i+1]>0){
            ans++;
            a[i]--;a[i+1]--;
        }
    }
    cout<<ans;
    return 0;
}

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

using namespace std;

using int64 = long long;

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

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

  int n;
  int64 c;
  cin >> n >> c;
  vector<int64> xs(n + 1);
  for (int i = 1; i <= n; i++) cin >> xs[i];
  vector<int64> cumulated_xs(n + 1);
  for (int i = 1; i <= n; i++) cumulated_xs[i] = cumulated_xs[i - 1] + xs[i];

  int64 max_cost = 2 * n * c + 5 * cumulated_xs[n];
  auto solve_for_k = [&](int k) {
    int64 cost = (n + k) * c;
    // cout << "cost : " << cost << endl;
    
    int r = n;
    int64 unit_cost = 5;
    while (r > 0) {
      int l;
      if (unit_cost == 5) {
        l = max(r - 2 * k, 0);
      } else {
        l = max(r - k, 0);
      }
      cost += (cumulated_xs[r] - cumulated_xs[l]) * unit_cost;
      if (cost > max_cost) return max_cost;
      r = l;
      unit_cost += 2;
    }
    // cout << "k: " << k << " cost: " << cost << endl;
    return cost;
  };

  int64 ans = max_cost;
  for (int k = 1; k <= n; k++) {
    UpdateMin(ans, solve_for_k(k));
  }
  cout << ans << endl;
}


Measured memory_bytes: 3456
mod = 10**9+7

H, W, A, B = list(map(int, input().split(" ")))

fact = [1] * (2 * 10**5+1)
for i in range(1, 2*10**5+1):
    fact[i] = i * fact[i-1] % mod

def comb(n, k):
    a = fact[n] % mod
    b = (fact[k] * fact[n-k]) % mod
    b_ = pow(b, mod-2, mod)
    return  (a * b_) % mod

ans = 0
for i in range(B, W):
    # (h-a+i)Ci * (a+W-i)Ca 
    ans += comb(H-A+i-1, i) * comb(A+W-i-2, A-1) % mod
    
print(ans%mod)

Measured memory_bytes: 10868
#include <iostream>
#include <string>
#include <cstdio>
#include <unordered_map>
#include <vector>
#define task ""
using namespace std;
using ll = long long;
using ld = long double;

const int N = 5e3 + 2;
string s;

void Read(){
	cin >> s;
}

void Solve(){
	int ans = 0;
	for(int i = 0; i < s.size(); ++i)
		if(s[i] == '?')
			s[i] = 'D';
	cout << s;
}

main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
//	freopen(task".INP", "r", stdin);
//	freopen(task".OUT", "w", stdout);
	Read();
	Solve();
}


Measured memory_bytes: 3720
#include <stdio.h>

int main() {
	int A, B, C, i;

	scanf("%d %d %d", &A, &B, &C);

	for (i = 0; C > 0 && B >= A; i++) {
		C--;
		B = B - A;
	}

	printf("%d", i);

	return 0;
}

Measured memory_bytes: 128
N, K = map(int, input().split())
ans = 0
cou = 0
if K % 2 != 0:
    
    ans = (N // K)**3
else:
    
    for i in range(1, N+1):
        if i%K == K/2:
            cou += 1
    ans = (N//K)**3 + cou**3

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  int r;
  cin >> r;
  cout << 3 * r * r << endl;
}


Measured memory_bytes: 892
#include<bits/stdc++.h>
#define ll long long int
#define pii pair<int,int>
#define F first
#define S second
using namespace std;
ll mod=1e9+7;

ll add(ll a,ll b){
    return ((a%mod)+(b%mod))%mod;
}
ll mul(ll a,ll b){
    return ((a%mod)*(b%mod))%mod;
}
void dfs(vector<int>adj[],int vis[],int i,int &curr){
    for(auto x:adj[i]){
        if(vis[x]==0){
            vis[x]=1; curr++;
            dfs(adj,vis,x,curr);
        }
    }
}
int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n,m; cin>>n>>m; vector<int>adj[n+1];
    int vis[n+1]={0};
    for(int i=0;i<m;i++){
        int u,v; cin>>u>>v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(vis[i]==0){
            int curr=1;
            vis[i]=1;
            dfs(adj,vis,i,curr);
            ans=max(ans,curr);
        }
    }
    cout<< ans <<endl;


}


Measured memory_bytes: 24700
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <typeinfo>

using namespace std;

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

  vector<long long> x(1001);
  for(int i=1;i<=N;i++){
    int a=i;
    for(int j=2;j<=a;j++){
      while(a%j==0){
        x.at(j)++;
        a/=j;
      }
    }
  }

  long long ans=1;
  long long mod=1000000007;
  for(int i=0;i<1001;i++){
    ans*=(x.at(i)+1);
    ans%=mod;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
<?php
    /*
        Problem URL : http://abc057.contest.atcoder.jp/tasks/abc057_b

        Score  :
        Result :
        Time   : ms
        Memory : KB
     */

    ini_set('error_reporting', E_ALL & ~E_NOTICE);

    // define('DEBUG', true);
    define('DEBUG', false);

    if (DEBUG) {
        $start = microtime(true);
    }
    $ret = solve();
    foreach ($ret as $v) {
        echo $v . PHP_EOL;
    }
    if (DEBUG) {
        $t = microtime(true) - $start;
        printf ("Elapsed time: %7.3f sec\n", $t);
    }


    function solve() {
        $ret = array();

        fscanf(STDIN, "%d %d\n", $N, $M);
        for ($i = 1; $i <= $N; $i++) {
            fscanf(STDIN, "%d %d\n", $a[$i], $b[$i]);
        }
        for ($i = 1; $i <= $M; $i++) {
            fscanf(STDIN, "%d %d\n", $c[$i], $d[$i]);
        }

        // var_dump($a);
        // var_dump($b);
        // var_dump($c);
        // var_dump($d);

        for ($i = 1; $i <= $N; $i++) {
            $tmp = PHP_INT_MAX;
            $ans = null;
            for ($j = 1; $j <= $M; $j++) {
                $diff = abs($a[$i] - $c[$j]) + abs($b[$i] - $d[$j]);
                if ($diff < $tmp) {
                    $ans = $j;
                    $tmp = $diff;
                }
            }
            $ret[] = $ans;
        }
        return $ret;
    }


Measured memory_bytes: 4856
#include<bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define  rep(i,a,b) for(i=a;i<b;i++)
#define endl "\n"
#define ll long long int
#define ld long double
using namespace std;
int main()
{
IOS;
ll k,x,a,b,i;
cin>>k>>x;
a=x-(k-1);
b=x+k-1;
rep(i,a,b+1)
cout<<i<<' ';
return 0;
}



Measured memory_bytes: 256
(* your code goes here *)
let id x = x

let () =
    let x = Scanf.sscanf(read_line()) "%d" id in
    let rec f t r n = if r >= t then f t (r - t) (n + 1) else (n, r) in
    let (hh, x') = f 3600 x 0  in
    let (mm, ss) = f 60   x' 0 in
    Printf.printf "%d:%d:%d\n" hh mm ss


Measured memory_bytes: 2396
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();
        if(a + b > c + d) {
            System.out.println("Left");
        } else if(a + b < c + d) {
            System.out.println("Right");
        } else {
            System.out.println("Balanced");
        }
    }
}

Measured memory_bytes: 35684
A, B = map(int, input().split())
x = A+B
y = A-B
z = A*B

if B>=0:
  if x - z >= 0:
    print(x)
  else:
    print(z)
else:
  if y - z >= 0:
    print(y)
  else:
    print(z)


Measured memory_bytes: 2940
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
	ll i,x,count=0;
	ll n;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>x;
		if(i%2==1 &&  x%2==1){
			count++;
		}
	}
	cout<<count;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin >> n;
    const int x = 5;
    long long int s[x];
    long long int min = LLONG_MAX;
    for(int i = 0;i < x;i++)
    {
        cin >> s[i];
        if(s[i] < min)
        {
            min = s[i];
        }
    }
    cout << (n - 1) / min + 5;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
      	sc.nextLine();
		Set<String> kind=new LinkedHashSet<>();
		for(int i=0;i<n;i++){
			kind.add(sc.nextLine());
		}
		System.out.println(kind.size());
	}
}

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

const int use_number[] = {
    3, 5, 7
};
int numbers[10];
vector<int> container;

int make_number(int n) {
    int num = 0;
    for (int i = 0; i < n; i++) {
        num = (num * 10) + numbers[i];
    }
    return num;
}

void make_sequence(int n, int digit) {
    if (n == digit) {
        int count7 = 0;
        int count5 = 0;
        int count3 = 0;
        for (int i = 0; i < n; i++) {
            if (numbers[i] == 7) count7++;
            else if (numbers[i] == 5) count5++;
            else if (numbers[i] == 3) count3++;
            if (count7 > 0 && count5 > 0 && count3 > 0) {
                container.push_back(make_number(n));
                break;
            }
        }
    } else {
        for (int i = 0; i < 3; i++) {
            int num = use_number[i];
            numbers[n] = num;
            make_sequence(n + 1, digit);
        }
    }
}

int check(int limit) {
    int count = 0;
    for (vector<int>::iterator it = container.begin(); it != container.end(); it++) {
        if (*it > limit) {
            break;
        }
        count++;
    }
    return count;
}

int main() {
    int N;
    
    cin >> N;
    for (int i = 3; i <= 9; i++) {
        make_sequence(0, i);
    }
    int count = check(N);
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 512
function Main(input) {
  var line = input.trim().split(' ');
  var A = Number(line[0]);
  var B = Number(line[1]);
  if (A <= 8 && B <= 8) {
    console.log('Yay!');
  } else {
    console.log(':(');
  }
}

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


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

#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define vi vector<int>

#define ll long long
#define vl vector<ll>
#define vll vector<vl>
#define P pair<ll, int>

const int INF = 1e9;
const long double pi=3.14159265358979323846;

#define E pair<int, ll>


int main() {
	vi e[100010];
	vi ne[100010];
	int n;
	cin >> n;
	int a, b;
	rep(i, n-1)
	{
		cin >> a >> b;
		a--;
		b--;
		e[a].push_back(b);
		e[b].push_back(a);
		ne[a].push_back(i);
		ne[b].push_back(i);
	}
	int ans=0;
	rep(i, n)
	{
		if(e[ans].size()<e[i].size()) ans=i;
	}
	int k=e[ans].size();
	cout << k << endl;
	bool done[100010]={};
	//done[ans]=true;
	int col[100010];
	col[ans]=1;
	queue<int> q;
	int co=0;
	int colo[100010];
	rep(i, e[ans].size())
	{
		co++;
		col[ne[ans][i]]=co;
		q.push(e[ans][i]);
		colo[e[ans][i]]=co;
	}
	done[ans]=true;
	while(!q.empty())
	{
		int from=q.front();
		q.pop();
		done[from]=true;
		int c=0;
		rep(i, e[from].size())
		{
			int to=e[from][i];
			if(!done[to])
			{
				c++;
				if(c==colo[from]) c++;
				col[ne[from][i]]=c;
				colo[to]=c;
				q.push(to);
			}
		}
	}

	rep(i, n-1) cout << col[i] << endl;

	return 0;
}

Measured memory_bytes: 12544
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    vector<string>v ={"01","02","03","04","05","06","07","08","09","10","11","12"};
    string yymm,mmyy;
    yymm+=s[2];
    yymm+=s[3];
    mmyy+=s[0];
    mmyy+=s[1];
    int cnt=0,cnt1=0;
    if(find(v.begin(),v.end(),yymm)!=v.end())
        cnt++;
    if(find(v.begin(),v.end(),mmyy)!=v.end())
        cnt1++;
    if(cnt==1&&cnt1==1)
        cout<<"AMBIGUOUS"<<endl;
    else if(cnt==1)
        cout<<"YYMM"<<endl;
    else if(cnt1==1)
        cout<<"MMYY"<<endl;
    else
        cout<<"NA"<<endl;

}


Measured memory_bytes: 3588
def solve():
    M, K = [int(_) for _ in raw_input().split()]
    if M == 0:
        if K == 0:
            print '0 0'
        else:
            print '-1'
    elif M == 1:
        if K == 0:
            print  '0 0 1 1'
        else:
            print '-1'
    else:
        MAX = 1 << M
        if K >= MAX:
            print '-1'
        else:
            arr = list(range(K))
            arr.extend(list(range(K + 1, MAX)))
            arr_rev = arr[::-1]
            arr.append(K)
            arr.extend(arr_rev)
            arr.append(K)
            for ele in arr:
                print ele,

if __name__ == '__main__':
    solve()


Measured memory_bytes: 37868
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

const int LIM=1300000;
bool sosu[LIM];

int main() {
	int i,j;
	for(i=0;i<LIM;i++)sosu[i]=true;
	sosu[0]=sosu[1]=false;
	for(i=0;i<LIM;i++){
		if(sosu[i]){
			for(j=i*2;j<LIM;j+=i){
				sosu[j]=false;
			}
		}
	}
	int n;
	while(n=in()){
		if(sosu[n]){
			cout<<0<<endl;
			continue;
		}
		int i,j;
		for(i=n;!sosu[i];i--);
		for(j=n;!sosu[j];j++);
		cout<<j-i<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
import java.util.*;
import java.io.*;

public class Main {

	private static void solve(){
		//Implement solution here.
		int N = ni();
		int M = ni();		
		int K = ni();
		long[] A = nal(N);
		long[] B = nal(M);
		long[] Asum = new long[N + 1];
		long[] Bsum = new long[M + 1];
		
		for(int i = 0; i < N; i++) Asum[i + 1] = Asum[i] + A[i];
		for(int i = 0; i < M; i++) Bsum[i + 1] = Bsum[i] + B[i];
		
		int result = 0;
		for(int i = 0; i <= N; i++) {
			if(Asum[i] > K)break;
			for(int j = M; j >= 0; j--) {
				if(Asum[i] + Bsum[j] <= K) {
					result = Math.max(result, i + j);
					M = j;
					break;
				}
			}				
		}
		
			System.out.println(result);
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		boolean hasNext = true;
		while(hasNext){
			solve();	
			try{
				br.mark(1);
				if(br.read() > 0){
					br.reset();			
					System.out.println("---");
				} else {
					hasNext = false;
				}
			}catch(Exception e){
				throw new RuntimeException(e);
			} 
		}
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 65984
import java.util.Scanner;
public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        if (a < b) {
        	System.out.println("a < b");
        } else if (a>b) {
        	System.out.println("a > b");
        } else if (a==b) {
        	System.out.println("a == b");
        }
        scanner.close();
    }
}


Measured memory_bytes: 26180
// Example program
#include <iostream>
#include <string>
#include<vector>
#include<algorithm>
using namespace std;


int main()
{
int a;
int b;
int c;
int d;
int e;
int f;
int g;
int h;

cin >> a;
cin >> b;
cin >> c;
cin >> d;
cin >> e;
cin >> f;
cin >> g;
cin >> h;

int s=(a+b+c+d);
int t=(e+f+g+h);

if(t>s){
    cout << t << endl;
}else{
    cout << s << endl;
}
}

Measured memory_bytes: 1160
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <utility>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
using namespace std;

int INF = 1<<29;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする

long long int i,j;

int main(){
	int n;
	cin>>n;
	int x[105];
	for(i=0;i<n;i++){
		cin>>x[i];
	}
	sort(x,x+n);
	int a=0,b=0;
	for(i=0;i<n;i++){
		if(i%2==0)a+=x[i];
		else b+=x[i];
	}
	cout<<abs(a-b)<<endl;
	return 0;
}

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

int main(){
    int a, b;
    cin >> a >> b;
    
    string s = "No";
    if((a*b)%2) s = "Yes";
    
    cout << s << endl;
    return 0;
}

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

if n==1:
    print("Yes")
    exit()
elif n==2:
    if h[0]-h[1] >= 2:
        print("No")
        exit()
    else:
        print("Yes")
        exit()
else:
    judge=True
    for i in range(n-1):
        if h[i]-h[i+1] >= 2:
            print("No")
            exit()
        elif h[i]-h[i+1] == 1:
            if judge:
                judge=False
            else:
                print("No")
                exit()
        elif h[i]-h[i+1] < 0:
            judge=True
print("Yes")

Measured memory_bytes: 14400
import java.util.*;

public class Main {
		static Scanner sc = new Scanner(System.in);
		
	public static void main(String[] args) {
		int N = sc.nextInt();
		int M = sc.nextInt();
		
		String[] A = new String[N];
		String[] B = new String[M];
		for (int i = 0; i < N; i++) {
			A[i] = sc.next();
		}
		for (int i = 0; i < M; i++) {
			B[i] = sc.next();
		}
		
		for (int i = 0; i<= N - M; i++) {
			for (int j = 0; j <= N-M; j++){
				if(A[i].substring(j, j + M).equals(B[0])){
					if(submat(A, B, i, j)==1) {
						System.out.println("Yes");
						return;
					}
					
				}
			}
		}
		System.out.println("No");

	}
	static int submat(String[] a, String[] b, int i, int j){
		for (int k = 0; k < b.length; k++) {
			if(!a[i+k].substring(j,  j + b.length).equals(b[k])) {
				return 0;
			}
		}
		return 1;
	}

}


Measured memory_bytes: 9988
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner scan=new Scanner(System.in);
		int H,W;
		while(true){
			H=scan.nextInt();
			W=scan.nextInt();
			if(H==0&&W==0) break;
			
			for(int i=0;i<H;i++){
				for(int j=0;j<W;j++){
					if(i==0||i==H-1||j==0||j==W-1)System.out.print("#");
					else System.out.print(".");
				}
				System.out.println();
			}
			System.out.println();
		}
		scan.close();
	}
}

Measured memory_bytes: 24868
n,m,q = map(int,input().split())

abcd = []

for i in range(q):
    abcdi = list(map(int,input().split()))
    abcd.append(abcdi)

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

def dfs(p):
    global ans
    
    if p == 0:
        for i in range(1,m+1):
            a[p] = i
            dfs(p+1)
    else:
        for i in range(a[p-1],m+1):
            a[p] = i
            
            if p != n-1:
                dfs(p+1)
            else:
                temp = 0
                for j in range(q):
                    ai,bi,ci,di = abcd[j]
                    ai,bi = ai-1, bi-1
                    if a[bi] - a[ai] == ci:
                        temp += di
                ans = max(ans,temp)

dfs(0)
print(ans)
            
        





Measured memory_bytes: 9240