akhauriyash/Code-Regression huggingface dataset:
/*▄███████▀▀▀▀▀▀███████▄
░▐████▀▒ЗАПУСКАЕМ▒▀██████▄
░███▀▒▒▒▒▒ДЯДЮ▒▒▒▒▒▒▀█████
░▐██▒▒▒▒▒БОГДАНА▒▒▒▒▒████▌
░▐█▌▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒████▌
░░█▒▄▀▀▀▀▀▄▒▒▄▀▀▀▀▀▄▒▐███▌
░░░▐░░░▄▄░░▌▐░░░▄▄░░▌▐███▌
░▄▀▌░░░▀▀░░▌▐░░░▀▀░░▌▒▀▒█▌
░▌▒▀▄░░░░▄▀▒▒▀▄░░░▄▀▒▒▄▀▒▌
░▀▄▐▒▀▀▀▀▒▒▒▒▒▒▀▀▀▒▒▒▒▒▒█
░░░▀▌▒▄██▄▄▄▄████▄▒▒▒▒█▀
░░░░▄█████████████  █▒▒▐▌
░░░▀███▀▀████▀█████▀▒▌
░░░░░▌▒▒▒▄▒▒▒▄▒▒▒▒▒▒▐
░░░░░▌▒▒▒▒▀▀▀▒▒▒▒▒▒▒▐*/
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3")
#pragma GCC optimize("fast-math")
#include <iostream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define DEBUG
#define fi first
#define se second
#define pqueue priority_queue
#define pb(x) push_back(x)
//#define endl '\n'
#define all(x) x.begin(), x.end()
#define int long long
#define mk(a, b) make_pair(a, b)
     
using namespace std;
      
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<ll> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
// typedef tuple<ll, ll, ll> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef pair<ll, ll> pll;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector< vector<ll> > vvi;
typedef vector<char> vc;
      
const ll INF = 1e9 + 228;
const ll INFLL = 1e18;
const ll MOD = 1e9 + 7;
//static const int maxn = 2e5 + 228;;
const ld eps = 1e-7;
const ld eps2 = 1e-9;
const ll MOD2 = 998244353;
const ll dosz = 5e5;
const ll SZ = (1<<18);
const ld PI = atan2l(0, -1);
     
void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef DEBUG
//      freopen("haybales.in", "r", stdin);
//      freopen("haybales.out", "w", stdout);
    #endif
}

void solve(){
	int n;
	cin >> n;
	vi nums(n);
	for(int &i:nums)
		cin >> i;
	int minim = INF;
	int ans = 0;
	for(int i=0; i<n; i++){
		if(nums[i] < minim){
			ans++;
			minim = nums[i];
		}
	}
	cout << ans << endl;
	
}

signed main(){
        fast_io();
	srand(time(NULL));
//	cout << fixed << setprecision(12);
	int q = 1;
//	cin >> q;
	while(q--)
		solve();
     
}





Measured memory_bytes: 1792
import heapq
N, M = map(int, input().split())
A = list(map(int, input().split()))
h=[]
for i in range(N):
    heapq.heappush(h, (-A[i], A[i]))

for i in range(M):
    a = heapq.heappop(h)[1]//2
    heapq.heappush(h, (-a, a))

ans = 0
for i in range(N):
    ans += heapq.heappop(h)[1]

print(ans)

Measured memory_bytes: 20420
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define what_is(x) cerr << #x <<" is " << x << endl;
typedef long long ll;
const double PI = 3.14159265358979;
const ll INF =  1e15 + 7;
const ll MOD = 998244353;
const ll nax = 1010;

ll add(ll n) {
	ll s = 0, e = n;
	ll ans = 0;
	while (s <= e) {
		ll mid = (s + e) / 2;
		if (mid * (mid + 1) <= 2 * n) {
			s = mid + 1;
			ans = mid;
		}
		else e = mid - 1;
	}
	return ans;
}


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tc = 1;
	// cin >> tc;
	while (tc--) {
		ll n;
		cin >> n;
		ll ans = 0;
		ll cnt = 0;
		while (n % 2 == 0) {
			cnt++;
			n /= 2;
		}
		ans += add(cnt);
		for (ll i = 3 ; i * i <= n ; i += 2) {
			cnt = 0;
			while (n % i == 0) {
				cnt++;
				n /= i;
			}
			ans += add(cnt);
		}
		if (n > 2) {
			ans++;
		}
		cout << ans;
	}
	return 0;
}




















Measured memory_bytes: 3648
H, W = map(int, input().split())
canvas = list(list(input()) for _ in range(H))
dx_list = [0, 1, 0, -1]
dy_list = [1, 0, -1, 0]
for x in range(W):
    for y in range(H):
        if canvas[y][x] == ".":
            continue
        is_connect = False
        for dx, dy in zip(dx_list, dy_list):
            if 0 <= x + dx < W and 0 <= y + dy < H:
                if canvas[y + dy][x + dx] == '#':
                    is_connect = True
        if not is_connect:
            print("No")
            exit()
print('Yes')

Measured memory_bytes: 3064
mod=1000000
n,m=map(int,input().split())
dp=[[0]*5 for _ in range(n)]
dp[0]=[1,1,1,1,0]
if m==1:print((1<<n)%mod)
else:
    for i in range(1,n):
        dp[i][0]=(sum(dp[i-1])-dp[i-1][3])%mod
        dp[i][1]=sum(dp[i-1][:3])%mod
        dp[i][2]=sum(dp[i-1][:4])%mod
        dp[i][3]=sum(dp[i-1][:4:3])%mod
        dp[i][4]=sum(dp[i-1][2::2])%mod
    print(sum(dp[n-1][:4])%mod)

