akhauriyash/Code-Regression huggingface dataset:
// written by newbiechd
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>

// DELETE the debugging information!
#define debug(x) std::cerr << #x << " = " << (x) << std::endl

const int N_MAX = 1000003;
char s[N_MAX];
int a[N_MAX];

bool binom(int n, int m) {
  while (n | m) {
    if ((n & 1) < (m & 1))
      return 0;
    n >>= 1, m >>= 1;
  }
  return 1;
}

int main() {
  int n;
  scanf("%d%s", &n, s + 1);
  for (int i = 1; i <= n; ++i)
    a[i] = s[i] - '0';
  for (int i = n; i; --i) {
    for (int j = 1; j < i; ++j)
      a[j] = a[j] >= a[j + 1] ? a[j] - a[j + 1] : a[j + 1] - a[j];
    bool ext[3] = {0, 0, 0};
    for (int j = 1; j < i; ++j)
      ext[a[j]] = 1;
    if (!(ext[1] & ext[2])) {
      int ans = 0;
      for (int j = 1; j < i; ++j)
        if (binom(i - 2, j - 1))
          ans ^= a[j];
      printf("%d\n", ans);
      break;
    }
  }
  return 0;
}


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

using namespace std;

using ll= long long;

#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _set(x) __builtin_popcount(x)
#define dpv(...) cerr<< "["#__VA_ARGS__ " : ";for(int i: (__VA_ARGS__)){cerr<<i<<" ";}cerr<<"]\n"

void solve(){
	ll a,b=0;
	cin>>a;
	string s;
	cin>>s;
	for(char c: s){
		if(c=='.'){
			continue;
		}
		b = b*10+(c-'0');
	}
	ll ans= a*b;
	ans /=100;
	cout<<ans<<"\n";
}

int32_t main(){
	IOS
	// freopen("input.txt","r",stdin);
	int _;
	// cin>>_;
	_=1;
    // int tt=1;
	while(_--){
		// cout<<"Case #"<<tt++<<": ";
		solve();
    }
	return 0;
}

/*
   check for overflows int long long
   correct size of array
*/

Measured memory_bytes: 3640
A,B = [int(i) for i in input().split()]
if A==B:
    print(A)
