akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.StringTokenizer;
  
class Main{
  
static final PrintWriter out=new PrintWriter(System.out);
static boolean[] hasParent;
static int root;
  
static class Node{
int id;
int p;
int rank;
int height;
int s;
int deg;
int l;
int r;
String type;
Node(int id){
this.id=id; this.p=-1; this.rank=-1; this.height=-1; this.s=-1; this.l=-1; this.r=-1; this.deg=0; this.type="internal node";
}
}

static void preorder(int now,Node[] ns){
if(now<0) return;
out.print(" "+now);
preorder(ns[now].l,ns);
preorder(ns[now].r,ns);
}

static void inorder(int now,Node[] ns){
if(now<0) return;
inorder(ns[now].l,ns);
out.print(" "+now);
inorder(ns[now].r,ns);
}

static void postorder(int now,Node[] ns){
if(now<0) return;
postorder(ns[now].l,ns);
postorder(ns[now].r,ns);
out.print(" "+now);
}

public static void main(String[] args) throws IOException{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int num=Integer.parseInt(br.readLine());
Node[] ns=new Node[num];
hasParent=new boolean[num];
StringTokenizer st;
for(int i=0;i<num;i++){
ns[i]=new Node(i);
}
for(int i=0;i<num;i++){
st=new StringTokenizer(br.readLine());
int id=Integer.parseInt(st.nextToken());
Node n=ns[id];
int l=Integer.parseInt(st.nextToken());
n.l=l;
int r=Integer.parseInt(st.nextToken());
n.r=r;
if(l==-1&&r==-1){
n.type="leaf";
n.height=0;
}
else if(l==-1){
ns[r].p=id;
n.deg=1;
hasParent[r]=true;
}
else if(r==-1){
ns[l].p=id;
n.deg=1;
hasParent[l]=true;
}
else{
ns[l].p=id;
ns[l].s=r;
hasParent[l]=true;
ns[r].p=id;
ns[r].s=l;
n.deg=2;
hasParent[r]=true;
}
}
for(int i=0;i<num;i++){
Node an=ns[i];
if(an.rank<0) an.rank=setRank(i,ns);
if(an.height<0) an.height=setHeight(i,ns);
}
out.println("Preorder");
preorder(root,ns);
out.println();
out.println("Inorder");
inorder(root,ns);
out.println();
out.println("Postorder");
postorder(root,ns);
out.println();
out.flush();
}
  
private static int setRank(int now,Node[] ns){
if(ns[now].rank>=0) return ns[now].rank;
if(!hasParent[now]){
ns[now].type="root";
root=now;
return ns[now].rank=0;
}
return ns[now].rank=setRank(ns[now].p,ns)+1;
}
 
private static int setHeight(int now,Node[] ns){
if(now<0) return Integer.MIN_VALUE/2;
if(ns[now].height>=0) return ns[now].height;
return ns[now].height=Math.max(setHeight(ns[now].l,ns),setHeight(ns[now].r,ns))+1;
}
}

Measured memory_bytes: 16908
using System;
using System.Collections.Generic;
using System.Linq;

public class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var A = vals[0];
        var B = vals[1];
        var C = vals[2];
        var K = int.Parse(Console.ReadLine());

        while (B <= A)
        {
            B *= 2;
            K--;
        }
        while (C <= B)
        {
            C *= 2;
            K--;
        }
        if (K >= 0)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }
    }
}

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

using namespace std;

int main() {
    string s;
    getline(cin, s);

    int digits[4];
    for (int i = 0; i < 4; i++)
    {
        digits[i] = ((int)s[i]) - ((int)'0');
    }

    bool YYMM = false, MMYY = false;
    int MMxx = digits[0] * 10 + digits[1], xxMM = digits[2] * 10 + digits[3];
    if (MMxx <= 12 && MMxx >= 1)
    {
        MMYY = true;
    }

    if (xxMM <= 12 && xxMM >= 1)
    {
        YYMM = true;
    }

    if (YYMM && MMYY)
    {
        cout << "AMBIGUOUS";
    } else if (YYMM && !MMYY)
    {
        cout << "YYMM";
    } else if (!YYMM & MMYY)
    {
        cout << "MMYY";
    } else {
        cout << "NA";
    }
}


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

void output(int d[],int n){
	int i;
	for(i=0;i<n;i++)
		printf("%d ",d[i]);
	printf("\n");
}

void swap(int d[],int p,int q){
	int tmp;
	tmp=d[p];d[p]=d[q];d[q]=tmp;
}
//[l,r)をソート
void sort(int d[],int n,int l,int r){
	int mid=(l+r)/2;
	if(mid-l>1)
		sort(d,n,l,mid);
	if(r-mid>1)
		sort(d,n,mid,r);
	int *work,i;
	i=0;
	work=(int*)malloc(sizeof(int)*(r-l));
	int lp=l;int rp=mid;
	while(lp<mid || rp<r){
		int tmpl=d[lp];int tmpr=d[rp];
		if(lp==mid)
			tmpl=1e8-1;
		if(rp==r)
			tmpr=1e8-1;
		if(tmpl<tmpr){
			work[i]=tmpl;
			lp++;
		}else{
			work[i]=tmpr;
			rp++;
		}
		i++;
	}
	for(i=0;i<r-l;i++)
		d[l+i]=work[i];
}

