akhauriyash/Code-Regression huggingface dataset:
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <climits>
#include <set>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <complex>
#include <regex>

using namespace std;

#define SHOW_VECTOR(v) {std::cerr << #v << "\t:";for(const auto& xxx : v){std::cerr << xxx << " ";}std::cerr << "\n";}
#define SHOW_MAP(v){std::cerr << #v << endl; for(const auto& xxx: v){std::cerr << xxx.first << " " << xxx.second << "\n";}}

constexpr long long mod = 1e9 + 7;

vector<long long> get_primes(long long n) {
    vector<long long> b(n + 1, true);
    b[0] = b[1] = false;
    for (long long i = 2; i * i <= n; i++) if (b[i]) for (long long j = i * 2; j <= n; j += i)b[j] = false;
    vector<long long> primes;
    for (long long i = 0; i < b.size(); i++) if (b[i]) primes.push_back(i);
    return primes;
}

int main() {

    long long N;
    cin >> N;

    auto primes = get_primes(1000);
    //SHOW_VECTOR(primes);

    long long ans = 1;
    for (long long i = 0; i < primes.size(); i++) {
        long long cnt = 0;
        long long d = primes[i];
        while (N / d)cnt += N / d, d = d * primes[i];
        ans *= (cnt + 1);
        ans %= mod;
    }


    cout << ans << endl;

    return 0;
}
















































Measured memory_bytes: 256
#include <iostream>
#include <stdint.h>

int main(void)
{
    int n, k;
    std::cin >> n >> k;

    int minval = std::numeric_limits<int>::max();
    for (int a = 0; a <= n; ++a)
    {
        int val = 1;
        for (int i = 0; i < n; ++i)
        {
            if (i < a)
            {
                val *= 2;
            }
            else
            {
                val += k;
            }
        }
        minval = std::min<int>(minval, val);
    }
    std::cout << minval << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,k,count=0;
    scanf("%d %d",&n,&k);
    int ara[n];
    for(int y=0;y<n;y++){
        scanf("%d",&ara[y]);
    }
    for(int y=0;y<n;y++){
        if(ara[y]>=k)
        {
            count++;
        }
    }
    printf("%d\n",count);
    return 0;

}


Measured memory_bytes: 512
N, M = map(int, input().split())
AB = []

for _ in range(N):
  A, B = map(int, input().split())
  AB.append((A, B))

AB.sort()

i = 0
ans = 0

while M > 0:
  A, B = AB[i]
  if B <= M:
    ans += A * B
    M -= B
  else:
    ans += A * M
    M = 0
  i += 1

print(ans)

Measured memory_bytes: 22856
#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 N, i, A[200001], B[200001]={0};

    cin >> N;

    for(i=2; i<=N; i++){
        cin >> A[i];
        B[A[i]]++;
    }

    for(i=1; i<=N; i++){
        cout << B[i] << endl;
    }

    return 0;
}

Measured memory_bytes: 6772
#include <cstring>
#include <cassert>
#include <utility>
#include <iostream>
#include <cstdio>
#include <iomanip>
#include <bitset>
#include <chrono>
#include <cstdlib>
#include <functional>
#include <tuple>
#include <climits>
#include <limits>
#include <deque>
#include <list>
#include <array>
#include <stack>
#include <queue>
#include <random>
#include <complex>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
 
#define init ios::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL);
#define setpr(x) cout << setprecision((x))
#define PI atan(1)*4
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define mk(a , b) { min((a) , (b)) , max((a) , (b)) }
#define flush cout.flush()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endc "\n"
#define MOD 1000000007
#define meme(x) memset((x), 0, sizeof((x)))
#define memo(x) memset((x),-1, sizeof((x)))
 
using namespace std;

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

// #define int ll

ll egcd(ll a, ll b, ll &x, ll &y){
    if (a == 0LL){  
        x = 0LL;  
        y = 1LL;  
        return b;  
    }
    ll xx, yy;
    ll val = egcd(b % a, a, xx, yy);  
    x = yy - (b / a) * xx;  
    y = xx;  
    return val;
}

ll gcd(ll a, ll b){
    while(true){
        if(a>b)
            swap(a,b);
        if (a == 0) 
            return b; 
        ll p = b % a  , q = a;
        a = p;
        b = q;
    }
}
 
ll powerMod(ll x,ll y){
    ll res = 1;
    x %= MOD;
    while(y > 0){
        if(y & 1)res = (res*x)%MOD;
        y = y >> 1;
        x = (x * x)%MOD;
    }
    return res%MOD;
}

//  ==========      //\\       //||     ||====//||
//      ||         //  \\        ||     ||   // ||
//      ||        //====\\       ||     ||  //  ||
//      ||       //      \\      ||     || //   ||
//  ==========  //        \\  ========  ||//====|| 
//  code

void solve(){
    int n,i,j,k,l,p;
    cin >> n;
    vector<double> prob(n);
    vector< vector< double > > dp(n + 1, vector<double>(n + 1, 0));

    dp[0][0] = 1;
    for(auto &i : prob)cin >> i;

    for(j = 0; j <= n; j++){
        for(i = 0; i < n; i++){
            dp[i + 1][j] = dp[i][j] * (1 - prob[i]);
            if(j)
                dp[i + 1][j] += dp[i][j - 1] * prob[i];
        }
    }

    double ans = 0;
    for(i = n / 2 + 1; i <= n; i++){
        ans += dp[n][i];
    }
    setpr(20);
    cout << ans << endc;
}

