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

#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++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N; cin>>N; N--;
    ll now=26; int cnt=1;
    while(N >= now){
        N-=now;
        now*=26;
        cnt++;
    }
    string ans;
    rep(i,cnt){
        ans.pb(char(N%26+'a'));
        N/=26;
    }
    reverse(all(ans));
    cout<<ans<<endl;
    return 0;
}


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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max<R>(x,0.0));}

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

// Problem Specific Parameter:
const ll inf=1LL<<50;

// Description: ??°??????????????????(?????????????°??????¨???)
// Verifyed: Many Diffrent Problem 

//Appropriately Changed
using edge=struct{int to,cap,rev;};
using G=vector<vector<edge>>;

//Appropriately Changed
void add_edge(G &graph,int from,int to,int cap){ 
	graph[from].push_back({to,cap,int(graph[to].size())});
	graph[to].push_back({from,0,int(graph[from].size())-1});
}

// Description: ??°???????????????????????§??? 
// TimeComplexity: $ \mathcal{O}(EV^2) $ 
// Verifyed: AOJ GRL_6_A

template <typename W> W dinic(G &graph,int s,int t,W inf){
	const int n=graph.size();
	vector<int> level(n),iter(n);

	auto bfs=[&](int s,int t){
		fill(_all(level),-1);
		queue<int> q;
		level[s]=0,q.push(s);
		while(!q.empty()){
			int v=q.front();q.pop();
			for(auto &e:graph[v])
				if(e.cap>0 && level[e.to]<0)
					level[e.to]=level[v]+1,q.push(e.to);
		}
		return level[t]>=0;
	};

	auto dfs=[&](int v,int t,W f){
        auto func=[&](int v,int t,W f,auto func)->W{
        	if(v==t) return f;
			for(int &i=iter[v];i<graph[v].size();i++){
				edge &e=graph[v][i];
				if(e.cap>0 && level[v]<level[e.to]){
					W d=func(e.to,t,min<W>(f,e.cap),func);
					if(d==0) continue;
					e.cap-=d,graph[e.to][e.rev].cap+=d;
					return d;
				}
			}
			return 0;
        };
        return func(v,t,f,func);
    };

	W res=0;
	while(bfs(s,t)){
		fill(_all(iter),0);
		for(W f;f=dfs(s,t,inf);res+=f);
	}
	return res;
}

int main(void){
	int v,e;
	cin >> v >> e;
	G graph(v);
	rep(i,e){
		int a,b,c;
		cin >> a >> b >> c;
		add_edge(graph,a,b,c);
	}
	cout << dinic(graph,0,v-1,inf) << endl;
	return 0;
}

Measured memory_bytes: 3212
#include <cstring>
#include <cstdio>
#include <algorithm>
#define ll long long
const ll INFLL = 0x3f3f3f3f3f3f3f3fLL;
const int MAXN = 100010;
using namespace std;

int N, T, E, X[MAXN];
ll dp[MAXN];

inline ll val(int x, int p) { return dp[p] + (X[p + 1] - X[p]) + max(T, 2 * (X[x] - X[p + 1])) + (X[x] - X[p + 1]); }
int pt[MAXN], ptpos[MAXN], qH = 0, qT = 0;

int main() {
	int i, j;
	scanf("%d%d%d", &N, &E, &T);
	for(i = 1; i <= N; i++) scanf("%d", &X[i]);

	dp[0] = 0, pt[qT] = 0, ptpos[qT] = 1, qT++;
	for(i = 1; i <= N; i++) {
		while(qT - qH >= 2 && i >= ptpos[qH + 1]) qH++;
		//printf("%d = %d\n", i, pt[qH]);
		dp[i] = val(i, pt[qH]);

		//insert i
		if( val(N, i) < val(N, pt[qT - 1]) ) {
			//printf("Try to insert %d\n", i);
			while( qT - qH >= 2 && val(i + 1, i) <= val(i + 1, pt[qT - 1]) ) qT--;

			int L = i, R = N, M; //(L, R]
			while(R - L > 1) {
				M = (L + R) >> 1;
				if(val(M, i) < val(M, pt[qT - 1])) R = M; else L = M;
			}
			pt[qT] = i, ptpos[qT] = R, qT++;
			//printf("Ins to %d\n", R);
		}
	}

	printf("%lld", dp[N] + (E - X[N]));
	return 0;
}


Measured memory_bytes: 2048
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, s, n)    for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...)  type __VA_ARGS__; read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream& operator>> (istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x): x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

constexpr int MOD = int(1e9) + 7;
constexpr int A = 0;
constexpr int C = 1;
constexpr int G = 2;
constexpr int T = 3;

int N;

bool isNG(int a, int b, int c, int d, bool p = false) {
    if (p) {
        return
            (a == A && b == G && c == C) ||
            (b == A && c == G && d == C);
    }

    return
        isNG(a, b, c, d, true) ||
        isNG(b, a, c, d, true) ||
        isNG(a, c, b, d, true) ||
        isNG(a, b, d, c, true);
}

i64 memo[105][5][5][5];
i64 dp(int idx, int pre, int prepre, int preprepre) {

    if (idx >= N) return 1;

    auto &ret = memo[idx][pre][prepre][preprepre];
    if (~ret) return ret;

    ret = 0;
    rep(nxt, 0, 4) {
        if (!isNG(preprepre, prepre, pre, nxt)) {
            ret += dp(idx+1, nxt, pre, prepre);
            ret %= MOD;
        }
    }

    return ret;
}

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

    read(N);
    memset(memo, -1, sizeof(memo));
    print(dp(0, 4, 4, 4));

    return 0;
}


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