int main(){
	int i,N,*D;
	// FILE *fp;
	// fp=fopen("data.txt","r");
	// fscanf(fp,"%d",&N);
	// D=(int*)malloc(sizeof(int)*N);
	// for(i=0;i<N;i++)
	// 	fscanf(fp,"%d",&D[i]);
	// fclose(fp);
	N=3;
	D=(int*)malloc(sizeof(int)*N);
	for(i=0;i<N;i++)
		scanf("%d",&D[i]);
	sort(D,N,0,N);
	for(i=0;i<N;i++){
		printf("%d",D[i]);
		if(i<N-1)
			printf(" ");
	}
	printf("\n");
	free(D);
	return 0;
}


Measured memory_bytes: 2092
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define ppll pair<ll,pll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define eb emplace_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
// #define ll int
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
// const ll mod = 998244353;
const ll MAX = 2100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[8] ={1,0,-1,0,1,-1,1,-1};
ll dy[8] ={0,1,0,-1,1,-1,-1,1};
 
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 n,k;
ll a[5010];
bool dp[5010][5010];

bool ok(ll index){
    rep(i,5010)rep(j,5010) dp[i][j]=0;
    dp[0][0]=1;
    rep(i,n){
        rep(j,k+1){
            if(dp[i][j]==0) continue;
            dp[i+1][j]=dp[i][j];
            if(i==index) continue;
            if(j + a[i] > k) continue;
            dp[i+1][j+a[i]]=1;
        }
    }
    bool can=true;
    // cout<<index<<endl;
    // rep(i,k){
    //     cout<<dp[n][i]<<" ";
    // }
    // cout<<endl;

    rep2(i,max(0ll,k-a[index]),k){
        if(dp[n][i]) can = false;
    }
    return can;
}



void solve() {
    
    cin>>n>>k;
    rep(i,n) cin>>a[i];
    sort(a,a+n);
    ll left=0, right=n;
    while(left != right - 1){
        ll mid = (left+right)/2;
        if(ok(mid)) left = mid;
        else right = mid;
    }
    // cout<<left<<" "<<right<<endl;
    if(left==0){
        if(ok(0)) cout<<1<<endl;
        else cout<<0<<endl;
    }
    else cout<<left+1<<endl;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);


    solve(); 


    return 0;
}


Measured memory_bytes: 28204
#include <iostream>

using namespace std;

int main(void) {
  unsigned int a, b, c;
  cin >> a >> b >> c;
  if((a == b) || (a == c)) {
    if(b == c) {
      cout << "1\n";
    } else {
      cout << "2\n";
    }
  } else {
    if(b == c) {
      cout << "2\n";
    } else {
      cout << "3\n";
    }
  }
}

Measured memory_bytes: 256
#include <iostream>
#define ll long long


 using namespace std;
 const int N = 110;
 int main() {
      int p, a, b;
      cin >> p >> a >> b;
      if(abs(p-a) < abs(p-b)) printf("A\n");
     else printf("B\n");
     return 0;
 }

Measured memory_bytes: 3636
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int r = sc.nextInt();
    int g = sc.nextInt();
    int b = sc.nextInt();
    if((r*100+g*10+b)%4==0) System.out.println("YES");
    else System.out.println("NO");
  }
}

Measured memory_bytes: 23764
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

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

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define fi first
#define se second
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
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; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<Pl>;
using vvp = vector<vp>;

const int INF = 1<<29;
const long long LINF=1LL<<59;

ll po(ll x){
  if(x==1) return 300000;
  if(x==2) return 200000;
  if(x==3) return 100000;
  return 0LL;
}

void solve(long long X, long long Y){
  cout << po(X)+po(Y)+(X==1LL&&Y==1LL? 400000LL : 0LL) << endl;
}

int main(){
  std::cout << std::fixed << std::setprecision(15);
  long long X;
  scanf("%lld",&X);
  long long Y;
  scanf("%lld",&Y);
  solve(X, Y);
  return 0;
}


Measured memory_bytes: 256
object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val _ = sc.nextInt(); sc.nextLine()
    val S = sc.nextLine()
    val (l, r) = S.splitAt(S.length / 2)
    println(if (l == r) "Yes" else "No")
  }

}

Measured memory_bytes: 25416
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <random>
#include <chrono>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;


string S;
bool solve(){
    int C = 0;
    for(int i=0; i<S.size(); i++){
        if(i==0){
            if(S[i]!='A') return false;
        }
        else if(i>=2 && i<=S.size()-2 && S[i]=='C') C++;
        else if(i>=2 && i<=S.size()-2 && S[i]!='C' && S[i]<'a') return false;
        else if(S[i]<'a') return false;
    }
    if(C!=1) return false;
    return true;
}