Measured memory_bytes: 7792
#include<cstdio>
#include<cmath>
#define PI 3.14159
using namespace std;
int main(void){
    int n;
    while(1){
        scanf("%d",&n);
        if(n==-1)break;
        double t=0.0;
        for(int i=1;i<n;i++){
            t+=acos(sqrt(i)/sqrt(i+1));
            if(t>=2.0*PI)t-=2.0*PI;
        }
        printf("%.2lf\n%.2lf\n",cos(t)*sqrt(n),sin(t)*sqrt(n));
    }
        return 0;
}

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

using namespace std;

int n,xb,a[1200][1200];

int main(){
	scanf("%d",&n);
	for (int i=1;i<=n+1;++i)
		if (i*(i-1)/2==n){
			printf("Yes\n%d\n",i);
			for (int j=1;j<=i;++j){
				printf("%d",i-1);
				for (int k=1;k<=i;++k){
					if (k<j) a[j][k]=a[k][j];
					if (k>j) a[j][k]=++xb;
					if (k!=j) printf(" %d",a[j][k]);
				}
				puts("");
			}
			return 0;
		}
	puts("No");
	
	return 0;
}
			

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

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

	vector<int> Button(N);
	for (int i = 0; i < N; i++) {
		int z;
		cin >> z;
		--z;
		Button.at(i) = z;
	}
    
	//入力層終わり
	int cnt = 0;
	int tmp = 0;

	for (;;) {
		if (tmp == 1) {
			cout << cnt << endl;
			break;
		}

		if (cnt >= N) {
			cout << "-1" << endl;
			break;
		}
		tmp = Button.at(tmp);
		++cnt;
	}

	return 0;
}


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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}



