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

#define rep(i,n) for (int i = 0; i< (n); ++i)
#define vvec(m,n) vector<vector<int>> (int(m), vector<int>(n))
#define ALL(a) (a).begin(), (a).end()

using ll = long long;

int main(){
    int n, k;
    cin >> n >> k;
    int i = 1;
    int ans = 1;
    while(ans*k <= n){
        ans = ans * k;
        i++;
    }
    cout << i << endl;

}

Measured memory_bytes: 256
_,a,b,*H=map(int,open(0).read().split())
l,r=0,10**9
while r-l>1:
	m=(l+r)//2
	if-sum(min(0,(h-m*b)//(b-a))for h in H)>m:l=m
	else:r=m
print(r)


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

using namespace std;

int main() {
    string s, t;    cin >> s >> t;
  
    int ls = s.length(), lt = t.length();
    bool can = false;

    if (ls < lt) {
        cout << "UNRESTORABLE" << endl;
        return 0;
    }
    
    int ans = 0;

    for (int i = 0; i <= ls-lt; i++) {
        bool can_ = true;
        for (int j = 0; j < lt; j++) {
            if (s[i+j] != t[j] && s[i+j] != '?')
                can_ = false;
        }
        if (can_) {
            ans = i;
            can = true;
        }
    }
    if (can) {
        for (int i = 0; i < ls; i++) {
            if (i != ans)
                cout << ((s[i] != '?') ? s[i] : 'a');
            else {
                cout << t;
                i += lt-1;
            }
        }
        cout << endl;
    }
    else 
        cout << "UNRESTORABLE" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
#include <string.h>
#include <queue>
#include <functional>
#include <utility>
using namespace std;
signed main() {
	int a, b;
	cin >> a >> b;
	if (a > 0)cout << "Positive";
	else {
		if (b >= 0)cout << "Zero";
		else {
			int judge = b - a;
			if (judge % 2)cout << "Positive";
			else cout << "Negative";
		}
	}
	return 0;
}


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

using namespace std;

int c()
{
    int n;
    cin >> n;
    vector<vector<int>> a(2, vector<int>(n));
    for(int i = 0; i < 2; i++)
    {
        for(int j = 0; j < n; j++)
        {
            cin >> a[i][j];
        }
    }
    int max_count = 0;
    for(int i = 0; i < n; i++)
    {
        int j = 0;
        int count = 0;
        bool flag = true;
        for(int k = 0; k < n; k++)
        {
            count += a[j][k];
            if(k == i && flag) {
                j = 1;
                k--;
                flag = false;
            }
        }
        max_count = max(count, max_count);
    }
    cout << max_count << endl;
}

int main() {
    c();
    return 0;
}


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

int cnt[4];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    if (s == "AC") {
      ++cnt[0];
    } else if (s == "WA") {
      ++cnt[1];
    } else if (s == "TLE") {
      ++cnt[2];
    } else {
      ++cnt[3];
    }
  }
  cout << "AC x " << cnt[0] << endl;
  cout << "WA x " << cnt[1] << endl;
  cout << "TLE x " << cnt[2] << endl;
  cout << "RE x " << cnt[3] << endl;
}


Measured memory_bytes: 3624
#include<iostream>
#include<stdio.h>
#include<vector>//s1.erase(n)=文字列s1の、n文字目以降削除
#include<algorithm>//辞書順=next_permutation
#include<set>
#include<string>//char 小文字のほうが32大きい
#include<sstream>
#include<string.h>
#include<complex>
#include<time.h>
#include<random>
#include<cmath>
#include<math.h>
#include<queue>
#include<time.h>
#include<iomanip>
#include<locale>
#include<utility>//swap=数値交換

#define rt "\n"
#define rep(i,n) for(int i=0;i<n;i++)
#define rop(i,n) for(int i=1;i<=n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define drop(i,n) for(int i=n;0<i;i--)
#define yes(ans) if(ans)cout<<"yes"<<rt;else cout<<"no"<<rt;
#define Yes(ans) if(ans)cout<<"Yes"<<rt;else cout<<"No"<<rt;
#define YES(ans) if(ans)cout<<"YES"<<rt;else cout<<"NO"<<rt;
#define sec(a,b,ans) if(ans)cout<<a<<rt;else cout<<b<<rt;
#define vcin(s,n) rep(i,n)cin>>s[i];//vcin(配列名),(繰り返し回数)
#define sort(s) sort(s.begin(),s.end())//標準=昇順
#define reve(s) reverse(s.begin(),s.end())
#define asas int ans=0
#define llcncn llint cnt=0
#define llasas llint ans=0
#define str string
#define please return
#define AC 0
#define ic_a int a;cin>>a;
#define ic_b int b;cin>>b;
#define ic_s string s;cin>>s;
#define Rapid_pleaseAC_fast cin.tie(0);ios::sync_with_stdio(false)
#define Pi 3.1415926535897932384626
#define nine 1000000000
using ll = long long;
using namespace std;
typedef vector<int> vint;
typedef vector<string> vstr;
typedef vector<char> vchar;
typedef vector<double> vdou;
typedef long long int llint;
typedef pair<int, int> pint;
typedef pair<llint, llint> pllint;
typedef vector<llint> vllint;
typedef vector<pint> vpint;
typedef vector<pair<llint, llint>> vpllint;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
typedef vector<vector<llint>> vvllint;
typedef vector<vector<string>> vvstr;
typedef vector<vector<bool>> vvbool;
typedef vector<vector<pint>> vvpint;
typedef vector<bool> vbool;
typedef long double ld;
const ld eps = 1.0e-12; // 許容される誤差
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

long long LCM(long long a, long long b) {
	return a * b / GCD(a, b);
}

unsigned GetDigit(unsigned num) {
	return std::to_string(num).length();
}

int tow(int n) {//2のn乗
	if (n == 0)return 1;
	int x = tow(n / 2);
	x *= x;
	if (n % 2 == 1)x *= 2;
	return x;//@domino
}

int keta(int n) {
	int sum = 0;
	while (n != 0) {
		sum += n % 10; n /= 10;
	}
	return sum;//Nanashi,tRue,wai
}

/*

 (char)toupper(a[n])=文字列のn文字目を大文字で出力

  pow(a,b)=aのb乗

  */
ld mysqrtl(ld x)
{
	ld a = sqrtl((double)x); // 近似値
	do {
		a = (a + x / a) / 2.0L;
	} while (fabsl(x - a * a) > eps);
	return a;
}
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);

}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//平方根を求める。sqrtより精度が高い。
//epsを変えて誤差を調整する。
int main(void) {
	Rapid_pleaseAC_fast;
	llint ans = 0, n = 0,  count = 0, sum = 0;
    llint  x,y;
	bool check = false;
	string ss, sss;
	vector<llint> array;
	vector<bool> bo;
	cin >> x >> y;
	if (y % 2 == 1)cout << "No" << endl;
	else if (x * 2 <= y && x * 4 >= y)cout << "Yes" << endl;
	else cout << "No" << endl;
	
	please AC;
}


