akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
using namespace std;

int n;

int slv(int now, int t);

int main(){
  
  while(scanf(" %d",&n) != EOF){
    printf("%d\n",slv(0,0));
  }
  
  return 0;
}

int slv(int now, int t){
  if(now == 4){
    if(t == n)return 1;
    return 0;
  }
  
  int ans = 0;
  for(int i=0;i<10;i++){
    ans += slv(now + 1, t + i);
  }
  
  return ans;
}

Measured memory_bytes: 2676
#include<bits/stdc++.h>
#define vll vector<ll>
#define vi vector<int>
#define vpll vector<pair<ll,ll>>
#define pii pair<int,int>
#define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
#define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); 
    ll N;
    cin >> N;
    vector<ll> A(N);
    vector<ll> c(N+5,0);
    REP(i,N){
        cin >> A[i];
        c[A[i]]++;
    }
    ll ans = 0;
    REP2(i,1,N+1) if(c[i] >= 2) ans += c[i]*(c[i]-1)/2;
    
    REP(i,N) cout << ans - c[A[i]] + 1 << "\n";
    
    return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 1e5 + 5;
int n, m, k, ans;
int a[N];

int main() {
    cin >> n >> k;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a, a + n);
    ans = 1e9;
    for (int i = 0; i <= n - k; ++i) {
        ans = min(ans, a[i + k - 1] - a[i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4080
#include <iostream>
int main()
{
    using namespace std;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int w, a, b;
    cin >> w >> a >> b;
    if (a <= b && b <= a + w)
    {
        cout << 0 << "\n";
    }
    else if (a + w < b)
    {
        cout << b - a - w << "\n";
    }
    else
    {
        cout << a - b - w << "\n";
    }
    return 0;
}

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

int sx, sy, gx, gy;
int dx[5][1111], dy[5][1111], dn[5];
int memo[5][5][1111];
int a, b;
int u;

int solve(int k, int t, int q){

  if(k == 4) return abs(dx[t][q]-gx) + abs(dy[t][q]-gy);
  if(memo[k][t][q]) return memo[k][t][q];

  int ans = 1<<28, s, d = (t+1)%5;

  for(int i=0;i<dn[d];i++){
    if(!k) s = abs(sx-dx[d][i]) + abs(sy-dy[d][i]);
    else s = abs(dx[t][q]-dx[d][i]) + abs(dy[t][q]-dy[d][i]);
    ans = min(ans, solve(k+1, d, i) + s);
  }

  return memo[k][t][q] = ans;
}

int main(){

  int w,h;
  char c;

  while(true){
    scanf("%d %d", &w, &h);
    if(!w && !h) break;

    memset(dn, 0, sizeof(dn));

    for(int i=0;i<h;i++){
      for(int j=0;j<w;j++){
	scanf(" %c", &c);
	if(c == 'S') sx = j, sy = i;
	else if(c == 'G') gx = j, gy = i;
	else if(c != '.') u = c-'1', dx[u][dn[u]] = j, dy[u][dn[u]] = i, dn[u]++;
      }
    }
    
    b = 1<<28;
    for(int i=0;i<5;i++){
      memset(memo, 0, sizeof(memo));
      if(b > solve(0,i,0)) a = i, b = memo[0][i][0];
    }

    if(b == 1<<28) printf("NA\n");
    else printf("%d %d\n", a+1, b);

  }
}

Measured memory_bytes: 1188
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace At
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Read();
            var ans = "";
            for (int i = 0; i < n.Length; i++)
            {
                if (n[i].ToString() == "1")
                {
                    ans += "9";
                }
                else
                {
                    ans += "1";
                }
            }
            WriteLine(ans);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define oo 1000000010
const int N = 6010;

int n , mod;

int dp[N][2 * N];

inline void add(int &x,int y){x += y; if(x >= mod) x -= mod; if(x < 0) x += mod;}

int main(){
	scanf("%d%d",&n,&mod);
	n *= 3;
	for(int j = 0 ;j <= n;j++) dp[0][j] = 1;
	for(int i = 1;i <= n;i++){
		for(int j = 0 ;j <= 2 * n;j++){
			dp[i][j] = 0;
			if(i >= 3) add(dp[i][j] , (long long)dp[i - 3][j] * ((i - 1) * (i - 2)) % mod);
			if(j > 0) add(dp[i][j] , dp[i - 1][j - 1]);
			if(i >= 2) add(dp[i][j] , ((long long)dp[i - 2][j + 1] * (i - 1)) % mod);
			//printf("dp[%d][%d]=%d\n",i,j - n,dp[i][j]);
		}
	}
	cout << dp[n][n] << endl;
	return 0;
}


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb emplace_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using vpint = vector<pint>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int h, w;
    cin >> h >> w;
    vstr s = in(h);

    vint dx{1, 0, -1, 0};
    vint dy{0, 1, 0, -1};

    int ans = 0;
    rep(i, h) rep(j, w)
    {
        if (s[i][j] == '#')
            continue;
        int dist[h][w];
        rep(k, h) rep(l, w) dist[k][l] = -1;
        dist[i][j] = 0;
        qpint q;
        q.emplace(i, j);
        while (!q.empty())
        {
            int y = q.front().first;
            int x = q.front().second;
            q.pop();
            rep(k, 4)
            {
                int ny = y + dy[k];
                int nx = x + dx[k];
                if (nx >= 0 && ny >= 0 && nx < w && ny < h && dist[ny][nx] == -1 && s[ny][nx] != '#')
                {
                    dist[ny][nx] = dist[y][x] + 1;
                    q.emplace(ny, nx);
                }
            }
        }

        rep(k, h) rep(l, w)
        {
            if (dist[k][l] == -1 && s[k][l] == 1)
            {
                cout << 1 / 0 << endl;
            }
            ans = max(ans, dist[k][l]);
        }
    }
    cout << ans << endl;
}

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


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

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#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 REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    int N,L;
    cin>>N>>L;
    vector<int> a(N);
    REP(i,N) cin>>a[i];
    bool ok=false;
    int idx;
    REP(i,N-1){
        int l=a[i]+a[i+1];
        if(l>=L){
            idx=i;
            ok=true;
            break;
        }
    }
    if(ok){
        cout<<"Possible"<<endl;
        REP(i,idx) cout<<i+1<<endl;
        REPD2(i,N-2,idx) cout<<i+1<<endl;
        cout<<idx+1<<endl;
    }else{
        cout<<"Impossible"<<endl;
    }
}

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

using namespace std;

int main()
{
    int a, b;
    cin >> a >> b;
    if (a >= 13)
    {
        cout << b << endl;
    }
    else if (a >= 6)
    {
        cout << (b / 2) << endl;
    }
    else
    {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <stack>
#include <functional>
#include <set>
#include <map>
#include <deque>
#define WMAX 10000
#define HMAX 10000

//コメントアウトするとdebug()を実行しない
#define DEBUG

using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

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

int A,B,C,N,W,H,ans,dp[HMAX][WMAX];
string O,E;
static const int dx[8] = {0,1,1,1,0,-1,-1,-1},
					dy[8] = {1,1,0,-1,-1,-1,0,1};

void solve(){

}

void debug(){

}

void answer(){
	cout << ans << "\n";
}

int main(){
	cin >> O >> E;
	for (int i = 0; i < E.size(); ++i)
	{
		cout << O[i] << E[i];
	}
	if(O.size() > E.size()){
		cout << O[O.size()-1] << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys, math, fractions, itertools, collections, copy, heapq


def solve(N: int, K: int):
    counter = 0
    for b in range(1, N+1):
        p = N // b
        r = N % b
        counter += p * max(0, b-K)
        counter += max(0, r-K+1)
    if K > 0:
        print(counter)
    else:
        print(counter - N)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
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
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 5308
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(i,a,b) for(auto i=a;i<b;i++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

int main(){
    IOS
    int t, f;
    char c ;
    bool rers = false;
    std::deque<char> dq;
    string s; cin>>s;
    for(int i =0 ;i<s.size();i++)dq.push_back(s[i]);
    int n; cin>>n; 
    while(n--){
        cin>>t;
        if(t==1) rers ^= 1;
        else{
            cin>>f;cin>>c;
            if(rers){
                if(f==1) dq.push_back(c);
                else{dq.push_front(c);}
            }
            else{
                if(f==1) dq.push_front(c);
                else{dq.push_back(c);}
            }
        }
    }
    string s1;
    while(!dq.empty()){
        s1 += dq.front();
        dq.pop_front();
    }
    if(rers)reverse(s1.begin(),s1.end());
    cout<<s1;
    return 0 ;
}

Measured memory_bytes: 1368
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main()
{   long long n,ans=0;
    scanf("%lld",&n);
    long long set[n+1];
    for(int i=1;i<=n;i++){
        set[i]=0;
    }
    
    for(long long c=1;c<n;c++){
        for(long long a=c;a*c<n;a++){
            set[c*a]++;
        }
    }
    for(long long i=1;i<n;i++){
        long long tmp=sqrt(i);
        set[i]*=2;
        if(tmp*tmp==i)set[i]--;
        ans+=set[i];
    }
    printf("%lld",ans);
    
    return 0;
}


Measured memory_bytes: 9908
s = input()
n = int(input())

for _ in range(n):
    line = input().split()
    if line[0] == 'replace':
        a, b = int(line[1]), int(line[2])
        # print(s[:a], s[a:b+1], s[b+1:])
        s = s[:a] + line[3] + s[b+1:]
        # print(s)
    elif line[0] == 'reverse':
        a, b = int(line[1]), int(line[2])
        s = s[:a] + s[a:b+1][::-1] + s[b+1:]
    else:
        a, b = int(line[1]), int(line[2])
        print(s[a:b + 1])


Measured memory_bytes: 5620
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

char str[1000000];
int calc(int &pos) {
  assert(str[pos] == '[');
  pos++;
  int ret = 0;
  if (isdigit(str[pos])) {
    ret = atoi(str + pos) / 2 + 1;
    while (isdigit(str[pos])) { pos++; }
    assert(str[pos] == ']');
    pos++;
  } else {
    vector<int> vs;
    while (str[pos] == '[') { vs.push_back(calc(pos)); }
    assert(str[pos] == ']');
    pos++;
    sort(vs.begin(), vs.end());
    REP(i, vs.size() / 2 + 1) { ret += vs[i]; }
  }
  return ret;
}

int main() {
  int test_case;
  cin >> test_case;
  while (test_case--) {
    scanf("%s", str);
    int pos = 0;
    printf("%d\n", calc(pos));
  }
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

int main() {
    int H, W;
    int A[505][505];
    cin >> H >> W;
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            cin >> A[i][j];
        }
    }
    vector<pair<Pi, Pi>> output;
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j < W; j++) {
            if (A[i][j] & 1) {
                output.emplace_back(Pi(i, j), Pi(i, j + 1));
                A[i][j + 1]++;
            }
        }
    }
    for (int i = 1; i < H; i++) {
        if (A[i][W] & 1) {
            output.emplace_back(Pi(i, W), Pi(i + 1, W));
            A[i + 1][W]++;
        }
    } 
    cout << output.size() << endl;
    for (auto x : output) {
        cout << x.first.first << " " << x.first.second << " " << x.second.first << " " << x.second.second << el;
    }

    return (0);
}


Measured memory_bytes: 5232
n = int(input())
x = list(map(int,input().split()))
sort_x = sorted(x)

mid_1 = sort_x[n//2-1]
mid_2 = sort_x[n//2]

for i in range(n):
  
  if x[i] <= mid_1:
    print(mid_2)
  else:
    print(mid_1)

Measured memory_bytes: 25220
/*
@Author
   Sujeet Kushwaha
*/
 
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
 
#define ll long long int
#define fast ios_base::sync_with_stdio(false)
#define fast_input cin.tie(NULL)
#define fast_output cout.tie(NULL)
#define vi vector<long long int> 
#define vp vector<pair<long long int ,long long int>>
#define pb push_back
#define mp make_pair
#define pp pop_back
#define iter vector<int>::iterator
#define pa pair<long long int ,long long int> 
#define f(a,b) for(int a=0;a<b;a++)
#define mod 1000000007
#define F first
#define S second
#define sett set<long long int>
#define um unordered_map<ll,ll>
#define ordered_set tree<pa, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
// ll powmod(ll a, ll b)
// {
//     ll res = 1;
//     while (b) {
//         if (b&1) {
//             res *= a;
//             res %= mod;
//         }
//         b >>= 1;
//         a = (a * a) % mod;
//     }
 
//     return res;
// }
 
// ll modInv(ll a)
// {
//     return powmod(a, mod - 2);
// }
// int fastread(){
//     int x=0;
//     int c = getchar_unlocked();
//     while(c<48)
//         c = getchar_unlocked();
//     while(c>=48){
//         x = x*10 + (c - 48);
//         c = getchar_unlocked();
//     }
//     return x;
// }
// vi v;
// bool comp(pa a,pa b)
// {
//     if(a.F==b.F)
//     {
//         return v[a.S]<v[b.S];
//     }
//     return a.S<b.S;
// }
void solve()
{
  ll n,a,b;
  cin>>n>>a>>b;
  if(a>b)
   swap(a,b);
  if(abs(b-a)%2==0)
    cout<<abs(b-a)/2<<endl;
  else
  {
     ll ans;
     if(a-1<n-b)
     {
      ans=a-1;
     ans++;
     b=b-ans;
     a=1;
     ans+=(b-a)/2;
     cout<<ans;
     }
     else
     {
       ans=n-b;
     ans++;
     a=a+ans;
     b=n;
     ans+=(b-a)/2;
     cout<<ans;
     }
     
  }
}
int main() {
	fast;
	fast_input;
	fast_output;
	// ll t;
	// cin>>t;
	// while(t--)
	// {
	  solve();
	// }
	return 0;
}

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

#define ll long long
#define ar array

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	vector<int> a(n);
	for(int &x : a)
		cin >> x;
	ll ans=0;
	for(int i=1; i<n; ++i) {
		if(a[i-1]>a[i])
			ans+=a[i-1]-a[i], a[i]=a[i-1];
	}
	cout << ans << "\n";
}


Measured memory_bytes: 3964
x, n = map(int, input().split())
p = list(map(int, input().split()))

check = 1000000
ans = 0

N = list(range(102))

for i in range(1, 101):
    if i in p:
        N.remove(i)

for i in range(len(N)):
    if check > abs(N[i]-x):
        check = abs(N[i]-x)
        ans = N[i]
print(ans)


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

int main(){
    string s;
    cin >> s;
    bool allDifferent = true;
    for(int j=0; j<s.size();++j){
        for(int i=0; i<s.size();++i){
            if(s[i]==s[j] && i!=j){
                allDifferent = false;
                break;
            }
        }
    }
    if(allDifferent==true) cout << "yes" << endl;
    if(allDifferent==false) cout << "no" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int h,n;
  scanf("%d%d",&h,&n);
  int array[n];
  int sum=0;
  for(int i=0;i<n;i++)
  {
    scanf("%d",&array[i]);
    sum+=array[i];
  }
  if(sum>=h)
    printf("Yes\n");
  else
    printf("No\n");
}

Measured memory_bytes: 512
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <queue>
#include <set>
#include <map>
using namespace std;
int N,R;
int main(){
    int ans;
    cin >> N >> R;
    if ( N < 10){
        ans = R + 100*(10-N);
    } else {
      ans = R;
    }
    cout << ans << endl;
}

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


int main (){
  int n, a;
  cin >> n;
  int ans = 0;
  rep(i, n){
    cin >> a;
    if(i % 2 == 0){
      if(a % 2) ans++;
    }
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3592
import numpy as np
N = int(input())
H = np.array(list(map(int, input().split())))

def f(L):
    if len(L) == 0:
        return 0

    if len(L) <= 2:
        return max(L)

    l = min(L)
    i = np.where(L == l)[0][0]
    return f(L[:i] - l) + f(L[i + 1:] - l) + l

print(f(H))

Measured memory_bytes: 21652
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
const int INF = 0x3f3f3f3f;

int n, q;
int A[25], m[205], flag[25], ans[205];

void find(int i){
	if(i == n){
		int temp = 0;
		for(int j = 0; j < n; j++)
			temp += flag[j] * A[j];
		for(int j = 0; j < q; j++)
			if(m[j] == temp)
				ans[j] = 1;
		return ;
	}
	flag[i] = 0; find(i + 1); flag[i] = 1; find(i + 1);
	return;
}

int main(){
	memset(ans, 0, sizeof(ans));
	cin >> n;
	for(int i = 0; i < n; i++)
		scanf("%d", A + i);
	cin >> q;
	for(int i = 0; i < q; i++)
		cin >> m[i];
	find(0);
	for(int i = 0; i < q; i++){
		if(ans[i])
			printf("yes\n");
		else
			printf("no\n");
	}
	return 0;
}

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

int main(){
    int n, a[100];
    cin >> n;

    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = n-1; i > 0; i--){
        cout << a[i] << " ";
    }
    cout << a[0] << endl;
    return 0;
}

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

const int N=1e5+7;
priority_queue <int >qe;
vector <int > ve[N];
int main()
{
	int n,m,sum=0;
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		int a,b;
		cin>>a>>b;
		if(m-a+1>0) ve[m-a+1].push_back(b);
	}
	for(int i=m;i>=1;i--)
	{
		for(int j=0;j<ve[i].size();j++)
		qe.push(ve[i][j]);
		if(qe.size())
		sum+=qe.top(),qe.pop();
	}
	cout<<sum<<"\n";
}

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

using namespace std;

using ll = long long;

struct Queue : public std::priority_queue<ll> {
    auto begin() { return this->c.begin(); }

    auto end() { return this->c.end(); }
};

int main() {
    ll N, M;
    cin >> N >> M;

    Queue A;

    ll x;
    for (ll i = 0; i < N; ++i) {
        cin >> x;
        A.emplace(x);
    }

    for (ll i = 0; i < M; ++i) {
        x = A.top() / 2;
        A.pop();
        A.emplace(x);
    }

    cout << std::accumulate(A.begin(), A.end(), 0ll) << endl;

    return 0;
}


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

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;

  string ans = "Three";
  for (int i = 0; i < n; ++i) {
    char c;
    cin >> c;
    if (c == 'Y') {
      ans = "Four";
      break;
    }
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)ull
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
#define dame { puts("-1"); return 0;}
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,vector<T>,greater<T> >
#define bn(x) ((1<<x)-1)
#define newline puts("")
#define v(T) vector<T>
#define vv(T) vector<vector<T>>
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}
template<typename T>istream& operator>>(istream&i,vector<T>&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const vector<T>&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,const vector<T>&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;

vi to[MX];

int dfs(int v, int p=-1) {
  int res = 0;
  rep(i,sz(to[v])) {
    int u = to[v][i];
    if (u == p) continue;
    int r = dfs(u,v);
    res ^= r;
  }
  return res+!!v;
}

int main() {
  int n;
  scanf("%d",&n);
  rep(i,n-1) {
    int a,b;
    scanf("%d%d",&a,&b);
    --a; --b;
    to[a].pb(b);
    to[b].pb(a);
  }
  int g = dfs(0);
  string ans = g?"Alice":"Bob";
  cout<<ans<<endl;
  return 0;
}






















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

namespace abc124_a
{
    class Program
    {
        static public int hantei(int x, int y)
        {
            int sum = 0;
            if(x > y && x - 1 > y)
            {
                sum = x + x - 1;
            }
            else if(y > x && y - 1 > x)
            {
                sum = y + y - 1;
            }
            else
            {
                sum = x + y;
            }
            return sum;
        }

        static void Main(string[] args)
        {
            string[] X = Console.ReadLine().Split(' ');
            int A = int.Parse(X[0]);
            int B = int.Parse(X[1]);

            Console.WriteLine(hantei(A, B));
            Console.Read();
        }
    }
}


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

typedef long long ll;
const int mx = 1e5 + 5;

int n;
ll C;
ll X[mx], K[mx + mx];

void input(){
    cin >> n >> C;
    for(int i = 1; i <= n; i++){
        cin >> X[i] >> K[i];
        K[i] += K[i-1];
    }
}

ll cwise(){
    ll ans = 0, cal = 0;
    for(int i = 1; i <= n; i++){
        ans = max(ans, K[i] - X[i]);
    }
    return ans;
}

ll awise(){
    ll ans = 0, cal = 0;
    for(int i = n; i >= 1; i--){
        ans = max(ans, K[n] - K[i-1] + X[i] - C);
    }
    return ans;
}

ll cawise(){
    ll ans = 0, rf = 0;
    for(int i = 1; i <= n; i++){
        ans = max(ans, K[n] - C - K[i-1] + X[i] + rf);
        rf = max(rf, K[i] - 2LL * X[i]);
    }
    return ans;
}

ll acwise(){
    ll ans = 0, rf = 0;
    for(int i = 1; i <= n; i++){
        ans = max(ans, K[n] - 2LL * C - K[i-1] + 2LL * X[i] + rf);
        rf = max(rf, K[i] - X[i]);
    }
    return ans;
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    input();
    cout << max({cwise(), awise(), acwise(), cawise()}) << endl;
}


Measured memory_bytes: 1792
#include<stdio.h>
#define H 500001

int T[H];
int h;

void maxHeapify(int);

int main(){

  int i,j;

  scanf("%d",&h);


  for(i=1;i<=h;i++){
    scanf("%d",&T[i]);
  }
  
  for(j=h/2;j>=1;j--){
    maxHeapify(j);
  }
   

  for(i=1;i<=h;i++){
    printf(" %d",T[i]);
  }
  printf("\n");
  return 0;
}

void maxHeapify(int i){
  int l,r,largest,swap;

  if(h>=2*i)l=2*i; 
  else l=2000000001;  
    
  if(h>=2*i+1) r=2*i+1;
  else r=2000000001;

    if(l<=h && T[l]>T[i]) largest = l;

    else largest = i;

    if(r<=h && T[r]>T[largest]) largest = r;

    if(largest != i) {
       swap = T[i];
       T[i] = T[largest];
       T[largest] = swap;
       maxHeapify(largest);
    }
    else return;

}

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

namespace hoge
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int a = x[0] * x[1];
            if (a % 2 == 0) Console.WriteLine("Even");
            else Console.WriteLine("Odd");
        }
    }
}

Measured memory_bytes: 11348
#include <stdio.h>

using namespace std;
typedef long long llong;

#define MAX 200001

int main()
{
  int N;
  int A[MAX], B[MAX];
  llong K;
  scanf("%d", &N);
  scanf("%lld", &K);

  // 配列の初期化
  for (int i = 0; i < N; i++)
  {
    scanf("%d", &A[i]);
    B[i] = 0;
  }

  // サイクルのスタートを見つける
  // Biがすでに訪れられていたらそれがサイクルのスタート
  llong startIndex = 0;
  llong i = 1;
  while (1)
  {
    if (B[i - 1])
    {
      startIndex = i;
      break;
    }
    B[i - 1] = 1;
    i = A[i - 1];
  }

  // startにいたるまでの手数を見つける
  llong I = 1;
  llong startCnt = 0;
  while (startIndex != I)
  {
    I = A[I - 1];
    startCnt++;
  }

  // サイクルの長さを見つける
  // サイクルの始まりからスタートして戻るまでの回数
  llong cnt = 1;
  while (1)
  {
    i = A[i - 1];
    if (startIndex == i)
    {
      i = startIndex;
      break;
    }
    cnt++;
  }
  if (startCnt > K)
  {
    i = 1;
    for (int j = 0; j < K; j++)
    {
      i = A[i - 1];
    }
    printf("%d\n", i);
    return 0;
  }

  K -= startCnt;
  int mod = K % cnt;

  for (int j = 0; j < mod; j++)
  {
    i = A[i - 1];
  }

  printf("%d", i);

  return 0;
}

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

const int MAX=2e3+10;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> A(n);
    for (int i=0;i<n;++i) cin >> A[i];
    bitset<MAX> cnt;
    int sum;
    for (int bit=0;bit<(1<<n);++bit){
        sum=0;
        for (int i=0;i<n;++i){
            if (bit&1<<i) sum+=A[i];
        }
        if (sum<MAX) cnt.set(sum);
    }
    int m,q; cin >> m;
    for (;m--;){
        cin >> q;
        cout << (cnt.test(q)?"yes":"no") << '\n';
    }
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#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) )
typedef long long ll;
using namespace std;
int main(int argc, char const *argv[]) {
    int a, b;
    cin >> a >> b;
    if (b%a == 0) cout << a+b << endl;
    else cout << b-a << endl;
    return 0;
}

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

int main(){
    int n,k; cin >> n >> k;
    string s; cin >> s;
    char hand='i';
    int su=0;
    vector<int> suc;
    rep(i,s.length()){
        char c; c=s[i];
        if(hand=='i'){
            hand=c;
            su++;
        }
        else{
            if(hand==c) su++;
            else{
                suc.push_back(su);
                hand=c;
                su=1;
            }
        }
        if(i==s.length()-1) suc.push_back(su);
    }
    bool two=false;
    rep(i,k){
        if(suc.size()<=2){
            two=true;
            break;
        }
        else{
            suc[2]=suc[0]+suc[1]+suc[2];
            suc.erase(suc.begin());
            suc.erase(suc.begin());
        }
    }
    int ans=0;
    if(two){
        rep(i,suc.size()) ans+=suc[i];
        cout << ans-1 << endl;
    }
    else{
        rep(i,suc.size()) ans+=suc[i]-1;
        cout << ans << endl;
    }
    return 0;
}

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back



int main(){
    string o,e;
    cin >> o >> e;
    
    for(int i=0;i<e.size();i++){
        cout << o[i] << e[i] ;
    }
    if(o.size()>e.size()){
        cout << o[o.size()-1];
    }
    cout << endl;
    return 0;
}

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

using namespace std;
int main(){
  long long N, P, tmp, j;
  long long ret = 1;
  cin >> N >> P;
  
  if (N == 1) ret = P;
  else{
    long long max_p = ceil(pow(P, 1.0/(double)N));
    for (j=max_p; j >= 1; j--){
        tmp = pow(j, N);
        if (P % tmp == 0) break;
    }
    ret = j;
  }
  cout << ret << endl;
  return 0;
}


Measured memory_bytes: 256
s = str(input())
t = str(input())

dp = [[0]*3100 for _ in range(3100)]
# dp[i+1][j+1]: s[i], t[j]まで見たときのLCSの長さ

for i in range(len(s)):
  for j in range(len(t)):
    if s[i] == t[j]:
      dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j]+1)
    dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j])
    dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j+1])

