akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1e15;

int main() {
  ll n, a, b;
  cin >> n >> a >> b;
  vector<ll> x(n);
  REP(i, n) cin >> x[i];

  ll ans = 0;
  FOR(i, 1, n) { ans += min(a * (x[i] - x[i - 1]), b); }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
ll gcd(ll a, ll b) {return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}


int main()
{
  vector<char> cha(4) ;
  string s ;
  REP(i,4){
    cin >> cha.at(i) ;
  }
  sort(ALL(cha)) ;
  
  
  
  if(cha.at(0)=='1' && cha.at(1)=='4' && cha.at(2)=='7' && cha.at(3)=='9'){
    cout <<"YES"<<endl ;
  }
  else{
    cout <<"NO"<<endl ;
  }


  return 0 ;
}




Measured memory_bytes: 256
S=str(input())
def is_kaibun(kaibun):
    for i in range(len(kaibun)//2):
        if kaibun[i] != kaibun[-i-1]:
            return print('No')
    for j in range(len(kaibun)//4):
        if kaibun[j] != kaibun[-(j+len(kaibun)//2)-2]:
            return print('No')
        if kaibun[j+len(kaibun)//2+1] != kaibun[-(j+len(kaibun)//2)-2]:
            return print('No2')
    return print('Yes')

is_kaibun(S)

Measured memory_bytes: 3064
n, x = map(int,input().split())
children = list(map(int,input().split())) 
children.sort()
count=0
c = 0
if x < children[0]:
  print(0)
  exit()
for i in range(n):
  count += children[i]
  c += 1
  if count == x:
    print(c)
    exit()
  elif count > x:
    print(c-1)
    exit()

print(n-1)


Measured memory_bytes: 9116
// https://atcoder.jp/contests/dp/tasks/dp_b

#include <bits/stdc++.h>

using namespace std;

#define ll long long 
#define REP1(i,n) for(ll i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
static const int MAX = 1000010;
static const ll INFTY = 1e12;
static const ll NUMMAX = 1000000007;
static const ll MOD = 1000000007;
#define LOOP 10000000
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 入力
int H, W;
vector<string> field;
int result = 100;
int dfs_res = 0;

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

ll dp[101][100001];
 
int main() {
 
    int N;
    cin >> N >> W;
    //ll dp[N+1][1010];
    vector<ll> weight(N), value(N);

    REP(i, N+1)REP(j, 100001) dp[i][j] = INFTY;

    REP(i, N){
        cin >> weight[i] >> value[i];
    }

    dp[0][0] = 0;
    REP(i, N){
        REP(j, 100001){
            chmin(dp[i+1][j], dp[i][j]);
            if(value[i] <= j) chmin(dp[i+1][j], dp[i][j- value[i]] + weight[i]);
        }
    }

    //REP(i, N+1){
    //    REP(j, 100){
    //        cout << dp[i][j] << " ";
    //    } cout << endl;
    //}
    ll ans = 0;
    REP(i, 100001){
        if(dp[N][i] <= W){
            ans = i;
        } 
    }
    cout << ans << endl;




 
    return 0;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/




Measured memory_bytes: 79104
N = int(input())
xyss = [[] for _ in range(N)]
for i in range(N):
    A = int(input())
    for _ in range(A):
        x, y = map(int, input().split())
        xyss[i].append((x-1, y))

ans = 0
for ptn in range(1<<N):
    conflict = False
    for i in range(N):
        if (ptn>>i) & 1:
            for x, y in xyss[i]:
                if (ptn>>x) & 1 != y:
                    conflict = True
                    break
        if conflict:
            break
    else:
        num1 = bin(ptn).count('1')
        if num1 > ans:
            ans = num1

print(ans)


Measured memory_bytes: 9216
local read = setmetatable({}, {__index = function(t, k) local a = {} for i=1,#k do table.insert(a, '*'..string.sub(k, i, i)) end local r = io.read local u = table.unpack or unpack return function() return r(u(a)) end end})
read.N = function(N) local t={} for i=1,N do t[i]=read.n() end return t end
string.totable = function(s) local t={} local u=string.sub for i=1,#s do t[i] = u(s, i, i) end return t end
string.split = function(s) local t={} for w in string.gmatch(s, "[^%s]+") do table.insert(t, w) end return (table.unpack or unpack)(t) end
local function array(dimension, default_val) assert(type(default_val) ~= 'table') local n=dimension local m={}if default_val~=nil then m[1]={__index=function()return default_val end}end for i=2,n do m[i]={__index=function(p, k)local c=setmetatable({},m[i-1])rawset(p,k,c)return c end}end return setmetatable({},m[n])end
----
local N = read.n()
local A = read.N(N)
local p = 1
local ov = false
for i=1,N do
    if A[i] == 0 then
        print(0)
        return
    end
    local np = p * A[i]
    if math.log(p, 10) + math.log(A[i], 10) > 18 then
        ov = true
    end
    if np > 10^18 then
        ov = true
    end
    p = np
end
if ov then
    print(-1)
else
    print(p)
end

Measured memory_bytes: 12704
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define int long long

bool same(int n) {
	string a = to_string(n);
	for(int i = 1; i < a.length(); ++i) {
		if (a[i] == a[i-1]) continue;
		else return false;
	}
	return true;
}

int32_t main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int m; cin >> m;
	if (same(m)) {
		cout << m;
		return 0;
	}
	else {
		++m;
		while(!same(m)) {
			++m;
		}
	}
	cout << m;
}

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

int S[500];
int top;

int **mat;
int n;
int tm=0;
int *disc, *fin;

void adjmatrix();
void push(int);
int pop();
void dsearch();

int main(){
  int i,j;

  adjmatrix();

  disc = (int *)malloc(n * sizeof(int));
  fin = (int *)malloc(n * sizeof(int));

  for(i=0; i<n; i++){
    disc[i] = 0;
    fin[i] = 0;
  }
  
  push(1);
  tm++;
  disc[0] = tm;


  while(tm != n*2){
    for(i=0; i<n; i++){
      if(disc[i]==0){
	push(i+1);
	tm++;
	disc[i] = tm;
	dsearch();
      }
    }
  }
  
  for(i=0; i<n; i++)
    printf("%d %d %d\n",i+1 ,disc[i] ,fin[i]);

  for(i=0; i<n; i++)
    free(mat[i]);
  free(mat);
  
  return 0;
}

void adjmatrix(){
  int u, k;
  int *v;
  int i, j;

  scanf("%d",&n);

  mat = (int **)malloc(n * sizeof(int *));
   
  for(i=0; i<n; i++){
    mat[i] = (int *)malloc(n * sizeof(int));
    for(j=0; j<n; j++)
      mat[i][j] = 0;
  }

  for(i=0; i<n; i++){
    scanf("%d%d",&u ,&k);

    v = (int *)malloc(k * sizeof(int));

    for(j=0; j<k; j++){
      scanf("%d",&v[j]);
      mat[u-1][v[j]-1] = 1;
    }

    free(v);
  }
}

void push(int x){
  S[++top] = x;
}

int pop(){
  return S[top--];
}

void dsearch(){
  int j;
  
  while(top!=0){
    for(j=0; j<n; j++){
      if(mat[S[top]-1][j]==1 && disc[j]==0){
	tm++;
	disc[j] = tm;
	push(j+1);
	break;
      }
    }

    if(j == n){
      tm++;
      fin[S[top]-1] = tm;
      pop();
    }
  }
}



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

int a, b, c, d;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> a >> b >> c >> d;
    if ((a + d - 1) / d < (c + b - 1) / b)
        cout << "No\n";
    else cout << "Yes\n";
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
 
#define ll          long long
#define ld          long double
#define pb          push_back
#define pii         pair<int,int> 
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F         first
#define S           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define mem(x)      memset(x,0,sizeof(x));
#define what_is(x)  cerr << #x << " is " << x << endl;
#define rep(i,a,b)  for(int i=a;i<b;i++)
 
using namespace std;
 
void solve(){
    
    int n,k;
    cin>>n>>k;

    int a[n];

    bool dp[k+1];
    mem(dp);

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

    }
    dp[0]=0;
    for(int i=1;i<=k;i++){
        for(int j=0;j<n;j++){
            if(i-a[j]>=0){
                dp[i]|=!(dp[i-a[j]]);
            }
        }
    }

    if(dp[k]){
        cout<<"First";
    }
    else{
        cout<<"Second";
    }

}
 
 
 
int main(){
    
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
   
 
    int t=1,i=1;
   // cin>>t;
    
 
    while(t--){
       // cout<<"Case #"<<i++<<": ";
        solve();
    
    }
 
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
//#define DEBUG
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
constexpr ll MOD = 1e9 + 7;
constexpr int mxH = 1e5;
constexpr int mxW = 1e5;
constexpr int mxCh = mxH + mxW;
int h, w, a ,b;

ll inverse_mod[mxCh + 1];

int first_half, second_half;
ll first_choices[mxW];
ll second_choices[mxW];

template <class T>
void print_vect(std::vector<T> v){
    for(int i = 0 ; i < v .size(); i++) cout << v[i] << " ";
    cout << endl;
}
ll pow_mod(ll a , ll p, ll MOD){
    if( p < 2){
        ll ans = 1;
        while(p--){
            ans =  (ans * a) % MOD;
        }
        return ans;
    }else{
        if( p % 2){
            ll ans = pow_mod(a, p / 2, MOD);
            ans = (ans * ans) % MOD;
            ans = (a * ans) % MOD;
            return ans;
        }else{
            ll ans = pow_mod(a , p /2, MOD);
            ans = (ans * ans) % MOD;
            return ans;
        }
    }
}
void calculate_inverse_mod(){
    for(int i = 1 ; i < mxCh  + 1; i++){
        ll ans = pow_mod(i, MOD - 2, MOD);
        inverse_mod[i] = ans;
    }
}

void calculate_first_choices(){
    ll current_choices = 1;
    first_choices[0] = 1;
    for(int i = 1; i < w; i++){
        current_choices = current_choices * ( first_half + i); 
        if ( current_choices >= MOD){
            current_choices = current_choices % MOD;
        }
        current_choices = current_choices * inverse_mod[i];
        if ( current_choices >= MOD){
            current_choices = current_choices % MOD;
        }
        first_choices[i] = current_choices;
    }
}

void calculate_second_choices(){
    ll current_choices = 1;
    second_choices[0] = 1;
    for(int i = 1 ; i < w ; i++){
        current_choices = current_choices * ( second_half + i); 
        if( current_choices >= MOD){
            current_choices = current_choices % MOD;
        }
        current_choices = current_choices * inverse_mod[i];
        if ( current_choices >= MOD){
            current_choices = current_choices % MOD;
        }
        second_choices[i] = current_choices;
    }
}

void solve(){
    cin >> h >> w >> a >> b;
    first_half = h - 1 - a;
    second_half = a - 1; 
    calculate_inverse_mod();
    calculate_first_choices();
    calculate_second_choices();
    ll ans = 0;
    for( int i = b ; i < w ; i++){
        ans = ans + first_choices[i] * second_choices[w - 1 - i ];
        if( ans >= MOD){
            ans = ans % MOD;
        }
    }
    cout << ans << endl;
}

int main()
{
    //making data IO Fast
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    /****************************/

    #ifdef DEBUG
    int TEST_CASES = 2;
    while(TEST_CASES--){
    #endif // DEBBUG

    solve();

    #ifdef DEBUG
    }
    #endif // DEBUG
    
    return 0;
}



Measured memory_bytes: 6768
#include<bits/stdc++.h>
 
using namespace std;
using ll = long long;


int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
    int n, z, w;
    cin >> n >> z >> w;
    vector<int> a(n + 1);
    for (int i = 0; i < n; ++i) cin >> a[i];
    if (n == 1) {
        cout << abs(a[n - 1] - w) << '\n';
        return 0;
    }
    cout << max(abs(a[n - 1] - w), abs(a[n - 1] - a[n - 2]));
}
















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

int main() {
    int N; cin >> N;
    int cnt = 0;
    for (int i = 1; i <= N; i++) {
        int d = log10(i);
        if (d % 2 == 0) cnt ++;
    }
    cout << cnt << endl;
}


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

int main() {
	ios_base::sync_with_stdio( false );

	int N;
	cin >> N;

	vector<int> a( N );
	for( auto& v: a ) { cin >> v; }

	sort( a.begin(), a.end() );

	int result = 0;
	for( int i = 0; i < N-1; ++i ) {
		result += a[i+1] - a[i];
	}

	cout << result << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------

void _main() {
	int A,B,C;
	cin >> A >> B >> C;

	// B > A*C なら C
	// B < A*C なら　(B < A なら0) (B>AならB/A)
	cout << ( (B > A * C) ? C : ( (B < A) ? 0 : (B / A) )) << endl;
}

Measured memory_bytes: 256
import copy
n = int(input())
X = 0
Y = 0
T = 0
ans = 'Yes'
for i in range(n):
    t, x, y = map(int, input().split())

    res = t - (T + abs(x -X) + abs(y - Y))
    if res >= 0 and res % 2 == 0:
        ans = 'Yes'
    else:
        ans = 'No'
        break
    X = copy.copy(x)
    Y = copy.copy(y)
    T = copy.copy(t)
print(ans)

Measured memory_bytes: 3444
"use strict";

function Main(input) {
    input = input.split("\n");

    input[0] = input[0].split(" ");
    const n = parseInt(input[0][0], 10);
    const m = parseInt(input[0][1], 10);
    const c = parseInt(input[0][2], 10);
    const b = input[1].split(" ");

    let answer = 0;
    for (let i = 0; i < n; i++) {
        let code = input[2 + i].split(" ");
        let codeScore = c;

        for (let j = 0; j < m; j++) {
            codeScore += parseInt(b[j], 10) * parseInt(code[j], 10)
        }

        if (codeScore > 0) {
            answer++;
        }
    }

    console.log(answer);
}

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


Measured memory_bytes: 7372
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=m-1; i>=n; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2)%MOD;
  return x%MOD*POW(x,n-1)%MOD;
}

ll POW2(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW2(x*x,n/2);
  return x*POW2(x,n-1);
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll KAI2(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI2(m-1);
}

ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll COM2(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI2(m)/KAI2(n)/KAI2(m-n);
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  ll n,q,x;
  vector<ll>b;
  vector<ll>c;
  b.reserve(200);
  c.reserve(200);
  cin >> n;
  q=n;
  rep(i,n){
    cin >> x;
    b.push_back(x);
  }
  while(n>0){
    per(i,n){
      if(b[i]==i+1){
        c.push_back(b[i]);
        b.erase(b.begin()+i);
        n--;
        goto A;
      }
    }
    printf("-1");
    return 0;
    A:;
  }
  per(i,q)cout << c[i] <<endl;
}

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

#define int long long
#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cps CLOCKS_PER_SEC
#define mod (ll)2
#define f first
#define s second
#define debug1(x) cerr<<x<<"\n"
#define debug2(x,y) cerr<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cerr<<x<<" "<<y<<" "<<z<<"\n"
#define nl cerr<<"\n";
#define pq priority_queue
#define inf 9999999999999999
#define test cerr<<"abcd\n";
#define pi pair<int,int>
#define pii pair<int,pi>
#define pb push_back
#define mxn 100005
#define mxnn 2000005
int arr[105][2];
int dp[105][mxn];
int32_t main(){
sp;
int n,w;
cin >>n >>w;
for(int i = 1;i<=n;i++) cin >>arr[i][0]>>arr[i][1];
for(int i = 0;i<105;i++) for(int j = 0;j<mxn;j++) dp[i][j] = -inf;
for(int i = 0;i<=n;i++) dp[i][0] = 0;
for(int i = 1;i<=n;i++){
    for(int j = 1;j<=w;j++){
        if(arr[i][0]<=j)
        dp[i][j] = max(dp[i-1][j],dp[i-1][j-arr[i][0]]+arr[i][1]);
        else dp[i][j] = dp[i-1][j];
    }
}
int ans = 0;
for(int i = 0;i<=w;i++) ans = max(ans,dp[n][i]);
cout<<ans;
return 0;
}


Measured memory_bytes: 82304
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
   int a, b;
   char op;
   cin >> a >> op >> b;
   if (op == '+') cout << a + b;
   else cout << a - b;	
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}


Measured memory_bytes: 256
//Bismillahir Rahmanir Rahim
#include <bits/stdc++.h>
#define ll long long int
#define li long int
#define ld long double
using namespace std;
const ll mod = 1e9 + 7;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

    double a, b, c;
    cin >> a >> b >> c;
    cout << (int) ceil(a/b) * (int)c;
}


Measured memory_bytes: 3724
ip = lambda : map(int, input().split())
# ##############
# N,K = ip()
S = input()
for i in range(1,1+len(S)):
    if (i%2==1 and S[i-1]=='L') or (i%2==0 and S[i-1]=='R'):
        print('No')
        exit()
print('Yes')


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);

signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);

    LL K,N; cin >> K >> N;
    LL tmax = -LINF;
    VL A(N);
    REP(i,N) cin >> A[i];
    REP(i,N){
        LL tmp;
        if(i != N-1) tmp = abs(A[i]-A[(i+1)%N]);
        else  tmp = abs(K+A[0]-A[i]);
        //dump(tmp)
        chmax(tmax,tmp);
    }
    cout << K - tmax << endl;


}


Measured memory_bytes: 1792
// Shuffle and Swap
// * frank_c1
// * 2017 / 12 / 27

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

LL pow_mod(LL b, LL p, LL k) {
	LL ret = 1;
	for (; p; p >>= 1) {
		if (p & 1) ret = ret * b % k;
		b = b * b % k;
	} return ret;
}

const int maxn = 10005;
const int mo = 998244353;
char a[maxn], b[maxn];
LL fac[maxn], ivf[maxn];
LL f[2][maxn];

inline LL C(int n, int m) {
	return fac[n] * ivf[m] % mo * ivf[n - m] % mo;
}

int main() {
	scanf("%s%s", a + 1, b + 1);
	int n = strlen(a + 1), p = 0, q = 0; 
	for (int i = 1; i <= n; ++i) {
		p += (a[i] == '1' && a[i] == b[i]); q += (a[i] != b[i]);
	} q >>= 1;
	fac[0] = ivf[0] = 1;
	for (int i = 1; i <= n; ++i) fac[i] = fac[i - 1] * i % mo;
	ivf[n] = pow_mod(fac[n], mo - 2, mo);
	for (int i = n - 1; i >= 1; --i) ivf[i] = ivf[i + 1] * (i + 1) % mo;
	int now = 0, lst = 0; LL ret = 0;
	for (int i = 0; i <= p; ++i) {
		now = lst ^ 1;
		for (int j = 0; j <= q; ++j) {
			if (!i && !j) f[now][j] = 1;
			else f[now][j] = 0;
			if (i) f[now][j] += f[lst][j] * i * j;
			if (j) f[now][j] += f[now][j - 1] * j * j;
			f[now][j] %= mo;
		}
		(ret += f[now][q] * C(p, i) % mo * C(p + q, i + q) % mo * fac[p - i] % mo * fac[p - i]) %= mo;
		lst = now;
	}
	return printf("%lld\n", ret), 0;
}

Measured memory_bytes: 512
n = int(input())
S = list(map(int, input().split(' ')))
S.sort()
q = int(input())
T = list(map(int, input().split(' ')))
T.sort()

count = 0
for t in T:
    min_idx = 0
    max_idx = len(S) - 1
    while min_idx <= max_idx:
        mid_idx = (min_idx+max_idx) // 2
        if t < S[mid_idx]:
            max_idx = mid_idx - 1
        elif t > S[mid_idx]:
            min_idx = mid_idx + 1
        else:
            count += 1
            break
print(count)


Measured memory_bytes: 16704
/**
 *    author:  RM07
 *    created: July 05, 2020 6:08 PM
 *    motto: Knowledge is Power, Strive for Excellence
**/
#include<bits/stdc++.h>
using namespace std;
#define int long long 
signed main(){
    int n;
    cin >> n;
    int *arr = new int[n];
    for(int i=0;i<n;i++){
        cin >> arr[i];
    }
    sort(arr,arr + n, greater<int>());
    int *newArr = new int[n];
    newArr[0] = arr[0];
    int cnt = 1;
    int mainIndex = 0;
    int sideIndex = 1;
    while(cnt < n-1){
        newArr[++mainIndex] = arr[sideIndex];
        newArr[++mainIndex] = arr[sideIndex];
        cnt += 2;
        sideIndex++;
    }
    // for(int i=0;i<n-1;i++){
    //     cout << newArr[i] << endl;
    // }
    int sum = 0;
    for(int i=0;i<n-1;i++){
        sum += newArr[i];
    }
    cout << sum << endl;
}

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

typedef long long ll;

int main()
{
    int N;
    cin >> N;
    vector<ll> H;
    ll prev;
    ll now;
    cin >> prev;
    ll ans = 0;
    ll tmp = 0;
    for (int i = 1; i < N; ++i)
    {
        cin >> now;
        if (prev >= now)
        {
            ++tmp;
            ans = max(ans, tmp);
        }
        else
        {
            tmp = 0;
        }

        prev = now;
    }
    cout << ans << endl;
}

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

using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define rf(i,a,b) for(ll i=a; i>=b; i--)
#define pb push_back
#define mp make_pair
#define show(a) for(auto el:a)cout<<el<<" "
#define ff first
#define ss second
#define pairv vector<pair<ll,ll>>
#define vec vector <ll> 
#define all(a) a.begin(),a.end()
#define fam(v,i) for(auto i=v.begin();i!=v.end();i++)
#define fai(v,i) for(auto i : v)
#define mo 1000000007
#define nn cout<<"\n";
ll pow1(ll n,ll p)
{
if(p==0) return 1;
ll x=pow1(n, p/2);
x=(x*x)%mo;
if(p%2==0)
return x;
else
return (x*n)%mo;
}
bool sortbysec(const pair<ll,ll> &a, 
const pair<ll,ll> &b) 
{ 
return (a.second < b.second); 
} 
bool compare(const pair<ll, ll>&p1, const pair<ll,ll>&p2)
{
if(p1.ff < p2.ff) return true;
if(p1.ff == p2.ff) return p1.ff < p2.ss;
return false;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll x;
    cin>>x;
    if(x==0)
    cout<<1;
    else
    cout<<0;
     return 0;
}


Measured memory_bytes: 3648
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
using namespace std;

struct record{
	int num;
	double time;
};

bool operator<(const record& a, const record& b){
	return a.time < b.time;
}

int main(void){
	vector<record> rec1;
	vector<record> rec2;
	vector<record> rec3;
	vector<record> allrec;
	int i;
	record allbuf;
	
	for(i = 0; i < 8; i++){
		record buf;
		cin >>buf.num >>buf.time;
		rec1.push_back(buf);
	}
	sort(rec1.begin(), rec1.end());
	
	for(i = 0; i < 8; i++){
		record buf;
		cin >>buf.num >>buf.time;
		rec2.push_back(buf);
	}
	sort(rec2.begin(), rec2.end());
	
	for(i = 0; i < 8; i++){
		record buf;
		cin >>buf.num >>buf.time;
		rec3.push_back(buf);
	}
	sort(rec3.begin(), rec3.end());
	
	printf("%d %.2f\n", rec1[0].num, rec1[0].time);
	printf("%d %.2f\n", rec1[1].num, rec1[1].time);
	printf("%d %.2f\n", rec2[0].num, rec2[0].time);
	printf("%d %.2f\n", rec2[1].num, rec2[1].time);
	printf("%d %.2f\n", rec3[0].num, rec3[0].time);
	printf("%d %.2f\n", rec3[1].num, rec3[1].time);
	
	for(i = 2; i < 8; i++){
		allbuf = rec1[i];
		allrec.push_back(allbuf);
	}
	for(i = 2; i < 8; i++){
		allbuf = rec2[i];
		allrec.push_back(allbuf);
	}
	for(i = 2; i < 8; i++){
		allbuf = rec3[i];
		allrec.push_back(allbuf);
	}
	sort(allrec.begin(), allrec.end());
	
	printf("%d %.2f\n", allrec[0].num, allrec[0].time);
	printf("%d %.2f\n", allrec[1].num, allrec[1].time);
	
	return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> d(n);
  
  long long sum = 0;
  
  for(int i = 0; i < n; i++){
    cin >> d.at(i);
  }
  
  for(int i = 0; i < n; i++){
    for(int j = i+1; j < n; j++){
      sum += d.at(i)*d.at(j);
    }
  }
  
  cout << sum << endl;
  
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n;i>0;i--)
#define rep1(i,s,n) for(int i=s;i<n;i++)
#define max0(a,b,c) max(max(a,b),c)
#define min0(a,b,c) min(min(a,b),c) 
using namespace std;
typedef long long lint;
typedef long long ll;
typedef long double ldouble;
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<pair<int,int>> pvec;
typedef vector<pair<ll,ll>> plvec;

int main(){
    int n,m,count=0,k=0;
    ll ans=0;
    cin>>n>>m;
    lvec a(n);
    vec index(m);
    rep(i,n) cin>>a[i];
    plvec p(m);
    sort(a.begin(),a.end());
    rep(i,m){
        int b;
        ll c;
        cin>>b>>c;
        p[i]=make_pair(c,b);//pairの一番目はC(変更する先),二番目はB(変更できる個数)
    }
    sort(p.begin(),p.end());
    reverse(p.begin(),p.end());
    rep(i,m){
        index[i]=lower_bound(a.begin(),a.end(),p[i].first)-a.begin();
        if(p[i].first<=a[n-1]) index[i]--;
    }
    if(index[k]<=p[k].second-1){
        ans=p[k].first*(index[k]+1);
        count+=index[k]+1;
    }else{
        ans=p[k].first*(p[k].second);
        count+=p[k].second;
    }
    k++;
    while(k<m){
        if(count+p[k].second<=index[k]+1){
            ans+=p[k].second*p[k].first;
            count+=p[k].second;
            if(count>n){
                ans-=(count-n)*p[k].first;
                break;
            }
        }else if(index[k]+1>=count){
            ans+=(index[k]+1-count)*p[k].first;
            count+=index[k]+1-count;
            if(count>n){
                ans-=(count-n)*p[k].first;
                break;
            }
        }
        k++;
    }
    if(count<n){
        for(int i=count;i<n;i++) ans+=a[i];
    }
    cout<<ans;
}

Measured memory_bytes: 2944
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
#include<map>
#include<set>
using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size(), a = 0, b = 0;
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) {
            a += s[i] - '0';
            b += '1' - s[i];
        }
        else {
            a += '1' - s[i];
            b += s[i] - '0';
        }
    }
    cout << min(a, b) << endl;
}



