akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
const int maxn=5e5+10;
string s;
int bl,br;
int z[maxn];
void Z_function()
{
	int n=s.length();
	z[0]=n;
	bl=br=0;
	for(int i=1;i<n;i++)
	{
		z[i]=0;
		if(i<=br)
		{
			int p=i-bl;
			if(z[p]<br-i+1)z[i]=z[p];
			else
			{
				z[i]=min(z[p],br-i+1);
				while(i+z[i]<n&&s[i+z[i]]==s[z[i]])z[i]++;
				bl=i;
				br=i+z[i]-1;
			}
		}
		else
		{
			while(i+z[i]<n&&s[i+z[i]]==s[z[i]])z[i]++;
			bl=i;
			br=i+z[i]-1;
		}
	}
}
/*ull seed=1331;
ull hsh[maxn],pw[maxn];
void inithash()
{
	int n=s.length();
	pw[0]=1;
	hsh[0]=s[0];
	for(int i=1;i<n;i++)
	{
		pw[i]=pw[i-1]*seed;
		hsh[i]=hsh[i-1]*seed+s[i];
	}
}
ull getval(int st,int len)
{
	ull val=hsh[st+len-1];
	if(st)val-=hsh[st-1]*pw[len];
	return val;
}*/
bool ban[maxn];
int insie(int len)
{
	int cnt=0;
//	s=s.substr(0,len);
	Z_function();
	for(int i=1;i+i<=len;i++)
	{
		int zz=z[i]/i;
		if(zz<1)continue;
		for(int j=1;j<=zz;j++)
			ban[i*(j+1)]=1;
		i=max((i*(zz+1)+2)/2,i);
	//	if(getval(0,i)==getval(i,i))cnt++;
	//	if(getval(len-i,i)==getval(len-i-i,i))cnt++;
	}
	reverse(s.begin(),s.end());
//	cout<<s<<endl;
	Z_function();
	for(int i=1;i+i<=len;i++)
	{
		int zz=z[i]/i;
		if(zz<1)continue;
		for(int j=1;j<=zz;j++)
			ban[len-i*(j+1)]=1;
		i=max((i*(zz+1)+2)/2,i);
	//	if(getval(0,i)==getval(i,i))cnt++;
	//	if(getval(len-i,i)==getval(len-i-i,i))cnt++;
	}
	for(int i=0;i<len;i++)
		if(ban[i])cnt++;
	return cnt;
}
int main()
{
	ios::sync_with_stdio(false);
	cin>>s;
	Z_function();
//	inithash();
	int n=s.length();
	for(int i=1;(i+i)<=n;i++)
	{
		if(n%i==0&&i+z[i]==n)
		{
			int pos=i+1;
			if(pos<n&&pos+z[pos]==n)
			{
			//	assert(i==1);
				cout<<n<<endl<<1<<endl;
			}
			else
			{
			//	int k=z[i]/i+1;
				cout<<2<<endl<<((n-insie(n))%MOD+MOD)%MOD<<endl;
			}
			return 0;
		}
	}
	cout<<1<<endl<<1<<endl;
	return 0;
}

Measured memory_bytes: 3356
#include <bits/stdc++.h>
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
using namespace std;

using pii = pair<int, int>;
#define fst first
#define snd second

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

inline bool check(int i, int j, int h, int w) {
	if (i < 0 or h <= i) return false;
	if (j < 0 or w <= j) return false;
	return true;
}

auto convert(vector<string> board) {
	const int h = board.size();
	const int w = board[0].size();

	vector<vector<int>> used(h, vector<int>(w, -1));


	vector<int> ret;
	int total = 0;

	while (1) {
		int ci = -1, cj = -1;
		rep(i, h)rep(j, w) {
			if (used[i][j] == -1) {
				ci = i, cj = j;
				i = h, j = w;
			}
		}

		if (ci == -1) break;

		int par = -1;
		const int num = (board[ci][cj] == '#') ? 8 : 4;

		rep(i, num) {
			pii nxt = pii(ci, cj);
			nxt.fst += dy[i], nxt.snd += dx[i];
			if (check(nxt.fst, nxt.snd, h, w) == false) continue;

			if (used[nxt.fst][nxt.snd] != -1) {
				par = used[nxt.fst][nxt.snd];
				break;
			}
		}

		ret.push_back(par);

		queue<pii> q;
		q.push(pii(ci, cj));
		used[ci][cj] = total;


		while (!q.empty()) {
			pii cur = q.front(); q.pop();
			rep(i, num) {
				pii nxt = cur;
				nxt.fst += dy[i], nxt.snd += dx[i];

				if (check(nxt.fst, nxt.snd, h, w) == false) continue;

				if (used[nxt.fst][nxt.snd] == -1 and board[nxt.fst][nxt.snd] == board[ci][cj]) {
					used[nxt.fst][nxt.snd] = total;
					q.push(nxt);
				}
			}
		}

		total++;
	}

	return ret;
}



string dfs(vector<int> tree, int v) {
	const int n = tree.size();

	vector<string> ary;
	rep(v2, n) if (tree[v2] == v) ary.push_back(dfs(tree, v2));
	sort(begin(ary),end(ary));

	string ret = "";
	for (auto &it : ary) ret += it;
	ret = "(" + ret + ")";
	return ret;
}