int32_t main(){
    init;
    int t = 1;
    // cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 73588
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
 
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StringBuilder builder = new StringBuilder();
        String line;
        String[] columns;
        int x, y;
        line = reader.readLine();
        columns = line.split(" ");
        y = Integer.parseInt(columns[0]);
        x = Integer.parseInt(columns[1]);
        int[] total = new int[x+1];
 
        for (int i = 0; i < y; i++) {
            int sum = 0;
            line = reader.readLine();
            columns = line.split(" ");
            for (int j = 0; j < x; j++) {
                sum += Integer.parseInt(columns[j]);
                builder.append(columns[j])
                        .append(" ");
                total[j] += Integer.parseInt(columns[j]);
            }
            builder.append(sum)
                    .append("\n");
            total[x] += sum;
        }
        for (int i = 0; i < x + 1; i++) {
            if ( i != 0 ) {
                builder.append(" ");
            }
            builder.append(total[i]);
        }
//        builder.append("\n");
//        System.out.print("\n");
        System.out.println(builder);
    }
}

Measured memory_bytes: 27264
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n;
	cin>>n;
	int s[n+1];
	for(int i=1;i<=n;i++) cin>>s[i];
	int min=-1,f=0;
	for(int i=1;i<=100;i++) {
		f=0;
		for(int j=1;j<=n;j++) {
			f+=fabs(s[j]-i)*fabs(s[j]-i);
		}
		if(f<min || min==-1) min=f;
	}
	cout<<min<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
namespace aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
			string input;
			while((input = Console.ReadLine()) != null){
				string output = input;
				int count = 0;
        	    do{
					string outbuff = string.Empty;
					for(int i=0;i < output.Length;++i){
						char buffer = output[i];
						if(buffer >= 'a' && buffer <= 'z'){
							++buffer;
							if(buffer > 'z'){
								buffer = 'a';
							}
						}
						outbuff += buffer.ToString();
					}
					output = outbuff;
					++count;
            	}while(!(output.Contains("the") || output.Contains("this") || output.Contains("that") || count > 25));
				Console.WriteLine (output);
			}
        }
    }
}

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(24);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x;
string s;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	ll a,b,c,k;

	cin>>a>>b>>c>>k;
	ll sum = 0;
	if(k) {
		sum+=min(k,a);
		k-=min(k,a);
	}
	if(k) {
		k-=min(k,b);
	}
	if(k) {
		sum-=k;
	}
	cout<<sum;
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}


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

