akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
int main(){
  vll a(5);
  ll k;
  ll ans=0;
  rep(i,5) cin>>a[i];
  cin>>k;
  rep(i,4)for(int j=i+1;j<5;j++){
    if(a[j]-a[i]>k)ans++;
  }
  if(ans) COUT(":(");
  else COUT("Yay!");
  
}

Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
#define int long long
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=10000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
struct node{int l,r,a;}seg[200200];
bool operator<(node p,node q) {return p.r<q.r;}
int n,m;
ll mx[3100800],tag[3100800];

int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

void pushdown(int id,int l,int r)
{
	if (tag[id]!=0)
	{
		tag[id<<1]+=tag[id];tag[id<<1|1]+=tag[id];
		mx[id<<1]+=tag[id];mx[id<<1|1]+=tag[id];
		tag[id]=0;
	}
}

void modify(int id,int l,int r,int ql,int qr,int val)
{
	pushdown(id,l,r);
	if ((l>=ql) && (r<=qr))
	{
		mx[id]+=val;tag[id]+=val;
		return;
	}
	int mid=(l+r)>>1;
	if (ql<=mid) modify(id<<1,l,mid,ql,qr,val);
	if (qr>mid) modify(id<<1|1,mid+1,r,ql,qr,val);
	mx[id]=max(mx[id<<1],mx[id<<1|1]);
}

ll query(int id,int l,int r,int ql,int qr)
{
	pushdown(id,l,r);
	if ((l>=ql) && (r<=qr)) return mx[id];
	int mid=(l+r)>>1;ll ans=0;
	if (ql<=mid) ans=max(ans,query(id<<1,l,mid,ql,qr));
	if (qr>mid) ans=max(ans,query(id<<1|1,mid+1,r,ql,qr));
	return ans;
}

signed main()
{
	n=read();m=read();
	rep(i,1,m)
	{
		seg[i].l=read();seg[i].r=read();seg[i].a=read();
	}
	sort(seg+1,seg+1+m);
	int pos=1;
	rep(i,1,n)
	{
		modify(1,1,n,i,i,query(1,1,n,1,i));
		while ((pos<=m) && (seg[pos].r==i))
		{
			modify(1,1,n,seg[pos].l,seg[pos].r,seg[pos].a);
			pos++;
		}
	}
	ll ans=max(0ll,query(1,1,n,1,n));
	printf("%lld",ans);
	return 0;
}


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

typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

void solve(){
    llint x;
    cin >> x;
    llint t=1;
    llint sum=0;
    while(sum<x){
        sum+=t;
        t++;
    }
    cout << t-1 << endl;
}

