akhauriyash/Code-Regression huggingface dataset:
N = int(input())
X = {c:0 for c in 'MARCH'}
for _ in range(N):
    c = input()[0]
    if c in X: X[c]+=1

ans = 0
for i1 in range(5):
    for i2 in range(i1+1,5):
        for i3 in range(i2+1,5):
            ans += X['MARCH'[i1]]*X['MARCH'[i2]]*X['MARCH'[i3]]
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define SZ(X) (int)(X).size()
#define ALL(X) (X).begin(), (X).end()
#define pb push_back
#define MP make_pair
#define rep(i, n) for(int i = 0; i < n; i ++)
#define rep1(i, a, b) for(int i = a; i < b; i ++)
#define per1(i, a, b) for(int i = a; i >= b; i --)
typedef long long LL;
const int MXN = (int)2e5 + 7;
int n;
LL a[MXN];
LL num[MXN];
LL lsum[MXN], rsum[MXN];
void build1(){
	vector<int>buf;
	a[n+1] = 1;
	num[n+1] = 100000000;
	buf.pb(n + 1);
	buf.pb(n);
	per1(i, n-1, 1){
		rsum[i] = rsum[i+1];
		int v = num[i+1];
		LL v1 = a[i], v2 = a[i+1];
		if( v1 > v2){
			while(v1 > v2){
				v2 *= 2;
				v--;
			}
		}
		if(v >= 0){
			buf.pb(i); continue;
		}
		v = -v;
		int need = v;
		need = (need + 1) / 2 * 2;
		while( need ){
			int pos = buf.back();
			v = num[pos+1] - num[pos];
			if(a[pos+1] >= a[pos]){
				v1 = a[pos+1], v2 = a[pos];
				while(v1 >= v2){
					v2 *= 2;
					v++;
				}
				v--;
			} else{
				v1 = a[pos+1], v2 = a[pos];
				while(v1 < v2){
					v1 *= 2;
					v--;
				}
			}
			v = (v / 2)*2;
			if(v > need){
				rsum[i] += need*1ll*(pos - i);
				num[pos] += need;
				break;
			} else{
				need -= v;
				rsum[i] += v*1ll*(pos-i);
				num[pos] += v;
				buf.pop_back();
			}
		}
	}
	//rep1(i, 1, n+1) printf("%lld%c", rsum[i], " \n"[i == n]);
	return ;
}
void build2(){
	vector<int>buf;
	rep1(i, 1, n+1) num[i] = 0;
	a[0] = 1;
	num[0] = 100000000;
	buf.pb(0);
	buf.pb(1);
	lsum[1] = 1;
	rep1(i, 2, n+1){
		lsum[i] += lsum[i-1] + 1;
		int v = num[i-1];
		LL v1 = a[i], v2 = a[i-1];
		if( v1 > v2 ){
			while(v1 > v2){
				v2 *= 2;
				v--;
			}
		}
		if(v >= 0){
			buf.pb(i); continue;
		}
		v = -v;
		int need = v;
		need = (need + 1) / 2 * 2;
		while( need ){
			int pos = buf.back();
			v = num[pos-1] - num[pos];
			if(a[pos-1] >= a[pos]){
				v1 = a[pos-1], v2 = a[pos];
				while(v1 >= v2){
					v2 *= 2;
					v++;
				}
				v--;
			} else{
				v1 = a[pos-1], v2 = a[pos];
				while(v1 < v2){
					v1 *= 2;
					v--;
				}
			}
			v = (v / 2)*2;
			if(v > need){
				lsum[i] += need*1ll*(i - pos);
				num[pos] += need;
				break;
			} else{
				need -= v;
				lsum[i] += v*1ll*(i-pos);
				num[pos] += v;
				buf.pop_back();
			}
		}
	}
	//rep1(i, 1, n+1) printf("%lld%c", lsum[i], " \n"[i == n]);

	return ;
}
int main(void){
	scanf("%d", &n);

	rep1(i, 1, n+1) scanf("%lld", a + i);
	build1();
	build2();
	LL ans = 10000000000000LL;
	rep1(i, 1, n+2){
		ans = min(ans, lsum[i-1] + rsum[i]);
	}
	printf("%lld\n", ans);
	return 0;
}


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

int main(){
    int P,Q,R,m;
    cin>>P>>Q>>R;
    m=std::max({P,Q,R});
    if (m==P){
        cout<<Q+R<<endl;
    }else if(m==Q){
        cout<<P+R<<endl;
    }else if(m==R){
        cout<<P+Q<<endl;
    }
}




Measured memory_bytes: 256
using System;
using System.Linq;

namespace abc084_c
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine()); n--;
            int[] c = new int[n]; int[] s = new int[n]; int[] f = new int[n];
            for (int i = 0; i < n; i++)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                c[i] = x[0]; s[i] = x[1]; f[i] = x[2];
            }
            for (int i = 0; i < n; i++)
            {
                int sum = 0;
                for (int j = i; j < n; j++)
                {
                    sum = Math.Max(sum,s[j]);
                    while (sum % f[j] != 0) sum++;
                    sum += c[j];
                }
                Console.WriteLine(sum);
            }
            Console.WriteLine(0);
        }
    }
}

Measured memory_bytes: 13396
import static java.util.Arrays.binarySearch;

import java.io.IOException;
import java.util.TreeSet;

public class Main {