int main() {
    int n; cin >> n;
    ll max1 = 0, max2 = 0, max3 = 0;
    ll prev,cur;
    ll count = 0;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());

    prev = a[0];
    rep(i,n){
        cur = a[i];
        if(prev == cur) count++;
        else{
            if(count >= 4){
                count = 1;
                max3 = a[i-1];
                max2 = max1;
                max1 = a[i-1];
            }
            else if(count >= 2){
                count = 1;
                max2 = max1;
                max1 = a[i-1];
            }
        }

        if(i == n-1){
            if(count >= 4){
                count = 1;
                max3 = a[i-1];
                max2 = max1;
                max1 = a[i-1];
            }
            else if(count >= 2){
                count = 1;
                max2 = max1;
                max1 = a[i-1];
            }
        }
        prev = cur;
    }

    cout << max(max3*max3,max1*max2);

    return 0;
}











Measured memory_bytes: 4000
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int b = in.nextInt();
        compare(a, b);
    }

    private static void compare(int a, int b) {
        if (a < b) {
            System.out.println("a < b");
        } else if (a > b){
            System.out.println("a > b");
        } else {
            System.out.println("a == b");
        }
    }
}


Measured memory_bytes: 26120
#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<ll, int>;

struct E {
    int to, co;
    E(int to = 0, int co = 0) : to(to), co(co) {}
};

string rev(string s) {
    reverse(s.begin(), s.end());
    return s;
}

int main() {
    int m;
    cin >> m;
    vector<string> S(m);
    vector<int> C(m);
    rep(i, m) cin >> S[i] >> C[i];
    rep(i, m) {
        S.push_back(rev(S[i]));
        C.push_back(C[i]);
    }

    int n = 1;
    vector<vector<int>> id(m * 2);
    rep(i, m * 2) {
        int l = S[i].size();
        id[i].resize(l);
        rep(j, l) {
            id[i][j] = n++;
        }
    }

    vector<vector<E>> g(n);
    rep(i, m * 2) {
        int l = S[i].size();
        rep(j, l) {
            int v = id[i][j];
            rep(ni, m * 2) {
                if (i / m == ni / m) continue;
                int nl = S[ni].size();
                int w = min(nl, l - j);
                if (S[i].substr(j, w) != S[ni].substr(0, w)) continue;
                int u = 0;
                if (nl > w) {
                    u = id[ni][w];
                } else if (l > j + w) {
                    u = id[i][j + w];
                } else u = 0;
                g[v].emplace_back(u, C[ni]);
            }
        }
    }

    const ll INF = 1e18;
    vector<ll> dist(n, INF);
    priority_queue<p, vector<p>, greater<p>> q;
    auto push = [&](int v, ll x) {
        if (dist[v] <= x) return;
        dist[v] = x;
        q.emplace(x, v);
    };

    rep(i, m) push(id[i][0], C[i]);
    while (!q.empty()) {
        ll x = q.top().first;
        int v = q.top().second; q.pop();
        if (dist[v] != x) continue;
        for (E e : g[v]) {
            push(e.to, x + e.co);
        }
    }

    ll ans = dist[0];
    rep(i, m * 2) {
        int l = S[i].size();
        rep(j, l) {
            string t = S[i].substr(j);
            if (t == rev(t)) {
                ans = min(ans, dist[id[i][j]]);
            }
        }
    }

    if (ans == INF) cout << -1 << endl;
    else cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
const int N=2e5+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;

int main()
{
    ft
    int t,i,j,n,m,l=0,r;
    cin>>n;
    while(n!=0)
    {
        r=n%10;
        if(r==7)
        {
            l=1;
        }
        n/=10;
    }
    (l==1)? cout<<"Yes\n":cout<<"No\n";
    return 0;
}



Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    char S[N];
    rep(i, N) cin >> S[i];
    rep(i, N) {
        if (S[i] == 'Y') {
            cout << "Four" << endl;
            return 0;
        }
    }
    cout << "Three" << endl;

    return 0;
}


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

long long N, A, B;
long long cb = 0, cr = 0;
long long current = 0;
long long amari, shou;

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

    shou = N / (A + B);
    amari = N % (A + B);

    if(amari > A){
        cout << A * (shou + 1) << endl;
    }else{
        cout << A * shou + amari << endl;
    }

    /*while(true){
        
        if(current + A < N){
            cb += A; 
            current += A; 

            if(current + B < N){
                //cr += B;
                current += B;
            }
            else{
                //cr += N - current;
                break;
            }
        }
        else{
            cb += N - current;
            break;
        }

        if(current + B < N){
            cr += B;
            current += B;
        }
        else{
            cr += N - current;
            break;
        }
    }*/

    //cout << cb << endl;

    return 0;
}

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

