akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double pi=3.141592653589793;
typedef unsigned long long ull;
typedef long double ldouble;
const ll INF=1e18;

int main(){
    ll d, g;
    ll min = INF;
    cin >> d >> g;
    vector<ll> p(d);
    vector<ll> c(d);
    for(int i = 0; i < d; i++) {
        cin >> p.at(i) >> c.at(i);
    }
    // {0, 1, ..., n-1} の部分集合の全探索
    for (int bit = 0; bit < (1<<d); ++bit)
    {
        int max_index = -1;
        ll score = 0, problem = 0;
        /* bit で表される集合の処理を書く */
        bitset<10> tmp(bit);
        /* bit で表される集合の処理を書く */
        for(int i = 0; i < d; i++){
            if(tmp.test(i)) {
                score += p.at(i) * (i+1) * 100 + c.at(i);
                problem += p.at(i);
            }
            else max_index = i;
        }

        if(problem > min) continue;
        if(score == 0){
            while(score < g) {
                problem++;
                score += (max_index + 1) * 100;
                if(problem > p.at(max_index)) {
                    problem = INF;
                    break;
                }
            }

        }
        else if(g > score && g - score < p.at(max_index) * 100 * (max_index+1)) {
            problem += (g - score) / (max_index+1) / 100;
        }
        else if(g > score) continue;
        
        if(problem < min) min = problem;
    }
    cout << min << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> t(n);
  for (int i = 0; i < n; i++)
    cin >> t[i];
  int m;
  cin >> m;
  vector<int> p(m), x(m);
  for (int i = 0; i < m; i++) {
    cin >> p[i] >> x[i];
    p[i]--;
  }

  for (int i = 0; i < m; i++) {
    int sum = 0;
    for (int j = 0; j < n; j++) {
      if (p[i] == j) {
        sum += x[i];
      } else {
        sum += t[j];
      }
    }
    cout << sum << endl;
  }
}

Measured memory_bytes: 764
n = int(input())

if n % 2 == 1 or n < 10:
	print(0)
	exit()

tmp = 1
idx = 0
while True:
	tmp *= 5
	if tmp >= n:
		break
	idx += 1

