akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp(a, b) make_pair(a, b)
#define ls (rt << 1)
#define rs (rt << 1 | 1) 
typedef pair<int, int> pii; 
const ll mod = 1e9 + 7;
template <class T> T lowbit(T x){return ((x)&(-(x)));}
const int maxn = 200 + 10;
int n;
int a[maxn][maxn];
ll ans;
int main()
{
	cin >> n;
	for(int i= 1; i <= n; ++i)
		for(int j = 1; j <= n; ++j)
			a[i][j] = __gcd(i, j);
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= n; ++j)
			for(int k = 1; k <= n; ++k)
				ans += a[a[i][j]][k];
	cout << ans << endl;
	return 0;
}

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

using namespace std;
struct color
{
	string str;
	int RGB[3];
};

void solve()
{
	color Color[8];
	Color[0].str = "black";
	Color[0].RGB[0] = 0;	Color[0].RGB[1] = 0;	Color[0].RGB[2] = 0;
	Color[1].str = "blue";
	Color[1].RGB[0] = 0;	Color[1].RGB[1] = 0;	Color[1].RGB[2] = 255;
	Color[2].str = "lime";
	Color[2].RGB[0] = 0;	Color[2].RGB[1] = 255;	Color[2].RGB[2] = 0;
	Color[3].str = "aqua";
	Color[3].RGB[0] = 0;	Color[3].RGB[1] = 255;	Color[3].RGB[2] = 255;
	Color[4].str = "red";
	Color[4].RGB[0] = 255;	Color[4].RGB[1] = 0;	Color[4].RGB[2] = 0;
	Color[5].str = "fuchsia";
	Color[5].RGB[0] = 255;	Color[5].RGB[1] = 0;	Color[5].RGB[2] = 255;
	Color[6].str = "yellow";
	Color[6].RGB[0] = 255;	Color[6].RGB[1] = 255;	Color[6].RGB[2] = 0;
	Color[7].str = "white";
	Color[7].RGB[0] = 255;	Color[7].RGB[1] = 255;	Color[7].RGB[2] = 255;

	string str;
	while(cin >> str, str[0] != '0')
	{
		int C[3] = {0};
		for(int i = 0; i < 3; ++i)
		{
			if('a' <= str[2 * i + 1] && str[2 * i + 1] <= 'f')
			{
				C[i] += (str[2 * i + 1] - 'a' + 10) * 16;
			}
			else if('0' <= str[2 * i + 1] && str[2 * i + 1] <= '9')
			{
				C[i] += (str[2 * i + 1] - '0') * 16;
			}
		}
		for(int i = 1; i < 4; ++i)
		{
			if('a' <= str[2 * i] && str[2 * i] <= 'f')
			{
				C[i - 1] += str[2 * i] - 'a' + 10;
			}
			else if('0' <= str[2 * i] && str[2 * i] <= '9')
			{
				C[i - 1] += str[2 * i] - '0';
			}
		}
		int index = 0;
		int dist = 0;
		int min = 999999999;
		for(int i = 0; i < 8; ++i)
		{
			dist = (C[0] - Color[i].RGB[0]) * (C[0] - Color[i].RGB[0])
				 + (C[1] - Color[i].RGB[1]) * (C[1] - Color[i].RGB[1])
				 + (C[2] - Color[i].RGB[2]) * (C[2] - Color[i].RGB[2]);
			if(dist < min)
			{
				min = dist;
				index = i;
			}
		}
		cout << Color[index].str << endl;
	}
}

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

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

using namespace std;
using ll = long long;
const double pi = acos(-1);
#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__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
	REP(i, v.size()) { if (i)os << " "; os << v[i]; }return os;
}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
	REP(i, v.size()) { if (i)os << endl; os << v[i]; }return os;
}

const ll INF = 1LL << 60;
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

#define int long long

inline void my_io() {

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	cout << fixed << setprecision(10);

}

signed main() {
	string s;
	ll ans = 0;
	ll m, now;

	cin >> s;

	REP(i, s.size()) {
		m = 0;
		now = i;
		while (now < s.size() && s[now] == 'A' || s[now] == 'C' || s[now] == 'G' || s[now] == 'T') {
			m++;
			now++;
		}
		ans = max(ans, m);
	}

	cout << ans << endl;
}

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

vector<P>dat[1050000];
struct st { int a, b, c; }p[500000];
bool operator<(st a, st b) {
	return P(a.a, a.b) < P(b.a, b.b);
}
void init(int k, int l, int r) {
	if (r - l == 1) {
		dat[k].push_back(P(p[l].b, p[l].c)); return;
	}
	int lb = k * 2 + 1, rb = k * 2 + 2;
	init(lb, l, (l + r) / 2);
	init(rb, (l + r) / 2, r);
	dat[k].resize(r - l);
	merge(dat[lb].begin(), dat[lb].end(), dat[rb].begin(), dat[rb].end(), dat[k].begin());
}
vector<int>query(int a, int b, int c, int d, int k, int l, int r) {
	if (b <= l || r <= a)return vector<int>();
	if (a <= l&&r <= b) {
		int u = upper_bound(dat[k].begin(), dat[k].end(), P(d, INT_MAX)) - dat[k].begin();
		int v = upper_bound(dat[k].begin(), dat[k].end(), P(c, INT_MIN)) - dat[k].begin();
		vector<int>res;
		for (int i = v; i < u; i++)res.push_back(dat[k][i].second);
		return res;
	}
	auto lb = query(a, b, c, d, k * 2 + 1, l, (l + r) / 2);
	auto rb = query(a, b, c, d, k * 2 + 2, (l + r) / 2, r);
	for (int i : rb)lb.push_back(i);
	return lb;
}
int main() {
	int n; scanf("%d", &n);
	rep(i, n)scanf("%d%d", &p[i].a, &p[i].b), p[i].c = i;
	sort(p, p + n);
	init(0, 0, n);
	int q; scanf("%d", &q);
	rep(i, q) {
		int sx, tx, sy, ty; scanf("%d%d%d%d", &sx, &tx, &sy, &ty);
		int a = lower_bound(p, p + n, st{ sx, INT_MIN,0 }) - p;
		int b = lower_bound(p, p + n, st{ tx, INT_MAX,0 }) - p;
		auto res = query(a, b, sy, ty, 0, 0, n);
		sort(res.begin(), res.end());
		for (int j : res)printf("%d\n", j);
		puts("");
	}
}

