akhauriyash/Code-Regression huggingface dataset:
//marico el que lo lea
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <stdlib.h>
#include <assert.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;

void fastIO() {std::ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);}

#define pb push_back
#define all(obj) obj.begin(), obj.end()
#define ms(obj, val) memset(obj, val, sizeof(obj))
#define ms2(obj, val, sz) memset(obj, val, sizeof(obj[0])*sz)

#define fst first
#define snd second

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

void _scan( int &x ) { scanf("%d",&x); }
void _scan( long long &x ) { scanf("%lld",&x); }
void _scan( double &x ) { scanf("%lf",&x); }
void _scan( char &x ) { scanf(" %c",&x); }
void _scan( char *x ) { scanf("%s",x); }
template<typename T>
void _scan( vector<T> &v ){
	for(int i=0; i<(int)v.size(); i++) _scan(v[i]);
}
void scan() {}
template<typename T, typename... U>
void scan( T& head, U&... tail ) { _scan(head); scan(tail...);}

template<typename T> void _dbg(const char* sdbg, T h)
	{ cerr<<sdbg<<"="<<h<<"\n"; }
template<typename T, typename... U> void _dbg(const char* sdbg, T h, U... t) {
	while(*sdbg != ',')cerr<<*sdbg++;
	cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr<<#x<<" = "; for(auto _i:x) cerr<<_i<<", ";cerr<<"\n";}}
#define debuga(x, sz) {{cerr<<#x<<" = ";for(int _i=0;_i<sz;_i++)cerr<<x[_i]<<", ";cerr<<"\n";}}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define debuga(x, sz)
#define cerr if(0)cout
#endif

ll MOD = 1e9+7;

inline ll Msum(ll x){return x;}
template<typename... Rest>
inline ll Msum(ll x, Rest... rest){ return (x + Msum(rest...)) % MOD; }

inline ll Mprod(ll x){return x;}
template<typename... Rest>
inline ll Mprod(ll x, Rest... rest){ return x * Mprod(rest...) % MOD; }

inline ll Mnorm(ll x){ return (x%MOD + MOD) %MOD; }

inline ll Msq(ll x){ return (x*x) %MOD; }
inline ll Mpot(ll x, ll e){
	if(!e) return 1;
	return Msq(Mpot(x, e>>1)) * (e & 1 ? x : 1)%MOD;
}
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

const int MAXN = 2e5+5;

int n, p[20][MAXN];
int A[MAXN];

int main(){
	scan(n);
	for(int i=0; i<n; i++){
		int a; scan(a);
		A[i] = a;
		for(int j=0; j<20; j++){
			int b = (a>>j)&1;
			p[j][i] = b;
			if(i) p[j][i] += p[j][i-1];
		}
	}

	ll ans = 0;
	for(int i=0; i<n; i++){
		int d = n;
		for(int b=0; b<20; b++){
			int nd;
			if((A[i]>>b) & 1)
				nd = distance(p[b]+i, upper_bound(p[b], p[b]+n, p[b][i]));
			else
				nd = distance(p[b]+i, upper_bound(p[b], p[b]+n, p[b][i]+1));
			mnze(d, nd);
		}
		ans += d;
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 16640
#include <iostream>
#include <algorithm>
#include <cstring>
#include <queue>

using namespace std;

int main(){

  int n;
  cin>>n;

  int march[5];
  for(int i = 0;i<5;i++)
    march[i] = 0;
 

  for(int i = 0;i<n;i++){
    string s;
    cin>>s;
    if(s[0] == 'M')
      march[0]++;
    else if(s[0] == 'A')
      march[1]++;
    else if(s[0] == 'R')
      march[2]++;
    else if(s[0] == 'C')
      march[3]++;
    else if(s[0] == 'H')
      march[4]++;

  }
  /*
  for(int i = 0;i<5;i++){
    cout<<march[i]<<endl;
  }
  */
  long long ans = 0;
  for(int i = 0;i<(1<<5);i++){
    int num = 0;
    long long tmp = 1;
    for(int j = 0;j<5;j++){
      if((i&(1<<j)) != 0){
	num++;
	tmp *= march[j];
      }
    }
    if(num ==3){
      
      ans += tmp;
      // cout<<"num:"<<num<<"\t ans:"<<ans<<endl;
    }
      
  }
  cout<<ans<<endl;
  
  return 0;
}


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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

/*最小公倍数*/
ll lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

/*最大公約数*/
ll gcd(ll a, ll b){
    return __gcd(a,b);
}

int main(){

    ll n; cin >> n;
    string s;
    vll d(5, 0);
    vll p = {0, 0, 0, 0, 0, 0, 1, 1, 1, 2};
    vll q = {1, 1, 1, 2, 2, 3, 2, 2, 3, 3};
    vll r = {2, 3, 4, 3, 4, 4, 3, 4, 4, 4};
    rep(i, n){
        cin >> s;
        if(s[0] == 'M') d[0]++;
        if(s[0] == 'A') d[1]++;
        if(s[0] == 'R') d[2]++;
        if(s[0] == 'C') d[3]++;
        if(s[0] == 'H') d[4]++;
    }

    ll ans = 0;
    rep(i, 10){
        ans += d[p[i]]*d[q[i]]*d[r[i]];
    }

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

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n;
	cin>>n;
	vector<ll> vec(n,0);
	for(ll i=0;i<n;i++){
		cin>>vec[i];
	}
	
	ll maxi=0;
	ll count=0;
	for(ll i=0;i<n-1;i++){
		if(vec[i+1]<=vec[i]){
			count++;
			maxi=max(maxi,count);
		}
		else{
			count=0;
		}
	}
	
	cout<<maxi<<endl;
}

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

typedef long long int ll;
typedef long double ld;

#define Pb push_back
#define Mp make_pair

#define ff first
#define ss second

#define Max(x,y,z) max(x,max(y,z))
#define Min(x,y,z) min(x,min(y,z))

#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN

#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

#define db1(x) cout<<#x<<" : "<<x<<endl;
#define db2(x,y) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<endl;
#define db3(x,y,z) cout<<#x<<" : "<<x<<"\t"<<#y<<" : "<<y<<"\t"<<#z<<" : "<<z<<endl;

const int N = 1e5+5;
int f[N];

void solve()
{
   int n;
   cin >> n;
   ll sum = 0;
   for(int i=0;i<n;i++)
   {
      int x;
      cin >> x;
      sum += x;
      f[x]++;
   }
   int q;
   cin >> q;
   for(int i=0;i<q;i++)
   {
      int x,y;
      cin >> x >> y;
      if(f[x])
      {
         sum -= x*1LL*f[x];
         sum += y*1LL*f[x];
         f[y]+= f[x];
         f[x] = 0;
      }
      cout << sum << endl;
   }
}

signed main()
{
  IOS;
  //freopen("input.txt", "rt", stdin);
  //freopen("output.txt", "wt", stdout);
  int t=1;
  //cin >> t;
  while(t--)
  {
    solve();
  }
  return 0;
}
/*==============================================================================================================================================================*/


Measured memory_bytes: 3964
n = int(input())
print(n-1)
base = input()
def srh(n, t, str):
    print(((n - 1) // 2) + t)
    point = input()
    if point == 'Vacant':
        return
    if n % 4 == 1:
        if point == str:
            srh((n // 2) + 1, t, point)
        else:
            srh((n // 2) + 1, t + (n // 2), str)
    else:
        if point == str:
            srh(n // 2, t + (n // 2) + 1, str)
        else:
            if point == 'Male':
                srh(n // 2, t, 'Female')
            else:
                srh(n // 2, t, 'Male')
srh(n, 0, base)


Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n, i, j, k=0, m, p=0, f=0, a[3], x, y, z;
    cin>>n;
    unordered_map<ll, ll>mp;
    a[0]=0, a[1]=0, a[2]=0;
    for(i=0; i<n; i++){
        cin>>j;
        if(j!=0)p=j;
        if(mp[j]==0){
            k++;
            if(k>=4){
                f=1;
            }
            else{
                a[k-1]=j;
            }
        }
        mp[j]++;
    }
    if(f==1){
        cout<<"No"<<endl;
    }
    else{
        x=mp[a[0]];
        y=mp[a[1]];
        z=mp[a[2]];
        if(mp.size()==1){
            if(a[0]==0)cout<<"Yes"<<endl;
            else cout<<"No"<<endl;
        }
        else if(mp.size()==2){
            if(mp[0]==0)cout<<"No"<<endl;
            else{
                if(mp[p]==2*mp[0])cout<<"Yes"<<endl;
                else cout<<"No"<<endl;
            }
        }
        else if(mp.size()==3){
            if((a[0]^a[1]^a[2])==0){
                if(x==y && x==z)cout<<"Yes"<<endl;
                else cout<<"No"<<endl;
            }
            else{
                cout<<"No"<<endl;
            }
        }
         else cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N;
int A[100100];
int main(){
	cin >> N;
	for(int i=0;i<N;i++)cin >> A[i];
	sort(A,A+N);
	int k = lower_bound(A,A+N,0)-A;
	int res;
	if(k==N){
		res = A[N-1];
		for(int i=0;i<N-1;i++){
			res = res - A[i];
		}
		cout << res << endl;
		res = A[N-1];
		for(int i=0;i<N-1;i++){
			cout << res << ' ' << A[i]<< endl;
			res = res - A[i];
		}
	}else if(k==0){
		res = A[0];
		for(int i=1;i<N-1;i++){
			res -= A[i];
		}
		cout << A[N-1]-res << endl;
		res = A[0];
		for(int i=1;i<N-1;i++){
			cout << res << ' ' << A[i] << endl;
			res -= A[i];
		}
		cout << A[N-1] << ' ' << res << endl;
	}else{
		int p = A[k]; //plus
		int q = A[k-1]; //minus
		for(int i=k+1;i<N;i++){
			q -= A[i];
		}
		for(int i=0;i<k-1;i++){
			p -= A[i];
		}
		cout << p - q << endl;
		p = A[k]; //plus
		q = A[k-1]; //minus
		for(int i=k+1;i<N;i++){
			cout << q << ' ' << A[i] << endl;
			q -= A[i];
		}
		for(int i=0;i<k-1;i++){
			cout << p << ' ' << A[i] << endl;
			p -= A[i];
		}
		cout << p << ' ' << q << endl;
	}
	return 0;
}

Measured memory_bytes: 2304
#include<bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
struct Macho {int c, w;};
int main() {
  int N;
  cin >> N;
  vector<Macho> macho(N);
  for(auto& m: macho) cin >> m.c >> m.w;
  vector<vector<int>> liftable(N, vector<int>(N, INF));
  for(int i = 0; i < N; ++i) liftable[i][i] = macho[i].w;
  for(int range = 1; range < N; ++range) {
    // ????????°?????????????????????????????????????????????
    for(int i = 0; i < N - range; ++i) {
      int j = i + range;
      if(liftable[i + 1][j] <= macho[i].c) liftable[i][j] = liftable[i + 1][j] + macho[i].w;
    }
    // ????????°?????????????????????????????????????????????
    for(int i = range; i < N; ++i) {
      int j = i - range;
      if(liftable[j][i - 1] <= macho[i].c) liftable[j][i] = liftable[j][i - 1] + macho[i].w;
    }
  }
  vector<vector<int>> dp(N, vector<int>(N, INF));
  for(int j = 0; j < N; ++j) dp[0][j] = (liftable[0][j] != INF) ? 1 : dp[0][j - 1] + 1;
  for(int i = 1; i < N; ++i) {
    dp[i] = dp[i - 1];
    for(int j = i; j < N; ++j) if(liftable[i][j] != INF) dp[i][j] = min(dp[i][j], dp[i - 1][i - 1] + 1);
  }
  cout << dp[N - 1][N - 1] << endl;
}

Measured memory_bytes: 8916
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo(os.Stdin, os.Stdout)
	defer io.Flush()
	k := io.NextInt()
	a := io.NextInt()
	b := io.NextInt()
	for i := a; i <= b; i++ {
		if i%k == 0 {
			io.Println("OK")
			return
		}
	}
	io.Println("NG")
}

// Io is I/O object
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

// NewIo returns a new Io instance
func NewIo(r io.Reader, w io.Writer) *Io {
	return &Io{
		reader: bufio.NewReader(r),
		writer: bufio.NewWriter(w),
	}
}

// Flush flushes writer
func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

// NextLine scans a line from stdin
func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

// Next return a word from stdin
func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

// NextInt returns an integer from stdin
func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

// Println is a wrapper of fmt.Fprintln
func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}


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

/* #pragma */
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")


/*alias*/
#define F first
#define S second

#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define itn int

/*template*/
template<class T>inline bool amax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>inline bool amin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }

/* func */
int32_t GCD(int32_t a, int32_t b){return b ? GCD(b, a%b) : a;}
int64_t GCD(int64_t a, int64_t b){return b ? GCD(b, a%b) : a;}
int32_t LCM(int32_t a, int32_t b){return a * b / GCD(a, b);}
int64_t LCM(int64_t a, int64_t b){return a * b / GCD(a, b);}

/*struct*/
struct aaa {
	aaa() {
		cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20);
	};
}aaaaaaa;

/* const */
constexpr int32_t INF = 1001001001;
constexpr int64_t LINF = 1001001001001001001ll;
constexpr int32_t MOD = 1e9 + 7; //10^9
constexpr int64_t EPS = 1e-9;
constexpr int32_t dx[] = { 1, 1, 0, -1, -1, -1, 0, 1 }, dy[] = { 0, 1, 1, 1, 0, -1, -1, -1 };
//constexpr int32_t dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
//Counterclockwise from the 6o'clock direction
//Take the x-axis downward and the y-axis right


//g++ -std=c++14 -Wall --pedantic-errors -o template template.cpp
//g++ -std=c++14 -Wall --pedantic-errors template.cpp
//chcp 65001

/*global*/



//#define int int64_t
signed main()
{
	int n; cin >> n;
	vector<int> a(n);
	for(int i = 0, i_len = (int)n; i < i_len; ++i) cin >> a[i];
 
	vector<int> left(n+1, 0);
	vector<int> right(n+1, 0);

for (int i = 0; i < n; ++i) left[i+1] = max(left[i], a[i]);
for (int i = n-1; i >= 0; --i) right[i] = max(right[i+1], a[i]); 

	for(int i = 0, i_len = (int)n; i < i_len; ++i)
	{
		cout << max(left[i], right[i+1]) << '\n';
	}	
}

Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()

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

    int N, K;
    cin >> N >> K;
    vector<pair<int, int>> sushi(N);
    REP(i, N) {
        int t, d;
        cin >> t >> d;
        sushi[i] = {d, t - 1};
    }
    sort(ALL(sushi));
    reverse(ALL(sushi));
    ll s = 0;
    ll x = 0;
    vector<bool> used(N);
    vector<int> discard;
    REP(i, K) {
        int d = sushi[i].first, t = sushi[i].second;
        s += d;
        if (!used[t]) {
            x++;
            used[t] = true;
        } else {
            discard.push_back(d);
        }
    }
    ll ans = s + x * x;
    sort(ALL(discard));
    reverse(ALL(discard));
    for (int i = K; i < N && !discard.empty(); i++) {
        int d = sushi[i].first, t = sushi[i].second;
        if (used[t]) continue;
        used[t] = true;
        s -= discard.back();
        discard.pop_back();
        s += d;
        x++;
        ans = max(ans, s + x * x);
    }
    cout << ans << endl;
}

Measured memory_bytes: 1408
#include<stdio.h>

int n,i;
int dp[31];
int main(){
  dp[0]=1;
  dp[1]=1;
  dp[2]=2;
  dp[3]=4;
  for(i=4;i<=30;i++){
    dp[i]=dp[i-1]*2-dp[i-4];
  }
  
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    printf("%d\n",(dp[n]+3649)/3650);
  }
  return 0;
}

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

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1e9
typedef long long ll;


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

    int count = 0;
    ll sum = 0;
    ll min_a = INF;
    REP(i,N){
        ll a;
        cin >> a;
        if (a<0){
            count++;
            a = -a;
        }
        sum += a;
        min_a = min(min_a, a);
    }
    if(count%2 == 0){
        cout << sum << endl;
    }else{
        cout << sum - 2*min_a << endl;
    }
    return 0;
}

Measured memory_bytes: 3644
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def solve():
    xc = [[0] * n for _ in range(1 << n)]
    yc = [[0] * n for _ in range(1 << n)]
    for s in range(1 << n):
        xcs = xc[s]
        ycs = yc[s]
        for i, (x, y, p) in enumerate(xyp):
            xcost = abs(x)
            ycost = abs(y)
            for j, (lx, ly, _) in enumerate(xyp):
                if s >> j & 1 == 0: continue
                if abs(x - lx) < xcost: xcost = abs(x - lx)
                if abs(y - ly) < ycost: ycost = abs(y - ly)
            xcs[i] = xcost * p
            ycs[i] = ycost * p
    # print(xc)

    ans = [inf] * (n + 1)
    for s in range(1 << n):
        k = bin(s).count("1")
        xs = (1 << n) - 1
        while xs > 0:
            xs &= s
            xcs = xc[xs]
            ycs = yc[s - xs]
            cur = 0
            for i in range(n): cur += min(xcs[i], ycs[i])
            if cur < ans[k]: ans[k] = cur
            xs -= 1

    for a in ans: print(a)

inf = 10 ** 16
n = II()
xyp = LLI(n)

solve()


Measured memory_bytes: 88304
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;

    ll n; cin >> n;
    ll ans = (to_string(n)).size();

    for(ll a=2;a*a<=n;a++){
        if(n%a != 0) continue;
        ll b = n/a;
        ll cur = max(to_string(a).size(),to_string(b).size());
        ans = min(ans,cur);
    }

    cout << ans << endl;
    return 0;

}


Measured memory_bytes: 3692
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		 int n=in.nextInt();
		 List<Integer> A=new ArrayList<>();
		 
		 for(int i=0;i<n;i++)A.add(Integer.parseInt(in.next()));
		 in.close();
		 
		 int swap=selection(A);
		 for(int i=0;i<n-1;i++)System.out.print(A.get(i)+" ");
		 System.out.println(A.get(n-1));
		 System.out.println(swap);
	}
	
	static int selection(List<Integer> A) {
		int sw=0;
		
		for(int i=0;i<A.size();i++) {
			int min=i;
			for(int j=i;j<A.size();j++) {
				if(A.get(j)<A.get(min))min=j;
			}
			
			if(min>i) {
				Collections.swap(A, i, min);
				sw++;
			}
			
		}
		
		return sw;
	}
}



Measured memory_bytes: 26304
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int[] P = new int[N];
        for (int i = 0; i < N; i++) {
            P[i] = scan.nextInt();
        }
        int[] count = new int[N+1];
        for (int i = 0; i < N; i++) {
            count[P[i]] += count[P[i]-1] + 1;
        }

        System.out.println(N - Arrays.stream(count).max().getAsInt());
    }
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

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

    if(s.at(0)==s.at(2)) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

int main( void )
{
	register int i, j;

	bool isPrime[50001 + 1];
	isPrime[2] = true;
	for ( i = 3; i < 50001; i += 2 )
	{
		isPrime[i] = true;
	}

	for ( i = 3; i < 50001; i += 2 )
	{
		for ( j = i + i; j < 50001; j += i )
		{
			isPrime[j] = false;
		}
	}

	register int cnt = 1;
	int primes[5500];
	primes[0] = 2;
	for ( i = 3; i < 50001; i += 2 )
	{
		if ( isPrime[i] )
		{
			primes[cnt] = i;
			cnt++;
		}
	}

	register int n;
	while ( cin >> n && n != 0 )
	{
		int kotae = 0;
		for ( i = 0; i < cnt; i++ )
		{
			if ( primes[i] <= n / 2 )
			{
				if ( isPrime[n-primes[i]] )
					kotae++;
			}
		}
		cout << kotae << endl;
	}

	return 0;
}

Measured memory_bytes: 936
n = int(input())
s = input()
cnt = 0
for i in range(1000):
    i = str(i).zfill(3)
    j = s.find(i[0])
    if j != -1:
        k = s[j + 1:].find(i[1])
        if k != -1:
            if s[j + k + 2:].find(i[2]) != -1:
                cnt += 1
print(cnt)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 200005

typedef long long ll;

ll L,N,T;

ll X[200005];
ll W[200005];
ll t[200005];
ll sum[200005];
ll ans[200005];

ll f(ll x){
  while(x<0)x+=L;
  return x%L;
}

ll calc(int left,int right,int type){
  if(type==1)return sum[right]-sum[left];
  else return (right-left)-(sum[right]-sum[left]);
}

void solve(){
  ll loop=T*2/L;
  ll nt=T*2%L;
  
  int h=0;
  
  for(int i=0;i<N;i++){
    if(W[i]==2)continue;
    ll key=i;
    key+=loop*(N-sum[N]);
    while(h<N+N&&(W[h]==1||X[h]-X[i]<=nt))h++;
    key+= calc(i,h,2);
    key%=N;
    ans[key]=t[i];
  }

  h=N+N-1;
  for(int i=N+N-1;i>=N;i--){
    if(W[i]==1)continue;
    
    ll key=i;
    key+= N-( loop*(sum[N]) )%N;
    
    while(h>=0&&(W[h]==2||X[i]-X[h]<=nt))h--;
    key+=(N- calc(h+1,i,1))%N;

    key%=N;
    //    cout<<calc(h+1,i,1)<<' '<<key<<endl;
    //    cout<<key<<' '<<t[i]<<endl;

    ans[key]=t[i];
  }
}


int main(){
  memset(ans,-1,sizeof(ans));
  cin>>N>>L>>T;

  
  for(int i=0;i<N;i++){
    cin>>X[i]>>W[i];
    if(W[i]==1){
      t[i]=X[i]+T;
    } else{
      t[i]=X[i]-T;
    }
    t[i]=f(t[i]);
  }
  
  for(int i=0;i<N;i++){
    X[i+N]=X[i]+L;
    W[i+N]=W[i];
    t[i+N]=t[i];
  }

  for(int i=1;i<=N*2;i++){
    sum[i]=sum[i-1];
    if(W[i-1]==1)sum[i]++;
  }
  

  solve();

  for(int i=0;i<N;i++)
    cout<<ans[i]<<endl;
  return 0;
}


Measured memory_bytes: 8960
#include<bits/stdc++.h>
#define L long long
using namespace std;
int n,x[100010],l=1e9,r,a,b;
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
	  {
	   scanf("%d",&x[i]);
	   l=min(l,x[i]);
	   r=max(r,x[i]);
	  }
	for(i=1;i<=n;i++)
	  if(x[i]==l)
	    a++;
	  else if(x[i]==r)
	    b++;
	if(a+b<n || r>l+1)
	  {
	   printf("No\n");
	   return 0;
	  }
	if(l==r)
	  i=1,j=n/2;
	else
	  i=a+1,j=a+b/2;
	if(i<=r && r<=j || l==r && l==n-1)
	  printf("Yes\n");
	else
	  printf("No\n");
	return 0;
}


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

bool is_right_triangle(int a, int b, int c){
  // a2 >= b2 >= c2
  int a2, b2, c2;
  
  if(a >= b && a >= c){
    a2 = a * a;
    
    if(b >= c){
      b2 = b * b;
      c2 = c * c;
    } else {
      b2 = c * c;
      c2 = b * b;
    }
  } else if(b >= a && b >= c){
    a2 = b * b;

    if(a >= c){
      b2 = a * a;
      c2 = c * c;
    } else {
      b2 = c * c;
      c2 = a * a;
    }
  } else if(c >= a && c >= b){
    a2 = c * c;

    if(a >= b){
      b2 = a * a;
      c2 = b * b;
    } else {
      b2 = b * b;
      c2 = a * a;
    }
  }

  if(a2 == b2 + c2) return true;
  else return false;
}

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

  int a,b,c;

  for(int i = 0; i < n; i++){
    cin >> a;
    cin >> b;
    cin >> c;

    if(is_right_triangle(a, b, c)) cout << "YES" << endl;
    else cout << "NO" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3012
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n;
    cin >> n;
    for(int i = 1; i < 11; i++){
        if(i * 1000 >= n){
            cout << i * 1000 - n << endl;
            break;
        }
    }
}


Measured memory_bytes: 3608
// Connected?
// * frank_c1
// * 2017 / 09 / 30

#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;

int r, c;

inline bool chk(int x, int y) {
	return x == 0 || x == r || y == 0 || y == c;
}

inline int calc(int x, int y) {
	if (y == 0) return x; 
	else if (x == r) return r + y;
	else if (y == c) return r + c + r - x;
	else if (x == 0) return r + c + r + c - y;
	else throw;
}

const int maxn = (int)(2e5) + 5;
pii a[maxn];
int va[maxn];

int main() {
	int n, tot = 0, now = 0;
	scanf("%d%d%d", &r, &c, &n);
	for (int i = 1; i <= n; ++i) {
		int xa, ya, xb, yb;
		scanf("%d%d%d%d", &xa, &ya, &xb, &yb);
		if (chk(xa, ya) && chk(xb, yb)) {
			int wa = calc(xa, ya), wb = calc(xb, yb); a[++tot] = make_pair(wa, i); a[++tot] = make_pair(wb, i);
		}
	} 
	sort(a + 1, a + tot + 1); memset(va, -1, sizeof(va));
	for (int i = 1; i <= tot; ++i) {
		if (va[a[i].second] < 0) va[a[i].second] = ++now;
		else if (va[a[i].second] != now) return printf("NO\n"), 0; 
		else --now;
	}
	return printf("YES\n"), 0;
}

Measured memory_bytes: 2560
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
	string S;
	cin >> S;
	int year = 0, month = 0, day = 0;
	for (int i = 0; i < 4; i++) {
		year += (S[i] - '0') * pow(10, 3 - i);
	}
	for (int i = 5; i < 7; i++) {
		month += (S[i] - '0') * pow(10, 6 - i);
	}
	string ans = "TBD";
	if (year < 2019) ans = "Heisei";
	else if (year == 2019) {
		if (month <= 4) ans = "Heisei";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4004
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;
int main()
{
 
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll k,n;
  cin>>k>>n;
  ll arr[n],i,min1=k;
  for(i=0;i<n;i++)
  {
   cin>>arr[i];
  }
  for(i=0;i<n-1;i++) 
  {
   min1=min(k-(arr[i+1]-arr[i]),min1);
  }
  min1=min(min1,max(k-(arr[n-1]-arr[0]),arr[n-1]-arr[0]));
  cout<<min1;
  return 0;
}

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

int main()
{
  list<char> s;
  string tmp;
  cin >> tmp;
  for (auto &&i : tmp)
  {
    s.push_back(i);
  }
  int q;
  cin >> q;
  int rev_flag = 1;
  for (size_t i = 0; i < q; i++)
  {
    int t;
    cin >> t;
    if (t == 1)
    {
      rev_flag *= -1;
    }
    else if (t == 2)
    {
      int f;
      cin >> f;
      if (f == 2)f = -1;
      char c;
      cin >> c;
      if (f*rev_flag == 1)
      {
        s.push_front(c);
      }
      else if (f*rev_flag == -1)
      {
        s.push_back(c);
      }
      else
      {
        cout << "err" << endl;
      }
    }
    else
    {
      cout << "err" << endl;
    }
  }
  if (rev_flag == -1)
  {
    reverse(s.begin(), s.end());
  }
  
  for (auto &&a : s)
  {
    cout << a;
  }
  cout << "\n";

}

Measured memory_bytes: 13064
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:input()

"""========main code==============="""

#t=ii()
t=1
for _ in range(t):
    x=ii()
    if(x==0):
        print(1)
    else:
        print(0)
    

Measured memory_bytes: 65044
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef pair<int, int> pii;
typedef vector<pii> vii;
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()

const int N = 410;

void remax (int &x, int y)
{
    x = max(x, y);
}

void solve (int n)
{
    int m;
    cin >> m;

    vi x(m), y(m);
    forn (i, m)
    {
        cin >> x[i] >> y[i];
        --x[i], --y[i];
    }

    const int inf = (int)1e9;
    vvi lng(n, vi(n, -inf));
    forn (i, n)
        lng[i][i] = 0;

    forn (i, m)
    {
        int cx = x[i], cy = y[i];
        forn (j, n)
        {
            int ocx = lng[j][cx] + 1;
            remax(lng[j][cx], lng[j][cy] + 1);
            remax(lng[j][cy], ocx);
        }
        remax(lng[cx][cy], 1);
        remax(lng[cy][cx], 1);
    }

    vector<vc> rch(n, vc(n));
    forn (i, n) forn (j, n)
        rch[i][j] = (lng[i][j] > 0);

    vc good(n, 1);
    forn (v, n)
    {
        vc used(n);
        used[v] = 1;
        for (int i = m - 1; i >= 0; i--)
        {
            int cx = x[i], cy = y[i];
            if (!used[cx] && !used[cy])
                continue;
            if (!used[cx])
                swap(cx, cy);
            if (used[cy])
            {
                good[v] = 0;
                break;
            }
            used[cy] = 1;
        }
    }

    int ans = 0;
    forn (i, n) forn (j, i)
    {
        bool ok = true;
        ok &= (!rch[i][j] && !rch[j][i]);
        ok &= good[i] && good[j];
        forn (v, n)
            ok &= (!rch[v][i] || !rch[v][j]);
        ans += ok;
    }
    cout << ans << endl;
}

int main()
{
#ifdef LOCAL
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE

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

    int n;
    while (cin >> n)
        solve(n);
}


Measured memory_bytes: 1920
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def main():
    N, M, K = map(int, input().split())
    num_friends = [0 for _ in range(N)]
    blocks = [[] for _ in range(N)]
    uf = UnionFind(N)
    for _ in range(M):
        a, b = map(int, input().split())
        num_friends[a-1] += 1
        num_friends[b-1] += 1
        uf.union(a-1, b-1)
    for _ in range(K):
        a, b = map(int, input().split())
        blocks[a-1].append(b-1)
        blocks[b-1].append(a-1)

    for i in range(N):
        cnt = uf.size(i) - 1 - num_friends[i]
        for j in blocks[i]:
            if uf.same(i, j):
                cnt -= 1
        print(cnt, end=' ')
        

if __name__ == "__main__":
    main()

Measured memory_bytes: 28108
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
typedef long long ll;

const int MOD = 1000000007;  // 1 000 000 007


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

    // input
    int A, B;
    cin >> A >> B;
    
    // calculation
    if (A == 1) A += 13;
    if (B == 1) B += 13;
    
    if (A == B) {
        cout << "Draw" << "\n";
    } else if (A > B) {
        cout << "Alice" << "\n";
    } else {
        cout << "Bob" << "\n";
    }
    
    return 0;
}


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

int main()
{
    int n,k;
    cin >> n >> k;
    --k;
    int idx = 0;
    int num = 100001;
    for(int i = 0; i < n; ++i)
    {
        int t;
        cin >> t;
        if(t < num)
        {
            idx = i;
            num = t;
        }
    }

    int l = idx;
    int r = n-idx-1;
    int ans = l/k + r/k;
    ans += ceil((l%k+r%k)/(double)k);

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>

using namespace std;
 
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
long long gcd(long long a,long long b){
    if(a<b)return gcd(b,a);
    if(b==0)return a;
    return gcd(b,a%b);
}
long long lcm(long long a,long long b){
    return a/gcd(a,b)*b;
}
int main()
{
    int n,m,a[100100];
    cin>>n>>m;
    REP(i,n)
    {
        cin>>a[i];
        a[i]/=2;
    }

    long long ans=1;
    REP(i,n)
    {
        ans=lcm(ans,a[i]);
        if(ans>m)
        {
            cout<<0<<endl;
            return 0;
        }
    }
    REP(i,n)
    {
        if(ans/a[i]%2==0)
        {
            cout<<0<<endl;
            return 0;
        }
    }
    // cout<<ans<<endl;
    cout<<(m/ans+1)/2<<endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	int N,L;
	cin>>N>>L;
	vector<string > in(N);
	rep(i,N)cin>>in[i];
	sort(all(in));
	rep(i,N)cout<<in[i];
	cout<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);

    Queue<Character>[] queues = new Queue[3];
    for (int i = 0; i < 3; i++) {
      queues[i] = new LinkedList<>();
      for (char ch : scanner.next().toCharArray()) queues[i].add(ch);
    }

    int c = 0;
    while (true) {
      if (queues[c].isEmpty()) {
        System.out.println((char)('A' + c));
        return;
      }
      char ch = queues[c].remove();
      c = ch - 'a';
    }
  }
}