Measured memory_bytes: 512
#!ruby -pal
i=j=0
t,a,b=$F
$_=""
(e=a[i])==b[j]?($_+=e;i+=1;j+=1):(c,k,q=e<?)?[a,i,0]:[b,j];d=0;begin e=c[k];d+=e<?)?1:e<?,?-1:0;t>?i&&$_+=e;k+=1;end while d>0;q ?(i=k):j=k)while a[i]

Measured memory_bytes: 6112
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

vector<ll> lay;
vector<ll> p;
ll n, k;

//level n ,layer x

ll fun(ll n, ll x)
{
	if (x == 0)
		return 0;
	if (n == 0)
		return 1;
	if (x <= lay[n - 1] + 1)
		return fun(n - 1, x - 1);
	if (x <= lay[n])
		return p[n - 1] + 1 + fun(n - 1, x - 1 - (lay[n - 1] + 1));
	return p[n];
}

int main()
{
	cin >> n >> k;
	lay.push_back(1),p.push_back(1);
	for (int i = 1; i <= n; i++)
	{
		ll l = lay[i - 1] * 2 + 3;
		ll pp = p[i - 1] * 2 + 1;
		lay.push_back(l);
		p.push_back(pp);
	}
	cout << fun(n, k) << endl;
}


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

using namespace std;

