akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define lli long long int
#define ulli unsigned long long int
#define ld long double
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(lli i=a;i<b;i++)
#define initialize(array,size,value) for(lli i=0;i<size;i++) array[i]=value
#define couta(array,size) for(lli i=0;i<size;i++) cout<<array[i]<<" "
#define vl vector<lli>
#define vp vector< pair <lli,lli> >
#define sl set<lli>
#define msp multiset < pair < long long , long long > > S;
#define pll pair<lli, lli>
#define mll map<lli, lli>            //for( map<lli, lli>::iterator i=temp.begin();i!=temp.end();i++)cout<<i->fi<<" "<<i->se<<endl;
#define mvl map<lli, vl>
#define umll unordered_map<lli, lli>
#define vt vector<pair<lli, pll >  >
#define vf vector<pair<pll,pll > >
#define qu queue<lli>
#define pq priority_queue<lli>
#define dq deque <lli>
#define ptr vector<lli>::iterator
#define bs(array,x) binary_search(array.begin(),array.end(),x) // also valid for set and multiset
#define lb(array,x) lower_bound(array.begin(),array.end(),x)
#define ub(array,x) upper_bound(array.begin(),array.end(),x)
#define nobw(array,i,j) upper_bound(array.begin(), array.end(), j)-lower_bound(array.begin(), array.end(), i) //number of numbers between i & j
#define vc clear()
#define endl '\n'
#define sp system("pause");
#define INF 9223372036854775807
#define MINF -9223372036854775808
typedef tree<pll,null_type,less<pll>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
int main()
{
 	ios::sync_with_stdio(0);
    cin.tie(0);
    lli n;
    cin>>n;
    vp tem;
    for(lli i=0;i<n;i++){
    	lli a;
    	cin>>a;
    	tem.pb(mp(a,i+1));
    }
    sort(tem.begin(),tem.end());
    for(auto u:tem)cout<<u.se<<" ";


 	return 0;
 }

Measured memory_bytes: 2544
#include <bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
#define mod 1000000007
bool isPrime[1000001];
ll power(ll a,ll b)
{
    ll result = 1;
    while(b>0)
    {
        if(b%2)
        {
            result = (a*result)%mod;
        }
        a = (a*a)%mod;
        b = b/2;
    }
    return result;
}
int gcd(int a,int b)
{
    if(b==0)
    {
        return a;
    }
    return gcd(b,a%b);
}
void sieve()
{
    memset(isPrime,1,sizeof(isPrime));
    isPrime[0] = isPrime[1] = 0;
    for(int i=2;i*i<=1000000;i++)
    {
        if(isPrime[i])
        {
            for(int j=i*i;j<=1000000;j+=i)
            {
                isPrime[j] = 0;
            }
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL),cout.tie(NULL);
    int t,n;
    t = 1;
    for(int i=0;i<t;i++)
    {
        int h,w;
        cin>>h>>w;
        string s[h];
        int arr[h][w];
        for(int i=0;i<h;i++)
        {
            cin>>s[i];
            for(int j=0;j<s[i].size();j++)
            {
                if(s[i][j]=='.')
                {
                    arr[i][j] = 1;
                }
                else
                {
                    arr[i][j] = 0;
                }
            }
        }
        int maxi = 0;
        vector <pair<int,int>> v;
        v.push_back({-1,0});
        v.push_back({0,-1});
        v.push_back({0,1});
        v.push_back({1,0});
        for(int i=0;i<h;i++)
        {
            for(int j=0;j<w;j++)
            {
                if(arr[i][j])
                {
                    int dist[h][w] ;
                    bool vis[h][w] ;
                    memset(dist,0,sizeof(dist));
                    memset(vis,0,sizeof(vis));
                    queue <pair<int, int>> q;
                    q.push({i, j});
                    while(q.size()) 
                    {
                        pair <int, int> p = q.front();
                        int x = p.first;
                        int y = p.second;
                        q.pop();
                        if(vis[x][y])
                        {
                            continue;
                        }
                        vis[x][y] = 1;
                        for (int i = 0; i < 4; i++)
                        {
                            int a = x+v[i].first;
                            int b = y+v[i].second;
                            if (a < 0 ||a >= h || b < 0 || b >= w || vis[a][b] || arr[a][b] == 0)
                            {
                                continue;
                            }
                            dist[a][b] = dist[x][y] + 1;
                            q.push({a,b});
                            maxi = max(maxi,dist[a][b]);
                        }
                    }    
                }
            }
        }
        cout<<maxi;
    }
    return 0;
}


Measured memory_bytes: 3580
N, T, *AS = $stdin.read.split.map(&:to_i)

w = []
a0 = a1 = nil
AS.each do |x|
  if a0.nil?
    a0 = x
  elsif a1.nil?
    if x < a0
      a0 = x
    else
      a1 = x
    end
  else
    if x > a1
      a1 = x
    elsif x < a0
      w.push(a1-a0)
      a0 = x
      a1 = nil
    end
  end
  #p a: [a0, a1], w: w
end
w.push(a1-a0) if a1
p w.count(w.max)


Measured memory_bytes: 9724
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i];if(i<len-1) s<<" ";
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){
	int len=d.size();
	rep(i,len){
		s<<d[i]<<endl;
	}
	return s;
}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){
	s<<"{ ";
	for(auto itr=v.begin();itr!=v.end();++itr) {
		if (itr!=v.begin()) {s<< ", ";}
		s<<(*itr);
	}
	s<<" }";
	return s;
}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){
	s<<"{"<<endl;
	for(auto itr=m.begin();itr!=m.end();++itr){
		s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;
	}
	s<<"}"<<endl;
	return s;
}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