ans = 0
for i in range(idx):
	ans += (n // (5 ** (i + 1))) // 2

print(ans)


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

using namespace std;

int main(void){

    int n, k;
    cin >> n >> k;
    vector<int> l(n);
    for(int i=0; i<n; i++) cin >> l[i];
    sort(l.begin(), l.end(), greater<int>());
    int result = 0;
    for(int i=0; i<k; i++) result += l[i];
    cout << result << endl;    

    return 0;
    
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <unordered_set>
using namespace std;

int main(void){
    int N;
    cin >> N;
    cout <<(N+1)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N,K;
  cin>>N>>K;
  string S;
  cin>>S;
  int ans=0;
  REP(i,N-1){
    if(S[i]==S[i+1]){
      ans++;
    }
  }
  cout<<min(N-1,ans+K*2)<<endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a,b,s;
	cin>>a>>b;
	int n,m;
	cin>>n>>m;cin>>s;
	if(s==a) cout<<n-1<<' '<<m<<endl;
	else cout<<n<<' '<<m-1<<endl;
}

Measured memory_bytes: 256
for _ in range(50):
    m, f, r = [int(x) for x in input().split(' ')]
    if m == f == r == -1: break
    elif m == -1 or f == -1: print('F')
    elif m + f >= 80: print('A')
    elif m + f >= 65: print('B')
    elif m + f >= 50: print('C')
    elif m + f >= 30:
        if r >= 50: print('C')
        else: print('D')
    else: print('F')


Measured memory_bytes: 5604
//0-1 knapsack but now with huge w


#include<bits/stdc++.h>
using namespace std;
const long long int inf=1e18L+5;

int main()
{long long int n,w;
cin>>n>>w;
vector<long long int> weight(n),value(n);
for(long long int i=0;i<n;i++)cin>>weight[i]>>value[i];
int sum_value=0;
for(long long int i=0;i<n;i++)sum_value+=value[i];

vector<long long int> dp(sum_value+1,inf);
dp[0]=0;
//this time let dp[i]=minimum total weight of items with value exactly i
for(long long int item=0;item<n;++item)
{
    for(long long int already=sum_value-value[item];already>=0;already--)
    {
        dp[already+value[item]]=min(dp[already+value[item]],dp[already]+weight[item]);
    }
}
long long int answer=0;
for(long long int i=0;i<=sum_value;i++)
{
    if(dp[i]<=w)
        answer=max(answer,i);
}
cout<<answer<<endl;






}


Measured memory_bytes: 3968
import sys
N = int(sys.stdin.readline().rstrip())
p = list(map(int, sys.stdin.readline().rstrip().split()))
p = sorted(p, reverse = True)
A = 0
B = 0
for i in range(N):
    if i%2 == 0:
        A += p[i]
    else:
        B += p[i]
print(A - B)


Measured memory_bytes: 3060
#define NDEBUG

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <cassert>
#include <numeric>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<ll, int, int> T;

const int MS = 12;
const int MN = 1<<MS;
ll a[MN], sum[MN];
vector<T> v;
P dp[MN];
int main() {
    int n;
    cin >> n;
    sum[0] = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        sum[i+1] = sum[i]+a[i];
    }
    for (int i = 0; i < n; i++) {
        for (int j = i+1; j <= n; j++) {
            v.push_back(T(sum[j]-sum[i], -i, -j));
        }
    }
    sort(v.begin(), v.end());
    vector<P> res(v.size());
    fill_n(dp, MN, P(-10000, -1));
    dp[0] = P(0, -1);
    for (int i = 0; i < v.size(); i++) {
        ll dummy; int a, b;
        tie(dummy, a, b) = v[i];
        a *= -1; b *= -1;
        res[i] = dp[a];
        if (dp[b].first >= res[i].first+1) continue;
        dp[b] = P(res[i].first+1, i);
    }
    P p = dp[n];
    printf("%d\n", p.first);
    vector<int> rv;
    while (p.second != -1) {
        rv.push_back(-get<2>(v[p.second]));
        p = res[p.second];
    }
    reverse(rv.begin(), rv.end());
    rv.pop_back();
    for (int d: rv) {
        printf("%d ", d);
    } printf("\n");
    return 0;
}

Measured memory_bytes: 190736
//love yjl forever
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
const int INF=0x3f3f3f3f,N=1e5+5,mo=998244253;
int n,m,S;
vector<int> v[N];
ll an[N][20],dep[N];
pii a[N],edge[N];
void dfs(int x,int fa)
{
	int i;
	an[x][0]=fa;
	dep[x]=dep[fa]+1;
	for(i=1;i<=17;i++)
	{
		an[x][i]=an[an[x][i-1]][i-1];	
	}
	for(i=0;i<v[x].size();i++)
	{
		int u=v[x][i];
		if(u==fa) continue;
		dfs(u,x);
	}
}
int lca(int x,int y)
{
	if(dep[x]<dep[y])
		swap(x,y);
	int i;
	for(i=17;i>=0;i--)
	{
		if(dep[an[x][i]]>=dep[y])
		{
			x=an[x][i];			
		}
	}
	if(x==y) return y;
	
	for(i=17;i>=0;i--)
	{
		if(an[x][i]!=an[y][i])
		{
			x=an[x][i];
			y=an[y][i];
		}
	}
	return an[x][0];
}
ll dp[2][(1<<20)+5];
bool ok(int i,int z,int w)
{
	int x=edge[i].fi,y=edge[i].se;
//	if(z==a[j].fi) w=a[j].se;
//	else w=a[j].fi;
//	
	if(lca(x,z)==z&&lca(y,z)==z&&lca(y,w)==y&&lca(x,w)==x)
		return 1;
	else 
		return 0;
}
bool ok2(int i,int j)
{
	int x=a[j].fi,y=a[j].se;
	int z=lca(x,y);
	if(ok(i,z,x)||ok(i,z,y))
	{
		return 1;
	}
	else 
		return 0;
}
int sat[N];
void add(int &x,int y)
{
	x=(x+y)%mo;
}
int main()
{
	//freopen("","r",stdin);
	//freopen("","w",stdout);
	int i,j;
	cin>>n;
	for(i=1;i<n;i++)
	{
		int x,y;
		scanf("%d%d",&x,&y);
		v[x].pb(y);
		v[y].pb(x);
		edge[i].fi=x;
		edge[i].se=y;
	}
	dfs(1,1);
	cin>>m;
	for(i=1;i<=m;i++)
	{
		scanf("%d%d",&a[i].fi,&a[i].se);
	}
	for(i=1;i<n;i++)
	{
		int msk=0;
		for(j=1;j<=m;j++)
		{
			if(ok2(i,j))
			{
				msk=msk|(1<<(j-1));	
			}
		}
		sat[i]=msk;
//		cout<<i<<" "<<msk<<endl;
	}
	dp[0][0]=1;
	for(i=1;i<n;i++)
	{
		int k=i%2;
		for(int msk=0;msk<(1<<m);msk++)
		{
			dp[k][msk]=dp[k^1][msk];

		}
		for(int msk=0;msk<(1<<m);msk++)
		{
			dp[k][msk|sat[i]]+=dp[k^1][msk];
//			add(dp[k][msk|sat[i]],dp[k^1][msk]);
//			dp[k][msk|sat[i]]=dp[k^1][msk];
		}
					
	}
//	for(i=1;i<n;i++)
//	{
//		for(int msk=0;msk<(1<<m);msk++)
//			cout<<dp[i][msk]<<" ";
//		cout<<endl;		
//	}
//

	cout<<dp[(n-1)%2][(1<<m)-1]<<endl;
}
/*
5
1 2
2 3
3 4
3 5
2
1 3
2 5
*/

Measured memory_bytes: 22424
#include <stdio.h>

#define Max 100000
#define NIL -1

int rec( int, int );
void print(int);

struct node{
  int p, l, r;
};

struct node T[Max];
int n, D[Max];

int main(){
  int i, j, v, c, l, r, d;
  scanf("%d",&n);
  for( i = 0 ; i < n ; i++)
    T[i].p = T[i].l = T[i].r =NIL;

  for( i = 0 ; i < n ; i++){
    scanf("%d%d",&v,&d);
    for( j = 0 ; j < d ; j++){
      scanf("%d",&c);
      if( j == 0) T[v].l = c;
      else  T[l].r = c;
      l = c;
      T[c].p = v;
    }
  }
  for( i = 0 ; i < n ; i++){
    if(T[i].p == NIL) 
      r = i;
  }
  rec(r,0);

  for( i = 0 ; i < n ; i++)
    print(i);

  return 0;
}

void print(int u){
  int i, c;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].p);
  printf("depth = %d, ",D[u]);

  if( T[u].p == NIL ) printf("root, ");
  else if( T[u].l == NIL ) printf("leaf, ");
  else printf("internal node, ");

  printf("[");

  for( i = 0 , c = T[u].l ; c != NIL ; i++, c =T[c].r){
    if(i != 0 ) printf(", ");
    printf("%d",c);
  }
  printf("]\n");
}

