akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define pb push_back
#define sz(x) (int)(x).size()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;


int main() {
  int h, w;
  cin >> h >> w;
  char s[h+10][w+10];
  bool check[h+10][w+10];
  rep(i,h){
    rep(j,w){
      cin >> s[i][j];
      if(s[i][j]=='.'){
        check[i][j]=true;
      }
      else check[i][j]=false;
    }
  }
  
  rep(i,h){
    rep(j,w-1){
      if(s[i][j]=='#' && s[i][j+1]=='#'){
        check[i][j]=true;
        check[i][j+1]=true;
      }
    }
  }
  rep(i,h-1){
    rep(j,w){
      if(s[i][j]=='#' && s[i+1][j]=='#'){
        check[i][j]=true;
        check[i+1][j]=true;
      }
    }
  }
  rep(i,h){
    rep(j,w){
      if(!check[i][j]){
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val N, M, X = sc.nextInt
  val CA = Array.fill(N, M + 1)(sc.nextInt)
  val C = CA.map(_.head)
  val A = CA.map(_.tail)

  val a = (0 until N).foldLeft(Set(Set.empty[Int])) {
    (set, element) => set union (set map (_ + element))
  }
  val b = a.map(_.toSeq.sorted).toSeq.filter(xs => {
    xs.map(A(_)).foldLeft(Array.fill(M)(0))((x, y) => {
      (x zip y).map { case (x, y) => x + y }
    }).forall(_ >= X)
  })
  val c = b.map(_.map(C(_)).sum)
  val x = if (c.isEmpty) -1 else c.min
  println(x)
}


Measured memory_bytes: 67168
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)

int main() {
    int n,ans=0;
    int h,w;
    int a,b;
    scanf("%d %d", &h,&w);
    scanf("%d %d", &a,&b);
    cout << (h-a)*(w-b) << "\n";
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main()
{
    int x;
    cin  >> x;
    int gohyaku;
    int goen;
    long long ans;
    gohyaku = x / 500;
    x = x % 500;
    goen = x / 5;
    ans = 1000 * gohyaku + 5 * goen;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma region atcoder
#include <atcoder/twosat>
using namespace atcoder;
/* These are for segment tree
int op(int a, int b){return max(a, b);}
int e(){return -1;}
bool f(int v){ return v < target;}
*/
#pragma endregion
#pragma region macros
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vl = vector<ll>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
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; }
template<class T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a,T b){return a / gcd(a, b) * b;}
#pragma endregion
#pragma region debug for var, v, vv
#define debug(var)  do{std::cout << #var << " : ";view(var);}while(0)
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){cout << endl;int cnt = 0;for(const auto& v : vv){cout << cnt << "th : "; view(v); cnt++;} cout << endl;}
#pragma endregion
const ll mod = 1000000007;
const int inf = 1001001001;
const ll INF = 1001001001001001001;
const int MAX = 2000005;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	int n, d; cin >> n >> d;
	two_sat g(n);
	vi x(n), y(n);
	rep(i, n) cin >> x[i] >> y[i];
	for(int i = 0; i < n; i++){
		for(int j = i + 1; j < n; j++){
			if(abs(x[i] - x[j]) < d) g.add_clause(i, false, j, false);
			if(abs(x[i] - y[j]) < d) g.add_clause(i, false, j, true);
			if(abs(y[i] - x[j]) < d) g.add_clause(i, true, j, false);
			if(abs(y[i] - y[j]) < d) g.add_clause(i, true, j, true);
		}
	}
	if(!g.satisfiable()) cout << "No" << endl;
	else{
		cout << "Yes" << endl;
		auto ans = g.answer();
		rep(i, n){
			if(ans[i]) cout << x[i] << endl;
			else cout << y[i] << endl;
		}
	}
} 


Measured memory_bytes: 3772
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <utility>
#define ms(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int mod = 998244353;
const int inf = 1 << 30;
const int maxn = 100 + 5;

int n, m, p[maxn];
vector<int> s[maxn];

int main() {
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; i++) {
        int k, x; scanf("%d", &k);
        while (k--) {
            scanf("%d", &x); s[i].push_back(x - 1);
        }
    }
    for (int i = 1; i <= m; i++) scanf("%d", p + i);
    int ss = 1 << n, ans = 0;
    for (int s = 0; s < ss; s++) {
        int f = 1;
        for (int i = 1; i <= m; i++) {
            int c = 0;
            for (int& x: ::s[i]) {
                if (s & (1 << x)) c++;
            }
            if (c % 2 != p[i]) {
                f = 0; break;
            }
        }
        if (f) ans++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int x,n; cin>>n;
  vector<int> v(n+1,0);
  for(int i=0;i<n-1;i++){
    cin>>x; v[x]++;
  }
  for(int i=1;i<=n;i++) cout<<v[i]<<" ";
  return 0;
}

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

#define PI acos(-1)
#define all(a) a.begin(), a.end()
#define full(a, n) a, a + n
#define ma(type, size) (type *)malloc(sizeof(type) * size)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define f0(i, n) for (i = 0; i < (n); i++)
#define f1(i, n) for (i = 1; i < (n); i++)
#define f1n(i, n) for (i = 1; i <= (n); i++)
#define fab(i, a, b) for (i = (a); i <= (b); i++)
#define fr(i, b, a) for (i = (b); i >= (a); i--)

using namespace std;

/*
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag,
	tree_order_statistics_node_update> indexed_set;
//*/
typedef long long int ll;
typedef long int lo;

typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef tuple<ll, ll, ll> tll;

//* utility function
inline bool compare(ll i, ll j)
{
    return i < j;
}
//*/

//* function prototypes
template< typename T>
T gcd(T a, T b);
template< typename T>
T modpow(T number, T power, T mod_value);
//*/

