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


int main() {
    string s;

    cin >> s;

    int length = 0;
    string output = "";
    for(int i = 0; i < s.size(); i++){
        if(s.at(i) == 'B'){
            if(length != 0){
                output.erase(length-1);
                length--;
            }
        }
        else{
            output = output + s.at(i);
            length++;
        }
    }
    cout << output << endl;

    return 0;
}

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

signed main(){
  int x,y,a,b,c;
  cin >> x >> y >> a >> b >> c;
  vector<int> ans(a + b + c);
  for(int &x:ans) cin >> x;
  sort(ans.begin(),ans.begin()+a);
  sort(ans.begin()+a,ans.end()-c);
  sort(ans.end()-c,ans.end());
  for(int i = 0;i < a-x;i++) ans[i] = 0;
  for(int i = a;i < a+b-y;i++) ans[i] = 0;
  sort(ans.rbegin(),ans.rend());
  cout << accumulate(ans.begin(),ans.begin()+x+y,0LL) << endl;
}

Measured memory_bytes: 1536
#include <stack>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <iomanip>
#include <string>
#include <limits>
using namespace std;
int gcd(int a, int b)//最大公約数
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int mod = 1000000000 + 7;
vector<int> v;
class Calc
{
    // 宣言
    long long a;

    public:
        // 素因数分解
        void decompositPrime(long long a);
};

/*
 * 素因数分解
 */
void Calc::decompositPrime(long long n)
{
    // 割る数の初期値
    a = 2;
    // √n ≧ a ( n ≧ a * a ) の間ループ処理
    while (n >= a * a) {
        // a で割り切れたら、a は素因数
        // そして、割られる数を a で割る
        // a で割り切れなかったら、 a を 1 増加させる
        if (n % a == 0) {
            //printf("%d * ", a);
             v.push_back(a);
            n /= a;
        } else {
            a++;
        }
    }
    // 最後に残った n は素因数
    v.push_back(n);
    //printf("%d\n", n);
}
vector<int> divisor(int n) {//約数発見
    vector<int> ret;
    for (int i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    std::sort(ret.begin(), ret.end());
    return ret;
}
long nc2(long n){
    return n*(n-1)/2;
}
template<typename TypeInt>
std::string Itoa(const TypeInt v, int base)
{
	static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	string ret;
	static numeric_limits<TypeInt> t;
	TypeInt n = v;
	if (t.is_signed) {
		if (v < 0) n *= -1;
	}

	while (n >= base) {
		ret += table[n%base];
		n /= base;
	}
	ret += table[n];
	if (t.is_signed) {
		if (v < 0 && base == 10) ret += '-';
	}
	// 文字列の順番を逆にする
	std::reverse(ret.begin(), ret.end());

	return ret;
}

int main(){
    //std::stack<int> stack;
    int n;
    cin >> n;
    int ans = n;
    while(ans > 1000){
        ans -= 1000;
    }
    cout << 1000-ans << endl;
    return 0;
}






Measured memory_bytes: 3596
#include <iostream>
#include <string>
using namespace std;
int main(){
    int n=1,c[999];
    int a,b,i,d=0;
    for (i =0; i<999; i++){
        d = d+n;
        c[i] = d;
        n++;

    }
    cin >> a >> b;
    for (i =0; i<999; i++){
        if(c[i+1]-c[i] == b-a){
            break;
        }
    }

    cout << (c[i+1]+c[i]-a-b)/2;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)

using namespace std;
using ll = long long;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<ll> A(N);
  rep(i, N) cin >> A[i], A[i] *= 2;
  // A[0] = X[0] + X[1]
  // A[1] = X[1] + X[2]
  // A[2] = X[2] + X[3]
  // ...
  // X[i] = a + b*X[0]
  // A[i] = X[i] + X[i + 1]
  // X[i + 1] = A[i] - X[i]
  // X[i + 1] = A[i] - a - b * X[0]
  ll a = 0;
  ll b = 1;
  for (int i = 0; i < N; i++) {
    a = A[i] - a;
    b = -b;
  }
  // a + b * X[0] = X[0]
  // X[0] = a / (1 - b)
  ll f = a / (1 - b);
  for (int i = 0; i < N; i++) {
    cout << f << ' ';
    f = A[i] - f;
  }
  cout << endl;
}

Measured memory_bytes: 2176
#!/usr/bin/env python3
import sys
from itertools import accumulate
INF = float("inf")


def solve(N: int, S: str):
    ss = [1 if c == "E" else 0 for c in S]
    ss = list(accumulate(ss))

    mi, m = -1, INF
    for i in range(N):
        b = 0
        if i - 1 >= 0:
            b += i - ss[i-1]
        if i+1 <= N-1:
            b += ss[N-1]-ss[i]
        # print(i, b)
        if b < m:
            m = b
            mi = i
    print(m)
    # print(mi)

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)


if __name__ == '__main__':
    main()


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

#define fi first
#define se second
#define U unsigned
#define P std::pair<int,int>
#define LL long long
#define pb push_back
#define MP std::make_pair
#define all(x) x.begin(),x.end()
#define CLR(i,a) memset(i,a,sizeof(i))
#define FOR(i,a,b) for(int i = a;i <= b;++i)
#define ROF(i,a,b) for(int i = a;i >= b;--i)
#define DEBUG(x) std::cerr << #x << '=' << x << std::endl

const int MAXN = 2000+5;

struct Edge{
    int to,nxt;
}e[MAXN<<1];
int head[MAXN],cnt;

inline void add(int u,int v){
    e[++cnt] = (Edge){v,head[u]};head[u] = cnt;
    e[++cnt] = (Edge){u,head[v]};head[v] = cnt;
}

