akhauriyash/Code-Regression huggingface dataset:
import math
N, K = list(map(int, input().split()))


def calc(ini):
    l = math.ceil(math.log2(K/ini))
    return 0.5**l


ans = 0
for i in range(1, N+1):
    if i >= K:
        ans += 1/N
    else:
        ans += calc(i)/N

print(ans)


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

int b[10000000];

int main(void){
    int s;
    cin >> s;
    vector<int> a;
    a.push_back(s);
    int ans = 0;
  	b[s] =1; 
    rep(i,1000005){
        int num = a[i];
        if(num%2==0){
            b[num/2]+=1;
            a.push_back(num/2);
        }
        else{
            b[num*3+1]+=1;
            a.push_back(num*3+1);
        }
        if(b[num/2]==2 || b[num*3+1]==2){
            ans = i+2;
            break;
        }
    }
    cout << ans <<endl;
    
    
    return 0;
}
















































Measured memory_bytes: 256
q,w=(%w{+ - *}*3).combination(3),%w{$%$ %%($%%) %%(%%$) ($%%)%% (%%$)%%}.map{|s|s.gsub(?$,"(%%%)").gsub"%","%s"};until f=/0/=~s=gets;s.split.permutation.map{|a,b,c,d|q.map{|x,y,z|w.map{|e|10==eval(e%=[a,x,b,y,c,z,d])&&(puts f=e;break)};break if f};break if f};p 0 if !f;end

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

using ll = long long;

//constant
const ll MOD = 1e+9 + 7;
const double EPS = 1e-10;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// view vector
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }

// ***************************************

map<int, vector<int>> graph;
vector<int> dp;

int rec(int parent) {
	int ret = 0;

	if (dp[parent] > 0) return dp[parent];
	if (graph[parent].empty()) return 0;

	for (auto child : graph[parent]) {
		chmax<int>(ret, rec(child));
	}

	dp[parent] = ret + 1;
	return ret + 1;
}