struct state{
	int v;
	vector<int> S;
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	vector<vector<int>> g(n);
	rep(i,m){
		int a,b;
		cin>>a>>b;
		a--,b--;
		g[a].push_back(b);
	}
	vector<int> ans;
	int cnt=INF;
	auto bfs=[&](int v){
		queue<state> que;
		que.push({v,vector<int>{v}});
		vector<bool> used(n,false);
		while(!que.empty()){
			state now=que.front();
			int nv=now.v;
			que.pop();
			used[nv]=true;
			for(auto itr:g[nv]){
				if(itr==v){
					if(chmin(cnt,(int)now.S.size())){
						ans=now.S;
					}
					continue;
				}else{
					if(used[itr]) continue;
					vector<int> nnS(now.S);
					nnS.push_back(itr);
					que.push({itr,nnS});
				}
			}
		}
	};
	rep(i,n) bfs(i);
	if(cnt==INF){
		cout<<-1<<endl;
		return 0;
	}
	cout<<ans.size()<<endl;
	for(auto v:ans){
		cout<<v+1<<endl;
	}
}

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

int main() {
    string S;
    cin >> S;
    int N = S.size(),ans = 0;
    for(int i = 0;i < N / 2;i++){
        if (S[i] != S[N - 1 - i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for (int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};
int main(){
  int N,M; cin>>N>>M;
  vector<int>A(N);
  for(int i=0;i<N;i++)cin>>A[i];
  UnionFind Onion(N);
  for(int i=0;i<M;i++){
    int a,b; cin>>a>>b; Onion.unite(a-1,b-1);
  }
  int ans=0;
  for(int i=0;i<N;i++){
    if(Onion.same(i,A[i]-1))ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 4056
#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(){
    int a;
    cin >> a;
    while(a--){
        double x1,y1,x2,y2,x3,y3;
        cin >> x1 >>y1 >>x2 >> y2 >> x3 >> y3;
        double a1=2*(x2-x1);
        double b1=2*(y2-y1);
        double c1=x1*x1-x2*x2+y1*y1-y2*y2;
        double a2=2*(x3-x1);
        double b2=2*(y3-y1);
        double c2=x1*x1-x3*x3+y1*y1-y3*y3;
        double x=(b1*c2-b2*c1)/(a1*b2-a2*b1);
        double y=(c1*a2-c2*a1)/(a1*b2-a2*b1);
        double r=hypot(x-x1,y-y1);
        printf("%.3lf %.3lf %.3lf\n",x,y,r);
    }
}



Measured memory_bytes: 3224
// 2011/07/12 Tazoe

#include <iostream>
#include <string>
#include <sstream>
#include <cmath>
using namespace std;

int main()
{
	double x = 0.0;
	double y = 0.0;
	int ang = 90;

	while(true){
		string str;
		cin >> str;

		for(int i=0; i<str.size(); i++)
			if(str[i]==',')
				str[i] = ' ';

		istringstream ist(str);
		int d, r;
		ist >> d >> r;
		if(d==0&&r==0)
			break;

		x += (double)d*cos(M_PI*(double)ang/180.0);
		y += (double)d*sin(M_PI*(double)ang/180.0);
		ang -= r;
	}

	cout << (int)x << endl;
	cout << (int)y << endl;

	return 0;
}

Measured memory_bytes: 0
#ABC 045 C - たくさんの数式
#AC

#ビット演算を使ってみる
s = input()
#print(s)

n = len(s)
#print(n)
#長さnだとn-1桁の2進数が欲しい。2^n-1通り試さないと行けない

tasu_ichi = []
cnt = 0

for i in range(2 ** (n-1)):
    #iは2^n-1通りに変化する。
    #何番目にフラグが立っているか全部回収する
    k=0
    for j in range(n-1):
        if (i>>j)&1 == 1:
            #何番目に+を入れるか判定する。参照用の二進数iの右から何番目に1が入るかで判定
            #0から数え始める
            cnt += int(s[k:(j+1)])
            k = (j+1)
    cnt += int(s[k:])
print(cnt)

  

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC098A
{
	class Program
	{
		static void Main(string[] args)
		{
			int a, b, max;

			var word = Console.ReadLine().Split(' ');

			a = int.Parse(word[0]);
			b = int.Parse(word[1]);

			max = a + b;
			if(max < a - b) max = a - b;
			if(max < a * b) max = a * b;

		
			Console.WriteLine(max);

			Console.ReadKey();

		}
	}
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

vector<vector<ll> > v;
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    vector<ll> h(n);
    for(int i=0;i<n;i++) cin>> h[i];
    v.resize(n);
    ll a,b ;
    for(int i=0;i<m;i++){
        cin >> a >> b;
        a--; b--;
        v[a].pb(b);
        v[b].pb(a);
    }
    ll ans = 0;
    for(int i=0;i<n;i++){
        bool maki = true;
        for(auto& j: v[i]){
            if(h[j] >= h[i]) maki = false;
        }
        if(maki) ans++;
    }
    cout << ans << endl;
    return 0;
}


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

using   namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;

#define  all(v)       (v).begin(),(v).end()
#define  rall(v)      (v).rbegin(),(v).rend()
#define  pb           push_back  
#define  eb           emplace_back
#define  mp           make_pair
#define  ff           first
#define  ss           second
#define  pf           push_front
#define  bs           binary_search
#define  lb           lower_bound
#define  ub           upper_bound
#define  umap         unordered_map
#define  uset         unordered_set
#define  dec(x)       fixed<<setprecision(x)
#define  lcm(a,b)    (a*b/__gcd(a,b))

typedef  priority_queue<ll>  pq;
typedef  priority_queue<ll,vector<ll>,greater<ll>> pqmn;
typedef  pair<ll,ll> pll;

const    ll inf=LLONG_MAX;
const    ll mod=1e9+7;
const    ld pi=acos(-1);
                    
void solution(){

    ll n;
    cin>>n;
    string s;
    cin>>s;
    int j=n-1;
    ll op=0;
    string m=s;
    for(int i=0;i<n;i++){
        if(s[i]=='W'){
            while(s[j]!='R'){
                j--;
                if(j<=i){
                    goto out;
                }
            }
            swap(s[i],s[j]);
           // cout<<s<<" \n";
            op++;
        }
    }
   out: bool flag=false;
    ll ans=0;
    for(int i=n-1;i>=0;i--){
        if(m[i]=='R'){
            flag=true;
        }
        else if(m[i]=='W'&&flag){
            ans++;
        }
    }
    bool flagg=false;
    ll ans2=0;
    for(int i=0;i<n;i++){
        if(m[i]=='W'){
            flagg=true;
        }
        else if(m[i]=='R'&&flag){
            ans2++;
        }
    }
    ll wh=0;
    ll rr=0;
    for(int i=0;i<n;i++){
        if(s[i]=='W') wh++;
        else rr++;
    }
    ll tot=min(op,min(ans,min(wh,min(ans2,rr))));
    cout<<tot;

}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll t;
    t=1;
    //cin>>t;
    while(t--){
        solution();
        cout<<"\n";
    }
    return 0;
}


Measured memory_bytes: 3848
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0;i < n;i++)
#define REP(i,n,k) for(int i = n;i < k;i++)
#define P(p) cout << (p) << endl;
#define sP(p) cout << setprecision(15) << fixed << p << endl;
#define vi vector<int>
#define printv(v) for(int i = 0;i < v.size();i++)P(v[i]);
#define printt(a,b) cout << a << " " << b << endl; 
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0};
int dy[] = { 0,  0,  1, -1};
int MOD = 1e9 + 7;

void solve() {
    int a,b,c;
    cin >> a >> b >> c;
    P(min(b/a,c));
}

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


Measured memory_bytes: 256
//waz
#include <bits/stdc++.h>
 
using namespace std;
 
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)((x).size()))
 
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef long long int64;
typedef unsigned int uint;
typedef unsigned long long uint64;
 
