akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aryssoncf
 */



// Taken from: https://github.com/bqi343/USACO/blob/master/Implementations/content/contest/templateShort.cpp

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ull> vul;
typedef vector<ll> vl;
typedef vector<pii> vpii;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) FOR(i,0,a)
#define ROF(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i, a) ROF(i,0,a)
#define trav(a, x) for (auto& a: x)

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

#define mp make_pair
#define pb push_back
#define f first
#define s second

const int MOD = 1e9 + 7; // 998244353; // = (119<<23)+1
const int MX = 2e5 + 5;

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

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

mt19937 rng((uint32_t) chrono::steady_clock::now().time_since_epoch().count());


//
// Created by aryssoncf on 28/10/2019.
//

#include <type_traits>


#include <iterator>
#include <utility>

template<typename T>
constexpr auto hasBegin(int) -> decltype(std::begin(std::declval<T>()), true) {
    return true;
}

constexpr bool hasBegin(...) {
    return false;
}

template<typename T>
using IsContainer = std::integral_constant<bool, hasBegin<T>(0)>;


#ifndef JHELPER_EXAMPLE_PROJECT_IO_HPP
#define JHELPER_EXAMPLE_PROJECT_IO_HPP

#endif //JHELPER_EXAMPLE_PROJECT_IO_HPP

template<typename T>
std::istream &operator>>(std::istream &is, std::vector<T> &vec) {
    for (T &element: vec) {
        is >> element;
    }
    return is;
}

template<typename T, typename U>
std::istream &operator>>(std::istream &is, std::pair<T, U> &p) {
    is >> p.first;
    is >> p.second;
    return is;
}

template<class X, class Y>
std::ostream &operator<<(std::ostream &os, std::pair<X, Y> const &p) {
    return os << p.first << " " << p.second;
}

template<class Ch, class Tr, class Container>
std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, Container const &x) {
    bool first = true;
    for (auto &y : x) {
        if (first) {
            first = false;
        } else {
            os << " ";
        }
        os << y;
    }
    return os;
}

using namespace std;

class CColoringColorfully {
public:
    void solve(std::istream &in, std::ostream &out) {
        string str;
        in >> str;
        int res = INT_MAX;
        FOR(i, 0, 2) {
            int c = 0;
            FOR(j, 0, sz(str)) {
                c += (i + j) % 2 + '0' != str[j];
            }
            ckmin(res, c);
        }
        out << res << '\n';
    }

    void setup() {}
};