int main(void) {

	int N, M;
	cin >> N >> M;

	vector<int> dst_count(N);
	dp.assign(N, 0);
	int x, y;
	REP(i, M) {
		cin >> x >> y;
		graph[x-1].push_back(y-1);
		dst_count[y - 1]++;
	}

	//find root
	vector<int> root;
	REP(i, dst_count.size()) {
		if (dst_count[i] == 0) root.push_back(i);
	}

	int ans = 0;
	for (auto r : root) {
		chmax<int>(ans, rec(r));
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 19840
def solve():
    #start here
    n = int(input())
    dp = [[0 for i in range(3)] for j in range(n)]
    a, b, c = map(int,input().split())
    dp[0][0], dp[0][1], dp[0][2] = a, b, c
    for i in range(1, n):
        a, b, c = map(int,input().split())
        dp[i][0] = max(dp[i-1][1], dp[i-1][2]) + a
        dp[i][1] = max(dp[i-1][0], dp[i-1][2]) + b
        dp[i][2] = max(dp[i-1][1], dp[i-1][0]) + c
    print(max(dp[n-1]))
    
solve()

Measured memory_bytes: 82660
#include <bits/stdc++.h>
using namespace std;  
#define rep(i, a, b) for(ll i = a; i < b; i++)
#define Rep(i, a, b) for(ll i = a; i <= b; i++)
#define repr(i, a, b) for(ll i = b-1; i >= a; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
// const ll INF = 1LL << 60;
const ll INF = 100000000000;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif          // -D_DEBUG をつけて実行 cf)可変引数
 
// rep(i, 0, sz(v)) cout << v[i] << " \n"[i==sz(v)-1];
 
////////////////////////////////////////////////////////


int main() {
	ll d, t, s; cin >> d >> t >> s;
	if(s*t >= d) co("Yes");
	else co("No");

    return 0;
}

Measured memory_bytes: 3620
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let m: usize = input();
    let s: Vec<Vec<i32>> = (0..m)
        .map(|_| {
            let k: usize = input();
            (0..k).map(|_| input()).collect()
        })
        .collect();
    let p: Vec<i32> = (0..m).map(|_| input()).collect();

    let mut ans: i32 = 0;
    for i in 0..1 << n {
        let mut ok = true;
        for j in 0..m {
            let mut cnt = 0;
            for &k in &s[j] {
                if i & (1 << (k - 1)) > 0 {
                    cnt += 1;
                }
            }
            if cnt % 2 != p[j] {
                ok = false;
            }
        }
        if ok {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
package main

import "fmt"

func main(){
	var A, B, K int64;

	fmt.Scan(&A, &B, &K);

	if A >=1{
		if A - K <= 0 {
			B += A-K
			if B < 0{
				B = 0;
			}
			A = 0;
		}else {
			A -= K;
		}
	}else if B >= 1 {
		if B - K > 0{
			B -= K
		}else {
			B = 0
		}
	}
	fmt.Println(A, B);
}

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

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=m-1;i>=n;--i)
#define ALL(v) v.begin(),v.end()
#define INF 1000000001
#define MOD 1000000007

using namespace std;



int main() {

	vector<int> v;
	REP(i, 3) {
		int a;
		cin >> a;
		v.push_back(a);
	}
	sort(ALL(v));
	if (v[0] + v[1] == v[2]) {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>

using namespace std;

int main() {
    double a, b, c, d, e, f, x, y, det;
    while (true) {
        cin >> a >> b >> c >> d >> e >> f;
        if (cin.eof()) {
            return 0;
        }
        det = a*e-b*d;
        x = (c*e-b*f)/det;
        y = (a*f-c*d)/det;
        if (abs(x) < 0.0005) {
            x = 0;
        }
        if (abs(y) < 0.0005) {
            y = 0;
        }
        cout << std::fixed << setprecision(3) << x << ' ' << y << endl;
    }
}

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

const int maxn = (1e5 + 12);
int n, m;
int cn1, cn2;
bool ch[maxn];
int cnt[maxn];

int main() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		string s;
		int p;
		cin >> p >> s;
		if(ch[p]) continue;
		if(s == "AC") ch[p] = 1, cn1++;
		else cnt[p] ++;
	}

	for (int i = 1; i <= n; i++) {
		if(ch[i]) cn2 += cnt[i];
	}
	cout << cn1 << ' ' << cn2;
	return 0;
}



Measured memory_bytes: 768
/*
sonu_verma1
*/
#include <bits/stdc++.h>
// For policy based data structure
/*#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> */
using namespace std;
/*using namespace __gnu_pbds; 
typedef tree<int, null_type, less<int>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set;*/
 
#define MD 1000000007
#define X first
#define Y second
#define pb push_back
#define debug(val, ch) cout <<val <<ch
#define FOR(i, st, en, ch) for(register int i = (st); i <= (en) ; i += (ch))
#define RFOR(i, st, en, ch) for(register int i = (st); i >= (en) ; i -= (ch))
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
 
typedef long long int ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<int, bool> pib;
typedef pair<bool, int> pbi;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
/*********************************************************************/
void test(int r)
{
	int h,w;
	cin>>h>>w;
	vector<string>gr(h);
	int i,j;
	for(i=0;i<h;i++)
		cin>>gr[i];
	vector<vector<ll>>dp(h,vector<ll>(w,0));
	dp[0][0]=1;
	for(i=0;i<h;i++)
	{
		for(j=0;j<w;j++)
		{
			if(gr[i][j]!='#')
			{
				if(i>0)
					dp[i][j]=dp[i-1][j];
				if(j>0)
					dp[i][j]=(dp[i][j]+dp[i][j-1])%MD;
			}
		}
	}
	cout<<dp[h-1][w-1]<<endl;
	

}
/***********************************************************************/
int main()
{
	fast();
    int t=1,r;
    // cin>>t;
    for(r=1;r<=t;r++)
        test(r);
    return 0;
}

Measured memory_bytes: 12168
N = int(input())
A = [int(a) for a in input().split()]
ans = 0
while max(A) >= N:
    for i in range(N):
        if A[i] >= N:
            t = A[i] // N
            A = [A[j] - t * N if j==i else A[j] + t for j in range(N)]
            ans += t

print(ans)

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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

#define pii pair<int,int>
#define pll pair<ll, ll>
#define forn(i, a, b) for(int i = a; i <= b; i++)
#define ford(i, a, b) for(int i = a; i >= b; i--)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007

ll a[104];

int main(){
	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n, k;
	cin >> n >> k;
	forn(i, 0, n - 1){
		cin >> a[i];
	}
	vector<ll> dp(k + 10, 0);
	dp[0] = 1;
	forn(i, 0, n - 1){
		int last = 0;
		ll sum = 0;
		vector<ll> dp2(k + 10, 0);
		forn(j, 0, k){
			sum += dp[j];
			while(j - last > a[i]){
				sum += (mod - dp[last]);
				last++;
			}
			sum %= mod;
			dp2[j] = sum;
		}
		dp = dp2;
	}
	cout << dp[k] << "\n";
	return 0;
}

Measured memory_bytes: 1792
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<sstream>
#include<climits>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX = 200;
int h, w;
int c[10][10];
int a[MAX][MAX];

int main() {
  cin >> h >> w;
  rep(i,10) {
    rep(j,10) {
      cin >> c[i][j];
    }
  }
  rep(i,h) {
    rep(j,w) {
      cin >> a[i][j];
    }
  }

  for (int k = 0; k < 10; ++k) {
    for (int i = 0; i < 10; ++i) {
      for (int j = 0; j < 10; ++j) {
        c[i][j] = min(c[i][j], c[i][k] + c[k][j]);
      }
    }
  }

  ll ans = 0;
  rep(i,h) {
    rep(j,w) {
      if (a[i][j] != -1) ans += c[a[i][j]][1];
    }
  }

  cout << ans << endl;

  return 0;
}


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

int main(){
    int n;cin>>n;
    int l[2*n];
    for(int i=0;i<2*n;i++) cin>>l[i];
    for(int i=1;i<2*n;i++){
        int v=l[i];
        int j=i-1;
        while(j>=0&&l[j]>v){
            l[j+1]=l[j];
            j--;
        }
        l[j+1]=v;
    }
    int ans=0;
    for(int i=0;i<n;i++){
        int x=min(l[2*i],l[2*i+1]);
        ans+=x;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  string s_yubao, s_qishi;
  cin >> s_yubao >> s_qishi;
  int i = 0, a = 0;
  while (i<3){
    if (s_yubao.substr(i,1) == s_qishi.substr(i,1))
      a += 1;
    i++;
        }
  cout << a << endl;
        }

Measured memory_bytes: 256
object Main extends App {
    for (Array(a, b, n) <- io.Source.stdin.getLines.map(_.split(" ").map(_.toInt))) {
        var rem = a % b
        var res = 0
        (0 until n).foreach(_ => {
            rem *= 10
            res += rem / b
            rem %= b
        })
        println(res)
    }
}

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

using namespace std;

const int N=110;

int dp[N][N];

int main(){
    int n;
    cin>>n;
    for (int i=0;i<=9;i++) 
	dp[1][i]=1;
    for (int i=2;i<=10;i++)
        for (int j=0;j<=9;j++)
            dp[i][j]=dp[i-1][j]+dp[i-1][j-1]+dp[i-1][j+1];
            
    queue<int> ans;
    
    int l=0,r=0,flag=0;
    
    for (int i=1;i<=10;i++) {
        for (int j=1;j<=9;j++) {
            if(n<=dp[i][j]){
                l=i;
                r=j;
                flag=1;
                break;
            }
            n-=dp[i][j];
        }
        if(flag==1)break;
    }
    l--;
    ans.push(r);
    while(l!=0){
        if(n<=dp[l][r-1]){
            r--;
            ans.push(r);
        }
		else{
            n-=dp[l][r-1];
            if(n<=dp[l][r]) ans.push(r);
			else{
                n-=dp[l][r];
                r++;
                ans.push(r);
            }
        }
        l--;
    }
    while(!ans.empty()){
        int res=ans.front();
        cout<<res;
        ans.pop();
    }
    return 0 ;
}


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

int main(){
  int N, c=0;
  string ans = "YES";
  cin >> N;
  vector<string> A(N);
  for (int i; i < N; i++){
    cin >> A.at(i);
  }
  set<string> B;
  while (c < N){
    if (B.count(A.at(c)) == 1){
      ans = "NO";
      break;
    }
    B.insert(A.at(c));
    c++;
  }
  cout << ans << endl;
}

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

int main(){
	int a,i,j;
	cin>>a;
	for(i=1;i<=a;i++){
		j=i;
		if(i%3==0){
			cout << " "<<i;
		}
		else if(i%10==3){
			cout << " "<<i;
		}
		else{
		while(j>0){
			j=j/10;
			if(j%10==3){
				cout << " "<<i;
				j=0;
			}
		}
		}
	}
	cout << endl;
}

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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,int>;

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

constexpr ll MOD = 1000000000 + 7;

struct Matrix{
    int dimension;
    std::vector<std::vector<ll>> data;

    Matrix(int d) : dimension(d), data(d) {
        for(int i=0;i<d;++i){
            data[i] = std::vector<ll>(d, 0);
        }
    }

    std::vector<ll>& operator[](int i){
        return data[i];
    }
};

Matrix one(int d){
    Matrix m(d);
    for(int i=0;i<d;++i){
        m[i][i] = 1;
    }

    return m;
}

Matrix mult(Matrix m1, Matrix m2){
    int d = m1.dimension;
    Matrix m3(d);

    for(int i=0;i<d;++i){
        for(int j=0;j<d;++j){
            for(int k=0;k<d;++k){
                m3[i][j] = (m3[i][j] + m1[i][k] * m2[k][j] % MOD) % MOD;
            }
        }
    }

    return m3;
}

Matrix expt(Matrix m, ll n){
    Matrix res = one(m.dimension);

    while(n > 0){
        if(n & 1){
            res = mult(res, m);
        }
        m = mult(m, m);
        n >>= 1;
    }

    return res;
}

int N;
ll K;

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

    std::cin >> N >> K;

    Matrix m(N);

    for(int i=0;i<N;++i){
        for(int j=0;j<N;++j){
            std::cin >> m[i][j];
        }
    }

    Matrix mn = expt(m, K);
    ll res = 0;
    for(int i=0;i<N;++i){
        for(int j=0;j<N;++j){
            res = (res + mn[i][j]) % MOD;
        }
    }

    std::cout << res << std::endl;
}


Measured memory_bytes: 384
/**
 *    author:  otera    
**/
#include<iostream>
#include<string> 
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm> 
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

#define int long long
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }

void solve() {
	ll x; cin >> x;
    ll now = 100;
    int cnt = 0;
    while(true) {
        now = now + now / 100;
        ++ cnt;
        if(now >= x) {
            cout << cnt << endl;
            return;
        }
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//int t; cin >> t; rep(i, t)solve();
	solve();
    return 0;
}

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

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define sort(a) sort(a.begin(),a.end())
#define reverse(a) reverse(a.begin(),a.end())
#define pb push_back
#define elif else if
#define unique(a) a.erase(unique(a.begin(),a.end()),a.end())
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef long long ll;
typedef string S;
typedef queue<int> qi;

int main(){
    ll n,p;
    cin >> n >> p;
    vl a(n);
    lrp(i,n){
        cin >> a.at(i);
        a.at(i) %= 2;
    }
    sort(a);
    ll m,cnt=0;
    lrp(i,n){
        cnt++;
        if(a.at(i)==1){
            m=i;
            break;
        }
    }
    if(cnt==n){
        m=n;
    }
    cout << (ll)pow(2,m)*(p?(n-m>=1?(ll)pow(2,n-m-1):0):(n-m>=1?(ll)pow(2,n-m-1):1)) << endl;
    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

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

  ll A,V;
  cin>>A>>V;
  ll B,W;
  cin>>B>>W;
  ll T;
  cin>>T;

  ll P=V-W;
  if(P>0){
    ll Q=abs(A-B);
    if(P*T>=Q){
      cout<<"YES"<<endl;
      return 0;
    }
  }

  cout<<"NO"<<endl;

  return 0;
}


Measured memory_bytes: 3652
const main = input => {
  const inputs = input.split('\n')
  const K = parseInt(inputs[0].trim())
  const S = inputs[1].trim()

  if (S.length <= K) {
    console.log(S)
  } else {
    console.log(S.substr(0, K) + '...')
  }
}
// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 30592
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

int32_t main(){
	IOS;
	int n, sm = 0, a;
	cin >> n;
	a = n;
	for(int i = 0; i < 3; i++){
		sm += a;
		a = a*n;
	}

	cout << sm << endl;
	return 0;
}

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

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
    ll taka,aoki,k;
    cin >> taka >> aoki >> k;
    ll ans1, ans2;
    ll temp1 = taka, temp2 = aoki;
    taka = taka - k;
    if (taka <= 0){ans1 = 0; }else{ ans1 = taka;}
    if (k <= taka){ans2 = aoki;} else { ll rem = k - temp1; aoki = aoki - rem; if (aoki <= 0){ans2 = 0;} else {ans2 = aoki;}}
    cout << ans1 << " " << ans2 << endl;
    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<string>
#include<vector>

using namespace std;

// int func(int N,vector<string> S(N),vector<double> P(N){
//     int num;
//     for(int i=0;i<N;i++){
//         if(S[i]>S[i+1]){
//             num++;
//         }
//     }
    
//}

int main(){

    int N;
    cin >> N;
    vector<string> S(N);
    vector<int> P(N);
    vector<int> num(N);

    for(int i=0;i<N;i++){
        cin >> S[i] >> P[i];
    }

    //cout << S[2].compare(S[0]) << endl;

    for(int i=0;i<N;i++){
        num[i] = 1;

        for(int j=0;j<N;j++){
            int result =S[i].compare(S[j]);
            //cout << result << endl;

            if(result > 0){
                num[i]++;
            }
            else if(result == 0){               
                if(P[i]<P[j]){
                    num[i]++;}
            }
        }
    }
    
    for(int i=0;i<N;i++){
        for(int j=0;j<N;j++){
            if(num[j]==i+1){
                cout << j+1 << endl;
            }

        }
    }
    return 0;
}

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

using LL = long long;
using LD = long double;
 
LL mod = 998244353;

int main()
{
	LL n, m;
	cin >> n >> m;

	cout << n*(n-1)/2 + m*(m-1)/2 << "\n";


}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define main signed main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

main {
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> l(c);
  cin >> l;
  vector<pair<int, int>> v(n);
  rep(i, n) cin >> v[i].second >> v[i].first;
  sort(rall(v));
  int sum = 0;
  rep(i, n) {
    if (l[v[i].second - 1] && m) {
      l[v[i].second - 1]--;
      m--;
      sum += v[i].first;
    }
  }
  cout << sum << endl;
}



Measured memory_bytes: 4920
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)    \
  for (auto v : (V)) { \
    cerr << v << " ";  \
  }                    \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> using vec = std::vector<T>;
template <class T> void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int N;
  cin >> N;

  vec<int> a(BIT(N));
  vec<int> b;

  REP(i, BIT(N)) cin >> a[i];
  sort(ALL(a));
  reverse(ALL(a));
  b.pb(a[0]);
  a[0] = 0;

  REP(i, N) {
    sort(ALL(a));
    reverse(ALL(a));
    sort(ALL(b));
    reverse(ALL(b));
    int index = 0;
    REP(j, BIT(i)) {
      while (1) {
        if (index == (int)a.size() || a[index] == 0) {
          print("No");
          return 0;
        }
        if (b[j] > a[index]) {
          b.pb(a[index]);
          a[index] = 0;
          index++;
          break;
        }
        index++;
      }
    }
  }
  print("Yes");
}

/*
教訓としてwhile文は複雑になりそうだったら中でbreak指定したほうが良い。
適宜bool変数を用意して、Noを出力するかどうか決定すればよかった。
降順の配列bを用意して各々の要素においてできるだけ大きなaの要素を取る。貪欲にやっている。
取ったあとは、bに組み込み取ったことを示すためにもとの配列の値は0にする。
尺取りでやるためaのindexは変化しない。(+1する)最後まで到達してしまったら終了。
各々の日ごとにa,bはソートしておく。
解説の方法では完全二部木でやっている。
 */

Measured memory_bytes: 4468
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const ll N=1005,M=1000000007;
ll i,j,n,m,dp[N][N];
char a[N][N];
int play(int x,int y){
	if(a[x][y]=='#') return 0;
	if(x==n-1) if(y==m-1) return 1;
	if(dp[x][y]!=-1) return dp[x][y];
	dp[x][y]=0;
	if(x+1<n) dp[x][y]=(dp[x][y]+play(x+1,y))%M;
	if(y+1<m) dp[x][y]=(dp[x][y]+play(x,y+1))%M;
	return dp[x][y];
}
int main(){
	ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0);
	cin>>n>>m;
	for(i=0;i<n;++i){
		for(j=0;j<m;++j){
			dp[i][j]=-1;
			cin>>a[i][j];
		}
	}
	cout<<play(0,0);
}

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