int main(void) {
	int h, w;

	while (cin >> h >> w, h) {
		vector<int> tree, tree2;

		{
			vector<string> board(h + 2, string(w + 2, '.'));
			rep(i, 1, h + 1)rep(j, 1, w + 1) cin >> board[i][j];
			tree = convert(board);
		}

		cin >> h >> w;

		{
			vector<string> board(h + 2, string(w + 2, '.'));
			rep(i, 1, h + 1)rep(j, 1, w + 1) cin >> board[i][j];
			tree2 = convert(board);
		}

		if (dfs(tree, 0) == dfs(tree2, 0))
			puts("yes");
		else
			puts("no");

		/*
		for(auto &it:tree) cerr << it << " ";
		cerr << endl;

		for(auto &it:tree2) cerr << it << " ";
		cerr << endl;
		*/
	}

	return 0;
}

Measured memory_bytes: 3232
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
using namespace std;
#define rep(i,x,n) for(int i=x;i<n;i++)
#define WHITE 0
#define BLACK 1
typedef long long ll;
typedef pair<ll,ll> pl;
typedef pair<int,int> pi;
string s;
int k;
int INFi=1000000000;
ll INFl=1000000000000000;

int main(){
    string s;cin>>s;
    int count=0;
    for(int i=0;i<s.size()-1-i;i++){
        if(s[i]!=s[s.size()-1-i]) count++;
    }
    cout<<count<<endl;
  return 0;
}





Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int x,y;
	while(cin>>x>>y){

		if(x==0&&y==0){break;}
		else if(x<y){cout<<x<<" "<<y<<endl;}
		else if(x>y){cout<<y<<" "<<x<<endl;}
		else if(x==y){cout<<x<<" "<<y<<endl;}

	}
	return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for (int i = 0; i < n; i++)