	public static void main(String[] args) {
		int n = nextInt();
		int m = nextInt();
		int[] xs = new int[n];
		int[] ys = new int[n];
		for (int i = 0; i < n; i++) {
			xs[i] = nextInt();
			ys[i] = nextInt();
		}

		TreeSet<Integer> xSet = new TreeSet<Integer>();
		TreeSet<Integer> ySet = new TreeSet<Integer>();

		for (int i = 0; i < n; i++) {
			xSet.add(xs[i]);
			ySet.add(ys[i]);
		}
		xSet.add((int) Integer.MAX_VALUE);
		xSet.add((int) Integer.MIN_VALUE);
		ySet.add((int) Integer.MAX_VALUE);
		ySet.add((int) Integer.MIN_VALUE);

		Integer[] xss = xSet.toArray(new Integer[0]);
		Integer[] yss = ySet.toArray(new Integer[0]);

		int w = xss.length;
		int h = yss.length;

		int[][] location = new int[h + 1][w + 1];

		for (int i = 0; i < n; i++) {
			int x = binarySearch(xss, xs[i]);
			int y = binarySearch(yss, ys[i]);
			location[y + 1][x + 1]++;
		}

		for (int i = 0; i < w; i++) {
			for (int j = 0; j < h; j++) {
				location[j + 1][i + 1] += location[j + 1][i] + location[j][i + 1] - location[j][i];
			}
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < m; i++) {
			int x1 = binarySearch(xss, xSet.ceiling(nextInt()));
			int y1 = binarySearch(yss, ySet.ceiling(nextInt()));
			int x2 = binarySearch(xss, xSet.floor(nextInt())) + 1;
			int y2 = binarySearch(yss, ySet.floor(nextInt())) + 1;
			sb.append(location[y2][x2] - location[y1][x2] - location[y2][x1] + location[y1][x1]);
			sb.append('\n');
		}
		System.out.print(sb.toString());
	}

	static int nextInt() {
		int c;
		try {
			c = System.in.read();
			while (c != '-' && (c < '0' || c > '9'))
				c = System.in.read();
			if (c == '-')
				return -nextInt();
			int res = 0;
			while (c >= '0' && c <= '9') {
				res = res * 10 + c - '0';
				c = System.in.read();
			}
			return res;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return -1;
	}

}

Measured memory_bytes: 211356
#include <iostream>
#include <algorithm>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll a,b,c,d;
	cin>>a>>b>>c>>d;
	ll ans = a*c;
	ans = max(ans,a*d);
	ans = max(ans,b*d);
	ans = max(ans,b*c);
	cout<<ans;    
	return 0;
}

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

typedef long long int LLI;

int n;

bool input() {
  cin >> n;
  if (!n) {
    return false;
  }
  return true;
}

void solve() {
  LLI b = 1;
  LLI k = 0;
  while (n) {
    int m = n % 8;
    if (m < 4) {
      k += m * b;
    } else if (m < 5) {
      k += (m + 1) * b;
    } else {
      k += (m + 2) * b;
    }
    n /= 8;
    b *= 10;
  }
  cout << k << endl;
}

int main() {
  while (input()) {
    solve();
  }
  return 0;
}

Measured memory_bytes: 3008
#include <cstdio>
#include <algorithm>

int n;
long long a[100010];

int main(void)
{
    int i,j,k;
    long long u,v;
    long long answer = 0x7f7f7f7f7f7f7f7f;

    //freopen("x.in","r",stdin);

    scanf("%d",&n);
    for(i = 0;i < n;++i)
        scanf("%lld",&a[i]);
    for(i = 1;i < n;++i)
        a[i] += a[i - 1];

    for(k = 0;k < 2;++k)
    {
        j = k;
        u = v = 0;
        for(i = 0;i < n;++i,j ^= 1)
        {
            if(j == 1 && a[i] + v > 0)
                continue;
            else if(j == 0 && a[i] + v < 0)
                continue;
            u += std::abs(a[i] + v) + 1;
            v -= a[i] + v;
            if(j == 1)
                ++v;
            else
                --v;
        }
        answer = std::min(answer,u);
    }

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

    return 0;
}

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

int main(){
    int n;
    cin >> n;
    int pt1=0,pt2=0;
    string str1,str2;
    for(int i=0; i<n; i++){
        cin >> str1 >> str2;
        int len1=str1.size(),len2=str2.size();
        int flg=0;
        for(int j=0; j<( (len1 > len2) ? len2 : len1); j++){
            if(str1[j]>str2[j]){
                pt1+=3;
                flg=1;
                break;
            }
            else if(str1[j]<str2[j]){
                pt2+=3;
                flg=1;
                break;
            }
        }
        if(flg==0){
            if(len1==len2){
                pt1+=1;
                pt2+=1;
            }
            else if(len1 > len2)
                pt1+=3;
            else if(len1 < len2)
                pt2+=3;
        }
    }
    cout << pt1 << " " << pt2 << endl;
    
    return 0;
}


Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
#define lp(i, n) for (int i = 0; i < n; i++)
#define pb push_back
#define ll long long
#define ii pair<string,int>ii;

string IntToStr(int tmp){
    ostringstream out;
    out << tmp;
    return out.str();
}

int main()
{
    int n;
    int sum=0;
    cin>>n;
    int a[n+7];
    for(int i=0; i<n; i++){
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=0;i<n-1; i++){
        sum+=a[i];
    }
    cout<<sum+(a[n-1]/2)<<endl;
}














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

int main() {
    int n, m; 
    while (cin >> m >> n, m != 0) {
      int max = 7368800;
      vector<bool> years(max, false);
      int bamboo_cnt = 0;
      for (int i=0; i<m; i++) years[i] = true;
      int i = 0;
      for (;i < max; i++) {
          if (years[i]) {
          } else if (bamboo_cnt < n) {
              for (int l=1; i*l<max; l++)
                  years[i * l] = true;
              // cout << "ﾆｮｷﾆｮｷ@" << bamboo_cnt <<": " << i << endl;
              bamboo_cnt += 1;
          } else {
              break;
          }
      }
      cout << i << endl;
    }
}



