akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <unordered_map>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<vector<int>> v(n + 1, vector<int>(3));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> v[i + 1][j];
		}
	}
	for (int j = 0; j < 3; j++) {
		v[0][j] = 0;
	}
	bool f{ true };
	for (int i = 0; i < n; i++) {
		int t_dif = v[i + 1][0] - v[i][0];
		int dist = (v[i + 1][1] - v[i][1]) + (v[i + 1][2] - v[i][2]);
		if (t_dif < dist || (t_dif - dist) % 2 == 1) {
			f = false;
			break;
		}
	}
	if (f) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 5760
#include<deque>
#include<list>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<cmath>
#include<cstdio>
#include<cstring>
using namespace std;
bool operator>(const pair<string,int>& p,const pair<string,int>& q){
  if(0){
  }else if(p.second>q.second){
    return 1;
  }else if(p.second==q.second){
    if(p.first>q.first)
      return 1;
  }
  return 0;
}
int a[10],b[10][10],n;
string s[10];
pair<string,int> c[10][1<<10];
pair<string,int> fi(int p,int q){
  int i;
  if(c[p][q].second)
    return c[p][q];
  c[p][q].second=1<<30;
  for(i=0;i<n;++i){
    if(q&(1<<i))
      continue;
    pair<string,int> t=fi(i,q|(1<<i));
    t.first=s[p].substr(0,a[p]-b[p][i])+t.first;
    t.second+=a[p]-b[p][i];
    if(c[p][q]>t)
      c[p][q]=t;
  }
  return c[p][q];
}
int main(){
  int i,j,k,l;
  while(cin>>n,n){
    for(i=0;i<n;++i)
      cin>>s[i];
    for(i=0;i<n-1;++i){
      for(j=i+1;j<n;++j){
	if(0){
	}else if(s[i].find(s[j])!=string::npos){
	  copy(&s[j+1],&s[n],&s[j]);
	  --j;
	  --n;
	}else if(s[j].find(s[i])!=string::npos){
	  copy(&s[i+1],&s[n],&s[i]);
	  --i;
	  --n;
	  break;
	}
      }
    }
    for(i=0;i<n;++i)
      a[i]=s[i].length();
    for(i=0;i<n;++i){
      for(j=0;j<n;++j){
	if(i==j)
	  continue;
	for(k=max(1,a[i]-a[j]+1);k<a[i];++k){
	  for(l=k;l<a[i];++l){
	    if(s[i][l]!=s[j][l-k])
	      break;
	  }
	  if(l==a[i])
	    break;
	}
	b[i][j]=a[i]-k;
      }
    }
    fill(c[0],c[0]+10*(1<<10),make_pair("",0));
    for(i=0;i<n;++i)
      c[i][~(-1<<n)]=make_pair(s[i],a[i]);
    pair<string,int> mn=make_pair("",1<<30);
    for(i=0;i<n;++i){
      pair<string,int> t=fi(i,1<<i);
      if(mn>t)
	mn=t;
    }
    cout<<mn.first<<endl;
  }
  return 0;
}

Measured memory_bytes: 1284
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, k;
    cin >> n >> k;
    int mx = (n-1) * (n-2) / 2;
    if (k > mx) {
        cout << -1 << endl;
        return 0;
    }
    vp ans;
    int cnt = 0;
    for (int i = 1; i <= n; ++i) {
        bool flag = false;
        for (int j = i+1; j <= n; ++j) {
            if (i != 1 && cnt == mx - k) {
                flag = true;
                break;
            }
            ans.eb(i, j);
            if (i != 1) cnt++;
        }
        if (flag) break;
    }
    cout << sz(ans) << endl;
    rep(i, sz(ans)) cout << ans[i].fi << " " << ans[i].se << endl;
}

Measured memory_bytes: 384
x1, y1, x2, y2 = map(int, input().split())

dx12 = x2 - x1
dy12 = y2 - y1
dx23 = -dy12
dy23 = dx12
dx34 = -dy23
dy34 = dx23

x3 = x2 + dx23
y3 = y2 + dy23
x4 = x3 + dx34
y4 = y3 + dy34

print('{} {} {} {}'.format(x3, y3, x4, y4))


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

#define for_(i,a,b) for(int i=a;i<b;++i)
#define ALL(a) a.begin(),a.end()
using lint = long long int;

int main() {
    double L;
    cin >> L;
    double X = L / 3;
    printf("%.9lf\n", X*X*X);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
constexpr int DEBUG = 0;
using ll = long long;
using namespace std;

struct S {
    int x;
    int y;
    S(int _x, int _y) {
        x = _x;
        y = _y;
    }
};
bool comp(const S &a, const S &b) {
    if (a.x != b.x)
        return a.x < b.x;
    return a.y < b.y;
}

int n, m;
vector<S> e;
vector<int> zz;
vector<int> a;
void dfs(vector<int> v) {
    vector<int> d;
    for (int r : v) {
        if (DEBUG >= 1)
            cout << "r : " << r+1 << endl;
        auto it = lower_bound(zz.begin(), zz.end(), r);
        int id = it - zz.begin();
        for (int i = id; e[i].x == r; i++) {
            if (DEBUG >= 1)
                cout << e[i].x+1 << " -- " << e[i].y+1;
            if (a[e[i].y] == -1) {
                a[e[i].y] = r;
                d.push_back(e[i].y);
                if (DEBUG >= 1)
                    cout << " *";
            }
            if (DEBUG >= 1)
                cout << endl;
        }
    }
    if (d.size() > 0)
        dfs(d);
}

int main() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        int ai, bi;
        cin >> ai >> bi;
        e.push_back(S(min(ai-1, bi-1), max(ai-1, bi-1)));
        e.push_back(S(max(ai-1, bi-1), min(ai-1, bi-1)));
        zz.push_back(ai-1);
        zz.push_back(bi-1);
    }
    sort(e.begin(), e.end(), comp);
    sort(zz.begin(), zz.end());
    
    for (int i = 0; i < n; i++)
        a.push_back(-1);
    a[0] = 1;
    vector<int> v(1, 0);
    dfs(v);
    cout << "Yes" << endl;
    for (int i = 1; i < n; i++)
        cout << a[i]+1 << endl;
    
    return 0;
}


Measured memory_bytes: 26396
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <map>
#include <iomanip>
using namespace std;