#define gi(x) ((x) = F())
#define gii(x, y) (gi(x), gi(y))
#define giii(x, y, z) (gii(x, y), gi(z))
 
int F()
{
	char ch;
	int x, a;
	while (ch = getchar(), (ch < '0' || ch > '9') && ch != '-');
	if (ch == '-') ch = getchar(), a = -1;
	else a = 1;
	x = ch - '0';
	while (ch = getchar(), ch >= '0' && ch <= '9')
		x = (x << 1) + (x << 3) + ch - '0';
	return a * x;
}
 
const int mod = 924844033;

int fpow(int a, int x)
{
	int ret = 1;
	for (; x; x >>= 1)
	{
		if (x & 1) ret = 1LL * ret * a % mod;
		a = 1LL * a * a % mod;
	}
	return ret;
}

const int N = 1 << 20;
 
int g[N], t[N], ans;

int fac[N], rfac[N];

int C(int n, int m)
{
	if (n < m || m < 0) return 0;
	return 1LL * fac[n] * rfac[m] % mod * rfac[n - m] % mod;
}

int f(int n, int m) { return C(n - m, m); }

int inc(int a, int b) { a += b; return a >= mod ? a - mod : a; }

int dec(int a, int b) { a -= b; return a < 0 ? a + mod : a; }

void dft(int *a, int n, int type)
{
	for (int i = 0, j = 0; i < n; ++i)
	{
		if (i > j) swap(a[i], a[j]);
		for (int l = n >> 1; (j ^= l) < l; l >>= 1);
	}
	for (int i = 1; i < n; i <<= 1)
	{
		int m = i << 1;
		int w = fpow(5, (mod - 1) / m);
		if (type == -1) w = fpow(w, mod - 2);
		for (int j = 0; j < n; j += m)
		{
			int v = 1;
			for (int k = 0; k < i; ++k)
			{
				int x = a[j + k], y = 1LL * a[j + k + i] * v % mod;
				a[j + k] = inc(x, y);
				a[j + k + i] = dec(x, y);
				v = 1LL * v * w % mod;
			}
		}
	}
	if (type == -1) 
	{
		int invn = fpow(n, mod - 2);
		for (int i = 0; i < n; ++i) a[i] = 1LL * a[i] * invn % mod;
	}
}

int a[N], b[N];