int main() {
    cin >> S;
    if(solve()) cout << "AC" << endl;
    else cout << "WA" << endl;
    return 0;
}





Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	var s, t string
	fmt.Scan(&n, &s, &t)

	for i := 0; i <= n; i++ {
		if s[i:n] == t[0:n-i] {
			fmt.Println(n + i)
			return
		}
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////


int main(){fastio
    ll n;cin>>n;
    cout<<n*n*n;
    return 0;
}

/*

#define N 200005
ll n;
ll a[N];

ll ret[N][2];
void cal(){
    set<l_l>s;
    memset(ret,-1,sizeof(ret));
    rep(i,0,n-1){
        while(!s.empty()){
            l_l t=*s.begin();
            if(t.first<a[i]){
                ret[t.second][0]=i;
                s.erase(t);
            }
        }
        s.insert(l_l(a[i],i));
    }
    rep(i,0,n-1){
        
    }
}

int main(){fastio
    
    cin>>n;
    rep(i,0,n-1)cin>>a[i];
    ll dp[n][4];
    cal();
    rep(i,0,n-1)rep(j,0,1){
        dp[i][j]=ret[i][j];
    }
    reverse(a,a+n);
    cal();
    rep(i,0,n-1)rep(j,0,1){
        dp[i][j+2]=ret[i][j];
    }
    reverse(a,a+n);
    
    
    
    return 0;
}
 */













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

int main() {
int A, B, C;
cin >> A >> B >> C;
  
if ( A == B && A != C ) cout << "Yes" << endl;
else if ( B == C && A != B ) cout << "Yes" << endl;
else if ( A == C && A != B ) cout << "Yes" << endl;
else cout << "No" << endl;
    
}


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

typedef long long ll;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll LINF = 1e18;
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define MP make_pair
#define MT make_tuple
#define F first
#define S second
#define PB push_back
#define dump(x)  cout << #x << " = " << (x) << endl;	//debug
#define SZ(x) ((ll)(x).size())
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define RFOR(i, a, b) for (ll i = (a); i >= (b); i--)
#define ps(s) cout << #s << endl;
#define pv(v) cout << (v) << endl;
#define pvd(v) cout << setprecision(16) << (v) << endl;
#define ALL(a)  (a).begin(),(a).end()
#define RANGE(a, start_index, num)  (a).begin()+(start_index),(a).begin()+(num)

int main() {
	int n, k;
	cin >> n >> k;
	vector<int> p(n);
	FOR(i, 0, n - 1) {
		cin >> p[i];
	}
	sort(ALL(p));
	int sum = 0;
	FOR(i, 0, k-1) {
		sum += p[i];
	}
	pv(sum)
	return 0;
}

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

typedef long long ll;

int main() {
    ios_base::sync_with_stdio(false);

    int k, a, b;
    cin >> k >> a >> b;

    for(int i = a; i <= b; i++) {
        if(i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }

    cout << "NG" << endl;
}


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

using namespace std;

int main()
{
    vector<int> v(3);
    int dif=0;

    scanf("%d%d%d",&v[0],&v[1],&v[2]);

    sort(v.begin(),v.end());

    dif += v[2]-v[1];
    dif += v[2]-v[0];

    if(dif%2==0)
        printf("%d\n",dif/2);
    else
        printf("%d\n",dif/2+2);
                

    return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>
#include<iomanip>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;

const int NONE = 0;
const int LOSE = 1;
const int BACK = 2;

int N, L, T, B;
vector< vector<double> > dp;
vector<int> board;

int main(){
  cout << setiosflags(ios::fixed) << setprecision(8) << endl;
  while(cin >> N >> T >> L >> B && N > 0){

    board.assign(N+1, NONE);
    dp.assign(T+3, vector<double>(N+1, 0.0));

    int i;
    rep(nth, L){
      cin >> i;
      board[i] = LOSE;
    }

    rep(nth, B){
      cin >> i;
      board[i] = BACK;
    }

    dp[0][0] = 1.0;

    REP( turn, 0, T){
      REP( pos, 0, N){
        if( dp[turn][pos] == 0.0){ continue; }
        REP( i, 1, 7 ){
          int npos = pos + i;
          int nturn = turn + 1;
          if( npos > N ){ npos = N - (npos - N); }
          if (board[npos] == LOSE ) { nturn += 1; }
          if (board[npos] == BACK ) { npos = 0; }
          dp[nturn][npos] += dp[turn][pos] * (1.0/6.0);

        }

      }

    }

    double ans = 0;
    rep(i, T+1){
      ans += dp[i][N];
    }

    cout << ans << endl;

  }

  return 0;

}


Measured memory_bytes: 3316
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#include <cmath>
#include <map>
#define ll long long
#define out(a) printf("%d",a)
#define ln printf("\n")
const int N=2e5+50;
const int MOD=1e9+7;
const int inf=0x7f7f7f7f;
using namespace std;
int n,m,now;
int ans=0,ans2=0;
int a[N],b[N],cnt[N];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
	  scanf("%d",&a[i]),b[i]=a[i],cnt[a[i]]++;
	sort(a+1,a+n+1);
	if (cnt[a[n]]>1) ans2=a[n];
	else ans2=a[n-1];
	for (int i=1;i<=n;i++){
	  if (b[i]==a[n]) out(ans2);
	  else out(a[n]); ln;
	}
	return 0;
}

Measured memory_bytes: 3840
/*  -*- coding: utf-8 -*-
 *
 * b.cc: B: String Rotation
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100;

/* typedef */

typedef vector<int> vi;
typedef queue<int> qi;
typedef pair<int,int> pii;

/* global variables */

/* subroutines */

/* main */

int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();

  for (int d = 0; d < n; d++) {
    bool ok = true;
    for (int i = 0; ok && i < n; i++)
      ok = (s[i] == t[(i + d) % n]);
    if (ok) {
      puts("Yes");
      return 0;
    }
  }

  puts("No");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <tuple>
#include <stack>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define INF INT_MAX>>1 //要climits#includ

typedef long long ll;

using namespace std;

int main(void){
	int a, p; cin >> a >> p;
	cout << (a*3+p)/2 << endl;


	return 0;
}

Measured memory_bytes: 764
// I look at my watch
// it say nine twenty-five
// And I think oh God
// I'm still alive
 
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(x) int((x).size())
#define all(v) (v).begin(),(v).end()
#define trace(x) cerr << #x << " = " << x << endl
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define For(i,a,b) for(int i = int(a); i < int(b); ++i)
#define roF(i,a,b) for(int i = int(a); i >= int(b); i--)
using namespace std;
 
typedef long long ll;
typedef pair<int,int> ii;
typedef long double ld;




int main(){	
	int x,y,z;cin>>x>>y>>z;
	cout<<z<<" "<<x<<" "<<y<<endl;

	return 0;
}


Measured memory_bytes: 256
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define IINF 10e8
#define INF 10e16
#define MOD 1000000007
#define mod 1000000007
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define Endl endl
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0,1,1,-1,-1};
int dy[8]={0,-1,0,1,1,-1,1,-1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    ll n;
    cin>>n;
    vector<ll>use;
    use.pb(1);
    
    for(ll i=1;i<1000;i++){
        ll tmp=pow(6,i);
        if(tmp>n)break;
        use.pb(tmp);
    }
    for(ll i=1;i<1000;i++){
        ll tmp=pow(9,i);
        if(tmp>n)break;
        use.pb(tmp);
    }
    sort(all(use));
    reverse(all(use));
    ll cnt=0;
    ll nn=n;
    ll dp[100005];
    memset(dp,0,sizeof(dp));
    for(ll i=1;i<=n;i++){
        ll min=INF;
        for(ll j=0;j<siz(use);j++){
            if(i>=use[j]){
                chmin(min,mmin(dp[i-1]+1,dp[i-use[j]]+1));
            }
        }
        dp[i]=min;
    }
    cout<<dp[n]<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------




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

int main(void) {
	int N;
	const int pow[7] = { 0, 1, 10, 100, 1000, 10000, 100000 };
	cin >> N;

	int keta = 0;
	for (int i = 6; i >= 1; --i) {
		if (N / pow[i] > 0) {
			keta = i;
			break;
		}
	}

	int ans = 0;
	if (keta % 2 == 1) {
		ans = N - pow[keta] + 1;
		--keta;
	}
	--keta;
	for (int i = keta; i >= 1; i -= 2)
		ans += (pow[i + 1] - 1 - pow[i] + 1);

	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
template<class S,class T> ostream& operator << (ostream& out,const pair<S,T>& o){ out << "(" << o.first << "," << o.second << ")"; return out; }
template<class T> ostream& operator << (ostream& out,const vector<T> V){ for(int i = 0; i < V.size(); i++){ out << V[i]; if(i!=V.size()-1) out << " ";} return out; }
template<class T> ostream& operator << (ostream& out,const vector<vector<T> > Mat){ for(int i = 0; i < Mat.size(); i++) { if(i != 0) out << endl; out << Mat[i];} return out; }
template<class S,class T> ostream& operator << (ostream& out,const map<S,T> mp){ out << "{ "; for(auto it = mp.begin(); it != mp.end(); it++){ out << it->first << ":" << it->second; if(mp.size()-1 != distance(mp.begin(),it)) out << ", "; } out << " }"; return out; }

/*
 <url:>
 問題文============================================================
 =================================================================
 解説=============================================================
 ================================================================
 */

ll solve(){
    ll res = 0;
    ll N,K; cin >> N >> K;

    for(ll a = 1; a <= N;a++){
        if(2*a%K!=0)continue;
        ll cnt = (N+a)/K - a/K;
   //     cout << a << " " << cnt << endl;
//        if(a%K==0)cnt++;
        res += cnt*cnt;
    }

    return res;
}
int main(void) {
    cin.tie(0); ios_base::sync_with_stdio(false);
    cout << solve() << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
V = list(map(int, input().split()))

even_idx_cnt = {}
odd_idx_cnt = {}
for idx, v in enumerate(V):
    if idx % 2 == 0:
        if v not in even_idx_cnt:
            even_idx_cnt[v] = 0
        even_idx_cnt[v] += 1
    else:
        if v not in odd_idx_cnt:
            odd_idx_cnt[v] = 0
        odd_idx_cnt[v] += 1

if len(even_idx_cnt) == 1 and len(odd_idx_cnt) == 1:
    if even_idx_cnt.keys() == odd_idx_cnt.keys():
        print(N - even_idx_cnt[V[0]])
    else:
        print(0)
    exit()

even_idx_cnt = sorted(even_idx_cnt.items(), key=lambda  x:x[1], reverse=True)
odd_idx_cnt = sorted(odd_idx_cnt.items(), key=lambda  x:x[1], reverse=True)

if even_idx_cnt[0][0] != odd_idx_cnt[0][0]:
    print(N - even_idx_cnt[0][1] - odd_idx_cnt[0][1])
elif len(even_idx_cnt) == 1:
    print(N - even_idx_cnt[0][1] - odd_idx_cnt[1][1])
elif len(odd_idx_cnt) == 1:
    print(N - even_idx_cnt[1][1] - odd_idx_cnt[0][1])
else:
    if even_idx_cnt[1][1] > odd_idx_cnt[1][1]:
        print(N - even_idx_cnt[1][1] - odd_idx_cnt[0][1])
    else:
        print(N - even_idx_cnt[0][1] - odd_idx_cnt[1][1])


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

using namespace std;

int main(void)
{
  int k;
  string s;

  cin>>k;
  cin>>s;

  if(s.size()<=k)
  {
    cout<<s<<endl;
    return 0;
  }
  else
  {
    for(int i=0;i<k;i++)
    {
      cout<<s[i];
    }
    cout<<"..."<<endl;
  }
  
  return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int n,m=0;
  int a[500000],b[500000]={};
  cin>>n;
  for(int i=0;i<n;i++) cin>>a[i];
  for(int i=n-1;i>=0;i--){
    int q=i+1,sum=0,j=1;
    //cout<<i<<" ";
    while(true){
      if(q>n) break;
      //cout<<q<<" ";
      q=(i+1)*j;
      sum+=b[q-1];
      j++;
    }
    //cout<<sum<<"\n";
    if(sum%2!=a[i]) b[i]=1,m++;
  }
  cout<<m<<"\n";
  for(int i=0;i<n;i++){
    if(b[i]==1){
      cout<<i+1;
      if(i!=n-1) cout<<" ";
    }
  }
  cout<<"\n";
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = (int)(n)-1; i >=0; i--)

using ll = long long;

int main(){
  ll N,K; cin>>N>>K;
  ll R,S,P; cin>>R>>S>>P;
  string T; cin>>T;
  map<char,ll> m;
  m['r']=P;
  m['s']=R;
  m['p']=S;
  ll res = 0;
  rep(i,K){
    ll cont = 1;
    for(ll j = 0; i+j*K<N; j++){
      if(j==0)res+=m[T.at(i+j*K)];
      else if(T.at(i+j*K)==T.at(i+(j-1)*K)){
        cont++;
        if(cont%2!=0)res+=m[T.at(i+j*K)];
      }else{
         res+=m[T.at(i+j*K)];
         cont = 1;
       }
    }
  }
  cout<<res<<endl;
}

Measured memory_bytes: 512
import java.util.Scanner;

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

        String ans = "Yay!";

        if (A > 8 || B > 8) {
            ans = ":(";
        }

        System.out.println("" + ans);
    }
}

Measured memory_bytes: 23252
object Main extends App {
  val sc = new java.util.Scanner(System.in) 
  sc.useDelimiter("\n")
  val n = sc.nextInt()
  val d = sc.next().split(" ").map(_.toInt).toList
  val ans = d.zip(1 to n).sortBy(_._1).map(_._2)
  println(ans.mkString(" "))
}

Measured memory_bytes: 81160
#include <stdio.h>
int main() {
	char n[5];
	int cnt = 0;
	scanf("%s", n);
	for (int i = 0; i < 4; i++) {
		if (n[i] == '2') {
			cnt++;
		}
	}
	printf("%d\n", cnt);
	return 0;
}

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

int n;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n;
	for(int i=0; i<n; ++i){
		string s, t;
		cin >> t >> s;
		for(int j=t.size()-1; j>=0; --j){
			if(t[j] == 'J'){
				s = s.substr(s.size()-1, 1) + s.substr(0, s.size()-1);
			}else if(t[j] == 'C'){
				s = s.substr(1, s.size()-1) + s.substr(0, 1);
			}else if(t[j] == 'E'){
				if(s.size() % 2 == 0){
					s = s.substr(s.size()/2, s.size()/2) + s.substr(0, s.size()/2);
				}else{
					s = s.substr(s.size()/2+1, s.size()/2) + s[s.size()/2] + s.substr(0, s.size()/2);
				}
			}else if(t[j] == 'A'){
				reverse(s.begin(), s.end());
			}else if(t[j] == 'P'){
				for(int k=0; k<s.size(); ++k){
					if('1' <= s[k] && s[k] <= '9')
						--s[k];
					else if(s[k] == '0')
						s[k] = '9';
				}
			}else{
				for(int k=0; k<s.size(); ++k){
					if('0' <= s[k] && s[k] <= '8')
						++s[k];
					else if(s[k] == '9')
						s[k] = '0';
				}
			}
		}
		cout << s << "\n";
	}
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef pair<int, int> p;

int main(){
  int h, w;
  cin >> h >> w;
  int n;
  cin >> n;
  vector<int> v(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }

  int use = 1;
  int count = 0;
  int index = 0;
  vector<vector<int>> vv(h,vector<int>(w, 0));
  for (int i = 0; i < h; i++) {
    if(i % 2 == 0){
      for (int j = 0; j < w; j++) {
        if(count >= v[index]){
          index++;
          count = 0;
          use++;
        }
        vv[i][j] = use;
        count++;
      }
    }else{
      for (int j = w-1; j >= 0; j--) {
        if(count >= v[index]){
          index++;
          count = 0;
          use++;
        }
        vv[i][j] = use;
        count++;
      }
    }
  }

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if(j != w-1) cout << vv[i][j] << " ";
      else cout << vv[i][j];
    }
    cout << endl;
  }


}


