akhauriyash/Code-Regression huggingface dataset:
// #pragma GCC target("avx,avx2,fma")
// #pragma GCC optimization ("Ofast")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>

using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// template <typename T>
// using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// #define sfind(i) (*find_by_order(i))
// #define ord(i) order_of_key(i)
typedef long long ll;
typedef pair<int , int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;
#define mod 1000000007
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define repc(i, a, b, c) for (ll i = a; (c > 0 ? i < b : i > b) and c != 0; i += c)
#define vi vector<int>
#define vl vector<ll>
#define _max(vec) (*max_element(all(vec)))
#define _min(vec) (*min_element(all(vec)))
#define fi first
#define si second
#define pb push_back
#define all(name) name.begin(), name.end()
#define ral(name) name.rbegin(), name.rend()
#define fact(n) rep(i, 1, n+1)ft.pb((ft[i-1]*i)%mod)
#define mod_in(a) power(a, mod - 2)
#define ncr(n, r) (n>=r?((ft[n]*mod_in((ft[r]*ft[(n)-(r)])%mod))%mod):0LL)
#define deb(x) cerr << "[" << #x << " " << x << "]" << endl;
#define endl '\n'  //....????
#define int ll
vector<ll> ft(1, 1LL);

/*======================================================================*/


void solve(){
    int x, d, k;
    cin >> x >> k >> d;
    x = llabs(x);
    int a = x/d;
    if(d - x%d < x%d)a++;
    if((k >= a and a%2 == k%2) || (k >= a and x%d == d - x%d))cout << min(x%d, d-x%d);
    else if(k < a)cout << x - d*k << endl;
    else cout << max(x%d, d-x%d);
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();
    }
}

Measured memory_bytes: 3644
import java.util.*;

public class Main {
public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int d=sc.nextInt();
		if(d==25){
			System.out.println("Christmas");
		}else if(d==24){
			System.out.println("Christmas Eve");
		}else if(d==23){
			System.out.println("Christmas Eve Eve");
		}else if(d==22){
			System.out.println("Christmas Eve Eve Eve");
		}


	}
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define vll vector<ll>
#define endl "\n"
#define fa(i,n) for(i=0;i<n;i++) 
#define fb(j,n) for(j=1;j<=n;j++)  
using namespace std;
int main()
{ 
 long long int n,a[100006],j,i,z=0,k=1,l=1e18,p=1; cin >> n ; fa(i,n) { cin >> a[i];if(a[i]==0){z++;} }

for(i=0;i<n;i++) {if(z!=0) { k=0; break;} if( a[i]<= 1000000000000000000/k){ k=k*a[i];} else { k=-1; break;}} cout << k; 

}


Measured memory_bytes: 4384
/* atcoder */
#include "bits/stdc++.h"
using namespace std;

/* typedef */
/* long系 */
typedef long long ll;   // long long
typedef long double ld; // long double
/* vector系 */
typedef vector<int> vi;                    // intのvector
typedef vector<double> vd;                 // doubleのvector
typedef vector<ll> vll;                    // llのvector
typedef vector<ld> vld;                    // ldのvector
typedef vector<pair<int, int>> vi_i;       // i_iのvector
typedef vector<pair<double, double>> vd_d; // d_dのvector
typedef vector<pair<ll, ll>> vl_l;         // l_lのvector
typedef vector<pair<ld, ld>> vld_ld;       // ld_ldのvector
typedef vector<string> vs;                 // stringのvector
/* pair系 */
typedef pair<int, int> i_i;       // int同士のpair
typedef pair<double, double> d_d; // double同士のpair
typedef pair<ll, ll> l_l;         // ll同士のpair
typedef pair<ld, ld> ld_ld;       // ld同士のpair

/* define */
#define all(v) v.begin(), v.end() // コンテナ全体
#define PI (acos(-1))             // 円周率pi

/* main */
void Main(void)
{
    while (true)
    {
        int a, b;
        string s;
        cin >> a >> s >> b;
        if (s == "?")
        {
            break;
        }
        else
        {
            if (s == "+")
            {
                cout << a + b << endl;
            }
            else if (s == "-")
            {
                cout << a - b << endl;
            }
            else if (s == "*")
            {
                cout << a * b << endl;
            }
            else if (s == "/")
            {
                cout << a / b << endl;
            }
        }
    }
}

int main(int argc, char const *argv[])
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();

    return 0;
}



Measured memory_bytes: 3192
// AOJ 0291 Mystery of an Ancient Ruin
// 2018.2.15 bal4u

#include <stdio.h>
#include <string.h>
#include <ctype.h>

#define SIZE 500

int N, K;
int parts[26][12];
int ans[12];
char buf[1002], *p;

int spool[SIZE+1][12];
char used[SIZE+1]; int top;

int new() { int i, k;	// malloc
	used[k=i=top] = 1;
	while (++i < SIZE) if (!used[i]) { top = i; break; }
	return k;
}

void dis(int k) { used[k] = 0; if (k < top) top = k; }	// free