//int row, column;
//int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//int dy[8] = {0, -1, -1, -1, 0, 1, 1, 1};
//int dx[4] = {1,  0, -1, 0};
//int dy[4] = {0, -1,  0, 1};
//ll p2[63] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 140737488355328, 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496, 9007199254740992, 18014398509481984, 36028797018963968, 72057594037927936, 144115188075855872, 288230376151711744, 576460752303423488, 1152921504606846976, 2305843009213693952, 4611686018427387904};
#ifdef DEBUG
#endif // DEBUG

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll number_of_test_case = 1, test_case;
    //cin >> number_of_test_case;
    for (test_case = 1; test_case <= number_of_test_case; test_case++)
    {
        ll i, j, n;

        cin >> n;
        
        f1n(i, 9)
        {
            if (n%i == 0 && n/i > 0 && n/i < 10)
            {
                cout << "Yes\n";
                return 0;
            }
        }
        cout << "No\n";

    	//cout << "Test #" << test_case << ": ";
    	//cout << "Case " << test_case << ": ";
    }
    return 0;
}


template< typename T>
T gcd(T a, T b)
{
    if (b == 0)
        return a;
    return gcd(b, a%b);
}
template< typename T>
T modpow(T number, T power, T mod_value)
{
    if (power == 0)
        return 1%mod_value;
    ll u = modpow(number,power/2,mod_value);
    u = (u*u)%mod_value;
    if (power%2 == 1)
        u = (u*number)%mod_value;
    return u;
}


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

int main(){
  long long  N,K;
  cin >> N >> K;

  double res=0.0;
  for (long long n=1;n<=N;++n){
    double tmp=1.0;
    long long nn=n;
    while(nn<K) nn*=2,tmp/=2.0;
    res+=tmp;
  }
  res/=N;
  cout << fixed << setprecision(10) << res << endl;
}

Measured memory_bytes: 256
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
import itertools

cannot=False
for x,y in itertools.combinations([a,b,c,d,e],2):
    if y-x>k:
        cannot=True
if cannot:
    print(":(")
else:
    print("Yay!")

Measured memory_bytes: 62044
def main():
    s = input()
    t = input()
    ans = 1000

    for i in range(len(s)-len(t)+1):
        m = 0
        for j in range(len(t)):
            if s[i+j] != t[j]:
                m += 1

        ans = min(ans, m)

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 67284
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;

int main() {
    ll N, M;
    cin >> N >> M;

    if(N==1 and M==1){
        cout << 1 << endl;
    }
    else if(N==1){
        cout << M-2 << endl;
    }
    else if(M==1){
        cout << N-2<< endl;
    }
    else{
        cout << N*M - (2*N + 2*(M-2)) << endl;
    }
}


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

string fix(int a,int l){
	stringstream ss;
	ss << a;
	string s = ss.str();
	while(s.size() < l) s = "0" + s;
	return s;
}


int main(){
	int a;
	int L;
	while( cin >> a >> L && L){
		map<int,int> done;
		done[a] = 0;
		
		for(int i = 1 ; ; i++){
			string x = fix(a,L);
			sort(x.begin(),x.end());
			string y = x;
			reverse(y.begin(),y.end());
			int na = atoi(y.c_str()) - atoi(x.c_str());
			if( done.count(na) ){
				cout << done[na] << " " << na << " " << i - done[na] << endl;
				break;
			}else{
				done[na] = i;
				a = na;
			}
		}
	}
}

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

int cnt[100010];
int main()
{
    cin.sync_with_stdio(0);
    cin.tie(0);

    int n, m; cin>>n>>m;
    while (m--) {
        int a, b; cin>>a>>b;
        ++cnt[a];
        ++cnt[b];
    }
    bool ok=true;
    for(int i=0; i<100010; ++i)
        if (cnt[i]%2) ok=false;
    cout<<(ok ? "YES" : "NO")<<endl;
}


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

ll item[4][102];
int pt[4] = {1,1,1,1};
int main()
{
    ll n,w;
    ll w0 = 0;
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> w;
    for (int i = 1; i<=n; i++)
    {
        ll wi, vi;
        cin >> wi >> vi;
        if (i==1)
        {
            item[0][1] = vi;
            w0 = wi;
            pt[0]++;
        }
        else
        {
            item[wi-w0][pt[wi-w0]] = vi;
            pt[wi-w0]++;
        }
    }
    sort(item[0]+1, item[0]+n, greater<ll>());
    sort(item[1]+1, item[1]+n, greater<ll>());
    sort(item[2]+1, item[2]+n, greater<ll>());
    sort(item[3]+1, item[3]+n, greater<ll>());
    for (int i = 2; i<=n; i++)
    {
        item[0][i] = item[0][i-1]+item[0][i];
        item[1][i] = item[1][i-1]+item[1][i];
        item[2][i] = item[2][i-1]+item[2][i];
        item[3][i] = item[3][i-1]+item[3][i];

    }
    ll ans = 0;
    for (int a = 0; a<=n; a++)
    {
        if (a*w0>w)
            break;
        for (int b = 0; b<=n; b++)
        {
            if (a*w0 + (b*(w0+1))>w)
                break;
            for (int c = 0; c<=n; c++)
            {
                if (a*w0 + (b*(w0+1)) + c*(w0+2)>w)
                    break;
                for (int d = 0; d<=n; d++)
                {
                    if (a*w0 + (b*(w0+1)) + c*(w0+2)+d*(w0+3)>w)
                        break;
                    ans = max(ans,item[0][a]+item[1][b]+item[2][c]+item[3][d]);
                }
            }
        }
    }
    printf("%lld",ans);
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef pair<ll,P>  PP;
typedef vector<ll> Vector;
typedef vector<Vector> DVector;
typedef priority_queue<PP, vector<PP>, greater<PP>> PPQueue;

#define fi          first
#define se          second
#define sfi         se.fi
#define sse         se.se
#define pb          push_back
#define INF         INT_MAX
#define MOD         1000000007
#define bcnt        __builtin_popcount
#define all(x)      (x).begin(),(x).end()
#define uni(x)      x.erase(unique(all(x)),x.end())
#define ub(x,y)     (upper_bound(all(x),y)-x.begin())
#define lb(x,y)     (lower_bound(all(x),y)-x.begin())
#define rep(i,n)    repl(i,0,n-1)
#define usort(x)    sort(all(x))
#define dsort(x)    sort(all(x),greater<ll>())
#define mkp(x,y)    make_pair(x,y)
#define mmax(x,y)   (x>y?x:y)
#define mmin(x,y)   (x<y?x:y)
#define maxch(x,y)  x=mmax(x,y)
#define minch(x,y)  x=mmin(x,y)
#define exist(x,y)  (find(all(x),y)!=x.end())
#define each(itr,v) for(auto itr:v)
#define repl(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);i++)
int main(){
  cin.sync_with_stdio(false);
  ll n;
  cin >> n;
  Vector a(n);
  rep(i,n)cin >> a[i];
  usort(a);
  uni(a);
  cout << endl;
  cout << (a.size() % 2 == 0 ? a.size() - 1 : a.size()) << endl;
}


Measured memory_bytes: 1024
#define D(x) cout << #x " = " << x << endl
#define DD(x, y) cout << "(" #x ", " #y ") = (" << x << ", " << y << ")" << endl
#define DDD(x, y, z) cout << "(" #x ", " #y ", " #z ") = (" << x << ", " << y << ", " << z << ")" << endl
#define DV(v) for (auto __macro_vi : v){ cout << __macro_vi << " ";} cout << endl;
#define DA(a, n) for (int __macro_i = 0; __macro_i < n; ++__macro_i) { cout << a[__macro_i] << " "; } cout << endl;
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(), (v).end()
#include<iostream>
#include<vector>
#include<cassert>
#include<cmath>
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p){ os << "(" << p.first << ", " <<  p.second << ")"; return os; }