Measured memory_bytes: 127240
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>

using namespace std;

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

    map<int, int> m;
    bool f = 1;
    for (int i = 0; i < n; ++i)
    {
        int a;
        cin >> a;
        m[a]++;
        if (a != 0)
        {
            f = 0;
        }
    }
    
    if (f)
    {
        cout << "Yes" << endl;
    }
    else
    {
        if (n % 3 != 0)
        {
            cout << "No" << endl;
        }
        else
        {
            if (m.size() == 3)
            {
                int ret = 0;
                for (auto itr = m.begin(); itr != m.end(); ++itr)
                {
                    ret ^= itr->first;
                    if (itr->second != n / 3)
                    {
                        cout << "No" << endl;
                        return 0;
                    }
                }
                if (ret == 0)
                {
                    cout << "Yes" << endl;
                }
                else
                {
                    cout << "No" << endl;
                }
            }
            else if (m.size() == 2)
            {
                if (m[0] == n / 3)
                {
                    cout << "Yes" << endl;
                }
                else
                {
                    cout << "No" << endl;
                }
            }
            else
            {
                cout << "No" << endl;
            }
        }
    }
    
    return 0;
}

Measured memory_bytes: 3840
fun main(args : Array<String>) {
    val (a, b, c) = readLine()!!.split(" ").map { it.toLong() }

    if (c - a - b <= 0) {
        println("No")
        return
    }

    val left = (c - a - b) * (c - a - b)
    val right = 4 * a * b

    println(if (left > right) "Yes" else "No")
}

Measured memory_bytes: 39872
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<ll>;
using vii = vector<vi>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1000000007;
template<class T> void print(const T& t){ cout << t << endl; }
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; }

int main(){
  ll h, w;
  cin >> h >> w;
  vector<string> s(h+2);
  for(ll i=1;i<=h;i++){
    cin >> s[i];
    s[i].pb(0);
  }
  for (ll i = 1; i <= h;i++){
    for (ll j = 0; j < w;j++){
      if(s[i][j]=='.'){
        int num = 0;
        if(s[i][j+1] == '#') num++;
                if(s[i+1][j+1] == '#') num++;
                if(s[i+1][j] == '#') num++;
                if(s[i][j-1] == '#') num++;
                if(s[i+1][j-1] == '#') num++;
                if(s[i-1][j] == '#') num++;
                if(s[i-1][j+1] == '#') num++;
                if(s[i-1][j-1] == '#') num++;
                cout << num;
      }
      else{
        cout << '#';
      }
    }
    cout << endl;
  }
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

N = int(input())

dict = {}
for i in range(N):
    dict[i+1] = int(input())

pushed = set([1])
button_next = dict[1]
while True:
    if button_next == 2:
        print(len(pushed))
        break
    elif button_next not in pushed:
        pushed.add(button_next)
        button_next = dict[button_next]
    else:
        print(-1)
        break

Measured memory_bytes: 22240
#include<stdio.h>
#define sizeH 500000

const int INF = 999999999;

typedef long int lint;

void maxHeap(lint H[], int i, int n){
  lint left,right;
  lint largeVal;
  lint temp;
  
  left = i*2;
  right = i*2+1;

  if(left <= n && H[left] > H[i]){
    largeVal = left;
  }
  else{
    largeVal = i;
  }

  if(right <= n && H[right] > H[largeVal]){
    largeVal = right;
  }

  if(largeVal != i){
    temp = H[i];
    H[i] = H[largeVal];
    H[largeVal] = temp;

    maxHeap(H, largeVal, n);
  }
}

void buildMaxHeap(lint H[], int n){
  int i;
  for(i = n/2;i > 0;i--){
    maxHeap(H, i, n);
  }
}

int main()
{
  int i;
  int n;
  lint key;
  lint H[sizeH*2+1]={};
  
  scanf("%ld",&n);

  for(i = 1;i < n+1;i++){
    scanf("%ld",&key);
    H[i] = key;
  }
  
  buildMaxHeap(H, n);

  for(i = 1; i <= n; i++){
    printf(" %ld",H[i]);
  }
  printf("\n");
  
  return 0;
}



Measured memory_bytes: 9664
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}

struct BIT{
	int N;
	vector<int> bit;
	void init(int n){
		N=n;
		bit.resize(n+1);
		rep(i,n+1) bit[i]=0;
	}
	int sum(int i){		//i個の和a[0]+..a[i-1]
		int s=0;
		while(i>0){
			s+=bit[i];
			i-=(i&-i);
		}
		return s;
	}
	void add(int i,int x){	//a[i]+=x (0-indexed)
		i++;
		while(i<=N){
			bit[i]+=x;
			i+=(i&-i);
		}
	}
}bit;