Measured memory_bytes: 23764
"""
8
4 23 75 0 23 96 50 100
"""

n = int(raw_input())
ais = map(int, raw_input().split(' '))

def f(ais):
	r = [0]
	for i in range(len(ais)):
		## looking for max
		if len(r) % 2:	
			if (ais[i-1] if i-1 >= 0 else 0) <= ais[i] > (ais[i+1] if i+1 < len(ais) else 0): 
				r.append(ais[i])
		else:
		## looking for min
			if (ais[i-1] if i-1 >= 0 else 0) >= ais[i] < (ais[i+1] if i+1 < len(ais) else 1000): 
				r.append(ais[i])

	t = 0
	for i in range(0,len(r),2):
		if i + 1 < len(r):
			u,v = r[i],r[i+1]
			t += v-u
	
	return t if len(ais) > 1 else ais[0]
print f(ais)

Measured memory_bytes: 85024
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String A=sc.next();
    String B = sc.next();
    if(A.compareTo(B)<0){
      System.out.println("<");
    }else if(A.compareTo(B)>0){
      System.out.println(">");
    }else{
      System.out.println("=");
    }
    
  }
  

  
}

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

using namespace std;


int main() {
    int n, a, b;
    string s;
    cin >> n >> a >> b >> s;
    int cur_a = 0, cur_b = 0;
    for(int i = 0; i < n; i++) {
        char c = s[i];
        if(c == 'a') {
            cur_a++;
        }
        else if(c == 'b') {
            cur_b++;
        }
        if(c == 'a') {
            int sum = cur_a + cur_b;
            if(sum <= a + b) {
                puts("Yes");
            } else {
                puts("No");
            }
        }
        else if(c == 'b') {
            int sum = cur_a + cur_b;
            if(sum <= a + b && cur_b <= b) {
                puts("Yes");
            } else {
                puts("No");
                cur_b--;
            }
        }
        else if(c == 'c') {
            puts("No");
        }
    }
    return 0;
}