Measured memory_bytes: 3676
#include<bits/stdc++.h>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, K, Q;
  int m[100003];
  int a;

  cin >> N >> K >> Q;
  REP(i, 1, N+1){
    m[i] = 0;
  }

  rep(i, Q){
    cin >> a;
    m[a] += 1;
  }
  //
  // REP(i, 1, N+1){
  //   cout << m[i] << endl;
  // }
  // cout << Q-K+1 << endl;
  if (Q < K) {
    rep(i, N){
      cout << "Yes" << endl;
    }
  } else {
    REP(i, 1, N+1){
      if (m[i] >= (Q - K + 1)) {
        cout << "Yes" << endl;
      } else {
        cout << "No" << endl;
      }
    }
  }


}

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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <queue>
#include <stack>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int gcd(int a, int b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));}

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

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}

int main(void){
  ios::sync_with_stdio(false);
  string s, t;
  cin >> s >> t;
  bool flag = false;
  for (char i='a';i<='z';i++){
    if (s + i == t){
      flag = true;
    }
  }
  if (flag) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 3660
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<complex>
using namespace std;
const long long mod=998244353;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
int t[110000];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<a;i++){
		int p;scanf("%d",&p);p--;
		t[p]=i;
	}
	for(int i=0;i<a;i++){
		if(i)printf(" ");printf("%d",t[i]+1);
	}printf("\n");
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define inf 1e+9
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,k;
    cin >> n >> k;
    int h[n];
    for (int i=0; i < n; i++) cin >> h[i];
    int dp[n];
    fill_n(dp, n, inf);
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j <= i+k; j++)
            if (j < n)
                dp[j] = min(dp[j], dp[i] + abs(h[i]-h[j]));
    }
    cout << dp[n-1] << "\n";
    return 0;
}

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main(){
	reader := bufio.NewReader(os.Stdin)
	writer := bufio.NewWriter(os.Stdout)
	defer writer.Flush()

	var A, B, H uint
	fmt.Fscan(reader, &A, &B, &H)
	fmt.Fprintln(writer, (A+B)*H/2)
}

Measured memory_bytes: 640
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO.Compression;
using System.Linq;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Text;
using System.Text.RegularExpressions;
using Console = System.Console;

namespace Atcoder
{

    class Program
    {
        private const long COMDIV = 1000000007;

