akhauriyash/Code-Regression huggingface dataset:
/*
I don't wanna die alone
I don't wanna live forsaken
I refuse to let this go
Because my soul is breaking

I don't wanna let you know
That my heart is just so jaded
I refuse to let it show
I refuse to let it go

Wake me up when this is over
I'm tired of living life like its a dream
Please wake me up when its all over
I'm tired of living right here in between
I refuse

I've always walked alone
I chose the path less taken
I refuse to let you win
Life's a bitch and I've been shaken

Its not a joke at all
Inside my spirit's fading
I refuse to take the fall
Cause no one cares at all

Wake me up when this is over
I'm tired of living life like its a dream
Please wake me up when its all over
I'm tired of living right here in between
I refuse

Cause at the end of the day I'm not you
I refuse

Wake me up when this is over
I'm tired of living life like its a dream
Please wake me up when its all over
I'm tired of living right here in between
Wake me up when this is over
I'm tired of living life like its a dream
Please wake me up when its all over
I'm tired of living right here in between

I refuse
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh

#define eps 1e-8
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 600031;

int n,ar[N];
vector<int> order;
long long ans;

int main(){
//	freopen("apache.in","r",stdin);
//	freopen("apache.out","w",stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
//	cin.tie(0);

	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>ar[i];
	}
	for (int i=1;i<=n;i++){
		ar[i]-=i;
		order.push_back(ar[i]);
	}
	sort(order.begin(),order.end());
	int mid=order[n/2];
	for (int i=0;i<order.size();i++){
		ans+=abs(order[i]-mid);
	}
	cout<<ans<<endl;

//	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 2168
//phoenix




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


#define spdio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pp pop_back
#define mp make_pair
#define fr(i,j,n) for(ll i=j; i<n; i++)
#define rfr(i,j,n) for(ll i=n-1; i>=0; i--)
#define vsort(v) sort(v.begin(),v.end())
#define asort(a) sort(a,a+n);


typedef long double ld;
typedef long long int ll;


//getline(cin,string);
const ll inf = (ll) 1e18 + 19;




ll solveDp(ll i,ll j,ll a[][3],ll n,vector <vector <ll> > &dp) {
    if(i>=n)
        return 0;
    if(dp[i][j]!=-1)
        return dp[i][j];
    else if(i==0) {
        dp[i][0]=max(a[i][0]+solveDp(i+1,1,a,n,dp),a[i][0]+solveDp(i+1,2,a,n,dp));
        dp[i][1]=max(a[i][1]+solveDp(i+1,0,a,n,dp),a[i][1]+solveDp(i+1,2,a,n,dp));
        dp[i][2]=max(a[i][2]+solveDp(i+1,1,a,n,dp),a[i][2]+solveDp(i+1,0,a,n,dp));
        return max(dp[i][0],max(dp[i][1],dp[i][2]));
    }
    else {
        if(j==0)
            dp[i][0]=max(a[i][0]+solveDp(i+1,1,a,n,dp),a[i][0]+solveDp(i+1,2,a,n,dp));
        else if(j==1)
            dp[i][1]=max(a[i][1]+solveDp(i+1,0,a,n,dp),a[i][1]+solveDp(i+1,2,a,n,dp));
        else
            dp[i][2]=max(a[i][2]+solveDp(i+1,1,a,n,dp),a[i][2]+solveDp(i+1,0,a,n,dp));
    }
}




void cazz() {
    ll t,n,i,j,k,ans=0,f=0,b;
    cin>>n;
    ll a[n][3];
    fr(i,0,n)
        fr(j,0,3)
            cin>>a[i][j];
    vector <vector <ll> > dp(n,vector <ll> (3,-1));
    cout<<solveDp(0,0,a,n,dp)<<"\n";
}




int main() {
    spdio;
	cazz();
	return 0;
}



Measured memory_bytes: 15872
let () = Printf.printf "%d\n" @@ Scanf.scanf "%d %d" (fun n k ->
  Array.init n (( + ) 1)
  |> Array.map (fun b ->
      max 0 (b - k) * (n / b)
    + min (n mod b) (max 0 (n mod b - k + 1)))
  |> Array.fold_left ( + ) 0)

Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
 
int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	ll x,y,z,k;
	cin >> x >> y >> z >> k;
	vector <ll> a1(x),a2(y),a3(z);
	vector <ll> k1(x*y),k2(k*z);
	for (int i=0;i<x;i++){
		cin >> a1[i];
	}
	for (int i=0;i<y;i++){
		cin >> a2[i];
	}
	for (int i=0;i<z;i++){
		cin >> a3[i];
	}
	ll c = 0;
	bool end = true;
	for (int i=0;i<x;i++){
		for (int j=0;j<y;j++){
			k1[c] = a1[i]+a2[j];
			c++;
		}
	}
	c = 0;
	sort(k1.rbegin(),k1.rend());
	for (int i=0;i<min(k,x*y);i++){
		for (int j=0;j<z;j++){
			k2[c] = k1[i]+a3[j];
			c++;
		}
	}
	sort(k2.rbegin(),k2.rend());
	for (int i=0;i<k;i++){
		cout << k2[i] << endl;
	}
	cin >> x;
}

Measured memory_bytes: 31616
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const ll INF = 1<<30;
const ll MOD = 1e9 + 7;
const ll MAX_N = 110;
ll G[MAX_N][MAX_N];
ll dp[MAX_N][MAX_N];
signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m; cin >> n >> m;
    for(ll i = 0; i < n; i++)
    {
        for(ll j = 0; j < n; j++) dp[i][j] = G[i][j] = INF;
    }
    for(ll i = 0; i < n; i++) dp[i][i] = G[i][i] = 0;
    for(ll i = 0; i < m; i++)
    {
        ll a, b, c; cin >> a >> b >> c;
        a--, b--;
        G[a][b] = c;
        G[b][a] = c;
        dp[a][b] = c;
        dp[b][a] = c;
    }
    for(ll k = 0; k < n; k++)
    {
        for(ll i = 0; i < n; i++)
        {
            for(ll j = 0; j < n; j++) dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
        }
    }
    // for(ll i = 0; i < n; i++)
    // {
    //     for(ll j = 0; j < n; j++) cout << setw(4) << dp[i][j]; cout << endl;
    // }
    ll ans = 0;
    for(ll i = 0; i < n; i++)
    {
        for(ll j = 0; j < n; j++)
        {
            if(G[i][j] == INF) continue;
            if(dp[i][j] != G[i][j]) ans++;
        }
    }
    cout << ans / 2 << endl;
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>

int main(){

    int min;
    int maxd;
    int t;
    int n, i;
    scanf("%d\n", &n);
    scanf("%d\n", &min);
    for(i = 2; i <= n; i++){
        scanf("%d\n", &t);
        if(i==2){
            maxd = t - min;
        }
        if((t - min)>maxd)
            maxd = t - min;
        if(t < min)
            min = t;
    }
    printf("%d\n", maxd);

}


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

using namespace std;

int main(){
	int n;
	string str;
	char tmp;
	int space = 0;
	cin >> n;
	cin >> str;

	for (int i = 0; i < n; i++){
		while (str[i] == ' ') i++;
		tmp = str[i];
		int c = i + 1;
		while(tmp == str[c]){
			str[c] = ' ';
			c++;
	  }
	}

	for (int i = 0; i < n; i++){
		if (str[i] == ' ') space++;
	}
	cout << n - space <<endl;
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pb push_back
#define ff first
#define ss second
using namespace std;
using ll = long long;
using vi = vector<int>;
using pii = pair<ll, ll>;
int a[200005];
int vis[200005];
ll k;
int n;
vector<int> order;
void dfs(int u, int p = -1) {
  vis[u] = 1;
  order.pb(u);
  k--;
  if (k == 0) {
    cout << order.back() << endl;
    exit(0);
  }
  if (!vis[a[u]])
    dfs(a[u], u);
  else {
    for (int i = 0; i < order.size(); i++) {
      if (order[i] == a[u]) {
        // for (int j = i; j < order.size(); j++) {
        //   cout << order[j] << ' ';
        // }
        // cout << endl;
        ll len = order.size() - i;
        // cout << len << ' ' << k << endl;
        k--;
        cout << order[i + k % len] << endl;
        exit(0);
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n >> k;
  for (int i = 1; i <= n; i++)
    cin >> a[i];
  vis[1] = 1;
  order.pb(1);
  dfs(a[1]);
}

Measured memory_bytes: 13016
N,K = list(map(int,input().split()))
R,S,P = list(map(int,input().split()))
T = input()

#r - P
#s - R
#p - S

ans = [0] *len(T)
for i,x in enumerate(T):
  if x == 'r':
    ans[i] = P
  elif x == 's':
    ans[i] = R
  elif x == 'p':
    ans[i] = S
  
  if i >= K:
    if (T[i-K] == x) & (ans[i-K] == ans[i]):
      ans[i] = 0

print(sum(ans))


Measured memory_bytes: 4084
/***  بسم الله الرحمن ا لرحيم   ***/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#include<unordered_map>
#define endl                         '\n'
#define Ceil(x,y)             ((x+y-1)/y)
#define sz(s)               (int)s.size()
#define RT(x)           return cout<<x,0;
#define mem(x,y)    memset(x,y,sizeof(x))
#define all(v) ((v).begin()), ((v).end())
#define watch(x) cout<<#x<<" = { "<<x<<" }\n"
#define test int t;cin>>t;while(t--)
const int dx[] = { 0, 1, 0, -1, 1, 1, -1, -1 };
const int dy[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
const double PI = acos(-1), EPS = 1e-7;
const int OO = 0x3f3f3f3f, N = 2e5 + 5, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll x, ll y) { return (!y) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return ((x / gcd(x, y)) * y); }
void file() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif  !ONLINEJUDGE
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int n;
int memo[N];
vector<int>v;
int dp(int i) {
	if (i >= n)return OO;
	if (i == n - 2)return abs(v[i] - v[n - 1]);
	if (i == n - 3)return abs(v[i] - v[n - 1]);
	int& ret = memo[i];
	if (ret != OO)return ret;
	ret = min(ret, dp(i + 1) + abs(v[i] - v[i + 1]));//take1
	ret = min(ret, dp(i + 2) + abs(v[i] - v[i + 2]));//take2
	return ret;
}
void solve() {
	cin >> n;
	v = vector<int>(n);
	for (auto& t : v)cin >> t;
	mem(memo, OO);

	cout << dp(0) << endl;

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


Measured memory_bytes: 9048
#include<stdio.h>
int main()
{char a[10];
int i,A=0,B=0;
gets(a);
for(i=0;a[i]!='\0';i++)
{
    if(a[i]=='A')
    {
        A++;
    }
    else if(a[i]=='B')
    {
        B++;
    }
}
 if(A!=0&&B!=0)
 {
     printf("Yes\n");
 }
    else
        printf("No\n");
    return 0;
}


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

// 愚直な二項係数計算
ll nCk(ll n, ll k){
    ll res = 1;
    for(ll i=1; i<=k; i++){
        res = (res*(n-i+1)/i); 
    }
    return res;
}

void solve(){
    ll n;
    cin >> n;
    map<char, ll> mp;
    REP(i, n){
        string s;
        cin >> s;
        if(s[0]=='M' || s[0]=='A' || s[0]=='R' || s[0]=='C' || s[0]=='H'){
            mp[s[0]]++;
        }
    }
    
    if(mp.size() < 3) cout << 0 << endl;
    else{
        if(!mp['M']) mp['M'] = 0;
        if(!mp['A']) mp['A'] = 0;
        if(!mp['R']) mp['R'] = 0;
        if(!mp['C']) mp['C'] = 0;
        if(!mp['H']) mp['H'] = 0;
        vector<ll> v;
        for(auto it=mp.begin(); it!=mp.end(); it++){
            v.pb(it->second);
            //cout << it->second << endl;
        }

        ll res = 0;
        for(int i=0; i<=2; i++){
            for(int j=i+1; j<=3; j++){
                for(int k=j+1; k<=4; k++){
                    res += v[i]*v[j]*v[k];
                }
            }
        }

        cout << res << endl;
    }

    
    
}

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

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

int f(char a, char b, char c){
  if(a == b && b == c) return 0;
  if(a != b && b != c && c != a) return 2;
  return 1;
}

int main(void){
  int n;
  string a, b, c;
  cin >> n >> a >> b >> c;
  int ans = 0;
  for(int i = 0; i < n; i++){
    ans += f(a[i], b[i], c[i]);
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N;
    cin >> N;
    ll ans = 0;
    REP(i, N) {
        ll n = i + 1;
        ll m = 0;
        while (n > 0) {
            n /= 10;
            m++;
        }
        if (m % 2 == 1)
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;

int main(){
    char b,c[128];
    cin >> b ;
    c['A'] = 'T';
    c['T'] = 'A';
    c['C'] = 'G';
    c['G'] = 'C';

    // cout << c['A'] << endl;
    cout << c[b] << endl;

    
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
A2 = list(map(lambda a: a // 400, A))

G1 = [a for a in A2 if a < 8]
min = len(set(G1))
max = min + len(A2) - len(G1)

if min == 0:
    min = 1
print(min, max)

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int D, G;
  cin >> D >> G;
  vector<int> p(D), c(D);
  REP(i, D) cin >> p[i] >> c[i];
  vector<int> all(D);
  REP(i, D) all[i] = 100 * (i + 1) * p[i] + c[i];
  int ans = 1e9;
  for (int mask = 0; mask < (1 << D); ++mask) {
    int res = 0;
    int score = 0;
    int last = -1;
    REP(i, D) {
      if ((mask >> i) & 1) {
        score += all[i];
        res += p[i];
      } else {
        last = i;
      }
    }
    if (score < G) {
      REP1(i, p[last] - 1) {
        score += 100 * (last + 1);
        res++;
        if (G <= score) break;
      }
      if (score < G) res = 1e9;
    }
    ans = min(ans, res);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<ll,ll>
#define vpii vector<pair<ll,ll> >
#define F first
#define S second
#define ld long double
#define built __builtin_popcountll
int const M=2e5+10,M2=1e6+10,mod=1e9+7,inf=1e9+10;
ll max3(ll x,ll y,ll z) {return max(max(x,y),z);}
ll min3(ll x,ll y,ll z) {return min(min(x,y),z);}
ll pow(ll a, ll b){ll res = 1;for(int i = 1; i<=b; ++i) res *= a;return res;}
ll isPrime(ll n){for(ll i=2; i<=sqrt(n); i++){if(n%i==0) return 0;}return 1;}
ll fact(ll n){if(n==0 || n==1) return 1; else return n*fact(n-1);}
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;}
int a[18]={2,3,5,7,11,13,13,17,19,23,29,31,37,41,43,47,53,59};
ll binarySearch(ll low,ll high,ll key){while(low<=high){ll mid=(low+high)/2;if(a[mid]<key){low=mid+1;}else if(a[mid]>key){high=mid-1;}else{return mid;}}return -1;}
void Sieve(ll n, ll prime[]){for(int p=2; p*p<=n; p++){if(prime[p] == true){for(int i=p*2; i<=n; i += p)prime[i] = false;}}for(int p=2; p<=n; p++)if(prime[p])cout << p << " ";}


int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n,m;
	cin >> n >> m;
	if(n==m) cout << 1;
	else{
        for(ll i=m/n; i>=1; i--){
            if(m%i==0){
                cout << i;
                return 0;
            }
        }
	}
	return 0;
}
/* The judge is never wrong! Your code is buggy 😈
   Look for:
 * * an easier and alternate approach
 * * read the problem statement carefully
 * * if concept is correct and still WA, try with a different implementation
 * * special cases (n=1?)
 * * overflow (ll vs int?)
 * * array bounds
 * * if you have no idea just guess the appropriate well-known algorithm instead of doing nothing :/
 */


Measured memory_bytes: 384
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  string S;
  cin >> S;
  if(S=="ABC") cout << "ARC\n";
  else cout << "ABC\n";
}

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

Measured memory_bytes: 3612
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1072114514
#define llinf 1145141919810364364
#define mod 1000000007

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(c%gcd(a,b) == 0){printf("YES\n");}else{printf("NO\n");}
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
int ch[26];
int dp[26];
int main()
{
	string a;
	int n;
	cin >> n;
	for (int i = 0; i < 26; i++)
		dp[i] = 111111;
	while (n--)
	{
		cin >> a;
		memset(ch, 0, sizeof(ch));
		for (int i = 0; i < a.size(); i++)
		{
			ch[a[i] - 'a']++;
		}
		for (int i = 0; i < 26; i++)
		{
			dp[i] = min(dp[i], ch[i]);
		}
	}
	for (int i = 0; i < 26; i++)
	{
		while (dp[i])
		{
			printf("%c", i + 'a');
			dp[i]--;
		}
	}
}

Measured memory_bytes: 256
#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[i];
  
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int Alice = 0;
  int Bob = 0;
  
  for (int i=0; i<N; i++){
    if (i%2==0) Alice += a[i];
    else Bob += a[i];
  }
  
  cout << Alice - Bob << endl;
}

Measured memory_bytes: 256
import heapq
N,M = map(int,input().split())
l_a = list(map(int,input().split()))
l_a = [(-x,x) for x in l_a]
heapq.heapify(l_a)
for m in range(M):
    if l_a[0][1]%2==1:
        heapq.heappush(l_a,(l_a[0][0]//2+1,l_a[0][1]//2))
    else:
        heapq.heappush(l_a,(l_a[0][0]//2,l_a[0][1]//2))
    heapq.heappop(l_a)
a = 0
for i in range(N):
    a += l_a[i][1]
print(a)

Measured memory_bytes: 81388
#include<bits/stdc++.h>
#define INF 9223372036854775807LL
#define mod 1000000007
#define SYOU(x) setprecision(x+1)
#define abs(x,y) (max(x,y)-min(x,y))
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    lol n,a,b,c;
    cin >>n>>a>>b;
    lol ans=0;
    ans=n/(a+b)*a;
    ans+=min(a,n%(a+b));
    cout <<ans<<'\n';
    return (0);
}


Measured memory_bytes: 256
solve [] = "APPROVED"
solve (x:xs)
  | odd x = solve xs
  | cond = solve xs
  | otherwise = "DENIED"
  where
    cond = (x `mod` 3 == 0) || (x `mod` 5 == 0)

main = do
  getLine
  xs <- map read . words <$> getLine :: IO [Int]
  putStrLn $ solve xs


Measured memory_bytes: 892
#include <algorithm>
#include <cstdio>
#include <climits>
#include <vector>
using namespace std;

int main() {
    while(true) {
        int n; scanf("%d\n", &n);
        if(n==0) break;
        int m; scanf("%d\n", &m);
        static char s[1000010];
        scanf("%s ", s);
        int cnt = 0;
        int state = 0;
        for(int i = 0; i < m; i++) {
            if(s[i] == "IO"[state&1]) state++;
            else if(s[i] == 'I') state = 1;
            else state = 0;
            if((state&1) && state>=n*2+1) cnt++;
        }
        printf("%d\n", cnt);
    }
    return 0;
}

Measured memory_bytes: 0
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int l = sc.nextInt();

		String[] s = new String[n];
		for (int i = 0; i < n; i++) {
			s[i] = sc.next();
		}

		Arrays.sort(s);

		StringBuilder ans = new StringBuilder(n * l);

		for (int i = 0; i < n; i++) {
			ans.append(s[i]);
		}

		System.out.println(ans);

		sc.close();
	}

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
#include <time.h>
#define int long long int
#define pb push_back
#define mem(a, x) memset(a, x, sizeof a)
#define all(a) a.begin(), a.end()
#define scnarr(a, n) for (int i = 0; i < n; ++i) cin >> a[i]
#define vi vector<int>
#define si set<int>
#define pii pair <int, int>
#define sii set<pii>
#define vii vector<pii>
#define mii map <int, int>
#define faster ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
using namespace chrono;
/*
	----------------------------------------------------------------------
	Things to remember : check for coners n = 1, pass references instead
*/
/* -------------------------------Solution Sarted--------------------------------------*/

//Constants
const int MOD = 1000000007; // 1e9 + 7
const int MAXN = 1000005; // 1e6 +5
const int INF = 100000000000005; // 1e15 +5

void solve(){
	string s;
	cin >> s;
	s.back() == 's' ? cout << s << "es\n" : cout << s << "s\n";
	
}

signed main()
{
	faster;
#ifndef ONLINE_JUDGE
	freopen("ip.txt", "r", stdin);
	freopen("op.txt", "w", stdout);
#endif
	// int t; cin >> t; while(t--)
		solve();
	return 0;
}


//Author : Ankit Raj
//Problem Link :

/*Snippets*/
/*
sieve - prime factorization using sieve and primes in range
zpower - pow with mod
plate - Initial template
bfs 
dfs
fenwik - BIT
binary_search
segment_tree
*/
	

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

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

int main(){
    int n, m;
    cin >> n >> m;
    string ans = "Yes";
    if(n!=m){
        ans = "No";
    }
    cout << ans << endl;
    return 0;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
int64_t factorial(int64_t n) {
  if (n == 1) {
    return 1;
  }
  int64_t ans = factorial(n-1);
  return ans*n;
}

int main() {
  int64_t n;
  cin >> n;
  vector <int64_t> v(n+2, 0);
  rep(i, n) cin >> v.at(i+1);
  int64_t sum = 0;
  rep(i, n+1) sum += abs(v.at(i)-v.at(i+1));
  rep(i, n) {
    cout << sum - (abs(v.at(i)-v.at(i+1))+abs(v.at(i+1)-v.at(i+2))) + abs(v.at(i)-v.at(i+2)) << endl;
  }
}

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

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

template<class T,class U> void chmax(T& a, U b) {if(a<b)a=b;}
template<class T,class U> void chmin(T& a ,U b) {if(b<a)a=b;}

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
#define debug(x) cerr << #x << ": " << x << endl;
#define int ll

const ll mod = 1e9 + 7;
const ll inf = (1LL << 50);

#include <iostream>

/* recursion ver
 *
long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
*/

long long gcd(long long m, long long n) {

  if (m < n)
    std::swap(m, n);

  long long tmp;
  while (m % n != 0) {
    tmp = n;
    n = m % n;
    m = tmp;
  }

  return n;
}

long long lcm(long long m, long long n) { return m * n / gcd(m, n); }

void solve(long long N, long long M, std::vector<long long> a){
    ll g = a[0], y = a[0] / 2;
    rep(i, N) {
        ll f = g;
        g = lcm(g, a[i]);
        ll zz = max(f, a[i]);
        // debug(y)
        // debug(g)
        bool ok = false;
        for (int j = zz / 2; j < g; j+=zz) {
            // debug(j)
            // debug((j - y) % f)
            // debug((j - a[i] / 2) % a[i])
            if (j - y >= 0 and j - a[i] / 2 >= 0 and (j - y) % f == 0 and (j - a[i] / 2) % a[i] == 0) {
                y = j;
                ok = true;
                break;
            }
        }
        if (!ok) {cout << 0 << endl; return;}
    }
    // debug(M)
    // debug(g)
    // debug(y)
    if (M < y) {
        cout << 0 << endl;
        return;
    }
    cout << (M - y) / g + 1 << endl;
    return;
}

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

    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<long long> a(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&a[i]);
    }
    solve(N, M, std::move(a));
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <string.h>
/* 返り値 1=>stable 0=>notstable */
int SelectionSort(int N, int row, int A[row][N]);
int BubbleSort(int N, int row, int A[row][N]);
int CheckStable(int N, int row, int bbs[row][N], int sls[row][N]);
int main(){
  char line[100000];
  int total;
  int i;
  char card;
  char *str_ptr;
  fgets(line, sizeof(line), stdin);
  sscanf(line, "%d", &total);
  int bfs[2][total];		/* ソート前のデータ */
  int bbs[2][total];			/* バブルソート */
  int sls[2][total];			/* 選択ソート */
  //カードの読み込み
  fgets(line, sizeof(line), stdin);
  str_ptr=strtok(line, " ");
  for(i=0; i<total; ++i){
	bbs[0][i]=*str_ptr;
	bfs[0][i]=*str_ptr;
	sls[0][i]=*str_ptr;
	++str_ptr;
	bbs[1][i]=(*str_ptr-'0');
	bfs[1][i]=(*str_ptr-'0');
	sls[1][i]=(*str_ptr-'0');
	str_ptr=strtok(NULL, " ");
	if(str_ptr==NULL)
	  break;
  }
  //sort
  SelectionSort(total, 2, sls);
  BubbleSort(total, 2, bbs);
  //

  //バブルソートの結果の出力
  for(i=0; i<total; ++i){
  	printf("%c%d", bbs[0][i], bbs[1][i]);
  	if(i<(total-1))
  	  printf(" ");
  }
  printf("\n");
  printf("Stable\n");
  //選択ソートの結果の出力
  for(i=0; i<total; ++i){
  	printf("%c%d", sls[0][i], sls[1][i]);
  	if(i<(total-1))
  	  printf(" ");
  }
  printf("\n");
  int flag;
  flag=CheckStable(total, 2, bbs, sls);
  if(flag==0)
	printf("Stable\n");
  else
	printf("Not stable\n");
  return 0;
}
int SelectionSort(int N, int row, int A[row][N]){
  int i, j;
  int tmp, min;
  int index;
  int count;
  char ch;
  for(i=0; i<(N-1); ++i){
	min=A[1][i];
	tmp=A[1][i];
	ch=A[0][i];
	for(j=(i+1); j<N; ++j){
	  if(min>A[1][j]){
		min=A[1][j];
		index=j;
		
	  }
	}
	if(tmp!=min){
	  A[1][i]=min;
	  A[1][index]=tmp;
	  A[0][i]=A[0][index];
	  A[0][index]=ch;
	  ++count;
	}
  }
  return 1;
}
int BubbleSort(int N, int r, int A[r][N]){
  int i, j;
  char tmp_ch;
  int tmp_int;
  for(i=0; i<(N-1); ++i){
	for(j=(N-1); j>i; --j){
	  if(A[1][j]<A[1][j-1]){
		tmp_ch=A[0][j];
		tmp_int=A[1][j];
		A[0][j]=A[0][j-1];
		A[1][j]=A[1][j-1];
		A[0][j-1]=tmp_ch;
		A[1][j-1]=tmp_int;
	  }
		
	}
  }
  return 1;
}
/* 安定<==>1  不安定<==>0 */
int CheckStable(int N, int row, int bbs[row][N], int sls[row][N]){
  int i;
  int flag=0;
  for(i=0; i<N; ++i){
	if((bbs[0][i]==sls[0][i])&&(bbs[1][i]==sls[1][i]));
	else
	  ++flag;

}
  return flag;
}



Measured memory_bytes: 2044
n = int(input())
d = {}
for i in range(2, n+1):
    for j in range(2, i+1):
        while i%j == 0:
            i //= j
            d[j] = d.get(j, 0)+1
a = list(d.values())
dp = [[0]*74 + [1] for i in range(len(a)+1)]
for i in reversed(range(len(a))):
    for j in range(74):
        for k in range(a[i]+1):
            v = j+(j+1)*k
            if v > 74:
                break
            dp[i][j] += dp[i+1][v]
print(dp[0][0])

Measured memory_bytes: 3064
package main

import (
        "bufio"
        "fmt"
        "os"
        "sort"
        "strings"
)

var rdr = bufio.NewReaderSize(os.Stdin, 1000000)

func readLine() string {
        var buf []byte
        for {
                l, p, e := rdr.ReadLine()
                if e != nil {
                        panic(e)
                }
                buf = append(buf, l...)
                if !p {
                        break
                }
        }
        return string(buf)
}

func main() {
        var n int
        var s string
        var ans int64

        mp := map[string]int{}

        fmt.Scan(&n)

        for i := 0; i < n; i++ {
                s = readLine()
                slice := strings.Split(s, "")
                sort.Strings(slice)
                s = strings.Join(slice, "")
                ans += int64(mp[s])
                mp[s]++
        }

        fmt.Println(ans)
}


Measured memory_bytes: 13696
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
//INSERT ABOVE HERE
signed main(){
  map<string,Int> m;
  Int q;
  cin>>q;
  for(Int i=0;i<q;i++){
    Int t,x;
    string s;
    cin>>t;
    if(t!=3) cin>>s;
    if(t==0) cin>>x;
    if(t==0) m[s]=x;
    if(t==1) cout<<(m.count(s)?m[s]:0)<<endl;
    if(t==2) m.erase(s);
    if(t==3){
      string l,r;
      cin>>l>>r;
      auto latte=m.lower_bound(l);
      while(latte!=m.end()&&latte->first<=r){
	cout<<latte->first<<" "<<latte->second<<endl;
	++latte;
      }
    }
  }
  return 0;
}



Measured memory_bytes: 27828
// header {{{
// header {{{
#include <bits/stdc++.h>
using namespace std;
 
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
 
#define ASSERT(expr...) assert((expr))
 
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
 
using f32 = float;
using f64 = double;
// }}}
 
constexpr i64 INF = 1'010'000'000'000'000'017LL;
 
constexpr i64 MOD = 1'000'000'007LL;
 
constexpr f64 EPS = 1e-12;
 
constexpr f64 PI = 3.14159265358979323846;

#define M5 100007
#define M9 1000000000

 
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
 
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define ll long long int
#define VI vector <int>
template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
 
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
 
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
 
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}
 
// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;
 
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}
 
//--------------------------------------------------------------------
 
bool isOK(int mid, double key){
 
    if((double)mid*mid > key) {
             return true;
     } else {
              return false;
     }
}

 int binary_search(double key) {
    int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
    int right = 2000000000;
    /* どんな二分探索でもここの書き方を変えずにできる！ */
    while (right - left > 1) {
        int mid = left + (right - left) / 2;

        if (isOK(mid, key)) right = mid;
        else left = mid;
    }

    /* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
    return right;
}


bool isKaibun(string st){
    bool ans = true;
    int n = st.length();
    REP(i,n/2){
        if(st[i] != st[n-i-1]){
            return false;
        }
    }
    return true;
}

int toInt(char a){
    return a-'0';
}



void solve() {
    int N,M;
    VI A;
    cin >> N >> M;
    A.resize(N);
    int ans = 0;
    REP(i,N){
        cin >>A[i];
        ans += A[i];
    }
    int co = 0;

    REP(i,N){
        if(A[i] * 4 * M >= ans)        {
            co++;
        }
    }

    if(co >= M){
        cout << "Yes";
    }else{
        cout << "No";
    }


   }




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


Measured memory_bytes: 256
class SegmentTree():

    def __init__(self, n):
        self.size = 1
        while self.size < n:
            self.size *= 2
        self.node = [0] * (2*self.size - 1)

    def update(self, i, val):
        i += (self.size - 1)
        self.node[i] = val
        while i > 0:
            i = (i - 1) // 2
            self.node[i] = max(self.node[2*i+1], self.node[2*i+2])

    def get_max(self, begin, end):
        begin += (self.size - 1)
        end += (self.size - 1)
        s = 0
        while begin < end:
            if (end - 1) & 1:
                end -= 1
                s = max(s, self.node[end])
            if (begin - 1) & 1:
                s = max(s, self.node[begin])
                begin += 1
            begin = (begin - 1) // 2
            end = (end - 1) // 2
        return s


n = int(input())
h = list(map(int, input().split()))
a = list(map(int, input().split()))
st = SegmentTree(n+1)

dp = [0]*(n+1)

for i in range(n):
    #i番目の花を残さないとき
    res1 = st.get_max(0, n+1) 
    #i番目の花を残すとき
    res2 = st.get_max(0, h[i]) + a[i]
    
    dp[i+1] = max(res1, res2)
    st.update(h[i], res2)
print(dp[n])

Measured memory_bytes: 123600
#include<bits/stdc++.h>
#define FLASH cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);

#define F first
#define S second
#define pb push_back
#define int long long
#define maxn 200000
#define mod 1000000007
#define inf 1000000000000000000

#define fr(i,a,b) for(int i=a;i<b;i++)
#define FILEIO freopen("/home/aman/Desktop/Kachda/input.txt", "r", stdin); //freopen("/home/aman/Desktop/Kachda/output.txt", "w", stdout);
#define all(x) begin(x), end(x)
#define PII pair<int, int>
#define VI vector<int>
#define VII vector<PII>

using namespace std;

int n, h[maxn + 1], bit[maxn + 1], a[maxn + 1];


void update(int ind, int val){
	int x = ind;
	while(x <= n){
		bit[x] = max(bit[x], val);
		x += x&-x;
	}
}

int queri(int ind){
	int x = ind;
	int ans = 0;
	while(x){
		ans = max(ans, bit[x]);
		x -= x&-x;
	}
	return ans;
}

signed main()
{
    FLASH

    cin>>n;

    fr(i, 1, n + 1){
    	cin>>h[i];
    }
    fr(i, 1, n + 1){
    	cin>>a[i];
    }

    int ans = 0;
    fr(i, 1, n + 1){
    	int max_val = queri(h[i] - 1);
    	ans = max(ans, max_val + a[i]);
    	update(h[i], max_val + a[i]);
    }

    cout<<ans<<'\n';
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x, n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
typedef pair< int, int > P;   
typedef pair< int, P > PP;

//-----------------------------------------------------------------------------

int n;
vector< int > p;

vector< bool > eratosthenes(int n) {
    vector< bool > is_prime(n + 1, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i * i <= n; i++) {
        if (is_prime[i]) {
            for (int j = 2 * i; j <= n; j += i) is_prime[j] = false;
        }
    }
    return is_prime;
}

void prime_list(int n) {
    auto is_prime = eratosthenes(n);
    for (int i = 0; i <= n; i++) {
        if (is_prime[i]) {
            if (i % 5 == 1) p.pb(i);
        }
    }
}

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

    prime_list(55555);

    cin >> n;
    REP(i, n) {
        cout << p[i] << ' ';
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
using namespace std;
const int N = 1e5+5;
void fast(){std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
int n,x[N],dp[N],ans;
int main()
{
	fast();
	cin>>n;
	for(int i=0;i<n;i++)cin>>x[i];
	for(int i=1;i<n;i++)
	{
		if(x[i-1]>=x[i])
		{
			dp[i]=dp[i-1]+1;
			ans=max(ans,dp[i]);
		}
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>
#include<math.h>
int check(int k) {
	int i = 1;
	while (1) {
		if ((k * i) % 360 == 0) {
			return i;
		}
		i++;
	}
	return -1;
}
int main() {
	char c;
	scanf("%c", &c);
	if (c >= 'A' && c <= 'Z') {
		printf("A\n");
	}
	else {
		printf("a\n");
	}
	return 0;
}

Measured memory_bytes: 1540
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <string>
#include <vector>
#define FOR(i, a, b)  for(int i=a; i<b; ++i)
#define rFOR(i, a, b) for(int i=a-1; i>=b; --i)
#define REP(i, n) for(int i=0; i<n; ++i)
#define rREP(i, n) for(int i=n-1; i>=0; --i)
#define all(a)  a.begin(), a.end()
using namespace std;

int main(){
  int n;  cin >> n;
  if(n>=1000) cout << "ABD" << endl;
  else  cout << "ABC" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
using namespace std;

void stable(int n, char a[36][3], char b[36][3]){

	for (int i = 0; i < n - 1; i++)
		cout << b[i] << " ";
	cout << b[n - 1] << endl;

	int	k = 0;

	for (int i = 0; i < n - 1; i++) {
		if (b[i][1] == b[i + 1][1]) {

			int s = 0, t = 0;

			while (strcmp(a[s], b[i]))
				s++;

			while (strcmp(a[t], b[i + 1]))
				t++;

			if (s > t)
				k = 1;
		}
	}

	if (k == 0)
		cout << "Stable" << endl;
	else
		cout << "Not stable" << endl;
}

int main()
{
	int n = 0 , minj = 0, flag = 1, k = 0;
	char a[36][3], b[36][3], temp[3];

	cin >> n;

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

	for (int i = 0; i < n; i++)
		strcpy(b[i], a[i]);

	while (flag) {
		flag = 0;
		for (int j = n - 1; j > 0; j--) {
			if (b[j][1] < b[j - 1][1]) {
				strcpy(temp, b[j - 1]);
				strcpy(b[j - 1], b[j]);
				strcpy(b[j], temp);
				flag = 1;
			}
		}
	}

	stable(n, a, b);

	for (int i = 0; i < n; i++)
		strcpy(b[i], a[i]);

	for (int i = 0; i < n - 1; i++){

		minj = i;

		for (int j = i + 1; j < n; j++) {
			if (b[j][1] < b[minj][1])
				minj = j;
		}

		if (minj > i) {
			strcpy(temp, b[i]);
			strcpy(b[i], b[minj]);
			strcpy(b[minj], temp);
		}
	}

	stable(n, a, b);
		
	return 0;
}

Measured memory_bytes: 3148
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   ff   first
#define   ss   second
#define   pii  pair<int,int>
using namespace std;

inline void solve(){
    int n; 
    cin>>n;
    int a[n],alice=0,bob=0;
    for (int &i: a) cin>>i;
    sort(a,a+n,greater<int> ());
    for (int i=0;i<n;i++){
        if (i&1^1) alice += a[i];
        else bob += a[i];
    }
    cout << alice-bob << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
typedef struct _data {
	int x;
	int y;
} data;

int  main()
{
	int n, m,x;
	cin >> n >> m >> x;
	set <int> st;
	rep(i , m)
	{
		int a;
		cin >> a;
		st.insert(a);
	}
	int right = 0,left = 0;
	for (int i = x+1; i < n; i++)
	{
		if (st.count(i))
			right++;
	}
	for (int i = x-1; i > 0; i--)
	{
		if (st.count(i))
			left++;
	}
	cout << min(left, right) << endl;
	return (0);
}


Measured memory_bytes: 256
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
#from operator import itemgetter
#from heapq import heappush, heappop
#import numpy as np
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
#from scipy.sparse import csr_matrix
#from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
import sys

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

K = ni()
S = ns()
if len(S) <= K:
    print(S)
else:
    print(S[:K] + '...')

Measured memory_bytes: 10876
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = LONG_LONG_MAX / 2;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

int main() {
  ll N, M, K;
  cin >> N >> M >> K;
  vector<ll> A(N + 1, 0), B(M + 1, 0);
  for (int i = 1; i <= N; i++) {
    cin >> A[i];
    A[i] += A[i - 1];
  }
  for (int i = 1; i <= M; i++) {
    cin >> B[i];
    B[i] += B[i - 1];
  }
  int ans = 0;
  for (int i = 0; i <= N; i++) {
    int tk = K;
    tk -= A[i];
    if (tk < 0) break;
    auto iter = upper_bound(B.begin(), B.end(), tk);
    ans = max(ans, i + (int)(iter - B.begin()) - 1);
  }

  cout << ans << endl;
}


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

#define nl '\n'

using namespace std;

typedef long long ll;

void solve() {
  int x, n;
  cin >> x >> n;
  unordered_set<int> a;
  for (int i = 0; i < n; ++i) {
    int e;
    cin >> e;
    a.insert(e);
  }

  int ans = -1;
  bool ansFound = false;
  for (int diff = 0; !ansFound; ++diff) {
    int val1 = x - diff, val2 = x + diff;
    if (!a.count(val1)) {
      ans = val1;
      ansFound = true;
      break;
    } else if (!a.count(val2)) {
      ans = val2;
      ansFound = true;
      break;
    }
  }
  
  cout << ans;
}

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

  // int t;
  // cin >> t;
  // while (t--) {
  solve();
  // }

  return 0;
}

Measured memory_bytes: 3620
#include <iostream>

using namespace std;

void solve(int H,int W,int N) {
    int moji[H][W];
    int cnt[H+1][W+1];
    for(int i=0; i<H; ++i) {
        for(int j=0; j<W; ++j) {
            cin >> moji[i][j]; // 0->south / 1->east
        }
    }

    // count visits for N-1 walk
    cnt[0][0]=N-1;
    for(int j=0; j<W-1; ++j) {
        cnt[0][j+1]=(cnt[0][j]+moji[0][j])/2;
    }
    for(int i=0; i<H-1; ++i) {
        cnt[i+1][0]=(cnt[i][0]+1-moji[i][0])/2;
    }
    for(int i=0; i<H-1; ++i) {
        for(int j=0; j<W-1; ++j) {
            cnt[i+1][j+1]=(cnt[i+1][j]+moji[i+1][j])/2+(cnt[i][j+1]+1-moji[i][j+1])/2;
        }
    }
    // calculate status after N-1 walk
    for(int i=0; i<H; ++i) {
        for(int j=0; j<W; ++j) {
            moji[i][j]=(moji[i][j]+cnt[i][j])%2;
        }
    }
    // Nth walk
    int h=0, w=0;
    while(h<H && w<W) {
        if(moji[h][w]==0) ++h;
        else ++w;
    }
    cout << h+1 << " " << w+1 << endl;

    return;
}

int main() {
    int H,W,N;
    while(true) {
        cin >> H >> W >> N;
        if(H==0 && W==0 && N==0) break;
        solve(H,W,N);
    }
    return 0;
}


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

using namespace std;

int main(){
string s;
    cin>>s;

    if(s == "Sunny"){
        cout<<"Cloudy";
    }
    else if(s == "Cloudy"){
        cout<<"Rainy";
    }
    else{
        cout<<"Sunny";
    }
return 0;
}

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

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

    if (n == 1) cout << "Hello World" << endl;
    else if(n == 2) {
        int a, b;
        cin >> a >> b;
        cout << a+b << endl;
    }

    return 0;
}

Measured memory_bytes: 3552
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define INF 1<<31-1
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define MOD 1000000007
#define NUM 100005
void swap(int* a,int* b){int tmp=*a;*a=*b;*b=tmp;}
int cmp(const void* a,const void* b){return *(int*)a-*(int*)b;}

int judge(char a){
  if(a=='A'||a=='G'||a=='C'||a=='T')return 1;
  return 0;
}

int main() {
  int N,M,i,ans=0,a=0;
  char S[11];
  scanf("%s",S);
	FOR(i,0,11){
    if(judge(S[i])==1)a++;
    else{
      if(ans<a)ans=a;
      a=0;
    }
  }

  printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 128