int N,a[3][100000];
vector<int> as,bs;
bool ac,bc;
bool swapodd(vector<int> vc){
	int n=vc.size();
	bit.init(N);
	long long cnt=0;
	rep(i,n){
		int v=vc[i];
		cnt+=(i-bit.sum(v));
		bit.add(v,1);
	}
	return cnt%2;
}
bool solve(){
	cin>>N;
	rep(j,3) rep(i,N) cin>>a[j][i],a[j][i]--;
	rep(i,N){
		if(a[0][i]/3!=a[1][i]/3 || a[0][i]/3!=a[2][i]/3 || a[1][i]/3!=a[2][i]/3) return 0;
		int q=a[0][i]/3;
		if(a[1][i]%3!=1) return 0;
		bool flip=(a[0][i]%3==2);
		if(i%2==0){
			as.pb(q),ac^=flip;
			if(q%2==1) return 0;
		}else{
			bs.pb(q),bc^=flip;
			if(q%2==0) return 0;
		}
	}
	bool A=swapodd(as),B=swapodd(bs);
	return (A==bc && B==ac);
}
int main(){
	if(solve()) puts("Yes");
	else puts("No");
}

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


 
typedef struct NODE {
  
    struct Node {
    int A;
    struct NODE *right;
    struct NODE *left;
    } *node;
  
} *NODE;




typedef struct Node * Node;
 
void PrintPreorder(NODE tree);

void PrintInorder(NODE tree);

void Free(NODE tree);

bool Search(NODE tree, int key);

void Insert(NODE tree, int item);

bool IsEmpty(NODE tree);

void CreateLeaf(NODE leaf, int item);

NODE NewTree(void);
 


int main(void)
{
    int i, n, key;
    
    char com[10], input[100];
    
    NODE bst = NewTree();
 
    scanf("%d\n", &n);
    for (i=0; i<n; i++)
    {
    fgets(input, 100, stdin);
    sscanf(input, "%s %d\n", com, &key);
    if (strcmp(com, "insert") == 0)
        Insert(bst, key);
    else
    {
        PrintInorder(bst);
        puts("");
        PrintPreorder(bst);
        puts("");
    }
    }
 
    Free(bst);
 
    return 0;
}




void PrintPreorder(NODE tree)
{
    if (IsEmpty(tree))
    return;
 
    printf(" %d", tree->node->A);
 
    if (!IsEmpty(tree->node->left))
    PrintPreorder(tree->node->left);   
 
    if (!IsEmpty(tree->node->right))
    PrintPreorder(tree->node->right);  
}



void PrintInorder(NODE tree)
{
    if (IsEmpty(tree))
    return;
 
    if (!IsEmpty(tree->node->left))
    PrintInorder(tree->node->left);    
 
    printf(" %d", tree->node->A);
 
    if (!IsEmpty(tree->node->right))
    PrintInorder(tree->node->right);   
}


void Free(NODE tree)
{
    if (IsEmpty(tree))
    free(tree);
    else
    {
    Free(tree->node->left);
    Free(tree->node->right);
    free(tree->node);
    free(tree);
    }
}





bool Search(NODE tree, int key)
{
    while (1)
    {
    if (IsEmpty(tree))
        return false;
    else if (key < tree->node->A)
        tree = tree->node->left;
    else if (key > tree->node->A)
        tree = tree->node->right;
    else
        return true;
    }
}



void Insert(NODE tree, int item)
{
    while (1)
    {
    if (IsEmpty(tree))
    {
        CreateLeaf(tree, item);
        break;
    }
    else if (item < tree->node->A)
        tree = tree->node->left;
    else if (item > tree->node->A)
        tree = tree->node->right;
    }
}


bool IsEmpty(NODE tree)
{
    return tree->node == NULL;
}



void CreateLeaf(NODE leaf, int item)
{
    leaf->node = (Node)malloc(sizeof(struct Node));
    leaf->node->A = item;
    leaf->node->left = NewTree();
    leaf->node->right = NewTree();
}





NODE NewTree(void)
{
    NODE empty = (NODE)malloc(sizeof(struct NODE));
    empty->node = NULL;
    return empty;
}
 



Measured memory_bytes: 48564
N = int(input())
A = input()
B = input()
C = input()
ans = 0
for k in range(N):
    a, b, c = A[k], B[k], C[k]
    if a == b == c:
        ans += 0
    elif a == b and b != c:
        ans += 1
    elif a == c and c != b:
        ans += 1
    elif b == c and b != a:
        ans += 1
    else:
        ans += 2

print(ans)

Measured memory_bytes: 38384
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))

N, x = mi()
A = li()
adj = []

for i in range(N-1):
    adj.append(A[i]+A[i+1])

ans = 0
for i, num in enumerate(adj):
    if num > x:
        ans += num - x
        if i < N-2:
            adj[i+1] = max(adj[i+1] - (num-x), A[i+2])
print(ans)

Measured memory_bytes: 14200
w,h,n = gets.split.map(&:to_i)
x = [0, w]
y = [0, h]
n.times do
  w,h,a = gets.split.map(&:to_i)
  case a
  when 1
    x[0] = [x[0], w].max
  when 2
    x[1] = [x[1], w].min
  when 3
    y[0] = [y[0], h].max
  when 4
    y[1] = [y[1], h].min
  end
  if x[0] >= x[1] or y[0] >= y[1] then
    puts 0
    exit
  end
end
puts (x[1] - x[0])*(y[1] - y[0])

Measured memory_bytes: 3836
#include<iostream>
#include<vector>
#include<algorithm>

#define f first
#define s second


using namespace std;


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

   vector<pair<int, int> > v;
   int a[n];

   for(int i = 0; i < n; i++){
         int x; cin >> x;
         v.push_back(make_pair(x,i));
    }
   
   sort(v.begin(), v.end());


   for(int i = 0; i < n/2; i++){
        int idx = v[i].s;
        a[idx] = v[n/2].f;
    }
   
   for(int i = n/2; i < n; i++){
        int idx = v[i].s;
        a[idx] = v[n/2 - 1].f;
    }



    for(int i = 0; i < n; i++){
         cout << a[i] << '\n';
    }

  

    return 0;
}

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