        static void Main(string[] args)
        {
            var DTS = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (DTS[0] <= DTS[1] * DTS[2])
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

Measured memory_bytes: 28280
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INFLL LLONG_MAX // 9223372036854775807
#define EPS 1e-9
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
#define Init() std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout<<fixed<<setprecision(15);
template<class T>bool chmax(T &a, const T &b){ if(a<b){ a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b){ if(b<a){ a=b; return 1; } return 0; }
using namespace std;

int main(){
    Init();
    ll a, b; cin >> a >> b;
    if(a+b == 15) cout << "+" << endl;
    else if(a*b == 15) cout << "*" << endl;
    else cout << "x" << endl;
}

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

int main() {
	int r, c;
	cin >> r >> c;
	int h[101][101];
	for (int i = 0; i<r; i++) {
		for (int j = 0; j<c; j++) {
			cin >> h[i][j];
		}
	}

	int csum;
	int rsum[101];

	for (int i = 0; i < 101; i++) {
		rsum[i] = 0;
	}
	for (int i = 0; i <= r; i++) {
		csum = 0;
		for (int j = 0; j <= c; j++) {
			if (i != r) {
				if(j!=c)csum += h[i][j];
				if (j != c)rsum[j] += h[i][j];
				if (j == c) cout << csum << endl;
				else cout << h[i][j] << " ";
			}
			else {
				if (j != c)csum += rsum[j];
				if (j == c) cout << csum << endl;
				else cout << rsum[j] << " ";
			}
		}
	}
}

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

#define REP(i,n) for(ll i=0; i < (n); ++i)
#define REPR(i,n) for(ll i=(n); i >= 0; --i)
#define FOR(i, m, n) for(ll i = (m); i < (n); ++i)

#define INF 1e12+5

int main(){
  ll N;
  cin >> N;
  ll ans = INF;
  FOR(i, 1, ll(sqrt(N)+1)){
    if(N % i == 0){
      ll x = i, y = N/i;
      //cout << x << " " << y << endl;
      ans = min(ans, x-1+y-1);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
//#define int long long
#define loop(i, a, b) for(int i = a; i < b; i++)
#define rep(i, a) loop(i, 0, a)
#define all(a) (a).begin(),(a).end()
using namespace std;
const int MOD = 1e9 + 7, INF = 1e9;
using vi = vector <int>;
using vvi = vector <vi>;
//g++ -std==c++14
#define MAX_V (110)

signed main(){
	string s;
	cin >> s;
	bool va[4] = {false};
	rep(i, s.size()){
		if(s[i] == 'W')va[0] = true;
		if(s[i] == 'E')va[1] = true;
		if(s[i] == 'N')va[2] = true;
		if(s[i] == 'S')va[3] = true;
	}
	if((va[0] && va[1] && va[2] == va[3])
		|| (va[2] && va[3] && va[0] == va[1]))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;	
}


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

namespace ABC124 {
	class ABC124_B {
		static void Main(string[] args) {

			var N = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).First();
			var H = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

			var currentMax = H[0];
			var count = 1;
			for (int i = 1; i < N; i++) {
				if(currentMax <= H[i]) {
					currentMax = H[i];
					count++;
				}
			}

			Console.WriteLine(count);
		}
	}
}


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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

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

    ll n, k;
    cin >> n >> k;
    cout << n - k + 1 << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<iostream>
#define N 210000
using namespace std;
int n,m,a[N],b[N],ans,num;
struct node{int l,r,c;}A[N];
int solve(int lim)
{
	for(int i=1;i<=m;i++) b[i]=(a[i]>=lim);
	num=0;
	int i=1;
	while(i<m)
	{
		if(b[i]!=b[i+1]) {i++;continue;}
		A[++num].l=i;A[num].c=b[i];
		while(i<m && b[i+1]==b[i]) i++;
		A[num].r=i;
	}
	if(num==0) return b[1];
	A[0].r=0;
	for(int i=1;i<=num;i++)
	{
		int l=A[i-1].r+1,r=A[i].l-1;
		if(l>r) continue;
		int mid=(l+r)/2;
		A[i-1].r=mid;A[i].l=mid+1;
	}
	int l=A[num].r+1,r=m,mid;
	if(l<=r) {mid=(l+r)/2;A[num].r=mid;}
	for(int i=1;i<=num;i++) if(A[i].l<=n && A[i].r>=n) return A[i].c;
}
int main()
{
	scanf("%d",&n);
	m=2*n-1;
	for(int i=1;i<=m;i++) scanf("%d",&a[i]);
	int l=1,r=m;
	while(l<=r)
	{
		int mid=(l+r)/2;
		if(solve(mid)) ans=mid,l=mid+1;
		else r=mid-1;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 2816
#define _CRT_SECURE_NO_WARNINGS
#define REL

#pragma GCC optimize("Ofast")

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <string>
#include <set>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <cassert>
#include <complex>
#include <stack> 
#include <random>

using namespace std;

typedef int64_t i64;
typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef complex <LD> cld;
typedef unsigned int uint;
typedef complex <double> cd;
typedef unsigned long long ULL;

#define endl "\n"
#define dendl "\n\n"
#define mp make_pair
#define mt make_tuple
#define size(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

/////////////////////////////////////////////////////////////////////

template <typename T>
T sqr(T a) {
	return a * a;
}

template <typename T>
int sign(T a) {
	if (a == 0)
		return 0;
	return (a > 0 ? 1 : -1);
}

template <typename T1, typename T2>
T2 sum_mod(T1 x, T2 MOD) {
	if (x < 0)
		x += MOD;
	if (x >= MOD)
		x -= MOD;
	return x;
}

template <typename T1, typename T2>
T2 mul_mod(T1 x, T2 MOD) {
	if (x < 0)
		return (abs(x) % MOD == 0 ? 0 : MOD - abs(x) % MOD);
	return x % MOD;
}

template <typename T>
bool uax(T& a, const T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T>
bool uin(T& a, const T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T1, typename T2>
istream& operator >> (istream& in, pair<T1, T2>& p) {
	in >> p.first >> p.second;
	return in;
}

template <typename T1, typename T2>
ostream& operator << (ostream& out, pair<T1, T2>& p) {
	out << p.first << ' ' << p.second;
	return out;
}

mt19937_64 rnd(0);

const int LOG = 18;
const int N = (int)3e5 + 7;
const int MAXN = (int)2e6 + 7;
const int MOD = (int)998244353;
const int INF = (int)1e9 + 7;
const int CONST = 450;
const LL LINF = (i64)1e17;
const LD PI = 3.1415926535897932384626433832795;
const LD EPS = 1;

/////////////////////////////////////////////////////////////////////

int main() {
	double start = clock();
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	cout << fixed << setprecision(20);
	cerr << fixed << setprecision(20);
#else
	cout << fixed << setprecision(20);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	rnd.seed(time(0));
#endif

	LD r; cin >> r;
	cout << 2.0 * PI * r;

#ifdef _DEBUG
	cout << endl << "Time is " << (clock() - start) / 1000.0;
#endif
}

Measured memory_bytes: 3804
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: i32 = read();
    let a: i32 = read();
    println!("{}", if n % 500 <= a { "Yes" } else { "No" });
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

#define ll long long int
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf  1e18
#define mk(arr,n,type) type *arr=new type[n];
#define w(x) int x;cin>>x;while(x--)
int main()
{
  ll d,t,s;cin>>d>>t>>s;
  if(d<=(t*s))
    cout<<"Yes";
  else
    cout<<"No";

}

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

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    ll ans = 0;
    if(a>b) ans = 0;
    else if(n==1){
        if(a==b)ans = 1;
        else ans = 0;
    }
    else ans = n*(b-a)+2*a-2*b+1;
    COUT(ans);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
typedef pair<ll, int> p;
 
int main() {
	cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    cin >> s;

    int x = 0;

    for(int i = 0; i < s.length(); i++) {
        if(s[i] == 'p') x++;
    }

    cout << s.length() / 2 - x << endl;
}

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

using namespace std;

int main()
{
 int n,i,a,b,cont=0;
 double d,x;
 cin>>n;
 cin>>d;
 for(i=0;i<n;i++)
 {
  cin>>a>>b;
  x = sqrt(pow(a,2)+pow(b,2));
  if(x<=d) cont++;	
 }

 cout<<cont;
 return 0;
}

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

int main(void){
    int h, w;
    cin >> h >> w;
    char ma[110][110];
    int usei[110], usej[110];
    for(int i=0;i<110;++i){
        usei[i] = 1;
        usej[i] = 1;
    }
    for(int i=0;i<h;++i){
        for(int j=0;j<w;++j){
            cin >> ma[i][j];
        }
    }
    for(int i=0;i<h;++i){
        int flg=1;
        for(int j=0;j<w;++j){
            if(ma[i][j]!='.') flg=0;
        }
        if(flg) usei[i] = 0;
    }
    for(int i=0;i<w;++i){
        int flg=1;
        for(int j=0;j<h;++j){
            if(ma[j][i]!='.') flg=0;
        }
        if(flg) usej[i] = 0;
    }
    for(int i=0;i<h;++i){
        if(usei[i]==0) continue;
        for(int j=0;j<w;++j){
            if(usej[j]==0) continue;
            cout << ma[i][j];
        }
        cout << endl;
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

int main()
{
  int n;
  scanf("%d", &n);
  int x[8];
  int y[8];
  for (int i = 0; i < n; ++i)
  {
    scanf("%d%d", x + i, y + i);
  }
  double ans = 0;
  for (int i = 0; i < n - 1; ++i)
  {
    for (int j = i + 1; j < n; ++j)
    {
      ans += std::sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])) * 2 / n;
    }
  }
  printf("%.14f\n", ans);
  return 0;
}

Measured memory_bytes: 128
#coding:utf-8
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

def main():
    n = int(input())
    sumv = 0
    for i in range(1, n+1):
        for j in range(1, n+1):
            for k in range(1, n+1):
                sumv += gcd(i, j, k)
                #print(i,j,k)
    print(sumv)
  
if __name__ == '__main__':
    main()

Measured memory_bytes: 86628
//#include <bits/stdc++.h>
//#include <stdio.h>
#include<iostream>
#include<cstdio>
#include<bitset>
#include<algorithm>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<string.h>
#include<cmath>
#include<utility>
#include<functional>
#include<map>
#include<set>
#include<cctype>
#include<fstream>


#define FOR(i, a, b) for( int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for( int i=(a);i>=(b);i--)
#define LFOR(i, a, b) for( long long int i=(a);i<=(b);i++)
#define LRFOR(i, a, b) for(long long int i=(a);i>=(b);i--)
#define MOD 1000000007
#define INF 1000000000 //2000000000
#define LLINF 1000000000000000000 //9000000000000000000
#define PI 3.14159265358979
#define MAXI 7500000

using namespace std;
typedef long long int ll;
typedef pair< long long int, long long  int> P;
typedef string::const_iterator State;

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


int main(void) {

	int prime[55555];
	int pos = 2;
	int n;
	int now;

	prime[1] = 2;

	FOR(i, 3, 55555) {
		FOR(j, 1, pos-1) {
			if (i%prime[j] == 0) {
				break;
			}
			if (j == pos - 1) {
				prime[pos] = i;
				pos++;
			}
		}
	}

	cin >> n;

	now = 1;

	FOR(i, 1, n) {
		FOR(j, now, pos - 1) {
			if (prime[j] % 5 == 1) {
				cout << prime[j];
				if (i != n) {
					cout << " ";
				}
				else {
					cout << endl;
				}
				now = j + 1;
				break;
			}
			
		}
		
	}





	return 0;
}

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

map<int,int>f;
int n, m, a[101000], b[101000];
map<int,set<int,greater<int> > >S;

void add(int x,int v){
  for (;x<=mod;x+=x&-x)
    f[x]=(f[x]+v)%mod;
}
int que(int x){
  int t=0;
  for (;x;x-=x&-x)
    t=(t+f[x])%mod;
  return t;
}

int main(){
  cin>>n>>m;
  for (int i=1;i<=n;++i) scanf("%d",&a[i]);
  for (int i=1;i<=m;++i) scanf("%d",&b[i]);
  for (int i=1;i<=n;++i){
    int p=lower_bound(b+1,b+m+1,a[i])-b;
    if (p>=2&&p<=m) S[a[i]-b[p-1]].insert(b[p]-a[i]+1);
  }
  add(1,1);
  for (auto it:S)
    for (auto o:it.second)
      add(o,que(o-1));
  int ans=que(mod);
  cout<<ans<<endl;
}


Measured memory_bytes: 68096
local S, T = io.read("*l", "*l")

local count = 0
--[[ パターン1
for i = 1, S:len() do
	if S:sub(i, i) ~= T:sub(i, i) then
		count = count + 1
	end
end
--]]
---[[ パターン2
local S_byte_s, T_byte_s = {}, {}
for i = 1, S:len() do
	S_byte_s[i] = S:byte(i)
	T_byte_s[i] = T:byte(i)
end

for i = 1, S:len() do
	if S_byte_s[i] ~= T_byte_s[i] then
		count = count + 1
	end
end
--]]
print(count)


Measured memory_bytes: 7192
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC042A
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, c, d;

            var word = Console.ReadLine().Split(' ');

            a = int.Parse(word[0]);
            b = int.Parse(word[1]);
            c = int.Parse(word[2]);
            d = a + b + c;

            if (d == 17) Console.WriteLine("YES");
            else Console.WriteLine("NO");

            Console.ReadKey();
        }
    }
}


Measured memory_bytes: 11092
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)
from collections import deque

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

s = i_s()
d = deque()

for x in s:
    if d and x == 'B':
        d.pop()
    elif x == '0' or x == '1':
        d.append(x)

print(*d, sep='')


Measured memory_bytes: 3436
N, M = list(map(int, input().split()))

ab = []
for i in range(N):
    ab.append(list(map(int, input().split())))

cd = []
for i in range(M):
    cd.append(list(map(int, input().split())))

for ab_list in ab:
    min_distance = 400000000
    checkpoint = 0
    for cd_list in cd:
        checkpoint += 1
        distance = abs(ab_list[0] - cd_list[0]) + abs(ab_list[1] - cd_list[1])
        if distance < min_distance:
            min_distance = distance
            ans = checkpoint
    print(ans)


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

using namespace std;
vector<int> v;


int main()
{
    int n,m,c;
    int cind = 0;
    cin>>n>>m;
    int mat[n][m];
    cin>>c;

    for (int i = 0 ; i < c ; i++){
    int in;
    cin>>in;
    v.push_back(in);
    }

    int past = 0;

    for (int i = 0 ; i < n ; i++){
        for (int j = 0 ; j < m ; j++){
            mat[i][j] = cind+1;
            v[cind]--;
            if (v[cind] == 0)cind++;
        }
    }

    int r = 0;

    for (int i = 0 ; i < n ; i++){
    if (r%2 == 0){
    for (int j = 0 ; j < m ; j++)cout<<mat[i][j]<<" ";
    }
    else {
    for (int j = m-1 ; j >= 0 ; j--)cout<<mat[i][j]<<" ";
    }
    cout<<endl;
    r++;
    }


    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;

int main(void) {
  int N;
  string S;
  cin >> N >> S;
  map<char, int> ma;
  for (auto c : S) {
    ma[c]++;
  }
  long long ans = 1;
  for (auto e : ma) {
    ans *= (e.second + 1);
    ans %= mod;
  }
  ans--;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <math.h>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

int main(){
  int A=0,B=0,C=0,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=0,O=0,P=0,Q=0,R=0;
  string S;
  cin >> S;
  A=S.size();
  for(int i=0;i<A;i++){
    cout << 'x';
  }
  cout<<endl;
  
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int X = sc.nextInt();
    int T = sc.nextInt();
    
    int num = N / X;
    if(N % X != 0) ++ num;
    
    System.out.println(num * T);
  }
}

Measured memory_bytes: 35644
N = int(input())
h = list(map(int, input().split()))
INF = 10**9
dp = [INF] * N
dp[0] = 0
for i in range(1, N):
    v = dp[i-1] + abs(h[i] - h[i-1])
    if v < dp[i]:
        dp[i] = v
    if i + 1 < N:
        v = dp[i-1] + abs(h[i+1] - h[i-1]) 
        if v < dp[i+1]:
            dp[i+1] = v
print(dp[N-1])

Measured memory_bytes: 13976
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);

    int n = Integer.parseInt(sc.next());
    String[] s = new String[n];
    char[][] c = new char[n][26];

    for (int i = 0; i < n; i++) {
      s[i] = sc.next();
    }

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < s[i].length(); j++) {
        for (int k = 0; k < 26; k++) {
          if (s[i].charAt(j) == 97 + k) {
            c[i][k]++;
          }
        }
      }
    }

    int[] num = new int[26];

    for (int i = 0; i < 26; i++) {
      num[i] = 100;
      for (int j = 0; j < n; j++) {
        num[i] = Math.min(num[i], c[j][i]);
      }
    }

    for (int i = 0; i < 26; i++) {
      for (int j = 0; j < num[i]; j++) {
        System.out.print((char) (i + 'a'));
      }
    }

    System.out.println();

    sc.close();
  }
}


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

int main(){
    int n;

    cin >> n;
    vector<int> a(n+1);
    vector<int> b(n+1,0);

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


    int m = 0;
    for(int i = n ; i >= 1 ; i--){
        int j = i*2;
        int cnt = 0;
        if(n/2 < i){
            b[i] = a[i];
            if(b[i] == 1){
                m++;
            }
        }else{
            while(n >= j){
                //cout << j << " ";
                cnt+= b[j];
                j += i;
            }
            //cout << cnt;
            //cout << endl;
            b[i] = (cnt + a[i])%2;
            if(b[i] == 1){
                m++;
            }
        }
    }
    cout << m << endl;
    bool flag = false;
    for(int i = 1 ; i <= n ; i++){
        if(b[i] == 1){
            cout << i;
            m--;
            flag = true;
            if(m != 0){
                cout << " ";
            }
        }
    }

    if(flag){
        cout << endl;
    }
return 0;
}

Measured memory_bytes: 2432
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class Main

{	
	public static void main(String args[]) throws IOException
	{
		FastScanner fs = new FastScanner();
		
		int T = fs.nextInt(),count=0;double d = fs.nextInt();
		while(T-->0)
		{
			double x = fs.nextInt(),y = fs.nextInt();
			
			if(Math.sqrt(x*x+y*y)<= d) count++;
			
		}
		System.out.println(count);
	}

}
class FastScanner
{
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	StringTokenizer str = new StringTokenizer("");
	