int main(){
    int n,k,q;
    cin >> n >> k >> q;
    int a=0;
    int point[n+1]={};
    
    for(int i=1;i<=q;i++){
        cin >> a;
        point[a]++;
    }
    
    for(int i=1;i<=n;i++){
        if(point[i]<=q-k) cout << "No" << endl;
        else cout << "Yes" << endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include<stdio.h>

int main(void){

  int n;
  int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  scanf("%d",&n);
  printf("%d",a[n-1]);

  return 0;
}

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

#define rep(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define pb push_back
#define fst first
#define snd second
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

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

  ll minv = 1000000000000000000LL;
  ll tmp = 0;
  rep(i, n - 1){
    tmp += a[i];
    minv = min(minv, abs(sum - 2 * tmp));
    //cout << minv << endl;
  }
  cout << minv << endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
  
  string s,t;
  cin>>s>>t;
  bool flag;
  for(size_t i=0;i<=s.length()-1;i++){
  
    flag=1;
    for(size_t j=0;j<=s.length()-1;j++){
    
      if(s[(j+i)%(s.length())]!=t[j]){
      
        flag=0;
        break;
      }
    }
    if(flag==1){
    
      cout<<"Yes";
      return 0;
    }
  }
  cout<<"No";
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#define REP(i,n) for(int i = 0; i < n ; i++)
using namespace std;

int check(int left,int right)
{
    if(left < 0){
        if(right < 0){
            return - left;
        }else{
            if(left + right < 0){
                return - left + 2 * right;
            }else{
                return -2 * left + right;
            }
        }
    }else{
        return right;
    }
}

int main(void){
    // Your code here!
    int n, m;
    cin >> n >> m;
    int candle[n];
    REP(i,n){
        cin >> candle[i];
    }
    int result = (candle[n-1] - candle[0]) * 2;
    REP(i, n - m + 1){
        result = min(result,check(candle[i], candle[i + m - 1]));
    }
    cout << result;
}

Measured memory_bytes: 640
listA1 = input().split(" ")
listA2 = input().split(" ")
listA3 = input().split(" ")

matrix = [listA1, listA2, listA3]

matrixBool = [[False for i in range(3)] for j in range(3)]

n = int(input())
bingo = False
for i in range(n):
    a = input()

    for l in range(3):
        for j in range(3):

            if matrix[l][j] == a:
                matrixBool[l][j] = True

for l in range(3):
    c = 0
    for i in range(3):
        if matrixBool[l][i] == True:
            c = c+1

    if c == 3:
        bingo = True
        break

for l in range(3):
    c = 0
    for i in range(3):
        if matrixBool[i][l] == True:
            c = c + 1

    if c == 3:
        bingo = True
        break

if (matrixBool[0][0] == True) and (matrixBool[1][1] == True) and (matrixBool[2][2] == True):
    bingo = True


if (matrixBool[0][2] == True) and (matrixBool[1][1] == True) and (matrixBool[2][0] == True):
    bingo = True

if bingo == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
N,M=gets.split.map(&:to_i)
as=gets.split.map(&:to_i).sort
bcs=$<.read.split.map(&:to_i).each_slice(2).sort_by {|b,c|c}

b,c = bcs.pop
ret = 0
as.each do |a|
  if b.nil?
    ret += a
  elsif a < c
    ret += c
    b -= 1
    b,c = bcs.pop if b == 0
  else
    ret += a
  end
end

p ret


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

#define rp(i,n) for(int i=0;i<n;i++)
#define rep(i,m,n) for(int i=m;i<=n;i++)
#define lrp(i,n) for(long long i=0;i<n;i++)
#define lrep(i,m,n) for(long long i=m;i<=n;i++)
#define all(a) a.begin(),a.end()
#define pb push_back

typedef vector<int> vi;
typedef vector<long long> vl;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    vl a(n),s(n);
    lrp(i,n){
        cin >> a.at(i);
    }
    s.at(0)=a.at(0);
    lrep(i,1,n-1){
        s.at(i) = s.at(i-1)+a.at(i);
    }
    sort(all(s));
    ll i=0,cnt1=0;
    while(i<n){
        ll cnt2=1;
        while(i<n-1&&s.at(i)==s.at(i+1)){
            i++;
            cnt2++;
        }
        cnt1 += (cnt2*(cnt2-1))/2;
        i++;
    }
    lrp(i,n){
        cnt1 += (s.at(i)==0?1:0);
    }
    cout << cnt1 << endl;
    
    
    return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>

int main()
{
    int m, n;
    scanf("%d %d", &m, &n);
    while (m != 0 || n != 0)
    {
        for (int i = 0; i < m; i++)
        {
            for (int j = 0; j < n; j++)
            {
                printf("#");
            }
            printf("\n");
        }
        printf("\n");
        scanf("%d %d", &m, &n);
    }
    return 0;
}


Measured memory_bytes: 2036
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<math.h>
#include<map>
using namespace std;


int main(){
	int n;
	cin>>n;
	long long min_x=2000000000;
	long long ans=-5000000000;
	for(int i=0;i<n;i++){
		long long  x;
		cin>>x;
		if(x-min_x>ans)ans=x-min_x;
		min_x=min(x,min_x);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1168
/**In the name of Allah, the Most Merciful, the Most Merciful.**/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define INF 9223372036854775806
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define PI 2*acos(0.0)
#define EPS 1e-9
ll max(ll a,ll b) {if(a>b) return a; else return b;}
ll min(ll a,ll b) {if(a<b) return a; else return b;}

int main()
{
    int n;
    cin>>n;
    int a[n+1];
    int sum=0;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        sum^=a[i];
    }

    for(int i=1;i<=n;i++){
        cout<<(sum^a[i])<<" ";
    }
    cout<<endl;

    return 0;
}




Measured memory_bytes: 4400
n,*a=open(0).read().split()
if len(a)>len(set(a)):
    print("No")
    exit()
else:
    s=a[0][-1]
    for i in range(1,int(n)):
        if s==a[i][0]:
            s=a[i][-1]
        else:
            print("No")
            exit()
        #print(a[i][0])
print("Yes")

Measured memory_bytes: 3060
#include<iostream>
#define ll long long int
#define vi vector<ll>
#define ii pair<ll,ll>
#define iii pair<ii,ll>
#define iiii pair<ii,ii>
#define pb push_back
#define fi first
#define se second
using namespace std;
int t;
int main(){
	ios::sync_with_stdio(0), cin.tie(0);
	string s;
	cin>>s;
	if(s[2] == s[3] && s[4] == s[5]) cout<<"Yes\n";
	else cout<<"No\n";
	return 0;
}

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

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


int main() {
    int N,a,b;
    cin >> N >> a >> b;

    int res = 0;
    for (int i = 1; i<=N; i++) {
        int sum = findsum(i);
        if(sum >= a && sum <= b) {
            res += i;
        }
    }
    cout << res << endl;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    vector<string> a(n);
    vector<string> b(m);

    for (int i = 0;i < n;i++){
        cin >> a.at(i);
    }
    for (int i = 0;i < m;i++){
        cin >> b.at(i);
    }
    bool ans = false;
    for (int i = 0;i <= n - m;i++){
        for (int j = 0;j <= n - m;j++){
             bool can = true;
             for (int k = 0;k < m;k++){
                 for (int l = 0;l < m;l++){
                     if (a[i+k][j+l] != b[k][l]){
                         can = false;
                         break;
                     }
                 }
             }
             if (can){
                 ans = true;
             }
        }
    }
    if (ans){
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,x,s=0;
  cin>>a>>b>>c>>x;
  for(int p=0;p<=a;p++){
    for(int q=0;q<=b;q++){
      
        if(x/50-p*10-q*2<=c && 0<=x/50-p*10-q*2){
          s++;
        }
      
    }
  }
  cout<<s<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<math.h>
#include<algorithm>

using namespace std;
typedef long long ll;

int main(){
   ll N;
   ll A[100002];
   scanf("%lld", &N);
   A[0] = A[N+1] = 0;
   for(int i = 0; i < N; i++) scanf("%lld", &A[i+1]);
   ll sum = 0;
   for(int i = 0; i < N + 1; i++) sum += abs(A[i+1] - A[i]);
   for(int i = 1; i < N + 1; i++)
      printf("%lld\n", sum + abs(A[i+1] - A[i-1]) - abs(A[i+1] - A[i]) - abs(A[i] - A[i-1]));
}

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

    var (N,Y) = readLine()!!.split(" ").map(String::toInt)
    for(x in 0..N){
        for(y in 0.. N){
            var z = Y - 10000*x - 5000*y
            if(z>=0 && x+y+(z/1000).toInt() == N){
                println("$x $y ${z/1000}")
                return
            }
        }
    }
    println("-1 -1 -1")
    
}


Measured memory_bytes: 37912
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處

char s[200005];
int x[200005];

LL neg_pow2[200005];
LL pos_pow2[200005];

int countSetBits(LL n) 
{ 
    int count = 0; 
    while (n) { 
        count += n & 1; 
        n >>= 1; 
    } 
    return count; 
} 

int f(LL x) {
    if (x == 0) {
        return 0;
    } else {
        LL nxt = x % countSetBits(x);
        return 1 + f(nxt);
    }
}

int main() {
    int n;
    cin >> n;
    scanf("%s", s);
    LL popcount = 0;
    for (int i = 0; i < n; i++) {
        x[i] = s[i] - '0';
        if (x[i]) {
            popcount++;
        }
    }
    LL negc = popcount - 1;
    if (negc == 0) {negc = 1;}
    LL posc = popcount + 1;
    neg_pow2[0] = 1 % negc;
    pos_pow2[0] = 1 % posc;
    for (int i = 1; i < n; i++) {
        neg_pow2[i] = neg_pow2[i - 1] * 2 % negc;
        pos_pow2[i] = pos_pow2[i - 1] * 2 % posc;
    }
    LL neg_all = 0, pos_all = 0;
    for (int i = 0; i < n; i++) {
        int d = n - 1 - i;
        neg_all += x[d] * neg_pow2[i];
        neg_all %= negc;
        pos_all += x[d] * pos_pow2[i];
        pos_all %= posc;
    }
    for (int i = 0; i < n; i++) {
        if (x[i] == 1 && popcount == 1) {
            printf("0\n");
        } else if (x[i] == 1) {
            LL num = neg_all - neg_pow2[n - 1 - i];
            num += negc;
            num %= negc;
            printf("%d\n", 1 + f(num));
        } else {
            LL num = pos_all + pos_pow2[n - 1 - i];
            num += posc;
            num %= posc;
            printf("%d\n", 1 + f(num));
        }
    }
}


Measured memory_bytes: 7924
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

ll d;
vector<vl> s;
vl c(26);
vector<set<ll>> st(26, {-1});
ll score;

void add(ll i, ll k) {  // i日目(0-index)、テストk（0-index）
  st[k].insert(i);
  auto pi = st[k].lower_bound(i);
  pi--;
  ll prev, next;
  if(pi == st[k].begin())
    prev = -1;
  else
    prev = *pi;
  auto ni = st[k].upper_bound(i);
  if(ni == st[k].end())
    next = d;
  else
    next = *ni;
  score += c[k] * (i - prev) * (next - i) + s[i][k];
}

void rm(ll i, ll k) {
  auto pi = st[k].lower_bound(i);
  pi--;
  ll prev, next;
  if(pi == st[k].begin())
    prev = -1;
  else
    prev = *pi;
  auto ni = st[k].upper_bound(i);
  if(ni == st[k].end())
    next = d;
  else
    next = *ni;
  score -= c[k] * (i - prev) * (next - i) + s[i][k];
  st[k].erase(i);
}

void eval(vl &t) {
  rep(i, d) {
    ll k = t[i];
    add(i, k);
  }
}

int main() {
  // 入力をもらう
  cin >> d;
  rep(i, 26) cin >> c[i];
  s.resize(d, vl(26));
  rep(i, d) rep(j, 26) cin >> s[i][j];

  //// 入力を作るデバッグ用
  // d = 365;
  // s.resize(d, vl(26));
  // rep(i, 26) c[i] = rand() % 101;
  // rep(i, d) rep(j, 26) s[i][j] = rand() % 20001;

  // 初期解をランダムに作って評価、scoreに反映
  score = -accumulate(all(c), 0LL) * d * (d + 1) / 2;
  vl t(d);
  rep(i, d) t[i] = rand() % 26;
  eval(t);

  double limit = double(clock()) / double(CLOCKS_PER_SEC) + 1.95;
  while(double(clock()) / double(CLOCKS_PER_SEC) < limit) {
    ll xd = rand() % d;
    ll xt = rand() % 26;
    ll old_score = score;
    ll old_test = t[xd];
    if(xt == t[xd]) xt = (xt + 1) % 26;
    rm(xd, t[xd]);
    add(xd, xt);
    if(score < old_score) {
      rm(xd, xt);
      add(xd, old_test);
    } else
      t[xd] = xt;
  }
  rep(i, d) cout << t[i] + 1 << '\n';
}

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

int main(){
    int n, m, l;
    cin >> n >> m >> l;

    int A[101][101] = {};
    int B[101][101] = {};

    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            cin >> A[i][j];
        }
    }

    for (int i = 1; i <= m; i++){
        for (int j = 1; j <= l; j++){
            cin >> B[i][j];
        }
    }

    long long C[101][101] = {};

    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= l; j++){
            for (int k = 1; k <= m; k++){
                C[i][j] += A[i][k] * B[k][j];
            }
        }
    }

    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= l; j++){
            if (j == 1)cout << C[i][j];
            else cout << " " << C[i][j];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 3248
#include <stdio.h>
int n,A[2000];
int solve(int i,int m){
  int res;
  if(m==0) return 1;
  if(i>=n) return 0;
  res=solve(i+1,m) || solve(i+1,m-A[i]);
  return res;
}

int main(){
  int i,q,B[2000];
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&B[i]);
  }
  for(i=0;i<q;i++){
    if(solve(0,B[i])==1) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

Measured memory_bytes: 588
n=int(input())
dp=[0]*n
h=list(map(int,input().split()))
for i in range(1,n):
  if i-2>=0:
     dp[i]=min(dp[i-1]+max(h[i]-h[i-1],h[i-1]-h[i]),dp[i-2]+max(h[i]-h[i-2],h[i-2]-h[i]))
  else:
    dp[i]=dp[i-1]+max(h[i]-h[i-1],h[i-1]-h[i])
print(dp[n-1])    
  

Measured memory_bytes: 14748
#include <stdio.h>

int main(void)

{

  int a,b,c;

  scanf("%d %d %d", &a, &b, &c);

  if( a < b && b < c )

    {

      printf("Yes\n");

    }

  else 

    {

      printf("No\n");

    }

  return 0;

}

Measured memory_bytes: 580
#include<set>
#include<cstdio>

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

using namespace std;

typedef long long ll;

struct Ice{
	int i;
	ll t;
	bool operator<(const Ice &I)const{ return t!=I.t ? t<I.t : i<I.i; }
};

int main(){
	int n,l; scanf("%d%d",&n,&l);
	static int h[100000];
	rep(i,n) scanf("%d",h+i);

	set<Ice> top;
	rep(i,n) if((i==0 || h[i-1]<h[i]) && (i==n-1 || h[i]>h[i+1])) {
		top.insert((Ice){i,l-h[i]});
	}

	Ice I;
	while(!top.empty()){
		I=*top.begin(); top.erase(top.begin());
		h[I.i]=0;
		for(int j=I.i-1;j<=I.i+1;j+=2) if(0<=j && j<n) {
			if((j== 0  || h[j-1]<h[j])
			&& (j==n-1 || h[j]>h[j+1])) top.insert((Ice){j,I.t+l-h[j]});
		}
	}

	printf("%lld\n",I.t);

	return 0;
}

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

typedef long long ll;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    unordered_map<string,int> umap;
    umap["AC"]=0,umap["WA"]=0,umap["TLE"]=0,umap["RE"]=0;
    string s;
    for(int i=0; i<n; i++){
        cin >> s;
        umap[s]++;
    }

    cout<<"AC x "<<umap["AC"]<<'\n';
    cout<<"WA x "<<umap["WA"]<<'\n';
    cout<<"TLE x "<<umap["TLE"]<<'\n';
    cout<<"RE x "<<umap["RE"]<<'\n';
    return 0;
}


