akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<pair<int, int>> ab(n);
    for (int i = 0; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        ab[i] = make_pair(b, a);
    }
    sort(ab.begin(), ab.end());
    int now = 0;
    string ans = "Yes";
    for (int i = 0; i < n; ++i) {
        if (ab[i].second + now > ab[i].first) {
            ans = "No";
            break;
        }
        else {
            now += ab[i].second;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1792
#include <iostream>
typedef long long ll;
using namespace std;
int main(void){
    ll n,q,k; cin >> n >> k >> q;
    ll a[100001]={0};
    for(int i=0;i<q;i++){
        int x; cin >> x;
        a[x]++;
    }
    for(int i=0;i<n;i++){
        if(a[i+1]+k-q > 0) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
}



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

const int mod = (int) 1e9 + 7;
const int MaxN = (int) 1e5 + 99;
ll pre[MaxN + 999];

ll modPow(ll n, ll k) {
	ll res = 1;
	for (n %= mod; k; k >>= 1) {
		if (k & 1)
			(res *= n) %= mod;
		(n *= n) %= mod;
	}
	return res;
}

ll modInv(ll x) {
	return modPow(x, mod - 2);
}

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

	for (int i = 1; i <= MaxN + 9; ++i) {
		pre[i] = (pre[i - 1] + modInv(i)) % mod;
		if(i <= 10)
			cerr << pre[i] << ' ';
	}
	int n;
	cin >> n;
	ll ans = 0;
	for (int i = 0; i < n; ++i) {
		ll x;
		cin >> x;
		ans += x * (pre[i + 1] + pre[n - i] - 1) % mod;
		ans %= mod;
	}
	for(int i = 2; i <= n; ++i)
		(ans *= i) %= mod;
	cout << ans << '\n';
	return 0;

}


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

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

    int sum = 0;
    int tmp = n;
    while (tmp > 0) {
        sum += tmp % 10;
        tmp /= 10;
    }

    if (n % sum == 0) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;int n,a[5000];int main(){int i,j,t,s;while(cin>>n&&n){s=0;t=-1000000;for(i=0;i<n;i++){cin >> a[i];}for(i=0;i<n;i++){s+=a[i];if(t<s)t=s;for(j=i+1;j<n;j++){s+=a[j];if(t<s)t=s;}s=0;}cout<<t<<endl;}return 0;}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#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 ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
const int Max_v = 1000;
const int Max_w = 10000;
const int Max_N = 100;

int main(){
    int N,W;
    vector<int> v, w;
    cin >> N >> W;
    REP(i,N){
        int vi,wi;
        cin >> vi >> wi;
        v.push_back(vi);
        w.push_back(wi);
    }
    /*REP(i,N){
        cout << i <<":" << v[i] << " " << w[i] << endl; 
    }*/
    vector<vector<int> > dp(Max_N+1, vector<int>(Max_w+1,0)); //i番目の品物のうち、M
    /*REP(i,N+1){
        REP(j,W+1){
            dp[0][j] = 0;
        }
    }    */
    
    REP(i,N){
        //int nokori;
        REP(j,W+1){
            if(w[i] > j){dp[i+1][j] = dp[i][j];}
            else{
                if(dp[i][j] >( dp[i][j-w[i]] + v[i])){dp[i+1][j] = dp[i][j];}
                else {dp[i+1][j] = dp[i][j-w[i]] + v[i];}
            }
            //cout << dp.at(i+1).at(j) << " ";
        }
       //cout << endl;
    }
    cout << dp.at(N).at(W) << endl;
}



Measured memory_bytes: 6860
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
typedef long long LL;
typedef unsigned long long ULL;
const LL LINF = 0x3f3f3f3f3f3f3f3f; 
const int INF = 0x3f3f3f3f;
const double eps = 1e-6;
const int mod = 1e9+7;
const ULL P = 131;
const int N = 2e5+7;

int vis[N];

int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=100;i++)
	for(int j=1;j<=100;j++)
	for(int k=1;k<=100;k++){
		int t = i*i+j*j+k*k+i*j+i*k+j*k;
		if(t<=1e4) vis[t] ++;
	} 
	for(int i=1;i<=n;i++) cout<<vis[i]<<"\n";
	return 0;
}

Measured memory_bytes: 3680
#include<stdio.h>
int main()
{
	int r,d,x;
	scanf("%d %d %d",&r,&d,&x);
	int j,sum=0;
	for(j=0;j<10;j++){
		sum=(r*x)-d;
		printf("%d\n",sum);
		x=sum;
	}
	return 0;
}

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

using namespace std;

struct pol{
    int l, r, s;
}p[300005];

struct st{
    int ind, x;
};

bool operator < (st a, st b)
{
    return a.x<b.x;
}

priority_queue<st> PQ;

int n, ans[100005], cnt, m;

struct segtree{
    int ar[300005];
    int base = 1<<17;

    void update(int ind, int inds, int inde, int s, int e, int val){
        if(inde<s||e<inds)return;
        if(s<=inds&&inde<=e){
            ar[ind] += val;
            return;
        }
        update(ind*2, inds, (inds+inde)/2, s, e, val);
        update(ind*2+1, (inds+inde)/2+1, inde, s, e, val);
    }

    int getE(int ind, int inds, int inde, int des){
        if(inds==des&&des==inde)return ar[ind];
        if(des<=(inds+inde)/2){
            return getE(ind*2, inds, (inds+inde)/2, des)+ar[ind];
        }
        else return getE(ind*2+1, (inds+inde)/2+1, inde, des)+ar[ind];
    }

}sg;