int main()
{
	int n, k;
	gii(n, k);
	fac[0] = 1;
	for (int i = 1; i <= n; ++i) fac[i] = 1LL * fac[i - 1] * i % mod;
	rfac[n] = fpow(fac[n], mod - 2);
	for (int i = n; i; --i) rfac[i - 1] = 1LL * rfac[i] * i % mod;
	g[0] = 1;
	for (int i = 0; i <= (n - 1) / k; ++i) a[i] = f((n - 1) / k + 1, i);
	for (int i = 0; i <= (n - 1) / k - 1; ++i) b[i] = f((n - 1) / k, i);
	int cnt1 = 0, cnt2 = 0;
	for (int i = 1; i <= k; ++i) 
	{
		int len = (n - i) / k;
		if (len == (n - 1) / k) ++cnt1;
		else ++cnt2;
	}
	int m = 1;
	for (; m < (n << 1); m <<= 1);
	dft(a, m, 1), dft(b, m, 1);
	for (int i = 0; i < m; ++i) g[i] = 1LL * fpow(a[i], cnt1 << 1) * fpow(b[i], cnt2 << 1) % mod;
	dft(g, m, -1);
	for (int i = n, fac = 1, j = (n & 1) ^ 1; ~i; --i, fac = 1LL * fac * (n - i) % mod, j ^= 1)
	{
		if (j) ans = (ans + 1LL * g[i] * fac) % mod;
		else ans = (ans - 1LL * g[i] * fac) % mod;
	}
	if (ans < 0) ans += mod;
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 10496
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 998244353
    #w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

    #N = int(input())
    N,A,B, K = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    def extgcd1(a0,b0):#計算量log(b0),フェルマーの小定理より早い
        u,v,a,b=1,0,a0,b0
        while b: t=a//b; a-=t*b; a,b=b,a; u,v=v,u-t*v
        if a!=1: return -1#互いに素じゃない
        return u%b0
    
    maxn=N
    fact=[1]*(maxn+1)#NはnCrの最大のn
    ifact=[1]*(maxn+1)
    x=1
    for i in range(2,maxn+1):
        x=(x*i)%mod
        fact[i]=x; ifact[i]=extgcd1(x,mod)
        
    def comb(n,r): return (fact[n]*ifact[r]%mod)*ifact[n-r]%mod
    ans=0
    for i in range(N+1):
        b=K-A*i
        if b<0:break
        d,x=divmod(b,B)
        if x!=0 or d>N:
            continue
        ans+=comb(N,i)*comb(N,d)%mod
        ans%=mod
    print(ans)
        





if __name__ == "__main__":
    main()

Measured memory_bytes: 83592
#include <bits/stdc++.h>
typedef unsigned long long ull;
typedef long long ll;
#define __TRUE "Yes"
#define __FALSE "No"
#define cout(x) cout << (x) << endl
#define MAX 100001
using namespace std;

int main() {
  int n;
  cin >> n;
  cout << n/3 << endl;
  return 0;
}

Measured memory_bytes: 256
N, K, Q = map(int, input().split())

scores = [K-Q] * (N + 1)

for i in range(Q):
    a = int(input())
    scores[a] += 1

for i in range(1, N+1):
    if scores[i] <= 0:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 11512
s = io.read("*l")
count = 0
ret = 0
start = false
for i = 1, #s do
	c = string.sub(s, i, i)
	if start then
		count = count + 1
		if  c == "Z" then
			ret = count
		end
	elseif c == "A" then
		start = true
		count = 1
	end
end
print(ret)

Measured memory_bytes: 888
N = int(input())
A = list(map(int, input().split()))

dp = [0] * (N + 1)
dp[2] = max(A[0], A[1])
s = A[0]
for i, a in enumerate(A, 1):
  if i <= 2:
    continue
  if i%2: # 奇数
    dp[i] = max(dp[i-1], a+dp[i-2])
    s += a
  else: # 偶数
    dp[i] = max(a+dp[i-2], s)

print(dp[-1])

Measured memory_bytes: 31760
n=int(input())
ans=float('inf')

def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

for i in range(1,n):
    a=i
    b=n-i
    ans=min(ans,digitSum(a)+digitSum(b))

print(ans)

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

int main(void) {
  int a, b, c , d;
  cin >> a >> b >> c >> d;
  cout << max(a*b,c*d) << endl;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define substr(s,f,t) (s.substr(f-1,t-f+1))
#define ALL(a) (a).begin(),(a).end()
#define Yes(hoge) cout<<((hoge)?"Yes":"No")<<endl;
#define YES(hoge) cout<<((hoge)?"YES":"NO")<<endl;
using namespace std;
struct Grid{ll x,y,t;};
struct Edge{ll to,cost;};
struct Graph{vector<vector<Edge>>E;int V;
  const ll Inf = llINF;const int MAX_V=201010;vector<ll>d;
  Graph(int n):E(n){d.resize(MAX_V);E.resize(n);V=n;}
  void init(){for(int i=0;i<MAX_V;i++)d[i]=Inf;}
  void add_edge(ll from,ll to,ll cost){E[from].pb({to,cost});}
};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;cin>>n;
  vi a(n);
  vi b(n);
  for(int i=0;i<n;i++)cin>>a[i];
  for(int i=0;i<n;i++)cin>>b[i];

  b.pb(llINF);
  ll ans=0;
  vi sum(100);
  for(int j=28;j>=0;j--){
    for(int i=0;i<n;i++)b[i]%=(1<<(j+1));
    sort(ALL(b));
    for(int i=0;i<n;i++){
      ll aa=(a[i]%(1<<(j+1)));
      ll cnt=0;
      auto lb=lower_bound(ALL(b),(1<<j)-aa);
      auto lb2=lower_bound(ALL(b),(1<<(j+1))-aa);
      cnt+=(lb2-lb);
      auto lb3=lower_bound(ALL(b),(1<<(j+1))+(1<<j)-aa);
      auto lb4=lower_bound(ALL(b),(1<<(j+1))+(1<<(j+1))-aa);
      cnt+=(lb4-lb3);
      sum[j]+=cnt;
    }
  }
  for(int i=0;i<=28;i++){
    ans+=(1<<i)*(sum[i]%2);
  }

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


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

int main(){
  string s;
  cin >> s;
  
  string t = "keyence";
  if(s == t){
    cout << "YES" << endl;
    return 0;
  }
  
  int l = s.size();
  bool ok = false;
  for(int i = 0; i < l; i++){
    for(int j = i; j < l; j++){
      string ans = "";
      for(int k = 0; k < l; k++){
        if(k >= i && k <= j) continue;
        ans += s.at(k);
      }
      if(ans == t) ok = true;
    }
  }
  
  if(ok) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {
	public static boolean composite[] = new boolean[100001];
	public static int total[] = new int[100001];
	public static void soe(int up) {
		int sqrt = (int)Math.sqrt(up);
		composite[1] = true;
		for(int i=2;i<=sqrt;i++) {
			if(!composite[i]) {
				for(int j=i*i;j<=up;j+=i) {
					composite[j] = true;
				}
			}
		}
	}
	
	public static void count(int up) {
		for(int i=3;i<=up;i++) {
			total[i] = total[i-1];
			if(i%2==0) {
				continue;
			}
			if(!composite[i]&&!composite[(i+1)/2]) {
				total[i]++;
			}
		}
	}
	
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		soe(100000);
		count(100000);
		int Q = Integer.parseInt(br.readLine());
		for(int i=1;i<=Q;i++) {
			StringTokenizer st = new StringTokenizer(br.readLine());
			int l = Integer.parseInt(st.nextToken());
			int r = Integer.parseInt(st.nextToken());
			System.out.println(total[r]-total[l-1]);
		}
	}

}


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

using namespace std;

int a[4];

int main(void)
{
	for(int i = 0; i < 4; i++) cin >> a[i];
	sort(a, a+4);
	
	if(a[0] == 1 && a[1] == 4 && a[2] == 7 && a[3] == 9) cout << "YES" << endl;
	else cout << "NO" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
#include <unordered_map>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<long long int> a(n), b(n);
	long long int ans = 0;
	for(int i=0;i<n;i++){
		cin >> a.at(i) >> b.at(i);
	}
	for(int i=0;i<n;i++){
		ans += (b.at(n-i-1) - a.at(n-i-1)%b.at(n-i-1))%b.at(n-i-1);
		if(i != n-1){
			a.at(n-i-2) += ans;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    int n = in.nextInt();
    int ac = 0;
    int wa = 0;
    int tle = 0;
    int re = 0;
    for(int i = 0; i <= n; ++i) {
      String curr = in.nextLine();
      if(curr.equals("AC")) ++ac;
      if(curr.equals("WA")) ++wa;
      if(curr.equals("TLE")) ++tle;
      if(curr.equals("RE")) ++re;
    }
    
    System.out.println("AC x " + ac);
    System.out.println("WA x " + wa);
    System.out.println("TLE x " + tle);
    System.out.println("RE x " + re);
  }
}

Measured memory_bytes: 60388
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <set>
#define int long long
using namespace std;

int32_t main(){

    ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);

    int n,m;
    cin>>n>>m;
    vector<pair<int,int>> p(n);
    for(int i=0;i<n;i++){
        cin>>p[i].first>>p[i].second;
    }
    sort(p.rbegin(),p.rend());
    int ans = 0,now = 0;
    multiset<int> st;
    for(int i=0;i<n;i++){
        now = m-p[i].first+1;
        if(now<=0) continue;
        if(st.size()==now){
            if(*st.begin()<p[i].second){
                st.erase(st.begin());
                st.insert(p[i].second);
            }
        }
        else st.insert(p[i].second);
    }
    for(auto i : st){
        ans+=i;
    }
    cout<<ans<<endl;
    return 0;
}

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

#define rep(i,a,b) for(long long i = a; i < b; i++)
#define dump(a) for(auto x : a) cout << x << " "; cout << "\n"
#define print(a) cout << a << "\n"
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr << #x << ": " << x << ", " << #y << ": " << y << "\n"
#define debug3(x,y,z) std::cerr << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << "\n"

typedef long long ll;
using vi   = vector<int>;
using vll  = vector<long long>;
using vs   = vector<string>;
using vvi  = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using vvs  = vector<vector<string>>;

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

  int _min = 1000; // あり得る最大値
  rep(i,0,S.length()) {
    int diff = T.length();
    if (i + T.length() > S.length()) break;
    rep(j,0,T.length()) {
      if (T[j] == S[i + j]) {
        --diff;
      }
    }
    _min = min(diff,_min);
  }
  
  print(_min);
  return 0;
}

Measured memory_bytes: 3628
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        int M = scan.nextInt();
        PriorityQueue<Long> queue = new PriorityQueue<>(Comparator.reverseOrder());
        for (int i = 0; i < N; i++) {
            queue.add(scan.nextLong());
        }
        int count = 0;
        while (count < M) {
            long x = queue.poll();
            x /= 2;
            queue.add(x);
            count += 1;
        }
        long answer = 0;
        while (!queue.isEmpty()) {
            answer += queue.poll();
        }
        System.out.println(answer);
    }
}


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