int main(){
  solve();
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

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

  cout << ((s[2] == s[3] && s[4] == s[5]) ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 256
N,Y=gets.chomp.split(" ").map{|s| s.to_i}
x,y,z=-1,-1,-1
for t in 0..N
  for u in 0..N-t
    if (10000*t)+(5000*u)+(1000*(N-t-u))==Y
      x,y,z=t,u,N-t-u
    end
  end
end
puts "#{x} #{y} #{z}"

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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> p(M);
    vector<string> S(M);
    for(int i=0; i<M; i++){
        cin >> p.at(i) >> S.at(i);
    }
    vector<int> check(N);
  	vector<int> WA(N);
  	for(int i=0; i<N; i++){
       	check.at(i) = 0;
      	WA.at(i) = 0;
    }
    for(int i=0; i<M; i++){
        if(check.at(p.at(i)-1)==0){
            if(S.at(i)=="WA") WA.at(p.at(i)-1) += 1;
            if(S.at(i)=="AC") check.at(p.at(i)-1) = 1;
        }
    }
  	int AC=0;
  	int Wa=0;
    for(int i=0; i<N; i++){
		if(check.at(i)==1){
			AC += 1;
          	Wa += WA.at(i);
        }
    }
    cout << AC << " " << Wa << endl;
    return 0;
}

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

int f[10];
int main(){
  for(int i=0; i<3; i++){
   int x;
    scanf("%d", &x);
    f[x]++;
  }
  if(f[5] == 2 && f[7] == 1){
    puts("YES");
  }else{
   	puts("NO"); 
  }
}

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

using namespace std;

void solve()
{
    //4*h*w*n = N(h*w+w*n+n*h)
    //(4*h*w)*n = N(h*w) + (N(w+h)) * n
    //(4*w*h - N(w+h))*n = N(h*w)
    long N;
    cin >> N;
    for (int h = 1; h <= 3500; h++)
        for (int w = 1; w <= 3500; w++)
        {
            if (4 * w * h == N * (w + h))
                continue;
            long n = (N * (h * w)) / (4 * w * h - N * (w + h));
            if (n > 0 && (N * (h * w)) % (4 * w * h - N * (w + h)) == 0)
            {
                cout << h << ' ' << w << ' ' << n << endl;
                return;
            }
        }
}

int main()
{
    solve();
    return 0;
}


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

void solve(long long n, std::vector<long long> v){
    map<ll,int> counter_odd;
    map<ll,int> counter_even;
    int odd_count = 0;
    int even_count = 0;
    for (ll i=0;i<n;i++){
        if (i%2==0){
            counter_even[v[i]]++;
            even_count++;
        } 
        else {
            counter_odd[v[i]]++;
            odd_count++;
        }
    }
    counter_even[-1] = 0;
    counter_odd[-2] = 0;
    vector<pair<int,ll>> cand_even;
    vector<pair<int,ll>> cand_odd;
    for (const auto t : counter_even){
        cand_even.push_back(make_pair(even_count - t.second,t.first));
    }
    for (const auto t : counter_odd){
        cand_odd.push_back(make_pair(odd_count - t.second,t.first));
    }
    sort(cand_even.begin(),cand_even.end());
    sort(cand_odd.begin(),cand_odd.end());
    int ans;
    if (cand_even[0].second == cand_odd[0].second){
        ans = min(cand_even[1].first + cand_odd[0].first,cand_even[0].first + cand_odd[1].first);
    }else{
        ans = cand_even[0].first + cand_odd[0].first;
    }

    printf("%d\n",ans);



}

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


Measured memory_bytes: 9592
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n,w = list(map(int, input().split()))
wv = [None]*n
for i in range(n):
    wv[i] = tuple(map(int, input().split()))
w0 = wv[0][0]
wv = [(item[0]-w0, item[1]) for item in wv]
ans = 0
def sub(k):
    W = w - k*w0
    m = min(W, sum(item[0] for item in wv))
    dp = [[[0]*(k+1) for _ in range(m+1)] for _ in range(n+1)]
    for i in range(1,n+1):
        iw, iv = wv[i-1]
        for j in range(m+1):
            for kk in range(1,k+1):
                if j>=iw:
                    dp[i][j][kk] = max(dp[i-1][j][kk], dp[i-1][j-iw][kk-1]+iv)
                else:
                    dp[i][j][kk] = dp[i-1][j][kk]
#     print(k, dp)
    return max(dp[n][j][kk] for j in range(m+1))
for k in range(1, w//w0+1):
    if k>n:
        break
    ans = max(ans, sub(k))
print(ans)

Measured memory_bytes: 205072
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Apolloliu
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

//#define print(s)      cerr << s << endl
//#define print(a, b)      cerr << a << " "  << b << endl
#define MEM(a,b)    memset(a, b, sizeof(a))
#define UN(a)       sort(all(a)), a.erase(unique(all(a)), a.end())
#define REV(a)      reverse(all(a))
#define MP(a, b)    make_pair(a, b)
#define PAIR(a, b)  pair<int, int>(a, b)

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;
const int maxn = 1;
const double EPS = 1e-8;

int a[123465];
int lcm(int a, int b){
	return a / __gcd(a, b) * b;
}
class CSkip {
public:
	void solve(std::istream& in, std::ostream& out) {
		int n, x;
		memset(a, 0, sizeof(a));
		in >> n >> a[0];
		for (int i = 1; i <= n; ++i) {
			in >> a[i];
		}
		sort(a, a + n + 1);
		int res = a[1] - a[0];
		for (int i = 1; i <= n; ++i) {
			res = __gcd(a[i] - a[i - 1], res);
		}
		out << res << '\n';
	}
};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	CSkip solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 768
#include<iostream>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,n) for(int i=1;i<=n;i++)
int main()
{
    int r,c;

    cin >> r >> c;

    int mat[r+1][c+1];

    rep(i,r){

        mat[i][c]=0;

        rep(j,c){
            cin >> mat[i][j];
            mat[i][c] += mat[i][j];
        }
        
    }

    rep(j,c+1){
        mat[r][j]=0;
        rep(i,r){
            mat[r][j] += mat[i][j];
        }

    }

    rep(i,r+1){
        rep(j,c+1){
            cout << mat[i][j];
            if(j!=c) cout << " ";
        }
        cout << endl;
    }

    return 0;

}


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

typedef long long ll;
typedef pair<int,int> P;

#define p_ary(ary,a,b) do { cout << "["; for (int count = (a);count < (b);++count) cout << ary[count] << ((b)-1 == count ? "" : ", "); cout << "]\n"; } while(0)
#define p_map(map,it) do {cout << "{";for (auto (it) = map.begin();;++(it)) {if ((it) == map.end()) {cout << "}\n";break;}else cout << "" << (it)->first << "=>" << (it)->second << ", ";}}while(0)

template<typename T1,typename T2>ostream& operator<<(ostream& os,const pair<T1,T2>& a) {os << "(" << a.first << ", " << a.second << ")";return os;}

const char newl = '\n';

int main() {
    int n;
    cin >> n;
    unordered_set<string> st;
    for (int i = 0;i < n;++i) {
        string s;
        cin >> s;
        st.insert(s);
    }
    cout << st.size() << endl;
}

Measured memory_bytes: 17648
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define ALL(i) (i).begin(),(i).end()
#define RALL(i) (i).begin(),(i).end(),greater<int>()
using namespace std;
#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T> void print(T x) { std::cout << x << '\n'; }

typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
#define TENFIVE2 200005
typedef pair<ll, bool>P;
// #define int long long
bool compair(const P& a, const P& b ){
    return a > b  ;

}


signed main(){
    vector<pair<ll, bool>>pr;
    
    int N;
    ll H;
    cin>>N>>H;
    rep(i,N){
        ll tmp;cin>>tmp;
        pr.pb(mp(tmp,false));
        cin>>tmp;pr.pb(mp(tmp,true));
    }
    sort(ALL(pr),compair );
    // rep(i,pr.size()){
    //     print(pr[i].fst);
    // }
    ll sum=0,ans=0;
    rep(i,pr.size()){
        if(pr[i].sec){sum+=pr[i].fst;ans++;}
        else{
            H -=sum;
            ans+=ceil(double(H)/double(pr[i].fst));
            H = sum;
        }
        if(H<=sum)break;
    }
    print(ans);

    return 0;
}


Measured memory_bytes: 6384
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

class MainClass : Scanner
{
    static int[] D;
    static void Main()
    {
        int N = RInt();
        D = RInts();
        Array.Sort(D);

        int ans = 0;
        for (int i = 0; i < 13; i++)
        {
            if (check(i)) ans = i;
        }
        WriteLine(ans);
    }
    static bool check(int time)
    {
        int l = D[0];
        int r = 0;
        if (Abs(l - r) < time) return false;
        for (int i = 1; i < D.Length; i++)
        {
            if (Abs(l - D[i]) >= time)
            {
                l = D[i];
            }
            else
            {
                if (Abs(r - D[i]) < time) return false;
                r = D[i];
            }

            if (Abs(l - (24 - r)) < time) return false;
        }
        return true;
    }
}



class Scanner
{
    public static string RString() => Console.ReadLine();
    public static int RInt() => ReadTuple<int>();
    public static long RLong() => ReadTuple<long>();
    public static double RDouble() => ReadTuple<double>();

    public static string[] RStrings() => Console.ReadLine().Split();
    public static int[] RInts() => Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
    public static long[] RLongs() => Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
    public static double[] RDoubles() => Array.ConvertAll(Console.ReadLine().Split(), double.Parse);
    public static int[] RInts(Func<string, int> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static long[] RLongs(Func<string, long> func) => Console.ReadLine().Split().Select(func).ToArray();
    public static double[] RDoubles(Func<string, double> func) => Console.ReadLine().Split().Select(func).ToArray();
    //public static string[] RStrings(Func<string, string> func) => Console.ReadLine().Split().Select(func).ToArray();

    public static T1 ReadTuple<T1>()
    {
        var r = RString();
        var r1 = (T1)Convert.ChangeType(r, typeof(T1));
        return r1;
    }
    public static (T1, T2) ReadTuple<T1, T2>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        return (r1, r2);
    }
    public static (T1, T2, T3) ReadTuple<T1, T2, T3>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        return (r1, r2, r3);
    }
    public static (T1, T2, T3, T4) ReadTuple<T1, T2, T3, T4>()
    {
        var r = RStrings();
        var r1 = (T1)Convert.ChangeType(r[0], typeof(T1));
        var r2 = (T2)Convert.ChangeType(r[1], typeof(T2));
        var r3 = (T3)Convert.ChangeType(r[2], typeof(T3));
        var r4 = (T4)Convert.ChangeType(r[3], typeof(T4));
        return (r1, r2, r3, r4);
    }
}


Measured memory_bytes: 27596
import numpy as np

def main():
    N = np.int64(input())
    sts = np.array([np.array([i for i in input().split(" ")]) for n in range(N)])
    X = input()
    musics = list(sts[:,0])
    times = sts[:,1].astype("int64")
    ind = musics.index(X)
    sleeptimes = times[ind+1:]
    #print(sleeptimes)
    ans = np.sum(sleeptimes)
    print(ans)
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 21900
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <iostream>
#include <bitset>
#include <cassert>
#include <queue>
#include <random>
#include <stack>
#include <iomanip>

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

using Int = unsigned int;
using llong = long long;
using Llong = unsigned long long;
using ldouble = long double;
using intV = vector<int>;
using llongV = vector<long long>;
using llongVV = vector<vector<long long>>;
using Graph = vector<vector<long long>>;
using costGraph = vector<vector<pair<long long, long long>>>;

struct Edge {
    long long from;
    long long to;
    long long cost;
};

template<typename T>
using asc = less<T>();
template<typename T>
using desc = greater<T>();

const llong MOD = 1e9 + 7;
const llong INF = 1e17;

#define FOR(i, n) for (llong i = 0; i < n; i++)
#define FORS(i, a, b) for (llong i = a; i < b; i++)
#define FORR(i, n) for (llong i = n; i > 0; i++)
#define sup(vec, a) upper_bound(vec.begin(), vec.end(), a) - vec.begin()
#define inf(vec, a) lower_bound(vec.begin(), vec.end(), a) - vec.begin()

llongV depth;
llongV ans;
llongVV edges;

llong bfs(llong now) {
    if(depth[now] != -1) return depth[now];
    llong ret = 0;
    for(llong pr : edges[now]) {
        llong d = bfs(pr);
        if(ret < d) {
            ret = d;
            ans[now] = pr;
        }
    }
    ret++;
    depth[now] = ret;
    return ret;
};

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

    llong N, M;
    cin >> N >> M;

    edges = llongVV(N);
    depth = llongV(N, -1);
    ans = llongV(N, -1);

    FOR(i, N + M - 1) {
        llong fr, to;
        cin >> fr >> to;
        fr--; to--;
        edges[to].push_back(fr);
    }

    FOR(i, N) {
        bfs(i);
    }

    FOR(i, N) {
        cout << (ans[i] + 1) << endl;
    }

    return 0;
}