Measured memory_bytes: 384
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<bitset>
#include<stack>
#include<memory>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=1000000007;
const llint big=2.19e18+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-15;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}
int main(void){
	int i,n,K,mk=0;cin>>n>>K;
	vector<int>snuke;
	vector<int>box(n+1);
	for(i=0;i<n;i++){cin>>box[i];}
	box[n]=mod;
	int mae=n;
	bool dme=0;
	while(-1){
		//少ない箱を最後に持ってくる作戦
		int sku=n;
		for(i=0;i<n;i++){
			if(i!=mae&&box[sku]>box[i]){sku=i;}
		}
		for(i=0;i<n;i++){
			if(i!=mae&&i!=sku){
				if(box[i]==0){dme=1;break;}
				box[i]--;snuke.pub(i+1);
			}
		}
		if(dme){break;}
		if(box[sku]==0){break;}
		box[sku]--;snuke.pub(sku+1);mk++;
		mae=sku;
	}
	if(mk<=K){cout<<"-1"<<endl;return 0;}
	cout<<snuke.size()<<endl;
	for(auto it:snuke){cout<<it<<" ";}cout<<endl;
}

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

using int64 = long long;

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

    string S;
    cin >> S;

    map<pair<string, string>, int64> counter;

    for (int mask = 0; mask < (1 << N); mask++) {
        string R = "", B = "";
        for (int i = 0; i < N; i++) {
            if ((mask >> i) & 1) R.push_back(S[i]);
            else B.push_back(S[i]);
        }
        reverse(B.begin(), B.end());
        counter[make_pair(R, B)]++;
    }

    /*
    for (auto mapping : counter) {
        cout << mapping.first.first << " " << mapping.first.second << endl;
    }
    */

    int64 ans = 0;
    for (int mask = 0; mask < (1 << N); mask++) {
        string R = "", B = "";
        for (int i = 0; i < N; i++) {
            if ((mask >> i) & 1) R.push_back(S[N + i]);
            else B.push_back(S[N + i]);
        }
        reverse(B.begin(), B.end());
        ans += counter[make_pair(B, R)];
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 87040
#include<iostream>
#include<cstdio>
#include<cstring>
#define REP(i,e,s) for(register int i=e; i<=s; i++)
#define DREP(i,e,s) for(register int i=e; i>=s; i--)
#define DE(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG(a) DE("DEBUG: %d\n",a)
#define file(a)	freopen(a".in","r",stdin);freopen(a".out","w",stdout)
using namespace std;

int read() {
	int x=0,f=1,ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int MAXM=1e4+10;

int a[MAXM];

int main() {
	int n=read(),m=read(),sum=0;
	REP(i,1,m) a[i]=read(),sum+=a[i];
	if(sum>n) puts("-1");
	else printf("%d\n",n-sum);
	return 0;
}



Measured memory_bytes: 3696
import java.util.*;
class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int d;
        d = sc.nextInt();
        if(d==25)System.out.println("Christmas");
        if(d==24)System.out.println("Christmas Eve");
        if(d==23)System.out.println("Christmas Eve Eve");
        if(d==22)System.out.println("Christmas Eve Eve Eve");
    }
}


