akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vb vector<bool>
#define vi vector<int>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
#define mx 100001
using namespace std;
ll mi(ll n,ll m){ll pw=n%m;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans%mod;}
ll pw(ll a,ll n){ll pw=a%mod;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw%mod;pw = pw*pw%mod;ex>>=1;}return ans%mod;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
void show(ll x){cout<<x<<" ";}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define mkp make_pair
//#define d double
void solve(){
	int n,W;
	cin>>n>>W;
	vi w(n),v(n);
	rep(i,0,n) cin>>w[i]>>v[i];
	ll M=0;
  	for(int i=0;i<n;i++) M+=v[i];
	vl dp(M+1,INT_MAX);
	//dp[i]->min capacity of knapsack required to get the value i....
	dp[0]=0;
	for(int i=0;i<n;i++){
		for(int j=M;j>=v[i];j--){
			dp[j]=min(dp[j],w[i]+dp[j-v[i]]);
		}
	}
	ll ans=0;
	for(int i=0;i<=M;i++){
		if(dp[i]<=W) ans=max(ans,(ll)i);
	}
	cout<<ans;
	
}
int32_t main(){
int t=1;
//cin>>t;
while(t--){
	solve();
}
 
}

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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

#define BE(x) x.begin(), x.end()

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	int n;
	vector<int> v[26];

	cin >> n;
	string in;
	for(int i = 0; i < n; i++){
		cin >> in;
		int many[26] = {};
		for(int j = 0; j < (int)in.size(); j++)
			many[in[j]-'a']++;
		for(int j = 0; j < 26; j++)
			v[j].push_back(many[j]);
	}


	for(int i = 0; i < 26; i++){
		sort(BE(v[i]));
		cout << string(v[i][0], 'a'+i);
	}

	cout << endl;

	return 0;
}

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

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