vector<long long int> num;

int main() {
    long long int N, K;
    cin >> N >> K;
    
    num.assign(100001, 0);
    
    long long int a, b;
    for(int i=0; i<N; i++) {
        cin >> a >> b;
        
        num[a] += b;
    }
    
    for(int i=0; i<100001; i++) {
        num[i+1] += num[i];
    }
    
    vector<long long int>::iterator iterator_lower;
    long long int index_lower;
    iterator_lower = lower_bound(num.begin(), num.end(), K);
    index_lower=distance(num.begin(), iterator_lower);
    cout << index_lower << endl;

    return 0;
    
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cstdlib>
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
using ll = long long;
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (b + c > a)cout << b + c - a << endl;
	else cout << 0 << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
	public static void main(String[] args){
		int ans = 0;
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] as = new int[n];
		int[] pm = new int[n];
		int plus = 0;
		int minus = 0;
		int min = 10001;
		int min_where = -1;
		int pmzero = 0;
		
		for(int i=0; i<n; i++){
			as[i] = sc.nextInt();
			if(as[i] >= 0){
				pm[i] = 1;
				plus++;
				ans += as[i];
				if(as[i] < min){
					min = as[i];
					min_where = i;
				}
			}else{
				pm[i] = -1;
				minus++;
				ans -= as[i];
				if(-as[i] < min){
					min = -as[i];
					min_where = i;
				}
			}
		}
		
		if(plus == 0 || minus == 0){
			ans -= 2 * min;
			if(plus == 0){
				plus++;
				minus--;
				pmzero = 1;
			}else{
				plus--;
				minus++;
				pmzero = -1;
			}
		}
		
		System.out.println(ans);
		
		int[] plus_nums = new int[plus];
		int[] minus_nums = new int[minus];
		int p = 0;
		int m = 0;
		
		for(int i=0; i<n; i++){
			if(i != min_where){
				if(as[i] >= 0){
					plus_nums[p] = as[i];
					p++;
				}else{
					minus_nums[m] = as[i];
					m++;
				}
			}
			if(pmzero != 0){
				if(pmzero == 1){
					plus_nums[0] = as[min_where];
				}else{
					minus_nums[0] = as[min_where];
				}
			}
			else{
				if(as[min_where] >= 0){
					plus_nums[plus - 1] = as[min_where];
				}else{
					minus_nums[minus - 1] = as[min_where];
				}
			}
		}
		
		int x,y;
		int p_where = 0;
		int m_where = 0;
		int len = minus;
		
		if(plus > minus + 1){
			int gap = plus - minus - 1;
			y = minus_nums[0];
			for(int i=0; i<gap; i++){
				System.out.print(y);
				System.out.print(" ");
				System.out.println(plus_nums[i]);
				y -= plus_nums[i];
			}
			minus_nums[0] = y;
			p_where = gap;
			m_where = 0;
			len = minus;
		}
		if(plus < minus + 1){
			int gap = minus - plus + 1;
			x = plus_nums[0];
			for(int i=0; i<gap; i++){
				System.out.print(x);
				System.out.print(" ");
				System.out.println(minus_nums[i]);
				x -= minus_nums[i];
			}
			plus_nums[0] = x;
			p_where = 0;
			m_where = gap;
			len = plus - 1;
		}
		
		for(int i=0; i<len; i++){
			System.out.print(minus_nums[m_where + i]);
			System.out.print(" ");
			System.out.println(plus_nums[p_where + i + 1]);
			System.out.print(plus_nums[p_where]);
			System.out.print(" ");
			System.out.println(minus_nums[m_where + i] - plus_nums[p_where + i + 1]);
			plus_nums[p_where] -= (minus_nums[m_where + i] - plus_nums[p_where + i + 1]);
		}
		
	}
}