using namespace std;


void solve(long long N, long long K, std::vector<long long> h){
    int ans = 0;
    REP(i, N) {
        if (h[i] >= K) ans++;
    }
    cout << ans << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> h(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&h[i]);
    }
    solve(N, K, std::move(h));
    return 0;
}


Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
    private static Map<Integer, List<Integer>> groupMap = new HashMap<>();

    public static void main(String args[]) {
        groupMap.put(1, Arrays.asList(1, 3, 5, 7, 8, 10, 12));
        groupMap.put(2, Arrays.asList(4, 6, 9, 11));
        groupMap.put(3, Arrays.asList(2));

        Scanner sc = new Scanner(System.in);

        // 入力(X Y)
        int x = sc.nextInt();
        int y = sc.nextInt();

        System.out.println((findGroup(x) == findGroup(y)) ? "Yes" : "No");
        sc.close();
    }    

    private static int findGroup(final int value) {
        int group = 0;
        for (int k : groupMap.keySet()) {
            List<Integer> v = groupMap.get(k);
            if (v.contains(value)) {
                group = k;
                break;
            }
        }
        return group;
    }
}

Measured memory_bytes: 35520
#include <cstdio>
#define ll long long
using namespace std;
int main(){
    ll d;
    int i,n,ans=0;
    ll x,y;
    scanf("%d%lld",&n,&d);
    for(i=0;i<n;i++){
        scanf("%lld%lld",&x,&y);
        if(x*x+y*y<=d*d) ans++;
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1732
#include <algorithm>
#include <iostream>
#include <cstring>

using namespace std;

// a/b の切り上げを求める
int ceil( int a, int b )
{
    if ( ( a / b ) * b == a ) return a / b;

    return a / b + 1;
}

long pow_mod( long a, long n, long mod )
{
    if ( n == 0 ) return 1;

    if ( n & 1 )
    {
        long t = pow_mod( a, n - 1, mod );
        return ( a * t ) % mod;
    }
    else
    {
        long t = pow_mod( a, n >> 1, mod );
        return ( t * t ) % mod;
    }
}

#define MAX_N 300
#define MAX_A 300
#define MOD 998244353

// R が S/2 以上の場合を数える dp
long dp1[MAX_N + 1][MAX_N * MAX_A + 1];
// R=G=S/2 となる場合を数える dp
long dp2[MAX_N + 1][MAX_N * MAX_A + 1];

long A[MAX_N];

int main( int argc, char **argv )
{
    int N;
    cin >> N;

    long S = 0;
    for ( int n = 0; n < N; n++ )
    {
        cin >> A[n];
        S += A[n];
    }

    memset( dp1, 0, sizeof( dp1 ) );
    memset( dp2, 0, sizeof( dp2 ) );

    dp1[0][0] = dp2[0][0] = 1;

    long limit = ceil( S, 2 );

    for ( int n = 0; n < N; n++ )
    {
        long a = A[n];
        for ( int r = 0; r <= limit; r++ )
        {
            // R を使わない場合
            // R >= S/2 を求める時は、R で使わないものは B/G の二通り
            // あるので x2
            dp1[n + 1][r] = ( dp1[n + 1][r] + 2 * dp1[n][r] ) % MOD;
            // R=G=S/2 を求める時は、R で使わないものは全部 G にするので
            // x1
            dp2[n + 1][r] = ( dp2[n + 1][r] + 1 * dp2[n][r] ) % MOD;

            if ( limit < r + a )
            {
                // S/2 を超えるものをカウントするのは R >= S/2 を求める時だけ。
                // R=G=S/2 の場合は S/2 を超えるものは必要ない
                dp1[n + 1][limit] = ( dp1[n + 1][limit] + dp1[n][r] ) % MOD;
            }
            else
            {
                // 今回の a を利用して S/2 以下になるものをカウントする
                dp1[n + 1][r + a] = ( dp1[n + 1][r + a] + dp1[n][r] ) % MOD;
                dp2[n + 1][r + a] = ( dp2[n + 1][r + a] + dp2[n][r] ) % MOD;
            }
        }
    }

    // 全ての塗り方は 3^N 通り。そこから R/G/B のどれかが S/2
    // 以上になる場合を引く。 dp1 は R が S/2 以上になる場合だが、G, B
    // も同じ通りあるので、x3 している。
    long ans = ( pow_mod( 3, N, MOD ) - 3 * dp1[N][limit] ) % MOD;

    if ( ans < 0 ) ans = ( ans + MOD ) % MOD;

    // S が 2 の倍数の時だけ (R,G,B) = (S/2,S/2,0) (S/2,0,S/2) (0,S/2,S/2)
    // となる可能性があり、これは上の 3*dp1[N][limit] でそれぞれ一回ずつ重複して
    // 覗かれている。つまり、(R,G,B) = (S/2,S/2,0) となる場合 (dp2[N][limit]x3)
    // だけ無駄に取り除かれているのでそれを補正する。
    if ( S % 2 == 0 ) ans = ( ans + 3 * dp2[N][limit] ) % MOD;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 423552
#include<iostream>
using namespace std;
int main(){
    int N;
    cin >> N;
    int H[N];
    for(int i  = 0; i < N; ++i) cin >> H[i];
    int max = 0;
    int count;
    for(int i = 0; i < N; ++i){
        if(i == 0){
            count = 1;
            max = H[i];
        }
        else{
            if(H[i] >= max){
                max = H[i];
                count++;
            }
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 256
import random
import math

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

def frontCounter(n, k):
	count = 0
	if n >= k:
		return count
	current = n
	while True:
		count += 1
		current = current * 2
		if current >= k:
			return count

probe = 0
for n in range(1, N + 1):
	probe += (1 / N) * math.pow(0.5, frontCounter(n, K))
print(probe)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp> 
// using namespace boost::multiprecision;
// #define int cpp_int
using namespace std;

#define fastio 			ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define int 			long long
#define ll 				long long
#define ld 				long double
#define vi 				vector<int>
#define pii 			pair<int,int>
#define vpii 			vector< pair<int,int> >
#define uset			unordered_set
#define umap 			unordered_map
#define maxpq 			priority_queue<int>
#define minpq			priority_queue<int,vi,greater<int>()>

#define all(v) 			v.begin(),v.end()
#define part(v,s,e)		v.begin()+s,v.begin()+e
#define rev(v)			reverse(v.begin(),v.end())
#define sz(x)			(int)x.size()
#define def(v)			memset(v,-1,sizeof(v));
#define def0(v)			memset(v,0,sizeof(v));
#define minv(a)			*min_element(all(a))
#define maxv(a)			*max_element(all(a))
#define sumv(a)			accumulate(all(a),0)

#define	lb				lower_bound
#define	ub				upper_bound
#define	desc			greater<int>()
#define	pb				emplace_back
#define	mp				make_pair
#define	F				first
#define	S				second

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";

#define gcd(a,b)		__gcd(a,b)
#define lcm(a,b)		(a/(__gcd(a,b)))*b

#define setbits(x) 		__builtin_popcountll(x)
#define zerobits(x)		__builtin_ctzll(x)

#define ip(v)	 		for(auto& i:v)	cin>>i;
#define op(v) 			for(auto i:v)	cout<<i<<" ";cout<<endl;
#define deb(x) 			cout <<"Value of " #x << " : " << x << endl;



void solve()
{	

	int n,k;
	cin>>n>>k;

	int a[n];
	ip(a);

	int ans=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]>=k)
			ans++;
	}

	cout<<ans<<endl;

}	

int32_t main()
{

	fastio
	cout<<setprecision(15)<<fixed;



	int t=1;
	// cin>>t;
	
	for(int i=1;i<=t;i++)
	{
		// cout<<"Case "<<i<<" : "<<endl;
		solve();
	}
	
	#ifndef ONLINE_JUDGE	
		cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl;
	#endif

	return 0;
}

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


MOD = 10**9+7
Facts = [1]*(2*10**5+1)
for i in range(2,2*10**5+1):
  Facts[i] = (Facts[i-1]*i) % MOD

def mul(a,b):
  return (a*b) % MOD

def power(a,b):
  if   b==0   : return 1
  elif b==1   : return a % MOD
  elif b%2==0 : return power(a,b//2)**2 % MOD
  else        : return power(a,b//2)**2 * a % MOD

def div(a,b):
  return mul(a,power(b,MOD-2))


def combi(n,m,k):
  if k <= 2 or k >= n*m:
    return 1
  else:
    return div(Facts[n*m-2],(Facts[k-2]*Facts[n*m-k]))


def main():
  N,M,K = map(int, input().split())
  com = combi(N,M,K)
  ans = 0
  for d in range(1,N):
    ans = (ans + d * (N-d)*M**2 * com) % MOD
  for d in range(1,M):
    ans = (ans + d * (M-d)*N**2 * com) % MOD
  return ans

if __name__ == "__main__":
  print(main())

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

// マクロ //
#define rep(i,N) for(int i = 0; i < N; i++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) (x) * (x)
#define pi acos(-1)
// 型エイリアス //
using lint = long long;
using vi = vector<int>;
using vli = vector<lint>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using msi = map<string, int>;

// 関数 //
int gcd(int a, int b) {
    int t;
    while (b != 0) {
        t = a % b;
        a = b;
        b = t;
    }
    return a;
}

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

double distance(pii a, pii b) {
    double dist;
    dist = sqrt(x2(a.first - b.first) + x2(a.second - b.second));
    return dist;
}

lint perm(int a) {
    lint perm = 1;
    for (int i = a; i >= 1; i--) {
        perm *= i;
    }
    return perm;
}

lint comb(int n, int m) {
    return perm(n) / (perm(n - m) * perm(m));
}

// End of Template //



int main() {

    double a, b, x;
    cin >> a >> b >> x;


    if (acos(a / sqrt(a * a + x2((2 * b - ((2 * x) / (a * a)))))) < atan(b / a)) {
        cou(fixed << setprecision(7) << acos(a / sqrt(a * a + x2((2 * b - ((2 * x) / (a * a)))))) * 180 / pi);
    }
    else {
        cou(fixed << setprecision(7) << 90 - asin(((2 * x) / (a * b)) / (sqrt(b * b + x2(((2 * x) / (a * b)))))) * 180 / pi);
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;
    vector<int> t(N + 1), x(N + 1), y(N + 1);
    rep(i, N) cin >> t[i + 1] >> x[i + 1] >> y[i + 1];
    repd(i, 1, N + 1) {
        int ti = t[i] - t[i - 1];
        int dis = abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]);
        if (ti % 2 != dis % 2 || ti < dis) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 1408
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
def resolve():
    N = ir()
    ans = len(make_divisors(N-1))-1
    d = make_divisors(N)
    d.remove(1)
    for i in d:
        tmp = N
        while tmp != 1 and tmp >= i:
            if tmp%i > 0:
                tmp %= i
            else:
                tmp //= i
        if tmp == 1:
            ans += 1
    print(ans)
resolve()

Measured memory_bytes: 39408
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <vector>
#define itn int
#define reaD read
#define N 15
using namespace std;

long long num[N][N], p[N], n, ans;
string s; 

template < typename T > 
inline T read()
{
	T x = 0, w = 1; char c = getchar();
	while(c < '0' || c > '9') { if (c == '-') w = -1; c = getchar(); }
	while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	return x * w;
}

int main()
{
	cin>>s;
	n = s.size();
	for(int i = 0; i < n; i++)
		num[i + 1][i + 1] = s[i] - '0';
	for(int i = 0; i <= n; i++)
		p[i] = !i ? 1 : p[i - 1] * 2;
	for(int i = 1; i <= n; i++)
		for(int j = i + 1; j <= n; j++)
			num[i][j] = num[i][j - 1] * 10 + num[j][j];
	for(int i = 1; i <= n; i++)
		for(int j = i; j <= n; j++)
		{
			long long l = 1, r = 1;
			if(i - 2 >= 0)
				l = p[i - 2];
			if(n - j - 1 >= 0)
				r = p[n - j - 1];
			ans += num[i][j] * l * r; 
		}
	printf("%lld\n", ans); 
	return 0;
}


Measured memory_bytes: 256
N=input()
D=int(input())

s = len(N)
mod=10**9+7
#[2][D][s]
dp=[[[0]*(s+1) for i in range(D)] for i in range(2)]
dp[0][0][0]=1
for i in range(s):
    for j in range(D):
        for k in range(10):
            dp[1][(j+k)%D][i+1]+=dp[1][j][i]
            dp[1][(j+k)%D][i+1]%=mod
        for k in range(int(N[i])):
            dp[1][(j+k)%D][i+1]+=dp[0][j][i]
            dp[1][(j+k)%D][i+1]%=mod
        dp[0][(j+int(N[i]))%D][i+1]+=dp[0][j][i]
        dp[0][(j+int(N[i]))%D][i+1]%=mod
print((dp[0][0][s]+dp[1][0][s]-1)%mod)


Measured memory_bytes: 59612
#include <iostream>
#include <cstdlib>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin >> n;
    int sum = 0;
    int dissum[100002];
    int p[100002];
    p[0] = 0;
    p[n+1] = 0;
    for(int i=1;i<=n;i++){
        cin >> p[i];   
    }
    for(int i=1;i<=n+1;i++){
        sum += abs(p[i] - p[i-1]);
        //cout << sum << endl;
    }
    for(int i=1;i<=n;i++){
        dissum[i] = abs(p[i] - p[i-1]) + abs(p[i+1] - p[i]) - abs(p[i-1] - p[i+1]); 
        //cout << dissum[i] << endl;
    }

    for(int i=1;i<=n;i++){
        cout << sum-dissum[i] << endl;
    }
    
}


Measured memory_bytes: 2048
MOD = 1000000007


def main():
    n, m = map(int, input().split())
    if abs(n - m) > 1:
        print(0)
        return

    res = 2 if abs(n - m) == 0 else 1
    for i in range(2, n + 1):
        res = (res * i) % MOD
    for i in range(2, m + 1):
        res = (res * i) % MOD
    print(res)


if __name__ == '__main__':
    main()


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

int main(){
  int a[100];
  int n;
  cin >> n;
  for (int i = 0; i < 100; i++){
    a[i] = 0;
  }
  for (int i = 0; i < n; i++){
    int k;
    scanf("%d", &k);
    a[k-1]++;
  }
  int count = 0;
  for (int i = 0; i < 100; i++){
    if (a[i] > 0) count++;
  }
  printf("%d\n", count);
  return 0;
}


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

public class Main {

	final static long MOD = 1000000007;
	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		long N = Long.parseLong(W);

		W = in.readLine();
		String[] Ws = W.split(" ");

		int[] A = new int[100001];
		Arrays.fill(A, 0);
		for (int i = 0; i < Ws.length; i++) {
			int x = Integer.parseInt(Ws[i]);
			A[x]++;
		}
		long ans = 0;
		long tmp = 0;
		for(int i=0;i<A.length;i++){
			if(i<3){
				ans+=A[i];
				tmp+=A[i];
			}else{
				tmp=tmp-A[i-3]+A[i];
				ans = Math.max(ans, tmp);
			}


		}

		System.out.println(ans);


	}
}


Measured memory_bytes: 35540
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

int n, m, a, b;
vector<bool> visited(8, false);
vector<vector<int>> graph(8);

int dfs(int cur) {
    visited[cur] = true;

    bool all_visited = true;
    for (int i = 0; i < n; i++) {
        if (!visited[i]) {
            all_visited = false;
        }
    }
    
    if (all_visited) {
        visited[cur] = false;
        return 1;
    }

    int ans = 0;
    for (int ch : graph[cur]) {
        if (visited[ch]) continue;
        ans += dfs(ch);
    }

    visited[cur] = false;
    return ans;
}

int main() {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        a--; b--;
        graph[a].push_back(b);
        graph[b].push_back(a);
    }
    
    cout << dfs(0) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
/*
g++ -std=c++11 -Wall -g -fsanitize=undefined -D_GLIBCXX_DEBUG arc/arc098/c.cpp
*/
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define SZ(x) ((int)(x).size())
#define INF (1e16)
typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);//おまじないでcin, cout早くする
    int n;
    string s;
    cin >> n;
    cin >> s;

    int cnt_r[n];//i番目より左に要るヒトで右向いてるヒトの人数
    int cnt_l[n];//i番目より右に要るヒトで左向いてるヒトの人数

    cnt_r[0] = 0;
    for(int i = 1; i < n; i++){
        if(s[i-1] == 'E') cnt_r[i] = cnt_r[i-1] + 1;
        else cnt_r[i] =  cnt_r[i-1];
    }
    cnt_l[n-1] = 0;
    for(int i = n - 2; i >= 0; i--){
        if(s[i+1] == 'W') cnt_l[i] = cnt_l[i+1] + 1;
        else cnt_l[i] = cnt_l[i+1];
    }

    ll ans = -1;
    for(int i = 0; i < n; i++){
        if(cnt_l[i] + cnt_r[i] > ans){
            ans = cnt_l[i] + cnt_r[i];
        }
    }

    cout << n - ans - 1 << "\n";
    return 0;
}

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

int main() {
	char C;
	cin >> C;
    printf("%c\n", C+1);
}

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

using namespace std;
#define inf             0x3f3f3f3f
#define INF             2e18
#define eps             1e-9

#define FastRead        ios_base::sync_with_stdio(0);cin.tie(0)
#define fRead           freopen("input.txt","r",stdin)
#define fWrite          freopen("output.txt","w",stdout)

#define LL              long long
#define ull            unsigned long long
#define PI              acos(-1.0)
#define pb              push_back
#define mk              make_pair
#define pii             pair<int,int>
#define pLL             pair<LL,LL>
#define ff              first
#define ss              second
#define all(a)          a.begin(),a.end()
#define SQR(a)          ((a)*(a))
#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(min(a,b),min(c,d))
#define max4(a,b,c,d)   max(max(a,b),max(c,d))
#define max5(a,b,c,d,e) max(max3(a,b,c),max(d,e))
#define min5(a,b,c,d,e) min(min3(a,b,c),min(d,e))
#define vi              vector <int>
#define vL              vector <LL>
#define LB(a,x)         (lower_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which does not compare less than val.
#define UB(a,x)         (upper_bound(all(a),x)-a.begin()) //  first element in the range [first,last) which compares greater than val.
#define prec(n)         fixed << setprecision(n)

#define MEM(a,x)        memset(a,x,sizeof(a))
#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())
#define Unique(a)       sort(all(a)),a.erase(unique(all(a)),a.end())

#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define IT(it,x)	    for(it=x.begin();it!=x.end();it++)
int main()
{
    char ch;
    cin>>ch;
    if( ch>='A' and ch <='Z')
        cout<<'A';
    else
        cout<<'a';

}


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

#define zton(i,n) for(int i=0;i<=n;i++)
#define oneton(i,n) for(int i=1;i<=n;i++)
#define fo(i,n) for(int i=0;i<n;i++)
#define fab(i,a,b) for(int i=a;i<b;i++)
#define loop(i,b,a) for(int i=a;i>=b;i--)
#define dsort(arr,n) sort(arr, arr + n, greater<int>())
#define vsortd(a) sort(a.begin(), a.end(), greater<double>())
#define vsort(a) sort(a.begin(), a.end())
#define ll long long int
#define test int tc;cin>>tc;while(tc--)
#define dbg(x) cout<<#x<<'='<<(x)<<endl;
#define dbg2(x,y) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl;
#define dbg3(x,y,z) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl<<#z<<"="<<(z)<<endl;
#define dbg4(x,y,z,w) cout<<#x<<'='<<(x)<<endl<<#y<<'='<<(y)<<endl<<#z<<"="<<(z)<<endl<<#w<<"="<<(w)<<endl;
#define minheap priority_queue <int, vector<int>, greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define mpr make_pair
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define mkv vector<int>
#define allzero(dp) memset(dp,0,sizeof(dp))
#define endl "\n"
#define print(x) cout<<x<<endl;

const int mod=1e9+7;
using namespace std;
bool sortcol( const vector<int>& v1,const vector<int>& v2 ) {return v1[1] < v2[1];}

void fastio()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

bool compare(const pair<ll,ll> &a,const pair<ll,ll> &b){
    if(a.first>b.first)return true;
    if(a.first==b.first)return a.second<b.second;
    return false;
}

ll power(ll x, ll y){
    ll res = 1;x=x%mod;
    while(y>0){
        if(y&1)res=(res*x)%mod;
        y=y>>1;x=(x*x)%mod;}
    return res;
}

mkv vin(int n){
    mkv v;
    fo(i,n){
        int t;cin>>t;v.pb(t);
    }
    return v;
}

vector<int>ch;
void solve()
{
    int n;cin>>n;
    ll a[n];fo(i,n)cin>>a[i];
    ll mx=a[0];
    ll ans=0;
    fo(i,n){
        ans+=max((ll)0,(mx-a[i]));
        mx=max(mx,a[i]);

    }
    print(ans)
}

int main()
{
  //  fastio();
   // test
    solve();
}


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

int main(void){
    int n, a[11][11], i, j ;
    cin >> n;
    
    while(n != 0){
        //初期化
        for(i=0; i<=10; i++){
            for(j=0; j<=10; j++){
                a[i][j]=0;
            }
        }
        
        for(i=0; i<n; i++){
            for(j=0; j<n; j++){
                cin >> a[i][j];
                a[i][n] += a[i][j];
                a[n][j] += a[i][j];
                cout << setw(5) << a[i][j];
            }
            a[n][n] += a[i][n];
            cout << setw(5) << a[i][n] << endl;
        }
        for(j=0; j<=n; j++){
            cout << setw(5) << a[n][j];
        }
        cout << endl;
        cin >> n;
    }
    return 0;
}



Measured memory_bytes: 3088
using System;
using System.Text;
using System.Collections.Generic;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string[] str = Console.ReadLine().Split(' ');
        string s = Console.ReadLine();
        int N = int.Parse(str[0]);
        int[] R = new int[N];
        {
            int M = int.Parse(str[1]);
            int l = 0;
            int r = 0;
            for(int i=0;i<M;i++){
                str = Console.ReadLine().Split(' ');
                int a = int.Parse(str[0])-1;
                int b = int.Parse(str[1])-1;
                if(l != a){
                    for(int j=l;j<a;j++){
                        R[j] = Math.Max(r,j);
                    }
                    l = a;
                }
                r = Math.Max(r,b);
            }
            for(int j=l;j<N;j++){
                R[j] = Math.Max(r,j);
            }
        }
        int[] one = new int[N];
        one[0] = s[0] == '1' ? 1 : 0;
        for(int i=1;i<N;i++){
            one[i] = one[i-1] + (s[i] == '1' ? 1 : 0);
        }
        int C = one[N-1];
        long[,] dp = new long[N,C+1];
        dp[N-1,C] = 1;
        for(int i=C-1;i>=0;i--){
            dp[N-1,i] = 0;
        }
        for(int i=N-2;i>=0;i--){
            for(int j=0;j<C;j++){
                dp[i,j] = (one[R[i]] >= j && (R[i] + 1 - one[R[i]] >= i + 1 - j) && i+1 >= j) ? (dp[i+1,j] + dp[i+1,j+1]) % Define.mod : 0; 
            }
            dp[i,C] = (one[R[i]] >= C && (R[i] + 1 - one[R[i]] >= i + 1 - C) && i+1 >= C) ? dp[i+1,C] : 0;
        }
        sb.Append((C != 0 ? (dp[0,0] + dp[0,1])%Define.mod : dp[0,0])+"\n");
    }
}
public static class Define{
    public const long mod = 1000000007;
}

