akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl;
#define mdebug(m) cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;}
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
#define Add(x, y) x = (x + (y)) % mod
#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    string S; cin >> S;
    int N = SZ(S);

    int nr = 0, nl = 0, i0;
    vec ans(N, 0);
    REP(i, N){
        //debug(i0);
        if(S[i] == 'R'){
            nl++;
            if(i < N - 1 && S[i + 1] == 'L'){
                i0 = i;
            }
        }else{
            nr++;
            if(i == N - 1 || S[i + 1] == 'R'){
                ans[i0] = (nl + 1) / 2 + nr / 2;
                ans[i0 + 1] = nl / 2 + (nr + 1) / 2;
                nl = 0, nr = 0;
            }
        }
    }
    REP(i, N) cout << ans[i] << " ";
    cout << endl;

    return 0;
}


Measured memory_bytes: 1488
n, w = map(int, input().split())
v = []
ww = []
for _ in range(n):
    a, b = map(int, input().split())
    v.append(a)
    ww.append(b)

dp = [[-1e9 for _ in range(w+1)] for _ in range(n+1)]
#dp[i][j] = i番目まで見た時、重さjまででできる最大の価値, 0<=i<=n, 0<=j<=w

dp[0] = [0 for _ in range(w+1)]

for i in range(n):
    for j in range(w+1):
        if (j >= ww[i]):#w以下ならww[i]を入れた時とそうでない時で比較
            dp[i+1][j] = max(dp[i][j], dp[i][j-ww[i]] + v[i])
        else:
            dp[i+1][j] = dp[i][j]
print(dp[n][w])