int main()
{
	int n, d;
	cin >> n >> d;

	int r = 0;
	if (n % (2*d + 1)) {
		r = n / (2 * d + 1) + 1;
	}
	else {
		r = n / (2 * d + 1);
	}

	cout << r << endl;

	return 0;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>

/*
#include<boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/rational.hpp>
namespace mp = boost::multiprecision;
using Real = mp::number<mp::cpp_dec_float<1024>>;
using Bint = mp::cpp_int;
*/

using namespace std;

#define int long long
#define REP(i,s,e) for((i)=(s);(i)<(e);(i)++)
#define RREP(i,s,e) for((i)=((s)-1);(i)>=(e);(i)--)
#define FOR(i,n) for((i)=(0);(i)<(n);(i)++)
#define RFOR(i,n) for((i)=((n)-1);(i)>=(0);(i)--)
#define MOD 1000000007
#define NMAX 200000

signed main(){   
    int N,K,A[NMAX];
    int a[NMAX];

    cin>>N>>K;
    for(int i=0;i<N;i++){
        cin>>A[i];
    }

    for(int i=0;i<N;i++){
        a[i]=A[i];
    }
    for(int i=0;i<K;i++){
        int n[NMAX]={0};
        int sp=0;
        for(int j=0;j<N;j++){
            if(j-a[j]<0) sp++;
            else n[j-a[j]]++;
            if(j+a[j]+1<N) n[j+a[j]+1]--;
        }
        for(int j=0;j<N;j++){
            sp+=n[j];
            n[j]=sp;
        }
        bool zf=true;
        bool mf=true;
        for(int j=0;j<N;j++){
            a[j]=n[j];
            if(a[j]!=0) zf=false;
            if(a[j]!=N) mf=false;
        }
        if(zf||mf) break;
    }
    for(int j=0;j<N;j++){
        cout<<a[j]<<" ";
    }
    cout<<endl;
}


Measured memory_bytes: 7848
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	int ans=99999;
	cin >>n;
	int bef;
	int cnt=0;
	for(int i=1;i<n;i++){
		cnt=0;
		bef=i;
		while(bef!=0){
			cnt+=bef%10;
			bef/=10;
		}
		bef=n-i;
		while (bef != 0)
		{
			cnt += bef % 10;
			bef /= 10;
		}
		chmin(ans,cnt);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3648
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }

void main()
{
	auto N = RD;
	long digit;
	{
		auto x = N;
		while (x != 0)
		{
			++digit;
			x /= 10;
		}
	}
	debug writeln(digit);

	long ans;
	foreach (i; 1..N+1)
	{
		//debug writeln("i:", i, " ans:", ans);
		auto s = i.to!string;
		auto l = [s[0]].to!long;
		auto r = [s[$-1]].to!long;
		if (r == 0) continue;
		//debug writeln("l:", l, " r:", r);
		if (l == r)
			++ans;
		foreach (j; 2..6)
		{
			if (j < digit)
			{
				ans += 10^^(j-2);
			}
		}
		if (digit == 1) continue;
		auto unit = 10^^(digit-1);
		auto x = r * unit + l;
		if (x > N) continue;
		auto ll = (N / (unit));
		auto y = ((N % (unit)) - (N % 10)) / 10;
		auto t1 = y + (ll > r || l <= (N % 10) ? 1 : 0);
		auto t2 = 10^^(digit-2);
		//debug writeln("t1:", t1, " t2:", t2);
		ans += ll == r ? min(t1, t2) : t2;
	}

	writeln(ans);
	stdout.flush;
	debug readln;
}


Measured memory_bytes: 1276
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvv vector<vvl>
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvvl(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
typedef __int128_t lll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n, k;std::cin >> n >> k;
  ll ans = 0;
  while(n>0) n/=k, ans++;
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 888
function Main(input){
	for(var i = 0, ans = 0; i < input.length; i++){
    ans += (input[i] === '+');
    }
   	if(ans == 4){
    var x = 4;
    console.log(x);
    }else if(ans == 3){
    var x = 2
    console.log(x);
    }else if(ans == 2){
    var x = 0;
    console.log(x);
    }else if(ans == 1){
    var x = -2;
    console.log(x);
    }else{
    var x = -4
    console.log(x);
    }
}

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

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

template<class T> struct Seg { 
	const T ID = 0; // comb(ID,b) must equal b
	T combine(T a, T b) { return a | b; } 
	int n; vector<T> seg;
	void init(int _n) { n = _n; seg.assign(2*n,ID);}

	void update(int p, T value) {	// set value at position p
		seg[p += n] = value;
		for (p /= 2; p; p /= 2) seg[p] = combine(seg[2*p], seg[2*p+1]);
	}
    
	T query(int l, int r) {	 // sum on interval [l, r]
		T ra = ID, rb = ID; 
		for (l += n, r += n+1; l < r; l /= 2, r /= 2) {
			if (l&1) ra = combine(ra,seg[l++]);
			if (r&1) rb = combine(seg[--r],rb);
		}
		return combine(ra,rb);
	}
};

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	string S; cin >> S;
	int Q; cin >> Q;

	Seg<ll> seg; seg.init(N);
	F0R(i, N) seg.update(i, (1LL << (S[i] - 'a')));
	
	F0R(i, Q) {
		// cout << "READY" << endl;
		int a; cin >> a;
		if (a == 1) {
			int b; cin >> b;
			char c; cin >> c;
			// cout << "doing 1 " << b - 1 << endl;
			seg.update(b-1, (1LL << (c - 'a')));
		} else if (a == 2) {
			int b; cin >> b;
			int c; cin >> c;
			// cout << "doing 2" << endl;
			print(__builtin_popcount(seg.query(b-1, c-1)));
		}
	}
}

Measured memory_bytes: 8732
package main

import (
	"fmt"
)

func main() {
	var A, B int
	var ans string
	fmt.Scan(&A, &B)

	if A == B {
		ans = "Draw"
	} else if A == 1 {
		ans = "Alice"
	} else if B == 1 {
		ans = "Bob"
	} else if A > B {
		ans = "Alice"
	} else {
		ans = "Bob"
	}

	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll INF = 1e9+7;
ll MOD = 998244353;
typedef pair<ll,ll> ii;
#define iii pair<ii,ll>
#define iiii pair<ii,ii>
#define f(i,a,b) for(long long i = a;i < b;i++)
#define rf(i,a,b) for(long long i=a;i>=b;i--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define w(t) while(t--)
#define c(n); cin>>n;
#define p(n) cout<<n;
#define pl(n) cout<<n<<endl;
#define ps(n); cout<<n<<" ";
#define F first
#define S second
#define pb(a) push_back(a)
#define all(x) (x).begin(), (x).end()
#define ull unsigned long long
#define vll vector<ll>
#define vii vector<ii>
#define mkp make_pair
#define ld long double
#define arrin(a,n) f(i,0,n){cin>>a[i];}
#define arrout(a,n) f(i,0,n){cout<<a[i]<<" ";}
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define PI (2*acos(0))
const long long N = 1e6+5;
vll visit,dist,taken;
vector<vll> adj;
vector<vii> adj2;
priority_queue<ii,vector<ii>, greater<ii> > pq;
ll bit[N]={0};
ll siz;
ll res = 0;
ll lcm(ll a,ll b){return (a * b) / __gcd(a,b);}
ll gcd(ll a,ll b){return __gcd(a,b);}
ll power(ll a,ll b){if(b == 0)return 1;if(b == 1)return a;ll ans = power(a,b/2) % MOD;ans *= ans;ans %= MOD;if(b % 2 == 1)ans *= a;return ans%MOD;}
ll inverse(ll x){x%=MOD;return power(x,MOD-2);}
void BITup(ll k, ll x){while(k <= siz){bit[k]+=x;k += k & -k;}}
ll BITq(ll k){ll s=0;while(k>=1){s+=bit[k];k -= k &-k;}return s;}
struct node{ll lazy,val;}seg[4000000];
struct point{ll x,y;};
void dfs(ll v){visit[v] = 1;for(auto x:adj[v]){if(!visit[x])dfs(x);}}
void bfs(ll s){visit[s] = 1;queue<ll>q;q.push(s);while(!q.empty()){ll u = q.front();ps(u);q.pop();for(auto x:adj[u]){if(!visit[x]){visit[x] = 1;q.push(x);}}}}
void dijkstra(ll s){pq.push(ii(0,s));dist[s] = 0;while(!pq.empty()){ii f = pq.top();pq.pop();ll w = f.F;ll u = f.S;if(w > dist[u]){continue;}for(auto v:adj2[u]){if(dist[u] + v.S < dist[v.F]){dist[v.F] = dist[u] + v.S;pq.push(ii(dist[v.F],v.F));}}}}
void prim(ll edge) {taken[edge] = 1;for(auto v:adj2[edge]) {if (taken[v.first]==0)pq.push(ii(v.second, v.first));}}
ll mst(ll s){taken.assign(N, 0);prim(s);ll cost = 0;while(!pq.empty()){ii front = pq.top();pq.pop();ll w = front.first;ll u = front.second;if(taken[u]==0)cost += w;prim(u);}return cost;}
void YESNO(ll a){if(!!a){pl("YES");}else{pl("NO");}}
void filesin(void){freopen("input.in","r",stdin);}
void filesout(void){freopen("output.out","w",stdout);}
///I hope I will get uprating and don't make mistakes
///I will never stop programming
///sqrt(-1) Love C++
///Please don't hack me
///@TheofanisOrfanou Theo830
///Educational DP Contest
int main(void){
    fastio;
    ll n,k;
    c(n);
    INF = 1e18;
    k = 2;
    ll arr[n];
    arrin(arr,n);
    ll dp[n+5];
    f(i,0,n+5){
        dp[i] = INF;
    }
    dp[0] = 0;
    dp[1] = 0;
    f(i,1,n+1){
        f(j,1,k+1){
            if(i + j <= n){
                dp[i+j] = min(dp[i+j],dp[i] + abs(arr[i-1] - arr[i+j-1]));
            }
        }
    }
    pl(dp[n]);
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <cstdio>
#include <cstring>
using namespace std;


string str[101][2];

int main(){
	int n;//100
	cin>>n;
	
	
	
	int data[102];
	bool flag[101]={0};
	memset(data,-1,sizeof(data));
	map<string,int>arr;
	for(int i=1;i<=n;i++){
		cin>>str[i][0];
		if(str[i][0]=="goto"){
			cin>>str[i][1];
			str[i][1][str[i][1].size()-1]=':';
		}
		else{
			arr[str[i][0]]=i;
		}
	}
	priority_queue<int, vector<int>, greater<int> > Q;
	Q.push(1);
	
	
	
	for(int pos,cost;!Q.empty();){
		pos=Q.top();Q.pop();
		cost=pos/1000;
		pos%=1000;
		if(pos==n+1){
			cout<<cost<<endl;
			break;
		}
		if(flag[pos]==0){
			flag[pos]=1;
			if(str[pos][0]=="goto"){
				
				if(flag[arr[str[pos][1]]]==0)Q.push(cost*1000+arr[str[pos][1]]);
				if(flag[pos+1]==0)Q.push((cost+1)*1000+pos+1);
			}
			else{
				if(flag[pos+1]==0)Q.push(cost*1000+pos+1);
			}
		}
	}
	
	return 0;
}


Measured memory_bytes: 1256
#include "bits/stdc++.h"
using namespace std;
#define Rep(i,n) for(int i=0;i<(int)(n);i++)
#define For(i,n1,n2) for(int i=(int)(n1);i<(int)(n2);i++)
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define RREP(i,n) for(ll i=((ll)(n)-1);i>=0;i--)
#define FOR(i,n1,n2) for(ll i=(ll)(n1);i<(ll)(n2);i++)
#define RFOR(i,n1,n2) for(ll i=((ll)(n1)-1);i>=(ll)(n2);i--)
#define all(a)  (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define oorret 0
#define oor(x) [&](){try{x;} catch(const out_of_range& oor){return oorret;} return x;}()
#define IOS cin.tie(0),ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<ll, ll> P;
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<class Type>struct is_vector : std::false_type {};
template<class ValueType, class Alloc>struct is_vector<std::vector<ValueType, Alloc>> : std::true_type {};
template <typename T> inline std::ostream& operator << (std::ostream& out, const std::vector<T>& v) {
	if (v.empty())return out;
	constexpr bool is_vector_v = is_vector<T>::value;
	if (is_vector_v)for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? "\n" : "");
	else for (auto itr = v.begin(); itr != v.end();)out << (*itr), out << ((++itr != v.end()) ? " " : "");
	return out;
}
inline void put() {}
template<class T> inline void put(const T& first) { std::cout << first << "\n"; }
template<class T, class... N> inline void put(const T& first, const N& ... rest) { std::cout << first << " "; put(rest...); }
inline void putn() {}
template<class T, class... N> inline void putn(const T& first, const N& ... rest) { std::cout << first << "\n"; putn(rest...); }

int main() {
	IOS;
	int a, b, m;
	cin >> a >> b >> m;
	vector<ll> aa(a), bb(b), x(m), y(m), c(m);
	REP(i, a) {
		cin >> aa[i];
	}
	REP(i, b) {
		cin >> bb[i];
	}
	REP(i, m) {
		cin >> x[i] >> y[i] >> c[i];
		x[i]--;
		y[i]--;
	}
	ll res = LLONG_MAX;
	chmin(res, *min_element(all(aa)) + *min_element(all(bb)));
	REP(i, m) {
		chmin(res, aa[x[i]] + bb[y[i]] - c[i]);
	}
	put(res);
	return 0;
}

Measured memory_bytes: 4224
from heapq import heappop, heappush


def main():
    Q = int(input())
    y = 0
    lheap = []
    rheap = []
    lsum = 0
    rsum = 0
    for _ in range(Q):
        q = input()
        if q[0] == '1':
            # update
            _, a, b = map(int, q.split())
            y += b
            if len(lheap) == 0 or -lheap[0] <= a <= rheap[0]:
                heappush(lheap, -a)
                heappush(rheap, a)
                lsum += a
                rsum += a
            elif a < -lheap[0]:
                mov = -heappop(lheap)
                heappush(rheap, mov)
                heappush(lheap, -a)
                heappush(lheap, -a)
                lsum += a*2 - mov
                rsum += mov
            elif rheap[0] < a:
                mov = heappop(rheap)
                heappush(lheap, -mov)
                heappush(rheap, a)
                heappush(rheap, a)
                lsum += mov
                rsum += a*2 - mov
        else:
            # inquiry
            x = -lheap[0]
            minimum = abs(x * len(lheap) - lsum) // 2 + \
                abs(x * len(rheap) - rsum) // 2 + y
            print(x, minimum)


if __name__ == "__main__":
    main()


Measured memory_bytes: 90968
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MM = 1000000000;
const int MOD = MM + 7;
const int MAX = 510000;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(ll i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()
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;}
const ll INF = 1LL << 60;

int main() {
    ll n; cin >> n;
    vector<ll> a(n); rep(i, n) cin >> a[i];
    ll p = n-1;
    rep(i, n-1) {
        if(a[n-i-1] > a[n-i-2]) break;
        p--;
    }
    ll mon = 1000;
    ll cap = 0;
    rep(i, n-1) {
        if(i == p) {
            cout << mon + cap * a[i] << endl;
            return 0;
        }
        if(a[i] < a[i+1]) {
            cap += mon / a[i];
            mon %= a[i];
            continue;
        }
        mon += cap * a[i];
        cap = 0;
        while(a[i] >= a[i+1]) {
            i++;
        }
        cap += mon / a[i];
        mon %= a[i];
    }
    mon += cap * a[n-1];
    cout << mon << endl;
}


Measured memory_bytes: 3636
import java.util.*;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int a = sc.nextInt();
        int b = sc.nextInt();
        String u = sc.next();
        if(s.equals(u)){
            a += -1;
            String as = String.valueOf(a);
            String bs = String.valueOf(b);
            System.out.println(as+" "+bs);
        } else {
            b += -1;
            String as = String.valueOf(a);
            String bs = String.valueOf(b);
            System.out.println(as+" "+bs);
        }
    }
}

