akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)
//#define INF (1LL<<59)

int main(){
    int h,w;
    cin>>h>>w;
    vector<string> v(h);
    rep(i,h)cin>>v[i];
    
    rep(i,w+2)cout<<"#";cout<<endl;
    rep(i,h){
        cout<<"#";
        cout<<v[i];
        cout<<"#"<<endl;
    }
    rep(i,w+2)cout<<"#";cout<<endl;
}

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

int main(){
    ll n; cin >> n;
    string s; cin >> s;
    ll r=0,g=0,b=0;
    for(ll i=0;i<n;i++){
        if(s[i]=='R') r++;
        if(s[i]=='G') g++;
        if(s[i]=='B') b++;
    }
    ll ans=r*g*b;
    for(ll c=1;c<=n/2;c++){
        for(ll i=0;i<n-c*2;i++){
            char first=s[i],second=s[i+c],third=s[i+c*2];
            if(first!=second && second!=third && third!=first){
                ans--;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
# -*- coding: utf-8 -*-
S = raw_input()
tmp = ['a','b','c']

for i in range(3):
    index = S.find(tmp[i])
    if index == -1: break
    S = S[:index]+S[index+1:]

if len(S) > 0:
    print('No')
else:
    print('Yes')


Measured memory_bytes: 2568
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    n = ii()
    h = li()

    nowh = 0
    ans = 0
    cnt = 0

    for i in h:
        if nowh < i:
            nowh = i
            ans = max(ans,cnt)
            cnt = 0
        else:
            nowh = i
            cnt+=1
    ans = max(ans,cnt)
    print(ans)

main()


Measured memory_bytes: 14480
function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var list = {};
  var list2 = [];
  for(var i = 0; i < input.length; i++){
    var tmp = input.slice(i,i+1);
    if(list[tmp] == null){
       list[tmp] = 1;
      list2.push(tmp);
    }else{
       list[tmp]++;
    }
  }
  for(var i = 0; i < list2.length; i++){
    if(list[list2[i]] % 2 == 1){
       myout("No");
      return;
       }
  }
  myout("Yes");
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


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

int main(){
    int n,a,b;
    int c = 0;

    cin >> n;
    rep(i,n) {
        cin >> a >> b;
        if(a == b) c++;
        else if(c == 3) break;
        else c = 0;
    }

    if(c >= 3) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
using namespace std;

int main() {
	set<int> x;

	int n;
	cin >> n;
	for(int i = 0; i < n; i++) {
		int flag = 0;
		cin >> flag;
		long int value;
		cin >> value;
		if(flag == 0) {
			x.insert(value);
			cout << x.size() << endl;
		}
		else if(flag == 1) {
			set<int>::iterator itr = x.find(value);
			if(itr != x.end()) {
				cout << 1 << endl;
			}
			else {
				cout << 0 << endl;
			}
		}
		else if(flag == 2) {
			x.erase(value);
		}
		else {
			int r;
			cin >> r;
			set<int>::iterator itr, end;
			itr = x.lower_bound(value);
			end = x.upper_bound(r);
			for(;itr != end; itr++) {
				cout << *itr << endl;
			}
		}

	}

	return 0;
}



Measured memory_bytes: 12452
#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;

int Prime_Check(long long N){
	for (long long i = 2; i*i <= N; i++)
	{
		if (N % i == 0)return 0;
	}
	return 1;
}
int main() {
	//10^5までの素数を持っておく,条件を満たすものを持っておく
	vector<int>primer(100001),good(100001),goodsum(100002);
	for (size_t i = 1; i <= 100000; i++)
	{
		primer.at(i) = Prime_Check(i);
	}
	for (size_t i = 3; i <= 100000; i+=2)
	{
		good.at(i) = primer.at(i) * primer.at((i + 1) / 2);
	}
	for (size_t i = 0; i < 100001; i++)
	{
		goodsum.at(i+1) = goodsum.at(i) + good.at(i);
	}
	int Q;
	cin >> Q;
	vector<pair<int,int>>A(Q);
	for (size_t i = 0; i < Q; i++)
	{
		cin >> A.at(i).first >> A.at(i).second;
	}
	for (size_t i = 0; i < Q; i++)
	{
		cout << goodsum.at(A.at(i).second+1) - goodsum.at(A.at(i).first)<<endl;
	}
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
 
struct edge {int /*from,*/to,cost;};
typedef long long ll;
typedef pair<int,int> P;
typedef pair<pair<int,int>,int> PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
typedef vector<edge> VE;
static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const long long INF = 9223372000000000000/2145;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define np next_permutation
#define pq priority_queue
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n)  FOR(i,0,n)
//#define int ll

signed main(){
    int a,b;
    scanf("%d%d",&a,&b);

    a+b>=10 ? puts("error") : printf("%d\n",a+b);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
  
  int a,b,c,d;
  std::cin >> a >> b >> c >> d;

    
  for(int i=1;1>0;i++){
        if(b*i>=c){
            cout << "Yes" << endl;
            return 0;
        }
        else if(d*i>=a){
            cout << "No" << endl;
            return 0;
        }
    }
}


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

int main(){
    string S;
    cin >> S;
    
    if(S[0] == S[1]){
        if(S[2] == S[3] && S[0] != S[2]){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else if(S[0] == S[2]){
        if(S[1] == S[3] && S[0] != S[1]){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else if(S[0] == S[3]){
        if(S[1] == S[2] && S[0] != S[1]){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
         cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
#include<string>
#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<complex>
#include<stack>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)


int main(){
	
	string A = "apple";
	string B = "peach";
	string a;
	getline(cin,a);
	
	rep(i,a.size()-A.size()+1){
		if(a[i]=='a'){
			bool ok = true;
			rep(j,A.size())if(a[i+j]!=A[j])ok=false;
			if(ok) a = a.substr(0,i)+B+a.substr(i+B.size());
		}else if(a[i]=='p'){
			bool ok = true;
			rep(j,A.size())if(a[i+j]!=B[j])ok=false;
			if(ok) a = a.substr(0,i)+A+a.substr(i+B.size());
		}
	}
	cout<<a<<endl;
	
}

Measured memory_bytes: 1188
#include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
#define rep_eq(i,x,n) for(int i=x; i<=(int)(n); i++)
using namespace std;

using ll=long long;

int main() {
  int N; cin >>N;
  string S; cin >>S;
  int ans=1;
  rep(i,1,N) {
    if (S[i]!=S[i-1]) {ans++;}
  }
  cout <<ans <<endl;
  return 0;
}


Measured memory_bytes: 3768
#include <iostream>
#include <algorithm>
const int N = 20;
int opt[N],cnt;
int b[N];
int b_max[N];
int n;
const int M = 110000;
int dp[M];
using namespace std;
int main(){
    cnt = 0 ;
    std::cin >> n;
    int i;
    opt[cnt++] = 1;
    for(i = 6; i <= n; i*=6){
        opt[cnt ++] = i;
    }
    for(i=9; i<=n; i*= 9){
        opt[cnt ++] = i;
    }
    std::sort(opt, opt + cnt);
    int k = 1010000;
    int c;
    int j;
    dp[0]=0;
    for(i = 1; i< M; i++){
        dp[i] = 110000;
    }

  for(i=0; i<=n ; i++){
    for(j=0; j < cnt; j++){
        k = i- opt[j];
        if(k>=0){
            c = dp[k]+1;

        //cout << k<<" "<<c<<endl;
            if(c<dp[i]){
                dp[i] = c;


            }
        }
    }
  }
  cout << dp[n];
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdlib>

int main()
{
    int a;
    
    std::cin>>a;
    
    if(a<105)  std::cout << 0 << std::endl;
     else if(a<135) std::cout << 1 << std::endl;
    else if(a<165) std::cout << 2 << std::endl;
    else if(a<189) std::cout << 3 << std::endl;
    else if(a<195) std::cout << 4 << std::endl;
    else if(a<=200) std::cout << 5 << std::endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,x,ans,tm=101;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>x;
        ans+=x;
        if(x%10)tm=min(tm,x);
    }
    if(ans%10)cout<<ans<<endl;
    else if(tm!=101)cout<<ans-tm<<endl;
    else cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
 
  vector<int> vec(N);
  for (int i=0;i<N;i++) {
   cin >> vec.at(i);
  }
 
 int count =0;
 while (true) {
  bool exist_odd = false;
  for (int i=0;i<N;i++) {
    if (vec.at(i)%2 != 0) {
      exist_odd = true;
    }
  }
  if (exist_odd) {
    break;
  }
  for (int i=0;i<N;i++) {
    vec.at(i)/=2;
  }
  count++;
 }
 cout<<count<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
#define REP(i,s,N) for (int i=s;i<(N); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
using namespace std;


ll ans=0;

int main(){
	ll N;
	cin >> N;
	vector<ll> L(N);
	REP(i,0,N) cin >> L[i];
	sort(L.begin(),L.end());
	REP(low,0,N-2){
		REP(mid,low+1,N-1){
			ll ab = L[low] + L[mid];
			auto itr = lower_bound(L.begin(),L.end(),ab)-L.begin();
			ans += itr - mid - 1;
		}
	}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
int main() {
    fast_io

    int x;
    cin>>x;
    if(x==1) {
        cout<<0;
    }else cout<<1;



    return 0;
}


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

using namespace std;

int main() {
	int a, b, c;
	long long k;
	ignore = scanf("%d %d %d %lld", &a, &b, &c, &k);
	printf("%d\n", k % 2 == 1 ? b - a : a - b);
	
	return 0;
}


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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

void tokenize(std::string const &str, const char delim,
			std::vector<std::string> &out)
{
	// construct a stream from the string
	std::stringstream ss(str);

	std::string s;
	while (std::getline(ss, s, delim)) {
		out.push_back(s);
	}
}

void Main() {
    int N;
    cin >> N;
    set<ll> A;
    bool flag = true;
    rep(i, N){
        ll tmp;
        cin >> tmp;
        if (A.find(tmp) != A.end()){flag = false; break;}
        A.insert(tmp);
    }
    if (flag){cout << "YES" << endl;} else {cout << "NO" << endl;}
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 9600
#define DEBUG
#include <bits/stdc++.h>
#include <ext/numeric>
using namespace std; using __gnu_cxx::power;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1; const double eps = 1e-6, ldeps = 1e-9;
#define all(x) begin(x), end(x)
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
#define TCC template<class C
struct Dbg { static constexpr auto &os = cout;   // replace by cerr in interactive.
#define ENI typename enable_if<
#define DTOR , Dbg&>::type operator<<
#define RIS return *this
TCC> static auto o(C *x)->decltype(os << *x, 0);
TCC> static char o(...);
TCC> ENI sizeof o<C>(0)!=1 DTOR(const C &x) {os<<x; RIS;}
TCC> Dbg &dump(C b, C e) {
    int ii = 0;
    for(C i = (os << "\n[", b); i!=e and ii<26; i++, ii++) *this << ", "+2*(i==b) << *i;
    RIS << ']';
}
TCC> ENI sizeof o<C>(0)==1 DTOR(const C &x) {
    return dump(all(x));
}
TCC, size_t X> ENI !is_same<C, const char>::value DTOR(C (&x)[X]) {
    return dump(all(x));
}
TCC, class D> Dbg &operator<<(const pair<C, D> &x) {RIS<<'{'<<x.first<<", "<<x.second<<'}';}
Dbg &operator<<(ostream&(*x)(ostream&)) { os << x; RIS; }
} dbg;
void err(istringstream *iss) { delete iss; }
TCC, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args...);
}
#ifdef DEBUG
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(#args), args), dbg << endl
#else
#define bug(args...) 0
#endif
#define ASSERT(a, o, b, args...) if (!((a)o(b))) bug(a, b, ##args), assert((a)o(b));
int T = 1, Q, cn;
const int inf = 1000000007, mxn = 200005;

int n,d,x[mxn],y[mxn];

signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); cout.precision(11), cout.setf(ios::fixed);
    // cin >> T;
    auto inputAll = [&]()->void {
        
    };
    auto kase = [&]()->void {
        // cout << "Case " << cn << ": ";
        cin>>n>>d;
        int ans=0;
        for(int i=1;i<=n;i++){
            cin>>x[i]>>y[i];
            ans+=(x[i]*ll(x[i])+y[i]*ll(y[i])<=d*ll(d));
        }
        cout<<ans<<'\n';
    };
    auto resetAll = [&]()->void {
        
    };
    while (cn++!=T) inputAll(), kase(), resetAll();
}


Measured memory_bytes: 5228
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<queue>
#include<stack>
#include<algorithm>
#include<math.h>
#include<set>
#include<map>
#include<iomanip>
#include<functional>
#define ll long long
using namespace std;

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	ll X; cin >> X;
	vector<ll> Sum;
	Sum.push_back(0);
	int i = 0;
	while (1) {
		ll S = Sum[i];
		if (S >= X) break;
		i++;
		Sum.push_back(S + i);
	}
	ll S = Sum[i];
	ll D = Sum[i] - X;
	if (i > D) { cout << i << endl; }
	else { cout << D << endl; }
}

Measured memory_bytes: 892
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    int n,i,ans=0;
    cin>>n;
    int a[n],b[n],c[n];
    for(i=0;i<n;i++)cin>>a[i];
    for(i=0;i<n;i++)cin>>b[i];
    for(i=0;i<n-1;i++)cin>>c[i];
    for(i=0;i<n;i++){
        ans+=b[a[i]-1];
        if(i!=0&&a[i]==a[i-1]+1)ans+=c[a[i]-2];
    }
    cout<<ans<<endl;
}
    


Measured memory_bytes: 256
def max_profit(n, values):
    min_val = values[0]
    profit = -(10**9)

    for i in range(1, n):
        if profit < values[i] - min_val:
            profit = values[i] - min_val
        if min_val > values[i]:
            min_val = values[i]

    return profit


def main():
    n = int(input())
    values = [int(input()) for i in range(n)]
    print(max_profit(n, values))


if __name__ == "__main__":
    main()


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

#define MAXN 10001

vector<int> edge[MAXN],we[MAXN];
int d[MAXN],n,m,inque[MAXN],cnt[MAXN];

void spfa(int x)
{
    queue<int> q;
    q.push(x);
    cnt[1]=1;
    for(int i=1;i<=n;++i)
    {
        d[i]=-1e9;
    }
    d[x]=0;
    memset(inque,false,sizeof(inque));
    inque[x]=true;
    do
    {
        int u=q.front();
        q.pop();
        inque[u]=false;
        for(unsigned i=0;i<edge[u].size();++i)
        {
            int v=edge[u][i],w=we[u][i];
            if(d[v]<d[u]+w)
            {
                d[v]=d[u]+w;
                if(!inque[v])
                {
                    inque[v]=true;
                    ++cnt[v];
                    if(v==n && cnt[v]>n)
                    {
                    	puts("-1");
                    	exit(0);
					}
                    q.push(v);
                }
            }
        }
    }
    while(!q.empty());
}

int main()
{
    int u,v,w,p;
    scanf("%d%d%d",&n,&m,&p);
    for(int i=1;i<=m;++i)
    {
        scanf("%d%d%d",&u,&v,&w);
        edge[u].push_back(v);
        w-=p;
        we[u].push_back(w);
    }
    spfa(1);
    printf("%d\n",max(0,d[n]));
}


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

int str2time(string time_str) {
    int time_int = 0;
    time_int += stoi(time_str.substr(0, 2))*60*60;
    time_int += stoi(time_str.substr(3, 2))*60;
    time_int += stoi(time_str.substr(6, 2));
    return time_int;
}

int main() {
    while (true) {
        int N;
        cin >> N;
        if (N==0) break;

        int time[86401] = {};
        string leave, arrive;
        int leave_time, arrive_time;
        rep(i, N) {
            cin >> leave >> arrive;
            leave_time = str2time(leave);
            arrive_time = str2time(arrive);

            time[leave_time]++;
            if (leave_time!=arrive_time) time[arrive_time]--;
            else time[arrive_time+1]--;
        }

        int num_train[86401] = {}, ans=0;
        num_train[0] = time[0];
        for (int i=1; i<86401; i++) {
            num_train[i] = num_train[i-1] + time[i];
            ans = max(ans, num_train[i]);
        }

        cout << ans << endl;
    }


    return 0;
}




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

using namespace std;
int arr[1000];
int main()
{
    string s,s1;
    cin >> s >> s1;
    int count = 0;
    for(int i = 0; i < s.size(); i++){
            if(s[i]!=s1[i]){
                count++;
            }
    }
    cout << count << endl;
    return 0;
}


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

using namespace std;

int n, k, p[5005];
long long c[5005], ans = LLONG_MIN;
bool v[5005];

int main() {
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++)
		scanf("%d", p + i);
	for (int i = 1; i <= n; i++)
		scanf("%lld", c + i);
	for (int i = 1; i <= n; i++)
		if (!v[i]) {
			vector<long long> vv;
			for (int at = i; !v[at]; at = p[at]) {
				v[at] = 1;
				vv.push_back(c[at]);
			}
			vector<long long> vvv(1);
			for (auto j : vv)
				vvv.push_back(vvv.back() + j);
			for (auto j : vv)
				vvv.push_back(vvv.back() + j);
			int mm = min(k, (int)vv.size());
			long long gg = vvv[vv.size()];
			for (int ii = 0; ii < vv.size(); ii++)
				for (int j = 1; j <= mm; j++) {
					long long tmp = vvv[ii + j] - vvv[ii];
					if (gg > 0)
						tmp += (k - j) / vv.size() * gg;
					ans = max(ans, tmp);
				}
		}
	printf("%lld\n", ans);
}

Measured memory_bytes: 3984
import numpy as np

H,W,K=map(int,input().split())
E=[]
for e in range(H):
    _=input()
    temp=_.replace('#','1').replace('.','0')
    
    E.append(list(map(int,temp)))

Arr=np.array(E)
# print(Arr)
FA=0

for h in range (2**H):
    # print("h:{0}が始まるよ。".format(h))
    select_H=[]
    for i in range (H):
        if (h>>i) & 1==1:
            select_H.append(1)
        else:
            select_H.append(0)
    sHarr=np.array(select_H)
    delSHarr=np.where(sHarr==1)
    # print(sHarr)
    # print(delSHarr)
    _ans=np.delete(Arr,delSHarr,axis=0)
    # print('________________ans__________________')
    # print(_ans)

    for w in range (2**W):
        # print("w:{0}が始まるよ。".format(w))
        select_W=[]
        for j in range (W):
            if (w>>j) &1 ==1:
                select_W.append(1)
            else:
                select_W.append(0)
        sWarr=np.array(select_W)
        delsWarr=np.where(sWarr==1)
        ans=np.delete(_ans,delsWarr,axis=1)
        # print("***ans***")
        # print(ans)

        if np.sum(ans)==K:
            FA+=1

print(FA)



# for x in range(2**H):
    
    # ans=np.delete(_ans,sWarr,axis=1)
# print(ans)


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

int main(){
	// おまじない
	cin.tie(0);
   	ios::sync_with_stdio(false);
	
	int N;
	// 出入力
	cin>>N;
    int L[N];
    for(int i=0;i<N;i++){
        cin>>L[i];
    }
    sort(L,L+N);
    int ans = 0;
    for(int i=0;i<N-2;i++){
        for(int j=i+1;j<N-1;j++){
            for(int k=j+1;k<N;k++){
                if(L[i]+L[j]>L[k]){
                    ++ans;
                }
            }
        }
    }
    cout<<ans<<"\n";

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int k,s,a,cnt=0;
	cin>>k>>s;
	for(int i=0;i<=k;i++){
		for(int j=0;j<=k;j++){
			a=s-i-j;
			if(a<=k&&a>=0){
				cnt++;
			}
		}
	}
	cout<<cnt<<endl;
return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <ctype.h>
#include <algorithm>
#include <iterator>
#include <climits>

// int calc_point(std::vector<int> vp, std::vector<int> vc, std::vector<int> route) {
//     int point = 0;
//     int* ans_flag = new int[vp.size()];
//     for (int i=0; i<vp.size(); i++) {
//         ans_flag[i] = 0;
//     }
//     for (int i : route) {
//         point += (i+1) * 100;
//         ans_flag[i] += 1;
//         if (ans_flag[i] == vp[i]) {
//             point += vc[i];
//         }
//     }
//     return point;
// }

// int wfs(int num, std::vector<int> init_flag, int target, std::vector<int> vp, std::vector<int> vc) {
//     std::vector<std::vector<int>> que;
//     int min_depth = INT_MAX;
//     que.push_back(init_flag);
//     while (que.size() > 0) {
//         std::vector<int> route = que.back();
//         int score = calc_point(vp, vc, route);
//         que.pop_back();
//         if (route.size() > min_depth) {
//             continue;
//         }
//         if (score >= target) {
//             min_depth = route.size();
//             continue;
//         }
//         for (int i=0; i<num; i++) {
//             if (std::count(route.begin(), route.end(), i) < vp[i]) {
//                 std::vector<int> new_route;
//                 route.push_back(i);
//                 copy(route.begin(), route.end(), back_inserter(new_route));
//                 que.insert(que.begin(), new_route);
//             }
//         }
//     }
//     return min_depth;
// }

int main() {
    int min_num = INT_MAX;
    int num, target;
    std::vector<int> vp, vc, init_flag;
    std::cin >> num >> target;
    for (int i=0; i<num; i++) {
        int p, c;
        std::cin >> p >> c;
        vp.push_back(p);
        vc.push_back(c);
    }
    for (int bit=0; bit < (1 << num); bit++) {
        int sum = 0, prob_num = 0;
        for (int i=0; i<num; i++) {
            sum += bit & (1 << i) ? (i+1)*100*vp[i]+vc[i] : 0;
            prob_num += bit & (1 << i) ? vp[i] : 0;
        }
        if (sum >= target) {
            min_num = std::min(prob_num, min_num);
        } else {
            for (int i=num-1; i>=0; i--) {
                if (bit & (1 << i)) continue;
                for (int j=0; j<vp[i]; j++) {
                    if (sum >= target) {
                        break;
                    }
                    sum += (i+1) * 100;
                    prob_num ++;
                }
            }
            min_num = std::min(prob_num, min_num);
        }
    }
    std::cout << min_num << "\n";
    return 0;
}


Measured memory_bytes: 256
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
def GI(V,E,Directed=False,index=0):
    org_inp=[]
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        org_inp.append(inp)
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
            g[a].append(b)
            if not Directed:
                g[b].append(a)
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[0],inp[2])
            bb=(inp[1],inp[2])
            g[a].append(bb)
            if not Directed:
                g[b].append(aa)
    return g,org_inp
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()

def dijkstra(edge,st):
    # edge=[[(v_to,dist_to_v),...],[],...]
    # initialize: def: d=dist(st,i), prev=[previous vertex in minimum path], q[]
    n=len(edge)
    d=[(0 if st==i else inf,i) for i in range(n)]
    prev=[0]*n
    q=[i for i in d]
    heapify(q)
    
    # calc
    while q:
        dist,cur=heappop(q)
        for dst,dist in edge[cur]:
            alt=d[cur][0]+dist
            if alt<d[dst][0]:
                d[dst]=(alt,dst)
                prev[dst]=cur
                heappush(q,(alt,dst))
    return d,prev
    
show_flg=False
show_flg=True

ans=0
n=I()
d=[]
c=[[1]*n for i in range(n)]
for i in range(n):
    d.append(LI())


for i in range(n):
    for j in range(i+1,n):
        for k in range(n):
            if k==i or k==j:
                continue
            if d[i][k]+d[k][j]<d[i][j]:
                print(-1)
                exit()
            if d[i][k]+d[k][j]==d[i][j]:
                c[i][j]=0

for i in range(n):
    for j in range(i+1,n):
        ans+=d[i][j]*c[i][j]

    
print(ans)






Measured memory_bytes: 44504
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>

#define F first
#define S second
#define pb push_back
#define ll long long
#define all(x) x.begin() , x.end()
#define mod(x,m) ((x%m + m )%m)
using namespace std;
using namespace __gnu_pbds;
void OJ();

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

string go( int n , int k , string s ){
    string t = s.substr(0,k);
    for ( int i = 0; i < k; ++i ){
        for ( int j = i; j < n; j += k )
            s[j] = t[i];
    }
    return s;
}

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

    int n , m , sum = 0;
    cin >> n >> m;
    for ( int i = 0; i < m; ++i ){
        int x; cin >> x; sum += x;
    }
    cout << max(-1 , n - sum);
    return 0;
}

void OJ(){
#ifndef ONLINE_JUDGE
    freopen( "C:\\Users\\ehab\\Desktop\\Code Forces\\CF\\in.txt" , "r" , stdin  );
   // freopen( "C:\\Users\\ehab\\Desktop\\Code Forces\\CF\\out.txt", "w" , stdout );
#endif // ONLINE_JUDGE
}
ll binEXP( ll x , ll pw , ll MOD )
{ ll res=1; while(pw>0){ pw%2 ? res *= x : 0; x *= x; x%=MOD; pw /= 2; res%= MOD; } return res%=MOD; }


Measured memory_bytes: 3660
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce
#from fractions import gcd
#from math import gcd
import sys
def I(): return int(input())  # '123' -> 123
def Is(): return map(int, input().split())  # '123 456' -> 123, 456
def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]
def TI(): return tuple(map(int, input().split()))  # '123 456' -> (123, 456)
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()  # 'aa bb' -> 'aa','bb' or ['aa','bb']
def LS(): return list(input())  # 'abc123' -> ['a','b','c','1','2','3']
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(1000000)
MOD = 1000000007
INF = float('inf')

s, t = Ss()
print(t+s)

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

int main(){
  bool flag=0;
  string s;
  cin >> s;
  int alp[26]={};
  for(int i=0;i<s.size();i++)
    alp[s.at(i)-97]++;
  for(int j=0;j<26;j++){
    if(alp[j]==0){
      cout << char(j+97) << endl;
      flag = 1;
      break;
    }
  }
  if(!flag)
    cout << "None" << endl;
}	

Measured memory_bytes: 512
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <iostream>
#include <map>
#include <functional>

using namespace std;

#define reep(i,f,n) for(int i=f; i<int(n); ++i)
#define rep(i,n) reep(i,0,n)

typedef vector<int> vi;

int main()
{
	int a, b, n;
	while(scanf("%d%d%d", &a, &b, &n) != EOF){
		a = a%b*10;
		int sum = 0;
		rep(i, n){
			sum += a/b;
			a = a%b*10;
		}
		printf("%d\n", sum);
	}

	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int main(void)
{
  int h,w;
  int count=0;
  scanf("%d %d",&h,&w);
  char a[10][10];
  for(int i=0;i<h;i++){
    scanf("%s",a[i]);
  }
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(a[i][j]=='#')count++;
    }
  }
  if(count<h+w){
    puts("Possible");
    return 0;
  }
  puts("Impossible");
  return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;

namespace ConsoleApp3
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var k = int.Parse(Console.ReadLine());

            var s = 7 % k;
            var set = new HashSet<int>();
            var i = 1;
            while (!set.Contains(s))
            {
                set.Add(s);

                if (s == 0)
                {
                    Console.WriteLine(i);
                    return;
                }

                s = (10 * s + 7) % k;
                ++i;
            }

            Console.WriteLine(-1);
        }
    }
}

Measured memory_bytes: 60404
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char const *argv[])
{
    int N, A, B;
    cin >> N >> A >> B;
    string str;
    int sum;
    int cnt = 0;
    for (int i = 1; i <= N; i++)
    {
        sum = 0;
        str = to_string(i);
        for (char c : str)
        {
            sum += (int)c - 48;
        }
        
        if (A <= sum && sum <= B)
        {
            cnt += i;
        }

    }

    cout << cnt << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main()
{
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
 
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 
    char s[10000000]; long long sum=0;
    cin>>s;
    long long len=strlen(s);
    for(int i=0;i<len;i++)
    {
        long long x = s[i]-48;
        sum=sum+x;
    }
    if(sum%9==0)cout<<"Yes\n";
    else cout<<"No\n";
 
 
}

Measured memory_bytes: 3752
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
using namespace std;
typedef long long ll;
typedef pair<int, int> pair;
const int inf = 1000000000; //10^9

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

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

    cout << ans/2 << endl;

    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>
#include <functional>

#define mp make_pair
#define pb push_back


typedef long long ll;
typedef long long llong;
typedef long double ld;

using namespace std;

#ifndef LOCAL
#define cerr _cer
struct _cert
{
    template <typename T> _cert& operator << (T) { return *this; }
};
_cert _cer;
#endif

template <typename T> void dprint(T begin, T end) {
    for (auto i = begin; i != end; i++) {
		cerr << (*i) << " ";
    }
    cerr << "\n";
}
ll dp[1200000];
const ll MOD = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    dp[0] = 1;
    dp[1] = n;
    ll sum = n + 1;
    for (int i = 2; i <= n; ++i) {
        dp[i] = (ll)(n - 1) * (ll)(n - 1) % MOD;
        dp[i] = (dp[i] + sum - dp[i - 2] + MOD + n - i + 1) % MOD;
        sum = (sum + dp[i]) % MOD;
    }
    cout << dp[n] << "\n";
	return 0;
}




Measured memory_bytes: 8448
n = gets.to_s.to_i

g = Array.new(n){ [] }
(n-1).times do |i|
  a, b = gets.to_s.split.map{|t| t.to_i - 1 }
  g[a] << [b, i]
  g[b] << [a, i]
end

q = [0, -1, -1]

ans = Array.new(n-1)
while q[0]
  v, parent, parent_color = q.pop
  color = 0
  g[v].each do |(u, i)|
    next if u == parent
    # p [v, color] if i == 0
    color += 1
    color += 1 if color == parent_color
    # p [v, color] if i == 0
    ans[i] = color
    q << [u, v, color]
  end
end
# puts "ans"
puts ans.max, ans

Measured memory_bytes: 27900
using System;
using System.Collections.Generic;
using System.Linq;

namespace AOJVolume21_2199
{
    class Program
    {
        static void Main(string[] args)
        {
            List<int> anss = new List<int>();
            while (true)
            {
                var NM = ReadInt();
                int N = NM[0];
                int M = NM[1];
                if (N == 0) break;

                int[] C = new int[M];
                int[] X = new int[N + 1];
                for (int i = 0; i < M; i++)
                {
                    C[i] = int.Parse(Console.ReadLine());
                }
                for (int i = 0; i < N; i++)
                {
                    X[i + 1] = int.Parse(Console.ReadLine());
                }

                int[,] dp = new int[256, N + 1];
                for (int i = 0; i < N + 1; i++)
                {
                    for (int j = 0; j < 256; j++)
                    {
                        dp[j, i] = int.MaxValue / 2;
                    }
                }
                dp[128, 0] = 0;

                for (int j = 0; j < N; j++)
                {
                    for (int i = 0; i < 256; i++)
                    {
                        for (int k = 0; k < M; k++)
                        {
                            int nexti = i + C[k];
                            if (nexti < 0) nexti = 0;
                            else if (nexti > 255) nexti = 255;

                            int cand = dp[i, j] + (int)Math.Pow(nexti - X[j + 1], 2);
                            dp[nexti, j + 1] = Math.Min(dp[nexti, j + 1], cand);
                        }
                    }
                }

                int ans = int.MaxValue;
                for (int i = 0; i < 256; i++)
                {
                    ans = Math.Min(ans, dp[i, N]);
                }

                anss.Add(ans);
            }

            foreach (var a in anss)
            {
                Console.WriteLine(a);
            }
            Console.ReadKey();
        }

        static int[] ReadInt()
        {
            int[] ret = Console.ReadLine().Split().Select(int.Parse).ToArray();
            return ret;
        }
        static long[] ReadLong()
        {
            long[] ret = Console.ReadLine().Split().Select(long.Parse).ToArray();
            return ret;
        }
    }
}



Measured memory_bytes: 56056
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <set>
#include <map>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  int N;
  std::cin >> N;
  std::vector<int> mon(N+1), bre(N);
  for(int i=0;i<N+1;i++) std::cin >> mon[i];
  for(int i=0;i<N;i++) std::cin >> bre[i];
  ll count=0;
  for(int i=N-1;i>=0;i--){
    count+=min(bre[i], mon[i+1]);
    bre[i]-=min(bre[i], mon[i+1]);
    count+=min(bre[i], mon[i]);
    mon[i]-=min(bre[i], mon[i]);
  }
  std::cout << count << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;

int main(){
    int N;
    cin >> N;
    vector<ll> A(N);
    for(int i=0; i<N; i++) cin >> A[i];
    ll count = 0;

    for(int i=1; i<N; i++) {
        if(A[i-1] > A[i]) {
            count += (A[i-1]-A[i]);
            A[i] = A[i-1];
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 4836
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
using namespace std;
int main(){
	int n;
	cin>>n;
	while(n>0){
		int a=n%10;
		if(a==7){
			cout<<"Yes";
			return 0;
		}
		n/=10;
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>
int main()
{
	int n,k,a[101]={0},b,c;
    scanf("%d%d",&n,&k);
    for(int i=0;i<k;i++)
    {
		scanf("%d",&b);
	    for(int j=0;j<b;j++)
	    {
		    scanf("%d",&c);
		    a[c]++;
	    }
    }
	c=0;
    for(int i=1;i<=n;i++)
    {
		if(a[i]==0)c++;
	}
	printf("%d",c);
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<vector<ll>> A(N, vector<ll>(N));
  vector<vector<ll>> B(N, vector<ll>(N));
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) {
      ll a;
      cin >> a;
      A[i][j] = a;
      B[i][j] = a;
    }

  bool exist = true;
  ll ans = 0;
  for (int k = 0; k < N; k++) {
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < N; j++) {
        if (A[i][j] > min(A[i][j], A[i][k] + A[k][j])) exist = false;
        if (A[i][j] == A[i][k] + A[k][j] && i != k && j != k) B[i][j] = 0;
      }
    }
  }
  for (int i = 0; i < N; i++)
    for (int j = 0; j < N; j++) ans += B[i][j];
  if (exist)
    cout << ans / 2 << endl;
  else
    cout << -1 << endl;

  return 0;
}


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

#define rep(i,n) for (int i = 0; i < (n); ++i)

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;

int main() {
  string S;
  cin >> S;

  int count = 0;
  char before = S[0];
  rep(i, S.size()) {
    if (before != S[i]) {
      count++;
      before = S[i];
    }
  }

  cout << count << endl;
  
  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define repr(i, n) for(int i=(n-1); 0<=i; i--)
#define repr2(i, from, to) for(int i=(from-1); (int)(to)<=i; i--)
#define ALL(obj) (obj).begin(), (obj).end()
typedef long long ll;

using namespace std;

struct Point { int x, y; };
struct Edge { int to, cost; };
struct Node { int from, to, cost; };

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

int gcd(int a, int b){ return a % b == 0 ? b : gcd(b, a%b); }
int lcm(int a, int b){ return a * b/ gcd(a, b); }
int extgcd(int a, int b, int& x, int& y){
	int d = a;
	if(b != 0){
		d = extgcd(b, a%b, y, x);
		y -= (a/b) * x;
	} else{
		x = 1; y = 0;
	}
	return d;
}

int main(void){
	int n, m; cin >> n >> m;
	vector<vector<int> > v(m+1);
	rep(i, n){
		int a, b;
		cin >> a >> b;
		if(a > m) continue;
		v[a].push_back(b);
	}


	ll ans = 0;
	priority_queue <int> que;
	for(int i=1; i<m+1; i++){
		rep(j, v[i].size()){
			que.push(v[i][j]);
		}
		if(que.size() != 0){
			ans += que.top();
			que.pop();
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 5504
#include <cstdio>
#include <cmath>
#include <iostream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <cassert>
#include <string>
#include <cstring>
#include <queue>

using namespace std;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define S(x) scanf("%d",&x)
#define S2(x,y) scanf("%d%d",&x,&y)
#define P(x) printf("%d\n",x)
#define all(v) v.begin(),v.end()
#define FF first
#define SS second
#define pb push_back
#define mp make_pair

typedef long long int LL;
typedef pair<int, int > pii;
typedef vector<int > vi;

int main() {
  int n;
  S(n);
  int ans = 0;
  for(int i = 3; i <= n; i += 2) {
    int cnt = 0;
    rep(j,1,i+1) if(i % j == 0) {
      cnt++;
    }
    ans += cnt == 8;
  }
  P(ans);
  return 0;
}


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

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


using namespace std;


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




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

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

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

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

	return ans;
}

ll F(ll a, ll b) {
	ll c1=0, c2=0;
	while (a > 0) {
		a /= 10;
		c1++;
	}
	while (b > 0) {
		b /= 10;
		c2++;
	}
	return max(c1, c2);
}

bool used[20000000];
signed main() {
	m0(used);
	ll N; cin >> N;
	ll res = INF;
	ll m = (ll)sqrt(N)+1;
	FOR(i,1, m+1000) {
		if (N%i == 0) {
			if (used[i]) {
				cout << res << endl;
				return 0;
			}
			res = min(res, F(i, N / i));
			if (i < 20000000 && N / i < 20000000)used[i] = used[N / i] = true;
		}
	}
	cout << res << endl;
	return 0;
}




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

typedef long long ll;

vector < pair<ll,int> > v;
int n,V,p;
ll m,c[100005];

bool check(int index){
	vector <pair<ll,int> > v2;
	for(int i=0;i<100005;i++) c[i]=0;
	v2=v;
	int _=v2[index].second;
	ll sum=ll(m*ll(V)); 
	v2[index].first+=m; sum-=m;
	int __=v2[index].first;
	for(int i=0;i<v2.size();i++) if(i!=index){
		if(sum<=0) break;
		if(v2[i].first>v2[index].first){
			v2[i].first+=min(sum,m);
			c[i]=min(sum,m);
			sum-=min(sum,m);
			continue;
		}
		if(v2[i].first==v2[index].first) continue;
		if(v2[i].first<v2[index].first){
			ll add=min(sum,min(v2[index].first-v2[i].first,m));
			c[i]=add;
			v2[i].first+=add;
			sum-=min(sum,add);
		}
	}
	for(int i=0;i<v2.size();i++) if(index!=i){
		if(sum<=0) break;
		ll add=min(sum,m-c[i]);
		sum-=add;
		v2[i].first+=add;
	}
	sort(v2.begin(),v2.end());
	reverse(v2.begin(),v2.end());
	for(int i=0;i<p;i++){
		if(-v2[i].second==_||v2[i].first==__) return true;
	}
	return false;
}

int main(){
	cin>>n>>m>>V>>p;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		v.push_back(make_pair(x,i));
	}
	sort(v.begin(),v.end());
	reverse(v.begin(),v.end());
	int low=0,high=v.size(),ans=-1;
	while(low<high){
		int mid=(low+high)/2;
		if(check(mid)){
			ans=max(ans,mid);	
			low=mid+1;
		}
		else 	
			high=mid;
	}	
	if(ans==-1) 
		printf("0\n");
	else 
		printf("%d\n",ans+1);
	return 0;
}

Measured memory_bytes: 4336
import Control.Monad
import Data.List
import Data.Maybe

main = do
    [n,m,x] <- map read . words <$> getLine :: IO [Int]
    cass <- replicateM n (map read . words <$> getLine) :: IO [[Int]]
    let ansList = map head $ filter (\(z:zs) -> all (>=x) zs) $ map (foldl (\acc ca -> zipWith (+) acc ca) (replicate (m + 1) 0)) $ filter (not . null) $subsequences cass
    print $ if ansList == [] then -1 else minimum $ ansList

Measured memory_bytes: 4988
#include <iostream>
#include <vector>
#include <stack>
#include <utility>
#define infty 1000000000
using namespace std;

stack<int> lol;
vector<pair<int,int> > adj[2501];
int dist[2501];
bool seen[2501] = {};

int main(){
    int n, m, p;
    cin >> n >> m >> p;
    int u,v,w;
    for (int i = 2; i <= n; i++) dist[i] = infty;
    dist[1] = 0;
    while(m--){
        cin >> u >> v >> w;
        adj[u].emplace_back(v, p - w);
    }
    for (int i = 1; i < n; i++){
        for (int u = 1; u <= n; u++){
            int v, w;
            if (dist[u] != infty){
                for (int j = 0; j < adj[u].size(); j++){
                    v = adj[u][j].first;
                    w = adj[u][j].second;
                    if (dist[v] > dist[u] + w) dist[v] = dist[u] + w;
                }
            }
        }
    }

    for (int u = 1; u <= n; u++){
        int v, w;
        if (dist[u] != infty){
            for (int j = 0; j < adj[u].size(); j++){
                v = adj[u][j].first;
                w = adj[u][j].second;
                if (dist[v] > dist[u] + w){
                    lol.push(u);
                    seen[u] = 1;
                    break;
                }
            }
        }
    }
    while(!lol.empty()){
        int u = lol.top(), v;
        lol.pop();
        for (int i = 0; i < adj[u].size(); i++){
            v = adj[u][i].first;
            if (!seen[v]){
                seen[v] = 1;
                lol.push(v);
            }
        }
    }
    int ans = dist[n];
    if ((ans == infty) || (seen[n])) cout << -1 << '\n';
    else cout << max(-ans, 0) << '\n';


}


Measured memory_bytes: 384
# coding:utf-8

import sys


input = sys.stdin.readline


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


N = int(input())
A = inpl()

a = max(A)
tmp = 0
b = min(A)
for i in range(N):
    x = A[i]
    if x == a: continue
    x = max(x, a - x)
    if tmp < a - x:
        b = A[i]
        tmp = a - x

print(a, b)


Measured memory_bytes: 14044
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A: abc of ABC
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int N = 3;

/* typedef */

/* global variables */

int cs[N];

/* subroutines */

/* main */

int main() {
  string s;
  cin >> s;

  for (int i = 0; i < N; i++) cs[s[i] - 'a']++;

  for (int i = 0; i < N; i++)
    if (cs[i] != 1) {
      puts("No");
      return 0;
    }

  puts("Yes");
  return 0;
}


Measured memory_bytes: 256