Measured memory_bytes: 3996
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:16777216")
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <stack>
#include <iomanip>
#include <set>
#include <queue>
#include <unordered_map>

using namespace std;

#define ff first
#define ss second

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int maxn = 1e5 + 7;
const int inf = 2e9 + 7;
const ll infl = 1e18 + 7;
const long double eps = 1e-9;
const ll mod = 1e9 + 7;

int main() {
#ifdef _DEBUG
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif // _DEBUG

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;
	vector<double> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	vector<vector<double>> dp(n + 1, vector<double>(n + 1, 0));
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= i; j++) {
			dp[i][j] = dp[i - 1][j] * (1 - a[i - 1]);
			if (j > 0) dp[i][j] += dp[i - 1][j - 1] * a[i - 1];
		}
	}
	double ans = 0;
	for (int i = n; i > n / 2; i--) {
		ans += dp[n][i];
	}
	cout << fixed << setprecision(20) << ans;
	return 0;
}


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


//#define cin2(a,b) scanf("%d%lf",&a,&b)
#define pb push_back
#define all(x) x.begin(),x.end()
#define dist(x1,y1,x2,y2) (x1-x2)*1LL*(x1-x2)+(y1-y2)*1LL*(y1-y2)
#define ll long long
#define db double
#define ull unsigned ll
#define lb lower_bound
#define inf 1e9
#define mp make_pair
#define gcd(x,y) __gcd(x,y);
#define pii pair<int,int>
#define M 1000000007
#define pi acos(-1)


const int mx = 202;
int soldier[mx][mx],prince[mx][mx];
char s[mx][mx];
int r, c;
bool memo[mx][mx];;

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


bool process()
{
    int i,j,k;
    queue<pair<pii,int> > q;
    for(i=0;i<r;i++) {
        for(j=0;j<c;j++) {
            memo[i][j] = false;
            soldier[i][j] = inf;
            prince[i][j] = inf;
            if(s[i][j]=='@') {
                memo[i][j] = true;
                q.push(mp(mp(i,j),0));
                prince[i][j] = 0;
            }
        }
    }
    while(!q.empty()) {
        pair<pii,int> tmp = q.front();
        q.pop();
        int x = tmp.first.first;
        int y = tmp.first.second;
        int v = tmp.second;
        prince[x][y] = v;
        for(i=0;i<4;i++) {
            int tx = x + dx[i];
            int ty = y + dy[i];
            if(tx<0||tx==r||ty<0||ty==c) continue;
            if(memo[tx][ty]) continue;
            if(s[tx][ty]=='#') continue;
            memo[tx][ty] = true;
            q.push(mp(mp(tx,ty),v+1));
        }
    }
    while(!q.empty()) q.pop();
    for(i=0;i<r;i++) {
        for(j=0;j<c;j++) {
            memo[i][j] = false;
            if(s[i][j]=='$') {
                memo[i][j] = true;
                q.push(mp(mp(i,j),0));
            }
        }
    }
    while(!q.empty()) {
        pair<pii,int> tmp = q.front();
        q.pop();
        int x = tmp.first.first;
        int y = tmp.first.second;
        int v = tmp.second;
        soldier[x][y] = v;
        for(i=0;i<4;i++) {
            int tx = x + dx[i];
            int ty = y + dy[i];
            if(tx<0||tx==r||ty<0||ty==c) continue;
            if(s[tx][ty]=='#') continue;
            if(memo[tx][ty]) continue;
            memo[tx][ty] = true;
            q.push(mp(mp(tx,ty),v+1));
        }
    }

    for(i=0;i<r;i++) {
        //printf("%s\n",s[i]);
        for(j=0;j<c;j++) {
            if(s[i][j]=='%') {
                //printf("i = %d j = %d\n",soldier[i][j],prince[i][j]);
                return soldier[i][j]>prince[i][j];
            }
        }
        //printf("\n");
    }
    return false;
}



int main()
{
    while(true) {
        int i,j,k;
        scanf("%d%d",&r,&c);
        for(i=0;i<r;i++) scanf("%s",s[i]);

        int ans = process();
        if(ans) printf("Yes\n");
        else printf("No\n");
        break;
    }
}

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

int main() {
 string S; cin >> S;
  bool ans=1;
  if(S[2]!=S[3] || S[4]!=S[5])ans=0;
  
  if(ans)cout << "Yes" << endl;
  else cout << "No" << endl;
}

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

using namespace std;

inline long long ceil(long long x, long long y)
{
	return (x+y-1)/y;
}

bool process(vector<long long> a, int n, long long T)
{
	long long sum = 0;
	for (int i = 0; i < n; i++)
	{
		long long y1 = ceil(a[i]+T-n+1,n+1);
		long long y2 = (a[i]+T)/(n+1);
		if (y1 != y2) return false;
		sum += y1;
	}
	return sum == T;
}

int main()
{
	int n; cin >> n; 
	vector<long long> a(n);
	long long S = 0;
	for (auto & x : a) { cin >> x; S += x; }
	long long H = S; long long L = max(0ll, S - (n*(n+1)));
    
	for (long long T = L; T <= H; T++)
		if (process(a,n,T))
		{
			cout << T << endl;
			break;
		}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,n) for (int i=a; i < n; i++)