int main() {
    std::ios_base::sync_with_stdio(false);
    CColoringColorfully solver;
    solver.setup();
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    in.tie(nullptr);
    out << std::fixed;
    out.precision(20);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 3768
from itertools import combinations
n = int(input())
A = tuple(map(int, input().split()))
B = set(A)
for i in range(2, n + 1):
    for C in combinations(A, i):
        B.add(sum(C))
q = int(input())
for m in map(int, input().split()):
    print("yes" if m in B else "no")



Measured memory_bytes: 5724
fun main(args:Array<String>):Unit{
    val n = readLine()!!.toInt()
    val nums = readLine()!!.split(' ').map(String::toInt)
    println(Array(n + 1){0L}.apply {
        var s = 0L
        for (i in 0 .. n){
            this[i] = s
            if (i in 0 until n) s += nums[i]
        }
    }.groupBy { it }.filterValues { it.size >= 2 }.map{ it.value.size * (it.value.size - 1L) / 2 }.sum())
}

Measured memory_bytes: 111152
#include <bits/stdc++.h>
using namespace std;
#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 fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
const ll INF = 1e9+100;
const ll MOD = 1e9;
const double EPS = 1e-10;
const bool debug = 1;
//------------------------------//

int N, K;
int A[112345], B[112345];

int main() {
	cin >> N >> K;
	REP(i, N) scanf("%d %d", A + i, B + i);
	
	int mabit = 0; // Kの最大bit[0-indexed]
	for (int i = 0; i < 31; i++) if (K >> i & 1) mabit = i;
	REP(i, N) if (A[i] >= (1ll<<(mabit+1))) B[i] = 0;
	
	ll ans = 0;
	
	for (int era = 30; era >= -1; era--) { // Kのeraビット目をサボる
		if (era >= 0 && !(K >> era & 1)) continue;
		
		ll now = 0;
		REP(i, N) {
			bool ng = false;
			;
			for (int j = 30; j > era; j--) {
				if (!(K >> j & 1) && (A[i] >> j & 1)) ng = true;
			}
			if (era >= 0 && (A[i] >> era & 1)) ng = true;
			
			if (ng) continue;
			now += B[i];
		}
		chmax(ans, now);
	}
	
	cout << ans << endl;
	
	return 0;
}


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

int main() {
	cin.tie(0)->sync_with_stdio(false);

	int n, m; cin >> n >> m;
	vector<int> p(m), y(m);
	vector<vector<int> > num(n + 1);
	REP(i, m) {
		cin >> p[i] >> y[i];
		num[p[i]].push_back(y[i]);
	}

	REP(i, n)
		sort(num[i + 1].begin(), num[i + 1].end());

	REP(i, m) {
		int j = lower_bound(num[p[i]].begin(), num[p[i]].end(), y[i]) - num[p[i]].begin();
		printf("%06d%06d\n", p[i], j + 1);
	}
	return 0;
}


Measured memory_bytes: 9516
#include<iostream>
using namespace std;
 
int main(){
	char a,b,c;

	cin >> a >> b >> c;

 	if(a == b && b == c) {
    	cout << "No";
    } else if(a != b || a != c || b != c){
    	cout << "Yes";
    }
  
	return 0;		 
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
using namespace std;
static const int MAX_N = 1001;
int vegs[MAX_N];

int main()
{
    int n, m, sum;
    for (; ; ) {
        scanf("%d %d", &n, &m);
        if (n == 0 && m == 0) break;
        sum = 0;
        for (int i = 0; i < n; i++) scanf("%d", &vegs[i]);
        sort(vegs, vegs+n, greater<int>());
        for (int i = 0; i < n; i++) {
            if (i % m == m - 1) continue;
            sum+= vegs[i];
        }
        printf("%d\n", sum);
    }
    return 0;
}



Measured memory_bytes: 2752
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
A = [0] + A

visited = [-1 for _ in range(N + 1)]
visited[1] = 0
cur = 1
precur = 0

cnt = 0
while cnt < K:
    precur = cur
    cur = A[cur]
    cnt += 1
    if visited[cur] > -1:
        break
    else:
        visited[cur] = cnt

if cnt == K:
    print(cur)
    exit()

ite = cnt - visited[cur]
x = (K - cnt + 1) % ite
cur = precur

cnt = 0
while cnt < x:
    cur = A[cur]
    cnt += 1
print(cur)
exit()


Measured memory_bytes: 32424
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <vector>
#include <cctype>
#include <algorithm>
#include <functional>
#include <cmath>
#include <string>
#include <cstring>
#include <vector>
#include <numeric>
#include <iomanip>
#include <limits>

#define roop(i, n) for(int i=0;i<n;i++)
#define DIV 1000000007
//static const long double pi = 3.1415926535897932;

using namespace std;
using ll = long long int;
using ull = unsigned long long;

char toSmall(char c) { // 大文字を小文字へ
	return (c + 0x20);
}

char toLarge(char c) { // 小文字を大文字へ
	return (c - 0x20);
}

float myPower(int a, int n) { // aのn乗の計算
	float x = 1;
	while (n > 0) { // 全てのbitが捨てられるまで
		if ( n & 1) { // 一番右のbitが１のとき
			x *= a;
		}
		a *= a;
		n >>= 1; // bit全体を右に1つシフトして一番右を捨てる
	}
	return x;
}

ll combination(ll n, ll r) { // nCr の計算
	if (n < 0 || r < 0 || r > n) return -1;

	if (n - r < r) r = n - r;
	if (r == 0) return 1;
	if (r == 1) return n;

	vector<ll> num(r);
	vector<ll> den(r);

	for (ll i = 0; i < r; i++) {
		num[i] = n - r + i + 1;
		den[i] = i + 1;
	}

	for (ll p = 2; p <= r; p++) {
		ll pivot = den[p - 1];
		if (pivot > 1) {
			ll offset = (n - r) % p;
			for (ll k = p - 1; k < r; k += p) {
				num[k - offset] /= pivot;
				den[k] /= pivot;
			}
		}
	}
	ll result = 1;
	for (ll k = 0; k < r; k++) {
		if (num[k] > 1) result *= num[k];
	}
	return result;
}

vector<string> split(const string& src, const char* delim = ",") { //カンマ区切り
	vector<string> vec;
	string::size_type len = src.length();

	for (string::size_type i = 0, n; i < len; i = n + 1) {
		n = src.find_first_of(delim, i);
		if (n == string::npos) {
			n = len;
		}
		vec.push_back(src.substr(i, n - i));
	}

	return vec;
}

bool check_int(string str)
{
	if (all_of(str.cbegin(), str.cend(), [](char ch) { return isdigit(ch);}))
	{
		return true;
	}
	return false;
}

struct rest {
	string s;
	int p;
	int num;

	/* -------------------------------------
	sort関数を使用したときのソートの定義をする。
	まずは文字列sでソートする。
	文字列sが同じだった場合、pでソートする。
	この条件を参考演算子で表現(ifでもOK)
	-------------------------------------*/
	bool operator<(const rest& right) const {
		return s == right.s ? p > right.p : s < right.s;
	}
};

int main() {
	ll n;
	cin >> n;
	vector<ll> a(n);
	vector<ll> b(n);
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		b[i] = a[i] - i - 1;
	}
	sort(b.begin(), b.end());
	ll x = b[n/2];
	ll ans = 0;
	for (ll i = 0; i < n; i++) {
		ans += max(x - b[i], -x + b[i]);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3328
from bisect import *



def resolve():
    N = int(input())
    A = [int(input()) for i in range(N)]
    A.reverse()

    B =[A[0]]

    A=A[1:]
    for  i in A:
        if i >= B[-1]:
            B.append(i)
            continue
        point = bisect_right(B,i)
        B[point]=i

    print(len(B))
if __name__ == "__main__":
    resolve()

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

using namespace std;

int main()
{
    int N;
    cin>>N;
    int count = 0;
    for(int i = N - 1; i > 0; i--)
    {
        for(int a = 1; a <= sqrt(i); a++)
        {
            if(a*a == i)
            {   count++;
                break;
            }
            else if(i%a == 0)
                count+= 2;
        }
    }
    cout<<count;
    return 0;
}

Measured memory_bytes: 3604
from collections import deque
import sys

sys.setrecursionlimit(10 ** 7)  # ここが足りないと " RecursionError: maximum recursion depth exceeded in comparison " が出る


H,W = map(int,input().split())

grid = ['#'] * (W+2)  #外枠の塀を作る
for _ in range(H):
    grid += ['#'] + list(input()) + ['#']
grid += ['#'] * (W+2)

cnt = grid.count(".")

move = [1,-1,W+2,-(W+2)]    #グラフの左、右移動を作る


start = W+2
goal = (H+1)*(W+2)-2
flg = False
visit = set([start]) # 到達可能

next_set = deque()
next_set.append((start, 1))

while next_set:    # q = [] になったら止める
    x, t = next_set.popleft()     # 要素を消去して、消去した要素を出力
    for dx in move:
        y = x+dx
        if grid[y] == '#':
            continue
        if y in visit:
            continue
        if y == goal:
            flg = True
            break
        visit.add(y)   # すでに到達した道を記憶
        next_set.append((y, t + 1))     # yに移動
    if flg:
        break
if not flg:
    print(-1)
else:
    print(cnt - t )



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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  string s, t; cin >> s >> t;
  ll ls = s.length(), lt = t.length();
  map<char, vector<int>> cs, ct;
  rep(i,ls) cs[s[i]].push_back(i);
  ll result = 0;
  rep(i,lt) {
    if (cs[t[i]].empty()) { cout << -1 << endl; return 0; }
    auto pos = lower_bound(cs[t[i]].begin(), cs[t[i]].end(),result%ls);
    if (pos==cs[t[i]].end()) result += cs[t[i]][0]+ls - result%ls;
    else result += *pos - result%ls;
    result++;
    // cout << i << " " << result << endl;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
typedef int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define endl '\n'
//#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")
#define kill(x) return cout<<x<<'\n', 0;
using namespace std;
const int N=2e3+10;
bitset <N*N> dp;
ll a[N];
int32_t main(){
    ll n;
    cin >> n;
    ll z=0;
    for (int i=1;i<=n;i++){
        cin >> a[i];
        z+=a[i];
    }
    z=(z+1)/2;
    dp[0]=1;
    for (int i=1;i<=n;i++){
        dp=(dp | (dp << a[i]));
    }
    for (int i=z;i<N*N;i++) if (dp[i]) kill(i);
}


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

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> void chmax(t&a,u b){if(a<b)a=b;};
template<class t, class u> void chmin(t&a,u b){if(a>b)a=b;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)
  
  string S,T;
  IN(S);
  IN(T);

  REP(i,S.size()){
    if(S[i]!=T[i]){
      OUT("No");
      return 0;
    }
  }

  OUT("Yes");


  return 0;
}

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

struct BTree{
    int parent, left, right;
};

BTree tree[25];

void preorder(int x){
    if(x != -1){
        cout << " " << x;
        preorder(tree[x].left);
        preorder(tree[x].right);
    }
}

void inorder(int x){
    if(x != -1){
        inorder(tree[x].left);
        cout << " " << x;
        inorder(tree[x].right);
    }
}

void postorder(int x){
    if(x != -1){
        postorder(tree[x].left);
        postorder(tree[x].right);
        cout << " " << x;
    }
}

int main(){
    int n, id, l, r;
    cin >> n;
    for(int i = 0; i < 25; i++){
        tree[i].parent = -1;
        tree[i].left = -1;
        tree[i].right = -1;
    }
    for(int i = 0; i < n; i++){
        cin >> id >> l >> r;
        tree[id].left = l;
        tree[id].right = r;
        if(l != -1) tree[l].parent = id;
        if(r != -1) tree[r].parent = id;
    }
    for(int i = 0; i < n; i++){
        if(tree[i].parent == -1){
            cout << "Preorder" << endl;
            preorder(i);
            cout << endl << "Inorder" << endl;
            inorder(i);
            cout << endl << "Postorder" << endl;
            postorder(i);
            cout << endl;
            break;
        }
    }
    return 0;
}



Measured memory_bytes: 3084
n = int(input())
a = list(map(int, input().split()))
flg = 0
for i in range(n):
    if a[i]%2==0 and a[i]%3!=0 and a[i]%5!=0:
        flg +=1
if flg==0:
    print("APPROVED")
else:
    print("DENIED")

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


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int M, K;
    cin >> M >> K;
    int N = pow(2, M + 1) + 0.5;
    if (M == 1 && K == 1) {
        cout << -1 << endl;
        return 0;
    } else if ( N / 2<= K) {
        cout << -1 << endl;
        return 0;
    }
    if (K == 0) {
        rep(i, N / 2) {
            cout << i << " " << i << " "; 
        }
        cout << endl;
        return 0;
    }
    REP(i, 0, N / 2 - 1) {
        if (i == K) continue;
        cout << i << " ";
    }
    cout << K << " ";
    RREP(i, N / 2 - 1, 0) {
        if (i == K) continue;
        cout << i << " ";
    }
    cout << K << endl;

    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
#define rep(i,a,n)	for(int i=a;i<n;i++)
int main(){
	int n;
	int a[10010],b[10010];
	int sumA=0;
	int sumB=0;
	cin>>n;
	rep(i,0,n){
		cin>>a[i];
		sumA+=a[i];
	}
	rep(i,0,n){
		cin>>b[i];
		sumB+=b[i];
	}
	long long int sum=0;
	rep(i,0,n){
		if(b[i]>a[i]){
			sum+=(b[i]-a[i])/2;
		}
		else{
			sum-=a[i]-b[i];
		}
	}
	if(sum>=0){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 384
n = int(input())

z_count = 0
for _ in range(n):
    d1,d2 = map(int,input().split())
    if d1 == d2:
        z_count += 1
    else:
        z_count = 0

    if z_count == 3:
        print ("Yes")
        exit ()

print ('No')


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

string s;
int main(){    
    cin >> s;
    int n = s.size();
    ll ans = 0;
    for(int i = 0;i<n;i++){
        ans += s[i] - '0';
    }
    if(ans % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

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

const int MAX = 1e5+10;
const int INF = 1e9+9;
int N;
int H[MAX];
int dp[MAX];

int main() {
  cin >> N;
  REP (i, N) {
    cin >> H[i];
    dp[i] = INF;
  }
  dp[0] = 0;
  REP (i, N-2) {
    dp[i+1] = min(dp[i+1], dp[i] + abs(H[i]-H[i+1]));
    dp[i+2] = min(dp[i+2], dp[i] + abs(H[i]-H[i+2]));
  }
  dp[N-1] = min(dp[N-1], dp[N-2] + abs(H[N-1]-H[N-2]));
  cout << dp[N-1] << endl;
  return 0;
}

Measured memory_bytes: 1024
N,X=map(int,input().split())
a=[[]]*(N+1)
b=[[]]*(N+1)
ans=N
for i in range(N+1):
  a[i]=pow(2,i+1)-1
  b[i]=pow(2,i+2)-3

def f(n,x):
  if n==0:
    if x<=0:return 0
    else:return 1
  else:
    if x==1:
      return 0
    elif 1<x<=1+b[n-1]:
      return f(n-1,x-1)
    elif x==2+b[n-1]:
      return a[n-1]+1
    elif 2+b[n-1]<x<=2+2*b[n-1]:
      return f(n-1,x-2-b[n-1])+a[n-1]+1
    else:
      return 2*a[n-1]+1
print(f(N,X))

Measured memory_bytes: 3064
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int x, y;
    cin >> x >> y;

    for (int i = 0; i <= x; i++)
    {
        if (i * 4 + (x - i) * 2 == y)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
using namespace std;

#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)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int main() {
  int n,m;
  while(cin >> n >> m, n) {
    int k[n];
    int x[n][10];
    int c[n][10];
    REP(y,n) {
      cin >> k[y];
    
      REP(i,k[y]) {
        cin >> x[y][i] >> c[y][i];
      }
    }
  
    int dp[n][10][m+1];           // dp[i][j][k] = i sÚÌ j ÔÚÌÎÉ¢ÄAcèk ñQsòÎµÌWvªÅ«éÆ«ÌÅ¬ë¯x
    REP(i,n) REP(j,10) REP(l, m+1) dp[i][j][l] = INF;
    REP(j,k[0])
      dp[0][j][m] = 0;
    if (m>0)
      REP(j, k[1])
        dp[1][j][m-1] = 0;

    
    for (int i=1; i<n; ++i) {
      REP(j,k[i]) {
        REP(l,m+1) {
          REP(jj, k[i-1])         // PsWv
            dp[i][j][l] = min(dp[i][j][l], dp[i-1][jj][l] + (c[i][j]+c[i-1][jj])*abs(x[i][j]-x[i-1][jj]));
          if (i>=2 && l>=1) {
            REP(jj, k[i-2]) {
              dp[i][j][l-1] = min(dp[i][j][l-1], dp[i-2][jj][l] + (c[i][j]+c[i-2][jj])*abs(x[i][j]-x[i-2][jj]));
            }
          }
        }
        //    cout << i << " " << j << " " <<dp[i][j][0] << " " <<dp[i][j][1]  << endl;
      }
    }
    int res = INF;
    REP(i, k[n-1]) {
      REP(j,m+1)
        res = min(res, dp[n-1][i][j]);
    }
    REP(i, k[n-2]) {
      for (int j=1;j<=m; ++j)
        res= min(res, dp[n-2][i][j]);
    }
    cout << res << endl;
  }
}

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

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> as(n);
    for (int &a : as) {
        cin >> a;
    }

    int sum = 0;
    for(int a : as) {
        sum += a - 1;
    }

    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, a, b) for(int i = a; i < b; i++)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int main(){
    ll x;
    cin >> x;
    ll ans = (x / 11) * 2;
    ll r = x % 11;
    if (r != 0 && r <= 6) ans++;
    else if(r != 0 && r < 11) ans += 2;
    cout << ans << endl;
    return 0;
}

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

class Solve {
private:
	using vi = std::vector<int>;
	using vvi = std::vector<vi>;

	int W, H, min{11};
	vvi board;

	void rc(int turn, int h, int w)
	{
		
	if (turn >= min) return;

	if (board[h + 1][w] != 1)
	{
		for (int h_i{h};; h_i++)
		{
			if (board[h_i + 1][w] == 0 || board[h_i + 1][w] == 2) continue;
			if (board[h_i + 1][w] == 4) break;
			if (board[h_i + 1][w] == 3)
				min = std::min(min, turn);
			else if (board[h_i + 1][w] == 1)
			{
				board[h_i + 1][w] = 0;
				rc(turn + 1, h_i, w);
				board[h_i + 1][w] = 1;
			}
			break;
		}
	}
	if (board[h - 1][w] != 1)
	{
		for (int h_i{h};; h_i--)
		{
			if (board[h_i - 1][w] == 0 || board[h_i - 1][w] == 2) continue;
			if (board[h_i - 1][w] == 4) break;
			if (board[h_i - 1][w] == 3)
				min = std::min(min, turn);
			else if (board[h_i - 1][w] == 1)
			{
				board[h_i - 1][w] = 0;
				rc(turn + 1, h_i, w);
				board[h_i - 1][w] = 1;
			}
			break;
		}
	}
	if (board[h][w + 1] != 1)
	{
		for (int w_i{w};; w_i++)
		{
			if (board[h][w_i + 1] == 0 || board[h][w_i + 1] == 2) continue;
			if (board[h][w_i + 1] == 4) break;
			if (board[h][w_i + 1] == 3)
				min = std::min(min, turn);
			else if (board[h][w_i + 1] == 1)
			{
				board[h][w_i + 1] = 0;
				rc(turn + 1, h, w_i);
				board[h][w_i + 1] = 1;
			}
			break;
		}
	}
	if (board[h][w - 1] != 1)
	{
		for (int w_i{w};; w_i--)
		{
			if (board[h][w_i - 1] == 0 || board[h][w_i - 1] == 2) continue;
			if (board[h][w_i - 1] == 4) break;
			if (board[h][w_i - 1] == 3)
				min = std::min(min, turn);
			else if (board[h][w_i - 1] == 1)
			{
				board[h][w_i - 1] = 0;
				rc(turn + 1, h, w_i);
				board[h][w_i - 1] = 1;
			}
			break;
		}
	}
	}
public:
	bool is_last_query{};
	Solve()
	{
		scanf("%d%d", &W, &H);
		if (H == 0 && W == 0)
		{
			is_last_query = true;
			return;
		}
		board.resize(H + 2, vi(W + 2, 4));

		int start[2]{};
		for (int i{1}; i <= H; i++)
			for (int j{1}; j <= W; j++)
			{
				scanf("%d", &board[i][j]);
				if (board[i][j] == 2)
				{
					start[0] = i;
					start[1] = j;
				}
			}

		rc(1, start[0], start[1]);
		if (min == 11) puts("-1");
		else printf("%d\n", min);
	}
};

int main()
{
	while (!Solve().is_last_query);

	return 0;
}


Measured memory_bytes: 3236
//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 <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


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())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--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() {
	string s; cin >> s;
	int n = s.length();
	int ans = 0;

	for (int i = 0; i < n - 1; i++) {
		if (s[i] != s[i + 1])ans++;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#include<assert.h>
using namespace std;
#define i64 long long int
int n,a[22222];
bool f[33333];
i64 gcd(i64 x,i64 y){
	return y?gcd(y,x%y):x;
}
int main(){
	int N;
//	for(N = 3; N <= 20000; N++){
//	printf("%d\n",N);
	i64 sum = 0;
	scanf("%d",&N);
	n = N;
	memset(f,0,sizeof(f));
	for(int i=1; i<=30000; i++)if(i%2==0 || i%3==0){
		sum += i;
		f[i] = true;
		a[n] = i;
		if(--n==1)break;
	}
	while(1){
		bool flag = false;
		for(int i=2; i<=30000; i++)if(!f[i] && (sum + i)%6 == 0 && gcd(sum, i)!= 1){
			a[1] = i;
			flag = true;
			break;
		}
		if(!flag){
			f[a[2]] = false;
			if(a[2] % 2 == 0){
				a[2] += 2;
				sum += 2;
			}else{
				a[2] += 3;
				sum += 3;
			}
			f[a[2]] = true;
		}else
			break;
	}
	for(int i=1; i<=N; i++)
		printf("%d%c",a[i],i<N?' ':'\n');
//	}
	return 0;
}


Measured memory_bytes: 512
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as T
import qualified Data.Text.Lazy.Read as T
import Data.List (group)
import Data.Bool (bool)

main :: IO ()
main = do
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  ds <- map (uncurry (==) . unsafeListToPair . map unsafeTextToInt . T.words) . T.lines <$> T.getContents :: IO [Bool]
  putStrLn . bool "No" "Yes" . any (3 <=) . map snd . filter fst . map ((,) <$> head <*> length) . group $ ds

unsafeListToPair :: [Int] -> (Int, Int)
unsafeListToPair = (,) <$> head <*> head . tail
{-# INLINE unsafeListToPair #-}

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 3988
import sys
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7

    h, w = list(map(int, input().rstrip('\n').split()))
    s = [list(str(input().rstrip('\n'))) for _ in range(h)]
    ql = []
    ql = collections.deque(ql)
    for i in range(h):
        for j in range(w):
            if s[i][j] == "#":
                ql.append([0, i, j])
    while True:
        if len(ql) != 0:
            b = False
            cost, xv, yv = ql.popleft()
            for xv, yv in [[xv + 1, yv], [xv - 1, yv], [xv, yv + 1], [xv, yv - 1]]:
                if 0 <= xv < h and 0 <= yv < w:
                    if s[xv][yv] == "#":
                        b = True
                        break
            if not b:
                print("No")
                exit()
        else:
            break
    print("Yes")


if __name__ == '__main__':
    solve()


Measured memory_bytes: 39664
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
#include <time.h>
#include <chrono>
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a,b) for(ll i=a;i>b;i--)
#define CST(x) cout<<fixed<<setprecision(x)//小数点以下の桁数指定
#define ct(a) cout<<a<<endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define repl(i,l,r) for(int i=(1);i<(r);i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
static const double pi = 3.141592653589793;
using namespace std;
typedef long long ll;
const ll MOD = 998244353;
const ll INF = (1LL << 31) - 1;
const ll mod = 1e9 + 7;


string S;

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


	cin >> S;
	ll cnt = 0;
	FOR(i, 0, S.size()) {
		cnt += int(S[i] - '0');
	}
	
	if (cnt % 9 == 0)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 3712
import math

N,H=list(map(int,input().split()))
A,B=[],[]
for i in range(N):
    a,b=list(map(int,input().split()))
    A.append(a)
    B.append(b)

max = max(A)
B.sort(reverse=True)

cnt,i=0,0
while H > 0:
    if i != len(B):
        if B[i] >= max:
            H -= B[i]
            i += 1
        else:
            x = math.ceil(H/max)
            H=-1
            cnt += x-1
    else:
        x = math.ceil(H/max)
        H=-1
        cnt += x-1
    cnt+=1
print(cnt)

Measured memory_bytes: 11436
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++){
    int x = i;
    if (x % 3 == 0){
      cout << " " << i;
    } else {
      while (x > 0){
        if (x % 10 == 3){
          cout << " " << i;
          break;
        }
        x = x / 10;
      }
    }
  }
  cout << endl;
}


Measured memory_bytes: 3096
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }

    fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.input()).collect()
    }

    fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let s: String = sc.input();
    let mut chs: Vec<usize> = s
        .chars()
        .into_iter()
        .map(|x| x.to_digit(10).unwrap() as usize)
        .collect();
    chs.reverse();

    let mut deg = 1usize;
    let mut cnt = [0; 2019];
    cnt[0] = 1;
    let mut cur = 0usize;
    for ch in chs {
        cur += ch * deg;
        cur %= 2019;
        deg *= 10;
        deg %= 2019;
        cnt[cur] += 1;
    }

    let ans = cnt.iter().fold(0, |acc, x| acc + x * (x - 1) / 2);
    println!("{}", ans);
}


Measured memory_bytes: 3688
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second 
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define pp pair<ll,ll> 
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t = 1 ;
void solve()
{
    ll n , k , cur = 0 ;
    cin >> n >> k ;
    string s ;
    cin >> s ;
    rep( i , 1 , n ){
        cur += (s[i]==s[i-1]);
    }
    cout << min(n-1,cur+k+k);
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cin >> t ;
    while(t--){
        solve();
    }
    return 0 ;
}


Measured memory_bytes: 512
#include <stdio.h>

int s[10000], g[10000], f[10000];
char h1, h2, m1, m2, s1, s2;
int ans, n, count;

int henkan();
void sort1(int, int);
void sort2(int, int);
void change(int, int);
void tansaku(int);

int main(){
  int i, j;
  char a, b;

  while(1){
    scanf("%d", &n);
    if(n==0) break;
    getchar();

    for(i=0;i<n;i++){
      scanf("%c%c%c%c%c%c%c%c", &h1, &h2, &a, &m1, &m2, &b, &s1, &s2);
      getchar();
      s[i]=henkan();

      scanf("%c%c%c%c%c%c%c%c", &h1, &h2, &a, &m1, &m2, &b, &s1, &s2);
      getchar();
      g[i]=henkan();

      f[i]=0;
    }

    sort1(0, n-1);
    for(i=0;i<n-1;i++){
      if(s[i]==s[i+1]){
	for(j=0;j+i<n-1;j++){
	  if(s[j+i]!=s[j+1+i]) break;
	}
	sort2(i, j+i);
	i=j+i;
      }
    }

    ans=0;
    count=0;
    for(i=0;i<n;i++){
      if(f[i]==0) tansaku(i);
    }

    printf("%d\n", ans);
  }
  return 0;
}

int henkan(){
  int h, m, s;

  h=((int)h1-'0')*10+(int)h2-'0';
  m=((int)m1-'0')*10+(int)m2-'0';
  s=((int)s1-'0')*10+(int)s2-'0';

  return h*10000+m*100+s;
}

void sort1(int left, int right){
  int i, j, m;

  i=left;
  j=right;
  m=s[(left+right)/2];

  while(1){
    while(m>s[i]) i++;
    while(m<s[j]) j--;

    if(i>=j) break;

    change(i, j);
    i++;
    j--;
  }

  if(left<i-1) sort1(left, i-1);
  if(j+1<right) sort1(j+1, right);
}

void sort2(int left, int right){
  int i, j, m;

  i=left;
  j=right;
  m=g[(left+right)/2];

  while(1){
    while(m>g[i]) i++;
    while(m<g[j]) j--;

    if(i>=j) break;

    change(i, j);
    i++;
    j--;
  }

  if(left<i-1) sort2(left, i-1);
  if(j+1<right) sort2(j+1, right);
}

void change(int a, int b){
  int temp;

  temp=s[a];
  s[a]=s[b];
  s[b]=temp;

  temp=g[a];
  g[a]=g[b];
  g[b]=temp;
}

void tansaku(int a){
  int i, j;

  if(count==n) return;
  count++;

  f[a]=1;

  for(i=0;i<n;i++){
    if(f[i]==1) continue;
    else if(s[i]>=g[a]){
      tansaku(i);
      return;
    }
  }
  ans++;
}

Measured memory_bytes: 536
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;



int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a[200010],M=-INF,m=-INF,cnt=0;
    cin>>n;
    rep(i,n){
        cin>>a[i];
        M=max(M,a[i]);
    }
    rep(i,n){
        if(a[i]!=M){
            m=max(m,a[i]);
        } else{
            cnt++;
        }
    }
    rep(i,n){
        if(a[i]!=M || cnt>1) cout<<M<<endl;
        else cout<<m<<endl;
    }
    return 0;
}

