akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

#define DEBUG

#ifdef DEBUG
#define var_dump(...) fprintf(stdout, __VA_ARGS__)
#define dump(a) cout << a << "\n";
#else
#define var_dump(...) 42
#define dump(a) 42
#endif

typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// 

int dp[105][10005];

int main() {
    int N, W; cin >> N >> W;

    int v[N];
    int w[N];
    for (int i = 0; i < N; i++) {
        cin >> v[i];
        cin >> w[i];
    }

    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= W; j++) {
            if (w[i] > j) {
                dp[i+1][j] = dp[i][j];
            } else {
                dp[i+1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
            }
        }
    }

    cout << dp[N][W] << "\n";

    return 0;
}



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

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

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

    vector <int> m(n);
    for(int i = 0 ; i < n; i++) {

        if(i == 0) {
            m.at(0) = a.at(0);
        } else {
            m.at(i) = max(m.at(i - 1),a.at(i));
        }


    }

    int ans = 0;

    for (int i = 0; i < n; i ++) {
        if(i == 0){
            ans++;
        } else {
if(a.at(i)>=m.at(i - 1)){
    ans ++;
}
        }
        
    }

    cout << ans << endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;
const int INF = 2e9;
signed main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int n, m, s; cin >> n >> m >> s;
  struct edge { int to, cost; };
  vector< vector<edge> > adj(n);
  for (int i = 0; i < m; i++) {
    int a, b, c; cin >> a >> b >> c;
    adj[a].push_back(edge{b, c});
  }
  vector<int> d(n, INF);
  priority_queue<P, vector<P>, greater<P> > pq;
  d[s] = 0;
  pq.push(P(0, s));
  while (not pq.empty()) {
    P p = pq.top(); pq.pop();
    int v = p.second;
    if (d[v] < p.first) continue;
    for (auto&& i : adj[v]) {
      if (d[i.to] <= d[v] + i.cost) continue;
      d[i.to] = d[v] + i.cost;
      pq.push(P(d[i.to], i.to));
    }
  }
  for (int i = 0; i < n; i++) {
    cout << (d[i] == INF ? "INF" : to_string(d[i])) << '\n';
  }
  return 0;
}


Measured memory_bytes: 12836
import Data.Char
import Data.List
import Data.Maybe
import qualified Data.ByteString.Char8 as C8

main :: IO ()
main = do
  [h, w] <- readInts 2 <$> C8.getLine
  [a, b] <- readInts 2 <$> C8.getLine
  print $ (h - a) * (w - b)

-- readInts :: IO [Int]
-- readInts = map (fst . fromJust . C8.readInt) . C8.words <$> C8.getLine

readInt = C8.readInt . C8.dropWhile isSpace
 
readInts :: Int -> C8.ByteString -> [Int]
readInts n = take n . unfoldr readInt

Measured memory_bytes: 380
N = input()
len_n = len(N)