Measured memory_bytes: 10880
#include <iostream>
#include <string>
using namespace std;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
typedef long long ll;
typedef long double ld;
#define MOD1 1000000007
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int main(){
  ll n,m,k,i,j,result=0,sum=0;
  ll a[200010]={0};
  string s;
  cin >> n;
  rep(i,n){
    cin >> a[i];
    sum += a[i];
  }
  rep(i,n){
    sum -= a[i];
    result += (a[i] * (sum % MOD1)) % MOD1;
    result %= MOD1;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 5172
/*input
3 7
1 6 3
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const double PI=acos(-1);
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}
ll a[maxn];

ll cnt[50];

int main()
{
	IOS;
	ll n,k;
	cin>>n>>k;
	REP(i,n) cin>>a[i];

	REP(i,n) REP(j,40) if(a[i]&(1LL<<j)) cnt[j]++;
	k++;
	ll ans=0;
	for(int i=39;i>=0;i--) if(k&(1LL<<i)){
		ll cur=0;

		for(int j=39;j>i;j--){
			if(k&(1LL<<j)) cur+=(n-cnt[j])*(1LL<<j);
			else cur+=cnt[j]*(1LL<<j);
		}
		cur+=cnt[i]*(1LL<<i);
		for(int j=i-1;j>=0;j--){
			cur+=max(cnt[j],n-cnt[j])*(1LL<<j);
		}
		ans=max(ans,cur);
	}
	cout<<ans<<'\n';
	return 0;
}


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

int main(){
int N;
  cin>>N;
  int ans=0;
  for(int i=0; i<=25; i++){
    for(int j=0; j<15; j++){
    if(4*i+7*j==N){
    ans=true;
    }
   }
  }
  if(ans){cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SORT(x) sort(x.begin(),x.end())
#define ALL(x) x.begin(),x.end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define INF 4000000000000000003 //1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

void Main(){

  int K,N;
  cin>>N>>K;

  vector<pair<int,int>> prx;
  vector<pair<int,int>> pry;

  rep(i,N){
    int x,y;
    cin>>x>>y;
    prx.emplace_back(x,y);
    pry.emplace_back(y,x);
  }

  SORT(prx);
  SORT(pry);

  ll ans=INF;


  rep(maxx,N){
    rep(minx,maxx){

      rep(maxy,N){
        rep(miny,maxy){
          ll maxxnum=prx[maxx].first;
          ll minxnum=prx[minx].first;
          ll maxynum=pry[maxy].first;
          ll minynum=pry[miny].first;
          int ct=0;

          reps(i,minx,maxx+1){
            if(prx[i].second<=maxynum and prx[i].second>=minynum) ++ct;
          }

          if(ct>=K){
            ans=min(ans,(maxxnum-minxnum)*(maxynum-minynum));
          }

        }
      }

    }
  }

  cout<< ans<<"\n";

}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int W,H,x,y,r;
	cin>>W>>H>>x>>y>>r;
	if(W < x+r){
		cout<<"No"<<endl;
	}
	else if(0 >x-r){
		cout<<"No"<<endl;
	}	
	else if(H < y+r){
		cout<<"No"<<endl;
	}
	else if(0 > y-r){
		cout<<"No"<<endl;
	}
	else
		cout<<"Yes"<<endl;
return 0;
}



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

#define msn(x) (memset((x),0,sizeof((x))))
#define msx(x) (memset((x),0x7f,sizeof((x))))
#define fuck(x) cerr << #x << " <- " << x << endl
#define acer cout<<"sb"<<endl
typedef long long ll;
using namespace std;
const int maxn=1e5+7;
struct node
{
    int v,d;
};
vector<int>g[maxn];
int n,m;

int fa[maxn],siz[maxn];
int dis[maxn];
int anc(int a)////謇セ辷ク辷ク
{
	if(fa[a]==a)return a;
	fa[a]=anc(fa[a]);
	return fa[a];
}
void uni(int aa,int bb,int w)///霑樊磁
{
	int a=anc(aa);
	int b=anc(bb);
	if(siz[a]<=siz[b])swap(a,b),swap(aa,bb),w=-w;
	int sb=w+dis[aa]-dis[bb];
	fa[b]=a;
	for(int i=0;i<g[b].size();i++)
    {
        dis[g[b][i]]=sb+dis[g[b][i]];
        g[a].push_back(g[b][i]);
    }
	siz[a]+=siz[b];
}
void ini1()//蟷カ譟・髮??蟋句喧
{
	for(int i=1;i<=n;i++)
	{
		fa[i]=i;
		siz[i]=1;
		dis[i]=0;
		g[i].clear();
		g[i].push_back(i);
	}
}
int main()
{
    while(~scanf("%d%d",&n,&m))
    {
        if(n==0&&m==0)break;
    ini1();
    char ope[5];
    int u,v,w;
    for(int i=0;i<m;i++)
    {
        scanf("%s",ope);
        if(ope[0]=='!')
        {
            scanf("%d%d%d",&u,&v,&w);
            if(anc(u)!=anc(v))
            {
                uni(u,v,-w);
            }
        }
        else
        {
            scanf("%d%d",&u ,&v);
            if(anc(u)!=anc(v))printf("UNKNOWN\n");
            else printf("%d\n",dis[u]-dis[v]);
       }
    }
    }

    return 0;
}

Measured memory_bytes: 8796
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;

int main() {
  int n, ans=0;
  cin >> n;
  vector<int> a(n), b(n), c(n-1);
  rep(i, n) cin >> a.at(i);
  rep(i, n) cin >> b.at(i);
  rep(i, n-1) cin >> c.at(i);
  ans += accumulate(b.begin(), b.end(), 0);
  rep(i, n-1){
    if(a.at(i) == a.at(i+1)-1) ans+=  c.at(a.at(i)-1);
  }
  cout << ans;
}

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

int main() {
	int N;
	long T, mn=1e10, MaxAbs=0, num=0;
	cin >> N >> T;
	for(int i=0; i<N; ++i){
	    long A; cin >> A;
	    if(mn>A) mn=A;
	    if(A-mn>MaxAbs){
	        MaxAbs=A-mn;
	        num=1;
	    }
	    else if(A-mn==MaxAbs) ++num;
	}
	cout << num << endl;
	return 0;
}



Measured memory_bytes: 256
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>
#include <tuple>
#include <utility>
#include <fstream>

std::string s1, s2;
long dp[1005][1005];

int main(){
	std::cin >> s1 >> s2;
	for(int i = 0; i <= s1.length(); i++){
		for(int j = 0; j <= s2.length(); j++){
			if(i == 0){
				if(j != 0){
					dp[i][j] = dp[i][j-1]+1;
				}
			}else{
				if(j == 0){
					dp[i][j] = dp[i-1][j]+1;
				}else{
					if(s1[i-1] == s2[j-1]){
						dp[i][j] = dp[i-1][j-1];
					}else{
						dp[i][j] = std::min(dp[i-1][j], std::min(dp[i][j-1], dp[i-1][j-1])) + 1;
					}
				}
			}
		}
	}
	printf("%ld\n", dp[s1.length()][s2.length()]);
}



Measured memory_bytes: 11120
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int N;
  cin >> N;
  vector<int> A, B;
  rep(i,N){
    int a;
    cin >> a;
    A.push_back(a);
    B.push_back(a);
  }
  sort(ALLOF(B));

  int x = B[B.size()/2-1];
  int y = B[B.size()/2];
 
  rep(i,N){
    if(x < A[i]) cout << x << endl;
    else cout << y << endl;
  }
  
  return 0;
}



Measured memory_bytes: 3948
import std.stdio, std.conv, std.string, std.algorithm, std.array, std.container, std.format;

class Rectangle {
  int h;
  int w;
  
  this( int h, int w ) {
	this.h = h;
	this.w = w;
  }
  
  override int opCmp( Object o ) {
	Rectangle r = cast(Rectangle)o;
	immutable int diag = h * h + w * w;
	immutable int rDiag = r.h * r.h + r.w * r.w;
	if ( diag != rDiag ) {
	  return diag - rDiag;
	} else {
	  return h - r.h;
	}
  }

  override string toString() {
	return format( "%d %d", h, w );
  }
}

void main()
{
  auto tree = new RedBlackTree!Rectangle();
  foreach ( h; 1 .. 151 ) {
	foreach ( w; h + 1 .. 151 ) {
	  tree.insert( new Rectangle( h, w ) );
	}
  }

  while ( true ) {
	string input = readln;
	int h, w;
	formattedRead( input, "%d %d\n", &h, &w );
	if ( h == 0 && w == 0 ) break;
	auto rng = tree.upperBound( new Rectangle( h, w ) );
	writeln( rng.front );
  }
}

Measured memory_bytes: 2168
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(10)

using namespace std;

typedef pair<int, int> P;

int dp[200005][5]; // i番目までjの状態のときの最小操作回数

int count(int a, int j) {
    switch (j) {
        case 0:
        case 4:
            return a;
        case 1:
        case 3:
            if (a == 0) return 2;
            return a % 2;
        case 2:
            if (a == 0) return 1;
            return (a + 1) % 2;
        default:
            exit(1);
    }
}

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

    int L;
    cin >> L;
    vector<int> A(L);
    REP(i, L) cin >> A[i];

    REP(i, L + 1) REP(j, 5) dp[i][j] = INF;

    dp[0][0] = 0;
    REP(i, L) {
        int prev = dp[i][0];
        REP(j, 5) {
            prev = min(prev, dp[i][j]);
            dp[i + 1][j] = min(dp[i + 1][j], prev + count(A[i], j));
        }
    }

    int ans = INF;
    REP(j, 5) {
        ans = min(ans, dp[L][j]);
    }
    cout << ans << endl;

    return 0;
}


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

#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)

typedef pair<int, int> pint;

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front

#define MOD (1000 * 1000 * 1000 + 7)

signed main() {
    int N;
    cin >> N;

    vector<int> a(N);

    int zero = 0;
    REP(i, N) {
        cin >> a[i];

        if (a[i] == 0) {
            zero++;
        }
    }
    sort(ALL(a));

    int ans = 0;
    if (zero == N) {
        ans = 1;
    } else if (N % 3 == 0) {
        int n = N / 3;
        ans = 1;
        if (a[n*0] != a[n*1-1]) {
            ans = 0;
        }
        if (a[n*1] != a[n*2-1]) {
            ans = 0;
        }
        if (a[n*2] != a[n*3-1]) {
            ans = 0;
        }
        if ((a[n*0] ^ a[n*1]) != a[n*2]) {
            ans = 0;
        }
    }

    cout << (ans ? "Yes" : "No") << endl;

    return 0;
}

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

int main() {
	int t, m;
	cin >> t;
	vector<int> f(t);
	for (int &i : f)
		cin >> i;
	cin >> m;
	
	vector<int>s(m);
	for (int &j : s) {
		cin >> j;
	}

	sort(begin(f), end(f));
	sort(begin(s), end(s));
	int p1 = 0, p2 = 0, k = 0;
	while (p2 < m && p1 < t) {
		if (f[p1] == s[p2]) {
			++k;
			++p1;
			++p2;
		}
		else {
			if (f[p1] <= s[p2])
				++p1;
			else
				++p2;
		}
	}
	if (k == m)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
#ifdef DIMA_DEBUG
	system("pause");
#endif // DIMA_DEBUG

}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

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

  int n;
  cin >> n;

  string ans = "No";
  for (int i = 1; i <= 9; i++) {
    for (int j = 1; j <= 9; j++) {
      if (i * j == n) ans = "Yes";
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
x1, y1, x2, y2 = map(int, input().split())
dx, dy = x1 - x2, y1 - y2

x3 = x2 + dy
y3 = y2 - dx

x4 = x1 + dy
y4 = y1 - dx

print(x3, y3, x4, y4)


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

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

int main() {
    ll n,m;
    string s,t;
    cin >> n >> m >> s >> t;
    ll x=gcd(n,m);
    n/=x,m/=x;
    bool ans=true;
    for(int i = 0; i < x; i++) {
        if(s[i*n] != t[i*m]) ans=false;
    }
    if(ans){
        cout << n*m*x << endl;
    }
    else{
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3720
s = list(str(input()))
t = list(str(input()))
a = []
for i in range(len(s) - len(t) + 1):
    if i != 0:
        t.insert(0, 0)
    count = 0
    for k in range(len(s)):
        if k < len(t):
            if s[k] != t[k] and t[k] != 0:
                count += 1
    a.append(count)
print(min(a))

Measured memory_bytes: 9068
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int N, K, S, tmp;
    cin >> N >> K >> S;
    if(S == inf - 7){
        tmp = 1;
    }else{
        tmp = inf - 7;
    }
    
    for(int i = 0; i < N; i++){
        if(i < K) cout << S << " ";
        else cout << tmp << " ";
    }
    return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <limits>
#include <boost/range/irange.hpp>
#include <boost/range/adaptors.hpp>
#include <string>

using namespace std;
using namespace boost;
using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long int;


bool is_bomb_exist(int v, int h, vector<vector<char>> & map){
    return v >= 0 && h >= 0 && v < map.size() && h < map.at(0).size() && map.at(v).at(h)=='#';
}

uint validate(int v, int h, vector<vector<char>> & map){
    uint count{0};
    count += is_bomb_exist(v-1, h-1, map);
    count += is_bomb_exist(v-1, h, map);
    count+=is_bomb_exist(v-1,h+1,map);
    count+=is_bomb_exist(v,h+1,map);
    count+=is_bomb_exist(v+1,h+1,map);
    count+=is_bomb_exist(v+1, h, map);
    count+=is_bomb_exist(v+1, h-1, map);
    count+=is_bomb_exist(v, h-1, map);
    return count;
}


int main() {
    uint H, W;
    cin >> H >> W;
    vector<vector<char>> map(H, vector<char>(W, 0));
    for (auto &&v: irange(0U, H)){
        for (auto &&h: irange(0U, W)){
            cin >> map.at(v).at(h);
        }
    }
    vector<vector<char>> ret(map);
    for (auto &&v: irange(0U, H)){
        for (auto &&h: irange(0U, W)){
            if(map.at(v).at(h)=='.'){
                ret.at(v).at(h) = to_string(validate(v, h, map)).at(0);

            }
        }
    }
    for (auto &&v: irange(0U, H)){
        for (auto &&h: irange(0U, W)){
            cout << ret.at(v).at(h);
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <utility>

using namespace std;

const int MAX_N = 1E5 + 10;
vector<int> a[MAX_N];
vector<bool> used(MAX_N, false);

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

    int n, res = 0;
    cin >> n;
    vector<pair<int, int>> inp(n - 1);
    for (int i = 0; i < n - 1; i++)
    {
        int u, v;
        cin >> u >> v;
        inp[i] = {u, v};
        a[u].push_back(v);
        a[v].push_back(u);
    }

    queue<pair<int, int>> s;
    s.push({1, -1});
    map<pair<int, int>, int> colors;

    while (!s.empty())
    {
        pair<int, int> cur = s.front();
        int clr = 1;
        used[cur.first] = true;
        s.pop();
        for (auto each : a[cur.first])
            if (!used[each])
            {
                clr += (cur.second == clr);
                colors[{cur.first, each}] = clr;
                res = max(res, clr);
                s.push({each, clr});
                clr++;
            }
    }

    cout << res << "\n";
    for (int i = 0; i < n - 1; i++)
        cout << colors[inp[i]] << "\n";

    return 0;
}


Measured memory_bytes: 13056
//#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
//#include "Header.h"
int main()
{
	int n, m, c, b[30], a[30][30];
	int i, j, k,ans=0;
	cin >> n >> m >> c;
	for (i = 1; i <= m; i++)
	{
		cin >> b[i];
	}
	for (i = 1; i <= n; i++)
	{
		k = c;
		for (j = 1; j <= m; j++)
		{
			cin >> a[i][j];
			k += a[i][j] * b[j];
		}
		//printf("k%d\n", k);
		if (k > 0)
		{
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
  int n; cin >> n;
  int ans = 0;
  int k = 0x7FFFFFFF, s = 0;
  bool d = false;
  for (int i = n; i--; ) {
    int a, b; cin >> a >> b;
    if (a > b) {
      k = min(b, k);
    }
    s += a;
    if (a != b) d = true;
  }
  cout << (d ? s - k : 0) << endl;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(true){
            int a = sc.nextInt();
            int b = sc.nextInt();
            if(a == 0 && b == 0)break;
            for(int i = 0; i<a; i++){
                for(int j=0;j<b;j++){
                    System.out.print("#");
                }
                System.out.println();
            }
            sc.nextLine();
            System.out.println();
        }
    }
}


Measured memory_bytes: 37820
#include<stdio.h>
#define N 100
#define MAX 2000
#define INFTY (1<<21)
#define WHITE 0
#define GRAY 1
#define BLACK 2


int A[N][N], n;

void dijkstra(){
  int i, u, v, minv, sum = 0;
  int d[N], color[N];

  for( i = 0 ; i < n ; i++){
    d[i] = INFTY;
    color[i] = WHITE;
  }
  d[0] = 0;
  color[0] = GRAY;
  while(1){
    minv = INFTY;
    u = -1;
    for( i = 0; i < n ; i++){
      if(minv > d[i] && color[i] != BLACK){
        u = i;
        minv = d[i];
      }
    }
    if( u == -1 ) break;
    color[u] = BLACK;
    for( v = 0 ; v < n ; v++){
      if( color[v] != BLACK && A[u][v] != INFTY ){
        if( d[v] > d[u] + A[u][v] ){
          d[v] = d[u] + A[u][v];
          color[v] = GRAY;
        }
      }
    }
  }
  for( i = 0 ; i < n ; i++ ){
    printf("%d %d\n", i, (d[i] == INFTY ? -1 : d[i]));
  }
}


int main(){
  int i, j, s;
  int u, v, c, k;
  scanf("%d", &n);
  for( i = 0 ; i < n ; i++ ){
    for( j = 0 ; j < n ; j ++){
      A[i][j] = INFTY;
    }
  }
  for( i = 0 ; i < n ; i++ ){
    scanf("%d%d", &u, &k);
    for( j = 0 ; j < k ; j ++){
      scanf("%d%d", &v, &c);
      A[u][v] = c;
    }
  }

  dijkstra();

  return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,s,n) for(int i=(s); i<(n); i++)
#define all(v) v.begin(),v.end()
#define outve(v) for(auto i : v) cout << i << " ";cout << endl
#define outmat(v) for(auto i : v){for(auto j : i) cout << j << " ";cout << endl;}
#define in(n,v) for(int i=0; i<(n); i++){cin >> v[i];}
#define out(n) cout << (n) << endl
#define fi first
#define se second
#define pb push_back
#define mod 1000000007
#define infi 1900000000
#define infl 1100000000000000000
#define cyes cout << "Yes" << endl
#define cno cout << "No" << endl
#define csp << " " <<
#define outset(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T> using ve = vector<T>;
template<typename T> using pq2 = priority_queue<T>;
template<typename T> using pq1 = priority_queue<T,vector<T>,greater<T>>;




int main()
{

    string S;
    cin >> S;
    int N = int(S.length());
    
    int ans = 1;
    int b = 1;
    int s = 1;
    while (s < N) {
        int t = s;
        if(b > 1){
            ans++;
            b = 1;
            s++;
            
        }else{
            if(S[s] != S[s-1]){
                ans++,b = 1,s++;
            }else{
                if(s+1 == N){
                    //ans++;
                    s++;
                }else{
                    s+=2;
                    ans++;
                    b = 2;
                }
            }
        }
        
        //cout << S.substr(t,(s-t)) << endl;
    }
    cout << ans << endl;
    
    

    return 0;
}


Measured memory_bytes: 640
#include"bits/stdc++.h"
#include<cassert>
#define fr first
#define sc second
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 998244353;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
int a[100005];
signed main() {
	int n, k, q; cin >> n >> k >> q;
	rep(i, n)a[i] = q;
	rep(i, q) {
		int b; cin >> b; a[b - 1]--;
	}
	rep(i, n) {
		if (k-a[i]>0 )puts("Yes");
		else puts("No");
	}
}

Measured memory_bytes: 1408
/******************************************
* AUTHOR : Ashish Joshi* 
* INSTITUTION : NIT Hamirpur *
******************************************/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100005
#define MOD 1000000007
#define dd double
#define loop(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define set(b,i) (b|(1<<i))
#define unset(b,i) (b&!(1<<i))
#define cbit(b,i) bool(b&(1<<i))

int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//ios_base& scientific (ios_base& str);

int n;
cin>>n;
string s;
cin>>s;

for(auto x:s)
{
	x='A'+(x-'A'+n)%26;
	cout<<x;
}


return 0;
}

Measured memory_bytes: 508
import bisect

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

A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]

