akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <limits>
#include <climits>
#include <utility>
#include <algorithm>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

static const ll MOD = 1000000007;

bool is_amida(int x, int W)
{
    for (int i = 0; i < W-1; ++i) {
        if ((x & (1 << i)) && (x & (1 << (i+1)))) {
            return false;
        }
    }

    return true;
}

int main()
{
    int H, W, K;
    cin >> H >> W >> K;
    --K;

    if (W == 1) {
        cout << 1 << endl;
        return 0;
    }

    vector<ll> t(W-1);

    for (int i = 0; i < W-1; ++i) {
        for (int j = 0; j < (1 << (W-1)); ++j) {
            if ((j & (1 << i)) == 0) {
                continue;
            }

            if (!is_amida(j, W)) {
                continue;
            }

            ++t[i];
        }
    }

    ll all = 0;
    for (int j = 0; j < (1 << (W-1)); ++j) {
        if (is_amida(j, W)) {
            ++all;
        }
    }

    vector<vector<ll>> dp(H+1, vector<ll>(W, 0));
    dp[0][0] = 1;

    for (int i = 1; i < H+1; ++i) {
        for (int j = 0; j < W; ++j) {
            if (j == 0) {
                dp[i][j] += dp[i-1][j] * (all - t[j]);
                dp[i][j] %= MOD;
                dp[i][j] += dp[i-1][j+1] * t[j];
                dp[i][j] %= MOD;
            } else if (j == W-1) {
                dp[i][j] += dp[i-1][j-1] * t[j-1];
                dp[i][j] %= MOD;
                dp[i][j] += dp[i-1][j] * (all - t[j-1]);
                dp[i][j] %= MOD;
            } else {
                dp[i][j] += dp[i-1][j-1] * t[j-1];
                dp[i][j] %= MOD;
                dp[i][j] += dp[i-1][j] * (all - t[j] - t[j-1]);
                dp[i][j] %= MOD;
                dp[i][j] += dp[i-1][j+1] * t[j];
                dp[i][j] %= MOD;
            }
        }
    }

    cout << dp[H][K] << endl;

    return 0;
}


