akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
typedef long long               ll;
typedef long double             ld;
 
 
#define racecar          ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define si(a)            scanf("%d", &a)
#define si2(a,b)         scanf("%d %d", &a,&b)
#define sll(a)           scanf("%I64d",&a)
#define sll2(a,b)        scanf("%I64d %I64d",&a,&b)
#define pb               push_back
#define pi(a)            printf("%d",int(a))
#define pll(a)           printf("%I64d",ll(a))
#define all(x)           (x).begin(),(x).end()
#define rall(x)          (x).rbegin(),(x).rend()
#define ps               printf(" ")
#define nln              printf("\n")
#define ff               first
#define ss               second
#define vi               vector<int>
#define vll              vector<ll>
#define vstr             vector<string>
#define vc               vector<char>
#define pii              pair<int,int>
#define PLL              pair<ll,ll>
#define PI               acos(-1)
#define sq(x)            x*x
#define forr(i,a,b)      for(ll i=ll(a);i<ll(b);i++)
#define forn(i,a,b)      for(ll i=ll(a);i>ll(b);i--)
#define max3(a,b,c)      max(a,max(b,c))
#define max4(a,b,c,d)    max(max3(a,b,c),d)
#define min3(a,b,c)      min(a,min(b,c))
#define mod              1000000007
#define inf              9223372036854775807
 
ll power(ll b,ll n)
{
    if(n==0) return 1;
    else if(n%2) return b*power(b,n/2)*power(b,n/2);
    else return power(b,n/2)*power(b,n/2);
} 
 
ld root(ll n,ll r)
{
    ld dif=0.0001;
    ld guess=n/2.0;
    while(abs(pow(guess,r)-n)>=dif)
    {
        ld temp=pow(guess,r)-n;
        ld tmp=r*pow(guess,r-1);
        guess-=temp/tmp;
    }
    return guess;
}
 
void fileio()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}


int solve()
{
	ll n;
	sll(n);
	ll sum=0;
	forr(i,0,n)
	{
		ll x;
		sll(x);
		sum+=x;
	}
	pll(sum-n);
	return 0;
}
 
int main()
{   
 
//    racecar;
//    cout<<fixed<<setprecision(6);
//    fileio();
    solve();
}
 
 
 
///    Before submission=>
///    ***check for integer overflow,array bounds
///    ***check for n


Measured memory_bytes: 384
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する


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

    set<int> st;
    int N;
    cin >> N;
    rep(i,0,N){
        int tmp;
        cin >> tmp;
        st.insert(tmp);
    }

    cout << st.size() << endl;

    return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m,i,j,p,ac=0,wa=0;
	string s;
	cin>>n>>m;
	//string s[m];
	bool f[n+1];
	int sum[n+1];
	for(i=1;i<=n;i++){f[i]=0;sum[i]=0;}
	
	for(i=0;i<m;i++){
		cin>>p>>s;
		if(f[p])continue;
		if(s=="AC"){ac++;f[p]=1;wa+=sum[p];}
		else sum[p]++;
	}
	//if(ac==0)wa=0;
	cout<<ac<<" "<<wa;

	return 0;
}



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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    vector<vector<unsigned long>> t(9, vector<unsigned long>(9));
    const auto& top = [](unsigned long i) -> unsigned long {
        while(i > 9)i /= 10;
        return i;
    };
    for(unsigned long i{1}; i <= N; ++i)if(i % 10)++t[top(i) - 1][(i - 1) % 10];
    unsigned long ans{0};
    for(unsigned long i{0}; i < 9; ++i)for(unsigned long j{0}; j < 9; ++j)ans += t[i][j] * t[j][i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
let input = readLine()!.split(separator: " ").map { Int($0)! }
let X = input[0]
let N = input[1]

let p = readLine()!.split(separator: " ").map { Int($0)! }

var diff = 0

var result = X
while true {
    if !p.contains(X - diff) {
        result = X - diff
        break
    } else if !p.contains(X + diff) {
        result = X + diff
        break
    }
    diff += 1
}

print(result)


Measured memory_bytes: 8228
def fa(): #final answer
    global ans
    print(ans)
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

N = getN()
if N < 1200:
    ans = "ABC"
elif N < 2800:
    ans = "ARC"
else:
    ans = "AGC"

fa()

Measured memory_bytes: 2940
void main()
{
    long n = rdElem;
    long[][] a = rdMat(n);

    bool[][] need = new bool[][](n, n);
    foreach (i; 0 .. n)
    {
        need[i][] = true;
    }
    bool ok = true;
    foreach (i; 0 .. n)
    {
        foreach (j; 0 .. n)
        {
            foreach (k; 0 .. n)
            {
                if (j == k || j == i || i == k) continue;
                if (a[j][k] > a[j][i] + a[i][k])
                {
                    ok = false;
                }
                if (a[j][k] == a[j][i] + a[i][k] && need[j][i] && need[i][k])
                {
                    need[j][k] = false;
                }
            }
        }
    }

    if (ok)
    {
        long len;
        foreach (i; 0 .. n-1)
        {
            foreach (j; i+1 .. n)
            {
                if (need[i][j]) len += a[i][j];
            }
        }
        len.writeln;
    }
    else
    {
        writeln(-1);
    }
}

T rdElem(T = long)()
{
    //import std.stdio : readln;
    //import std.string : chomp;
    //import std.conv : to;

    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;

dchar[] rdDchar()
{
    //import std.conv : to;

    return rdStr.to!(dchar[]);
}

T[] rdRow(T = long)()
{
    //import std.stdio : readln;
    //import std.array : split;
    //import std.conv : to;

    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdElem).array;
}

T[][] rdMat(T = long)(long col)
{
    //import std.range : iota;
    //import std.algorithm : map;
    //import std.array : array;

    return iota(col).map!(x => rdRow).array;
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.container;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 5500
//abc157_b.cpp
//Sun Mar  1 20:09:44 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007

using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int a[3][3];
	for (int i=0;i<3;i++){
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	}

	int n;
	cin >> n;

	for (int i=0;i<n;i++){
		int b;
		cin >> b;
		for (int j=0;j<3;j++){
			for (int k=0;k<3;k++){
				if (a[j][k]==b){
					a[j][k] = 0;
				}
			}
		}
	}

	if ((a[0][0]==0 && a[0][1]==0 && a[0][2]==0) ||
		(a[1][0]==0 && a[1][1]==0 && a[1][2]==0) ||
		(a[2][0]==0 && a[2][1]==0 && a[2][2]==0) ||
		(a[0][0]==0 && a[1][0]==0 && a[2][0]==0) ||
		(a[0][1]==0 && a[1][1]==0 && a[2][1]==0) ||
		(a[0][2]==0 && a[1][2]==0 && a[2][2]==0) ||
		(a[0][0]==0 && a[1][1]==0 && a[2][2]==0) ||
		(a[0][2]==0 && a[1][1]==0 && a[2][0]==0)){
		cout << "Yes" << endl;
	}else {
		cout << "No" << endl;
	}

}

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

#define ll long long
// #define endl '\n'

// void max_self(int &a, int b){a = max(a, b);}
// void min_self(int &a, int b){a = min(a, b);}

void solve(){
	int n; cin>>n;
	vector< int > v(n - 1);
	unordered_map< int, int > m;
	for(int &i : v){
		cin>>i;
		m[i]++;
	}
	for(int i = 1; i<=n; i++){
		cout<<m[i]<<endl;
	}
}

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int t = 1;// cin>>t;
	for(int i = 1; i<=t; i++){
		solve();
	}
	return 0;
}


