akhauriyash/Code-Regression huggingface dataset:
a, b, c = map(int, input().split())
for i in range(c):
  if i % 2 == 0:
    if a % 2 == 1:
      a -= 1
    a = a // 2
    b += a
  else:
    if b % 2 == 1:
      b -= 1
    b = b // 2
    a += b
print(a, b)


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using static System.Console;
using static System.Math;


namespace AtCodeeeer
{
    class AtCOOOOOOOOOOOder
    { 
        
        static void Main(string[] args)
        {
            int[] s = ReadLine().Split(' ').Select(int.Parse).ToArray();
            int a = s[0];
            int b = s[1];

            WriteLine(
                Max(a+b,Max(a-b,a*b))
                );
        }
    }
}


Measured memory_bytes: 13396
import math
import copy
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
Mp = copy.copy(P)
Mq = copy.copy(Q)
Lp = 0
Lq = 0
for i in range(N):
  if P[i] == min(Mp) and i != N:
    Mp.remove(P[i])
  else:
    Lp += math.factorial(len(Mp)-1)*(sum(x<P[i] for x in Mp))
    Mp.remove(P[i]) 
  if Q[i] == min(Mq) and i != N:
    Mq.remove(Q[i])
  else:
    Lq += math.factorial(len(Mq)-1)*(sum(x<Q[i] for x in Mq))
    Mq.remove(Q[i])
print(abs(Lp-Lq))

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

#define int long long
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = INT_MAX / 2;
constexpr int MOD = 1e9 + 7;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vec>;

template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) {
    return stream << p.first << " " << p.second;
}
template <typename T>
void print(const vector<vector<T>> matrix) {
    repall (vec, matrix)
        print(vec);
}
template <typename T>
void print(const vector<T> vec) {
    unsigned int len = vec.size();
    rep (i, len - 1)
        cout << vec[i] << ' ';
    cout << vec[len - 1] << '\n';
}
template <typename Arg>
void print(const Arg arg) {
    cout << arg << '\n';
}
template <typename Head, typename... Args>
void print(const Head head, const Args... args) {
    cout << head << " ";
    print(args...);
}
template <typename T>
T sum_(vector<T> vec, T init = 0) {
    return std::accumulate(all(vec), T(init));
}

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

template <typename T>
void init(vector<T>& v) {
    rep (i, v.size())
        cin >> v[i];
}

template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) {
    assert(v.size() == w.size());
    rep (i, v.size())
        cin >> v[i] >> w[i];
}

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4

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

    int a, b, k;
    cin >> a >> b >> k;
    int g = gcd(a, b);

    int kc = 0;
    Forr(i, g, 1) {
        if (g % i == 0) kc++;
        if (kc == k) {
            print(i);
            break;
        }
    }

    return 0;
}

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

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

int X[200020];
int B[200020];

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

    rep(i, N) {
        cin >> X[i];
        B[i] = X[i];
    }

    sort(B, B + N);
    rep(i, N) {
        if (X[i] <= B[N / 2-1 ]) {
            cout << B[N / 2] << endl;
        }
        else {
            cout << B[N / 2-1] << endl;
        }
    }
}

Measured memory_bytes: 3712
// A - Prefix and Suffix
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define pb push_back
#define eb emplace_back
#define mp make_pair
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using vvli = vector<vlli>;
using vs = vector<string>;
using vvs = vector<vs>;
using vb = vector<bool>;
using vvb = vector<vb>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, n, w, ans = 0, count = 0;
  string s, t;
  vector<pair<string, pair<lli, lli>>> pr;
  cin >> n;
  cin >> s;
  cin >> t;
  if (s == t)
  {
    cout << n << endl;
  }
  else
  {
    rep(i, 0, n)
    {
      string d = s.substr(i, n - i);
      string e = t.substr(0, n - i);
      if (d == e)
      {
        count += n - i;
      }
    }
    ans = 2 * n - count;
    cout << ans << endl;
  }
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> pp;
const int INF = 1e9;
const int MOD = 1000000007;

struct Unionfind{
  vector<int> parents;
  int m;
  Unionfind(int n):parents(n,-1){
    m = n;
  }

  int find(int x){
    if(parents.at(x) < 0){
      return x;
    }else{
      parents.at(x) = find(parents.at(x));
      return parents.at(x);
    }
  }

  void unite(int x,int y){
    x = find(x);
    y = find(y);

    if(x==y) return;
    if(parents.at(x) > parents.at(x))swap(x,y);
    parents.at(x) += parents.at(y);
    parents.at(y) = x;
  }

  int size(int x){
    return -parents.at(find(x));
  }

  bool same(int x,int y){
    return find(x) ==find(y);
  }

  vector<int> members(int x){
    int root = find(x);
    vector<int> A;
    for(int i=0;i<m;i++){
      if(find(i) ==root ){
        A.push_back(i);
      }
    }
    return A;
  }
};

 
int main() {
  int n,m;
  cin >> n >> m;
  vector<int> p(n);
  rep(i,n){
    int a;
    cin >> a;
    --a;
    p.at(a) = i;
  }
  //rep(i,n) cout << p.at(i) << " " ;
  
  Unionfind uf(n);
  rep(i,m){
    int a,b;
    cin >> a >> b;
    --a;--b;
    uf.unite(a,b);
  }
  
  int ans = 0;
  rep(i,n){
   if(uf.same(i,p.at(i))) ans ++;
  }
  
  cout << ans << endl;
  
  return 0;
}





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