Measured memory_bytes: 3200
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(){
    map<int, int> m;
    int ans = 0;
    REP(i,3){
        int x;
        cin >> x;
        m[x]++;
        if (m[x] == 1) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include<bits/stdc++.h>

using namespace std;
 
#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define  f              first                 
#define  s              second
#define  endl           "\n"
#define  pb             push_back  
#define  mset(a,x)      memset(a,x,sizeof(a))
#define  debv(a)        for(auto it: a)cout<<it<<" ";cout<<endl;
#define  deb1(a)        cout<<a<<endl;
#define  deb2(a,b)      cout<<a<<" "<<b<<endl;
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<endl;
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl;  
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());
#define  all(a)         a.begin(),a.end()
          
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  unordered_map<ll,ll>  um;
typedef  vector<pll>           vpll;

const ll   N     =  5e5+8;
const ll   mod   =  998244353;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;

ll test = 1, n, a[N], m = 1000;

void solve(){
	cin>>n;
	for(int i = 1; i <= n; i++) cin>>a[i];
	a[n+1] = -INFi;
	for(int i = 1, j = 1; i <= n; i++){
		if(a[i+1] < a[i]){
			ll ct = m/a[j];
			m += ct*(a[i]-a[j]);
			j = i+1;
		}
	}
	deb1(m)
}

int main(){
    fastio;
    //cin>>test;
    for(int i = 1; i <= test; i++){
        solve();
    }
    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed: " << 1.0*clock() / CLOCKS_PER_SEC << " sec\n";
    #endif
}

Measured memory_bytes: 3668
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
  int i,j,k;
  int N;
  int X;
  
  scanf("%d",&N);
  
  i = (int)(N/1.08);
  
  k = 0;
  for(j=i-9;j<=i+9;j++){
    X = (int)(j*1.08);
    if( X==N && k==0 ){
      k = 1;
      printf("%d\n",j);
    }
  }
  if( k==0 ){
    printf(":(\n");
  }

  
  return 0; 
}

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