Measured memory_bytes: 3660
#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);
    }
    int count=0;
    for(int i=0; i<N; i=i+2)
    {
        if(A.at(i)%2==1)
        {
            count++;
        }
    }
    cout << count << endl;
}

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

int main(){
  int n, r, h, V[41], xl, xr;
  while(cin >> r >> n, r){
    for(int i = 0; i < 2*r+1; ++i) V[i] = 0;
    double ans = 20.0;
    for(int i = 0; i < n; ++i){
      cin >> xl >> xr >> h;
      for(int j = xl; j < xr; ++j){
	if(j < -r) continue;
	if(j > r) break;
	V[j+r] = max(h, V[j+r]);
      }
      if(xr == r) V[2*r] = max(V[2*r],h);
    }
    for(int i = 0; i < 2*r+1; ++i){
      ans = min(ans, V[i] + r - sqrt(r*r - (i-r)*(i-r)));
      if(i+1-r <= r) ans = min(ans, V[i] + r - sqrt(r*r - (i+1-r)*(i+1-r)));
      if(abs(i-1-r) <= r) ans = min(ans, V[i-1] + r - sqrt(r*r - (i-r)*(i-r)));
    }
    printf("%.4lf\n", ans);
  }			     
  return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> L(N);
  for (int i = 0; i < N; i++) {
    cin >> L.at(i);
  }
  sort(L.begin(), L.end());
  int ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      for (int k = j + 1; k < N; k++) {
        if (L.at(i) + L.at(j) > L.at(k)) {
          ans++;
        }
        else {
          break;
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
from collections import deque

n, m = map(int, input().split())
AB = [[int(x) for x in input().split()] for _ in range(m)]

# representation matrix
repn = [[] for j in range(n)]
for a, b in AB:
    a -= 1
    b -= 1
    repn[a].append(b)
    repn[b].append(a)


# Minimum Spanning Tree
tree = [set() for i in range(n)]
visited = [False] * n
visited[0] = True
q = deque([0])

while q:
    u = q.popleft()
    for v in repn[u]:
        if visited[v]:
            continue
        visited[v] = True
        tree[u].add(v)
        tree[v].add(u)
        q.append(v)


# define directions of the edges other than that of MST
degree = [0] * n
ans = []

for a, b in AB:
    a -= 1
    b -= 1
    if b in tree[a]:
        continue
    ans.append([a+1, b+1])
    degree[a] += 1


# defining orientations
def dfs(u = 0, parent = None):
    for v in tree[u]:
        if v == parent:
            continue
        dfs(v, u)
        if degree[v] % 2 == 0:
            ans.append([u+1, v+1])
            degree[u] += 1
        else:
            ans.append([v+1, u+1])
            degree[v] += 1

dfs()

if degree[0] % 2 == 1:
    print(-1)
else:
    for pair in ans:
        print(' '.join(map(str, pair)))


Measured memory_bytes: 166064
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
    int a, b;
    cin >> a >> b;

    cout << max({a+b, a-b, a*b});
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;
int main(){
  string str;
  string tmp;
  while(getline(cin, str) && str != "."){
    int p = 0, q = 0;
    bool flag = 1;
    tmp = "";
    
    for(int i = 0 ; i < str.size() ; i++){
      if(str[i] == '[' || str[i] == '(' || str[i] == ']' || str[i] == ')'){
	tmp += str[i];
      }
    }
    
    for(int i = 0 ; i < tmp.size() ; i++){
      if(tmp[i] == '(' && tmp[i+1] == ']') flag = 0;
      if(tmp[i] == '[' && tmp[i+1] == ')') flag = 0;
    }
    
    for(int i = 0 ; i < tmp.size() ; i++){
      //printf("p = %d, q = %d\n", p, q);
      if(p < 0 || q < 0){
	flag = 0;
	break;
      }
      if(tmp[i] == '(') p++;
      if(tmp[i] == '[') q++;
      if(tmp[i] == ')') p--;
      if(tmp[i] == ']') q--;
    }
    if(p != 0 || q != 0) flag = 0;

    
    stack<char> st;
    
    for(int i = 0 ; i < tmp.size() ; i++){
      if(tmp[i] == '(' || tmp[i] == '[') st.push(tmp[i]);
      else if(tmp[i] == ')'){
	if(st.empty() || st.top() != '('){ flag = 0; break;}
	else st.pop();
      }
      else if(tmp[i] == ']'){
	if(st.empty() || st.top() != '['){ flag = 0; break;}
	else st.pop();
      }
    }
    
    //cout << tmp << endl;
    //printf("p = %d, q = %d\n", p, q);*/
    if(flag) cout << "yes" << endl;
    else cout << "no" << endl;    
  }
  return 0;
}

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

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

	std::vector<int> a(n);
	std::vector<int> b(n);
	std::vector<int> c(n);

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

	std::vector<vector<int>> dp(3,vector<int>(n,0));
	dp[0][0] = a[0] ; dp[1][0] = b[0] ; dp[2][0] = c[0];
	for (int i = 1; i < n; ++i)
	{
		dp[0][i] = a[i] + max(dp[1][i-1],dp[2][i-1]);
		dp[1][i] = b[i] + max(dp[0][i-1],dp[2][i-1]);
		dp[2][i] = c[i] + max(dp[1][i-1],dp[0][i-1]);	
	}

	int ans = max({dp[0][n-1],dp[1][n-1],dp[2][n-1]});
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 2944
n,m,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

a1 = [0]
b1 = [0]

for i in range(n):
    a1.append(a1[-1]+a[i])

for i in range(m):
    b1.append(b1[-1]+b[i])

cnt = m
ans = 0

for i in range(n+1):
    while a1[i] + b1[cnt] > k:
        if cnt == 0:
            break
        cnt -= 1
    if a1[i] + b1[cnt] <= k:
        ans = max(i + cnt, ans)
    else:
        break

print(ans)


Measured memory_bytes: 134572
def solve(mid,g):
    for t,d in zip(z[::2],z[1::2]):
        if s[mid]==t:
            mid-=(d<'R')or-1
    return mid==g
n,q,s,*z=open(0).read().split()
n,q=int(n),int(q)
s=' %s '%s
ok=0
ng=n+1
while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if solve(mid,0):
        ok=mid
    else:
        ng=mid
a=ok
ok=n+1
ng=0
while abs(ok-ng)>1:
    mid=(ok+ng)//2
    if solve(mid,n+1):
        ok=mid
    else:
        ng=mid
print(max(0,ok-a-1))

Measured memory_bytes: 11412
import std.stdio;
import std.array;
import std.conv;

void main(){
	int n, id;
	ulong value, amount;
	while (1) {
		readf("%d\n", &n);
		if(n == 0) break;
		bool na = true;
		ulong[int] sales;
		int[] printOrder;
		for (int i = 0; i < n; i++) {
			readf("%d %s %s\n", &id, &value, &amount);
			if(id in sales) {
				sales[id] += value * amount;
			}else {
				printOrder ~= id;
				sales[id] = value * amount;
			}
		}
		foreach (i; printOrder) {
			if (sales[i] >= 1000000) {
				na = false;
				writeln(i);
			}
		}
		if(na) writeln("NA");
	}
}

Measured memory_bytes: 1112
/************************************************
*Author        :  lrj124
*Created Time  :  2019.08.18.20:19
*Mail          :  1584634848@qq.com
*Problem       :  d
************************************************/
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 10;
vector<int> edge[maxn];
int n,q,val[maxn];
inline void dfs(int now,int fa) {
	val[now] += val[fa];
	for (size_t i = 0;i < edge[now].size();i++)
		if (edge[now][i] ^ fa) dfs(edge[now][i],now);
}
int main() {
	scanf("%d%d",&n,&q);
	for (int i = 1,u,v;i < n;i++) {
		scanf("%d%d",&u,&v);
		edge[u].push_back(v);
		edge[v].push_back(u);
	}
	for (int x,y;q--;) {
		scanf("%d%d",&x,&y);
		val[x] += y;
	}
	dfs(1,0);
	printf("%d",val[1]);
	for (int i = 2;i <= n;i++) printf(" %d",val[i]);
	return 0;
}

Measured memory_bytes: 21760
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string> //文字列
#include <iomanip> //doubleの桁数指定
#include <list> //前後に数値を入れれる配列



#define REP(i,m,n) for(int i = (int) (m);i < (int) (n);i++) //forの短縮
#define rep(i,n) REP(i,0,n) //REPが0の時
#define ll long long int

using namespace std;

double PI = 3.141592653589793; //円周率

//常設関数↓

//最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

//最小公倍数
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

//degree → radian
ll chg_DegRad(int deg) {
	return deg * PI / 180.0;
}

//radian → degree
ll chg_RadDeg(int rad) {
	return rad * 180.0 / PI;
}

//提出コード↓

ll A, B, M;
ll a[100010], b[100010], c[100010], x[100010], y[100010];
ll ans = 1000000;
ll m;


int main() {
	cin >> A >> B >> M;
	REP(i, 1, A + 1) cin >> a[i];
	REP(i, 1, B + 1) cin >> b[i];
	REP(i, 1, M + 1) cin >> x[i] >> y[i] >> c[i];

	REP(i, 1, M + 1) {
		m = a[x[i]] + b[y[i]] - c[i];
		if (m < ans) ans = m;
	}
	sort(a, a + (A + 1));
	sort(b, b + (B + 1));
	ans = min(ans, a[1] + b[1]);

	cout << ans << endl;






	return 0;
}



Measured memory_bytes: 4096
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int n;
  scanf("%d", &n);
  int a[101];
  rep(i, 0, n) scanf("%d", &a[i]);

  int ok = 1;
  rep(i, 0, n) {
    if (a[i] % 2 != 0) continue;
    if (a[i] % 3 == 0 || a[i] % 5 == 0) continue;
    ok = 0;
    break;
  }
  printf(ok ? "APPROVED" : "DENIED");
  return 0;
}


Measured memory_bytes: 128
n = int(input())
h = list(map(int, input().split()))

counter =0
answer = 0
prev = h[0]
for i in range(1,n):
  if h[i] <= prev:
    counter += 1
  else:
    answer = max(answer, counter)
    counter = 0
  
  prev = h[i]
  
  if i == n-1:
    answer = max(answer, counter)


print(answer)

Measured memory_bytes: 14380
#include <stdio.h>
     
    int main(void)
    {
        int n, x, c, sum;
        c = 0;
        sum = 0;
        scanf("%d %d", &n, &x);
        int a[n];
        a[0] = 0;
        int i;
        for (i = 1; i <= n; i++)
        {
            scanf("%d", &a[i]);
        }
        int j;
        for (j = 0; j <= n; j++)
        {
            c = c + a[j];
            if (c <= x)
            {
                sum++;
            }
        }
        printf("%d\n", sum);
        return 0;
    }

Measured memory_bytes: 128
'use strict'

function main(input) {
  input = input.trim().split('\n')
  const N = Number(input[0])
  const nums = input[1].split(' ').map(v => parseInt(v, 10))
  let count = 0
  for (let i = 1; i < N - 1; i++) {
    if (
      (nums[i] < nums[i - 1] && nums[i] > nums[i + 1]) ||
      (nums[i] < nums[i + 1] && nums[i] > nums[i - 1])
    ) {
      count++
    }
  }
  console.log(count)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
/* March 28 2020 */

#include <vector>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
#include <cstdlib>

#define ll long long

int main(void) {
    ll n, x, y; scanf("%lld %lld %lld", &n, &x, &y);
    x--; y--;
    ll ans[n + 1]; memset(ans, 0, sizeof ans);
    for (ll i = 0; i < n; ++i) for (ll j = i + 1; j < n; ++j) {
        ll dist = j - i;
        dist = std::min(dist,(ll) ( abs(x - i) + abs(y - j) + 1));
        ans[dist]++;
    }
    for (ll i = 1; i < n; ++i) printf("%lld\n", ans[i]);
    return 0;
}



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

namespace AtCoder
{
    class Program
    {
        public static void Main()
        {
            var inputs = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int left = inputs[0] + inputs[1];
            int right = inputs[2] + inputs[3];
            Console.WriteLine(left == right ? "Balanced" : left > right ? "Left" : "Right");
        }
    }
}


Measured memory_bytes: 13396
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll f(ll n){
    if(n%2==0){
        ll pair_num = n/2;
        if(pair_num%2==0){
            return 0 ^ n;
        }else{
            return 1 ^ n;
        }
    }else{
        return n ^ f(n-1);
    }
}

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

    ll A, B;
    cin >> A >> B;

    if(A==0){
        p(f(B));
    }else{
        ll ans = f(A-1) ^ f(B);
        p(ans);
    }

    return 0;
}

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

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

	int b = 0;
	vector<int>v(n+1);
	for (int i = 0; i < n; i++) {
		cin >> v.at(i);
	}
	int i = 0;
	while ((b <= x)&&i<=n) {
		b += v.at(i);
		i++;
	}
	cout << i << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <utility>
#include <vector>
#include <algorithm>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
//_sc(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
//_vo(string &s){for(char c:s)pcu(c);}
//_vo(string s){for(char c:s)pcu(c);}
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
//_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	auto read = [](int n) {
		vector<int> v;
		while (n--)
			v.push_back(in());
		return move(v);
	};
	vector<int> a = read(in()), b = read(in()), r;
	set_difference(a.begin(), a.end(), b.begin(), b.end(), inserter(r, r.end()));
	for (int x: r)
		outl(x);
}