Measured memory_bytes: 12268
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;
  
int main()
{
  ll N;
  cin >> N;
  map<ll,ll> mp;

  vector<ll> A(N);
  REP(i, N){
    cin >> A[i];
    mp[A[i]]++;
  }
  ll MAX4 = 0;
  ll MAX2[2]={0};
  ll a=0,b=0;
  for(auto x:mp){
    if(x.second>=2){
      if(MAX2[0]<x.first){
        MAX2[1]=MAX2[0];
        MAX2[0]=x.first;
      }
      a++;
    }
    if(x.second>=4){
      MAX4=max(MAX4,x.first);
      b++;
    }
  }

  ll ans = 0;
  if(a<2&&b<1){
    cout << 0 << endl;
  }else{
    cout << max(MAX4*MAX4,MAX2[0]*MAX2[1]) << endl;
  }
}

Measured memory_bytes: 7296
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define endl '\n'
#define ld long double
#define FOR(i,a,n) for (ll i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (ll i=(n);i>=(a);--i)
#define FI(i,n) for (ll i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define MINUS(a) memset((a),-1,sizeof((a)))
#define f first
#define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }
 
/*
░░░░░░░░░░░░░░░░░░░░░░░░░
░░█▀▀▄░░░░░░░░░░░▄▀▀█░░░░
░░█░░░▀▄░▄▄▄▄▄░▄▀░░░█░░░░
░░░▀▄░░░▀░░░░░▀░░░▄▀░░░░░
░░░░░▌░▄▄░░░▄▄░▐▀▀░░░░░░░
░░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█░
░░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█░
░▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█░
░█░░░▀▄░█░░░█░▄▀░░░░█▀▀▀░
░░▀▄░░▀░░▀▀▀░░▀░░░▄█▀░░░░
░░░░█░░░░░░░░░░░▄▀▄░▀▄░░░
░░░░█░░░░░░░░░▄▀█░░█░░█░░
░░░░█░░░░░░░░░░░█▄█░░▄▀░░
░░░░█░░░░░░░░░░░████▀░░░░
░░░░▀▄▄▀▀▄▄▀▀▄▄▄█▀░░░░░░░
░░░░░░░░░░░░░░░░░░░░░░░░░
*/
 
// I want to be the very best, like no one ever was, I will battle everyday to claim my rightful place
// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
 
// I am questioning life and universe and 
// everything else after looking at this

const ll MAXN = 13;
const ll MASMASK = (1<<12) + 1;
const ll MAXM = 1e3 + 10;
ll a[MAXM];
ll cost[MAXM];
ll n,m;
const ll INF = 1e15;
ll dp[MAXM][MASMASK];

ll rec(ll idx,ll mask){
    if(idx == m+1){
        if(mask == ((1<<n)-1)) return 0;
        else return INF;
    }

    ll &ans = dp[idx][mask];

    if(ans != -1) return ans;

    ans = INF;

    ans = min(ans,rec(idx+1,mask));
    ans = min(ans,rec(idx+1,(mask|a[idx]))+cost[idx]);

    return ans;
}

void solve(){
    MINUS(dp);
    cin>>n>>m;

    FOR(i,1,m){
        ll aa,b; cin>>aa>>b;
        cost[i] = aa;
        FOR(j,1,b){
            ll x; cin>>x;
            a[i] |= (1<<(x-1));
        }
    }

    ll ans = rec(1,0);
    if(ans >= INF) cout<<-1<<endl;
    else cout<<ans<<endl;
}
 