ans = 0
if len_n % 2 == 0:
    for i in range(len_n // 2):
        ans += 9 * pow(10, 2*i)
else:
    for i in range(len_n // 2):
        ans += 9 * pow(10, 2*i)
    ans += int(N) - pow(10, 2*(len_n // 2)) + 1
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e17;
 
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}



signed main()
{
	IOS();
	int N;
	vector<int>ans;
	while(1){
		cin>>N;
		if(N==0)break;
		set<pair<int,int>>st;
		rep(i,0,N){
			int a,b;
			cin>>b>>a;
			a-=10;
			b-=10;
			st.insert({a,b});
		}
		int cnt = 0;
		int Q;
		cin>>Q;
		int i = 0,j = 0;
		while(Q--){
			char c;
			int t;
			cin>>c>>t;
			while(t--){
				if(c=='N')i++;
				else if(c=='S')i--;
				else if(c=='E')j++;
				else j--;
				if(st.count({i,j})){
					cnt++;
					st.erase({i,j});
				}
				
			}
		}
		ans.push_back(N==cnt);
	}
	for(auto e:ans){
		if(e)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}



Measured memory_bytes: 2964
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree <int,null_type,less <int>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// #include <ext/rope>
// using namespace __gnu_cxx;
typedef long long int ll;
typedef long double ld;
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define rep(g, i, n) for (ll g = i; g < n; g++)
#define rev(g, n, i) for (ll g = n - 1; g >= i; g--)
#define all(v) v.begin(), v.end()
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define bb break
#define cc continue
#define rem 1000000007
#define PI 3.141592653589793238462643383279502
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p;  // Update x if it is more than or 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 
struct point
{
    ll x,y;
};
int main()
{
    FAST
    // freopen("input1.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    /*ll tests;
    cin>>tests;
    rep (gg,0,tests)
    {}*/
    ll n,m;
    cin>>n>>m;
    ve <ll> arr1(n+1),arr2(m+1);
    rep (i,1,n+1)
    {
        cin>>arr1[i];
    }
    rep (i,1,m+1)
    {
        cin>>arr2[i];
    }
    ve <ve<ll>> dp(n+1,ve <ll> (m+1,0));
    rep (i,1,n+1)
    {
        rep (j,1,m+1)
        {
            if (arr1[i]==arr2[j])
            {
                dp[i][j]=dp[i-1][j]+dp[i][j-1]+1;
                dp[i][j]%=rem;
            }
            else
            {
                dp[i][j]=dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1];
                if (dp[i][j]<0)
                {
                    dp[i][j]+=rem;
                }
                dp[i][j]%=rem;
            }
        }
    }
    ll ans=dp[n][m]+1;
    ans%=rem;
    cout<<ans<<"\n";
}


Measured memory_bytes: 31616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7/*998244353*/;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll); ll mod_fact(ll, ll); ll mod_inv(ll, ll); ll gcd(ll, ll); ll lcm(ll, ll);
//
int main(){
    ll a, b;
    cin >> a >> b;
    int cnt = 0;
    while(a <= b){
        cnt++;
        a *= 2;
    }
    cout << cnt;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
N = int(input())
A_list = list(map(int, input().split()))
Q = int(input())

count_list = [0 for i in range(10 ** 5 + 1)]
for i in range(len(A_list)):
    count_list[A_list[i]] += 1

ans = sum(A_list)
for i in range(Q):
    B, C = map(int, input().split())
    ans = ans - count_list[B] * B + count_list[B] * C
    print(ans)
    count_list[C] += count_list[B]
    count_list[B] = 0
    

Measured memory_bytes: 21040
#include <cstdio>
#include <iostream>
#include <string>
#include <map>
#define rep(i, n) for (int i=0; i<n; i++)
using namespace std;

string inp, ans[8];
map<char, string> m;

int main(void)
{
	m['0'] = "* = ****";
	m['1'] = "* =* ***";
	m['2'] = "* =** **";
	m['3'] = "* =*** *";
	m['4'] = "* =**** ";
	m['5'] = " *= ****";
	m['6'] = " *=* ***";
	m['7'] = " *=** **";
	m['8'] = " *=*** *";
	m['9'] = " *=**** ";

	bool first = true;

	while (cin >> inp)
	{
		if (first)
		{
			first = false;
		} else {
			cout << endl;
		}

		ans[5] = "        ";
		ans[6] = "        ";
		ans[7] = "        ";

		while (inp.length() < 5) inp = "0" + inp;
		rep(i, 5) ans[i] = m[inp[i]];
		//rep(i, 5) cout << ans[i] << endl;
		rep(i, 5)
		{
			rep(j, 8)
			{
				if (j < 5 && i < j) continue;
				char w = ans[i][j];
				ans[i][j] = ans[j][i];
				ans[j][i] = w;
			}
		}
		rep(i, 8)
		{
			rep(j, 5)
			{
				cout << ans[i][j];
			}
			cout << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1188
#include <iostream>

using namespace std;

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

    int n;
    cin >> n;
    char lc;
    cin >> lc;
    int ans = 1;
    for (int i = 1; i < n; i++) {
        char c;
        cin >> c;
        if (c != lc) {
            lc = c;
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
def merge_ranges(a, b)
  [a.begin, b.begin].max..[a.end, b.end].min
end

nm = gets.chomp.split(" ")
n = nm[0].to_i
m = nm[1].to_i

gate_ranges = []
m.times.each do
  lr = gets.chomp.split(" ")
  gate_ranges << ((lr[0].to_i)..(lr[1].to_i))
end

ans_range = gate_ranges[0]
gate_ranges.each do |range|
  ans_range = merge_ranges(ans_range, range)
end

puts ans_range.count

Measured memory_bytes: 9468
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#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 IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { 
  INIT(){cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;


signed main() {
  int A, B; 
  cin >> A >> B;

  FOR(i, 1, 500000){
    if((int)(i*0.08) == A && (int)(i*0.1) == B){
      cout << i << "\n";
      return 0;
    }
  }


  cout << -1 << "\n";

  return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace AOJ
{
    class Program
    {
        static void Main(string[] args)
        {
            var cells = new int[14 * 14];
            string line;
            while ((line = Console.ReadLine()) != null)
            {
                var d = line.Split(',').Select(int.Parse).ToArray();
                switch(d[2])
                {
                case 3:
                    cells[d[0] + 2 + 2 + (d[1] + 2) * 14]++;
                    cells[d[0] + 2 - 2 + (d[1] + 2) * 14]++;
                    cells[d[0] + 2 + (d[1] + 2 + 2) * 14]++;
                    cells[d[0] + 2 + (d[1] + 2 - 2) * 14]++;
                    goto case 2;
                case 2:
                    cells[d[0] + 2 + 1 + (d[1] + 2 + 1) * 14]++;
                    cells[d[0] + 2 + 1 + (d[1] + 2 - 1) * 14]++;
                    cells[d[0] + 2 - 1 + (d[1] + 2 + 1) * 14]++;
                    cells[d[0] + 2 - 1 + (d[1] + 2 - 1) * 14]++;
                    goto case 1;
                case 1:
                    cells[d[0] + 2 + (d[1] + 2) * 14]++;
                    cells[d[0] + 2 + 1 + (d[1] + 2) * 14]++;
                    cells[d[0] + 2 - 1 + (d[1] + 2) * 14]++;
                    cells[d[0] + 2 + (d[1] + 2 + 1) * 14]++;
                    cells[d[0] + 2 + (d[1] + 2 - 1) * 14]++;
                    break;
                }
            }

            int max = 0;
            int count = 0;
            for(int y = 2; y < 12; y++)
            for(int x = 2; x < 12; x++)
            {
                var val2 = cells[x + y * 14];
                max = Math.Max(max, val2);
                if (val2 == 0) count++;
            }
            Console.WriteLine(count);
            Console.WriteLine(max);
        }
    }
}

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

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

    ll ans=(n/(a+b))*a;
    n=n%(a+b);
    ans+=min(a,n);
    cout<<ans;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define X first
#define Y second

using namespace std;
typedef pair<int,int> pii;

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

		int w[1004] = {};
		rep(i,n) cin >> w[i];

		bool dp1[305][305]={};
		vector<pii> v;
		rep(i,n-1) if( abs(w[i] - w[i+1]) < 2 ){
			dp1[i][i+1] = true;
			v.emplace_back(i, i+1);
		}
		rep(k,n){
			rep(j,k) rep(i,n) if(j){
				if( i+k >= n ) break;
				if( dp1[i][i+j] && dp1[i+j+1][i+k] ){
					dp1[i][i+k] = true;
					v.emplace_back(i, i+k);
				}
			}
			rep(i,n){
				if( i+k >= n ) break;
				if( dp1[i][i+k] && 0 < i && i+k+1 < n ){
					if( abs(w[i-1] - w[i+k+1]) < 2 ){
						dp1[i-1][i+k+1] = true;
						v.emplace_back(i-1, i+k+1);
					}
				}
			}
		}

		//for(auto t: v) cout << t.X << "," << t.Y << " "; cout << endl;
		sort( v.begin(), v.end() );
		v.erase(unique(v.begin(), v.end()), v.end());

		int dp[900005] = {}, pos=0;
		rep(i,n) rep(k,n){
			if( i+k >= n ) break;
			if( dp1[i][i+k] ){
				dp[i+k+1] = max( dp[i+k+1], dp[i] + k+1 );
			}
			dp[i+1] = max( dp[i+1], dp[i] );
		}
//		rep(i,n) cout << dp[i] << " "; cout << endl;
		cout << dp[n] << endl;
//		rep(i,900002){
//			while( pos < v.size() && v[pos].first == i ){
//				int d  = v[pos].X;
//				int nx = v[pos].Y + 1;
//				dp[nx] = max( dp[nx], dp[i] + nx - d );
//				pos++;
//			}
//			dp[i+1] = max( dp[i+1], dp[i] );
//		}
//		cout << dp[900002] << endl;
	}
	return 0;
}

Measured memory_bytes: 22208
#include <stdio.h>
#include <queue>
#include <algorithm>
#define INF 200000000
using namespace std;
typedef pair<int, int > P;
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
int h, w, n, ans, dis[10000][1000];
char s[10000][10000];
int bfs(int sx, int sy, int ex, int ey)
{
	for(int i = 1; i <= h; i++)
		for(int j = 1; j <= w; j++)dis[i][j] = INF;
	queue<P> q;
	q.push(P(sx, sy));
	dis[sx][sy] = 0;
	while (q.size()){
		P p = q.front();q.pop();
		if(p.first == ex&&p.second == ey)break;
		for(int i = 0; i < 4; i++){
			int xx = p.first + dx[i], yy = p.second + dy[i];
			if(xx >= 1&&xx <= h&&yy >= 1&& yy <= w&&dis[xx][yy] == INF&&s[xx][yy]!='X'){
				dis[xx][yy] = dis[p.first][p.second] + 1;
				q.push(P(xx, yy));
			} 
		}
	}
	return ans+=dis[ex][ey];
}
int main(){
	//freopen("1.in" ,"r", stdin);
	int sx, sy, ex, ey;
	scanf("%d %d %d", &h, &w, &n);
	for(int i = 1; i <= h; i++)
		scanf("%s", s[i] + 1);
	for (int i = 1; i <= h; i++)
		for(int j = 1; j <= w; j++)
			if(s[i][j] == 'S')sx = i, sy = j;
	for (int k = 1; k <= n; k++)
		for(int i = 1; i <= h; i++)
			for(int j = 1; j <= w; j++){
				if(s[i][j] == '1' + k - 1){
					ex = i, ey = j;
					bfs(sx, sy, ex, ey);
					sx = ex;sy = ey;
				}
			}
	printf("%d\n", ans);

}

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

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

#define MAXN 5500
ll score[MAXN][MAXN];

int main(){
  ll n,k;cin>>n>>k;
  vector<ll> p(n);
  rep(i, n){cin>>p[i]; p[i]--;}
  vector<ll>c(n);
  rep(i, n)cin>>c[i];

  vector<ll>loopc(n);

  // 各マスから始めた時のループに必要な操作数を算出
  int nex, now;
  rep(i, n){
    now = i;
    ll tr=0;
    rep1(j, n+1){
      ll nex = p[now];
      score[i][j] += score[i][j-1] + c[nex];
      now=nex;
      tr++;
      if(now==i){ loopc[i]=tr; break; }
    }
  }

  ll result = -INF;
  // 最初の一周目は全探索
  rep(i, n)rep1(j, loopc[i]){
    if(j>k)continue;
    result = max<ll>(result, score[i][j]);
  }

  // 2周以上可能な時
  rep(i, n){
    ll lc = loopc[i];

    // ループ1回の収支がプラスでも、ループの最後の一回を止めた方がスコアがデカい場合がある、そのためループ回数を最大から1減らして、その中で最大になるかを全チェック。k/lcが1以上無いと減らしたループ回数が負になるのでそのため分岐
    if(k/lc>=1){
      //可能回数-1回分ループを回す。
      ll base = score[i][lc]*(k/lc-1);
      rep1(j, lc)result = max<ll>(result, base+score[i][j]);

      // 普通にループを可能な回数だけ回す
      // 1ループ収支をループ可能数だけ加算
      ll tr = score[i][lc]*(k/lc);
      result = max<ll>(result, tr);
      // ループ終了後の余り部分の計算、余りで到達可能な全マスに対して行う。
      rep1(j, k%lc)result = max<ll>(result, tr+score[i][j]);
    }
  }

  cout<<result<<endl;

  return 0;

  cout<<endl;
  rep(i, n){
    rep(j, n+1)cout<<score[i][j]<<' ';
    cout<<endl;
  }

  for(auto t: loopc)cout<<t<<' ';cout<<endl;

  return 0;
}

Measured memory_bytes: 218564
#include <iostream>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <iomanip>

#define ll long long int
#define pb push_back
#define mk make_pair
#define pq priority_queue

using namespace std;
typedef pair<int, int> P;
typedef pair<ll, int> Pl;
const int inf = 1e9;
const ll linf = 1LL << 50;

int a[100001];
int b[100001];
set<int> st[100001];

int main(int argc, char const* argv[])
{
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < m; i++){
			cin >> a[i] >> b[i];
			a[i]--;
			b[i]--;
			st[a[i]].insert(b[i]);
	}
	int res = 0;
	set<int> cul = st[0];
	for(int i = 1; i < n; i++){
			if(cul.find(i) != cul.end()){
					res++;
					cul = st[i];
			}else{
					for(auto itr = st[i].begin(); itr != st[i].end(); ++itr){
							cul.insert((*itr));
					}
			}
	}
	cout << res << endl;
	return 0;
}


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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9
#define MOD 1000000007

using namespace std;
typedef long long int lli;
typedef long long ll;

int main(){
  int a,b,c,d; cin >> a >> b >> c >> d;
  int x =c-a, y = d-b;
  cout << c-y << " " << d+x << " " << a-y << " " << b+x << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <string.h>
using namespace std;

#define HUNDRED 100
#define THOUSAND 10000
#define TENTHOUSAND 10000
#define HUNDREDTHOUSAND 100000
#define ALPHABET 26

int kaibun(int number);

int main() {
	string s;
	char check[ALPHABET] ={};


	cin >> s;

	for(int i= 0 ; i< (int)s.size() ; i++){
		check[(int)s[i]-(int)'a'] = s[i];
	}

	for(int j=0; j < ALPHABET ; j++){
		if(check[j] == 0){
			cout << (char)((int)'a'+ j) ;
			exit(0);
		}
	}

	cout << "None";


}

Measured memory_bytes: 512
#include<stdio.h>
#include <iomanip>
#include <iostream>
#include<string>
#include<vector>
#include<map>
#include<queue>
#include<algorithm>
#include <random>
#include <chrono>

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

using namespace std;
int main() {
	int a,b;
	int ans = -1;
	cin >> a>>b;
	if (a < 10 && b < 10) {
		ans = a * b;
	}

	cout << ans;

}

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

#define REP(i ,n) for(int i=0 ;i < n; i++)
#define REPB(i ,n) for(int i=n; i >= 0; i--)
#define FOR(i ,m ,n) for(int i=m; i < n; i++)
#define FORB(i, m, n) for(int i=m; i>= n; i--)
#define ll long long
#define pb push_back
#define popb pop_back
#define debug(i) cout<< #i<< "= "<< i << endl
using namespace std;

int main(){
    int n,ans = 0;
    vector<int> a;
    cin >> n;

    REP(i,n){
        int t;
        cin >> t;
        a.pb(t);
    }

    for(int i =0;i <n; i+=2){
        if(a[i] % 2 == 1) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3524
// Problem: D - Moving Piece
// Contest: AtCoder - AtCoder Beginner Contest 175
// URL: https://atcoder.jp/contests/abc175/tasks/abc175_d
// Memory Limit: 1024 MB
// Time Limit: 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)



    #include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    #define FAST ios_base::sync_with_stdio(false);cin.tie(0);
    const double EPS = 1e-9;
    const double PI = acos(-1);
    const int knightDir[8][2] = {{-2,-1},{-2,1},{-1,2},{1,2},{2,-1},{2,1},{-1,-2},{1,-2}};
    //const int dx[]={0,0,0,1,1,1,-1,-1,-1};
    //const int dy[]={-1,0,1,-1,0,1,-1,0,1};
    const int dx[] = {0 , 1 , 0 , -1};
    const int dy[] = {1 , 0 , -1 , 0};
    //#define MOD         1000000007LL
    #define MAX         1000005
    const ll MOD = 1000000000 + 7;
    int p[5010],c[5010];
    int vis[5010];
    pair<int, long long int> period[5010];
    int main()
    {
        FAST
        int t;
        t = 1;

        while(t--)
        {
           int n , k;
           cin >> n >> k;
           
           for(int i = 1 ; i <= n ; i++)
           {
               cin >> p[i];
           }
           
           for(int i = 1 ; i <= n ; i++)cin >> c[i];
           
           for(int i = 1 ; i <= n ; i++)
           {
               int m = i;
               ll s = 0;
               for(int i = 1 ; i <= n ; i++)vis[i] = 0;
               
               for(int j = 0 ; j <= n ; j++)
               {
                   if(vis[m])
                   {
                       period[i] = make_pair(j , s);
                       break;
                   }
                   vis[m] = 1;
                   m = p[m];
                   s += c[m];
               }
           }
           
           ll ans = LLONG_MIN;
           
           for(int i = 1 ; i <= n ; i++)
           {
               int m = i;
               ll s = 0;
               for(int j = 1 ; j <= period[i].first ; j++)
               {
                   if(j > k)break;
                   m = p[m];
                   s += c[m];
                   int t = (k - j) / period[i].first;
                   ll s2 = s + t * period[i].second;
                   ans = max(ans , s);
                   ans = max(ans , s2);
               }
           }
           
           cout << ans << endl;
        }
    }



Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define rep2(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) rep2(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define sz size()
#define pb push_back
#define bg begin()
#define ed end()
#define fi first()
#define se second()
using namespace std;
using ll = long long;
using vint = vector<int>;
using pint = pair<int, int>;
using vpint = vector<pint>;
template <typename T>
T sq(T x) {
  return x * x;
}
ll mod = 1e9 + 7;

signed main() {
  string N;
  cin >> N;
  int S = 0;
  for (int i = 0; i < (int)N.size(); i++) {
    S += (int)N.at(i) - 48;
  }
  if (S % 9 == 0) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}



Measured memory_bytes: 3724
a,b,c = input().split()

if a == b and a == c:
	print(1)
elif a ==b and a != c:
	print(2)
elif b == c and b != a:
	print(2)
elif c ==a and c != b:
	print(2)
elif a != b and b != c and c != a:
	print(3)

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

using namespace std;
int main(){
  int a[3];
  cin>>a[0]>>a[1]>>a[2];
  if(a[0]>a[1])swap(a[0],a[1]);
  if(a[1]>a[2])swap(a[1],a[2]);
  if(a[0]>a[1])swap(a[0],a[1]);
  cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<endl;
}


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

int gcd(unsigned long int m,unsigned long int n) {
	if (n == 0)return m;
	while (m%n != 0) {
		m = m%n;
		swap(m, n);
	}
	return n;
}

int main() {
	unsigned long int a, b; vector<unsigned long int> GCDS; vector<unsigned long int> LCMS;
	while(cin>>a>>b) {
		GCDS.push_back(gcd(a, b));
		LCMS.push_back(a / gcd(a, b)*b);
	}
	for (int i = 0; i < GCDS.size(); i++) {
		cout << GCDS[i] << ' ' << LCMS[i] << endl;
	}
}

Measured memory_bytes: 3116
from sys import argv

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
c = c + [0] * (len(b) - len(c))
ans = 0
debug = "a" in argv
for index, x in enumerate(a):
    ans += b[x - 1]
    if a[index - 1] + 1 == a[index] and index != 0:
        if debug:
            print(x, index, a[index - 1], a[index])
            print(c[x - 2], c[x - 1])
        ans += c[x - 2]
print(ans)

Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdio.h>
#include <string.h>
using namespace std;

constexpr int P = 1000000007;

int64_t f(int n, vector<int>& x) {
    int64_t s = 0, sx = x[n - 1] - x[0], t0 = 0, t1 = 0;
    sx %= P;
    for (int j = 1; j < n; j++) {
        int i = j - 1;
        t0 += (int64_t)x[i] - x[0];
        t1 += (int64_t)x[n - 1] - x[n - 1 - i];
        t0 %= P;
        t1 %= P;

        s += j * sx - t0 - t1;
        s %= P;
    }
    if (s < 0) s += P;
    return s;
}

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

    int n, m;
    cin >> n >> m;
    vector<int> x(n), y(m);
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> y[i];
    }

    cout << (f(n, x) * f(m, y)) % P << endl;

    return 0;
}

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

int main() {
  string A, B, C;
  cin >> A >> B >> C;

  char ans = 'a';
  int a = 0, b = 0, c = 0;

  while (a <= A.size() && b <= B.size() && c <= C.size()) {
    if (ans == 'a') {
      if (a == A.size()) ans = 'A';
      else ans = A.at(a);
      a++;
    }
    if (ans == 'b') {
      if (b == B.size()) ans = 'B';
      else ans = B.at(b);
      b++;
    }
    if (ans == 'c') {
      if (c == C.size()) ans = 'C';
      else ans = C.at(c);
      c++;
    }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(){
  int a,b,c,r;

  scanf("%d%d",&a,&b);
  if(a<b){
      c = a;
      a = b;
      b = c;
    }
    r = a % b;
    while(r!=0){
        a = b;
        b = r;
        r = a % b;
     }
    printf("%d\n",b);

  return 0;
}



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

using namespace std;

int main() {
	int N,K,X,Y,ans=0;

	cin>>N>>K>>X>>Y;

	for(int i=1;i<=N;i++) {
		if(i<=K) {
			ans+=X;
		} else {
			ans+=Y;
		} 
	}
	cout<<ans;

	return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>
int main(){
	int n,a,b,c,i;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d %d",&a,&b,&c);
		if(a*a+b*b==c*c)printf("YES\n");
		else if(b*b+c*c==a*a)printf("YES\n");
		else if(c*c+a*a==b*b)printf("YES\n");
		else printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

int N, ans;
map<int, int> M;

int main(){
    int x;
    scanf("%d", &N);
    for (int i=1; i<=N; i++){
        scanf("%d", &x);
        M[x]++;
    }
    for (pii t : M){
        if (t.first > t.second) ans += t.second;
        else ans += t.second - t.first;
    }
    printf("%d\n", ans);
    return 0;
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

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

const ll MOD = 1e9+7;

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

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

  sort(A.begin(), A.end());

  vector<int> good(N);
  if(N % 2 == 1){
    for(int i = 0; i < N; i++){
      good[i] = 2 * ((i + 2 - 1)/2);
    }
  }else{
    for(int i = 0; i < N; i++){
      good[i] = 1 + 2 * (i/2);
    }
  }

  bool ok = true;
  for(int i = 0; i < N; i++){
    if(good[i] != A[i]){
      ok = false;
      break;
    }
  }

  if(ok){
    ll ans = 1;
    for(int i = 0; i < N/2; i++){
      ans = (ans * 2) % MOD;
    }

    cout << ans << endl;

  }else{
    cout << 0 << endl;
  }

  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(2)<<(x)
#define what_is(x) cerr << #x << " is " << x << endl;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define inf std::numeric_limits<int>::max();
#define highest_2_pow(n)  __builtin_clzll((long long)0)- __builtin_clzll((long long)n) - 1
//-----------------------------------------------------------------------------------------------------
#define lli long long int 
#define int long long
#define all(x)            (x).begin(),(x).end()
#define uniq(v)           (v).erase(unique(all(v)),(v).end())
#define sz(x)             (int)((x).size())
#define fr                first
#define sc                second
#define pii               pair<int,int>
#define vi vector<int>
#define vlli vector<long long int>
#define si set<int>
#define slli set<long long int>
#define mt make_tuple
#define mp make_pair
#define eb emplace_back
#define mem1(a)           memset(a,-1,sizeof(a))
#define mem0(a)           memset(a,0,sizeof(a))
#define ppc               __builtin_popcount
#define ppcll             __builtin_popcountll
//---------------------------------------------------
using namespace std;
// GCD and LCM are available
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}

void faster(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}
void solve(){
    string s,t;
    cin>>s;
    cin>>t;
    int flag=0;
    int n = s.size();
    int tn = t.size();
    if(tn>n){
        cout<<"UNRESTORABLE"<<endl;
        return;
    }
    rep(i,n+1-tn,-1){
        flag=1;
        rep(j,0,tn){
            if(s[i+j]!='?' && s[i+j]!=t[j]) flag=0;
        }
        if(flag){
            s.replace(i,tn,t);
            break;
        }

    }
    

    if(flag==0) cout<<"UNRESTORABLE"<<endl;
    else{
        for(int i=0;i<n;i++) if(s[i]=='?') s[i] = 'a';
        cout<<s<<endl;
    }
    
}
signed main()
{
    faster();
    int t=1;
    //cin>>t;
    while(t--) solve();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,a[55],b[55],c[55],d[55],i,j,minv=1e9,minn;//a,b数组存储学生坐标;c,d数组存储检查站坐标.minv存最小值,minn存储最近的检查站编号
    cin>>n>>m;
    for(i=1;i<=n;i++)
        cin>>a[i]>>b[i];
    for(i=1;i<=m;i++)
        cin>>c[i]>>d[i];
    for(i=1;i<=n;i++){
        minv=1e9;
        for(j=1;j<=m;j++)
            if(abs(c[j]-a[i])+abs(d[j]-b[i])<minv){
                minv=abs(c[j]-a[i])+abs(d[j]-b[i]);
                minn=j;
            }
        cout<<minn<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MX = 200005;

char S[MX];

int na[MX];
int nb[MX];

vector<int> neigh[MX];
bool destroyed[MX];

void destroy(int v) {
	destroyed[v] = true;
	for (int u : neigh[v]) {
		if (destroyed[u]) continue;
		if (S[v] == 'A') {
			na[u]--;
		}
		else {
			nb[u]--;
		}
		
		if (na[u] == 0 || nb[u] == 0) {
			destroy(u);
		}
	}
}

int main()
{
	int n, m;
	ignore = scanf("%d %d", &n, &m);
	ignore = scanf(" %s", S + 1);
	
	for (int i = 0; i < m; i++) {
		int u, v;
		ignore = scanf("%d %d", &u, &v);
		neigh[u].push_back(v);
		neigh[v].push_back(u);
		
		if (S[v] == 'A') {
			na[u]++;
		}
		else {
			nb[u]++;
		}
		
		if (u != v) {		
			if (S[u] == 'A') {
				na[v]++;
			}
			else {
				nb[v]++;
			}
		}
	}

	for (int v = 1; v <= n; v++) {
		if (destroyed[v]) continue;
		if (na[v] == 0 || nb[v] == 0) {
			destroy(v);
		}
	}
	
	for (int v = 1; v <= n; v++) {
		if (!destroyed[v]) {
			printf("Yes\n");
			return 0;
		}
	}
	
	printf("No\n");

	return 0;
}


Measured memory_bytes: 14208
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define true 1
#define false 0
#define MAX 10000000
typedef long long ll;
typedef unsigned char Uchar; 

int main(void){
  
  double a,b,c;
  scanf("%lf %lf %lf",&a,&b,&c);
  
  double f = a / c;
  //f = f * 10;
  if(f <= b){
    printf("Yes");
  }else printf("No");
  
  return 0;
}

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

#include <boost/hana/functional/fix.hpp>

#if DEBUG
template <typename Iter>
void debug_iter(Iter begin, Iter end);
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T>
void debug(const std::vector<T>& v) {
  debug_iter(v.begin(), v.end());
}
template <typename T>
void debug(const std::set<T>& s) {
  debug_iter(s.begin(), s.end());
}
template <typename T, typename U>
void debug(const std::map<T, U>& m) {
  debug_iter(m.begin(), m.end());
}
template <typename T, typename U>
void debug(const std::pair<T, U>& p) {
  std::cerr << "{";
  debug(p.first);
  std::cerr << ", ";
  debug(p.second);
  std::cerr << "}";
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  debug(value);
  std::cerr << ", ";
  debug(args...);
}
template <typename Iter>
void debug_iter(Iter begin, Iter end) {
  std::cerr << "{";
  for (Iter it = begin; it != end; ++it) {
    if (it != begin) std::cerr << ", ";
    debug(*it);
  }
  std::cerr << "}";
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

template <typename T>
std::istream& operator>>(std::istream& is, std::vector<T>& v) {
  for (T& vi : v) is >> vi;
  return is;
}

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

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

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

int main() {
  rd(int, n);
  vector<int> target(3);
  cin >> target;
  vector<int> l(n);
  cin >> l;
  vector<int> current(3);
  int ans = numeric_limits<int>::max();
  boost::hana::fix([&](auto f, int depth, int used_mp) {
    if (depth == n) {
      rep(i, 3) {
        if (current[i] == 0) return;
        used_mp += abs(target[i] - current[i]);
      }
      chmin(ans, used_mp);
      return;
    }
    rep(i, 4) {
      int mp = 0;
      if (i < 3) {
        if (current[i] != 0) {
          mp += 10;
        }
        current[i] += l[depth];
      }
      f(depth + 1, used_mp + mp);
      if (i < 3) {
        current[i] -= l[depth];
      }
    }
  })(0, 0);
  wt(ans);
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
map<int,int> m;
vector<int> v;
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		int x;
		cin>>x;
		if(m[x]==0)
			v.push_back(x);
		m[x]++;
	}
	int ans=0;
	for(int i=0;i<v.size();i++)
	{
		if(v[i]>m[v[i]]) 
			ans+=m[v[i]];
		else if(v[i]<m[v[i]]) 
			ans+=m[v[i]]-v[i];
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 5112
package main

import "fmt"

var dp [3001][3001]int

func main() {
	var s, t []byte
	fmt.Scan(&s, &t)

	for i := 0; i < len(s); i++ {
		for j := 0; j < len(t); j++ {
			a, b := i+1, j+1
			if s[i] == t[j] {
				dp[a][b] = Max(dp[a][b], dp[i][j]+1)
			}
			dp[a][b] = Max(dp[a][b], dp[a][j])
			dp[a][b] = Max(dp[a][b], dp[i][b])
		}
	}

	var ans []byte
	i, j := len(s), len(t)

	for i > 0 && j > 0 {
		if dp[i][j] == dp[i-1][j] {
			i--
			continue
		}

		if dp[i][j] == dp[i][j-1] {
			j--
			continue
		}

		i--
		j--
		ans = append(ans, s[i])
	}

	Reverse(ans)
	fmt.Println(string(ans))
}

// generated by https://github.com/murosan/gollect

func Reverse(s []byte) {
	for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 {
		s[i], s[j] = s[j], s[i]
	}
}

func Max(a, b int) int {
	if a > b {
		return a
	}
	return b
}


Measured memory_bytes: 70912
using System;
using System.Linq;

namespace Sample
{
	class Program
	{
		static void Main(string[] args)
		{
			while (true)
			{
				var array = Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
				var h = array[0];
				var w = array[1];

				if( h == 0 && w == 0)
				{
					return;
				}
				for(var i = 0; i < h; i++)
				{
					var s = new string('#', w);
					Console.WriteLine(s);
				}
				Console.WriteLine();
			}
		}
	}
}



Measured memory_bytes: 20456
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <string>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>
#define endl '\n'
#define ll long long
#define mod 1000000007
#define NCONS 1000000000
//#define NCONS 100001
//#define NCONS 1001
//#define NCONS 101
#define MCONS 2001
#define LIMIT 1000000000
#define TRUE 1
#define FALSE 0
#define toRadian(degree) ((degree) * (M_PI / 180.))
#define toDegree(radian) ((radian) * (180. / M_PI))
using namespace std;
struct Point{int x; int y;};

int main(void)
{
    cin.tie(NULL); ios_base::sync_with_stdio(false);
    int D; cin >> D;
    if(D == 25)
        cout << "Christmas";
    else if(D == 24)
        cout << "Christmas Eve";
    else if(D == 23)
        cout << "Christmas Eve Eve";
    else if(D == 22)
        cout << "Christmas Eve Eve Eve";
   
    return 0;
}


Measured memory_bytes: 256
N = int(input())
P = [int(i) for i in input().split()]
P_min = P.copy()
for i in range(1,N):
    P_min[i] = min(P_min[i-1],P[i])
cnt = 0
for i in range(N):
    if P_min[i] >= P[i]:
        cnt += 1
print(cnt)


Measured memory_bytes: 24744
import Data.Bits
import Debug.Trace

main = do
  n <- read <$> getLine :: IO Int
  as <- map read . words <$> getLine :: IO [Int]
  print $ solve as

solve :: [Int] -> Int
solve as =
  traceShow ("as",as) $
  ans
  where
    ans = check (as,as,0) 0 0

check ([],_,_) _ res = res
check (als@(al:als'), ars@([]), len) accum res =
  check (als', ars, len-1) (xor accum al) $ res+len-1  
check (als@(al:als'), ars@(ar:ars'), len) accum res =
--  traceShow ("l="++show als,"r="++ show ars,"acc="++show accum,"len="++show len,"res="++show res) $
  if len == 0 then
    check (als, ars', len+1) (xor accum ar) $ res+1
  else if 0 == (accum .&. ar) then
    check (als, ars', len+1) (xor accum ar) $ res+1
  else
    check (als', ars, len-1) (xor al accum) $ res+len-1
    


  

Measured memory_bytes: 119164
import java.util.*;

public class Main
{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int ans = n*a < b? n*a : b;
		//ArrayList<Integer> iarr = new ArrayList<Integer>();


		System.out.println(ans);
	}

}

Measured memory_bytes: 23636
n, a, b = map(int, input().split())
s = input()

oversea = 0
c = [False for i in range(n)]
cnt = 0
for i in range(n):
	if s[i] == "a":
		if cnt < a+b:
			c[i] = True
			cnt += 1
	if s[i] == "b":
		if cnt < a+b and oversea < b:
			c[i] = True
			oversea += 1
			cnt += 1
for i in c:
	if i:
		print ("Yes")
	else:
		print ("No")

Measured memory_bytes: 4784
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;



int main() {
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    sort(h.begin(), h.end());
    int ans = INF;
    rep(i,n) {
        if (i+k-1 >= n) break;
        ans = min(ans, h[i+k-1]-h[i]);
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long LL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<LL> vl;
typedef vector<vector<LL>> vvl;
typedef vector<vector<vector<LL>>> vvvl;


const int inf = 1e9+7;
const LL INF = 1e18+5;
const int mod = 1e9+7;
const int mxN = 1e5+5;
const int mxM = 1e5+5;

int main(){
    #ifndef ONLINE_JUDGE
    freopen("E:\\Coding\\Programming\\input.txt", "r", stdin);
    freopen("E:\\Coding\\Programming\\output.txt", "w", stdout);
    #endif
    int n;
    cin>>n;
    double d;
    cin>>d;
    vector<double> ans;
    for(int i=0;i<n;i++){
        LL x,y;
        cin>>x>>y;

       ans.push_back(sqrt(x*x+y*y));
    }
    int c=0;
    sort(ans.begin(),ans.end());
    for(int i=0;i<n;i++){
        if(ans[i]<=d) c++;
    }
    cout<<c<<endl;
}

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

// Loops
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define _rrep(i, n) rrepi(i, n, 0)
#define rrepi(i, a, b) for (int i = int(a) - 1; i >= int(b); --i)

#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__, rrepi, _rrep, )(__VA_ARGS__)
#define each(xi, x) for (auto &&xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)

// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi = vec<ll>;
using vvi = vec<vi>;
using vvvi = vec<vvi>;
using pii = pair<ll, ll>;

// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define mp make_pair

// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(all(v)), v.end())
#define perm(c)                                                                \
  sort(all(c));                                                                \
  for (bool c##p = 1; c##p; c##p = next_permutation(all(c)))

template <class T> pair<T, size_t> max(vector<T> &x) {
  auto it = max_element(all(x));
  return mp(*it, it - x.begin());
}
template <class T> pair<T, size_t> min(vector<T> &x) {
  auto it = min_element(all(x));
  return mp(*it, it - x.begin());
}

template <class T> inline bool chmax(T &maxval, const T &newval) {
  if (maxval < newval) {
    maxval = newval;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &minval, const T &newval) {
  if (minval > newval) {
    minval = newval;
    return 1;
  }
  return 0;
}

// Utilities
// Grid world utilities
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};
#define inside(H, W, y, x) 0 <= (x) && (x) < (W) && 0 <= (y) && (y) < (H)

// Debug
#ifdef LOCAL
#include "dump.hpp"
#define debug(x) cerr << #x << ": " << x << '\n'
#else
#define dump(...)
#define debug(x)
#endif

// Paste snippets here!!
template <class INT_T>
INT_T gcd(INT_T a, INT_T b) {
  if(a < b) return gcd(b, a);
  INT_T r;
  while ((r=a%b)) { a = b; b = r; }
  return b;
}

ll gcd3(ll a, ll b, ll c){
  //
  return gcd(a,gcd(b,c));
}
//

void solve(long long K) {
  ll ret = 0;
  rep(a,1,K+1) rep(b,1,K+1) rep(c,1,K+1) ret += gcd3(a,b,c);
  cout << ret << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); // Magic for faster cin
  cout.precision(12);
  long long K;
  std::cin >> K;
  solve(K);
  return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
#include <numeric>
#include <bitset>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {

	int N, i;
	cin >> N >> i;
	cout << N - i + 1;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int maxn=3000;
double dp[maxn][maxn];
double p[maxn],ans;
int n;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)cin>>p[i];
	for(int i=0;i<=n;i++)
	{
		for(int j=0;j<=n;j++)
		{
			if(j==0&&i==0)dp[i][j]=1;
			else if(j==0&&i!=0)dp[i][j]=(1-p[i])*dp[i-1][j];
			else if(i==0)dp[i][j]=0;
			else dp[i][j]=dp[i-1][j-1]*p[i]+dp[i-1][j]*(1-p[i]);
		}
	}
	for(int heads=(n/2)+1;heads<=n;heads++)ans+=dp[n][heads];
	cout<<fixed<<setprecision(10)<<ans<<endl;
	return 0;
}

Measured memory_bytes: 70528
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S;
    int a;
    cin >> S;
    a = S.size();
    for (int i=0;i<a;i++){
        if (i % 2 == 0){
            if(S.at(i) == 'L'){
                cout << "No" << endl;
                break;
            }
        }
        else{
            if(S.at(i) == 'R'){
                cout << "No" << endl;
                break;
            }
        }
        if (i + 1 == a){
            cout << "Yes" << endl;
        }
    }
}

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

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

typedef long long ll;

const ll MOD = 1e9 + 7;

class EColorfulHats2 {
public:
	void solve(std::istream& in, std::ostream& out) {
	    ll N;
	    in >> N;
	    vector<ll> A(N);
	    REP(i,0,N) in >> A[i];

	    vector<int> cnt(3, 0);

	    ll answer = 1;
	    REP(i,0,N) {
	        auto itr = find(all(cnt), A[i]);
	        if (itr == cnt.end()) {
	            answer = 0;
	            break;
	        }
	        answer *= count(all(cnt), *itr);
	        answer %= MOD;
            *itr += 1;
	    }
	    out << answer << "\n";
	}
};


signed main() {
	EColorfulHats2 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1024