int rec(int u, int p) {
  D[u] = p;
  if( T[u].r != NIL ) rec(T[u].r ,p);
  if( T[u].l != NIL ) rec(T[u].l ,p+1);
} 

Measured memory_bytes: 5296
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <list>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)

using namespace std;

int i,j,k,l,m,n;
/////////////////////////////////////////////////////
#define INF 999999999
#define DUB 21 //>log2_505050

char s[505050];
int Q;

int sl;
int nextc[505050][30];
int nextdb[505050][DUB];


int main(){
    //文字列入力
    cin>>s;

    //データ作成
    for(sl=0;s[sl]!='\0';sl++);

    int C[30];
    //cout<<sl<<" "<<endl;
    for(j=0;j<27;j++){
        nextc[sl][j]=INF;
        C[j]=INF;
    }
    for(i=sl-1;i>=0;i--){
        for(j=0;j<27;j++){
            nextc[i][j]=INF;
        }
        int cc=s[i]-'a';
        nextc[i][cc]=i+1;
        int ci=nextc[nextc[i][cc]][cc];
        
        while(ci!=INF&&cc<26){
            cc++;
            nextc[i][cc]=ci;
            ci=nextc[nextc[i][cc]][cc];
        }
        if(cc==26){
            int idx=nextc[i][26];
            int cci=s[i]-'a';
            cc=0;
            while(cc<cci){
                nextc[i][cc]=nextc[idx][cc];
                cc++;
            }
        }
        /*
        cout<<"\n"<<i<<":"<<endl;
        for(j=0;j<27;j++){
            if(nextc[i][j]==INF)
                cout<< " ["<<j<< "]:-"; 
            else
                cout <<" ["<<j<< "]:" << nextc[i][j];
        }
        */
        
    }

    //ダブリング
    for(i=0;i<=sl;i++){
        nextdb[i][0]=nextc[i][26];
    }
    for(k=1;k<DUB;k++){
        for(i=0;i<=sl;i++){
            if(nextdb[i][k-1]!=INF){
                nextdb[i][k]=nextdb[nextdb[i][k-1]][k-1];
            }else{
                nextdb[i][k]=INF;
            }
            //cout<<" "<<k<<":"<<i<< nextdb[k][i]<<endl;
        }
    }   

    //検索
    cin>>Q;
    int l,r,lr;
    for(i=0;i<Q;i++){
        cin >> l >> r;
        l--;
        for(k=DUB-1;k>=0;k--){
            if(r>=nextdb[l][k]){
                l=nextdb[l][k];
                if(r==l)
                    break;
            }
        }
        if(l==r){
            cout<< "Yes"<<endl;
        }else{
            cout<<"No"<< endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 101504
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
#include <utility>
#include <algorithm>
#include <string>
using namespace std;

int main() {
  int s;
  cin >> s;
  int ans = 1;
  while (1) {
	  if (s == 4 || s == 2 || s == 1) {
		  break;
		}
	  ans++;
	  if (s % 2 == 0) {
		  s /= 2;
		}
	  else {
		  s = 3 * s + 1;
		}
	}
  cout << ans + 3 << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<time.h>
#include<stdlib.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse4")
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define pll pair<ll,ll>
#define vll vector<ll,ll>
#define all(a) (a).begin(),(a).end()
#define ff first
#define ss second
#define sz(x) (ll)x.size()
#define hell 1000000007
#define repf(i,a,b) for(ll i=a;i<b;i++)
#define repb(i,a,b) for(ll i=a;i>b;i--)
#define lbnd lower_bound
#define ubnd upper_bound
#define bs binary_search
#define gcd(a,b) __gcd((a),(b))
#define EPS 1e-12
#define lcm(a,b) ((a)*(b))/__gcd((a),(b))
#define sqrt sqrtl
#define cbrt cbrtl
using namespace std;
ll n,k;
vector<ll> pos,neg;
int main()
{
  IOS
  cin>>n>>k; 
  ll i,x;
  for(i=0;i<n;i++)
  {
     cin>>x;
     if(x>=0)
     pos.pb(x);
      else
      neg.pb(x);
  }
  sort(all(pos));
  sort(all(neg));
  reverse(all(neg));
  ll mini=1e18;
  ll sum1=0,sum2=0;
  ll c=0;
  for(i=0;i<pos.size();i++)
  {
     sum1=pos[i];
     c++;
     if(c==k)
      break;
  }
  ll rem=k-c;
  i=0;
  while(rem>0)
  {
     rem--;
     sum2=abs(neg[i]);
     i++;
  }
 // cout<<sum1<<" "<<sum2<<"\n";
  mini=min(mini,min(sum2*2+sum1,sum1*2+sum2));
 // cout<<mini<<" ";
  while(c>=0)
  {
    c--;
    if(c-1>=0)
      sum1=pos[c-1];
    else
      sum1=0;
    if(i<neg.size())
      sum2=abs(neg[i]);
    else
      break;
     i++;
    mini=min(mini,min(sum2*2+sum1,sum1*2+sum2));
 //   cout<<mini<<" ";
  }
  cout<<mini;
  
  return 0;
}


Measured memory_bytes: 1656
s=list(input())
k=int(input())
for i in range(len(s)):
    c = (ord('z') - ord(s[i]) + 1)%26
    if c <= k:
        k -= c
        s[i] = 'a'
s[-1] = chr(ord('a') + ((ord(s[-1]) - ord('a') + k) % 26))
print(''.join(s))

Measured memory_bytes: 50288
# coding: utf-8
# Your code here!

num = int(input())
dish = [int(item)-1 for item in input().split()]
satis = [int(item) for item in input().split()]
additional = [int(item) for item in input().split()]

sum = 0
prev = num + 10

for item in dish:
    sum += satis[item]
    if item == prev +1:
        sum += additional[prev]
    prev = item
    
print(sum)

Measured memory_bytes: 3064
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    print(N**2)




if __name__ == "__main__":
    main()

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

int main(){
  int N, a[100];
  int Alice = 0, Bob = 0;
  cin >> N;
  for(int i = 0;i < N; i++){
    cin >> a[i];
  }
  sort(a,a+N,std::greater<int>());
  for(int i = 0;i < N; i++){
    if(i % 2 == 0){
      Alice += a[i];
    }else{
      Bob += a[i];
    }
  }
  cout << Alice - Bob << endl;
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a, b = map(int, input().split())
p = list(map(int, input().split()))
A, B, C = [], [], []
for i in p:
    if i <= a:
        A.append(i)
    elif i <= b:
        B.append(i)
    else:
        C.append(i)
print(min(len(A), len(B), len(C)))

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

using namespace std;

void solve()
{
	int N, K;
	cin >> N >> K;
	vector<int> as(N), grundy(K+1);

	for (int i = 0; i < N; i++) cin >> as[i];

	grundy[0] = 0;

	for (int k = 1; k <= K; k++)
	{
		for (int a : as)
		{
			if (k-a < 0) continue;
			if (!grundy[k-a])
			{
				grundy[k] = 1;
				break;
			}
		}
		//cout << grundy[k] << endl;
	}

	cout << (grundy[K] ? "First" : "Second") << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


Measured memory_bytes: 640
import itertools
def calc(a,b,c):
    if(c==0):
        return a+b
    elif(c==1):
        return a-b
    else:
        return a*b


mp=[' + ',' - ',' * ']
while True:
    nums=list(map(int,input().split()))
    if(nums[0]==0 and nums[1]==0 and nums[2]==0 and nums[3]==0):break
    nums.sort()
    ans=''
    for perms in itertools.permutations(nums):
        perms=list(perms)
        v=[0,0,0];
        for v[0] in range(3):
            for v[1] in range(3):
                for v[2] in range(3):
                    sum=calc(perms[0],perms[1],v[0])
                    sum=calc(sum,perms[2],v[1])
                    sum=calc(sum,perms[3],v[2])
                    for i in range(4):
                        perms[i]=str(perms[i])

                    if(sum==10):
                        ans='(('+perms[0]+mp[v[0]]+perms[1]+')'+mp[v[1]]+perms[2]+')'+mp[v[2]]+perms[3]

                    for i in range(4):
                        perms[i]=int(perms[i])


        for v[0] in range(3):
            for v[1] in range(3):
                for v[2] in range(3):
                    lsum=calc(perms[0],perms[1],v[0])
                    rsum=calc(perms[2],perms[3],v[2])
                    sum=calc(lsum,rsum,v[1])
                    for i in range(4):
                        perms[i]=str(perms[i])

                    if(sum==10):
                        ans='('+perms[0]+mp[v[0]]+perms[1]+')'+mp[v[1]]+'('+perms[2]+mp[v[2]]+perms[3]+')'

                    for i in range(4):
                        perms[i]=int(perms[i])

        for v[0] in range(3):
            for v[1] in range(3):
                for v[2] in range(3):
                    sum=calc(perms[1],perms[2],v[1])
                    sum=calc(perms[0],sum,v[0])
                    sum=calc(sum,perms[3],v[2])
                    for i in range(4):
                        perms[i]=str(perms[i])

                    if(sum==10):
                        ans='('+perms[0]+mp[v[0]]+'('+perms[1]+mp[v[1]]+perms[2]+'))'+mp[v[2]]+perms[3]

                    for i in range(4):
                        perms[i]=int(perms[i])
        
        for v[0] in range(3):
            for v[1] in range(3):
                for v[2] in range(3):
                    sum=calc(perms[2],perms[3],v[2])
                    sum=calc(perms[1],sum,v[1])
                    sum=calc(perms[0],sum,v[0])
                    for i in range(4):
                        perms[i]=str(perms[i])

                    if(sum==10):
                        ans=perms[0]+mp[v[0]]+'('+perms[1]+mp[v[1]]+'('+perms[2]+mp[v[2]]+perms[3]+'))'

                    for i in range(4):
                        perms[i]=int(perms[i])

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

Measured memory_bytes: 7936
n=int(input())
a=list(map(int,input().split()))
for i in range(0,n):
    v=a[i]
    j=i-1
    while j>=0 and a[j]>v:
        a[j+1]=a[j]
        j-=1
    a[j+1]=v
    print(" ".join(map(str,a)))



Measured memory_bytes: 5596
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

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

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

ll min(ll a, ll b) {return a < b ? a : b;}
ll min(int a, ll b) {return a < b ? a : b;}
ll min(ll a, int b) {return a < b ? a : b;}
ll min(int a, int b) {return a < b ? a : b;}

ll max(ll a, ll b) {return a > b ? a : b;}
ll max(int a, ll b) {return a > b ? a : b;}
ll max(ll a, int b) {return a > b ? a : b;}
ll max(int a, int b) {return a > b ? a : b;}

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

const int N = 6010;
const long long MOD = 998244353;

int n, m;
int x[N], y[N];
set<vector<int> > s;
long long st2[N];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    st2[0] = 1;
    for (int i = 1; i < N; i++) st2[i] = st2[i - 1] * 2 % MOD;
    for (int i = 0; i < n; i++)
    {
        cin >> x[i] >> y[i];
    }
    long long ans = 1;
    for (int i = 0; i < n; i++)
    {
        ans = ans * 2 % MOD;
        for (int j = i + 1; j < n; j++)
        {
            vector<int> v;
            for (int k = 0; k < n; k++)
            {
                if (k == i || k == j)
                {
                    v.push_back(k);
                    continue;
                }
                if ((x[k] - x[i]) * (y[j] - y[i]) == (x[j] - x[i]) * (y[k] - y[i]))
                {
                    v.push_back(k);
                }
            }
            //for (auto e : v) cout << e << " "; cout << "\n";
            s.insert(v);
        }
    }
    ans = (ans - n - 1 + MOD) % MOD;
    for (auto it : s)
    {
        //cout << it.size() << endl;
        ans = (ans - st2[it.size()] + it.size() + 1 + MOD) % MOD;
    }
    cout << ans;
}


Measured memory_bytes: 2176
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()    // 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend() // 降順ソート 例：sort(DESC(vec));
#define rep(i, n) for (int i = 0; i < (n); i++)
#define Rep(i, n) for (int i = 1; i < n; i++)
#define REP(i, vec) for (auto i = vec.begin(); i != vec.end(); ++i)

const int       mod = 1000000007;
const int       inf = (1 << 21);
const long long INF = 1LL << 60;

using ll = long long;
using ii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

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>
T GCD(T a, T b) { if (b == 0) return a; else return GCD(b, a % b); }
template<class T>
T LCM(T a, T b) { return a / GCD(a, b) * b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

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

	for (int i = 1; i <= 9; ++i) {
		if (n % i == 0 && n / i <= 9) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 3612
#include <cassert>
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <cfenv>
#include <cinttypes>
#include <cstdint>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <chrono>
#include <forward_list>
#include <initializer_list>
#include <random>
#include <ratio>
#include <regex>
#include <system_error>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#if __cplusplus >= 201402L
#include <shared_mutex>
#endif

#define rep(i,n) for(ll i = 0;i < n;++i)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
typedef pair<int,int> P;

const int INF = 1001001001;
const long double PI = (acos(-1));
const int mod = 1e9+7;
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};



int main(){
 
    ll n;
    cin >> n;
    ll now = 1000;
    ll sum = 0;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n-1){
        if(a[i] < a[i+1]){
            sum = now / a[i];
            now -= sum * a[i];
            now += sum * a[i+1];
        }
    }
    cout << now << endl;


    return 0;
}


Measured memory_bytes: 3168
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define llu unsigned long long int
#define Endl endl
#define mod  998244353
#define mkp make_pair
#define pb push_back
#define cin(n) scanf("%d",&n)
#define cout(n) printf("%d ",n)
#define sf(n) scanf("%d",&n)
#define pf(n) printf("%d ",n)
#define bitget(n) __builtin_popcountll(n)
ll dx[] = {1,1,0,-1,-1,-1,0,1};
ll dy[] = {0,-1,-1,-1,0,1,1,1};
ll dxx[] = {1,-1,0,0};
ll dyy[] = {0,0,-1,1};
ll modexpo(ll x,ll y){if(y==0)return 1;if(y%2){ll viky=modexpo(x,y/2);
return (((x*viky)%mod)*viky)%mod;}else{ll viky=modexpo(x,y/2);return (viky*viky)%mod;
}}
bool isvalid(ll x,ll y,ll n, ll m) { return (x>=0&&x<n&&y>=0&&y<m); }



int main() {
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    string s;
    cin>>s;
    
    for(ll i=0;i<s.size();i++){
        if(i%2){
            if(s[i]=='L'||s[i]=='U'||s[i]=='D'){
                continue;
            }else{
                cout<<"No";
                return 0;
            }
        }else{
            if(s[i]=='R'||s[i]=='U'||s[i]=='D'){
                continue;
            }else{
                cout<<"No";
                return 0;
            }
        }
    }
    cout<<"Yes";

    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define mem(a) memset(a,0,sizeof(a))
#define sqr(x) ((x)*(x))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;

const int mn=1e5+5;

int a[mn];
int n;

vector<int> v;

ll ans=0;
void calc(){
	ll rans=0;
	for(int i=0;i<sz(v)-1;i++){
		rans+=abs(v[i+1]-v[i]);
		//printf("%d %lld\n",v[i],rans);
	}
	ans=max(ans,rans);
}

int main() {
	//cin.sync_with_stdio(0);
#ifdef LOCAL
	freopen("../1.txt", "r", stdin);
	clock_t cc=clock();
#endif
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	if (n%2==0){
		int l=(1+n)/2,r=n;
		while(l>0) v.pb(a[l--]),v.pb(a[r--]);
		calc();
	}
	else{
		int l=1,r=n;
		int mid=(l+r)>>1;
		int ul=mid-1;
		while(ul>=1){
			v.pb(a[ul--]);
			v.pb(a[r--]);
		}
		v.pb(a[mid]);
		calc();


		v.clear();
		reverse(a+1,a+n+1);
		l=1,r=n;
		mid=l+r>>1;
		ul=mid-1;
		while(ul>=1){
			v.pb(a[ul--]);
			v.pb(a[r--]);
		}
		v.pb(a[mid]);
		calc();
	}
	printf("%lld\n",ans);
#ifdef LOCAL
	cout<<"time:"<<(double)(clock()-cc)/CLOCKS_PER_SEC;
#endif
	return 0;
}

Measured memory_bytes: 1276
N = int(input())
s = str(input())
cntA = 0
cntB = 0

for i in  s:
    if i == "R":
        cntA = cntA + 1
    else:
        cntB = cntB + 1
        
if cntA > cntB:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define sz(x) int(x.size())
using ll=long long;
const ll MOD=1000000007;



int main() {
    string N;
    cin>>N;
    rep(i,3){
        if(N.at(i)=='7'){cout<<"Yes"<<endl;return 0;}
    }
    cout<<"No"<<endl;
}


Measured memory_bytes: 3624
/*Bismillahir Rahmanir Rahim */
	/**
	 *	author: al-muzahid
	 *	created: 27.04.2020 07:47:51
	**/

	#include<bits/stdc++.h>
	#define tt int t; cin>>t; while(t--)
	#define nl cout<<"\n";
	#define sp cout<<" ";
	#define rep(i, a, b) for(long long i=a; i<b; i++)
	#define pi acos(-1)
	#define gcd(a,b) __gcd(a,b)
	#define lcm(a,b) (((a)/gcd(a,b))*b)
	#define vc vector<ll>
	#define pb push_back
	#define sf scanf
	#define pf printf
	#define in(a) scanf("%lld",&a)
	#define in1(x,y) scanf("%lld %lld",&x,&y)
	#define el << endl
	#define yes cout<<"YES"<<endl;
	#define no cout<<"NO"<<endl;
	#define dec_place(d,x) cout<<fixed<<setprecision(d)<<x<<endl
	#define print(x) cout<<x<<endl
	#define srt(a) sort(a.begin(), a.end())
	#define rsrt(a) sort(a.rbegin(), a.rend())
	#define fri(i,n) for(ll i=0; i<n; i++)
	#define frj(j,n) for(ll j=0; j<n; j++)
	#define mod 1000000007
	#define fast ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
	#define tc  ll test = input(); for(ll i=1; i<=test; i++)
	#define all_variables ll a,b,c,x,y,z,i,j,k,l,m,n,p,q,r,sum=0,pos=0,cnt=0,pnt=0,flag=0; double avg=0,xx=0,yy=0,zz=0; string s,s1,s2,s3; bool is=false;
	typedef long long ll;
	typedef long long unsigned llu;
	typedef long double ld;

	#include<stdio.h>
	#include<string.h>
	#include<math.h>
	#include<time.h>
	#include<iomanip>
	#include<set>
	#include<map>
	#include<vector>
	#include<cstdio>
	#include<cmath>
	#include<ctime>
	#include<algorithm>

	using namespace std;

int main()
{
	fast;
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	///Write Code Here
	///---------------------------------------------------------------------
	//all_variables;




	string s,p;
	cin>>s>>p;
	int l = s.size();
	int len = p.size();
	int i,j,cnt=0;
	if(l+1==len){

		for(i=0, j=0 ; i<l; i++, j++)
		{
			if(s[i]==p[j])cnt++;
		}
		if(cnt==l) cout << "Yes" << endl;
		else cout << "No" << endl;


	}
	else cout << "No" << endl;







	///---------------------------------------------------------------------
	return 0;
}



Measured memory_bytes: 3640
#include"bits/stdc++.h"
using namespace std;

int f(int x){
  int res = 0;
  while(x % 2 == 0) {
    x /= 2;
    res++;
  }
  return res;
}

template<typename T>
T gcd(T a, T b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

template<typename T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
}

void Main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }

  for (int i = 0; i < n; i++) {
    if (a[i] % 2 == 1) {
      cout << 0 << endl;
      return;
    }
    a[i] /= 2;
  }

  int t = f(a[0]);
  for (int i = 0; i < n; i++) {
    if (f(a[i]) != t) {
      cout << 0 << endl;
      return;
    }
    a[i] >>= t;
  }
  m >>= t;

  long long l = 1;
  for (int i = 0; i < n; i++) {
    l = lcm(l, (long long)a[i]);
    if (l > m) {
      cout << 0 << endl;
      return;
    }
  }

  m /= l;
  int ans = (m + 1) / 2;
  cout << ans << endl;
}

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


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

int main() {
	int X, Y, Z, K;
	cin >> X >> Y >> Z >> K;
	vector<long long>A(X);
	vector<long long>B(Y);
	vector<long long>C(Z);
	for (int n = 0;n<X;++n) {
		cin >> A[n];
	}
	for (int n = 0; n < Y; ++n) {
		cin >> B[n];
	}
	for (int n = 0; n < Z; ++n) {
		cin >> C[n];
	}
	sort(A.begin(), A.end(), greater<long long>()); 
	sort(B.begin(), B.end(), greater<long long>());
	sort(C.begin(), C.end(), greater<long long>());
	using Data = pair<long long, tuple<int, int, int>>;
	priority_queue<Data>que;
	set<Data>st; 
	que.push(Data(A[0]+B[0]+C[0], make_tuple(0,0,0)));
	for (int n = 0;n<K;++n) {
		Data  d = que.top();
		que.pop();
		cout << d.first<<endl; 
		int i = get<0>(d.second); 
		int j = get<1>(d.second); 
		int k = get<2>(d.second);
		{
			if (X > i+1) {
				Data d0 = Data(A[i + 1] + B[j] + C[k], make_tuple(i + 1, j, k));
				if (!st.count(d0)) {
					st.insert(d0);
					que.push(d0);
				}
			}
		} 

		{	
			if (Y > j + 1) {
				Data d0 = Data(A[i] + B[j + 1] + C[k], make_tuple(i, j + 1, k));
				if (!st.count(d0)) {
					st.insert(d0);
					que.push(d0);
				}
			}
		}

		{	
			if (Z > k + 1) {
				Data d0 = Data(A[i] + B[j] + C[k + 1], make_tuple(i, j, k + 1));
				if (!st.count(d0)) {
					st.insert(d0);
					que.push(d0);
				}
			}
		}
	}
	return 0;
}

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


#define li          long long int
#define uli         unsigned long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


int main() {
    li a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max(max(a*c, a*d), max(b*c, b*d))<<endl;
    return 0;
}


Measured memory_bytes: 3632
"use strict";

const main = arg => {
    const inputList = arg.trim().split("\n");
    // 回答を記述
    const A = BigInt(inputList[0].split(" ")[0]);
    const B = inputList[0].split(" ")[1]
    const num = A * BigInt(parseInt(B.replace(".", ""))) / 100n;
    console.log(num.toString());
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29476
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <map>
#include <iomanip>
#include <climits>
#include <cmath>
#define ll long long int
#define MOD 1000000007
#define IOS ios::sync_with_stdio(false)  ;cin.tie()  ; cout.tie()

using namespace std;



int main()
{
    IOS;
    string s ;
    cin>>s ;
    int arr[26]  ;
    fill(arr , arr + 26 , 0) ;
    for(int i =  0 ; i < s.length() ; ++i)
    {
        arr[s[i]-'a']++ ;

    }
    for(int i = 0  ; i < 26  ;++i)
    {
        if(arr[i] == 0)
        {
            cout<<char(i + 'a') <<"\n";
            return 0  ;

        }
    }

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


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define testbit(mask,i) (((mask)>>(i))&1)
#define setbit(mask,i) ((mask)|(1<<i))
#define delbit(mask,i) ((mask)^(1<<i))
#define lowbit(x) ((x)&(-x))
#define randome_generate srand(std::chrono::high_resolution_clock::now().time_since_epoch().count())
using namespace std;
string s;
int dp[1000100][2];
int a[1000100];
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>s;
	int n=s.size();
	s="?"+s;
	for(int i=1;i<=n;i++)
		a[i]=(s[i]-'0');
	//dp[i][0]:ith pay normal
	//dp[i][1]:ith pay extra
	dp[0][1]=1;
	dp[0][0]=0;
	for(int i=1;i<=n;i++){
		dp[i][0]=a[i]+dp[i-1][0];
		dp[i][0]=min(dp[i-1][1]+10-a[i],dp[i][0]);//change money
		dp[i][1]=a[i]+1+dp[i-1][0];//fill +1(no change)
		dp[i][1]=min(dp[i-1][1]+9-a[i],dp[i][1]);//change money
	}
	cout<<dp[n][0]<<endl;
	return 0;
}


Measured memory_bytes: 13128
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
template<typename T>
void chmax(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void chmin(T& a, T b) {
	a = min(a, b);
}

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////
class BITree {//1-index
	int N;
	vector<LL> bit;
public:
	BITree(int n) {
		N = n;
		bit = vector<LL>(N + 1, 0);//1-index
	}
	void add(int a, LL w) {//aにwを足す
		if (a <= 0 || N < a) return;//a:[1,N]
		for (int i = a; i <= N; i += i & -i) {
			bit[i] += w;
		}
	}
	LL sum(int a) {//[1,a]の和,a:[1,N]
		/*
		1番目からa番目までの和、1-index
		*/
		LL ret = 0;
		if (a > N) a = N;
		for (int i = a; i > 0; i -= i & -i) {
			ret += bit[i];
		}
		return ret;
	}
};
void solve() {
	int N;
	cin >> N;
	vector<int> A(N);
	IN(A);
	LL ans = 0;

	BITree bit(N);
	for (int i = 0; i < N; ++i) {
		LL res = bit.sum(A[i]);
		if (res==0) {
			++ans;
		}
		bit.add(A[i], 1);
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 2560
#include<iostream>
#include<vector>
#include<string>

using ll = long long;
const ll mod = 1e9 + 7;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};



std::istream& operator>>(std::istream& is, const mint& a) { return is >> a.x;}
std::ostream& operator<<(std::ostream& os, const mint& a) { return os << a.x;}

int main(){
    ll n, m;
    std::cin >> n >> m;
    if(n > m) std::swap(n, m); // nを小さくする

    if(std::abs(n - m) > 1) std::cout << 0 << std::endl;
    else{
      // m startで計算
      mint sum(1);
      for(int i = 0; i < n; i++){
        sum *= m - i;
        sum *= n - i;
      }

      if(n == m){
        // n startとm startの両方があり得る
        sum *= 2;
      }else{
        // m startしかありえない
      }
      std::cout << sum << std::endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string S,T;cin>>S>>T;
  int l=S.size();
  int cnt=0;
  for(int i=0;i<l;i++){
    if(S[i]!=T[i])cnt++;
  }
  cout<<cnt<<endl;
}


Measured memory_bytes: 3896
import math
def f(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N = int(input())

if N == 1:
    print(0)
    exit()

f = f(N)
ans = 0
for i in range(len(f)):
    ans += (math.sqrt(1+8*f[i][1]) - 1)//2

print(int(ans))


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

typedef long long ll;
typedef pair<ll, ll> ii;

#define Canuc80k cin.tie(0); cout.tie(0);
#define FOR(i,a,b) for (ll i=a;i<=b;i++)
#define FORD(i,a,b) for (ll i=a;i>=b;i--)
#define I_AM ios_base::sync_with_stdio(0);
#define FORS(i,a,b,c) for (ll i=a;i<=b;i+=c)
#define FORSD(i,a,b,c) for (ll i=a;i>=b;i-=c)

const ll N = 1e6 + 1;
const ll M = 1e9 + 7;

ll n, W;
ll v[N], w[N], m[N], dp[N];

int main() {
    I_AM Canuc80k

    cin >> n >> W;
    FOR (i, 1, n) 
        cin >> v[i] >> w[i] >> m[i];

    FOR (i, 1, n) 
        for (ll k = 0; m[i] > 0; k ++) {
            ll num = min(m[i], (1LL << k));
            
            m[i] -= num;
            FORD (j, W, w[i] * num) 
                dp[j] = max(dp[j], dp[j - w[i] * num] + v[i] * num);
        }

    cout << dp[W] << endl;
}


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

int main() {
    int N, A[20], x[20][20], y[20][20], ans = 0;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        cin >> A[i];
        for (int j = 0; j < A[i]; ++j) {
            cin >> x[i][j] >> y[i][j];
            --x[i][j];
        }
    }

    for (int i = 0; i < (1 << N); ++i) {
        bool can = true;
        int cnt = 0;
        for (int j = 0; j < N; ++j) {
            if (i & (1 << j)) {
                for (int k = 0; k < A[j]; ++k) {
                    if (i & (1 << x[j][k])) {
                        if (!y[j][k]) {
                            can = false;
                            break;
                        }
                    }
                    else {
                        if (y[j][k]) {
                            can = false;
                            break;
                        }
                    }
                }
                if (can) {
                    ++cnt;
                }
                else {
                    break;
                }
            }
        }
        if (can) {
            ans = max(ans, cnt);
        }
    }

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

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

using namespace std;
 
int main(){
    int K, N;
    vector<int> L;

    cin >> N >> K;

    for(int i = 0; i < N; i++){
        int l;
        cin >> l;
        L.push_back(l);
    }

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

    int sum = 0;
    for(int i = N-1; i >= N-K; i--){
        sum += L[i];
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

const int mod = 1e9 + 7;

int main() {
	int n, a;

	cin >> n;
	vector<int> nums(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> a;
		nums[a]++;
	}

	long long ans = 1;
	if (n % 2 == 0) {
		for (int i = 1; i < n; i += 2) {
			if(nums[i] != 2) {
				ans = 0;
				break;
			} else {
				ans = ans * 2 % mod;
			}
		}
	} else {
		if (nums[0] != 1) {
			ans = 0;
		}
		for (int i = 2; i < n; i += 2) {
			if(nums[i] != 2) {
				ans = 0;
				break;
			} else {
				ans = ans * 2 % mod;
			}
		}
	}

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


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

int main() {
  int a,b;
  cin >> a >> b;
  
  if(a+b==15){
    cout << "+" << endl;
  }
  
  else if(a*b==15){
    cout << "*" << endl;
  }
  
  else{
    cout << "x" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 #include<map>
#include<cmath>
#define ll long long
using namespace std;
 
  
int main() {
 
      
 ll i,j,n,m,t;
  ll sum=0;
  cin>>t;
  map<string,int>mp;
  while(t--) 
  {
  	string str;
    
     cin>>str;
     mp[str]++;
     
  }
  
      bool ok=true;
  
  
      
     		 for(map<string,int >:: iterator it=mp.begin();it!=mp.end();it++)
     		 {
     		 	if(it->first=="AC")
     		 	{
     		 		cout<<it->first<<" "<<"x"<<" "<<it->second<<endl;
     		 		ok=false ;
				  }
     		 		
			  }
     	
		  if(ok)cout<<"AC"<<" "<<"x"<<" "<<0<<endl;
		   ok=true;
	 
     		 for(map<string,int >:: iterator it=mp.begin();it!=mp.end();it++)
     		 {
     		 	if(it->first=="WA")
     		 	{
     		 		cout<<it->first<<" "<<"x"<<" "<<it->second<<endl;
     		 		ok=false;
				  }
     		 		
			  }
     	if(ok)cout<<"WA"<<" "<<"x"<<" "<<0<<endl;
		   ok=true;
		 
		 
     		 for(map<string,int >:: iterator it=mp.begin();it!=mp.end();it++)
     		 {
     		 	if(it->first=="TLE")
     		 	{
     		 		cout<<it->first<<" "<<"x"<<" "<<it->second<<endl;
     		 		ok=false;
				  }
     		 		
			  }
     	
		 	if(ok)cout<<"TLE"<<" "<<"x"<<" "<<0<<endl;
		   ok=true;
	 
		 
		 ok=true;
     		 for(map<string,int >:: iterator it=mp.begin();it!=mp.end();it++)
     		 {
     		 	if(it->first=="RE")
     		 	{
     		 		cout<<it->first<<" "<<"x"<<" "<<it->second<<endl;
     		 		ok=false;
				  }
     		 		
			  }
     	    if(ok)cout<<"RE"<<" "<<"x"<<" "<<0<<endl;
		   ok=true;
    
 
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
using namespace std;
typedef long long ll;

// #define DEBUG

void printarray(int n, int a[])
{
    for (int i = 1; i < n + 1; i++)
    {
        cout << a[i];
        if (i != n)
            cout << " ";
    }
    cout << endl;
}

int cycleanalysis(int n, int a[])
{
    int pos, ret, next;
    pos = 0, ret = 0;
    for (int i = 1; i < n + 1; i++)
    {
        pos = i;
        while (a[pos] != pos)
        {
            ret += (a[pos] + a[a[pos]]);
            next = a[pos];
            swap(a[pos], a[a[pos]]);
            pos = next;
        }
    }

    return ret;
}

int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int q, op, x;
    string key;
    cin >> q;
    map<string, int> mp;
    for (int i = 0; i < q; i++)
    {
        cin >> op >> key;
        if (op == 0)
        {
            cin >> x;
            if (mp.count(key))
                mp[key] = x;
            else
                mp.insert(make_pair(key, x));
        }
        else if (op == 1)
        {
            cout << (mp.count(key) ? mp.at(key) : 0) << endl;
        }
        else if (op == 2)
        {
            mp.erase(key);
        }
    }

    return 0;
}

// getline(cin,s);
// a = strtok(s, ",");  ","で分解
// for (int i = 0; i < n; i++)


Measured memory_bytes: 27712