Measured memory_bytes: 21076
#include "bits/stdc++.h"
using namespace std;
 
int d,n;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin>>d>>n;
	if(n < 100){
		cout<<n*pow(100,d);
	}
	else{
		cout<<int(101 * pow(100,d));
	}
	return 0;
}

Measured memory_bytes: 256
import itertools
import sys
input1 = list(map(int, input().split()))
input_A = input1[0]
input_B = input1[1]
input_C = input1[2]
K = int(input())

def check(r, g, b):
    if g > r and b > g:
        return True
    else:
        return False

def magic(card):
    return card * 2

mylist = [0, 1, 2]
for cards in itertools.product(mylist, repeat=K):
    A = input_A
    B = input_B
    C = input_C
    for itr in cards:
        if itr == 0:
            A = magic(A)
        elif itr == 1:
            B = magic(B)
        elif itr == 2:
            C = magic(C)
        if(check(A, B, C)):
            print('Yes')
            sys.exit()
        # print(A, B, C)
print('No')

    # print(cards[2])




Measured memory_bytes: 9032
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <algorithm>

using namespace std;

#define ll long long
#define _ABS(x) (((x) < 0) ? (-(x)):(x))

int main()
{
	int X, A;

	scanf("%d %d", &X, &A);

	if (X < A) printf("0\n");
	else printf("10\n");

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
#define REP(i,n) for (int i = 0; i < n; ++i)
#define FOR(i,m,n) for (int i = m; i < n; ++i)

const int MAX = 2222;

int N, M, Q;
int grid[MAX][MAX], cumulative[MAX][MAX];
int hedge[MAX][MAX], vedge[MAX][MAX];

int main() {
    cin >> N >> M >> Q;
    REP(n, N) {
        string s;
        cin >> s;
        REP (m, M) grid[n+1][m+1] = s[m] == '1';
    }

    FOR (n, 1, N+1) FOR (m, 1, M) if (grid[n][m] == 1 && grid[n][m+1] == 1) hedge[n][m+1] = 1;
    FOR (m, 1, M+1) FOR (n, 1, N) if (grid[n][m] == 1 && grid[n+1][m] == 1) vedge[n+1][m] = 1;
    FOR (n, 1, N+1) FOR (m, 1, M+1) {
        grid[n][m+1] += grid[n][m];
        hedge[n][m+1] += hedge[n][m];
        vedge[n][m+1] += vedge[n][m];
    }
    FOR (n, 1, N+1) FOR (m, 1, M+1) {
        grid[n+1][m] += grid[n][m];
        hedge[n+1][m] += hedge[n][m];
        vedge[n+1][m] += vedge[n][m];
    }


    REP (q, Q) {
        int x, y, xx, yy;
        cin >> x >> y >> xx >> yy;
        int node = grid[xx][yy] - grid[xx][y-1] - grid[x-1][yy] + grid[x-1][y-1];
        int ve = vedge[xx][yy] - vedge[xx][y-1] - vedge[x][yy] + vedge[x][y-1];
        int he = hedge[xx][yy] - hedge[xx][y] - hedge[x-1][yy] + hedge[x-1][y];
        cout << node-ve-he << endl;
    }     
}

Measured memory_bytes: 57088
#input
D, N = map(int, input().split())

#output
if D == 0:
    if N == 100:
        print(101)
    else:
        print(N)
elif D == 1:
    if N == 100:
        print(10100)
    else:
        print(100*N)
else:
    if N == 100:
        print(1010000)
    else:
        print(100**2*N)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a) for(int i=0; i<(a); i++)