int n;
set<string> s;
string x;

int main() {

  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    s.insert(x);
  }

  printf("%d\n", s.size());

  return 0;
}

Measured memory_bytes: 19236
#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 main() {
    string s;
    cin >> s;
    vector<bool> flg(26, false);
    int n = s.size();
    rep(i, n) flg[s[i] - 'a'] = true;
    rep(i, 26) {
        if (!flg[i]) {
            cout << (char)(i + 'a') << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}


Measured memory_bytes: 3708
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {
    public static void main(String[] args){
        FastScanner sc = new FastScanner();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int h = sc.nextInt();
        int area = 0;
        area = (a + b) * h / 2;
        System.out.println(area);

    }

    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            }else{
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }else if(b == -1 || !isPrintableChar(b)){
                    return minus ? -n : n;
                }else{
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
    }
}

Measured memory_bytes: 23124
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <queue>
#include <functional>

#define out(t) cout << (t) << "\n"

using namespace std;

typedef long long ll;
typedef unsigned int uint;

void swap(int &a, int &b) {
    a ^= b;
    b ^= a;
    a ^= b;
}

uint tzcnt(uint x) {
    x = ~x & (x - 1);
    x -= x >> 1 & 0x55555555;
    x = (x & 0x33333333) + (x >> 2 & 0x33333333);
    x = x + (x >> 4) & 0x0F0F0F0F;
    return x * 0x01010101 >> 24;
}

