akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <map>
#include <set>
#include <cstring>
#include <string>
#include <cctype>
#include <cassert>
#include <queue>
#include <unordered_set>
#include <unordered_map>

using namespace std;

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i = 0; i < (n); i++)
#define repr(i,b,e) for(int i = (b); i <= (e); i++)
#define INF (1001001001)
#define EPS (1e-15)

#define pr(x) do{cerr << (#x) << " = " << (x) << endl;}while(0)
#define pri(x,i) do{cerr << (#x) << "[" << i << "] = " << (x[i]) << endl;}while(0)
#define pra(x) do{rep(__i,(x).size()) pri(x,__i);}while(0)
#define pran(x,n) do{rep(__i,n) pri(x,__i);}while(0)
#define pral(x) do{cerr << (#x) << " =";rep(__i,(x).size()) cerr<<" "<<(x[__i]);cerr<<endl;}while(0)
#define prar(x,b,e) do{repr(__i,b,e) pri(x,__i);}while(0)

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"<<endl; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}
template<class T> inline bool CHMAX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool CHMIN(T &l,const T &r){return l>r?l=r,1:0;}

ll MOD = 1000000007;

int in() {
	int a;
	scanf("%d ", &a);
	return a;
}

vint finalAns;
void solve(int N, bool fa = false) {
	// pr(N);
	vint ans;
	int sum = 0;
	for (int i = 2; ans.size() < N; i++) {
		if (i % 2 == 0 || i % 3 == 0 || i % 5 == 0) {
			ans.pb(i);
			sum += i;
		}
	}
	
	ans[N - 1] += 30 - sum % 30;
	// pra(ans);
	if (ans[N - 1] % 2 == 0 || ans[N - 1] % 3 == 0 || ans[N - 1] % 5 == 0) {
	}
	else if (ans[N - 2] % 3 == 0) {
		ans[N - 2] += 3;
		ans[N - 1] += 27;
	}
	else if (ans[N - 2] % 5 == 0) {
		ans[N - 2] += 5;
		ans[N - 1] += 25;
	}
	else {
		int wa = 0;
		while (ans[N - 2] % 3 != 0 && ans[N - 2] % 5 != 0) {
			ans[N - 2] += 2;
			wa += 2;
		}
		ans[N - 1] += 30 - wa;
		if (ans[N - 2] % 3 == 0) {
			ans[N - 2] += 3;
			ans[N - 1] += 27;
		}
		else if (ans[N - 2] % 5 == 0) {
			ans[N - 2] += 5;
			ans[N - 1] += 25;
		}
	}
	// pra(ans);
	
	sum = 0;
	rep(i,N) sum += ans[i];
	// pr(sum);
	assert(sum % 30 == 0);
	rep(i, N) assert(ans[i] % 2 == 0 || ans[i] % 3 == 0 || ans[i] % 5 == 0);
	rep(i, N - 1) assert(ans[i] < ans[i + 1]);
	rep(i, N) assert(ans[i] >= 2 && ans[i] <= 30000);
	
	if (fa) finalAns = ans;
}

int main() {
	function<void(int,int)> tensi_no_3p=[&](int v,int d){
	};
	int N;
	cin >> N;
	if (N == 3) {
		cout << "2 5 63" << endl;
		return 0;
	}
	else if (N == 4) {
		cout << "2 5 20 63" << endl;
		return 0;
	}
	
	// repr(n, 5, 20000) solve(n);
	
	solve(N, true);
	
	rep(i, N) {
		cout << finalAns[i];
		if (i == N - 1) cout << endl;
		else cout << " ";
	}
	return 0;
}


Measured memory_bytes: 440
inf = 2**60
'''
def table(size, init): #配列生成
  x = len(size)
  l = [init for i in range(size[x-1])]
  for i in range(x-1):
    l = [l for k in range(size[x-2-i])]
  return l
'''

n, W = map(int, input().split())
w, v = [[0]*n for i in range(2)]
for i in range(n):
  w[i], v[i] = map(int, input().split())

dp = [[0] * (W+1) for i in range(n+1)]


for i in range(n):
  for j in range(W+1):
        if j>=w[i]:
            dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i])
        else:
            dp[i+1][j] = dp[i][j]

print(max(dp[n]))

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

int main() {
  int a;
  int c=0;
  cin>>a;
  vector<int> b(a);
  for(int i=0;i<a;i++){
    cin>>b.at(i);
  }
  for(int i=0;i<a-2;i++){
    if(b.at(i)<b.at(i+1)&&b.at(i+1)<b.at(i+2)){
      c++;
    }
    else if(b.at(i)>b.at(i+1)&&b.at(i+1)>b.at(i+2)){
      c++;
    }
  }
  cout<<c<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        var scaner = new Scanner(System.in);
        var x = Long.parseLong(scaner.nextLine());

        var deposit = 100l;
        var interest = 0.01;
        
        int year = 0;
        while(deposit < x) {
            deposit += deposit*interest;
            year++;
        }
        System.out.println(year);
    }
}

Measured memory_bytes: 35776
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
int func(int n){
    if(n==0)
        return 0;
    return func(n/2)*2+1;
}
signed main(){
    int h;
    cin>>h;
    cout<<func(h)<<endl;
}


Measured memory_bytes: 256
use std::cmp::max;
use std::io::stdin;