#define per(i,a,n) for (int i=n-1; i >= a; i--)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define pb push_back
#define mp make_pair
#define MOD 1000000007
typedef long int int32;
typedef unsigned long int uint32;
typedef long long int int64;
typedef unsigned long long int  uint64;
using namespace std;
int main(){
    int c; cin >> c;
    if(c ==1) cout << 0 << endl;
    else cout << 1 << endl;
}

Measured memory_bytes: 3592
var
	n,i,h,p,a:Longint;
begin
	read(n);
	p:=0;
	a:=0;
	for i:=1 to n do begin
		read(h);
		if h>p then inc(a,h-p);
		p:=h;
	end;
	writeln(a);
end.


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

int main() {
    long *wp,w;
    long N,i;
    int K,*hp,k;

    scanf("%ld %d",&N,&K);
    wp=(long *)malloc((K+1)*sizeof(long));
    hp=(int *)malloc((K+1)*sizeof(int));

    scanf("%d",&hp[0]);
    wp[0]=0;

    for(i=1;i<=N-1;i++) {
        k=K;
        if(i<K) k=i;
        for(;k>=1;k--) {
            hp[k]=hp[k-1];
            wp[k]=wp[k-1];
        }

        scanf("%d",&hp[0]);

        for(k=1;k<=K;k++) {
            if(i<k) break;
            if(hp[0]>hp[k]) w=wp[k]+hp[0]-hp[k];
            else w=wp[k]+hp[k]-hp[0];
            if(k==1 || wp[0]>w) wp[0]=w;
        }
    }

    printf("%ld\n",wp[0]);
    return 0;
}

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

// const int N = 1e9+7;
const int N = 1e6 + 5;
ll parent[N];
ll siz[N];
void make() {
    for(ll i=0; i<N; i++) {
        parent[i] = i;
        siz[i] = 1;
    }
}
int find(int x) {
    while (parent[x] != x) {
        x = parent[x];
    }
    return x;
}
void unite(int a, int b) {
    a = find(a);
    b = find(b);
    if (a != b) {
        if (siz[a] < siz[b]) {
            swap(a, b);
        }
        parent[b] = a;
        // if (siz[a] == siz[b]) {
            siz[a]+=siz[b];
        // }
    }
}

bool sieve[N];

void solve(){
  ll n;
  cin>>n;
  vector<ll>v(n);
  map<ll,ll>m;
  for(ll i=0;i<n;i++){
    cin>>v[i];
    m[v[i]]++;
  }
  sort(v.begin(), v.end());
  ll gc = v[0];
  for(ll i=1; i<n;i++){
    gc = __gcd(v[i],gc);
  }
  if(gc > 1){
    cout<<"not coprime\n";
    return;
  }
  vector<ll>primes;
  for(ll i=2; i<(ll)sqrt(N)+1; i++){
    if(sieve[i])continue;
    for(ll j=i+i; j<N; j+=i){
      sieve[j] = true;
    }
  }
  for(ll i=2; i<N; i++){
    if(sieve[i])continue;
    primes.push_back(i);
  }
  for(auto y:primes){
    ll cnt = 0;
    for(ll j = y; j<N; j+=y){
      cnt += m[j];
    }
    if(cnt > 1){
      cout<<"setwise coprime\n"; return;
    }
  }
  cout<<"pairwise coprime";

}



int main(){
  // freopen("input.txt", "r",stdin);
  // freopen("output.txt", "w", stdout);
  ll t;
  // cin>>t;
  t = 1;
  while(t--){
    solve();
  }
}
























/*
  1 2 3 4 5 6 7 8

  6 7 8 1 2 3 4 5


*/


Measured memory_bytes: 75536
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  
  for ( int i = 0; i < N; i++ ){
    string s;
    cin >> s;  
    
   if ( s == "Y" ){
      cout << "Four" << endl;
      exit (0);
    }  
  }
  cout << "Three" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, j, n) for (int i = j; i < n; i++)
#define all(x) (x).begin(),(x).end()
#define INF (1e9)
#define MOD (1e9+7)

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

void Main(){
  ll x; cin >> x;
  ll hoge = x / 11;
  ll fuga = x % 11;
  if(fuga == 0) cout << hoge * 2 << endl;
  else if(fuga <= 6) cout << hoge * 2 + 1 << endl;
  else cout << hoge * 2 + 2 << endl;
}

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

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

  Main();
}


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

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;


int main(){
  lll ii,jj,kk;
  vector<int> ret;
  lll n;
  vector<lll> l;
  cin >> n;
  l.resize(n);

  for(ii=0;ii<n;ii++){
    cin >> l[ii];
  }
  lll sum = 0;
  sort(l.begin(),l.end(),std::greater<lll>());
  //cout << "end sort" << endl;

  for(ii=0;ii<n-2;ii++){
    for(jj=ii+1;jj<n-1;jj++){
      for(kk=jj+1;kk<n;kk++){
        if(l[jj]+l[kk]>l[ii]){
          //cout << "ii" << ii << "jj" << jj << "kk" << kk <<endl;
          //cout << "ii" << l[ii] << "jj" << l[jj] << "kk" << l[kk] <<endl;
          sum++;
        }
      }
    }
  }
  cout << sum << endl;
  return 0;
}


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

typedef long long ll;

int main()
{
    ll N;
    ll ans = 0;
    cin >> N;
    ll even = 0;
    ll odd = 0;
    for (ll i = 0; i < N; ++i)
    {
        ll temp;
        cin >> temp;
        if (temp % 2 != 0)
        {
            ++odd;
        }
        else
        {
            ++even;
        }
    }
    if (odd % 2 != 0)
    {
        cout << "NO" << endl;
    }
    else
    {
        cout << "YES" << endl;
    }
}