Measured memory_bytes: 20684
x,n=map(int,input().split())
if n!=0:
  p=list(map(int,input().split()))
  p2=list(map(lambda s:s-x,p))
a=0
i=0
if n==0:
  print(x)
else:
  while a==0:
    if i in p2:
      if i==0:
        i=-1
      elif i>0:
        i=-1*(i+1)
      else:
        i=-1*i
    else:
      print(x+i)
      a=1
      break


Measured memory_bytes: 9176
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define max(x,y)(x>y?x:y)
#define min(x,y)(x>y?y:x)
typedef long long int ll;
typedef unsigned long long int ull;
int asc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return -1;else if(x==y)return 0;else return 1;}
int desc_cmp(const void* X,const void* Y){int x=*(int*)X,y=*(int*)Y;if(x<y)return 1;else if(x==y)return 0;else return -1;}
int main(){
    ull n,m;scanf("%llu %llu",&n,&m);
    if(n==1&&m==1)printf("1\n");
    else if(n==1||m==1)printf("%llu\n",n*m-2);
    else printf("%llu\n",n*m-((n-2)*2+m*2));
    return 0;

}

Measured memory_bytes: 128
#include "bits/stdc++.h"
#define ll long long
#define mk make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
using namespace std;
const int MAXN=1e5+9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	ll a[n+1];
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	map<ll,ll> mp;
	ll fans=0;
	for(int i=1;i<=n;i++)
	{
		if(i>1)
		{
			if(mp.find(i-a[i])!=mp.end())
			{
				fans+=mp[i-a[i]];
			}
		}
		mp[a[i]+i]++;
	}
	cout<<fans<<endl;
	return 0;
}