int n;
char S[MAXN];
int sm[MAXN],num[MAXN],mx[MAXN];
int f[MAXN];

inline void dfs1(int v,int fa=0){
    num[v] = S[v]=='1';mx[v] = 0;sm[v] = 0;
    for(int i = head[v];i;i = e[i].nxt){
        if(e[i].to == fa) continue;
        dfs1(e[i].to,v);
        sm[v] += sm[e[i].to]+num[e[i].to];
        num[v] += num[e[i].to];
        if(sm[mx[v]]+num[mx[v]] < sm[e[i].to]+num[e[i].to]) mx[v] = e[i].to;
    }
}

inline void dfs2(int v,int fa=0){
    f[v] = 0;
    for(int i = head[v];i;i = e[i].nxt){
        if(e[i].to == fa) continue;
        dfs2(e[i].to,v);
    }
    int mx = sm[::mx[v]]+num[::mx[v]];
    if(2*mx <= sm[v]) f[v] = sm[v]/2;
    else{
        int k = std::max(0,std::min(f[::mx[v]],(2*mx-sm[v])/2));
        f[v] = sm[v]-mx+k;
    }
}
/*
 * if 2*mx <= sm then f[v]=sm/2
 * else f[v]=sm-mx+k
 * 0 <= k <= f[u],k <= (2*mx-sm)/2
 */
int ans = 1e9;
inline void work(int rt){
    dfs1(rt);dfs2(rt);
    if(f[rt] == sm[rt]/2 && !(sm[rt]&1)) ans = std::min(ans,sm[rt]/2);
}