Measured memory_bytes: 88532
#include "bits/stdc++.h"
#include "math.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) for(ll i=(a);i>=(b);--i)
#define SIZE(a) int((a).size())
#define out(a) cout<<(a)<<endl;
const int INF=INT_MAX;
const int MAX = 510000;
const ll MOD = 10000;
ll fac[MAX], finv[MAX], inv[MAX];


int main (){
  ll n,m,q;cin>>n>>m>>q;
  vvll a(509,vll(509,0));
  rep(i,0,m){
    ll l,r;cin>>l>>r;
    a[l][r]++;
  }
  rep(i,1,n+1){
    rep(j,1,n+1){
      a[i][j]+=a[i][j-1];
    }
  }
  rep(i,1,n+1){
    rep(j,1,n+1){
      a[i][j]+=a[i-1][j];
    }
  }
  rep(i,0,q){
    ll p,q;cin>>p>>q;
    cout<<a[q][q]+a[p-1][p-1]-a[p-1][q]-a[q][p-1]<<endl;
  }
  
}

Measured memory_bytes: 2944
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <vector>
#include <stack>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
#include <bitset>

using namespace std;


//+, *?????????????????????????????°?????????
//cur::suf //ope::+ or * //com::number of comma //v::array
int rec(int cur, int ope, int com, vector<pair<char,int> > &v)
{//ex //cur::1  //ope::+ //com::0

  vector<int> nums;
  
  for (int i = cur+1; i < v.size(); i++) {
    pair<char,int> p = v[i];
    //ope?????¢??£????????°?????????ope
    if (p.second == com+1) {
      //num
      if (p.first > 47) {
	int tmp = p.first - 48;
	nums.push_back(tmp);
      }
      //ope
      else if (p.first == 42 || p.first == 43) {
	int tmp = rec(i,p.first,p.second,v);
	nums.push_back(tmp);
      }
    }
    else if (p.second <= com)
      break;
  }

  //+
  if (ope == 43) {
    int sum = 0;
    for (int i = 0; i < nums.size(); i++) {
      sum += nums[i];
    }
    return sum;
  }
  //*
  else if (ope == 42) {
    int sum = nums[0];
    for (int i = 1; i < nums.size(); i++) {
      sum *= nums[i];
    }
    return sum;
  }
  else {
    pair<char,int>p = v[cur];
    return p.first-48;
  }
}


