akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

template<typename T>
istream& operator>> (istream& is, vector<T> &vec){
    for(T& x: vec) is >> x;
    return is;
}

bool field[2005][2005];

int main(){
    ll sx = 0, sy = 0, tx = 1, ty = 2;
    cin >> sx >> sy >> tx >> ty;
    
    fill(field[0], field[2005], false);
    ll fsx = sx+1002, fsy = sy+1002, ftx = tx+1002, fty = ty+1002;
    ll loop = 0, tmpx = fsx, tmpy = fsy, destx = ftx, desty = fty, cc = 0;
    ll dy[2][4] = {{1, 0, -1, 0}, {0, -1, 0, 1}}, dx[2][4] = {{0, 1, 0, -1}, {-1, 0, 1, 0}};
    char move[2][4] = {{'U', 'R', 'D', 'L'}, {'L', 'D', 'R', 'U'}};
    
    
    while(loop != 2){
        while(tmpy != desty || tmpx != destx){
            ll ndx = abs(tmpx - destx), ndy = abs(tmpy - desty);
            bool z = false;
            rep(i, 4){
                ll dix = abs(tmpx+dx[cc%2][i] - destx), diy = abs(tmpy+dy[cc%2][i] - desty);
                if((ndx > dix || ndy > diy) && !field[tmpx+dx[cc%2][i]][tmpy+dy[cc%2][i]]){
                    tmpy += dy[cc%2][i];
                    tmpx += dx[cc%2][i];
                    field[tmpx][tmpy] = true;
                    printf("%c", move[cc%2][i]);
                    z = true;
                    break;
                }
            }
            if(!z){
                rep(i, 4){
                    if(!field[tmpx+dx[cc%2][i]][tmpy+dy[cc%2][i]]){
                        tmpy += dy[cc%2][i];
                        tmpx += dx[cc%2][i];
                        field[tmpx][tmpy] = true;
                        printf("%c", move[cc%2][i]);
                        break;
                    }
                }
            }
        }

        if(desty == fty){
            destx = fsx;
            desty = fsy;
            cc++;
        }else{
            desty = fty;
            destx = ftx;
            loop++;
            cc++;
        }
        field[destx][desty] = false;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 7564
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int main(){
    // 前処理
    COMinit();
    int N,K;
    cin >> N >> K;
    for(int i=1;i<=K;i++){
        // 赤:N-K 青:K
        ll ans = COM(N-K+1,i);
        ans*=COM(K-1,i-1);
        ans%=MOD;
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 15568
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip> // cout<<setprecision(n)
#include <functional> // std::function<void(int)>
using namespace std;
#define All(v) (v).begin(),(v).end()
const long long mod = 1000000007;
const long long inf = mod*mod;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
signed main(){
    int k,x;
    cin>>k>>x;
    for(int i=x-k+1;i<=x+k-1;i++){
        cout<<i<<' ';
    }
    cout<<endl;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    S = input()
    if N % 2 == 0:
        half = N // 2
        for i in range(half):
            A = S[i]
            B = S[i + half]
            if A != B:
                print("No")
                exit()
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()


Measured memory_bytes: 38256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n) 
{ v = vector<T>(n); for (lli i=0; i<n; ++i) cin >> v[i]; }
template<class T, class U> void read_n(vector<pair<T, U>>& v, size_t n)
{ v = vector<pair<T, U>>(n); 
  for (lli i=0; i<n; ++i) cin >> v[i].first >> v[i].second; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

struct P { lli x, y, d; 
  P(lli x, lli y, lli d) : x(x), y(y), d(d) {}
};

int main() {
  lli x; cin >> x; cout << x/3 << endl;
  return 0;
}


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

int main(){
	int a[3];
	for(int i=0;i<3;++i){
		cin >> a[i];
	}
	int cnt=3;
	int p=2;
	int q=1;
	for(int i=0;i<3;++i){
		if(a[i]==5 && p!=0) { --cnt; --p; } 
		if(a[i]==7 && q!=0) { --cnt; --q; }
	}
	if(cnt==0) cout << "YES" << endl;
	else cout << "NO" << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
const int INF = 100000000;
using namespace std;


const int kN = 1299709 + 1;
void primeNumber(bool prime[kN]){
    rep(i,kN) prime[i] = 1;
    prime[0] = prime[1] = 0;
    rep(i,kN){
        if(prime[i]){
            for(int j = i + i; j < kN; j+=i){
                prime[j] = 0;
            }
        }
    }
}

int main(){
    bool prime[kN];
    primeNumber(prime);

    int n;
    while(cin >> n,n){
        int maxi, mini;
        for(maxi = n; prime[maxi] == 0; maxi++);
        for(mini = n; prime[mini] == 0; mini--);
        cout << maxi - mini << endl;
    }
}

Measured memory_bytes: 4332
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<cstdio>
#include<algorithm>
#include<stdlib.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<stack>
#include<iterator>
#include<functional>
#include<string.h>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
//namespace mp = boost::multiprecision;
long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}
int main(){
 int n,a,b;
 cin>>n>>a>>b;
 vector<int>p(n);
 int count1=0;int count2=0; int count3=0;
 for(int i=0;i<n;i++)
 {
 	cin>>p[i];
 	if(p[i]<=a)count1++;
 	else if(p[i]<=b)count2++;
 	else count3++;
 }
 int ans =min(count1,count2);
 ans=min(ans,count3);
 cout<<ans<<endl;}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.IO;

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

            int ans = 0;
            int cont = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T')
                {
                    cont++;
                }
                else
                {
                    cont = 0;
                }

                ans = Math.Max(ans, cont);
            }

            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a, b)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

ll D, c[33], s[444][33], t[444], last[33] = {};
set<ll> s1[33], s2[33];

// vector<ll> score(ll t[]) {
//     ll i, j, sc = 0;
//     vector<ll> v;
//     v.pb(0);
//     for (i = 1; i <= D; i++){
//         sc += s[i][t[i]];
//         last[t[i]] = i;
//         for (j = 1; j <= 26;j++)
//             sc -= c[j] * (i - last[j]);
//         v.pb(sc);
//     }
//     return v;
// }

ll cost(ll k, ll dis){
    return k * dis * (dis - 1) / 2;
}

ll eval(ll d, ll q){
    ll bq = t[d];
    ll b = *s1[bq].upper_bound(d);
    ll a = *s2[bq].upper_bound(-d);
    ll sc = 0;
    sc -= s[d][bq];
    sc += s[d][q];
    ll l = d + a, r = b - d;
    sc += cost(c[bq], l);
    sc += cost(c[bq], r);
    sc -= cost(c[bq], l + r);
    b = *s1[q].upper_bound(d);
    a = *s2[q].upper_bound(-d);
    l = d + a, r = b - d;
    sc -= cost(c[q], l);
    sc -= cost(c[q], r);
    sc += cost(c[q], l + r);
    return sc;
}

int main(){
    ll i, j;
    cin >> D;
    for (i = 1; i <= 26;i++)
        cin >> c[i];
    for (i = 1; i <= D;i++)
        for (j = 1; j <= 26;j++)
            cin >> s[i][j];
    for (i = 1; i <= 26; i++){
        s1[i].insert(D + 1);
        s2[i].insert(0);
    }
    for (i = 1; i <= D;i++){
        ll ma = -1e15, p;
        for (j = 1; j <= 26; j++){
            if(c[j]*(i-last[j])+s[i][j]>ma){
                ma = c[j] * (i - last[j]) + s[i][j];
                p = j;
            }
        }
        t[i] = p;
        last[p] = i;
    }
    for (i = 1; i <= D;i++){
        s1[t[i]].insert(i);
        s2[t[i]].insert(-i);
    }
    random_device rnd;
    mt19937 mt(rnd());
    uniform_int_distribution<> rand365(1, 365);
    ll INF = 1e9;
    double start_temp = 30000, end_temp = 0;
    for (i = 0; i < 100000; i++){
        ll ma = -1e15, p;
        ll d = rand365(mt);
        for (j = 1; j <= 26; j++){
            if(j!=t[d]){
                ll sc = eval(d, j);
                if(sc > ma){
                    ma = sc;
                    p = j;
                }
            }
        }
        double temp = start_temp + (end_temp - start_temp) * i / 100000;
        double prob = exp(ma / temp);
        if (prob > (rand() % INF) / (double)INF){
            s1[t[d]].erase(d);
            s2[t[d]].erase(-d);
            s1[p].insert(d);
            s2[p].insert(-d);
            t[d] = p;
        }
    }
    for (i = 1; i <= D;i++)
        cout << t[i] << endl;
}

Measured memory_bytes: 4480
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=998244353 ;

vector<ll> inv,fact,invfact;
void mod_build(int n=101010){
    fact.resize(n+1);
    inv.resize(n+1);
    invfact.resize(n+1);
    fact[0]=inv[0]=invfact[0]=1;
    inv[1]=1;
    rep(i,n){
        fact[i+1]=fact[i]*(i+1)%mod;
        if(i>0)inv[i+1]=mod-inv[mod%(i+1)]*(mod/(i+1))%mod;
        invfact[i+1]=invfact[i]*inv[i+1]%mod;
    }
}
ll perm(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return fact[n]*invfact[n-k]%mod;
}
ll comb(int n,int k){
    if(n<0||k<0||k>n)return 0;
    return (fact[n]*invfact[n-k]%mod)*invfact[k]%mod;
}


vector<ll> mul,fac;
ll comb2(ll n,ll k){
    if(k<0||n<0||k>n)return 0;
    return mul[k]*fac[k]%mod;
}


ll powmod(ll n,ll k){
    k%=mod-1;
    if(k<0)k+=mod-1;
    ll ret=1;
    while(k){
        if(k&1)ret=ret*n%mod;
        n=n*n%mod;
        k>>=1;
    }
    return ret;
}
int main(){
    ll m,n,k;
    cin>>m>>n>>k;
    mod_build();
    m%=mod;
    vector<ll> dp(k+5);
    fac.resize(k+5);
    mul.resize(k+5);
    mul[0]=1;
    rep(i,k)mul[i+1]=mul[i]*(m-i+mod)%mod;

    fac[0]=1;
    rep(i,k+1){
        fac[i+1]=fac[i]*powmod(i+1,mod-2)%mod;
    }
    REP(i,1,k){
        dp[i]=powmod(i,n);
        REP(j,1,i){
            dp[i]+=mod-comb(i,j)*dp[j]%mod;
        }
        dp[i]%=mod;
    }
    ll ans = powmod(m,n);
    rep(i,k)ans += mod-dp[i]*comb2(m,i)%mod;
    cout<<ans%mod<<endl;
    return 0;
}


Measured memory_bytes: 5224
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var x = int.Parse(line[0]);
        var a = int.Parse(line[1]);
        var b = int.Parse(line[2]);
        var ba = b - a;
        if (ba <= 0) Console.WriteLine("delicious");
        else if (x >= ba) Console.WriteLine("safe");
        else Console.WriteLine("dangerous");
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define all(x) (x).begin(), (x).end()
const int MOD = 1e9+7;
int mpow(int a,int b,int p=MOD){a=a%p;int res=1;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b=b>>1;}return res%p;}
const int N=20;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);

      int n;
      cin>>n;
      int a[n];
      int s=0,ans=0;
      for(int i=0;i<n;i++) cin>>a[i],s+=a[i];
      for(int i=0;i<n;i++)
      {
        ans+=(a[i]*(s-a[i]));
      }
      cout<<ans/2;
}
// I never lose. I either win or I learn

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

