akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>

int main()
{
    long long n, a, b;
    std::cin >> n >> a >> b;
    long long num_blues;
    if (a == 0) {
        num_blues = 0;
    } else if (n <= a + b) {
        num_blues = std::min(n, a);
    } else {
        long long wrap_count = n / (a + b);
        long long remaining = n % (a + b);
        long long blue_remaining = remaining > a ? a : remaining;
        num_blues = wrap_count * a + blue_remaining;
    }
    std::cout << num_blues << std::endl;
    return 0;
}

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

#define pb push_back
#define all(v) v.begin(), v.end()
#define sz(v) int(v.size())
#define pii pair<int, int>
#define mp make_pair
#define f first
#define ll long long
#define ld long double
#define s second
#define vec vector<int>

using namespace std;

const int N = (int) 1e5 + 10;
const int M = (int) 1e6 + 10;
const int K = (int) 500 + 10;
const int INF = (int) 1e9 + 7;
const int mod = (int) 1e9 + 7;
const ld EPS = (ld) 1e-9;
const ll LINF = (ll) 1e18;

int n;
int a[N];
set<pair<ll, ll> > pos[N];

int main() {
	#ifdef sony
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	srand(time(0));
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	pos[n + 1].insert(mp(2, 2));
	for (int i = n; i >= 1; i--) {
		for (auto it : pos[i + 1]) {
			//p / a[i] * a[i] = it 
			ll k_min = (it.f + a[i] - 1) / a[i];
			ll k_max = it.s / a[i];
			if (k_min > k_max) continue;
			pos[i].insert(mp(k_min * a[i], (k_max + 1) * a[i] - 1));
			/*
			int k = it / a[i];
			for (int j = k * a[i]; j < (k + 1) * a[i]; j++)
				pos[i].insert(j);
			*/
		}
		/*
		cout << i << ": ";
		for (auto it : pos[i]) {
			cout << it << ' ';
		}
		cout << "\n";
		*/
	}
	if (pos[1].empty()) cout << -1;
	else cout << (*pos[1].begin()).f << ' ' << (*pos[1].rbegin()).s;
	return 0;
}

Measured memory_bytes: 11520
using System;

class quiz
{
    public int solve(int N, int K, int[] D)
    {
        int payment = 0;
        bool used = false;

        for (int i = 0; i <= 9 * N; i++)
        {
            payment = N + i;
            used = false;

            while (payment > 0)
            {
                for (int k = 0; k < K; k++)
                {
                    if (payment % 10 == D[k])
                        used = true;
                }

                payment /= 10;
            }

            if (!used)
                return N + i;
        }

        return -1;
    }

    public int[] ParseIntBySpace(string str)
    {
        int[] array = new int[str.Length];
        int lastloc = 0, spaceloc = -1;

        for (int i = 0; i < str.Length; i++)
        {
            if (str[i] == ' ')
            {
                array[lastloc++] = int.Parse(str.Substring(spaceloc + 1, i - spaceloc - 1));
                spaceloc = i;
            }
            else if (i == str.Length - 1)
            {
                array[lastloc++] = int.Parse(str.Substring(spaceloc + 1, i - spaceloc));
            }
        }

        Array.Resize(ref array, lastloc);

        return array;
    }
}

class Example
{
    static void Main()
    {
        quiz ex = new quiz();

        int[] NK = ex.ParseIntBySpace(Console.ReadLine());

        Console.WriteLine(ex.solve(NK[0],NK[1],ex.ParseIntBySpace(Console.ReadLine())));
    }
}

Measured memory_bytes: 13140
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 210

struct BipartiteMatching{
  
  int V;
  vector<vector<int> > G;
  vector<int> match;
  vector<bool> used;
  
  BipartiteMatching(int n):
    V(n),G(n,vector<int>()){}
  
  void add_edge(int u, int v){
    G[u].push_back(v);
    G[v].push_back(u);
  }
  
  bool dfs(int v){
    used[v] = true;
    for(int i=0;i<G[v].size();i++){
      int u = G[v][i], w = match[u];
      if(w < 0 || (!used[w] && dfs(w))){
        match[v] = u;
        match[u] = v;
        return true;
      }
    }
    return false;
  }
  
  int solve(){
    int res = 0;
    match.assign(V,-1);
    for(int i=0;i<V;i++){
      if(match[i] < 0){
        used.assign(V,false);
        if(dfs(i)) res++;
      }
    }
    
    return res;
  }
  
};



int main(){
  int n;
  int a[SIZE],b[SIZE], c[SIZE], d[SIZE];

  scanf("%d",&n);

  BipartiteMatching bm(2*n);
  
  for(int i=0;i<n;i++){
    scanf("%d%d",a+i, b+i);
  }

  for(int i=0;i<n;i++){
    scanf("%d%d",c+i, d+i);

    for(int j=0;j<n;j++){
      if(a[j] < c[i] && b[j] < d[i]){
        bm.add_edge(j, n + i);
      }
    }
    
  }

  cout << bm.solve() << endl;
  
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int a, b;
	int n, m;
	int temp;
	int GCD, LCM;
	while(scanf("%d %d",&b,&a)!=EOF){
		if(b<a){
			temp = b;
			b = a;
			a = temp;
		}
		n = a;
		m = b;
		while(n){
			temp = m;
			m = n;
			n = temp % n;
		}
		printf("%d %d\n",m,a*(b/m));
	}
}

Measured memory_bytes: 0
sx, sy, tx, ty = [int(a) for a in input().split()]

dx = tx - sx
dy = ty - sy