fn main() {
    let mut is = String::new();
    stdin().read_line(&mut is).ok();
    is.clear();
    stdin().read_line(&mut is).ok();
    let s = is.trim();
    let mut ans = 0;

    for i in 1..s.len() {
        let (x, y) = s.split_at(i);
        let mut x_cnt = [false; 26];
        let mut y_cnt = [false; 26];

        x.chars().for_each(|c| x_cnt[c as usize - 0x61] = true);
        y.chars().for_each(|c| y_cnt[c as usize - 0x61] = true);
        ans = max(
            ans,
            x_cnt
                .iter()
                .zip(y_cnt.iter())
                .filter(|e| *e.0 && *e.1)
                .count(),
        );
    }

    println!("{}", ans);
}


Measured memory_bytes: 2104
def main():
  from builtins import abs
  N = int(input())
  A = list(map(int, input().split()))

  a = A[:-1]
  for i in range(1, N - 1):
    a[i] += a[i - 1]

  l = sum(A)
  print(min(abs(p + p - l) for p in a))
main()


Measured memory_bytes: 26764
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN=18;

char s[2*MAXN+1]; int slen,n;

ll dp[1<<MAXN];

void run() {
	scanf("%d%s",&n,s); slen=strlen(s); assert(slen%2==0); n=slen/2;

	memset(dp,0,sizeof(dp)); dp[0]=1;
	FOR(mask,1,1<<n) {
		int cnt=0; REP(i,n) if(mask&(1<<i)) ++cnt;
		int at=0; while((mask&(1<<at))==0) ++at;
		int to=at; FOR(i,at,n) if((mask&(1<<i))==0) to=i;
		bool fixed=to!=at;
		if(s[at]==s[n+cnt-1]) {
			dp[mask]+=dp[mask^(1<<at)];
			if(!fixed) dp[mask]+=dp[mask^(1<<at)];
		}
		FOR(i,to+1,n) if((mask&(1<<i))!=0&&s[i]==s[n+cnt-1]) {
			dp[mask]+=dp[mask^(1<<i)];
			if(!fixed) dp[mask]+=dp[mask^(1<<i)];
		}
	}
	printf("%lld\n",dp[(1<<n)-1]);
}

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


Measured memory_bytes: 2304
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <cctype>
#include <bitset>
#include <type_traits>

#include <list>
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, a, b) for (int i = a; i < (b); ++i)
#define YES(j) cout << (j ? "YES" : "NO") << endl;
#define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
#define yes(j) std::cout << (j ? "yes" : "no") << endl;
int main(void)
{
    typedef long long ll;
    const ll infl = 1LL << 60;
    int n;
    cin >> n;
    long long a[n], b[n];
    REP(i, n)
    {
        cin >> a[i];
        if (i == 0)
        {
            b[i] = a[i];
        }
        else
        {
            b[i] = a[i] + b[i - 1];
        }
    }
    long long sum = b[n - 1];
    long long ans = infl;
    REP(i, n - 1)
    {
        long long tmp = abs(b[i] - (sum - b[i]));
        if (ans > tmp)
        {
            ans = tmp;
        }
    }
    cout << ans << endl;
}

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

#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define SORT(v) (sort(v.begin(),v.end()))
using ll = long long;
using namespace std;

void solve();

int main() {

	solve();
	return 0;

}

void solve() {

	vector<ll> v(3);
	REP(i, 3) {
		cin >> v[i];
	}
	SORT(v);
	cout << v[0] + v[1] << endl;
	
}

Measured memory_bytes: 256
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

using ll = long long;
using ld = long double;
using ull = unsigned long long;

using namespace std;

const ll MOD = 1e9 + 7;

ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}

const int N = 1 << 17;

int h, n;

int p[N];
ll go[N];

ll ans = 0;

ll gl[N * 2 + 5];
ll gr[N * 2 + 5];

int mx[N];
ll rgo[N * 2];

ll get(int x, int y) {
	ll ans = go[x] * go[y] % MOD;
	int lca = (x + n) >> mx[x ^ y];
	return ans * rgo[lca] % MOD;
}

void run(int v, int l, int r, ll cur) {
	ll nw = cur * pw(v, MOD - 2) % MOD;
	memset(gl, 0, sizeof(gl[0]) * (1 << h));
	memset(gr, 0, sizeof(gr[0]) * (1 << h));

	if ((r - l) <= 256) {
		for (int i = l; i < r; ++i) {
			for (int j = i + 1; j < r; ++j) {
				ans = (ans + get(i, j) * get(p[i], p[j])) % MOD;
			}
		}
		return;
	}

	int m = (l + r) >> 1;
	for (int i = l; i < m; ++i) {
		gl[n + p[i]] = (gl[n + p[i]] + go[i] * cur % MOD * (n + p[i])) % MOD;
	}
	for (int i = m; i < r; ++i) {
		gr[n + p[i]] = (gr[n + p[i]] + go[i] * nw % MOD * (n + p[i])) % MOD;
	}

	for (int i = n - 1; i >= 1; --i) {
		ll ad = (gl[i * 2] * gr[i * 2 + 1] + gl[i * 2 + 1] * gr[i * 2]) % MOD * i;
		ans = (ans + ad) % MOD;
		gl[i] = (gl[i * 2] + gl[i * 2 + 1]) * i % MOD;
		gr[i] = (gr[i * 2] + gr[i * 2 + 1]) * i % MOD;
	}

	run(v * 2, l, m, nw);
	run(v * 2 + 1, m, r, nw);
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cout.setf(ios::fixed), cout.precision(20);
	cin >> h;
	n = (1 << (h - 1));
	for (int i = 0; i < n; ++i) {
		cin >> p[i];
		--p[i];
	}
	for (int i = 0; i < n; ++i) {
		int cur = i;
		while (cur) {
			++mx[i];
			cur >>= 1;
		}
	}

	rgo[1] = 1;
	for (int i = 2; i < 2 * n; ++i) {
		rgo[i] = rgo[i / 2] * pw(i, MOD - 2) % MOD * pw(i / 2, MOD - 2) % MOD;
	}

	for (int i = 0; i < n; ++i) {
		ll cur = n + i;
		go[i] = 1;
		while (cur) {
			go[i] = (go[i] * cur) % MOD;
			cur >>= 1;
		}
	}

	run(1, 0, n, 1);
	cout << ans << "\n";

	return 0;
}