	String next() throws IOException
	{
		while(!str.hasMoreTokens())
			str = new StringTokenizer(br.readLine());
		
		return str.nextToken();
	}
	
	int nextInt() throws IOException
	{
		return Integer.parseInt(next());
	}
	
	float nextfloat() throws IOException
	{
		return Float.parseFloat(next());
	}
	
	double nextDouble() throws IOException
	{
		return Double.parseDouble(next());
	}
	long nextLong() throws IOException
	{
		return Long.parseLong(next());
	}
	int [] arrayIn(int n) throws IOException
	{
		int  arr[] = new int[n];
		arr[0] = 0;
		for(int i=1; i<n; i++)
		{
			arr[i] = nextInt();
		}
		return arr;
	}
}



	

Measured memory_bytes: 55016
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (in i = 0; i < (in)(n); i++)
#define REP(i,a,b) for(in i=(in)(a);i<(in)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const in inf=1e9+7;
using P=pair<in,in>;
vector<in> dx={0,1,-1,0};
vector<in> dy={1,0,0,-1};



int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in n;
    cin>>n;
    vector<in> a(n,0);
    rep(i,n) cin>>a.at(i);
    map<in,in> x;
    rep(i,n) x[a[i]] ++;

    in sum=0ll;
    for(auto y:x){
        in sec=y.second;
        if(sec<2ll) continue;
        sum +=(sec-1ll)*sec/2ll;
    }