int main() {
    int x1,x2,y1,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    printf("%d %d %d %d\n",x2+(y1-y2),y2+(x2-x1),x1+(y1-y2),y1+(x2-x1));
}

Measured memory_bytes: 256
# include <iostream>
using namespace std;
const int N=56;
string a[N];
int n,m;
void work (void)
{
	int i,j,k,o,p,q,u,v,t;
	for (i=0;i<n;i++)
	for (j=0;j<m;j++)
	if (a[i][j]=='.')
	{
		if (i==0)
		p=0;
   else p=i-1;
        if (i==n-1)
        q=n-1;
   else q=i+1;
        if (j==0)
		u=0;
   else u=j-1;
        if (j==m-1)
        v=m-1;
   else v=j+1;
        t=0;
        for (k=p;k<=q;k++)
        for (o=u;o<=v;o++)
        if (a[k][o]=='#')
        t++;
        a[i][j]=t+'0';
	}
	for (i=0;i<n;i++)
	cout<<a[i]<<endl;
}
int main (void)
{
	int i;
	cin>>n>>m;
	for (i=0;i<n;i++)
	cin>>a[i];
	work ();
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long ans;
long long n;
long long retans;
vector<long long>vec_a;
long long solver(vector<long long> arg1_vec) {
    retans = 9223372036854775807;
    vector<long long> vec_s(n, 0);
    long long absl;
    long long absr;
    long long l=0;
    long long r=2;
    long long p;
    long long q;
    long long R;
    long long s;
    for(int i = 0; i<n; i++) {
       if(i == 0) {
           vec_s[0] = vec_a[0];
       } else {
           vec_s[i] += vec_s[i-1] + vec_a[i];
       }
    }
    for(int mid=1; mid < n-2; mid++) {
       absl = abs(vec_s[mid] - vec_s[l]*2);
       while(abs(vec_s[mid] - vec_s[l+1]*2) < absl) {
           absl = abs(vec_s[mid] - vec_s[l+1]*2);
           l++;
       }
       absr = abs(vec_s[n-1] - vec_s[r]*2 + vec_s[mid]);
       while(abs(vec_s[n-1] - vec_s[r+1]*2 + vec_s[mid]) < absr && r+1 < n-1) {
           absr = abs(vec_s[n-1] - vec_s[r+1]*2 + vec_s[mid]);
           r++;
       }
       p = vec_s[l];
       q = vec_s[mid] - vec_s[l];
       R = vec_s[r] - vec_s[mid];
       s = vec_s[n-1] - vec_s[r];
       retans = min(retans, max({p,q,R,s}) - min({p,q,R,s}));
    }
    return retans;
}
int main(int argc, char* argv[]) {
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        long long tmp;
        scanf("%d", &tmp);
        vec_a.push_back(tmp);
    }
    ans = solver(vec_a);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 5104
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip.split())
def main():
    s = S()
    alldic = collections.Counter(s)
    wnum = alldic["W"]
    leftdic = collections.Counter(s[:wnum])
    leftbnum = leftdic["B"]
    right_w_in = wnum-1
    left_b_in = right_w_in + 1
    ans = leftbnum

    for i,x in enumerate(s):
        if i<=right_w_in:
            if x == "B":
                ans += right_w_in - i
        elif i>=left_b_in:
            if x == "W":
                ans += i - left_b_in
    
    print(ans)