Measured memory_bytes: 11788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N,M,R;
    cin >> N >> M >> R;
    vector<int> r(R);
    rep(i,R){
        int a;
        cin >> a;
        r[i]=a-1;
    }
    sort(r.begin(),r.end());
    vector<vector<ll>> dist(N,vector<ll>(N,INF));
    rep(i,M){
        int A,B,C;
        cin >> A >> B >> C;
        A--;B--;
        dist[A][B] = C;
        dist[B][A] = C;
    }

    // ワーシャルフロイド法
    rep(i,N) dist[i][i] = 0;
    for (int k = 0; k < N; ++k){
        for (int i = 0; i < N; ++i){
            for (int j = 0; j < N; ++j){
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
    ll ans = INF;
    do{
        ll tmp = 0;
        for(int i=1;i<R;i++){
            tmp += dist[r[i]][r[i-1]];
        }
        ans = min(ans,tmp);
    }while(next_permutation(r.begin(),r.end()));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 512
<?php
fscanf(STDIN, "%d", $n);
while ($n--) {
	fscanf(STDIN, "%s", $s);
	$cs = count_chars($s, 1);
	if (isset($xs)) {
		foreach ($xs as $c => $m) {
			if (isset($cs[$c]) && $cs[$c] < $m) {
				$xs[$c] = $cs[$c];
			} elseif (!isset($cs[$c])) {
				unset($xs[$c]);
			}
		}
	} else {
		$xs = $cs;
	}
}
$x = null;
foreach ($xs as $c => $m) {
	$x .= str_repeat(chr($c), $m);
}
echo $x;

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

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int N; cin >> N;
	ll sum = 0;
	map<int, int> occ;
	F0R(i, N) {
		int x; cin >> x;
		sum += x;
		occ[x]++;
	}

	int Q; cin >> Q;
	F0R(i, Q) {
		int A, B; cin >> A >> B;
		sum -= 1LL * A * occ[A];
		sum += 1LL * B * occ[A];
		occ[B] += occ[A]; occ[A] = 0;
		print(sum);
	}
}

Measured memory_bytes: 7992
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define wh while
#define db double
#define pb .push_back
#define sz .size()
#define vc vector
#define vcd vector <double>
#define vcf vector <float>
#define vci vector <int>
#define vcs vector <string>
#define sti set <int>
#define fi .first
#define se .second
#define yes true
#define no false
#define bg .begin()
#define ed .end()
#define ad a,b,c,d
#define till n i<n.size();
set <int> A;
vector <int> B;
vector <int> C;
vector <int> D;
sti G;
bool t;
bool f;
int cnt=0;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int j1,j2;
    j1=a*b;
    j2=c*d;
    cout<<max(j1,j2);

















}


Measured memory_bytes: 256
n = int(input())
h = list(map(int, input().split()))
for i in range(1, n):
    m = n-i
    if h[m] < h[m-1]:
        if h[m] < h[m-1]-1:
            print("No")
            exit()
        else:h[m-1] -= 1
print("Yes")

Measured memory_bytes: 14396
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(n);i++)

int main(){
	rep(i,3){
		int a,b,c,d,e,f;
		cin>>a>>b>>c>>d>>e>>f;
		a = (a*60+b)*60+c;
		b = (d*60+e)*60+f;
		a=b-a;
		printf("%d %d %d\n",a/3600,a/60%60,a%60);
	}
	return 0;
}

Measured memory_bytes: 1144
input_lines = input().split(" ")
N = int(input_lines[0])
T = int(input_lines[1])

times = [int(x) for x in input().split(" ")]
elapsed = 0
oyu = T
for i in range(1,N):
    if times[i] > times[i-1] + T:
        oyu = oyu+T
    else:
        oyu = oyu+times[i]-times[i-1]
        
print(oyu)

Measured memory_bytes: 25196
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
using pp=pair<ll,pair<ll,ll>>;
#define MAX 1000000
#define MOD 998244353
#define INF 1000000000000000000