Measured memory_bytes: 256
// G++ MACRO.CPP -STD=C++17
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair
 
int main(){
  CIN(a,b);
  COUT((a+b)%24);

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){
    int n,l;
    cin >> n >> l;
    string s[n];
    for(int i = 0;i < n;i++){
        cin >> s[i];
    }
    sort(&s[0],&s[n]);
    for(int i = 0;i < n;i++){
        cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
using namespace std;
typedef long long LL;
#define ms(a,b) memset(a,b,sizeof(a))
# define eps 1e-8

bool to(int &x, int y) {
  if (x > y) {
    x = y;
    return true;
  }
  return false;
}

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

    deque<int> q;//双向队列
    q.push_back(1);

    vector<int> dp(K,1e9);//表示有K个值为1e9的数
    dp[1] = 1;

    while (!q.empty()) {
        int u = q.front(); q.pop_front();
        //int d = dp[u];
        if (to(dp[u * 10 % K], dp[u])) {
            q.push_front(u * 10 % K);
        }
        if (to(dp[(u + 1) % K], dp[u] + 1)) {
            q.push_back((u + 1) % K);
        }
    }

    cout << dp[0] << endl;
    return 0;
}


Measured memory_bytes: 896
#define _CRT_SECURE_NO_WARNINGS
#include<cstdio>
#include<cstring>

int main(){
	char str[20];
	gets(str);
	for (int i = strlen(str) - 1; i >= 0; i--)
		printf("%c", str[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 908
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<math.h>
using namespace std;
using ll = int64_t;
using Graph = vector<vector<int> >;
const ll M = 1000000007;

int main(){
    int n;
    cin >> n;
    int h[n];
    for(int i=0;i<n;i++) cin >> h[i];

    int m=h[0];
    for(int i=1;i<n;i++) {
        m = max(h[i],m);
        if(m-h[i]>1) {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
}

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

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


    int a[100] = {};
    int k = 0;
    for (int i = 0; i < w.size(); i++) {
        if (w[i] != '0') {
            for (int j = i + 1; j < w.size(); j++) {
                if (w[i] == w[j]) {
                    w[j] = '0';
                    a[k]++;
                }
            }
            //cout << a[k] << endl;
            if (a[k] % 2 == 0) {
                cout << "No" << endl;
                return 0;
            }
            k++;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

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

const ll mod = 1000000007;

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

  string s;
  cin >> s;

  int n = s.length();
  int ans = 0;
  for (int i = 1; i * 2 < n; i++) {
    bool good = true;
    for (int j = 0; j < i; j++) {
      if (s[j] != s[j+i]) {
        good = false;
        break;
      }
    }
    if (good) ans = i * 2;
  }

  cout << ans << endl;

  return 0;
}


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

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

    string C;
    cin >> C;

    // count num of R
    int R_num = 0;
    for (int i = 0; i < N; i++)
    {
        if (C[i] == 'R')
        {
            R_num++;
        }
    }

    int res = 0;
    for (int i = 0; i < R_num; i++)
    {
        if (C[i] == 'W')
        {
            res++;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 3760
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
	int m;
	cin >>m;
	cout << 24- m +24 << endl;
	return 0;
}


Measured memory_bytes: 256
# include "stdio.h"
int main(){
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    int max=-1,min=1001;
    for(int i=0;i<n;i++){
        if(a[i]<min) min=a[i];
        if(a[i]>max) max=a[i];
    }
    printf("%d\n",max-min);
}


Measured memory_bytes: 1736
#include<stdio.h>
int main()
{
int h,w;
int i,j;
while(1){
scanf("%d %d", &h, &w);
if(h==0&&w==0)break;
for(i=0; i<h; i++){
for(j=0; j<w; j++){

if(i==0||i==h-1||j==0||j==w-
1){ printf("#");

}
else{
printf(".");
}
}
printf("\n");
}
printf("\n");
}
return 0;
}


Measured memory_bytes: 2700
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=500010;

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

    ll n;
    cin>>n;
    if(n%2==1){cout<<"0";return(0);}
    n/=2;
    ll p=5;
    ll ans=0;
    while(p<=n)
    {
        ans+=n/p;
        p=p*5;
    }
    cout<<ans;

    return (0);
}


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

ll eval(string s){
    ll ans = 0;
    int i=0;
    ll curr = 0;
    while(i<s.size()){
        if(s[i] != '+'){
            while(i < s.size() && s[i] != '+'){
                curr = curr * 10 + (s[i] - '0');
                i++;
            }
        }
        else{
            ans += curr;
            curr = 0;
            i++;
        }
    }
    ans += curr;
    return ans;
}
ll answer(string s, int i, int k){
    int l = s.size();
    for(int j=0; j<k; j++){
        if(i & (1<<j)){
            s.insert(l - j - 1, "+");
        }
    }
    //cout << s <<" " << eval(s) << endl;
    return eval(s);
}
int main() {
    string s;
    cin >> s;
    ll ans= 0;
    int k= s.size()-1;
    for(int i=0; i<(1<<k); i++){
        ans += answer(s, i, k);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

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

    string s;
    cin >> s;
    for (int i = 0; i < n; i++) {
        s[i] -= '0';
    }

    vector<int> a;
    int c = 0, p = 1;
    for (int i = 0; i < n; i++) {
        if (s[i] == p) {
            c++;
        } else {
            a.push_back(c);
            c = 1;
            p ^= 1;
        }
    }
    a.push_back(c);
    if (p == 0) a.push_back(0);

    int m = (int)a.size();
    int x = 0;
    int j = k * 2 + 1;
    if (j >= m) {
        cout << n << endl;
        exit(0);
    }
    for (int i = 0; i < j; i++) {
        x += a[i];
    }

    int r = x;
    for (int i = j; i + 1 < m; i += 2) {
        x += (a[i + 1] + a[i]) - (a[i - j + 1] + a[i - j]);
        r = max(r, x);
    }

    cout << r << endl;

    return 0;
}

Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please

int BIT[2001];

void add(int A, int B) {
	A++;
	while (A > 0) {
		BIT[A] = max(BIT[A], B);
		A -= A & -A;
	}
}

int query(int A) {
	A++;
	int kotae = 0;
	while (A <= 2000) {
		kotae = max(BIT[A], kotae);
		A += A & -A;
	}
	return kotae;
}

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


	string A, B;
	cin >> A >> B;

	int N = A.size();
	int L[2000], R[2000];
	rep(i, N) L[i] = 1e9;
	rep(i, N) R[i] = 1e9;
	rep(i, N) if (B[i] == '1') L[i] = 0;
	rep(i, N) if (B[i] == '1') R[i] = 0;
	rep(i, 2 * N) L[(i + 1) % N] = min(L[(i + 1) % N], L[i % N] + 1);
	for (int i = 2 * N; i > 0; i--) R[(i - 1) % N] = min(R[(i - 1) % N], R[i % N] + 1);

	if (L[0] > 1e8) {
		int zero = 1;
		rep(i, N) if (A[i] == '1') zero = 0;
		if (zero) co(0);
		else co(-1); 
		return 0;
	}
	
	A += A;
	int kotae = 1e9;
	rep(i, N) {
		int m = 0;
		memset(BIT, 0, sizeof(BIT));
		rep(j, N) {
			if (A[i + j] != B[j]) {
				if(L[(i + j) % N]) add(L[(i + j) % N] - 1, R[(i + j) % N]);
				m++;
			}
		}
		rep(j, N) {
			int k = query(j);
			kotae = min(kotae, m + j * 2 + k + min(abs(i + k), abs(N - i - k)));
			kotae = min(kotae, m + j + 2 * k + min(abs(i - j), abs(N - i + j)));
		}
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
	int a, b, c;
	cin >> a >> b >> c;
	if (a > b)
		swap(a, b);
	if (a > c)
		swap(a, c);
	if (b > c)
		swap(b, c);
	cout << a << " " << b << " " << c << endl;
	return 0;
}

Measured memory_bytes: 1168
#include<bits/stdc++.h>
 #include<iostream>
using namespace std;
long long  a[200005];
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);
	long long n,k,t,sum=0;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	sort(a,a+n);
	t=n-k;
	for(int i=0;i<t;i++)
	{
		sum=sum+a[i];
	}
	cout<<sum;
	
 } 

Measured memory_bytes: 1792
S=input()

# print(S)
S_rev=S[::-1]
# print(S_rev)

N=len(S)
S_mae=S[:int((N-1)/2)]
S_usiro=S[int((N+3)/2)-1:]
# print(S_mae)
# print(S_usiro)
S_mae_rev=S_mae[::-1]
S_usiro_rev=S_usiro[::-1]

if S!=S_rev:
    print("No")
    exit()
if S_mae!=S_mae_rev:
    print("No")
    exit()
if S_usiro!=S_usiro_rev:
    print("No")
    exit()
print("Yes")


Measured memory_bytes: 3064
#include <iostream> 
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
#include<set>
#include<queue>
#include<deque>
#include<iomanip>
#include<sstream>
#include<cmath>
#include<tuple>
#include<bitset>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define req(i,n) for(ll i = 1;i <=  n; i++)
#define rrep(i,n) for(ll i = n -1;i >= 0;i--)
#define ALL(obj) begin(obj), end(obj)
#define RALL(a) rbegin(a),rend(a)
typedef long long int ll;
typedef long double ld;
const ll INF = 1e18;
const double eps = 1e-8;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
    std::fill((T*)array, (T*)(array + N), val);
}int n, m, Q, b = 0, c = 0,dd = 0, sx,sy,gx,gy; string s;
const int MOD = 1e9 + 7;
int main(void) {
    cin >> n; vector<ll> a(n);
    ll ma = 0;
    rep(i, n) {
        cin >> a[i];
        ma = max(ma, a[i]);
    }ll ans = 0;
    dd = floor(log2(ma - 1))+1;
    rep(i, dd) {
        ll x = 1,y=0;
        rep(j, i) {
            x *= 2; x %= MOD;
        }
        rep(j, n) if (a[j] >> i & 1) ++y;
        ans += (y * (n - y) % MOD) * x % MOD;
        ans %= MOD;
    }cout << ans << endl;
}

Measured memory_bytes: 2560
#include<stdio.h>

int main(void){

int n,a[1000],key,i,j,k;

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

for(i=0; i < n; i++){
key=a[i];
j=i-1;
while(j>=0 && a[j]>key){
a[j+1] = a[j];
j--;
}
a[j+1]=key;
for(k = 0; k<n-1; k++){
printf("%d ",a[k]);
}
printf("%d\n",a[n-1]);
}
return 0;
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
;
int main()
{
    int n, k;
    cin >> n >> k;
    int a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];
    bool dp[k + 1];
    memset(dp, false, sizeof(dp));
    for (int i = 1; i <= k; i++)
    {
        for (int j = 0; j < n; j++)
        {
            if (i >= a[j])
            {
                if (dp[i - a[j]] == false)
                {
                    dp[i] = true;
                }
            }
        }
    }
    if(dp[k]) 
     cout << "First" ;
    else 
    cout << "Second";
}

Measured memory_bytes: 3708
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<algorithm>

using namespace std;

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

    int ans = 700;

    for (int i = 0; i < 3; i++) {
        if (s[i] == 'o') {
            ans += 100;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(V) V.begin(),V.end()
using ll = long long;
const ll MOD = 1000000007;

int main() {
	string S;
	cin >> S;
	for (int i = 0;i < S.size();i++) {
		cout << 'x';
	}
	cout << endl;
}

Measured memory_bytes: 256
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math
import collections

N, = map(int, sys.stdin.readline().rstrip().split(" "))
As = list(map(int, sys.stdin.readline().rstrip().split(" ")))

total = sum(As)
current = 0
half = None
for i in range(len(As)):
    if current + As[i] >= (total / 2):
        if abs(current - total / 2) <= abs((current + As[i]) - total / 2):
            half = current
        else:
            half = current + As[i]
        break
    current += As[i]
print(abs((total - half) - half))
exit(0)


Measured memory_bytes: 27652
// C++ program to display all permutations 
// of an array using STL in C++ 
  
#include <bits/stdc++.h> 
using namespace std;
int aa[10];
int bb[10];
int ans1;
int ans2;
long long cnt = 0;
  
// Function to display the array 
void display(int a[], int n) 
{ 	cnt++;
    for (int i = 0; i < n; i++) {
    	if(a[i] != aa[i])break;
    	if(i == n - 1)ans1 = cnt;
    } 
} 
  
// Function to find the permutations 
void findPermutations(int a[], int n) 
{ 
  
    // Sort the given array 
    sort(a, a + n); 
  
    // Find all possible permutations 
    do { 
        display(a, n); 
    } while (next_permutation(a, a + n)); 
} 

void display2(int a[], int n) 
{ 	cnt++;
    for (int i = 0; i < n; i++) {
    	if(a[i] != bb[i])break;
    	if(i == n - 1)ans2 = cnt;
    } 
} 
  
// Function to find the permutations 
void findPermutations2(int a[], int n) 
{ 
  
    // Sort the given array 
    sort(a, a + n); 
  
    // Find all possible permutations 
    do { 
        display2(a, n); 
    } while (next_permutation(a, a + n)); 
} 
  
// Driver code 
int main() 
{ 
  	int n; cin >> n;
    int a[10];
    for(int i = 0; i < n; i++){
    	a[i] = i + 1;
	}
    for(int i = 0; i < n; i++)cin >> aa[i];
	for(int i = 0; i < n; i++)cin >> bb[i];
  
    findPermutations(a, n);
    cnt = 0;
    findPermutations2(a, n);
    
    cout << abs(ans1 - ans2) << endl;
  
    return 0; 
} 

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

typedef  long long ll;
//forループ
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
//
//

using namespace std;

int ctoi(char c) {
 switch (c) {
 case '0': return 0;
 case '1': return 1;
 case '2': return 2;
 case '3': return 3;
 case '4': return 4;
 case '5': return 5;
 case '6': return 6;
 case '7': return 7;
 case '8': return 8;
 case '9': return 9;
 default: return 0;
 }
}


 long long a,b,c,s,t,x,y,z;
 long long A,B,C,S,T,X,Y,Z;

 long long cnt;

 long double pi=3.14159265358979323846;

 string N,M;

unsigned long long D;


signed main(){

	cin>>a;
 
	cout<<pow(a,3);


	return 0;

}


Measured memory_bytes: 4100
#include <iostream>
#include <string>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define int long long
#define INF 1e9 + 7
#define cae cout << ans << endl;
#define cye cout << "Yes" << endl;
#define cne cout << "No" << endl;
#define r0 return 0;
using namespace std;
typedef pair<int,int>P;
typedef long long ll;
signed main() {
    string s;
    cin >> s;
    rep(i, 3) {
        if (s[i] == '7') {
            cye
            r0
        }
    }
    cne
    r0
}


Measured memory_bytes: 3592
const val mod = 998244353L
fun power(base: Long, exp: Int): Long {
    return when(exp){
        0 -> 1L
        1 -> base
        else -> power(base * base % mod, exp / 2) * power(base, exp % 2) % mod
    }
}
fun main(args: Array<String>?): Unit {
    val n = readLine()!!.trim().toInt()
    val numbers = readLine()!!.trim().split(' ').map(String::toLong)
    println(
            numbers.indices.map { i -> power(2L, n - i - 1) * numbers[i] % mod * power(numbers[i] + 1, i) % mod}.reduce { acc, l -> (acc + l) % mod }
    )
}


Measured memory_bytes: 241900
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main() {
    int n,a,b;cin>>n>>a>>b;
    int sum=0;
    int sum_for=0;
    
    
    rep(i,n){
        char s;
        cin>>s;
        if(s=='a'){
            sum++;
            if(sum<=a+b){
                std::cout << "Yes" << std::endl;
            }else{
                std::cout << "No" << std::endl;
            }
        }else if(s=='b'){
            sum++;
            sum_for++;
            if(sum<=a+b&&sum_for<=b){
                std::cout << "Yes" << std::endl;
            }else{
                std::cout << "No" << std::endl;sum--;
            }
        }else{
            std::cout << "No" << std::endl;
        }
    }
    return 0;
}

Measured memory_bytes: 768
#include <stdio.h>
#include <vector>
#include <iostream>
// #include <bits/stdc++.h>

using namespace std;
#define _GLIBCXX_DEBUG

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

    int A, B;
    cin >> A >> B;
    int ans = 0;
    ans = max(2 * A - 1, ans);
    ans = max(2 * B - 1, ans);
    ans = max(A + B, ans);

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n,k,ans=0,sabun=1,cnt=0,cntt=1;
  cin >> n >> k;
  // for(int kk=k;kk<50;kk++){
  //   for(int nn=n;nn<30;nn++){
      
  //     ans=0;
  //     for(int i=1;i<=nn;i++){
  //       for(int j=1;j<=nn;j++){
  //         for(int m=1;m<=nn;m++){
  //           if((i+j)%kk==0 and (m+j)%kk==0 and (i+m)%kk==0){
  //             ans++;
  //           }
  //         }
  //       }
  //     }
  //     cout << nn<< "  "<<kk << "   "  <<ans << endl;
  //   }
  //   cout <<"***********" << endl;
  // }

  if(k%2==1){
    cout << (n/k)*(n/k)*(n/k) << endl;
  }else{
    for(int i=1;i<=n;i++){
      cnt++;
      if(cnt*2%k==0){
        ans+=sabun;
      }
      if(i%k==0){
        sabun+=6*cntt;
        cntt++;
      }
    // cout << ans << "  " << sabun<< endl;
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <limits>
#include <queue>
#include <iomanip>
#include <map>
using namespace std;

#define rip(i,n,s) (int i=(s);i<(int)(n);i++)
#define all(a) (a).begin(),(a).end()
long long mod = 1000000007;

int main() {
	long long n, k;
	cin >> n >> k;
	vector<int> da(n);
	for (int i = 0;i < n;i++) {
		cin >> da[i];
	}
	int co = 0;
	for rip(i, n, 0) {
		for rip(j, i, 0) {
			if (da[i] < da[j]) {
				co++;
			}
		}
	}
	sort(all(da));
	long long coo = 0;
	int fl = 0;
	for rip(i, n, 1) {
		if (da[i] == da[i - 1]) {
			fl++;
		}
		else {
			fl = 0;
		}
		coo += i - fl;
	}
	long long ans = (long long)co*k%mod;
	co = (k * (k - 1) / 2 )% mod;
	coo = (co*coo) % mod;
	ans = (long long)(ans + coo) % mod;
	cout << ans << endl;
}

Measured memory_bytes: 256
n = int(input())
R = []
for i in range(n):
    R.append(int(input()))

minv = min(R[0], R[1])
maxv = R[1] - R[0]
for i in range(2,n):
    maxv = max(maxv, R[i]-minv)
    minv = min(minv, R[i])
print(maxv)


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

class Rank
{
public:
  int index, solved, rank;
  Rank(int _index, int _solved, int _rank)
    :index(_index), solved(_solved), rank(_rank) {}
};

class OrderIndex
{
public:
  bool operator() (const Rank& lhs, const Rank& rhs) const
  {
    return lhs.index < rhs.index;
  }
};

class GreaterSolved
{
public:
  bool operator() (const Rank& lhs, const Rank& rhs) const
  {
    return lhs.solved > rhs.solved;
  }
};

int main()
{
  int index, solved;
  vector<Rank> team;
  while (~scanf("%d,%d\n", &index, &solved)) {
    if ((index|solved) == 0)
      break;
    team.push_back(Rank(index, solved, -1));
  }

  sort(team.begin(), team.end(), GreaterSolved());
  index = team[0].rank = 1;
  solved = team[0].solved;
  for (unsigned int i = 1; i < team.size(); ++i) {
    if (team[i].solved < solved) {
      solved = team[i].solved;
      team[i].rank = ++index;
    } else {
      team[i].rank = index;
    }
  }
  sort(team.begin(), team.end(), OrderIndex());

  while (~scanf("%d", &index))
    printf("%d\n", team[index-1].rank);
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>

using namespace std;

int main() {
	int A, B, C;
	cin >> A >> B >> C;
	if (A + B >= C) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N,K;
ll arr[105];
ll dp[100*1000+5];

int main(){
	cin>>N>>K;
	
	for(ll k = 1;k<=K;k++)dp[k] = 0;
	ll mk = 1e8;
	for(ll i = 0;i<N;i++){
		cin>>arr[i];
		dp[arr[i]] = 1;
		mk = min(mk, arr[i]);
	}
	
	for(ll k = mk;k<=K;k++){
		ll f = 1;
		for(ll i = 0;i<N;i++)
			if(k-arr[i]>=0)
				f &= dp[k-arr[i]];
		dp[k] |= !f;
	}
	
	//for(ll k = 1;k<=K;k++)cout<<dp[k]<<" ";
	//cout<<endl;
	
	if(dp[K])
		cout<<"First\n";
	else
		cout<<"Second\n";
  return 0;
}
			
			
	
	

Measured memory_bytes: 1024
using System;

namespace agc003A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string A = Console.ReadLine();
            int i = A.Length;
            string[] B = new string[i];
            int N = 0;
            int W = 0;
            int S = 0;
            int E = 0;
            for(int m = 0; m < i; m++)
            {
                B[m] = A.Substring(m, 1);
                if (B[m] == "N")
                    N += 1;
                else if (B[m] == "W")
                    W += 1;
                else if (B[m] == "S")
                    S += 1;
                else
                    E += 1;
            }
            if ((N > 0 && S == 0) || (N == 0 && S > 0) || (W > 0 && E == 0) || (W == 0 && E > 0))
                Console.WriteLine("No");
            else
                Console.WriteLine("Yes");
        }
    }
}


Measured memory_bytes: 13124