static const int inf = 1 << 30;
static const int MAX = 100;
int main(void) {
  int N, M;
  string s[MAX], t[MAX];
  map<string, int> mp;
  cin >> N;
  string tmp;
  REP(i, N) {
    cin >> tmp;
    mp[tmp] += 1;
  }
  cin >> M;
  REP(i, M) {
    cin >> tmp;
    mp[tmp] -= 1;
  }
  int mx = -inf;
  for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
    mx = max(mx, mp[itr->first]);
  }
  cout << max(mx, 0) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main()
{
    vector<long long > a(6);

    long long k;
    
    for(int i = 0;i<5;i++)
    {
        cin >> a[i];
    }
    
    cin >> k;

    a[5] = a[0];
    
    bool flag = true;

    for(int i = 0;i<5;i++)
    {
        if(fabs(a[i+1]-a[i]) > k)
        {
            cout << ":(" << endl;
            flag = false;
            break;
        }
    }

    if(flag == true)
        cout << "Yay!" << endl;
   
    return 0;    
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;

const long long MOD = 1e9 + 7;

class Combination {
    //a^p%mod
    ll powmod(ll a, ll p) {
        ll ans = 1LL;
        ll mul = a;
        // p >>=1 <-> p=(p >> 1)
        for (; p > 0; p >>= 1, mul = (mul * mul) % mod) {
            if ((p & 1) == 1) ans = (ans * mul) % mod;
        }

        return ans;
    }
public:
    int N;
    ll mod;
    vector<ll> fact;
    vector<ll> revFact;

    Combination(int n, ll m) : N(n), mod(m), fact(n+1), revFact(n+1) {
        fact[0] = 1;
        for (int i = 1; i <= N; i++) {
            fact[i] = fact[i-1] * i;
            fact[i] %= mod;
        }

        // Fermat's little theorem
        revFact[N] = powmod(fact[N], mod - 2);

        for (int i = N-1; i >= 0; i--) {
            revFact[i] = revFact[i+1] * (i+1);
            revFact[i] %= mod;
        }
    }

    ll get(int a, int b) {
        if (a < 0 || b < 0) return 0;
        if (b > a) return 0;
        return (((fact[a] * revFact[b]) % mod) * revFact[a-b]) % mod;
    }
};

//-----------------------------------------------------------
int main(){
  ll N, M, K;
  cin >> N >> M >> K;
  if(N > M){
    ll tmp = N;
    N = M;
    M = tmp;
  }

  Combination cm = Combination(200010, MOD);

  ll ans = 0LL;
  for(ll i = 1LL; i < N; i++){
    ll cnt = (N - i) * M * M;
    ans += cnt * i * cm.get(N * M - 2, K - 2);
    ans %= MOD;
  }
  for(ll i = 1LL; i < M; i++){
    ll cnt = (M - i) * N * N;
    ans += cnt * i * cm.get(N * M - 2, K - 2);
    ans %= MOD;
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
     
     
#define ll long long
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define pld(x) printf("%lld\n",x)
#define pd(x) printf("%d\n",x)

int main(){
    int P,Q,R;
    sd(P);
    sd(Q);
    sd(R);
    int a = min(P,Q);
    int b = max(P,Q);
    int c = min(b,R);
    int res = a + c;
    pd(res);
    return 0;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int h,w,k;
string s[305];
int ans[305][305];
int cnt,app;
int main(){
    scanf("%d %d %d",&h,&w,&k);
    for(int i=1;i<=h;i++){
        cin>>s[i];
        s[i]=" "+s[i];
    }
    for(int i=1;i<=h;i++){
        bool flag=0;
        for(int j=1;j<=w;j++) flag|=(s[i][j]=='#');
        app|=flag;
        if(!flag && app){
            for(int j=1;j<=w;j++)
                ans[i][j]=ans[i-1][j];
            continue;
        }
        bool isapp=0;
        for(int j=1;j<=w;j++){
            if(s[i][j]=='#'){
                if(isapp==0)
                    for(int l=1;l<j;l++) ans[i][l]=cnt+1;
                ans[i][j]=++cnt,isapp=1;
            }
            else if(isapp)
                ans[i][j]=cnt;
        }
        if(app && ans[i-1][1]==0){
            for(int j=1;j<i;j++)
                for(int l=1;l<=w;l++)
                    ans[j][l]=ans[i][l];
        }
    }
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++)
            cout<<ans[i][j]<<" ";
        cout<<endl;
    }
    return 0;
}


Measured memory_bytes: 1280
S = input()

n_len = len(S)
is_keyence = False

for i in range(n_len):
    for j in range(i, n_len):
        if S[:i] + S[j:] == 'keyence':
            is_keyence = True
    if is_keyence: break
        
print('YES' if is_keyence else 'NO')

Measured memory_bytes: 2940
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;

int main() {
    int Q;
    scanf("%d", &Q);
    multiset<int> stL, stS;
    LL sumb = 0, sumS = 0, sumL = 0;
    while (Q--) {
          int cmd;
          scanf("%d", &cmd);
          if (cmd == 1) {
             int a, b;
             scanf("%d %d", &a, &b);
             sumb += b;
             if (stS.empty() || (*stS.rbegin() >= a)) {
                stS.insert(a);
                sumS += a;
             } else {
                stL.insert(a);
                sumL += a;
             }
             int num = stS.size() + stL.size();
             int md_idx = num / 2 + ((num % 2) ? 1 : 0);
             while ((int)stS.size() > md_idx) {
                   int tmp = *stS.rbegin();
                   sumS -= tmp, sumL += tmp;
                   stS.erase(prev(stS.end()));
                   stL.insert(tmp);
             }
             while ((int)stS.size() < md_idx) {
                   int tmp = *stL.begin();
                   sumS += tmp, sumL -= tmp;
                   stS.insert(tmp);
                   stL.erase(stL.begin());
             }
          } else {
             LL md = *stS.rbegin();
             printf("%lld", md);
             LL ans = (LL)stS.size() * md - sumS - (LL)stL.size() * md + sumL;
             printf(" %lld\n", ans + sumb);
          }
    }
    return 0;
}


Measured memory_bytes: 9600
import java.util.*;
public class Main{
	public static void main(String[] args){
		new Main().run();
	}
	public void run(){
		Scanner scan = new Scanner(System.in);
		String mstr = "AADINNUY";
		String nstr = "AIZUNYAN";
		char[] t = "AAAAAAAA".toCharArray();
		String tt = "";
		while(scan.hasNext()){
			String dstr = scan.next();
			if(dstr.length() < 8){
				System.out.println(dstr);
				continue;
			}
			for(int i = 0;i < dstr.length()-7;i++){
				t = dstr.substring(i,i+8).toCharArray();
				tt = String.valueOf(t);
				sort(t);
				if(mstr.equals(String.valueOf(t))){
					dstr = dstr.replace(tt,nstr);
					i += 7;
				}
			}
			System.out.println(dstr);	
		}
	}
	public char[] sort(char[] t){
		for(int i = 0;i < t.length;i++){
			for(int j = t.length-1;j > i;j--){
				if(t[i] > t[j]){
					char a = t[i];
					t[i] = t[j];
					t[j] = a;				
				}
			}
		}
		return t;
	}
}

Measured memory_bytes: 20936
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

int main() {
  //
  ll n, m;
  cin >> n >> m;
  vl ok(m, 0);
  rep(i, n) {
    ll k;
    cin >> k;
    rep(j, k) {
      ll a;
      cin >> a;
      a--;
      ok[a]++;
    }
  }
  ll cnt = 0;
  rep(i, m) {
    if (ok[i] == n) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


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


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

  vector<int> monster(n+1),hero(n);
  for(int i=0; i < n+1; i++){
    cin >> monster[i];
  }
  for(int i=0; i < n; i++){
    cin >> hero[i];
  }

  ll ans=0;
  int force;
  for(int i=0; i<n; i++){
    force=max(hero[i] - monster[i] , 0);
    ans += min(monster[i],hero[i]);
    //cout << ans << endl;
    ans += min(force,monster[i+1]);
    //cout << ans << endl;
    monster[i+1] -= min(force,monster[i+1]);

  }

  cout << ans << endl;
}


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

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

    ll N;
    cin >> N;

    for (ll h = 1; h <= 3500; h++) {
        for (ll n = 2; n <= 3500; n++) {
            ll numerator = N * h * n;
            ll dominator = 4 * h * n - N * n - N * h;
            if (dominator > 0 && numerator % dominator == 0) {
                cout << h << ' ' << n << ' ' << numerator / dominator << '\n';
                return 0;
            }
        }
    }

    return 0;
}

Measured memory_bytes: 1144
#include<stdio.h>
int main()
{
	for(int i=0;i<4;i++)
	{
		char z;
		scanf("%c",&z);
		printf("%c",z);
	}
	printf(" ");
	for(int i=0;i<9;i++)
	{
		char z;
		scanf("%c",&z);
		printf("%c",z);
	}
}

Measured memory_bytes: 128
/* ----------------------- reclone_rk --------------------------------------------*/ 
#include<bits/stdc++.h>
using namespace std;
#define int long long int
const int mod=1e9+7;

#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define prq priority_queue<int>
#define prqp priority_queue<pair<int,int>>
#define vtr vector<int>
#define INF INT_MAX
#define NINF INT_MIN
#define endl "\n"
#define pb push_back
#define mp make_pair
#define f first
#define s second
#define pvtr vector<pair<int,int>>
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)

int gcd(int a, int b){ if(a == 0) return b; return gcd(b%a, a);}
int MOD(int n){ return ((n%mod)+mod)%mod;}
int power(int a,int b){ if(b==0)return 1LL;int s=power(a,b/2LL);s*=s;s%=mod;if(b&1LL)return (s*a)%mod;return s;}
int inv(int a){return power(a,mod-2);}
int nCr(int n,int r){if(r>n)return 0LL;if(n-r<r)r=n-r;int ans=1;for(int i=0;i<r;i++){ans*=(n-i);ans=MOD(ans);ans*=inv(i+1);ans=MOD(ans);}return ans;}

int pi = 3.14159265358979323846;
signed main()
{   
    int s, w;
    cin>>s>>w;
    if(w>=s)
        cout<<"unsafe"<<endl;
    else
        cout<<"safe"<<endl;
	return 0;
}

Measured memory_bytes: 3644
#include <stdint.h>

#include <algorithm>
#include <iostream>

using namespace std;

int main(void) {
  int64_t W, H, x, y;
  cin >> W >> H >> x >> y;

  cout << double(W * H) / 2.0 << " ";
  if (x * 2 == W && y * 2 == H) {
    cout << 1 << endl;
  } else {
    cout << 0 << endl;
  }
}


Measured memory_bytes: 3740
def main():
    A, B, C, D = map(int, input().split())
    i = 0
    while True:
        if i % 2 == 0:
            C -= B
        else:
            A -= D
        if A <= 0 or C <= 0:
            break
        i += 1
    if i % 2 == 0:
        print("Yes")
    else:
        print("No")

        
    

if __name__ == "__main__":
    main()

Measured memory_bytes: 9052
D,G = map(int, input().split())
PC = [tuple(map(int, input().split())) for _ in range(D)]

# コンプリートしたときの点数
comp = [100*(i+1)*PC[i][0] + PC[i][1] for i in range(D)]

# bit全探索
# 配点が高い位置からコンプリートする問題を決め打ち
ans = sum([PC[i][0] for i in range(D)])
for bit in range(1<<D):
    
    
    point = 0
    prob = 0
    
    for j in range(D-1, -1, -1):
        if bit & (1<<j):
            point += comp[j]
            prob += PC[j][0]

    # コンプだけでG以上になったなら次へ
    if point >= G:
        ans = min(ans,prob)
        continue
    
    # そうでないなら高い位置から貪欲
    else:
        for j in range(D-1, -1, -1):
            if bit & (1<<j):
                continue
            else:
                if point + 100*(j+1)*(PC[j][0]-1) < G:
                    point += 100*(j+1)*(PC[j][0]-1)
                    prob += (PC[j][0]-1)
                else:
                    temp = (G-point)//(100*(j+1)) + bool((G-point)%(100*(j+1)))
                    point += 100*(j+1)*temp
                    prob += temp
        
            if point >= G:
                ans = min(ans,prob)
                break
            

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF 2000000000
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;

using namespace std;

ull LCM(ull a,ull b){
  ull tmp,r,x;
  x=a*b;
  if(a<b) tmp=a,a=b,b=tmp;
  r=a%b;
  while(r!=0) a=b,b=r,r=a%b;
  x=x/b;
  return x;
}

ull GCD(ull a,ull b){
  if(a==0 || b==0) return max(a,b);
  else return (a*b)/LCM(a,b);
}

int main(void){
  int N;
  cin >> N;
  ull A[N],ans[N];
  rep(i,N) cin >> A[i];
  ull L[N+2],R[N+2];
  L[0]=0,L[1]=A[0],R[N+1]=0,R[N]=A[N-1];
  for(int i=2;i<=N;i++) L[i]=GCD(L[i-1],A[i-1]);
  for(int i=N-1;i>=1;i--) R[i]=GCD(R[i+1],A[i-1]);
  rep(i,N) ans[i]=GCD(L[i],R[i+2]);
  cout << *max_element(ans,ans+N) << endl;
}

Measured memory_bytes: 3328
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
import std.traits;
void times(alias fun)(int n) {
    foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = fun();
    return res;
}
// fold was added in D 2.071.0.
template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
        static if (S.length < 2) {
            return reduce!fun(seed, r);
        } else {
            return reduce!fun(tuple(seed), r);
        }
    }
}