int main(void)
{
	int n, a, b;
	cin >> n >> a >> b;
	if (a > b)
		cout << b;
	else
		cout << a;

	cout << " ";
	if (n <= (a + b))
	{
		cout << (a + b) - n << endl;
	}
	else
	{
		cout << 0 << endl;
	}
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
using System.Numerics;
using System.Runtime.InteropServices.ComTypes;
using System.Xml.Schema;
using System.ComponentModel.DataAnnotations;
using System.Security.Cryptography;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            Solve();
            //Out.Flush();
            Read();
        }

        static void Solve()
        {
            var N = Sarray()[0];
            var Ai = Sarray();
            var dp = new long[N, 2];
            dp[1, 0] = Ai[0] + Ai[1];
            dp[1, 1] = -Ai[0] - Ai[1];
            for (var i = 2; i < N; ++i)
            {
                dp[i, 0] = Max(dp[i - 1, 0], dp[i - 1, 1]) + Ai[i];//
                dp[i, 1] = Max(dp[i - 1, 0] - 2 * Ai[i - 1], dp[i - 1, 1] + 2 * Ai[i - 1]) - Ai[i];//iとi-1に-1
            }
            WriteLine(Max(dp[N - 1, 0], dp[N - 1, 1]));
        }
        static long Gcd(long x, long y) => y == 0 ? x : Gcd(y, x % y);

        static long Mod = (long)1e9 + 7;
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static public (T1 a, T2 b) Slice<T1, T2>()
        {
            var t = ReadLine().Split();
            return (
            (T1)Convert.ChangeType(t[0], typeof(T1)),
            (T2)Convert.ChangeType(t[1], typeof(T2)));
        }
        static public (T a, T b) Slice2<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)));
        }
        static public (T a, T b, T c) Slice3<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)));
        }
        static public (T a, T b, T c, T d) Slice4<T>()
        {
            var t = ReadLine().Split();
            return (
            (T)Convert.ChangeType(t[0], typeof(T)),
            (T)Convert.ChangeType(t[1], typeof(T)),
            (T)Convert.ChangeType(t[2], typeof(T)),
            (T)Convert.ChangeType(t[3], typeof(T)));
        }
    }
}