using namespace std;

typedef long long ll;

// This is recursion
//ll knapsack(vector<ll> wet, vector<ll> val, ll n, ll maxwt){
//	// First thing is the Base case!! 
//	if(n == 0 || maxwt == 0){
//		return 0;
//	}
//	
//	// My second base case would be when my current element wet is larger than my bag wt so ignore the element and consider 2nd case
//	if(wet[n - 1] > maxwt){
//		// Call the function again with ignoring current element and checking for next least element
//		return knapsack(wet,val,n-1,maxwt);
//	}else{
//		// My recurrence relation is ????
//		return max(val[n-1] + knapsack(wet, val, n - 1, maxwt - wet[n - 1]), knapsack(wet,val,n-1,maxwt));	
//	}
//}
//int main(){
//	ll n,maxwt;
//	cin >> n >> maxwt;
//	vector<ll> wet(n);
//	vector<ll> val(n);
//	for(ll i = 0;i<n;i++)
//		cin >> wet[i] >> val[i];
//		
//	ll callfxs = knapsack(wet,val,n,maxwt);
//	cout << callfxs << "\n";
//}


// Need to do memoization 

int main(){
	ll n,maxwet;
	cin >> n >> maxwet;
	vector<ll> dp(maxwet + 1);
	for(ll i = 0;i<n;i++){
		int wet,val;
		cin >> wet >> val;
		for(ll j = maxwet - wet;j>=0;j--){
			dp[j + wet] = max(dp[j + wet], dp[j] + val);
		}
	}
	ll ans = 0;
	for(ll i = 0;i<=maxwet;i++){
		ans =  max(ans, dp[i]);
	}
	cout << ans << "\n";
}

Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<iomanip>
#include<set>
#include<unordered_map>
using namespace std ;

