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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

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

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll h, w;
  cin >> h >> w;

  vs s(h);
  rep(i, h) {
    cin >> s[i];
  }
  vvll dp(h, vll(w, INF));
  dp[0][0] = 0;
  if (s[0][0] == '#') {
    dp[0][0] = 1;
  }
  rep(y, h) {
    rep(x, w) {
      ll cnt = 0;
      FOR(i, x, w - 1) {
        // 右に進む
        if (s[y][i] == '.' && s[y][i + 1] == '#') {
          cnt++;
        }
        chmin(dp[y][i + 1], dp[y][x] + cnt);
      }

      cnt = 0;
      FOR(i, y, h - 1) {
        // 下に進む
        if (s[i][x] == '.' && s[i + 1][x] == '#') {
          cnt++;
        }
        chmin(dp[i + 1][x], dp[y][x] + cnt);
      }
    }
  }

  cout << dp[h - 1][w - 1] << endl;

  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		if(N%2 == 0) {
			System.out.println(N);
		}else {
			System.out.println(2*N);
		}

	}

}


Measured memory_bytes: 21972
#include <stdio.h>

int main () {
  int num,x,count=0,i,r;
  int hantei(int);

  scanf("%d",&num);

  for(i=0;i<num;i++) {
    scanf("%d",&x);
    r = hantei(x);
    if(r == 1)
      count++;
  }
  printf("%d\n",count);

  return 0;
}

int hantei(int x) {
  int j;
  if(x<2) return 0;
  else if(x==2) return 1;
  if(x%2==0) return 0;
  for(j=3;j*j <=x; j+=2){
    if(x%j==0) return 0;
  }
  return 1;
}



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