int mathC(int a,int b){

  int i,ans=1;
  if(b>a/2) b=a-b;
  for(i=1;i<=b;i++){
    ans*=(a-i+1);
    ans/=i;
  }
  
  return ans;
}

void solve(void){

string S;
  cin >>S;
  
  if(S[2]==S[3]&&S[4]==S[5]) cout << "Yes" <<endl;
  else cout << "No" <<endl;
  
  return;
  
return;
}

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

Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    cnt = 0
    if n == 0 and x == 0: break
    for i in range(1, n + 1):
        for j in range(i + 1, n + 1):
            for k in range(j + 1, n + 1):
                if i + j + k == x:
                    cnt += 1
    print(cnt)


Measured memory_bytes: 5592
#include <iostream>

using namespace std;

void print(int H, int W) {
    for (int i = 0; i < H; ++i) {
        for (int j = 0; j < W; ++j) {
           if (!(i & 1)) {
           	   if (!(j & 1))
                   cout << '#';
               else
                   cout << ".";
            }
            else {
            	if (!(j & 1)) 
            		cout << ".";
            	else
            		cout << "#";
            }
        }
        cout << endl;
    }
}

int main() {
    int H, W;
    while (cin >> H >> W) {
        if (H == 0 && W == 0) {
            break;
        }
        print(H, W);
        cout << endl;
    }
    return 0;
}


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

#if __has_include(<local.h>)
#include <local.h>
#endif

using namespace std;

typedef long long int LL;
typedef long long int LLint;

//Faster Program
#define endl "\n"

//Faster Coding
#define ED return
#define GET(a) int a;cin >> a
#define DGET(a) double a;cin >> a
#define SGET(a) string a;cin >> a
#define CGET(a) char a;cin >> a
#define PRINT(a) cout << a << "\n"
#define ANS(a,b) int a;cin >> a;cout << b << "\n"
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define SORT(vec) sort(vec.begin(),vec.end())
#define REV(vec) reverse(vec.begin(),vec.end())
#define ALL(x) (x).begin(),(x).end()

//As Function
#define UP(a,b) ((a+(b-1))/b)
#define IPOW(x,y) LL(pow(x,y))

//Debug
#ifdef LOCAL_H
#define TEST cout << "OK\n"
#define DEBUG(a) a
#else
#define TEST
#define DEBUG(a)
#endif

#ifdef LOCAL_H
[[maybe_unused]]
#endif
const double PI = M_PI;
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const int INF = int(999999999);
#ifdef LOCAL_H
[[maybe_unused]]
#endif
const long long MOD = int(1000000007);

//Settings
#ifdef LOCAL_H
const bool DO_BENCHMARK = true;
#endif
const int DOUBLE_ACCURACY = 30;

#ifndef LOCAL_H
const bool DO_BENCHMARK = false;
#endif

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(DOUBLE_ACCURACY);
    void solve();
    if(DO_BENCHMARK){
        clock_t clock_start = clock();
        solve();
        clock_t clock_end = clock();
        const double time = static_cast<double>(clock_end-clock_start)/CLOCKS_PER_SEC*1000.0;
        cout << "\n" << time << "[ms]\n";
    }
    else solve();
}

/************************************************************************************************************************************************/
void solve(){
    int A, B, H, M;
    cin >> A >> B >> H >> M;
    double hour_deg = H*30.0+(M/2.0);
    double min_deg = M*6.0;

    double dig_dist = min(abs(hour_deg-min_deg),360.0-abs(hour_deg-min_deg));
    dig_dist /= 180.0;
    cout << sqrt(A*A + B*B - 2.0*A*B*cos(PI*dig_dist)) << endl;
}



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

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

#define fill(a,x) memset(a,x,sizeof(a)) 
#define pb push_back
#define sz(x) (int)x.size() 
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
const ll INF = 1e18;
const ll mod = 1e9+7;
const int N = 1e5+10; 

int arr[N];

int main(){
  fast;
  int n;
  cin>>n;
  FOR(i,1,n)
  cin>>arr[i];

  int cur=1;
  int swaps=0;
  while(cur<=n)
  {
  	if(arr[cur]==cur)
  	{
  		swaps++;
  		cur+=2;
  	}
  	else
  	cur++;
  }

  cout<<swaps<<endl;
  return 0;
}