i = len(s)
j = len(t)
ans = ''
while i>0 and j>0:
  if dp[i][j] == dp[i-1][j]:
    i -= 1
  elif dp[i][j] == dp[i][j-1]:
    j -= 1
  else:
    ans = s[i-1] + ans
    i -= 1
    j -= 1
print(ans)

Measured memory_bytes: 119132
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
using namespace std;


void mtxprd( int p, int q, int r, const ll* A, const ll* B, ll* C )
{
    int i, j, k;
    for(i=0; i<p; i++) {
        for(k=0; k<r; k++) {
            C[i*r+k] = 0;
            for(j=0; j<q; j++) {
                C[i*r+k] = (C[i*r+k] + A[i*q+j] * B[j*r+k])%MOD;
            }
        }
    } 
    return;
}
 
void mtxuni(int dim, ll* mtx){
    int i,j;
    for(i=0; i<dim; i++) {
        for(j=0; j<dim; j++) {
            mtx[i*dim+j]=(i==j? 1: 0);
        }
    }
    return;
}
 
void mtxcpy(int dim, const ll* mtx, ll* mtx2){
    int i,j;
    for(i=0; i<dim; i++) {
        for(j=0; j<dim; j++) {
            mtx2[i*dim+j]=mtx[i*dim+j];
        }
    }
    return;
}
 