elif A%2==0:
    A = A+((B-A-1)//4)*4
    ans = 0
    for i in range(A,B+1):
        ans = ans^i
    print(ans)
else:
    buff = A
    A = A+1
    A = A+((B-A-1)//4)*4
    ans = 0
    for i in range(A,B+1):
        ans = ans^i
    print(ans^buff)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do { cout << "\033[32;1m " << #x << " -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<template<typename...> class T, typename t, typename... A>
void err(T<t> a, A... x) { for (auto v: a) cout << v << ' '; err(x...); }
template<typename T, typename... A>
void err(T a, A... x) { cout << a << ' '; err(x...); }
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
ll rand_int(ll l, ll r) //[l, r]
{
    static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
    return uniform_int_distribution<ll>(l, r)(gen);
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
    print(v[i],i==(int)(v.size())-1?suc:2);
}
int main()
{
    int n;
    cin>>n;
    vi a(n);
    int mi=0x3f3f3f3f;
    ll tot=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        tot+=a[i];
        mi=min(a[i],mi);
    }
    if(n&1&&tot&1) cout<<"First\n";
    else if(n&1^1)
    {
        if(tot&1) cout<<"First\n";
        else{
            if(mi&1) cout<<"First\n";
            else cout<<"Second\n";
        }
    }
    else cout<<"Second\n";
}


Measured memory_bytes: 3568
#include<stdio.h>

#define N 100

int minimum(int j, int r){
    if(j>r){
        return r;
    }else{
        return j;
    }
}

int main(void){
    int n, p[N+1], m[N+1][N+1];
    scanf("%d", &n);

    for(int i=1; i<=n; i++){
        scanf("%d %d", &p[i-1], &p[i]);
    }
    for(int i=1; i<=n; i++){
        m[i][i]=0;
    }
    for(int l=2; l<=n; l++){
        for(int i=1; i<=n-l+1; i++){
            int j=i+l-1;
            m[i][j]=(1<<21);
            for(int k=i; k<=j; k++){
                m[i][j]=minimum(m[i][j], 
m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
            }
        }
    }

    printf("%d\n", m[1][n]);

    return 0;
}




Measured memory_bytes: 2112
#include <bits/stdc++.h>
#define all(c) c.begin(), c.end()
#define isz(c) (int)c.size();

using namespace std;
using ll = long long;
using vi = vector<int>;

int main(void)
{
    int a, b;
    cin >> a >> b;

    b--;
    a--;

    cout << (a + b - 1) / a << endl;

    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <climits>
#include <algorithm>
using namespace std;

int main()
{
	int a=0;
	string str;
	cin >> str;
	for (int i = 0; i < str.size(); i++) {
		if (str.substr(i, 1) == "+") {
			a++;
		}
		if (str.substr(i, 1) == "-") {
			a--;
		}
	}
	cout << a;
}

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

typedef pair<int, int> PII;

const int dx[] = {0,1,0,-1};
const int dy[] = {1,0,-1,0};
 
int main(){
  int H,W;
  cin >> H >> W ;
  vector<vector<char> > mat(H, vector<char>(W));

  int cnt_black = 0;
  for(int i=0; i < H; i++){
    for(int j=0; j < W; j++){
      cin >> mat.at(i).at(j);
      if(mat.at(i).at(j) == '#'){
      }
    }
  }

  int max_dist = 0;
  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      queue<PII> q;
      q.push(make_pair(i,j));
      vector<vector<int> > ans(H, vector<int>(W, -1));
      if(mat.at(i).at(j) == '#'){
        continue;
      } else {
        ans.at(i).at(j) = 0;
      }

      int x,y,nx,ny;
      int tmp_max = 0;
      while(!q.empty()){
        cerr << q.front().first << endl;
        cerr << q.front().second << endl;
        x = q.front().first;
        y = q.front().second;
        q.pop();

        for(int k=0;k<4;k++){
          nx = x + dx[k];
          ny = y + dy[k];
          if(nx < 0 || nx >= H || ny < 0 || ny >= W){
            continue;
          }
          if(mat.at(nx).at(ny) == '#' || ans.at(nx).at(ny) != -1){
            continue;
          }
          ans.at(nx).at(ny) = ans.at(x).at(y) + 1;
          tmp_max = max(tmp_max, ans.at(nx).at(ny));
          q.push(make_pair(nx,ny));
        }
      }

      max_dist = max(max_dist, tmp_max);
    }
  }

  cout << max_dist << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string.h>
#include <stdio.h>
#define LL long long
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define piii pair<int, pii >
#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define vi vector<int>
#define vpi vector< pii >
#define INF 2147483647
#define big 19260817
#define pb push_back
#define mp make_pair
using namespace std;
const int Maxk=1005;
string mul(string a,string b){
	int res[Maxk];
	memset(res,0,sizeof(res));
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	for (int i=0;i<a.length();i++){
		for (int j=0;j<b.length();j++){
			res[i+j]+=(a[i]-'0')*(b[j]-'0');
		}
	}
	for (int i=0;i<Maxk;i++){
		if (res[i]>=10) {
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	string ret;
	bool flag=false;
	for (int i=Maxk-1;i>=0;i--){
		if (flag || res[i]){
			flag=true;
			ret=ret+(char)(res[i]+'0');
		}
	}
	if (ret=="") ret="0";
	return ret;
}
string add(string a,string b){
	if (a.length()<b.length()) swap(a,b);
	while (a.length()!=b.length()){
		b='0'+b;
	}
	for (int i=a.length()-1;i>=0;i--){
		a[i]+=(b[i]-'0');
		if (a[i]>'9' && i){
			a[i]-=10;
			a[i-1]++;
		}
	}
	if (a[0]>'9'){
		a[0]-=10;
		a='1'+a;
	}
	return a;
}
// cf IO: I64d
// atcoder IO: ｌｌｄ
const int Maxn=5005;
bool pdp[Maxn][Maxn*2],sdp[Maxn][Maxn*2];
int a[Maxn];
int n,k;
bool check(int x){
	vector<int> l,r;
	//cout<<"debug"<<' '<<x<<' '<<a[x]<<endl;
	for (int i=0;i<=2*k;i++){
		if (pdp[x][i]) l.pb(i);//cout<<i<<' ';
	}//cout<<endl;
	for (int i=0;i<=2*k;i++){
		if (sdp[x+2][i]) r.pb(i);//,cout<<i<<' '; 
	}//cout<<endl;
	//>=k-a[x] <k
	for (int i=0;i<l.size();i++){
		int tgt=k-l[i]-a[x];
		int loc=lower_bound(r.begin(),r.end(),tgt)-r.begin();
		if (loc==(int)r.size()) continue;
		if (r[loc]+l[i]<k){
			return true;
		}
	}
	return false;
}
int main(){

	scanf("%d %d",&n,&k);
	for (int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	sort(a,a+n);
	for (int i=0;i<n;i++){
		if (a[i]>=k){
			n=i;
			break;
		}
	}
	if (!n){
		printf("0\n");
		return 0;
	}
	int res=0;
	pdp[0][0]=true;
	for (int i=1;i<=n;i++){
		for (int j=0;j<=k*2;j++){
			pdp[i][j]=pdp[i-1][j];
			if (j>=a[i-1]) pdp[i][j]|=pdp[i-1][j-a[i-1]];
		}
	}
	sdp[n+1][0]=true;
	for (int i=n;i>=1;i--){
		for (int j=0;j<=k*2;j++){
			sdp[i][j]=sdp[i+1][j];
			if (j>=a[i-1]) sdp[i][j]|=sdp[i+1][j-a[i-1]];
		}
	}
	int l=0,r=n;
	while (r-l>1){
		int mid=(l+r)>>1;
		if (check(mid)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	//cout<<l<<r<<endl;
//	cout<<check(1)<<endl;
	if (check(l)){
		printf("%d\n",l);
	} 
	else{
		printf("%d\n",r);
	}
	return 0;
}
/*
6 20
101234 4 31234 101234 251234 2
*/

Measured memory_bytes: 98224
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}


long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0;true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

//ここまでライブラリ
//ここから本文

long long int tpimin(vector<int> a) {
	int MIN = 1000000000;
	int number = 0;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
		number = i;
	}
	return number;
}
int main() {
	int n;
	cin >> n;
	for (int i = n; i > 0; i--) {
		if (i == (int)sqrt(i) * (int)sqrt(i)) {
			cout << i << endl;
			return 0;
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main() {
    fastio
	ll n,t,i,j,x,k;
	cin>>x>>k>>n;
	
	if(x<0) x*=-1;
	
	ll a=x/n,b=x%n;
	if(a>k) cout<<x-k*n;
	else{
	    if((k-a)&1) cout<<abs(b-n);
	    else cout<<b;
	}
	
	return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define pli pair<ll, int>
#define pil pair<int, ll>
#define pll pair<ll, ll>
#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 endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
template<typename T, typename U> T pow_(T a, U b) { return b ? pow_(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b % mod; if (a >= mod) a -= mod; }
template<class T> void operator += (vector<T>& v, vector<T> v2) { rep(i, sz(v2)) v.eb(v2[i]); }

void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12); // debuged
    int T;
    T = 1;
    while (T--) solve();
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    cin >> a;
    
    // ∑abs((ai-i)-b)
    rep(i, n) a[i] -= i + 1;
    sort(all(a));
    // cerr << a << endl;
    
    ll ans = INF;
    rep3(i, n / 2 - 1, n / 2 + 2) {
        if (i < 0 || i >= n) continue;
        ll sum = 0;
        rep(j, n) sum += abs(a[i] - a[j]);
        chmin(ans, sum);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3968
#include <algorithm>
#include <cstdint>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <cfloat>

using namespace std;

using lint=int64_t;
using uint=uint32_t;
using ulint=uint64_t;

template<class T>
using vector2d=vector<vector<T>>;

template<class T>
bool UpdateMax(T &a, const T &b){
  if(a<b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template<class T>
bool UpdateMin(T &a, const T &b){
  if(a>b){
    a=b;
    return true;
  }else{
    return false;
  }
}

template <class T>
void OutVec(const vector<T>& vec){
  for(int i = 0; i < vec.size() - 1; ++i){
    cout<<vec[i]<<" ";
  }
  cout<<vec.back()<<endl;
}

template <class T>
void OutVec2d(const vector2d<T>& vec){
  for(auto v:vec){
    OutVec(v);
  }
}

int main(){
  cout << std::fixed << std::setprecision(16);
  cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  int n;
  cin>>n;
  int i=1000;
  for(i=1000;i<n;i+=1000){}
  cout<<i-n<<endl;


  return 0;
}




Measured memory_bytes: 3640
#define MOD_TYPE 1

#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
/*
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using Int = boost::multiprecision::cpp_int;
using lld = boost::multiprecision::cpp_dec_float_100;
*/
/*
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
*/
using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
//constexpr ll MOD = 1;
constexpr int INF = (int)1e9 + 10;
constexpr ll LINF = (ll)4e18;
constexpr double PI = acos(-1.0);
constexpr double EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define REPI(i, m, n) for (int i = m; i < (int)(n); ++i)
#define repi(i, n) REPI(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

inline void init_main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);
}
template <typename T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return true;
  }
  return false;
}
template <typename T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return true;
  }
  return false;
}
inline ll CEIL(ll a, ll b)
{
  return (a + b - 1) / b;
}
template <typename A, size_t N, typename T>
inline void Fill(A (&array)[N], const T &val)
{
  fill((T *)array, (T *)(array + N), val);
}
template <typename T, typename U>
constexpr istream &operator>>(istream &is, pair<T, U> &p) noexcept
{
  is >> p.first >> p.second;
  return is;
}
template <typename T, typename U>
constexpr ostream &operator<<(ostream &os, pair<T, U> &p) noexcept
{
  os << p.first << " " << p.second;
  return os;
}
#pragma endregion

void solve()
{
  int n;
  cin >> n;
  int cnt = 0;
  rep(i, n)
  {
    int a;
    cin >> a;
    if (i % 2 == 0 and a % 2 == 1)
      cnt++;
  }
  cout << cnt << "\n";
}

int main()
{
  init_main();
  solve();
}

Measured memory_bytes: 3648
#include <stdio.h>

int main(){
	int a, b, ans;
	char op;
	while(1){
		scanf("%d %c %d", &a, &op, &b);
		if(op == '+'){
		    ans = a + b;
		}else if(op == '-'){
			ans = a - b;
		}else if(op == '*'){
			ans = a * b;
		}else if(op == '/'){
			ans = a / b;
		}else{
			break;
		}
    	printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long int
#define ii pair<int,int>
#define lli pair<ll,ll>
#define pii pair<int,int>
#include<limits>
#define deb(x) cout<<#x<<'='<<(x)<<endl
#define deb2(x,y) cout<<'['<<#x<<'='<<(x)<<','<<#y<<'='<<(y)<<']'<<endl
#define debarr(a,n) {cout<<#a<<'='; for(int i=0;i<n;i++) cout << a[i] << ' '; cout<<endl;}
#define debvec(v) {cout<<#v<<'=';for(auto itr=v.begin();itr!=v.end();itr++)cout<<*itr<<' ';cout<<endl;}
#define INF numeric_limits<int>::max()
#define NINF numeric_limits<int>::min()
#define endl "\n"
#define MP make_pair
#define SZ(x) ((int)(x).size())
#define MOD (pow(10,9)+7)
using namespace std;





int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr);
    cout.tie(nullptr);
    ll a,b;
    cin>>a>>b;
    ll sum=0;
    for(ll i=0;i<b;i++)
    {
        ll t;
        cin>>t;
        sum+=t;
    }
    if(sum>a) cout<<-1<<endl;
    else cout<<a-sum<<endl;


    return 0;
}

Measured memory_bytes: 3652
import sys
import math
from collections import deque
MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

x = I()

while True:
  for i in range(2, int(math.sqrt(x))+1):
    if x%i == 0:
      break
  else:
    print(x)
    exit()
  x += 1

Measured memory_bytes: 38896
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(input())
ans = 0

for i in range(n):
    if i < k:
        if t[i] == "r":
            ans += p
        elif t[i] == "s":
            ans += r
        else:
            ans += s
    else:
        if t[i] != t[i - k]:
            if t[i] == "r":
                ans += p
            elif t[i] == "s":
                ans += r
            else:
                ans += s
        else:
            t[i] = ""

print(ans)

Measured memory_bytes: 9852
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
int main() {
  long long N,D,A;
  cin >> N >> D >> A;
  vector<pair<long long,long long>> XH(N);
  long long i;
  for(i=0;i<N;i++) {
    cin >> XH[i].first >> XH[i].second;
    XH[i].second = (XH[i].second-1)/A+1;
  }
  sort(XH.begin(),XH.end());
  vector<pair<long long,long long>> R;
  long long ans = 0;
  long long dmg = 0;
  long long l1,r1,m;
  for(i=0;i<N;i++) {
    l1 = i;
    r1 = N;
    while(r1-l1>1) {
      m = (l1+r1)/2;
      if(XH[m].first-XH[i].first>2*D)r1 = m;
      else l1 = m;
    }
    ans += max(XH[i].second - dmg,(long long)0);
    if(R.size()?R[R.size()-1].first == l1:false)R[R.size()-1].second += max(XH[i].second-dmg,(long long)0);
    else R.insert(R.end(),pair<long long,long long>(l1,max(XH[i].second-dmg,(long long)0)));
    dmg = max(XH[i].second,dmg);
    if(R.size()?R[0].first==i:false) {
      dmg = max(dmg-R[0].second,(long long)0);
      R.erase(R.begin());
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 4216
#include<stdio.h>

int main(){
  int n,L;
  int i,min,sum=0;
  scanf("%d %d",&n,&L);
  for(i=1;i<=n;i++) sum += L+i-1;
  if(L < 0){
    if(n+L <= 0)
      printf("%d\n",sum-L-n+1);
    else
      printf("%d\n",sum);
  }else
    printf("%d\n",sum-L);
  return 0;
}

Measured memory_bytes: 128
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前
sort()
sorted(reverse=true)
配列の初期化
配列名=[a]*n+[b]*m
Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools
import fractions
import sys

n = stdin.readline().rstrip()
num = 0
for el in n:
    num += int(el)
if num % 9 == 0:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 78816
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        StringBuilder ans = new StringBuilder();
        for (int i = 0; i < S.length(); i++) {
            ans.append('x');
        }
        System.out.println(ans.toString());
    }
}



Measured memory_bytes: 23764
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


// CHECK THE LIMITS
typedef long long ll;

const int MOD = 1000000007;
const ll INFLL = 1e18;
const int INF = 1e9;
const int NMAX = 1000001;

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
} 

int main()
{
  
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    char c;
    cin >> c;
    cout << (char) (c+1);


    return 0;
}

Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
typedef pair<lint,lint> pl;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
ostream &operator<<(ostream &os, const pl &a) { os << "(" << a.fi << "," << a.se << ")"; return os; }
ostream &operator<<(ostream &os, const vector<pl> &a) {
	os<<"[";
	rep(i,a.size()){
		os<<a[i];
		if(i<a.size()-1) os<<",";
	}
	os<<"]";
	return os; 
}
#define D 10
vector<pl> dp[300100];
lint V[300100],W[300100];
int main()
{
	int n,bo=(1<<D)-1;cin>>n;
	rep(i,n){
		cin>>V[i]>>W[i];
	}
	dp[0].pb(mp(0,0));dp[0].pb(mp(W[0],V[0]));
	REP(i,1,min(n,bo)){
		vector<pl> v;
		int r=(i-1)/2;
		rep(j,dp[r].size()){
			v.pb(dp[r][j]);v.pb(mp(dp[r][j].fi+W[i],dp[r][j].se+V[i]));
		}
		sort(All(v));
		//cout<<i<<' '<<v<<endl;
		dp[i].pb(v[0]);
		lint ma=0;
		rep(j,v.size()-1){
			if(v[j+1].se>ma){
				dp[i].pb(v[j+1]);ma=v[j+1].se;
			}
		}
		rep(j,dp[i].size()-1){
			assert(dp[i][j].fi<=dp[i][j+1].fi && dp[i][j].se<=dp[i][j+1].se);
		}
		//cout<<i<<' '<<dp[i]<<endl;
	}
	//rep(i,n) cout<<i<<' '<<dp[i]<<endl;
	int q,a,b;cin>>q;
	rep(i,q){
		cin>>a>>b;a--;
		vector<pl> v;v.pb(mp(0,0));
		while(a>=bo){
			/*rep(j,dp[a].size()){
				v.pb(dp[a][j]);v.pb(mp(dp[a][j].fi+W[i],dp[a][j].se+V[i]));
			}*/
			int len=v.size();
			rep(j,len) v.pb(mp(v[j].fi+W[a],v[j].se+V[a]));
			a--;a/=2;
		}
		lint ret=0;
		rep(j,v.size()){
			lint w=b-v[j].fi;
			if(w<0LL) continue;
			int it=lower_bound(All(dp[a]),mp(w+1,-1LL))-dp[a].begin();it--;
			ret=max(ret,v[j].se+dp[a][it].se);
		}
		cout<<ret<<endl;
	}
}


Measured memory_bytes: 25456
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define int long long
#define mod 1000000007
signed main(){
    int n,q;
    cin>>n>>q;
    string s;
    cin>>s;
    int l[114514],r[114514];
    for(int i=0;i<q;i++){
        cin>>l[i]>>r[i];
    }
    bool c[114514]={};
    for(int i=0;i<s.size();i++){
        if(s[i]=='A'&&s[i+1]=='C'){
            c[i+1]=true;
        }
    }
    int a[114514]={};
    for(int i=1;i<s.size();i++){
        if(c[i]==true)a[i]=a[i-1]+1;
        else a[i]=a[i-1];
    }
    for(int i=0;i<q;i++){;
        cout<<a[r[i]-1]-a[l[i]-1]<<endl;
    }
    return 0;
}



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

int main() {
    string s;
    int flg,cnt1, cnt2, ans;

    cin >> s;

    cnt1 = 0;
    flg = 0;
    rep(i, s.size()) {
        if (flg != s[i]-'0')
            ++cnt1;
        if (++flg == 2)
            flg = 0;
    }
    cnt2 = 0;
    flg = 1;
    rep(i, s.size()) {
        if (flg != s[i]-'0')
            ++cnt2;
        if (++flg == 2)
            flg = 0;
    }
    ans = min(cnt1, cnt2);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3668
#define _CRT_SECURE_NO_WARNINGS
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <stack>
#include <array>
#include <fstream>

#define REP(i,n) for(int (i) = 0;(i) < (n) ; ++(i))
#define REPA(a,i,n) for(int (i) = (a) ; (i) < (n) ; ++(i))
#if defined(_MSC_VER)||__cplusplus > 199711L
#define AUTO(r,v) auto r = (v)
#else
#define AUTO(r,v) typeof(v) r = (v)
#endif
#define ALL(c) (c).begin() , (c).end()
#define EACH(it,c) for(AUTO(it,(c).begin());it != (c).end();++it)
#define LL long  
#define int LL
#define INF  99999999
#define DEV 1000000007
#define QUICK_CIN ios::sync_with_stdio(false); cin.tie(0);
using namespace std;



signed main()
{
	QUICK_CIN;
	//ifstream cin("debug.txt");
	//ofstream cout("result.txt");

	int W, Q;
	while (cin >> W){
		if (!W)
			break;
		bool canS[1100];
		int S[1100];
		int re[1100];
		fill(canS, canS + 1100, false);
		fill(S, S + 1100, -1);
		fill(re, re + 1100, -1);

		cin >> Q;
		REP(i, Q){
			char m;
			int id;
			int ww;

			cin >> m;
			if (m == 's'){
				cin >> id >> ww;
				int i = 0;
				for (; i < W; i++){
					if (!canS[i]){
						bool f = true;
						REP(j, ww){
							if (canS[i + j] || i + j > W - 1){
								f = false;
							}
						}
						if (f)
							break;
					}
				}


				if (i == W){
					cout << "impossible" << endl;
					continue;

				}
				cout << i << endl;
				REPA(i, q, i + ww){
					canS[q] = true;
				}
				re[id] = i;
				S[id] = ww;


			}
			if (m == 'w'){
				cin >> id;

				REPA(re[id], q, re[id] + S[id]){
					canS[q] = false;
				}
			}
		}
		cout << "END" << endl;
	}
	return 0;

}

Measured memory_bytes: 1204
n=int(input())
it=[]
for _ in range(n):
    it.append(list(map(int,input().split())))
it.sort()
ac=[i+[j] for j,i in enumerate(it[:])]
ac.sort(key=lambda x:x[1])
bc=[i+[j] for j,i in enumerate(it[:])]
bc.sort(key=lambda x:x[0],reverse=True)

maa=0
mi=bc[0][0]
ma=ac[0][1]
a=0
b=0
for i in range(n):
    if i==ac[0][2]:
        ma=ac[1][1]
        a=1
    if i==bc[0][2]:
        mi=bc[1][0]
        b=1
   # print(ma-mi+1)
    maa=max(max(ma-mi+1,0)+it[i][1]-it[i][0]+1,maa)
    if a:
        ma=ac[0][1]
        a=0
    if b:
        mi=bc[0][0]
        b=0

aa=[0]*n
bb=[0]*n
aa[0]=it[0][1]-it[0][0]+1
mi=it[0][0]
ma=it[0][1]
for i in range(1,n-1):
    mi=max(mi,it[i][0])
    ma=min(ma,it[i][1])
    so=ma-mi+1
    if so<0:
        so=0
    aa[i]=so

bb[-1]=it[-1][1]-it[-1][0]+1
mi=it[-1][0]
ma=it[-1][1]

for i in range(n-2,0,-1):
    mi=max(mi,it[i][0])
    ma=min(ma,it[i][1])
    so=ma-mi+1
    if so<0:
        so=0
    bb[i]=so
ma=aa[0]+bb[1]
for i in range(1,n-1):
    ma=max(ma,aa[i]+bb[i+1])
print(max(ma,maa))

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

struct drink{
    long long int A;
    int B;
};

int asc(const void *a, const void *b){
    struct drink *x = (struct drink *)a;
    struct drink *y = (struct drink *)b;

    if(x->A > y->A) 
        return 1;
    if(x->A < y->A)
        return -1;
    return 0;
}

int main(){
    int n, m, i;
    struct drink AB[100000];
    long long int ans = 0;

    scanf("%d %d", &n, &m);

    for(i=0; i<n; i++){
        scanf("%lld %d", &AB[i].A, &AB[i].B);
    }

    qsort(AB, n, sizeof(struct drink), asc);

    i=0;
    while(m > 0){
        if(m > AB[i].B){
            ans += (long long int)AB[i].B * (long long int)AB[i].A;
            m -= AB[i].B;
        }
        else{
            ans += (long long int)m * (long long int)AB[i].A;
            m -= AB[i].B;
        }

        i++;
    }

    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 3324
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define repone(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define Rep(j,n) for(int j=0;j<(int)(n);++j)
#define Repo(j,o,n) for(int j=o;j<(int)(n);++j)
#define Repone(j,n) for(int j=1;j<(int)(n);++j)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define int long long
#define pb(a) push_back(a)
#define eraser(v,i) (v).erase(v.begin()+(i))
#define pbpair(a,b) push_back(make_pair(a,b))
#define MOD 1000000007
#define INF 9223372036854775807
#define pairint pair<int,int>
signed main(){
  int x=0,y=0,z=0;
  string s;
  std::cin >> s;
  rep(i,s.size()){
    if(s[i]=='o')x++;
    else y++;
  }
  if(x>=8)std::cout << "YES" << '\n';
  else if(x+15-s.size()>=8)std::cout << "YES" << '\n';
  else std::cout << "NO" << '\n';

}


Measured memory_bytes: 256
#include <iostream>
#include<cstdio>
using namespace std;
int a,b;
bool check(int x,int y,int z)
{
    bool f1=((int)(z*0.08)==x);
    bool f2=((int)(z*0.1)==y);
    return f1&&f2;
}
int main()
{
    cin>>a>>b;
    int i;
    for(i=max(0,b*10-10);i<=b*10+10;i++)
    {
        if(check(a,b,i)) {printf("%d\n",i);break;}
    }
    if(i==b*10+11) printf("-1\n");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() int t;cin>>t;while(t--)
#define pb push_back
#define nl cout<<endl
#define MOD 1000000007
#define loop(i,start,end) for(int i=start;i<end;i++)
#define N 100001
#define all(v) v.begin(),v.end()
#define oa(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";nl
#define ov(a) for(int i=0;i<a.size();i++)cout<<a[i]<<" ";nl
#define vinn(n,v) int n;cin>>n;vector<int>v(n);loop(i,0,n)cin>>v[i];
#define vinm(n,m,v) int n,m;cin>>n>>m;vector<int>v(n);loop(i,0,n)cin>>v[i];
#define debug(x) cerr<<#x<<" : "<<x<<endl;
signed main() 
{
    fastio();

    int n;
    cin>>n;
    vector<int>v(n);
    loop(i,0,n)cin>>v[i];
    int ans = 1e10;
    for(int i = 1;i<=100;i++)
    {
        int tem = 0;
        for(int j = 0;j<n;j++)
            tem+=pow(i-v[j],2);
        ans =min(tem,ans);
    }
    cout<<ans<<endl;


    return 0;
}


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

namespace abc127_c
{
    class Program
    {
        static void Main(string[] args)
        {
            
            var NM = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
            var N = NM[0];
            var M = NM[1];
            int Lm = 0;
            int Rm = 0;

            for (int i = 0; i < M; i++)
            {
                var LR = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
                if (Lm < LR[0] - 1) Lm = LR[0] - 1;
                if (Rm < N - LR[1]) Rm = N - LR[1];
            }
            int r = N - (Lm + Rm);

            Console.WriteLine(r >= 0 ? r : 0);

        }
    }
}


Measured memory_bytes: 15408
def solve():
  ans = 0
  N, M = map(int, input().split())
  A,C = [0]*M,[0]*M
  for i in range(M):
    A[i],b = map(int, input().split())
    c = list(map(int, input().split()))
    for j in range(b):
      C[i] += 1<<(c[j]-1)
  dp = [float('inf')]*(1<<N)
  dp[0] = 0
  for i in range(1,(1<<N)+1):
    for key in range(M):
      if C[key] & i == 0:
        continue
      dp[i] = min(dp[i],dp[i&~C[key]]+A[key])
  ans = dp[-1]
  if ans==float('inf'):
    return -1
  return ans
print(solve())

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

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

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

const int kmax = 42;

ll bin[20][20];

int main()
{

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	//ifstream cin("input.txt");
	//ofstream cout("output.txt");

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll n;
	cin >> n;

	vector<int> ans;
	int s = 1;

	bin[0][0] = 1;
	for (int i = 1; i < 20; ++i) {
		bin[i][0] = 1;
		for (int j = 1; j < 20; ++j) {
			bin[i][j] = bin[i - 1][j] + bin[i - 1][j - 1];
		}
	}

	while (n) {
		int bestA = -1, bestB = -1;
		ll bestVal = -1;
		for (ll k = 1; k < kmax; ++k) {
			if ((1LL << (k - 1)) - 1 <= n) {
				bestA = k;
				bestVal = (1LL << (k - 1)) - 1;
			}
		}
		int bestC = -1, bestD = -1;
		for (ll a = 1; a < 20; ++a) {
			for (ll b = 1; b < 20; ++b) {
				for (ll c = 1; c < 20; ++c) {
					for (ll d = 1; d < 20; ++d) {
						ll curr = (1LL << ((a + c) - 1)) - 1;
						curr += (1LL << ((b + d) - 1)) - 1;
						bool ok = true;
						ll ans = curr;
						for (int i = 1; i <= min(a, c); ++i) {
							for (int j = 1; j <= min(b, d); ++j) {
								ll val = bin[a][i] * bin[b][j];
								if (ans + val > n) {
									ok = false;
									break;
								}
								val *= bin[c][i];
								if (ans + val > n) {
									ok = false;
									break;
								}
								val *= bin[d][j];
								if (ans + val > n) {
									ok = false;
									break;
								}
								ans += val;
							}
							if (!ok) {
								break;
							}
						}
						if (ok && ans <= n && ans > bestVal) {
							bestA = a, bestB = b, bestC = c, bestD = d;
							bestVal = ans;
						}
					}
				}
			}
		}
		//cout << bestVal << "\n";
		if (bestB != -1) {
			for (int i = 0; i < bestA; ++i) {
				ans.pb(s);
			}
			for (int i = 0; i < bestB; ++i) {
				ans.pb(s + 1);
			}
			for (int i = 0; i < bestC; ++i) {
				ans.pb(s);
			}
			for (int i = 0; i < bestD; ++i) {
				ans.pb(s + 1);
			}
			s += 2;
			n -= bestVal;
		} else {
			for (int i = 0; i < bestA; ++i) {
				ans.pb(s);
			}
			++s;
			n -= bestVal;
		}
	}

	assert(sz(ans) <= 200);

	cout << sz(ans) << "\n";
	for (int x : ans) {
		cout << x << " ";
	}
	cout << "\n";

}


Measured memory_bytes: 256
open Base
open Stdio

let () =
  let (x, y) = Caml.Scanf.scanf "%d %d" (fun x y -> x, y) in
  let ans = ref "No" in
  for i = 0 to x do
    let a = i in
    let b = x - i in
    if phys_equal (2 * a + 4 * b) y
    then ans := "Yes"
  done;
  print_endline !ans;


Measured memory_bytes: 5716
import java.util.Scanner;
import java.util.Arrays;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
            A[i] = sc.nextInt();
        }

        int q = sc.nextInt();
        int[] m = new int[q];
        for (int i = 0; i < q; i++) {
            m[i] = sc.nextInt();
        }

        int[] bit = new int[(int) Math.pow(2, n)];
        boolean judge = false;

        for (int i = 0; i < Math.pow(2, n); i++) {
            for (int j = 0; j < n; j++) {
                if ((1 & i >> j) == 1) {
                    bit[i] += A[j];
                }
            }
        }

        Arrays.sort(bit);

        for (int k = 0; k < q; k++) {
            for (int i = 0; i < Math.pow(2, n); i++) {
                if (bit[i] > m[k]) {
                    break;
                }
                if (bit[i] == m[k]) {
                    judge = true;
                }
            }
            if (judge == true) {
                System.out.println("yes");
            } else {
                System.out.println("no");
            }
            judge = false;
        }

        sc.close();
    }

}


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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	
	int n; cin >> n;
	int cnt = 0;
	for(int i = 2; i < 201; i++){
		for(int j = i + 1; j < 201; j++){
			for(int k = j + 1; k < 201; k++){
				if(i * j * k <= n && (i * j * k) % 2 == 1) cnt++;
			}
		}
	}
	for(int i = 2; i < 201; i++){
		for(int j = i + 1; j < 201; j++){
			if(i * j * j * j <= n && (i * j * j * j) % 2 == 1) cnt++;
		}
	}
	cout << cnt << endl;
	return 0;	
}





  

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;
vector<int> computeB(const vector<int> &A) {
  int n = A.size();
  vector<int> B(n, 0), C(n + 1, 0);
  for (int i = 0; i < n; i++) {
    int l = max(i - A[i], 0);
    int r = min(i + A[i], n - 1);
    C[l]++;
    C[r + 1]--;
  }
  int s = 0;
  for (int i = 0; i < n; i++) {
    s += C[i];
    B[i] = s;
  }
  return B;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<int> A(n);
  for (auto &x : A)
    cin >> x;
  vector<int> B = A;
  // if (*max_element(A.begin(), A.end()) != 0) {
  for (int i = 0; i < k; i++) {
    if (*min_element(B.begin(), B.end()) == n)
      break;
    B = computeB(B);
  }
  // }
  for (auto x : B)
    cout << x << " ";
  cout << "\n";
}

Measured memory_bytes: 6340
#include<iostream>
using namespace std;
int n,t[100005],x[100005],y[100005];
bool f;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>t[i]>>x[i]>>y[i];
	for(int i=1;i<=n;i++)
	{
		if(x[i]+y[i]>t[i])
		{
			cout<<"No";f=1;break;
		}
		else if((t[i]-x[i]-y[i])%2==1)
		{
		cout<<"No";f=1;break;
		}
	} 
	if(!f)cout<<"Yes";
} 

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = 1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";

void solve() {
    int n = 50;
    static long long a[100];
    long long k; cin >> k;
    long long l = k;
    while (l % n) l++;
    FOR(i, 0, n) a[i] = n - 1 + l / n;
    while (l > k) {
        pair<long long, int> best = mp(-LINF, -INF);
        FOR(i, 0, n) {
            chkmax(best, mp(a[i], i));
        }
        int ix = best.se;
        a[ix] -= n;
        FOR(i, 0, n) if (i != ix) {
            a[i]++;
        }
        l--;
    }
    cout << n << "\n";
    FOR(i, 0, n) cout << a[i] << " \n"[i == n - 1];
}

int main() {
    int JUDGE_ONLINE = 1;
    if (fopen("in.txt", "r")) {
        JUDGE_ONLINE = 0;
        assert(freopen("in.txt", "r", stdin));
        //assert(freopen("out.txt", "w", stdout));
    }
    else {
        ios_base::sync_with_stdio(0), cin.tie(0);
    }
    solve();
    if (!JUDGE_ONLINE) {
        //cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    }
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	N, X := ReadInt(), ReadInt()
	fmt.Println(F(N, X))
}

func F(i int, x int) int {
	if i == 0 {
		if x >= 1 {
			return 1
		}
		return 0
	}
	if x <= 1 {
		return 0
	}

	if 2 <= x && x <= 1+LL(i-1) {
		return F(i-1, x-1)
	} else {
		return PL(i-1) + 1 + F(i-1, x-2-LL(i-1))
	}
}

func LL(i int) int {
	if i == 0 {
		return 1
	}
	return 3 + 2*LL(i-1)
}

func PL(i int) int {
	if i == 0 {
		return 1
	}
	return 1 + 2*PL(i-1)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }
func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 1840
#include <bits/stdc++.h>
#define MAXN 100000
#define LOG 17

using namespace std;

int x[MAXN + 1];

int n, l;

int dp[MAXN + 1][LOG + 1];

inline void make_dp() {
    for(int i = 1; i < n; i++) {
        int rez = i;
        for(int pas = 1 << 16; pas; pas >>= 1)
            if(rez + pas <= n && x[rez + pas] - x[i] <= l)
              rez += pas;
        dp[i][0] = rez;
    }
    for(int lg = 1; (1 << lg) <= n; lg++)
        for(int i = 1; i <= n; i++)
           dp[i][lg] = dp[dp[i][lg - 1]][lg - 1];
}

int main() {
   // fstream cin("A.in");
   // ofstream cout("A.out");
    ios::sync_with_stdio(false);
    int i, q, a, b, pas;
    cin >> n;
    for(i = 1; i <= n; i++)
        cin >> x[i];
    cin >> l >> q;
    make_dp();
    while(q > 0) {
        q--;
        cin >> a >> b;
        if(a > b)
            std::swap(a, b);
        int ans = 0;
        if(a < b) {
            for(pas = 16; pas >= 0; pas--)
              if(dp[a][pas] > 0 && dp[a][pas] < b) {
                  a = dp[a][pas];
                  ans += (1 << pas);
              }
        }
        cout << ans + 1 << endl;
    }
   // cin.close();
   // cout.close();
    return 0;
}


Measured memory_bytes: 8320
package main
import "fmt"
var mod int64
func main() {
  var l,a,b,m int64
  fmt.Scan(&l,&a,&b,&m)
  mod = m
  t := int64(1)
  y := Identity(3)
  for d:=1;d<19;d++ {
    t *= 10
    inf,sup := t/10,t-1
    if inf > a+b*(l-1) { break }
    if sup < a { continue }
    s0 := (((inf-a)+(b-1))/b)*b+a
    if s0 > a+b*(l-1) { s0 = a+b*(l-1) }
    if inf <= a { s0 = a }
    sl := ((sup-a)/b)*b+a
    if sup >= a+b*(l-1) { sl = a+b*(l-1) }
    c := (sl-s0)/b+1
    z := NewMatrix(3)
    z[0].v[0] = t%mod
    z[1].v[0] = 1
    z[1].v[1] = 1
    z[2].v[1] = b%mod
    z[2].v[2] = 1
    y = y.MatMul(z.Pow(c))
  }
  x := Vector{[]int64{0,a%mod,1}}
  fmt.Println(x.DotProduct(y.ColVec(0)))
}
type Vector struct { v []int64 }
func(x Vector) DotProduct(y Vector) int64 {
  if len(x.v) != len(y.v) || len(x.v) == 0 { return 0 }
  d := (x.v[0]*y.v[0])%mod
  for i:=1;i<len(x.v);i++ { d = (d+(x.v[i]*y.v[i])%mod)%mod }
  return d
}
type Matrix []Vector
func NewMatrix(n int) Matrix {
  m := Matrix{}
  for i:=0;i<n;i++ { m = append(m,Vector{make([]int64,n)}) }
  return m
}
func Identity(n int) Matrix {
  e := NewMatrix(n)
  for i:=0;i<n;i++ { e[i].v[i] = 1 }
  return e
}
func(a Matrix) ColVec(j int) Vector {
  if len(a) == 0 || j >= len(a[0].v) { return Vector{nil} }
  v := make([]int64,len(a))
  for i:=0;i<len(a);i++ { v[i] = a[i].v[j] }
  return Vector{v}
}
func(a Matrix) Transpose() Matrix {
  if len(a) == 0 || len(a[0].v) == 0 { return Matrix{Vector{nil}} }
  m := Matrix{}
  for j:=0;j<len(a[0].v);j++ { m = append(m,a.ColVec(j)) }
  return m
}
func(a Matrix) VecMul(x Vector) Vector {
  if len(a) == 0 || len(a[0].v) != len(x.v) ||
  len(x.v) == 0 { return Vector{nil} }
  v := make([]int64,len(a))
  for i:=0;i<len(a);i++ { v[i] = a[i].DotProduct(x) }
  return Vector{v}
}
func(a Matrix) MatMul(b Matrix) Matrix {
  if len(a) == 0 || len(a[0].v) == 0 || len(b) == 0 || len(b[0].v) == 0 ||
  len(a[0].v) != len(b) { return Matrix{Vector{nil}} }
  m := Matrix{}
  for j:=0;j<len(b[0].v);j++ { m = append(m,a.VecMul(b.ColVec(j))) }
  return m.Transpose()
}
func(a Matrix) Pow(n int64) Matrix {
  if len(a) == 0 || len(a[0].v) == 0 ||
  len(a) != len(a[0].v) { return Matrix{Vector{nil}} }
  if n == 0 { return Identity(len(a)) }
  if n%2 == 0 { c := a.Pow(n/2);return c.MatMul(c) }
  return a.MatMul(a.Pow(n-1))
}

Measured memory_bytes: 1024