Measured memory_bytes: 40152
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

p = 0

for a,b in zip(A,B) :
    if a < b :
        if (b-a) % 2 == 0 :
            p += b-a
        else :
            p += b-a-1
    else :
        p -= (a-b)*2

if p >= 0 :
    ans = "Yes"
else :
    ans = "No"

print(ans)


Measured memory_bytes: 4596
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

using ll = long long int;
using ha = pair<ll, ll>;
struct RollingHash {
	static const ll mul0 = 10009, mul1 = 10007;
	static const ll add0 = 1000010007, add1 = 1003333331;
	size_t len;
	//vector<ll> hash_, hash2_;
	vector<ha>hash_;
	//static vector<ll> pmo_, pmo2_;
	static vector<ha>pmo_;
	void init(const vector<ll>& s) {
		len = s.size();
		hash_.resize(len + 1);
		hash_[0] = make_pair(0, 0);

		if (pmo_.empty()) {
			pmo_.push_back(make_pair(1, 1));
		}
		while (pmo_.size() <= len) {
			pmo_.push_back(make_pair(pmo_.back().first*mul0, pmo_.back().second*mul1));
		}
		for (unsigned int i = 0; i < len; ++i) {
			hash_[i + 1] = make_pair((hash_[i].first * mul0 + s[i]), (hash_[i].second*mul1 + s[i]));
		}
		return;
	}
	void init(const string& s) {
		vector<ll>v;
		for (char c : s) {
			v.push_back(c);
		}
		init(v);
	}
	ha hash(const int l, const int r)const { // s[l..r]
		return make_pair(hash_[r + 1].first - hash_[l].first * pmo_[r + 1 - l].first,
			hash_[r + 1].second - hash_[l].second * pmo_[r + 1 - l].second);
	}
	ha  hash()const { // s[all]
		return hash(0, len - 1);
	}