int main(void)
{
  while (true) {

    //+ 43  //* 42
    //. 46  //0 48 

    int n;
    cin >> n;

    if (n == 0) break;
    
    vector<pair<char,int> > v;
    for (int i = 0; i < n;i++) {
      string str;
      cin >> str;
      int com = 0;
      for (int j = 0; j < str.size(); j++) {
	int c = str[j];
	if (c == 46)
	  com++;
	else {
	  pair<char,int> p = make_pair(c,com);
	  v.push_back(p);
	}
      }
    }
    pair<char, int> p = v[0];

    cout << rec(0,p.first,p.second,v) << endl;
    
  }
  return 0;	
}

Measured memory_bytes: 3196
#include <iostream> 
#include <cstdio> 
#include <cstdlib> 
#include <cstring> 
#include <cmath> 
#include <algorithm> 
using namespace std;
const int MAX_N = 1e6 + 5; 
int N, a[MAX_N]; 
char s[MAX_N];
int ans = 0; 
bool C(int n, int m) { 
    while (n | m) { 
	if ((n & 1) < (m & 1)) return 0;
	n >>= 1, m >>= 1;
    }
    return 1;
}
int main () { 
    scanf("%d %s", &N, s + 1); 
    for (int i = 1; i <= N; i++) a[i] = s[i] - '0'; 
    if (N == 1) return printf("%d\n", a[1]) & 0; 
    for (int i = N; i >= 1; i--) {
	for (int j = 1; j <= i - 1; j++) a[j] = abs(a[j + 1] - a[j]); 
	bool vis[5];
	memset(vis, 0, sizeof(vis)); 
	for (int j = 1; j <= i - 1; j++) vis[a[j]] = 1; 
	if ((vis[1] & vis[2]) == 0) { 
	    for (int j = 1; j <= i - 1; j++) 
		if (C(i - 2, j - 1)) ans ^= a[j]; 
	    break; 
	} 
    } 
    printf("%d\n", ans); 
    return 0; 
} 