main()

Measured memory_bytes: 74964
h, w = gets.split.map(&:to_i)
cm = Array.new(h + 2){Array.new(w + 2, 0)}
que = []
a = []
1.upto(h) do |i|
  s = gets.chomp
  1.upto(w) do |j|
    if s[j - 1] == '.'
      cm[i][j] = -1
      a << [i, j]
    end
  end
end
ans = 0
a.each do |b|
  dm = Marshal.load(Marshal.dump(cm))
  que.push(b[0], b[1], 0)
  dm[b[0]][b[1]] = 0
  while que.size > 0
    y = que.shift
    x = que.shift
    r = que.shift
    ans = r + 1 if ans < r + 1
    if dm[y + 1][x] == -1
      dm[y + 1][x] = r + 1
      que.push(y + 1, x, r + 1)
    end
    if dm[y - 1][x] == -1
      dm[y - 1][x] = r + 1
      que.push(y - 1, x, r + 1)
    end
    if dm[y][x - 1] == -1
      dm[y][x - 1] = r + 1
      que.push(y, x - 1, r + 1)
    end
    if dm[y][x + 1] == -1
      dm[y][x + 1] = r + 1
      que.push(y, x + 1, r + 1)
    end
  end
end
puts ans - 1

Measured memory_bytes: 2812
#include <vector>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
int n;
const int maxn=1e5+7;
int a[maxn];
map<int,int> mp;
int main(){
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        mp[a[i]]++;
    }
    sort(a,a+n);
    int len=unique(a,a+n)-a;
    if(len==3){
        if((a[0]^a[1])==a[2]){
            if(max(max(abs(mp[a[0]]-mp[a[1]]),abs(mp[a[0]]-mp[a[2]])),abs(mp[a[1]]-mp[a[2]]))<2) printf("Yes\n");
            else printf("No\n");
        }else printf("No\n");
    }
    else if(len==1 &&a[0]==0) printf("Yes\n");
    else if(len==2&&mp[a[1]]==2*mp[a[0]]) printf("Yes\n");
    else printf("No\n");
}


