akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("-Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//#pragma GCC target("avx2")  //Enable AVX
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//order_of_key(x) : number of items less than x
//find_by_order(x) : iterator to x

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()

const ld pi=3.14159265359;
ll INF=1e18+10;
ll MOD=998244353;
ll mod=1e9+7;

inline ll add(ll a,ll b,ll m){
    if(a+b>m)return (a+b)-m;
    return a+b;
}

inline ll mul(ll a,ll b,ll m){
    if((a*b)<m)return a*b;
    return (a*b)%m;
}

int main()
{
    ll n;cin>>n;
    ll ans=1000*(n/500);
    n%=500;
    ans+=(5*(n/5));
    cout<<ans;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static const ll INF = 1LL << 50;
using namespace std;

int main(){
	string s;
	map<int,int>mp;
	cin>>s;
	rep(i,s.size()){
		mp[(int)(s[i]-'0')]++;
	}
	bool judge=true;
	rep(i,mp.size()){
		if(mp[i]%2!=0)judge=false;
	}
	if(judge)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
 
using namespace std;
 
int main() {
  int N;
  cin >> N;
  vector<unsigned> A(N);
  for(int i = 0; i < N; i++) cin >> A[i];
  
  long long ans = 0;
  unsigned x = 0;
  for(int l = 0, r = 0; l < N; l++) {
    while(r < N && (x & A[r]) == 0) {
      x ^= A[r];
      r++;
    }
    ans += r - l;
    x = x & (~A[l]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <map>
#include <iterator>
#include <functional>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <list>
#include <sstream>
#include <cstring>
#include <stdio.h>
#include <complex>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

typedef long double LD;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<LD, LD> PDD;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<char> VCH;
typedef vector<LD> VLD;
typedef vector<string> VS;
typedef vector<VS> VSS;
typedef vector<VI> VVI;
typedef vector<VLL> VVLL;
typedef vector<VCH> VVCH;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<PDD> VPDD;
#define MP make_pair
#define PB push_back
#define X first
#define Y second
#define next fake_next
#define prev fake_prev
#define left fake_left
#define right fake_right

#define FOR(i, a, b) for(LL i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define REP(i, t) FOR(i, 0, t)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))

const LD PI = acos(-1.0);
const LD EPS = 1e-9;
const LL INF = 1e9;
const LL LINF = 1e18;
const LL mod = 1000000007;
const LL MAXN = 3e5 + 47;
const int MAX = 45;

LL n, a, b;
LL s[MAXN];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	
	cin >> n >> a >> b;		
	if (a + b - 1 > n || a * b < n)
		cout << -1;
	else
	{
		LL len = 0;
		LL curr = 1;
		LL left = n - a;
		FOR(i, 1, a + 1)
		{
			int k = min(left, b - 1);
			left -= k;
			k++;
			curr += k;
			RFOR(j, curr, curr - k)			
				s[len++] = j;
		}

		FOR(i, 0, len)
			cout << s[i] << " ";
	}
		
	cin >> n;
	return 0;
}

Measured memory_bytes: 4608
#include <iostream>
#include <cassert>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
#define curr(P, i) P[i]
#define next(P, i) P[(i+1)%P.size()]
typedef complex<double> P;
typedef long long int Int;
const Int N = 3;
const double EPS = 1e-8;

struct L : public vector<P> {
  L(){}
  L(const P &a, const P &b) {
    push_back(a); push_back(b);
  }
};
typedef vector<P> G;

double cross(const P& a, const P& b) { return imag(conj(a)*b); }
double dot(const P& a, const P& b) { return real(conj(a)*b); }

Int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

bool intersectSS(const L &s, const L &t) {
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
    ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}

pair<bool, P> crosspointLL(const L &l, const L &m) {
  double A = cross(l[1] - l[0], m[1] - m[0]);
  double B = cross(l[1] - l[0], l[1] - m[0]);
  if (abs(A) < EPS && abs(B) < EPS) return pair<bool, P>(0, m[0]); // same line
  if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
  return pair<bool, P>(1, m[0] + B / A * (m[1] - m[0]));
}

bool input(L &l){
  Int x1, y1, x2, y2; cin >>x1 >>y1 >>x2 >>y2;
  l = L(P(x1, y1), P(x2, y2));
  return (x1 != 0 || y1 != 0 || x2 != 0 || y2 != 0);
}

double area(const G &P) {
  double A = 0.0;
  for (Int i = 0; i < P.size(); ++i) A += cross(curr(P, i), next(P, i));
  return abs(A / 2.0);
}

string solve(L ls[N]){
  G g;
  REP(i, N){
    if(!intersectSS(ls[i], ls[(i + 1) % N])) continue;
    else{
      pair<bool, P> res = crosspointLL(ls[i], ls[(i + 1) % N]);
      if(res.first) g.push_back(res.second);
    }
  }
  double r = area(g);
  if(g.size() < 3 || r <= 0) return "kyo";
  if(r < 100000) return "syo-kichi";
  if(r < 1000000) return "kichi";
  if(r < 1900000) return "chu-kichi";
  return "dai-kichi";
}

int main() {
  L ls[N];
  while(input(ls[0])){
    FOR(i, 1, N) input(ls[i]);
    cout <<solve(ls) <<endl;
  }
  return 0;
}

Measured memory_bytes: 1216
#include<bits/stdc++.h>
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define F(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
#define VE(i,v) for(int i = 0;i < (v).size();i++)

using namespace std;
#define trace(...) cerr<<__FUNCTION__<<":"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cerr<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	const char *comma=strchr(names+1,',');
	cerr.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef long long ll;
typedef unsigned int ui;
typedef vector<ll> vl; 
typedef vector<vl> vvl; 
typedef pair<ll,ll> pll;
typedef vector<pll> vpll; 
 



int main()

{
	std::ios::sync_with_stdio(false);
	cin.tie(NULL);
	int T;
	T=1;

	for(int tc=1; tc<=T;tc++)
	{
		int N;
		cin >> N; 
		vector<double> arr(N);
		for(int i =0; i < N;i++)
			cin >> arr[i];
		vector<vector<double> > dp(N+1, vector<double>(N,0.0));
		dp[0][0] = 1-arr[0];
		dp[1][0] = arr[0];
		for(int i =1; i < N; i++)
			dp[0][i] = dp[0][i-1] * (1-arr[i]);
		for(int i = 1; i < N; i++)
		{
			for(int j = 1; j <=i+1; j++)
			{
				dp[j][i] = dp[j][i-1] * (1-arr[i]) + dp[j-1][i-1]*arr[i];
				//trace(i,j,dp[j][i]);
			}
		}
		double ans = 0.0;
		for(int i = N/2+1; i <=N; i++)
		{
			//trace(i, dp[i][N-1]);
			ans += dp[i][N-1];
		}

		


			
		
		cout<<setprecision(10)<<fixed<<ans<<"\n";
	}
 
 
 
	return 0;
}
 
 



Measured memory_bytes: 70656
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus < 201703L
#        pragma GCC target("avx")
#    else
#        pragma GCC target("avx2")
#    endif

#endif

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <random>
#define dump(x) cout << x << endl
typedef int64_t Int;
typedef long double Ld;

using namespace std;
using Graph = vector<vector<Int>>;

const Ld pi = M_PI;
const Int MOD = 1000000007;
const Int INF = 1LL << 61;

Int Floor(Int a, Int b) {
    return (a - (a % b)) / b;
}

const Int alp = 26;

Int compute_score(Int &D, vector<vector<Int>> &s, vector<Int> &c, vector<Int> &out) {
    Int score = 0;
    vector<Int> last(alp, 0);

    Int count = out.size();
    for (Int d = 0; d < count; d++) {
        last[out[d]] = d + 1;

        for (Int i = 0; i < alp; i++) {
            score -= (d + 1 - last[i]) * c[i];
        }
        score += s[d][out[d]];
    }

    return score;
}

Int evaluate(Int &D, vector<vector<Int>> &s, vector<Int> &c, vector<Int> &out, Int &k) {
    Int score = 0;
    vector<Int> last(alp, 0);

    Int count = out.size();
    for (Int d = 0; d < count; d++) {
        last[out[d]] = d + 1;

        for (Int i = 0; i < alp; i++) {
            score -= (d + 1 - last[i]) * c[i];
        }
        score += s[d][out[d]];
    }

    count = min(D, (Int)(out.size() + k));
    for (Int d = out.size(); d < count; d++) {
        for (Int i = 0; i < alp; i++) {
            score -= (d + 1 - last[i]) * c[i];
        }
    }

    return score;
}

vector<Int> solve(Int &D, vector<vector<Int>> &s, vector<Int> &c, Int &k) {
    vector<Int> out;

    for (Int _ = 0; _ < D; _++) {
        Int max_score = -INF;
        Int best_i = 0;

        for (Int i = 0; i < alp; i++) {
            out.push_back(i);

            Int score = evaluate(D, s, c, out, k);
            if (max_score < score) {
                max_score = score;
                best_i = i;
            }

            out.pop_back();
        }

        out.push_back(best_i);
    }

    return out;
}

Int scoring(Int &D, vector<vector<Int>> &s, vector<Int> &c, vector<Int> &t) {
    Int ans = 0;
    vector<Int> last(alp, 0);

    for (Int i = 0; i < D; i++) {
        ans += s[i][t[i]];
        last[t[i]] = i + 1;

        for (Int j = 0; j < alp; j++) {
            ans -= c[j] * (i - last[j] + 1);
        }
    }

    return ans;
}

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

    Int D;
    cin >> D;
    vector<Int> c(alp);
    vector<vector<Int>> s(D, vector<Int>(alp));
    for (Int i = 0; i < alp; i++) {
        cin >> c[i];
    }
    for (Int i = 0; i < D; i++) {
        for (Int j = 0; j < alp; j++) {
            cin >> s[i][j];
        }
    }

    vector<Int> ans(D, 0);
    Int point = 0;
    for (Int k = 0; k <= alp*2; k++) {
        vector<Int> t = solve(D, s, c, k);
        Int p = scoring(D, s, c, t);

        if (point < p) {
            point = p;
            ans = t;
        }
    }

    for (auto e : ans) {
        cout << e + 1 << endl;
    }

    return 0;
}


Measured memory_bytes: 3768
n, k = map(int,input().split())


MOD=10**9+7
def comb(n,k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    k = min(n-k,k)
    ans = 1
    inv = [1]*(k+1)
    if k >= 1:
        ans *= (n-k+1)%MOD
    for i in range(2,k+1):
        inv[i] = MOD - inv[MOD%i]*(MOD//i)%MOD
        ans = ans*(n-k+i)*inv[i]%MOD
    return ans


for i in range(1, k+1):
    ans_i = comb(n-k+1, i) * comb(k-1, i-1)
    print(ans_i % MOD)


Measured memory_bytes: 9264
import java.util.*;

public class Main{

    Scanner sc = new Scanner(System.in);

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

    void run() {

        int n = sc.nextInt();
        long k = sc.nextLong();
        int[] arr = new int[n];
        for (int i=0; i<n; i++) arr[i] = sc.nextInt() - 1;

        if (n >= k) {
            int tmp = arr[0];
            for (int i=1; i<k; i++) {
                int idx = arr[tmp];
                tmp = idx;
            }
            System.out.println(tmp + 1);
            return;
        }

        int[] cnt = new int[n];
        cnt[0] = 1;

        int start = Integer.MAX_VALUE;

        int idx = arr[0];
        cnt[idx] = 1;
        outer:
        for (int i=1; i<n; i++) {
            int tmp = arr[idx];
            cnt[tmp]++;
            if (cnt[tmp] == 2) {
                start = tmp;
                break outer;
            }
            idx = tmp;
        }


        int before = 0;
        idx = arr[0];


        if (start != 0) {
            before++;
            out:
            for (int i=1; i<n; i++) {
                int tmp = arr[idx];
                before++;
                idx = tmp;
                if (tmp == start) break out;
            }

        }

        int circle = 0;
        idx = arr[0];

        if (start == 0) {
            circle++;
            for (int i=1; i<n; i++) {
                int tmp = arr[idx];
                circle++;
                if (tmp == start) break;
                idx = tmp;
            }
        } else {
            for (int i=1; i<n; i++) {
                int tmp = arr[idx];
                idx = tmp;
                if (tmp == start) {
                    circle++;
                    tmp = arr[tmp];
                    while (tmp != start) {
                        circle++;
                        tmp = arr[tmp];
                    }
                    break;
                }
            }
        }

//        System.out.println(circle);

        long remain = circle != 0 ? (k - before) % circle : 0;

//        System.out.println(remain);


//        System.out.println(remain);
//        System.out.println(before);
//        System.out.println(start);



        idx = arr[start];
//        System.out.println(idx);
        if (remain == 0) {
            System.out.println(start + 1);
        } else {
            for (int i=0; i<remain-1; i++) {
                int tmp = arr[idx];
                idx = tmp;
//                System.out.println(idx);
            }
            System.out.println(idx + 1);

        }






    }


}


Measured memory_bytes: 60232
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

typedef long long LL;
#define REPD(i,a,b) for (LL i=(a);i<(b);i++)
#define REP(i,n) REPD(i,0,n)

using namespace std;


string inputString(){
  string a;
  cin >> a;
  return a;
};

LL inputValue(){
  LL a;
  cin >> a;
  return a;
};

vector<LL> inputVector(LL a){
  vector<LL> rv;
  REP(i, a){
    LL input;
    cin >> input;
    rv.push_back(input);
  }
  return rv;
}

vector<string> inputVectorString(LL a){
  vector<string> rv;
  REP(i, a){
    string input;
    cin >> input;
    rv.push_back(input);
  }
  return rv;
}
vector<vector<LL>> inputVector2D(LL a, LL b){
  vector<vector<LL>> rv;
  REP(i, a){
    rv.push_back(vector<LL>());
    REP(j, b) {
      LL input;
      cin >> input;
      rv.at(i).push_back(input);
    }
  }
  return rv;
}

#if 1
#define debug(d) debug1(__LINE__,#d, d)
void debug1(LL line, const char* name, vector<LL>& v) {
  cout << line << ":" << name << ":vector<LL>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, LL i) {
  cout << line << ":" << name << ":LL " << i << endl;;
}
void debug1(LL line, const char* name, vector<string>& v) {
  cout << line << ":" << name << ":vector<string>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    cout << v.at(i) << " ";
  }
  cout << endl;
}
void debug1(LL line, const char* name, vector<vector<LL>>& v) {
  cout << line << ":" << name << ":vector<vector<LL>>(" << v.size() << ") ";
  REP(i, (LL)v.size()) {
    REP(j, (LL)v.at(i).size()) {
      cout << v.at(i).at(j) << " ";
    }
    cout << ", ";
  }
  cout << endl;
}
#else
#define debug(n)
#endif

int main(int argc, const char * argv[]) {
  LL a = inputValue();
  string s = inputString();
  if (a>=3200) {
    cout << s << endl;
  }else {
    cout << "red" << endl;
  }


  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  string s;
  cin >> s;
  
  if (s == "SUN")
    cout << 7 << endl;
  if (s == "MON")
    cout << 6 << endl;
  if (s == "TUE")
    cout << 5 << endl;
  if (s == "WED")
    cout << 4 << endl;
  if (s == "THU")
    cout << 3 << endl;
  if (s == "FRI")
    cout << 2 << endl;
  if (s == "SAT")
    cout << 1 << endl;
  
  return 0;
}


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

int main(int argc, char const *argv[]) {
    int n;
    long long cnt=0;
    long long h, w;
    long long a, b;
    cin >> n >> h >> w;
    for(int i=0;i<n;i++){
        cin >> a >> b;
        cnt += min(floor(a/h),floor(b/w));
    }
    cout << cnt << endl;
    return 0;
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

// vector<int> A(3010), B(3010);
// vector<P> C(3010);
// int dp[3010][3010];

#define chmax(x, y) x = max(x, y)

int dp[3005][3005];

int main()
{
    int n, t;
    cin >> n >> t;
    vector<P> p(n);
    rep(i, n)
    {
        cin >> p[i].first >> p[i].second;
    }
    sort(p.begin(), p.end());

    int ans = 0;

    rep(i, n)
    {
        rep(j, t)
        {
            chmax(dp[i + 1][j], dp[i][j]);
            if (j - p[i].first >= 0) {
                chmax(dp[i + 1][j], dp[i][j - p[i].first] + p[i].second);
            }
        }
        int now = dp[i][t - 1] + p[i].second;
        chmax(ans, now);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 35456
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//ライブラリゾーン！！！！
#define int long long
#define str string
#define rep(i,j) for(int i=0;i<(int)(j);i++)
typedef long long ll;
typedef long double ld;
const long long inf = 4523372036854775807;
const ll Mod = 1000000007;
const ll gosenchou = 5000000000000000;
short gh[2][4] = { { 0,0,-1,1 },{ -1,1,0,0 } };
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {//隣接リスト表現
	ll to, cost;
};
struct E {//辺の情報を入れる変数
	int from, to, cost;
};
bool operator<(E a, E b) {
	return a.cost < b.cost;
}
struct H {
	int x, y;
};
bool operator<(H a, H b) {
	if (a.x != b.x) return a.x < b.x;
	return a.y < b.y;
}
bool operator>(H a, H b) {
	if (a.x != b.x) return a.x > b.x;
	return a.y > b.y;
}
bool operator==(H a, H b) {
	return a.x == b.x&&a.y == b.y;
}
bool operator!=(H a, H b) {
	return a.x != b.x || a.y != b.y;
}
ll gcm(ll i, ll j) {//最大公約数
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
ld rad(H a, H b) {
	return sqrt(pow(a.x - b.x, 2.0) + pow(a.y - b.y, 2.0));
}//rad＝座標上の2点間の距離
int ari(int a, int b, int c) {
	return (a + b)*c / 2;
}//等差数列の和
bool suf(ld a, ld b, ld c, ld d) {
	if (b <= c || d <= a) return 0;
	return 1;
}//[a,b),[c,d)
int fact(int i) {
	int sum = 1;
	for (int j = 2; j <= i; j++)
		sum = (sum* j) % Mod;
	return sum;
}//階乗(正）
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
signed main() {
	int x, y;
	cin >> x >> y;
	int sum = 0;
	for (x; x <= y; x *= 2) {
		sum++;
	}
	cout << sum << endl;
	getchar(); getchar();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define MOD 1000000007
#define dataSize 500005
#define INF 1e18+7
#ifndef LOCAL
#define map unordered_map
#define endl "\n"
#endif
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	ULL a,b;
	cin>>a>>b;
	ULL p1=(a+b);
	if (p1%2==0) cout<<p1/2<<endl;
	else cout<<"IMPOSSIBLE"<<endl;
}


Measured memory_bytes: 256
import sys
import os
# import math
# input = sys.stdin.readline

def int_array():
    return list(map(int, input().strip().split()))


def str_array():
    return input().strip().split()

def gcd(a,b):
    if b == 0:
        return a
    return gcd(b, a % b);

def take_input():
	if os.environ.get("check"):
		sys.stdin = open('input.txt', 'r') 
		sys.stdout = open('output.txt', 'w')
		
take_input()
######################### TEMPLATE ENDS HERE #################################

n = int(input())-400

print(8-n//200)

Measured memory_bytes: 61760
N = int(input())
S = input()

S_W = [0]*(N+1)
S_E = [0]*(N+1)

A_W = []
A_E = []

for i in range(N):
    if S[i]=="W":
        A_W.append(1)
        A_E.append(0)
    else:
        A_W.append(0)
        A_E.append(1)
for i in range(len(S)):
    S_W[i+1] = S_W[i] + A_W[i]
    S_E[i+1] = S_E[i] + A_E[i]

ans = float('inf')
for i in range(len(S)):
    e_count = S_E[len(S_E)-1]-S_E[i+1]
    w_count = S_W[i]
    ans = min(ans, e_count+w_count)
   
print(ans)

Measured memory_bytes: 31804
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define vi vector<int>
#define vvi vector<vector<int>>
using namespace std;

bool comp(vi& lhs, vi& rhs) {
    if (lhs[1] != rhs[1]) {
        return lhs[1] > rhs[1];
    }
    else {
        return lhs[0] < rhs[0];
    }
}
int main() {
    int N, M; cin >> N >> M;
    vector<vector<int>> pjobs(N, vi(2));
    rep(i, N) cin >> pjobs[i][0] >> pjobs[i][1];
    sort(ALL(pjobs), comp);
    set<int> Dfree;
    ll score = 0;
    for (int i = 0; i < M + 1; i++) {
        Dfree.insert(i);
    }
    for (int i = 0; i < N; i++) {
        int a = pjobs[i][0];
        int b = pjobs[i][1];
        auto iter = Dfree.lower_bound(a);
        if (iter != Dfree.end()) {
            score += b;
            Dfree.erase(iter);
        }
    }
    cout << score << endl;
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//typedef vector<vector<ll>> Graph;

const ll mod = 1e9 + 7;
//const ll mod = 998244353;

#define REP(i,n) for(ll i=0;i<(ll)n;i++)
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define spa << " " <<
#define fi first
#define se second

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

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

template<typename T> void debug(vector<vector<T>>&v,ll h,ll w){for(ll i=0;i<h;i++)
{cerr<<v[i][0];for(ll j=1;j<w;j++)cerr spa v[i][j];cerr<<endl;}};
template<typename T> void debug(vector<T>&v,ll n){if(n!=0)cerr<<v[0];
for(ll i=1;i<n;i++)cerr spa v[i];
cerr<<endl;};

string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    ll N;
    cin >> N;
    vector<int> V(N+1), W(N+1);
    REP(i, N) cin >> V[i+1] >> W[i+1];

    const ll K = 9;
    const ll H = (1ll<<K);
    const ll LMA = 100005;

    vector<vector<int>> dp(H, vector<int>(LMA, 0));
    REP(i, H){
        REP(j, 2){
            if(i==0 and j==0) continue;

            ll ni = 2 * i + j;
            if(ni>=H or ni>N) continue;
            REP(k, LMA){
                chmax(dp[ni][k], dp[i][k]);
                if(k+W[ni] < LMA) chmax(dp[ni][k+W[ni]], dp[i][k] + V[ni]);
            }
        }
    }

    //debug(dp, 5, 10);

    ll Q;
    cin >> Q;
    while(Q--){
        ll v, L;
        cin >> v >> L;

        vector<pll> reku;
        reku.push_back({0, 0});
        while(v>=H){
            ll sz = reku.size();
            REP(i, sz){
                pll y;
                y.first = reku[i].first + V[v];
                y.second = reku[i].second + W[v];
                reku.push_back(y);
            }
            v /= 2;
        }
        ll ma = 0;
        for(auto x: reku){
            if(L-x.second>=0) chmax(ma, x.first + dp[v][L-x.second]);
        }
        cout << ma << "\n";
    }

    return 0;
}

Measured memory_bytes: 206444
// inputに入力データ全体が入る
function Main(input) {
  	input = input.split('\n');
    if(input[0] % 2 === 1) {
        console.log('No');
        return;
    }
    const length = input[0] / 2;
    const str1 = input[1].substring(0, length);
    const str2 = input[1].substring(length, input[0]);
    console.log(str1 === str2 ? 'Yes': 'No');
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main() {
    ll k,s,ans=0;
    cin >> k >> s;
    for(int x=0;x<=k;x++){
        for(int y=0;y<=k;y++){
            int z = s - x - y;
            if(z < 0 || z > k)continue;
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3624
import copy
while True :
    n, r = map(int, input().split())
    if n == 0 and r == 0 :
        break
    
    Card = [0] * n
    for i in range(n) :
        Card[i] = n - i
    Card_copy = copy.copy(Card)
    
    for i in range(r) :
        p, c = map(int, input().split())
        for j in range(c) :
            Card[j] = Card_copy[p+j-1]
        for j in range(c, p+c-1):
            Card[j] = Card_copy[j-c]
        Card_copy = copy.copy(Card)
    print(Card[0])


Measured memory_bytes: 6332
package main
import . "fmt"
func main() {
  var a,b int64
  Scan(&a,&b)
  Println(f(a,b))
}
func f(a int64,b int64) int64 {
  if a != 0 {
    return f(0,a-1)^f(0,b)
  }
  if b%2 == 1 {
    return ((b+1)/2)%2
  } else {
    return (b/2)%2^b
  }
}

Measured memory_bytes: 512
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

using ll = long long;
template< typename T >
struct Edge {
  int from, to;
  T cost;
  Edge() {}
  Edge(int f, int t) : from(f), to(t), cost(1) {}
  Edge(int f, int t, T c) : from(f), to(t), cost(c) {}
  friend bool operator < (const Edge& lhs, const Edge& rhs) { return lhs.cost < rhs.cost; };
  friend bool operator > (const Edge& lhs, const Edge& rhs) { return rhs < lhs; };
  friend bool operator <= (const Edge& lhs, const Edge& rhs) { return !(lhs > rhs); };
  friend bool operator >= (const Edge& lhs, const Edge& rhs) { return !(lhs < rhs); };
};

template< typename T >
using Edges = std::vector< Edge< T > >;
template< typename T >
using Graph = std::vector< Edges< T > >;

using graph = Graph<int>;

#include <stack>

template< typename G >
std::vector<int> topologicalSort(const G &g) {
  // トポロジカルソートした結果を返す
  const int V = g.size();
  std::vector<int> indegree(V); // 200000とかだと遅い？ 厳しそうならグローバル変数にする
  // 入次数の初期化. ほんとは読み込み時にやったほうが効率が良いけど許容する
  for (int v = 0; v < V; ++v) {
    for (auto& e: g[v]) ++indegree[e.to];
  }

  std::stack<int> st;
  for (int v = 0; v < V; ++v) {
    // 入次数0の点をstackにいれる
    if (indegree[v] == 0) st.push(v);
  }

  std::vector<int> order;
  while (!st.empty()) {
    int v = st.top(); st.pop();
    order.push_back(v);
    for (auto& e: g[v]) {
      --indegree[e.to];
      if (indegree[e.to] == 0) st.push(e.to);
    }
  }

  return order;
}

graph g(1000000);
vector<int> depth(1000000, -1);


void dfs(int s) { 
  int d = 0;
  for (auto e: g[s]) { 
    if (depth[e.to] == -1) dfs(e.to);
    d = max(d, depth[e.to]);
  }
  depth[s] = d+1;
}

int id(int v1, int v2) {
  return min(v1, v2)*1000+max(v1, v2);
}

int main() {
  int n; cin >> n;
  for (int i = 0; i < n; ++i) {
    int ba = -1, a;
    for (int j = 0; j < n-1; ++j) {
      cin >> a; --a;
      if (ba != -1) {
        int v1 = id(i, ba);
        int v2 = id(i, a);
        g[v1].emplace_back(v1, v2);
      }
      ba = a;
    }
  }
  vector<int> order = topologicalSort(g);
  if (order.size() != 1000000) {
    cout << -1 << endl;
    return 0;
  }
  int ans = 0;
  for (int i = 0; i < 1000000; ++i) {
    if (depth[i] == -1) dfs(i);
    ans = max(ans, depth[i]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 54908
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int n, m, a[1001], b[1001], cnt[1001] = {};
  cin >> n >> m;
  for(int i = 0 ; i < n ; i++ ){
    cin >> a[i];
  }
  for(int i = 0 ; i < m ; i++ ){
    cin >> b[i];
  }
  for(int i = 0 ; i < n ; i++ ){
    int j = 0;
    while(a[j] > b[i]) j++;
    cnt[j]++;
  }
  cout << distance(cnt,max_element(cnt,cnt+n)) + 1 << endl;
}

Measured memory_bytes: 1172
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstring>
#include <chrono>
#include <complex>
#define endl "\n"
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define pb push_back
#define f first
#define s second
#define pi 3.141592653589793238
using namespace std;

ll gcd( ll a, ll b )
{
	if(b==0)
	{
		return a;
	}
	else
	{
		return gcd( b, a%b );
	}
}
ll lcm (ll a, ll b)
{
	return (a*b)/gcd(a,b);
}

ll power(ll a, ll b)	//a is base, b is exponent
{
	if(b==0)
		return 1;
	if(b==1)
		return a;
	if(b%2 == 1)
		return (power(a,b-1)*a)%mod;
	ll q = power(a,b/2);
	return (q*q)%mod;
}
ll n;
ll h[20000000];
ll dp[2000000];
ll solve(ll idx)
{
	if(idx>=n-1) return 0;
	else if(dp[idx]!=-1) return dp[idx];
	else if(dp[idx]==-1)
	{
		if(idx<=n-3)
			return dp[idx]= min(solve(idx+1)+abs(h[idx+1]-h[idx]),solve(idx+2)+abs(h[idx+2]-h[idx]));
		else if(idx==n-2)
			return dp[idx] = solve(idx+1)+abs(h[idx+1]-h[idx]);
	}
}

int main()
{
	std::ios::sync_with_stdio(false);
	
	cin >> n;
	for(int i =0;i<n;i++) cin >> h[i];
	for(int i =0;i<2000000;i++) dp[i]=-1;
cout << 	solve(0) << endl;
//	cout << dp[n-2] << endl;

	return 0;
}


//Hello, this is a snippet.


Measured memory_bytes: 20224
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define f(i,a,b) for(int i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define all(a) a.begin(),a.end()
#define size(s) s.size()
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using si = stack<LL>;
using pi = pair<LL, LL>;
using v_pi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b) f(i,0,n){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

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


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

	int n;
	cin >> n;
	vi dp(n + 1);
	dp[0] = 0;
	f(i, 1, n + 1) dp[i] = (int)1e9;
	f(i, 0, n + 1) {
		for (int j = 1; i + j <= n; j *= 6) {
			dp[i + j] = min(dp[i + j], dp[i] + 1);
		}
		for (int j = 1; i + j <= n; j *= 9) {
			dp[i + j] = min(dp[i + j], dp[i] + 1);
		}
	}
	cout << dp[n];
	return 0;
}

Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000009)
	sc.Split(bufio.ScanWords)

	a, b := oneInt(), oneInt()
	if (a*b)%2 == 0 {
		fmt.Println("Even")
	} else {
		fmt.Println("Odd")
	}
}

func oneInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func oneStr() string {
	sc.Scan()
	return sc.Text()
}

func scanNums(len int) (nums []int) {
	for i := 0; i < len; i++ {
		nums = append(nums, oneInt())
	}
	return nums
}

func scanStrings(len int) (strs []string) {
	for i := 0; i < len; i++ {
		strs = append(strs, oneStr())
	}
	return strs
}

func abs(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}

func cumSum(nums []int) []int {
	sums := []int{0}

	for i := 0; i < len(nums); i++ {
		sums = append(sums, sums[i]+nums[i])
	}
	return sums
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <iostream>
 
using namespace std;
typedef long long int ll;
const int INF = 0x3f3f3f3f;

  
 
int main(){
	int T = 1;
	//cin >> T;
	while (T--){
		int a,b,c,k;
		cin >> a >> b >> c >> k;
		vector<int> p;
		int ans = 0;
		if (k > a) ans += a;
		else ans += k;
		if (k > a and k > b) ans += -(k-a-b);
		cout << ans << endl;
	}
}


Measured memory_bytes: 3600
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>

#define ll long long

using namespace std;

string seat_pre, seat_now;
int first, last, mid;
int N;

int main()
{
    cin >> N;
    first = 0;
    last =  N - 1;

    cout << 0 << endl;
    cin >> seat_pre;
    if (seat_pre == "Vacant") {
        return 0;
    }

    for (int i=1; i<20; i++) {

        if (last - first < 2) {
            cout << first << endl;
            cin >> seat_now;
            if(seat_now != "Vacant") {
                cout << last << endl;
            }
            return 0;
        }

        mid = (first + last)/2;
        cout << mid << endl;
        cin >> seat_now;

        if (seat_now == "Vacant") {
            return 0;
        } else if ((seat_now==seat_pre && (mid-first)%2==0) || (seat_now!=seat_pre && (mid-first)%2==1)) {
            first = mid;
            seat_pre = seat_now;
        } else {
            last = mid-1;
        }
    }
}

Measured memory_bytes: 852
import java.util.Scanner; 
public class Main {
  public static void main(String[] args) {
   Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
     if(a<b&&b<c){
      System.out.println("Yes");
     }else{
      System.out.println("No");
     }
    sc.close();
  }
}


Measured memory_bytes: 26156
#include <iostream>
#include <queue>
using namespace std;
typedef unsigned long long u64;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  u64 n;
  cin >> n;
  priority_queue< u64 > q;
  for (u64 i = 0; i < n*3; ++i) {
    u64 a;
    cin >> a;
    q.push(a);
  }
  u64 sum = 0;
  for (u64 i = 0; i < n; ++i) {
    q.pop();
    sum+=q.top();
    q.pop();
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 6512
#define _CRT_SECURE_NO_WARNINGS

#pragma GCC optimize("O3")

#include <iostream>
#include <algorithm>
#include <vector>
#include <cassert>
#include <cstring>
#include <numeric>
#include <set>
#include <queue>
#include <deque>
#include <array>
#include <string>
#include <cmath>
#include <random>
#include <ctime>
#include <map>
#include <functional>
#include <bitset>
#include <complex>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>

#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back

using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using ld = long double;

int main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	const int mod = 1e9 + 7;
	string s;
	int D;
	cin >> s >> D;
	int n = sz(s);
	vector<vi> ways(n + 1, vi(D, 0));
	ways[0][0] = 1;
	for (int len = 1; len <= n; len++) {
		for (int r = 0; r < D; r++) {
			for (int d = 0; d < 10; d++) {
				int rr = (r + d) % D;
				(ways[len][rr] += ways[len - 1][r]) %= mod;
			}
		}
	}
	int ans = 0;
	int tmp = 0;
	vi num;
	for (char d : s) {
		tmp += (d - '0');
		num.pb(d - '0');
	}
	ans += (tmp % D == 0);
	int pref_rem = 0;
	for (int i = 0; i < n; i++) {
		for (int d = (i > 0 ? 0 : 1); d < num[i]; d++) {
			int want_rem = ((-(pref_rem + d)) % D + D) % D;
			(ans += ways[n - i - 1][want_rem]) %= mod;
		}
		(pref_rem += num[i]) %= D;
	}
	(ans += ways[n - 1][0]) %= mod;
	(ans += mod - 1) %= mod;
	cout << ans;
}


Measured memory_bytes: 4736
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long[] lims = new long[5];
        int minpart = 0;
        for (int i = 0; i < 5; i++) {
            lims[i] = sc.nextLong();
            if (lims[i] < lims[minpart]) {
                minpart = i;
            }
        }
        
        long times = 0;
        times += 5;
        if (n % lims[minpart] == 0) {
            times += n / lims[minpart] - 1;
        } else {
            times += n / lims[minpart];
        }
        
        System.out.println(times);
    }
}


Measured memory_bytes: 21972
#include<string>
#include<iostream>
#include<vector>
using namespace std;
vector<string> m;
void draw(int a,int b){
if(m[a][b]=='1'){
m[a][b]='0';
draw(a-1,b);
draw(a+1,b);
draw(a,b-1);
draw(a,b+1);
}
}
int solve(){
int ans= 0;
for(int i=0;i<m.size();i++){
for(int j=0;j<m[i].size();j++){
if(m[i][j]=='1'){
draw(i,j);
ans++;
}
}
}
return ans;
}
int main(){
while(!cin.eof()){
string s;
m.clear();
m.push_back("00000000000000");
for(int i=0;i<12;i++){
cin>>s;
s = "0"+s+"0";
m.push_back(s);
}
m.push_back("00000000000000");
cin.ignore(100,'\n');
cin.ignore();
cout<<solve()<<endl;
}
}

Measured memory_bytes: 1204
N = int(input())
dic = {}
list1 = ['M','A','R','C','H']
list2 = [0,0,0,0,0]
for i in range(N):
  s = list(input())
  s = s[0]
  for j in range(5):
   if(s == list1[j]):
    list2[j] += 1

a,b,c,d,e = list2[0],list2[1],list2[2],list2[3],list2[4]
ans = a*b*c + a*b*d + a*b*e + a*c*d + a*c*e + a*d*e
ans += b*c*d + b*c*e + b*d*e 
ans += c*d*e
print(ans)

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
// i --> 9?????§?????°???
// sum --> ????¨????
// cnt --> S??¨??????????????°
// total --> ?¶????????????°(N????????§?¶????)
int N, S, cnt;
void func( int i, int sum, int total )
{
	//N???????????????????????? ?????? ????¨????S?????????????????????count??????
	if( total == N && sum == S )
	{
		cnt++;
		return;
	}
	//0-9?????§??¢?´¢????????? or ?¶?????????°???N?????????????????? ?????????
	if( i == 10 || total == N ) return;
	
	//????¨???? i ????¶??????´??? -> ?¶?????????°??? +1 ??????
	func( i + 1, sum + i, total + 1 );
	//????¨???? i ????¶????????????´???
	func( i + 1, sum, total );
}
int main()
{
	while( cin >> N >> S )
	{
		if( N == 0 && S == 0 ) break;
		cnt = 0;
		func( 0, 0, 0 );
		cout << cnt << endl;
	}
	return 0;
}

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

int main(){
    ll n,x,a[200001];
    cin >> n ;
    rep(i,n){
        a[i]=0;
    }
    rep(i,n-1){
        cin >> x;
        a[x-1]++;
    }
    rep(i,n){
        cout << a[i] << endl;
    }
}

Measured memory_bytes: 5152
#include <bits/stdc++.h>
#ifdef NJUDGE
#include "igba.h"
#endif

using namespace std;
typedef long long ll;
const int MAXN = 2 * 100100;

stack<int> s;
int n, v[MAXN], l[MAXN], r;
ll ans = 0;

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%d", &v[i]);
		while(!s.empty() && v[s.top()] > v[i])
			s.pop();
		l[i] = (s.empty() ? 0 : s.top());
		s.push(i);
	}
	s = stack<int>();
	for(int i = n; i >= 1; --i)
	{
		while(!s.empty() && v[s.top()] > v[i])
			s.pop();
		r = (s.empty() ? n + 1 : s.top());
		ans += v[i] * 1LL * (i - l[i]) * (r - i);
		s.push(i);
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using vvl = vector<vector<long>>;
using pii = pair<int, int>;
using pil = pair<int, long>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,s,t) for(int i=s; i<t; i++)
#define RNG(i,s,t,u) for(int i=s; i<t; i+=u)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

long D;
vector<long> c(26);
vector<vector<long>> s(365,vector<long>(26));
vector<long> t(365);
vector<long> kari(365);
long karians = -1e15;
map<long, vector<long>> mp;

void INPUT(){
  cin >> D;
  rep(i,26) cin >> c.at(i);
  rep(i,D){
    rep(j,26) cin >> s.at(i).at(j);
  }
}

long greedy(){
  vector<long> lastday(26,-1);

  long ans = 0;
  rep(i,D){
    vector<long> tmpscore(26,ans);
    rep(j,26){
      tmpscore.at(j) += s.at(i).at(j);
      rep(k,26){
        if(j != k){
          tmpscore.at(j) -= (i - lastday.at(k))*c.at(k);
        }
      }
    }
    long day = 0;
    long maxi = tmpscore.at(0);
    rep(j,26){
      if(tmpscore.at(j) > maxi){
        maxi = tmpscore.at(j);
        day = j;
      }
    }
    ans = maxi;
    //cout << day+1 << endl;
    t.at(i) = day;
    lastday.at(day) = i;
  }
  return ans;
}

long calc(){
  vector<long> lastday(26,-1);
  long ans = 0;
  rep(i,D){
    long tt = t.at(i);
    ans += s.at(i).at(tt);
    lastday.at(tt) = i;
    rep(j,26){
      ans -= (i - lastday.at(j)) * c.at(j);
    }
    //cout << ans << endl;
  }
  return ans;
}

void OUTPUT(){
  rep(i,D){
    cout << kari.at(i)+1 << endl;
  }
}

int main(){
  long start = clock();
  INPUT();
  long now = greedy();
  karians = now;
  kari = t;
  srand(time(NULL));
  long cnt = 0;
  while((clock() - start)/(CLOCKS_PER_SEC/1000) < 1930){
    cnt++;
    long d = rand() % D;
    long q = rand() % 26;
    long prev_q = t.at(d);
    t.at(d) = q;
    long res = calc();
    if(res > now){
      now = res;
    }else if(cnt >= 10000){
      cnt = 0;
      if(now > karians){
        karians = now;
        t.at(d) = prev_q;
        kari = t;
        t.at(d) = q;
      }
      now = res;
    }else{
      t.at(d) = prev_q;
    }
  }
  if(now > karians){
    kari = t;
  }
  OUTPUT();
}

Measured memory_bytes: 3760
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=8931145141919364364,LMOD=998244353;
// const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};

int main(){
    int n,m,X,Y; cin>>n>>m>>X>>Y;
    int x[n],y[m]; rep(i,n) cin>>x[i]; rep(i,m) cin>>y[i];
    sort(x,x+n); sort(y,y+m);
    string ans="War";
    for(int z=x[n-1]+1;z<=y[0];z++){
        if(X<z&&z<=Y) ans="No War";
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <queue>
#include <random>
#include <cstdint>
#include <bitset>
#include <iomanip>
#include <utility>
#include<map>
#include<functional>
#include<climits>
#include<regex>
#include<numeric>
using namespace std;
typedef long long ll;
const int mod = 1000000007;

char c[1000][1000];
bool b[4][4] = { { false,true,false,true}, {false,true,true,false} ,{true,false,true,false} ,{true,false,false,true} };
int h, w;
int memo[1001][1001],poi[1001][1001];
int dp(int x, int y);
int cou = 0;

int main() {
	int ans=0;
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> c[i][j];
		}
	}
	fill(poi[0], poi[1000], 100000);
	for (; cou < 4; cou++) {
		fill(memo[0], memo[1000], -1);
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				poi[i][j]=min(poi[i][j] , dp(i, j));
			}
		}


	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			ans = max(ans, poi[i][j]);
		}
	}
	cout << ans << endl;
}

int dp(int x, int y) {
	if (x<0 || y<0 || x>=h || y>=w)return 10000;
	else if (memo[x][y] != -1);
	else if (c[x][y] == '#')memo[x][y] = 0;
	else {
		int qwe = 100000;
		if (b[cou][0])qwe = min(qwe, dp(x, y - 1)+1);
		if (b[cou][1])qwe = min(qwe, dp(x, y + 1)+1);
		if (b[cou][2])qwe = min(qwe, dp(x-1, y )+1);
		if (b[cou][3])qwe = min(qwe, dp(x+1, y )+1);
		memo[x][y] = qwe;
	}
	return memo[x][y];
}



Measured memory_bytes: 9088
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double PI=acos(-1);
const int INF = numeric_limits<int>::max();

int main(){
    ll x;
    cin >> x;

    ll a = 100;

    int n = 0;

    while(a < x){
        ++n;
        a *= 1.01;
    }

    cout << n << endl;

    return 0;
    
}

Measured memory_bytes: 3628