int popcount(uint x) {
    x -= x >> 1 & 0x55555555;
    x = (x & 0x33333333) + (x >> 2 & 0x33333333);
    x = x + (x >> 4) & 0x0F0F0F0F;
    return x * 0x01010101 >> 24;
}

struct Point {
    int x, y;

    Point(int p, int q) : x(p), y(q) {}
};

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

    int N;
    cin >> N;

    map<char, ll> person_count = {
        { 'M', 0 },
    { 'A', 0 },
    { 'R', 0 },
    { 'C', 0 },
    { 'H', 0 },
    };

    for (int i = 0; i < N; ++i) {
        string s;
        cin >> s;

        char first = s[0];

        if (first == 'M' || first == 'A' || first == 'R' || first == 'C' || first == 'H') {
            ++person_count[first];
        }
    }

    ll ans = 0;

    const char table[] = { 'M', 'A' ,'R', 'C', 'H' };

    for (int i = 0b111; i <= 0b11111; ++i) {
        if (popcount(i) != 3) continue;

        int j = i;

        char p1 = table[tzcnt(j)];

        j &= j - 1;

        char p2 = table[tzcnt(j)];

        j &= j - 1;

        char p3 = table[tzcnt(j)];

        ans += person_count[p1] * person_count[p2] * person_count[p3];
    }

    out(ans);

    int aaa;
    cin >> aaa;
}