Measured memory_bytes: 4224
X=int(input())

def is_prime(n):
    for i in range(2,n+1):
        if i*i >n:
            break
        if n%i==0:
            return False
    return True

for i in range(1000):
    A=is_prime(X+i)
    if A==True:
        print(X+i)
        break
    

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <string>
using namespace std;
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define mod 1000000007
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define fr(i,a,n) for(i=a;i<n;i++)
#define frn(i,a,n) for(i=a;i<=n;i++)
#define vll vector<ll>
#define pll pair<ll,ll>
#define vp vector<pll>
#define ub upper_bound
#define lb lower_bound
//#define map map<ll,ll>
#define mem(x,y) memset(x,y,sizeof(x))
#define all(v) v.begin(),v.end()
#define bs binary_search
#define qll queue<ll>
#define sll set<ll>
#define ma 500000
ll power(ll x,ll n)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return power(x*x,n/2);
    else                             //n is odd
        return x*power(x*x,(n-1)/2);
}
int highestPowerof2(int n)
{
   int p = (int)log2(n);
   return (int)pow(2, p);  
}
ll powermod(ll x, ll y, ll p)  
{  
    ll res = 1;
    x = x % p;
    if (x == 0) return 0;  
  
    while (y > 0)  
    {  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1; 
        x = (x*x) % p;  
    }  
    return res;  
}
 