Measured memory_bytes: 3736
from collections import deque
def bfs(G,s,N):
    dist=[-1]*N
    d=deque()
    dist[s]=0
    d.append(s)
    while(len(d)!=0):
        v=d[0]
        d.popleft()
        for nv in G[v]:
            if(dist[nv]!=-1):
                continue
            dist[nv]=dist[v]+1
            par[nv]=v
            d.append(nv)
    return dist
    
N,M=map(int,input().split())
G=[[] for i in range(N)]
for i in range(M):
    a,b=map(lambda x:int(x)-1,input().split())
    G[a].append(b)
    G[b].append(a)
par=[-1]*N
dist=bfs(G,0,N)
print('Yes')
for i in range(1,N):
    print(par[i]+1)

Measured memory_bytes: 34808
mask = (1<<64)-1
a = 0
def test(a,i):
    if a>>i & 1:
        print(1)
    else:
        print(0)
def _set(a,i):
    a = a | (1<<i)
    return a
def clear(a,i):
    a = a & ~(1<<i)
    return a
def flip(a,i):
    a = a ^ (1<<i)  
    return a
def _all(a):
    if a & mask == mask:
        print(1)
    else:
        print(0)
def _any(a):
    if a == 0:
        print(0)
    else:
        print(1)
def none(a):
    if a & mask == 0:
        print(1)
    else:
        print(0)