void mtxpow(int dim, const ll* mtx, ll n, ll* mtx2){ //x^n(mod M)
    vector<ll> mtx0(dim*dim);
    vector<ll> mtxtmp(dim*dim);
    mtxcpy( dim, mtx, &mtx0[0] );
    mtxuni( dim, mtx2 );
    while(n != 0){        
        if(n&1) {
            mtxprd( dim, dim, dim, mtx2, &mtx0[0], &mtxtmp[0] );
            mtxcpy( dim, &mtxtmp[0], mtx2 );
        }
        mtxprd( dim, dim, dim, &mtx0[0], &mtx0[0], &mtxtmp[0] );
        mtxcpy( dim, &mtxtmp[0], &mtx0[0] );
        n = n >> 1;
    }
    return;
}

int main(int argc, char* argv[])
{
    int n;
    ll  k;
    scanf("%d%lld", &n, &k);

    vector<ll> a(n*n);
    int i,j;
    for(i=0; i<n; i++) {
        for(j=0; j<n; j++) {
            scanf("%lld", &a[i*n+j]);
        }
    }

    vector<ll> b(n*n);
    mtxpow( n, &a[0], k, &b[0] );

    ll sum=0;
    for(i=0; i<n*n; i++) {
        sum = (sum + b[i])%MOD;
    }
    printf("%lld\n", sum);

    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
#define REP(i, a, b) for (int i = (a); i < (b); ++i)

using namespace std;
using ll = long long;

static const string SENTINEL = "";

/**
 * main
 */
int main () {
  ll N; cin >> N;

  // read: O(N)
  vector<string> freq;
  while (N--) {
    char S[11]; scanf("%s", S);

    freq.push_back(string(S));
  }

  // sort: O(NlogN)
  sort(freq.begin(), freq.end());
  freq.push_back(SENTINEL);

  // obtain the max count: O(N)
  string prev = "";
  ll cnt = 0;
  ll m = 0;
  for (auto item : freq) {
    if (prev != item) {
      m = max(m, cnt);
      cnt = 1;
    } else {
      cnt++;
    }

    prev = item;
  }

  // print only items whose count is equal to m: O(N)
  prev = "";
  cnt = 0;
  for (auto item : freq) {
    if (prev != item) {
      if (cnt == m) printf("%s\n", prev.c_str());
      cnt = 1;
    } else {
      cnt++;
    }

    prev = item;
  }
}


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

int main (){
    vector<char> a(3), b(3);
    for (int i=0; i<3; i++){
        cin>>a.at(i);
    }
    for (int i=0; i<3; i++){
        cin>>b.at(i);
    }
    if(a.at(0)==b.at(2)&&a.at(1)==b.at(1)&&a.at(2)==b.at(0)){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD=1000000007;
using namespace std;
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
int main(){
    int n,ma,mb;
    cin>>n>>ma>>mb;
    vector<int> a(n),b(n),c(n);
    rep(i,0,n) cin>>a[i]>>b[i]>>c[i];
    
    auto dp=make_vec<int>(50,500,500);
    rep(i,0,50) rep(j,0,500) rep(k,0,500) dp[i][j][k]=1000000000;
    dp[0][0][0]=0;
    
    rep(i,0,n){
        rep(j,0,500){
            rep(k,0,500){
                if(dp[i][j][k]>=1000000000)  continue;
                dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i]);
                dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k]);
            }
        }
    }
    
    int ans=1000000000;
    rep(j,1,500){
        rep(k,1,500){
            if(j*mb==k*ma) ans=min(ans,dp[n][j][k]);
        }
    }
    
    cout<<(ans!=1000000000 ? ans : -1)<<endl;
    
}