#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define sort_asc( X ) sort(( X ).begin(), ( X ).end())
#define sort_desc( X ) sort(( X ).begin(), ( X ).end(), greater <>())
#define endl "\n"

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
bool bit_search( int pattern, int N );
void initialize( void );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;
template <typename T, typename K> struct P {
	T a; K b;
};
int main( void ){
	// initialize();
	int N;
	cin >> N;
	ll sum = 0;
	rep(i,1,N+1){
		if (i %3 == 0 || i%5 == 0);
		else
			sum+=i;
	}
	cout << sum << endl;
}

template <class T> bool chmax( T& a, T b ) {
	if (a < b){
		a = b; return true;
	}
	return false;
}
template <class T> bool chmin( T& a, T b ) {
	if (a > b){
		a = b; return true;
	}
	return false;
}
int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
bool bit_search( int pattern, int N ){
	int cnt = 0;
	rep( bit, 0, N ){
		if (pattern & ( 1 << bit )){
			cnt++;
		}
	}
	return true;
}
void initialize( void ){
	cout << fixed << setprecision( 10 );
}


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

int main() {
  int k,a,b;
  cin >> k >> a >> b;
  bool s = false;
  
  for(int i = a; i < b+1 ; i++){
    if(i%k == 0){
      s = true;
    }
    else{
      continue;
    }
  }
  
  if(s){
    cout << "OK" << endl;
  }
  else{
    cout << "NG" << endl;
  }
}

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

using namespace std;

int main()
{
    int n,a[105];
    cin >> n;
    int mn = INT_MAX,mx = 0;
    for(int i = 0 ; i < n ; i ++){
        cin >> a[i];
        mn = min(mn,a[i]);
        mx = max(mx,a[i]);
    }
    cout << mx - mn << endl;
    return 0;
}


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

using namespace std;
using ll = long long;

#define INF (1LL << 60)
#define MOD 1000000009

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    ll N;
    cin >> N;
    vector<ll> d(N);
    REP(i,0,N) cin >> d[i];
    
    if(N % 2 == 1) _PR(0);
    else {
        sort(ALL(d));
        _PR(d[N/2] - d[N/2-1]);
    }

    return 0;
}

/*



*/

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int main(){
	int n, d, ans = 0;
	cin >> n >> d;
	vector<int> point[n];
	for (int i = 0; i < n; i++){
		for (int j = 0; j < d; j++){
			int temp;
			cin >> temp;
			point[i].push_back(temp);
		}
	}
	for (int i = 0; i < n-1; i++){
		for (int j = i+1; j < n; j++){
			double len = 0;
			for (int k = 0; k < d; k++){
				len += (point[i][k] - point[j][k])*(point[i][k] - point[j][k]);
			}
			if ((int)sqrt(len)*(int)sqrt(len) == len){
				ans++;
			}
		}
	}
	cout << ans << endl;
	return 0;
}



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

using namespace std;

int main() {
  	int n;
 	cin >> n;
  	vector<int> a(n + 1);
  	for (int i = 1; i <= n; i++) {
      	cin >> a[i];
    }
  	for (int i = 1; i <= n; i++) {
     	if (a[i] > a[i-1]) {
          	a[i]--;
        }
    }
  	for (int i = 1; i < n; i++) {
      	if (a[i] > a[i+1]) {
          	cout << "No";
          	return 0;
        }
    }
  	cout << "Yes";
}


Measured memory_bytes: 640
n=int(input())
sl=[input() for i in range(n)]

m=int(input())
tl=[input() for i in range(m)]

keyl=[]
bluedic={}
reddic={}
for st in sl :
  if st in bluedic.keys() :
    bluedic[st]=bluedic[st]+1
  else :
    bluedic[st]=1
for st in tl :
  if st in reddic.keys() :
    reddic[st]=reddic[st]+1
  else :
    reddic[st]=1
keyl=list(bluedic.keys())#+list(reddic.keys())
#keyl=list(set(keyl))
mx=0
for k in keyl :
  if not k in reddic.keys() :
    reddic[k]=0
  div=(bluedic[k]-reddic[k])
  if mx < div :
    mx=div
    
print(mx)
    

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