Measured memory_bytes: 640
#include<string.h>
#include<iostream>
int main()
{
	struct data
	{
		char s[201];
		int m;
		int*h;
	} dat[10];
	int num;
	for(int i = 0;; i++)
	{
		std::cin >> dat[i].s;
		if(dat[i].s[0] == '-')
		{
			num = i;
			break;
		}
		std::cin >> dat[i].m;
		dat[i].h = new int[dat[i].m];
		for(int j = 0; j < dat[i].m; j++)
		{
			std::cin >> dat[i].h[j];
		}
	}
	for(int i = 0; i < num; i++)
	{
		int length;
		for(int j = 0;; j++)
		{
			if(dat[i].s[j] == '\0')
			{
				length = j;
				break;
			}
		}
		int sum_h = 0;
		for(int j = 0; j < dat[i].m; j++)
		{
			sum_h += dat[i].h[j];
		}
		sum_h %= length;
		for(int j = sum_h; j < length; j++)
		{
			std::cout << dat[i].s[j];
		}
		for(int j = 0; j < sum_h; j++)
		{
			std::cout << dat[i].s[j];
		}
		std::cout << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3068
#include<stdio.h>

int jdg_sunuke(int *num, int *data);
int count(int *num, int *data);

int main(void)
{
  int all_num;
  int snack_num;
  int sunuke_num;
  int jdg[100] = {0};
  int cntnum;
  int i;
  
  scanf("%d %d^n", &all_num, &snack_num);
  
  for(i = 0; i < (snack_num*2); i++)
  {
    scanf("%d\n", &sunuke_num);
    jdg_sunuke(&sunuke_num, jdg);
  }
  
  cntnum = count(&all_num, jdg);
  
  printf("%d\n", all_num-cntnum );
}

int jdg_sunuke(int *num, int *data)
{
  int i;
  int temp_num;
  
  for(i = 0;i < *num; i++)
  {
    scanf("%d ", &temp_num);
    data[temp_num-1] = 1;
  }
  
  return 0;
}

int count(int *num, int *data)
{
  int i;
  int outnum = 0;
  
  for(i = 0; i < *num; i++)
  {
    if(data[i] == 1)
    {
      outnum++;
    }
    else
    {
    }
  }
  
  return outnum;
}

Measured memory_bytes: 1708
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int INF = 1001001001;
vector<int> a;
vector<vector<int>> to;
vector<bool> seen;
vector<int> dp;
vector<int> ans;

// 深さ優先探索で最長増加部分列LISの長さを求める
void dfs(int start) {
    // 今回のノードで更新するdpのindexとその更新前の値
    int index, old;
    index = distance(dp.begin(), lower_bound(dp.begin(), dp.end(), a[start]));
    old = dp[index];
    //dpの更新
    dp[index] = a[start];
    //この時の最長増加部分列の長さをans配列にためる
    ans[start] = distance(dp.begin(), lower_bound(dp.begin(), dp.end(), INF)) - 1;
    // このノードを見たことを記録    
    seen[start] = true;
    // 一つ深い階層へ再帰
    for (int next : to[start]) {
        // 見たことない、すなわち深い階層なら進む
        if (!seen[next]) dfs(next);
    }
    // 深い階層から帰ってきたら今回のノードで更新したdpを元に戻す
    dp[index] = old;
    return;
}
int main() {
    // 頂点の数
    int n;
    cin >> n;
    // 頂点に書かれてる数字
    a = vector<int>(n);
    for (int i = 0; i < n; ++i) cin >> a[i];
    // つながっている頂点
    to = vector<vector<int>>(n);
    for (int i = 0; i < n - 1; ++i){
        int u, v;
        cin >> u >> v;
        u--; v--;
        to[u].push_back(v);
        to[v].push_back(u);
    }
    // dfs
    seen = vector<bool>(n);
    dp = vector<int>(n + 1, INF);
    dp[0] = -INF;
    ans = vector<int>(n);
    dfs(0);

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

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

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> x(m);
    rep(i, m) cin >> x[i];

    if (m <= n) {
        cout << 0 << endl;
        return 0;
    }

    sort(x.begin(), x.end(), greater<int>());
    vector<int> diff(m - 1);
    rep(i, m-1) {
        diff[i] = x[i] - x[i + 1];
    }

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

    int ans = 0;
    rep(i, m - n) {
        ans += diff[i];
    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main()
{
  int sx,sy,tx,ty;
  cin>>sx>>sy>>tx>>ty;
  int a,b;
  a=tx-sx;
  b=ty-sy;
  REP(i,b)
  {
    cout<<"U";
  }
  REP(i,a)
  {
    cout<<"R";
  }

  REP(i,b)
  {
    cout<<"D";
  }
  REP(i,a)
  {
    cout<<"L";
  }
  cout<<"L";
  REP(i,b+1)
  {
    cout<<"U";
  }
  REP(i,a+1)
  {
    cout<<"R";
  }
  cout<<"D";
  cout<<"R";

  REP(i,b+1)
  {
    cout<<"D";
  }
  REP(i,a+1)
  {
    cout<<"L";
  }
  cout<<"U"<<endl;

}


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

int main(){
    string s;cin>>s;
    int n=s.size();
    vector<int> a(26);
    for(int i=0;i<n;i++)a.at(s.at(i)-'a')++;

    if(accumulate(a.begin(),a.end(),0)<26){
        cout<<s;
        for(int i=0;i<26;i++){
            if(a.at(i)==0){
                cout<<char(i+'a')<<endl;
                break;
            }
        }
    }

    else if(s=="zyxwvutsrqponmlkjihgfedcba")
        cout<<-1<<endl;

    else{
        int i;
        for(i=n-1;i>=1;i--){
            if(s.at(i)<=s.at(i-1)){
                a.at(s.at(i)-'a')--;
                n--;
            }
            else break;
        }
        for(int j=0;j<i-1;j++){
            cout<<s.at(j);
        }
        a.at(s.at(i)-'a')--;
        for(int j=s.at(i-1)-'a'+1;j<26;j++){
            if(a.at(j)==0){
                cout<<char(j+'a')<<endl;
                break;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
a,b,c,k = map(int,input().split())

ans = 0
ans += min(a, k)
k -= a
#print(k, 'a')
if k > 0:
    k -= b
    #print(k, 'b')
if k > 0:
    ans -= min(c, k)
    #print(k, 'c')
print(ans)


Measured memory_bytes: 9164
mem = [([0],0)]
N = int(input().strip())
for i in range(1,N):
  next_mem = []
  for seq, n_max in mem:
    next_mem += [(seq+[n], max(n_max, n)) for n in range(n_max+2)]
  mem = next_mem
    
S = 'abcdefghij'
for seq, n_max in mem:
  print(''.join(S[n] for n in seq))

Measured memory_bytes: 84060
#include <iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(void){
    int n,k;
    string s;
    cin>>n>>k>>s;
    if(s[k-1]=='A'){
        s[k-1]='a';
    }
    
    else if(s[k-1]=='B'){
        s[k-1]='b';
    }
    
    else if(s[k-1]=='C'){
        s[k-1]='c';
    }
    
    cout<<s<<endl;
}


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

const int MAXN = 200000 + 10;

int n;
int a[MAXN];
int kub[MAXN];
int32_t main() {
    ios_base::sync_with_stdio(0);
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        kub[a[i]+3]++;
    }

    int best = -1;

    for (int i = 0; i < MAXN - 10; i++) {
        best = max(best, kub[i] + kub[i+1] + kub[i+2]);
    }

    cout << best << "\n";



    return 0;
}


Measured memory_bytes: 1792
N = gets.to_i
D = gets.chomp.split(" ").map(&:to_i)

countD = Array.new(D.max + 1, 0)

D.each{|d|
  countD[d] += 1
}

if D[0] != 0 then
  puts 0
elsif countD[0] != 1 then
  puts 0
else
  ans = 1
  for i in 1...countD.length do
    ans *= countD[i-1] ** countD[i]
  end
  puts ans % 998244353
end


Measured memory_bytes: 62008
import java.io.PrintWriter
import java.util.*
import java.math.*

val pw = PrintWriter(System.out)

fun main(args: Array<String>) {
    val n = readInt()
    val a = readListOfLong()

    val x = a.fold(0L) { acc, i -> acc + i - 1L }
    println(x)
    pw.flush()
}

fun inputList() = 
    readLine()!!.split(" ").map(String::toInt)

fun sum_digits(num_: Long): Long {
    var num = num_
    var rtn: Long = 0
    while(num != 0.toLong()) {
        val tmp = num % 10
        rtn += tmp
        num /= 10
    }
    return rtn
}

/****** Decrared Functions ******/

// IO
fun read() = readLine()!!
fun readInt() = read().toInt()
fun readLong() = read().toLong()
fun readDouble() = read().toDouble()
fun readListOfString() = read().split(" ")
fun readListOfInt() = readListOfString().map { it.toInt() }
fun readListOfLong() = readListOfString().map { it.toLong() }
fun readListOfDouble() = readListOfString().map { it.toDouble() }


fun println(value : Any) {
    pw.println(value)
}

fun gcd(a: Long, b: Long): Long = 
    if(b != 0L) a else gcd(b, a % b)

fun lcm(a: Long, b: Long) = 
    if(b==0L) a else gcd(b, a % b)


Measured memory_bytes: 40780
#include<bits/stdc++.h>
#define ll long long int 
#define w(x) int x; cin>>x; while(x--)
#define pb push_back
#define mp make_pair
using namespace std;
int main(){
#ifndef ONLINE_JUDGE 
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll n,d;
	cin>>n>>d;
	ll x,y;
	ll ans=0;
	for(ll i=0; i<n; i++){
		cin>>x>>y;
		ll z=x*x;
		ll v=y*y;
		ll b=(z+v);
		//cout<<b<<endl;
		if(b<=d*d)
			ans++;
	}
	cout<<ans;
}

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

using namespace std;

#define ll       long long
#define PII      pair<int, int>
#define READ(f)  freopen(f, "r", stdin)
#define WRITE(f) freopen(f, "w", stdout)

const int N = 3e5 + 5;
const int MOD = 1e9 + 7;
const double PI = 2 * acos(0.0);

int main() {
    int n;
    string a, b, tmp = "";
    cin >> n >> a >> b;
    for (int i = 0; i < n; i++) {
        tmp += a[i];
        tmp += b[i];
    }
    cout << tmp << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
  string s;
  int n;
  cin >> s;
    if (s=="SUN"){n=7;}
  else
        if (s=="SAT"){n=1;}
  else
        if (s=="FRI"){n=2;}
  else
        if (s=="THU"){n=3;}
  else
        if (s=="WED"){n=4;}
  else
    if (s=="TUE"){n=5;}
  else
        if (s=="MON"){n=6;}
  cout<< n;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
//#pragma GCC optimize(2)
//#ifdef ONLINE_JUDGE
#define filename(_ST_); \
		freopen(_ST_".in","r",stdin); \
		freopen(_ST_".out","w",stdout);
//#else
//#define filename(_ST_);
//#endif
char outp[64];
template<typename T>
inline void read(T &x){
	char ch=0; x=0;
	bool sign=false;
	while(ch<'0'||'9'<ch) sign|=ch=='-',ch=getchar();
	while('0'<=ch&&ch<='9') x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	x=sign?-x:x;
}
template<typename T>
inline void print(T x){
	if(!x){ putchar('0'); return; }
	if(x<0) putchar('-'),x=-x;
	int tot=0;
	while(x) outp[tot++]=x%10+'0',x/=10;
	while(tot) putchar(outp[--tot]);
}
typedef long long ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define rt register int
#define For1(f,e,item) for(rt item=f;item!=e;++item)
#define Rep1(f,e,item) for(rt item=f;item!=e;--item)
#define For2(f,e,item) for(rt item=f;item<e;++item)
#define Rep2(f,e,item) for(rt item=f;item>e;--item)
#define For3(f,e,item) for(rt item=f;item<=e;++item)
#define Rep3(f,e,item) for(rt item=f;item>=e;--item)
#define lowbit(x) x&-x
ll tree[(int) 2e5+1024],n;
int maxr;
inline void add(int x,ll k){
	while(x<=maxr){
		tree[x]=tree[x]+k;
		x+=lowbit(x);
	}
}
inline ll query(int x){
	ll ret=0;
	while(x!=0){
		ret=ret+tree[x];
		x-=lowbit(x);
	}
	return ret;
}
int main(){
	read(n); maxr=(n<<1)+32;
	vector<int> numb(n+1),cnt(n+1);
	For3(1,n,i){
		read(numb[i]);
	}
	vector<int>	cpy=numb;
	sort(cpy.begin(),cpy.end());
	cpy.erase(unique(cpy.begin(),cpy.end()),cpy.end());
	int lef=1,rit=cpy.size(),ans=0;
	while(lef<rit){
		int mid=(lef+rit)>>1;
		int use=cpy[mid];
		For3(1,n,i){
			cnt[i]=cnt[i-1]+(use<=numb[i]?1:-1);
		}
		long long tot=0;
		memset(tree,0,sizeof(tree));
		For3(1,n,i){
			add(cnt[i-1]+n+1,1);
			tot+=query(cnt[i]+n+1);
		}
		if(tot>=((n*(n+1)>>1)+1)>>1) lef=mid+1,ans=use;
		else rit=mid;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2944
n = gets.split(" ").map{|k| k.to_i}
until n[0] == 0
    index = []
    for i in 0..n.length-1 do
        if n[i] > 10
            index << i
        end
    end
    if index.empty?
    else
        index.each do |index|
             n[index] = 10
        end
    end
    sum = n.sum
    one = 0
    if n.include?(1)
        one = 1
    end
    if sum > 21
        sum = 0
    elsif sum <= 11 && one == 1
        sum += 10
    end

    puts sum
    n = gets.split(" ").map{|k| k.to_i}
end



Measured memory_bytes: 6872
#include <bits/stdc++.h>
using namespace std;
int main() {
	int k, s, a = 0;
	cin >> k >> s;
	for (int x = 0; x <= k && x <= s; x++) {
		for (int y = 0; y <= k && x + y <= s; y++) {
			if (x + y + k >= s) {
				a++;
			}
		}
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
long long a[100001],b[100000];
int main()
{
	cin>>n;
	for(int i=0;i<n+1;i++) 
	  cin>>a[i];
	for(int i=0;i<n;i++) 
	  cin>>b[i];
    long long ans=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]>=b[i])
		{
			ans+=b[i];
			a[i]-=b[i];
			b[i]=0;
		}
		else
		{
			ans+=a[i];
			b[i]-=a[i];
			a[i]=0;
		}
        if(a[i+1]>=b[i])
		{
		  	ans+=b[i];
			a[i+1]-=b[i];
			b[i]=0;
		}
		else
		{
			ans+=a[i+1];
			b[i]-=a[i+1];
			a[i+1]=0;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    int N;
    cin >> N;
    vector<lli> A(N);
    REP(i, 0, N) {
        cin >> A[i];
    }
    vector<lli> S(N + 1, 0);
    vector<lli> X(N + 1, 0);
    REP(i, 0, N) {
        S[i + 1] = S[i] + A[i];
        X[i + 1] = X[i] ^ A[i];
    }
    lli ans = 0;
    REP(l, 0, N) {
        int lft = l + 1, rght = N;
        lli cnt = 0;
        while (lft <= rght) {
            int mid = (lft + rght) / 2;
            lli s = S[mid] - S[l], x = X[mid] ^ X[l];
            if (s == x) {
                lft = mid + 1;
                cnt = mid - l;
            } else {
                rght = mid - 1;
            }
        }
        ans += cnt;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4992
n = int(input())
s = input()
cnt_e = [0] * n
cnt_w = [0] * n
for i in range(n):
    if i == 0 :
        if s[i] == 'E':
            cnt_e[i] = 1
        else :
            cnt_w[i] = 1
    else :
        if s[i] == 'E':
            cnt_e[i] = cnt_e[i-1] + 1
            cnt_w[i] = cnt_w[i-1]
        else :
            cnt_e[i] = cnt_e[i-1]
            cnt_w[i] = cnt_w[i-1] + 1
ans = 3 * 10**5 + 1
for i in range(n):
    if s[i] == 'E':
        e = cnt_e[-1] - cnt_e[i]
        w = cnt_w[i]
    else :
        e = cnt_e[-1] - cnt_e[i]
        w = cnt_w[i] - 1
    ans = min(ans, e + w)
print(ans)


Measured memory_bytes: 23484
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int inf=1e9,mod=1e9+7;
typedef long long ll;
int read() {
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9') f=(c=='-')?-1:1,c=getchar();
	while(c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
	return x*f;
}
int a[100001];
main() {
	int r=read(),D=read();
	a[2000]=read();
	for(int i=2001; i<=2010; i++)
		a[i]=a[i-1]*r-D,cout<<a[i]<<endl;
}


Measured memory_bytes: 256
N=int(input())
H=list(map(int,input().split()))
dp=[float("inf")for _ in range(N)]
dp[0]=0
for i in range(1,N):
    dp[i]=min(dp[i-1]+abs(H[i]-H[i-1]),dp[i-2]+abs(H[i-2]-H[i]))
print(dp[-1])

Measured memory_bytes: 13928
#include <iostream>
#include <stack>
#include <math.h>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

#define rep(i,n) for(int i=0; i < n; i++)
using ll =  long long;
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> ans(n);
    rep(i, n)
    {
        int _a;
        cin >> _a;
        ans[_a-1] = i + 1;
    }

    rep(i, n)
    {
        cout << ans[i];
        if (i == n - 1) cout << endl;
        else cout << " ";
    }
    return 0;
}

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

int main()
{
	int n;
	cin>>n;
	
 vector<pair<int, int> > vp; 
	 for (int i = 0; i < n; ++i) 
	{ 
        int x;
		cin>>x;
		vp.push_back(make_pair(x, i)); 
    } 
    
     sort(vp.begin(), vp.end()); 
     for (int i = 0; i < n; ++i) 
	{ 
        cout<<vp[i].second +1<<" "; 
    } 
	
	return 0;
}


Measured memory_bytes: 1780
#include<iostream>
#include<vector>
#include<queue>
using namespace std;
const int cc=100005;
vector<int>poi[cc];
int color[cc]={0},cnt[2];
int main()
{
	queue<int>clr;
	int n,a,b;
	cin>>n;
	for(int i=1;i<n;i++)
	{
		scanf("%d%d",&a,&b);
		poi[a].push_back(b);
		poi[b].push_back(a);
	}
	color[1]=1;
	color[n]=2;
	clr.push(1);
	clr.push(n);
	while(!clr.empty())
	{
		int tmp=clr.front();
		clr.pop();
		cnt[color[tmp]-1]++;
		for(int i=0;i<poi[tmp].size();i++)
		{
			if(color[poi[tmp][i]]) continue;
			color[poi[tmp][i]]=color[tmp];
			clr.push(poi[tmp][i]);
		}
	}
	if(cnt[0]>cnt[1]) cout<<"Fennec\n";
	else cout<<"Snuke\n";
	return 0;
}

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

bool isposs(char c){
    if(c=='A'||c=='G'||c=='T'||c=='C') return true;
    return false;
}

int main() {

    ll n,q;
    cin>>n>>q;
    string s;
    cin>>s;
    ll dp[n+1]{0};
    dp[0]=0;
    for(ll i=1;i<n;i++){
        if(s[i]=='C' && s[i-1]=='A'){
            dp[i]=dp[i-1]+1;
        }
        else{
            dp[i]=dp[i-1];
        }
    }    
    while(q--){
        ll l,r;
        cin>>l>>r;
        l--;
        r--;
        cout<<dp[r]-dp[l]<<endl;
    }
}


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

int main() {
	int a,b,c,d,e;
  	cin >> a >> b >> c >> d >> e;
  
  	vector<int> vec;
  	vec= {a,b,c,d,e};
  
  	for(int i = 0; i < 5; i++) {
    	vec.at(i) %= 10;
      	if(vec.at(i) != 0) {
      	vec.at(i) = 10 - vec.at(i);
        }
    }
  
  	sort(vec.begin(),vec.end());
  	
  	int wait = 0;
  	for(int i = 0; i < 4; i++) {
      wait += vec.at(i);
    }
  
  	cout << a + b + c + d + e + wait << endl;
  	
}

Measured memory_bytes: 256
import java.util.*;


class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int i = 1;
    long rtn = 0;

    while (i <= n) {
      if (i % 3 == 0 || i % 5 == 0){
        i++;
      } else {
        rtn += i;
        i++;
      }
    }
    System.out.println(rtn);
  }
}

Measured memory_bytes: 35812
#include<bits/stdc++.h>
using namespace std;
using ll=int64_t;
ll mod=1e9+7;
ll pw(ll x,ll y){
  ll z;
  if(y==0) return 1;
  z=pw(x*x%mod,y/2);
  if(y%2==1) z=z*x%mod;
  return z;
}
ll comb(ll x,ll y){
  ll z=1,i;
  if(y==0) return 1;
  for(i=1;i<=y;i++) z=z*(x+1-i)%mod*pw(i,mod-2)%mod;
  return z;
}
int main(){
  ll s,m,i,ans=0;
  cin>>s;
  m=s/3;
  for(i=1;i<=m;i++) ans=(ans+comb(s-2*i-1,i-1))%mod;
  cout<<ans<<endl;
}

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

#define warn printf("!!!***!\n")
using namespace std;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
const int maxn=2e6+6;
const int mod=1e9+7;
const int oo=0x3fffffff;
double a[maxn];
int main()
{
     int n,k;scanf("%d%d",&n,&k);
     for(int i=1;i<=n;i++) scanf("%lf",&a[i]);

     double ans=0,cnt=0;
     for(int i=1;i<=k;i++){
        ans=ans+(a[i]+1)/2.0;
     }
     cnt=ans;

     for(int i=k+1;i<=n;i++){
         cnt=cnt-(a[i-k]+1)/2.0+(a[i]+1)/2.0;
         ans=max(ans,cnt);
     }
     printf("%f\n",ans);



}


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

using namespace std;

int main(){
	long long n;
	cin>>n;
	long long hoge=1;

	for(long long i=1;i<=pow(n,0.5);i++){
		if(n%i==0) hoge=i;
	}

	cout<<to_string(n/hoge).size()<<endl;

	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
//#include <fstream>

using namespace std;

int gcd (int a, int b)
{
	if (a > b){
		swap(a,b);
	} // end if
	while (b % a != 0){
		b = b % a;
		if (a > b){
			swap(a,b);
		} // end if
	} // end while

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

	return res;
}

int calc_count (int a, int m )
{
	int x = 1;
	int res = 0;

	do{
		x = a*x % m;
		++res;
	}while (x != 1 );

	return res;
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.electro-fly", "r", stdin );

	vector <int> a (3, 0 ), m (3, 0 );

	while (1){
		for (int i = 0; i < 3; ++i){
			cin >> a[i] >> m[i];
		} // end for

		if (!a[0] && !a[1] && !a[2] && !m[0] && !m[1] && !m[2] ){
			break;
		} // end if
		
		vector <int> c (3, 0 );

		for (int i = 0; i < 3; ++i){
			c[i] = calc_count (a[i], m[i] );
		} // end for

		sort (c.begin(), c.end(), greater<int>() );

		long long res = lcm (c[0], lcm (c[1], c[2] ) );

		cout << res << endl;

	} // end loop
		
	return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define inf 100000000000000000
#define ll long long int
#define pb push_back
#define f first
#define s second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}

int main(){
	// mahakal();fast;

	ll n ;
	cin>>n ;
	ll dp[10][10];
	memset(dp , 0 , sizeof dp);
	for(ll i=1;i<=n;i++){
		ll last_digit=i%10;
		ll lg=log10(i);
		lg=pow(10LL,lg);
		ll first_digit = i/lg;
		// cerr<<lg<<" ";
		dp[first_digit][last_digit]++;
	}
	ll cnt=0;
	for(ll i=0;i<10;i++){
		for(ll j=0;j<10;j++){
			cnt+=(dp[i][j])*(dp[j][i]);
		}
	}
	cout<<cnt<<endl;

	return 0;
}

Measured memory_bytes: 512
#ifndef ___Class_RMQ
#define ___Class_RMQ

#define INF (1LL << 60)

#include <vector>
#include <utility>
#include <algorithm>

using namespace std;

class RMQ
{
private:

	int size;

	vector<long long> minvalue;
	vector<long long> maxvalue;

	pair<long long, long long> _query(int a, int b, int k, int l, int r)
	{
		if (r <= a || b <= l) { return make_pair(INF, -INF); }
		if (a <= l && r <= b) { return make_pair(minvalue[k], maxvalue[k]); }

		pair<long long, long long> vl = _query(a, b, 2 * k + 1, l, (l + r) / 2);
		pair<long long, long long> vr = _query(a, b, 2 * k + 2, (l + r) / 2, r);

		return make_pair(min(vl.first, vr.first), max(vl.second, vr.second));
	}

public:

	RMQ(int size_)
	{
		for (size = 1; size < size_;) { size <<= 1; }

		minvalue = vector<long long>(size * 2 - 1, INF);
		maxvalue = vector<long long>(size * 2 - 1, -INF);
	}

	void update(int i, long long x)
	{
		i += size - 1;

		minvalue[i] = x;
		maxvalue[i] = x;

		while (i > 0)
		{
			i = (i - 1) / 2;

			minvalue[i] = min(minvalue[2 * i + 1], minvalue[2 * i + 2]);
			maxvalue[i] = max(maxvalue[2 * i + 1], maxvalue[2 * i + 2]);
		}
	}

	pair<long long, long long> query(int s, int t)
	{
		return _query(s, t, 0, 0, size);
	}
};

#endif


// ------ main ------ //

#include <cstdio>

using namespace std;

int n, q, com, x, y;

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

	RMQ r(n);

	for (int i = 0; i < q; i++)
	{
		scanf("%d", &com);
		scanf("%d", &x);
		scanf("%d", &y);

		if (com == 0) 
		{
			r.update(x, y);
		}
		if (com == 1) 
		{
			pair<long long, long long> p = r.query(x, y + 1);

			printf("%lld\n", p.first != INF ? p.first : (1LL << 31) - 1);
		}
	}

	return 0;
}

Measured memory_bytes: 6368
package main
 
import (
  "fmt"
)
 
func main() {
  var n, k int
  fmt.Scanf("%d %d", &n, &k)
  
  ans := "NO"
  if (n+1)/2 >= k {
    ans = "YES"
  }
  fmt.Printf("%s\n", ans)
}

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

int main() {
	int a, b, c;
	cin >> a >> b >> c;

	int count = 0;
	for( int i = a; i <= b; ++i ) {
		count += ( c % i == 0 );
	}

	cout << count << endl;
}



Measured memory_bytes: 3104
s = input()
n = len(s)
p = 2019
 
 
 
digit_rm = [0 for _ in range(n)]
for i in range(n):
	digit_rm[i] = (int(s[n-1-i]) * pow(10, i, p) ) % p
 
remain = [0 for _ in range(n)]
for i in range(n):
	if i == 0:
		remain[i] = digit_rm[i]
	else:
		remain[i] = (remain[i-1] + digit_rm[i]) % p
 
pcnt = [0 for _ in range(p)]
 
for i in remain:
	pcnt[i] += 1
 
if 10 % p == 0:
	ans = 0
	for i in range(n):
		if int(s[n-1-i]) % p == 0:
			ans += n - i
	print(ans)
else:
	ans = pcnt[0]
	for num in pcnt:
		if num != 0:
			ans += num * (num - 1) // 2
 
	print(ans)

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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int N;
LL A[200010];
LL S[200010];

int BS(int x , int y , int i , LL t){
	if(y-x<2) return x;
	int z = (x+y)/2;
	return (S[z] - S[i])*2 > t ? BS(x,z,i,t) : BS(z,y,i,t);
}

int main(){
	cin >> N;
	repp(i,0,N){
		cin >> A[i];
		S[i+1] = S[i] + A[i];
	}
	LL ans = S[N];
	repp(i,2,N-1){
		int x = BS(0,i,0,S[i]);
		int y = BS(i,N,i,S[N]-S[i]);
		if(x > 0 && y > i) ans = min(ans , max(S[i]-S[x],S[N]-S[y])-min(S[x],S[y]-S[i]));
		if(x+1 < i && y > i) ans = min(ans , max(S[x+1],S[N]-S[y])-min(S[i]-S[x+1],S[y]-S[i]));
		if(x > 0 && y+1 < N) ans = min(ans , max(S[i]-S[x],S[y+1]-S[i])-min(S[x],S[N]-S[y+1]));
		if(x+1 < i && y+1 < N) ans = min(ans , max(S[x+1],S[y+1]-S[i])-min(S[i]-S[x+1],S[N]-S[y+1]));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
using namespace std;
ll factorial(ll n){
    if(n==0){
        return 1;
    }
    else{
        return n*factorial(n-1);
    }
}

double dist(pair<double,double> a,pair<double,double> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}
//繰り返し自乗法
double ism(double aa,ll p){
    double ap=aa;
    double ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans*=ap;
        }
        p/=2;
        ap=ap*ap;
    }
    return ans;

}
//繰り返し自乗法(アマリトリバージョン)
ll ismm(ll aa,ll p,ll m){
    ll ap=aa;
    ll ans=1;
    while(p>0){
        //cout<<"p="<<p<<",ap="<<ap<<endl;
        if(p&1){//奇数が真
            ans=(ans*ap)%m;    
        }
        p/=2;              
        ap=(ap*ap)%m;
    }
    return ans;

}

struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(9);
    }
} All_init;


int main()
{
    ll n,max=0;
    cin>>n;
    vector<string>s(n);
    map<string,ll>m;
    for(ll i=0;i<n;i++){
        string t;
        cin>>t;
        m[t]++;
    }
    for(auto x:m){
        if(x.second>=max){
            max=x.second;
        }
    }
    for(auto x:m){
        if(x.second==max){
            cout<<x.first<<endl;
        }
    }



    
}


Measured memory_bytes: 26752
def count_dig(m)
  dig = 0
  while m > 0
    m /= 10
    dig += 1
  end
  dig
end

n = gets.chomp.to_i
cur_dig = count_dig(n)

min_dig = cur_dig
mid = Math.sqrt(n).floor
(2..mid).each do |a|
  next if n % a != 0

  # always b >= a
  b = n / a

  cur_dig = count_dig(b) if b < 10 ** (cur_dig - 1)
  min_dig = cur_dig if cur_dig < min_dig
end

puts min_dig

Measured memory_bytes: 1788
from heapq import heapify,heappush,heappop

N=int(input())
V=list(map(int,input().split()))
heapify(V)

while len(V)>=2:
    a=heappop(V)
    b=heappop(V)
    heappush(V,(a+b)/2)

c=heappop(V)
print(c)


Measured memory_bytes: 81912
using System;

namespace abc167_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string t = Console.ReadLine();

            if(s == t.Substring(0,s.Length) && s.Length+1 == t.Length)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	map<int, pair<int, int>> card;
	int grid[3][3];
	memset(grid, 0, sizeof grid);
	for(int i = 0; i < 3; i++) {
		for(int j = 0; j < 3; j++) {
			int x;
			cin >> x;
			card[x] = make_pair(i, j);
		}
	}
	
	int n;
	cin >> n;
	for(int rep = 0; rep < n; rep++) {
		int x;
		cin >> x;
		if(card.count(x)) {
			int i, j;
			tie(i, j) = card[x];
			grid[i][j] = 1;
		}
	}
	
	bool win = false;
	for(int i = 0; i < 3; i++) {
		bool row = true;
		bool col = true;
		for(int j = 0; j < 3; j++) {
			row &= grid[i][j];
			col &= grid[j][i];
		}
		
		win |= row || col;
	} 
	
	bool d1 = true, d2 = true;
	
	for(int i = 0; i < 3; i++) {
		d1 &= grid[i][i];
		d2 &= grid[2-i][i];
	}
	
	win |= d1 || d2;
	cout << (win ? "Yes" : "No") << endl;
}


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

typedef long long ll;
ll K, X, Y;
vector<pair<ll, ll>> R;
ll CX, CY;

ll dist_x() { return abs(X - CX); }
ll dist_y() { return abs(Y - CY); }
ll dist() { return dist_x() + dist_y(); }
void update_cx(ll dx) { CX += (X - CX > 0 ? 1 : -1) * dx; }
void update_cy(ll dy) { CY += (Y - CY > 0 ? 1 : -1) * dy; }
void approach(ll dx = min(dist_x(), K)) {
  update_cx(dx);
  update_cy(K - dx);
  // cout << "@ " << CX << " " << CY << endl;
  R.push_back(make_pair(CX, CY));
}
void finalize() {
  ll d = dist();
  assert(d % 2 == 0);
  if (dist_x() < d / 2) {
    ll dy = d / 2 - dist_x();
    approach(K - dy);
  } else {
    ll dx = d / 2 - dist_y();
    approach(dx);
  }
  assert(dist() == K);
  approach(dist_x());
}
void solve() {
  if (K % 2 == 0 && dist() % 2 != 0) {
    cout << -1 << endl;
    return;
  }
  if (dist() == K) {
    cout << 1 << endl;
    cout << X << " " << Y << endl;
    return;
  }
  if (K % 2 == 1 && dist() % 2 == 1) approach();
  while (dist() > 2 * K) {
    approach();
    if (K % 2 == 1) approach();
  }
  finalize();
  cout << R.size() << endl;
  for (auto xy : R) {
    cout << xy.first << " " << xy.second << endl;
  }
}
int main() {
  cin >> K >> X >> Y;
  solve();
  return 0;
}


Measured memory_bytes: 5484
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        
        int[] check = new int[N];
        int[] ans = new int[N];
        
        boolean hantei = true;
        
        for(int i = 0; i < M; i++) {
            int s = sc.nextInt();
            int c = sc.nextInt();
            
            if(check[s-1] == 0) {
                check[s-1] = 1;
                ans[s-1] = c;
            }else if(check[s-1] == 1 && ans[s-1] == c) {

            }else {
                hantei = false;
                break;
            }
            
        }
        
        if(N > 1 && ans[0] == 0 && check[0] == 1) {
            hantei = false;
        } else if(N > 1 && ans[0] == 0 && check[0] == 0) {
            ans[0] = 1;
        }
        
        int num = 0;
        if(hantei) {
            for(int i = 0; i < N; i++) {
                num *= 10;
                num += ans[i];
            }
            System.out.println(num);
        }else {
            System.out.println(-1);
        }
    }
}

Measured memory_bytes: 21588
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]

max_g = 0
for i in s:
    c_s = s.count(i)
    c_t = t.count(i)

    max_g = max(max_g,c_s-c_t)

print(max_g)
    
    

Measured memory_bytes: 38384
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define MAX 300000
typedef long long ll;
typedef pair<ll,int> P;

int main(){
  ll N,K,n;
  long double ans=0,kake=1;
  cin>>N>>K;
  n=N;
  while(true){
    if(N>=K){
      ans+=(N-K+1)*kake/n;
      N=K-1;
    }
    K=(K+1)/2;
    kake*=0.5;
    if(N==0) break;
  }
  printf("%.9Lf\n",ans);
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	
	int H,W,i,j,a[55][55]={0};
	char s[55][55];
	
	scanf("%d %d",&H,&W);
	
	for(i=1;i<=H;i++){
		scanf("%s",s[i]);
	}
	
	for(i=1;i<=H;i++){
		for(j=0;j<W;j++){
			if(s[i][j]=='#'){
				a[i][j+1]++;
			}
		}
	}
	
	
	
	for(i=1;i<=H;i++){
		for(j=1;j<=W;j++){
			if(a[i][j]==1){
				if(a[i-1][j]+a[i][j-1]+a[i][j+1]+a[i+1][j]==0){
					printf("\nNo\n");
					return 0;
				}
			}
		}
	}
	printf("\nYes\n");
	
	return 0;
}

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

/*int Main(){
    long long n,a;
    int min,max,sum;
    cin>>a;
    while(cin>>n){
        
    }
}
*/

int main(){
	int n, a, min, max, i;
	long long s;
 
	cin>>n>>a;
	
	s = a;
	min = a;
	max = a;
	
	for (i = 1; i < n; i++) {
 		cin>>a;
		if (a > max) max = a;
		if (a < min) min = a;
		s += a;
	}
	
	cout<<min<<" "<<max<<" "<<s<<endl;
}


Measured memory_bytes: 3080
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] h = new int[n];
		int[] view = new int[n];
		Arrays.fill(view, 1);
		for(int i=0; i<n; i++) {
			h[i] = sc.nextInt();
		}
		for(int j=0; j<m; j++) {
			int a = sc.nextInt() - 1;
			int b = sc.nextInt() - 1;
			if(h[a] >= h[b]) {view[b] = 0;}
           	if(h[a] <= h[b]) {view[a] = 0;}
		}
		
		int ans = 0;
		for(int isGood : view) {
			ans += isGood;
		}
		System.out.println(ans);
	}
	
}


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

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

    vector<int> index(n);
    vector<pair<int,int> > z;
    for (int i = 0; i < n; ++i) {
        int x, y;
        cin >> x >> y;
        z.push_back(make_pair(x, y));
        index[i] = i;
    }

    double ans = 0;
    int t = 0;
    do {
        for (int i = 1; i < n; ++i) {
            ans += sqrt(pow(z[index[i]].first - z[index[i-1]].first, 2) + pow(z[index[i]].second - z[index[i-1]].second, 2));
        }
        t++;
    } while (next_permutation(index.begin(), index.end()));

    ans /= (double)t;
    printf("%.7f\n", ans);

}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <string>
using namespace std;
#define ll long long
#define MOD 1000000007

ll sum(ll l, ll r) {
    return (l+r)*(r-l+1)/2;
}

int main() {
    int n, k;
    cin >> n >> k;
    ll ans = 0;
    for(int i = k; i <= n+1; i++) {
        ll l = sum(0, i-1);
        ll r = sum(n-i+1, n);
        ans += r-l+1;
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3608
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define rep2(i, a)for(auto i : a)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x, std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll co(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }

int main()
{
	ll n, p1, p2, k1, k2, k3, k4;
	cin >> n;
	vector<ll> t(n), a(n);
	rep(i, 0, n)cin >> t[i] >> a[i];
	p1 = p2 = 1;
	rep(i, 0, n) {
		k1 = (p1 + t[i] - 1) / t[i] * t[i];
		k2 = k1 / t[i] * a[i];
		k4 = (p2 + a[i] - 1) / a[i] * a[i];
		k3 = k4 / a[i] * t[i];
		if (k1 < k3)k1 = k3, k2 = k4;
		p1 = k1, p2 = k2;
	}
	printf("%lld\n", p1 + p2);
	return 0;
}

Measured memory_bytes: 3704
#pragma GCC optimize("O3")

#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef pair<int, int> pi;
tree<int,int,greater<int>,rb_tree_tag,tree_order_statistics_node_update> map_t;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define sz(x) (int)x.size()
#define f first
#define s second

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int h,a;
    cin >> h >> a;
    if(h%a==0)
        cout << h/a;
    else
        cout << h/a+1;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool p(int a){
	for(int i=2;i<=sqrt(a);i++){
		if(a%i==0)
		return true;
	}
	return false;
}
int main(){
  	int a;
  	cin >> a;
  	while(p(a)){
  		a++;
	}
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"sort"
)

func main() {
	var s, t string
	fmt.Scan(&s, &t)
	x, y := []byte(s), []byte(t)
	sort.Slice(x, func(i, j int) bool { return x[i] < x[j] })
	sort.Slice(y, func(i, j int) bool { return y[i] > y[j] })
	if string(x) < string(y) {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1840