def count(a):
    print(bin(a).count('1'))
q = int(input())
for i in range(q):
    s, *t = map(int, input().split())
    if s == 0:test(a,t[0])
    if s == 1:a = _set(a,t[0])
    if s == 2:a = clear(a,t[0])
    if s == 3:a = flip(a,t[0])
    if s == 4:_all(a)
    if s == 5:_any(a)
    if s == 6:none(a)
    if s == 7:count(a)
    if s == 8:print(a)


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_h(const vector<T>& c, int n=INT_MAX)
{ rep(i, min(n, (int)c.size())) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define D1(a) cout<<#a<<":"<<a<<"\n"
#define D2(a,b) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<endl 
#define D3(a,b,c) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl 
#define MOD 1000000007

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

    int N; cin >> N;
    vector<int> a(N);
    unordered_map<int, int> m;
    rep(i, N) {
        cin >> a[i];
        m[a[i]]++;
    }
    bool f = false;
    if (N % 3) {
        if (m.size()==1 && a[0]==0)
            f = true;
    } else {
        switch(m.size()) {
        case 1:
            if (a[0]==0)
                f = true;
            break;
        case 2:
            if (m[0] == N/3)
                f = true;
            break;
        case 3:
            int x = 0;
            bool ok = true;
            for (auto it = m.begin(); it != m.end(); it++) {
                x ^= it->first;
                if (it->second != N/3) {
                    ok = false;
                    break;
                }
            }
            if (x == 0 && ok)
                f = true;
            break;
        }
    }

    cout << (f ? "Yes" : "No") << endl;
}