txt = ""
# route 1
txt += dy*"U" + dx*"R"
# route 2
txt += dy*"D" + dx*"L"
# route 3
txt += "L" + (dy+1)*"U" + (dx+1)*"R" + "D"
# route 4
txt += "R" + (dy+1)*"D" + (dx+1)*"L" + "U"

print(txt)

Measured memory_bytes: 9152
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef unordered_set<ll> uset;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=0;i<=n;i++)
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define all(x) x.begin(),x.end()
#pragma gcc optimize("O3")
#pragma gcc optimize("unroll-loops")
#pragma gcc target("avx2,see4")
int ask(ll a,ll b,ll c,ll d){
	cout<<"? "<<a<<" "<<b<<" "<<c<<" "<<d<<"\n"<<flush;
	int res;
	cin>>res;
	return res;
}
int main(){
	int h,w,n,K;
	cin>>h>>w>>n>>K;
	int ans[55][55];
	rep(i,h)rep(j,w)ans[i][j]=0;
	ll e=0;
	rep(i,h)for(int j=0;j<w;j+=4){
		int l=j,r=min(w-1,j+3);
		int allsum=ask(i,l,i,r);
		if(allsum==0)continue;
		e+=allsum;
		if(r-l+1==2){
			int x=ask(i,l,i,l);
			ans[i][l]=x,ans[i][r]=allsum-x;
			continue;
		}
		else{
			int x=ask(i,l,i,l+1);
			int y=allsum-x;
			if(x>0){
				int s=ask(i,l,i,l);
				int t=x-s;
				ans[i][l]=s,ans[i][l+1]=t;
			}
			if(y>0){
				int s=ask(i,l+2,i,l+2);
				int t=y-s;
				ans[i][l+2]=s,ans[i][l+3]=t;
			}
		}
		if(n==e)break;
	}
	ll fans=0,po2=1;
	rep(i,h)rep(j,w){
		fans=(fans+po2*ans[i][j])%K;
		po2=po2*2%K;
	}
	cout<<"! "<<fans<<"\n"<<flush;
}


Measured memory_bytes: 720
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <set>
#include <map>

#define INF 100000000
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
using P = pair<int, int>;

const int MAX = 1000000;
const int MOD = 1000000007;

/*
long long fac[MAX], finv[MAX], inv[MAX];

//テーブルの前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        //そのまま計算すると負の値になるのでMODを足す
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//二分累乗法
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
*/

/*
//UnionFind木
struct UnionFind{
   vector<long long int> par; //par[i] : iの親の番号
   vector<long long int> rnk; //root[i] : iの木のサイズ

   //コンストラクタ
   UnionFind(long long int n): par(n), rnk(n){
       //木の初期化
       for(long long int i = 0; i < n; i++){
           par[i] = i;
           rnk[i] = 1;
       }
   }

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

   //xとyが同じ木に属しているかを判定
   bool same(long long int x, long long int y){
       return root(x) == root(y);
   }

   //xとyの木を併合
   void unite(long long int x, long long int y){
       long long int rx = root(x); //xの根
       long long int ry = root(y); //yの根
       if(rx == ry) return; //根が同じならそのまま

       //併合するときにサイズを足し合わせる
       if(rnk[rx] < rnk[ry]){
           par[rx] = ry;
           rnk[ry] += rnk[rx];
       }else{
           par[ry] = rx;
           rnk[rx] += rnk[ry];
       }
   }

   //属している木のサイズを取得
   long long int size(long long int x){
       return rnk[root(x)];
   }
};
*/