Measured memory_bytes: 256
import numpy as np

D = int(input())
c = np.array(list(map(int, input().split())))
S = np.array([list(map(int, input().split())) for i in range(D)])

last_day = np.zeros(26, dtype=int)

T = [int(input()) for i in range(D)]

score = 0
for d, t in enumerate(T, 1):
    last_day[t-1] = d
    decrease = c * (d - last_day)
    score += S[d-1, t-1] - decrease.sum()


def calc_pre(ans, pre_t, t, d):
    flag1 = flag2 = True
    res = [-1, -1]
    for day in range(d-1, -1, -1):
        td = ans[day]
        if td == pre_t and flag1:
            res[0] = day
            flag1 = False
        if td == t and flag2:
            res[1] = day
            flag2 = False
        if not (flag1 or flag2):
            return res
    return res

def calc_next(ans, pre_t, t, d):
    flag1 = flag2 = True
    res = [D, D]
    for day in range(d+1, D):
        td = ans[day]
        if td == pre_t and flag1:
            res[0] = day
            flag1 = False
        if td == t and flag2:
            res[1] = day
            flag2 = False
        if not (flag1 or flag2):
            return res
    return res


ans = []
M = int(input())
dq = [list(map(int, input().split())) for i in range(M)]

for d, q in dq:
    d -= 1
    t = T[d]
    dm1, dm2 = calc_pre(T, t, q, d)
    dp1, dp2 = calc_next(T, t, q, d)
    diff = S[d, q-1] - S[d, t-1] + c[t-1]*(dm1-d)*(dp1-d) - c[q-1]*(dm2-d)*(dp2-d)
    score += diff
    ans.append(score)
    T[d] = q

print(*ans, sep='\n')


Measured memory_bytes: 45272
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

int main() {
  ll X;
  cin >> X;
  string ans = "NO";
  if (X == 7 || X == 5 || X == 3) {
    ans = "YES";
  }

  cout << ans << endl;
  return 0;
}


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

typedef pair<int,int> P;
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define sz(x) ((int)(x).size())
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
int dh[] = {0, 1, 0, -1};
int dw[] = {1, 0, -1, 0};
int dp[1005][1005];
vector<string> mp;



int main()
{
    int h,w;
    cin >> h >> w;
    mp.resize(h);
    rep(i, h)cin >> mp[i];
    dp[0][0] = 1;
    for (int i = 0; i < h; i++)
    {
        for (int j = 0; j < w; j++)
        {
            if(i+1 <=h-1 && mp[i+1][j]=='.')
            {
                dp[i+1][j]+= dp[i][j];
                dp[i+1][j]%=MOD;

            }
            if (j + 1 <= w - 1 && mp[i][j+1] == '.')
            {
                dp[i][j+1] += dp[i][j];
                dp[i][j+1] %= MOD;
            }
        }
        
    }

    cout << dp[h-1][w-1]%MOD << endl;
    
}

Measured memory_bytes: 5248