Measured memory_bytes: 4004
from math import floor, ceil

a, b, n = map(int, input().split())
# a, b, n = 10, 8, 10

num = min(b-1, n)
#n以下で最大のbの倍数
print(floor(a*num/b) - a*floor(num/b))



# ans = 0
# for i in range(1,100):
#     tmp = floor(a*i/b) - a*floor(i/b)
#     print("i", i, "tmp", tmp)
#     ans = max(ans, tmp)


# if a > b:
#     print(floor(a-a/b))
# elif a<b:
#     print(ceil(b/a))
# else:
#     print(a-1)

Measured memory_bytes: 9120
#include<bits/stdc++.h>
using namespace std;
#define int long long
constexpr int mu = 1e9;
signed main(){
    int a[200000],n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n);
    int lb = -(mu*mu) ,ub =mu*mu;
    while(ub - lb>1){
        int mid = (lb+ub)/2,cnt=0;
        for(int i=0;i<n;i++){
            if(a[i] < 0){
                cnt +=n- (lower_bound(a,a+n,(long double )mid/a[i])-a);
            }
            else if( a[i] >0){
                cnt += upper_bound(a,a+n,(long double)mid/a[i])-a;
            }
            else if( mid >= 0){
                cnt+=n;
            }
            if( a[i] * a[i] <= mid) cnt--;
        }
        (cnt>=2*k?ub:lb) = mid;
    }
    cout<<ub<<endl;
}