Measured memory_bytes: 51072
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
import bisect
from heapq import heappush, heappop
from scipy.sparse.csgraph import floyd_warshall

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M, L = MAP()
ABC = [LIST() for _ in range(M)]
Q = INT()
st = [LIST() for _ in range(Q)]

graph1 = [[INF]*(N+1) for _ in range(N+1)]
graph2 = [[INF]*(N+1) for _ in range(N+1)]
for i in range(M):
	A, B, C = ABC[i]
	if C <= L:
		graph1[A][B] = C
		graph1[B][A] = C


graph1 = floyd_warshall(graph1, directed=False)

for i in range(N+1):
    for j in range(N+1):
        if graph1[i][j]<=L:
            graph2[i][j]=1

graph2 = floyd_warshall(graph2, directed=False)

for s, t in st:
	if graph2[s][t] == INF:
		print(-1)
	else:
		print(int(graph2[s][t])-1)


Measured memory_bytes: 46512
/*
 * test.cpp
 *
 *
 *      Author: Fireworks
 */

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<string>
#include<map>
#include<cmath>
#include<bitset>
#include<set>
#include<iomanip>
#include<fstream>
#include<bitset>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<list>
#include<sstream>

using namespace std;

typedef pair<int,int> ii;
typedef pair<int,long long> il;
typedef pair<long long,long long> ll;
typedef pair<ll,int> lli;
typedef pair<long long,int> li;
typedef pair<double,double> dd;
typedef pair<ii,int> iii;
typedef pair<double,int> di;
long long mod = 1000000007LL;
long long base = 10000007;
long long large = 1000000000000000000LL;