Measured memory_bytes: 5448
#include <bits/stdc++.h>
#define ll long long
#define PI 3.141592653589
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define EPS 1e-9
#define f first
#define s second
using namespace std;
int n, maxWeight;
pair<int,int> arr[105];
ll dp[2][100005];
int main(){
    IO;
    cin >> n >> maxWeight;
    //memset(memo, -1, sizeof memo);
    for(int i = 1; i <= n; ++i)
        cin >> arr[i].f >> arr[i].s;
    int itr = 0;
    for(int i = 0; i <= n; ++i){
        itr = !itr;
        for(int j = 1; j<= maxWeight; ++j){
            if(i==0 || j==0)
                dp[itr][j]=0;
            else if(arr[i].f <= j)
                dp[itr][j] = max(arr[i].s+dp[itr^1][j-arr[i].f], dp[itr^1][j]);
            else
                dp[itr][j] = dp[itr^1][j];
        }
    }
    cout << dp[itr][maxWeight];
    return 0;
}


Measured memory_bytes: 1792
import java.io.*;
 
public class Main
{
    public static void main(String[] args) throws IOException
    {
        String s;
        int a;
        int b;
        BufferedReader buf = new BufferedReader (new InputStreamReader(System.in));
        s=buf.readLine();
        a=Integer.parseInt(s);
        b=a*a*a;
        System.out.println(b);
    }
}