int main(){
    scanf("%d%s",&n,S+1);
    FOR(i,2,n){
        int u,v;scanf("%d%d",&u,&v);
        add(u,v);
    }
    work(2);
    FOR(i,1,n) work(i);
    printf("%d\n",ans==1e9 ? -1 : ans);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define MOD 998244353 
#define ff first
#define ss second
typedef long long ll;
ll power(ll a, ll b){//a^b
    ll res=1;
    a=a%MOD;
    while(b>0){
        if(b&1){res=(res*a)%MOD;b--;}
        a=(a*a)%MOD;
        b>>=1;
    }
    return res;
}
ll fermat_inv(ll y){return power(y,MOD-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
int n;
ll a[3000];
ll cost[3000][3000];
ll solve(ll i,ll j){
    if(cost[i][j]!=1e15)
        return cost[i][j];
    else{
        if((n-(j-i))%2==1)
            cost[i][j]=max(a[i]+solve(i+1,j),a[j]+solve(i,j-1));
        else
            cost[i][j]=min(solve(i+1,j)-a[i],solve(i,j-1)-a[j]);
        return cost[i][j];
    }
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--){
        cin>>n;
        int ctr=1;
        if(n%2==0)
            ctr=-1;
        for(int i=0;i<n;i++)
            cin>>a[i];
        for(ll i=0;i<n;i++){
            cost[i][i]=ctr*a[i];
            for(ll j=i+1;j<n;j++)
                cost[i][j]=1e15;
        }
        cout<<solve(0ll,n-1)<<"\n";
    }
    return 0;
}

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

int main() {
    int s,t;
    cin>>s>>t;
    if (s>t){
        cout<<"a > b"<<endl;
    } else if (s<t){
        cout<<"a < b"<<endl;
    } else {
        cout<<"a == b"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3064
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include<bits/stdc++.h>
using namespace std;
#define inf 1000000007
int arr[100007],dp[100007],n;
int frog(int i){
   if(i<=0)return 0;
   if(dp[i]!=inf)return dp[i];
   int p=inf,q=inf;
   if(i > 0)p=abs(arr[i]-arr[i-1])+frog(i-1);
   if(i > 1)q=abs(arr[i]-arr[i-2])+frog(i-2);

   dp[i]=min(dp[i], min(p,q));
   //cout<<p<<" "<<q<<endl;
   return dp[i];
}
int main(){
cin>>n;
for(int i=0;i<n;i++)cin>>arr[i];
//memset(dp, INF,sizeof(dp));
for(int i = 0; i < n; i++)dp[i] = inf;
cout<<frog(n-1)<<endl;

return 0;
}


Measured memory_bytes: 4096
#define _USE_MATH_DEFINES
  #include <set>
  #include <array>
  #include <map>
  #include <unordered_map>
  #include <unordered_set>
  #include <stack>
  #include <queue>
  #include <vector>
  #include <tuple>
  #include <string>
  #include <math.h>
  #include <time.h>
  #include <bitset>
  #include <stdio.h>
  #include <string.h>
  #include <iostream>
  #include <algorithm>
  #include <limits>
  #include <climits>
  #include <numeric>
  #include <functional>
  #include <iomanip>
  #include <cmath>

  #define lnd '\n'
  // #define reverse(i, n) for(ll i = n-1; i >= 0; --i)
  #define from(i, n) for (ll i = 0; i < n; ++i)
  #define loop(i, n) for(ll i = 0; i < n; i++)
  #define REPN(i, n) for (ll i = 1; i <= n; ++i)
  #define ALL(s) (s).begin(), (s).end()
  #define rALL(s) (s).rbegin(), (s).rend()
  #define sz(s) (int)(s).size()
  #define mk make_pair
  #define pb push_back
  #define sqr(s) ((s) * (s))

  using namespace std;

  typedef long long ll;
  typedef long long int lli;
  typedef long double ld;
  typedef unsigned long long ull;
  typedef unsigned int ui;

  template <class T>
  T GCD (T a, T b) {
    if(a == 0) return b;
    return GCD(b%a, a);
  }

  template <class T>
  T LCM(T a, T b){
    return a*b/GCM(a,b);
  }

  template <class T>
  T modpow(T x, T p){
      T res = 1;
      while(p > 0){
          if(p&1) res *= x;
          x *= x;
          p /= 2;
      }
      return res;
  }

  template <class T>
  T modpow(T x, T p, ll mod){
      T res = 1;
      while(p > 0){
          if(p&1) res = (res*x)%mod;
          x = (x*x)%mod;
          p /= 2;
      }
      return res%mod;
  }

  template <class T>
  void print(T a[], ll n){
      for (ll i = 0; i < n; i++) std::cout << a[i] << ' ';
      cout << endl;
  }

  template<class T>
  void printc(T c){
      for(auto const& v: c) std::cout << v << ' ';
      cout << endl;
  }

  struct HASH{
    size_t operator()(const pair<long,long>&x)const{
      return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
    }
  };

  bool pair_sort(const pair<int, int> &p1, const pair<int,int> &p2){
      if(p1.first != p2.first) return p1.first < p2.first;
      else return p1.second < p2.second;
  }

  const int INF = std::numeric_limits<int>::max();
  const ll M_INF = std::numeric_limits<ll>::min();
  const ll LL_INF = std::numeric_limits<ll>::max();

  void solution();
  int main(){
      ios_base::sync_with_stdio(0);
      cin.tie(0);
      cout.tie(0);
      solution();
      return 0;
  }

  void solution(){
    ll n;
    cin >> n;

    ll m = 1e6+1;
    vector<ll> b(m, 0);
    vector<ll> a(n);
    loop(i, n){
      cin >> a[i];
      b[a[i]] = 1;
    }

    for(auto i: a){
      if(b[i] >= 2){
        b[i]++;
        continue;
      }
      for(ll j = i; j < m; j += i){
        b[j]++;
      }
    }

    ll count = 0;
    for(ll i = 0; i < n; i++){
      if(b[a[i]] == 2){
        count++;
      }
    }

    cout << count << endl;
  }    





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

using namespace std;
#define ll long long
#define ld long double
#define PI 3.141592653L
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll INF = (ll)1e18;
const int N = 2e5 + 5;
const ll MOD = 998244353;

int parent[N];

int gcd(int a, int b) { 
    if (a == 0) 
        return b;  
    return gcd(b%a, a);  
} 
   
int lcm(int a, int b) {  
    return (a*b)/gcd(a,b);  
} 

ll pow(ll x, ll y, ll p) {
    if(y == 0) return 1;
    ll res = 1;
    x %= p;
    if(x == 0) return 0LL;
    while(y > 0) {
        if(y & 1) res = (res*x) % p;
        y >>= 1;
        x = (x*x) % p;
    }
    return res;
}

int find(int x) {
    return x == parent[x] ? x : parent[x] = find(parent[x]);
}

void Union(int x, int y) {
    int xPar = find(x), yPar = find(y);
    if(xPar != yPar) parent[xPar] = yPar;
}

int main()
{
    IOS
    int n;
    cin >> n;
    ll mx = 0;
    vector<ll> a(n);
    for(int i=0;i<n;i++) {
        cin >> a[i];
        mx = max(mx, a[i]);
    }
    vector<int> cnt(mx+1);
    for(auto val : a) {
        if(cnt[val]) {
            cnt[val] = 2;
            continue;
        }
        for(int j=val;j<=mx;j+=val) cnt[j]++;
    }
    int res = 0;
    for(auto val : a) if(cnt[val] == 1) res++;
    cout << res << endl;
    return 0; 
}



Measured memory_bytes: 8680
N, x = map(int, raw_input().split())
a = map(int, raw_input().split())
ans = 0
for i in range(N-1):
    total = a[i] + a[i+1]
    if total > x:
        ans += total - x
        a[i+1] = max(a[i+1] - total + x, 0)
print ans

Measured memory_bytes: 11340
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<pint> vpint;
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)

int x[55];
ll dp[55][55][2550];

int main(void){
	int n, a; cin >> n >> a;
	rep(i, n){
		cin >> x[i]; 
	}

	rep(i, 55)rep(j, 55)rep(k, 2550) dp[i][j][k] = 0;
	dp[0][1][x[0]] = 1; dp[0][0][0] = 1;
	for (int i = 0; i < n - 1; ++i){
		for (int j = 0; j <= n; ++j){
			for (int k = 0; k <= 2500; ++k){
				if(dp[i][j][k] == 0) continue;
				//i + 1番目を選ぶ
				dp[i + 1][j + 1][k + x[i + 1]] += dp[i][j][k];
				//i + 1選ばない
				dp[i + 1][j][k] += dp[i][j][k];
			}
		}
	}

	ll ans = 0;
	for (int j = 1; j <= n; ++j){
		int aim = j * a;
		if(aim <= 2500 && dp[n - 1][j][aim] != 0){
			ans += dp[n - 1][j][aim];
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 60544
import numpy as np
H,W = map(int,input().split())
L = np.zeros((H,W),int)
R = np.zeros((H,W),int)
D = np.zeros((H,W),int)
U = np.zeros((H,W),int)
S = np.array([list(input()) for h in range(H)])=="."

for h in range(H):
  U[h] = S[h]*(U[h-1]+1)
  D[-h-1] = S[-h-1]*(D[-h]+1)

for w in range(W):
  L[:,w] = S[:,w]*(L[:,w-1]+1)
  R[:,-w-1] = S[:,-w-1]*(R[:,-w]+1)

print(np.max(U+D+L+R)-3)

Measured memory_bytes: 192048
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
const ll mod = 1e9 + 7;

bool calc(ll n, ll b, ll c, ll d) {
  REP(i, 0, n + 1) {
    // i positive, (n - i) negative
    ll hi = i * d - (n - i) * c;
    ll lo = i * c - (n - i) * d;
    if (lo <= b && b <= hi) {
      return true;
    }
  }
  return false;
}

int main(void){
  int n;
  ll a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  cout << (calc(n - 1, b - a, c, d) ? "YES" : "NO") << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main {

	int[][] a;
	int k;

	int[] make(int l, int r, int mod) {
		if (l <= r) {
			return new int[] { l, r };
		} else {
			return new int[] { l, mod - 1, 0, r };
		}
	}

	void add(int x1, int x2, int y1, int y2) {
//		System.err.println(x1 + " " + x2 + " " + y1 + " " + y2);
		x1 %= 2 * k;
		x2 %= 2 * k;
		y1 %= 2 * k;
		y2 %= 2 * k;

		int[] xs = make(x1, x2, 2 * k);
		int[] ys = make(y1, y2, 2 * k);

		for (int i = 0; i < xs.length; i += 2) {
			for (int j = 0; j < ys.length; j += 2) {
				int xl = xs[i];
				int xr = xs[i + 1] + 1;
				int yl = ys[j];
				int yr = ys[j + 1] + 1;
				
				a[xl][yl]++;
				a[xl][yr]--;
				a[xr][yl]--;
				a[xr][yr]++;
			}
		}
	}

	void submit() {
		int n = nextInt();
		k = nextInt();
		int[] xs = new int[n];
		int[] ys = new int[n];
		char[] cs = new char[n];

		a = new int[2 * k + 1][2 * k + 1];

		for (int i = 0; i < n; i++) {
			int x = nextInt();
			int y = nextInt();
			char c = nextToken().charAt(0);

			if (c == 'W') {
				x += k;
			}
			
//			System.err.println(x + " " + y);

			// (x, y) is black

			add(x + 1, x + k, y + 1, y + k);
			add(x + k + 1, x + 2 * k, y + k + 1, y + 2 * k);
		}
		
//		for (int[] row : a) {
//			System.err.println(Arrays.toString(row));
//		}
		
		int ans = 0;
		
		for (int i = 0; i < 2 * k; i++) {
			for (int j = 0; j < 2 * k; j++) {
				if (i > 0) {
					a[i][j] += a[i - 1][j];
				}
				if (j > 0) {
					a[i][j] += a[i][j - 1];
				}
				if (i > 0 && j > 0) {
					a[i][j] -= a[i - 1][j - 1];
				}
				ans = Math.max(ans, a[i][j]);
			}
//			System.err.println(Arrays.toString(a[i]));
		}
		
		out.println(ans);
	}

	void preCalc() {

	}

	void stress() {

	}

	void test() {

	}

	Main() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		preCalc();
		submit();
		// stress();
		// test();
		out.close();
	}

	static final Random rng = new Random();

	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}

	public static void main(String[] args) throws IOException {
		new Main();
	}

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	long nextLong() {
		return Long.parseLong(nextToken());
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}
}


Measured memory_bytes: 68616
import java.io.PrintWriter

// 入力取得
private fun read() = readLine()!!
private fun readInt() = read().toInt()
private fun readLong() = read().toLong()
private fun nextDouble() = read().toDouble()

//入力取得(list)
private fun listOfString() = read().split(" ") //スペース区切り
private fun listOfInt() =listOfString().map { it.toInt() }
private fun listOfLong() =listOfString().map { it.toLong() }
private fun listOfDouble() =listOfString().map { it.toDouble() }

//二次元配列y生成
private fun arrayIntInit(n:Int) = Array(n, {Array(n, {it -> 0})}) //0で初期化した, n × nの二次元配列

//PrintWriter(出力用)
val pw = PrintWriter(System.out)

fun main(args: Array<String>) {
    calc()
}

fun calc(){
    val a = readInt()
    println(a + a * a + a * a * a)
    pw.flush()
}

fun println(value : Any) {
    pw.println(value)
}

fun print(value : Any) {
    pw.print(value)
}


Measured memory_bytes: 34596
N, A, B, C, D = map(int, input().split())
lb, ub = A, A
for _ in range(1, N):
    if (lb + ub) / 2 < B:
        lb, ub = lb + C, ub + D
    else:
        lb, ub = lb - D, ub - C
if lb <= B <= ub:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3060
N,M = map(int, input().split())
A = [int(input()) for _ in range(M)]

mod = 10**9 + 7

dp = [1] * (N+1)

for i in A:
    dp[i] = 0

for i in range(2, N+1):
        dp[i] *= (dp[i-1] + dp[i-2]) % mod

print(dp[-1])

Measured memory_bytes: 13572
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define cerr if(false) cerr
#define show(...) cerr << #__VA_ARGS__ << " = ",debug(__VA_ARGS__);
using namespace std;
#define int long long
using ll = long long;
using pii = pair<int,int>;
template<typename T, typename S>
ostream &operator<<(ostream &os,pair<T,S>a){
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os, vector<T> v){
    for(auto x:v)os << x << ' ';
    return os;
}
void debug(){cerr << '\n';}
template<typename H, typename... T>
void debug(H a, T... b){
    cerr << a;
    if(sizeof...(b))cerr << ", ";
    debug(b...);
}
class UnionFind {
private:
    int sz;
    vector<int> par, size_;
public:
    UnionFind(){}
    UnionFind(int node_size) : sz(node_size), par(sz), size_(sz, 1){
        iota(par.begin(), par.end(), 0);
    }
    int find(int x){
        if(par[x] == x) return x;
        else return par[x] = find(par[x]);
    }
    void unite(int x,int y){
        x = find(x), y = find(y);
        if(x == y) return;
        if(size_[x] < size_[y]) swap(x,y);
        par[y] = x;
        size_[x] += size_[y];
    }
    int size(int x){
        x = find(x);
        return size_[x];
    }
    bool same(int x,int y){
        return find(x) == find(y);
    }
};
signed main(){
    int n,m;
    cin >> n >> m;
    vector<ll>ans(m);
    vector<pii>e;
    UnionFind uf(n);
    rep(i,m){
        int c,d;
        cin >> c >> d;
        c--,d--;
        e.emplace_back(c,d);
    }
    reverse(e.begin(), e.end());
    ll t = n*(n-1)/2;
    rep(i,m){
        ans[i] = t;
        show(t);
        if(uf.same(e[i].first,e[i].second))continue;
        else{
            ll k = uf.size(e[i].first);
            ll kk = uf.size(e[i].second);
            uf.unite(e[i].first,e[i].second);
            t -= k*kk;
        }
    }
    assert(t==0);
    reverse(ans.begin(),ans.end());
    rep(i,m)cout << ans[i] << "\n";
}


Measured memory_bytes: 5360
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;
#define REP(i,n) for(int i = 0; i < (int)(n); i++)

int main() {
  int N; cin>>N;
  double sum = 0.0;
  REP(i,N) {
    double a; cin>>a;
    sum += 1.0 / a;
  }
  printf("%0.8f", 1.0 / sum);
  puts("");
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val a, b, c = sc.nextInt()

    val ar = Array(a, b, c).sorted.reverse

    val ans =
      if (ar.max == ar.drop(1).sum) "Yes" else "No"

    println(ans)
  }
  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }
}


Measured memory_bytes: 25900
<?php


$n = fgets(STDIN);

$ans = array_fill(1,$n,0);

for($x=1;$x<100;$x++) {
	for($y=1;$y<100;$y++) {
      for($z=1;$z<100;$z++) {
        $tmp = $x**2 + $y**2 + $z**2 + $x*$y + $y*$z + $z*$x;
        if ($tmp <= $n) {
           $ans[$tmp]++;
        }
      }
    }
}

echo implode(PHP_EOL,$ans);



Measured memory_bytes: 16268
p,M=pow,1000003
f=[1]*M
for i in range(1,M):f[i]=f[i-1]*i%M
for _ in'_'*input():x,d,n=map(int,raw_input().split());t=x*p(d,M-2,M)%M;print[p(x,n,M),M/(t+n)*t and f[t+n-1]*p(f[t-1],M-2,M)*p(d,n,M)%M][d>0]

Measured memory_bytes: 43112
D = int(input().strip())
c = list(map(int, input().strip().split()))
s = [list(map(int, input().split())) for _ in range(D)]

last=[0]*26 # contents(last day): 1 ind

for d in range(1,D+1): # 1 ind
    max_=-float("inf")
    for contest in range(26): # 0ind
        score=s[d-1][contest]
        last[contest-1], tmp = d, last[contest-1]
        for i in range(26):
            score-=c[i]*(d-last[i])
        last[contest-1] = tmp
        if score>max_:
            nextContest=contest
            max_=score
    last[nextContest]=d
    print(nextContest+1)

Measured memory_bytes: 9400
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    A, B, N = map(int, input().split())

    ans = -1
    for x in [N, B * (N // B) - 1]:
        if x >= 0:
            ans = max(ans, A * x // B - A * (x // B))
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 9180
#include <stdio.h>

int main(void)
{
	int S, h, m, s;

	S = 0;

	scanf("%d", &S);
	if ((S >= 0) && (S <= 86400))
	{
		h = S /3600;
		m = (S - (h * 3600)) / 60;
		s = (S - (h * 3600) - (m * 60));

	}

	printf("%d:%d:%d\n", h, m, s);

	return 0;

}


Measured memory_bytes: 2760
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int,int>;


const long long INFLL = 1LL << 60;
const int INFI = 1000000000;


int main(){
    string s,t; cin >> s >> t;
    int len = max(s.size(), t.size());
    vector<int> S(int(s.size()),0);
    vector<int> T(int(t.size()),0);
    for(int i=0;i<len;i++){
        if(i<s.size()) S[i] = s[i]-'a'+1;
        if(i<t.size()) T[i] = t[i]-'a'+1;
    }
    sort(S.begin(), S.end());
    sort(T.begin(), T.end());
    reverse(T.begin(), T.end());

    for(int i=0;i<len;i++){
        if(i>=s.size()){
            if(i<t.size()) {cout << "Yes" << endl; break;}
            else {cout << "No" << endl; break;}
        } else if (i>=t.size()){
            cout << "No" << endl;
        }else{
            if(S[i] == T[i]) {
                if(i==len-1) cout << "No"<< endl;
                continue;
            }
            if(S[i] > T[i]) {cout << "No" << endl; break;}
            if(S[i] < T[i]) {cout << "Yes" << endl;break;}
        }
    }

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define sec second
#define fir first
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
typedef vector<int> Vec;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};



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

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


Measured memory_bytes: 3348
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int a,b,sum=0;
  cin>>a>>b;
  if(b==1){
    cout<<0<<'\n';
    return 0;
  }
  cout<<a-b<<'\n';
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
     
    public class Main {
      public static void main(String[] args) {
        Scanner sc = new Scanner(System.in); 
        String S = sc.next();
        boolean key = false;
        if (S.equals("AAA") || S.equals("BBB")) key = true;
        else ;
        System.out.println(key ? "No" : "Yes");
      }
    }

Measured memory_bytes: 21844
N = int(input())
A = list(map(int, input().split()))

ans = 0

"""
acum = A[0]
for i in range(1, N):
    if (acum >= 0 and acum + A[i] >= 0) or (acum < 0 and acum + A[i] < 0) or (acum + A[i] == 0):
        # same signs
        ans += abs(acum + A[i]) + 1
        acum = 1 if acum < 0 else -1

    else:
        # different signs
        acum += A[i]
"""
oans, eans = 0, 0
oacum, eacum = 0, 0
acum = 0

# 奇数番目が正
for i in range(0, N):
    oacum += A[i]
    eacum += A[i]

    if i & 1:
        # should be neg
        if oacum >= 0:
            oans += abs(oacum) + 1
            oacum = -1
        
        # should be pos
        if eacum <= 0:
            eans += abs(eacum) + 1
            eacum = 1

    else:
        # should be pos
        if oacum <= 0:
            oans += abs(oacum) + 1
            oacum = 1
        
        # should be neg
        if eacum >= 0:
            eans += abs(eacum) + 1
            eacum = -1

# print(oans, eans)
print(min(oans, eans))


Measured memory_bytes: 14464
#include <stdio.h>
#include <stdlib.h>

#define MAX 200

void initialize(void);
int isEmpty(void);
int isFull(void);
void push(int);
int pop(void);

int S[MAX];
int top = 0;


int main(int argc, char const *argv[]) {

  int num1,num2;
  char c[MAX];

  while( scanf("%s",c) != EOF ){

    if( c[0] == '+' ){
      num1 = pop();
      num2 = pop();
      push(num2+num1);
    }else if( c[0] ==  '-' ){
      num1 = pop();
      num2 = pop();
      push(num2-num1);
    }else if( c[0] == '*' ){
      num1 = pop();
      num2 = pop();
      push(num2*num1);
    }else{
      push(atoi(c));
    }

  }

  printf("%d\n",S[1]);

  return 0;
}

void initialize(void){
  top = 0;
}

int isEmpty(void){
  if( top == 0 )
    return 1;
  return 0;
}

int isFull(void){
  if( top >= MAX-1)
    return 1;
  return 0;
}

void push(int x){
  if( isFull() ){
    fprintf(stderr,"?????????????????????\n");
    exit(1);
  }

  top++;
  S[top] = x;
}

int pop(void){
  if( isEmpty() ){
    fprintf(stderr,"??¢??????????????????\n");
    exit(2);
  }

  top--;
  return S[top+1];
}

Measured memory_bytes: 548
// BEGINNING WITH NAME OF ALMIGHTY GOD ALLAH
// AUTHOR:: MOHAMMAD FAISAL
// ATCODER BEGINNERS PROBLEMS
//#include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.flush();
   	string s;
    cin >> s;
    if(s=="Sunny")
      cout<<"Cloudy";
    if(s=="Cloudy")
      cout<<"Rainy";
    if(s=="Rainy")
      cout<<"Sunny";
    return 0;
    // Bye Bye 2019
}



Measured memory_bytes: 256
using System;
using System.IO;
using System.Collections.Generic;
using System.Text;

namespace ABC134
{
    class Program3
    {
        static void Main()
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var N = int.Parse(Console.ReadLine());
            var max1 = 0;
            var index1 = 0;
            var max2 = 0;
            var index2 = 0;
            for (int i = 0; i < N; i++)
            {
                var num = int.Parse(Console.ReadLine());
                if (num > max1)
                {
                    max1 = num;
                    index1 = i;
                }
                else if (num == max1 || num > max2)
                {
                    max2 = num;
                    index2 = i;
                }
            }

            for (int i = 0; i < N; i++)
                Console.WriteLine(i != index1 ? max1 : max2);
            Console.Out.Flush();
        }
    }
}


Measured memory_bytes: 16584
#include <iostream>
    using namespace std;
     
    int main() {
    	int n;
    	cin >> n;
    	long int l0 = 2 , l1 = 1;
    	long int result = l1;
    	for(int i = 1;i < n;i++){
    		result = l0 + l1;
    		l0 = l1;
    		l1 = result;
    	}
    	cout << result << endl;
     	return 0;
    }

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

#define pb push_back
#define f1 first
#define s2 second

#define fastio ios :: sync_with_stdio(); cin.tie(0); cout.tie(0);
#define debug(x...) cerr << "[" << #x << "]: " << x << "\n";

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

int const N = 1e5 + 7;

int dp[N];
bool visited[N] = {};
vector<int> adj[N];

int solve(int node)
{
	if (dp[node] != -1)
		return dp[node];

	visited[node] = true;

	int res = 0;
	for (auto x : adj[node])
	{
		res = max(res, 1 + solve(x));
	}
	return dp[node] = res;
}

int main()
{
	fastio;

	memset(dp, -1, sizeof(dp));

	int n, m;
	cin >> n >> m;

	int u, v;
	for (int i = 0; i < m; ++i)
	{
		cin >> u >> v;
		adj[u].pb(v);
	}

	int res = 0;
	for (int i = 1; i <= n; ++i)
		res = max(res, solve(i));
	cout << res << '\n';
	return 0;
}


Measured memory_bytes: 11604
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin >> n;
    int d = n % 10;
    if (d == 2 || d == 4 || d == 5 || d == 7 || d == 9)
    {
        cout << "hon"
             << "\n";
    }
    else if (d == 0 || d == 1 || d == 6 || d == 8)
    {
        cout << "pon"
             << "\n";
    }
    else if (d == 3)
    {
        cout << "bon"
             << "\n";
    }
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define ll long long

using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  int s = 0;
  string a, b;
  cin >> a>> b;
  for(int i =0; i < (int) b.size(); ++i){
    if(a[i] != b[i])
      ++s;
  }
  cout<<s;
}



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

#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})

#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()

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

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

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

    int N, A, B;
    cin >> N >> A >> B;

    if (A * ll(B) < N || A + B - 1 > N) {
        cout << -1 << endl;
        return 0;
    }

    int v = 0, pr = N - A;
    for (int i = 0; i < A; i++) {
        int desc = 1 + min(pr, B - 1);
        for (int j = v + desc; j > v; j--) {
            cout << j << " ";
        }
        v += desc;
        pr -= desc - 1;
    }
    cout << endl;

    return 0;
}



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

int main() {
  int n,k;
  cin >> n >> k;
  vector<int> v(n);
  rep(i,n) cin >> v[i];
  k=min(k,200);
  rep(i,k){
    vector<int> vec(n+1,0);
    rep(i,n){
      int x=v[i];
      int y=max(0,i-x);
      int z=min(n,i+x+1);
      vec[y]++; vec[z]--;
    }
    int now=0;
    rep(i,n){
      now+=vec[i];
      v[i]=now;
    }
  }
  rep(i,n) cout << v[i] << endl;
}

Measured memory_bytes: 4824
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; 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);
    char a, b;
    cin >> a >> b;
    if (a == b) cout << "H" << endl;
    else cout << "D" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	int S[4], flag = 0; //flag=0はNA 1はMMYY 2はYYMM 3がAMBIGUOUS
		scanf("%1d%1d%1d%1d", &S[0],&S[1],&S[2],&S[3]);

	if ((S[0] >= 1 && S[1] > 2) || (S[0]>1) || (S[0]==0 && S[1]==0)) {
		if ( (S[2] >= 1 && S[3] > 2) || (S[2]==0&&S[3]==0) || (S[2]>1) || (S[2]==0 && S[3]==0)) {
			flag = 0;
		}
		else {
			flag = 2;
		}
	}else if ((S[2] >= 1 && S[3] > 2) || (S[2]>1) || (S[2]==0 && S[3]==0)) {
		flag = 1;
	}
	else {
		flag = 3;
	}

	switch (flag) {
	case 0:
		puts("NA");
		break;
	case 1:
		puts("MMYY");
		break;
	case 2:
		puts("YYMM");
		break;
	case 3:
		puts("AMBIGUOUS");
		break;
	}

	return 0;
}



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

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  const array<string, 7> Month = {
    "SUN","MON","TUE","WED","THU","FRI","SAT"
  };
  string S;
  cin >> S;
  int i = distance(begin(Month), find(begin(Month), end(Month), S));
  cout << 7 - i << endl;
}