int N, A, B;
string s;
int main(){
  cin >> N >> A >> B;
  cin >> s;
  int t = 0;
  int r = 0;
  REP(i,N){
    if( s[i] == 'a' ){
      if( t < A + B ){
	t++;
	cout << "Yes" << endl;
      }else{
	cout << "No" << endl;
      }
    }else if( s[i] == 'b' ){
      if( t < A + B && r < B ){
	t++; r++;
	cout << "Yes" << endl;
      }else{
	cout << "No" << endl;
      }
    }else{
      cout << "No" << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 896
#include <iostream>
#include <math.h>
#include <limits>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <map>
using namespace std;
#define rep(i, n) for (int i =0; i < (int)(n); i++)
typedef pair<int, string> P;



int main() {
    long long n,a,b;
    cin >> n >> a >> b;
    long long wari;
    long long amari;
    if (a == 0 && b == 0) {
        cout << "0" << endl;
        return 0;
    }

    wari = n / (a + b);
    amari = n % (a + b);
    if (amari <= a)cout << wari * a + amari << endl;
    else cout << wari * (a)+a << endl;
   
}


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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

void seica_add(int &a,int &b){
	a += b;
	if(a >= MOD)a -= MOD;
}

int dp[3003][3003][2];

int main(){
	
	ll n,m;cin >> n >> m;
	
	REP(i,n+1){
		if(i == 0)dp[0][i][1] = 1;
		else dp[0][i][0] = 1;
	}
	
	REP(i,m){
		REP(j,n+1){
			REP(k,2){
				if(dp[i][j][k]){
					if(j > 0){
						if(j == 1){
							seica_add(dp[i+1][j-1][1],dp[i][j][k]);
							seica_add(dp[i+1][j][1],dp[i][j][k]);
						}
						else{
							seica_add(dp[i+1][j-1][k],dp[i][j][k]);
							seica_add(dp[i+1][j][k],dp[i][j][k]);
						}
					}
					
					if(j < n){
						seica_add(dp[i+1][j+1][k],dp[i][j][k]);
						seica_add(dp[i+1][j][k],dp[i][j][k]);
					}
				}
			}
		}
	}
	
	int ans = 0;
	
	REP(i,n+1)seica_add(ans,dp[m][i][1]);
	
	cout << ans << endl;
						
	
	return 0;
}

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

constexpr long long MOD = 1000000007;

int main() {
	long long N;
	cin >> N;
	if (N == 1) {
		cout << 1 << endl;
		return 0;
	}
	vector<long long> DP(N + 1, 0), DPSUM(N + 1, 0);
	DP[0] = 1, DP[1] = 1, DPSUM[0] = 1, DPSUM[1] = 2;
	for (int i = 2; i <= N; i++) {
		DP[i] = (DPSUM[i - 1] - DP[i - 2] + MOD) % MOD;
		DPSUM[i] = (DPSUM[i - 1] + DP[i]) % MOD;
	}
	long long ANS = (DP[N] + DP[N - 1] * (N - 1) + DPSUM[N - 2]) % MOD;
	for (int i = 0; i < N - 2; i++) {
		ANS += DPSUM[N - 2] - DPSUM[i];
		ANS %= MOD;
	}
	ANS = (ANS + DPSUM[N - 2] * (((N - 1) * (N - 1)) % MOD)) % MOD;
	cout << ANS << endl;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int dp[3005][3005];
int pre[3005][3005];

int main() {
    string s, t; cin >> s >> t;
    int n_s = s.size(), n_t = t.size();
    REP(i,n_s+1) {
        REP(j,n_t+1) {
            if (chmax(dp[i][j],dp[i-1][j])) pre[i][j] = 0;
            if (chmax(dp[i][j],dp[i][j-1])) pre[i][j] = 1;
            if (s[i-1] == t[j-1]) {
                if (chmax(dp[i][j],dp[i-1][j-1]+1)) pre[i][j] = 2;
            }
        }
    }
    int i = n_s, j = n_t;
    string res;
    while (i >= 0 && j >= 0) {
        if (pre[i][j] == 0) i--;
        else if (pre[i][j] == 1) j--;
        else {
            i--; j--;
            res = s[i] + res;
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 70784
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  double W, H; cin >> W >> H;
  double x, y; cin >> x >> y;
  
  cout << fixed << setprecision(10) << W*H/2 << " ";
  if(x == W/2 && y == H/2) cout << 1 << endl;
  else cout << 0 << endl;
}

Measured memory_bytes: 3792
#include<iostream>

using namespace std;

int main(){
  long long int a,b,c,d,max;
  cin >>a>>b>>c>>d;
  max = a*c;
  max = a*d>max ? a*d :max;
  max = b*c>max ? b*c :max;
  max = b*d>max ? b*d :max;
  cout << max<<endl;
  return 0;
}


Measured memory_bytes: 3628
// 嘘解法か判断する用
#include <bits/stdc++.h>
using namespace std;

// 隣接行列を用いた幅優先探索 O(|V|^2)
int n;
vector<int> G[200000];
vector<int> d(200000), visited(200000); // 始点sから頂点iまでの最短距離をd[i]に記録
/*
* main関数からこれらを削除すること
* 隣接行列Mの行数と列数および最短距離dの要素数はnの最大値を整数で入力すること
*/

void bfs(int s) {
  queue<int> q;
  q.push(s);
  visited[s] = 1;
  // d[s] = 0;
  while(!q.empty()){
    int u = q.front();
    q.pop();
    for(int v = 0; v < G[u].size(); v++){
      if(visited.at(G[u][v]) == 0){
        d[G[u][v]] += d[u];
        visited.at(G[u][v]) = 1;
        /* if(M[u][v] == 0) continue;
        if(d[v] != 100000000) continue;
        d[v] = d[u] + 1;*/
        q.push(G[u][v]);
      }
    }
  }
}

int main() {
// 無向(有向)グラフの隣接リスト
  int q, u, v, p, x;
  
  cin >> n >> q;
  
  // vector<int> G[n]; // 頂点数がnのグラフを表す隣接リスト
  
  for(int i = 0; i < n - 1; i++){
    cin >> u >> v;
    u--;
    v--;
    G[u].push_back(v);
    G[v].push_back(u); // 有向グラフではこの行をコメントアウト
  }
  
  for(int i = 0; i < q; i++){
    cin >> p >> x;
    d.at(p - 1) += x;
  }
  
  bfs(0);
  
  for(int i = 0; i < n; i++){
    if(i) cout << " ";
    cout << d[i];
  }
  cout << endl;
}


Measured memory_bytes: 16372
# coding: utf-8
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

nn = inputs[0][0]
arr = []
for i in 1..5 do
  arr << inputs[i][0]
end

# body
if $debugFlag
  p nn
  p arr
end

min = arr.min
ans = 5 + (nn.to_f / min).ceil - 1

puts ans


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,int> pli;
typedef pair<int,int> pii;
#define rep(i,a,b) for(ll i=a ; i<b ; i++)
#define qrep(que, ite) for(auto ite=begin(que) ; ite!=end(que) ; ite++)
const int max_n = 1e5;
const ll mod = 1e9+7;
const ll INF = 1e17;
const int inf = 1e5;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return a ? gcd(b%a, a) : b; }
int dx[4] = {0,0,1,-1};
int dy[4] = {1,-1,0,0};
ll mo = 998244353;
struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) {
        return -par[root(x)];
    }
};
struct SegmentTree{
  int N;
  vector<int> node;
  public :
    void intit(vector<int>v){
      int sz = v.size();
      N=1;
      while(N<sz) N*=2;
      node.resize(N);
      for(int i=0 ; i<sz ; i++) node[i+N-1] = v[i];
      for(int i=N-2 ; i>=0 ; i--) node[i] = min(node[i*2+1], node[i*2+2]);
    }
    void update(int x, int val){
      x += N-1;
      node[x+N-1] = val;
      while(x>0){
        x = (x-1)/2;
        node[x] = min(node[x*2+1], node[x*2+2]);
      }
    }
    int getmin(int a, int b, int k, int l, int r){
      if(b<=l || r<=a) return inf;
      else if(a<=l && r<=b) return node[k];
      else{
        int vl = getmin(a, b, 2*k+1, l, (l+r)/2);
        int vr = getmin(a, b, 2*k+2, (l+r)/2, r);
        return min(vl, vr);
      }
    }
};
int main(){
  int N;  cin>>N;
  vector<ll> v(N);
  rep(i,0,N) cin>>v[i];
  sort(all(v));
  ll now=1;
  rep(i,0,N){
    ld k = 1e18;
    if(v[i]>1e18 || now>1e18){
      cout<<-1<<endl;
      return 0;
    }
    k /= now;
    k /= v[i];
    if(k<1){
      cout<<-1<<endl;
      return 0;
    }
    now *= v[i];
  }
  cout<<now<<endl;
  return 0;
}


Measured memory_bytes: 3996
#include <bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ii pair<int,int>
#define F first
#define S second
#define pb push_back
#define pf push_front
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fore(i,a,b) for(int i = a;i < b; i+= 1)
#define forr(i,a) for(int i = a; i >= 0; i--)
#define fori(i,m) for(auto i = m.begin(); i != m.end(); i++) 
#define sz(s) int(s.size())
#define cls(a,car) memset(a,car,sizeof (a))
using namespace std;
typedef long long ll;
const int N = 1 * 1e6 + 5;
const ll mod = 1e9 + 7;
const int INF = INT_MAX;
const ll INFCAD  = ll(INT_MAX) * 2 + 1;
int v[1005];
ll POW(ll a,ll b){
    ll ans = 1;
    while(b){
        if(b & 1)
            ans = (ans % mod * a % mod) % mod;
        b >>= 1;
        a = (a % mod * a % mod) % mod;
    }
    return ans;
}
int main(){/*
    freopen("in","r",stdin);
    freopen("out","w",stdout);*/
    fast;
    int x;
    cin >> x;
    if(x < 1200)
        cout << "ABC\n";
    else
        cout << "ARC\n";    
    return 0;   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define drep(i,cc,n) for(int i=(cc);i<=(n);++i)
#define rep(i,n) drep(i,0,n-1)
#define drrep(i,cc,n) for(int i=(cc);i>=(n);--i)
#define rrep(i,n) drrep(i,0,n-1)
#define sz(s) (int)(s.size())
#define vecprint(v) rep(i,v.size())if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define arrprint(v,n) rep(i,n)if(i==0)cout << v[i];else cout << " " << v[i]; cout << endl;
#define matprint(v,n,m) rep(i,n){rep(j,m){cout << v[i][j] << " ";}cout << endl;}
#define SORT(v) sort(v.begin(), v.end())
#define REV(v) reverse(v.begin(), v.end())
using namespace std;
const int mod=1000000007;
const int INF=1001001001;
using ll = long long;
using P = pair<int,int>;
template<typename T>
using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>; //小さいものから取り出す

int d;
vector<int> c(26);
vector<vector<int>> s;
vector<int> t, now;
vector<int> last(26, -1);
ll best = 0;

ll score(){
    ll res = 0;
    rep(i,26)last[i] = -1;
    rep(i,d){
        res += s[i][now[i]];
        last[now[i]] = i;
        rep(j,26) res -= c[j] * (i - last[j]);
    }
    return res;
}

int main(){
    random_device seed;
    mt19937 mt(seed());
    uniform_int_distribution<int> rnd1(0,25);

    cin >> d;
    uniform_int_distribution<int> rnd2(0,d-1);
    rep(i,26) cin >> c[i];
    s.resize(d);
    rep(i,d)s[i].resize(26);
    rep(i,d)rep(j,26) cin >> s[i][j];
    t.resize(d);now.resize(d);
    rep(i,d){now[i] = i%26;t[i] = now[i];}
    best = score();
    rep(_,10000){
        // cout << best << endl;
        // rep(i,d)now[i] = rnd1(mt);
        int choice = rnd2(mt);
        rep(i,26){
            now[choice] = i;
            ll now_s = score();
            if(best < now_s){
                best = now_s;
                rep(j,d)t[j] = now[j];
            }
        }
    }

    // cout << score() << endl;
    rep(i,d)cout << t[i]+1 << endl;

    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
//mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
//int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

int main() {
	char s;
	scanf("%c",&s);
	if(s>=97){
		printf("a"); 
	} else{
		printf("A");
	}
} 

Measured memory_bytes: 3724
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split();
		double N = double.Parse(str[0]);
		double M = double.Parse(str[1]);
		double d = double.Parse(str[2]);
		double ct = 0;
		if(d==0){
			ct = N/N;
		} else {
			ct = (2*N-2*d)/N;
		}
		ct = ct * (M-1) / N;
		Console.WriteLine(ct);
	}
}

Measured memory_bytes: 13140
import sys
import itertools


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    h, w, K = list(map(int, readline().split()))
    if w == 1:
        print(1)
    else:
        pt = [[0] * w for _ in range(w)]
        pf = [0] * w
        for it in itertools.product([True, False], repeat=w-1):
            b = True
            for i in range(1, len(it)):
                if it[i] and it[i-1]:
                    b = False
                    break
            if b:
                for i in range(len(it)):
                    if it[i]:
                        pt[i][i+1] += 1
                        pt[i+1][i] += 1
                    else:
                        if i == 0:
                            pf[i] += 1
                        elif i == w - 2:
                            pf[i+1] += 1
                for i in range(1, w - 1):
                    if not it[i-1] and not it[i]:
                        pf[i] += 1
        dp = [[0] * w for _ in range(h + 1)]
        dp[0][0] = 1
        for i in range(1, h + 1):
            for j in range(w):
                for k in range(w):
                    if j != k:
                        dp[i][j] += dp[i-1][k] * pt[j][k]
                    else:
                        dp[i][j] += dp[i-1][k] * pf[j]
                    dp[i][j] %= mod
        print(dp[-1][K-1])


if __name__ == '__main__':
    solve()


Measured memory_bytes: 39664
#include<bits/stdc++.h>
using namespace std;
#define int long
signed main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(auto& i:a)cin>>i;
  for(int i=1;i<n;++i)a[i]+=a[i-1];
  int md=a[n-1];
  for(int i=0;i<n-1;++i){
    md=min(md,abs((a[n-1]-a[i])-a[i]));
  }
  cout<<md;
}

Measured memory_bytes: 1920
import sys
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy

    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N = I()
    mylist = [LI() for i in range(N)]
    dist = [[0 for i in range(N)] for i in range(N)]
    for index1, num1 in enumerate(mylist):
        for index2, num2 in enumerate(mylist):
            dist[index1][index2] = math.sqrt((num1[0]-num2[0])**2 + (num1[1]-num2[1])**2)
    result = 0
    index = 0
    seq = [i for i in range(N)]
    for i in itertools.permutations(seq):
        index += 1
        past = i[0]
        for num in i[1:]:
            result += dist[past][num]
            past = num
            
            
    print(result/index)

    
    
    
if __name__ == "__main__":
    main()

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

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define FORA(i,I) for(const auto& i:I)
#define ALL(x) x.begin(),x.end() 
#define SIZE(x) ll(x.size()) 

int main(void)
{
    long double  N,D;
    cin >> N >> D;

    long double x[1000000] = {0};
    long double  y[10000000] = {0};

    REP(i,N){
        cin >> x[i];
        cin >> y[i];
    }

    int ans = 0;
    REP(i,N){
        //if(x[i]*x[i] + y[i]*y[i] <= D*D){
        if(sqrt(x[i]*x[i]+y[i]*y[i]) <= D){
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 175656
import java.util.*;

/* 
 * 取模运算中的除法计算
 * （m + n） ! / (m! * n !)
 * 因为阶乘都被取模操作过， 所以除法时会出现问题
 * 本算法完美解决了此问题
 * */
public class Main {
	
	static int H, W, A, B;
	
	static final int MOD = 1000000007;
	
	public static void main(String[] args) {
		
		Scanner cin = new Scanner(System.in);
		
		/*input*/
		
		H = cin.nextInt();
		W = cin.nextInt();
		A = cin.nextInt();
		B = cin.nextInt();
		
		
		/* start */
		
		//get 
		long[] f = new long[W + H + 1];
		f[0] = 1;
		for (int i = 1; i < f.length; i ++) {
			f[i] = i * f[i-1];
			f[i] %= MOD;
		}
		
		
		//step1
		
		long res = 0;
		
		for (int j = B; j < W; j ++) {
			res += (comb((H - A - 1) + j, j, f) * 
				   comb((A - 1) + (W - j - 1), A - 1, f)) % MOD;
			res %= MOD;
		}
		
		res += MOD;
		res %= MOD;
		
		
		
		/*finish*/	
		System.out.println(res);
		
	}
	
	
	public static long mod_inv(long a, long m){
		return (a == 1 ? 1 : (1 - m*mod_inv(m%a, a)) / a + m);
	}
	
	public static long comb(int n, int k, long[] fact){
		if(n == 0){ return 1; }
		if(k == 0){ return 1; }
		
		return (((fact[n] * mod_inv(fact[k], MOD)) % MOD) * mod_inv(fact[n - k], MOD)) % MOD;
	}
}



Measured memory_bytes: 24532
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=1LL<<60;
const ll mod=1000000007;

int z[1000001];
int a[200001];
bool is_Prime(int n) {
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
int main(void){
    fill(z,z+1000001,100000000);
    int n;
    cin>>n;
    map<int,int> m;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        m[x]++;
    }
    vector<int> a;
    for(auto itr=m.begin();itr!=m.end();itr++){
        a.push_back(itr->first);
	}
    sort(a.begin(),a.end());
    for(int i=0;i<a.size();i++){
        if(a[i]==1){
            z[1]=min(i,z[1]);
            break;
        }
        z[a[i]]=min(i,z[a[i]]);
    }
    int ans=0;
    for(int i=0;i<a.size();i++){
        bool ok=true;
        if(z[1]<i) ok=false;
        for(int j=1;j*j<=a[i];j++){
            if(a[i]%j==0){
                if(z[j]<i||z[a[i]/j]<i){
                    ok=false;
                }
            }
        }
        if(is_Prime(a[i])){
            if(z[a[i]]<i) ok=false;
        }
        if(m[a[i]]>=2) ok=false;
        if(ok){
            ans++;
        }
    }
    cout<<ans<<endl;
}

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

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

  vector<int> al(26, 50);
  for (int i = 0; i < n; i++) {
    string S;
    cin >> S;
    for (char ch = 'a'; ch <= 'z'; ch++) {
      int cnt = 0;
      for (int j = 0; j < S.size(); j++) {
        if (ch == S[j]) cnt++;
      }
      al[ch - 'a'] = min(al[ch - 'a'], cnt);
    }
  }

  string ans = "";
  for (int i = 0; i < 26; i++) {
    int num = al[i];
    for (int j = 0; j < num; j++) {
      ans += 'a' + i;
    }
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
typedef long long ll;
map<ll, ll> m;
ll f(ll n) {
  return m[n] > 0 ? m[n]
                  : (m[n] = (f(n / 2) + f((n - 1) / 2) % MOD + f((n - 2) / 2)) %
                            MOD);
}

int main() {
  ll n;
  scanf("%lld", &n);
  m[0] = 1;
  m[1] = 2;
  printf("%lld\n", f(n));
  return 0;
}


Measured memory_bytes: 256
N, M = gets.chomp.split(' ').map(&:to_i)
like_list = N.times.flat_map do
  k, *a_list = gets.chomp.split(' ').map(&:to_i)
  a_list.take(k)
end
ans = like_list.group_by { |n| n }.count { |_, values| values.size == N }
puts ans


Measured memory_bytes: 1916
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <math.h>
#include <cstdlib>
#include <cctype>
#include <random>

using namespace std;

int main() {
  string s;
  cin >> s;

  if (s[0] == s[1]) {
    cout << "Bad" << endl;
  } else if (s[1] == s[2]) {
    cout << "Bad" << endl;
  } else if (s[2] == s[3]) {
    cout << "Bad" << endl;
  }else {
    cout << "Good" << endl;
  }


  return 0;
}


Measured memory_bytes: 888
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,b,n) for(int i=b;i<n;i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
map<int,int> ma,mb;
int main(){
	int a,b;
	string str;
	while(getline(cin,str),str.size()!=0){
		stringstream ss;
		rep(i,str.size()){
			if(str[i]==',')str[i]=' ';
		}
		ss<<str;
		ss>>a;
		ma[a]++;
	}
	while(scanf("%d,%d",&a,&b)!=EOF){
		if(ma[a]!=0){
			if(mb[a]==0){
				mb[a] = ma[a];
			}
			mb[a]++;
		}
	}
	map<int,int>::iterator it = mb.begin();
	while(it!=mb.end()){
		cout <<it->first<<" "<<it->second<<endl;
		it++;
	}

	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
using namespace std;

typedef long long ll;

/*
const ll M = 1000000007;
vector<ll> fac(3001);
vector<ll> ifac(3001);
ll mpow(ll x, ll n){
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n = n >> 1;
    }
    return ans;
}
 
ll comb(ll a, ll b){
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0 || b < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % M;
    return tmp * fac[a] % M;
}
*/


ll lcm(ll a,ll b){
 
  ll r, x, tmp;
  x = a * b;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return x/b;
}

ll gcd(ll a ,ll b){
    if(a==0){return b;}
    else if(b==0){return a;}
    else{
    ll tmp,r;
    if(a<b){
        tmp = a;
        a = b;
        b = tmp;
    }
    
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
    }
    return b;
    }
}




int main(void){
    const ll M = 1000000000;
    ll a,b;
    ll ans = 0;
    cin >> a >> b;
    if((a%2)==(b%2))cout << (a+b)/2 << endl;
    else cout << "IMPOSSIBLE" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int d[n];
  for(int i=0;i<n;i++) cin>>d[i];
  map<int,int> m;
  int s=0,ans=0;
  for(int i=0;i<n;i++){
    s+=d[i];
    if(m.count(s)) ans=max(ans,i-m[s]);
    else m[s]=i;
    if(!s) ans=max(ans,i+1);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 17104
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799;

ll a, b, n;

int main(){
  cin >> a >> b >> n;
  ll ans = 0;

  if(n < b){
    ans = a * n / b;
  }else{
    ans = a * (b - 1) / b;
  }
  cout << ans <<endl;
}

Measured memory_bytes: 3596
#include<stdio.h>
int main()
{
	double a,b, c, d, e, f, x,y;
	while(scanf("%lf%lf%lf%lf%lf%lf",&a,&b,&c,&d,&e,&f)!=EOF)
	{
		x=(e*c-b*f)/(e*a-b*d);
		y=(c-a*x)/b;
		if(x==-0)
			x=0;
		if(y==-0)
			y=0;
		printf("%0.3f %0.3f\n",x,y);
	}
}

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


#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

int main()
{
	cin.tie(0); ios_base::sync_with_stdio(false);
	int a, b;
	cin >>a >>b;
	
	rep2(i, 1, 100200){
		if(i * 8 /100 == a && i * 10 /100 ==b){
			cout << i <<"\n";
			return 0;
		}
	}
	puts("-1");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX_N 100000
#define MAX_M 100000
const int MAX = 10000000;
const int MOD = 1000000007;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecbvecb vector<vector<bool>>
#define vecst vector<string>
#define vecch vector<char>
#define vecf vector<float>
#define vecvec vector<vector<int>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
const int INF = 1e9;
#define PI 3.141592653589793
// cout << setprecision(15) << std::fixed;
int main() {
  int n;
  cin>>n;
  vecch s;
  if(n==0){
    cout<<0<<endl;
    return 0;
  }
  bool che=true;
  while(che){
    int k=n%(-2);
    if(k==0){
      s.push_back('0');
    }
    else{
      s.push_back('1');
      n--;
    }
    n/=-2;
    if(n==0) che=false;
  }
  reverse(all(s));
  for(int i=0;i<s.size();i++) cout<<s[i];
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pdd;

#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int N = (int)1e5 + 3;

int main(){
    fastIO;
    int n;
    cin >> n;
    ll a[n];
    ll total = 0;
    for(int i = 0 ; i < n; i ++ ){
        cin >> a[i];
        a[i] *= 2ll;
        if(i % 2 == 0) total += a[i];
    }
    for(int i = 1; i < n; i += 2){
        total -= a[i];
    }
    total /= 2;
    cout << total << " ";
    for(int i = 0 ; i + 1 < n; i ++ ){
        total = a[i] - total;
        cout << total << " ";
    }
    return 0;
}

Measured memory_bytes: 2176
#include <cstdio>
#include <iostream>

using namespace std;

int parent(int i) {
    return i / 2;
}

int left(int i) {
    return 2 * i;
}

int right(int i) {
    return 2 * i + 1;
}

int main() {
    int H;
    scanf("%d", &H);

    int Heap[H + 1];
    for (int i = 1; i < H + 1; ++i)
        scanf("%d", &Heap[i]);

    for (int i = 1; i < H + 1; ++i) {
        cout << "node " << i << ": key = " << Heap[i] << ", ";
        if (parent(i) >= 1)
            cout << "parent key = " << Heap[parent(i)] << ", ";
        if (left(i) <= H)
            cout << "left key = " << Heap[left(i)] << ", ";
        if (right(i) <= H)
            cout << "right key = " << Heap[right(i)] << ", ";
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
using namespace std;
int main () {
  long N, K;
  cin >> N >> K;
  long ans = 0;
  for(int i = 1; i <= N; i++){
    if(K >= i)continue;
    if(N % i != 0)ans += (N / i) * (i - K) + max((N % i - (K?K - 1:K)), 0L);
    else ans += (N / i) * (i - K);
    //cout << ans << endl;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <stdlib.h>
#include <cmath>

int main() {

    int S, N, L, tmp1;
    std::string s;
    int ans = 0;

    std::cin >> s;

    int flag1 = 1;
    int flag2 = 0;
    if(s[0] == s[1]){
        flag1++;
    }else {
        flag2++;
    }

    if(s[0] == s[2]){
        flag1++;
    }
    else {
        if(s[1] == s[2]){
            flag2++;
        }else{
            if(flag2 == 0){
                flag2++;
            }
            else {
                std::cout << "No" << std::endl;
                return 0;
            }
        }
    }
    if(s[0] == s[3]){
        flag1++;
    }
    else {
        if(s[1]==s[3]){
            flag2++;
        }
        else {
            if(flag2 == 1 && s[2] == s[3]){
                std::cout << "Yes" << std::endl;
                return 0;
            }
            else {
                std::cout << "No" << std::endl;
                return 0;
            }
        }
    }
    if(flag1 > 2 || flag2 > 2){
        std::cout << "No" << std::endl;
        return 0;
    }

    std::cout << "Yes" << std::endl;
    return 0;
}

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

int main()
{
    int l, r, d;
    cin >> l >> r >> d;
    int ans = 0;
    for(int i = l; i <= r; ++i) {
        if (i % d == 0) ++ans;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3620
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
//const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int N;
	int P[30];
	cin >> N;
	rep(i, 0, N)
	{
		cin >> P[i];
	}

	int ans = 0;
	rep(i, 1, N - 1)
	{
		if (min(P[i - 1], P[i + 1]) < P[i] && P[i] < max(P[i - 1], P[i + 1]))
		{
			ans++;
		}
	}

	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
def calc_triangle(a, b, C):
    from math import sqrt, sin, cos, tan, radians
    c = sqrt(a**2 + b**2 - (2*a*b*cos(radians(C))))
    L = a + b + c
    S = 0.5 * a * b * sin(radians(C))
    h = b * sin(radians(C))
    return S, L, h


if __name__ == '__main__':
    # ??????????????\???
    data = [int(x) for x in input().split(' ')]
    a = data[0]
    b = data[1]
    C = data[2]

    # ????§???¢???????¨??????±????¨????
    S, L, h = calc_triangle(a, b, C)

    # ???????????????
    print('{0:.8f}\n{1:.8f}\n{2:.8f}'.format(S, L, h))

Measured memory_bytes: 7836
import java.util.*;
public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        ArrayList<ArrayList<Integer>> L = new ArrayList<>();
        for(int i=0;i<n;i++)L.add(new ArrayList<Integer>());
        for(int i=0;i<q;i++){
            int cmd = sc.nextInt();
            int t = sc.nextInt();
            if(cmd==0){
                int x = sc.nextInt();
                L.get(t).add(x);
            }
            else if(cmd==1) {
                if(L.get(t).size()==0) System.out.print("");
                else{
                    System.out.print(L.get(t).get(0));
                    for(int j=1;j<L.get(t).size();j++) System.out.print(" "+L.get(t).get(j));
                }
                System.out.println();
            }
            else L.get(t).clear();
        }
    }
}


Measured memory_bytes: 309932
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	char S[100010];
	scanf("%s", S);

	int i, j, k;
	char ans = 'a';
	int flag[26];
	for (i = 0; i < 26; i++) {
		flag[i] = 0;
	}
	k = 0;
	for (i = 'a'; i <= 'z'; i++) {
		for (j = 0; S[j] != '\0'; j++) {
			if (i == S[j]) {
				flag[k] = 1;
			}
		}
		k++;
	}
	for (i = 0; i < 26; i++) {
		if (flag[i] != 1) {
			printf("%c\n", 'a' + i);
			break;
		}
	}
	if (i == 26) {
		printf("None\n");
	}
	return 0;
}


Measured memory_bytes: 256
N, W = map(int, input().split())
VW = [[0,0]]
for _ in range(N):
	VW.append(list(map(int, input().split())))

dp = [[0] * (W+1) for _ in range(N+1)]

for i in range(1,N+1):
	for j in range(1, W+1):
		if VW[i][1] > j:
			dp[i][j] = dp[i-1][j]
		else:
			dp[i][j] = max(dp[i-1][j], dp[i-1][j-VW[i][1]] + VW[i][0])

print(dp[N][W])


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

int main(){
    int dp[40000][5] = {};
    dp[0][0] = 1;

    for(int i = 1; i*i < 40000; i++){
        for(int k = 1; k <= 4; k++){
            for(int j = i*i; j < 40000; j++){
                dp[j][k] += dp[j-i*i][k-1];
            }
        }
    }

    int n;
    while(cin >> n, n)  cout << dp[n][1]+dp[n][2]+dp[n][3]+dp[n][4] << endl;
    
    return 0;
}


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

using namespace std;

const long long MOD = 1e9 + 7;

long long memo[2020][2020];

/* べき乗(mのn乗)を計算する関数. O(logn) */
template <typename T>
T modpow(T m, T n, const T &p) {
  if (n == 0) return 1;
  T ret = modpow(m * m % p, n / 2, p);
  if (n % 2) ret *= m;
  return ret % p;
}
/* フェルマーの小定理を使って二項係数を計算. O(r) */
template <typename T>
T binomial(T n, T r, const T &p) {
  if (r > n - r) return binomial(n, n - r, p);
  if (memo[n][r] != 0) return memo[n][r];
  T ansMul = 1;
  T ansDiv = 1;
  for (T i = 0; i < r; i++) {
    ansMul *= (n - i);
    ansDiv *= (i + 1);
    ansMul %= p;
    ansDiv %= p;
  }
  // ansDivの逆元
  T ans = (ansMul * modpow(ansDiv, p - 2, p)) % p;
  return memo[n][r] = ans;
}

int main() {
  long long N, K;
  cin >> N >> K;

  for (long long k = 1; k <= K; k++) {
    if (N - K + 1 < k) {
      cout << 0 << endl;
    } else {
      cout << binomial(N - K + 1, k, MOD) * binomial(K - 1, k - 1, MOD) % MOD
           << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 4352