typedef long long ll;
template<typename T>
struct edge {
  int src, to;
  T cost;
  edge(int to, T cost) : src(-1), to(to), cost(cost) {}
  edge(int src, int to, T cost) : src(src), to(to), cost(cost) {}
  edge &operator=(const int &x) {
    to = x;
    return *this;
  }
  operator int() const { return to; }
};
template<typename T>
using Edges = vector<edge<T>>;
template<typename T>
using WeightedGraph = vector<Edges<T>>;
using UnWeightedGraph = vector<vector<int>>;
template<typename T>
using Matrix = vector<vector<T>>;

/////////////////////////////////////////////////////////////////////
const ll inf = 1LL<<60;

ll f(ll x, ll y, ll z) {
  ll mi = min(x, min(y, z));
  ll ma = max(x, max(y, z));
  return abs(ma - mi);
}

int main()
{
  ll h,w; cin>>h>>w;

  if (h%3 == 0 || w%3 == 0) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = h*w;

  rep(i, 2) {
    ll a = h/3+i;
    ll b = h-a;
    ll x = a*w;
    {
      ll y = b*(w/2);
      ll z = b*((w+1)/2);
      ans = min(ans, f(x, y, z));
    }
    {
      ll y = w*(b/2);
      ll z = w*((b+1)/2);
      ans = min(ans, f(x, y, z));
    }
  }
  rep(i, 2) {
    ll a = w/3+i;
    ll b = w-a;
    ll x = h*a;
    {
      ll y = b*(h/2);
      ll z = b*((h+1)/2);
      ans = min(ans, f(x, y, z));
    }
    {
      ll y = h*(b/2);
      ll z = h*((b+1)/2);
      ans = min(ans, f(x, y, z));
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3624
N=int(input())
ans=""
k=1
s=[]
while N!=0:
    if N%(k*(-2))!=0:
        s.append("1")
        N-=k
    else:
        s.append("0")
    k*=-2

for i in range(len(s)):
    ans+=s[len(s)-1-i]

if ans=="":
    ans+="0"
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <list>
#include <unordered_set>
#include <tuple>
#include <cmath>
#include <limits>
#include <type_traits>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <set>
#include <bitset>
#include <regex>
#include <random>
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exout(x) printf("%.10f\n", x)
const double pi = acos(-1.0);
const ll MOD = 1000000007;
const ll INF = 1e18;
const ll MAX_N = 201010;

//組み合わせの余りを求める
ll fac[MAX_N], finv[MAX_N], inv[MAX_N];

void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX_N; i++) {
		fac[i] = fac[i - 1] * i;
	}
}

// 二項係数計算
long long COM(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] / (fac[k] * fac[n - k]);
}