int main(){
  int N,K;
  cin>>N>>K;
  mcf_graph<int,ll>g(2*N+2);
  int s=2*N,t=2*N+1;

  g.add_edge(s,t,N*K,1000000000);

  for(int i=0;i<N;i++){
    g.add_edge(s,i,K,0);
    g.add_edge(N+i,t,K,0);
  }
  for(int i=0;i<N;i++){
    for(int j=0;j<N;j++){
      ll a;
      cin>>a;
      g.add_edge(i,N+j,1,1000000000-a);
    }
  }

  auto result=g.flow(s,t,N*K);
  cout<<(ll)N*(ll)K*1000000000-result.second<<endl;
  vector<string> grid(N,string(N,'.'));
  auto edges=g.edges();
  for(auto e:edges){
    if(e.from==s||e.to==t||e.flow==0){
      continue;
    }
    grid[e.from][e.to-N]='X';
  }
  for(int i=0;i<N;i++){
    cout<<grid[i]<<endl;
  }
}


Measured memory_bytes: 3956
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtTest.Virtual
{
    class AGC001_B
    {
        static void Main(string[] args)
        {
            Method(args);
            ReadLine();
        }

        static void Method(string[] args)
        {
            long[] nx = ReadLongs();
            long n = nx[0];
            long x = nx[1];
            long min = Min(n - x, x);
            long max = Max(n - x, x);
            WriteLine(GetLength(min, max));
        }

        static long GetLength(long min,long max)
        {
            long cnt = max / min;
            long val = min * 3 * cnt;
            if (max % min > 0)
            {
                val += GetLength(max % min, min);
            }
            return val;
        }

        private static string Read() { return ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11220
#include<bits/stdc++.h>
#include <queue>
#include <stack>
using namespace std;
 
typedef pair<long long int,long long int>pa;
#define resize(A) A.resize(unique(A.begin(), A.end()) - A.begin())
#define pb push_back
 
# define  MAX 200005
long long int MOD=998244353;
long long int INF=1e18;
 
int main()
{
    
       ios_base::sync_with_stdio(false); 
       cin.tie(NULL);
     cout.tie(NULL);
      long long int i,j,k=0,l=0,r=0,m=0,n,p=0,cnt=0,cnt1=0,x,y,z=0,a,b,low,mid,high,ans=0,maxi=0,mini=INF,t,d;
  cin>>n;
    long long int A[n];
  
    for(i=0;i<n;i++)
    {
        cin>>A[i];
        
    }
    
    multiset<long long int> lk; 
  multiset<long long int>::iterator it;
    for ( i = 0; i <n; i++)
    { 
  
       
         it=lk.lower_bound(A[i]); 
  
       
        if (it == lk.begin())
            lk.insert(A[i]); 
  
        else 
        { 
            it--; 
            lk.erase(it); 
            lk.insert(A[i]);
        } 
    } 
    cout<<lk.size();
   
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
map<int,int>mp;
int arr[2000000];
int main()
{
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=m;i++)
    {
        cin>>arr[i];
    }
    for(int i=m;i>=1;i--)
    {
        if(mp[arr[i]]==0)cout<<arr[i]<<endl;
        mp[arr[i]]++;
    }
    for(int i=1;i<=n;i++)
    {
        if(mp[i]==0)cout<<i<<endl;
        mp[i]++;
    }
    return 0;
}

Measured memory_bytes: 12852
S = list(input())
key = 'keyence'
l = len(S)
ans = 0
stop = 7

for i in range(7):
    if S[i] == key[i]:
        ans += 1
    else:
        stop = i
        break

if stop == 7:
    print('YES')
else:
    for i in range(stop,7):
        if S[l - 7 + i] == key[i]:
            ans += 1

    if ans == 7:
        print('YES')
    else:
        print('NO')

Measured memory_bytes: 3064
from itertools import permutations
N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))
A = []
for x in permutations(range(1,N+1),N):
    A.append(list(x))
A = sorted(A)
indP = A.index(P)
indQ = A.index(Q)
print(abs(indP-indQ))

Measured memory_bytes: 46940
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define M 1000000007
ll po(ll a,ll b){
  ll x=1,y=a;
  while(b){
    if(b%2==1) x=x*y%M;
    y=y*y%M;
    b/=2;
  }
  return x;
}
int main(){
  ll n,m;
  cin>>n>>m;
  ll d[1<<17],x=1;
  d[0]=1;
  for(int i=1;i<1<<17;i++){
    d[i]=d[i-1]*i%M;
  }
  for(int i=2;i*i<=m;i++){
    if(m%i==0){
      ll s=0;
      while (m%i==0){
        m/=i;
        s++;
      }
      x=x*d[n+s-1]%M*po(d[n-1],M-2)%M*po(d[s],M-2)%M;
    }
  }
  if(m>1) x=x*n%M;
  cout<<x;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
ll power(ll x,ll y,ll p){
ll res = 1;x = x % p;
while (y > 0){
if (y & 1){res = (res*x) % p;}
y = y>>1;
x = (x*x) % p;}
return res;}
ll mcd(ll a,ll b){
    if(b>a)swap(a,b);
    if(b==0)return a;
    else return mcd(b,a%b);
}
ll t,n,m,k;
bool esprimo(ll n){
ll s=0;
for(ll i=1;i*i<=n;i++){
    if(n%i==0){s++;}}
if(s>=2){return false;}
return true;
}
int main(){
    //    cout<<fixed<<setprecision(2);
//cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

cin>>t;
ll ac=0,wa=0,tle=0,re=0;
while(t--){
    string s;
    cin>>s;
    if(s=="AC"){ac++;}
    if(s=="WA"){wa++;}
    if(s=="TLE"){tle++;}
    if(s=="RE"){re++;}
}
cout<<"AC x "<<ac<<endl<<"WA x "<<wa<<endl<<"TLE x "<<tle<<endl<<"RE x "<<re<<endl;


}



Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
 //Compiler version g++ 6.3.0

 int main()
 {
 	int n;
 	cin >> n;
 	string x;
 	cin >> x;
 	int a=0;
 	for (int i = 0; i < n; i++){
 		if(x.at(i)=='B'){
 			a++;
 		}
 	}
 	if(n-a>a){
 		cout << "Yes" << endl;
 	}else{
 		cout << "No" << endl;
 	}
 }

Measured memory_bytes: 256
// #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES	// M_PI=3.1415...
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>	// 20桁出力 cout << setprecision(20) << double;
#include <queue>
#include <bitset>	// bitset<8> bs1(131uL); // 10000011 bs1[0]は1 01stringからビット集合生成可
#include <numeric>
#include <random>
#include <climits>  // A/Bを計算するときA==LLONG_MIN && B==-1のみ(1ull<<63)で代用
using namespace std;

typedef long long LL;
typedef pair<LL, LL> P;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;				// VVL v(100,VL(100,0));
typedef vector<pair<LL, LL> > VP;
typedef vector<string> VS;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<LL, pair<P, P> > PP;

#define INF 999999999999999997		// 少し加算したらオーバーフローする
#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORL(i,a,b) for(LL i=(a);i<(b);i++)
#define FOR_REV(i,a,b) for(int i=(a);i>=(b);i--)
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
#define FOR_ITR(d) for(auto itr=d.begin(),d_end=d.end();itr!=d_end;++itr)	// C++11
#define O(s) cout<<s<<endl;

#define DUMP_VVI(b) if(dbgF){FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}

template<class T>T IN() { T d; cin >> d; return d; }

LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; } // 最大公約数（Greatest Common Divisor）
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; } // 最小公倍数（Least Common Multiple）
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); } // うるう年判定
string Replace(string S, string from, string to) { auto p = S.find(from); while (p != string::npos) { S.replace(p, from.size(), to); p = S.find(from, p + to.size()); }return S; }

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