	//hash????????????
	static ha concat(const ha L, const ha R, const int RLength) { // hash(L+R) 
		return make_pair((R.first + L.first*pmo_[RLength].first), (R.second + L.second*pmo_[RLength].second));
	}

	//index????????????from??????to????????????????????????????????\????????????
	ha get_changed_hash(const int index, const ll from, const ll to)const {
		const ha p(hash());
		return make_pair(
			p.first + (to - from) * pmo_[len - index - 1].first,
			p.second + (to - from) * pmo_[len - index - 1].second);
	}
};
vector<ha> RollingHash::pmo_;

int main() {
	string st; cin >> st;
	RollingHash rh;
	rh.init(st);
	pair<int, int>ans=make_pair(0,0);
	for (int a = st.size() / 3; a > 0; --a) {
		if ((st.size() - a * 3) % 2)continue;
		else {
			int b = (st.size() - a * 3) / 2;
			if (b) {
				ha h0 = rh.hash(0, a - 1);
				ha h1 = rh.hash(a, a + b - 1);
				ha h2 = rh.hash(a + b, 2 * a + b - 1);
				ha h3 = rh.hash(2 * a + b, 2 * a + 2 * b - 1);
				ha h4 = rh.hash(2 * a + 2 * b, 3 * a + 2 * b - 1);
				if (h0 == h2&&h2 == h4&&h1 == h3) {
					ans = make_pair(a, b);
					break;
				}
			}
			
		}
	}
	if (ans.first) {
		assert(ans.second);
		cout << "Love " << st.substr(0, ans.first) << st.substr(ans.first, ans.second) << "!" << endl;
	}
	else {
		cout << "mitomerarenaiWA" << endl;
	}
	return 0;
}

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