int main(){
    string input;
    vector<string> ans;
    getline(cin, input);
    input += " ";
    while(input.find(",") != string::npos) input.replace(input.find(","), 1, " ");
    while(input.find(".") != string::npos) input.replace(input.find("."), 1, " ");
    while(input.find_first_of(" ") != string::npos){

        string s = input.substr(0, input.find_first_of(" "));
        if(3 <= s.size() && s.size() <= 6) ans.push_back(s);

        input = input.substr(input.find_first_of(" ")+1);
    }
    for(int i=0; i < ans.size(); i++){
        if(i == 0) cout << ans[i];
        else cout << " " << ans[i];
    }
    cout << endl;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define pdump(p) cout<<" "<<#p<<"=("<<p.fst<<","<<p.snd<<")"
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std; using lint = long long; using ld = long double;
using pii = pair<int, int>; using pll = pair<lint, lint>;

// べき乗の剰余
lint modpow(lint x, lint y, lint m) {
    if (y == 0) return 1;
    lint res = modpow(x, y / 2, m);
    return res * res % m * (y & 1 ? x : 1) % m;
}

lint an(lint n) {
    const lint MOD = 1e18;
    return modpow(2, n+2, MOD) - 3;
}

lint bn(lint n) {
    const lint MOD = 1e18;
    return modpow(2, n+1, MOD) - 1;
}

lint rec(lint n, lint x) {
    if (n==0) return 1;
    
    if (x == 1) return 0;
    if (1 <= x and x <= 1+an(n-1)) return rec(n-1, x-1);
    if (x == 2+an(n-1)) return bn(n-1)+1;
    //dump(n); dump(2+an(n-1)); dump(x); dump(2+2*an(n-1)); dump(x-(an(n-1)+2)); el;
    if (3+an(n-1) <= x and x <=2+2*an(n-1)) return bn(n-1)+1+rec(n-1, x-(an(n-1)+2));
    if (x == 3+2*an(n-1)) return 2*bn(n-1)+1;
    assert (false);
    return -1;
}

int main(void) {
    lint n, x;
    cin >> n >> x;
    
    cout << rec(n, x) << endl;
}

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

using Lint=long long;

int main()
{
   Lint a,b,k; cin>>a>>b>>k;
   Lint d=min(a,k);
   a-=d; k-=d;
   d=min(b,k);
   b-=d; k-=d;
   cout<<a<<' '<<b<<endl;
   return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int gi(){
	int x=0,w=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if (ch=='-') w=0,ch=getchar();
	while (ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
	return w?x:-x;
}
const int N = 1e5+5;
const int mod = 1e9+7;
int n,inv[N],ans;
int main(){
	n=gi();inv[1]=1;
	for (int i=2;i<=n;++i) inv[i]=1ll*inv[mod%i]*(mod-mod/i)%mod;
	for (int i=2;i<=n;++i) inv[i]=(inv[i]+inv[i-1])%mod;
	for (int i=1;i<=n;++i) ans=(ans+1ll*gi()*(inv[i]+inv[n-i+1]-1))%mod;
	for (int i=1;i<=n;++i) ans=1ll*ans*i%mod;
	printf("%d\n",ans);return 0;
}


Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main(){
    
    int i , x ;
    
    i=1;
    
    do{
        cin >> x;
        if(x>0){
            cout << "Case" << " " << i << ": " << x << endl;
            i++;    
        }
        else{
        }
    } while (x > 0);
    
    
    
    
    
    
}


Measured memory_bytes: 3100
//#pragma GCC optimize(3)
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
typedef long long LL;
using namespace std;

#define MAXN 100005
#define INF 999999999

//multiset<int> se;

signed main() {
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	LL ans = 0;
	int n, o, a, b;
	int left = 0;
	scanf("%d", &n);
	scanf("%d", &o);
	if (o == 1) {
		scanf("%d%d", &a, &b);
		ans += b;
		left = a;
	}
	priority_queue<int> qleft;
	priority_queue<int,vector<int>, greater<int> > qright;
	for (int i = 1; i < n; i++) {
		scanf("%d", &o);
		if (o == 1) {
			scanf("%d%d", &a, &b);
			ans += b;
			ans += abs(left - a);
			if (a <= left) {
				qleft.push(a);
				if (qleft.size() > qright.size()) {
					int temp = qleft.top();
					qleft.pop();
					qright.push(left);
					left = temp;
				}
			}
			else {
				qright.push(a);
				if (qright.size() > qleft.size() + 1) {
					int temp = qright.top();
					qright.pop();
					ans -= temp - left;
					qleft.push(left);
					left = temp;
				}
			}
		}
		else if(o == 2) {
			printf("%d %lld\n",left, ans);
		}
		
	}
	return 0;
}

Measured memory_bytes: 3452
#include <iostream>
#include <string>
#include <vector>

using namespace std;

void d()
{
	string s;
	cin >> s;
	int n = s.length();
	vector<int> count(n, 1);
	for (int i = 0; i < n; i++) {
		if (s[i] == 'R') {
			if (s[i + 1] == 'R') {
				count[i + 2] += count[i];
				count[i] = 0;
			}
		}
	}

	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == 'L') {
			if (s[i - 1] == 'L') {
				count[i - 2] += count[i];
				count[i] = 0;
			}
		}
	}
	cout << count[0];
	for (int i = 1; i < n; i++) {
		cout << " " << count[i];
	}
	cout << endl;
}

int main()
{
	d();

	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main (void){
  int X;
  cin >> X;
  if(X >= 400 && X<=599){
    cout << "8" << endl;
  }else if(X >= 600 && X<=799){
    cout << "7" << endl;
  }else if(X >= 800 && X<=999){
    cout << "6" << endl;
  }else if(X >= 1000 && X<=1199){
    cout << "5" << endl;
  }else if(X >= 1200 && X<=1399){
    cout << "4" << endl;
  }else if(X >= 1400 && X<=1599){
    cout << "3" << endl;
  }else if(X >= 1600 && X<=1799){
    cout << "2" << endl;
  }else if(X >= 1800 && X<=1999){
    cout << "1" << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P;
map<int, int> dp;
#define REP(i, n) for (int i = 0; i < n; i++)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  int range_min = 0;
  int range_max = N;

  REP(i, M) {
    int gate_min, gate_max;
    cin >> gate_min >> gate_max;
    if (gate_min > range_min) range_min = gate_min;
    if (gate_max < range_max) range_max = gate_max;
  }
  if (range_max > N) range_max = N;
  int ans = range_max - range_min + 1;
  if (ans < 0) ans = 0;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
// @author: arch_

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

int main(void) {
    int h, w;
    vector<array<int, 2>> a;
    while (cin >> h >> w, h | w) {
        array<int, 2> i{h, w};
        a.emplace_back(i);
    }
    for (auto&& i : a) {
        for (int y = 0; y < i[0]; y++) {
            for (int x = 0; x < i[1]; x++) {
                cout << ((y + x) % 2 == 0 ? "#" : ".");
            } cout << "\n";
        } cout << "\n";
    }
    return 0;
}

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

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

using namespace std;
using lint=long long;

int main(){
	int n; scanf("%d",&n);
	vector<int> a(n);
	rep(i,n) scanf("%d",&a[i]);

	lint ans=0;
	map<int,int> L;
	rep(i,n){
		ans+=L[i-a[i]];
		++L[i+a[i]];
	}
	printf("%lld\n",ans);

	return 0;
}


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

using namespace std;

#define rep(i, x)   for (__typeof(x) i = 0; i < x; i++)
#define mp             make_pair
#define pb             push_back
#define fi             first
#define se             second
#define sz(x)          (int)((x).size())
#define all(x)         (x).begin(), (x).end()
#define sci(x)         int x;       scanf("%d", &x);
#define scii(x, y)     int x, y;    scanf("%d %d", &x, &y);
#define sciii(x, y, z) int x, y, z; scanf("%d %d %d", &x, &y, &z);
#define TC(x)          sci(x); while(x --)
#define eprintf(...)   fprintf(stderr, __VA_ARGS__)
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define repi(i, x)  for (__typeof(x) i = x-1; i >= 0; i --)
#define fore(itr, x)   for (__typeof(x.begin()) itr = x.begin(); itr != x.end(); itr ++)
#define forei(itr, x)  for (__typeof(x.end()) itr = x.end() - 1; itr != x.begin() - 1; itr --)
typedef long long      ll;
typedef pair<int, int> ii;
typedef pair<ii, int>  iii;
typedef vector<int>    vi;
typedef vector<ii>     vii;
typedef vector<iii>    viii;
typedef vector<vector<int> > vvi;
const   int            infi = numeric_limits<int>::max();
const   double         eps = 0;
const   int            ms  = 0;




int main()
{
    ios::sync_with_stdio(false);//endl->"\n"
    cin.tie(0);

    string S;
    cin >> S;

    

    int z = 0, o = 0;
    rep(i, S.size()){
        if(S[i]=='0')z++;
        else o++;
    }


    cout << min(z, o)*2 << endl;
    /*
    int ans = 0;
    int l = 0;
    bool f = false;
    vi vis(N, 0);
    for(int i = 0; i < N-1; i++){
        //int l = i;
        int c = S[i];
        if(S[i+1] != c && !vis[i]){
            if(!f)l = i-1;
            f = true;
            ans+=2;
            i++;
            vis[i] = 1;vis[i+1] = 1;
        } else if(f){
            int r = i;
            while(0 <= l && r < N && S[r] != S[l] && !vis[r] && !vis[l]){
                ans+=2;
                r++;l--;
                vis[l]=1;
                vis[r]=1;
            }
            f = false;
        } else {
            f = false;
        }
        
    }*/

    return 0;
}

Measured memory_bytes: 512
/*********************
*                    *
* Nothing Impossible *
*                    *
*********************/
#include <algorithm>
#include <iostream>
#include <fstream>
#include <ctype.h>
#include <string>
#include <vector>
#include <math.h>
#include <cmath>
#include <map>
#define GetRand(Min, Max) ((rand()%(int)(((Max) + 1)-(Min))) + (Min))
#define Rep(i, min, max) for (int i = min; i < max; ++i)
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef long double ld; 
using namespace std;

int main()
{
	ll x, t;
	cin >> x >> t;
	if(x - t < 0)
	{
		cout << "0\n";
	}
	else
	{
		cout << x-t << endl;
	}
	return 0;
}





Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sun Jun  2 22:01:55 2019

@author: hisaki
"""

import sys
N, A, B, C, D = map(int, input().split())
S = input()
A_start = A -1
B_start = B -1
A_goal = C -1
B_goal = D -1

A_pos = A_start
B_pos = B_start

flag = True
for i in range(A_pos, A_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False

for i in range(B_pos, B_goal):
    if S[i] == '#':
        if S[i+1] == '#':
            flag = False
            
if flag == False:
    print ("No")
    sys.exit()
  


if A_goal < B_goal:
    print ("Yes")
    sys.exit()


if B_goal < A_goal :
    for i in range(B_pos , B_goal+1):
        if (S[i-1] == '.' or i-1 == A_pos) and (S[i]== '.') and (S[i+1] == '.'):
            print ("Yes")
            sys.exit()

            
print ("No")
        


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

const int INF = 0x3f3f3f3f;

int h, w, ch, cw, dh, dw;
char mat[1005][1005];
int dist[1005][1005];

int dirx[] = {1, -1, 0, 0};
int diry[] = {0, 0, 1, -1};

bool valid(int x, int y) {
	if (x < 0 || y < 0 || x >= w || y >= h || mat[y][x] == '#') return 0;
	return 1;
}

int main() {
	cin >> h >> w;
	cin >> ch >> cw;
	cin >> dh >> dw;
	ch--; cw--; dh--; dw--;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> mat[i][j];
		}
	}
	memset(dist, INF, sizeof dist);
	dist[ch][cw] = 0;
	deque<int> qx, qy;
	qx.push_front(cw); qy.push_front(ch);
	while (!qx.empty()) {
		int cx = qx.front();
		int cy = qy.front();
		qx.pop_front(); qy.pop_front();
		for (int i = 0; i < 4; i++) {
			int tx = cx + dirx[i];
			int ty = cy + diry[i];
			if (valid(tx, ty)) {
				if (dist[ty][tx] > dist[cy][cx]) {
					dist[ty][tx] = dist[cy][cx];
					qx.push_front(tx);
					qy.push_front(ty);
				}
			}
		}
		for (int y = cy - 2; y <= cy + 2; y++) {
			for (int x = cx - 2; x <= cx + 2; x++) {
				if (valid(x, y)) {
					if (dist[y][x] > dist[cy][cx] + 1) {
						dist[y][x] = dist[cy][cx] + 1;
						qx.push_back(x);
						qy.push_back(y);
					}
				}
			}
		}
	}
	if (dist[dh][dw] > 1e7) dist[dh][dw] = -1;
	cout << dist[dh][dw] << endl;
}


Measured memory_bytes: 8628
#include<stdio.h>
 
int main()
 
 
{
 
 
int a,b;
 
 
scanf("%d%d",&a,&b);
 
 
if(a < b){
printf("a < b\n");
} 
 
else if(a>b){
printf("a > b\n");
}
 
else{
printf("a == b\n");
} 
 
return 0;
 
 
}

Measured memory_bytes: 580
/// Containers Start
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
/// C Header Files
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <math.h>
#include <stdio.h>
/// Containers End

using namespace std;

/// Math Start
#define PI acos(-1.0)
#define Pi 3.141592653589793
#define EPS (1e-7)
#define INF (0x3f3f3f3f)
/// Math End

/// Extra Start
#define nn '\n'
#define pb push_back
#define ull unsigned long long
#define ll long long
#define MOD 1000000007
#define sz(a) int((a).size())
#define space " "
#define All(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
/// Extra End

#define rep(i, n) for (int i = 0; i < n; i++)
#define Cini(a)                                                                \
    int a;                                                                     \
    cin >> a;
#define Cinii(a, b)                                                            \
    int a, b;                                                                  \
    cin >> a >> b;
#define Ciniii(a, b, c)                                                        \
    int a, b, c;                                                               \
    cin >> a >> b >> c;
#define Cins(s)                                                                \
    string s;                                                                  \
    cin >> s;
#define Cinss(s1, s2)                                                          \
    string s1, s2;                                                             \
    cin >> s1 >> s2;
#define Cinc(c)                                                                \
    char c;                                                                    \
    cin >> c;
/// Functions End


/// Debug Start
#define deb(x) cout << #x << ": " << x << endl
#define deb2(x, y) cout << #x << ": " << x << '\t' << #y << ": " << y << endl;
#define deb3(x, y, z)                                                          \
    cout << #x << ": " << x << '\t' << #y << ": " << y << '\t' << #z << ": "   \
         << z << endl;
/// Debug End

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

/**>>>>>>>>>>>>>>>>>>> END <<<<<<<<<<<<<<<<<<**/

/// template


signed main(void) {
    cin.sync_with_stdio(false);
    cin.tie(0);
    Cini(N);
    Cins(S);
    rep(i,S.length()){
        cout << char((S[i]-'A'+N)%('Z'-'A'+1) + 'A');
    }
    cout << nn;
    return 0;
}

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

void roll_x(vector<int> &v) {
  vector<int> res = v;
  
  res[0] = v[4];
  res[1] = v[0];
  res[5] = v[1];
  res[4] = v[5];
  v = res;
}

void roll_y(vector<int> &v) {
  vector<int> res = v;
  res[0] = v[3];
  res[2] = v[0];
  res[5] = v[2];
  res[3] = v[5];
  v = res;
}

void roll_z(vector<int> &v) {
  vector<int> res = v;
  res[1] = v[2];
  res[2] = v[4];
  res[4] = v[3];
  res[3] = v[1];
  v = res;
}

void allpattern(vector<int> v, vector<vector<int> > &out) {
  out.clear();  
  for(int i = 0; i < 6; i++) {
    if( i & 1 ) roll_x(v);
    else roll_y(v);
    for(int j = 0; j < 4; j++) {
      roll_z(v);
      out.push_back(v);
    }
  }
  
}

bool same(vector<int> a, vector<int> b) {
  vector<vector<int> > aa, bb;
  
  allpattern(b, bb);

  for(int i = 0; i < bb.size(); i++) 
    if( bb[i] == a ) return true;
  return false;
}

bool dup(vector< vector<int> > have, vector<int> b) {
  for(int i = 0; i < (int)have.size(); i++) {
    if( same( have[i], b ) ) return true;
  }
  return false;
}

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

    vector<int> dice[N];

    for(int n = 0; n < N; n++) {
      for(int i = 0; i < 6; i++) {
        string s; cin >> s;
        dice[n].push_back( s[0] - 'A' );
      }
    }
    
    vector< vector<int> > uni;
    for(int i = 0; i < N; i++) {
      if( ! dup(uni, dice[i]) ) {
        uni.push_back( dice[i] );
      }
    }

    cout << N - (int)uni.size() << endl;
    
  }
}

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

int main(){
  string s,t;
  cin>>s>>t;
  int n = s.size();
  map<char,char> mp1,mp2;
  char tmp='a';
  rep(i,26){
    mp1[tmp]='#';
    mp2[tmp]='#';
    tmp++;
  }
  bool ans=1;
  rep(i,n){
    if(t[i]==mp1[s[i]] || mp1[s[i]]=='#') mp1[s[i]]=t[i];
    else ans=0;
    if(s[i]==mp2[t[i]] || mp2[t[i]]=='#') mp2[t[i]]=s[i];
    else ans=0;
  }
  if(ans) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 3928
N, Y = map(int, input().split())

checker = Y // 1000
ans = [-1, -1, -1]
for x in range(N + 1):
    for y in range(N + 1):
        z = N - x - y
        if z < 0:
            break
        if (x + 5 * y + 10 * z) == checker:
            ans = [z, y, x]
            break
print('{} {} {}'.format(ans[0], ans[1], ans[2]))

Measured memory_bytes: 9176
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1e9+7;
map<int,int>a;
inline int sss()
{
    char ch=getchar();
    int x=0,q=1;
    while(ch>'9' || ch<'0')
	{
		q=ch==45?-1:q,ch=getchar();
	}
    while(ch>='0' && ch<='9')
	{
		x=(x<<1)+(x<<3)+(ch^'0'),ch=getchar();
	}
    return x*q;
}
inline int ss(int x)
{
    if(a[x]!=0)
    {
    	return a[x];
	}
    else
    {
    	return a[x]=((ss(x/2)+ss((x-1)/2)+ss((x-2)/2)))%mod;
	}
}
int n;
signed main()
{
    a[0]=1;
    a[1]=2;
    n=sss(); 
    printf("%lld",ss(n));
    return 0;
}

Measured memory_bytes: 256
#define watch5(a,b,c,d,e) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d << " | "<<#e<<": "<<e<<endl;
#define watch4(a,b,c,d) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define watch3(a,b,c) cerr <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<endl;
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define sharingan cerr << "\n-------------------------------------------\n\n";
#define watch2(a,b) cerr <<#a<<": "<<a<<" | "<<#b<<": "<<b<< endl;
#define Yup ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define watch(a) cerr <<#a<<": "<<a<<endl;
#define __gcd(a, b) __algo_gcd(a, b)
#define PI 3.14159265358979323846
#define mod 1000000007
#include "bits/stdc++.h"
using namespace std;
#define int long long

int32_t main(){
    double x;
    cin >> x;
    if( x == 0 )cout << "1";
    else cout << "0";
}

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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<int, int> pii;
const int inf=1010001000;
const ll  INF=1001000100010001000;
const int mod=(int)1e9+7;

int main(){
    ll n,k;
    cin>>n>>k;
    vector<ll>a(n);
    rep(i,0,n){
        cin>>a.at(i);
    }
    sort(all(a));
    ll ng=-INF;
    ll ok=INF;
    while(ok-ng>1){
        ll x=(ok+ng)/2;
        ll s=0, t=0;
        rep(i,0,n){
            if(a.at(i)>0){
                int ng2=-1, ok2=n;
                while(ok2-ng2>1){
                    int m=(ok2+ng2)/2;
                    if(a.at(i)*a.at(m)<=x)ng2=m;
                    else ok2=m;
                }
                s+=ng2+1;
            }
            else if(a.at(i)<0){
                int ng2=-1, ok2=n;
                while(ok2-ng2>1){
                    int m=(ok2+ng2)/2;
                    if(a.at(i)*a.at(m)<=x)ok2=m;
                    else ng2=m;
                }
                s+=n-ok2;
            }
            else if(x>=0)s+=n;
            if(a.at(i)*a.at(i)<=x)t++;
        }
        ll num=(s-t)/2;
        if(num>=k)ok=x;
        else ng=x;
    }
    cout<<ok<<endl;
return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep1(i,n) for(int i=1; i<=(n); ++i)
#define repi(i,a,b) for(int i=a; i<=(b); ++i)
#define rrep(i,n) for(int i=(n-1); i>=0; --i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vvi vector<vi>
#define yes "Yes"
#define no "No"
using namespace std;
using ll = long long;
int main() {
  int n,k;
  cin >> n >> k;
  vi p(n);
  rep(i,n) {
    cin >> p[i];
  }
  sort(all(p));
  int ans = 0;
  rep(i,k){
    ans += p[i];
  }
  cout << ans << endl;

}


Measured memory_bytes: 3628
import java.util.*;
public class Main{

    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);
        //枚数
        int n = Integer.parseInt(sc.next());
        
        //スペード:S
        List<Integer> s_list = new ArrayList<>();
        //ハート:H
        List<Integer> h_list = new ArrayList<>();
        //クラブ:C
        List<Integer> c_list = new ArrayList<>();
        //ダイヤ:D
        List<Integer> d_list = new ArrayList<>();
        
        //1～13の数字を登録
        for(int i=1; i<=13; i++){
            s_list.add(i);
            h_list.add(i);
            c_list.add(i);
            d_list.add(i);
        }
        
        //インプットされた値をリストから除外
        for(int i=0; i<n; i++){
            //絵柄
            String suit = sc.next();
            //数字
            int num = sc.nextInt();
            
            //リストから該当する数字を除外
            if(suit.equals("S")) s_list.remove(s_list.indexOf(num));
            else if(suit.equals("H")) h_list.remove(h_list.indexOf(num));
            else if(suit.equals("C")) c_list.remove(c_list.indexOf(num));
            else if(suit.equals("D")) d_list.remove(d_list.indexOf(num));
        }
        //リストに残った数字を出力
        for(Integer s: s_list){
            System.out.println("S "+s);
        }
        for(Integer h: h_list){
            System.out.println("H "+h);
        }
        for(Integer c: c_list){
            System.out.println("C "+c);
        }
        for(Integer d: d_list){
            System.out.println("D "+d);
        }





    }

}



Measured memory_bytes: 26296
import java.util.Scanner;
import java.util.Arrays;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int A = sc.nextInt();
   int B = sc.nextInt();
   if(A>B)
   {
   if((A-B) % 2 == 1) System.out.println("IMPOSSIBLE");
    else System.out.println((A+B)/2); 
   }else{
     if((B-A) % 2 == 1) System.out.println("IMPOSSIBLE");
     else System.out.println((B+A)/2); 
   }
 }
}

Measured memory_bytes: 23124
#include<iostream>
#include<cstring>

using namespace std;

int n,m,s;
int map[50][3001];

int main(void){
	while(1){
		cin >> n >> m >> s;
		if(n==0 && m==0 && s==0)break;
		memset(map,0,sizeof(map));
		map[0][0]=1;
		for(int i=1;i<=m;i++){
			for(int j=n*n;j>=1;j--){
				for(int k=i;k<=s;k++){
					map[j][k]=(map[j][k]+map[j-1][k-i])%100000;
				}
			}
		}
		cout << map[n*n][s] << endl;
	}
    return 0;
}

Measured memory_bytes: 1448
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <numeric>
using namespace std;

int a;

int main(void)
{
	cin>>a;
	int b = a%7;
	switch(b){
	case 0:
		cout<<"thu";
		break;
	case 1:
		cout<<"fri";
		break;
	case 2:
		cout<<"sat";
		break;
	case 3:
		cout<<"sun";
		break;
	case 4:
		cout<<"mon";
		break;
	case 5:
		cout<<"tue";
		break;
	case 6:
		cout<<"wed";
		break;
			break;
	}
	cout<<endl;


	return 0;
}


Measured memory_bytes: 3112
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	ll N;
	scan(N);
	if(N%2){
		prin(0);
	}
	else{
		ll ans=0;
		ll p=5;
		rep1(k,26){
			ans+=N/2/p;
			p*=5;
		}
		prin(ans);
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define x first
#define y second
#define mod 1e9+7
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rof(i,a,b) for(ll i=a;i>b;i--)

//int a[1001][1001] //aise global me hi

ll lcm(ll a, ll b){
    return a / __gcd(a, b) * b;
}
//memset can initialize to 0 or -1 ONLY //memset(str, 't', sizeof(str)); // string
//memset(a, 0, sizeof(a));  //1D array    // memset(a,0,sizeof(a[0][0])*n*n); //2D array
// set.insert(),find()    // sort(v.begin(),v.end(),compare)

void solve()
{
    int n,r;cin>>n>>r;
    if(n>=10) cout<<r;
    else
    {
ll x=r + 100*(10-n);cout<<x;
    }
    
}


int main()
{

ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    ll t=1;
   // cin>>t;
    while(t--)
    {
    
    solve();
    
    }

}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ldouble = long double;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s) cout << fixed << setprecision(10) << s << endl;


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

	println((a % b == 0 ? 0 : 1));
}


Measured memory_bytes: 3592
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		String string;
		int n;
		
		while((string = reader.readLine()) != null){
			n = Integer.valueOf(string);
			int array[][] = new int[n][3];
			boolean resul[][] = new boolean[n][3];
			
			for(int i = 0; i < n; i++){
				string = reader.readLine();
				array[i][0] = Integer.valueOf((string.split(" ")[0]));
				array[i][1] = Integer.valueOf((string.split(" ")[1]));
				array[i][2] = Integer.valueOf((string.split(" ")[2]));
			}
			
			for(int i = 0; i < 3; i++){
				for(int j = 0; j < n; j++){
					for(int k = j + 1; k < n; k++){
						if(array[j][i] == array[k][i]){
							resul[j][i] = true;
							resul[k][i] = true;
						}
					}
				}
			}
			
			for(int i = 0; i < n; i++){
				for(int j = 0; j < 3; j++)
					if(resul[i][j]) array[i][j] = 0;
				
				System.out.println(array[i][0] + array[i][1] + array[i][2]);
			}
		}
	}
}

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

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


Measured memory_bytes: 4572
#include <iostream>

using namespace std;
int n , a[200010] , avail[1000009];
int main(){
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 1; i <= n; i++) avail[a[i]]++;
    int ans = 0;
    for (int i = 1; i <= n; i++){
        avail[a[i]]--;
        bool check = false;
        for (int j = 1; j * j <= a[i]; j++){
            if (a[i] % j == 0)
                if (avail[j] > 0 || avail[a[i]/j] > 0) check = true;
        }
        if (check == false) ans++;
        avail[a[i]]++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 8208
function Main(arg) {
 
    var N = arg.split("\n")[0]-0;
    var A = arg.split("\n")[1].split(" ").map(v => v - 0);

    var tmp = new Array(N);
    for (var i = 1; i <= N; i++){
        tmp[A[i-1]-1] = i;
    }

    console.log(tmp.join(" ").toString());
}

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

Measured memory_bytes: 34160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(int i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(int i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define uniq(x) (x).erase(unique((x).begin(), (x).end()), (x).end())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // std::ifstream in("input.txt");
    // std::cin.rdbuf(in.rdbuf());
    const int mod = 1e9 + 7;
    int h, w, k;
    cin >> h >> w >> k;
    vector<vector<ll>> dp(h + 1, vector<ll>(w, 0));
    dp[0][0] = 1;
    if ((w == 1) && (k != 1)) {
        cout << 0 << endl;
        return 0;
    }
    reps(i, 1, h + 1) {
        rep(ii, 1 << (w - 1)) {
            bitset<8> bs(ii);
            bool f = true;
            rep(iii, w - 1) {
                if ((bs[iii]) && (bs[iii + 1])) {
                    f = false;
                    break;
                }
            }
            if (!f) continue;
            rep(iii, w) {
                if ((iii > 0) && (bs[iii - 1])) {
                    dp[i][iii] += dp[i - 1][iii - 1];
                }
                if ((iii < (w - 1)) && (bs[iii])) {
                    dp[i][iii] += dp[i - 1][iii + 1];
                }
                if (
                    ((iii == 0) || (!bs[iii - 1])) &&
                    ((iii == (w - 1)) || (!bs[iii]))
                ) {
                    dp[i][iii] += dp[i - 1][iii];
                }
                dp[i][iii] %= mod;
            }
            // rep(iii, w) {
            //     printf("|%c%s", (((iii < (w - 1)) && (bs[iii])) ? '-' : ' '), ((iii == (w - 1)) ? "\n" : ""));
            // }
        }
    }
    cout << dp[h][k - 1] << endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int i,j,n,b,temp,sum=0;
    scanf("%d %d",&n,&b);
    int pl[n];
    for(i=0;i<n;i++)
    {
        scanf("%d",&pl[i]);
    }
    for(i=0;i<n;i++)
    {
        for(j=i+1;j<n;j++)
        {
            if(pl[i]>pl[j])
            {
                temp=pl[i];
                pl[i]=pl[j];
                pl[j]=temp;
            }
        }
    }


    for(i=0;i<b;i++)
    {
        sum=sum+pl[i];
    }
    printf("%d",sum);
    return 0;
}


Measured memory_bytes: 1680
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (n,k) = get!(usize, usize);
    let a = get!([usize]);

    let mut dp = vec![false; k+1];
    for i in 0..k+1 {
        for j in 0..n {
            if i>=a[j] {
                dp[i] |= !dp[i-a[j]];
            }
        }
    }
    if dp[k] {
        println!("First");
    } else {
        println!("Second");
    }
}


Measured memory_bytes: 8572
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <math.h> 
#include <iomanip>
#include <string.h>
#include <vector>
using namespace std;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N = 2e5 + 5;

 
int vis[N];


int32_t  main() {

	IOS;

	

	int  n;
	
	cin >> n;

	vector<int>  v(n);

	bool flag = false;
	for (int i = 0; i < n; i++) {

		 
		cin >> v[i];
	
		if (v[i] == 0) {
			flag = true;
		}

	}

	if (flag) {
		cout << "0" << endl;
	}
	else {
		int ans = v[0];
		 
		
		for (int i = 1; i < n; i++) {

			if (v[i] > 1000000000000000000 / ans) {
				ans = -1;
					break;
			 }


			ans *= v[i];
		}

		cout << ans << endl;
		
	}
	 


}

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

using namespace std;

int main() {
    string str; cin >> str;
    int arr[26] = {0};
    for (auto s: str) {
        arr[s - 'a']++;
    }

    string ret = "yes";
    for (auto e: arr) {
        if (e > 1) {
            ret = "no";
            break;
        }
    }

    cout << ret << endl;

    return 0;
}

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

int main(){
	int n;
	cin>>n;
	double p[n+1];
	for (int i=1;i<=n;i++)
		cin>>p[i];
	double dp[n+1][n+1];
	dp[0][0] = 1;
	for (int i=1;i<=n;i++){
		dp[i][0] = dp[i-1][0]*(1-p[i]);
		dp[0][i] = 0;
	}
	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++){
			dp[i][j] = dp[i-1][j-1]*p[i] + dp[i-1][j]*(1-p[i]);
		}
	}
	double ans = 0;
	// for (int i=0;i<=n;i++){
	// 	for (int j=0;j<=n;j++){
	// 		cout<<dp[i][j]<<" ";
	// 	}
	// 	cout<<"\n";
	// }
	for (int i=n;i>(n/2);i--){
		ans+=dp[n][i];
	}
	cout<<setprecision(11)<<ans;
}

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

using namespace std;

#define LL long long
#define FOE(i, s, t) for (int i = s; i <= t; i++)

int n, k;

#define K 10000001

char s[K];

char f(int a, char b){
        if (a){
                if (b == 'A') return 'B';
                return 'A';
        }
        return b;
}

char s2[K];

#define MAGIC 5000000
int main(){
        scanf("%d%d", &n, &k);
        scanf("%s", s);

        FOE(i, 0, n - 1) s2[i] = s[i];

        int ptr = 0, tog = 0;
        int las = n;

        FOE(i, 1, min(k, MAGIC)){
                int tru = (s[ptr] == 'A'? 0: 1);
                if (tog) tru ^= 1;

                if (tru == 0){
                        s[ptr] = (s[ptr] == 'A'? 'B': 'A');
                } else {
                        s[las] = (tog? 'A': 'B');
                        las++;
                        ptr++;
                        tog ^= 1;
                }
        }

        int left = max(0, k - MAGIC);

//      printf("left = %d\n", left);

        if (left && (n % 2)){
                if (left % 2 == 1){
                        if (s[ptr] == 'A') s[ptr] = 'B'; else s[ptr] = 'A';
                }
        }
/*
        FOE(i, 1, k){int cur = 0, dir = 1;
        while (cur >= 0 && cur < n){
                if (s2[cur] == 'A') dir *= -1, s2[cur] = 'B';
                else s2[cur] = 'A';
                cur = cur + dir;
        }}



        FOE(i, 1, n) printf("%c", s2[i - 1]);
        puts("");*/


        FOE(i, 1, n) printf("%c", f(tog, s[ptr + i - 1]));
        puts("");

}


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

ans = [0] * n

for i in range(m):
    a, b = map(int, input().split())
    if h[a - 1] < h[b - 1]:
        ans[a - 1] += 1
    elif h[a - 1] > h[b -1]:
        ans[b - 1] += 1
    else:
        ans[a - 1] += 1
        ans[b - 1] += 1

print(ans.count(0))


Measured memory_bytes: 84988
#include <bits/stdc++.h>
using namespace std;
constexpr int MOD = 1e9 + 7;

int dp[1007][1007];

int main()
{
#ifdef LOCAL
    freopen("data.txt", "r", stdin);
#endif
    int h, w;
    scanf("%d%d %*c", &h, &w);
    dp[0][0] = 1;
    for (int i = 0; i != h; ++i) {
        for (int j = 0; j != w; ++j) {
            if (!i && !j)
                continue;
            if (getchar() == '.') {
                if (!i)
                    dp[i][j] = dp[i][j - 1];
                else if (!j)
                    dp[i][j] = dp[i - 1][j];
                else
                    dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
            }
        }
        getchar();
    }
    printf("%d\n", dp[h - 1][w - 1]);
}

Measured memory_bytes: 4224
import java.io.*;
public class Main {
	String input = "";
	int output[][] = new int[100][2];//[ID][0]???d [ID][1]???f
	int intinput[][] = new int[100][100];
	BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
	int dataset = 0;
	int time = 0;
	public static void main(String []args){
		Main run = new Main();
		run.Run();
	}
	public void Run(){
		for(int z = 0;z < 100;z++){
			output[z][0] = -1;
			output[z][1] = -1;
		}try{
				input = read.readLine();
				if(dataset == 0)dataset = Integer.parseInt(input);
				for(int x = 0;x < dataset;x++){
					input = read.readLine();
					String[] get = input.split(" ");
					int number = 0,touch = 0;
					for(int y = 0; y < get.length; y++){
						if(y == 0)number = Integer.parseInt(get[y]);
						if(y >= 2){
							touch = Integer.parseInt(get[y]);
							intinput[number-1][touch-1] = 1;
						}
					}
				}
			}catch(Exception e){
				
			}
		for(int z = 0;z < dataset;z++){
			if(output[z][0] == -1){
				time++;
				Explore(z+1);
			}
		}

		
		for(int z = 0;z < dataset;z++){
			System.out.println((z+1)+" "+output[z][0]+" "+output[z][1]);
		}
	}
	public void Explore(int ID){//??¢?´¢ ID:??´???????±??????´???
		if(output[ID-1][0] == -1){//???????????????
			output[ID-1][0] = time;
		}
		for(int z = 0;z < dataset;z++){
			if(intinput[ID-1][z] == 1 &&
					output[z][0] == -1){//????????????????????????????????????
				time++;
				Explore(z+1);
			}if(z == dataset-1){//??????????????????????????¨???????????????????????????=??????
				time++;
				output[ID-1][1] = time;
			}
		}
	}
}

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

int main(){
  int n;
  cin >> n;
  int lr[n][2];
  for(int i=0;i<n;++i) cin >> lr[i][0] >> lr[i][1];
  auto sum=0;
  for(int i=0;i<n;++i){
    sum+=lr[i][1]-lr[i][0]+1;
  }
  cout << sum << endl;

  return 0;
}

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

typedef pair<int, int> Pi;
typedef tuple<int, int, int> Ti;
typedef vector<int> vint;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  string N;
  cin >> N;
  cout << (count(all(N), '9') ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(2)<<(x)
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inf std::numeric_limits<int>::max();
#define highest_2_pow(n)  __builtin_clzll((long long)0)- __builtin_clzll((long long)n) - 1
//-----------------------------------------------------------------------------------------------------
#define lli long long int 
#define int long long
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define vi vector<int>
#define vlli vector<long long int>
#define si set<int>
#define slli set<long long int>
#define mt make_tuple
#define mp make_pair
#define eb emplace_back
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
//---------------------------------------------------
using namespace std;
// GCD and LCM are available
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}

void faster(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
void solve(){
    int n,m,mx;
    cin>>n>>m;
    vector<int> v(n);
    rep(i,0,n) cin>>v[i];
    make_heap(all(v));
    while(m--){
        mx = v.front();
        if(mx==0) break;
        pop_heap(all(v)); v.pop_back();
        v.push_back(mx/2); push_heap(all(v));
    }
    int sum=0;
    for(auto e:v) sum+=e;
    cout<<sum<<endl;
}
signed main()
{
    faster();
    int t=1;
    //cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

// O(√n) time
bool is_prime(int n) {
    if (n < 2) return false;
    for (int i = 2; i * i <= n; i++) {
        if (n % i == 0) return false;
    }
    return true;
}

void _main() {
    vector<int> cum(100010, 0);
    for (int i = 3; i < 100010; i += 2) {
        if (is_prime(i) && is_prime((i + 1) / 2)) {
            cum[i]++;
        }
    }
    for (int i = 1; i < 100010; ++i) cum[i] += cum[i - 1];
    int Q;
    cin >> Q;
    REP (i, Q) {
        int l, r;
        cin >> l >> r;
        cout << cum[r] - cum[l - 1] << endl;
    }

}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 3864