int MAX = 10^^6+1;
void main() {
    int N = readln.chomp.to!int;
    int[] a = readln.split.to!(int[]);

    auto list = DList!int(MAX.iota);
    iota(2, N-1).each!(i => list[].drop(1).take(a[i]).each!(v => list.insertFront(v)));
    int[] ary = list[].array;
    int s = a[2..$].sum;
    int M = readln.chomp.to!int;
    foreach(_; 0..M) {
        int x = readln.chomp.to!int;
        writeln((x<MAX ? ary[x] : x-s) + a[0] - a[1]);
    }
}


Measured memory_bytes: 88812
using System;

class A {
	static void Main() {
		var n = int.Parse(Console.ReadLine());
		long ans = 0,cnt = 0;
		for(int i = 0; i < n;i++) {
			var a = int.Parse(Console.ReadLine());
			if(a != 0) {
				cnt += a;
			} else {
				ans += cnt / 2;
				cnt = 0;
			}
		}
		ans += cnt / 2;

		Console.WriteLine(ans);
	}
}

Measured memory_bytes: 6744
using System;
using System.IO;
using System.Linq;
using System.Text;

namespace Contest
{
    class Program
    {
        private Scanner sc;

        public void Solve()
        {
            sc = new Scanner();
            var a = sc.NextInt();
            int b = sc.NextInt();
            int p = a + b;
            int m = a - b;
            int f = a * b;
            Console.WriteLine(Math.Max(Math.Max(p,m),f));
        }