signed main(){
 
   FastRead;    
 
    ll t;
    t = 1; 
    // cin>>t;
    FOR(i,1,t){
        // cout<<"Case #"<<i<<": ";
        solve();
    }
}

Measured memory_bytes: 32640
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<time.h>
#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; ++i)
#define FOR(i,n,m) for(long long i=n; i<m; ++i)
#define DUMP(n,a) for(long long dump=0; dump<n; ++dump) { cout<<a[dump]; if(dump!=n-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin>>n;
	vector<ll> b(n,0);
	REP(i,n) {
		ll a;
		cin>>a;
		b[a]++;
	}
	for(ll i=n-1; i>=0; i-=2) {
		if(i==0) {
			if(b[i]!=1) {
				cout<<0<<endl;
				return 0;
			}
		}
		else if(b[i]!=2) {
			cout<<0<<endl;
			return 0;
		}
	}
	ll ret=1;
	REP(i,n/2) {
		ret*=2;
		ret%=MOD;
	}
	cout<<ret<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define run  ios_base::sync_with_stdio(false);cin.tie(NULL);
  //  mid =(l+r) >> 1 


  
int main()
 {
  run;
 ll n,i,m;
 cin>>n>>m;
 ll a[m],b[m],c=0;
 
 for(i=0;i<m;i++)
    cin>>a[i]>>b[i];
    
    ll h[100009];
    for(i=0;i<100009;i++)
        h[i]=1;

  ll  red[100009]={0};
      red[1]=1;
  
    for(i=0;i<m;i++)
    {
      if(red[a[i]]!=0)
      {
          if(h[a[i]]==1)
          {
             red[a[i]]=0;
             
             if(red[b[i]]==0)
                red[b[i]]++;
             
          }
             
          else if(h[a[i]]>1&&red[b[i]]==0)
                  red[b[i]]++;
      }
      h[a[i]]--;
      h[b[i]]++;
      
    }
    
   // for(i=0;i<100009;i++)
    //  cout<<red[i]<<" ";
     // cout<<endl;
      
    for(i=0;i<100009;i++)
    {
        if(red[i]==1)
          c++;
    }
   cout<<c;
 }