#define MAXN 100007

int n ;
int a[ MAXN ] ;
char op[ MAXN ] ;

int nxt[ MAXN ] ;
long long pref[ MAXN ] ;

void input ( ) {
    cin >> n ;
    for ( int i = 1 ; i <= n ; ++ i ) {
        if ( i == 1 ) { op[ i ] = '+' ; }
        else { cin >> op[ i ] ; }
        cin >> a[ i ] ;
    }
}

void solve ( ) {
    pref[ 0 ] = 0 ;
    long long ans = 0 ;
    for ( int i = 1 ; i <= n ; ++ i ) {
        pref[ i ] = pref[ i - 1 ] + a[ i ] ;
        if ( op[ i ] == '-' ) { ans -= a[ i ] ; }
        else { ans += a[ i ] ; }
    }
    int lst = n + 1 ;
    for ( int i = n ; i >= 1 ; -- i ) {
        nxt[ i ] = lst ;
        if ( op[ i ] == '-' ) { lst = i ; }
    }
    long long aux = 0 ;
    for ( int i = 1 ; i <= n ; ++ i ) {
        if ( op[ i ] == '-' ) {
            long long sr = aux - ( pref[ nxt[ i ] - 1 ] - pref[ i - 1 ] ) + ( pref[ n ] - pref[ nxt[ i ] - 1 ] ) ;
            ans = max ( ans , sr ) ;
        }
        if ( op[ i ] == '-' ) { aux -= a[ i ] ; }
        else { aux += a[ i ] ; }
    }
    printf ( "%lld\n" , ans ) ;
}


int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    input ( ) ;
    solve ( ) ;
    return 0 ;
}


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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

ll pow2(ll e) {
    ll res = 1;
    ll b = 2;
    while (e) {
        if (e & 1)
            res = res * b % MOD;
        e >>= 1;
        (b *= b) %= MOD;
    }
    return res;
}

int main() {
    int N;
    cin >> N;
    multiset<pair<ll, ll>> ms;
    for (int i = 0; i < N; i++) {
        ll a, b;
        cin >> a >> b;
        if (a == 0 && b == 0) {
            ms.emplace(a, b);
            continue;
        }
        ll g = __gcd(a, b);
        a /= g;
        b /= g;
        if (a == 0)
            b = 1;
        if (b == 0)
            a = 1;
        if (a < 0) {
            a *= -1;
            b *= -1;
        }
        ms.emplace(a, b);
    }
    ll res0 = ms.erase({0, 0});
    ll res = 1;
    while (ms.size() > 0) {
        ll a, b;
        tie(a, b) = *ms.begin();
        int cnt1 = ms.erase({a, b});
        ll c = -b, d = a;
        if (c < 0) {
            c *= -1;
            d *= -1;
        }
        int cnt2 = ms.erase({c, d});
        res = res * (pow2(cnt1) + pow2(cnt2) - 1) % MOD;
    };
    cout << (res0 + res + MOD - 1) % MOD << endl;
}


Measured memory_bytes: 16056
import itertools

N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))

l_pattern = list(itertools.permutations([i + 1 for i in range(N)]))
P_count_order = 0
Q_count_order = 0
for i,v in enumerate(l_pattern):
    if list(v) == P:
        P_count_order = i+1
    if list(v) == Q:
        Q_count_order = i+1
print(abs(P_count_order-Q_count_order))

Measured memory_bytes: 13584
#include <iostream>
#include <unordered_set>
#include <cstdint>
#include <vector>
#include <string>
#include <climits>
#include <set>
#include <algorithm>
using namespace std;

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

	int cnt = 0;
	unsigned long long curr = 100;

	while (curr < x)
	{
		curr += curr/100;
		cnt++;
	}

	cout << cnt;
}

Measured memory_bytes: 3608
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:(input())

"""========main code==============="""
t=ii()
a=ll()
b=ll()
c=ll()
ans=0
for i in range(t):
    ans+=b[a[i]-1]
    if(i<t-1):
        if(a[i]+1==a[i+1]):
            ans+=c[a[i]-1]
print(ans)            

Measured memory_bytes: 65336
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define uu unsigned
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define MOD 1000000007
#define pi pair<int,int>
#define pl pair<ll,ll>
#define mkp make_pair
#define ss second
#define ff first
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define pb push_back
#define pf push_front
#define printcas cout<<"Case "<<cas<<": "
#define _ continue;
#define endl '\n'
#define __ cout<<endl;continue;
#define vc4d(nam,type,a,b,c,d,fix) vector<vector<vector<vector<type>>>> nam(a,vector<vector<vector<type>>>(b,vector<vector<type>>(c,vector<type>(d,fix))))
const ll oo=(1ll<<60);
int gg(){
    int x=0,w=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')w=0,ch=getchar();
    while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
    return w?x:-x;
}
ll m(ll& a)
{
   return a= a%MOD;
}
int main()
{
     io;
    int T=1;
    //T=gg();
    //cin>>T;
    //for(int cas=1;cas<=T;cas++)
    while(T--)
    {
       ll n,i,j,k,l,sum,ans;
       cin>>n;
       vl v(n);
       for(auto &x:v)cin>>x;
       sum=v[n-1]+v[n-2];ans=v[n-2]*v[n-1];m(ans);m(sum);
       for(i=n-3;i>-1;i--)
       {
           k=v[i]*sum;
           ans+=k;
           m(ans);
           sum+=v[i];
           m(sum);
       }
       cout<<m(ans);
    }
    return 0;
}


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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		char[] s = sc.next().toCharArray();
		List<Integer> ans_rev = new ArrayList<>();
		boolean ok = false;
		boolean[] used = new boolean[N+1];
		Queue<Integer> q = new ArrayDeque<>();
		q.add(N);
		while(q.size() > 0) {
			boolean first = true;
			int x = q.poll();
			for(int i = M; i >= 1; i--) {
				if(x-i <= 0) {
					ans_rev.add(M+x-i);
					ok = true;
					break;
				}
				if(!used[x-i] && s[x-i] == '0') {
					if(first) {
						ans_rev.add(i);
						q.add(x-i);
						first= false;
					}
				}
			}
		}
		if(!ok) {
			System.out.println(-1);
			return;
		}
		for(int i = ans_rev.size()-1; i >= 0; i--)
			System.out.print(ans_rev.get(i) + " ");
	}

}

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