int main()
{
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a>=0&& b>=0)
    {
        if(c<0 && d<0)
            cout<<a*d<<endl;
        else if(c>=0 && d>=0)
        cout<<b*d<<endl;
        else if(c<0 && d>=0)
        cout<<d*b<<endl;
        
    }
    else if(a<0 && b<0)
    {
        if(c>=0 && d>=0)
        cout<<b*c<<endl;
        else if(c<0 && d<0)
        cout<< c*a<<endl;
        else if(c<0 && d>=0)
        cout<<a*c<<endl;
    }
    else if(a<0 && b>=0)
    {
         if(c>=0 && d>=0)
        cout<<d*b<<endl;
        else if(c<0 && d<0)
        cout<< c*a<<endl;
        else if(c<0 && d>=0)
        cout<<max(a*c ,b*d)<<endl;
    }
        
}


Measured memory_bytes: 3672
#include <stdio.h>
int main()
{
    long long int a, b, c, d;
    scanf("%lld%lld", &a, &b);
    c = a % b;
    d = b - c;
    if (c >= d)
    {
        printf("%lld", d);
    }
    else
    {
        printf("%lld", c);
    }
    return 0;
}


Measured memory_bytes: 128
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
p = -1
q = -1

jun = []
a = [(k+1) for k in range(N)]
def make(now):
  if len(now) == N:
    jun.append(now)
    return 0
  for item in a:
    if item not in now:
      make(now+ [item])