        static void Main() => new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _stream = new StreamReader(Console.OpenStandardInput());
        _pos = 0;
        _line = new string[0];
        _separator = ' ';
    }
    private readonly char _separator;
    private readonly StreamReader _stream;
    private int _pos;
    private string[] _line;
    #region get a element
    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = _stream.ReadLine().Split(_separator);
            _pos = 0;
        }
        return _line[_pos++];
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    #endregion
    #region convert array
    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }
    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }
    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }
    #endregion
    #region get array
    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = _stream.ReadLine().Split(_separator);
        _pos = _line.Length;
        return _line;
    }
    public int[] IntArray()
    {
        return ToIntArray(Array());
    }
    public long[] LongArray()
    {
        return ToLongArray(Array());
    }
    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }
    #endregion
}

Measured memory_bytes: 11092
d,m=1e9+7,p[10001][200]={1};i,k,x,I;char s[11111];main(j,L){for(scanf("%s%d",s,&d);s[i+=j^=1];k=0)for(x=L=j?9:s[i]-48;~x;x-=++k/d,k%=d)p[i+1][I=(j|x<L)*d+(k+x)%d]+=p[i][j*d+k],p[i+1][I]%=m;printf("%d",(*p[i]+p[i][d]-1+m)%m);}

Measured memory_bytes: 7936
#define TEMPLATE_USED
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
#define _overload3(_1,_2,_3,name,...) name
#define _rep2(i,n) for(ll i=0;i<(n);++i)
#define _rep3(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,_rep3,_rep2)(__VA_ARGS__)
#define _repe2(i,n) for(ll i=0;i<=(n);++i)
#define _repe3(i,a,b) for(ll i=(a);i<=(b);++i)
#define repe(...) _overload3(__VA_ARGS__,_repe3,_repe2)(__VA_ARGS__)
#define _rrep2(i,n) for(ll i=(n)-1;i>=0;i--)
#define _rrep3(i,a,b) for(ll i=(b)-1;i>=(a);i--)
#define rrep(...) _overload3(__VA_ARGS__,_rrep3,_rrep2)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
template<class T>
bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>
bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
template<class T>
using pq=priority_queue<T,vector<T>,greater<T>>;
const string YES = "Yes";
const string NO = "No";

ll N;
vector<string> S;

void solve();

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin >> N;
    S = vector<string>(N);
    for(int i = 0; i < N; ++i){
        cin >> S[i];
    }
    solve();
}

// 1 <= N <= 10^6
// S_i の文字列長の合計は 10^6 以下
// S_i は (, ) のみからなる空でない文字列

bool f(vp &a){
    ll sum=0;
    for(auto &p:a){
        if(sum+p.first<0)return false;
        sum+=p.second;
    }
    return true;
}

// ll N, vector<string> S
// S_i を任意の順序で連結するとき、括弧列を構成できるなら Yes、できないなら No を出力せよ。
void solve(){
    vp sl,sr;
    ll sum=0;
    rep(i,N){
        ll cnt=0,mi=0;
        rep(j,S[i].size()){
            if(S[i][j]=='(')++cnt;
            else --cnt;
            chmin(mi,cnt);
        }
        if(cnt>=0)sl.emplace_back(mi,cnt);
        else sr.emplace_back(mi-cnt,-cnt);
        sum+=cnt;
    }
    if(sum){
        cout<<NO<<endl;
        return;
    }

    sort(sl.rbegin(),sl.rend());
    sort(sr.rbegin(),sr.rend());
    cout<<(f(sl)&&f(sr)?YES:NO)<<endl;
}


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

using namespace std;

int main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m;
	cin >> n >> m;
	vector <int> v[100050];
	map <pair<int,int>, string> mp;
	vector <pair<int,int>> poc;
	set <int> ind;
	for(int i = 0; i < m; i++){
		int a,b;
		cin >> a >> b;
		poc.push_back(make_pair(a,b));
		v[a].push_back(b);
		ind.insert(a);
	}
	for(auto it = ind.begin(); it != ind.end(); it++) sort(begin(v[*it]), end(v[*it]));
	for(auto it = ind.begin(); it != ind.end(); it++){
		int cnt = 1;
		string l = to_string(*it);
		for(int j = 0; j < v[*it].size(); j++){
			string temp(6 - l.size(), '0');
			string g = to_string(cnt);
			string drugi(6 - g.size(), '0');
			string curr = temp + l + drugi + g;
			mp[make_pair(*it, v[*it][j])] = curr;
			cnt++;
		}
	}
	for(auto x : poc) cout << mp[x] << endl;
}

Measured memory_bytes: 23412
#include<stdio.h>
 
int main() {
   int n, r;
   scanf("%d", &n);
   scanf("%d", &r);
 
   if(n < 10) {
      printf("%d", r + 100 * (10-n));
   }else {
      printf("%d", r);
   }
   printf("\n");
   return 0;
}

Measured memory_bytes: 1676
#include <iostream>

#define int long long

using namespace std;

const int N = 1e6 + 10;

int a[N];
int m[N];