Measured memory_bytes: 6756
#include<iostream>
#include<algorithm>
using namespace std;
int N;
long A[2<<17],B[2<<17];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>A[i];
	for(int i=0;i<N;i++)cin>>B[i];
	long ans=0;
	for(int t=0;t<500;t++)
	{
		for(int i=t&1;i<N;i+=2)
		{
			long s=B[(i+N-1)%N]+B[(i+1)%N];
			long t=(B[i]-A[i])/s;
			ans+=t;
			B[i]-=t*s;
		}
	}
	for(int i=0;i<N;i++)
	{
		if(A[i]!=B[i])
		{
			cout<<-1<<endl;
			return 0;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3840
//    https://youtu.be/N3oCS85HvpY

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

typedef long long ll;
typedef long double ld;
typedef long long unsigned llu;
typedef pair<long long, long long> pll;
const long long inf = 2000000000000000000LL;	// 2e18
#define pi                  acos(-1.0)
#define fast                ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define shesh               "\n"
#define ff                  first
#define ss                  second
#define pb                  push_back
#define bp                  pop_back
#define pf                  push_front
#define fp                  pop_front
#define ub                  upper_bound
#define lb                  lower_bound
#define all(x)              x.begin(), x.end()
#define debug(x)            cout<<"debug "<<x<<"\n"
#define mest(a,b)           memset(a,b,sizeof(a))

int main(){
    fast;
    ll n,m,i,j,k,temp,flag,ans=0;
    string s,t;
    cin>>s>>t;
    for(i=s.size()-t.size();i>=0&&!ans;i--){
        for(j=i,k=0,flag=0;k<t.size()&&!flag;j++,k++){
            if(s[j]==t[k] || s[j]=='?') continue;
            else flag++;
        }
        if(!flag){
            for(j=i,k=0,flag=0;k<t.size()&&!flag;j++,k++){
                s[j]=t[k];
            }
            ans++;
            break;
        }
    }
    if(!ans){
        cout<<"UNRESTORABLE";
        return 0;
    }
    for(i=0;i<s.size();i++){
        if(s[i]=='?') s[i]='a';
    }
    cout<<s;
    return 0;
}


Measured memory_bytes: 256
'use strict';
(function(stdin) {
  var inputs = stdin.toString().trim().split('\n');

  (function(x) {
    // ????????????????????????
    console.log(Math.pow(x, 3));


  })(parseInt(inputs[0], 10)); // ??°?????????

}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15716
n=int(input())
l=list(map(int,input().split()))
dp=[float("INF")]*n
dp[0]=0;dp[1]=abs(l[0]-l[1])
for i in range(2,n):
  for j in range(1,3):
    dp[i]=min(dp[i-j]+abs(l[i]-l[i-j]),dp[i])
print(dp[-1])


Measured memory_bytes: 13928
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

typedef long long int int64;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))

const int mod=1000000007;

void add(int u,int v,int d,int *vertex,int *cost,int *next,int *start,int index){
  vertex[index]=v;
  cost[index]=d;
  next[index]=start[u];
  start[u]=index;
  return;
}

typedef struct heapnode{
  int64 d;
  int index;
} node;

int cmp(node *a,node *b){
  return a->d<=b->d;
}

void swap(node *a,node *b){
  node t=*a;
  *a=*b;
  *b=t;
  return;
}

node *heap=NULL;
int heapSize=0;

void push(int64 v,int index){
  int k=++heapSize;
  heap[k].d=v;
  heap[k].index=index;
  while(k>1){
    if(cmp(heap+k/2,heap+k)) return;
    swap(heap+k/2,heap+k);
    k/=2;
  }
}

void pop(node *res){
  *res=heap[1];
  heap[1]=heap[heapSize--];
  int k=1;
  while(2*k+1<=heapSize){
    int next=cmp(heap+2*k,heap+2*k+1)?2*k:2*k+1;
    if(cmp(heap+k,heap+next)) return;
    swap(heap+k,heap+next);
    k=next;
  }
  if(2*k<=heapSize && cmp(heap+2*k,heap+k)) swap(heap+2*k,heap+k);
}

void dijkstra(int from,int64 *dp,int *cnt,int n,int *vertex,int *cost,int *next,int *start){
  heapSize=0;
  int64 inf=1000000000LL*100001;
  int i;
  for(i=0;i<n;i++){
    dp[i]=inf;
    cnt[i]=0;
  }
  dp[from]=0;
  cnt[from]=1;
  push(0,from);
  while(heapSize>0){
    node t;
    pop(&t);
    int v=t.index;
    int64 d=t.d;
    if(d>dp[v]) continue;
    int p;
    for(p=start[v];p!=-1;p=next[p]){
      int u=vertex[p];
      if(dp[u]>dp[v]+cost[p]){
	dp[u]=dp[v]+cost[p];
	cnt[u]=cnt[v];
	push(dp[u],u);
      } else if(dp[u]==dp[v]+cost[p]){
	cnt[u]=(cnt[u]+cnt[v])%mod;
      }
    }
  }
  return;
}

void run(void){
  int n,m,s,t;
  scanf("%d%d%d%d",&n,&m,&s,&t);
  s--;
  t--;
  int *vertex=(int *)malloc(sizeof(int)*2*m);
  int *cost=(int *)malloc(sizeof(int)*2*m);
  int *next=(int *)malloc(sizeof(int)*2*m);
  int *start=(int *)malloc(sizeof(int)*n);
  int i;
  for(i=0;i<n;i++) start[i]=-1;
  for(i=0;i<m;i++){
    int u,v,d;
    scanf("%d%d%d",&u,&v,&d);
    u--;
    v--;
    add(u,v,d,vertex,cost,next,start,2*i);
    add(v,u,d,vertex,cost,next,start,2*i+1);
  }
  heap=(node *)malloc(sizeof(node)*(m+1));
  int64 *fromS=(int64 *)malloc(sizeof(int64)*n);
  int *cntS=(int *)malloc(sizeof(int)*n);
  dijkstra(s,fromS,cntS,n,vertex,cost,next,start);
  int64 *fromT=(int64 *)malloc(sizeof(int64)*n);
  int *cntT=(int *)malloc(sizeof(int)*n);
  dijkstra(t,fromT,cntT,n,vertex,cost,next,start);
  int64 min=fromS[t];
  int64 ans=(int64)cntS[t]*cntT[s]%mod;
  for(i=0;i<n;i++){
    if(fromS[i]==fromT[i] && fromS[i]+fromT[i]==min){
      ans=(ans-(int64)cntS[i]*cntS[i]%mod*cntT[i]%mod*cntT[i]%mod+mod)%mod;
    }
  }
  for(i=0;i<n;i++){
    int u=i;
    int p;
    for(p=start[u];p!=-1;p=next[p]){
      int v=vertex[p];
      if(fromS[v]==fromS[u]+cost[p] && fromS[v]+fromT[v]==min && MAX(fromS[u],fromT[v])<MIN(fromS[v],fromT[u])){
	ans=(ans-(int64)cntS[u]*cntS[u]%mod*cntT[v]%mod*cntT[v]%mod+mod)%mod;
      }
    }
  }
  printf("%lld\n",ans);
  return;
}

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


Measured memory_bytes: 10496
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<ll, ll, ll> T;

int N, K;
map<int, int> mp;

int main(void){
    
    scanf("%d %d", &N, &K);
    for(int i = 0; i < N; ++i){
        int a; scanf("%d", &a);
        ++mp[a];
    }
    
    vector<P> v;
    for(auto m : mp) v.push_back(make_pair(m.second, m.first));
    sort(v.begin(), v.end(), greater<P>());
    
    int cnt = 0;
    for(int i = 0; i < K && i < v.size(); ++i) cnt += v[i].first;
    printf("%d\n", N - cnt);
    
    return 0;
}



Measured memory_bytes: 11768
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

from math import gcd

mod = int(1e9+7)
n = ii()
cnd = {}
azero = 0
bzero = 0
allzero = 0
for _ in range(n):
    a,b = iim()
    if a*b == 0:
        if a == 0 and b != 0:
            azero += 1
        elif a != 0 and b == 0:
            bzero += 1
        else:
            allzero += 1
    else:
        g = gcd(a,b)
        a //= g
        b //= g
        if a<0:
            a *= -1
            b *= -1
        before = cnd.get((a,b),False)
        if b > 0:
            check = cnd.get((b,-a),False)
        else:
            check = cnd.get((-b,a),False)
        if before:
            cnd[(a,b)] = [before[0]+1,before[1]]
        elif check:
            if b > 0:
                cnd[(b,-a)] = [check[0],check[1]+1]
            else:
                cnd[(-b,a)] = [check[0],check[1]+1]
        else:
            cnd[(a,b)] = [1,0]

cnd[0] = [azero,bzero]
noreg = 0
ans = 1
#print(cnd)
for item in cnd.values():
    if item[0] == 0  or item[1] == 0:
        noreg += max(item[0],item[1])
    else:
        ans *= (2**item[0]+2**item[1]-1)
        ans %= mod
print((ans*((2**noreg)%mod)-1+allzero)%mod)

Measured memory_bytes: 63844
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define PI acos(-1)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}