Measured memory_bytes: 26000
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int main() {
	int c[3][3];
	rep(i, 3)rep(j, 3) {
		cin >> c[i][j];
	}
	bool flag = false;
	rep(i, 101)rep(j, 101)rep(k, 101) {
		int a[3], b[3];
		a[0] = i, a[1] = j, a[2] = k;
		b[0] = c[0][0] - a[0], b[1] = c[0][1] - a[0], b[2] = c[0][2] - a[0];
		bool f = true;
		rep(y, 3)rep(x, 3) if (a[y] + b[x] != c[y][x]) f = false;
		if(f) flag = true;
	}
	if(flag) printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
def main():
    N, K = map(int, input().split())
    A_list = list(map(int, input().split()))

    for _ in range(min(K,50)):
        e_list_1 = [0] * N
        l_1 = [0] * N
        v = 0
        for i,a in enumerate(A_list):
            l_1[i] = v 
            e_list_1[min(i + a, N-1)] += 1
            v = v + 1 - e_list_1[i]
        
        e_list_2 = [0] * N
        v = 0
        for _i,a in enumerate(A_list[::-1]):
            i = N-1-_i
            A_list[i] = l_1[i] + v + 1
            e_list_2[max(i-a, 0)] += 1
            v = v + 1 - e_list_2[i]
        
    print(*A_list)
if __name__ == "__main__":
    main()



Measured memory_bytes: 171564
'use strict'

const main = input => {
	const args = input.split('\n').map(arg => arg.split(' '))
	const a = args[0].map(arg => parseInt(arg, 10)).sort((a, b) => b - a)
	console.log(a[0] * 10 + a[1] + a[2])
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


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

int N,M,Q;
int a[55],b[55],c[55],d[55];
int tmp[20];

int solve(int i){
    int ans=0;
    if(i==(N+1)){
        for(int j=0;j<Q;j++){
            if(tmp[b[j]]-tmp[a[j]]==c[j]){
                ans+=d[j];
            }
        }
        return ans;
    }
    for(int v=tmp[i-1];v<=M;v++){
        tmp[i]=v;
        ans=max(ans,solve(i+1));
    }
    return ans;
}

int main(){
    cin >> N >> M >> Q;
    for(int i=0;i<Q;i++){
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }
    tmp[0]=1;
    cout << solve(1) << endl;
}

Measured memory_bytes: 3624
# 減らせるときは減らす
N = int(input())
h = list(map(int, input().split()))

stop_flg = 0
h[0] = h[0]-1
for i in range(N-1):
    if stop_flg == 0:
        if h[i] <= h[i+1]-1:
            h[i+1] = h[i+1]-1
        elif h[i] == h[i+1]:
            continue
        else:
            stop_flg = 1

if stop_flg == 1:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 14628
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define rep(i, s, N) for(ll i{s}; i < N; i++)
#define rem(i, N, s) for(ll i{N}; i > s; i--)
using namespace std;using ll = long long int;using ld = long double;using P = pair<ll,ll>;const int MOD = (int)1e9+7;const string rt = "\n";const string sp = " ";/* 最大公約数 */template<typename T> T gcd(T a, T b){return b != 0 ? gcd(b, a % b) : a;}/* UnionFind */template<typename T> struct UnionFind{vector<T> par;UnionFind(T n) : par(n, -1){}void init(T n){par.assign(n, -1);}T root(T x){if (par[x] < 0) return x;else return par[x] = root(par[x]);}bool issame(T x, T y){return root(x) == root(y);}bool merge(T x, T y){x = root(x); y = root(y);if(x == y) return false;if(par[x] > par[y]) swap(x, y);par[x] += par[y];par[y] = x;return true;}int size(int x) {return -par[root(x)];}};/* コンビネーション */template<typename T> ll combpm(T N_, T C_) {const int NUM_=400001;static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];if (fact[0]==0) {inv[1]=fact[0]=factr[0]=1;for (int i=2;i<=NUM_;++i) inv[i] = inv[MOD % i] * (MOD - MOD / i) % MOD;for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%MOD, factr[i]=factr[i-1]*inv[i]%MOD;}if(C_<0 || C_>N_) return 0;return factr[C_]*fact[N_]%MOD*factr[N_-C_]%MOD;}/* 多次元ベクター */template<class T>vector<T> mvec(size_t a){return vector<T>(a);}template<class T, class... Ts>auto mvec(size_t a, Ts... ts){return vector<decltype(mvec<T>(ts...))>(a, mvec<T>(ts...));}/* テスト関数 */void test(ll n){cout << "test" << n << endl;}/* 小数点以下 */void fixsp(ll n){cout << fixed << setprecision(n);}void defsp(ll n){cout << defaultfloat << setprecision(n);}/* 重み付きUnionFind */struct WUnionFind {vector<int> par;vector<int> rank;WUnionFind(int n = 1) {init(n);}void init(int n = 1) {par.resize(n); rank.resize(n);for (int i = 0; i < n; ++i) par[i] = i, rank[i] = 0;}int root(int x) {if (par[x] == x) {return x;}else {int r = root(par[x]);return par[x] = r;}}bool issame(int x, int y) {return root(x) == root(y);}bool merge(int x, int y) {x = root(x); y = root(y);if (x == y) return false;if (rank[x] < rank[y]) swap(x, y);if (rank[x] == rank[y]) ++rank[x];par[y] = x;return true;}};/* IO高速化 */void fastio(){ios::sync_with_stdio(false);cin.tie(NULL);}
/* ここからコード開始 */

int main(){
  fastio;
  ll H, W, K;
  cin >> H >> W >> K;
  auto DP = mvec<ll>(H+1,W);
  DP[0][0] = 1;
  auto fib = mvec<ll>(8);
  fib[0] = 1;
  fib[1] = 1;
  fib[2] = 2;
  fib[3] = 3;
  fib[4] = 5;
  fib[5] = 8;
  fib[6] = 13;
  fib[7] = 21;
  rep(h, 1, H+1){
    rep(w, 0, W){
      if(w != 0){
        DP[h][w-1] += DP[h-1][w] * fib[W-w-1] * fib[w-1];
        DP[h][w-1] %= MOD;
      }
      if(w != W-1){
        DP[h][w+1] += DP[h-1][w] * fib[W-w-2] * fib[w];
        DP[h][w+1] %= MOD;
      }
      DP[h][w] += DP[h-1][w] * fib[W-w-1] * fib[w];
      DP[h][w] %= MOD;
    }
  }
  // for(auto&& i : DP){
  //   for(auto&& j : i){
  //     cout << j << sp;
  //   }
  //   cout << rt;
  // }
  cout << DP[H][K-1] << rt;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    int gcd_all;
    rep(i, n) {
        cin >> a[i];
        if (i == 0) {
            gcd_all = a[i];
        }
        else {
            gcd_all = gcd(gcd_all, a[i]);
        }
    }
    vector<int> v(1e6+1, 0);
    v[1] = 1;
    for (int i = 2; i <= 1e6; ++i) {
        if (v[i] == 0) {
            int idx = i;
            while(idx <= 1e6) {
                v[idx] = i;
                idx += i;
            }
        }
    }
    set<int> st;
    bool ok = true;
    rep(i, n) {
        int tmp = a[i];
        set<int> tmp_st;
        while(1) {
            if (tmp == 1) break;
            tmp_st.insert(v[tmp]);
            tmp /= v[tmp];
        }
        for (auto tt: tmp_st) {
            if (st.count(tt)) {
                ok = false;
                break;
            }
            st.insert(tt);
        }
        if (!ok) {
            //for (auto ss: st) {
            //    cout << ss << " ";
            //}
            //cout << endl;
            if (gcd_all == 1) {
                cout << "setwise coprime" << endl;
                return 0;
            }
            else {
                cout << "not coprime" << endl;
                return 0;
            }
        }
    }
    cout << "pairwise coprime" << endl;
    return 0;
}


Measured memory_bytes: 11192
import Data.List

ibsearch :: (Int -> Bool) -> (Int,Int) -> Int
ibsearch f (ok,ng) = if abs (ok-ng) <= 1 then ok else let mid = (ok + ng) `div` 2 in ibsearch f (if f mid then (mid,ng) else (ok,mid))

f a b = sum $ map abs $ zipWith (-) a [b+1..]

diff a b = f a (b+1) - f a b

calc a = let b = ibsearch ((>=0) . diff a) (maximum a, minimum a - length a - 1) in min (f a b) (f a (b+1))

main = getLine >> getLine >>= print . calc . map read . words


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

int main(){
    int n, d, i, j, k, count = 0;
    cin >> n >> d;
    double x[n][d];
    for(i=0; i<n; i++){
        for(j=0; j<d; j++){
            cin >> x[i][j];
        }
    }
    for(i=0; i<n; i++){
        for(j=i+1; j<n; j++){
            double distance = 0;
            for(k=0; k<d; k++){
                distance += (x[i][k] - x[j][k])*(x[i][k] - x[j][k]);
            }
            if(sqrt(distance) == (int)sqrt(distance)) count++;
        }
    }
    cout << count;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
const Int MOD = 1e9+7;
Int n;
string s[55];
Int dp[55][55][22][33];
Int check(Int u,Int d,Int k,Int c){
  for(Int i=u;i<d;i++)
    if(!(s[i][k]=='?'||s[i][k]=='a'+c)) return 0;
  return 1;
}

Int dfs(Int u,Int d,Int k,Int a){
  Int &res=dp[u][d][k][a];
  if(~res) return res;
  res=0;
  
  if(u+1==d&&k==(Int)s[u].size())
    return res=1;

  if(k==(Int)s[u].size()&&k<(Int)s[u+1].size())
    return res=dfs(u+1,d,k,0);

  for(Int i=u;i<d;i++)
    if(k>=(Int)s[i].size())
      return res=0;

  Int q=check(u,d,k,'?'-'a');
  
  for(Int c=a;c<26;c++)
    if(q||check(u,d,k,c)){
      (res+=dfs(u,d,k+1,0))%=MOD;
      if(!q) break;
    }

  q=s[u][k]=='?';
  for(Int i=u+1;i<d;i++){
    for(Int c=a;c<26;c++){
      if(q||check(u,i,k,c)){
	(res+=dfs(u,i,k+1,0)*dfs(i,d,k,c+1)%MOD)%=MOD;
	if(!q) break;
      }  
    }
    q&=s[i][k]=='?';
  }

  //if(res) cout<<u<<" "<<d<<" "<<k<<" "<<a<<":"<<res<<endl;
  return res;
}

signed main(){
  cin>>n;
  for(Int i=0;i<n;i++) cin>>s[i];
  memset(dp,-1,sizeof(dp));
  cout<<dfs(0,n,0,0)<<endl;
  return 0;
}



Measured memory_bytes: 20336
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        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); }

        static long Solve(int N, long K, long[] A)
        {
            long[] counts = new long[62];
            foreach (long a in A)
            {
                for (int i = 0; i < 62; ++i)
                {
                    if ((a & (1L << i)) != 0) { ++counts[i]; }
                }
            }
            long sum = 0;
            bool free = false;
            for (int i = 61; i >= 0; --i)
            {
                if (free)
                {
                    sum += Math.Max(counts[i], N - counts[i]) << i;
                }
                else if ((K & (1L << i)) == 0)
                {
                    sum += counts[i] << i;
                }
                else if (counts[i] >= N - counts[i])
                {
                    sum += counts[i] << i;
                    free = true;
                }
                else
                {
                    sum += (N - counts[i]) << i;
                }
            }
            return sum;
        }

        static void Main(string[] args)
        {
            long[] V = ReadLongs();
            long[] A = ReadLongs();
            Console.WriteLine(Solve((int)V[0], V[1], A));
        }
    }
}


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