int in()
{
	int n = 0;
	while (isdigit(*p)) n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int gcd(int a, int b) {	int r;
	while (b != 0) r = a % b, a = b, b = r;
	return a;
}
int lcm(int a, int b) {	return a/gcd(a, b)*b; }

void link(int *a, int *b)
{
	int i, *t, _t;

	t = spool[_t=new()];
	memcpy(t, a, sizeof(ans));
	for (i = 0; i < N; i++) a[i] = t[b[i]];
	dis(_t);
}

int period(int *a)
{
	int i, x, t, ans;

	ans = 1;
	for (i = 0; i < N; i++) {
		x = a[i], t = 1;
		while (x != i) x = a[x], t++;
		ans = lcm(ans, t);
	}
	return ans;
}
 
void calc(int *a)
{
	int i, n;
	int *t, _t;

	for (i = 0; i < N; i++) a[i] = i;
	while (*p >= ' ') {
		if (isalpha(*p)) link(a, parts[*p++ - 'A']);
		else {
			n = in();
			t = spool[_t=new()];
			if (isalpha(*p)) memcpy(t, parts[*p++ - 'A'], sizeof(ans));
			else { p++, calc(t); }
			n %= period(t);
			while (n--) link(a, t);
			dis(_t);
		}
		if (*p <= ' ' || *p++ == ')') break;
	}
}
 
int main()
{
	int E, i, j, k, h, g;
	int *t;

	fgets(p=buf, 10, stdin), N = in(), p++, K = in();
	for (i = 0; i < K; i++) {
		fgets(p=buf, 10, stdin);
		t = parts[*p - 'A'], p+= 2, h = in();

		for (j = 0; j < N; j++) t[j] = j;
		for (k = 1; k < h; k++) {
			fgets(p=buf, 30, stdin);
			for (j = 1; j < N; j++, p+=2) if (*p & 1) {
				g = t[j], t[j] = t[j-1], t[j-1] = g;
			}
		}
	}

	fgets(p=buf, 10, stdin), E = in();
	while (E--) {
		fgets(p=buf, 1002, stdin);
		calc(ans);
		printf("%d", ans[0]+1);
		for (j = 1; j < N; j++) printf(" %d", ans[j]+1);
		putchar('\n');
	}
	return 0;
}


Measured memory_bytes: 2056
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**10
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    S = LSS()
    stk = []
    for i in S:
        if i in ['+', '-', '*']:
            a = stk.pop()
            b = stk.pop()
            if i=='+':
                stk.append(b+a)
            elif i=='-':
                stk.append(b-a)
            elif i=='*':
                stk.append(b*a)
        else:
            stk.append(int(i))

    print(stk[0])

if __name__ == '__main__':
    resolve()


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

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;

string res;
ll sum = 0;

int main()
{
    ll n, k;
    cin >> n >> k;

    for (ll i = 0; i < n; i++)
    {
        ll a;
        cin >> a;

        sum += 2 * min(a, k - a);
    }

    println(sum);
}


Measured memory_bytes: 3608
h1, a1, h2, a2 = map(int, input().split())

h2 -= a1
while True:
    if h2 > 0:
        h1 -= a2
    else:
        print("Yes")
        break
    if h1 > 0:
        h2 -= a1
    else:
        print("No")
        break

Measured memory_bytes: 9176
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

readInt = fst . fromJust . BS.readInt

readIntList = map readInt . BS.words

getIntList = readIntList <$> BS.getLine

main = do
  [w, h, x, y] <- getIntList
  let s = ((fromIntegral w :: Double) * (fromIntegral h :: Double)) / 2
  if (fromIntegral w :: Double) / 2 == (fromIntegral x :: Double) && (fromIntegral h :: Double) / 2 == (fromIntegral y :: Double)
    then putStrLn $ unwords [show s, "1"]
    else putStrLn $ unwords [show s, "0"]


Measured memory_bytes: 3888
# xメートルの地点での平均気温は T−x*0.006度
#input
input()
T, A = map(int, input().split())
H=list(map(int, input().split()))

S=[((T-i*0.006)-A)**2 for i in H]

#インデックス（Sから最小のSを返す）
print(S.index(min(S))+1)

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

const int MAX = 110;
const long long int INF = 1e10;
long long int d[MAX][MAX];
int V;
void warshall_floyd() {
	for (int k = 0; k < V; k++)
		for (int i = 0; i < V; i++)
			for (int j = 0; j < V; j++)
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
}
int main() {
	int E,s,t;
	long long int a,b=0;
	cin >> V >> E;
	for (int i = 0; i < 110; i++)
		for (int j = 0; j < 110; j++)
			d[i][j] = INF;
	for (int i = 0; i < 110; i++)d[i][i] = 0;
	for (int i=0; i < E; i++) {
		cin >> s >> t >> a;
		d[s][t] = a;
	}
	warshall_floyd(); 
	for (int i = 0; i < V; i++) {
		if (d[i][i] != 0) {
			cout << "NEGATIVE CYCLE" << endl;
			return 0;
		}
	}
	for (int i = 0; i < V; i++) {
		
	
		for (int j = 0; j < V; j++) {
			if (d[i][j] >= 5*1e9) {
				if (j!=0)cout << " ";
				cout << "INF";
			}
			else {
				if (j!=0)cout << " ";
				cout << d[i][j] ;
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

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

    string ans;
    if(a>b) ans = "GREATER";
    else if(a<b) ans = "LESS";
    else ans = "EQUAL";
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;
class Main{
	public static void main(String[] args){
	int h =0;
	int w =0;
	int t =0;
	Scanner scan = new Scanner(System.in);
	ArrayList<Integer> listw = new ArrayList<Integer>();
	ArrayList<Integer> listh = new ArrayList<Integer>();
		while(scan.hasNextLine()){
			h = scan.nextInt();			
			w = scan.nextInt();
			
			if(h==0 && w==0){
				break;
			}
			else{
				listh.add(h);
				listw.add(w);
			}
		}
		
		
		
		for(int i=0;i<listh.size();i++){
			for(int ii=0;ii<listh.get(i);ii++){
				for(int iii=0;iii<listw.get(i);iii++){
					if(ii%2 == 0){
							if(iii%2 == 0){
								System.out.print("#");
							}
							else{
								System.out.print(".");
							}
					}
					else{
							if(iii%2 == 0){
								System.out.print(".");
							}
							else{
								System.out.print("#");
							}
					}
				}
			System.out.println("");
			}
		System.out.println("");
		}
	}
}

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

signed main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string s; cin >> s;
    if(s == "SUN") cout << 7 << endl;
    if(s == "MON") cout << 6 << endl;
    if(s == "TUE") cout << 5 << endl;
    if(s == "WED") cout << 4 << endl;
    if(s == "THU") cout << 3 << endl;
    if(s == "FRI") cout << 2 << endl;
    if(s == "SAT") cout << 1 << endl;

    return 0;
}

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

#define Rep(b, e, i) for(int i = b; i <= e; i++)
#define Repr(e, b, i) for(int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n-1, i)
#define repr(n, i) Repr(n-1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)),(v).end())
#define bitcnt(x) __builtin_popcount(x)

//vector の中身を出力
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

typedef long long ll;

void func(vector <ll> v){
    for (int i : v) {
        printf("%3d", i);
    }
    printf("\n");
    if ((int)v.size() == 1) return;
    int n = (int)v.size()-2;
    vector <ll> vv(n), mid(3);
    rep(n, i) {
        rep(3, j) mid[j] = v[i+j];
        sort(all(mid));
        vv[i] = mid[1];
    }
    func(vv);
}

void solve(void){
    ll N, x;
    cin >> N >> x;
    if (x == 1 || x == 2*N-1) {
        cout << "No" << endl;
        return;
    }
    cout << "Yes" << endl;
    if (N == 2) {
        cout << "1 2 3" << endl;
        return;
    }
    vector <ll> ans(2*N-1, 0);

    if (x == 2 || x == 2*N-2) {
        bool f = x == 2;
        ans[N-2] = 2;
        ans[N-1] = 1;
        ans[N-3] = 3;
        ans[N] = 4;
        ll n = 5;
        rep(2*N-1, i) {
            if (i >= N-3 && i <= N) continue;
            else ans[i] = n++;
        }

        if (f) {
            rep(2*N-1, i) {
                printf("%lld\n", ans[i]);
            }
        }
        else {
            rep(2*N-1, i) {
                printf("%lld\n", 2*N-ans[i]);
            }
        }
        //func(ans);
        return;
    }
    ll n = 3+(x==3);

    rep(2*N-1, i) {
        if (i == N-1) {
            ans[i] = x;
        }
        else if (i==N-2) {
            ans[i] = 1LL;
        }
        else if (i==N) {
            ans[i] = 2*N-1;
        }
        else if (i==N-3) {
            ans[i] = 2*N-2;
        }
        else if (i==N+1) {
            ans[i] = 2LL;
        }
        else {
            ans[i] = n++;
            if (n==x) n++;
        }
    }

    rep(2*N-1, i) {
        printf("%lld\n", ans[i]);
    }/*
    func(ans);
    sort(all(ans));
    uniq(ans);
    if ((int)ans.size() != 2*N-1) {
        cout << "yui(*-v・)yui" << endl;
    }*/

}

int main(void){
  solve();
  //cout << "yui(*-v・)yui" << endl;
  return 0;
}


Measured memory_bytes: 3072
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main(){
    int x,n;
    cin>>x>>n;
    map<int,int> m;
    for(int i=0; i<n; i++){
        int a;
        cin>>a;
        m[a]++;
    }
    for(int i=0;;i++){
        if(!m[x-i]){
            cout<<x-i<<endl;
            return 0;
        }
        if(!m[x+i]){
            cout<<x+i<<endl;
            return 0;
        }
    }
}


Measured memory_bytes: 3632
process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
 var i = 3;
 var count = 0;
 var one = lines[0].split(' '); 
 var two = lines[1].split(' ');
 var three = lines[2].split(' ');

 while(lines[i] !== undefined){
    if(one.indexOf(lines[i]) !== -1){
      var index = one.indexOf(lines[i]);
      one[index] = "0";
    }
    if(two.indexOf(lines[i]) !== -1){
      var index = two.indexOf(lines[i]);
      two[index] = "0";
    }
    if(three.indexOf(lines[i]) !== -1){
      var index = three.indexOf(lines[i]);
      three[index] = "0";
    }
    i++;
 }

 if((one[0] == "0" && one[1] == "0" && one[2] == "0") || 
    (two[0] == "0" && two[1] == "0" && two[2] == "0") ||
    (three[0] == "0" && three[1] == "0" && three[2] == "0")){
   count++;
 }
 if((one[0] == "0" && two[0] == "0" && three[0] == "0") || 
    (one[1] == "0" && two[1] == "0" && three[1] == "0") ||
    (one[2] == "0" && two[2] == "0" && three[2] == "0")){
   count++;
 }
 if((one[0] == "0" && two[1] == "0" && three[2] == 0) ||
    (one[2] == "0" && two[1] == "0" && three[0] == 0)){
      count++;
    }

    if(count != 0){
      console.log("Yes");
    }else{
      console.log("No");
    }
 
 
});

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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
//Write From this Line

int main()
{
	int n, t;
	cin >> n >> t;
	vector<int> a(n);
	rep(i, n)cin>>a[i];
	int m = a[0];

	int big = 0;
	map<int,int> mp;
	rep(i,n){
		// 今売ると
		int mon = a[i] - m; // mon円の利益が出ます。
		if(chmax(big,mon)) mp[big] ++;
		else {
			if(big == mon) mp[big] ++;
		}
		chmin(m,a[i]);
	}
	cout << mp[big] << endl;
}


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

const int N = 100010;
vector<pair<int, int>> G[N]; // {vertex, cost}
vector<int> Color(N);

int n;

void dfs(int now, int pre, int oe){
    for(int i = 0; i < G[now].size(); i++){
        int to = G[now][i].first;
        if(to == pre) continue;

        int cost = G[now][i].second;
        if(cost == 0){
            Color[to] = Color[now];
            dfs(to, now, oe);
        }else{
            Color[to] = Color[now] ^ 1;
            dfs(to, now, oe ^ 1);
        }
    }
}

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

    cin >> n;
    for(int i = 0; i < n - 1; i++){
        int u, v, w;
        cin >> u >> v >> w;
        u--; v--;
        G[u].push_back({v, w % 2});
        G[v].push_back({u, w % 2});
    }

    dfs(0, -1, 0);

    for(int i = 0; i < n; i++){
        cout << Color[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pi pair<int , int>
#define f first
#define s second
int32_t main(){
     int n; std::cin >> n;
     int arr[n];
     for(int i = 0 ; i < n ;i++){
         cin>>arr[i];
     }
     sort(arr , arr+n);
      multiset<pi> st;
     st.insert({arr[n-1] , arr[n-1]});
     int ans = 0;
     for(int i = n-2 ; i>= 0 ; i--){
            pi val = *st.rbegin();
            st.erase(st.find(val));
            ans += val.f;
            st.insert({min(arr[i],val.f) , max(val.f , arr[i])});
            st.insert({min(arr[i],val.s) , max(val.s , arr[i])});
     }
     cout<<ans<<endl;
     
     
}

Measured memory_bytes: 17684
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

//完全に解いた場合の組み合わせのみ考える
//G点を目指す
int main(){

//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());
    
//    ios::sync_with_stdio(false);
//    cin.tie(0);
    ll d,g;
    cin >> d >> g;

    vector <ll> p(d);
    vector <ll> c(d);
    ll iMin = INF;
    REP(i,d)
    {
        cin >> p[i] >> c[i];
    }

    for(int bit = 0; bit < (1 << d); ++bit)
    {
        ll cnt = 0;
        ll res = 0;

        for(int i = 0; i < d; ++i)
        {
            if(res >= g)break;
            if(bit & (1 << i))
            {
                //全部解けるなら
                res += (i + 1) * p[i] * 100;
                res += c[i];
                cnt += p[i];
            }
        }

        for(int i = d-1; i >= 0; --i)
        {
            if(res >= g)break;
            if(!(bit & (1 << i)))
            {
                //zanの消化
                for(int j = 0; j < p[i]; ++j)
                {
                    if(res >= g)break;
                    res += (i + 1) * 100;
                    ++cnt;
                }
                break;
            }
        }

        if(res >= g)
        {
            iMin = min(iMin,cnt);
        }
    }


    cout << iMin << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){

    int N;
    long long int A[200000] = {0};
    long long int len = 0, ans1, ans2;
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        len += A[i];
    }

    long long int half = len / 2;
    long long int left = 0, right = 0;
    int half_ix = 0;

    while(left < half){
        left += A[half_ix++];
    }

    right = len - left;

    ans1 = left - right;
    ans2 = right - left + A[half_ix - 1] * 2;

    cout << ((ans1<ans2)?ans1:ans2) << endl;

    return 0;
}

Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
const int MAXN = 2 * int(1E5);
int A[MAXN + 5];
int main() {
	int N;
	scanf("%d", &N);
	for(int i=1;i<=N;i++)
		scanf("%d", &A[i]);
	long long ans = 0;
	int s = 1, t = 0, p = 0;
	while( t < N ) {
		while( t < N && ( p & A[t+1] ) == 0 ) {
			t++;
			ans = ans + (t-s+1);
			p ^= A[t];
		}
		while( s <= t && ( p & A[t+1] ) != 0 ) {
			s++;
			p ^= A[s-1];
		}
	}
	printf("%lld\n", ans);
}

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

#define pb push_back
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n,s) for(int i=(s);i<(n);i++)
#define rrep(i,n) for(int i=(n-1);i>=0;i--)
#define rreps(i,n,s) for(int i=s;i>=n;i--)
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 (a>b) { a=b; return 1; } return 0; }

using ll = long long;
using namespace std;
constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int MOD = 1000000007;

int main(){
cin.tie(0);
ios::sync_with_stdio(false);
int a,b,k;
cin >> k >> a >> b;
bool ok=false;
reps(i,b+1,a){
  if(i%k==0)
    ok = true;
}
if(ok){
  cout << "OK" << endl;
}
else{
  cout << "NG" << endl;
}
return 0;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
inline int read(){
	int x=0,f=1;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	return x*f;
}
#define mid (l+r>>1)
int a[15],dig;
char c[14];
long long ans,digi[15];
bool check(long long x){
	printf("? %lld\n",x);
	fflush(stdout);
	scanf("%s",c);
	if(c[0]=='Y') return 1;
	return 0;
}
main(){
	digi[0]=1;dig=1;
	for(int i=1;i<=9;i++){
		digi[i]=digi[i-1]*10;
		printf("? %lld\n",digi[i]);
		fflush(stdout);
		scanf("%s",c);
		if(c[0]=='N') break;
		dig++;
	}
	if(dig==10){
		int len;
		for(len=0;len<9;++len){
			printf("? %lld\n",digi[len+1]-1);
			fflush(stdout);
			scanf("%s",c);
			if(c[0]=='Y') break;
		}
		printf("! %lld\n",digi[len]);
		fflush(stdout);return 0;
	}
	for(int i=1;i<=dig;++i){
		int l=i==1,r=9;
		while(l<r){
			if(check((ans+mid*digi[dig-i])*10+digi[dig-i+1]-1)) r=mid;
			else l=mid+1;
		}
		ans+=l*digi[dig-i];
	}
	printf("! %lld\n",ans);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll k, a, b, judge=0, i;

    cin >> k >> a >> b;

    for(i=a; i<=b; i++){
        if(i%k==0) judge = 1;
    }

    if(judge==1) cout << "OK" << endl;
    else cout << "NG" << endl;

    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define rep(i,n) for(int (i) = 0;(i) < (n);(i)++)
#define SORT(c) sort((c).begin(),(c).end())
#define MOD 1000000007
//S.size()
//配列名.Length()
using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<bool> VB;
typedef unsigned long long ll;


int main(void){
	string S; cin>>S;

	bool jud = false;
	int cnt = 0;

	for(int i = 0; i < S.size(); i++){
		cnt = 0;
		for(auto x: S){
			if(S[i] == x)cnt++;
		}
		if(cnt != 1)jud = true;
	}
	cout<<(jud? "no":"yes");
}


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

using namespace std;

int main(){

    int H,W,N;

    cin>>H>>W>>N;

    int r;

    if (W<H){

        if(N%H==0){
            r=N/H;
        }
        else r=(N/H)+1;

    }
    else if(H<W){
         if(N%W==0) r=N/W;
         else r=(N/W)+1;

    }
    else{
    if(N%W==0) r=N/W;
         else r=(N/W)+1;

    }

     cout<<r<<" ";
return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
// 217
// 44

using namespace std;

struct DSU {
    vector <int> par;
    int n;
    inline void init(int _n) {
        n = _n;
        par.resize(n + 1);
    }
    int root(int x) {
        if(par[x] == 0)
            return x;
        return par[x] = root(par[x]);
    }
    inline void join(int x, int y) {
        x = root(x), y = root(y);
        if(x != y) {
            par[x] = y;
        }
    }
};


int main() {
    //ifstream cin("A.in");
    //ofstream cout("A.out");
    int n, i, j;
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    cin >> n;

    vector <ll> x(n + 1), y(n + 1);
    for(i = 1; i <= n; i++) {
        cin >> x[i] >> y[i];
    }

    int ans = n;
    for(int a = 1; a <= n; a++) {
        for(int b = 1; b <= n; b++) {
            if(a == b) {
                continue;
            }

            int dx = x[b] - x[a], dy = y[b] - y[a];
            DSU dsu; dsu.init(n);

            int cur = n;
            for(i = 1; i <= n; i++) {
                for(j = 1; j <= n; j++) {
                    if(x[j] - x[i] == dx && y[j] - y[i] == dy) {
                        if(dsu.root(i) != dsu.root(j)) {
                            dsu.join(i, j);
                            cur--;
                        }
                    }
                }
            }

            ans = min(ans, cur);

        }
    }

    cout << ans;

    //cin.close();
    //cout.close();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
 
ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
 
ll gcd(ll a, ll b){
    if(b == 0)  return a;
    return gcd(b, a%b);
}

typedef vector<double> VD;
typedef vector<VD> VVD;
typedef vector<int> VI;

int a,b,c;
int main()
{
	scanf("%d%d%d",&a,&b,&c);
	int num1 = 0,num2=0,num3=0;
	while(a%2 == 0)
	{
		a = a/2;
		num1++;
	}

	while(b%2 == 0)
	{
		b = b/2;
		num2++;
	}

	while(c%2 == 0)
	{
		c = c/2;
		num3++;
	}
	if(num1 == 0 || num2 == 0 || num3 == 0)
	{
		printf("0\n");
		return 0;
	}
	if(a == b && b == c)
	{
		printf("-1\n");
		return 0;
	}
	if(num1 == num2 && num2 == num3)
	{
		printf("%d\n",num1+1);
		return 0;
	}
	printf("%d\n",min(num1,min(num2,num3)));
	

	return 0;
}

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

public class Program
{

    public void Proc()
    {
		int[] nums = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
		int proc = int.Parse(Reader.ReadLine());
		int mul = (int)Math.Pow(2, proc);
		int max = nums.Max();

		int ans = nums.Sum() - max + max * mul;
		Console.WriteLine(ans);

	}


	public class Reader
    {
        static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"


3 3 4
2



";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}

Measured memory_bytes: 13396
#include<iostream>
#include<vector>

using namespace std;
int main() {
  int N, M, C;
  cin >> N >> M >> C;
  int b;
  vector<int> B;
  for (int i = 0; i < M; ++i) {
    cin >> b;
    B.push_back(b);
  }
  int a;
  int num = 0;
  for (int k = 0; k < N; ++k){
  int sum = 0;
  for (int i = 0; i < M; ++i) {
    cin >> a;
    sum += a * B[i];
  }
  if (sum + C > 0) {
    ++num;
  }
}
  cout << num << endl;
  return 0;
}


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

#define itn int
#define all(x) (x).begin(), (x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())

#define random_shuffle(...) shuffle(__VA_ARGS__, rng)
#define rand() rng()

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

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

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

	{
		vector<int> b = {a[0]};
		for (int i = 1; i < n; ++i) {
			if (a[i] != b.back()) {
				b.push_back(a[i]);
			}
		}
		a.swap(b);
	}
	// make_unique(a);
	n = a.size();

	const int mod = 1000000007;
	vector<long long> dp(n + 1);
	dp[0] = 1;

	map<int, long long> cur_dp;

	for (int i = 0; i < n; ++i) {
		auto x = cur_dp[a[i]];
		cur_dp[a[i]] = dp[i + 1] = (dp[i] + x) % mod;
	}

	cout << dp[n] << "\n";

	return 0;
}

Measured memory_bytes: 15076
#include <bits/stdc++.h>
typedef long long ll;
 
using namespace std;
const int INF = 1e9 + 5;
int main(){
    int n, k; cin >> n >> k;
    set<int> s;
    for(int i = 0; i < k; i++) {
        int d; cin >> d;
        for(int j = 0; j < d; j++) {
            int x; cin >> x;
            s.insert(x);
        }
    }
    cout << n - s.size();
    return 0;
}

Measured memory_bytes: 3604
from collections import Counter
n = int(input())
lists = list(input())
l = dict(Counter(lists))
for i in range(n-1):
  tmp_l = dict(Counter(list(input())))
  for key in l.keys():
    if key not in tmp_l.keys():
      l[key] = 0
    elif l[key] > tmp_l[key]:
      l[key] = tmp_l[key]

string = ""
for key in l:
  string += ''.join([key for _ in range(l[key])])
    
l = list(string)
l.sort()

string = ''.join(l)
print(string)

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long
#define ld long double
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
const int mod = 1e9 + 7;
int main()
{
	SPEED
	int n,m;
	cin >> n >> m;
	cout << (n*(n-1))/2 + (m*(m-1))/2;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
#define LL long long
#define PP pair<int, int>
int N;
int v[100010];
int A[100010];
int B[100010];
int V = 1e5;
vector<PP> AS;
vector<PP> BS;
int main(){
	cin >> N;
	int ans = N;
	for(int i = 0; i < N; i++){
		cin >> v[i];
	}
	for(int i = 0; i < N; i += 2){
		A[v[i]]++;
	}
	for(int i = 1; i <= V; i++){
		AS.push_back({A[i], i});
	}
	for(int i = 1; i < N; i += 2){
		B[v[i]]++;
	}
	for(int i = 1; i <= V; i++){
		BS.push_back({B[i], i});
	}
	sort(AS.rbegin(), AS.rend());
	sort(BS.rbegin(), BS.rend());
	if(AS[0].second != BS[0].second){
		ans -= AS[0].first + BS[0].first;
	}else{
		ans -= max(AS[0].first + BS[1].first, BS[0].first + AS[1].first);
	}
	cout << ans << endl;
	return 0;
}

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

struct disjoint_set{
  size_t n;
  vector<int> par;
  disjoint_set(){}
  disjoint_set(size_t _n):n(_n){
    par.resize(n,-1);
  }
  void reset(size_t _n){
    n = _n;
    par.clear();
    par.resize(n,-1);
  }
  int root(int k){
    while(par[k]>=0){
      k = par[k];
    }
    return k;
  }
  int size(int k){
    k = root(k);
    return -par[k];
  }
  auto operator[](int k){
    return size(k);
  }
  bool connect(int a,int b){
    a = root(a);
    b = root(b);
    if(a==b)return false;
    if(size(a)<size(b))swap(a,b);
    par[a] += par[b];
    par[b] = a;
    return true;
  }
  auto operator()(int a,int b){
    return connect(a,b);
  }
  bool same(int a,int b){
    return root(a) == root(b);
  }
};

signed main(){

  int n,m,k;
  cin>>n>>m>>k;
  disjoint_set st(n);
  vector<int> deg(n);
  for(int _{0};_<m;++_){
    int a,b;
    cin>>a>>b;
    a--;b--;
    st(a,b);
    deg[a]++;
    deg[b]++;
  }
  for(int _{0};_<k;++_){
    int c,d;
    cin>>c>>d;
    c--;d--;
    if(st.same(c,d)){
      deg[c]++;
      deg[d]++;
    }
  }
  for(int v{0};v<n;++v){
    cout<<(st[v]-deg[v]-1)<<" ";
  }
  cout<<endl;

}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define repk(i,k,n) for (ll i = k; i < (ll)(n); ++i)
#define MAX 500000001000000000
#define MOD 1000000007
typedef long long  ll;

using namespace std;

int ans, cnt;

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

	int N,K;
	cin >> N >> K;

	int d, a;
	map<int, int> m;
	rep(i, K) {
		cin >> d;
		rep(i, d) {
			cin >> a;
			m[a]++;
		}
	}
	
	for (auto p : m) {
		cnt++;
	}
	cout << N - cnt << endl;
	
	return 0;
}

Measured memory_bytes: 3668
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define forn(i, n) for (int i = 0; i < (n); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define for1(i, n) for (int i = 1; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()


const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
    freopen("a.in","r",stdin);
    #endif
    int t;
    t=1;
    while (t--)
    {
        string s;
        cin>>s;
        int n=s.size();
        for (int i=0;i<n;i++)
        {
            if (s[i]=='?')
                s[i]='D';
        }
        cout<<s<<'\n';
    }



}

Measured memory_bytes: 3780
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>

using namespace std;
vector<int> hon[11];
int dp[2][2010],dp2[2][2010];

int main(){
	int N,K,a,b,kaz,cnt,hog;
	vector<int>::iterator it;
	cin>>N>>K;
	for(int i=0;i<N;i++){
		cin>>a>>b;
		hon[b].push_back(a);
	}
	int I,O,II,OO;
	I=1;O=0;II=1;OO=0;
	
	memset(dp2[II],-1,sizeof(dp[II]));
	memset(dp2[OO],-1,sizeof(dp[OO]));
	dp[I][0]=dp2[II][0]=cnt=0;
	for(int i=1;i<=10;i++){
		kaz=min((int)hon[i].size(),K);
		cnt=min(cnt+kaz,K);
		memset(dp[I],-1,sizeof(dp[I]));
		dp[I][0]=0;
		for(it=hon[i].begin();it!=hon[i].end();it++){
			dp[O][0]=dp[I][0];
			for(int j=1;j<=kaz;j++){
				if(dp[I][j-1]!=-1)dp[O][j]=max(dp[I][j],dp[I][j-1]+(*it));
				else dp[O][j]=dp[I][j];
			}
			swap(I,O);
		}
		for(int j=1;j<=kaz;j++){
			dp[I][j]+=j*(j-1);
		}
		for(int j=0;j<=cnt;j++){
			hog=0;
			for(int k=0;k<=kaz;k++){
				if(j-k>=0&&dp2[II][j-k]!=-1)hog=max(hog,dp2[II][j-k]+dp[I][k]);
			}
			dp2[OO][j]=hog;
		}
		cnt+=kaz;
		swap(II,OO);
	}
	hog=0;
	for(int i=0;i<=K;i++){
		hog=max(hog,dp2[II][i]);
	}
	cout<<hog<<endl;
	return 0;
}

Measured memory_bytes: 1264
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>

#define ll long long
#define REP(i,n) for(int i = 0; i < n; i++)
#define PI 3.141592653589

using namespace std;

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

void solve_A(){
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5]) cout << "Yes";
    else cout << "No";
}

void solve_B(){
    int x;
    cin >> x;
    int ctr_500 = 0, ctr_5 = 0;
    
    while(x >= 500){
        x -= 500;
        ctr_500 ++;
    }

    while(x >= 5){
        x -= 5;
        ctr_5 ++;
    }
    
    cout << ctr_500 * 1000 + ctr_5 * 5;
}

void solve_C(){
    int k, n;
    cin >> k >> n;

    int a[n];
    REP(i,n) cin >> a[i];

    int dist[n]; //startがn番目
    int min = 100000000;
    REP(i,n){
        int index = (n - 1 + i) % n;
        if(a[index] - a[i] < 0){
            dist[i] = a[index] - a[i] + k;
        } else{
            dist[i] = a[index] - a[i];
        }

        if(min > dist[i]) min = dist[i];
    }

    cout << min;
}

int main(void){
    solve_C();
    
    return 0;
}

Measured memory_bytes: 1792
use text_io::*;
use std::collections::*;
use std::process::exit;

fn main() {
    let mut n:usize = read!();
    let mut va:Vec<usize>= Vec::new();
    for i in 0..n {
        let a:usize = read!();
        va.push(a);
    }
    let mut sum:usize = 0;
    for i in 0..n {
        let b:usize = read!();
        sum += b;
    }
    let mut vc:Vec<usize> = Vec::new();
    for i in 0..n-1 {
        let c:usize = read!();
        vc.push(c);
    }
    for i in 1..n {
        if va[i-1]+1==va[i] {
            sum+=vc[va[i-1]-1];
        }
    }
    println!("{}",sum);
}

Measured memory_bytes: 2184
#include <bits/stdc++.h>
#define INF 1e18
#define MOD 1000000007
#define PI M_PI
#define ll long long
#define vi vector<int>
#define all(v) v.begin(), v.end()
#define FOR(i, a, b) for (int i=a; i<b; i++)
#define REP(i, n) for (int i=0; i<n; i++)
#define REPD(i, n) for (int i=n-1; i>=0; i--)
#define print(x) cout << x << endl;
#define debug(x) cout << #x << " = " << endl;

using namespace std;

void solve()
{
    string S;
    cin >> S;

    int a = stoi(S.substr(0, 2));
    int b = stoi(S.substr(2, 2));

    if (((a >= 1) && (a <= 12)) && ((b >= 1) && (b <= 12))) {
        print("AMBIGUOUS");
    } else if ((a >= 1) && (a <= 12)) {
        print("MMYY");
    } else if ((b >= 1) && (b <= 12)) {
        print("YYMM");
    } else {
        print("NA");
    }

}

int main()
{
    solve();

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define _0 first
#define _1 second
typedef pair<int,int>pii;
typedef pair<pair<pii,pii>,pii>pp_p;

int N;
const int B=1<<18;
pii s[2*B];

pii d(int i){
	if(i<B){
		return s[i]=min(d(i*2-i%2),d(i*2+2-i%2));
	}else{
		return s[i];
	}
}

pp_p rmq(pii lr){
	auto f=[](int l,int r){
		pii t=s[l+=B],u=s[r+=B];
		for(;l/4<r/4;l=l/4*2+l%2,r=r/4*2+r%2){
			t=l&2?t:min(t,s[l+2]);
			u=r&2?min(s[r-2],u):u;
		}
		return min(t,u);
	};
	pii x,y;
	x=f(lr._0,lr._1-2);
	y=f(x._1+1,lr._1-1);
	return{{x,y},lr};
}

main(){
	for(int i=2;i<2*B;++i){
		s[i]={B,B};
	}
	cin>>N;
	for(int i=0;i<N;++i){
		int p;
		cin>>p;
		s[B+i]={p,i};
	}
	d(2);
	d(3);
	priority_queue<pp_p,vector<pp_p>,greater<pp_p>>pq;
	pq.push(rmq({0,N}));
	while(pq.size()){
		auto a=pq.top();
		pq.pop();
		cout<<" "<<a._0._0._0<<" "<<a._0._1._0;
		for(auto b:(vector<pii>){{a._1._0,a._0._0._1},{a._0._0._1+1,a._0._1._1},{a._0._1._1+1,a._1._1}}){
			if(b._0<b._1){
				pq.push(rmq(b));
			}
		}
	}
}


Measured memory_bytes: 6644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順
//factorizeは、素因数分解用の関数

int main(){
	ll x;
  ll sum=100;
  ll ct = 0;
  cin >> x;
  while(sum < x){
    sum *= 1.01;
    ct += 1;
  }
  cout << ct << endl;

  return 0;
}


Measured memory_bytes: 3592
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    s = s.replaceAll("1", "2");
    s = s.replaceAll("9", "3");
    s = s.replaceAll("2", "9");
    s = s.replaceAll("3", "1");
    System.out.println(s);
  }
}

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

class Unionfind{
    public:
        vector< int > trank,p;

        Unionfind(int size){
            trank.resize(size,0);
            p.resize(size,0);
            REP(x,size) p[x]=x;
        }
        int find(int x){
            if(x==p[x]) return x;
            return p[x]=find(p[x]);
        }
        bool same(int x,int y){
            return find(x)==find(y);
        }
        void unite(int x,int y){
            x=find(x);
            y=find(y);
            if(trank[x]>trank[y]) p[y]=x;
            else {
                p[x]=y;
                if(trank[x]==trank[y]) trank[y]++;
            }
        }
};

int main(){
    int n,q;
    scanf("%d%d",&n,&q);
    Unionfind data(n);
    int com,x,y;
    REP(i,q){
        scanf("%d%d%d",&com,&x,&y);
        if(com) printf("%d\n",data.same(x,y));
        else data.unite(x,y);
    }
    return 0;
}




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

int main(){

int H,W;

while(1){

cin>>H>>W;

if(H==0&&W==0){break;}

for(int i=0;i<H;i++){

int write;

if(i%2==0){write=1;}else{write=0;}

for(int j=0;j<W;j++){

if(j%2==write){cout<<".";}else{cout<<"#";}

}

cout<<"\n";

}

cout<<"\n";

}

return 0;

}

Measured memory_bytes: 1120
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>

//#include<bits/stdc++.h>


using namespace std;


int main() {

	string p;
	cin >> p;
	for (int i = 0; i < p.size(); i++) {
		cout << p[i];
		if (i == 3)cout << " ";
	}
	cout << endl;


	return 0;

}


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

using ll = long long;
using namespace std;
const int INFint = 2e9+1;
const ll INFll = 2e18+1;
ll MOD=1e9+7;

int main(){
  int N;
  cin>>N;
  vector<int> A(N+1);
  for(int i(1);i<=N;i++) cin>>A[i];
  vector<int> ans(N+1);
  int cnt(0);
  for(int i(N);i>=1;i--){
    int tmp(i);
    int tmpi(0);
    while(N >= tmp){
      tmpi += ans[tmp];
      tmp += i;
    }
    //cout << tmpi << endl;
    if(A[i] != tmpi%2){
      ans[i] = 1;
      cnt++;
    }
    else ans[i] = 0;
  }
  cout << cnt << endl;
  for(int i(1);i<=N;i++){
    if(ans[i]) cout << i << " ";
  }
  cout << endl;
  return 0;
}

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

using namespace std;

#define llong long long int
#define ldouble long double
#define rep(i, n) for (int i = 0; i < n; ++i) 
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define stl_repr(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

constexpr static int MOD = 1000000000 + 7;
constexpr static int inf = INT_MAX / 2;
constexpr static llong INF = 1LL << 31;
constexpr static int dx[] = {1, 0, -1, 0};
constexpr static int dy[] = {0, 1, 0, -1};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a, b;
    cin >> a >> b;
    if (a >= 13) cout << b << endl;
    else if (a >= 6 && a <= 12) cout << b / 2 << endl;
    else cout << 0 << endl;
    
    return 0;
}

Measured memory_bytes: 256
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn read_col<T: std::str::FromStr>(n: usize) -> Vec<T> {
    (0..n).map(|_| read()).collect()
}

fn primer(m: u64) -> u64 {
    let end = (((m as f64).sqrt()) as u64) + 1;
    for i in 2..end {
        if m % i == 0 {
            return i;
        }
    }
    m
}

fn prime_factrization(mut m: u64) -> Vec<usize> {
    let mut ans: Vec<usize> = vec![];
    let mut tmp: u64 = 0;
    let mut l: usize = 0;
    while m > 1 {
        let prm = primer(m);
        m /= prm;
        if prm == 1 {
            break;
        } else if prm != tmp {
            tmp = prm;
            l += 1;
            ans.push(1);
        } else {
            ans[l - 1] += 1;
        }
    }
    ans
}

const R: u64 = 1000000007;

fn main() {
    let nm: Vec<u64> = read_vec();
    let n = nm[0] as usize;
    let m = nm[1];

    let mut cmb: Vec<Vec<u64>> = vec![vec![1; n]; 31];

    for i in 1..31 {
        for j in 1..n {
            cmb[i][j] = (cmb[i - 1][j] + cmb[i][j - 1]) % R;
        }
    }

    let mut ans: u64 = 1;
    let primes = prime_factrization(m);
    for p in primes {
        ans *= cmb[p][n - 1];
        ans %= R;
    }

    println!("{}", ans);
}


Measured memory_bytes: 35068