Measured memory_bytes: 1792
import sys

a = int(sys.stdin.readline())
b = int(sys.stdin.readline())
c = int(sys.stdin.readline())
d = int(sys.stdin.readline())
e = int(sys.stdin.readline())
k = int(sys.stdin.readline())

if e - a > k:
    print(":(")
else:
    print("Yay!")

Measured memory_bytes: 3060
#include<stdio.h>
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX],R[MAX];
int cnt;

void merge(int A[],int n,int left,int mid,int right){
  int n1,n2,i,k,j;
  n1=mid-left;
  n2=right-mid;
  for(i=0;i<n1;i++){
    L[i]=A[left+i];
  }
  for(i=0;i<n2;i++){
    R[i]=A[mid+i];
  }

  L[n1]=SENTINEL;
  R[n2]=SENTINEL;
  i=0;
  j=0;
  for(k=left;k<right;k++){
    cnt++;
    if(L[i]<=R[j]){
      A[k]=L[i++];
    }
    else{
      A[k]=R[j++];
    }
  }
}

void mergeSort(int A[],int n,int left,int right){
  int mid;
  if(left+1<right){
    mid=(left+right)/2;
    mergeSort(A,n,left,mid);
    mergeSort(A,n,mid,right);
    merge(A,n,left,mid,right);
  }
}
    

