akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <random>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;

typedef
tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define relaxMax(a, b) a = max(a, b)
#define relaxMin(a, b) a = min(a, b)

typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
}

void solve() {
    int x;
    cin >> x;
    cout << (x >= 30 ? "Yes" : "No") << '\n';
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

Measured memory_bytes: 3644
#include <iostream>

using namespace std;

bool is_uneven(int n) {
    int digits = 0;
    while (n > 0) {
        ++digits;
        n /= 10;
    }
    return digits % 2 == 1;
}

int main() {
    int n;
    cin >> n;

    int count = 0;
    for (int i = 1; i <= n; ++i) {
        if (is_uneven(i))
            ++count;
    }
    cout << count << '\n';
}


Measured memory_bytes: 256
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
#define ALL(a)  (a).begin(),(a).end()
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
int per(int n, int r) {
	r = n - r;
	int sum = 1;
	int i;
	for (i = n; i >= r + 1; i--)sum *= i;
	return sum;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};

int ctoi(const char c) {
	return c - '0';
}
int keta(int a) {
	return to_string(a).size();
}
int a[114];
signed main() {
	int n;
	cin >> n;
	rep(i, n) {
		cin >> a[i];
	}
	rep(i, n) {
		if (a[i] % 2 == 0 && a[i] % 3 != 0 && a[i] % 5 != 0) {
			cout << "DENIED" << endl;
			return 0;
		}
	}
	cout << "APPROVED" << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

int main()
{
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    for(int i=0; i<h; ++i)
        cin >> s[i];

    vector<vector<bool> > used(h, vector<bool>(w, false));
    long long ans = 0;
    for(int y=0; y<h; ++y){
        for(int x=0; x<w; ++x){
            if(s[y][x] != '#' || used[y][x])
                continue;

            vector<int> cnt(2, 0);
            queue<pair<int, int> > q;
            q.push(make_pair(y, x));
            used[y][x] = true;
            while(!q.empty()){
                int y1, x1;
                tie(y1, x1) = q.front();
                q.pop();
                ++ cnt[s[y1][x1]=='#'?0:1];

                for(int i=0; i<4; ++i){
                    int y2 = y1 + dy[i];
                    int x2 = x1 + dx[i];
                    if(0 <= y2 && y2 < h && 0 <= x2 && x2 < w && !used[y2][x2] && s[y1][x1] != s[y2][x2]){
                        used[y2][x2] = true;
                        q.push(make_pair(y2, x2));
                    }
                }
            }
            ans += cnt[0] * (long long)cnt[1];
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 512
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

int trans(int n){
	return 100-n;
}
	int t,n;

int dfs(vvi &m,int x,int y,int step){
	m[x][y]=1;
	if(step==t){
		return 1;
	}
	int ans=1;
	REP(i,6){
		int xx=x+dx[i];
		int yy=y+dy[i];
		if(!m[xx][yy]){
			ans+=dfs(m,xx,yy,step+1);
		}
	}
	return ans;
}

struct node{
	int x,y,step;
	node(int x,int y,int step):x(x),y(y),step(step){}
};
int main(){
	while(cin>>t>>n,t|n){
		vvi m(200,vi(200));
		vi x(n),y(n);
		REP(i,n){
			cin>>x[i]>>y[i];
		}
		int sx,sy;
		cin>>sx>>sy;
		REP(i,n){
			m[trans(x[i]-sx)][trans(y[i]-sy)]=1;
		}
		queue<node> q;
		q.push(node(trans(0),trans(0),0));
		m[trans(0)][trans(0)]=1;
		int ans=1;
		while(!q.empty()){
			node n=q.front();
			q.pop();
			if(n.step==t){
				continue;
			}
			REP(i,6){
				int xx=n.x+dx[i];
				int yy=n.y+dy[i];
				if(!m[xx][yy]){
					m[xx][yy]=1;
					ans++;
					q.push(node(xx,yy,n.step+1));
				}
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 1348
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b,c; cin >> a >> b >> c;
    if(a != b && b == c)cout << "Yes" << endl;
    else if(b != c && b == a) cout << "Yes" << endl;
    else if(c != a && c == b) cout << "Yes" << endl;
    else if(b != a && a == c) cout << "Yes" << endl;
    else cout << "No" << endl;
   return 0;
}

Measured memory_bytes: 256
from collections import Counter
N = int(input())
v = list(map(int, input().split()))
v_odd = v[0::2]
v_even = v[1::2]
cnt_o = Counter(v_odd).most_common()
cnt_e = Counter(v_even).most_common()
if cnt_o[0][0] != cnt_e[0][0]:
    print(N - cnt_o[0][1] - cnt_e[0][1])
else:
    if len(cnt_o) == 1 and len(cnt_e) == 1:
        print(N // 2)
    elif len(cnt_o) == 1:
        print(len(v_even) - cnt_e[1][1])
    elif len(cnt_e) == 1:
        print(len(v_odd) - cnt_o[1][1])
    else:
        print(min(N - cnt_o[1][1] - cnt_e[0][1], N - cnt_o[0][1] - cnt_e[1][1]))


Measured memory_bytes: 21084
#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    ios::sync_with_stdio(false);

    int a, b, c1, c2, c3;

    cin>>a>>b;

    c1 = a+b;
    c2 = a-b;
    c3 = a*b;

    cout<<max(c1, max(c2, c3))<<endl;

    return 0;
}

Measured memory_bytes: 256
from collections import Counter

N = int(input())
V = list(map(int, input().split()))

s1 = Counter(V).most_common(2)[0]
s2 = Counter(V).most_common(2)[0]
V1 = V[0::2]
V2 = V[1::2]
c1 = c2 = c3 = c4 = 0
Z1 = Counter(V1)
Z2 = Counter(V2)
x1, c1 = Z1.most_common(1)[0]
x2, c2 = Z2.most_common(1)[0]
if len(Z1) > 1:
    x3, c3 = Counter(V1).most_common(2)[1]
if len(Z2) > 1:
    x4, c4 = Counter(V2).most_common(2)[1]
if x1 == x2:
    a = max(c1+c4, c2+c3)
    print(N-a)
else:
    print(N - c1 - c2)

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

string S;
int alpha[26];

int main()
{
    cin>>S;
    for (int i = 0; i < 26; i++)
    {
        alpha[i] = 0;
    }
    
    for (int i = 0; i < S.size(); i++)
    {
        alpha[S[i] - 'a'] = 1;
    }

    for (int i = 0; i < 26; i++)
    {
        if(alpha[i] == 0){
            cout << (char)('a' + i) << endl;
            return 0;
        } 
    }
        
    cout << "None" << endl;
    return 0;
}


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

typedef double du ;
typedef string st ;
typedef long long ll ;
typedef long double ld ;
typedef long long int lli ;

#define vi vector <lli>
#define loop(num) for (lli i = 0 ; i < num ; i ++ )
#define loopcin(num , ar ) for (lli i = 0 ; i < num ; i ++ ) {cin >> ar [i] ;}
#define loopcout(num , ar) for (lli i = 0 ; i < num ; i ++ ) {cout << ar [i] << ' '; }

#define forr(num1 , num2) for (lli i = num1 ; i < num2 ; i ++ )
#define forrcin(num1 , num2 , ar ) for (lli i = num1 ; i < num2 ; i ++ ) {cin >> ar [i] ;}
#define forrcout(num1 , num2 , ar) for (lli i = num1 ; i < num2 ; i ++ ) {cout << ar [i] << ' '; }

#define D2forrcin(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cin >> A[i][j] ;}}
#define D2forrcout(num1_1 , num1_2 , num2_1 , num2_2 , A ) for (lli i = num1_1 ; i < num1_2 ; i ++){ for (lli j = num2_1 ; j < num2_2 ; j++){cout << A[i][j] << ' ' ;}cout << endl ;}

#define Yes cout << "Yes" << endl ;
#define yes cout << "yes" << endl ;
#define No cout << "No" << endl ;
#define no cout << "no" << endl ;

#define coset(num , q)cout << fixed << setprecision(num) << q << endl ;

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int main ()
{
    fastio

    lli t , x ;
    cin >> t >> x ;

    du q = (du)t / x ;

    coset(10 , q ) ;

    return 0 ;
}

/*___________________________________________________________________functions___________________________________________________________________________*/



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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

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

struct PrimalDual{
    using F=long long;
    const F INF=1ll<<50;
    
    struct Edge{
        int to;
        F cap,cost;
        int rev;
        Edge(int to,F cap,F cost,int rev):to(to),cap(cap),cost(cost),rev(rev){}
    };
    
    int n;
    vector<vector<Edge>>G;

    PrimalDual(int n):n(n),G(n){}

    void addEdge(int from,int to,F cap,F cost){
        G[from].push_back(Edge(to,cap,cost,G[to].size()));
        G[to].push_back(Edge(from,0,-cost,G[from].size()-1));
    }


    double solve(int s,int t,F P){
        F cur=0;

        vector<F>h(n);
        vector<int>prevv(n,-1),preve(n,-1);
        vector<F>dist(n);
        priority_queue<pair<F,int>,vector<pair<F,int>>,greater<pair<F,int>>>que;
        
		double ans=1e10;
        for(int z=1;;z++){
            fill(dist.begin(),dist.end(),INF);
            dist[s]=0;
            que.emplace(0,s); 
            while(que.size()){
                F d;
                int v;
                tie(d,v)=que.top();
                que.pop();
                if(dist[v]<d)continue;
                for(int i=0;i<G[v].size();i++){
                    Edge &e=G[v][i];
                    F nd=dist[v]+e.cost+h[v]-h[e.to];
                    if(e.cap>0&&dist[e.to]>nd){
                        dist[e.to]=nd;
                        prevv[e.to]=v;preve[e.to]=i;
                        que.emplace(nd,e.to);
                    }
                }
            }
            if(dist[t]==INF)break;
            for(int v=0;v<n;v++)h[v]+=dist[v];
            cur+=h[t];
            for(int v=t;v!=s;v=prevv[v]){
                Edge &e=G[prevv[v]][preve[v]];
                e.cap-=1;
                G[v][e.rev].cap+=1;
            }
			chmin(ans,1.0*(cur+P)/z);
        }
		return ans;
    }
};



signed main(){
	int N,M,P,S,T;
	cin>>N>>M>>P>>S>>T;
	S--;T--;

	PrimalDual pd(N);
	rep(i,M){
		int u,v,d,c;
		cin>>u>>v>>d>>c;
		u--;v--;
		pd.addEdge(u,v,c,d);
	}

	printf("%.20f\n",pd.solve(S,T,P));
	return  0;
}


Measured memory_bytes: 3360
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi >;
using vl = vector<ll>;
using vvl = vector<vl >;
using pairi = pair<int, int>;
using pairl = pair<ll, ll>;

#define TR ","
#define TS " "
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define rpt(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

ll gcd(int a, int b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

void printVector(const vector<ll>& vec) {
    for (ll value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

vector<int> IntegerToVector(int bit, int N) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

int main()
{
    ll ans, t=1, ni=1, e=1, N; cin >> N;

    ll cst = 1000000007;

    rep(i, N) {
        t = t * 10 % cst;
        ni = ni * 9 % cst;
        e = e * 8 % cst;
    }

    ans = (t - (ni + ni - e)) % cst;

    if (ans >= 0) {
        cout << ans << endl;
    }
    else {
        cout << ans + cst << endl;
    }

}

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

int main()
{
	int64_t a, b, c;
	cin >> a >> b >> c;
	cout << min(a, c) + 2 * min(c - min(a, c), b) + (b - min(c - min(a, c), b)) + (0 < c - a - b) << endl;
	return 0;
}

Measured memory_bytes: 256
#create date: 2020-06-29 09:33

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n, k = na()
    p = na()
    p.sort()
    print(sum(p[:k]))

if __name__ == "__main__":
    main()

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using namespace std;
#define dbug(x) cout<<#x<<"-->"<<x<<endl
const int maxn = 2e5 +100;

int main()
{
   long long n,d=10,p=0;
   cin >> n;
   if(n%2){
        cout << 0;
        return 0;
   }
   while(n/d)
   {
       p += n/d;
       d *= 5;
   }
   cout << p;
}


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

std::vector<long long int> enum_div(long long int n) {
  std::vector<long long int> ret;
  for(long long int i=1 ; i*i<=n ; ++i) {
    if(n%i == 0) {
      ret.push_back(i);
      if(i!=1 && i*i!=n) {
        ret.push_back(n/i);
      }
    }
  }
  ret.push_back(n);
  return ret;
}

int main() { 
  long long int n, ans = 10000000000000;
  cin >> n;
  vector<long long int> v = enum_div(n);
  for(int i = 0; i < v.size(); ++i) {
    long long int a = n/v[i] + v[i] - 2;
    if(a < ans) ans = a;
  }
  cout << ans << '\n';
}


Measured memory_bytes: 384
import java.util.Scanner;



public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	
		int n = sc.nextInt();
		int x = sc.nextInt();
		int t = sc.nextInt();
		
		if(n%x==0) {
			n--;
		}
		System.out.println(((n/x)+1)*t);
	}
	
}



Measured memory_bytes: 26952
#include<bits/stdc++.h> 
using namespace std; 
#define fast_io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define forp(i,a,b) for (int i = a; i <b; i++)
#define forn(i,a,b) for (int i = a; i >b; i--)
#define mod 1000000007
#define MAX 50
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;


long long int fact(long long int n)
{
  if(n==0 || n==1)
  return 1;
  else
  return (n*fact(n-1)%mod)%mod;
}

int prime(long long int n)
{
  for(int i=2;i<=sqrt(n);i++)
  {
    if(n%i==0)
    {
      return 0;
    }
  }
  return 1;
}

long long int gcd(long long int a,long long int b)
{
  if(a==0)
  return b;
  else
  return gcd(b%a,a);
}

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

int check_palin(string s)
{
  string str=s;
  reverse(str.begin(),str.end());
  if(str==s)
  return 1;
  else 
  return 0;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
            int k,n,z=0,ans=0,start=-1,end=-1,f=0,c=0;
            cin>>n>>k;
            vector<int> start_index;
string s;
            cin>>s;
            start=0,end=0;
            
            for(int i=1;i<n;i++)
            {
              if(s[i]=='1' && s[i-1]=='0')
              {
                start_index.push_back(i);
              }
              else if(i==1 && s[i-1]=='1')
              start_index.push_back(0);
            }
            z=0;
            if(s[n-1]=='0')
            start_index.push_back(n);

if(k-1<start_index.size())
{
  z=0;
  end=start_index[k-1];
  z+=end;
  while(end<n && s[end]=='1')
  {
    z++;
    end++;
  }
  ans=max(ans,z);
}            

for(int i=0;i<start_index.size();i++)
{
  if(start_index[i]!=n)
  {
   start=start_index[i];
   end=-1;
   z=0;
   if(i+k<start_index.size())
   {
     end=start_index[i+k];
   
     z+=(end-start);
     while(s[end]=='1' && end<n)
     {
       z++;
       end++;
     }
     ans=max(ans,z);
   }
   else
   {
     ans=max(ans,n-start);
   }
  }
}

//cout<<start_index.size();
if(k>=start_index.size())
ans=n;

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

Measured memory_bytes: 768
#include<stdio.h>
#include<stdlib.h>
#define MAX 10001
#define INF 2e8

struct node{
  int k;
  int w;
  struct node *n;
};

typedef struct node *Node;
 
Node G[MAX];

Node cpy(int k,int w,Node n)
{
  Node x;
  
  x= (Node)malloc(sizeof(struct node));
  x->k = k;
  x->w = w;
  x->n = n;
  
  return x;
}

void insert(int a,int b,int c)
{
  Node x;
  x=cpy(b,c,G[a]->n);
  G[a]->n=x;
}


int main()
{
  int i,j,n,count=0,u,k,v,c,color[MAX],d[MAX],pi[MAX],min,save;
  Node s;
 
  scanf("%d",&n);
  for(i=0; i<n; i++)
    G[i]=cpy(0,0,NULL);
  for(i=0; i<n; i++){
    scanf("%d%d",&u,&k);
    for(j=0; j<k; j++){
      scanf("%d%d",&v,&c);
      insert(i,v,c);
    }
  }
  for(i=0; i<n; i++){
    color[i] = 0;
    pi[i] = -1;
    d[i] = INF;
  }
  d[0] = 0;
  while(1){
    min = INF;
    for(i=0; i<n; i++){
      if(color[i]!=2 && d[i]<min){
        min=d[i];
        save = i;
      }
    }
    if(min == INF)
        break;
    color[save]=2;
    for(s=G[save]; s!=NULL; s=s->n){
      if(color[s->k]!=2 && (s->w+d[save])<d[s->k]){
	    pi[s->k] = save;
	    d[s->k] = s->w+d[save];
    	color[s->k]=1;
      }
    }
  }
  for(i=0; i<n; i++)
    printf("%d %d\n",i,d[i]);
  return 0;
}


Measured memory_bytes: 17356
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int a;
  string s;
  cin >> a >> s;
  if(a>=3200)cout << s << endl;
  else cout << "red" << endl;
}  


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main(void){
    int N;
    scanf("%d",&N);

    char list[N][11];
    int i,j;

    for(i=0;i<N;i++){
        scanf("%s",list[i]);
    }
    qsort(list,N,11,strcmp);
    int count=1;

    for(j=1;j<N;j++){
        if(strcmp(list[j-1],list[j])!=0){
            count++;
        }
    }


    printf("%d",count);
    return 0;
}

Measured memory_bytes: 5716
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <sstream>
#include <vector>

using namespace std;

int main(int argc, char const *argv[]) {
  int N, L;
  cin >> N >> L;
  vector<string> S;
  for (size_t i = 0; i < N; i++) {
    string s;
    cin >> s;
    S.push_back(s);
  }

  std::sort(S.begin(), S.end());
  std::ostringstream os;
  std::copy(S.begin(), S.end(), ostream_iterator<string>(os));

  cout << os.str();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    ll INF =1e9+7;
    typedef pair<ll,ll> ii;
    #define f(i,a,b) for(long long i = a;i < b;i++)
    #define rf(i,a,b) for(long long i=a;i>=b;i--)
    #define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #define w(t) while(t--)
    #define c(n); cin>>n;
    #define p(n) cout<<n;
    #define pl(n) cout<<n<<endl;
    #define ps(n); cout<<n<<" ";
    int main(void){
        fastio;
        ll n;
        c(n);
        ll arr[n];
        set<ll>b,r,g;
        ll ans=1;
        f(i,0,n){
            c(arr[i]);
        }
        f(i,0,n){
            bool g1 = 0;
            if(b.size() == arr[i]){
                if(b.size() == r.size() && b.size() == g.size()){
                    ans*= 3;
                }
                else if(b.size() == r.size()){
                    ans *= 2;
                }
                b.insert(arr[i]);
                g1 = 1;
            }
            else if(r.size() == arr[i]){
                r.insert(arr[i]);
                if(r.size()-1 == g.size()){
                    ans *= 2;
                }
                g1 = 1;
            }
            else if(g.size() == arr[i]){
                g.insert(arr[i]);
                g1 = 1;
            }
            if(!g1){
                ans = 0;
                break;
            }
            ans %= INF;
        }
        pl(ans);
    }


Measured memory_bytes: 5760
#include <stdio.h>

int main(void){
  int College[4][11][5]={0};
  int n,p,x,y,num,i;
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d %d %d %d",&p,&y,&x,&num);
    College[y][x][p]+=num;
  }
  for(p=1;p<5;p++){
    for(y=1;y<4;y++){
      for(x=1;x<11;x++){
	printf(" %d",College[y][x][p]);
      }
      puts("");
    }
    if(p!=4) puts("####################");
  }
  return 0;
}

Measured memory_bytes: 608
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
typedef pair<int, int> P;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n, m;
    cin >> n >> m;
    vector<vector<int>> v(n);
    rep(i, m)
    {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    queue<int> que;
    que.push(0);
    vector<int> ans(n);
    ans[0] = -1;
    while (!que.empty())
    {
        auto it = que.front();
        que.pop();
        for (auto i : v[it])
        {
            if (ans[i] == 0)
            {
                ans[i] = it + 1;
                que.push(i);
            }
        }
    }
    cout << "Yes" << endl;
    for (int i = 1; i < n; i++)
    {
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 10116
/*
Website : https://atcoder.jp/contests/abc145/tasks/abc145_d
Problem : D - Knight
Method  : Math
Status  : 
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int inf=1e10;
inline int read() {
	int x(0),neg(1);char ch(getchar());
	while(!isdigit(ch)) {
		if (ch=='-') neg=-1;
		ch=getchar();
	}
	while(isdigit(ch)) {
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*neg;
}
const int mod=1e9+7;
const int maxn=1e6+5;
int fac[maxn],inv[maxn];
inline int C(int x,int y) {
	return fac[x]%mod*inv[x-y]%mod*inv[y]%mod;
}
inline int qpow(int x,int y) {
	int res(1);
	while(y) {
		if (y&1) res=res*x%mod;
		x=x*x%mod;
		y>>=1;
	}
	return res;
} 
signed main() {
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);	
	int x=read(),y=read();
//	printf("%lld %lld\n",x,y);
	fac[0]=1;
	for (int i=1;i<=maxn;++i) {
		fac[i]=fac[i-1]*i%mod;
	}
	inv[maxn-1]=qpow(fac[maxn-1],mod-2);
	for(int i=maxn-2;i>=0;--i)
	    inv[i]=inv[i+1]*(i+1)%mod;
	if ((2*x-y)%3!=0) {
		puts("0");
		return 0;
	}
	int a=(2*x-y)/3,b=x-2*a;
//	printf("%lld %lld\n",a,b);
	if (a<0 || b<0) {
		puts("0");
		return 0;
	}
//	puts("hello");
	printf("%lld\n",C(a+b,b));
	return 0;
}
/*
2a + b = X
2b + a = Y
3a = 2X - Y
*/
/*
3 3

2
*/

Measured memory_bytes: 15872
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
#define dcml(n) fixed<<setprecision(n)
//CONST
//------------------------------------------
const ll INF=1010000000000000017LL;
const ll MOD=1000000007LL;
const ld EPS=1e-12;
const ld PI=3.14159265358979323846;
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define  FORS(i,m,n) for(ll (i)=(m);   (i)<=(n); (i)++)
#define  RFOR(i,m,n) for(ll (i)=(n)-1; (i)>=(n); (i)--)
#define RFORS(i,m,n) for(ll (i)=(n);   (i)>(n);  (i)--)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
#define WREPS(i,in,j,jn) REPS(i,in)REPS(j,jn)
//-----------------------------------------
//namespace
using namespace std;
//ライブラリはここに
//↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

//-----------------------------------------
int main(void){
    ll N;cin>>N;
    vector<ll> A(N);
    REP(i,N)cin>>A[i];
    ll ans=1;
    bool flag=false;
    REP(i,N){
        if(A[i]==0){
            cout<<0<<"\n";
            return 0;
        }
        if(ans<=1000000000000000000LL/A[i]){
            ans*=A[i];
        }else{
            flag=1;
        }
    }
    if(!flag){
        cout<<ans<<"\n";
    }
    else{
        if(ans==0)cout<<0<<"\n";
        else cout<<-1<<"\n";
    }
    return 0;
}


Measured memory_bytes: 4048
s = input()
n = len(s)
ans = 0

for i in range(2 ** (n - 1)) :
    k = int(s[0])
    for j in range(n - 1):
        if (i >> j) & 1 :
            ans += k
            k = 0
        k *= 10
        k += int(s[j + 1])
    ans += k

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int A, B, C;
    cin >> A >> B >> C;
    if (A == B && B == C) yes;
    else no;
    
    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/exawizards2019/exawizards2019_a && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/exawizards2019/exawizards2019_a && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/exawizards2019/exawizards2019_a && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    int n,d,x;
    cin >> n >> d >> x;
    int chocolate = x;
    rep(i,n){
        int a = 0;
        cin >> a;
        int eaten = 0;
        for(int j=1;j<=d;j++){
            if(j == 1 || (j-1)%a == 0){
                eaten++;
            }
        }
        chocolate += eaten;
    }
    cout << chocolate << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
"use strict"

function Main(input) {
  input = input.split(' ');
  let A = parseInt(input.shift());
  let B = parseInt(input.shift());
  console.log(Math.max(...[2*A-1, 2*B-1, A + B]));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		int N = Integer.parseInt(tokens[0]);
		int X = Integer.parseInt(tokens[1]);
		int T = Integer.parseInt(tokens[2]);
		int time = N % X == 0 ? N / X : N / X + 1;
		time *= T;
		System.out.println(time);
	}

	void calc() {
	}

	void showResult() {
	}
}


Measured memory_bytes: 25324
#include <bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
const int N=1e5+50;
int n,a[N],b[N],a1,a2;
int main()
{
    IO;
    cin>>n;
    for(int i=1;i<=n;i++)cin>>a[i],b[i]=a[i];
    for(int i=1;i<n;i++)
        if(a[i]==i)swap(a[i],a[i+1]),a1++;
    if(a[n]==n)swap(a[n],a[n-1]),a1++;
    for(int i=n;i>1;i--)
        if(b[i]==i)swap(b[i],b[i-1]),a2++;
    if(b[1]==1)swap(b[1],b[2]),a2++;
    cout<<min(a1,a2);
}


Measured memory_bytes: 1024
import java.util.*;
public class Main {

		
	    public static void main(String[] args) throws java.io.IOException{
	        Scanner scan = new Scanner(System.in);
	        int max_2n=123456*2;
	        boolean [] prime = new boolean [max_2n+1];
	        for(int i=3;i<=max_2n;i+=2)prime[i]=true;
	        prime[2]=true;
	        int limit = (int)Math.sqrt(max_2n);
	        for(int i=3;i<=limit;i+=2){
	        	if(prime[i]){
	        		for(int j=i*i;j<=max_2n;j+=i*2)prime[j]=false;
	        	}
	        }
	        
	        while(true){
	        	int n=scan.nextInt();
	        	if(n==0)break;
	        	int ans=0;
	        	for(int i=n+1;i<=2*n;i++)
	        		if(prime[i])ans++;
	        	System.out.println(ans);
	        }
	  
	        }
	     
}

Measured memory_bytes: 13000
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
int N;
int A,B,C,D;
int a[100001];
string s;
long long int T[101];
long long int gcd(long long int a,long long int b){
  if(a<b){
    long long int temp=a;
    a=b;
    b=temp;
  }

  if(b==0)return a;
  return gcd(b,a%b);
}
int main(){
  cin >> N;
  for(int i=0;i<N;i++)cin >> T[i];
  long long int ans=1;
  for(int i=0;i<N;i++){
    long long int g=gcd(ans,T[i]);
    ans/=g;
    ans*=T[i];
   
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
c = input()

wr = c.count('WR')
r = c.count('R')
w = c.count('W')

if wr == 0:
    print(0)
else:
    c_sorted = 'R'*r + 'W'*w
    ans = 0
    for i in range(n):
        if c[i] != c_sorted[i]:
            ans += 1
        else:
            ans += 0
    print(ans//2)

Measured memory_bytes: 9676
#include <bits/stdc++.h>
using namespace std;
typedef bool boool;
typedef long long ll;
#define vl vector<ll>
#define vb vector<boool>
#define vs vector<string>
#define vp vector<pair<ll, ll>>
#define vvl vector<vector<ll>>
#define vvp vector<vector<pair<ll, ll>>>
#define mod 1000000007
#define all(x) x.begin(), x.end()
#define rep1(i, n) for (long long i=0; i<(long long)(n); i++)
#define rep2(i, s, e) for (long long i=(s); i<(long long)(e); i++)
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
#define rep(...) GET_MACRO(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)

int main() {
    ll n, k;
    cin >> n >> k;
    vl vec(n);
    rep(i, n) cin >> vec[i]; 
    sort(all(vec));
    ll ng = 0;
    ll ok = 1000000001;
    while(abs(ok-ng)>1){
        ll mid = (ok+ng)/2;
        ll sum = 0;
        rep(i, n){
            sum += (vec[i]+(mid-1))/mid-1;
        }
        if(sum <= k) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 4784
#include <bits/stdc++.h>
#define FI first
#define SE second
#define VE vector<int>
#define PB push_back
#define PA pair<int,int>
#define MA make_pair
#define ll long long
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
#define POS(i) cout<<(i?"POSSIBLE":"IMPOSSIBLE")<<endl
#define Pos(i) cout<<(i?"Possible":"Impossible")<<endl
#define co(i) cout<<i<<endl
#define fcout cout<<fixed<<setprecision(10)
#define uni(i) i.erase(unique(i.begin(), i.end()), i.end());
using namespace std;

const int INF=1e9+7;
const int MOD=1e9+7;

int main(){
	double n,m;
	int d;
	cin>>n>>m>>d;
	if(d)
	fcout<<(n-d)*2/n*(m-1)/n<<endl;
	else fcout<<(n-d)/n*(m-1)/n<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

int main()
{
    int n;
    cin >>n;
    vector<string> s(n);
    rep(i,n) cin >>s[i];
    string t;
    cin >>t;

    int l=1,r=1;

    rep(i,n)
    {
        string a=s[i], z=s[i];
        rep(j,a.size())if(a[j]=='?')
        {
            a[j]='a';
            z[j]='z';
        }

        r += (a<=t);
        l += (z<t);
    }

    vector<int> ans;
    for(int i=l; i<=r; ++i) ans.pb(i);
    int A = ans.size();
    rep(i,A) cout << ans[i] << " \n"[i==A-1];
    return 0;
}


Measured memory_bytes: 896
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
D = LIST()

su = 0
for i in range(N):
	for j in range(i+1, N):
		su += D[i]*D[j]

print(su)

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  bool flag = false;
  for (int i = 1; i < b; i++) {
    if ((i*a)%b == c) {
      flag = true;
    }
  }
  if (flag) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int debt_amount(int, int);

int main(){
	int n;
	scanf("%d", &n);
	printf("%d\n", debt_amount(100000, n));
	return 0;
}

int debt_amount(int a, int x){
	if(x >= 1){
		a = a * 1.05;
		if(a%1000 != 0){
			a = (a/1000 + 1)*1000;
		}
		return debt_amount(a, x-1);
	}else{
		return a;
	}
}

Measured memory_bytes: 588
#include <iostream>
#include <vector>
using namespace std;
typedef vector <int> vi;

vi dec2binv(int n){
	vi x;
	while (n>0){
		if (n%2==1) x.push_back(1);
		else x.push_back(0);
		n/=2;
	}
	if (x.empty()) x.push_back(0);
	return x;
}

int main(void){

	int weight[10] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512};

	while (true){
		int n;
		cin>>n;
		if (cin.eof()) break;
		vi tmp = dec2binv(n);
		bool f=false;
		for (int i=0; i<int(tmp.size()); i++){
			if (tmp[i]==1){
				if (f) cout<<" ";
				else f=true;
				cout<<weight[i];
			}
		}
		cout<<endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_poizcy.hpp>
typedef long long  ll;
#define pb                push_back
#define mp                make_pair
#define all(a)            (a).begin(), (a).end()
#define mem(a,h)          memset(a, (h), sizeof(a))
#define fi first
#define se second
#define por(a,b) (((a%MOD) * (b%MOD))%MOD)
#define forg(i, b, e, c)    for (ll i = (ll)b; i < (ll)e; i+=c)
#define forr(i, b, e)    for (ll i = b; i < e; i++)
 
 
using namespace std;
//using namespace __gnu_pbds;
typedef long double lldb;
typedef pair<ll, ll>  ii;
typedef pair<lldb, lldb>  iidb;
typedef pair<ll, ii>  iii;
typedef vector<ll>     vi;
typedef vector<ll>      vll;
//typedef tree<ii,null_type,less<ii>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
const ll INF = 1e9+7;
const lldb PI = acos(-1);
#define initseg ll new_nodo=(pnodo*2),mid=(iz+der)/2;
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define tam 320000
#define offset 200
#define ptr nodo*
const ll MOD=1e9+7;
int arrpa[tam],cants[tam];
int findpa(int num)
{
	if (arrpa[num]==num)
		return num;
	else
		return arrpa[num]=findpa(arrpa[num]);
}
int main()
{
	forr(i,0,tam)
		arrpa[i]=i;
	int n,m;
	cin>>n>>m;
	int iz,der;
	set<ii> s;
	forr(i,0,m)
	{
		cin>>iz>>der;
		if(iz>der)swap(iz,der);
		if (s.find({iz,der})!=s.end())continue;
		s.insert(ii(iz,der));
		arrpa[findpa(iz)]=findpa(der);
	}	
	int maxx=0;
	forr(i,1,n+1){
		cants[findpa(i)]++;
		maxx=max(maxx,cants[findpa(i)]);
	}
	cout<<maxx<<endl;
}

Measured memory_bytes: 23524
#include<iostream>
using namespace std;
int main(){
    int a,b;
    cin >> a>>b;
    while(a!=0){
        for(int i=0;i<a;i++){
            for(int j=0;j<b;j++){
                if((i%2==0 && j%2==0) || (i%2==1 && j%2==1)) cout <<"#";
                else cout <<".";
            }
            cout <<endl;
        }
        cout<<endl;
        cin >>a>>b;
        
  
                   }
}


Measured memory_bytes: 3096
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, Q = lr()
STX = [tuple(lr()) for _ in range(N)]
event = []
for s, t, x in STX:
    event.append((s-x, 0, x))
    event.append((t-x, -1, x))

for i in range(Q):
    d = ir()
    event.append((d, 1, i))

event.sort()
answer = [-1] * Q
cur = set()
flag = False
INF = 10 ** 10
min_x = INF
for a, b, c in event:
    if b == 0:
        cur.add(c)
        if c < min_x:
            min_x = c
            flag = True
    elif b == -1:
        cur.remove(c)
        if min_x == c:
            flag = False
    elif b == 1:
        if cur:
            if not flag:
                min_x = min(cur)
                flag = True
            answer[c] = min_x

print('\n'.join(map(str, answer)))
# 19

Measured memory_bytes: 134264
N, L = map(int, input().split())

ans = 0
margin = float("inf")
for i in range(1, N + 1):

    tar = 0
    for j in range(1, N + 1):
        tar += L + j - 1

    res = 0
    for j in range(1, N + 1):
        if j == i:
            continue
        else:
            res += L + j - 1

    if abs(tar - res) < margin:
        ans = res
        margin = abs(tar - res)


print(ans)


Measured memory_bytes: 3060
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, k = na()
xli = na()
li = []
ans = 1000000000
idx = -1
for i in range(n):
    if xli[i] > 0:
        idx = i
        break
if idx == -1:
    print(abs(xli[-k]))
elif idx == 0:
    print(abs(xli[k-1]))
else:
    for i in range(max(idx - k, 0), min(idx+1, n-k+1)):
        if xli[i] * xli[i + k -1] < 0:
            ans = min(ans, 2 * abs(xli[i]) + xli[i + k -1], abs(xli[i]) + 2 * xli[i + k -1])
        else:
            if xli[i + k -1] <= 0:
                ans = min(ans, abs(xli[i]))
            else:
                ans = min(ans, abs(xli[i + k -1]))
    print(ans)


Measured memory_bytes: 58736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

template<class T> inline bool chmin(T &a,T b){
    if (a>b){a=b; return true;} return false;
}
template<class T> inline bool chmax(T &a,T b){
    if (a<b){a=b; return true;} return false;
}

const int MAX_AB=51;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    vector<int> A(N),B(N);
    rep(i,N) cin >> A[i];
    rep(i,N) cin >> B[i];
    vector<vector<int>> dp(1<<N,vector<int>(MAX_AB,INF));
    dp[0][0]=0;
    rep(bit,1<<N){
        int cnt=0;
        vector<Pii> can;
        rep(i,N) if (bit&1<<i) ++cnt;
        int order=cnt;
        rep(i,N) if (!(bit&1<<i)) can.emplace_back(i,order++);
        rep(j,MAX_AB){
            if (dp[bit][j]>=INF) continue;
            for (Pii p:can){
                int i=p.first,nj=(i%2==cnt%2?A[i]:B[i]);
                if (nj>=j) chmin(dp[bit|1<<i][nj],dp[bit][j]+p.second-cnt);
            }
        }
    }
    int ans=INF;
    rep(j,MAX_AB) chmin(ans,dp[(1<<N)-1][j]);
    if (ans==INF) ans=-1;
    cout << ans << endl;
}

Measured memory_bytes: 63744
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<fstream>

#define MOD (1000000007)

using namespace std;

typedef long long int Int;

constexpr Int TEN(int n) { return n == 0 ? 1 : 10 * TEN(n-1); }

const int max_n = 100000+10;
Int dp[max_n][2];

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

    dp[0][0] = 1;
    for(int i = 0;i < s.size();i++) {
        if(s[i] == '1') {//L=1
            //a+b==1
            dp[i+1][0] += dp[i][0]*2%MOD;
            dp[i+1][0] %= MOD;
            dp[i+1][1] += dp[i][1]*2%MOD;
            dp[i+1][1] %= MOD;

            //a+b==0
            dp[i+1][1] += (dp[i][0]+dp[i][1])%MOD;
            dp[i+1][1] %= MOD;

        } else { //L=0
            //a+b==1
            dp[i+1][1] += dp[i][1]*2%MOD;
            dp[i+1][1] %= MOD;

            //a+b==0
            dp[i+1][0] += dp[i][0];
            dp[i+1][0] %= MOD;

            dp[i+1][1] += dp[i][1];
            dp[i+1][1] %= MOD;
        }
    }

    cout<<(dp[s.size()][0]+dp[s.size()][1])%MOD<<endl;


    return 0;
}


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

int main() {
  int n, a, b, y = 0, g = 0;
  string s;
  cin >> n >> a >> b >> s;
  
  for (int i = 0; i < n; i++) {
    if (s.at(i) == 'a') {
      if (y < a + b) {
        y++;
        cout << "Yes" << "\n";
      } else {
        cout << "No" << "\n";
      }
    } else if (s.at(i) == 'b') {
      if (y < a + b && g < b) {
        y++;
        g++;
        cout << "Yes" << "\n";
      } else {
        cout << "No" << "\n";
      }
    } else {
      cout << "No" << "\n";
    }
  }
}

Measured memory_bytes: 896