int main(){

	int n;
	cin>>n;
	vector<int> a(n,0);
	for(int i=0;i<n;i++) cin>>a[i];
	int m ;
	cin>>m;
	vector<int> b(m,0);
	for(int i=0;i<m;i++) cin>>b[i];
	sort(a.begin(),a.end());
	sort(b.begin(),b.end());

	bool flag = true;
	int p = 0;
	for(int i=0;i<m;i++){
		while(p<n&&a[p]<b[i]) p++;
		if(p==n){
			flag = false;
			break;
		}
		if(a[p]!=b[i]){
			flag = false;
			break;
		}
		p++;
	}
	if(flag){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}



	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>

using namespace std;

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;
    int X[N];
    for (int i = 0; i < N; i++)
    {
        cin >> X[i];
    }
    
    sort(X, X + N);

    int min = 1000000;
    for (int i = X[0]; i <= X[N - 1]; i++)
    {
        int sum = 0;
        for (int j : X)
        {
            sum += (j - i) * (j - i);
        }
        if (sum < min)
        {
            min = sum;
        }

    }

    cout << min << endl;
    
    return 0;
}


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

int A, B, C, D, E, F;

int main() {
    cin >> A >> B >> C >> D >> E >> F;
    A *= 100; B *= 100;
    vector<int> sugar(F + 1, -F);//溶かせる砂糖の量の最大値
    sugar[0] = 0;
    pair<int, int> ans = make_pair(A, 0);
    for (int i = A; i <= F; i++) {
        int tmp = (i < B? sugar[i - A]: max(sugar[i - A], sugar[i - B]));
        int s = sugar[i - C] + C;
        if (s * (100 + E) <= E * i) {
            tmp = max(tmp, s);
        }
        s = sugar[i - D] + D;
        if (s * (100 + E) <= E * i) {
            tmp = max(tmp, s);
        }
        sugar[i] = tmp;
        if (ans.second * i  < tmp * ans.first) {
            ans.first = i;
            ans.second = tmp;
        }
    }
    cout << ans.first << " " << ans.second << endl;
}




Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int, char**)
{
	int n, a, b;
	cin >> n >> a >> b;
	long total = 0;
	for (int i = 1; i <= n; ++i)
	{
		auto tmp = i;
		auto sum = 0;
		while (tmp > 0)
		{
			sum += tmp % 10;
			tmp /= 10;
		}
		if (sum >= a && sum <= b)	total += i;
	}
	cout << total << endl;
}