    rep(i,n){
        in ans=sum;
        if(x[a[i]]==1){
            cout<<ans<<endl;
            continue;
        }
        in se=x[a[i]];
        ans -=(se-1ll)*se/2ll;
        se --;
        ans +=(se-1ll)*se/2ll;
        cout<<ans<<endl;
    }
}

Measured memory_bytes: 11136
#include "bits/stdc++.h"

#define rep(i, a) for (int i = 0; i < (int)a; ++i)
#define REP(i, a, b) for (int i = (a); i < (int)b; ++i)

// [debug]

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

void Main() {
  ll h, w;
  cin >> h >> w;
  if (h==1 || w==1) {
    cout << 1 << endl;
    return;
  }
  ll ans;
  ans = (w+1)/2 * ((h+1)/2) + w/2 * (h/2);
  cout << ans << 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
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)

#define DEBUG

#ifdef DEBUG
#define var_dump(...) fprintf(stdout, __VA_ARGS__)
#define dump(a) cout << a << "\n";
#else
#define var_dump(...) 42
#define dump(a) 42
#endif

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://beta.atcoder.jp/contests/abc084/tasks/abc084_b

vector<string> split(const string &s, char delim) {
    vector<string> elems;
    stringstream ss(s);
    string item;
    while (getline(ss, item, delim)) {
        if (!item.empty()) {
            elems.push_back(item);
        }
    }
    return elems;
}