/*
typedef struct edge{
   int to;
   int cost;
} edge;

vector<edge> graph[2010];
long long int d[2010];

void dijkstra(int s){
   priority_queue<P, vector<P>, greater<P> > que;
   for(int i = 0; i < 2010; i++){
       d[i] = INF;
   }
   d[s] = 0;
   que.push(P(s, 0));

   while (!que.empty()) {
       P p = que.top();
       que.pop();
       int v = p.first;
       if (d[v] < p.second) continue;

       for (int i=0; i<graph[v].size(); ++i) {
           edge e = graph[v][i];
           if (d[e.to] > d[v] + e.cost) {
               d[e.to] = d[v] + e.cost;
               que.push(P(e.to, d[e.to]));
           }
       }
   }
}
*/

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

    long long int count = 0;
    count++;
    x *= 2;
    while(x <= y){
        count++;
        x *= 2;
    }

    cout << count << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VV(T, a, b, c) vector<vector<T>>(a, vector<T>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define VVV(T, a, b, c, d)                                                     \
  vector<vector<vector<T>>>(a, vector<vector<T>>(b, vector<T>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

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

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string S;
  cin >> S;
  if (S.size() % 2 == 1) {
    cout << "No" << endl;
    return 0;
  }
  bool ok = true;
  REP(i, S.size() / 2) {
    if (S[i * 2] != 'h' || S[i * 2 + 1] != 'i') {
      ok = false;
    }
  }
  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;

using namespace std;
int main(){
	int a, b, c, d;
	int cnt = 0;
	cin >> a >> b >> c >> d;
	while(a >= 1 && c >= 1){
		if(cnt % 2 == 1)a -= d;
		if(cnt % 2 == 0)c -= b;
		cnt++;
	}

	if (a >= 1) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>

#define isMonth(x) ( 1 <= x && x <= 12 )

int main(int argc, char const *argv[])
{
	int num, t, b;

	scanf("%d", &num);
	t = num / 100;
	b = num % 100;

	if( isMonth(t) )
	{
		if( isMonth(b) )
			puts("AMBIGUOUS");
		else
			puts("MMYY");
	}
	else
	{
		if( isMonth(b) )
			puts("YYMM");
		else
			puts("NA");
	}

	return 0;
}

Measured memory_bytes: 128
using System;

namespace b
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            var d = 0.0;
            for(var i = 0; i < n; i++){
                var s = Console.ReadLine().Split();
                if(s[1].Equals("JPY")){
                    d += double.Parse(s[0]);
                }else{
                    d += (double.Parse(s[0]) * 380000);
                }
            }

            Console.WriteLine(string.Format("{0:F10}",d));
        }
    }
}


Measured memory_bytes: 13140
from sys import stdin, stdout
import math

def primeFactors(n): 
    ans = []
    # Print the number of two's that divide n 
    while n % 2 == 0: 
        ans.append(2) 
        n = n / 2
          
    # n must be odd at this point 
    # so a skip of 2 ( i = i + 2) can be used 
    for i in range(3,int(math.sqrt(n))+1,2): 
          
        # while i divides n , print i ad divide n 
        while n % i== 0: 
            ans.append(i)
            n = n / i 
              
    # Condition if n is a prime 
    # number greater than 2 
    if n > 2: 
        ans.append(int(n))

    return ans 

n = int(stdin.readline())

from collections import Counter

c = Counter(primeFactors(n))
# print(c)

ans = 0
t = list(c.keys())

for key in t:
    i = 1
    while c[key]!=0:
        if c[key]>=i:
            c[key] -= i
            ans += 1
            i += 1

        else:
            if c[key]%2 == 1:
                c[key] -= 1
            
            if c[key] == 0:
                del c[key]
            break

print(ans)
# if len(c) == 0:
#     print(ans)
# else:
#     print(ans)
#     print(c)

#     t = list(c.keys())

#     processed = set()
#     for k1 in t:
#         for k2 in t:
#             if k1!=k2:
#                 if (k1, k2) not in processed and (k2, k1) not in processed:
#                     if c[k1] >= 2 and c[k2] >= 2:
                        
#                         i = 2
#                         while c[k1]>1 and c[k2]>1:
#                             if c[k1] - i >= 0 and c[k2] - i >= 0:
#                                 ans += 1
#                                 c[k1] -= i
#                                 c[k2] -= i
#                                 i += 2

#                             else:
#                                 processed.add((k1, k2))
#                                 break
#     print(ans)
            






Measured memory_bytes: 68356
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	vector<Int> a(N);
	Int sum = 0;
	for (Int i = 0; i < N; i++) {
		cin >> a[i];
		sum += a[i];
	}

	vector<Int> diff(N);
	for (Int i = 0; i < N; i++) {
		diff[i] = abs(a[i] * N - sum);
	}

	Int mn = *min_element(diff.begin(), diff.end());
	for (Int i = 0; i < N; i++) {
		if (diff[i]==mn) {
			cout << i << "\n";
			return 0;
		}
	}



}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define read(type) readInt<type>() // Fast read
#define ll long long
#define nL "\n"
#define pb push_back
#define mk make_pair
#define pii pair<int, int>
// #define a first
// #define b second
#define vi vector<int>
#define all(x) (x).begin(), (x).end()
#define umap unordered_map
#define uset unordered_set
#define MOD 1000000007
#define imax INT_MAX
#define imin INT_MIN
#define exp 1e9
#define sz(x) (int((x).size()))

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int ac = 0, tle = 0, wa = 0,re = 0;
    int t; cin >> t;
    while(t--) {
        string s;
        cin >> s;
        if(s == "AC") {
            ac++;
        }if (s == "TLE")
        {
            /* code */
            tle++;
        }
        if(s == "RE") {
            re++;
        }
        if(s == "WA") {
            wa ++;
        }
        
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " <<wa << endl;
    cout << "TLE x " <<tle << endl;
    cout << "RE x " << re << endl;
    return 0;
}


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