WA = [0] * (N + 1)
WB = [0] * (M + 1)
for i in range(N):
    WA[i + 1] = WA[i] + A[i]
for j in range(M):
    WB[j + 1] = WB[j] + B[j]
ma = 0
last = False
for i in range(0, N + 1):
    if WA[i] > K:
        break
    t = K - WA[i]
    j = bisect.bisect(WB, t)
    ma = max(ma, i + j - 1)

print(ma)


Measured memory_bytes: 47428
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
#define FAST  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long int 
#define ar array
#define pb push_back
#define fi(a,b) for(int i=a;i<(b);i++)
#define fj(a,b) for(int j=a;j<(b);j++)
#define fk(a,b) for(int k=a;k<(b);k++)
#define lb lower_bound
#define ub upper_bound
//hash base 177013

const int INF=1000000000+7;

int main()
{
	FAST;
	//#ifndef ONLINE_JUDGE
	//	freopen("input.txt","r",stdin);
	//	freopen("output.txt","w",stdout);
	//#endif
	//ll testcase;
	//cin>>testcase;
	//while(testcase--)
	{
		int n,w;
		cin>>n>>w;
		ll a[n][2];
		fi(0,n)
		{
			cin>>a[i][0]>>a[i][1];
		}
		ll dp[w+2];
		fi(0,w+1)
		{
			dp[i]=-INF;
		}
		dp[0]=0;
		fi(0,n)
		{
			for(int j=w;j>=0;j--)
			{
				if(j-a[i][0]>=0)
				{
					dp[j]=max(dp[j],dp[j-a[i][0]]+a[i][1]);
				}
			}
		}
		ll ans=0;
		fi(0,w+1)
		{
			ans=max(ans,dp[i]);
			//cout<<dp[i]<<' ';
		}
		cout<<ans;
		
		
		
	}
}


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