Measured memory_bytes: 3148
def solve():
    H, W = map(int, input().split())
    if H*W%3==0:
        return 0
    if H%2==0 and W%2==0:
        return min(H//2,W//2)
    if H%2==0:
        return min([H//2,H//3*2+W//2+1-min(H//3,W//2),W])
    if W%2==0:
        return min([W//2,W//3*2+H//2+1-min(W//3,H//2),H])
    return min([H//3*2+W//2+1-min(H//3,W//2),W//3*2+H//2+1-min(W//3,H//2),H,W])
print(solve())

Measured memory_bytes: 38392
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

void solve(){
  ll x,a;
  cin >> x >> a;
  cout << (x<a?0:10) << endl;
}

int main(){
   cin.tie(nullptr);
  ios::sync_with_stdio(false);
  solve();
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = (1e+9)+7;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
bool eq(ld x, ld y) {
	if (abs(x - y) < eps)return true;
	else return false;
}
int main() {
	cout << fixed << setprecision(10);
	int n; cin >> n;
	LDP p[100];
	ld a, b;
	rep(i, n) {
		cin >> a >> b;
		p[i] = { a,b };
	}
	rep(i, n) {
		ld le, ri;
		bool f = true; bool g = false;
		rep(j, n) {
			if (i == j)continue;
			ld dx = p[j].first - p[i].first;
			ld dy = p[j].second - p[i].second;
			ld chk = atan2(dx, -dy);
			if (f) {
				f = false;
				le = chk; ri = chk + pi;
			}
			else {
				bool h = false;
				for (int k = -1; k <= 1; k++) {
					ld nex1 = chk + (ld)k * (ld)2 * pi;
					if (le <= nex1 && nex1 <= ri) {
						h = true; le = nex1; break;
					}
					ld nex2 = chk+pi + (ld)k * (ld)2 * pi;
					if (le <= nex2 && nex2 <= ri) {
						h = true; ri = nex2; break;
					}
					if (nex1 <= le && ri <= nex2)h = true;
				}
				if (!h) {
					g = true; break;
				}
			}
		}
		if (g) {
			cout << 0.0 << endl;
		}
		else {
			cout << (ri - le) / ((ld)2 * pi) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
A = map(int, raw_input().split())

max = 0

for i in range(len(A)):
    if max < (A[i] * 10 + A[(i+1)%len(A)] + A[(i+2)%len(A)]):
        max = A[i] * 10 + A[(i+1)%len(A)] + A[(i+2)%len(A)]
    if max < (A[i] + A[(i+1)%len(A)]*10 + A[(i+2)%len(A)]):
        max = (A[i] + A[(i+1)%len(A)]*10 + A[(i+2)%len(A)])

print max


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

int main() {
    int k; cin >> k;
    vector<set<string> > digit_lunluns;
    int total_count = 0;
    int digit = 0;
    while (total_count < k) {
        set<string> next_lunluns;
        if (total_count == 0) {
            for (int j = 1; j <= 9; j++) {
                next_lunluns.insert(to_string(j));
            }
        } else {
            set<string> prev_lunluns = digit_lunluns[digit - 1];
            for (auto it = prev_lunluns.begin(); it != prev_lunluns.end(); it++) {
                string s = *it;
                next_lunluns.insert(s + s[s.size()-1]);
                if (s[s.size() - 1] == '0') {
                    next_lunluns.insert(s + '1');
                } else if (s[s.size() - 1] == '9') {
                    next_lunluns.insert(s + '8');
                } else {
                    int last_digit = s[s.size() - 1] - '0';
                    char next_digit = '0' + (last_digit - 1);
                    next_lunluns.insert(s + next_digit);
                    next_digit = '0' + (last_digit + 1);
                    next_lunluns.insert(s + next_digit);
                }
            }
        }
        total_count += next_lunluns.size();
        digit++;
        digit_lunluns.push_back(next_lunluns);
    }
    for (int i = 0; i < 12; i++) {
        if (digit_lunluns[i].size() >= k) {
            string s = *next(digit_lunluns[i].begin(), k - 1);
            cout << s << endl;
            break;
        } else {
            k -= digit_lunluns[i].size();
        }
    }
    // string x = *next(lunluns.begin(), k - 1);
    // cout << x << endl;
    return 0;
}


Measured memory_bytes: 27776
#include <stdio.h>

void sort(int x[]);
	
int main(void)
{
	int i;
	int num[10];
	
	for(i=0; i<10; i++){
		scanf("%d", &num[i]);
	}
	
	sort(num);
	/*
	for(i=0; i<10; i++){
		printf("%d\n", num[i]);
	}	
*/
	return 0;
}

void sort(int x[])
{
	int i;
	int temp = 0;
	int flag=0;
/*	
	for(i=0; i<10; i++){
		printf("%d\n", x[i]);
	}	
	printf("\n");
*/	
	do{
		
		flag = 0;
		for(i=0;i<9;i++){
			if(x[i]>x[i+1]){
				temp = x[i+1];
				x[i+1] = x[i];
				x[i] = temp;
				flag = 1;
			}
		}
/*	
		for(i=0; i<10; i++){
			printf("%d\n", x[i]);
		}	
		printf("\n");
*/

	}while(flag==1);

	printf("%d\n", x[9]);
	printf("%d\n", x[8]);
	printf("%d\n", x[7]);

}

Measured memory_bytes: 600
N = int(input())

min = 10000000000
k = -1
flag = False
for i in range(1,6):
    if N / (10 ** i) == 1:
        print(10)
        flag = True
        break

if flag == False:
    sum = 0
    strN = str(N)
    for i in range(len(strN)):
        sum += int(strN[i])
    print(sum)

Measured memory_bytes: 3060
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>

#define REP(i,n) for(i=0; i < (n); i++)
#define REPONE(i, n) for(i=1; i <= (n); i++)
#define LOOP(n) for(int loopCount=1; loopCount <= (n); loopCount++)
#define ITER(c) __typeof((c).begin())
#define EACH(c,it) for(ITER(c) it =(c).begin(); it!=(c).end(); it++)
#define SZ(c) ((int) (c).size())
#define ALL(c) c.begin(), c.end()
#define SUM(c) accumulate(ALL(c), 0)
#define EXIST(c,v) (find(ALL(c), (v)) != (c).end())
#define PB push_back
#define MP make_pair

using namespace std;
static const double EPS = 1e-9;
static const double PI = 3.141592653589793238462643383279;
typedef long long ll;

int main(){
    int i, j, n, m, x;
    while(scanf("%d%d\n",&n,&m)){
        if(!(n||m)) break;
        vector< pair<int,int> > list;
        REP(i,m) list.PB(MP(0,i+1));
        REP(i,n)REP(j,m){
            scanf("%d",&x);
            if(x) list[j].first -= 1;
        }

        sort(ALL(list));
        REP(i,m){
            printf("%d",list[i].second);
            if(i<m-1)printf(" ");
            else printf("\n");
        }
    }

    return 0;
}

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

int main()
{
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;

    if (x >= r && y >= r && w - x >= r && h - y >= r)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 3084
s=input()
L=len(s)
ans=0
import itertools as it
l=[ i for i in it.product(["", "+"], repeat=L-1)]
for ll in l:
    f=""
    for i,j in zip(s,list(ll)+[""]):
       f+=i+j
    ans+=eval(f)

print(ans)

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    static int[] dp;
    static Magic[] magics;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int n = sc.nextInt();
		magics = new Magic[n];
		for (int i = 0; i < n; i++) {
		    magics[i] = new Magic(sc.nextInt(), sc.nextInt());
		}
		dp = new int[h + 1];
		Arrays.fill(dp, -1);
		System.out.println(dfw(h));
	}
	
	static int dfw(int power) {
	    if (power <= 0) {
	        return 0;
	    }
	    if (dp[power] != -1) {
	        return dp[power];
	    }
	    dp[power] = Integer.MAX_VALUE;
	    for (int i = 0; i < magics.length; i++) {
	        dp[power] = Math.min(dp[power], dfw(power - magics[i].power) + magics[i].cost);
	    }
	    return dp[power];
	}
	
	static class Magic {
	    int power;
	    int cost;
	    
	    public Magic (int power, int cost) {
	        this.power = power;
	        this.cost = cost;
	    }
	}
}


Measured memory_bytes: 27616
#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	int d[8]={0,1,2,3,5,7,8,9};
	int n;
	while(cin>>n,n){
		string out="";
		while(n){
			out=(char)(d[n%8]+'0')+out;
			n/=8;
		}
		cout<<out<<endl;
	}
}

Measured memory_bytes: 1200
#include<iostream>
int partition(int*, int, int);
int main(){
  int n,tmp;
  std::cin >> n;
  int A[n];
  for(int i=0; i<n; i++) std::cin >> A[i];
  tmp = partition(A, 0, n-1);
  for(int i=0; i<n; i++){
    if(i == tmp) std::cout << "[" << A[i] << "]";
    else std::cout << A[i];
    std::cout << (i != n-1 ? " " : "\n");
  }
  return 0;
}
int partition(int *A, int p, int r){
  int x=A[r],i,tmp;
  i = p - 1;
  for(int j=p; j<=r-1; j++){
    if(A[j] <= x){
      i++;
      tmp = A[i], A[i] = A[j], A[j] = tmp;
    }
  }
  tmp = A[i+1], A[i+1] = A[r], A[r] = tmp;
  return i+1;
}

Measured memory_bytes: 3404
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int t = scan.nextInt();
		if(t >= 30) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
		
	}

}


Measured memory_bytes: 35744
// https://atcoder.jp/contests/abc157/tasks/abc157_d
// AtCoder Beginner Contest 157
// D - Friend Suggestions

/*
Problem.
Nのそれぞれについて、間接的な友達の中で直接的な友人関係、ブロック関係にない
人(友達候補)の数を答えよ。

Point.
UnionFindで、同一グループ内の人数-1(自分)-友人数-ブロック数
*/

#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<ctime>
#include<queue>
#include<set>

using namespace std;
using ll = long long;

struct UnionFind {
  vector<int> par;//parent
  vector<int>nodes;

  UnionFind(int N): par(N), nodes(N)
  {
    for(int i = 0; i < N; i++){
      par[i] = i;
      nodes[i] = 1;
    }
  }

  int root(int x) {//find the root and path compression
    if(par[x] == x) return x;
    return par[x] = root(par[x]);
  }

  void unite(int x, int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry) return;
    nodes[ry] += nodes[rx];
    par[rx] = ry;
  }

  bool same(int x, int y){
    int rx = root(x);
    int ry = root(y);
    return rx == ry;
  }

};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int ti = clock();
  // start--------------------
  ll n, m, k; cin >> n >> m >> k;
  vector<ll> ans(n, 0);
  UnionFind uf = (n);

  for(int i = 0; i < m ; i++){
    int a, b;
    cin >> a >> b;
    a--, b--;
    if(!uf.same(a, b)) uf.unite(a, b);
    ans[a]--; ans[b]--; //すでに友達
  }
  for(int i = 0; i < k; i++){
    int a, b;
    cin >> a >> b;
    a--, b--;
    if(uf.same(a, b)) ans[a]--, ans[b]--; //すでにブロック
  }

  for(int i = 0; i < n; i++){
    ans[i] += uf.nodes[uf.root(i)]-1; //自分以外の友達候補
  }
  for(int i = 0; i < n; i++) cout << ans[i] << ' ';
  cout << endl;
  // end-----------------------------------------------
  cerr << 1.0 * (clock() - ti) / CLOCKS_PER_SEC << endl;
}


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

int main() {
    int n,m;
    cin >> n >> m ;
    int a[n+1][m+1];
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            cin >> a[i][j];
    int c=0;
    for(int i=0;i<n;i++){
        c=0;
        for(int j=0;j<m;j++){
            c=c+a[i][j];
        }
        a[i][m]=c;
    }
    for(int j=0;j<=m;j++){
        c=0;
        for(int i=0;i<n;i++){
            c=c+a[i][j];
        }
        a[n][j]=c;
    }
    for(int i=0;i<=n;i++){
        for(int j=0;j<=m;j++)
            cout << a[i][j] << (j==m?"":" ");
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3068
#include<cstdio>
#include<iostream>
char a[4];
int cnt, ans;
using namespace std;
int main()
{
	for (int i = 1; i <= 3; i++)
	{
		cin >> a[i];
		if (a[i] == 'o') cnt++;
	}
	ans = 700 + cnt * 100;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
    #include<algorithm>
    #include<cstdio>
    #include<cmath>
    #include<math.h>
    #include<string>
    #include<string.h>
    #include<stack>
    #include<queue>
    #include<vector>
    #include<utility>
    #include<set>
    #include<map>
    #include<stdlib.h>
    #include<iomanip>
     
    using namespace std;
     
    #define ll long long
    #define ld long double
    #define EPS 0.0000000001
    #define INF 1e9
    #define rep(i,n) for(i=0;i<n;i++)
    #define loop(i,a,n) for(i=a;i<n;i++)
    #define all(in) in.begin(),in.end()
    #define shosu(x) fixed<<setprecision(x)
     
    typedef vector<int> vi;
    typedef pair<int,int> pii;
     
    int main(void) {
      int i,j;
      ll a,b,x;
      cin>>a>>b>>x;
      if(x==1){
        cout<<(b-a+1)<<endl;
        return 0;
      }
      ll ans=b/x;
      if(a)
        ans-=(a-1)/x;
else ans++;
      cout<<ans<<endl;
    }

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

int main() {
  int a,b; cin>>a>>b;
  int n=b-a;
  int sum=0;
  rep(i, n) sum+=i;
  cout<<sum-a<<endl;
}


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

int main(){
    int n;
    ll ans=0;
    cin >> n;
    vector<int> v(n);
    for(int i=0;i<n;i++) cin >> v[i];
    for(int i=0;i<n;i++) ans+=v[i]-1;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
def gcd(a,b):
    c=0
    while b:(a,b),c=(b,a%b),c+1
    print(a,c)
  
while 1:
    m,n=map(int,input().split())
    if m==0:break
    gcd(m,n) if m>n else gcd(n,m)


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

using namespace std;

#define LL long long
#define DD double
#define Pb push_back
#define Bp pop_back
#define Pf push_front
#define Fp pop_front
#define Ub upper_bound
#define Lb lower_bound
#define In insert
#define All(x) x.begin(), x.end()
#define mem(a, b) memset(a, b, sizeof(a))
#define fast ios_base::sync_with_stdio(0);cin.tie(0)
#define X first
#define Y second
#define mx1 10
#define mx2 110
#define mx3 1010
#define mx4 10010
#define mx5 100010
#define mx6 1000010

typedef vector<LL> Vl;
typedef vector<DD> Vd;
typedef vector<bool> Vb;
typedef vector<Vl> VVl;
typedef pair<LL, LL> Pll;
typedef pair<DD, DD> Pdd;
typedef vector<Pll> Vpl;
typedef vector<Pdd> Vpd;
typedef queue<LL> Ql;
typedef stack<LL> Sl;
typedef deque<LL> Dl;

LL _set(LL N, LL pos) {return N = N | (1 << pos);}
LL _reset(LL N, LL pos) {return N = N & ~(1 << pos);}
bool _check(LL N, LL pos) {return (bool)(N & (1 << pos));}
bool _upper(char a) {return a >= 'A' && a <= 'Z';}
bool _lower(char a) {return a >= 'a' && a <= 'z';}
bool _digit(char a) {return a >= '0' && a <= '9';}

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

///**************************DONE****************************///

int N[2 * mx5];

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

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

    vector<int> v;
    for(int i = 1; i <= n; i++)
        if(N[i])
            v.Pb(N[i]);

    sort(All(v));

    int ans = 0, L = v.size(), M = L;
    for(int i = 0; i < L; i++) {
        if(M > k)
            M--, ans += v[i];
        else
            break;
    }

    cout << ans << '\n';
    return 0;
}


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

  n=1;
  for (int i=0;i<N;i++){
	if(n+K<n*2){
    	n=n+K;
    }else{
    	n=n*2;
    }
        
  } 
  	cout << n << endl;
}

Measured memory_bytes: 384
import sys
input = sys.stdin.readline
import numpy as np
N = int(input())
A = []
for _ in range(N-1):
    temp = [int(x) for x in input().split()]
    A.append(temp)
for i in range(N-1):
    t = A[i][0] + A[i][1]
    for j in range(i+1,N-1):
        if t < A[j][1]:
            t = A[j][1]
        elif t % A[j][2] != 0:
            t += A[j][2] - t % A[j][2]
        t += A[j][0]
    print(t)
print(0)

Measured memory_bytes: 12520
//
// Created by yjq on 2019/10/23.
//

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define ull unsigned long long
#define __ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N = 2010;
const int maxn = 2e5 + 10;
const ll mod = 1e9 + 7;
ll f[N * 3][N * 3], a[maxn], b[maxn], jie[maxn], ni[maxn];

ll pow_mod(ll a, ll b, ll m) {
    ll ans = 1;
    while (b) {
        if (b & 1)ans = ans * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return ans;
}

int main() {
    __;
    jie[0] = 1;
    for (int i = 1; i < maxn; ++i) {
        jie[i] = jie[i - 1] * (ll) i;
        jie[i] %= mod;
    }
    ni[maxn - 10] = pow_mod(jie[maxn - 10], mod - 2, mod);
    for (int i = maxn - 11; i >= 0; --i) {
        ni[i] = ni[i + 1] * (ll) (i + 1) % mod;
    }
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i] >> b[i];
        f[N - a[i]][N - b[i]]++;
    }
    for (int i = 1; i <= N * 2; ++i) {
        for (int j = 1; j <= N * 2; ++j) {
            f[i][j] += f[i - 1][j] + f[i][j - 1];
            f[i][j] %= mod;
        }
    }
    ll ans = 0;
    for (int i = 1; i <= n; ++i) {
        ans += f[a[i] + N][b[i] + N];
        ans = (ans - ((jie[a[i] * 2 + b[i] * 2] * ni[a[i] * 2]) % mod * ni[b[i] * 2]) % mod + mod + mod) % mod;
    }
    cout << (ans * ni[2]) % mod << endl;
    return 0;
}//

Measured memory_bytes: 196992
#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
	long long a,b,c,d,n;
	scanf("%lld%lld%lld%lld%lld",&a,&b,&c,&d,&n);
	b=min(b,2*a);
	c=min(c,2*b);
	d=min(d,2*c);
	printf("%lld",(n/2)*d+(n%2)*c);
	return 0;
}

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

using namespace std;

typedef long long ll;

double getTime() {
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

int main() {
  int n, m, q; read(n, m, q);
  vector <int> a(n), b(m);
  for(auto &x : a) read(x);
  for(auto &x : b) read(x);
  int ans = 1e9;
  while(q--) {
    int x, y, c; read(x, y, c);
    x--, y--;
    ans = min(ans, a[x] + b[y] - c);
  }
  int xx = *min_element(a.begin(), a.end());
  int yy = *min_element(b.begin(), b.end());
  print(min(ans, xx + yy));
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,ans;
  vector<int> vec;

  cin >> A >> B >> C; 
  
  vec.push_back(A);
  vec.push_back(B);
  vec.push_back(C);
  sort(vec.begin(),vec.end());

  if (vec[0]==vec[1])
  ans = vec[2];
  else if (vec[1]==vec[2])
  ans = vec[0];

  cout << ans <<"\n";
}

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

int main(){
	while(1){
		int N;
		cin >>N;
		if(N==0)
			break;

		int k;
		int c0=0,c1=0;
		for(int i=0; i<N; i++){
			cin >>k;
			if(k==0)
				c0++;
			if(k==1)
				c1++;

		}

		if(N==c0+c1)
			cout <<"NA" <<endl;

		else
			cout << N-c0+1<<endl;

		}
	return 0;
}
		

Measured memory_bytes: 1160
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <deque>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int N, K, R, S, P;
	cin >> N >> K >> R >> S >> P;
	string T;
	cin >> T;

	vector<bool> win(N);
	auto result = 0ll;
	for (auto i = 0; i < N; ++i)
	{
		if (i >= K)
		{
			if (T[i] == T[i - K] && win[i - K])
			{
				continue;
			}
		}

		win[i] = true;
		switch (T[i])
		{
			case 'r':
				result += P;
				break;

			case 's':
				result += R;
				break;

			case 'p':
				result += S;
				break;
		}
	}

	cout << result << endl;

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;


int main(){
    ll X;
    cin >> X;
    ll A;
    cin >> A;
    if(X<A){cout<<0<<endl;return 0;}
    cout<<10<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	int a, b;
  cin>>a>>b;
  a += b;
  if(a>=10) cout<<"error"<<endl;
  else cout<<a<<endl;
	return 0;
}


Measured memory_bytes: 256
N, K = map(int, raw_input().split())
array=[]
for i in range(N):
 l=map(int, raw_input().split())
 array.append(l)
array.sort()
num=0
for j in range(N):
 num=num+array[j][1]
 if K<=num:
  print array[j][0]
  break;

Measured memory_bytes: 21508
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>

using namespace std;

int n;
long long x, ans;

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	cin >> n;
	cin >> x;

	if (x <= n) {
		cout << 0 << endl;
		return 0;
	}

	vector<long long> f(n+1), p(n+1);

	f[0] = p[0] = 1;
	for (int i = 1; i <= n; ++i) {
		f[i] = (f[i-1]<<1) + 3;
		p[i] = (p[i-1]<<1) + 1;
	}

	x = min(x, f[n]);

	while (x > 0) {
		if (x == f[n] || x == f[n]-1) {
			ans += p[n];
			break;
		}

		if (x <= f[n-1] + 1) {
			--n;
			--x;
		} else if (x == f[n-1] + 2) {
			++ans;

			--n;
			x -= 2;
		} else {
			ans += p[n-1] + 1;

			x -= f[n-1] + 2;
			--n;
		}
	}

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


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

char color[20][20];
int dp[2][1 << 20];

int pop_count(int bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int possible_state(int bits) {
    return pop_count(bits) * 2 == pop_count(bits + (bits << 1));
}

int main() {
    int i, j, k;
    int m, n;
    int n_bit;
    int *src = dp[0];
    int *dst = dp[1];
    int all_case = 1;
    int sum;

    scanf("%d %d", &m, &n);
    n_bit = 1 << n;

    for (i=0; i<m; i++) {
        for (j=0; j<n; j++) {
            scanf(" %c", &color[i][j]);
            if (color[i][j] == '?') {
                all_case *= 3;
                all_case %= 100000;
            }
        }
    }

    src[0] = 1;
    for (i=0; i<m; i++) {
        int *tmp;

        for (j=0; j<n; j++) {
            int bits;

            if (i == 0) {
                bits = 1 << j;
            } else {
                bits = 1 << n;
            }

            for (k=0; k < bits; k++) {
                int JO_state;
                int is_J;
                int JO_exists;
                int r_shifted;
                char c = color[i][j];

                if (!possible_state(k)) continue;
                if (j > 0 && (k & (1 << j))) continue;

                JO_state = k & (~1);
                is_J = k & 1;
                JO_exists = k & (n_bit >> 1);
                r_shifted = (JO_state << 1) & (n_bit-1);

                if (c == 'J' || c == '?') {
                    dst[r_shifted | (0 << 1) | 1] += src[k]; // J
                }

                if (c == 'O' || c == '?') {
                    if (is_J && j > 0) {
                        dst[r_shifted | (1 << 1) | 0] += src[k]; // O
                    } else {
                        dst[r_shifted | (0 << 1) | 0] += src[k]; // O
                    }
                }

                if (!JO_exists && (c == 'I' || c == '?')) {
                    dst[r_shifted | (0 << 1) | 0] += src[k]; // I
                }

                dst[r_shifted | (1 << 1) | 0] %= 100000;
                dst[r_shifted | (0 << 1) | 1] %= 100000;
                dst[r_shifted | (0 << 1) | 0] %= 100000;
            }

            tmp = src;
            src = dst;
            dst = tmp;
            memset(dst, 0, sizeof(int) * (1 << 20));
        }
    }

    sum = 0;
    for (i=0; i<n_bit; i++) {
        sum += src[i];
        sum %= 100000;
    }

    if (all_case < sum) {
        all_case += 100000;
    }

    printf("%d\n", (all_case - sum)%100000);
}

Measured memory_bytes: 9228
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long ll;

vector<ll> prime_decom(ll &n){
  vector<ll> p;
  if ( n == 1 ) return p;
  
  ll i = 2;
  
  while ( i * i <= n){
    ll q = 0;
    while ( n % i == 0 ){
      ++q;
      n /= i;
    }
    p.push_back(q);
    ++i;
  }
  
  if (n > 1) p.push_back(1);
  
  return p;
}

ll count(ll a){
  ll i = 1;
  while (i * (i+1) / 2 <= a) ++i;
  
  return i - 1;
}

int main(){
  
  ll n;
  cin >> n;
  
  vector<ll> p = prime_decom(n);
  
  ll ans = 0;
  for (auto a : p){
    ans += count(a);
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 11248
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _0285
{
    class Program
    {

        static int endJ;
        static int endY;
        static void Main(string[] args)
        {
            int[] jy = RArInt();
            endJ = jy[0]; endY = jy[1];
            Print(string.Empty, 0, 0);
        }

        private static void Print(string s, int j, int y)
        {
            if (j == endJ && y == endY)
            {
                Console.WriteLine(s);
            }
            else if (j <= endJ && y <= endY)
            {
                if (Math.Max(j, y) == 5 && Math.Min(j, y) <= 3) return;
                if (j < endJ) Print(s + "A", j + 1, y);
                if (y < endY) Print(s + "B", j, y + 1);
            }
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RArSt(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RArInt(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RArLong(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RArDouble(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }
}



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

int a[105];

int main(){
	int n,k;

	cin>>n>>k;

	for(int i=1;i <= k;i++){
        int s;
        cin>>s;
		for(int j=1;j<=s;j++){
            int t;
			cin>>t;
			a[t]++;
		}
	}
	
	int sum = 0;
	for(int i=1;i<=n;i++)
		if(!a[i])sum++;
		
	cout<<sum<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld  = long double;
using pll = pair<ll, ll> ;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=1LL<<60;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-9; //微調整用（EPSより小さいと0と判定など）
 
#define gcd __gcd //llは受け取ってくれない
int lcm(int a, int b){return a / gcd(a, b) * b;}
#define ALL(a) a.begin(),a.end() //sort(ALL(vec));
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define PB push_back
#define SZ(x) ((int)(x).size) //size()がunsignedなのでエラー避けに

//最大値、最小値を更新する。aよりbのが大きい（小さい）か等しければaを更新してtrueを返す。そうでなければ何もせずfalseを返す chmax(nowmax,x);
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
// ----- template end ---- //
 
// ------- library ------- //


//a>=bで渡す必要があるか？（そうしなくてもいいけど、そうした方が実行早いかも）
ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
 
//a>=bで渡す必要があるか？
ll LCM(ll a, ll b) {
    ll g = GCD(a, b);
    return a / g * b;
}

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

// ----- library end ----- //



int main() {

  ll N, X;
  cin >> N >> X;

  if (N==1){
    ll x1;
    cin >> x1;
    cout << abs(X-x1) << endl;
    return 0;
  }

  ll x;
  cin >> x;
  ll nowgcd = abs(X-x);
  while (cin >> x){
    nowgcd = euclidean_gcd(max(nowgcd, abs(X-x)), min(nowgcd, abs(X-x)));
  }

  cout << nowgcd << endl;

// -- main() end -- //
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()

int main(){
  ll H,W; cin >> H >> W;
  REP(i, H) REP(j, W){
    string s;
    cin >> s;
    if(s == "snuke"){
      cout << (char) (j+'A') << i+1 << endl;
    }
  }

}



Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int price,sump,qua,sumq,n;
	
	sump=0;
	sumq=0;
	n=0;
	while(scanf("%d,%d",&price,&qua)!=EOF){
		sump=sump+price*qua;
		sumq=sumq+qua;
		n=n+1;
	}
	
	printf("%d\n",sump);
	printf("%.0lf\n",(double)sumq/(double)n+0.5);
	
	return 0;
}

Measured memory_bytes: 628
/******************************************
 *  Author : Atul Anand   
 *  Created On : Sat Feb 08 2020
 *******************************************/

import java.io.*;
import java.util.*;

public class Main{
    
    public static void main(String[] args) throws IOException {
        int N=in.nextInt();
        int a[]=new int[N];
        int b[]=new int[N];
        int c[]=new int[N];

        for(int i=0;i<N;i++){
            a[i]=in.nextInt();
            b[i]=in.nextInt();
            c[i]=in.nextInt();
        }
        
        // Max points collected till i-th day by playing a, b, c on i-th day
        int dp[][]=new int[N][3];
        dp[0][0]=a[0];
        dp[0][1]=b[0];
        dp[0][2]=c[0];

        for(int i=1;i<N;i++){
            dp[i][0]=a[i]+Math.max(dp[i-1][1], dp[i-1][2]);
            dp[i][1]=b[i]+Math.max(dp[i-1][0], dp[i-1][2]);
            dp[i][2]=c[i]+Math.max(dp[i-1][0], dp[i-1][1]);
        }
        println(Math.max(dp[N-1][0], Math.max(dp[N-1][1], dp[N-1][2])));
        in.close();
        out.close();
    }

    static int MIN = Integer.MIN_VALUE;
    static int MAX = Integer.MAX_VALUE;
    static Reader in = new Reader();
    static PrintWriter out = new PrintWriter(System.out);
    static void read(int arr[], int N) throws IOException{ for(int i=0;i<N;i++){ arr[i]=in.nextInt(); } }
    static void read(long arr[], int N) throws IOException{ for(int i=0;i<N;i++){ arr[i]=in.nextLong(); } }
    static void read(String arr[], int N) throws IOException{ for(int i=0;i<N;i++){ arr[i]=in.next(); } }
    static void print(Object O){ out.print(O); }
    static void println(Object O){ out.println(O); }
    static void print(int arr[]){ for(int i=0;i<arr.length;i++){ print(arr[i]+" "); } println(""); }
    static void print(int arr[][]){ for(int i=0;i<arr.length;i++){ print(arr[i]); } }
    static void debug(Object O){ System.out.println(O); }
}

class Reader {
    BufferedReader reader;
    StringTokenizer tokenizer;

    Reader() {
        reader = new BufferedReader(new InputStreamReader(System.in));
        tokenizer = new StringTokenizer("");
    }

    String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { tokenizer=new StringTokenizer(reader.readLine()); }
        return tokenizer.nextToken();
    }

    int nextInt() throws IOException { return Integer.parseInt(next()); }
    double nextDouble() throws IOException { return Double.parseDouble(next()); }
    long nextLong() throws IOException { return Long.parseLong(next()); }
    String nextLine() throws IOException { return reader.readLine(); }
    void close() throws IOException { reader.close(); }
}

Measured memory_bytes: 49616
-- ABC 136 B
import Data.Maybe
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as BS
import qualified Data.Vector.Unboxed as VU

main :: IO()
main = do
  n <- getInt
  print $ solve n

solve :: Int -> Int
solve n = if odd rank then m + l else l
  where
    n' = show n
    rank = length n'
    m = n - 10^(rank-1) + 1
    l = sum . map (\k -> 9*10^(k-1)) $ [1,3..rank-1]

-- ByteStringを用いた入力
readInt = fst . fromJust . BS.readInt

-- 整数を一つ受け取る
getInt = readInt <$> BS.getLine

-- 長さnの整数列を受け取る
getIntVec n = VU.unfoldrN n (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

-- 空白区切りの整数列をListで受け取る
getIntList = unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine


Measured memory_bytes: 380
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
#include <utility>
#include <stdio.h>
#include <unistd.h>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl
#define PI 3.14159265359

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const int mod = 1000000007;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

string s;
int solve(int index) {
  if (s.size() == index) {
    return 1;
  }
  int flag = 0;
  if (s.size() >= index + 5) {
    string tmp = s.substr(index, 5);
    int flag = 0;
    if (tmp == "dream") flag = solve(index + 5);
    else if (tmp == "erase") flag = solve(index + 5);
    if (flag == 1) return 1;
  }
  if (s.size() >= index + 6) {
    string tmp = s.substr(index, 6);
    if (tmp == "eraser") flag = solve(index + 6);
    if (flag == 1) return 1;
  }
  if (s.size() >= index + 5) {
    string tmp = s.substr(index, 7);
    if (tmp == "dreamer") flag = solve(index + 7);
    if (flag == 1) return 1;
  }
  return 0;
}

int main() {
  cin >> s;
  if (solve(0) == 1) YES;
  else NO;


  return 0;
}



Measured memory_bytes: 2560
use std::io::BufRead;

fn main() {
    let handle = std::io::stdin();
    let mut iter = handle.lock().lines().map(|a| a.unwrap());
    let n: usize = iter.next().unwrap().parse().unwrap();
    let x: Vec<f64> = iter.next().unwrap().split_whitespace()
        .map(|a| a.parse().unwrap()).collect();
    let y: Vec<f64> = iter.next().unwrap().split_whitespace()
        .map(|a| a.parse().unwrap()).collect();
    let p_1: f64 = x.iter().zip(y.iter())
        .map(|(a, b)| (a - b).abs()).sum();
    let p_2: f64 = x.iter().zip(y.iter())
        .map(|(a, b)| (a - b).abs().powi(2)).sum::<f64>().powf(0.5);
    let p_3: f64 = x.iter().zip(y.iter())
        .map(|(a, b)| (a - b).abs().powi(3)).sum::<f64>().powf(1.0 / 3.0);
    let p_inf: f64 = x.iter().zip(y.iter())
        .map(|(a, b)| (a - b).abs()).fold(0.0/0.0, |acc, x| acc.max(x));
    println!("{:.*}", 5, p_1);
    println!("{:.*}", 5, p_2);
    println!("{:.*}", 5, p_3);
    println!("{:.*}", 5, p_inf);
}


Measured memory_bytes: 5172
#include <iostream>
#include <tuple>
#include <algorithm>

int get_smaller_max(int a, int l[], int l_count) {
    int* ptr = std::upper_bound(l, l + l_count, a, std::greater<int>());
    int index = ptr - l;
    if (index == l_count) return -1;
    return index;
}

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

    int l[n], l_count = 0, max, index;
    for (size_t i = 0; i < n; i++) {
        int a; std::cin >> a;
        int index = get_smaller_max(a, l, l_count);
        if (index == -1) {
            l[l_count] = a;
            l_count++;
        } else {
            l[index] = a;
        }
    }

    std::cout << l_count << std::endl;
    return 0;
}


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a) accumulate(all(a), 0LL)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
int const inf = 1e9;
ll const INF = 1e18;

inline void ios_(){cin.tie(0); ios::sync_with_stdio(false);}
template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}

class Combination{
public:
    int N;
    ll mod;
    vector<ll> fact;

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

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

    ll combin(int n, int k){
        if(n < 0 || k < 0 || n < k){
            return 1;
        }
        return fact[n] * POW(fact[k] * fact[n-k] % mod, mod - 2) % mod;
    }

    ll moddiv(ll a, ll b){
        return a % MOD * POW(b, mod - 2) % MOD;
    }
};

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

    Combination C(min(n, 200010LL), MOD);

    ll ans = C.POW(2, n) - 1;

    vector<ll> dp(200010, 0LL);
    dp[0] = 1;
    REP(i, 200010){
        dp[i+1] = dp[i] * (n - i) % MOD;
        dp[i+1] = C.moddiv(dp[i+1], i+1);
    }

    ans = ans + 2*MOD - dp[a] - dp[b];
    ans %= MOD;

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


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

#define pi 3.14159265

int main(){
    while(1){
        int n; cin >> n;
        if(n == 0)  break;
        double sum=0, ave;
        vector<int> s(n);
        for(int i = 0; i  < n; i++){
            cin >> s[i];
            sum += s[i];    
        }
        ave = sum /n;
        sum = 0;
        for(int i = 0; i  < n; i++){
            sum += (s[i]-ave)*(s[i]-ave);
        }
        double v = sqrt(sum/n);
        cout << fixed << setprecision(8) << v << endl;
    }
}


Measured memory_bytes: 3276
#include <iostream>

using namespace std;
int main()
{
    string s;
    cin >> s;

    bool b = false;
    for(int i=1; i<3; i++) {
        if(s[i] != s[0]) b=true;
    }

    cout << (b ? "Yes" : "No");
    return 0;
}

Measured memory_bytes: 256
N = int(input())
t = [0] * N
x = [0] * N
y = [0] * N
for i in range(N):
    t[i],x[i],y[i] = map(int, input().split())
    if x[i] + y[i] > t[i]:
        print("No")
        exit()
    elif (x[i]+y[i])%2 != t[i]%2:
        print("No")
        exit()        
    if i > 0:
        a = abs(x[i]+y[i]-x[i-1]-y[i-1])%2
        b = (t[i]-t[i-1])%2
        if a != b:
            print("No")
            exit()
else:
    print("Yes")

Measured memory_bytes: 11700
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
const int N=2e5+5;
int inf=0x3f3f3f3f;
typedef pair<int,int> pa;

long double PI=3.141592654;

int main()
{
    long double r;
     cin>>r;
     long double kk=2*r*PI;
     printf("%.10llf\n",kk);
   return 0;
}


Measured memory_bytes: 3260
def is_prime(X):
    flag = 1
    for i in range(2,int(X**0.5)+1):
        if X % i == 0:
            flag = -1
        if i == int(X**0.5) and flag == 1:
            print(X)
            exit()
X=int(input())
if X == 2:
    print(2)
    exit()
while(True):
    is_prime(X)
    X+=1

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int n,m;
    cin>>n>>m;
    string a[n],b[m];
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<m;i++) cin>>b[i];
    
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            if(i+m-1>=n || j+m-1>=n) continue;
            
            bool flag=true;
            for(int k=0;k<m;k++){
                for(int l=0;l<m;l++){
                    if(a[i+k][l+j]!=b[k][l]) flag=false;
                }
            }
            if(flag){
               cout<<"Yes"<<endl;
               return 0;
            }
        }
    }
    
    cout<<"No"<<endl;
    
    
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

void solve() {
    int n;
    cin >> n;
    cout << double((n + 1) / 2) / n;
}

int main() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    
    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>

#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) for(int (i) = (n) - 1; (i) >= 0; --(i))

using lli = long long int;
std::vector<int> A;

int main(void){
    int n; scanf("%d", &n);
    A.resize(n); REP(i, n) scanf("%d", &A[i]);

    lli L = 2, R = 2;
    rREP(i, n){
        lli LL = (((L - 1) / A[i]) + 1) * A[i];
        lli RR = (R / A[i]) * A[i] + A[i] - 1;
        L = LL; R = RR;
        if(L > R){
            puts("-1");
            return 0;
        }
    }
    printf("%lld %lld\n", L, R);
    return 0;
}

Measured memory_bytes: 768