int32_t main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);    
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
        ++m[a[i]];
    }
    int ans = 0;
    for (int i = 0; i < n; ++i)
    {
        --m[a[i]];
        for (int j = 1; j * j <= a[i]; ++j)
        {
            if (a[i] % j) continue;
            if (m[j] || m[a[i] / j])
            {
                ++ans;
                break;
            }
        }
        ++m[a[i]];
    }
    cout << n - ans;
    return 0;
}

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

int main()
{
	int n;
	cin >> n;
	int A[2][n];
	for (int i = 0; i < 2; i++)
	{
		for (int j = 0; j < n; j++)
			cin >> A[i][j];
	}
	int sum[n];
	int k = 0;
	int i = 0;
	int j;
	int ans = 0;
	while (i < n)
	{
		sum[i] = 0;
		k = 0;
		j = 0;
		while (j < n)
		{
			sum[i] += A[k][j];
			if (j == i)
			{
				k = 1;
				sum[i] += A[k][j];
			}
			j++;
		}
		ans = max(ans, sum[i]);
		// cout << sum[i] << endl;
		i++;
	}
	cout << ans << endl;
	return (0);
}


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

int main(){
	ll n;
	cin>>n;
	vector<ll>a(n);
	ll ans=0;
	map<ll,ll>mp;
	rep(i,n){
		cin>>a[i];
		ans^=a[i];
	}
	if(!ans)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
vector<int> dy={-1,0,1,0};
vector<int> dx={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

struct UnionFind {
    vector<int> data;
    UnionFind(int size): data(size,-1) {
    }
    
    int root(int x){
        return (data[x] < 0)? x : data[x]=root( data[x] );
    }
    
    bool unite(int x, int y){
        x=root(x);
        y=root(y);
        if( x != y ){
            if( data[y] < data[x] ) swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
        return x!=y;
    }
    
    bool find(int x, int y){
        return root(x) == root(y);
    }
    
    int size(int x){
        return -data[ root(x) ];
    }
};

int main() {
    int n,m;
    cin>>n>>m;
    UnionFind uf(n);
    rep(i,m) {
        int x,y,z;
        cin>>x>>y>>z;
        x--;y--;
        uf.unite(x,y);
    }
    
    set<int> st;
    rep(i,n) st.insert(uf.root(i));
    cout<<sz(st)<<endl;
}



Measured memory_bytes: 5376
let n = read_int ()
let ss, ans = Array.make (n + 1) 0, ref max_int
let _ = for i = 0 to n - 1 do ss.(i + 1) <- Scanf.scanf " %d" (+) ss.(i) done; for i = 1 to n - 1 do ans := min !ans @@ abs @@ 2 * ss.(i) - ss.(n) done; Printf.printf "%d\n" !ans

Measured memory_bytes: 5632
#include <stdio.h>

int main(int argc, const char * argv[]) {
    
    int a,b,c,count=0,i;
    
    
    scanf("%d %d %d",&a,&b,&c);
    
    for (i = a; i <= b; i++) {
        if (c % i == 0) {
            count++;
        }
    }
    
    
    printf("%d\n",count);
    
    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std; inline void fileio(const char* in, const char* out) { freopen(in, "r", stdin); freopen(out, "w", stdout); } 
#define TD typedef
#define forx(i,n) for(int i = 0; i < (n); ++i)
#define forxr(i,n) for(int i = (n)-1; i >= 0; --i)
TD long long ll; TD long double ld; TD pair<int,int> pii; TD pair<ll,ll> pll; TD vector<int> VI; TD vector<bool> VB; TD vector<ll> VL;
const char nl = '\n'; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fll; const ld EPS = 1e-9, PI = acos(-1);
#define ff first
#define ss second
#define all(c) c.begin(),c.end()

int main() {
  atexit([](){ cerr << "Time: " << (ld)clock() / CLOCKS_PER_SEC << nl; });
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  cout << fixed << setprecision(12);
  // Emily <3
  int a, b;
  cin >> a >> b;
  if (max(a,b) <= 8) {
    cout << "Yay!\n";
  } else {
    cout << ":(\n";
  }
  return 0;
}



Measured memory_bytes: 256
N,M,C=list(map(int,input().split()))
B=input().split()
B=[int(i) for i in B]
cnt=0
Sum=0


for i in range(N):
    A=input().split()
    A=[int(k) for k in A]
    
    for j in range(M):
        Sum+=A[j]*B[j]
    
    if 0<Sum+C:
        cnt+=1
    
    Sum=0
    
print(cnt)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define Max(a,b) (a>b?a:b)
#define Min(a,b) (a<b?a:b)
#define ll long long
inline int read(){
	int f=1,x=0;char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')
			f=-1;
		c=getchar();
	}
	while(c<='9'&&c>='0'){
		x=x*10+c-'0';
		c=getchar();
	}
	return x*f;
}

inline void file(){
	freopen("1.in","r",stdin);
	freopen("1.out","w",stdout);
}

using namespace std;
const ll maxn=1e6+10;
ll a[maxn],b[maxn];

int main(){
	ll k,n,h;
	//scanf("%lld%lld",&n,&h);
	cin>>n>>h;
	for(register ll i=1;i<=n;++i)
		cin>>a[i]>>b[i];
	sort(b+1,b+n+1);
	sort(a+1,a+n+1);
	for(register ll i=1;i<=n;++i)
		b[i]=max(b[i],a[n]);
	ll ovo=0;
	for(register ll i=n;i>=1;--i){
		ovo+=b[i];
		if(ovo>=h){
			printf("%lld",n-i+1);
			return 0;
		}
	}
	int ans=n;
	ans+=(h-ovo)/a[n];
	if((h-ovo)%a[n])
		++ans;
	cout<<ans;
	return 0;
}




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

// repetition
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

// const value
// const ll MOD = 1e9 + 7;
// const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
// const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
inline ll toLL(string s) {
  ll v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T> inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) {
  return a < b && (a = b, true);
}

template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) {
  return a > b && (a = b, true);
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  set<int> st;
  rep(i, k) {
    int d;
    cin >> d;
    VI a(d);
    rep(i, d) cin >> a[i];
    rep(i, d) st.insert(a[i]);
  }
  cout << n - st.size() << endl;
  return 0;
}


Measured memory_bytes: 3664
s = input()

ans = "Yes"

for i in range(len(s)):
    if i == 0 or i%2 == 0:
        if s[i] == "R" or s[i] == "U" or s[i] == "D":
            continue
        else:
            ans = "No"
    else:
        if s[i] == "L" or s[i] == "U" or s[i] == "D":
            continue
        else:
            ans = "No"
print(ans)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
#define int long long
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000000000000;

int A[200010],B[200010],num[200010];
int N,M,W,C,D,E,G,K;
int ans,ans2,sum,sum2,cnt,cnt2,Max=0,Min=INF;
string S,T;
vector<int> V;
set<int> U;
map<int,int> H;
bool F,Q[200010];

signed main(){
	cin>>N;
	REP(i,N){
		cin>>A[i];
		V.push_back(A[i]);
	}
	int temp=N-1;
	if(N%2==1){
		vector<int> v;
		v.push_back(0);
		for(int i=2;i<=N-1;i+=2){
			v.push_back(i);
			v.push_back(i);
		}
		sort(V.begin(),V.end());
		sort(v.begin(),v.end());
		if(v==V){
			ans=1;
			REP(i,N/2){
				ans=ans*2%1000000007;
			}
			cout<<ans<<endl;
		}
		else{
			cout<<0<<endl;
		}
	}
	else{
		vector<int> v;
		for(int i=1;i<=N-1;i+=2){
			v.push_back(i);
			v.push_back(i);
		}
		sort(V.begin(),V.end());
		sort(v.begin(),v.end());
		if(v==V){
			ans=1;
			REP(i,N/2){
				ans=ans*2%1000000007;
			}
			cout<<ans<<endl;
		}
		else{
			cout<<0<<endl;
		}
	}
	return 0;
}


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

const int INF = 2147483647;
const int MAX_N = 1e6 + 10;
int N, dat[MAX_N * 2 - 1];

void init(int _n){
    N = 1;
    while( N < _n){
        N *= 2;
    }
    for (int i = 0; i < 2 * N - 1; ++i){
        dat[i] = INF;
    }
}

void update(int k, int a){
    k += N-1;
    dat[k] = a;
    while(k > 0){
        k = (k - 1) / 2;
        dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
    }
}

int _query(int a, int b, int k, int l, int r){
    if (r <= a || b <= l) return INF;
    if (a <= l && r <= b) return dat[k];
    int vl = _query(a, b, k * 2 + 1, l, (l + r)/2);
    int vr = _query(a, b, k * 2 + 2, (l + r)/2, r);
    return min(vl, vr);
}

int query(int a, int b){
    return _query(a, b, 0, 0, N);
}


int main(){
    int _N, Q;
    cin >> _N >> Q;
    init(_N);

    for (int i = 0; i < Q; ++i){
        int q, s, t;
        cin >> q >> s >> t;
        if (q == 0){
            update(s, t);
        }else{
            cout << query(s, t+1) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4128
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define PA pair<int,int>
#define PB push_back
#define PQ priority_queue<int>
#define PGQ priority_queue<int,vector<int>,greater<int> >
#define VE vector<int>
#define MOD 10000
#define INF 1000000007
using namespace std;
//
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,A,B;
  cin>>N>>A>>B;
  cout<<min(B,A*N)<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N;
ll A[200100];
ll sum[200100];
ll x[200100];
int check(int l,int r){
	return (x[r+1]^x[l]) == sum[r+1]-sum[l];
}
int main(){
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> A[i];
	}
	for(int i=0;i<N;i++){
		sum[i+1] = sum[i]+A[i];
		x[i+1] = x[i]^A[i];
	}
	ll ans = 0ll;
	for(int i=0;i<N;i++){
		int l = i, r = N;
		while(r-l>1){
			int mid = (l+r)/2;
			if(check(i,mid))l=mid;
			else r=mid;
		}
		ans += (ll)(l-i+1);
	}
	cout << ans << endl;
	return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

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

    int n, a, b;
    cin >> n >> a >> b;
    int c = 0;
    int bc = 0;
    string s;
    cin >> s;
    for( int i = 0; i < n; ++i ) {
        if( s[i] == 'c' ) {
            cout << "No";

        } else if( s[i] == 'b' ) {
            if( bc < b && c < a + b) {
                cout << "Yes";
                ++c;
            }
            else cout << "No";
            ++bc;

        } else {
            if( c < a + b ) {
                cout << "Yes";
                ++c;

            } else {
                cout << "No";

            }

        }
        cout << endl;
    }
    return 0;
}



Measured memory_bytes: 848
N = int(input())
items = []
for i in range(N):
    items.append(tuple(map(int, input().split())))


ans = 0
res = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        x1, y1 = items[i]
        x2, y2 = items[j]
        res.append((x1-x2, y1 -y2))

tar = []
for i in range(len(res)):
    x, y = res[i]
    cnt = 0
    for j in range(len(res)):
        if i == j:
            continue
        if x == res[j][0] and y == res[j][1]:
            cnt += 1
    if ans <= cnt:
        ans = cnt
        tar.append((x, y))


ans2 = 0
tar = list(set(tar))
for t in tar:
    cnt2 = 0
    for i in range(N):
        x, y = items[i]
        for j in range(N):
            if i == j:
                continue
            x2, y2 = items[j]
            if x - t[0] == x2 and y - t[1] == y2:
                cnt2 += 1
                break

    ans2 = max(ans2, cnt2)

print(N - ans2)


Measured memory_bytes: 42972
//057 C - Digits in Multiplication 2017/03/26
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

int f(uint64 a , uint64 b){
    int a1=0; int b1=0;
    do{
        ++a1;
        a/=10;
    }
    while(a!=0);
    do{
        ++b1;
        b/=10;
    }
    while(b!=0);
    return max( a1 , b1 );
}

int main(){
    uint64 n; cin >>n;
    uint64 b;
    int ans = 100;
    for(int64 a = 1 ; a * a <= n ; ++a ){
        if( n % a != 0 ) continue;
            b = n / a; 
            int tmp = f( a , b );
            if( ans > tmp )  ans = tmp;            
    }
    cout << ans << endl;
}

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

#define rep(i,a,b)      for(int i=a;i<=b;i++)
#define revp(i,a,b)     for(int i=b;i>=a;i--)

string s,a,b;
int n;
int main()
{
    ios::sync_with_stdio(false);
  
    cin>>n>>s;
    if(n&1)
        cout<<"No";
    else
    {
        rep(i,0,n/2-1)
            if(s[i]!=s[n/2+i])
            {
                cout<<"No";
                return 0;
            }
        cout<<"Yes";
    }
}




Measured memory_bytes: 256
n, k = map(int, input().split())
MOD = 10 ** 9 + 7

patterns = [0] * k
total = 0

for i in range(k, 0, -1):
    # gcdがちょうどi ⇔ すべての要素がiの倍数
    # かつ　すべての要素が2i, 3i, ...の倍数でない
    tmp = pow(k // i, n, MOD)

    for j in range(2*i, k+1, i):
        tmp -= patterns[j-1]
    
    patterns[i-1] = tmp
    total += i * tmp
    total %= MOD

print(total)


Measured memory_bytes: 70084
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef tree<int,null_type,less<int >,rb_tree_tag,tree_order_statistics_node_update>indexed_set;
template<class T1, class T2>
ostream &operator <<(ostream &os, pair<T1,T2>&p);
template <class T>
ostream &operator <<(ostream &os, vector<T>&v);
template <class T>
ostream &operator <<(ostream &os, set<T>&v);
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v);
#ifdef APURBA
#define HERE cout<<"here - "<<__LINE__<<"\n";
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it)
{
    cout<<endl;
}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
    cout << *it << " = " << a << " ";
    err(++it, args...);
}
#else
#define HERE
#define debug(args...)
#endif
const int N = 1e6+5;
const ll mod = 1e9+7 ;
typedef pair<int,int> pii;

void TEST_CASES(int cas)
{
    int x;
    cin>>x;
    x= 1-x;
    cout<<x<<endl;
}



/*

*/

int main()
{
#ifndef APURBA
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    int t=1,cas=0;
    //cin>>t;
    while(t--)
    {
        TEST_CASES(++cas);
    }
    return 0;
}



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

template <class T>
ostream &operator <<(ostream &os, set<T>&v)
{
    os<<"[ ";
    for(T i:v)
    {
        os<<i<<" ";
    }
    os<<" ]";
    return os;
}
template <class T1, class T2>
ostream &operator <<(ostream &os, map<T1,T2>&v)
{
    for(auto i:v)
    {
        os<<"Key : "<<i.first<<" , Value : "<<i.second<<endl;
    }
    return os;
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

// 約数列挙
vector<ll> divisor(ll n) {
    vector<ll> ret;
    for(ll i = 1; i * i <= n; i++) {
        if(n % i == 0) {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return ret;
}

// 素数判定
bool isPrime(ll n) {
    ll i = 2;
    while (i*i <= n) {
        if(n%i==0) return false;
        i++;
    }
    return true;
}

ll modnum = 1000000007;

int pow_kai(ll a, ll n){//aのn乗を計算します。
    ll x = 1;
    while(n > 0){//全てのbitが捨てられるまで。
        if(n&1){//1番右のbitが1のとき。
            x = x*a;
            x %= modnum;
        }
        a = a*a;
        a %= modnum;
        n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
    }
    // 最初の1つ外す
    x--;
    return x%modnum;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//const int MAX=510000;

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}




int main() {
    ll n,a,b; cin >> n >> a >> b;


    ll tmp = 1;
    ll tt = n;
    EFOR(i,1,a) {
        tmp *= tt+1-i;
        tmp %= modnum;
        tmp *= modinv(i, modnum);
        tmp %= modnum;
    }
    ll tmpb = 1;
    tt = n;
    EFOR(i,1,b) {
        tmpb *= tt+1-i;
        tmpb %= modnum;
        tmpb *= modinv(i, modnum);
        tmpb %= modnum;
    }
    tmp += tmpb;
    tmp %= modnum;

    //ll ans = pow_kai(2,n);
    ll ans = modpow(2,n, modnum);
    ans--;
    ans -= tmp;
    if(ans < 0) ans += modnum;

    cout << ans%modnum << endl;

    return 0;
}

// 140625001
// 34076506

Measured memory_bytes: 256