Measured memory_bytes: 5120
#include<iostream>
#include<stdio.h>
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,n) for(int i=1;i<=n;i++)
string change(string s){
    int size = s.size();

    rep(i,size){
        if(islower(s[i])) s[i] = toupper(s[i]); 
    }

    return s;

}
int main()
{
    string W,T;

    cin >> W >> T;

    W = change(W);

    int ans=0;
    
    while(T!="END_OF_TEXT"){
        T = change(T);
        if(T==W) ans++;
        cin >> T;
        
    }

    cout << ans << endl;

    return 0;


}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(k,i,n) for(ll i=k;i<n;++i)
#define pb push_back
int main(void){
    ll n,k;
    cin>>n>>k;
    vector<ll>p(n);
    rep(0,i,n)cin>>p[i];
    sort(p.begin(),p.end());
    ll ans=0;
    rep(0,i,k){
        ans+=p[i];
    }
    cout<<ans;
}

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

int main(){
  long long l,r;
  cin >> l >> r;
  
  long long min=2020;
  for(long long i=l; i<=r; i++){
    long long tmp = i%2019;
    if(tmp < min) min = tmp;
    if(min == 0) break;
  }
  
  if(min == 0){
    cout << 0 << endl;
    return 0;
  }
  
  long long start = l%2019;
  long long end = r%2019;
  if(start > end){
    long long tmp = start;
    start = end;
    end = tmp;
  }
  long long answer = 2020;
  
  for(long long i=start; i<end; i++){
    for(long long j=start+1; j<=end; j++){
      long long tmp = i*j;
      tmp %= 2019;
      if(answer > tmp) answer = tmp;
      if(answer == 0) break;
    }
  }
  
  cout << answer << endl;
  
  
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int k,i,buf,sum,combi;
	while(1){
		scanf("%d",&k);
		if(k == 0){break;}
		sum = 0;
		combi = k * (k - 1) / 2;
		for(i = 0; i < combi; i++){
			scanf("%d",&buf);
			sum += buf;	
		}
		printf("%d\n",sum / ( k - 1));
	}

	return 0;
}