Measured memory_bytes: 16864
#include <iostream>
#include <algorithm>
#include <vector>
#include <climits>

using namespace std;

static const int MAX = 100;
static const long long INFTY = (1LL << 32);

int n;
long long d[MAX][MAX];

void floyd()
{
	for (int k = 0; k < n; ++k)
	{
		for (int i = 0; i < n; ++i)
		{
			if (d[i][k] == INFTY) continue;
			for (int j = 0; j < n; ++j)
			{
				if (d[k][j] == INFTY) continue;
				d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
			}
		}
	}
}

int main()
{
	int e, u, v, c;
	cin >> n >> e;

	for (int i = 0; i < n; ++i)
	{
		for (int j = 0; j < n; ++j)
		{
			d[i][j] = ((i == j) ? 0 : INFTY);
		}
	}

	for (int i = 0; i < e; ++i)
	{
		cin >> u >> v >> c;
		d[u][v] = c;
	}

	floyd();
	bool negitive = false;
	for (int i = 0; i < n; ++i)
	{
		if (d[i][i] < 0) negitive = true;
	}

	if (negitive)
	{
		cout << "NEGATIVE CYCLE" << endl;
	}
	else
	{
		for (int i = 0; i < n; ++i)
		{
			for (int j = 0; j < n; ++j)
			{
				if (j) cout << " ";
				if (d[i][j] == INFTY) cout << "INF";
				else cout << d[i][j];
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 3192