#define FAST_IO                       \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" << " = " << a[i] << endl;

using namespace std;

using ll = long long;

const ll MOD = 1e9 + 7;
const ll INF = 1e9 + 9;

ll powmod(ll a, ll b) { ll res = 1; a %= MOD; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a % MOD; a = a * a % MOD; }return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }


int n;
int a[101];

int main()
{
	
	FAST_IO;
	ll n;
	cin >> n;
	ll sum = 0;
	for (int i = 1; i <= n; ++i) {
		if (i % 3 != 0 && i % 5 != 0) {
			sum += i;
		}
	}
	cout << sum;
	return 0;
}


Measured memory_bytes: 3640
#include <iostream>
#include <list>
#include <vector>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ITER(it,v) for(auto it=v.begin();it!=v.end();++it)
#define IN(v) if (scanf("%d", &v)<1);
#define OUT(v) printf("%d\n", v)

int main() {
  int N; IN(N);
  list<int> B;
  int ans[N];

  REP(i, N) {
    int b;
    IN(b);
    B.push_back(b);
  }
  REP(k, N) {
    auto last_it = B.end();
    int i = 1, last_i = 0;
    ITER(it, B) {
      if (*it == i) {
        last_it = it;
        last_i = i;
      }
      ++i;
    }
    if (last_it == B.end()) {
      OUT(-1);
      return 0;
    }
    ans[N-k-1] = last_i;
    B.erase(last_it);
  }
  REP(k, N) {
    OUT(ans[k]);
  }

  return 0;
}


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b?gcd(b,a%b):a;} //最小公倍数
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n,m,a,b,c,d,x,y,z;
  string s,t;
  //

  // ここから
  IN3(x,y,z);
  OUT((x+y)*z/2);
}

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