int main() {

  int n;
  cin>>n;

  vector<int> B(n-1);
  for(int i=0;i<n-1;i++){
    cin>>B.at(i);
  }

  int64_t sum=B.at(0)+B.at(n-2);
  for(int i=0;i<n-2;i++){
    sum+=min(B.at(i),B.at(i+1));
  }

  cout<<sum<<endl;

  return 0;
}


Measured memory_bytes: 256
def ai2aip1 (ai, L):
	ai_sort = sorted(ai)
	max_num = ""
	min_num = "" 
	for s in ai_sort[::-1]:
		max_num += s
	for s in ai_sort:
		min_num += s
	max_num += "0" * (L - len(max_num))
	tmpaip1 = int(max_num) - int(min_num)
	tmpaip1 = str(tmpaip1)
	aip1 = "0" * (L - len(tmpaip1)) + tmpaip1
	return aip1
while 1:
	a, L = raw_input().split(" ")
	if (a, L) == ("0", "0"):
		break
	L = int(L)
	num_dict = {a : 0}
	for j in range(1,21):
		a = ai2aip1(a, L)
		if a in num_dict:
			print num_dict[a] , int(a), j - num_dict[a]
			break
		else:
			num_dict[a] = j

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

const int INF=pow(10,5);

int N,A,B,C;
vector<int> l;

int dfs(int cur, int a, int b, int c){
    if(cur==N){
        if(min(a,min(b,c))>0) return abs(a-A)+abs(b-B)+abs(c-C)-30;
        else return INF;
    }

    int ret0=dfs(cur+1, a, b, c);
    int ret1=dfs(cur+1, a+l[cur], b, c)+10;
    int ret2=dfs(cur+1, a, b+l[cur], c)+10;
    int ret3=dfs(cur+1, a, b, c+l[cur])+10;
    
    return min(min(ret0,ret1), min(ret2, ret3));
}

int main(void){
    cin >> N >> A >> B >> C;
    for(int i=0; i<N; i++){
        int a; cin >> a;
        l.push_back(a);
    }

    cout << dfs(0,0,0,0) << endl;
}

Measured memory_bytes: 256
#include<ctime>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<cassert>
#include<string>
#include<sstream>
#include<fstream>
#include<deque>
#include<queue>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<set>
#include<bitset>
#include<iomanip>
#include<utility>
#include<functional>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cwchar>
#include<cwctype>
#include<exception>
#include<locale>
#include<numeric>
#include<new>
#include<stdexcept>
#include<limits>
using namespace std;

#define ll long long
#define INF 1e9
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
#define pii pair<int,int>

int readint()
{
	char c;
	while(c=getchar(),(c<'0'||c>'9')&&c!='-');
	bool flag=(c=='-');
	if(flag)c=getchar();
	int x=0;
	while(c>='0'&&c<='9')
	{
		x=x*10+c-48;
		c=getchar();
	}
	return flag?-x:x;
}

int ans=INF;
string s;
vector<char>all;

bool ok(string ss,char c){
	rep(i,ss.size())if(ss[i]!=c)return false;
	return true;
}

int check(char c){
	string cur=s;
	int cnt=0;
	while(true){
		string next="";
		if(ok(cur,c))break;
		cnt++;
		rep(i,cur.size()-1)
		if(cur[i]==c||cur[i+1]==c)next+=c;
		else next+=cur[i];
		cur=next;
	}
	return cnt;
}

int main(){
	cin>>s;
	rep(i,s.size())all.push_back(s[i]);
	sort(all.begin(),all.end());
	all.resize(unique(all.begin(),all.end())-all.begin());
	rep(i,all.size())ans=min(ans,check(all[i]));
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define mod 1000000007
#define dbg(n) cout<<#n<<' '<<n<<endl;
int main(){ 

	int x,y;
	cin>>x>>y;
	int l=y/4+(y%4)/2;
	int r=y/2;
	if(y%2)
		cout<<"No\n";
	else if(x<=r&&x>=l)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	
}



Measured memory_bytes: 3560
import java.util.Scanner;
import java.util.Map;
import java.util.HashMap;

public class Main {
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		Map<Long,Integer> list = new HashMap<Long,Integer>();
		int n = in.nextInt();
		for(int i=0;i<n;i++){
			long tmp = in.nextLong();
			if(list.containsKey(tmp))
				list.remove(tmp);
			else
				list.put(tmp,0);
		}
		System.out.print(list.size());
	}
}