Measured memory_bytes: 40788
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

def combination(n, m):
    return m - n

if combination(a, b) > k or combination(a, c) > k or combination(a, d) > k or combination(a, e) > k:
    print(":(")
else:
    print("Yay!")

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

template<typename ll_t>
vector<pair<ll_t,ll_t>> factorize(ll_t x){
    vector<pair<ll_t,ll_t>> ret; ll_t x_tmp=x, cnt;
    if(x_tmp%2==0) { cnt=0; while(x_tmp%2==0) {x_tmp/=2; ++cnt;} ret.push_back({2,cnt});}
    for(ll_t p=3;x_tmp>1&&p*p<=x;p+=2) if(x_tmp%p==0) { cnt=0; while(x_tmp%p==0) {x_tmp/=p; ++cnt;} ret.push_back({p,cnt});}
    if(x_tmp>1)ret.push_back({x_tmp,1});
    return ret;
}

template<typename ll_t>
vector<ll_t> divisors(ll_t x){
    auto factors=factorize(x);
    vector<ll_t> ret;
    ret.push_back(1);
    for(auto &p_s:factors){
        ll_t p=p_s.first;
        ll_t s=p_s.second; 
        vector<ll_t> tmp;
        for(auto &r:ret){
            ll_t d=r;
            for(ll_t i=0;i<=s;++i){
                tmp.push_back(d);
                d*=p;
            }
        }
        ret=tmp;
    }
    sort(ret.begin(),ret.end());
    return ret;
}

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> a(n),a_mod_d(n);
    rep(i,n)cin >> a[i];
    auto sum_a=accumulate(a.begin(),a.end(),0);
    int ans=1;
    for(auto &d:divisors(sum_a)){
        rep(i,n)a_mod_d[i]=a[i]%d;
        auto sum_a_mod_d = accumulate(a_mod_d.begin(),a_mod_d.end(),0);
        auto i_larger = n-sum_a_mod_d/d;
        sort(a_mod_d.begin(),a_mod_d.end());
        int k_tmp=0;
        rep(i,n)if(i<i_larger)k_tmp+=a_mod_d[i];
        if(k_tmp<=k)ans=max(ans,d);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*    ####################  */
/*   # I_LOVE_THUY_LINH #  */
/*  ####################  */
#include <bits/stdc++.h>
#define ll long long
#define db double
#define ld long double
#define ii pair<int,int>
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define matrix vector<vector<ll>>
#define fir first
#define sec second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
#define uni(a) (a).erase(unique(all(a)),(a).end())
#define sz(a) int((a).size())
#define ms(s,val) memset(s,val,sizeof(s))
#define bitcount(n) __builtin_popcountll(n)
#define getbit(s,k) ((s >> k)&1)
#define turnbit(s,k) (s | (1<<k))
#define offbit(s,k) (s & ~(1<<k))
#define flipbit(s,k) (s ^ (1<<k))
#define prec(n) fixed<<setprecision(n)
#define sqr(x) (ll)(x)*(ll)(x)
#define lcm(a,b) ((ll)a/__gcd((ll)a,(ll)b)*(ll)(b))
#define gcd(a,b) __gcd(a,b)
using namespace std;
const int INF = int(1e9);
const int Maxn = 2*int(1e6) + 5;
const ll Mod = (ll)(1e9) + 7;
vector<ll> fac(Maxn);
vector<ll> invfac(Maxn);
int c1, c2, r1, r2;

// hockey stick identity

ll fastpow(ll x,ll y){
    ll ans = 1;
    while (y){
        if (y & 1) ans = (ans * x) % Mod;
        x = (x * x) % Mod;
        y >>= 1;
    }
    return ans;
}

ll inv(ll x){
    return fastpow(x,Mod - 2);
}

void init(){
    fac[0] = 1;
    for (int i = 1; i < Maxn; i++) fac[i] = (fac[i - 1]*i) % Mod;
    invfac[Maxn - 1] = inv(fac[Maxn - 1]);
    for (int i = Maxn - 2; i >= 0; i--) invfac[i] = ((i + 1) * invfac[i + 1]) % Mod;

}
ll C(int k,int n){
    ll tmp = fac[n];
    tmp = (tmp * invfac[k]) % Mod;
    tmp = (tmp * invfac[n - k]) % Mod;
    return tmp;
}


int main(){
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> r1 >> c1 >> r2 >> c2;
    init();
    ll ans = ((C(r2 + 1,r2 + 1 + c2 + 1) - C(r1,r1 + 1 + c2)) - (C(r2 + 1,c1 + r2 + 1) - C(r1,c1 + r1)) + 4*Mod) % Mod;
    cout << ans; 
    return 0;
}

Measured memory_bytes: 31488
import java.util.*;
import java.io.*;
 
public class Main{
    
	public static void main(String[] $){
		Scanner s = new Scanner(System.in);
		long N = s.nextLong();
		long N2 = N;
		int count = 0;
		int[] sosu = new int[1000000];
		int sosusount = 0;
		int i = 2;
		while(i <= 1000000){
			while(N%i == 0L){
				N = N/i;
				sosu[sosusount]++;
			}
			i++;
			sosusount++;
		}
		for(int j = 0; j < 1000000; j++){
			int aCount = 1;
			while(sosu[j] >= aCount){
				count++;
				sosu[j] = sosu[j] - aCount;
				aCount++;
			}
		}
		
		if(count == 0 && N == 1L){
			System.out.println(0);
		}else if(N != 1L){
			System.out.println(count+1);
		}else{
			System.out.println(count);
		}
		
	}
} 

Measured memory_bytes: 39768
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

const int N = 1e5 + 10;

struct exam {
	ll a, b;
	bool operator<(const exam &o) const {
		return (a - b) < (o.a - o.b);
	}
};

exam e[N];

int main() {
	fast_cin();
	int n; cin >> n;
	for (int i = 1; i <= n; ++i) {
		cin >> e[i].a;
	}
	for (int i = 1; i <= n; ++i) {
		cin >> e[i].b;
	}
	sort(e + 1, e + 1 + n);
	ll have = 0, r = n, ans = 0;
	for (int i = 1; i <= n; ++i) {
		ll need = e[i].b - e[i].a;
		if (need <= 0) {
			break;
		} else if (have >= need) {
			have -= need;
			e[i].a = e[i].b;
			++ans;
		} else {
			while (have < need) {
				if (e[r].a > e[r].b) {
					have += e[r].a - e[r].b;
					e[r].a = e[r].b;
					--r;
					++ans;
				} else {
					break;
				}
			}
			if (have < need) {
				cout << -1 << endl;
				return 0;
			} else {
				have -= need;
				e[i].a = e[i].b;
				++ans;
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<iostream>
using namespace std;

int n;
#define maxn 500011
char s[maxn];
int f[maxn][3],inf=0x3f3f3f3f;
int suml[maxn],sumr[maxn];
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	f[1][1]=f[2][1]=-inf;
	f[1][0]=f[2][0]=0;
	int one=0,cnt=0;
	for (int i=1;i<=n;i++)
	{
		if (s[i]=='1') one++;
		else cnt++,suml[i]=one,one=0;
	}
	one=0;
	for (int i=n,tot=cnt;i>=1;i--)
	{
		if (s[i]=='1') one++;
		else sumr[i]=one,one=0,tot--;
	}
	f[0][0]=0;f[0][1]=f[0][2]=-inf;
	int last=0,ans=0;
	for (int i=1;i<=n;i++) if (s[i]=='0')
	{
		f[i][0]=max(f[last][0],max(f[last][1],f[last][2]));
		f[i][1]=suml[i] && sumr[i]?max(f[last][0]+suml[i],suml[i]>=1?f[last][1]+suml[i]-1:-inf):-inf;
		f[i][2]=suml[i] && sumr[i]?
		max(max(f[last][0]+sumr[i],suml[i]>=2?f[last][1]+sumr[i]:0),suml[i]>=1?f[last][2]+sumr[i]-1:-inf):-inf;
		ans=max(ans,max(f[i][0],max(f[i][1],f[i][2])));
		last=i;
//		cout<<f[i][0]<<' '<<f[i][1]<<' '<<f[i][2]<<endl;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 10496
import java.util.*;

public class Main {

  private static final int MAX_COUNT = 999;

  public static void main(String[] args) {
    Main m = new Main();
    m.exec();
  }

  private void exec() {
    Scanner scan = new Scanner(System.in);

    int a = scan.nextInt();
    int b = scan.nextInt();
    

    for (int i = 0; i < MAX_COUNT - 1; i++) {
      int aSnow = getHeight(i, 0) - a;
      int bSnow = getHeight(i + 1, 0) - b;
      if (aSnow == bSnow) {
        System.out.println(aSnow);
        break;
      }
    }
    scan.close();
  }

  private int getHeight(int index, int length) {
    if (index < 0) {
      return length;
    } else {
      return getHeight(index - 1, length + index + 1);
    }
  }
}

Measured memory_bytes: 23252
#!/usr/bin/env python
# -*- coding: utf-8 -*-

while True:
    n,m,a = map(int,input().split(" "))
    if n==0 and m==0 and a==0:
        break
    lines = []
    for i in range(m):
        h,p,q = map(int,input().split(" "))
        lines.append((h,p,q))

    pos = a
    for h,q,p in list(reversed(sorted(lines))):
        if pos == p:
            pos = q
        elif pos == q:
            pos = p
    print(pos)

Measured memory_bytes: 6776
//k_tourist
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define mx 500005
#define non __builtin_popcount
#define ml map<ll, ll> 
#define uml unordered_map<ll, ll>
#define ms map<string , ll> 
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define pl pair<ll, ll>
#define vl vector<ll>
#define vll vector<pl>
#define tpl pair<ll, pl>
#define vlll vector<tpl>
#define vs vector<string>
#define pb push_back
#define mk make_pair
#define M_PI 3.14159265358979323846
#define endl '\n'
#define fst ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define si(x) scanf("%d",&x)
#define sl(x) scanf("%I64d",&x)
#define inf ((ll)1e18 + 1)
#define bs binary_search
#define pq priority_queue
#define ub upper_bound
#define lb lower_bound
#define pow powr
#define sp(a) setprecision(a)
#define rep(i,a,b)  for (i=(a);i<(b);i++)
#define nrep(i,a,b) for (i=(a);i>(b);i--)
using namespace std;
using namespace __gnu_pbds;  

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>  ordered_set;
 
ll powr(ll a,ll b)
{
	ll res=1;
	while(b)
	{
		if(b&1)res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

void flag(ll fl){

	if(fl)
	cout<<"No";
	else
	cout<<"Yes";
}


void bta_de_yarr(){

	ll n, i, j, m, ans, fl=0, k, tmp=0, a[mx];

    cin>>k>>n;

    rep(i, 0, n)
    cin>>a[i];

    rep(i, 1, n){

        tmp= max(tmp, a[i] - a[i-1]);
    }

    ll t2= k - a[n-1] + a[0];

    tmp= max(tmp, t2);

    ans= k - tmp;

	cout<<ans;
	// flag(fl);
	cout<<endl;
}

int main(){
    fst

	// freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
	ll t, i;
    t= 1;
	// cin>>t;
    
    rep(i, 1, t+1){

        // cout<<"Case #"<<i<<":"<<" ";
        bta_de_yarr();
    }
    return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Measured memory_bytes: 3584
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
struct L_B{
    long long d[61],p[61];
    int cnt;
    L_B()
    {
        memset(d,0,sizeof(d));
        memset(p,0,sizeof(p));
        cnt=0;
    }
    bool insert(long long val)
    {
        for (int i=60;i>=0;i--)
            if (val&(1LL<<i))
            {
                if (!d[i])
                {
                    d[i]=val;
                    break;
                }
                val^=d[i];
            }
        return val>0;
    }
}A;

long long a[210];
char s[210];

int main()
{
    int _;
    scanf("%d", &_);
    while(_--) {
        int n;
        scanf("%d", &n);
        for(int i = 1; i <= n; i++) scanf("%lld", &a[i]);
        scanf("%s", s);
        int f = 0;
        L_B(A);
        for(int i = n; i >= 1; i--) {
            if(s[i - 1] == '0') A.insert(a[i]);
            else {
                if(A.insert(a[i]) == true) {
                    f = 1;
                    break;
                }
            }
        }
        printf("%d\n", f);
    }
}


Measured memory_bytes: 3756
#include<stdio.h>

int mlten(int n){
  if(n==0){
    return 1;
  }
  else{
    return 10*mlten(n-1);
  }
}

int fixit(int *p,int n){
  if(n<0){
    return 0;
  }
  else{
    int mt=mlten(n);
    return mt*p[3-n]+fixit(p,n-1);
  }
}

int smn(int *p,int n){
  if(n==4){
    return 1;
  }
  if(p[n]!=p[0]){
    return 0;
  }

  return smn(p,n+1);
}

int doit(int n){
  int a[4];
  int b[4];
  int na;
  int nb;
  int i;

  if(n==6174){
    return 0;
  }

  for(i=0;i<4;i++){
    int mt=mlten(3-i);
    a[i]=n/mt;
    b[i]=a[i];
    n=n%mt;
  }

  if(smn(a,1)==1){
    return -1;
  }

  for(i=0;i<4;i++){
    int j;
    int tmp;
    for(j=i+1;j<4;j++){
      if(a[i]<a[j]){
	tmp=a[i];
	a[i]=a[j];
	a[j]=tmp;
      }
      if(b[i]>b[j]){
	tmp=b[i];
	b[i]=b[j];
	b[j]=tmp;
      }
    }
  }

  na=fixit(a,3);
  nb=fixit(b,3);

  return 1+doit(na-nb);
}

int main(){
  int n;
  scanf("%d",&n);
  if(n!=0){
    int ans=doit(n);
    if(ans==-1){
      printf("NA\n");
    }
    else{
      printf("%d\n",ans);
    }
    return main();
  }
  return 0;
}

Measured memory_bytes: 920
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
using namespace std;
typedef long long ll;

int main(){
    string s;
    cin>>s;
    if(s[0]!='A'){
        cout<<"WA"<<endl;
        return 0;
    }
    bool flag=false;
    for(int i=1;i<s.size();i++){
        if('A'<=s[i]&&s[i]<='Z'){
            if(s[i]=='C'&&2<=i&&i<=s.size()-2){
                if(flag){
                    cout<<"WA"<<endl;
                    return 0;
                }else{
                    flag=true;
                }
            }else{
                cout<<"WA"<<endl;
                return 0;
            }
        }
    }
    if(flag){
        cout<<"AC"<<endl;
    }else{
        cout<<"WA"<<endl;
    }
}


Measured memory_bytes: 256
use std::io::Read;
use std::cmp::min;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();

    let mut tree: Vec<Node> = vec![Node { parent: -1, left: -1, right: -1 }; n];

    let mut pre_order: Vec<usize> = Vec::with_capacity(n);
    for _ in 0..n {
        pre_order.push(iterator.next().unwrap().parse().unwrap());
    }

    let mut in_order: Vec<usize> = Vec::with_capacity(n);
    for _ in 0..n {
        in_order.push(iterator.next().unwrap().parse().unwrap());
    }

    construct_tree(&mut tree, &pre_order, &in_order);

    let root_id = pre_order[0];

    let mut ans = String::new();
    post_order(&tree, root_id, &mut ans);

    return ans.trim().to_string();
}

fn construct_tree(tree: &mut Vec<Node>, pre_order: &[usize], in_order: &[usize]) -> isize {
    if in_order.is_empty() {
        return -1;
    }
    if in_order.len() == 1 {
        return in_order[0] as isize;
    }

    let mut min_index = std::usize::MAX;
    for id in in_order {
        let index = pre_order.iter().position(|i| i == id).unwrap();
        min_index = min(min_index, index);
    }

    let current = pre_order[min_index];
    let position = in_order.iter().position(|i| i == &current).unwrap();

    let (left_tree, right_tree) = in_order.split_at(position);
    let right_tree = &right_tree[1..];

    let left_child = construct_tree(tree, pre_order, left_tree);
    if left_child != -1 {
        tree[current - 1].left = left_child;
        tree[left_child as usize - 1].parent = current as isize;
    }

    let right_child = construct_tree(tree, pre_order, right_tree);
    if right_child != -1 {
        tree[current - 1].right = right_child;
        tree[right_child as usize - 1].parent = current as isize;
    }

    current as isize
}

fn post_order(tree: &Vec<Node>, id: usize, result: &mut String) {
    let node = &tree[id - 1];
    if node.left != -1 {
        post_order(tree, node.left as usize, result);
    }
    if node.right != -1 {
        post_order(tree, node.right as usize, result);
    }
    result.push_str(&format!("{} ", id));
}

#[derive(Clone, Debug)]
struct Node {
    parent: isize,
    left: isize,
    right: isize,
}



Measured memory_bytes: 5032
#include <iostream>
#include <climits>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <numeric>
#include <queue>
using namespace std;
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define vll vector<long long>
#define vb vector<bool>
#define vs vector<string>
#define px(x) cout << x << endl
#define pfi(x) printf("%d\n", x)
#define pfs(x) printf("%s\n", x)
#define sfi(x) scanf("%d", &x)
#define sfs(x) scanf("%s", x)

int mod = 1e9 + 7;


int main() {
    int h, w;
    cin >> h >> w;

    char arr[h][w];
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> arr[i][j];
        }
    }

    int dp[h][w];
    // for(int i=0; i<h; i++){
    //     for(int j=0; j<w; j++){
    //         cin >> arr[i][j];
    //     }
    // }
    dp[0][0] = 1;
    for(int i=1; i<h; i++){
        if(arr[i][0] == '#'){
            dp[i][0] = 0;
        }else{
            dp[i][0] = dp[i-1][0];
        }
    }

    for(int j=1; j<w; j++){
        if(arr[0][j] == '#'){
            dp[0][j] = 0;
        }else{
            dp[0][j] = dp[0][j-1];
        }
    }
    for(int i=1; i<h; i++){
        for(int j=1; j<w; j++){
            dp[i][j] = (arr[i][j] == '#') ? 0 : (dp[i-1][j] + dp[i][j-1])%mod;
        }
        
    }


    // for(int i=0; i<h; i++){
    //     for(int j=0; j<w; j++){
    //         cout << dp[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    cout << (dp[h-1][w-1]%mod) << endl;


	return 0;
}

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


const double eps = 1e-10;
int sgn(double x) {
    if(fabs(x) < eps) return 0;
    return x < 0 ? -1 : 1;
}
struct Point {
    double x, y;
    Point(double xp=0, double yp=0): x(xp), y(yp) { }
    Point operator + (const Point& rhs) const { return Point(x+rhs.x, y+rhs.y); }
    Point operator - (const Point& rhs) const { return Point(x-rhs.x, y-rhs.y); }
    Point operator * (const double& k) const { return Point(x*k, y*k); }
    Point operator / (const double& k) const { return Point(x/k, y/k); }
    bool operator < (const Point& rhs) const { return x < rhs.x || (x==rhs.x && y<rhs.y); }
    bool operator == (const Point& rhs) const {return sgn(x - rhs.x) == 0 && sgn(y - rhs.y) == 0; }
    Point turn(double rad) { return Point(x*cos(rad)-y*sin(rad), x*sin(rad)+y*cos(rad)); }
};
typedef Point Vector;

double dot(Vector x, Vector y) { return x.x*y.x + x.y*y.y; }
double length(Vector x) { return sqrt(dot(x, x)); }
double cross(Vector A, Vector B) { return A.x*B.y - A.y*B.x; }


Point LineProjection(Point P, Point A, Point B) {
    Vector v = B - A;
    return A + v * (dot(P-A, v) / dot(v, v));
}
Point LineReflection(Point P, Point A, Point B) {
    Point proj = LineProjection(P, A, B);
    return proj + proj - P;
}

int Clockwise(Point O, Point A, Point B) {
    /* Clockwise: -1
       Counterclockwise: 1
       Otherwise: 0
    */
    return sgn(cross(A - O, B - O));
}

int main() {
    Point a, b, p;
    scanf("%lf%lf%lf%lf", &a.x, &a.y, &b.x, &b.y);
    int q; scanf("%d", &q);
    while(q--) {
        scanf("%lf%lf", &p.x, &p.y);
        int ans = Clockwise(a, b, p);
        if(ans == 1) puts("COUNTER_CLOCKWISE");
        else if(ans == -1) puts("CLOCKWISE");
        else {
            Vector d = b - a, e = p - a;
            if(sgn(dot(d, e)) == -1) puts("ONLINE_BACK");
            else if(sgn(length(e) - length(d)) == 1) puts("ONLINE_FRONT");
            else puts("ON_SEGMENT");
        }
    }
    
    return 0;
}


Measured memory_bytes: 3228
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>
#include <sstream>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <numeric>
#include <cmath>
#include <climits>
#include <limits>
#include <cfloat>
#include <fstream>
using namespace std;
#define M 100000000

// ツパツケツッツトツつェツ経ツ由ツつキツづゥツδ仰ーツタツづ個催短ツ仰猟猟」ツづーツダツイツクツスツトツδ可づ仰づ淞づゥツ。
// ttl >= ツ個仰嘉環づ按づァ ツ個仰嘉環づーツ陛板つキ
// ttl < ツ個仰嘉環づ按づァ -1 ツづーツ陛板つキ
int dijkstra (int from ,int to, vector <vector <int> > t )
{
	int size = t.size();
	vector <int> d (size, M );
	vector <bool> v (size, false );
	int i,p;

	d[from] = 1;

	int mind = M;

	do{
		mind = M;
		for (i = 1; i < size; ++i){
			if (!v[i] && mind > d[i] ){
				mind = d[i];
				p = i;
			} // end if
		} // end for
		
		v[p] = true;

		for (i = 1; i < size; ++i){
			if ( d[p] + t[p][i] < d[i] ){
				d[i] = d[p] + t[p][i];
			} // end if
		} // end for
	} while (mind != M );
	

	return d[to];
}
	
int main()
{
//	cut here before submit 
//	freopen ("testcase.packet", "r", stdin );
	string str = "";
	string res = "";
	int n;

	getline (cin, str );
	stringstream ssn(str);
	ssn >> n;

	vector <vector <int> > t (n+1, vector <int> (n+1, M) );
	vector <vector <int> > memo (n+1, vector <int> (n+1, M ) );
	int i,j;
	for (i = 0; i < n; ++i){
		int from, num, to;
		getline (cin, str );
		stringstream ss(str);

		ss >> from >> num;
		for (j = 0; j < num; ++j){
			ss >> to;
			t[from][to] = 1;
		} // end for
	} // end for
	

	for (i = 1; i <= n; ++i){
		for (j = 1; j <= n; ++j){
			if (i != j ){
				memo[i][j] = dijkstra (i, j, t );
			} // end if
		}  // end for
	} // end for


	int p;
	getline (cin, str );
	stringstream ssp (str );
	ssp >> p;
	
	for (i = 0; i < p; ++i){
		int from, to , ttl;
		getline (cin, str );
		stringstream ss (str );
		ss >> from >> to >> ttl;
	
		int res = -1;
		if (memo[from][to] <= ttl ){
			res = memo[from][to];
		}else{
			res = -1;
		} // end if		

		if (res == -1){
			cout << "NA" << endl;
		}else{
			cout << res << endl;
		} // end if
	} // end for

	return 0;
}

Measured memory_bytes: 1068
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

K, S = map(int, input().split())

r = 0
for i in range(K + 1):
    for j in range(K + 1):
        k = S - i - j
        if k >= 0 and k <= K:
            r += 1

print(r)


Measured memory_bytes: 2940
figures = {
    "A": [[1, 1], [1, 1]],
    "B": [[1], [1], [1], [1]],
    "C": [[1, 1, 1, 1]], 
    "D": [[0, 1], [1, 1], [1, 0]],
    "E": [[1, 1, 0], [0, 1, 1]],
    "F": [[1, 0], [1, 1], [0, 1]],
    "G": [[0, 1, 1], [1, 1, 0]]
}

try:
    while True:
        a = [list(map(int, input())) for _ in [0]*8]

        for t, l in figures.items():
            x_size, y_size = len(l[0]), len(l)
            result = False
            for y in range(8-y_size+1):
                for x in range(8-x_size+1):
                    flag = True
                    for dy in range(y_size):
                        for dx in range(x_size):
                            if a[y+dy][x+dx] != l[dy][dx]:
                                flag = False
                    if flag:
                        result = True
                        break
                if result:
                    break
            if result:
                print(t)

        input()

except EOFError:
    exit()


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

int main(){
	int x;
	int happy=0;
	cin >> x;
	while(x >= 5){
		if(x>=500){
			x -= 500;
			happy += 1000;
		}
		else{
			x -= 5;
			happy += 5;
		}
	}
	cout << happy << endl;

	return 0;
}

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

sum = [0, 0]
for i in input().split():
    sum[int(i)%2] += 1

def nCr(n, r):
    a, b = 1, 1
    for i in range(1, r+1):
        a *= n - (i-1)
        b *= i
    return a // b

ans = 0
if P == 0:
    for i in range(N+1):
        for j in range(0, i+1, 2):
            if sum[0] < i-j: continue
            if sum[1] < j: continue
            ans += nCr(sum[0], i-j) * nCr(sum[1], j)
else:
    for i in range(N+1):
        for j in range(1, i+1, 2):
            if sum[0] < i-j: continue
            if sum[1] < j: continue
            ans += nCr(sum[0], i-j) * nCr(sum[1], j)

print(ans)

Measured memory_bytes: 3064
from bisect import *
n,k=map(int,input().split())
c=list(map(int,input().split()))
a=bisect_left(c,0)
insort_left(c,0)
j=a
while 1:
  if j+1<=n:
    if c[j+1]==0:
      k-=1
      j+=1
    else:
      break
  else:
    break
ans=10**18
for i in range(k+1):
  if a+i<=n and a-k+i>=0:
    ans=min(ans,min(c[a+i],-c[a-k+i])*2+max(c[a+i],-c[a-k+i]))
if ans==10**18:
  print(0)
else:
  print(ans)

Measured memory_bytes: 14660
import heapq
n , k = map(int,input().split())
a = list(map(int,input().split()))
lef = 0
rig = max(a)
while rig - lef != 1:
    now = -(-(lef+rig)//2)
    cou = 0
    for i in range(n):
        cou += -(-a[i]//now) - 1
    if cou <= k:
        rig = now
    elif cou > k:
        lef = now
print(rig)

Measured memory_bytes: 104820
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long X = sc.nextLong();
		long Y = sc.nextLong();
		long A = X;
		int ans = 1;
		while (true) {
			if (A < 0) {
				A *= -2;
			} else {
				A *= 2;
			}
			if (A <= Y)
				ans++;
			else {
				System.out.println(ans);
				return;
			}
		}
	}

}


Measured memory_bytes: 21716
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

typedef vector<int> vec;
typedef vector<vec> mat;

const ll mod = 1000000007;

int main(){
    
    int n;
    cin >> n;
    rep(i, 9)rep(j, 9){
        if((i + 1) * (j + 1) == n){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n,a,b,c,d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;
    bool ok1=true;
    for(ll i=a;i<c-1;i++){
        if(s[i]=='#'&&s[i+1]=='#') ok1=false;
    }
    bool ok2=true;
    for(ll i=b;i<d-1;i++){
        if(s[i]=='#'&&s[i+1]=='#') ok2=false;
    }
    bool ok3=false;
    if(c<d) ok3=true;
    for(ll i=b-1;i<=d-1;i++){
        if(s[i-1]=='.'&&s[i]=='.'&&s[i+1]=='.') ok3=true;
    }
    if(ok1&&ok2&&ok3) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3740
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	static int sc() {
		int a=scan.nextInt();
		return a;
	}
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		int a=sc();
		boolean b=true;
		int max=0;
		for(int i=0;i<a;i++) {
			int c=scan.nextInt();
			max=c>max?c:max;
			if(!(c>=max-1))b=false;
		}
		System.out.println(b?"Yes":"No");
	}
}

Measured memory_bytes: 48364
#include <bits/stdc++.h>
using namespace std;
int r=0;
void dfs(int n,int s){
  if(s==1){
    r++;
    return;
  }
  for(int i=0;i*s*s<=n;i++) dfs(n-i*s*s,s-1);
}
 
int main(){
  for(int n;cin>>n,n;r=0){
  dfs(n,17);
  cout<<r<<endl;
  }
  return 0;
}

Measured memory_bytes: 2980
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))

using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


ll m = 1000000007;

const int MOD = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}



long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}

int x[10000];
int main() {
	int A, B, C;
	cin >> A >> B >> C;
	bool ok = false;

	REP(i, 1000000000) {
		x[0] = i;
		ll ans = i % 57;
		if (C >= A && C <= B)ok = true;
	}
	if (ok)cout << "Yes" << endl;
	else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
const int N = 305;
int a[N][N], id[N], cnt[N];
bool vis[N];
int main()
{
	ios::sync_with_stdio(false);
	int n, m;
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			cin >> a[i][j];
	for (int i = 1; i <= n; i++)
	{
		id[i] = 1;
		cnt[a[i][1]]++;
	}
	int ans = *max_element(cnt + 1, cnt + m + 1);
	for (int i = 1; i < m; i++)
	{
		vis[max_element(cnt + 1, cnt + m + 1) - cnt] = true;
		fill(cnt + 1, cnt + m + 1, 0);
		for (int j = 1; j <= n; j++)
		{
			while (vis[a[j][id[j]]])
				id[j]++;
			cnt[a[j][id[j]]]++;
		}
		ans = min(ans, *max_element(cnt + 1, cnt + m + 1));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    string S;
    cin >> S;
    cout << S[0] << S.size()-2 << S.back() << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <set>
#include <array>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;
const ll INF = 1LL << 50;

struct Edge
{
    int from;
    int to;
    ll cost;

    Edge(int from, int to, ll cost)
        : from(from)
        , to(to)
        , cost(cost){}
};

struct Graph 
{
    vector<ll> xs;
    vector<vector<int>> neighbor_list;
    vector<Edge> edge_list;

    Graph(int n)
    {
        neighbor_list.resize(n);
        xs.resize(n, INF);
    }

    void push(const Edge &e)
    {
        edge_list.push_back(e);
        neighbor_list[e.from].push_back(edge_list.size() - 1);
    }
};

void dfs(Graph &g, int start)
{
    for (int ei : g.neighbor_list[start])
    {
        auto &e = g.edge_list[ei];
        if (g.xs[e.from] != INF && g.xs[e.to] == INF)
        {
            g.xs[e.to] = g.xs[e.from] + e.cost;
            dfs(g, e.to);
        }
    }
}

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

    Graph graph(n);
    for (int i = 0; i < m; i++)
    {
        int l, r;
        ll d;
        cin >> l >> r >> d;
        l--;
        r--;
        graph.push(Edge(l, r, d));
        graph.push(Edge(r, l, -d));
    }

    for (int i = 0; i < n; i++)
    {
        if (graph.xs[i] == INF) 
        {
            cerr << i << endl;
            graph.xs[i] = 0;
            dfs(graph, i);
        }
    }

    // for (ll x : graph.xs) cout << x << " ";
    // cout << endl;

    // check
    bool success = true;
    for (auto &e : graph.edge_list)
    {
        // cout << graph.xs[e.to] << " " << graph.xs[e.from] << " " << e.cost << endl;
        if (graph.xs[e.to] != graph.xs[e.from] + e.cost)
        {
            success = false;
        }
    }
    cout << (success ? "Yes" : "No") << endl;
}

Measured memory_bytes: 17512
#include <iostream>

using namespace std;
typedef long long ll;

int main(void){
ll H,W;
cin >> H >> W;

if(H == 1 || W == 1){
 cout << 1 << endl;
 } else {
 cout << (H * W + 1) / 2 << endl;
 }

 return 0;
}

Measured memory_bytes: 256