#define forn(i, a, b) for (int i = a; i <= b; ++i)
#define forr(i, a, b) for (int i = a; i >= b; --i)

using namespace std;

const int N = (int)3e5 + 1;
const int INF = 1e9 + 7;

typedef long long ll;
typedef long double ld;

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

int n, used[201][201], x[N], y[N], c[N], d[N];
vector < pii > g[201][201];
pii mt[201][201];

bool khun (int x, int y){
  if (used[x][y]) return 0;
  used[x][y] = 1;
  forn (i, 0, (int)g[x][y].size() - 1){
    int tox = g[x][y][i].first, toy = g[x][y][i].second;
    if (mt[tox][toy].first == -1 || khun(mt[tox][toy].first, mt[tox][toy].second)){
      mt[tox][toy] = {x, y};
      return 1;
    }
  }
  return 0;
}

int main (){
  scanf ("%d", &n);
  forn (i, 1, n){
    scanf ("%d %d", x + i, y + i);
  }
  forn (i, 1, n){
    scanf ("%d %d", c + i, d + i);
    mt[c[i]][d[i]].first = -1;
    mt[c[i]][d[i]].second = -1;
  }
  forn (i, 1, n){
    forn (j, 1, n){
      if (x[i] < c[j] && y[i] < d[j]){
        g[x[i]][y[i]].push_back({c[j], d[j]});
      }
    }
  }
  forn (i, 1, n){
    memset (used, 0, sizeof(used));
    khun(x[i], y[i]);
  }
  int ans = 0;
  forn (i, 1, n){
    if(mt[c[i]][d[i]].first != -1) ans++;
  }
  printf ("%d\n", ans);
  return 0;
}


Measured memory_bytes: 3712
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

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

const int MX=1000006;
int a[MX],b[MX];