// -------------------------------------------------------------------------------

int main() {
	FAST_IO;
	bool dbgF = true; // for D_OUT(str, value)  ... cout<< str <<" : "<< value <<endl;

	LL N;
	string S;
	cin >> N >> S;
	LL ans = 0;

	FOR(i, 1, N) {
		string s1, s2;
		s1 = S.substr(0, i);
		s2 = S.substr(i);
		//cout << s1 << " " << s2 << endl;
		LL tmp = 0;
		FOR(i, 0, 26) {
			char nowm = 'a' + i;
			if (count(s1.begin(), s1.end(), nowm) > 0&&
				count(s2.begin(), s2.end(), nowm) > 0) {
				tmp++;
			}
		}
		ans = max(ans, tmp);

	}
	O(ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long N = 0, A = 0, B = 0, C = 0, D = 0, i = 0;
    long long ans = 0;
    long count = 0;

    cin >> A>>B;

    count = B - A;


    for (i = 1; i < count;i++){
        ans += i;
    }

    ans = ans - A;

    cout << ans << endl;
}

Measured memory_bytes: 256
function Main(input) {

	input = input.split(" ");
	
	var X = parseInt(input[0]);
	var A = parseInt(input[1]);
	
	if(X<A){
	    console.log("0");
	}else{
	    console.log("10");
	}
	
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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

#define oo(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1)
{
  cout << name << ": " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args)
{
  const char *comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

unsigned lcm(int a, int b) { return (a / __gcd(a, b) * b); }
#define frii(i , j , n) for (int i = j; i < n; ++i)
#define jri(j, k, n) for (int j = k; j >= n; j--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fa(x , n , v) fill(&(x)[0][0], &(x)[0][0] + (0 + n) *(0 + n) , (v))
#define ra(a) for(int &x : (a)) cin >> (x);
typedef long long int lli;
typedef unsigned long long int ulli;
const lli MOD = 1e9 + 7;
#define pb emplace_back
#define mp make_pair
#define vi vector<int>
#define vlli vector<lli>

int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  vi dp(3);
  frii(day , 0 ,n){
    vi newdp(3 , 0);
    vi c(3);
    frii(i , 0 , 3){
      cin >> c[i];
    }
    frii(i,0,3){
      frii(j,0,3){
      	if(i!=j)
        { 
        	newdp[j] = max(newdp[j],dp[i] + c[i]);
        }
      }
    }
    dp = newdp;
  }
  cout <<  max({dp[0], dp[1], dp[2]});
  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long max = (1 << n);
		StringBuilder sb = new StringBuilder();
		for (long i = 0; i < max; i++) {
		    sb.append(i).append(":");
		    long x = i;
		    for (int j = 0; j <= 18 && x > 0; j++) {
		        if (x % 2 == 1) {
		            sb.append(" ").append(j);
		        }
		        x >>= 1;
		    }
		    sb.append("\n");
		}
		System.out.print(sb);
	}
}



Measured memory_bytes: 69772
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    MOD = 10**9 + 7
    SI = lambda : sys.stdin.readline().rstrip()
    S = SI()

    dp = [[0] * 4 for _ in range(len(S)+1)]
    dp[0] = [1,0,0,0]
    ans = 0
    for i in range(len(S)):
        rg = [0,1,2] if S[i] == '?' else [ord(S[i])-ord('A')]
        for a in rg:
            for b in range(4):
                if a == b:
                    c = b + 1
                    dp[i + 1][c] = (dp[i + 1][c] + dp[i][b]) % MOD
                dp[i + 1][b] = (dp[i + 1][b] + dp[i][b]) % MOD

    print(dp[-1][-1])

if __name__ == '__main__':
    main()

Measured memory_bytes: 56408
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define endl "\n"
using namespace std;
using ll = long long;
ll pi=3.1415926535897932384626433832795028841971693993751058l;


void solve(ll x, ll k, ll d) {
    if(x<0)x*=-1;
    if(x / d > k){
        cout << x - k * d << endl;
    }else{
        if((k - x / d) % 2 == 1){
            cout << abs(x % d - d) << endl;
        }else {
            cout << x % d << endl;
        }
    }
}

int main() {
    ll a,b,c;
    cin >> a >> b >> c;
    solve(a,b,c);
    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <iomanip>
using namespace std;
using i64 = int64_t;
#define rep(i, j, n) for(int i = (j); i < (n); ++i)
#define rrep(i, j, n) for(int i = (n) - 1; (j) <= i; --i)
constexpr i64 MOD = 1000000007;
constexpr i64 INF = 1LL << 60;

int main() {
	int a; cin >> a;
	cout << a + a * a + a * a * a;
	return 0;
}

Measured memory_bytes: 3628
#include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>

#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;

int gA[10],jA[10];
double dp[1<<9][10][400];

double dfs(int gS,int j,int sum) {
    // printf("%d : %d %d %d\n",__builtin_popcount(gS),gS,jS,sum);
    if(__builtin_popcount(gS) == 9) {
        if(sum>0) return 1.0;
        else return 0.0;
    }
    int p=9-__builtin_popcount(gS);
    if(dp[gS][j][sum+200]!=-1.0) return dp[gS][j][sum+200];
    double ret=0.0;
    rep(i,9) if(!((gS>>i)&1)){
        int a=gA[i]+jA[j];
        int s=sum;
        // printf("%d %d : %d %d\n",gA[i],jA[j],s,a);
        if(gA[i]>jA[j]) s+=a;
        else s-=a;

        ret += dfs(gS|1<<i, j+1, s)*1.0/(p);
    }

    return dp[gS][j][sum+200] = ret;
}

void solve() {
    rep(i,1<<9) rep(j,10) rep(a,400) dp[i][j][a]=-1.0;
    rep(i,9) cin>>gA[i];
    rep(i,9) cin>>jA[i];
    double ans=dfs(0,0,0);
    printf("%.8f %.8f\n",ans,1-ans);
}

int main() {
    int t;
    cin>>t;
    while(t-->0) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 17192
def main():
    N = input_int()
    S = input()

    count = 1

    for i in range(1, N):
        if S[i-1] != S[i]:
            count += 1

    print(count)


def input_int():
    return int(input())


# def input_int_tuple():
#     return map(int, input().split())


# def input_int_list():
#     return list(map(int, input().split()))


main()


Measured memory_bytes: 67428
from math import atan,tan,pi

a,b,x = map(int,input().split())

def max_volume(theta):
    
    theta = theta/180*pi
    if theta<atan(b/a):
        
        area = a*b-a*a*tan(theta)/2
    else:
        area = b*(b/tan(theta))/2
    return area*a

left = 0 
right = 90 
while right - left > 1e-7:
    mid = (left+right)/2
    if max_volume(mid) <= x:
        right = mid
    else:
        left = mid

answer = (left+right)/2
print(answer)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
template<typename T> inline void chkmin(T &a, const T &b) { a = a < b ? a : b; }
template<typename T> inline void chkmax(T &a, const T &b) { a = a > b ? a : b; }

const int MAXN = 605;
int D1, D2, n;
bool d1[MAXN][MAXN], d2[MAXN][MAXN], vis[MAXN][MAXN];
struct DD { int x, y; };
vector<DD> e1, e2;

void g_edge(vector<DD> &v, int D) {
	int s = sqrt(D);
	for (int i = -s - 1; i <= s + 1; i++) {
		if (i * i > D) continue;
		int y = round(sqrt(D - i * i));
		if (i * i + y * y == D) v.push_back(DD { i, y }), v.push_back(DD { i, -y });
	}
}

void dfs(bool dd[MAXN][MAXN], const vector<DD> &e, int i, int j, int c) {
	dd[i][j] = c, vis[i][j] = 1;
	for (const DD &d : e) if (i + d.x >= 0 && i + d.x < 2 * n && j + d.y < 2 * n && j + d.y >= 0)
		if (!vis[i + d.x][j + d.y]) dfs(dd, e, i + d.x, j + d.y, !c);
}

int main() {
	scanf("%d%d%d", &n, &D1, &D2);
	g_edge(e1, D1);
	g_edge(e2, D2);
	memset(vis, 0, sizeof(vis));
	for (int i = 0; i < 2 * n; i++)
	for (int j = 0; j < 2 * n; j++) if (!vis[i][j]) dfs(d1, e1, i, j, 0);
	memset(vis, 0, sizeof(vis));
	for (int i = 0; i < 2 * n; i++)
	for (int j = 0; j < 2 * n; j++) if (!vis[i][j]) dfs(d2, e2, i, j, 0);
	int c[4] = { 0, 0, 0, 0 };
	for (int i = 0; i < 2 * n; i++)
	for (int j = 0; j < 2 * n; j++)
		++c[d1[i][j] << 1 | d2[i][j]];
	int d = 0, e = n * n;
	for (int i = 0; i < 4; i++) if (c[i] >= n * n) { d = i; break; }
	for (int i = 0; i < 2 * n; i++)
	for (int j = 0; j < 2 * n; j++) if (d1[i][j] == d >> 1 && d2[i][j] == (d & 1)) {
		printf("%d %d\n", i, j);
		if (--e == 0) return 0;
	}
	return 0;
}

Measured memory_bytes: 30080
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;

/**
 * Amida, the City of Miracle
 */
public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		while ((line = br.readLine()) != null && !line.isEmpty()) {
			StringTokenizer st = new StringTokenizer(line);
			int n = parseInt(st.nextToken()); // ???????????¬??°
			int m = parseInt(st.nextToken()); // ?¨?????????¬??°
			int a = parseInt(st.nextToken()); // ????????????????????????

			if ((n | m | a) == 0) break;

			int[][] amida = new int[n + 1][1001];
			int top = 0;

			for (int i = 0; i < m; i++) {
				line = br.readLine();
				st = new StringTokenizer(line);
				int h = parseInt(st.nextToken());
				int p = parseInt(st.nextToken());
				int q = parseInt(st.nextToken());
				amida[p][h] = q;
				amida[q][h] = p;
				if (h > top) top = h;
			}

			int b = a;
			for (int i = top; i >= 1; i--) {
				if (amida[b][i] > 0) b = amida[b][i];
			}
			System.out.println(b);
		} // end while
	} // end main
}

Measured memory_bytes: 49512
//To leave a good impact on people I meet and places I go
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define FIO  ios_base::sync_with_stdio(0);cin.tie(0)
#define f(i, n) for(int i = 0; i < n; i++)

signed main()
{
	FIO;
	int T;
	T=1;
	while(T--)
	{
		int n, a, b;
		cin>>n;
		vector<int> v(n, 0);
		f(i, n) cin>>v[i];
		int ans = 0;
		f(i, n)
		{
			for(int j = i+1; j < n; j++)
			{
				for(int k = j+1; k < n; k++)
				{
					if(v[i]==v[j] || v[j]==v[k] || v[i]==v[k]) continue;
					if(v[i]+v[j] > v[k] && v[i] + v[k] > v[j] && v[j] + v[k] > v[i])
					{
						ans++;
					}
				}
			}
		}
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#define int long long
using namespace std;
const int N = 5e5 + 5;
const int mod = 998244353;
int fac[N], inv[N], n, m, ans;
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') {x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar();}
	return x * f;
}
int ksm(int x, int y)
{
	int res = 1;
	for(; y; y >>= 1, x = x * x % mod)
		if(y & 1) res = res * x % mod;
	return res;
}
void init(int n)
{
	fac[0] = 1;
	for(int i = 1; i <= n; i ++) fac[i] = fac[i - 1] * i % mod;
	inv[n] = ksm(fac[n], mod - 2);
	for(int i = n - 1; i >= 0; i --) inv[i] = inv[i + 1] * (i + 1) % mod;
}
int C(int n, int m)
{
	if(n < m || n < 0 || m < 0) return 0;
	return fac[n] * inv[m] % mod * inv[n - m] % mod;
}
signed main()
{
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
	n = read(); m = read(); init(max(n, m));
	for(int k = 0; k <= min(n, m); k ++)
	{
		int res = C(n, k) * C(m, k) % mod * fac[k] % mod * ksm(m + 1, n - k) % mod * ksm(n + 1, m - k) % mod;
		if(k & 1) ans = (ans - res + mod) % mod;
		else ans = (ans + res) % mod;
	}
	printf("%lld\n", ans);
	fclose(stdin);
	fclose(stdout);
	return 0;
}


Measured memory_bytes: 8064
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 

    int x = sc.nextInt();
    int y = sc.nextInt();
    boolean check = false;
    for(int i = 0; i <= x; i++){
      if(2 * i + 4 * (x - i) == y){
        check = true;
        break;
      }
    }    

    if(check){
      System.out.println("Yes");
    }else{
      System.out.println("No");
    }
 
  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}

Measured memory_bytes: 25344
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  Int k,n;
  cin>>k>>n;
  if(k%2==0){
    cout<<k/2;
    for(Int i=1;i<n;i++) cout<<" "<<k;
    cout<<endl;
    return 0;
  }
  vector<Int> ans(n,(k+1)/2);
  for(Int i=0;i<n/2;i++){
    if(ans.back()==1) ans.pop_back();
    else{
      ans.back()--;
      while((Int)ans.size()<n) ans.emplace_back(k);
    }
  }
  for(Int i=0;i<(Int)ans.size();i++){
    if(i) cout<<" ";
    cout<<ans[i];
  }
  cout<<endl;
  return 0;
}