#define INF LONG_MAX
#define MOD 1000000007
#define rng(a) a.begin(),a.end()
#define rrng(a) a.end(),a.begin()

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

  int N;
  cin>>N;
  vector<int>C(N-1),S(N-1),F(N-1);
  for(int i=0;i<N-1;i++)cin>>C[i]>>S[i]>>F[i];
  for(int i=0;i<N;i++){
    int ans=0;
    for(int now=i;now<N-1;now++){
      if(ans<S[now])ans=S[now];
      while(ans%F[now])ans++;
      ans+=C[now];
    }
    cout<<ans<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int segtree[100000];

int main() {
	int n, m;	cin >> n >> m;
	for (int i = 0; i < n; i++)	segtree[i + n - 1] = i;
	vector<int> a(m);
	for (int i = 0; i < m; i++) {
		cin >> a[i];
		segtree[a[i] + n - 1] = -1;
	}
	int ret = 0;
	for (int i = n - 2; i >= 0; i--) {
		if (segtree[2 * i + 1] == -1 && segtree[2 * i + 2] == -1)	segtree[i] = -1;
		else if (segtree[2 * i + 1] == -1)	segtree[i] = segtree[2 * i + 2];
		else if (segtree[2 * i + 2] == -1)	segtree[i] = segtree[2 * i + 1];
		else {
			ret++;
			segtree[i] = segtree[2 * i + 1];
		}
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 3096
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;

#define REP(i, a, b) for(int i = (a); i < int(b); ++i)
#define rep(i, n) REP(i, 0, n)
#define ALL(x) begin(x), end(x)

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

	constexpr int NUM = 128;
	constexpr int WIDTH = 72;

	string line;
	while(getline(cin, line)) {
		string text = "";
		do {
			text += line;
		} while(getline(cin, line) && !line.empty());

		if(text.empty()) break;

		string keywords;
		getline(cin, keywords);
		cin.ignore();

		const int n = text.size();
		const int m = keywords.size();
		vector<int> idx(NUM, -1);

		rep(i, m) {
			idx[keywords[i]] = i;
		}

		int number_of_answer = 0;
		int shortest = n;
		pair<int, int> first_answer;
		vector<int> last(m, -1);

		rep(i, n) {
			if(idx[text[i]] != -1) {
				last[idx[text[i]]] = i;
				const int start = *min_element(ALL(last));

				if(start != -1) {
					const int len = i - start;
					if(len < shortest) {
						shortest = len;
						number_of_answer = 1;
						first_answer = make_pair(start, i + 1);
					}
					else if(len == shortest) {
						++number_of_answer;
					}
				}
			}
		}

		cout << number_of_answer << endl << endl;

		if(number_of_answer == 0) continue;

		for(int i = first_answer.first; i < first_answer.second; i += WIDTH) {
			cout << text.substr(i, min(first_answer.second - i, WIDTH)) << endl;
		}
		cout << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1708
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;

typedef struct{
	int f;
	int a;
	int t;
	int x;
	int y;
}Data;
	
int getDist2(int x1, int y1, int x2, int y2){
	return (x2-x1)*(x2-x1) + (y2-y1)*(y2-y1);
}
	
int main(){
	int n;
	Data d[100];
		
	//input
	cin >> n;
	for(int i=0; i<n; ++i) scanf(" %d %d %d %d %d", &d[i].f, &d[i].a, &d[i].t, &d[i].x, &d[i].y); 	

	//solve
	int dist[2];
	int fr[2];
	
	dist[0]=dist[1]=-1;	
	fr[0]=fr[1]=400000;
	
	for(int i=0; i<n-1; ++i){
		//????????????????????§?????????????§???????????????§?????????
		if(d[i].t != d[i+1].t) continue;
		//????????????????£????????????§?????????
		if(d[i].a == d[i+1].a) continue;
	
		int tmp = getDist2(d[i].x, d[i].y, d[i+1].x, d[i+1].y);
		
		//?¨??????´??°
		if(tmp>dist[d[i].t] || (tmp==dist[d[i].t] && fr[d[i].t]>d[i+1].f-d[i].f)){
			dist[d[i].t] = tmp;
			fr[d[i].t] = d[i+1].f-d[i].f;	
		}
	
	}
		
	//output
	if(dist[0]==-1) printf("-1 -1\n");
	else printf("%.10lf %.10lf\n", sqrt(dist[0]), (double)fr[0]/60);
	
	if(dist[1]==-1) printf("-1 -1\n");
	else printf("%.10lf %.10lf\n", sqrt(dist[1]), (double)fr[1]/60);
}

Measured memory_bytes: 1268
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <numeric>
#include <math.h>
#include <algorithm>
#include <functional>
#include <string>
#include <array>
#include <vector>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#include <complex>
#include <bitset>
#define full(c) c.begin(), c.end()
#define vector2d(name,type,h,w,init) vector<vector<type>> name(h,vector<type>(w,init)) 
const int PRIME = 1000000007;
const int INT_INF = 2147483647;
const long long int LL_INF = 9223372036854775807;
const double PI = acos(-1);
const double EPS = 0.000000001;
typedef unsigned long long int ull;
typedef long long int ll;
using namespace std;

int main() {
	//ios_base::sync_with_stdio(false);
	//cin.tie(NULL);
	int k, i, n, m, cnt = 0;
	cin >> n >> m;
	vector<int> a(m);
	vector<int> b(m);
	for (i = 0; i < m; i++) {
		cin >> a[i] >> b[i];
		a[i]--;
		b[i]--;
	}
	for (k = 0; k < m; k++) {
		queue<int> bfs;
		vector<int> flag(n, false);
		vector<vector<int>> adj(n);
		for (i = 0; i < m; i++) {
			if (i != k) {
				adj[a[i]].push_back(b[i]);
				adj[b[i]].push_back(a[i]);
			}
		}
		bfs.push(0);
		flag[0] = true;
		while (!bfs.empty()) {
			int current = bfs.front();
			bfs.pop();
			for (int next : adj[current]) {
				if (flag[next] == false) {
					bfs.push(next);
					flag[next] = true;
				}
			}
		}
		for (i = 0; i < n; i++) {
			if (flag[i] == false) break;
		}
		if (i < n) cnt++;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
#define des_priority_queue priority_queue<int, vector<int>, greater<int> >
#define all(v) (v).begin(), (v).end()
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

const int MAX_V = 1e5;
vector<int> G[MAX_V];
int N, M;
int color[MAX_V];

bool dfs(int v, int c) {
	color[v] = c;
	rep(i, 0, G[v].size()) {
		if(color[G[v][i]] == c) return false;
		if(color[G[v][i]] == 0 and !dfs(G[v][i], -c)) return false;
	}
	return true;
}


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

	cin >> N >> M;
	rep(i, 0, M) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	rep(i, 0, N) {
		if(color[i] == 0) {
			if(!dfs(i, 1)) {
				/* 二部グラフではない */
				cout << 1LL * N * (N - 1) / 2 - M << endl;
				return 0;
			}
		}
	}

	ll red = 0, blue = 0;
	rep(i, 0, N) {
		if(color[i] == 1) red++;
		else if(color[i] == -1) blue++;
	}

	cout << 1LL * red * blue - M << endl;
	return 0;


	

}


Measured memory_bytes: 6528
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define ll long long
#define ull unsigned long long
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define FOR(i,start,stop)  for(int i=(start); i < (stop); i++)
#define FORD(i,start,stop) for(int i=(start); i >= (stop); i--)
#define RIP(i,stop) FOR(i,0,stop)
#define PI 3.141592653589793
#define PRECISION(c,f) fixed << setprecision(c) << f
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N;
  cin >> N;
  int D1,D2;

  int flag=0;
  RIP(i,N){
    cin >> D1 >> D2;
    if(D1 == D2) flag++;
    else flag=0;
    if(flag == 3) break;
  }

  if(flag == 3) yes;
  else no;

  return 0;
}


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

int main(){
    long long N,a,b,minB=1000000000,sum=0,i;
    cin >> N;
    for(i=0; i<N; i++){
        cin >> a >> b;
        sum+=a;
        if(a>b && minB>b)
        minB=b;
    }
    if(minB==1000000000)
    cout << 0 << endl;
    else
    cout << sum-minB << endl;
    return 0;
}

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

typedef long long ll;

int main(){
  ll a,b,c,d,n;
  cin >> a >> b >> c >> d >> n;
  n*=4;
  ll ans=0;
  ans+=(n/8)*min({8*a,4*b,2*c,d});
  n%=8;
  ans+=(n/4)*min({4*a,2*b,c});
  n%=4;
  ans+=(n/2)*min(2*a,b);
  n%=2;
  ans+=n*a;
  cout << ans << endl;
}

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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

ll gcd(ll a, ll b) { for (; b; a %= b, swap(a, b)); return a; }

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

	ll a, b, c; cin >> a >> b >> c;
	ll k; cin >> k;

	ll ans = 0;
	ans += min(a, k);

	k -= min(a, k);
	k -= min(b, k);

	ans -= min(c, k);
	cout << ans;
}

Measured memory_bytes: 3652
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int, int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
struct io { io() { ios::sync_with_stdio(false); cin.tie(0); } };
const int INF = INT_MAX;
const ll LLINF = 1LL << 60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int main(void) {
	string S, T;

	cin >> S >> T;

	string temp = S;

	auto L = T[(int)T.size() - 1];

	auto A = temp + L;

	string s1(S);
	string A1(A);


	if (T == A1) {

		cout << "Yes" << endl;
	}
	else {

		cout << "No" << endl;
	}
	


	return 0;
}

Measured memory_bytes: 3628
<?php
  list($N) = explode(" ", trim(fgets(STDIN)));

  $V = explode(" ", trim(fgets(STDIN)));
  $C = explode(" ", trim(fgets(STDIN)));

  $ans = 0;
  for($i=0; $i<$N; $i++){
    if($V[$i]-$C[$i] > 0){
      $ans+=($V[$i]-$C[$i]);
    }
  }

  echo $ans;

Measured memory_bytes: 4732
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll; //long longをllとして簡略
 
int main(){
  int ans=0;
  vector<int> a(3);
  rep(i,3){
    cin >> a[i];
  }
  //cout << ans <<endl;
  rep(i,10000){
    sort(a.begin(),a.end());//昇順
    //rep(j,3){cout << a[j];}puts("");
    if(a[0]==a[1] && a[1]==a[2]){
      cout << ans <<endl;
      return 0;
    }
    if(a[2]-a[0]>=2){
      a[0] = a[0] + 2;
      ans++;
    }
    else if(a[0]==a[1]){
      a[0]++;
      a[1]++;
      ans++;
    }
    else {a[0] = a[0] + 2;
      ans++;}

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

Measured memory_bytes: 256
(let ((in (parse-integer (read-line))))
  (format t "~A~%"
          (multiple-value-bind (q r)
              (truncate in 11)
            (cond
              ((> r 6) (+ (* q 2) 2))
              ((= r 0) (* q 2))
              (t (1+ (* q 2)))))))

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

int main(){
  int n; cin >> n;
  vector<ll> a(n), b(n);
  for(int i = 0; i < n; i++){
    ll x, y; cin >> x >> y;
    a[i] = x -y; b[i] = x + y;
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  ll ma = a[n-1] - a[0];
  ll mb = b[n-1] - b[0];
  ll ans = max(ma, mb);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6412
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <limits.h>
using namespace std;
typedef pair<int, int> P;
typedef long long ll;
#define INF LLONG_MAX/3
#define inf INT_MAX/3
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	return a / gcd(a, b)*b;
}
int modpow(int a, int b) {
	if (b == 0)return 1;
	if (b == 1)return a % MOD;
	if (b % 2)return modpow(a, b - 1)*a%MOD;
	else return modpow(a, b / 2)*modpow(a, b / 2) % MOD;
}
int comb(int a, int b) {
	if (b == 0 || a == b)return 1;
	if (b == 1)return a % MOD;
	return (comb(a - 1, b - 1) + comb(a - 1, b)) % MOD;
}
// Library End !

int t, h;
int n;
string a, b;
int main() {
	cin >> n;
	rep(i, n) {
		cin >> a >> b;
		if (a < b)h += 3;
		if (b < a)t += 3;
		if (a == b)h++, t++;
	}
	cout << t << " " << h << endl;
	return 0;
}



Measured memory_bytes: 3076
#include <iostream>
#include <iomanip>
using namespace std;
int main(){
    int n,k,a,i;
    double ans=0.0;
    cin >> n >> k;
    for (i=1;i<=n;i++){
        if (i>k)
            ans+=1.0/(double)n;
        else{
            double j=1.0;
            a=i;
            j/=(double)n;
            while (a<k){
                a*=2;
                j/=2;
            }
            ans+=j;
        }
    }
    cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;
import static java.util.stream.Collectors.joining;

class Main {
  final static int k = 10001;
  static int[] C = new int[k];

  public static void main(String... args) {
    Scanner sc = new Scanner(System.in);
    int size = sc.nextInt();
    int current = 0;
    int[] A = new int[size];
    int[] B = new int[size];

    for (int i = 0; i < size; i++) C[A[i] = Integer.parseInt(sc.next())]++;
    for (int i = 1; i < k; i++) C[i] += C[i - 1];
    for (int i = size - 1; i >= 0; i--) B[--C[A[i]]] = A[i];
    System.out.println(Arrays.stream(B).boxed().map(n -> n.toString()).collect(joining(" ")));
  }
}



Measured memory_bytes: 322204
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define rando mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define fi first
#define se second
#define debug(x) cerr << " - " << #x << ": " << x << endl;
#define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl;
#define debugii(x) cerr << " - " << #x << ": " << x.fi<<","<<x.se << endl;
#define sep() cerr << "--------------------" << endl;
#define all(x) (x).begin(),(x).end()
#define sz(x) (ll)x.size()
#define ld long double
#define ll long long
#define int ll
#define ii pair<int,int>
#define v vector<int>
#define vii vector<ii>
#define vv vector<vector<int> >
#define mp make_pair
#define INF 1000000000
#define pb push_back
#define EPS 1e-9
const int MOD = 1000000007; // 998244353
int c[100005];
int32_t main(){
    boost;
    int n,m,x,B=0;
    string a;
    cin>>n>>m;
    set<int> f;
    while(m--){
        cin>>x>>a;
        if(a=="WA"&&f.find(x)==f.end())c[x]++;
        if(a=="AC")f.insert(x);
    }
    int s=0;
    for (int i = 1; i <= n; ++i)
        if(f.find(i)!=f.end())s+=c[i];
    cout<<sz(f)<<" "<<s<<"\n";
    return 0;
}
//long long
//array bounds
//special cases
//binary search

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

using namespace std;

struct TPoint{
  int type;
  int id;
  int l;
  int r;
  int to;
};


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

  int n, m; cin >> n >> m;
  vector<TPoint> queries;

  for(int i = 0; i < n; ++i) {
    int l, r; cin >> l >> r;
    queries.push_back({0, r, l, 0, 0});
  }

  vector<int> ans(m + 1);
  for(int i = 2; i <= m; ++i) {
    for(int p = 0; p <= m; p += i) {
      queries.push_back({1, p + i - 1, p, p + i - 1, i});
      queries.push_back({-1, p, p, p + i - 1, i});


    }
  }


  sort(queries.begin(), queries.end(), [&](TPoint u, TPoint v){
    return make_pair(u.id, abs(u.type)) < make_pair(v.id, abs(v.type));
  });

  vector<int> bit(m + m + 5, 0);

  for(auto &q : queries) {
    if(q.type == 0) {
      for(int x = q.l; x < bit.size(); x += x & -x) bit[x]++;
    }
    else {
      for(int x = q.r; x > 0; x -= x & -x) ans[q.to] += q.type * bit[x];
      for(int x = q.l; x > 0; x -= x & -x) ans[q.to] -= q.type * bit[x];
    }
  }

  for(int i = 1; i <= m; ++i) cout << n - ans[i] << "\n";

  return 0;
}


Measured memory_bytes: 84192
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
  cin>>s;
  //cout<<s<<'\n';
  int len=0,currlen,maxlen=0;
   for(int j=1;j<s.length()-1;j++){
     currlen=0;
     for(int i=0,k=j;i<s.length()-1 && k<s.length()-1 && i<j;i++,k++){
     	if(s[i]==s[k])currlen+=1;
       else break;
     }
     //if(currlen > maxlen )cout<<j<<' '<<currlen<<'\n';
     if(j==currlen)maxlen = max(maxlen,currlen);
    }
  cout<<maxlen*2;

}

Measured memory_bytes: 256
class InputLine
  def self.to_s
    gets.chomp
  end

  def self.to_i
    InputLine.to_s.to_i
  end
  
  def self.to_f
    InputLine.to_s.to_f
  end

  def self.to_sa
    InputLine.to_s.split(' ')
  end

  def self.to_ia
    InputLine.to_sa.map(&:to_i)
  end
  
  def self.to_fa
    InputLine.to_sa.map(&:to_f)
  end
end

def main(argv)
  n = InputLine.to_i

  s = 0
  (1..n).each do |a|
    s += n / a
    s -= 1 if n % a == 0
  end

  puts s.to_s
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 14304
#include <bits/stdc++.h>
using namespace std;
string N;
 
int main(){
    cin >> N;
    int count=0;
    for(int i=0;i<N.length();i++)
        if(N[i] == '7'){
            count++;
        }
    if(count > 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3632
require 'matrix'
loop do
  s = gets.chomp.chop
  break if s == ''
 
  #lookahead(?!  )
  s.gsub!(/([A-Z\)])(?![a-z\d])/, '\11')
  s.gsub!(/([A-Z][a-z])(?!\d)/, '\11')
  s.gsub!(/\((.+?)\)(\d*)/){
    as, n = $1, $2
    as.gsub(/([a-zA-Z])(\d+)/){"#{$1}#{$2.to_i * n.to_i}"}
  }
  atoms = s.scan(/[A-Z][a-z]?/).uniq
  l = s.split('->')[0].count('+') + 1
  molecules = s.split(/\->|\+/)
  m = molecules.size - 1
  n = atoms.size
 
  a = Matrix.build(n, m){|y, x|
    sum = 0
    molecules[x].scan(/#{atoms[y]}(\d+)/).each{ |a|
      x < l ? sum += a[0].to_i : sum -= a[0].to_i
    }
    sum.to_r
  }.to_a
 
  b = [0] * n
  atoms.each do |atom|
    molecules[-1].scan(/(#{atom})(\d+)/).each{ |a, k|
      b[atoms.index(a)] = k.to_r
    }
  end
 
  # Gauss-Jordan elimination
  (0...m).each do |i|
    pv = (i...n).max{|k| a[k][i].abs}
    a[i], a[pv] = a[pv], a[i]
    b[i], b[pv] = b[pv], b[i]
    (0...n).each do |j|
      next if i == j
      r = a[j][i] / a[i][i]
      (i...m).each do |k|
        a[j][k] -= r * a[i][k]
      end
      b[j] -= r * b[i]
    end
  end
 
  ans = (Matrix[*a[0,m]].inv * Vector[*b[0,m]]).to_a + [1.to_r]
  lcm = ans.map(&:denominator).reduce(&:lcm)
  puts ans.map{|x| (x * lcm).to_i} * ' '
end

Measured memory_bytes: 10056
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

LL calc(LL r,LL x,LL D){
    LL y = r*x - D;
    return y;
}


int main(){
    LL r,D,x;cin >> r >> D >> x;
    rep(i,10){
        x = calc(r,x,D);
        cout << x << endl;
    }
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int a[102];
int main()
{
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    int num=0;
    for (int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    sort(a+1,a+1+n);
    for (int i=1;i<=n-2;i++)
    {
        for (int j=i+1;j<=n-1;j++)
        {
            for (int k=j+1;k<=n;k++)
            {
                if (a[i]+a[j]>a[k]&&a[i]!=a[j]&&a[i]!=a[k]&&a[j]!=a[k])
                    num++;
            }
        }
    }
    cout<<num<<endl;
    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
#include<algorithm>
 
using namespace std;
 
 
 
int main()
{
    unsigned long long a;
    cin >> a;
    int output = 0;
    if (a == 1) {
        cout << 0;
        return 0;
    }
    unsigned long long b;
    b = sqrt(a);
    for (int i = 2; i <= b; i++) {
        if (a % i == 0) {
            int count = 1;
            while (a != 1) {
                bool right = true;
                for (int j = 0; j < count; j++) {
                    if (a % i == 0) {
                        a = a / i;
                    }
                    else {
                        right = false;
                        break;
                    }
                }
                if (right) {
                    output++;
                }
                else {
                    break;
                }
                count++;
            }
        }
        if (a == 1) {
            break;
        }
    }
    if (a != 1)output++;
    cout << output;
 
 
    return 0;
}

Measured memory_bytes: 3188
# https://atcoder.jp/contests/abc128/tasks/abc128_c
# なんかかすかに解いた記憶あるな？

# load data
N, M = list(map(int, input().split()))
S = []
for _ in range(M):
    S.append(list(map(int, input().split()))[1:])
P = list(map(int, input().split()))


def is_on(i, S, p):
    # bit表現 i のときSのスイッチの個数とpでonか返す
    cnt = 0
    for j in S:
        if (i >> (j - 1)) % 2:  # j番目のスイッチオン
            cnt += 1
    return cnt % 2 == p


ans = 0
# bit 全探索
for i in range(1 << N):  # N桁のbit全探索
    # 以下iの全パターンについて
    flg = True
    for s, p in zip(S, P):
        flg *= is_on(i, s, p)
    ans += flg
print(ans)


Measured memory_bytes: 3064
import java.util.*;
public class Main { 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String o="No";
        int x=sc.nextInt();
        int y=sc.nextInt();
        if(y%2==0&&2*x<=y&&y<=4*x)o="Yes";
      System.out.println(o);
    }
    
}

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

int D[] = {1,1,1,1,1,1,1,1,1,1};

bool only_use_int (int n) {
	while (n!=0) {
		int tmp = n%10;
		if (D[tmp]==0)
			return false;
		n /= 10;
	}
	return true;
}
int main () {
	int N, K;
	cin >> N >> K;
	for (int i=0; i<K; i++) {
		int tmp;
		cin >> tmp;
		D[tmp] = 0;
	}
	for (;;N++) {
		if (only_use_int (N)) {
			cout << N << endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
// Ver19.02
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define INF 1 << 29
#define LLINF 4545454545454545454
#define MOD 1000000007
#define ll long long
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
int upll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? -1 : *(ll *)a > *(ll *)b ? 1 : 0; }
int downll(const void *a, const void *b) { return *(ll *)a < *(ll *)b ? 1 : *(ll *)a > *(ll *)b ? -1 : 0; }
void sortup(ll *a, int n) { qsort(a, n, sizeof(ll), upll); }
void sortdown(ll *a, int n) { qsort(a, n, sizeof(ll), downll); }

int main()
{
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  if (b - a == c - b)
    puts("YES");
  else
    puts("NO");
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEL 2e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template <class T>
inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template <class T>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}

//困ったら全探索
//全探索をしろ
//範囲を絞ればACするはずだ

inline double a(int i, int k){
    int count = 0;
    while (i<k){
        i *= 2;
        count++;
    }
    int possi = pow(2, count);
    return 1.0 / possi;
}

int main(){
    int k,n;
    cin >> n >> k;
    double sum = 0;
    for (int i = 1; i <= n; i++) sum += a(i, k);
    sum /= n;
    cout << fixed << setprecision(13) << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <complex>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <stack> 
#include <bitset>
#include <queue>
#include <assert.h>
using namespace std;

int main() {
	long long a, b;
	long long c, d;
	long long t;
	cin >> a >> b;
	cin >> c >> d;
	cin >> t;
	long long x = a - b * t;
	long long y = a + b * t;
	long long xx = c - d * t;
	long long yy = c + d * t;
	if (x <= xx && y >= yy) printf("YES\n");
	else printf("NO\n");
	return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b){return (a*b)/gcd(a, b);}
#define zzz ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
int main()
{
    zzz;
    int n;
    cin>>n; vector<int> a(n); for(int i=0;i<n;++i) cin>>a[i];
    double ans = 0;
    for(int i=0;i<n;++i)
    {
        ans = ans + 1.0/(double)(a[i]);
    }
    cout<< 1.0/ans;
}


Measured memory_bytes: 256
//agc005_b.cpp
//Sat Jan 26 14:50:17 2019

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

	ll a[n];
	set<int> s;
	ll pos[n+1];pos[0] = -1;
	for (int i=0;i<n;i++){
		cin >> a[i];
//		s.insert(i);
		pos[a[i]] = i;
	}

	s.insert(n);
	s.insert(-1);
	ll ans = 0;
	for (int i=1;i<=n;i++){
		auto it = s.lower_bound(pos[i]);
		ll right = (*it)-pos[i];
//		cout << i << "\t" << *it;
		it--;
		ll left = pos[i]-(*it);
//		cout << "\t" << *it << endl;
		s.insert(pos[i]);
		ans += i*right*left;
	}


	cout << ans << endl;
}

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

#define ll long long
#define ar array
 
using namespace std;


int main() {
	
	int r;
	double a,b,c,aux;
	
	cin >> a >> b >> c;
	
	aux = c + 0.5;
	
	r = aux/a;
	if(c<(a-0.5)){
		r=0;
	}
	cout << r*b <<endl;
	
	
   	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <vector>

using namespace std;

#define rep(i, n) for (int64_t i = 0; i < (n); i++)
#define irep(i, n) for (int64_t i = 0; i <= (n); i++)
#define rrep(i, n) for (int64_t i = (n)-1; i >= 0; i--)
#define rirep(i, n) for (int64_t i = n; i >= 0; i--)

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

    if (n > m) {
        swap(n, m);
    }

    if (m == 1) {
        cout << 1 << endl;
    } else if (n == 1) {
        cout << m - 2 << endl;
    } else {
        cout << (int64_t)(n - 2) * (m - 2) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
xys = [[tuple(map(int, input().split())) for j in range(int(input()))] \
       for i in range(n)]

C = set()
for i in range(2 ** n):
    flag = True
    for j in range(n):
        if((i >> j) & 1):
            flag &= all((i >> (x-1)) & 1 == y for x, y in xys[j])
    if flag:
        C.add(i)

print(max([sum([int(bit == '1') for bit in str(bin(c))]) for c in C]))

Measured memory_bytes: 6280
#pragma region Macros
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;
#pragma endregion
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	string str;
	cin >> str;

	rep(i, sz(str)) cout << 'x';

	cout << '\n';


	return 0;
}


Measured memory_bytes: 256
//2019年12月8日現在

#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>
#include <cstdio>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }

namespace {
    // printElms(&a[0], a[n]);　みたいな感じで使う。
    void printElems(const int* begin, const int* end)
    {
        for (const int* p = begin; p != end; ++p) {
            std::cout << *p << ' ';
        }
        std::cout << std::endl;
    }
}

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define FOR(i,j,n) for(int i=j; i < n; i++)
#define souatari rep1(i,n-1)rep(j,i)
#define souatari1 for(int i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef array<int,3> arr3;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
const ll BIG = 10000000000000000;


int main(){
    ll n,d,a;
    cin >> n >> d >> a;
    priority_queue<pll, vector<pll>, greater<pll>> mons;
    rep(i,n){
        ll atmp,btmp;
        cin >> atmp >> btmp;
        mons.push(mp(atmp,btmp));
    }

    ll ans = 0;

    priority_queue<pll, vector<pll>, greater<pll>> bomb;

    ll damage = 0;
    while(!mons.empty()){
        ll bcnt = 0;
        pll monstmp = mons.top();
        mons.pop();


        while(!bomb.empty()){
            pll bombtmp = bomb.top();
            if(bombtmp.F>monstmp.F) break;
            bomb.pop();
            damage-=bombtmp.S;
            // prints("damage-", bombtmp.F, bombtmp.S);
        }
        // prints(damage);
        
        monstmp.S-=damage;
        if(monstmp.S <= 0) continue;
        bcnt = monstmp.S/a;
        if(monstmp.S%a != 0) bcnt++;
        // prints("bcnt monss",bcnt,monstmp.F,damage);
        ans+=bcnt;
        bomb.push(mp(monstmp.F+(2*d)+1,a*bcnt));
        damage+=a*bcnt;
    }
    prints(ans);





    return 0;
}


Measured memory_bytes: 7916
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <bits/stdc++.h>

using std::cerr;
using std::cin;
using std::cout;

using std::abs;
using std::min;
using std::max;
using std::swap;

using std::map;
using std::pair;
using std::set;
using std::string;
using std::vector;

using ll = long long;
using uint = unsigned int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define ff first
#define ss second
#define pb emplace_back
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...);
}
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...) 
#endif

struct init {
    init() {
        cin.tie(0);
        std::iostream::sync_with_stdio(0);
        cout << std::fixed << std::setprecision(10);
        cerr << std::fixed << std::setprecision(5);
        #ifdef LOCAL
        srand(300); 
        #else
        using namespace std::chrono;
        srand(duration_cast<nanoseconds>(high_resolution_clock::now().time_since_epoch()).count()); 
        #endif
    }
    ~init() {
        #ifdef LOCAL
        cerr << "Time elapsed: " << (double)clock() / CLOCKS_PER_SEC << "s.\n";
        #endif
    }
} init;


int main() {
    int a, b, c;
    cin >> a >> b >> c;

    int ans = 123456789;
    for (int i = 0; i < 10000; ++i) {
        if (i < a || i < b || i < c) continue;

        int pot = 0;
        
        int da = (i - a);
        int db = (i - b);
        int dc = (i - c);

        pot += da / 2;
        pot += db / 2;
        pot += dc / 2;

        int sum = 0;
        sum += ((i - a) & 1) + ((i - b) & 1) + ((i - c) & 1);

        if (sum & 1) continue;

        pot += sum / 2;

        dbg(i, pot);

        ans = min(ans, pot);
    }


    cout << ans << '\n';

    return 0;
}


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

  int main(){
 cout << fixed << setprecision(12);
  
  int a, b;
 cin>>a>>b;
 
 cout<< a / b <<" ";
 cout<< a % b <<" ";
 cout<<(double)a / b <<endl;

 return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, ll> pcl;

#define m0(x) memset(x, 0, sizeof(x))
#define all(x) x.begin(), x.end()
#define asort(x) sort(all(x));
#define dsort(x, t) sort(x.begin(), x.end(), greater<t>());
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define MINS(m, s) m.insert(mp(s, 1));
#define MFIN(m, s) m.find(s) != m.end()
#define mp make_pair
#define pb push_back
#define INF (1 << 29)
const int mod = 1000000007;

int main() {
    ll N, M, cnt;
    cnt = 0;
    ll H[100001];
    bool check[100001];
    m0(check);

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

    for(int i = 0; i < M; i++) {
        ll a, b;
        cin >> a >> b;
        a--;
        b--;
        if(H[a] > H[b]) {
            check[b] = true;
        } else if(H[b] > H[a]) {
            check[a] = true;
        } else {
            check[a] = check[b] = true;
        }
    }

    for(int i = 0; i < N; i++) {
        if(check[i] == false) {
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 4504
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
using namespace std;

#define lint long long
#define INF 1000000000000000
#define pii pair<long long,long long>
#define all(x) (x).begin(),(x).end

/* source code below */

int main() {

	int N; cin >> N;
	vector<int> H(N); 
	for (int i = 0; i < N; i++)
	{
		cin >> H[i];
	}
	int count = 0;
	for (int i = 0; i < N; i++)
	{
		bool check = true;
		for (int j = 0; j < i; j++)
		{
			if (!(H[i] >= H[j])) {
				check = false;
			}
		}
		if (check) count++;

	}
	cout << count << endl;
}
/* Don't forget to delete the header! */

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextInt();
        long m = sc.nextInt();

        sc.close();

        long num = n * m;
        long ans = 0;
        if (n == 1 && m == 1) {
            ans = 1;
        } else if (n == 1 || m == 1) {
            ans = num - 2;
        } else {
            ans = num - n * 2 - m * 2 + 4;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
#define str string
#define rep(x,y) for(int i=x;i<y;i++)
#define REP(x,y) for(int j=x;j<y;j++)
#define all(x) x.begin(),x.end()
int main(){
  int N,out=0,safe=0,stack=0,A,B,C;
  str O,E;
  char d='A'-'a';
  cin>>O>>E;
  for(int i=0;i<E.size();i++){
    cout<<O.at(i)<<E.at(i);
    if(i==E.size()-1&&abs(O.size()-E.size()==1))cout<<O.at(O.size()-1);
  }
  cout<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,A[21],ans;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&A[i]);
	for(int i=2;i<n;i++){
		if(A[i]>A[i-1]&&A[i]<A[i+1])ans++;
		if(A[i]<A[i-1]&&A[i]>A[i+1])ans++;
	}
	printf("%d\n",ans);
}

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

int main(){
    int N; cin >> N;
    vector<int> A(N), B(N);
    vector<pair<int,int>> P(N);
    rep(i, 0, N) cin >> A[i];

    rep(i, 0, N) P[i] = {A[i], i};

    sort(P.begin(), P.end());
    rep(i, 0, N) B[P[i].second] = i; 

    int ans = 0;
    rep(i, 0, N) if(abs(B[i] - i) % 2 == 1) ans++;

    cout << ans / 2 << endl;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define ll  long long int
#define ull unsigned long long 
#define ff first
#define ss second
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back 
#define mp make_pair
#define inf 1000000000000000
#define mod 1000000007
#define ld long double
#define pll pair<ll,ll>
using namespace std;
int main()
{ 
	fast;
	ll n,k;
	cin>>n>>k;
	ll a[n+1];
	for(ll i=1;i<=n;i++)
	  cin>>a[i];
	ll up[n+1][61];
	memset(up,0,sizeof(up));
	for(ll i=1;i<=n;i++)
	  up[i][0]=a[i];
	for(ll j=1;j<61;j++)
	  for(ll i=1;i<=n;i++)
	    up[i][j]=up[up[i][j-1]][j-1];
	ll strt=1,ct=0;
	for(ll i=60;i>-1;i--)
	  if(ct+(1ULL<<i)<=k)
	    strt=up[strt][i],ct=ct+(1ULL<<i);
	cout<<strt;
	return 0;
}


Measured memory_bytes: 100536
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#define int long long
#define CONTAINS(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define REMOVE(v,a) v.erase(remove(v.begin(), v.end(), a), v.end())
using namespace std;

int N;
vector<int> t[100001];
bool flg[100001];

void func(int a)
{
	int b = 0;
	for (int i = 0; i < t[a].size(); i++)
	{
		int p = t[a][i];
		if (!flg[p])
		{
			if (b == 0)
			{
				b = p;
			}
			else
			{
				return;
			}
		}
	}
	if (b > 0)
	{
		flg[a] = true;
		flg[b] = true;
		for (int j = 0; j < t[b].size(); j++)
		{
			int c = t[b][j];
			if (!flg[c])
			{
				func(c);
			}
		}
	}
}

signed main()
{
	int N;
	cin >> N;
	for (int i = 0; i < N - 1; i++)
	{
		int a, b;
		cin >> a >> b;
		t[a].push_back(b);
		t[b].push_back(a);
	}
	for (int i = 1; i <= N; i++)
	{
		if (t[i].size() == 1)
		{
			func(i);
		}
	}
	for (int i = 1; i <= N; i++)
	{
		if (!flg[i])
		{
			cout << "First" << endl;
			return 0;
		}
	}
	cout << "Second" << endl;
}

Measured memory_bytes: 6400
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n,m;
  cin >> n >> m;
  vector<int> a(m),b(m);
  rep(i,m){
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  vector<pair<bool,int>> p(n,{false,1});
  p[0].first = true;
  rep(i,m){
    if(p[a[i]].first){
      p[b[i]].first = true;
    }
    p[a[i]].second--;
    p[b[i]].second++;
    if(p[a[i]].second==0){
      p[a[i]].first=false;
    }
  }

  int cnt = 0;
  rep(i,n){
    if(p[i].first){
      cnt++;
    }
  }

  cout << cnt << "\n";
  return 0;
}


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

using namespace std;

int main(){
    long N, K;
    cin >> N >> K;
    long ans = 0;
    for(int b=K + 1; b <= N; b++){
        ans += (b - K) * ((N + 1) / b) + max(0l, (N + 1) % b - K);
        if(K == 0) ans--;
    }    
    cout << ans << endl;
    return 0;
}

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

struct Node {
    int value;
    Node *next;
    Node *prev;
};
Node *nil;

void init() {
    nil = new Node();
    nil->next = nil;
    nil->prev = nil;
}

void insert_node(int x) {
    Node *p = new Node;
    p->value = x;

    p->next = nil->next;
    nil->next->prev=p;
    nil->next=p;
    p->prev=nil;
}

Node* search_node(int x) {
    Node *cur = nil->next;
    while(cur != nil && cur->value != x) cur = cur->next;
    return cur;
}

void delete_node(Node *p) {
    if(p == nil) return;
    p->prev->next=p->next;
    p->next->prev=p->prev;
    delete p;
}
void delete_first_node() {
    delete_node(nil->next);
}
void delete_last_node() {
    delete_node(nil->prev);
}
void delete_key_node(int x) {
    delete_node(search_node(x));
}

int main() {
    ios::sync_with_stdio(false);
    init();
    int n;
    string q;
    cin>>n;
    while(n--) {
        int x;
        cin>>q;
        if(q=="insert") {
            cin>>x;
            insert_node(x);
        }
        else if(q=="delete") {
            cin>>x;
            delete_key_node(x);
        }
        else if(q=="deleteFirst") {
            delete_first_node();
        }
        else if(q=="deleteLast") {
            delete_last_node();
        }
    }
    int t=0;
    Node *cur = nil->next;
    while(cur != nil) {
        if(t++) cout<<" ";
        cout<<cur->value;
        cur=cur->next;
    }
    cout<<endl;
    
    return 0;
}

Measured memory_bytes: 32472
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
#define INF 10e10

using namespace std;

//  #define y cout << "yes"<< endl
  #define Y cout << "YES" << endl
  #define y cout << "Yes" << endl
//  #define n cout << "no"<< endl
  #define N cout << "NO" << endl
  #define n cout << "No" << endl
  #define pu(q) cout << q ;
  #define put(q) cout << q << " ";
  #define puts(q) cout << q << endl;
  
  
//	int a,b,c,d,e,f,g,h,ans,res;
//	char a,b,c,d,e,f,g,h,ans,res;
	string a,b,c,d,e,f,g,h,ans,res;
//	double a,b,c,d,e,f,g,h,ans,res;
	
void take(int x);
  
int main(void){
	take(2);//数
	int ans=0;
	if(a[0]==b[0])ans++;
	if(a[1]==b[1])ans++;
	if(a[2]==b[2])ans++;
	puts(ans);
	return 0;
}
void take(int x){
	if(x==1)
		cin >> a;
	else if(x==2)
		cin >> a >> b;
	else if(x==3)
		cin >> a >> b >> c;
	else if(x==4)
		cin >> a >> b >> c >> d;
	else if(x==5)
		cin >> a >> b >> c >> d >> e;
	else if(x==6)
		cin >> a >> b >> c >> d >> e >> f;
	else if(x==7)
		cin >> a >> b >> c >> d >> e >> f >> g;
	else if(x==8)
		cin >> a >> b >> c >> d >> e >> f >> g >> h;
	return ;
}

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

using namespace std;
int gcd(int a, int b)
{
    if(a < b)
        swap(a, b);
    if(b == 0)
        return a;
    else
        return gcd(b, a % b);
}
int main()
{
    int n;
    cin >> n;
    vector <int> arr(n);
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    vector <int> temp1(n + 1);
    vector <int> temp2(n + 2);
    for(int i = 0; i < n; i++)
        temp1[i + 1] = gcd(temp1[i], arr[i]);
    for(int i = n - 1; i >= 0; i--)
        temp2[i] = gcd(temp2[i + 1], arr[i]);
    vector <int> v;
    for(int i = 0; i <= n; i++)
        v.push_back(gcd(temp1[i], temp2[i + 1]));
    sort(v.begin(), v.end(), greater<int>());
    cout << v[0] << endl;
    return 0;
}


Measured memory_bytes: 2044