Measured memory_bytes: 17616
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<utility>
using namespace std;
int main()
{
    int h,w;
    cin>>h>>w;

    int maze[w+2][h+2];
    for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            maze[j][i]=0;
        }
    }//初期化
    int sx,sy;//スタートの座標
    int gx,gy;//ゴールの座標
    sx=1;
    sy=1;
    gx=w;
    gy=h;
    int d[w+2][h+2];//最短距離list
    for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            d[j][i]=0;
        }
    }//初期化
    string s;
    int black=0;//黒マスの総数
    for(int i=1;i<=h;i++){
        cin>>s;
        for(int j=1;j<=w;j++){
            if(s[j-1]=='.'){
                maze[j][i]=1;
            }
            else{
                black++;
            }
        }
    }
    //check
    /*for(int i=0;i<h+2;i++){
        for(int j=0;j<w+2;j++){
            cout<<maze[j][i];
        }
        cout<<endl;
    }*/

    //最短距離の計算
    queue<pair<int,int> > q;
    pair<int,int> p;
    pair<int,int>p_nx;
    p.first=sx;p.second=sy;
    q.push(p);
    d[sx][sy]=0;
    maze[sx][sy]=0;
    while(!q.empty()){
        p=q.front();
        q.pop();
        if(p.first==gx&&p.second==gy){break;}
        //上
        p_nx.first=p.first;
        p_nx.second=p.second-1;
        if(maze[p_nx.first][p_nx.second]==1){
            q.push(p_nx);
            d[p_nx.first][p_nx.second]=d[p.first][p.second]+1;
            maze[p_nx.first][p_nx.second]=0;
        }
        //下
        p_nx.first=p.first;
        p_nx.second=p.second+1;
        if(maze[p_nx.first][p_nx.second]==1){
            q.push(p_nx);
            d[p_nx.first][p_nx.second]=d[p.first][p.second]+1;
            maze[p_nx.first][p_nx.second]=0;
        }
        //左
        p_nx.first=p.first-1;
        p_nx.second=p.second;
        if(maze[p_nx.first][p_nx.second]==1){
            q.push(p_nx);
            d[p_nx.first][p_nx.second]=d[p.first][p.second]+1;
            maze[p_nx.first][p_nx.second]=0;
        }
        //右
        p_nx.first=p.first+1;
        p_nx.second=p.second;
        if(maze[p_nx.first][p_nx.second]==1){
            q.push(p_nx);
            d[p_nx.first][p_nx.second]=d[p.first][p.second]+1;
            maze[p_nx.first][p_nx.second]=0;
        }
    }
    if(d[gx][gy]==0){cout<<-1<<endl;}
    else{cout<<h*w-black-d[gx][gy]-1<<endl;}
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
#include <fstream>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define FILL(Itr,n) fill((Itr).begin(),(Itr).end(),n)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