Measured memory_bytes: 0
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
struct UnionFind {
	vector<int> par;
	UnionFind(int x) : par(x, -1) {}
	void init(int x) { par.assign(x, -1); }
	int root(int x) {
		if (par[x] <= -1) return x;
		else return root(par[x]);
	}
	bool issame(int x, int y) {
		return root(x) == root(y);
	}
	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}
	int size(int x) {
		return -par[root(x)];
	}
};
int ans[100010];
int A[100010], B[100010];
int C[100010], D[100010];
int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M, K;
    cin >> N >> M >> K;
    UnionFind UF1(N), UF2(N);
    rep(i, M) {
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
        UF1.merge(A[i], B[i]);
    }
    rep(i, K) {
        cin >> C[i] >> D[i];
        C[i]--; D[i]--;
        UF2.merge(C[i], D[i]);
    }
    rep(i, M) {
        if (UF1.issame(A[i], B[i])) {ans[A[i]]--; ans[B[i]]--;}
    }
    rep(i, K) {
        if (UF1.issame(C[i], D[i])) {ans[C[i]]--; ans[D[i]]--;}
    }
    rep(i, N) {
        if (i != 0) cout<< " ";
        cout << UF1.size(i) + ans[i] - 1;
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 3584
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<map>
#include <algorithm>
int main() {

	int ina;

	std::cin >> ina;
	int inb= 999;	
	if (ina <= 888) inb = 888;
	if (ina <= 777) inb = 777;
	if (ina <= 666) inb = 666;
	if (ina <= 555) inb = 555;
	if (ina <= 444) inb = 444;
	if (ina <= 333) inb = 333;
	if (ina <= 222) inb = 222;
	if (ina <= 111) inb = 111;

	std::cout << inb << std::endl;


	return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
	int n,a;
	int saidai,saisyou;
	long goukei;
	saidai=saisyou=goukei=0;
	cin>>n>>a;
	n-=1;
	saidai=a;
	saisyou=a;
	goukei=a;
	for(int i=0;i<n;i++){
		cin>>a;
		if(saidai<a){
			saidai=a;
		}
		if(saisyou>a){
			saisyou=a;
		}
		goukei+=a;
	}
	cout<<saisyou<<" "<<saidai<<" "<<goukei<<endl;

	return 0;
}

Measured memory_bytes: 1168
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int a = ir.nextInt();
		int b = ir.nextInt();
		out.println(Math.max(0, a - 2 * b));
	}

	public static void main(String[] args) {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

		public boolean hasNext() {
			skip();
			return hasNextByte();
		}

		public String next() {
			if (!hasNext())
				throw new NoSuchElementException();
			StringBuilder sb = new StringBuilder();
			int b = readByte();
			while (!isSpaceChar(b)) {
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		public long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		public char[][] nextCharMap(int n, int m) {
			char[][] map = new char[n][m];
			for (int i = 0; i < n; i++)
				map[i] = next().toCharArray();
			return map;
		}
	}

	static void tr(Object... o) {
		out.println(Arrays.deepToString(o));
	}
}

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

const int maxn = 2e5 +7;
vector<int>g[maxn];
bool mark[maxn];
vector<int>p(maxn), x(maxn), cnt(maxn, 0);

void dfs(int v, int ancestor) {
    mark[v] = 1;
    for(int to : g[v]) {
        if(ancestor == to)  continue;
        if(!mark[to]) {
            cnt[to] += cnt[v];
            dfs(to, v);
        }
    }
}
int main()
{
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, q, u, v; cin>>n>>q;
    for(int i=1; i<n; i++) {
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    for(int i=1; i<=q; i++) {
        cin>>p[i]>>x[i];
        cnt[p[i]] += x[i];
    }

    dfs(1, 0);
    for(int i=1; i<=n; i++) cout<<cnt[i]<<" ";
    return 0;
}

Measured memory_bytes: 29116