public class Main {

	public static void main(String[] args) {

    	Scanner parameter = new Scanner(System.in);

    	String[] line1 = parameter.nextLine().split(" ");
        String[] line2 = parameter.nextLine().split(" ");

        double[] doubleNumber = new double[line2.length];

        for (int i = 0; i < line2.length; i++) {

        	doubleNumber[i] = Integer.parseInt(line2[i]);
        }

        Arrays.sort(doubleNumber);

        if (doubleNumber.length == 1) {

        	System.out.println(doubleNumber[0]);
        } else {

        	for (int i = 0; i < doubleNumber.length; i++) {

        		if (i < doubleNumber.length - 1) {

        			doubleNumber[i+1] = (doubleNumber[i] + doubleNumber[i+1]) / 2;
        		} else {

        			System.out.println(doubleNumber[doubleNumber.length - 1]);
        		}
            }
        }
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

template<typename T>
using ordered_set=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define ll long long
#define ull unsigned long long
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define inf 1000000000000000000
#define iinf -1000000000000000000
#define __   ios_base::sync_with_stdio(0);cin.tie();cout.tie();
#define mod 1000000007
#define base 1949313259
#define en '\n'

ll Set(ll N,ll pos){ return N=N | (1LL<<pos); }
ll reset(ll N,ll pos){ return N= N & ~(1LL<<pos); }
bool check(ll N,ll pos){ return (bool)(N & (1LL<<pos)); }

ll ar[]={0,0,1,-1};
ll br[]={1,-1,0,0};

ll bigmod(ll n,ll pow){
if(pow==0) return 1;
if(pow==1) return n%mod;

ll ans=bigmod(n,pow/2);
ans=(ans*ans)%mod;

if(pow%2==1){ans=(ans*n)%mod;}
return ans%mod;
}

ll fact[1000005];

ll nCr(ll n,ll r){

ll ans=fact[n];
ans=(ans*bigmod(fact[r],mod-2))%mod;
ans=(ans*bigmod(fact[n-r],mod-2))%mod;
return ans;
}

string s,s1,s2;
ll n,m;
ll arr[500010];
ll brr[500010];
vector<ll>v,v1;

map<ll,ll>mp;
ll vis[500005];

int main()
{__
        ll i,j,a,b,c,d,e,f,g,x,y,z,t,k,l,r;
        fact[0]=1;

      //  for(i=1;i<=1000000;i++) fact[i]=(fact[i-1]*i)%mod;
        ll ans=0,sum=0,temp;
        cin>>n;

        while(n!=0){
            if(n%26!=0){
            s.push_back('a'+n%26-1);
            n/=26;}
            else{
                s.push_back('z');
                n-=26;
                n/=26;
            }
        }

        reverse(s.begin(),s.end());
        cout<<s<<endl;
}




Measured memory_bytes: 3656
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
      }
  }