int main() {
    int A, B;
    cin >> A >> B;
    string S;
    cin >> S;

    vector<string> splt = split(S, '-');
    if (splt.size() != 2) {
        cout << "No" << "\n";
        return 0;
    }

    if (splt[0].length() == A && splt[1].length() == B) cout << "Yes" << "\n";
    else cout << "No" << "\n";

    return 0;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n,k = LI()
    p = LI()
    for i in range(n):
        p[i] -= 1
    c = LI()
    bfs = [0]*n
    lis = []
    for i in range(n):
        if not bfs[i]:
            bfs[i] = 1
            x = i
            path = [c[x]]
            while 1:
                x = p[x]
                if bfs[x]:
                    break
                path.append(c[x])
                bfs[x] = 1
            lis.append([0]+list(accumulate(path*2)))
    ans = -float("inf")
    for path in lis:
        n = len(path) >> 1
        m = k//n
        if k%n == 0:
            m -= 1
        s = m*path[n]
        if s < 0:
            s = 0
            res = n
        else:
            res = k-m*n
        for l in range(n):
            for j in range(1,res+1):
                ns = s+path[l+j]-path[l]
                if ans < ns:
                    ans = ns
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Measured memory_bytes: 74732
def mergeSort(num_list, left, right):
	if left + 1 < right:
		mid = (left + right) / 2
		mergeSort(num_list, left, mid)
		mergeSort(num_list, mid, right)
		merge(num_list, left, mid, right)

def merge(num_list, left, mid, right):
	global count 
	L = list(num_list[left:mid])
	L.append(float("inf"))
	R = list(num_list[mid:right])
	R.append(float("inf"))
	i, j = 0, 0
	for k in range(left, right):
		if L[i] <= R[j]:
			num_list[k] = L[i]
			i += 1
			count += 1
		else:
			num_list[k] = R[j]
			j += 1
			count += 1

count = 0
n = int(raw_input())
a = raw_input()
l = []
l = a.split(" ")
for i in range(len(l)):
	l[i] = int(l[i])
mergeSort(l, 0, n)

print " ".join(map(str, l)) 
print count

Measured memory_bytes: 71304
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(o,0,n)cout<<v[o]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tihs if(fopen("inp.txt","r"))freopen("inp.txt", "r", stdin),freopen("out.txt", "w", stdout);
using namespace std;
#define TRACE
 
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
 

#define M 100010


int main(){
	IOS;
	tihs;
	
	ll n,a,b;cin>>n>>a>>b;
	ll cnt = n/(a+b);
	ll rem = n-cnt*(a+b);
	ll ans = cnt*a + min(rem,a);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;
int N;
string sss;
char s[100];
int main() {
    cin >> N;
    cin >> sss;
    rep(i, N) s[i] = sss[i];

    int bs = 0;
    int be = 0;
    int b1 = 0;
    int b2 = 0;
    rep(i, N){
        if(s[i] == '(') b1++;
        else b2++;

        if(b2 > 0){
            if(b1 > 0){
                b1--;
                b2--;
            }
            else{
                bs++;
                b2--;
            }
        }
    }
    be = b1;

    rep(i, bs){cout << '('; }
    rep(i, N){cout << s[i]; }
    rep(i, be){cout << ')'; }
	cout << endl;
}

Measured memory_bytes: 256
// Undone
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
#define MOD 1000000007
using namespace std;
signed main() {
  int N; cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin>>a[i];
  sort(a.begin(), a.end());
  int ans = a[N/2]-a[N/2-1];
  cout << ans << endl;
}



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

int main() {
    ll n,my=10000000000,mx=-10000000000,r;
    cin>>n;
    for(ll i=0; i<n; i++) {
        cin>>r;
        mx = max(mx,r-my);
        my = min(my,r);
    }
    cout<<mx<<"\n";
}


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

int main() {
  int N = 3;
  vector<int> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  sort(A.begin(), A.end());
  A.erase(unique(A.begin(), A.end()), A.end());
  cout << ((A.size() == 2) ? "Yes" : "No") << "\n";
}

Measured memory_bytes: 256
abc=list(map(int,input().split()))
count=0
while not abc[0]==abc[1]==abc[2]:
    count+=1
    abc.sort()
    if abc[0]==abc[1]:
        abc[0]+=1
        abc[1]+=1
    else:
        abc[0]+=2
    # print(*abc)
print(count)
    

Measured memory_bytes: 38384
n=int(input())
s=input()
t=0
for i in range(10):
  for a in range(n):
    if s[a]==str(i):
      for j in range(10):
        for b in range(a+1,n)[::-1]:
          if s[b]==str(j):
            t+=len(set(list(s[a+1:b])))
            break
      break
print(t)

Measured memory_bytes: 70188
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
using namespace std;
int main() {
	lli a, b, x, y, n, k;
	string s, r, t;
	cin >> a >> b >> k;
	if(a <= k) {
		k -= a;
		a = 0;
	}
	else {
		a -= k;
		k = 0;
	}
	if(k > 0) {
		if(b <= k) {
			k -= b;
			b = 0;
		}
		else b -= k;
	}
	cout << a << ' ' << b << endl;
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  string ans = "Yes";
  for ( int i = 0; i < s.size(); i++ ) {
    if ( i%2 == 0 && s[i] == 'L' ) { ans = "No"; }
    if ( i%2 == 1 && s[i] == 'R' ) { ans = "No"; }
  }
  cout << ans << endl;
  return 0;
}


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

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

int n;
vector<int>x,y;
double dist(int i,int j){
    int dx=x.at(i)-x.at(j);
    int dy=y.at(i)-y.at(j);
    return pow(dx*dx+dy*dy,0.5);
}

int main(){
    cin>>n;
    vector<int>v(n);
    x=y=vector<int>(n);
    rep(i,0,n){
        cin>>x[i]>>y[i];
        v.at(i)=i;
    }
    double sum=0.0;
    int c=0;
    do{
        c++;
        rep(i,0,n-1) sum+=dist(v.at(i),v.at(i+1));
    }
    while(next_permutation(all(v)));
    cout<<fixed<<setprecision(10);
    cout<<sum/c<<endl;
return 0;
}

Measured memory_bytes: 256
// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include<unordered_map>
#include <stack>
#include <random>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
void vdeb(std::vector<T> &da) {
    for (int i = 0;i < da.size();i++) {
        if (i == da.size() - 1) std::cout << da[i];
        else std::cout << da[i] << ' ';
    }
    std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
    for (int i = 0;i < da.size();i++) vdeb(da[i]);
    std::cout << std::endl;
}

using namespace std;

int main(){
    string s; cin >> s;
    int n = s.size();
    reverse(all(s));
    vector<int> da(n+1);
    int pp = 1;
    rip(i,n,0){
        da[i+1] = (da[i] + pp*(s[i]-'0')) % 2019;
        pp = pp*10%2019;
    }
    vector<ll> mp(2019);
    rip(i,n+1,0){
        mp[da[i]]++;
    }
    ll ans = 0;
    rip(i,2019,0) ans += (mp[i]-1)*mp[i]/2;
    cout << ans << endl;
}

Measured memory_bytes: 4320