Measured memory_bytes: 256
using System;
 
public class Hello{
	public static void Main(){
      string[] s =Console.ReadLine().Split(' ');
      long N,A,B,r,m;
      N = long.Parse(s[0]);
      A = long.Parse(s[1]);
      B = long.Parse(s[2]);
      if(A==0){
        Console.WriteLine(0);
      }
      else if(A>=N){
        Console.WriteLine(N);
      }
      else if(A<N&&A+B>=N){
        Console.WriteLine(A);
      }
      else{
        m=N/(A+B);
        r=N%(A+B);
        if(r<A){
          Console.WriteLine(A*m+r);
        }
        else Console.WriteLine(A*(m+1));
      }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

int main(){
  ll A,B,C;
  cin>>A>>B>>C;
  if (A==B&&B==C){
    if (A%2==0&&B%2==0&&C%2==0)
      cout << -1 << endl;
    else
      cout << 0 << endl;
  }else{
    ll cnt(0);
    while (true){
      ll a,b,c;
      a = A;
      b = B;
      c = C;
      if (a%2==1||b%2==1||c%2==1){
        cout << cnt << endl;
        break;
      }
      cnt++;
      A = (b+c)/2;
      B = (a+c)/2;
      C = (a+b)/2;
    }
  }
  return 0;
}



Measured memory_bytes: 256
n=int(input())
l=[0]+list(map(int,input().split()))+[0]
S=sum([abs(l[i]-l[i-1]) for i in range(1,n+2)])
for i in range(1,n+1):
    m,M=min(l[i-1],l[i+1]),max(l[i-1],l[i+1])
    if m<=l[i]<=M:
        print(S)
    else:
        print(S-2*min(abs(m-l[i]),abs(M-l[i])))


Measured memory_bytes: 14044
def main():
    r = 0
    x = 0
    while x <= 1e9:
        r += 1
        x = pow(r, 5) - pow(r-1, 5)
    x = 0
    l = 1
    while x <= 1e9:
        l -= 1
        x = pow(l, 5) - pow(l-1, 5)
    for a in range(l,r):
        for b in range(l,r):
            if pow(a,5) - pow(b, 5) == X:
                print(a, b)
                return

X = int(input())
main()


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

int main() {
  int64_t N;
  cin >> N;
  
  int64_t sum = 0;
  
  for(int64_t i = 1; i <= N; i++) {
    if(i % 3 == 0 || i % 5 == 0) {
      sum = sum;
    }
    else {
      sum += i;
    }
  }
  
  cout << sum << endl;
  
}

Measured memory_bytes: 3636
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() []int {
	n := readInt()
	return readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func minUint(a, b uint) uint {
	if a < b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func minUint64(a, b uint64) uint64 {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func maxUint(a, b uint) uint {
	if a < b {
		return b
	}
	return a
}
func maxInt64(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}

func maxUint64(a, b uint64) uint64 {
	if a < b {
		return b
	}
	return a
}

func absInt(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int
func main() {
	defer stdout.Flush()

	c := readString()
	switch c {
	case "a", "o", "i", "u", "e":
		println("vowel")
	default:
		println("consonant")
	}
}


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

class TEST
{
    static void Main()
    {
        Sol mySol = new Sol();
        mySol.Solve();
    }
}

class Sol
{

    public Sol()
    {


        int len = ri();
        int index = len % 2 == 0 ? len / 2 : (len - 1) / 2;
        
        long[] intarr = rla();

        long[] finalArr = new long[len];
        
        finalArr[index] = intarr[0];

        for (int i = 1; i < len; i++) {

            if (i % 2 == 1)
            {  //--
                finalArr[index - i] = intarr[i];
                index = index - i;
            }
            else {
                finalArr[index + i] = intarr[i];
                index = index + i;
            } //++

        }

        if (len % 2 == 0) { Console.WriteLine(String.Join(" ", finalArr)); } else { Console.WriteLine(String.Join(" ", finalArr.Reverse())); }
        
        
    }

    public void Solve()
    {

    }

    static String rs() { return Console.ReadLine(); }
    static int ri() { return int.Parse(Console.ReadLine()); }
    static long rl() { return long.Parse(Console.ReadLine()); }
    static double rd() { return double.Parse(Console.ReadLine()); }
    static String[] rsa(char sep = ' ') { return Console.ReadLine().Split(sep); }
    static int[] ria(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
    static long[] rla(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
    static double[] rda(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }


}




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


#define f(i,a,b) for(int i=(int)(a);i<=(int)(b);i++)
#define char_f(i,a) for(int i=(int)(a);(char)s[i]!='\0';i++)
#define rf(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define llf(i,a,b) for(long long int i=(long long int)(a);i<=(long long int)(b);i++)
#define llrf(i,a,b) for(long long int i=(long long int)(a);i>=(long long int)(b);i--)



#define ll long long
#define fi first
#define se second
#define pb push_back
#define pob pop_back
#define mem(ara) memset((ara),0,sizeof(ara))
#define memn(ara) memset((ara),-1,sizeof(ara))
#define bb begin()
#define ee end()
#define em emplace
#define eb emplace_back





#define si set<int>
#define sd set<double>
#define sll set<long long int>
#define ss set<string>
#define sc set<char>

#define pii pair<int,int>
#define pli pair<long long int,int>
#define pil pair<int,long long int>
#define pll pair<long long int,long long int>
#define pci pair<char,int>
#define pic pair<int,char>
#define pcl pair<char,long long int>
#define plc pair<long long int,char>

#define pss pair<string,string>
#define pcc pair<char,char>

#define pis pair<int,string>
#define psi pair<string,int>
#define pls pair<long long int,string>
#define psl pair<string,long long int>
#define pdd pair<double,double>
#define pcs pair<char,string>
#define psc pair<string,char>



#define vi  vector<int>
#define vll vector<long long int>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vii vector<pii>



#define mod 1000000007
#define mx (1<<30)-1
#define llmx (1ll<<62)
#define n_size 100005
#define g_size 10000005
double PI=acos(-1);
#define eps 1e-9



///unsigned int uMAX=4294967295;
///unsigned ll int ullMAX=18446744073709551615;





int arr[g_size];
string s1,s2;
pair<int,int>p[3*n_size];

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

	int n,m,T,res;

	int maxi=-mx,mini=mx,count=0;

	int i,j,k;

	bool flag;



	char s[100000];

	int ara[n_size],ara2[n_size];

	cin>>n;

	cin>>s1;



	//mem(p);

    if(s1[0]=='W'){
        p[0].fi=1;
        p[0].se=0;
    }
    else if(s1[0]=='E'){
        p[0].fi=0;
        p[0].se=1;
    }

	f(i,1,s1.size()-1){
        if(s1[i]=='W'){
            p[i].fi=p[i-1].fi+1;
            p[i].se=p[i-1].se;
        }
        else if(s1[i]=='E'){
            p[i].fi=p[i-1].fi;
            p[i].se=p[i-1].se+1;
        }
	}

    int W=p[n-1].fi;
    int E=p[n-1].se;
    int w,e;
    for(i=0;i<n;i++){
        if(s1[i]=='W'){
            w=p[i].fi-1;
            e=E-p[i].se;
            mini=min(mini,(w+e));
        }
        else if(s1[i]=='E'){
            w=p[i].fi;
            e=E-p[i].se;
            mini=min(mini,(w+e));
        }
    }
    cout<<mini<<endl;
}


Measured memory_bytes: 6088
#include<bits/stdc++.h>
using namespace std;
#define IOS std::ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb push_back
#define LL long long
#define fi first
#define se second
int gcd(int a,int b){if(a==0)return 0;else return (b==0)?a:gcd(b,a%b);}
int main(){
	IOS;
	int t,n,i;
	string s1,s2;
	cin>>s1>>s2;
	s2.pop_back();
	if(s1==s2)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;	
	return 0;
} 

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

int main(){
    string s;
    cin >> s;
    int n = s.length();
    ll a_cnt = 0;
    ll ans = 0;
    rep(i, n) {
        if ( s[i] == 'A' ) {
            ++a_cnt;
        }
        else if ( i < n - 1 && s[i] == 'B' && s[i+1] == 'C' ) {
            ans += a_cnt;
            ++i;
        }
        else {
            a_cnt = 0LL;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, b, c;
    cin >> a >> b >> c;
    if(a > b) swap(a, b);
    if(a <= c && c <= b) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256