int main()
{
    scanf("%d %d", &n, &m);
    for(int i=1;i<=n;i++){
        scanf("%d %d", &p[i].l, &p[i].r);
        p[i].s = p[i].r-p[i].l+1;
        sg.update(1, 1, sg.base, p[i].l, p[i].r, 1);
        PQ.push({i, p[i].s});
    }
    for(int i=m;i>=1;i--){
        bool ep = false;
        while(true){
            if(PQ.empty()){
                ep = true;
                break;
            }
            if(PQ.top().x >= i){
                cnt++;
                sg.update(1, 1, sg.base, p[PQ.top().ind].l, p[PQ.top().ind].r, -1);
                PQ.pop();
            }
            else break;
        }
        if(ep){
            ans[i] = n;
            continue;
        }
        ans[i] = cnt;
        //printf("%d cnt: %d\n", i, cnt);
        for(int j=i;j<=m;j+=i){
            ans[i] += sg.getE(1, 1, sg.base, j);
            //printf("%d %d %d\n",i, j, ans[i]);
        }
    }
    for(int i=1;i<=m;i++){
        printf("%d\n", ans[i]);
    }
    return 0;
}


Measured memory_bytes: 8304
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;

int main() {
    int X;
    cin >> X;
    ll ans = (X / 500) * 1000;
    X %= 500;
    ans += (X / 5) * 5;
    cout << ans << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize(2)
#include<bits/stdc++.h>
using namespace std;
const int man = 2e5+10;
#define IOS ios::sync_with_stdio(0)
template <typename T>
inline T read(){T sum=0,fl=1;int ch=getchar();
for(;!isdigit(ch);ch=getchar())if(ch=='-')fl=-1;
for(;isdigit(ch);ch=getchar())sum=sum*10+ch-'0';
return sum*fl;}
template <typename T>
inline void write(T x) {static int sta[35];int top=0;
do{sta[top++]= x % 10, x /= 10;}while(x);
while (top) putchar(sta[--top] + 48);}
template<typename T>T gcd(T a, T b) {return b==0?a:gcd(b, a%b);}
template<typename T>T exgcd(T a,T b,T &g,T &x,T &y){if(!b){g = a,x = 1,y = 0;}
else {exgcd(b,a%b,g,y,x);y -= x*(a/b);}}
#ifndef ONLINE_JUDGE
#define debug(fmt, ...) {printf("debug ");printf(fmt,##__VA_ARGS__);puts("");}
#else
#define debug(fmt, ...)
#endif
typedef long long ll;
const ll mod = 1e9+7;
int a[10];

int main() {
    #ifndef ONLINE_JUDGE
        //freopen("in.txt", "r", stdin);
        //freopen("out.txt","w",stdout);
    #endif
    int n,m;
    cin >> n >> m;
    if(n==1&&!m){
        cout << 0 << endl;
        return 0;
    }
    memset(a,-1,sizeof(a));
    bool f = 0;
    for(int i = 1;i <= m;i++){
        int s,c;
        cin >> s >> c;
        if(n!=1&&s==1&&c==0){
            f = 1;
        }else if(a[s]==-1){
            a[s] = c;
        }else{
            //if(a[s]==0)a[s] = c;
            f = a[s] == c ? 0 : 1;
        }
    }
    if(f){
        cout << "-1\n";
        return 0;
    }
    string ans = "";
    for(int i = 1;i <= n;i++){
        if(a[i]==-1&&i==1)a[i] = 1;
        else if(a[i]==-1)a[i] = 0;
        ans += a[i] + '0';
    }
    int i = 0;
    while(i < ans.size()){
        if(ans[i]=='0'){
            ans.erase(0,1);
        }else break;
    }
    if(ans.size()==0)ans = "0";
   // cout <<ans << endl;
    if(ans.size()!=n){
        cout << -1 << endl;
    }else cout << ans << endl;
    return 0;
}

/*
3 5
1 3
1 2
1 0
3 2
3 1
*/


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

int main(){
	int r,d;
	cin >> r >> d;
	
	vector<int> x(11);
	cin >> x[0];
	
	rep(i,10){
		x[i+1] = r * x[i] - d;
	}
	
	rep(i,10) cout << x[i+1] << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip> // << fixed << precision(10)
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

#define FOR(i,s,t) for(int i=s;i<t;i++)
#define REP(i,n) FOR(i,0,n)
#define PRINT(s) cout << s << "\n"
#define SORT(A) sort(A.begin(), A.end())
#define EACHPRINT(A, T) for_each(begin(A), end(A), [&](T i){ cout << i << " "; });cout << "\n"

typedef long lint;
typedef pair<lint, lint> P;

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


    vector<lint> h(N);
    REP(i, N) {
      lint a; cin >> a; h[i] = a;
    }

    vector<lint> dp(N);

    dp[N-1] = 0;
    dp[N-2] = abs(h[N-1] - h[N-2]);

    for(lint i=N-3; i >=0;i--) {
      dp[i] = min(abs(h[i] - h[i+1]) + dp[i+1], abs(h[i] - h[i+2]) + dp[i+2]);
    }
    
    PRINT(dp[0]);
    return 0;
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/02/28  Problem: ABC 104 B / Link: http://abc104.contest.atcoder.jp/tasks/abc104_b  ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL ans = 0LL;

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

	string s; cin >> s;
	bool valid = s.front() == 'A';
	int Cpos = 0;
	{
		int Ccnt = 0;
		FOR(i, 2, SZ(s) - 1) {
			if (s[i] == 'C') {
				Ccnt++;
				Cpos = i;
			}
		}
		valid &= Ccnt == 1;
		DD(de(valid));
	}
	{
		FOR(i, 1, SZ(s)) {
			if (i == Cpos)continue;
			valid &= (bool)islower(s[i]);
		}
	}
	
	
	cout << (valid?"AC":"WA") << "\n";

	return 0;
}


Measured memory_bytes: 256
x=int(input())
if x>=1800:
  print(1)
elif 1600<=x<=1799:
  print(2)
elif 1400<=x<=1599:
  print(3)
elif 1200<=x<=1399:
  print(4)
elif 1000<=x<=1199:
  print(5)
elif 800<=x<=999:
  print(6)
elif 600<=x<=799:
  print(7)
elif 4<=x<=599:
  print(8)

Measured memory_bytes: 9192
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main(void) {

	int n, min, max;
	vector<int> a(1000);

	cin >> n;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	
	min = *min_element(a.begin(), a.begin()+n);
	max = *max_element(a.begin(), a.begin()+n);

	cout << max - min << endl;

	return 0;

}

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

int main() {
    int N, M;
    cin>>N>>M;
    map<int, int>dot;
    int a,b;
    for(int i=0;i<M;++i){
        cin>>a>>b;
        dot[a]++;
        dot[b]++;
    }
    int ans = true;
    for(int i=0;i<N;++i){
        if(dot[i+1]%2 == 1)ans=false;
    }
    if(ans)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}


Measured memory_bytes: 4992
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



int main(){

    ll n,a,b;
    cin >> n >> a >> b;

    ll ans =n/(a+b)*a; 

    if(n%(a+b) <= a)P(ans + n%(a+b));
    else P(ans + a);
    return  0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
typedef long double ld ;
#define F first
#define S second
#define pb push_back 
#define mp make_pair
#define vi vector <int>
#define vb vector <bool>
#define vc vector <char>
#define vll vector <ll>
#define vs vector <string>
#define pll pair < ll , ll >
#define pld pair < ld , ld >
#define pii pair < int , int >
#define vpld vector < pld >
#define vpii vector < pii >
#define vpll vector < pll >
#define vvi vector < vector < int > >
#define vvll vector < vector < ll > >
#define vvld vector < vector < ld > >
#define vvb vector < vector < bool > >
#define vvpii vector < vector < pii > >
#define all(v) (v).begin() , (v).end()
#define allrev(v) (v).rbegin() , (v).rend()
#define dist(x1 , y1 , x2 , y2) sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1))
const int MOD = 1e9 + 7 ;
const int infi = INT_MAX ;
const ll infll = LLONG_MAX ;
const int dx4[] = {0 , -1 , 0 , 1} ;
const int dy4[] = {-1 , 0 , 1 , 0} ;
const int dx8[] = {-1 , -1 , -1 , 0 , 1 , 1 , 1 , 0} ;
const int dy8[] = {-1 , 0 , 1 , 1 , 1 , 0 , -1 , -1} ;
const ld PI = 3.1415926535897932384626 ;

///////////////////////////////////////////////////////////////////////////////////////

ll pow_mod (ll a , ll b , ll m) {
	ll ans = 1 ;
	while(b) {
		if (b&1) ans = (ans*a) % m ;
		b /= 2 ;
		a = (a*a) % m ;
	}
	return ans ;
}

bool isprime (ll num) {
    for (ll i = 2 ; i * i <= num ; ++i) {
		if (num % i == 0) return false ;
	}
    return true;
}

ll gcd (ll a, ll b) {
    if (b == 0) return a ;
	else return gcd (b , a % b) ;
}

ll lcm (ll a, ll b) {
    return ((a / gcd(a , b)) * b) ;
}

ll cel (ll x1, ll y1) {
    if ((x1) <= 0) return (x1) / (y1) ;
    return (((x1) / (y1)) + (((x1) % (y1)) != 0)) ;
}

///////////////////////////////////////////////////////////////////////////////////////

void solve (int test_case) {
	int n ;
	cin >> n ;
	if (n % 1000 == 0) cout << "0" ;
	else cout << 1000 - (n % 1000) ;
}

int main() {
	ios_base :: sync_with_stdio (false) ;
	cin.tie(0) ;
	cout.tie(0) ;
	int tc = 1 ;
	//cin >> tc ;
	while (tc--) {
		solve (tc) ;
	}
	return 0 ;
}

Measured memory_bytes: 3648
#include "bits/stdc++.h"
#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = MOD - 1;
const ll LLINF = 4e18;

int main() {
    int n, m; cin >> n >> m;
    vector<vector<int>> c(m);
    vector<int> cost(m);
    vector<vector<int>> dp(m + 1, vector<int>(1 << n,INF));
    REP(i,m+1) dp[i][0] = 0;
    REP(i, m) {
        int a, b; cin >> a >> b;
        cost[i] = a;
        REP(j, b) {
            int d; scanf("%d", &d);
            d--;
            c[i].push_back(d);
        }
    }
    REP(i, m) {
        REP(j, 1 << n) {
            int s = 0;
            REP(k, c[i].size()) {
                s |= (1<<c[i][k]);
            }
            dp[i + 1][j] = min(dp[i + 1][j],dp[i][j]);
            dp[i + 1][j | s] = min({dp[i][j] + cost[i], dp[i][j | s],dp[i + 1][j | s]});
            //cout << i + 1 << "," << j << " = " << dp[i + 1][j] << endl;
        }
    }
    /*
    REP(i, m + 1) {
        REP(j, 1 << n) {
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    int ans = INF;
    REP(i, m + 1) {
        ans = min(ans, dp[i][(1 << n) - 1]);
    }
    if (ans == INF) {
        cout << -1 << endl;
    }
    else {
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;

#define int long long
#define reg register
#define Raed Read
#define clr(a,b) memset(a,b,sizeof a)
#define Mod(x) (x>=mod)&&(x-=mod)
#define debug(x) cerr<<#x<<" = "<<x<<endl;
#define rep(a,b,c) for(reg int a=(b),a##_end_=(c); a<=a##_end_; ++a)
#define ret(a,b,c) for(reg int a=(b),a##_end_=(c); a<a##_end_; ++a)
#define drep(a,b,c) for(reg int a=(b),a##_end_=(c); a>=a##_end_; --a)
#define erep(i,G,x) for(int i=(G).Head[x]; i; i=(G).Nxt[i])
#pragma GCC target("avx,avx2,sse4.2")
#pragma GCC optimize(3)

inline int Read(void) {
	int res=0,f=1;
	char c;
	while(c=getchar(),c<48||c>57)if(c=='-')f=0;
	do res=(res<<3)+(res<<1)+(c^48);
	while(c=getchar(),c>=48&&c<=57);
	return f?res:-res;
}

template<class T>inline bool Min(T &a, T const&b) {
	return a>b?a=b,1:0;
}
template<class T>inline bool Max(T &a, T const&b) {
	return a<b?a=b,1:0;
}
const int N=15,M=1e5+5;

bool MOP1;

int A[100005];

bool MOP2;

void _main(void) {
//	cerr<<"M="<<(&MOP2-&MOP1)/1024.0/1024.0<<endl;
	int n=Read(),Ans=1,res=1;
	rep(i,1,n)A[i]=Read();
	rep(i,2,n){
		if(A[i]<=A[i-1])res++;
		else Max(Ans,res),res=1;
	}
	Max(Ans,res);
	printf("%d\n",Ans-1);
}

signed main() {
	_main();
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
int hw[101][101],h,w,tl,a[10001],n,x,t,xx,yy;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
int cnt;
int main(){

   	while(cin>>h>>w>>n){
        memset(hw,0,sizeof(hw));tl=h*w;x=0;t=0;
        for(int i=0;i<n;i++)cin>>a[i];xx=0;yy=0;
        while(x<n){
            while(a[x]--){
                hw[xx][yy]=x+1;
                if(xx+dx[t]>=h||xx+dx[t]<0||yy+dy[t]>=w||yy+dy[t]<0||hw[xx+dx[t]][yy+dy[t]]!=0){t++;t%=4;}
                xx+=dx[t];yy+=dy[t];
            }
            x++;
        }
        for(int i=0;i<h;i++){
            cout<<hw[i][0];
            for(int j=1;j<w;j++){cout<<' '<<hw[i][j];}
            cout<<endl;
        }
   	}
    return 0;
}


Measured memory_bytes: 384
/// referenced: https://beta.atcoder.jp/contests/abc107/submissions/3082774
/// referenced: https://beta.atcoder.jp/contests/abc107/submissions/3145942
#include<bits/stdc++.h>
#define int int64_t
using namespace std;
int N;
vector<int>a;
int f(int X) {
  int sum[N+1]={};
  for(int i=0;i<N;++i){
    if(a[i]<X)sum[i+1]=-1;
    else sum[i+1]=1;
  }
  for(int i=0;i<N+1;++i){
    sum[i+1]+=sum[i];
  }
  int cnt[200020]={};
  for(int i=0;i<N;++i){
    ++cnt[sum[i+1]+100010];
  }
  int tmp=0;
  for(int i=0;i<100010;++i){
    tmp+=cnt[i+100010];
  }
  int ret=tmp;
  for(int i=0;i<N;++i){
    if(sum[i]<sum[i+1]){
      tmp-=cnt[sum[i]+100010];
    }else{
      tmp+=cnt[sum[i+1]+100010];
    }
    --tmp;
    --cnt[sum[i+1]+100010];
    ret+=tmp;
  }
  return ret;
}
main(){
  cin>>N;
  a=vector<int>(100010);
  for(int i=0;i<N;++i)cin>>a[i];
  if(N==1){
    cout<<a[0]<< endl;
    return 0;
  }
  int left=0;
  int right=20000000001;
  while(right-left>1){
    int mid=(left+right)/2;
    int num=N*(N+1)/2;
    if (f(mid)>=(num+1)/2)left= mid;
    else right=mid;
  }
  cout<<left<<endl;
}


Measured memory_bytes: 3328
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
int main(){
  short ans[50001]={};
  vector<int>pri;
  pri.push_back(2);
  for(int i=3;i<=50000;i+=2){
    int flag=1;
    for(int j=2;j<=sqrt(i);j++){
      if(i%j==0){
	flag=0;
	break;
      }
    }
    if(flag)
      pri.push_back(i);
  }
  for(int i=0;i<pri.size();i++){
    for(int j=i;j<pri.size();j++){
      if(pri[i]+pri[j]>50000)
	break;
      ans[pri[i]+pri[j]]++;
    }
  }
  int n;
  while(cin>>n,n)
    cout<<ans[n]<<endl;
  return 0;
}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
using namespace std;
#define fr(i,k,n) for(int i=k;i<n;i++)
#define read(x) cin>>x
#define ll long long int
#define mod 1000000007 
#define print(x) cout<<x<<endl
#define pb(x) push_back(x)
#define fastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main() { 
    fastIO;
     ll t=1,n;
     //cin>>t;
     while(t--){
       cin>>n;
       pair<ll,ll> arr[10000];
         
       fr(i,0,n){
         cin>>arr[i].first;
         arr[i].second=i;
       }
       sort(arr,arr+n);
       reverse(arr,arr+n);
       ll ans=INT_MIN;
       vector<vector<ll>>dp(n+1,vector<ll>(n+1,0));
       dp[0][0]=0;
       for(int i=0;i<n;i++){
         for(int j=0;(i+j)<=n ;j++)
         { if(i+j ==n )
              ans=max( dp[i][j] ,ans )   ;
          else{ dp[i+1][j]=(ll)max(dp[i+1][j],(ll)dp[i][j]+abs(i -arr[i+j].second) *arr[i+j  ].first);
           dp[i][j+1]=(ll)max(dp[i][j+1],(ll)dp[i][j]+abs(n-j-1-arr[i+j].second) *arr[i+j  ].first);
            // cout<<arr[i+j].first<<dp[i][j+1] <<endl;
              }
                          
         }
       }
       cout<<ans<<endl;
         
         
     }
	 
	return 0;
}


Measured memory_bytes: 34912
h, w, k = map(int, input().split())
s = [input() for _ in range(h)]

w_cut = [[0] * (w - 1) for _ in range(h)]
h_cut = [0] * (h - 1)

for hi in range(h):
    cnt = 0
    for wi in range(w):
        if s[hi][wi] == "#":
            if cnt >= 1:
                w_cut[hi][wi-1] = 1
            cnt += 1

prev_hi = -1
for hi in range(h):
    cnt = s[hi].count("#")
    if cnt >= 1:
        if prev_hi == -1:
            prev_hi = hi
        else:
            h_cut[hi-1] = 1

##print(*w_cut, sep="\n")
##print()
#print(h_cut)

ans = [[0] * w for _ in range(h)]
num = 1
prev_hi = 0
ww_cut = [0] * (w - 1)
for hi in range(h):
    for wi in range(w - 1):
        if w_cut[hi][wi]:
            ww_cut[wi] = 1

    if hi != h - 1 and h_cut[hi]:
        for wi in range(w):
            if wi != 0 and ww_cut[wi-1]:
                num += 1
            for hh in range(prev_hi, hi + 1):
                #print(hh, wi)
                ans[hh][wi] = num
        prev_hi = hi + 1
        num += 1
        ww_cut = [0] * (w - 1)

    if hi == h - 1:
        for wi in range(w):
            if wi != 0 and ww_cut[wi-1]:
                num += 1
            for hh in range(prev_hi, hi + 1):
                #print(hh, wi)
                ans[hh][wi] = num

for row in ans:
    print(*row)


Measured memory_bytes: 8260
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>

template <class F>
class fix_point: F {
public:
  explicit constexpr fix_point(F&& f) noexcept: F(std::forward<F>(f)) {}

  template <class... Args>
  constexpr decltype(auto) operator ()(Args&&... args) const {
    return F::operator ()(*this, std::forward<Args>(args)...);
  }
};

template <class F>
static inline constexpr decltype(auto) make_fix_point(F&& f) noexcept {
  return fix_point<F>{std::forward<F>(f)};
}

struct tree: std::vector<std::vector<size_t>> {
  tree(size_t n): std::vector<std::vector<size_t>>(n) {}

  void connect_with(size_t src, size_t dst) {
    (*this)[src].push_back(dst);
    (*this)[dst].push_back(src);
  }
};

std::vector<intmax_t> nya(const tree& g, intmax_t mod) {
  size_t n = g.size();
  std::vector<size_t> parent(n, -1);
  std::vector<std::vector<intmax_t>> dp0(n), dp1(n);
  std::vector<intmax_t> dp(n);
  for (size_t i = 0; i < n; ++i) {
    dp0[i].resize(g[i].size()+1, 1);
    dp1[i].resize(g[i].size()+1, 1);
  }

#if 0
int main() {
  auto fp = make_fix_point([](auto f, int n)-> int {
      if (n == 0) return 1;
      return n * f(n-1);
      });

  printf("%d\n", fp(10));
  printf("%d\n", fp(11));
}
#endif

  make_fix_point([&](auto f, size_t v, size_t p) -> intmax_t {
    intmax_t res = 1;
    for (size_t i = 0; i < g[v].size(); ++i) {
      size_t u = g[v][i];
      if (u == p) {
        parent[v] = i;
        continue;
      }
      intmax_t tmp = (f(u, v) + 1) % mod;
      (res *= tmp) %= mod;
      dp0[v][i+1] = tmp;
      dp1[v][i] = tmp;
    }
    return res;
  })(0, -1);

  make_fix_point([&](auto f, size_t v, size_t p, size_t pi) -> void {
    if (v != 0) {
      intmax_t tmp = (dp0[p][pi] * dp1[p][pi+1] + 1) % mod;
      dp0[v][parent[v]+1] = tmp;
      dp1[v][parent[v]] = tmp;
    }
    {
      for (size_t i = 1; i < dp0[v].size(); ++i)
        (dp0[v][i] *= dp0[v][i-1]) %= mod;
      for (size_t i = dp1[v].size()-1; i--;)
        (dp1[v][i] *= dp1[v][i+1]) %= mod;
      dp[v] = dp1[v][0];
    }
    for (size_t i = 0; i < g[v].size(); ++i) {
      size_t u = g[v][i];
      if (u != p) f(u, v, i);
    }
  })(0, -1, -1);

  return dp;
}

int main() {
  size_t N;
  intmax_t M;
  scanf("%zu %jd", &N, &M);

  tree g(N);
  for (size_t i = 1; i < N; ++i) {
    size_t x, y;
    scanf("%zu %zu", &x, &y);
    --x;
    --y;
    g.connect_with(x, y);
  }

  auto dp = nya(g, M);
  for (size_t i = 0; i < N; ++i)
    printf("%jd\n", dp[i]);
}



Measured memory_bytes: 24448
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
  int W, H, x, y, r; cin >> W >> H >> x >> y >> r;

  if (r <= x && x <= W-r && r <= y && y <= H-r) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 1156
#include<bits/stdc++.h>
using namespace std;
int main(void){
  long long n,a,b; cin>>n>>a>>b;
  long long res=0;
  if(a>0){
    res=n/(a+b)*a;
    n-=n/(a+b)*(a+b);
    res+=min(n,a);
  }
  cout<<res;
  return 0;
}
    


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

int main() {

    ll n, k;
    cin >> n >> k;
    vector<ll> P(n);
    rep(i,n) cin >> P[i];

    vector<ll> sum(n-k+1);
    rep(i,k) {
        sum[0] += P[i];
    }

    for (int i = 1; i<= n-k; i++) {
        sum[i] = sum[i-1] - P[i-1] + P[i+k-1];
    }

    sort(sum.rbegin(), sum.rend());
    ll tot = sum[0];
    double ans = (k + tot);
    ans /= 2;

    printf("%.8f\n", ans);

    return 0;
}

Measured memory_bytes: 3328
c = []
for i in range(3):
    c1 = list(map(int,input().split()))
    c.append(c1)
count = 0
ans = "Yes"
for i in range(2):
    for j in range(2):
        if c[i][j] - c[i][j+1] != c[i+1][j] - c[i+1][j+1]:
            ans = "No"
        if c[i][j] - c[i+1][j] != c[i][j+1] - c[i+1][j+1]:
            ans = "No"
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] T = new int[N];
		int sum = 0;
		for(int i = 0; i < N ; i++) {
			T[i] = sc.nextInt();
			sum += T[i];
		}
		
		int M = sc.nextInt();
		int[] P = new int[M];
		int[] X = new int[M];
		for(int i = 0; i < M; i++) {
			P[i] = sc.nextInt();
			X[i] = sc.nextInt();
		}
		
		for(int i = 0; i < M; i++) {
			int result = sum - (T[P[i]-1] - X[i]);
			System.out.println(result);
		}
	}

}


Measured memory_bytes: 23764
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		Unit[] arrA = new Unit[n];
		TreeSet<Unit> treeA = new TreeSet<>();
		for (int i = 0; i < n; i++) {
		    arrA[i] = new Unit(i, sc.nextInt());
		    treeA.add(arrA[i]);
		}
		Unit[] arrB = new Unit[n];
		TreeSet<Unit> treeB = new TreeSet<>();
		for (int i = 0; i < n; i++) {
		    arrB[i] = new Unit(i, sc.nextInt());
		    treeB.add(arrB[i]);
		}
		int count = 0;
		while (treeA.size() > 0) {
		    Unit last = treeA.pollLast();
		    if (last.value <= arrB[last.id].value) {
		        treeB.remove(arrB[last.id]);
		    } else {
		        int tmp = last.id;
		        last.id = 0;
		        Unit next = treeB.ceiling(last);
		        if (next == null) {
		            System.out.println("No");
		            return;
		        }
		        Unit change = arrA[next.id];
		        treeA.remove(change);
		        change.id = tmp;
		        treeA.add(change);
		        arrA[change.id] = change;
		        treeB.remove(next);
		        count++;
		    }
		}
		if (count > n - 2) {
		    System.out.println("No");
		} else {
	    	System.out.println("Yes");
		}
	}
	
	static class Unit implements Comparable<Unit>{
	    int id;
	    int value;
	    
	    public Unit(int id, int value) {
	        this.id = id;
	        this.value = value;
	    }
	    
	    public int hashCode() {
	        return id;
	    }
	    
	    public boolean equals(Object o) {
	        Unit u = (Unit)o;
	        return id == u.id && value == u.value;
	    }
	    
	    public int compareTo(Unit another) {
	        if (value == another.value) {
	            return id - another.id;
	        } else {
	            return value - another.value;
	        }
	    }
	    
	    public String toString() {
	        return "id:" + id + " value:" + value;
	    }
	}
}


Measured memory_bytes: 104816
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1000000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};


int main() {
	ll K;
	cin >> K;
	vll ans(50, 49 + (K / 50));
	rep(i, K % 50) {
		rep(j, 50) {
			if (j == i)ans[j] += 50;
			else ans[j] -= 1;
		}
	}
	cout << 50 << endl;
	rep(i, 50) {
		cout << ans[i];
		if (i < 49)cout << " ";
	}
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};





int main(){
    int n;cin >> n;
    vector<LL> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<int> cum(n+1,0);
    for (int i = 0; i < n; i++) {
        cum[i+1] = cum[i] ^ a[i];
    }
    int x = cum[n];
    if(x){
        vector<LL> dp(2,0);
        dp[0] = 1;
        for (int i = 0; i <= n; i++) {
            if(cum[i]==x){
                dp[1] = (dp[0] + dp[1])%mod;
            }
            else if(cum[i]==0){
                dp[0] = (dp[1] + dp[0])%mod;
            }
        }
        cout << dp[0] << endl;
    }
    else{
        LL ans = 1;
        for (int i = 1; i < n; i++) {
            if(cum[i]==0) ans = (2 * ans)%mod;
        }
        vector<vector<LL>> dp((1<<22),vector<LL>(2,0));
        vector<LL> count((1<<22),0);
        LL c = 0;
        for (int i = 0; i <= (1<<21); i++) {
            dp[i][0] = 1;
        }
        for (int i = 1; i <= n; i++) {
            int k = cum[i];
            if(k==0) c++;
            else{
                dp[k][0] = ((c-count[k]) * dp[k][1] + dp[k][0])%mod;
                ans = (ans + dp[k][0])%mod;
                dp[k][1] = (dp[k][0] + dp[k][1])%mod;
                count[k] = c;
            }
        }
        cout << ans << endl;
    }
    return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<int> a(N);
    rep(i,N) cin >> a.at(i);
    sort(a.begin(), a.end());
    cout << a.at(a.size()-1) - a.at(0) << endl;
}


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

int main() {
  string S; cin >> S;
  bool res_bool = true;
  for (int i = 0; i < S.size(); i++) {
    if (i % 2 == 0) {
      if (S[i] == 'L') res_bool = false;
    } else {
      if (S[i] == 'R') res_bool = false;
    }
  }
  if (res_bool) cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for(int i=0; i<n; i++) cin >> p.at(i);
  
  int cnt=0;
  for(int i=1; i<n-1; i++){
    if(p.at(i-1) < p.at(i) && p.at(i) < p.at(i+1) ) cnt++;
    else if(p.at(i+1) < p.at(i) && p.at(i) < p.at(i-1) ) cnt++;
  }
  cout << cnt << endl;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    n = n - 1;
    
    vector<int> c = vector<int>(n, 0);
    vector<int> s = vector<int>(n, 0);
    vector<int> f = vector<int>(n, 0);
    
    for (int i = 0; i < n; ++i)
    {
        cin >> c[i];
        cin >> s[i];
        cin >> f[i];
    }
    
    for (int no = 0; no < n; ++no)
    {
        int ret = 0;
        for (int i = no; i < n; ++i)
        {
            if (ret >= s[i])
            {
                for (int j = 0; j < f[i]; ++j)
                {
                    if (ret % f[i] == 0)
                    {
                        break;
                    }
                    ret++;
                }
                ret = ret + c[i];
            }
            else
            {
                ret = s[i] + c[i];
            }
        }
        cout << ret << endl;
    }
    cout << 0 << endl;
    
    return 0;
}


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

int f[1001], t[1001], v, d;

int main(){
    int i;
    f[0] = 2; f[1] = 3;
    for(i = 2; i < 1000; i++){
        f[i] = (f[i-1] + f[i-2])%1001;
    }
    while( cin >> v >> d ){
        for(i = 0; i < v; i++){
            t[i] = f[i];
        }
        sort(t,t+v);
        int c = 1;
        for(i = 0; i < v-1; i++){
            if( t[i+1] - t[i] >= d || t[i+1] - t[i] <= -d ) c++;
        }
        cout << c << endl;
    }
    return 0;
}

Measured memory_bytes: 1184
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 20) + 1;

	char buf[L], *S , *T, c;

	char getchar() {
		if(__builtin_expect(S == T, 0)) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}

	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}

	unsigned inpu()
	{
		unsigned x = 0; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar());
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x;
	}

	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}

	char B[45], *outs=B+40, *outr=B+40;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;

		if(!a)*--outs = '0';
		else
			while(a)
				*--outs = (a % 10) + 48, a /= 10;

		if(x)
			*--outs = x;

		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;

using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;
//using i128 = __int128_t;
//using u128 = __uint128_t;
using i128 = i64;
using u128 = u64;

ll power(ll a, ll b, ll p)
{
	if (!b) return 1;
	ll t = power(a, b/2, p);
	t = t*t%p;
	if (b&1) t = t*a%p;
	return t;
}

ll exgcd(ll a, ll b, ll &x, ll &y)
{
	if (b == 0)
	{
		x = 1;
		y = 0;
		return a;
	}
	ll px, py;
	ll d = exgcd(b, a%b, px, py);
	x = py;
	y = px-a/b*py;
	return d;
}

template<class T>
inline void freshmin(T &a, const T &b)
{
	if (a > b) a = b;
}

template<class T>
inline void freshmax(T &a, const T &b)
{
	if (a < b) a = b;
}

const int MOD = 1000000007;
const int INF = 1000000000;
const int MAXN = 200010;

int n;
char a[MAXN];
int s[MAXN];

int main()
{
	
	scanf("%d%s", &n, a+1);
	for (int i = 1; i <= n; ++ i)
		s[i] = s[i-1]+(a[i] == '.');
	int ans = n;
	for (int i = 0; i <= n; ++ i)
	{
		int x = i-s[i];
		int y = s[n]-s[i];
		freshmin(ans, x+y);
	}
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

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

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);

  ll n, W;
  cin >> n >> W;

  vll w(n);
  vll v(n);
  rep(i, n) {
    cin >> w[i] >> v[i];
  }

  vll dp(W + 1);
  rep(i, n) {
    for (int j = W; j >= 0; j--) {
      if (j + w[i] <= W) {
        chmax(dp[j + w[i]], dp[j] + v[i]);
      }
    }
  }

  ll ans = 0;
  rep(i, W + 1) {
    chmax(ans, dp[i]);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int L,A,B,C,D;
  cin >> L >> A >> B >> C >> D;
  cout << L - max((double)A/(double)C==A/C?A/C:A/C+1,(double)B/(double)D==B/D?B/D:B/D+1) << endl;
}

Measured memory_bytes: 1160
n = int(input())
alst = list(map(int, input().split()))
bef = []
aft = []
for i, a in enumerate(alst):
  if i % 2 == 0:
    bef.append(a)
  else:
    aft.append(a)
if n % 2 == 0:
  ans = aft[::-1] + bef
else:
  ans = bef[::-1] + aft
print(*ans)

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

using namespace std;

int main(){
	int num500, num100, num50, PORPOSE;
	
	cin >> num500;
	cin >> num100;
	cin >> num50;
	cin >> PORPOSE;

	int count = 0;

	for (int i = num500; i > -1; i--) {
		for (int j = num100; j > -1; j--) {
			for (int k = num50; k > -1; k--) {
				if (i * 500 + j * 100 + k * 50 == PORPOSE)
					count++;
			}
		}
	}
	cout << count << endl;
}

Measured memory_bytes: 256
N = gets.to_i
nums = gets.chomp.split(" ").map(&:to_i)

c = 0
odd = false
while odd == false do
  nums.each_with_index do |n, i|
    break odd = true if n.odd?
    nums = nums.map { |m| m/2 } if i == (N - 1)
  end
  c += 1 if odd == false
end

puts c

Measured memory_bytes: 14136
s = input()
s = s.replace('BC','D')

ans = 0
cnta = 0
for n in range(len(s)):
    if s[n] == 'A':
        cnta += 1
    elif s[n] == 'D':
        ans += cnta
    elif s[n] == 'B' or s[n] == 'C':
        cnta = 0

print(ans)


Measured memory_bytes: 41968
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++)
    cin>>a.at(i);
  sort(a.begin(),a.end());
  int h1=(a.at(n-1))/2;
  int h2=(a.at(n-1)+1)/2;
  auto m1=upper_bound(a.begin(),a.end(),h1);
  auto m2=lower_bound(a.begin(),a.end(),h2);
  if(m1==a.begin())
    cout<<a.at(n-1)<<" "<<a.at(0)<<endl;
  else
    cout<<a.at(n-1)<<" "<<(h1-*(m1-1)<=*m2-h2?*(m1-1):*m2)<<endl;
    
}

Measured memory_bytes: 640
using System;
using System.Linq;
using System.Text;

namespace ALDS1_5_B {
    public static class Problem {
        public static int MergeSort(this int[] A,int left,int right) {
            int count = 0;
            if (left + 1 < right) {
                int mid = (left + right) / 2;
                count += A.MergeSort(left, mid);
                count += A.MergeSort(mid, right);
                count += A.Merge(left, mid, right);
            }
            return count;
        }

        private static int Merge(this int[] A,int left,int mid,int right) {
            int n1 = mid - left;
            int n2 = right - mid;
            int count = 0;

            int[] L = new int[n1 + 1];
            for(int i = 0; i < n1; i++) {
                L[i] = A[left + i];
            }
            L[n1] = int.MaxValue;

            int[] R = new int[n2 + 1];
            for(int i = 0; i < n2; i++) {
                R[i] = A[mid + i];
            }
            R[n2] = int.MaxValue;

            int x = 0;
            int y = 0;
            for (int i = left; i < right; i++) {
                if (L[x] <= R[y]) {
                    A[i] = L[x];
                    x++;
                }
                else {
                    A[i] = R[y];
                    y++;
                }
                count++;
            }
            return count;
        }
    }

    class Program {
        static void Main(string[] args) {
            int n = int.Parse(Console.ReadLine());
            int[] S = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int count = S.MergeSort(0, n);

            StringBuilder sb = new StringBuilder();
            sb.Append(S[0]);
            foreach (int s in S.Skip(1)) {
                sb.AppendFormat(" {0}", s);
            }
            sb.AppendFormat("\n{0}\n", count);
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 112112
#include<iostream>
#include<vector>
using namespace std;
int main(){
int n,i,min,a[300000],x;
char s[300001];
cin>>n;
scanf("%s",s);
if(s[0]=='E')a[0]=1;
else a[0]=0;
for(i=1;i<n;i++){
if(s[i]=='E')a[i]=a[i-1]+1;
else a[i]=a[i-1];
}
min=a[n-1]-a[0];
for(i=1;i<n;i++){
x=a[n-1]-a[i]+i-a[i-1];
if(x<min)min=x;
}
cout<<min<<endl;
return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//
int main(){
    vector<int> box(5);
    rep(i,0,5) cin>>box[i];
    int mini=10;
    int sum=0;
    rep(i,0,5){
        sum+=ceil(box[i]/10.0)*10;
        if(box[i]%10==0) continue;
        mini=min(mini,box[i]%10);
    }
    cout<<sum-10+mini<<endl;
    
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <string>
#include <vector>
#include <algorithm>
#include <map>

#ifndef ULLONG
typedef unsigned long long ULLONG;
#endif
#ifndef LLONG
typedef long long LLONG;
#endif
template <class _T> static _T tp_abs(const _T& a) {
	return ((a < 0) ? (a * -1) : a);
}
template <class _T> static _T tp_min(_T a, _T b) {
	return a < b ? a : b;
}
template <class _T> static _T tp_max(_T a, _T b) {
	return a > b ? a : b;
}
template<class _T> static void get1int(_T& a) {
	const char* fmt = " %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld";
	}

	if (scanf(fmt, &a) < 0) {
		printf("g1int Error\n");
	}
}
template<class _T> static void get2int(_T& a, _T& b) {
	const char* fmt = " %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld";
	}

	if (scanf(fmt, &a, &b) < 0) {
		printf("g2int Error\n");
	}
}
template<class _T> static void get3int(_T& a, _T& b, _T& c) {
	const char* fmt = " %d %d %d";
	if (sizeof(_T) == sizeof(long long)) {
		fmt = " %lld %lld %lld";
	}

	if (scanf(fmt, &a, &b, &c) < 0) {
		printf("g3int Error\n");
	}
}
static void getstring(char* buff) {
	if (scanf(" %s", buff) < 0) {
		printf("getstr error!\n");
	}
}
static const long long MOD_NUM = 1000000007LL;

static void A_task();

int main()
{
	A_task();
	fflush(stdout);
	return 0;
}

static void A_task()
{
	int a;
	char s[11] = { 0 };
	get1int(a);
	getstring(s);

	printf("%s\n", ((a >= 3200) ? s : "red"));
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <utility>
#include <climits>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int INF=1<<29;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N,H,W;
	cin>>N>>H>>W;
	cout<<(N-H+1)*(N-W+1)<<endl;
	return 0;
}

Measured memory_bytes: 384