Measured memory_bytes: 256
n=int(input())
def zzz(k,m):
    r=0
    while k:
        r=r+k%m
        k=k//m
    return r
a=99999
for i in range(n+1):
    a=min(a,zzz(i,6)+zzz(n-i,9))
print(a)

Measured memory_bytes: 2940
#include<iostream>
#include<vector>
#include <algorithm>
#include <functional>

using namespace std;

int main() {
    int n=0;
    int t;
    int loop=0;
    bool result = true;
    cin>>n;
    vector<int> l;
    for(int i=0;i<n;i++){
        cin>>t;
        if(t%2==0){
            l.push_back(t);
        }
    }
    loop=l.size();
    for(int i=0;i<loop;i++) {
        if(l.at(i)%3==0 || l.at(i)%5==0){
        }
        else {
            result = false;
        }
    }
    if(result){
        cout<<"APPROVED";
    }
    else {
        cout<<"DENIED";
    }
}   


Measured memory_bytes: 256
///スマホコーディング
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
typedef long long ll;
const int inf=1e9;
int main(){
  int n;cin>>n;
  if(n<1000)cout<<"ABC"<<endl;
  else cout<<"ABD"<<endl;
  return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>
 
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())
 
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18


int main() {

    int L;
    cin>>L;
    cout <<fixed<<std::setprecision(10) <<L*L*L/27.0 << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

m1, d1 = LI()
m2, d2 = LI()
if m1 != m2:
    print(1)
else:
    print(0)

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

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

    int a[n][m], b[m];

    int c[n];
    for(int i=0; i<n; i++) c[i] = 0;

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

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

    for(int i=0; i<n; i++)
    {
        for(int j=0; j<m; j++)
        {
            c[i] += a[i][j] * b[j];
        }
    }

    for(int i=0; i<n; i++) cout << c[i] << endl;

    return 0;
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.000001
#define pi 3.141592653589793
#define pii pair<int,int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti multiset <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define stp setprecision(12)//use fixed before stp
#define endl '\n'
ll e[100009];
void dfs(vll v[],ll q)
{
    e[q]=1;
    for(auto i:v[q])
    {
        if(e[i]==0)
            dfs(v,i);
    }
}
int main()
{  
    FAST
    ll m,k;
    cin>>m>>k;
    ll n=pow(2,m+1);
    ll z=pow(2,m)-1;
    ll a[n];
    if(k>z||(m==1&&k==1))
        cout<<-1;
    else
    {
        cout<<0<<' ';
        if(k!=0)
            cout<<k<<' ';
        cout<<0<<' ';
        for(ll i=1;i<=z;i++)
        {
            if(i!=k)
                cout<<i<<' ';
        }
        if(k!=0)
        cout<<k<<' ';
        for(ll i=z;i>0;i--)
        {
            if(i!=k)
                cout<<i<<' ';
        }
    }
}

Measured memory_bytes: 1792