Measured memory_bytes: 4608
import java.util.*;
    public class Main {
    	public static void main(String[] args){
    	int[] a=new int[100000];
    		Scanner sc = new Scanner(System.in);
    		
    		  int b = sc.nextInt();
    		  int c = sc.nextInt();
    		  
    	   for(int i=0;i<c;i++){
    	   
    	      a[i]=sc.nextInt();
    	      b-=a[i];
    	   }
    
    	         if(b>0){
    	         
    	         System.out.println("No");
    	         } else{
    	         System.out.println("Yes");
    	         }
    	       
    	}
    }

Measured memory_bytes: 48888
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int		main(void)
{
	char c;
	cin >> c;
	cout << (char)(c + 1) << endl;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			int l = sc.nextInt();
			int K = sc.nextInt();
			int a = sc.nextInt();
			int h = sc.nextInt();
			if(n == 0)break;
			int[] list = new int[l+2];
			
			for(int i = 0; i < l; i++) {
				list[i] = sc.nextInt();
			}
			list[l] = a;
			list[l+1] = h;
			int[][] d = new int[n][n];
			for(int i = 0; i < n; i++) {
				Arrays.fill(d[i], 2 << 27);
			}
			for(int i = 0; i < K; i++) {
				int x = sc.nextInt();
				int y = sc.nextInt();
				int t = sc.nextInt();
				d[x][y] = t;
				d[y][x] = t;
			}
			
			int[][] newd = new int[l+2][l+2];
			for(int i = 0; i < l+2; i++) {
				Arrays.fill(newd[i], 2 << 27);
			}
			
			for(int k = 0; k < n; k++) {
				for(int i = 0; i < n; i++) {
					for(int j = 0; j < n; j++) {
						d[i][j] = Math.min(d[i][j], d[i][k] + d[k][j]);
					}
				}
			}
			
			for(int i = 0; i < l+2; i++) {
				for(int j = 0; j < l+2; j++) {
					if(d[list[i]][list[j]] <= m)
					newd[i][j] = d[list[i]][list[j]];
				}
			}
			
			
			
			
			for(int k = 0; k < l+2; k++) {
				for(int i = 0; i < l+2; i++) {
					for(int j = 0; j < l+2; j++) {
						//if(d[list[i]][list[k]] + d[list[k]][list[j]] <= m)
						newd[i][j] = Math.min(newd[i][j], newd[i][k] + newd[k][j]);
					}
				}
			}
			
			int result = newd[l][l+1];
			if(result > m && result != 2 << 27) {
				result += (result -m);
			}
			if(result == 2 << 27) {
				System.out.println("Help!");
			}
			else 
			System.out.println(result);
		}
		
		
		
		
		
	}
}                  