int main(){
	int a, b, c; // a:fee, b:shojikin, c:count
	cin >> a >> b >> c;

	int max;
	if(a*c > b){
		max = b/a;
	}else{
		max = c; 
	}

	cout << max << endl;

	return 0;
}

Measured memory_bytes: 256
// 26/01/20 // 10:06 AM //

#include <bits/stdc++.h>

using namespace std;

const int MAXN = (int)(1e2) + 10;
const int MAXK = (int)(1e5) + 10;

int n, k;
int a[MAXN], memo[MAXK];

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

    cin >> n >> k;
    for(int i=0; i<n; i++) cin >> a[i];

    for(int h=1; h<=k; h++)
        for(int i=0; i<n && a[i]<=h && !memo[h]; i++)
            memo[h] = !memo[h-a[i]];

    cout << (memo[k]?"First\n":"Second\n");

    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
int main(void){
	int K;
	scanf("%d",&K);
	int a;
	int e=0;
	int o=0;
	for(a=1;a<K+1;a++){
		if((a%2)==0){
			e++;
		}else{
			o++;
		}
	}
	printf("%d",(e*o));
return 0;
}

Measured memory_bytes: 128
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scan()
	a, z := -1, -1
	for i, r := range s {
		if string(r) == "A" {
			a = i
			break
		}
	}
	for i, r := range s {
		if string(r) == "Z" {
			z = i
		}
	}
	fmt.Println(z - a + 1)
}


Measured memory_bytes: 2480
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    long long int n;
    cin>>n;
    long long int i=1;

    while(n>(i*(i+1))/2){
        i++;
    }
    cout<<i<<endl;

    return 0;
}


Measured memory_bytes: 256