//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };
ll dp[10101][110];

//long longしか使わない
//素数は1より大きい
//lower_boundは指定したkey以上の要素の一番左のイテレータをかえす
//upper_boundは指定したkeyより大きい要素の一番左のイテレータをかえす
int main() {
	ll k, a, b;
	cin >> k >> a >> b;
	if (a+2 >= b) {
		cout << k + 1 << endl;
	}
	else {
		ll ans = a;
		k -= a - 1;
		ll res = k / 2;
		ans += res * (b - a);
		if (k % 2)ans++;
		cout << ans << endl;
	}
	return 0;
}


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

long long N, H[1 << 18];

int main() {
	cin >> N;
	for (int i = 1; i <= N; i++) cin >> H[i];
	for (int i = N - 1; i >= 1; i--) {
		if (H[i] - H[i + 1] >= 2) {
			cout << "No" << endl;
			return 0;
		}
		if (H[i] > H[i + 1]) H[i] = H[i + 1];
	}
	cout << "Yes" << endl;
	return 0;
}

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

#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define mp make_pair
#define input freopen("input.txt","r",stdin);
#define output freopen("output.txt","w",stdout);
#define fast_io ios::sync_with_stdio(NULL), cin.tie(NULL), cout.tie(NULL);
#define fix cout << fixed << setprecision(15);
//#define left left228
//#define right right228
//#define next next228
#define rank rank228
//#define prev prev228
#define y1 y1228
#define dout if(debug) cout
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int> ;
using pll = pair<ll, ll>;
using pci = pair<char, int>;
using vi = vector<int> ;
using vll = vector<ll> ;
using vpii = vector<pii> ;
const ll infll = 1e18 + 3;
const int maxn = 1e6 + 77;
const int nmax = 1e6 + 577;
const ll basell = 1e18 + 3;
const int mod = 1e9 + 7;
const ld eps = 1e-7;
const int inf = 1009000999;
const int nv = 100505;
const int baseint = 1000200013;
const ld PI = acos(-1.0);
inline bool EQ(ld a, ld b) { return fabs(a-b) < 1e-9; }
inline bool IF(int a, int b, int c) { return (a >= b && a <= c); }
inline bool IFS(int a, int b, int c) { return (a > b && a < c); }
template<typename T> inline istream &operator>> (istream &_in, vector<T> &_v) { for (auto &_i : _v) { _in >> _i; } return _in; }
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
//typedef pair<int, int> pt;
//#define x first
//#define y second
//ifstream cin("input.txt");
//ofstream cout("output.txt");
/*
sort(a, a + n, [&](pair<pt, int> a, pair<pt, int> b){if (a.x.x != b.x.x)
        return a.x.x < b.x.x; return a.x.y > b.x.y;});
for(int c : s)
for(int &i : a) cin >> i;
for(int c = 'a'; c <= 'z'; ++c)
vector<vector<ll>> dp(n, vector<ll>(n+2));
__int128;
char 0 = int 48;
char c = cin;
int h = (int)c - 48;
*/