#[fastout]
fn main() {
    input!{
        n: usize,
    }

    let mut cnt = 0;
    let mut ans = 0;
    for j in 1..n+1 {
        if j%2==0 {
            continue;
        } else {
            for i in 1..n+1 {
                if j%i==0 {
                    cnt += 1;
                }
            }
            if cnt==8 {
                ans += 1;
            }
            cnt = 0;
        }
    }

    println!("{}", ans);

}


Measured memory_bytes: 2188
#include<stdio.h>
#define MAX 2000000
int H , A[MAX+1];
void maxHeapify(int i){
	int l,r,largest;
	l = 2 * i;
	r = 2 * i + 1;
	int dmp = 0;
	if(l <= H && A[l] > A[i]){
		largest = l;
	}
	else {
		largest = i;
	}
	if(r <= H && A[r] > A[largest]){
		largest = r;
	}
	
	if(largest != i){
		
		dmp = A[i];
		A[i] = A[largest];
		A[largest] = dmp;
		maxHeapify(largest);
	}
}

int main (){
	scanf("%d",&H);
	for(int i = 1;i <= H;i++){
		scanf("%d",&A[i]);
	}
	for(int i = H/2;i >= 1;i--){
		maxHeapify(i);
	}
	for(int i = 1;i <= H;i++){
		printf(" %d",A[i]);
	}
	printf("\n");
	return 0;
}