int main(){
  int A[MAX],n,i;
  cnt=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  mergeSort(A,n,0,n);

  for(i=0;i<n;i++){
    if(i>0){
      printf(" ");
    }
    printf("%d",A[i]);
  }
  printf("\n");
  printf("%d\n",cnt);

  return 0;
}
    
    
  



Measured memory_bytes: 5612
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] numberList = new int[n];
		for(int i = 0; i < n;i++) {
			numberList[i] = sc.nextInt();
		}
		Arrays.sort(numberList);
		for(int i =1; i < n; i++) {
			if(numberList[i] == numberList[i-1]) {
				System.out.println("NO");
				return;
			}
		}
		System.out.println("YES");
	}
}

Measured memory_bytes: 66148
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//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; }
  
/* attention
    long longのシフト演算には気をつけよう
    タイポした時のデバッグが死ぬほどきつくなるので変数名は最低3字くらい使った方がいいかも
    sizeは(int)とキャストしよう
    ごちゃごちゃ場合分けを考える前に全探索は考えましたか？
*/

int main(){
    ll N,K; cin >> N >> K;
    vector<ll> a(N);
    for(int i=0; i<N; i++) cin >> a[i];

    vector<ll> bitcnt(40, 0); // bitcnt[i] := a[0]~a[N-1]を全部見て、右からi桁目のビットが立っているものの数
    for(int i=0; i<N; i++){
        for(int j=0; j<40; j++) if(a[i]&(1LL<<j)) bitcnt[j]++;
    }

    ll ans = 0;
    for(int i=39; i>=-1; i--){
        if(i>=0 && (K&1LL<<i)==0) continue;
        
        ll tmp = 0;
        for(int bit=39; bit>i; bit--){
            if(K&1LL<<bit) tmp += (1LL<<bit)*(N-bitcnt[bit]);
            else tmp += (1LL<<bit)*bitcnt[bit];
        }

        if(i == -1){
            ans = max(ans, tmp);
            continue;
        }

        tmp += (1LL<<i)*bitcnt[i];
        for(int bit=i-1; bit>=0; bit--){
            tmp += (1LL<<bit)*max(bitcnt[bit], N-bitcnt[bit]);
        }
        ans = max(ans, tmp);
    }

    cout << ans << endl;
} 

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int temp = sc.nextInt();

        if(temp >= 30){
            System.out.println("Yes");
        } else{
            System.out.println("No");
        }

        sc.close();
    }
}