/*char memory[(int)1e8];

char memorypos;

inline void * operator new(size_t n){
    char * ret = memory + memorypos;
    memorypos += n;
    return (void *)ret;
}

inline void operator delete(void *){}
*/

int dp[200][nmax];

int w[nv], val[nv];

int inline solve() {
    //input;//,output;
    //fix;
    fast_io;
    int n, W;
    cin >> n >> W;
    for (int i = 1; i <= n; ++i) {
        cin >> w[i] >> val[i];
    }
    int ans = 0;
    fill(dp[0], dp[0] + nmax, inf);
    dp[0][0] = 0;
    for (int j = 1; j <= n; ++j) {
        for (int i = 0; i < nmax; ++i) {
            if(val[j] > i) {
                dp[j][i] = dp[j - 1][i];
            } else {
                dp[j][i] = min(dp[j - 1][i - val[j]] + w[j], dp[j - 1][i]);
            }
            if(dp[j][i] <= W) ans = max(i, ans);
        }
    }
    cout << ans;
    return 0;
}

int32_t main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    solve();
    return 0;
}
/*
6
2 1 6 3 4 5
2 1 3 4 5 6
6 0
1 7 8 2 4 6
 * */

Measured memory_bytes: 396800
#include <bits/stdc++.h>
#ifdef BUG
    #include "debug.hpp"
#else
    #define DEBUG(var)
#endif