ll cntD(ll n){
    ll ret = 0;
    while(n!=0){
        ret++;
        n/=10;
    }
    return ret;
}

int main(){
    
    ll N; cin>>N;
    set<ll> yakusu;
    for(ll i=1;i*i<=N;i++){
        if(N%i==0){
            yakusu.insert(i);
            yakusu.insert(N/i);
        }
    }
    
    ll ans = 1e18;
    for(auto itr=yakusu.begin();itr!=yakusu.end();itr++){
        ans = min(ans,cntD(max(*itr,N/(*itr))));
    }
    
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 384
n = float(input())

chk1 = 0
chk2 = 0
max_len = 100000000000

for i in range(1,int(n**0.5)+1):
    #n=i*chk
    chk = n/i
    if chk.is_integer():
        i_len = len(str(i))
        chk_len = len(str(int(chk)))
        if max(i_len,chk_len) < max_len:
            #print(i,chk,":",i_len,chk_len)
            max_len = max(i_len,chk_len)

print(max_len)

Measured memory_bytes: 3064
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        char[] s = new char[200000];
        int N = in.read(s, 0, s.length);
        long ans = 0;
        long a = 0;
        long b = 0;
        int i = 0;
        while (i < N) {
            while (i < N && s[i] != 'A') {
                a = 0;
                i++;
            }
            while (i < N && s[i] == 'A') {
                i++;
                a++;
            }
            b = 0;
            while (i < N - 1 && s[i] == 'B' && s[i + 1] == 'C') {
                i += 2;
                b++;
            }
            ans += a * b;
        }
        out.println(ans);
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    void back() {
        head--;
    }

    boolean minus() {
        boolean minus;
        while (true) {
            char c = next();
            if (!isDelimiter(c)) {
                if (!(minus = c == '-')) back();
                return minus;
            }
        }
    }

    void skip() {
        while (isDelimiter(next()));
        back();
    }

    char[] s(int N) {
        char[] cbuf = new char[N];
        read(cbuf, 0, N);
        return cbuf;
    }

    public int read(char[] cbuf, int off, int len) {
        skip();
        int i;
        for (i = 0; i < cbuf.length; i++) {
            char c = next();
            if (isDelimiter(c)) {
                break;
            }
            cbuf[i] = c;
        }
        return i;
    }

    boolean isDelimiter(char c) {
        return c == ' ' || c == '\n' || c == '\r';
    }

    int i() {
        boolean minus = minus();
        int n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        boolean minus = minus();
        long n = 0;
        while (true) {
            int k = next() - '0';
            if (k < 0 || 9 < k) break;
            n = 10 * n + k;
        }
        return minus ? -n : n;
    }
}


Measured memory_bytes: 35780
program kadai
implicit none
integer  ::  n
character(len=10),allocatable  ::  s(:)
character(len=10)  ::  hako
character(len=1)  ::  word(10)
integer  ::  i,j,k
integer(8)  ::  num
integer(8)  ::  ans