using namespace std;
const int MOD=1e9+7;
string s;
int n,f[3005][3005],sum[3005];
//f[i][j] la so hoan vi thoa man co do dai i xep vao i-1 dau co so cuoi cung xep vao hoan vi la j
int main()
{
    cin>>n>>s;
    //for(int i=0;i<=n;i++)
    f[1][1]=1;
    for(int i=2;i<=n;i++)
    {
        sum[0]=0;
        for(int j=1;j<=i;j++)
           sum[j]=(sum[j-1]+f[i-1][j])%MOD;
        for(int j=1;j<=i;j++)
        {
            if ('>'==s[i-2])
            {
                f[i][j]=(sum[i]-sum[j-1]+MOD)%MOD;
               // for(int k=j;k<=i;k++)
                    //f[i][j]+=f[i-1][k],f[i][j]%=MOD;
            }
            else//<
            {
                f[i][j]=sum[j-1]%MOD;
                //for(int k=j-1;k>0;k--)
                    //f[i][j]+=f[i-1][k],f[i][j]%=MOD;
            }
        }
    }
    int res=0;
    for(int i=1;i<=n;i++) res=(res+f[n][i])%MOD;
    cout<<res;
/*
    for(int i=1;i<=n;i++)
    {
        cout<<'\n';
        for(int j=1;j<=n;j++)
            cout<<f[i][j]<<' ';
    }
*/
    return 0;
}


Measured memory_bytes: 34176
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	int ret = 0;
	for (int i = a; i <= b; i++) {
		if (c%i == 0)ret++;
	}
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 3116
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int cnt1 = 0;
    int cnt0 = 0;
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++)
    {
        if(s[i] == '1')
        {
            cnt1++;
        }
        else
        {
            cnt0++;
        }
    }
    if(cnt1 == 0 || cnt0 == 0)
    {
        cout << 0;
    }
    else
    {
        cout << s.size() - abs(cnt1 - cnt0);
    }

    return 0;
}



Measured memory_bytes: 512
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	cin>>n;
	int v[100010]={};
	for(int i=0; i<n-1; i++){
		int x, y, a;
		cin>>x>>y>>a;
		v[x]^=a;
		v[y]^=a;
	}
	int c[16]={};
	for(int i=0; i<n; i++) c[v[i]]++;
	int ans=c[0], b=0;
	for(int i=1; i<16; i++){
		ans+=c[i]/2;
		if(c[i]&1) b^=(1<<(i-1));
	}
	bool ok[1<<15]={};
	for(int i=0; i<(1<<15); i++){
		int s=0;
		for(int j=0; j<15; j++){
			if(i&(1<<j)) s^=(j+1);
		}
		if(s==0) ok[i]=1;
	}
	int dp[1<<15]={};
	for(int i=1; i<(1<<15); i++){
		if(!ok[i]) continue;
		for(int j=i; j>0; j=(j-1)&i){
			if(ok[j]) dp[i]=max(dp[i], dp[i-j]+1);
		}
	}
	ans+=dp[b];
	ans=n-ans;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 896
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <array>
#include <list>
#include <stack>
#include <valarray>

using namespace std;

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

int main() {
  int A = in();
  int B = in();
  int n = B - A;
  int res = n * (n+1) / 2 - B;

  printf("%d\n", res);

  return 0;
}



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

int main(){
    long long N,M,wa=0,hako=0,las=0;
    cin >> N >> M;

    vector<vector<long long>> A(N,vector<long long>(2));
    
    for(int i = 0;i < N;i++){
        cin >> A.at(i).at(0) >> A.at(i).at(1);
    }

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

    for(int i = 0;i < N;i++){
         if((hako + A.at(i).at(1)) <= M){              
             hako += A.at(i).at(1);
             wa += A.at(i).at(0) * A.at(i).at(1); 
         }else if((hako + A.at(i).at(1)) > M && hako < M){
             las = M - hako;
             wa += A.at(i).at(0) * las; 
             break;
         }
    }
    cout << wa << endl;

}

Measured memory_bytes: 5760
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        long h = stdin.nextLong();
        long w = stdin.nextLong();
        int n = stdin.nextInt();
        
        Map<Tuple, Integer> counter = new HashMap<>();
        int[] d = new int[] { 0, 1, 2 };
        long[] ans = new long[10];
        ans[0] =  (h - 2) * (w - 2);
        
        
        for (int i = 0; i < n; i++) {
            int a = stdin.nextInt() - 1;
            int b = stdin.nextInt() - 1;
            
            for (int dx : d) {
                for (int dy : d) {
                    int x = a - dx;
                    int y = b - dy;
                    if (0 <= x && x < h - 2 && 0 <= y && y < w - 2) {
                        Tuple t = new Tuple(x, y);
                        int before = counter.getOrDefault(t, 0);
                        int after = before + 1;
                        
                        counter.put(t, after);
                        
                        ans[before]--;
                        ans[after]++;
                    }
                }
            }
        }
        
        Arrays.stream(ans).forEach(System.out::println);
    }
    
    public static class Tuple {
        private int x;
        private int y;
        
        public Tuple(int x, int y) {
            super();
            this.x = x;
            this.y = y;
        }

        @Override
        public int hashCode() {
            return Objects.hash(x, y);
        }
        
        @Override
        public boolean equals(Object obj) {
            if (obj == null || !(obj instanceof Tuple)) {
                return false;
            }
            
            Tuple other = (Tuple) obj;
            return this.x == other.x && this.y == other.y;
        }
    }
}

Measured memory_bytes: 207104
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define all(a) (a).begin(), (a).end()