int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        b[a[i]]++;
    }
    int ans=0;
    for(int i=0;i<n;i++){
        int z=1;
        for(int x=1;x*x<=a[i];x++){
            int y=a[i]/x;
            if(x*y==a[i]){
                if(x==a[i]){
                    if(b[x]>1) z=0;
                }
                else{
                    if(b[x]) z=0;
                }
                if(y==a[i]){
                    if(b[y]>1) z=0;
                }
                else{
                    if(b[y]) z=0;
                }
                if(z==0) break;
            }
        }
        ans+=z;
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 8304
#include <iostream>

using namespace std;

typedef long long signed int ll;

constexpr ll NIL = -20000000000;

ll a[20000000] ={NIL};
int h;

ll rk(int n) {
    if(n*2+1 <= h) return a[n*2+1];
    return NIL;
}
ll lk(int n) {
    if(n*2 <= h) return a[n*2];
    return NIL;
}
ll pk(int n) {
    if(n/2 <= h) return a[n/2];
    return NIL;
}

void print(int n){
    cout << "node " << n << ": key = " << a[n] << ", ";
    pk(n);lk(n);rk(n);
    cout << endl;
}

void heaplify(int n) {
    int l = n;
    if(a[l] < rk(n)) l = n*2+1;
    if(a[l] < lk(n)) l = n*2;
    if(l != n){
        swap(a[l],a[n]);
        heaplify(l);
    }
}

void ins(int v) {
    a[h] = v;
    int d = h;
    h++;
    while(pk(d) < a[d]){
        swap(a[d/2],a[d]);
        d = d / 2;
    }
}

ll ext() {
    ll res = a[1];
    h--;
    a[1] = a[h];
    a[h] = NIL;
    heaplify(1);
    return res;
}

int main() {
    h = 1;
    a[0] = -NIL;
    string s;
    int t;
    while(!cin.eof()) {
        cin >> s;
        if(s == "extract") cout << ext() << endl;
        else {
            cin >> t;
            ins(t);
        }
    }
    return 0;
}


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

int main() {
  int N, a, b;
  cin >> N;
  vector<int> vec(N);  //vec {0, 0}
  
  for (int i = 0; i < N; i++)
    cin >> vec.at(i);  //vec {3, 1}
  
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  
  for (int i = 0; i < vec.size(); i++) {
    if (i % 2 == 0)
      a += vec.at(i);
    
    else
      b += vec.at(i); 
  }
    
    int MAX = max(a, b);
    int MIN = min(a, b);
    
    cout << MAX - MIN << endl;
 
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int a[26]={};
	for(int i=0;i<s.size();i++){
		a[s[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		if(a[i]>=2){
			cout<<"no"<<endl;
			return 0;
		}
	}
	cout<<"yes"<<endl;
}


Measured memory_bytes: 256
X, K, D = input().split(' ')
X, K, D = int(X), int(K), int(D)

x = X

if abs(int(X/D)) >= K:
    if 0 < x:
        print(abs(X-(K*D)))
    elif x < 0:
        print(abs(X+(K*D)))
    else:
        print(0)
    
else:
    if 0 < x:
        x -= (abs(int(X/D)))*D
        if (K-abs(int(X/D))) % 2:
            print(abs(x-D))
        else:
            print(abs(x))
    elif x < 0:
        x += (abs(int(X/D)))*D
        if (K-abs(int(X/D))) % 2:
            print(abs(x+D))
        else:
            print(abs(x))
    elif K % 2:
        print(abs(D))
    else:
        print(0)

Measured memory_bytes: 9224
#include <stdio.h>  
#include <algorithm>  
#include <assert.h>
#include <bitset>
#include <cmath>  
#include <complex>  
#include <deque>  
#include <functional>  
#include <iostream>  
#include <limits.h>  
#include <map>  
#include <math.h>  
#include <queue>  
#include <deque>
#include <set>  
#include <stdlib.h>  
#include <string.h>  
#include <string>  
#include <time.h>  
#include <unordered_map>  
#include <unordered_set>  
#include <vector>  
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}


#define INF 1e9+7
#define LLINF 1e18+7
#define N 250000

vector<vector<pii>> mempar;
vector<vector<pii>> memsize;

int turn=0;

struct UnionFind{
    vector<int> par,sizes;
    UnionFind(int n):par(n+1),sizes(n+1,1){
        rep2(i,1,n)par[i]=i;
    }
    int find(int x){
        if(x==par[x])return x;
        else{
            int res=find(par[x]);
            par[x]=res;
            mempar[x].pb({turn,res});
            return res;
        }
        // return (x==par[x]?x:par[x]=find(par[x]));
    }
    void unite(int x,int y){
        x=find(x);y=find(y);
        if(x==y)return ;
        if(sizes[x]<sizes[y]){
            swap(x,y);
        }
        par[y]=x;
        mempar[y].pb(pii{turn,x});
        sizes[x]+=sizes[y];
        memsize[x].pb(pii{turn,sizes[x]});
    }
    bool same(int x,int y) {return (find(x)==find(y));}
    int size(int x) {return sizes[find(x)];}
};


main(){
    ll n,x;
    cin>>n>>x;
    vecll a;
    rep(i,n)a.pb(in());
    ll ans=LLINF;
    rep(i,n){
        int k=i+1;
        deque<pii> dq;
        rep2(j,n-k,n-1){
            while(!dq.empty()&&dq.back().second>a[j]){
                dq.pop_back();
            }
            dq.push_back({j,a[j]});
        }
        ll tmp=i*x;
        rep(j,n){
            while(!dq.empty()&&dq.back().second>a[j]){
                dq.pop_back();
            }
            dq.push_back({j,a[j]});
            if(dq.front().first==(n+j-k)%n)dq.pop_front();
            tmp+=dq.front().second;
        }
        ans=min(ans,tmp);
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void debug_out() { cerr << endl; }
template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}
template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }
template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }
template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.first << ' ' << p.second << ')'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"
#define ll long long
#define ld long double
#define ull unsigned long long
#define pii pair<int,int>
#define MOD 1000000007
#define zeros(x) x&(x-1)^x
#define fi first
#define se second
#define NMAX 100005
const long double PI = acos(-1);

int uz[2][NMAX],a,b,n,q,pos;
unordered_set<int> L, R, Lp, Rp, S;

int main(){
  ios::sync_with_stdio(false);
  cin >> n >> q;
  pos = 1;
  S.insert(2);
  int nimic = 0, nimeni = 0;
  for (int i=1;i<=q;i++){
    cin >> a >> b;
    
    if (S.count(a) && S.count(b)){
        nimic = nimeni;
    }
    else if (S.count(a)){
      S.erase(a);
      S.insert(b);
    }
    else if (S.count(b)){
      S.erase(b);
      S.insert(a);
    }

    if (pos == a){
      pos = b;
    }
    else if (pos == b){
      pos = a;
    }

    if (pos - 1 > 0){
      S.insert(pos - 1);
    }
    if (pos + 1 <= n){
      S.insert(pos+1);
    }

  }

  S.insert(pos);

  cout << S.size() << '\n';

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <limits>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif
using ll = unsigned long long;
using vll = std::vector<ll>;
using vvll = std::vector<vll>;
using vvvll = std::vector<vvll>;
#define reps(i, S, E) for (ll i = (S); i <= (E); i++)
#define rep(i, N) reps(i, 0, N-1)
#define deps(i, E, S) for (ll i = (E); i >= (S); i--)
#define dep(i, N) deps(i, N-1, 0)
const ll INF = 1LL << 60;
const int INF_INT = 1 << 30;

template<class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; }return false; }
struct Fast {
	Fast() {
		cin.tie(0);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(std::numeric_limits<double>::max_digits10);
	}
} fast; //cin,cout高速化のおまじない＋桁数指定


void solve()
{
	ll N;
	cin >> N;
	vector<ll> A(N);
	rep(i, N) {
		cin >> A[i];
		if (A[i] == 0) {
			cout << 0 << endl;
			return;
		}
	}

	unsigned long long result = 1;
	rep(i, N) {
		unsigned long long temp = (A[i] + (unsigned long long)1000000000000000000 - 1);
		temp /= A[i];
		if (result > temp) {
			cout << -1 << endl;
			return;
		}
		else {
			result *= A[i];
			if (result > (unsigned long long)1000000000000000000) {
				cout << -1 << endl;
				return;
			}
		}
	}

	cout << result << endl;
}