read(*,*) n

allocate(s(n))

do i=1,n
    read(*,*) s(i)
end do

do i=1,n
    hako=s(i)
    do j=1,10
        word(j)=hako(j:j)
    end do
    call qsort(word)
    do j=1,10
        hako(j:j)=word(j)
    end do
    s(i)=hako
end do


num=0
call qsort(s)

!do i=1,n
!   write(*,*) s(i)
!end do

i=1
num=0
ans=0
do while (i<n+1)
    j=i+1
    do while (j<n+1)
        if (s(i)==s(j)) then
            num=num+1
            j=j+1
        else
            exit
        end if
    end do
    ans=ans+(num+1)*(num)/2
    i=j
    num=0
end do

write(*,*) ans





stop
contains

subroutine swap(a,b)
implicit none
character(len=*),intent(inout)  ::  a,b
character(len=10)  ::  c
c=a
a=b
b=c
end subroutine swap

subroutine qsort(x)
implicit none
character(len=*), intent(inout)  ::  x(:)
integer  ::  first,last
first=1
last=size(x)
call q2sort(x,first,last)
return
end subroutine qsort

recursive subroutine q2sort(x,first,last)
implicit none
character(len=*), intent(inout)  ::  x(:)
integer, intent(inout) ::  first,last
integer  ::  fir, las
integer  ::  i,j
character(len=10)  ::  n
n=x((first+last)/2)
i=first
j=last
do
do while (x(i)<n)
i=i+1
end do
do while(x(j)>n)
j=j-1
end do
if (i>j .or. i==j) then
exit
end if
call swap(x(i),x(j))
i=i+1
j=j-1
end do
if (first<i-1) then
las=i-1
call q2sort(x,first,las)
end if
if (last>j+1) then
fir=j+1
call q2sort(x,fir,last)
end if
end subroutine q2sort


end program kadai


Measured memory_bytes: 1152
#include<stdio.h>

void Read(int n,int del[])
{
    int i;
    for(i=0;i<=n-1;i++)
    {
        scanf("%d",&del[i]);
    }
}

long Summ(int n,int del[])
{
    long sum=0,p;
    int i,j;
    for(i=0;i<=n-2;i++)
    {
        for(j=i+1;j<=n-1;j++)
        {
            p=del[i]*del[j];
            sum=sum+p;
        }
    }
    return sum;
}



int main()
{
    int n;
    long sum=0;
    scanf("%d",&n);
    int del[n];
    Read(n,del);
    sum=Summ(n,del);
    printf("%ld",sum);
}



Measured memory_bytes: 128
# Template 1.0
import sys, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

a,b = MAP()
if(b==1):
    ans = 0
else:
    
    if(a>=b):
        ans = 1
    else:
        left = b - a
        ans = ceil(left/(a-1)) + 1
print(ans)

Measured memory_bytes: 70756
import itertools
N, M, Q = map(int, input().split())
a = [None for _ in range(Q)]
b = [None for _ in range(Q)]
c = [None for _ in range(Q)]
d = [None for _ in range(Q)]
for i in range(Q):
    a[i], b[i], c[i], d[i] = map(int, input().split())

ans = 0
elements = list(range(1, M+1))
for combination in itertools.combinations_with_replacement(elements, N):
    score = 0
    for i in range(Q):
        if combination[b[i]-1] - combination[a[i]-1] == c[i]:
            score += d[i]
    ans = max(score, ans)
print(ans)


Measured memory_bytes: 9232
N = int(input())
S = [input() for _ in range(N)]

dic = {}
for i in range(len(S[0])):
    if S[0][i] in dic:
        dic[S[0][i]] += 1
    else:
        dic[S[0][i]] = 1
for i in range(1, N):
    temp = {}
    for j in range(len(S[i])):
        if S[i][j] in temp:
            temp[S[i][j]] += 1
        else:
            temp[S[i][j]] = 1
    L = []
    for key in dic:
        if key in temp:
            dic[key] = min(dic[key], temp[key])
        else:
            L.append(key)
    for l in L:
        dic.pop(l)
            

L = []
for key in dic:
    L.append(key)
L.sort()
ans = ""
for l in L:
    ans += l*dic[l]
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		while(scan.hasNext()){
			String[] team = new String[n];
			int[] score = new int[n];
			for(int i = 0;i < n;i++){
				team[i] = scan.next();
				score[i] = 3*scan.nextInt() + 0*scan.nextInt() + scan.nextInt();
			}
			for(int i = 0;i < n;i++){
				for(int j = n-1;j > i;j--){
					if(score[j] > score[j-1]){
						swap(team,score,j,j-1);
					}
				}
			}
			PrintOut(team,score,n);
			n = scan.nextInt();
			if(n == 0){
				break;
			}else{
				System.out.println();
			}
		}
	}
	
	public static void swap(String[] str,int[] num,int i,int j){
		String temp = str[i];
		str[i] = str[j];
		str[j] = temp;
		int tempp = num[i];
		num[i] = num[j];
		num[j] = tempp;
	}
	
	public static void PrintOut(String[] str,int[] num,int n){
		for(int i = 0;i < n;i++){
			System.out.println(str[i]+","+num[i]);
		}
	}
}

Measured memory_bytes: 20560