make([])

for k in range(len(jun)):
  if jun[k] == P:
    p = k
  if jun[k] == Q:
    q = k
  if p >=0 and q >=0:
    break
print(abs(p-q))

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

#define ll long long int

int main()
{
    ll a,b,c,sum=0;
    cin>>a;
    for(ll i=1;i<=a;i++)
    {
        for(ll j=1;j<=a;j++)
        {
            for(ll k=1;k<=a;k++)
            {
                ll f=__gcd(i,j);
                ll fs=__gcd(f,k);
                sum=sum+fs;
            }
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n;
pair<ll, ll> p[200005];
ll INF = 1000000000000000000;

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n;
	ll mama = -1, mimi = INF, mami = INF, mima = -1, mai, mii;
	FOR(i, n) {
		ll x, y;
		cin >> x >> y;
		if (x > y) swap(x, y);
		mimi = min(mimi, x);
		mima = max(mima, x);
		mami = min(mami, y);
		mama = max(mama, y);
		p[i] = make_pair(x, y);
	}
	ll res = (mama-mami) * (mima-mimi);

	sort(p, p+n);

	ll ma = p[n-1].first;
	ll mi = INF, mmi = INF;
	FOR(i, n-1) {
		mi = min(mi, p[i].second);
		mmi = p[i+1].first;
		ma = max(ma, p[i].second);
		res = min(res, (mama-mimi)*(ma-min(mi,mmi)));
	}

	cout << res << endl;
	return 0;
}

Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
ll strtoint(string str);
int main(){
	fast;
	string a,b,c="",d=""; cin>>a>>b;
	ll x,y;
	x=strtoint(a);
	y=strtoint(b);
	for(auto i=0;i<x;++i)c+=b;
	for(auto i=0;i<y;++i)d+=a;
	(c<d)?cout<<c:cout<<d;
	cout<<'\n';
	return 0;
}
ll strtoint(string str){
	ll x=0;
	stringstream ss;
	ss<<str;
	ss>>x;
	return x;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n;
    long long int r;
    r=1;
    scanf("%d", &n);
    long long int a[100005];
    for(int i=0;i<n;i++){
        scanf("%lld", &a[i]);
        if(a[i]==0){
            printf("0");
            return 0;
        }
    }
    for(int j=0;j<n;j++){
        long long int tmp;
        tmp=r*a[j];
        if(r>tmp||tmp>1000000000000000000){
            printf("-1");
            return 0;
        }
        r=tmp;
    }
    printf("%lld",r);
    return 0;
}

Measured memory_bytes: 2476
def isEnd(t):
    if t == 0:
        return True
    return False

def answer(num):
    ret = 0
    while num != 0:
        ret += num % 10
        num //= 10
    return ret

flag = True
a = []

while flag:
    t = int(input())
    if isEnd(t):
        flag = False
        continue
    a.append(t)

for i in a:
    ans = answer(i)
    print(ans)


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vchar = vector<char>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  ll a, b;
  cin >> a >> b;
  ll ans = -1;
  rep(i, 1, 10000000){
    if(i * 8 >= a * 100 && i * 8 < (a + 1) * 100 && i >= b * 10 && i < (b + 1) * 10){
      ans = i;
      break;
    }  
  }
  cout << ans << endl;
}

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

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    if(a<b) swap(a,b);
    if(c%a==0) cout << c/a <<endl;
    else cout << c/a + 1 << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var h=sc.La;
		long a=h.Sum(),p=0,ans=long.MaxValue;
		for(int i = 0;i<n;i++) {
			p+=h[i];
			ans=Min(ans,Abs((a-p-p)));
		}
		Console.WriteLine("{0}",ans);
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 35536
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n,k = LI()
    l = []
    sq = int(n ** 0.5) + 1
    for i in range(1,sq+1):
        l.append((i,n//i,1))

    t = sq
    # print(sq,l)
    for j,i,_ in l[::-1]:
        # print(j,i,_)
        if t >= i:
            continue
        c = i - t
        l.append((i,j,c))
        t = i

    # print(l)

    ll = len(l)
    dp = [[0] * ll for _ in range(k+1)]
    dp[0][0] = 1

    l.append((inf,0,0))
    for i in range(k):
        dpi = dp[i]
        np = dp[i+1]
        m = 0
        c = 0
        for j in range(ll-1,-1,-1):
            t = l[j][1]
            tc = l[j][2]
            while l[m][0] <= t:
                c += dpi[m]
                c %= mod
                m += 1
            np[j] = c * tc % mod

    # print(dp)
    return sum(dp[-1]) % mod


print(main())



Measured memory_bytes: 120812
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) (a < b ? a : b)
#define MAX(a, b) (a > b ? a : b)
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

uint64_t a[100];

static int compare_int(const void *a, const void *b) {
	return (int)(*(int64_t *)a - *(int64_t *)b);
}

int main(void) {
	uint64_t N;
	uint32_t count = 0;

	scanf("%"PRIu64"\n", &N);
	for (uint64_t idx = 0; idx < N; idx++) {
		scanf(idx != N - 1 ? "%"PRIu64" " : "%"PRIu64, &(a[idx]));
		if (idx != 0) {
			if (a[idx] == a[idx - 1]) {
				count++;
				a[idx] = 100 + count;
			}
		}
	}

	printf("%"PRIu32, count);

	return 0;
}


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

int main() {
    double A, B;
    cin >> A >> B;
    double a = ceil(A / 0.08), b = ceil(B / 0.1);
    if(a >= b && floor(a*0.1) == B)
        cout << a << "\n";
    else if(b > a && floor(b*0.08) == A)
        cout << b << "\n";
    else
        cout << "-1\n";
}

Measured memory_bytes: 256
package main

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

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	c := make([][]int, 3)
	for i := 0; i < 3; i++ {
		c[i] = scanInts(3)
	}

	f := true
	for i := 0; i < 2; i++ {
		for j := 0; j < 2; j++ {
			if c[i][j]-c[(i+1)%3][j] != c[i][(j+1)%3]-c[(i+1)%3][(j+1)%3] {
				f = false
			}
		}
	}
	if f {
		fmt.Fprintln(wr, "Yes")
	} else {
		fmt.Fprintln(wr, "No")
	}
}


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

struct node{
    struct node *right;
    struct node *left;
    struct node *parent;
    int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

//Node treeMinimum(Node x){


//}

//Node treeMaximum(Node x){


//}

//Node treeSearch(Node u, int k){


//}

//Node treeSuccessor(Node x){


//}

//void treeDelete(Node z){
//      Node y; // node to be deleted
//        Node x; // child of y



//}

void insert(int key){
      Node y = NIL;
      Node x = root;
      Node z;

      z = malloc(sizeof(struct node));
      z->key = key;
      z->left = NIL;
      z->right = NIL;

      while(x != NIL){
          y = x;
          if(z->key < x->key){
              x = x->left;
          }
          else{
              x = x->right;
          }
      }

      z->parent = y;

      if(y == NIL){
          root = z;
      }
      else if(z->key < y->key){
          y->left = z;
      }
      else{
          y->right = z;
      }
}

void inorder(Node u){
    if(u == NIL) return;
    inorder(u->left);
    printf(" %d",u->key);
    inorder(u->right);
}
void preorder(Node u){
    if(u == NIL) return;
    printf(" %d",u->key);
    preorder(u->left);
    preorder(u->right);
}


int main(){
      int n, i, x;
      char com[20];
      scanf("%d", &n);

      for ( i = 0; i < n; i++ ){
          scanf("%s", com);
        /*  if ( com[0] == 'f' ){
              scanf("%d", &x);
              Node t = treeSearch(root, x);
              if ( t != NIL ) printf("yes\n");
              else printf("no\n");
          } else */if ( com[0] == 'i' ){
              scanf("%d", &x);
              insert(x);
          } else if ( com[0] == 'p' ){
              inorder(root);
              printf("\n");
              preorder(root);
              printf("\n");
          }/* else if ( com[0] == 'd' ){
              scanf("%d", &x);
              treeDelete(treeSearch(root, x));
          }*/
      }

      return 0;
}




Measured memory_bytes: 25172
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<stack>
#include<queue>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef long long ll;
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<ll> a(n);
	int ans = 0;
	rep(i, n) {
		cin >> a[i];
		while (a[i] % 2 == 0) {
			a[i] /= 2;
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int arrLength = scanner.nextInt();
		int[] arr = new int[arrLength];
		for (int i = 0; i < arrLength; i++) {
			arr[i] = scanner.nextInt();
		}
		scanner.close();
		
		for (int i = 0; i < arr.length; i++) {
			String output = "node "+(i+1)+": key = "+arr[i]+", ";
			if (i > 0) {
				output += "parent key = "+(arr[(i+1)/2-1])+", ";
			}
			if ((i+1)*2-1 < arr.length) {
				output += "left key = "+(arr[(i+1)*2-1])+", ";
			}
			if ((i+1)*2 < arr.length) {
				output += "right key = "+(arr[(i+1)*2])+", ";
			}
			System.out.println(output);
		}
	}
}



Measured memory_bytes: 27864