int main()
{
ll n ;
cin >> n ;
vector<ll> a(n);
ll su=0;
rep(i, n){
  cin >> a[i];
  su^=a[i];
}
rep(i,60){
  if(su>>i & 1LL){
    ans+=1LL<<i;
  }
}
rep(i,n){
  a[i]=(a[i]|ans)^ans;
}
ll syu=0;
for (ll i = 59; i >= 0; i--)
{
  for(ll j = syu; j < n; j++){
  if(a[j]>>i & 1LL){
    rep(k,n){
      if(j==k)continue;
      if(a[k]>>i & 1LL)a[k]^=a[j];
    }
    swap(a[syu],a[j]);
    syu++;
    break;
  }
  }
}
ll te=0;
rep(i,syu){
  te^=a[i];
}
ans+=te*2;
cout << ans << endl;
return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
using namespace std;
char c[333][333],a[333],b[333];
int height,width;
int dp[333][333],cst[333][333];
int d(int la,int lb){
	if(la==0 || lb==0)return 0;
	int&res=dp[la][lb];
	if(res!=-1)return res;
	return res = min(d(la-1,lb),d(la,lb-1))+cst[la][lb];
}
int main(){
	scanf("%d%d",&height,&width);
	for(int i=0; i<height; i++)
		scanf("%s",c[i]);
	long long int res=0;
	for(int i=0; i+1<width; i++){
		for(int j=1; j<=height; j++){
			a[j] = c[j-1][i];
			b[j] = c[j-1][i+1];
		}
		memset(dp,-1,sizeof(dp));
		for(int j=1; j<=height; j++)
			for(int k=1; k<=height; k++)
				cst[j][k] = a[j] == b[k]?1:0;
		for(int j=1; j<=height; j++)
			for(int k=1; k<=height; k++)
				cst[j][k] += cst[j-1][k-1];
		res += d(height,height);
	}
	cout<<res<<endl;
	return 0;
}


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

typedef struct{
  char suit,value;
}Card;

void Bubble(Card A[],int N){
  int i,j;
  Card f;
  for(i=0;i<=N-1;i++){
    for(j=N-1;j>i;j--){
      if(A[j].value<A[j-1].value){
          f = A[j];
          A[j]=A[j-1];
          A[j-1]=f;
        }
      }
    }
  }

void Selection(Card A[], int N){
  int i,j,minj,a,b;
  Card t;
  for(i=0;i<N;i++){
      minj=i;
      for(j=i;j<N;j++){
        if(A[j].value<A[minj].value){
          minj=j;
        }
      }
      t =A[i];A[i] = A[minj];A[minj]=t;
    }
  }

int isStable(Card C1[],Card C2[],int N){
  int i;
  for(i=0;i<N;i++){
    if(C1[i].suit!=C2[i].suit)return 0;
  }
  return 1;
}

int main(){
  int i,j,N;
  Card C1[100],C2[100];
  char as,s[3];
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%s",s);
    C1[i].suit=s[0];
    C1[i].value=s[1];
  }
  for(i=0;i<N;i++)C2[i]=C1[i];
  Bubble(C1,N);
  Selection(C2,N);
  for(i=0;i<N-1;i++){
    s[0]=C1[i].suit;
    s[1]=C1[i].value;
    printf("%s ",s);
  }
  s[0]=C1[i].suit;
  s[1]=C1[i].value;
  printf("%s\n",s);
  printf("Stable\n");
  for(i=0;i<N-1;i++){
    s[0]=C2[i].suit;
    s[1]=C2[i].value;
    printf("%s ",s);
  }
  s[0]=C2[i].suit;
  s[1]=C2[i].value;
  printf("%s\n",s);
  if(isStable(C1,C2,N)){
    printf("Stable\n");
  }
  else{
    printf("Not stable\n");
  }
  return 0;
}



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

int main(){
  int n;
  long long int a[100];
  cin>>n;
  a[0]=2;
  a[1]=1;
  for(int i=2;i<=n;i++) a[i]=a[i-1]+a[i-2];
  cout<<a[n];

}


Measured memory_bytes: 256
W, H, x, y = map(int, input().split())

# 面積の大きくない方の最大値
area_max = (W * H) / 2

# x, yが長方形の中心なら分割の方法が複数ある
divide = 1 if (x == W/2 and y == H/2) else 0

print(area_max, divide)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,m;
cin >> n >>m;
vector<int> h(n);

for(int i = 0;i < n;i++){
	cin >> h[i];
}

vector<int> a(m);
vector<int> b(m);

for(int i = 0;i < m;i++){
cin >> a[i] >> b[i];

}

vector<int> ans(n);
for(int i = 0;i < n;i++){
	ans[i] = 0;
}



for(int i = 0;i < m;i++){
if(h[a[i]-1] < h[b[i]-1])ans[a[i]-1] = 1;
else if(h[a[i]-1] > h[b[i]-1])ans[b[i]-1] = 1;
else {
	ans[a[i]-1] = 1;
	ans[b[i]-1] = 1;

}
}

int cnt = 0;
for(int i = 0;i < n;i++){
	if(ans[i] == 0){
		cnt++;
		//cout << i;
	}
}

cout << cnt <<endl;

}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

/**
 * For DEBUG
 * https://github.com/ta7uw/cpp-pyprint
 */
#include "cpp-pyprint/pyprint.h"

#endif

class RollingHash {
    static const ll base1 = 1009;
    static const ll base2 = 2009;
    static const ll mod1 = 1000000007;
    static const ll mod2 = 1000000009;
    vector<ll> hash1, hash2, pow1, pow2;

public:
    RollingHash(const string &S) {
        int n = (int) S.size();
        hash1.assign(n + 1, 0);
        hash2.assign(n + 1, 0);
        pow1.assign(n + 1, 1);
        pow2.assign(n + 1, 1);
        for (int i = 0; i < n; ++i) {
            hash1[i + 1] = (hash1[i] * base1 + S[i]) % mod1;
            hash2[i + 1] = (hash2[i] * base2 + S[i]) % mod2;
            pow1[i + 1] = (pow1[i] * base1) % mod1;
            pow2[i + 1] = (pow2[i] * base2) % mod2;
        }
    }

    /**
     * S の [l, r) のハッシュ値を返す
     * O(1)
     */
    inline pair<ll, ll> get(int l, int r) const {
        ll res1 = hash1[r] - hash1[l] * pow1[r - l] % mod1;
        if (res1 < 0) res1 += mod1;
        ll res2 = hash2[r] - hash2[l] * pow2[r - l] % mod2;
        if (res2 < 0) res2 += mod2;
        return make_pair(res1, res2);
    }

    /**
     * S のハッシュ値を返す
     * O(1)
     */
    inline pair<ll, ll> hash() const {
        return get(0, (int) hash1.size() - 1);
    }

    /**
     * LCP (Longest Common Prefix)
     * O( log N )
     */
    inline int getLCP(int a, int b) const {
        int len = min((int) hash1.size() - a, (int) hash1.size() - b);
        int low = 0, high = len;
        while (high - low > 1) {
            int mid = (low + high) >> 1;
            if (get(a, a + mid) != get(b, b + mid)) high = mid;
            else low = mid;
        }
        return low;
    }