int main() {
#if TEST && LOCAL
	ll t; cin >> t;
	rep(i, t) { solve(); }
#else
	solve();
#endif
	return 0;
}


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

using namespace std;

signed main(){

    
    string A,B;
    cin >> A;
    cin >> B;
    int answer = 0;
    for (int i = 0; i < 3; i++) {
        if(A[i] == B[i]){
            answer ++;
        }
    }
    cout << answer;

 
    return 0;

 }


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <iomanip>
#include <bitset>
#include <set>
#include <map>
#include <stdio.h>
#include <numeric>
#include <cstring>

#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i < (n); i++)
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define MOD 1000000007 //10^9+7
using namespace std;
using ll = long long;
using PII = pair<int, int>;
const int INF = numeric_limits<int>::max();

// 負の数にも対応した % 演算
long long mod(long long val, long long m) {
    long long res = val % m;
    if (res < 0) res += m;
    return res;
}

//greatest common divisor
long long gcd(ll a, ll b) 
{
    if (a % b == 0) {
        return b;
    } else {
        return gcd(b, a % b);
    }
}

//least common multiple
long long lcm(ll a, ll b)
{
    return a / gcd(a, b) * b ;
}

int main()
{
    ll n, m, k, tmp; cin >> n >> m >> k;
    ll ans = 0;
    vector<ll> a(n);
    vector<ll> b(m);
    rep(i,n) {
        cin >> a[i];
    }
    rep(i,m) {
        cin >> b[i];
    }
    ll time = 0;
    rep(i,m) time += b[i];

    ll j = m;
    rep(i,n+1) {
        while (j > 0 && time > k) {
            j--;
            time -= b[j];
        }
        if (time > k) 
            break;
        ans = max(ans, i + j);
        if (i == n)
            break;
        time += a[i];
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 6392
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const int INF = pow(10, 7);

int main(){
  int m, d;cin>>m>>d;
  int ans=0;
  for(int i=1;i<=m;i++){
  	for(int j=1;j<=d;j++){
      int d1 = j%10;
      int d2 = (j%100)/10;
      if(d1<2 || d2<2)continue;
      if(d1 * d2 == i)ans++;
    }
  }
  cout<<ans<<endl;
}

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

#define N 1000
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
#define fastio ios::sync_with_stdio(false); cin.tie(0)

int main(){
    fastio;
    // #ifndef ONLINE_JUDGE
    //     freopen("input.in", "r", stdin);
    //     freopen("output.out", "w", stdout);
    // #endif
    int n, k;
    string s;

    cin >> n >> k;
    cin >> s;
    s[k-1] = tolower(s[k-1]);

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {
        int n = sc.nextInt();
        long[] arr = new long[n];
        for (int i=0; i<n; i++) arr[i] = sc.nextLong();

        long max = 0;

        int cnt = n / 2;
        long[][] dp = new long[cnt+1][3];

        for (int i=1; i<=cnt; i++) {
            dp[i][0] = dp[i-1][0] + arr[2*i-2];
        }

        max = dp[cnt][0];

        for (int i=1; i<=cnt; i++) {
            dp[i][1] = Math.max( (dp[i-1][1]+arr[2*i-1]) , (dp[i-1][0]+arr[2*i-1]) );
        }

        max = Math.max(max, dp[cnt][1]);

        if ((n % 2) == 1) {
            for (int i=1; i<=cnt; i++) {
                dp[i][2] = Math.max((dp[i-1][2]+arr[2*i]), (
                        Math.max((dp[i-1][0]+arr[2*i]), (dp[i-1][1]+arr[2*i]))
                        ));
            }
            max = Math.max(max, dp[cnt][2]);
        }

        System.out.println(max);

    }

}


Measured memory_bytes: 62948
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;



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

	int n;
	cin >> n;
	cout << (n-2)*180 << "\n";

	return 0;
}



Measured memory_bytes: 256
import numpy as np
N,D=map(int,input().split())

X=[0]*N
for i in range(0,N):
  X[i]=list(map(int,input().split()))

count=0
for i in range(0,N):
  for j in range(i+1,N):
    Dist=0
    for k in range(0,D):
      Dist=Dist+(X[i][k]-X[j][k])**2
    mod=np.sqrt(Dist)%1
    if mod==0:
      count=count+1

print(count)


Measured memory_bytes: 12396
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <tuple>
#include <utility>
#include <vector>
#define ll long long
#define itn int
#define endl '\n'
#define co(ans) cout<<ans<<endl
#define COYE cout<<"YES"<<endl
#define COYe cout<<"Yes"<<endl
#define COye cout<<"yes"<<endl
#define CONO cout<<"NO"<<endl
#define CONo cout<<"No"<<endl
#define COno cout<<"no"<<endl
#define FORE(i,a) for(auto &i:a)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define PB push_back
#define MP make_pair
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define EACH(V,i) for(typeof((V).begin()) i=(V).begin();i!=(V).end();++i)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define INF ((1LL<<62)-(1LL<<31))
#define EPS 1e-10
#define PI 3.141592653589793238
#define MOD 1000000007
#define MAX 5100000
using namespace std;
using Edge=pair<int,int>;
using Graph=vector<vector<int>>;
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();}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll N,ans=0;
  cin>>N;
  ll ANS[100001];
  REP(i,100001) ANS[i]=0;
  
  for(int x=1; x<=100; ++x){
    for(int y=1; y<=100; ++y){
      for(int z=1; z<=100; ++z){
        ANS[x*x+y*y+z*z+x*y+y*z+z*x]++;
      }
    }
  }  
  
  RREP(i,N) co(ANS[i]);
  return 0;
}