using namespace std;
template< class T1, class T2 > inline istream &
operator>>( istream & fin, pair< T1, T2 > & pr )
{ fin >> pr.first >> pr.second; return fin; }
template< class T0, class T1, class T2 > inline istream &
operator>>( istream & fin, tuple< T0, T1, T2 > & t )
{ fin >> get<0>(t) >> get<1>(t) >> get<2>(t); return fin; }
template< class T > inline istream &
operator>>( istream & fin, vector< T > & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class T, size_t n> inline istream &
operator>>( istream & fin, array<T, n> & a ) {
for(auto & u: a) fin >> u; return fin; }
template<class FwdIter> inline auto
dump(FwdIter first, FwdIter last, const char * dlm = " ") -> void {
typedef typename iterator_traits<FwdIter>::value_type value_type;
copy(first, last, ostream_iterator<value_type>(cout, dlm)); }
template<typename T> vector<T> & operator--(vector<T> & a)
{ for(auto & i: a) --i; return a; }
/* @@@ ----------------------------------- */

string task1()
{
    string str;
    cin >> str;
    return str.substr(0, 4) + ' ' + str.substr(4);
}

int main(const int argc, char * argv [])
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cout << task1() << '\n';

    return EXIT_SUCCESS;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n=int(input())
A=list(map(int,input().split()))
k={}
ans=sum(A)
for i in A:
  if i in k:
    k[i]+=1
  else:
    k[i]=1
q=int(input())
for i in range(q):
  b,c=map(int,input().split())
  if b in k:
    f=c*k[b]-b*k[b]
    ans+=f
    p=k[b]
    del k[b]
    if c in k:
      k[c]+=p
    else:
      k[c]=p
  print(ans)
    

Measured memory_bytes: 83656
#include<stdio.h>
int main()
{
    char s[3];
  int counter = 0;
    // 文字列の入力
    scanf("%3s",s);
  if(s[0] == '1')	counter++;
  if(s[1] == '1')	counter++;
  if(s[2] == '1')	counter++;
    // 出力
    printf("%d\n",counter);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <utility>
#include <map>
using namespace std;

using ll = long long;

constexpr int limit = 1e5;
int n, m;

class V{
public:
  int tag;
  vector<V*> to;
};

int type[limit+1];
bool visited[limit+1];
int x[limit+1], y[limit+1];
V graph[limit+1];

void bfs(int, int);

int main(){
  cin >> n >> m;
  int p[n+1];
  for(int i=1; i<=n; i++) {
    cin >> p[i];
    graph[i].tag = i;
  }

  for(int i=1; i<=m; i++) {
    cin >> x[i] >> y[i];
    graph[x[i]].to.push_back(&graph[y[i]]);
    graph[y[i]].to.push_back(&graph[x[i]]);
  }

  int cnt=0;
  for(int i=1; i<=n; i++){
    if(!visited[i]){
      bfs(i, cnt);
      cnt++;
    }
  }

  int ans = n;
  for(int i=1; i<=n; i++){
    if(type[i] != type[p[i]]) ans--;
  }

  cout << ans << endl;

  return 0;
}

void bfs(int s, int t){
  type[s] = t;
  visited[s] = true;
  for(int i=0; i<graph[s].to.size(); i++){
    int nx = graph[s].to[i]->tag;
    if(!visited[nx]){
      bfs(nx, t);
    }
  }
}


Measured memory_bytes: 11136
N,K = map(int,input().split())
D = set(map(str,input().split()))
def check(n,d):
    n = str(n)
    for nstr in n:
        if nstr in d:
            return False
    return True
while True:
    if check(N,D):
        print(N)
        break
    else:
        N = N+1

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 998244353;
using ll = long long;
using u32 = uint32_t;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

template <class T>
T pow_ (T x, T n, T M){
    uint64_t u = 1, xx = x;
    while (n > 0){
        if (n&1) u = u * xx % M;
        xx = xx * xx % M;
        n >>= 1;
    }
    return static_cast<T>(u);
};

template <class T> class Factorial {
    T mod;
    vector<uint64_t> facts, factinv;

public:
    Factorial(int n, T mod) : facts(static_cast<u32>(n+1)), factinv(static_cast<u32>(n+1)), mod(mod) {
        facts[0] = 1;
        for (int i = 1; i < n+1; ++i) facts[i] = facts[i-1]*i % mod;
        factinv[n] = pow_(facts[n], static_cast<uint64_t>(mod - 2), static_cast<uint64_t>(mod));
        for (int i = n-1; i >= 0; --i) factinv[i] = factinv[i+1] * (i+1) % mod;
    }

    T fact(int k) const {
        if(k >= 0) return static_cast<T>(facts[k]);
        else return static_cast<T>(factinv[-k]);
    }

    T operator[](const int &k) const {
        if(k >= 0) return static_cast<T>(facts[k]);
        else return static_cast<T>(factinv[-k]);
    }

    T C(int p, int q) const {
        if(q < 0 || p < q) return 0;
        return static_cast<T>(facts[p]*  factinv[q] % mod * factinv[p-q] % mod);
    }

    T P(int p, int q) const {
        if(q < 0 || p < q) return 0;
        return static_cast<T>((facts[p] * factinv[p-q]) % mod);
    }

    T H(int p, int q) const {
        if(p < 0 || q < 0) return 0;
        return static_cast<T>(q == 0 ? 1 : C(p+q-1, q));
    }
};
int main() {
    ll n, m;
    cin >> n >> m;
    Factorial<ll> f(2000010, MOD);
    ll ans = 0;
    for (int k = 0; k <= m; ++k) {
        if(k%2 != m%2) continue;
        (ans += f.C(n, k)*f.H(n, (3*m-k)/2)) %= MOD;
    }
    for (int i = 2*m+1; i <= 3*m; ++i) {
        (ans += MOD-n*f.H(n-1, 3*m-i)%MOD) %= MOD;
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 31488
#include <iostream>
#include <vector>
#include <map>
#include<numeric>
using namespace std;
using P = pair<int, int>;
#define rep(i,n) for(int i=0; i<(n);i++)
typedef long long ll;


int main(){
    int n, k; cin >> k >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    a.push_back(a[0]+k);
    int l = 0;
    rep(i,n){
        l = max(l, a[i+1] - a[i]);
    }
    int ans = k-l;
    cout << ans ;
    return 0;
}


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

int mod = 1e9+7;
struct modular {
    int value;
    modular(long long v = 0) { value = v % mod; if (value < 0) value += mod;}
    modular(long long a, long long b) : value(0){ *this += a; *this /= b;}
    modular& operator+=(modular const& b) {value += b.value; if (value >= mod) value -= mod; return *this;}
    modular& operator-=(modular const& b) {value -= b.value; if (value < 0) value += mod;return *this;}
    modular& operator*=(modular const& b) {value = (long long)value * b.value % mod;return *this;}
    //其他函数调用mexp(modular(10),3);
    friend modular mexp(modular a, long long e) {
        modular res = 1; while (e) { if (e&1) res *= a; a *= a; e >>= 1; }
        return res;
    }
    friend modular inverse(modular a) { return mexp(a, mod - 2); }
    modular& operator/=(modular const& b) { return *this *= inverse(b); }
    friend modular operator+(modular a, modular const b) { return a += b; }
    friend modular operator-(modular a, modular const b) { return a -= b; }
    friend modular operator-(modular const a) { return 0 - a; }
    friend modular operator*(modular a, modular const b) { return a *= b; }
    //除法只有在mod是素数可用;
    friend modular operator/(modular a, modular const b) { return a /= b; }
    friend ostream& operator<<(ostream& os, modular const& a) {return os << a.value;}
    friend istream& operator>>(istream& is, modular & a){long long value; is >> value;a.value = 0; a += value;  return is;}
    friend bool operator==(modular const& a, modular const& b) {return a.value == b.value;}
    friend bool operator!=(modular const& a, modular const& b) {return a.value != b.value;}
};



ll quick_pow(ll a, ll b) {
    ll res = 1;
    a %= mod;
    while (b) {
        if (b & 1) res = res * a % mod;
        a = a * a % mod;
        b >>= 1;
    }
    return res;
}




int main(){
#ifdef LOCAL
    freopen("./input.txt", "r", stdin);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    int n,k;
    cin >> n >> k;
    
    int zero_max = min(n-1, k);
    
//    if(k == 1){
//        modular ans = 1;
//        cout << ans * n *(n-1) << "\n";
//    }
    
    vector<int> fac(n+1), finv(n+1);
    fac[0] = finv[0] = 1;
    for(int i = 1; i <= n; ++i)fac[i]=(ll)fac[i-1]*i%mod;
    finv[n] = quick_pow(fac[n], mod-2);
    for(int i = n-1; i; --i)finv[i] = (ll)finv[i+1]*(i+1)%mod;
    
    
    auto comb= [&](int n, int m){
        //n!/(m!(n-m)!)
        return (ll)fac[n] * finv[m] % mod * finv[n - m]% mod;
    };

    
    modular ans = 1;
    for (int i = 1; i <= zero_max; i++){
        ans += (modular)comb(n, i) * comb(n-1, i);
    }
    
    cout << ans << "\n";
    
    return 0;
}


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

using namespace std;
using ll = long long int;

int main() {
    ll N;
    cin >> N;
    ll current = 1;
    ll ans = 0;
    for (int i = 0; i < N; i++){
        ll a;
        cin >> a;
        if (a == current){
            current += 1;
        }else{
            ans += 1;
        }
    }
    if (ans == N){
        cout << "-1" << endl;
    }else{
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 256