int main(){
    int N, X;
    cin >> N >> X;
    vector<int> L(N);
    for(int i = 0; i < N; i++) cin >> L[i];
    int count = 1;
    int D = 0;
    for(int i = 0; i < N; i++){
        D = D + L[i];
        if(D <= X) count++;
    }
    cout << count << endl;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5+5 , M = 1e9+7, OO = 0x3f3f3f3f;
typedef long long ll;
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);
const double Pii = 3.14159265359;
ll n, k;
ll a[N], p[N];
ll mem[100][N];
ll solve(int idx, int w)
{
    if(idx == n) return 0;
    if(mem[idx][w] != -1) return mem[idx][w];
    ll op1 = 0, op2 = 0;
    op1 = solve(idx+1, w);
    if(w >= p[idx]) op2 = solve(idx+1, w-p[idx]) + a[idx];
    return mem[idx][w] = max(op1, op2);
}


int main()
{
    FIO
    cin >> n >> k;
    for(int i=0; i<n; ++i) cin >> p[i] >> a[i];
    memset(mem, -1, sizeof mem);
    ll ans = solve(0, k);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 81704
import sys
from bisect import bisect_left, bisect_right

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *L = map(int, read().split())

    L.sort()

    ans = 0
    for i, a in enumerate(L):
        for j, b in enumerate(L[i + 1 :], i + 1):
            k = bisect_left(L, a + b, lo=j + 1)
            ans += k - j - 1

    print(ans)
    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 74212
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
    class Program
    {
        static void Main(string[] args)
        {
            ulong[] NM = Console.ReadLine().Split().Select(ulong.Parse).ToArray();
            var n = NM[0];
            var m = NM[1];
            ulong ans = 0;
            if (n == 1)
            {
                if (m==1)
                {
                    ans = 1;
                }else
                {
                    ans = m - 2;
                }
            }else
            {
                if (m==1)
                {
                    ans = n - 2;
                } else
                {
                    ans = (n - 2) * (m - 2);
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11348
# -*- coding: utf-8 -*-

import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN

n=int(input())
k=int(input())
x=list(map(int,input().split()))

ans=0
for i in range(n):
    if x[i]*2>k:
        ans+=(k-x[i])*2
    else:
        ans+=x[i]*2
print(ans)


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

class dice{
	int d[6];
	int t;
public:
	int setdice();
	int showresult();
	int mvdice(string op);
};

int dice :: setdice(){
	for(int i = 0; i < 6; i++){
		cin >> d[i];
	}
	return 0;
}

int dice :: showresult(){
	cout << d[0] << endl;
	return 0;
}

int dice :: mvdice(string op){
	for(int i = 0; i < op.length(); i++){
		switch(op[i]){
			case 'N':
				t = d[0];
				d[0] = d[1];
				d[1] = d[5];
				d[5] = d[4];
				d[4] = t;
				break;
			case 'S':
				t = d[0];
				d[0] = d[4];
				d[4] = d[5];
				d[5] = d[1];
				d[1] = t;
				break;
			case 'W':
				t = d[0];
				d[0] = d[2];
				d[2] = d[5];
				d[5] = d[3];
				d[3] = t;
				break;
			case 'E':
				t = d[0];
				d[0] = d[3];
				d[3] = d[5];
				d[5] = d[2];
				d[2] = t;
				break;
		}
	}
	return 0;
}

int main(){
	dice x;
	string op;
	x.setdice();
	cin >> op;
	x.mvdice(op);
	x.showresult();
	return 0;
}

Measured memory_bytes: 1208
object Main extends App {

  val n = scala.io.StdIn.readInt()

  def solve(): Long = {
    (1 to n).foldLeft(0L) { case (acc, num) =>
      if(num % 3 != 0 && num % 5 != 0) acc + num else acc
    }
  }
  println(solve)
}

Measured memory_bytes: 56080
import java.io.*;
public class Main
{
    public static void main(String []args)throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        String []tokens = line.split(" ");
        int n = Integer.parseInt(tokens[0]);
        int K = Integer.parseInt(tokens[1]);
        String S=br.readLine();
        int p=S.charAt(K-1);
        char x=(char)(p+32);
System.out.print(S.substring(0,(K-1))+x+S.substring(K));
}
}


Measured memory_bytes: 21204
#include <iostream>

using namespace std;

int main() {
  long long L, R; cin >> L >> R;
  if (R > L+2019) {
    R = L+2019;
  }
  long long ans = 2020;
  for (long long i = L; i <= R; i++) {
    for (long long j = i+1; j <= R; j++) {
      ans = min(ans, (i*j) % 2019);
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
n,m=map(int, input().split())
q=[]
for i in range(m):
    a,b=map(int, input().split())
    q+=[[a,b],[b,a]]
p=[[1]]
count=0
while p:
    p1=p.pop()
    if len(p1)==n:count+=1
    else:
        for i,j in q:
            if i == p1[-1] and j not in p1:
                p.append(p1+[j])
    #print(p1,p)
print(count)

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
	int as,kl,o,n,m,hun,p;
	String op;
	Scanner sc = new Scanner(System.in);
	public void solve() {	
n=sc.nextInt();

for(o=0;o<n;o++) {
	op=sc.next();
	if(op.equals("AC")) {
		as=as+1;
	}else if(op.equals("WA")) {
		kl=kl+1;
	}else if(op.equals("TLE")) {
		hun=hun+1;
	}else if(op.equals("RE")) {
		m=m+1;
	}
	
}
System.out.println("AC x "+as);
System.out.println("WA x "+kl);
System.out.println("TLE x "+hun);
System.out.println("RE x "+m);

	}
	public static void main(String[] args) {
		new Main().solve();
	
	}
}

Measured memory_bytes: 58392
#include<bits/stdc++.h>
#define eps 1e-6
#define ll long long
#define IOS cin.sync_with_stdio(false);cin.tie(0);cout.tie(0);
//#define int long long
#define MEM(x,y) memset(x,y,sizeof(x))
#define rep(i,a,n) for (int i=a;i<n;i++)
#define fi first
#define se second
#define endl "\n"
#define pii pair<int,int>
#define fi first
#define se second
const ll mod=1000000007;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
ll Max(ll a,ll b){return a>=b?a:b;}
ll Min(ll a,ll b){return a<=b?a:b;}
ll qpow(ll a,ll b){ll s=1;while(b>0){if(b%2==1){s=s*a;}a=a*a;b=b>>1;}return s;}
ll qpowmod(ll a, ll b, ll c){ll res,t;res=1;t=a%c;while(b){if(b&1){res=res*t%c;}t=t*t%c;b>>=1;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
inline long long read(){long long k=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){k=k*10+ch-'0';ch=getchar();}return k*f;}
inline void write(long long x){if(x<0)x=-x,putchar('-');if(x>9)write(x/10);putchar(x%10+'0');}
using namespace std;
//head file

int main()
{
    ll n,d;
    cin>>n>>d;
    int cnt=0;
    while(n--)
    {
        ll x;
        ll y;
        cin>>x>>y;
        if(x*x+y*y<=d*d)
            cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
ll sm[100010];
vector <ll> a[100010], b[100010];
int dfs(int x, int papa, ll num){
  if(papa==-1)
    sm[x]=0;
  else
    sm[x]=sm[papa]+num;
  for(int i=0; i<a[x].size(); ++i){
    if(a[x][i]==papa)
      continue;
    dfs(a[x][i], x, b[x][i]);
  }
}
int main(){
  int n, x, y, c, q, k;
  while(cin>>n){
    for(int i=0; i<n-1; ++i){
      scanf("%d%d%d",&x,&y,&c);
      a[x].push_back(y);
      b[x].push_back(c);
      a[y].push_back(x);
      b[y].push_back(c);
    }
    ll ans=0;
    cin>>q>>k;
    dfs(k,-1,0);
    for(int i=0; i<q; ++i){
      scanf("%d%d",&x,&y);
      ans=abs(sm[k]-sm[x])+abs(sm[k]-sm[y]);
      printf("%lld\n",ans);
    }
  }
  return 0;
}




Measured memory_bytes: 19712
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <array>
#include <vector>

using namespace std;

int main() {
  while( true ) {
    int e = 0;
    cin >> e;
    if ( e == 0 ) break;

    int m = e;
    for ( int z = 0; z * z * z <= e; z++ ) {
      for ( int y = 0; y * y + z * z * z <= e; y++ ) {
	int x = e - z * z * z - y * y;
	m = min( m, x + y + z );
      }
    }
    cout << m << endl;
  }
}

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

#define inf 0x3f3f3f3f
#define pb push_back
#define fi first
#define se second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector <int> vi;
typedef vector <ll> vl;
typedef vector <ull> vu;
typedef vector <vector <int>> vvi;
typedef pair <int, int> pi;
typedef vector <pair <int, int>> vpi;

int n, m, x, y;

void read() {
  cin >> n >> m >> x >> y;
}

void solve() {
  for(int i = 0; i < n; ++i) {
    int nr;
    cin >> nr;
    x = max(x, nr);
  }
  for(int i = 0; i < m; ++i) {
    int nr;
    cin >> nr;
    y = min(y, nr);
  }
  if (x >= y) cout << "War";
  else cout << "No War";
}

int main() {
  ios :: sync_with_stdio(false);
  cin.tie(nullptr);
  int t = 1;
  //cin >> t; //please do not forget to comment this if there are no queries
  while(t) {
    --t;
    read();
    solve();
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define clear(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

typedef long long ll;
typedef pair<int, int> pint;

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };



int main()
{
	const int MAX = 300000;
	static vector<int> pf[MAX + 1];
	for (int i = 2; i <= MAX; ++i)
		if (pf[i].empty() && (i % 7 == 1 || i % 7 == 6))
			for (int j = i; j <= MAX; j += i)
				pf[j].push_back(i);

	int n;
	while (cin >> n, n != 1)
	{
		printf("%d:", n);
		for (int i = 0; i < pf[n].size(); ++i)
			printf(" %d", pf[n][i]);
		puts("");
	}
}

Measured memory_bytes: 0
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<vector>
using namespace std;
#define ll long long
#define maxn 100010
#define MST(vis,x) memset(vis,x,sizeof(vis))
ll dptemp[maxn];
ll s1[maxn],dp[maxn];
ll mi=9223372036854775807,n,a,sum,pri1,pri2,all;
void cir()
{
     for(a=2; a<=n; a++)
    {
        dp[a]=(dp[a-1]+s1[a]);
        if(dp[a-1]>0)
        {
            if(dp[a]>=0)
            {
                all+=(dp[a]+1);
                dp[a]=-1;
            }
        }
        else
        {
            if(dp[a]<=0)
            {
                all+=(-dp[a]+1);
                dp[a]=1;
            }
        }
    }
    if(all<mi)mi=all;
}
void copyy()
{
    for(ll a=1;a<=n;a++)
        dp[a]=dptemp[a];
}
int main()
{
    scanf("%lld",&n);
    dp[0]=0;
    for(a=1; a<=n; a++)
    {
        scanf("%lld",&s1[a]);
        dp[a]=s1[a]+dp[a-1];
        dptemp[a]=dp[a];
    }
    if(dp[1]>0)
    {
       copyy();
       all=0;
       cir();
       copyy();
       all=dp[1]+1;
       dp[1]=-1;
       cir();
    }
    else if(dp[1]<0)
    {
        copyy();
        all=0;
        cir();
        copyy();
        all=-dp[1]+1;
        dp[1]=1;
        cir();
    }
    else
    {
        copyy();
        all=1;
        dp[1]=1;
        cir();
        copyy();
        all=1;
        dp[1]=-1;
        cir();
    }
    printf("%lld\n",mi);
    return 0;
}


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

int main(void) {
int L,R,d;
  cin>>L>>R>>d;
  int n=0;
  for(int i=L;i<=R;i++)
  { if(i%d==0){n++;}}
  cout<<n<<endl;    
  return 0;
}


Measured memory_bytes: 3644
#include <stdio.h>

int main(void) {
  int a, b;
  scanf("%d %d", &a, &b);

  if ( a == b ) printf("%d", 2*a);
  else if ( a > b ) printf("%d", 2*a-1);
  else {
    printf("%d", 2*b-1);
  }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

int main () {
  int n, q;
  cin >> n >> q;
  string s;
  cin >> s;
  
  vector<int> csum(s.size()+1);
  rep(i,s.size()) {
    if (i == 0) continue;
    csum[i+1] = csum[i];
    if (s[i-1] == 'A' && s[i] == 'C') {
      csum[i+1] += 1;
    }    
  }
  //rep(i,csum.size()) printf("%d%c", csum[i], i==csum.size()-1?'\n':' ');

  vi ans(q);
  rep(i,q) {
    int l, r;
    cin >> l >> r;
    l--, r--;
    ans[i] = csum[r+1] - csum[l+1];
  }
  
  rep(i,ans.size()) printf("%d\n", ans[i]);
  return 0;
}

Measured memory_bytes: 1792
m = 10 ** 9 + 7
f = [1]

for i in range(10 ** 5 + 5):
    f.append(f[-1] * (i + 1) % m)

def nCr(n,r,mod = m):
    return f[n] * pow(f[r],m - 2,m) * pow(f[n-r],m - 2,m) % m

n,k = map(int,input().split())

a = list(map(int,input().split()))

a.sort()

ans = 0
for i in range(n - k + 1):
    ans += (a[-1-i] - a[i]) * nCr(n - 1 - i,k - 1)
    ans %= m

print(ans)

Measured memory_bytes: 18544
sum=0
s=0
A=input().split()
n=(int)(A[0])
t=(int)(A[1])
x=[0 for i in range(2*n)]
for i in range(n):
    B=input().split()
    k=2*i
    x[k]=(B[0])
    x[k+1]=(int)(B[1])
while len(x)>0:
    s=x[1]-t
    if s>0: 
        sum+=t
        x.append(x[0])
        x.append(s)
        del x[0]
        del x[0]
    if s<=0:
        sum+=x[1]
        print( x[0],sum)
        del x[0]
        del x[0]


Measured memory_bytes: 9456
function readInt(str){
  return parseInt(str, 10);
}
function solve(R,G,B,N){
  let count=0;
  for(let r=0;r<=N;r+=R)
    for(let g=0;r+g<=N;g+=G)
      {
        if((N-r-g)%B==0)count++;
      }
  return count;
}
function Main(raw: string) {
  const input = raw.split(/ |\n/);
  const [R,G,B,N] = input.map(readInt);
  //出力
  console.log(solve(R,G,B,N));
}

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


Measured memory_bytes: 7372
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
  int n,k;
  cin >> n >> k;
  
  double ans = 0;
  for(int i=1;i<=n;i++){
    int point = i;
    int time = 0;
    while(point < k){
      point *= 2;
      time++;
    }
    ans += 1/(n*pow(2,time));
  }
  
  printf("%.15lf\n",ans);
  return 0;
}

Measured memory_bytes: 256
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

S=get_nsp
N=S.size
if N==2
    puts S.join("")
else
    puts S.reverse.join("")
end

Measured memory_bytes: 3836
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

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

int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

int main() {
    int N = iin();
    int H, max = 0, count = 0, i;
    REP(i,N) {
        H = iin();
        if (max <= H) {
            count++;
            max = H;
        }
    }
    iout(count);
    return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vchar = vector<char>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  ll n;
  cin >> n;
  vll a(n);
  vin(a);
  set<ll> aset;
  vrep(i, a) aset.insert(i);
  cout << aset.size() << endl;
}

Measured memory_bytes: 256
class UnionFind
  def initialize(n)
    @par = Array.new(n){|x| x}
    @size = Array.new(n, 0)
  end

  def find(x)
    return x if x == @par[x]
    return @par[x] = find(@par[x])
  end

  def unite(x, y)
    x = find(x)
    y = find(y)
    return if x == y
    swap(x, y) if @size[x] < @size[y]
    @par[y] = x
    @size[x] += @size[y]
  end

  def same(x, y)
    return find(x) == find(y)
  end

  def size(x)
    return @size[find(x)]
  end
end

class Edge
  def initialize
    @a, @b, @cost = 0, 0, 0
  end
end

class Graph
  def initialize(n, es)
    @n = n
    @es = es
  end

  def kruskal()
    @es = @es.sort_by{|x| x[2]}

    uf = UnionFind.new(@n)
    min_cost = 0
    @es.each{|e|
      if !uf.same(e[0], e[1])
        min_cost += e[2]
        uf.unite(e[0], e[1])
      end
    }
    return min_cost
  end
end

v, e = gets.split.map(&:to_i)
es = e.times.map { gets.split.map(&:to_i) }

g = Graph.new(v, es)
p g.kruskal()

Measured memory_bytes: 18424
#include<iostream>
#include<math.h>
#include<algorithm>
#include<map>
#include<queue>
#include<set>
#include<deque>
#include<vector>

int res[100002];
int bit0[100002];
int bit1[100002];
int sum0(int i);
int sum1(int i);
void add0(int i,int x);
void add1(int i,int x);
int n, m;
using namespace std;
pair<int, pair<int,int>>  line[300000];
int main() {
	//C
	/*long long int x;
	cin >> x;
	long long int y;
	y = x % 11;
	x = x / 11;
	if (y == 0) {
		cout << 2 * x << endl;
	}
	else if (y < 7) {
		cout << 2 * x + 1 << endl;
	}
	else {
		cout << 2 * x + 2 << endl;
	}
	return 0;
	*/

	//D
	/*int n;
	int a[100000];
	int i;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	int l, lnum, r, rnum;
	l = 0; lnum = a[l];
	r = n - 1; rnum = a[r];
	//l++;
	//r--;
	int cards = n;
	while (1) {
		l++;
		if (a[l] != lnum) {
			//cout << 1;
			lnum = a[l];
			if (l >= r) {
				cout << cards << endl;
				return 0;
			}
		}
		else {
			while (1) {
				r--;
				if (a[r] != rnum) {
					
					rnum = a[r];
					if (r <= l) {
						cout << cards - 2 << endl;
						return 0;
					}
				}
				else {
					cards = cards - 2;
					if (r <= l) {
						cout << cards << endl;
						return 0;
					}
					break;
				}
			}
		}

	}*/

	//E
	cin >> n >> m;
	int i;
	int j = 0, k;
	for (i = 0; i < n; i++) {
		cin >> line[i].second.first >> line[i].second.second;
		line[i].first = line[i].second.second - line[i].second.first;
	}
	sort(line, line + n);
	for (i = 1; i <= m; i++) {
		while (j < n) {
			if (line[j].first + 1 < i) {
				//累積和に加える
				add0(line[j].second.first, -(line[j].second.first - 1));
				add0(line[j].second.second + 1, line[j].second.second);
				add1(line[j].second.first, 1);
				add1(line[j].second.second + 1, -1);
				j++;
			}
			else {

				break;
			}
		}
		res[i] = res[i] + n - j;
		for (k = 0; k <= m; k = k + i) {
			res[i] = res[i] + sum1(k) * k + sum0(k) - sum1(k - 1) * (k - 1) - sum0(k - 1);
		}
		
	}
	//for (k = 1; k <= m; k++) {
	//	cout << sum1(k) * k + sum0(k) - sum1(k - 1) * (k - 1) - sum0(k - 1) << endl;
	//}

	for (i = 1; i <= m; i++) {
		cout << res[i] << endl;
	}
	return 0;

}
int sum0(int i) {
	int s = 0;
	while (i > 0) {
		s += bit0[i];
		i -= i & -i;
	}
	return s;
}


int sum1(int i) {
	int s = 0;
	while (i > 0) {
		s += bit1[i];
		i -= i & -i;
	}
	return s;
}


void add0(int i, int x) {
	while (i <= m) {
		bit0[i] += x;
		i += i & -i;
	}
}


void add1(int i, int x) {
	while (i <= m) {
		bit1[i] += x;
		i += i & -i;
	}
}



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

#define SIZE 100005
#define PI acosl(-1) //3.14159265358979323846264338327950L 
#define rep(i, N) for (i = 0; i < N; i++) //制御変数iを用いてN回転
#define array(N, t) (t*)calloc(N, sizeof(t)) //t型N要素の1次元配列を動的確保後0クリア(freeを忘れずに)
#define zero(a); {int iter; rep(iter, sizeof(a)/sizeof((a)[0])) (a)[iter]=0;} //1次元配列aのゼロ初期化?

typedef long long ll; typedef long double ld;
typedef struct node { int data; struct node *next; } Node;

Node *list[SIZE];
int queue[SIZE]; int q_head = 0, q_tail = 0;

void print_log(); //とりあえず文字を出力してどこまで実行できているか確認(for debug)
void printa_int(int *a, int size); //int型の1次元配列aを出力(for debug)
void printl_int(int size); //リンクリストを出力(for debug)
Node* add_node(int i, int data); void free_list(Node* head);
int queue_empty(); int queue_full();
void enqueue(int data); int dequeue();

int main() {
    ll A, res;
    double B;
    scanf("%lld %lf", &A, &B);
    res = A * (int)(B * 100 + 0.5) / 100;
    printf("%lld\n", res);
    return 0;
}

void print_log() {
    printf("=== print log ===\n");
}
void printa_int(int *a, int size) {
    int i;
    printf("[");
    for (i = 0; i < size; i++)
        printf("%d, ", a[i]);
    printf("]\n");
}
void printl_int(int size) {
    int i;
    Node *t;
    rep(i, size) {
        printf("[%d] ", i);
        for (t = list[i]; t; t = t->next) printf("%d, ", t->data);
        printf("\n");
    }
}
Node* add_node(int i, int data) {
    if (!list[i]) {
        list[i] = (Node*)malloc(sizeof(Node*));
        list[i]->data = data;
    } else {
        Node *t;
        t = list[i];
        list[i] = (Node*)malloc(sizeof(Node*));
        list[i]->data = data;
        list[i]->next = t;
    }
    return list[i];
}
void free_list(Node* head) {
    Node *prev = NULL, *t = head;
    while (t) {
        prev = t;
        t = t->next;
        free(prev);
    }
}
int queue_empty() {
    return q_head == q_tail;
}
int queue_full() {
    return (q_head - 1) % SIZE == q_tail % SIZE;
}
void enqueue(int data) {
    if (queue_full()) {
        printf("full!\n");
        return;
    }
    queue[q_tail++] = data;
    q_tail %= SIZE;
}
int dequeue() {
    if (queue_empty()) {
        printf("empty!\n");
        return -444444;
    }
    int data = queue[q_head++];
    q_head %= SIZE;
    return data;
}

Measured memory_bytes: 1752
fun main(args:Array<String>) {

    val (n,k) = readLine()!!.split(" ").map { it.toInt() }
    val kirai = readLine()!!.split(" ").map { it.toInt() }

    for(i in (n..n*10)) {
        if(i.toString().map { it.toString().toInt() }.all { !kirai.contains(it) }) {
            println(i)
            return
        }
    }
}


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

int main() {
  int a, b;
  cin >> a >> b;
  set<int> st;
  st.insert(1);
    st.insert(2);
    st.insert(3);
  st.erase(a);
  st.erase(b);
  cout << *st.begin() << endl;
  return 0;
}

Measured memory_bytes: 256