Measured memory_bytes: 65792
import sys,bisect,string,math,time,functools,random,fractions
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
from itertools import permutations,combinations,groupby
rep=range
def Golf():n,*t=map(int,open(0).read().split())
def I():return int(input())
def S_():return input()
def IS():return input().split()
def LS():return [i for i in input().split()]
def MI():return map(int,input().split())
def LI():return [int(i) for i in input().split()]
def LI_():return [int(i)-1 for i in input().split()]
def NI(n):return [int(input()) for i in range(n)]
def NI_(n):return [int(input())-1 for i in range(n)]
def StoLI():return [ord(i)-97 for i in input()]
def ItoS(n):return chr(n+97)
def LtoS(ls):return ''.join([chr(i+97) for i in ls])
def RA():return map(int,open(0).read().split())
def GI(V,E,ls=None,Directed=False,index=1):
    org_inp=[];g=[[] for i in R(V)]
    FromStdin=True if ls==None else False
    for i in R(E):
        if FromStdin:
            inp=LI()
            org_inp.append(inp)
        else:
            inp=ls[i]
        if len(inp)==2:
            a,b=inp;c=1
        else:
            a,b,c=inp
        if index==1:a-=1;b-=1
        aa=(a,c);bb=(b,c);g[a].append(bb)
        if not Directed:g[b].append(aa)
    return g,org_inp
def GGI(h,w,search=None,replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1):
    #h,w,g,sg=GGI(h,w,search=['S','G'],replacement_of_found='.',mp_def={'#':1,'.':0},boundary=1) # sample usage
    mp=[boundary]*(w+2);found={}
    for i in R(h):
        s=input()
        for char in search:
            if char in s:
                found[char]=((i+1)*(w+2)+s.index(char)+1)
                mp_def[char]=mp_def[replacement_of_found]
        mp+=[boundary]+[mp_def[j] for j in s]+[boundary]
    mp+=[boundary]*(w+2)
    return h+2,w+2,mp,found
def TI(n):return GI(n,n-1)
def accum(ls):
    rt=[0]
    for i in ls:rt+=[rt[-1]+i]
    return rt
def bit_combination(n,base=2):
    rt=[]
    for tb in R(base**n):s=[tb//(base**bt)%base for bt in R(n)];rt+=[s]
    return rt
def gcd(x,y):
    if y==0:return x
    if x%y==0:return y
    while x%y!=0:x,y=y,x%y
    return y
def YN(x):print(['NO','YES'][x])
def Yn(x):print(['No','Yes'][x])
def show(*inp,end='\n'):
    if show_flg:print(*inp,end=end)

mo=10**9+7
inf=float('inf')
FourNb=[(-1,0),(1,0),(0,1),(0,-1)];EightNb=[(-1,0),(1,0),(0,1),(0,-1),(1,1),(-1,-1),(1,-1),(-1,1)];compas=dict(zip('WENS',FourNb));cursol=dict(zip('LRUD',FourNb))
l_alp=string.ascii_lowercase
#sys.setrecursionlimit(10**7)
read=sys.stdin.buffer.read;readline=sys.stdin.buffer.readline;input=lambda:sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

ans=0

n=I()
a=LI()

#for i in range(l,r+1):
for i in a[::2]:
    if i%2==1:
        ans+=1
        
    
print(ans)




Measured memory_bytes: 78328
import java.io.*;

import java.math.BigInteger;
import java.util.*;

import java.util.ArrayList;

import java.util.Scanner;


public class Main{

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }

    static final int mod = 1000000007;

    public static int gcd(int a, int b)
    {
        if (a == 0)
            return b;
        return gcd(b % a, a);
    }
    public static boolean isPalindrome(String str)
    {

        // Pointers pointing to the beginning
        // and the end of the string
        int i = 0, j = str.length() - 1;

        // While there are characters toc compare
        while (i < j) {

            // If there is a mismatch
            if (str.charAt(i) != str.charAt(j))
                return false;

            // Increment first pointer and
            // decrement the other
            i++;
            j--;
        }

        // Given string is a palindrome
        return true;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

            //int t=sc.nextInt();
            //for(int i=0;i<t;i++) {
                double n = (double)sc.nextInt();
                System.out.println((int)Math.ceil(n/2));
            }
            //}
    }





Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define int long long
#define pii pair<int,int>
#define pb push_back
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const int MOD = 1e9 + 7;
using namespace std;

int32_t main()
{
    IOS
    int k,a,b;
    cin >> k >> a >> b;
    if(b <= a)    
    {
        cout << k + 1 << '\n';
    }
    else
    {
        int ans = k + 1;
        // int x = (k - a - 1)/(a + 2);
        // ans = max((x + 1) * b + k - (x * (a+2) + a + 1),ans);
        // cout << ans << '\n';
        int bis = b,yen = 0;
        if(k < a+1)
            bis = 1 + k;
        // k -= (a+1);
        else
        {
            if((a+1)%2)
            {
                if(k%2)
                {
                    bis = ((k - (a + 1))/2)*(b-a) + b;
                }
                else
                {
                    k -= 1;
                    bis = ((k - (a + 1))/2)*(b-a) + b;   
                    bis += 1;
                }
            }
            else
            {
                if(k%2 == 0)
                {
                    bis = ((k - (a + 1))/2)*(b-a) + b;
                }
                else
                {
                    k -= 1;
                    bis = ((k - (a + 1))/2)*(b-a) + b;   
                    bis += 1;
                }
            }
            ans = max(ans,bis);
        }
        cout << ans << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
//{{{
#include <bits/stdc++.h>
using namespace std;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
#define foreach(x,a) for(auto &x:a)
typedef long long ll;
const int MOD = 1e9+7;
//}}}

int main(){
  int N, D, X;
  cin >> N >> D >> X;
  int ans = X;
  rep(i, N){
    int A;
    cin >> A;
    ans += (D - 1) / A + 1;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <sstream>
#include <cmath>
#include <math.h>
#include <string>
#include <set>
#include <queue>
#include <utility>
using namespace std;
typedef long long ll;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
	cin >> n;
  	int c = 0;
  	for( int i = 0 ; i < n ; i++ ){
    	int a;
		cin >> a;
    	while( true ){
      		if( a % 2 == 0 ) {
        		c++;
        		a /= 2;
      		} else break;
    	}
  	}
  	cout << c;
}


Measured memory_bytes: 3652