Measured memory_bytes: 35796
while True:
    s=str(input())
    if s=="END OF INPUT":
        break
    a,b=[],0
    for i in range(len(s)):
        if s[i]==" ":
            a.append(b)
            b=0
        else:
            b+=1
    a.append(b)
    print(*a,sep='')


Measured memory_bytes: 5560
N, K=map(int, input().split())
S=[0]*N

for i in range(K):
  d=int(input())
  a=list(map(int, input().split()))
  for j in range(d):
    S[a[j]-1]=1
print(len([i for i,x in enumerate(S) if x==0]))
         
  

Measured memory_bytes: 9124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }


int main() {
    ll n;
    cin >> n;
    vector<ll> cnt(330000, 0), cntcnt(330000, 0), ans(330000, 0);
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        cnt[a]++;
    }
    int kind = 0;
    for(int i = 1; i <= n; i++){
        cntcnt[cnt[i]]++;
        if(cnt[i] > 0) kind++;
    }
    int sum = 0;
    for(int i = 1; i <= n; ++i){
        kind -= cntcnt[i];
        sum += cntcnt[i]*i;
        ll maxk = (sum + kind*i)/i;
        ans[maxk] = i;
    }
    for(int i = n-1; i > 0; i--){
        ans[i] = max(ans[i+1], ans[i]);
    }
    for(int i = 1; i <= n; i++){
        cout << ans[i] << endl;
    }
}


Measured memory_bytes: 8704