int main(){
   int n,k;
   cin>>n>>k;
   vector<int> a(n);
   rep(i,n){
      cin>>a[i];
   }
   int ans=0;
   sort(a.begin(),a.end());
   int c=0;

   while(1){
      for(int i=c;i<c+k;i++){
         a[i]=1;
         if(i==n-1) break;
      }
      c=c+k-1;
      ans++;
      if(c>=n-1) break;
   }
   cout<<ans;
   return 0;
}


Measured memory_bytes: 3780
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h)cin >> s[i];
    vector<vector<ll>> dp(h, vector<ll>(w, 0));
    ll mod = 1000000007;
    dp[0][0] = 1;
    rep(i, h)rep(j, w){
        if(j < w - 1){
            if(s[i][j+1] != '#'){
                (dp[i][j+1] += dp[i][j]) %= mod;
            }
        }
        if(i < h - 1){
            if(s[i+1][j] != '#'){
                (dp[i+1][j] += dp[i][j]) %= mod;
            }
        }
    }
    cout << dp[h-1][w-1] << endl;
}

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

signed main(){
	vector<int> A={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int K;cin>>K;
	cout<<A[K-1]<<endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <string>
#include <vector> 
#include <algorithm>
 
#define FOR(i,a,b) for(i=(a);i<(b);++i) 
#define REP(i,n) for(i=0;i<(n);++i)
 
using namespace std;
 
int main() {
	int N, K, i, j, pos, ans = 0;
	vector<int> A(100000);
	cin >> N >> K;
	REP(i, N) {
		cin >> j;
		A[i] = j;
	}
	if (N == K) {
		cout << "1" << endl;
		return 0;
	}
 
	pos = find(A.begin(), A.end(), 1) - A.begin();
	//cout << pos << endl;
	ans = (pos + K - 2) / (K - 1);
	//cout << ans << endl;
	if (pos % (K - 1)==0)
		pos = find(A.begin(), A.end(), 0) - find(A.begin(), A.end(), 1) - 1;
	else
		pos = find(A.begin(), A.end(), 0) - find(A.begin(), A.end(), 1) - 1 - (K-1-(pos % (K - 1)));
	//cout << pos << endl;
	ans += (pos + K - 2) / (K - 1);
	cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
using namespace std;

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 <math.h>

#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;

int main() {
    long long n,d,count=0;
    cin >> n >> d;
    long long x[n], y[n];
    for (int i = 0; i < n;i++){
        cin >> x[i] >> y[i];
        if ((x[i] * x[i]) + (y[i] * y[i]) <= d * d) count++;
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 6724
n, k, c = map(int, input().split())
s = input()

l_list, r_list = [], []
tmp = 0
b = 0

for i in range(len(s)):
    if s[i] == 'o' and b == 0 and tmp < k:
        l_list.append(i)
        tmp += 1
        b = c
    
    elif b > 0:
        b -= 1

tmp = 0
b = 0
for i in range(len(s) - 1, -1, -1):
    if s[i] == 'o' and b == 0 and tmp < k:
        r_list.append(i)
        tmp += 1
        b = c
        
    elif b > 0:
        b -= 1

for i in range(k):
    if r_list[k - i - 1] == l_list[i]:
        print(l_list[i] + 1)

Measured memory_bytes: 20672
<?php
  fscanf(STDIN, "%d %d %d %d %d", $a, $b, $c, $d, $e);
  if($a == 0) echo 1;
  if($b == 0) echo 2;
  if($c == 0) echo 3;
  if($d == 0) echo 4;
  if($e == 0) echo 5;
 

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

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

using namespace std;
using lint=long long;

int main(){
	int n; cin>>n;
	vector<pair<int,int>> a(n);
	rep(i,n){
		int l,r; cin>>l>>r;
		a[i]=minmax(l,r);
	}

	int mx=0,mn=1e9;
	rep(i,n){
		mx=max(mx,a[i].second);
		mn=min(mn,a[i].first);
	}

	lint ans=1LL<<61;
	{
		int rmx=mn,bmn=mx;
		rep(i,n){
			rmx=max(rmx,a[i].first);
			bmn=min(bmn,a[i].second);
		}
		ans=min(ans,1LL*(rmx-mn)*(mx-bmn));
	}
	{
		sort(a.begin(),a.end());
		multiset<int> S;
		rep(i,n) S.emplace(a[i].first);
		rep(i,n+1){
			int bmn=*S.begin(),bmx=*S.rbegin();
			ans=min(ans,1LL*(mx-mn)*(bmx-bmn));
			if(i<n){
				S.erase(S.find(a[i].first));
				S.emplace(a[i].second);
			}
		}
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 11136
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
float tem(int H[], int i, int T){
	float M;
	M=(float)T-0.006*H[i];
	return M;
}
float close(int H[], int i, int A, int T){
	float M,min;
	M=tem(H,i,T);
	min=fabs(tem(H,i,T)-A);
	return min;
}
int main(void){
	int N,i,f;
	float min;
	scanf("%d",&N);
	int T, A;
	while(1){
		scanf("%d %d",&T,&A);
		if(T>=A){
			break;
		}
	}
	int H[N];
	for(i=0;i<N;i++){
		scanf("%d",&H[i]);
	}
	min=close(H,0,A,T);
	f=1;
	for(i=1;i<N;i++){
		if(min>close(H,i,A,T)){
			min=close(H,i,A,T);
			f=i+1;
		}
	}
	printf("%d\n",f);
	return 0;
}

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

int main(void){
  int a, b, k;
  cin >> a >> b >> k;
  for(int i = 0; i < k; i++){
    if(i % 2 == 0){
      if(a % 2 == 0){
	a /= 2;
	b += a;
      }else{
	a--;
	a /= 2;
	b += a;
      }
    }else{
      if(b % 2 == 0){
	b /= 2;
	a += b;
      }else{
	b--;
	b /= 2;
	a += b;
      }
    }
  }
  cout << a << " " << b << endl;
  return 0;
}


Measured memory_bytes: 256
# ABC136 D - Gathering Children
S = input()

right = []
left = []
idx = []

r_cnt = 0
l_cnt = 0
s_tmp = 'R'

for i,s in enumerate(S):

    if s_tmp == 'R':
        if S[i:i+1] == S[i+1:i+2]:
            r_cnt += 1
        else:
            r_cnt += 1
            right.append(r_cnt)
            idx.append(i)
            r_cnt = 0
            s_tmp = 'L'
            continue

    if s_tmp == 'L':
        if S[i:i+1] == S[i+1:i+2]:
            l_cnt += 1
        else:
            l_cnt += 1
            left.append(l_cnt)
            # idx.append(i)
            l_cnt = 0
            s_tmp = 'R'
            continue
    
    if i == len(S):
        if s_tmp == 'R':
            right.append(r_cnt)
        elif s_tmp == 'L':
            left.append(l_cnt)

# print('r:',right)
# print('l:',left)
# print('idx:',idx)
ans = [0 for i in range(len(S))]

for i in range(len(right)):
    if (right[i]+left[i])%2 == 0:
        ans[idx[i]] = (right[i]+left[i])//2
        ans[idx[i]+1] = (right[i]+left[i])//2
    else:
        t = max(right[i],left[i])-1
        if t%2 == 0:
            if right[i]>left[i]:
                ans[idx[i]] = (right[i]+left[i])//2 + 1
                ans[idx[i]+1] = (right[i]+left[i])//2
            elif right[i]<left[i]:
                ans[idx[i]] = (right[i]+left[i])//2
                ans[idx[i]+1] = (right[i]+left[i])//2 + 1
        else:
            if right[i]>left[i]:
                ans[idx[i]] = (right[i]+left[i])//2
                ans[idx[i]+1] = (right[i]+left[i])//2 + 1
            elif right[i]<left[i]:
                ans[idx[i]] = (right[i]+left[i])//2 + 1
                ans[idx[i]+1] = (right[i]+left[i])//2
print(*ans)

Measured memory_bytes: 9244
<?php
$n = intval(trim(fgets(STDIN)));
$s = trim(fgets(STDIN));

$max = 0;
for($i = 0; $i < $n; $i++){
    for($j = $i+$max+1; $j < $n; ++$j){
        $ss = substr($s, $i, $j-$i);
        if(strpos($s, $ss, $j) === false){
            break;
        }else{
            if($max<$j-$i)$max=$j-$i;
        }
    }
}
echo $max;


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

using namespace std;

#define all(x) x.begin(), x.end()
#define sz(x) (int) x.size()
#define pb push_back
#define endl '\n'
#define snd second
#define fst first
#define fastio cin.tie(NULL),cout.sync_with_stdio(true)

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector <int> vi;
typedef pair <ll, int> ii;
typedef pair <ii,int> iii;

const ll inf = 1e17;
const ll mod = 1e9 + 7;
const int N = 200005;

void solve(){
	int a;
	cin >> a;
	cout << a+a*a+a*a*a << endl;
}

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


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

using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))

#define MOD 1000000007
#define INF 1000000000
#define MAX_N 60

int ans[MAX_N][MAX_N];
int H, W;
vector<string> S;

int main()
{
    ZERO(ans);
    cin >> H >> W;
    REP(i, H) {
        string s;
        cin >> s;
        REP(j, W) {
            if(s[j] == '#') {
                if(i - 1 >= 0) {
                    if(j - 1 >= 0) { ans[i-1][j-1]++; }
                    ans[i-1][j]++;
                    if(j + 1 < W) { ans[i-1][j+1]++; }
                }
                if(j - 1 >= 0) { ans[i][j-1]++; }
                if(j + 1 < W) { ans[i][j+1]++; }
                if(i + 1 < H) {
                    if(j - 1 >= 0) { ans[i+1][j-1]++; }
                    ans[i+1][j]++;
                    if(j + 1 < W) { ans[i+1][j+1]++; }
                }
            }
        }
        S.push_back(s);
    }
    REP(i, H) {
        REP(j, W) {
            if(S[i][j] == '#') { printf("#"); }
            else { printf("%d", ans[i][j]); }
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 256
from collections import Counter
import numpy as np


N, M = map(int, input().split())
A = np.array(list(map(int, input().split())))

A = np.cumsum(A) % M
C = Counter(A)

res = 0
for c in C.items():
    if c[1] > 1:
        res += (c[1]*(c[1]-1)) // 2
    if c[0] == 0:
        res += c[1]

print(res)


Measured memory_bytes: 23364
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long ans = lcm(a,b);
        System.out.println(ans);
    }

    public static long lcm(long a,long b){
        return a*b / gcd(a,b);
    }
    public static long gcd(long a,long b){
        if(a < b)return gcd(b,a);
        if(b == 0)return a;
        return gcd(b,a%b);
    }
}

Measured memory_bytes: 21844
#![allow(non_snake_case, unused_imports)]

// Input macros
macro_rules! input { (source = $s:expr, $($r:tt)*) => { let mut iter = $s.split_whitespace(); let mut next = || { iter.next().unwrap() }; input_inner!{next, $($r)*} }; ($($r:tt)*) => { let stdin = std::io::stdin(); let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock())); let mut next = move || -> String{ bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect() }; input_inner!{next, $($r)*} }; }
macro_rules! input_inner { ($next:expr) => {}; ($next:expr, ) => {}; ($next:expr, $var:ident : $t:tt $($r:tt)*) => { let $var = read_value!($next, $t); input_inner!{$next $($r)*} }; ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => { let mut $var = read_value!($next, $t); input_inner!{$next $($r)*} }; }
macro_rules! read_value { ($next:expr, ( $($t:tt),* )) => { ( $(read_value!($next, $t)),* ) }; ($next:expr, [ $t:tt ; $len:expr ]) => { (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() }; ($next:expr, [ $t:tt ]) => { { let len = read_value!($next, usize); (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>() } }; ($next:expr, chars) => { read_value!($next, String).chars().collect::<Vec<char>>() }; ($next:expr, bytes) => { read_value!($next, String).into_bytes() }; ($next:expr, usize1) => { read_value!($next, usize) - 1 }; ($next:expr, $t:ty) => { $next().parse::<$t>().expect("Parse error") }; }

// Module
use std::cmp::{min,max};
use std::collections::{HashSet,HashMap,VecDeque,BinaryHeap};

// Functions

// Main
fn main(){

    input!{
        S: chars,
    }

    let mut q = VecDeque::new();
    for s in S{
        if s=='B'{
            q.pop_back();
        }else{
            q.push_back(s);
        }
    }

    println!("{}", q.into_iter().collect::<String>());
}

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

int main()
{
    int num[9];
    bool bingo[9];
    for (int i = 0; i < 9; i++)
    {
        bingo[i] = false;
        cin >> num[i];
    }
    int N, b;
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> b;
        for (int j = 0; j < 9; j++)
        {
            bingo[j] = bingo[j] || (num[j] == b);
        }
    }
    for (int i = 0; i < 9; i += 3)
    {
        if (bingo[i] && bingo[i + 1] && bingo[i + 2])
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    for (int i = 0; i < 3; i++)
    {
        if (bingo[i] && bingo[i + 3] && bingo[i + 6])
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    if ((bingo[0] && bingo[4] && bingo[8]) || (bingo[2] && bingo[4] && bingo[6]))
    {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>

using namespace std;

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

    for (int x = 111; x <= 999; x += 111)
    {
        if (N <= x)
        {
            cout << x << endl;
            break;
        }
    }
}


Measured memory_bytes: 256
#include <string>
#include <iostream>
#include <math.h>

using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	if (A >= 13)cout << B<<endl;
	if (A <= 12) {
		if (A <= 5)cout << 0 << endl;
		else cout << B / 2 << endl;
	}
		return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3

def main():
    n = int(input())
    *p, = map(int, input().split())

    cnt = 0
    for i in range (1, n-1):
        if (p[i + 1] > p[i] and p[i] > p[i - 1]) or (p[i + 1] < p[i] and p[i] < p[i - 1]):
            cnt += 1
    print(cnt)


main()

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <queue>
using namespace std;
typedef long long ll;
#define PI 3.14159265359

int main() {
  ll N;
  cin >> N;
  cout << N + N*N + N*N*N << endl;
  return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

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

        Scanner myScanner = new Scanner(System.in);
        int numberOfPeople = myScanner.nextInt();
        int trainCost = myScanner.nextInt();
        int taxiCost = myScanner.nextInt();
        if((taxiCost) < (numberOfPeople * trainCost)){
            System.out.println(taxiCost);
        }
        else {
            System.out.println(numberOfPeople*trainCost);
        }

    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
#include <bitset>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <math.h>
#include <iomanip>

using namespace std;

/********** TEMPLATE STARTS HERE ***********/

#define IOS ios::sync_with_stdio(false), cin.tie(0);
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define pb push_back
#define PI 3.1415926535897932384626433832795
#define gcd __gcd 

typedef unsigned long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <long long> vl;
typedef vector <pll> vll;
typedef vector <pii> vii;

const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;

template <typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template <typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }

/*********** TEMPLATE ENDS HERE *************/

unordered_map <char, bool> H;

main()
{
	IOS
	
	int n;
	cin >> n;
	
	int nr = 0;
	
	while(n--)
	{
		char c;
		cin >> c;
		
		if(H[c] == 0)
			nr++;
		
		H[c] = 1;
	}
	
	if(nr == 4)
		cout << "Four";
	else
		cout << "Three";
}

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

using namespace std;

typedef double D;
typedef long long int LL;

#define st first
#define nd second
#define PLL pair <LL, LL>
#define PII pair <int, int>

const int N = 1e6 + 7;
const int MX = 1e9 + 7;
const LL INF = 1LL * MX * MX;

int m;
long long ans = 0, sum = 0;

int main(){
	scanf("%d", &m);
	for(int i = 1; i <= m; ++i){
		long long d; long long c;
		scanf("%lld %lld", &d, &c);
		
		ans += c;
		sum += d * c;
	}
	
	ans--;
	ans += (sum - 1) / 9LL;
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
/// @file

#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

namespace {

bool run(std::istream& is, std::ostream& os);
}  // unnamed namespace

/// @brief エントリポイント
#ifdef _TEST
static int run()
#else
int main()
#endif
{
  try {
    if (run(std::cin, std::cout) == false) {
      std::cerr << "main funciton error.\n";
      return EXIT_FAILURE;
    }
  } catch (const std::exception& e) {
    std::cerr << "catch exception\n";
    std::cerr << e.what() << "\n";
    return EXIT_FAILURE;
  }

  return EXIT_SUCCESS;
}

namespace {

/// @brief 実行処理
bool run(std::istream& is, std::ostream& os)
{
  const std::string CONNECT_STR("Yay!");
  const std::string DISCONNECT_STR(":(");
  const int ANTENNA_NUM(5);
  std::vector<int> distances(ANTENNA_NUM);
  int k;
  for (auto& v: distances) is >> v;
  is >> k;

  std::sort(distances.begin(), distances.end());
  const int MAX_DISTANCE(distances.back() - distances.front());

  const std::string* anser(&CONNECT_STR);
  if (MAX_DISTANCE > k) anser = &DISCONNECT_STR;

  os << *anser << "\n";

  return true;
}
}  // unnamed namespace


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repd(i,a,b) for (int i = (a); i < (b); i++)
typedef long long ll;
int main(void)
{
	int n, sum = 100000;
	cin >> n;
	rep(i, n)
	{
	    sum *= 1.05;
        if (sum%1000!=0) sum = (sum/1000 + 1)*1000;
	}
    cout << sum << endl;
}


Measured memory_bytes: 3020
#include<stdio.h>
int main(){

  int i,j,data,minj,flag,count=0,temp;
  int a[101];
  scanf("%d",&data);
  for(i=0;i<data;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<data;i++){
    minj = i;
    flag = 0;
    for(j=i;j<data;j++){
      if(a[j] < a[minj]){
	minj = j;
	flag = 1;
      }
    }
    if(flag == 1){
      temp = a[minj];
      a[minj] = a[i];
      a[i] = temp;
      count++;
    }
  }

  for(i=0;i<data;i++){
    if(i == data -1){
      printf("%d\n",a[i]);
      break;
    }
    printf("%d ",a[i]);
  }

  printf("%d\n",count);
  return 0;
}



Measured memory_bytes: 2028
#[allow(dead_code)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(dead_code)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(dead_code)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        r: f64
    }
    println!("{}", r * 2f64 * std::f64::consts::PI);
}


Measured memory_bytes: 2196
// https://atcoder.jp/contests/abc126/tasks/abc126_c

#include <bits/stdc++.h>
#define REP(i, n) for (int(i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for (int(i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for (int(i) = (m); (i) < (n); i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;

int main()
{
  int N, K, mm = 0;
  vector<int> a(18, 0);
  ll win = 0;

  cin >> N >> K;

  FOR(i, 1, N + 1)
  {
    int index = K <= i ? 0 : ceil(log2((double)K / i));
    mm = max(mm, index);
    a[index]++;
  }

  REP(i, mm + 1)
  {
    win *= 2;
    if (0 < a[i])
      win += a[i];
  }

  cout << fixed << setprecision(12) << win * pow(2, -1 * mm) / N << '\n';

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        Scanner sc = new Scanner(System.in);

        for(int i = 0; ; i++){
            int a = sc.nextInt();
            if( a == 0){
                break;
            }

            System.out.println("Case " + (i+1) +": " + a);
        }
    }
}



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

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl;

const int INF=0x3f3f3f3f;


typedef pair<int,int> pii;

/*
#ifdef MYDEBUG
#include"debug.h"
#include"print.h"
#endif
*/
// }}}

void solve(int N, int M, vector<int> a, vector<int> b){
	unordered_map<int,unordered_set<int> > g;
	REP(i,M)g[a[i]].insert(b[i]);
	REP(i,M)g[b[i]].insert(a[i]);
	bool valid = false;
	for(int u=1;u<N-1;u++){
		if(g[0].find(u)!=g[0].end() and g[u].find(N-1)!=g[u].end()){
			valid = true;
		}
	}
	if(valid){
		cout<<"POSSIBLE"<<endl;
	}else{
		cout<<"IMPOSSIBLE"<<endl;
	}
}

int main(){	
	int M;
	int N;
	scanf("%d",&N);
	scanf("%d",&M);
	vector<int> a(M-1+1);
	vector<int> b(M-1+1);
	for(int i = 0 ; i <= M-1 ; i++){
		scanf("%d",&a[i]);
		scanf("%d",&b[i]);
		a[i]--;b[i]--;
	}
	solve(N, M, a, b);
	return 0;
}



Measured memory_bytes: 41708
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>

#define for0(i, N)    for (int i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (int i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (int i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (int i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (int i = (x); i <  (N); ++i)
#define forl(i, N, x, a) for (int i = (x), a = 0; a < (N);  \
                              i = (i + 1) % (N), ++a)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;
typedef pair<ll, ll> pll;
typedef map<ll, ll> mll;
typedef unordered_map<ll, ll> umll;
typedef set<ll> sll;
typedef unordered_set<ll> usll;


int main(void){
    cin.tie(0); ios::sync_with_stdio(false);
    ll x;
    cin >> x;

    ll up = x / 100;
    ll down = x % 100;


    ll r = 0;
    for (int i = 5; i >= 1; --i) {
        r += down / i;
        down %= i;
    }

    cout << (up >= r ? 1 : 0);


    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int x,a,b;
	cin >> x >> a >> b;
	if(abs(x-a)<abs(x-b)){
		cout << "A" << endl; 
	}else{
		cout << "B" << endl;
	}
	return 0;
}

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

void Main() {
  int h, a;
  cin >> h >> a;

  if (h % a == 0) cout << h / a << endl;
  else cout << h / a + 1 << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256