int main(){
  int X; cin >> X;
  cout << 1 - X << endl;

  return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a, b, c, ans;
    ans = 1;
    cin >> a >> b >> c;
    if (a != b)
    {
        ans++;
    }
    if (a != c && b != c)
    {
        ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import Counter,defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n = inp()
a = inpl()
d = defaultdict(int)
for i in a:
    d[i//400] += 1
c = 0
f = 0
for key in d.keys():
    if key < 8:
        c += 1
    else:
        f += d[key]
if c == 0:
    print(1,f)
else:
    print(c,c+f)



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

using namespace std;
#define pb push_back
#define ll long long
#define ff first
#define ss second
#define fio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);


int main() {
    fio;
    
    ll n,m;cin>>n>>m;
    if(n==m)
        cout<<"Yes\n";
    else    
        cout<<"No\n";
    
    
	return 0;
}

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

using namespace std;
typedef long long int ll;
#define rep(i, n) for(int i=0;i< int (n);i++)

int main(void)
{
    ll x, y;
    ll sum = 0;

    cin >> x >> y;

    rep(i,  x + y-1)
    {
        sum += i+1;
    }

    cout << sum - x * y << endl;

}

   

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
/*
alias g='g++ -std=c++17 -O2 pra.cpp'
cd programming
cd cpp
cd practice

*/
#define rep(i, n) for(int i=0; i<(n); i++)
using veci = vector<int>;
using ll = long long;
int c[10010];
int a[2020202];
int b[2000200];
int pertition(int a[], int p, int r){//配列の最後の要素の値を基準に分割
    int x=a[r];
    int i=p-1;//iが小さいほうのまとまりをみる下限
    for (int j=p; j<r; j++){//jが大きいほうのまとまりを見る下限
        if (a[j] <= x){
            i++;
            swap(a[i], a[j]);
        }
    }
    swap(a[i+1], a[r]);
    return i+1;
}
int main(){
    int n;
    cin >> n;
    rep(i, n)cin >> a[i];
    int ans = pertition(a, 0, n-1);
    rep(i, n){
        if (i == ans) cout << "[";
        cout << a[i];
        if (i == ans) cout << "]";
        if (i != n-1) cout << " ";
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3488
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  ll x;
  cin >> x;

  int y=0;
  if(x%11<=6&&x%11!=0){
    y=1;
  }else if(x%11<=10&&x%11>=7){
    y=2;
  }
  cout << (x/11)*2+y << endl;
}

Measured memory_bytes: 256
import sys,bisect,math
from functools import reduce
sys.setrecursionlimit(15000)

N = int(sys.stdin.readline())

def phi(N):
  n = N
  s = set()
  for i in range(2,math.floor(pow(N,0.5))+1):
    while n%i==0:
      s.add(i)
      n = n//i
  if n != 1:
    s.add(n)
  a1 = reduce(lambda a,b: a*b,[e-1 for e in s])
  a2 = reduce(lambda a,b: a*b,[e for e in s])
  #print(N,a1,a2)
  return a1*N//a2

print(phi(N))


Measured memory_bytes: 6408
import math
n = int(input())
A = list(map(int, input().split()))
lg = 0
for a in A:
    if a == 0:
        print(0)
        exit()
    lg += math.log10(a)
if lg > 18:
    print(-1)
else:
    ans = 1
    for a in A:
        ans *= a
    if ans > 10**18:
        print(-1)
    else:
        print(ans)

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

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  int Ans;
  Ans = max(10*A+B+C,A+10*B+C);
  Ans = max(Ans,A+B+10*C);
  printf("%d",Ans);
  return 0;
}

Measured memory_bytes: 256
#include <cstdio>



int main(){
    int x;
    scanf("%d",&x);

    if (x<600)
        puts("8");
    else if (x<800)
        puts("7");
    else if (x<1000)
        puts("6");
    else if (x<1200)
        puts("5");
    else if (x<1400)
        puts("4");
    else if (x<1600)
        puts("3");
    else if (x<1800)
        puts("2");
    else 
        puts("1");


    return 0;
}

Measured memory_bytes: 1656
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, a, b) for (int i = (a); i < (int)(b); i++)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef long long ll;
#define ALL(V) V.begin(), V.end()


ll Main(int N, int M, VI& A)
{
    sort(ALL(A));
    make_heap(ALL(A));
    REP(i, M) {
        int a = A.front();
        a >>= 1;
        pop_heap(ALL(A));
        A.pop_back();
        A.push_back(a);
        push_heap(ALL(A));
    }
    return accumulate(ALL(A), 0LL);
}

int main(void){
    int N, M;
    cin >> N >> M;
    VI A(N);
    REP(i, N) cin >> A[i];
    cout << Main(N, M, A) << endl;
    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>

int A[10000];
int main( void ) 
{
  
    int mini,n,count=0;
    scanf( "%d", &n );
     
    int i, j;

    for( i=0; i<n; i++ ) 
	{
       scanf( "%d", &A[i] );
    }
    for( i=0;i<n;i++) 
    {    
		mini = i;
        for(j=i;j<n;j++)
        {
            if(A[mini]>A[j])
            {
				mini = j;
            }
        }
		if(i!=mini)
			{
				int temp = A[mini];
				A[mini] = A[i];
				A[i] = temp;
				count++;
			}
    }
	for(i = 0 ; i < n-1 ; i++)printf("%d ",A[i]);
 
	printf("%d\n",A[i]);
	printf("%d\n",count);
    return 0;
	
}

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

struct Card {
  char suit;
  int num;
  string value () {
    return suit + to_string(num);
  }
};

void trace(vector<Card> C, int N) {
  for (int i = 0; i < N; i++) {
    if (i > 0) cout << ' ';
    cout << C[i].value();
  }
  cout << endl;
}

void bubbleSort(vector<Card>& C, int N) {
  for (int i = 0; i < N; i++) {
    for (int j = N-1; j > i; j--) {
      if (C[j].num < C[j-1].num) {
        Card temp = C[j];
        C[j] = C[j-1];
        C[j-1] = temp;
      }
    }
  }
}

void selectionSort(vector<Card>& C, int N) {
  for (int i = 0; i < N; i++) {
    int minJ = i;
    for (int j = i; j < N; j++) {
      if (C[j].num < C[minJ].num) {
        minJ = j;
      }
    }
    if (minJ != i) {
      Card temp = C[i];
      C[i] = C[minJ];
      C[minJ] = temp;
    }
  }
}

bool isStable(vector<Card> A, vector<Card> B, int N) {
  for (int i = 0; i < N; i++) {
    if (A[i].value() != B[i].value()) return false;
  }
  return true;
}
  
int main() {
  int N;
  cin >> N;
  vector<Card> A(N);
  vector<Card> B(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i].suit >> A[i].num;
    B[i] = A[i];
  }
  bubbleSort(A, N);
  trace(A,N);
  cout << "Stable" << endl;
  selectionSort(B, N);
  trace(B,N);
  cout << (isStable(A, B, N) ? "Stable" : "Not stable") << endl;
}


Measured memory_bytes: 3296
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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 lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = __LONG_LONG_MAX__;

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0,-1,1,-1,1};
vector<int> dy = {0,-1,0,1,1,-1,-1,1};

/* template */

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,K; cin >> n >> K;
    vector<pair<ll,ll>> p;
    rep(i,0,n){
        pair<ll,ll> a;
        cin >> a.second >> a.first;
        p.emplace_back(a);
    }
    sort(all(p));
    ll ans = LNF;
    rep(i,0,n){
        rep(j,1,n){
            vector<pair<ll,ll>> q;
            ll left = p[i].second;
            ll right = p[j].second;
            if(left>right) swap(left,right);
            rep(k,0,n){
                if(left<=p[k].second && p[k].second<=right) q.emplace_back(p[k]);
            }
            if(q.size()<K) continue;
            int index = 0;
            while(index+K-1<q.size()){
                ll m = (right-left)*(q[index+K-1].first-q[index].first);
                chmin(ans,m);
                index++;
            }
        }
    }
    cout << ans << endl;
}

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

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = (a); i <= (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

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

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

template<class T> void inputVector(vector<T>& v, int n) {
    v.resize(n);
    for (int i = 0; i < v.size(); i++) cin >> v[i];
}

signed main() {
    int N, W;
    cin >> N >> W;

    vector<int> w(N), v(N);
    rep(i, N) cin >> w[i] >> v[i];

    int minW = *min_element(all(w));

    vector<int> vals[4];
    rep(i, N) {
	vals[w[i] - minW].push_back(v[i]);
    }
    rep(i, 4) {
	sort(all(vals[i]));
	reverse(all(vals[i]));
	REP(j, 1, (int) vals[i].size() - 1) {
	    vals[i][j] += vals[i][j - 1];
	}
    }

    int ret = 0;
    rep(a, vals[0].size() + 1) rep(b, vals[1].size() + 1) rep(c, vals[2].size() + 1) rep(d, vals[3].size() + 1) {
	int sumW = a * minW;
	sumW += b * (minW + 1);
	sumW += c * (minW + 2);
	sumW += d * (minW + 3);
	
	if (sumW > W) continue;

	int sumV = 0;
	if (a > 0) sumV += vals[0][a - 1];
	if (b > 0) sumV += vals[1][b - 1];
	if (c > 0) sumV += vals[2][c - 1];
	if (d > 0) sumV += vals[3][d - 1];

	ret = max(ret, sumV);
    }

    cout << ret << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
// unbounded knapsack..
using namespace std;
using ll=long long ;
int  main(){
        long long int  n;
        cin>>n;
        vector<long long int >p(n,0);
        for(long long int  i=0;i<n;i++){
            cin>>p[i];
        }
        vector<vector<long long int >>dp(n,vector<long long int >(n,0));
        for(long long int  l=0;l<=n-1;l++){
            for(long long int  i=0;i<n-l;i++){
                long long int  j=i+l;
                if(i==j) dp[i][j]=p[i];
                else {
                    dp[i][j]=max(p[i]-dp[i+1][j],(-1)*dp[i][j-1]+p[j]);
                }
            }
        }
    cout<<dp[0][n-1];
    return 0;

}

Measured memory_bytes: 70656
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
#include <complex>
#include <numeric>
#include <list>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi;

int main(void) {
  int n;
  cin >> n;
	vi a(n+2, 0);
	REP(i, n) cin >> a[i+1];
	vi oc(n+1);
	vi tc(n);
	REP(i, n+1) oc[i] = abs(a[i+1] - a[i]);
	REP(i, n) tc[i] = abs(a[i+2] - a[i]);

	int cost = 0;
	REP(i, oc.size()) cost += oc[i];

	REP(i, n) {
		int lcost = cost;
		lcost = lcost - oc[i] - oc[i+1];
		lcost += tc[i];
		cout << lcost << endl;
	}
}

Measured memory_bytes: 2432
d = int(input())
c = list(map(int,input().split()))
ans = []
fin = [1]*d
pen = [0]*26
sattemp = 0
sat = 0
sl = [list(map(int,input().split())) for i in range(d)]
for k in range(250):
    for i in range(d):
        s = sl[i]
        sp = sum(pen)
        temp = -(10**9)
        for j in range(26):
            if s[j]-(sp-pen[j])**(k*0.01) > temp:
                temp = s[j]-(sp-pen[j])**(k*0.01)
                tempans = j+1
        ans += [tempans]
        sattemp += s[tempans-1]-sp+pen[tempans-1]
        for j in range(26):
            pen[j] += c[j]
            pen[tempans-1] = 0
    if sattemp > sat:
        sat = sattemp
        fin = ans
    ans = []
    pen = [0]*26
    # print(k,sattemp)
    sattemp = 0
for i in fin:
    print(i)
# print(sat)

Measured memory_bytes: 9792
#include <iostream>
#include <cmath>

using namespace std;

int main() {
    int i,c,j,n,count = 0,number[10000];

    cin >> n;

    for(i = 0;i < n;i++){
        cin >> number[i];
        c = 0;
        for(j = 1;j <= sqrt(number[i]);j++){
            if(number[i] % j == 0){
                c++;
            }
        }
        if(c == 1){
            count++;
        }
    }
    cout << count << endl;
    
    return 0;
}

Measured memory_bytes: 1196
#include <stdio.h>

int main() {

    char x[10];
    scanf(" %s", &x);
    if(x[0]=='S'){
        printf("%s","Cloudy");
    }else if(x[0]=='C'){
    printf("%s","Rainy");
    }else if(x[0]=='R'){
    printf("%s","Sunny");
    }


	return 0;
}



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

int main() {
	int N;
	cin >> N;
	int ans = 30;	// 2**30 = 1073741824 (>10**9)
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		int cnt = 0;
		while (A > 0) {	// 各Aについて、2で何回割り切れるかカウント(cnt)
			if (A % 2 == 0)	{
				A /= 2;
				cnt++;
			}
			else {
				break;
			}
		}
		if (ans > cnt) {	// 各Aのcntの最小値をansに格納
			ans = cnt;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
const main = input => input.split('\n').slice(1).filter(x => x).map(line => line.split('').map(x => x === '#' ? 1 : 0)).map((vs, i, matrix) => vs.map((v, j) => v ? '#' : [].concat(...[i - 1, i, i + 1].map(x => [j - 1, j, j + 1].map(y => [x, y]))).map(t => (matrix[t[0]] && matrix[t[0]][t[1]])).filter(x => x).length).join('')).join('\n');

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


Measured memory_bytes: 11136
import kotlin.comparisons.compareBy
fun main(args: Array<String>) {
    val N = nextInt()
    val S = Array(N) { next() }
    val M = S.groupBy { it }.mapValues { it.value.size }.toList().sortedWith(compareBy({ -it.second }, { it.first }))
    val max = M[0].second
  //M.filter { it.second == max }.forEach { println(it.first) }
    println(M.filter { it.second == max }.map { it.first }.joinToString(separator = "\n"))
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt(delta: Int = 0) = listOfString().map { Integer.parseInt(it) + delta }
fun printErr(value: Any) = System.err.println(value)


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

using ll=long long;

ll pow_num(ll n,ll m){
  ll r=1;
  while(m){
    r=r*((m%2)?n:1),n=n*n,m>>=1;
  }
  return r;
}

int main(){

  ll N;
  cin >> N;

  if(N<=26){
    char instaAns = N+96;
    cout << instaAns << endl;
    return 0;
  }

  vector<ll> dp(100);
  dp[0]=26;
  int patern;
  for(int i=0;i<100;i++){
    dp[i+1]=dp[i]+pow_num(26,i+2);
    if(dp[i+1]>=N){
      patern=i+1;
      break;
    }
  }

  ll index_one = N-dp[patern-1]-1;//1から
  int order = patern+1;

  vector<int> ans(order);
  int bit = patern;
  for(int i=0;i<order;i++){
    ans[i]=index_one/pow_num(26,bit);
    index_one=index_one-ans[i]*pow_num(26,bit);
    ans[i]+=97;
    bit--;
  }

  string s="";
  char c;
  for(int i=0;i<order;i++){
    c=ans[i];
    s+=c;
  }

  cout << s << endl;

}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std::literals::string_literals;
using i64 = std::int_fast64_t;
using std::cout;
using std::cerr;
using std::endl;
using std::cin;

template<typename T>
std::vector<T> make_v(size_t a){return std::vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return std::vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

int main() {
	int n; scanf("%d", &n); std::vector<int> x(n);
	for(int i = 0; i < n; i++) scanf("%d", &x[i]);

	// solve
	i64 ans = 1, cnt = 0;
	const int MOD = 1e9 + 7;
	for(int i = 0; i < n; i++) {
		if(cnt * 2 < x[i]) {
			cnt++;
		} else {
			(ans *= cnt + 1) %= MOD;
		}
	}
	while(cnt) (ans *= cnt--) %= MOD;
	
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <iomanip>

using namespace std;

int main(){
    int N;
    cin >> N;
    int A[N];
    int B[N];
    for(int i=0; i<N; i++) cin >>A[i];
    for(int i=0; i<N; i++) cin >>B[i];
    long long sum=0;;

    for(int i=0; i<N; i++){
        if(A[i]<B[i]){
            sum += (B[i]-A[i])/2;
        }
        else{
            sum += B[i]-A[i];
        }
//        cout << sum << endl;
    }
    if(sum < 0 ){
        cout << "No"<< endl;
    }
    else{
        cout <<"Yes"<<endl;
    }
    return 0;
}

Measured memory_bytes: 384
import collections
import math


def main():
    n, p = map(int, input().split())

    a = collections.defaultdict(lambda: 0)

    if n == 1:
        print(p)
        return

    for i in range(2, int(math.sqrt(p)) + 1):
        while p % i == 0:
            a[i] = a[i] + 1
            p //= i

    ret = 1
    for k, v in a.items():
        if v >= n:
            ret *= k ** (v // n)

    print(ret)


main()


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

int main()
{
    char s[5];
    scanf("%s", s);
    int ans = 0;
    for (int i=0; i<4; i++)
    {
        if (s[i] == '+') ans ++;
        else ans --;
    }
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main(){
    int n;
    while(cin >> n,n){
        int ret=0;
        
        for(int i=2;i<=n;i++){
            for(int j=i;j<=n;j++){
                int sum=0;
                for(int k=0;k<i;k++){
                    sum += j-k;
                }
                if(sum == n) ret++;
            }
        }
        cout << ret << endl;
    }
}

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

using namespace std;
using LL = long long;
using P = pair<int, int>;

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

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e15;
const int MOD = 1e9 + 7;

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

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

    string s;
    cin >> s;
    int renzoku = 0;
    REP(i, s.size() - 1){
        if(s[i+1] != s[i]) renzoku++;
    }
    cout << renzoku << endl;
}


Measured memory_bytes: 512
h,w,a,b  = map(int,input().split())
lst_a  = [[1]*a + [0] * (w-a) for i in range(b)]
lst_b  = [[0]*a + [1] * (w-a)] * (h-b)
for i in lst_a:
 print(*i,sep="")
for i in lst_b:
 print(*i,sep="")

Measured memory_bytes: 9196
<?php
while (true) {
	list($x, $y, $z) = explode(' ', trim(fgets(STDIN)));
	if ($x == 0 && $y == 0 && $z == 0) {
		break;
	}
	$s1 = $x * $x + $y * $y;
	$s2 = $y * $y + $z * $z;
	$s3 = $z * $z + $x * $x;

	$s = min($s1, $s2, $s3);

	$n = trim(fgets(STDIN));

	for ($i = 0; $i < $n; $i++) {
		$r = trim(fgets(STDIN));
		if ($s < 4 * $r * $r) {
			echo "OK\n";
		} else {
			echo "NA\n";
		}
	}
}

Measured memory_bytes: 6604
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
#define INF 1000000001

int dx[4]={1,-1,0,0};
int dy[4]={0,0,1,-1};
//---------------------------
string PM(int x){
  string xx;
  if(x==0)xx='+';
  if(x==1)xx='-';
  return xx;
}

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  string s;cin>>s;
  int a=s[0]-48;
  int b=s[1]-48;
  int c=s[2]-48;
  int d=s[3]-48;
  string p;

  REP(i,2){
    REP(j,2){
      REP(k,2){
        if((a+b+c+d-2*i*b-2*j*c-2*k*d)==7){
          string ans=to_string(a)+PM(i)+to_string(b)+PM(j)+to_string(c)+PM(k)+to_string(d)+"=7";
          P(ans);
          return 0;
        }
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD 1000000007
using namespace std;

int main(void){
    int n;
    cin >> n;
    vector<long long> a(n+3,0);
    for(int i=1; i<=n; i++) cin >> a[i];
    vector<long long> dp(n+3,MOD);
    dp[1]=0;
    for(int i=1; i<=n; i++){
        dp[i+1]=min(dp[i+1],dp[i]+abs(a[i+1]-a[i]));
        dp[i+2]=min(dp[i+2],dp[i]+abs(a[i+2]-a[i]));
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/agc040_a.txt"); \
  cin.rdbuf(in.rdbuf());
#else
#define INPUT_FILE
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  string S;
  cin >> S;

  int N = S.size() + 1;
  vector<int> l(N, 0);
  vector<int> r(N, 0);
  for (int i = 1; i < N; i++) {
    if (S[i - 1] == '<') {
      l[i] = l[i - 1] + 1;
    } else {
      l[i + 1] = 0;
    }
  }
  for (int i = N - 1; i >= 0; i--) {
    if (S[i] == '>') {
      r[i] = r[i+1] + 1;
    } else {
      r[i] = 0;
    }
  }
  ll ans = 0;
  rep(i, N) { ans += max(r[i], l[i]); }

  // rep(i, N) { cout << r[i] << ' '; }
  // cout << endl;
  // rep(i, N) { cout << l[i] << ' '; }
  // cout << endl;
  // rep(i, S.size()) { cout << S[i] << ' '; }

  cout << ans << endl;
}

Measured memory_bytes: 4764
#include<bits/stdc++.h>
using namespace std;
int main()
{ 
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n,a[30],b[100],c[100],z=0;
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a[i];
  }for(int i=1;i<=n;i++){
    cin>>b[i];
  }for(int i=1;i<=n-1;i++){
    cin>>c[i];
  }
  for(int i=1;i<=n;i++){
    z+=b[a[i]];
    if(a[i+1]-a[i]==1){
      z+=c[a[i]];
    }
  }
  cout<<z<<"\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inv[123456];
ll sum[123456];
ll mod_pow(ll a,ll b = mod-2){
    if(b==0)return 1;
    if(b==1)return a;
    if(b%2==0){
        ll res = mod_pow(a,b/2);
        return res*res%mod;
    }else{
        ll res = mod_pow(a,b/2);
        return res*res%mod*a%mod;
    }
}
int main(){
    ll n;
    cin >> n;
    for(ll i = 1; i <= n; i++){
        inv[i] = mod_pow(i);
        sum[i] = (sum[i-1] + inv[i])%mod;
    }
    vector<ll>a(n);
    rep(i,n)cin >> a[i];
    ll ans = 0;
    rep(i,n){
        ans += a[i]*sum[n-i]+a[i]*sum[i+1]+mod-a[i];
        ans %= mod;
    }
    for(ll i = 1; i <= n; i++){
        ans *= i;
        ans %= mod;
    }
    cout << ans << endl;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define ip pair<ll,ll>
#define ff first
#define ss second
#define MAX 100005
const ll MOD = 1000000007;

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

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

	while(k--){
		vector<int> c(n+1,0);
		for(int i=0;i<n;i++){
			if(i - a[i] <= 0)
				++c[0];
			else
				++c[i-a[i]];

			if(i+a[i] >= n-1)
				--c[n];
			else
				--c[i+a[i]+1];
		}


		int flag = 0;
		for(int i=0;i<n;i++){
			a[i] = c[i];
			c[i+1] += c[i];
			if(a[i] != n)
				flag = 1;
		}

		if(!flag)
			break;
	}

	// cout<<k<<endl;

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

Measured memory_bytes: 5956
#include <iostream>

using namespace std;

int main(){
  int A,B,res=0;
  cin >> A >> B;

  res+=max(A,B);
  if(A>B) A--;
  else B--;
  res+=max(A,B);
  if(A>B) A--;
  else B--;
  cout << res << endl;
  return 0;
}


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

int n, q;
vector<int> A(20);
vector<int> M(200);


int Sumc(int c,int q_) {
	if (q_ == 0) return true;
	else if (q_ < 0 || c >= n) return false;
	
	return Sumc(c + 1, q_ - A[c]) || Sumc(c + 1, q_);
}

int main() {
	// input
	cin >> n;
	rep(i, n) {
		cin >> A[i];
	}
	cin >> q;
	rep(i, q) {
		cin >> M[i];
	}
	int cnt = 0;
	rep(i, q) {
		if (Sumc(cnt, M[i])) cout << "yes";
		else cout << "no";
		cout << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
#define all(n) begin(n), end(n)
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    int N,K;
    cin>>N>>K;
    vector<long double> p(N),psum(N);
    for (size_t i = 0; i < N; i++)
    {
        long double q;
        cin>>q;
        p[i]=(q+(long double)1)/(long double)2;
    }
    partial_sum(all(p),psum.begin());
    long double ans = psum[K-1];
    for (size_t i = 0; i+K < N; i++)
    {
        chmax(ans,psum[i+K]-psum[i]);
    }
    cout<<setprecision(30)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 9524
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

#define mp make_pair
#define pb push_back
#define ll long long

int n, a, b, i;

int main()
{
    //freopen("test.in","r",stdin);

    cin >> n >> a >> b;

    if ((a & 1) ^ (b & 1))
        cout << "Borys";
    else
        cout << "Alice";


    return 0;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll ans=1;    
    for (int i = 0; i < n; i++)
    {
        cin>>a[i];
        if(a[i]==0) 
        {
            ans=0;
        }
    }
    if(ans>0)
    {
        for (int i = 0; i < n; i++)
        {
            //cout<<i<<" "<<ans<<" "<<a[i]<<endl;
            if(sqrt(ans)*sqrt(a[i])>1e9+10.0)
            {
                ans=-1;
                break;
            }
            ans*=a[i];
            if(ans>(ll)1e18)
            {
                ans=-1;
                break;
            }
        }
    }

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

Measured memory_bytes: 4116
import java.util.*;

public class Main{
    Scanner in = new Scanner(System.in);

    String[] T = {"the", "that", "this"};

    void solve(){
        int[] a = new int[5];
        for(int i = 0; i < 5; i++){
            a[i] = in.nextInt();
        }
        Arrays.sort(a);
        for(int i = 4; i >= 0; i--){
            if(i != 4) System.out.print(" ");
            System.out.print(a[i]);
        }
        System.out.println();
    }
    
    public static void main(String[] args){
        new Main().solve();    
    }
}

Measured memory_bytes: 26112
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
signed main(){
  int a;
  cin>>a;
  int b=a/2;
  int c=a-b;
  cout<<b*c;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>
#include <math.h>
#include <numeric>
#include <string.h>
#include <sys/time.h>
#include <random>


#define fs first
#define sc second
#define endl "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<ll, ll> P;


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

    for(auto r: res){
        cout << r << endl;
    }




    return 0;
}


Measured memory_bytes: 4048
// #pragma GCC optimize("O3", "unroll-loops")
// #pragma GCC target("avx2")

#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 1e15 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;

void solve() {
  int n, m; cin >> n >> m;
  int H[n+5];
  set <int> s;
  for(int i = 1; i <= n; i++) cin >> H[i];
  while(m--) {
    int a, b; cin >> a >> b;
    if(H[a] >= H[b]) {
      s.insert(b);
    }
    if(H[b] >= H[a]) {
      s.insert(a);
    }
  }
  cout << (n-sz(s)) << '\n';
}   

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

    #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    #endif
    int t = 1; // cin >> t;
    for(int i = 1; i <= t; i++) {
        solve();
    }
}    


Measured memory_bytes: 7076
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int>h(n);
  for (int i=0; i<n; i++) cin >> h[i];
  int ans = 0;
  for (int i=0; i<n; i++){
  bool jud = true;
      for (int j=0; j<i; j++){
          if (h[j]>h[i]) jud = false;
      }
      if (jud ==true) ans++;
  }
  cout << ans;
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repr(i,n) for(int (i)=(n);(i)>0;(i)--)
#define rrep(i,n,m) for(int (i)=(n);(i)<(m);(i)++)
#define rrepr(i,n,m) for(int (i)=(n);(i)>(m);(i)--)
#define SORT(s) sort((s).begin(),(s).end())
#define SORTR(s,t) sort((s).begin(),(s).end(),greater<t>())

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<vector<int>> vvi;

const int INF = 1000000000;
const ll LINF = 1000000000000000000ll;
const double PI = acos(-1.0);
const double EPS = 1e-10;

const ll MOD = 1000000007ll;
const int MAX=510000;

int N,K; vll H;
void input()
{
    cin>>N>>K;
    rep(i,N){
        ll a; cin>>a; H.emplace_back(a);
    }
    return;
}

void solve()
{
    SORTR(H,ll);
    rep(i,min(N,K)) H[i]=0ll;
    ll ans=0ll;
    rep(i,N) ans+=H[i];
    cout<<ans<<endl;
    return;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    input();
    solve();
    return 0;
}

Measured memory_bytes: 2420
#include <stdio.h>
 
int main(){
   long a,b,c,n;
    
   scanf("%ld %ld %ld",&a,&b,&c);
   if (b<c) {
     n=2*b;
     c-=b;
   } else {
     n=b+c;
     c=0;
   }
   if (c>0 && c<=a) {
     n+=c;
     c=0;
   } else if (c>a) {
     n+=a;
     c-=a;
   }
   if (c>0) n++;
   printf("%d\n",n);
   return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define pii              pair <ull,int>
#define pll              pair <long long,long long>
#define sc               scanf
#define pf               printf
#define Pi               2*acos(0.0)
#define ms(a,b)          memset(a, b, sizeof(a))
#define pb(a)            push_back(a)
#define MP               make_pair
#define db               double
#define ll               long long
#define ull              unsigned long long
#define f                first
#define s                second
#define sqr(x)           (x)*(x)
#define VI               vector <int>
#define DBG              pf("Hi\n")
#define MOD              1000000007
#define SZ(a)            (int)a.size()
#define sf(a)            scanf("%d",&a)
#define sfl(a)           scanf("%lld",&a)
#define sff(a,b)         scanf("%d %d",&a,&b)
#define sffl(a,b)        scanf("%lld %lld",&a,&b)
#define sfff(a,b,c)      scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c)     scanf("%lld %lld %lld",&a,&b,&c)
#define loop(i,n)        for(int i=0;i<n;i++)
#define loop1(i,n)       for(int i=1;i<=n;i++)
#define REP(i,a,b)       for(int i=a;i<b;i++)
#define RREP(i,a,b)      for(int i=a;i>=b;i--)
#define intlim           2147483648
#define ull              unsigned long long
#define gcd(a, b)        __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b)))
#define mk(x1,y1) make_pair(x1, y1)
#define maxl 100010
#define psz 20
using namespace std;

ll n;
ll a[maxl+2],b[maxl+2],c[maxl+2];
ll dp[maxl+2][5];

ll Dp(int pos, bool a1, bool b1, bool c1, int num)
{
    if(pos == n) return 0;

  //  cout<<"R   "<<pos<<"  "<<a1<<"  "<<b1<<"   "<<c1<<endl;
    if(dp[pos][num] != -1) return dp[pos][num];
 //   cout<<"EEE     "<<pos<<endl;

    ll max1=0,max2=0,max3=0;

    if(a1) 
    {
        max1=a[pos]+Dp(pos+1,false,true,true,1);
    }
    if(b1)
    {
        max2=b[pos]+Dp(pos+1,true,false,true,2);
    }
    if(c1)
    {
        max3=c[pos]+Dp(pos+1,true,true,false,3);
    }
 //   cout<<max1<<"  "<<max2<<"  "<<max3<<endl;
    return dp[pos][num]=max(max1,max(max2,max3));

}

int main()
{
    scanf("%lld",&n);
    memset(dp,-1,sizeof dp);

    for(int i=0; i<n; i++)
    {
        scanf("%lld %lld %lld",&a[i],&b[i],&c[i]);
    }

    printf("%lld\n",Dp(0,true,true,true,0));


    return 0;
}

Measured memory_bytes: 14336
#include<bits/stdc++.h>
using namespace std;
#define MAX 100005
#define INF (1e9+1)
 
int n,W;
int dp[MAX];
 
int main(){
  fill(dp,dp+MAX,INF);
  dp[0]=0;
   
  cin>>n>>W;
  for(int i=0;i<n;i++){
    int v,w;
    cin>>v>>w;
    for(int j=MAX-1;j>=v;j--){
      dp[j]=min(dp[j],dp[j-v]+w);
    }
  }
 
  for(int i=MAX-1;i>=0;i--){
    if(dp[i]<=W){
      cout<<i<<endl;
      break;
    }
  }
   
  return 0;
}

Measured memory_bytes: 3468
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <functional>
#define ll long long int
using namespace std;

int main() {
	ll N, x, ans=0;

	cin >> N;
	vector<ll> point(N);

	for (int i = 0; i < N; i++){
		cin >> point[i];
	}
	sort(point.begin(), point.end(), greater<ll>());

	for (int i = 0; i < N; i++){
		if (i == 0){
			ans += 0;
		}
		else if (i == 1){
			ans += point[0];
		}
		else{
			x = i / 2;
			ans += point[x];
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 4804
print+(map(($_)x2,(0)x5,1,1,2,3,3,8,11,11,14,32,35,35,42,42,(49)x3,75,(86)x3,123,(131)x2,148,153,(170)x3,(227)x3,250,323,(324)x2,(354)x2),(384)x5,391,(491)x2,(529)x6,543)[<>]

Measured memory_bytes: 640
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
string s;
int main(void){
    cin>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]=='?')cout<<"D";
        else cout<<s[i];
    }
    cout<<endl;
}


Measured memory_bytes: 3764
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#define flush fflush(stdout)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pl;
const int mod = (int)1e9 + 7, INF = (int)1e9;
const int di[4] = { 1,0,-1,0 }, dj[4] = { 0,1,0,-1 };


#define N 160005
class uf {
private:
    int par[N] = {}, r[N] = {}, size[N] = {};

public:
    uf(int n) {
        int i;
        for (i = 0; i < n; i++) {
            par[i] = i;
            size[i] = 1;
        }
    }

    int root(int a) {
        if (par[a] == a) return a;
        return par[a] = root(par[a]);
    }

    void unite(int a, int b) {
        a = root(a);
        b = root(b);
        if (a == b) return;
        if (r[a] > r[b]) {
            par[b] = a;
            r[a]++;
            size[a] += size[b];
        }
        else {
            par[a] = b;
            r[b]++;
            size[b] += size[a];
        }
    }

    int show_size(int a) {
        return size[root(a)];
    }

    int group(int n) {
        int i, t, res = 0;
        bool u[N] = { false };
        for (i = 0; i < n; i++) {
            t = root(i);
            if (!u[t]) {
                res++;
                u[t] = true;
            }
        }
        return res;
    }

    bool isroot(int a) {
        return par[a] == a;
    }

};

int main(void) {
    int h, w, i, j, bl[N] = {}, wh[N] = {}, dir, ni, nj, id, nid, rid, rnid;
    ll ans;
    string s[403];

    scanf("%d%d", &h, &w);
    for (i = 0; i < h; i++)
        cin >> s[i];

    for (i = 0; i < h; i++) for (j = 0; j < w; j++)
    {
        if (s[i][j] == '#')
            bl[i * w + j] = 1;
        else
            wh[i * w + j] = 1;
    }

    uf unfi(h * w + 3);
    for (i = 0; i < h; i++) for (j = 0; j < w; j++)
    {
        for (dir = 0; dir < 4; dir++)
        {
            ni = i + di[dir];
            nj = j + dj[dir];
            if (ni >= 0 && ni < h && nj >= 0 && nj < w && s[i][j] != s[ni][nj])
            {
                id = i * w + j;
                nid = ni * w + nj;
                if (unfi.root(id) != unfi.root(nid))
                {
                    rid = unfi.root(id);
                    rnid = unfi.root(nid);
                    unfi.unite(id, nid);
                    bl[rid] = bl[rnid] = bl[rid] + bl[rnid];
                    wh[rid] = wh[rnid] = wh[rid] + wh[rnid];
                }
            }
        }
    }

    ans = 0;
    for (id = 0; id < h * w; id++)
    {
        if (unfi.isroot(id))
            ans += (ll)bl[id] * wh[id];
    }

    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 7096
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int K = sc.nextInt();
        
        if( K == 0 ) {
            System.out.println( (long) N * N );
            return;
        }

        long ans = 0;
        for(int b = 1; b <= N; b++ ) {
            ans += Math.max( (long)(N / b) * (b-K), 0) + Math.max(N % b - K + 1, 0);
        }
        
        System.out.println(ans);
    }
}


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

int main(){
  int a,b[102];
  cin>>a;
  for(int i=0;i<a;i++)cin>>b[i];
  for(int i=a-1;i>=1;i--)cout<<b[i]<<" ";
  cout<<b[0]<<endl;
  return 0;
}



Measured memory_bytes: 3076
#include <stdio.h>

int main(void)
{
	int a;
	int data[10];
	int i;
	int j;
	int tmp;
	
	for (a = 0; a < 10; a++){
		scanf("%d", &data[a]);
	}
	for (i = 0; i < 10; i++){
		for (j = i + 1; j < 10; j++){
			if (data[i] < data[j]){
				tmp = data[i];
				data[i] = data[j];
				data[j] = tmp;
			}
		}
	}
	for (a = 0; a < 3; a++){
		printf("%d\n", data[a]);
	}
	
	return (0);
}

Measured memory_bytes: 600