Measured memory_bytes: 4308
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
#include<numeric>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef pair<int, int>P;
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
typedef vector<vector<ll>> mat;
typedef vector<int> vec;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
const ll mod = 1000000007;
const ll INF = mod * mod;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//int qp(int a,ll b){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll qp(ll a,ll b,int mo){int ans=1;do{if(b&1)ans=1ll*ans*a%mo;a=1ll*a*a%mo;}while(b>>=1);return ans;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };

void solve() {
    ll a, b;
    cin  >> a >> b;

    cout << 6/a/b << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout << fixed << setprecision(10);
    solve();
    // stop
        return 0;
}

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

using namespace std;

int main(){
	string s,front,back;
	cin >> s;
	int l = s.length();
	for(int i=0;i<l;++i){
		if(i < l/2)front += s[i];
		else if(i == l/2 && l%2 == 1)continue;
		else back += s[i];
	}
	reverse(back.begin(),back.end());
	int ll = back.length(),res=0;
	for(int i=0;i<ll;++i){
		if(front[i] != back[i])res++;
	}
	cout << res << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int ans1 = 0, ans2 = 0;
    long long x;
    
    scanf("%lld", &x);
    
    ans1 = (x / 500) * 1000;
    ans2 = (x % 500)/5*5;
    
    printf("%d\n", ans1 + ans2);
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
#ifdef __DEBUG__
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 1,-1, 1,-1};
int dy[]={0, 1, 0, -1, 1, 1,-1,-1};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const map<T, S> p) { for (auto el : p) cout << "[" << el.first << ";" << el.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const deque<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const set<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int x,y;
void input(){
    fast_io();
    cin >> x >> y;
}
#define YES do{cout << "Yes" << endl;return 0;} while (false);
#define NO do{cout << "No" << endl;return 0;} while (false);

int solve(){
    for (int i = 0; i <= x; i++)
    {
        int j = x-i;
        int k = 2*i+4*j;
        if(y==k) YES
    }
    NO
    return 0;
}   

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

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define VMAX 50
#define EMAX 500
#define DMAX 20
#define TRUE 1
#define FALSE 0
#define NOTUSED 0
#define END -1
#define ROOT -1

// グラフの隣接頂点リスト表現
struct GraphAV{
    int p;  // 頂点数
    int q;  // 辺数
    // int AV[VMAX][DMAX]; 
    vector<vector<int>> AV;  // 隣接頂点リスト
};

GraphAV G;
// int d[VMAX],f[VMAX];
// bool seen[VMAX];
vector<int> d(VMAX);
vector<int> f(VMAX);
vector<bool> seen(VMAX);
int t=1;
void DFS(int v,int& t);

int main(){
    cin>>G.p;

    d.resize(G.p+1);
    f.resize(G.p+1);
    G.AV.resize(G.p+1);
    seen.resize(G.p+1);
    G.AV[0]={NOTUSED};
    d[0]=NOTUSED;
    
    for(int i=1; i<=G.p; i++){
        int u,k;
        cin>>u>>k;
        G.AV[u].resize(k);
        for(int j=0; j<k; j++){
            cin>>G.AV[u][j];
        }
    }

    for(int i=1; i<=G.p; i++){
        if(seen[i]){
            continue;
        }
        DFS(i,t);
    }

    for(int i=1; i<=G.p; i++){
        cout<<i<<" "<<d[i]<<" "<<f[i]<<endl;
    }
}

void DFS(int v,int& t){
    d[v]=t++;

    seen[v]=true;
    // v から行ける各頂点 adj_v について
    for(int adj_v:G.AV[v]){
        if(seen[adj_v]) continue; // adj_v が探索済なら何もしない
        DFS(adj_v,t);  // 再帰的に探索
    }

    f[v]=t++;
}


Measured memory_bytes: 3080
/* You can't hack me! */
#pragma warning(disable : 4996)
#include"bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<char> vch;
typedef set<ll> sll;
#define fo(i,n) for(ll i=0; i<(n); i++)
#define FO(i,a,b) for(auto i=(a); i!=(b); i+=(b)>(a)?1:-1)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(c) c.begin(), c.end()
#define sc scanf
#define pr printf
#define in(x) sc("%lld", &(x))
#define id(x) sc("%Lf", &(x))
#define os(x) cout<<(x)<<' '
#define on(x) cout<<(x)<<'\n'
#define nl cout<<"\n"
#define fi first
#define se second
//const ll P = 998244353;
//const ll N = 200010;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    ll t = 1;
    //cin>>(t);
    while (t--)
    {
        string s;
        cin>>s;
        if(s[1]=='B') s[1]='R';
        else s[1]='B';
        cout<<s<<"\n";
    }
    cerr << "Time : " << ((double)clock()) / (double)CLOCKS_PER_SEC << "s\n";
    return 0;
}