    /**
     * hash h1 と 長さ h2_len の文字列の hash h2 を結合
     */
    pair<ll, ll> concat(pair<ll, ll> h1, pair<ll, ll> h2, int h2_len) {
        return make_pair((h1.first * pow1[h2_len] + h2.first) % mod1, (h1.second * pow2[h2_len] + h2.second) % mod2);
    }
};

void solve() {
    ll N;
    cin >> N;
    string S;
    cin >> S;
    ll ans = 0;
    RollingHash rh(S);
    rep(i, N) {
        rep2(j, i + 1, N) {
            ll lcp = rh.getLCP(i, j);
            ll len = min(j - i, lcp);
            ans = max(ans, len);
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include<vector>
#include <queue>
#include "math.h"
#include <string>
using namespace std;
long aa[2] = { 0,0 };  int c = 0;
int main()
{
	priority_queue<int> p;
	int n, a;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a;
		p.push(a);
	}

	int pa = 0; int q = 0;
	pa = p.top();
	p.pop();
	int i = 1;
	while (c < 2&&i<n) {
		
		q= p.top();
		if (pa == q) { 
			 aa[c]=pa;
			 c++;
			pa = -1;
			p.pop();
			i++;
		}
		else {
			p.pop();
			pa = q;
			i++;
		}
	}
	cout << aa[0] * aa[1] << endl;
}

Measured memory_bytes: 892
#include <algorithm>
#include <bitset>
//#include <boost/multiprecision/cpp_int.hpp>
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <sstream>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
// namespace mp = boost::multiprecision;
using namespace std;
using ull = unsigned long long;
using ld = long double;
// using ll = boost::multiprecision::cpp_int;
using ll = long long;
#define FOR(i, N) for(ll i = 0; i < N; ++i)

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
// using int = ll;
ll gcd(ll m, ll n) {
    if(n == 0)
        return abs(m);
    return (gcd(n, m % n));
}
void putYN(bool b) {
    if(b) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}
void swap(ll &a, ll &b) {
    ll tmp = a;
    a = b;
    b = tmp;
}
ll combi(ll n, ll k) {
    ll r = 1, rr = 1;
    for(ll i = 0; i < k; ++i) {
        r *= (n - i);
        rr *= (i + 1);
        // r %= 1000000007;
        // rr %= 1000000007;
    }
    r /= rr;
    // r %= 1000000007;
    return r;
}
int main() {
  ll N;
  cin>>N;
  vector<ll> A(N),B(N),C(N);
  FOR(i,N){
    cin>>A[i];
  }
  FOR(i,N){
    cin>>B[i];
  }
  FOR(i,N){
    cin>>C[i];
  }
  ll sum = 0;
  
  FOR(i,N){
    sum+=B[i];
  }
  
  FOR(i,N-1){
    if(A[i]+1==A[i+1]){
      sum += C[A[i]-1];
    }
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <string.h>
#include <string>
#include <vector>
#include <limits.h>
#include <stack>
#include <queue>
#include <cstdlib>
#define maxn 10000000
#define pi acos(-1)
#define ll long long
using namespace std;
#define MAX 100007

int n,k;
ll T[MAX];
int check(ll p)
{
	int i=0;
	for(int j=0;j<k;j++)
	{
		ll s=0;
		while (s+T[i]<=p) {
			s+=T[i];
			i++;
			if(i==n)return n;
		}
	}
	return i;
}
ll solve()
{
	ll l=0;
	ll r=100000*10000;
	ll mid;
	while(r-l>1)
	{
		mid=(l+r)/2;
		int v=check(mid);
		if(v>=n)r=mid;
		else l=mid;
	}
	return r;
}
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++)cin>>T[i];
	ll ans=solve();
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3896
#include <iostream>
#include <string>
#include <cstdio>

using namespace std;

int main() {
    string T, P;
    int Tlen, Plen;

    cin >> T >> P;
    Tlen = T.size();
    Plen = P.size();

    for (int i = 0; i <= Tlen - Plen; i++) {
        if (T[i] == P[0]) {
            if (P == T.substr(i, Plen)) {
                printf("%d", i);
                puts("");
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 2052
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int a,b,t;
  cin>>a>>b>>t;
  
  cout<<b*(t/a)<<endl;

  return 0;
}


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

using namespace std;

void test_case() {
  int n, x, t;
  cin >> n >> x >> t;

  cout << t * ceil(1.0 * n / x) << endl;
}

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

  cout << setprecision(20);
  
  int t = 1;
  // cin >> t;
  while (t--) {
    test_case();
  }

  return 0;
}


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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define FORE(i, a, b) for(int i=(a);i<=(b);++i)
#define FORR(i, a, b) for(int i=(b-1);i>=(a);--i)
#define FORRE(i, a, b) for(int i=(b);i>=(a);--i)
#define rep(i, n) for(int i=0;i<(n);++i)
#define repe(i, n) for(int i=0;i<=(n);++i)
#define repr(i, n) for(int i=(n-1);i>=0;--i)
#define repre(i, n) for(int i=(n);i>=0;--i)
#define ALL(v) (v).begin(),(v).end()
#define SP cout<<fixed<<setprecision(10)
typedef pair<int, int> P;
const int INF = (int) 1e9;
const int MOD = (int) 1e9 + 7;

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	ll r,d,x;
	cin>>r>>d>>x;
	
	rep(i,10){
		x = r*x-d;
		cout<<x<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
n = int(input())
v = list(map(int,input().split()))
#print(v)
v.sort()
#print(v)
#print(n,v)
cnt = v[0]
cntMax = 0 
for i in range(n-1):
  cnt = (cnt+v[i+1])/2
  cntMax = max(cnt,cntMax)
print(cntMax)

Measured memory_bytes: 3060
import sys
import collections

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    S = input().strip()

    if S == S[::-1]:
        print(0)
        return

    S2 = [s for s in S if s != 'x']

    if S2 == S2[::-1]:
        ans = 0
        l = 0
        r = len(S) - 1
        while l < r:
            if S[l] == S[r]:
                l += 1
                r -= 1
                continue
            else:
                if S[l] == 'x':
                    ans += 1
                    l += 1
                else:
                    ans += 1
                    r -= 1
        print(ans)
    else:
        print(-1)

    

if __name__ == '__main__':
    main()



Measured memory_bytes: 5108
N = gets.chomp.to_i
# l, r = gets.chomp.split.map(&:to_i)

ans = 0
l = []
r = [] # 空配列を渡しておかないとだめ

N.times do |i|
  l[i], r[i] = gets.chomp.split.map(&:to_i)
  ans += r[i] - l[i] + 1
end

puts ans

Measured memory_bytes: 1788
#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
#define m 1000000007
#define MAXN 1000001
#define satya ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define cil(a,b) (((a-1)/b)+1)
//#define init int t;cin>>t;while(t--)
#define in(a) ll a;scanf("%lld",&a)
#define ine(a,b) ll a,b;scanf("%lld lld",&a,&b)



ll spf[MAXN]; 

void sieve1() 
{ 
	spf[1] = 1; 
	for (int i=2; i<MAXN; i++) 

		spf[i] = i; 

	for (int i=4; i<MAXN; i+=2) 
		spf[i] = 2; 

	for (int i=3; i*i<MAXN; i++) 
	{ 
		if (spf[i] == i) 
		{ 
			for (int j=i*i; j<MAXN; j+=i) 

				if (spf[j]==j) 
					spf[j] = i; 
		} 
	} 
} 

ll  getFactorization(int x) 
{ 
	vector<int> ret; 
	long long int p=0;
	while (x != 1) 
	{ 
		ret.push_back(spf[x]); 
		x = x / spf[x]; 
	} 
	sort(ret.begin(),ret.end());
	for(int i=0;i<ret.size()-1;i++) 
	{
	    if(ret[i]!=ret[i+1])
	    p=p+ret[i];
	}
	p=p+ret[ret.size()-1];
	return p;
} 

ll d[1000055],u=0;
void Sieve(int n) 
{ 
	bool prime[n+1]; 
//	ll u=0;
	memset(prime, true, sizeof(prime)); 

	for (int p=2; p*p<=n; p++) 
	{ 
		if (prime[p] == true) 
		{ 
			for (int i=p*2; i<=n; i += p) 
				prime[i] = false; 
		} 
	} 

	for (int p=2; p<=n; p++) 
	if (prime[p]) 
	{
	    d[u]=p;
	    u++;
	}
} 

ll minverse(ll x,ll n,ll M)
{
    if(n==0)
        return 1;
    else if(n%2 == 0)        //n is even
        return minverse((x*x)%M,n/2,M);
    else                             //n is odd
        return (x*minverse((x*x)%M,(n-1)/2,M))%M;

}
ll prime(ll n){
    ll i;
    if(n==1||n==0)
    return 0;
    for(i=2;i<sqrt(n);i++)
    {
        if(n%i==0)
        return 0;
    }
    return 1;
}
int main() {
       satya;
     //sieve1(); 
     //Sieve(100);
     ll n;
     cin>>n;
     string s;
     cin>>s;
     if(n>=3200)
     cout<<s<<endl;
     else
     cout<<"red"<<endl;
    	   
    return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize ("O3")
//#pragma GCC target ("sse4")

#include <bits/stdc++.h>

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "


// CHECK THE LIMITS
typedef long long ll;

const int MOD = 1000000007;
const ll INFLL = 1e18;
const int INF = 1e9;
const int NMAX = 1000001;

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
} 

int a[5][5];
bool f[105];

int line[4];
int col[4];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
	for(int i =0; i< 3; ++i)
	{
		for(int j = 0; j < 3; ++j)
		{
			cin >> a[i][j];
		}
	}

	int n;
	cin >> n;
	for(int i=0; i< n; ++i)
	{
		int x;
		cin >> x;
		f[x] = true;
	}

	for(int i = 0; i< 3; ++i)
	{
		for(int j = 0; j < 3; ++j)
		{
			if(f[a[i][j]])
			{
				line[i]++;
				col[j]++;
			}
		}
	}
	for(int i = 0; i< 3; ++i)
	{
		if(line[i] == 3 || col[i] == 3)
		{
			cout << "Yes";
			return 0;
		}
	}

	int ct1=0,ct2=0;
	for(int i =0; i< 3; ++i)
	{
		if(f[a[i][i]])
			ct1++;
		if(f[a[i][3-i-1]])
			ct2++;
	}

	if(ct1 == 3|| ct2 == 3)
	{
		cout << "Yes";
		return 0;
	}


	cout << "No";

    return 0;
}

Measured memory_bytes: 256
f=lambda:map(int,input().split())
n,m=f()
l=list(f())
t=[1]*n
for _ in range(m):
  a,b=f()
  if l[a-1]<=l[b-1]: t[a-1]=0
  if l[b-1]<=l[a-1]: t[b-1]=0
print(sum(t))

Measured memory_bytes: 20108
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
// #define int ll
using namespace std;
const int INF (1 << 30);
const ll LLINF (1LL << 55LL);
const int MOD = 1000000007;
const int MAX = 510000;
const double pi=3.14159265358979;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n,m,c[100],dp[50010];
    cin>>n>>m;
    rep(i,m){
        cin>>c[i];
    }
    sort(c,c+m);
    rep(i,50010) dp[i]=LLINF;
    dp[0]=0;
    rep(i,n){
        rep(j,m){
            if(i+c[j]>n) break;
            dp[i+c[j]]=min(dp[i]+1,dp[i+c[j]]);
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}


Measured memory_bytes: 3564
#include <stdio.h>
#include <stdbool.h>

void leapyear (int year1, int year2)
{
    int i;
    int j = 0; 
    for (i = year1; i <= year2; ++i) {
        if (i % 4 == 0) {
            if (i % 100 != 0) {
                printf("%d\n", i);
                ++j;
            } else if (i % 400 == 0) {
                printf("%d\n", i);
                ++j;
            } 
        }
    }
    if (j == 0) {
        printf("NA\n");
    }
}

int main(void)
{
    int k = 0;
    while (true) {
        int year1, year2;
        scanf("%d %d", &year1, &year2);
        if (year1 == 0 && year2 == 0) {
            break;
        }
        if (k != 0) {
            printf("\n");
        }
        leapyear(year1, year2);
        ++k;
    }
    return 0;
}

Measured memory_bytes: 1044
import sys
from fractions import gcd
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def LS(): return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]

def main():
    n = II()
    ps = LI()
    ans = 0
    for i in range(n-2):
        sr = sorted(ps[i:i+3])
        if sr[1] == ps[i+1]:
            ans += 1
    print(ans)




if __name__ == "__main__":
    main()

Measured memory_bytes: 5588
#include <iostream>
#include <string>

int main() {
    std::string s, p;
    std::cin >> s;
    std::cin >> p;

    if ((s + s).find(p) != std::string::npos) {
        std::cout << "Yes" << std::endl;
    } else {
        std::cout << "No" << std::endl;
    }
}



Measured memory_bytes: 3232
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	int a, b, x;
	cin >> a >> b >> x;

	if (a <= x && x <= a + b)

		cout << "YES" << endl;

	else
		cout << "NO" << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:16777216")
#pragma warning( disable : 6031)
#include <climits>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <limits>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-9)
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< ll > vll;
typedef vector< vll > vvll;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef vector< pii > vpii;
typedef tuple<int, int, int> tiii;
const long long mod = 1000000007;

template<typename T>
void max_self(T& a, T b)
{
	a = max(a, b);
}
template<typename T>
void add_self(T& a, T b)
{
	a += b;
	if (a >= mod)
		a -= mod;
}
template<typename T>
void sub_self(T& a, T b)
{
	a -= b;
	if (a < 0)
		a += mod;
}

// dp[i][j] - number of ways to distribute i candies to j kids

int main()
{ 
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
	int n;
	cin >> n;
	vll a(n);
	for (auto& i : a)
		cin >> i;
	ll sr = accumulate(all(a), 0LL);
	ll sl = 0;
	ll mr = LLONG_MAX;
	for (int i = 0; i < sz(a) - 1; i++)
	{
		sr -= a[i];
		sl += a[i];
		mr = min(mr, abs(sr - sl));
	}
	cout << mr;
	return 0;
}

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

int main(){
    int N, M, min, temp, cnt;
    cin >> N >> M;
    min = 1000;
    cnt = 0;
    for(int i = 0; i < N; i++){
        cin >> temp;
        if(min > temp){
            min = temp;
        }
        M -= temp;
        cnt++;
    }
    while(M >= min){
        M -= min;
        cnt++;
    }

    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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; }

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

int main(){
  int n; cin >> n;
  vi a(n);
  rep(i, n) cin >> a[i];
  deque<int> d;
  rep(i,n) {
    int k = lower_bound(all(d),a[i]) - d.begin();
    if(k == 0) d.push_front(a[i]);
    else d[k-1] = a[i];
  }
  cout << d.size() << endl;
}


Measured memory_bytes: 1024
N=input()
i=int(len(N))
N=int(N)
#print(N,i)
x=0
if i%2!=0:
    x=N-10**(i-1)+1
    i=i-1
    if i!=0:
        while i>0:
            i=i-2
            x=x+9*(10**i)
else:
    if N<10:
        x=N
    else:
        while i>1:
            x=x+9*(10**(i-2))
            #print(i)
            i=i-2

print(x)


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> Fi(N);
  for ( int i = 0; i < N; ++i){
    cin >> Fi.at(i);
  }
  int bckt[200000] = {0};
  for ( int i = 0; i < N ;++i){
    bckt[Fi.at(i)]++;
  }
  
  sort(bckt, bckt+200000);
  reverse(bckt, bckt+200000);
  
  int count = 0;
  for ( int i = 0; i < N; ++i){
    if ( i < K  )continue;
    else count += bckt[i];    
  }
  cout << count << endl; 
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int N=207;

int n, m, k, u, v, x, y, t, a, b, ans, mod;
int F[N];
int dp[2][N][N][N];
int val[N][N][N];

inline void fix(int &x){
	if (x>=mod) x-=mod;
//	if (x<0) x+=mod;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	for (int j=0; j<N; j++) for (int k1=max(j-1, 0); k1<N; k1++) for (int k2=0; k2<N; k2++) dp[0][j][k1][k2]=1;
	cin>>n>>k>>mod;
	
	for (int i=1; i<N; i++){
		int cur=(i&1);
		for (int j=0; i+j<N; j++) for (int k1=0; k1<i+j; k1++) for (int k2=0; k2<i+j; k2++) dp[cur][j][k1][k2]=0;
		for (int k1=0; k1<i; k1++) dp[cur][0][k1][i-1]=1;
		for (int j=1; i+j<N; j++){
			for (int k1=j-1; k1<i+j; k1++) for (int k2=i-1; k2<i+j; k2++){
				if (k2) dp[cur][j][k1][k2]+=dp[cur][j-1][min(k1, i+j-2)][k2-1];
				if (k1) dp[cur][j][k1][k2]+=dp[cur^1][j][k1-1][min(k2, i+j-2)];
				fix(dp[cur][j][k1][k2]);
			}
		}
		for (int j=1; i+j<N; j++) for (int k=max(1, j-1); k<i+j; k++) for (int x=1; x<=min(j-1, k-i+1); x++){
			fix(val[j][i][k]+=dp[cur^1][j-x][min(k-1, i+j-x-2)][min(k-x, i+j-x-2)]);
		}
	}
	F[0]=1;
	for (int i=1; i<N; i++) F[i]=F[i-1]*i%mod;
	
	if (k==n-1){
		ans=1;
		for (int i=1; i<=n; i++) ans=1ll*ans*i%mod;
	}
	
	for (int t=0; t<=min(k, n-3); t++){
		for (int X=1; X<n-t; X++){
			int Y=n-X-t-1;
			ll tmp=1;
			for (int i=1; i<=n; i++) if (i!=n-t) tmp=tmp*i%mod;
			tmp=tmp*val[X+1][Y][min(k-t, X+Y)]%mod;
			ans=(ans+tmp)%mod;
		}
	}
	if (ans<0) ans+=mod;
	cout<<ans<<"\n";
	
	return 0;
}

Measured memory_bytes: 90068
// first second push_back unordered return continue break vector visited check flag bool while iterator begin end lower_bound upper_bound temp true false ll_MAX ll_MIN insert erase clear pop push compare ll64_MAX ll64_MIN  reverse replace stringstream string::npos length substr front
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
const ll mod = 1e9 + 7 ;
const ll inf =
 1e9 + 5 ;
 //1e18L + 5;
const ll nax = pow(2,22)+1;
void min_self(ll&a , ll b){a=min(a,b);}
void max_self(ll&a , ll b){a=max(a,b);}
void add_self(ll&a , ll b){a=(a+b)%mod;}
ll allmask  , n ;
//#define (x)  get<0>(x) 
//#define (x)  get<1>(x)
//#define (x)  get<2>(x)
vector<vector<ll>>dp(22 , vector<ll>(nax,-1));
ll countWays(vector<vector<ll>>& arr , ll man , ll state){

	if(dp[man][state]!=-1)return 
		dp[man][state];

	if(state == allmask)return 1;
	if(man>n)return  0 ;


	ll ans = 0 ;

	for(ll i = 0; i< n; i++){

		if(arr[man][i]==0)continue ; 
		ll x = (1<<i);
		if(x&state)continue;

		ll newstate = x|state ; 

		add_self(ans ,countWays( arr , man + 1 , newstate));

	}

	// add_self(ans , man+1)

	return dp[man][state] = ans ;



}


signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>> n ;
vector<vector<ll>>arr(n,vector<ll>(n));
for(auto &i:arr)for(auto &j:i)cin>>j;

allmask =(1<<n)-1;

cout<<countWays(arr , 0 , 0 );


	
}

Measured memory_bytes: 754048
#define K scanf("%d",
#define I(x)for(x=N;--x;)
#define L(a,b,c)I(i)I(j)if(k[i][j])b=b>a?b:a,c=a<c?a:c;b-=c-1;
N=404;main(c,i,j,l,e,f,g,h,n,d){int k[N][N],m[N],o[N];for(;c;){I(i)I(j)l=k[i][j]=m[j]=o[j]=0;e=g=m[0]=o[0]=(f=h=N)/2;K&c);if(k[e][e]=c){for(;--c;K&d),d/2?i=3-d,j=2-d:(i=d-1,j=d),d=m[n]+i,n=o[n]+j,k[d][n]=m[++l]=d,o[l]=n)K&n);L(i,e,f)L(j,g,h)c=printf("%d %d\n",e,g);}}}

Measured memory_bytes: 0
#include <iostream>
#include <string>

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

  for (size_t i = 1; i < s.length(); ++i) {
    if (s.c_str()[i - 0] == s.c_str()[i - 1]) {
      std::cout << "Bad" << std::endl;
      return 0;
    }
  }
  std::cout << "Good" << std::endl;
  return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>	//Frog 2
using namespace std;
const int N = 100010;
const int M = 110;
const int INF = 1e9 + 7;
int dp[N][M],v[N];

int main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	for(int i=0;i<N;++i)
		for(int j=0;j<M;++j)
			dp[i][j] = INF;

	int n,k;
	cin>>n>>k;

	for(int i=1;i<=n;++i) cin>>v[i];

	dp[1][0] = 0;

	for(int i=1;i<=n;++i)
		for(int j=1;j<=k;++j)
		{
			dp[i][j] = min(dp[i][j],dp[i][j-1]);
			int id = i - j;
			if(id < 0) continue;

			int x = abs(v[id] - v[i]);
			dp[i][j] = min(dp[i][j],dp[id][k] + x);
		}

	cout<<dp[n][k]<<"\n";
}

Measured memory_bytes: 46952