Measured memory_bytes: 3660
# -*- coding: utf-8 -*-

N = int(input())
count = [0] * 5
for i in range(N):
    tmp = input()
    if tmp[0] == "M":
        count[0] += 1
    if tmp[0] == "A":
        count[1] += 1
    if tmp[0] == "R":
        count[2] += 1
    if tmp[0] == "C":
        count[3] += 1
    if tmp[0] == "H":
        count[4] += 1

ans = 0
for i in range(0, 3):
    for j in range(i+1, 4):
        for k in range(j+1, 5):
            ans += count[i]*count[j]*count[k]

print(ans)


Measured memory_bytes: 8940
while True:
    #標準入力、両方0だった場合終わる
    a,b = map(int,input().split())
    if a == 0 and b == 0:break
    else:
        kei = 0
        #全パターンを試す
        for num1 in range(1,a + 1):
            for num2 in range(1,a + 1):
                for num3 in range(1,a + 1):
                    #文字がかぶっている場合を除く
                    if num1 + num2 + num3 == b:
                        if num1 == num2 or num1 == num3 or num2 == num3:pass
                        else:kei += 1
                    else:pass
        #同じ組み合わせの組が6こできるから割る6して出力
        print(int(kei / 6))


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

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl





using ll = long long;

const ll mod = 1e9+7;
const int maxn = 1e3;


int n,m,q;
int a[maxn],b[maxn],c[maxn],d[maxn];
int best;
int arr[maxn];


int eval() {
    int cur=0;
    for (int i=0; i<q; i++) {
	if (arr[b[i]]-arr[a[i]]==c[i]) cur+=d[i];
    }
    return cur;
}

void dfs(int i, int lo) {
    if (i==n) {
	best=max(best,eval());
    } else {
	for (int v=lo; v<=m; v++) {
	    arr[i]=v;
	    dfs(i+1,v);
	}
    }
}

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

    cin>>n>>m>>q;
    for (int i=0; i<q; i++) {
	cin>>a[i]>>b[i]>>c[i]>>d[i];
	a[i]--;
	b[i]--;
    }


    dfs(0,1);
    cout<<best<<endl;    
    return 0;
}


Measured memory_bytes: 3688