Measured memory_bytes: 3792
#include <iostream>
using namespace std;
int main() {
	int N;
	float x[15];
	string u[15];
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> x[i] >> u[i];
	}

	float total;
	for (int j = 0; j < N; ++j) {
		if(u[j][0] == 'B') {
			total += 380000.0 * x[j];
		}else{
			total += x[j];
		}
	}

	std::cout << total << std::endl;
	return 0;

}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().rstrip()
def dfs(s,mxs):
    if len(s)==n:
        print(s)
    else:
        for i in range(ord('a'),ord(mxs)+1):
            dfs(s+chr(i),chr(i+1) if i ==ord(mxs) else mxs)

def main():
    global n
    n=int(input())
    dfs('','a')
    

if __name__=='__main__':
    main()

Measured memory_bytes: 57304
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
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;}


struct FastIO{
  FastIO(){
    cin.tie(0);
    ios::sync_with_stdio(0);
  }
}fastio_beet;


template<typename R, size_t N>
struct SquareMatrix{
  typedef array<R, N> arr;
  typedef array<arr, N> mat;
  mat dat;

  SquareMatrix(){
    for(size_t i=0;i<N;i++)
      for(size_t j=0;j<N;j++)
        dat[i][j]=R::add_identity();
  }

  bool operator==(const SquareMatrix& a) const{
    return dat==a.dat;
  }

  size_t size() const{return N;}
  arr& operator[](size_t k){return dat[k];}
  const arr& operator[](size_t k) const {return dat[k];}

  static SquareMatrix add_identity(){return SquareMatrix();}
  static SquareMatrix mul_identity(){
    SquareMatrix res;
    for(size_t i=0;i<N;i++) res[i][i]=R::mul_identity();
    return res;
  }

  SquareMatrix operator*(const SquareMatrix &B) const{
    SquareMatrix res;
    for(size_t i=0;i<N;i++)
      for(size_t j=0;j<N;j++)
        for(size_t k=0;k<N;k++)
          res[i][j]=res[i][j]+(dat[i][k]*B[k][j]);
    return res;
  }

  SquareMatrix operator+(const SquareMatrix &B) const{
    SquareMatrix res;
    for(size_t i=0;i<N;i++)
      for(size_t j=0;j<N;j++)
        res[i][j]=dat[i][j]+B[i][j];
    return res;
  }

  SquareMatrix pow(long long n) const{
    SquareMatrix a=*this,res=mul_identity();
    while(n){
      if(n&1) res=res*a;
      a=a*a;
      n>>=1;
    }
    return res;
  }
};

//INSERT ABOVE HERE
struct Z{
  Int v;
  Z():v(0){}
  Z(Int v):v(v){}
  static Z add_identity(){return 0;}
  static Z mul_identity(){return 1;}
  Z operator+(Z a)const{return Z(v+a.v);};
  Z operator*(Z a)const{return Z(v*a.v);};
};

signed main(){
  using SM = SquareMatrix<Z, 2>;
  Int n,a,b;
  cin>>n>>a>>b;

  SM X,Y;
  X[0][0]=Z(1);X[0][1]=Z(-1);
  X[1][0]=Z(0);X[1][1]=Z(+1);

  Y[0][0]=Z(1);Y[0][1]=Z(0);
  Y[1][0]=Z(1);Y[1][1]=Z(1);

  SM A=(Y*X).pow(n/2);
  if(n&1) A=X*A;

  Int p=A[0][0].v*a+A[0][1].v*b;
  Int q=A[1][0].v*a+A[1][1].v*b;

  cout<<p<<" "<<q<<endl;
  return 0;
}



Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
typedef long long ll;
typedef pair<int,int> p;
const ll mod=998244353;
const ll linf=1ll<<60;
const int inf=1<<30;




int main(){
    int n,k;cin >> n >> k;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int h;cin >> h;
        if(h>=k) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

#include <vector>

using namespace std;

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

	int N;
	cin >> N;

	vector<long long> a_list(N + 1, 0);

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

	for (int i = 0; i < N; i++)
	{
		a_list[i + 1] += a_list[i];
	}

	long long result = a_list[N];
	for (int i = 0; i < N; i++)
	{
		long long left = a_list[N] - a_list[i];
		result = min(result, abs(left - a_list[i]));
	}

	cout << result;

	return 0;
}


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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

char c;

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

    std::cin >> c;

    char d;

    if(c == 'A'){
        d = 'T';
    }else if(c == 'T'){
        d = 'A';
    }else if(c == 'C'){
        d = 'G';
    }else{
        d = 'C';
    }

    std::cout << d << std::endl;
}


Measured memory_bytes: 256