Measured memory_bytes: 95312
#include <iostream>

using namespace std;

int main()	{
  	int n, k, x, y;
  	long long amount = 0;
  	cin >> n >> k >> x >> y;
  	if (n <= k)
      	amount = (n * x);
  	else
  		amount = (k * x) + ((n - k) * y);
  	cout << amount << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    int N, H, W;
    scanf("%d %d %d", &N, &H, &W);
    int a[N], b[N];
    for(int i=0; i<N; i++){
        scanf("%d %d", &a[i], &b[i]);
    }
    int cnt = 0;
    for(int j=0; j<N; j++){
        if(a[j]>=H && b[j]>=W)
            cnt++;
    }
    printf("%d", cnt);
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++) cin >> v[i];
    sort(v.begin(), v.end());
    int m = n/2;
    int a, b;
    a = v[m-1];
    b = v[m];
    cout << b - a << endl;
    //cout << a << " " << b << endl;
    return 0;

}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
  int a,b,c,d;
  cin >> a >> b >>c;
  if(a >b){
    d=a;
    a=b;
    b=d;
  }
  if(b > c){
    d=b;
    b=c;
    c=d;
  }
if( a > b){
    d=a;
    a=b;
    b=d;
  }
 cout << a <<" "<< b<<" " << c << "\n";
 return 0;
}

Measured memory_bytes: 1164
#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;

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

    cout << max(0, C - (A-B)) << endl;

    return 0;
}

Measured memory_bytes: 256
n,x=map(int,raw_input().split())
if x in [1,2*n-1]:print 'No'
else:
    print 'Yes'
    if x<=n:
        for i in range(x+n,2*n):print i
        for i in range(1,x+n):print i
    else:
        for i in range(x-n+1,2*n):print i
        for i in range(1,x-n+1):print i


Measured memory_bytes: 24860
def gcd(a,b):
  while b:
    a, b = b, a%b
  return a

def lcm(a,b):
  return a*b//gcd(a,b)

def g(X):
  return X - X//C - X//D + X//lcm(C,D)

A,B,C,D=map(int, input().split())

ans = g(B) - g(A-1)
print(ans)

Measured memory_bytes: 3060
import numba

@numba.njit
def main(N):
    dp = [1] * (N+1)
    for i in range(2, N+1):
        k = 1
        while i * k <= N:
            dp[i*k] += 1
            k += 1
    ans = 0
    for i in range(1, N+1):
        ans += i * dp[i]
    return ans

N = int(input())
print(main(N))


Measured memory_bytes: 188276