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

typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

ll N, X;

int main() {
	cin >> N >> X;
	ll D = __gcd(N, X);
	cout << 3 * (N - D) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bitset>
#include <vector>

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

int n, a;
int boys[21];
ll dp[22][1<<21];


int main() {
    cin >> n;

    for(int i=0;i<n;++i) {
        for(int j=0;j<n;++j) {
            cin >> a;
            if(a) {
                boys[i] |= 1 << j;
            }
        }
    }

    dp[0][0] = 1LL;
    for(int i=0;i<n;++i) {
        for(int s=0;s<(1<<n);++s) {
            if(dp[i][s] == 0) continue;
            // cerr << i << " " << bitset<5>(s) << ": " << dp[i][s] << "\n";
            for(int j=0;j<n;++j) {
                if(!(boys[i] & (1<<j)) || (s & (1<<j))) continue;
                dp[i+1][s|(1<<j)] += dp[i][s];
                dp[i+1][s|(1<<j)] %= MOD;
            }
        }
    }

    cout << dp[n][(1<<n)-1] << "\n";
}



Measured memory_bytes: 309504
#include <stdio.h>

int main() {
	
	int l,r,d,c = 0;
	scanf("%d %d %d", &l,&r,&d);
	
	for(int i = l; i <= r;i++){
		if(i%d == 0){
			c++;
		}
	}
	printf("%d\n",c);
	
	return 0;
}


Measured memory_bytes: 1684
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

use std::collections::HashMap;

fn main() {
    input! {
        n: usize,
        ss: [String;n]
    }
    let mut h = HashMap::new();
    for s in ss {
        *h.entry(s).or_insert(0) += 1;
    }
    let m = h.values().max().unwrap();
    let mut v = h.iter().filter(|&(_,v)| {
        v == m
    }).map(|t| t.0).collect::<Vec<_>>();
    v.sort();
    for k in v {
        println!("{}", k);
    }
}
/* vim:set foldmethod=marker: */


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

ll po(ll x, ll y) {
    ll ans = 1;
    while(y > 0) {
        if(y % 2) (ans *= x) %= MOD;
        (x *= x) %= MOD;
        y >>= 1;
    }
    return ans;
}

ll comb(ll n, ll r) {
    ll x = 1, y = 1;
    rep(i, r) (x *= n - i) %= MOD;
    rep(i, r) (y *= i + 1) %= MOD;
    y = po(y, MOD - 2);
    return x * y % MOD;
}

int main(void) {
    ll X, Y;
    cin >> X >> Y;
    ll m = (2 * X - Y) / 3;
    ll n = X - 2 * m;
    if((X + Y) % 3 || n < 0 || m < 0) {
        cout << 0 << endl;
    } else {
        cout << comb(m + n, n) << endl;
    }
    return 0;
}


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

const int N = 1 << 17;
int bit[N] = {};
int n, q;

int sum(int i)
{
	int s = 0;
	while(i > 0){
		s += bit[i];
		i -= i & (-i);
	}
	return s;
}

void add(int i, int x)
{
	while(i <= n){
		bit[i] += x;
		i += i & (-i);
	}
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> n >> q;
	
	int c, x, y;
	for(int i = 0; i < q; ++i){
		cin >> c >> x >> y;
		if(c == 0){
			add(x, y);
		}
		else {
			if(x == 0)
				cout << sum(y);
			else
				cout << sum(y) - sum(x - 1);
			cout << endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 1584
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
using Graph = vector<vector<int> >;

int main() {
   
   int N,X,Y;
   
   cin >> N >> X >> Y;
   
   
   // 頂点数
   int M = N;
   
   // グラフ入力受取 (ここでは無向グラフを想定)
   Graph G(N);
   for (int i = 0; i < N - 1; ++i) {
      int a, b;
      a = i;
      b = i + 1;
      G[a].push_back(b);
      G[b].push_back(a);
      
      if (i == X - 1) {
         a = i;
         b = Y - 1;
         G[a].push_back(b);
         G[b].push_back(a);
      }
   }
   
   int i;
   int A[N][N];
   for (i = 0; i < N; i++) {
      // BFS のためのデータ構造
      vector<int> dist(N, -1); // 全頂点を「未訪問」に初期化
      queue<int> que;
      
      // 初期条件 (頂点 0 を初期ノードとする)
      dist[i] = 0;
      que.push(i); // 0 を橙色頂点にする
      
      // BFS 開始 (キューが空になるまで探索を行う)
      while (!que.empty()) {
         int v = que.front(); // キューから先頭頂点を取り出す
         que.pop();
         
         // v から辿れる頂点をすべて調べる
         for (int nv : G[v]) {
            if (dist[nv] != -1) continue; // すでに発見済みの頂点は探索しない
            
            // 新たな白色頂点 nv について距離情報を更新してキューに追加する
            dist[nv] = dist[v] + 1;
            que.push(nv);
         }
      }
      
      
      // 結果出力 (各頂点の頂点 0 からの距離を見る)
      //for (int v = 0; v < N; ++v) cout << v << ": " << dist[v] << endl;
      for (int v = 0; v < N; ++v) A[i][v] = dist[v];
   }
   
   int j;
   int Ans[N];
   
   for (i = 0; i < N; i++) {
      Ans[i] = 0;
   }
   
   for (i = 0; i < N; i++) {
      for (j = i; j < N; j++) {
         Ans[A[i][j]]++;
      }
   }
   
   for (i = 1; i < N; i++) {
      printf("%d\n",Ans[i]);
   }
   
}


Measured memory_bytes: 16000
#include <bits/stdc++.h>
using namespace std;
int main () {
	int n,ans=0;
	cin>>n;
	int a[n],b,c[n];
	for (int i=0;i<n;i++) {
		cin>>a[i];
	}
	for (int i=0;i<n;i++) {
		cin>>b;
		ans+=b;
	}
	for (int i=0;i<n-1;i++) {
		cin>>c[i];
	}
	for (int i=0;i<n-1;i++) {
		if (a[i]+1==a[i+1]) {
			ans+=c[a[i]-1];
		}
	}
	cout<<ans;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int R[100000], L[100000],ans[100000];
string s;

signed main() {
    cin >> s;
    rep(i,s.size()) {
        if (s[i] == 'R') R[i] = 1;
        else L[i] = 1;
    }
    rep(i,s.size()-1) if (s[i] == 'R' && s[i+1] == 'R') R[i+1] += R[i], R[i] = 0;
    repm(i,s.size()-1) if (s[i] == 'L' && s[i+1] == 'L') L[i] += L[i+1], L[i+1] = 0;
    rep(i,s.size()) {
        if (R[i]) {
            int Rtmp = R[i], Ltmp = L[i+1];
            if (R[i]%2) {
                ans[i] += (Rtmp+1)/2;
                ans[i+1] += Rtmp/2;
            } else {
                ans[i] += Rtmp/2;
                ans[i+1] += (Rtmp+1)/2;
            }
            if (L[i+1]%2) {
                ans[i] += Ltmp/2;
                ans[i+1] += (Ltmp+1)/2;
            } else {
                ans[i] += (Ltmp+1)/2;
                ans[i+1] += Ltmp/2;
            }

        }
    }
    rep(i,s.size()) cout << ans[i] << " ";cout << endl;
}

Measured memory_bytes: 3072
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100005

enum Type{
	S,
	T,
};

struct Node{
	    int parent_id,children[28],suffix_link,length,count;
};

int num_nodes,root,last_node;
ll dp[2][NUM];
char base_ch;
Node nodes[NUM];
string input_S,input_T,line;


void add(int loc){

	char tmp_ch = line[loc];

	int tmp_node = last_node;

	while(true){
		if(loc-1-nodes[tmp_node].length >= 0 && line[loc-1-nodes[tmp_node].length] == tmp_ch){
			break;
		}
		tmp_node = nodes[tmp_node].suffix_link;
	}

	if(nodes[tmp_node].children[tmp_ch-base_ch] > 0){

		last_node = nodes[tmp_node].children[tmp_ch-base_ch];
		nodes[last_node].count++;
		return;
	}

	last_node = num_nodes++;
	nodes[tmp_node].children[tmp_ch-base_ch] = last_node;

	nodes[last_node].length = nodes[tmp_node].length+2;
	nodes[last_node].parent_id = tmp_node;
	nodes[last_node].count = 1;

	if(nodes[last_node].length == 1){

		nodes[last_node].suffix_link = root+1;

	}else{

		while(true){
			tmp_node = nodes[tmp_node].suffix_link;
			if(loc-1-nodes[tmp_node].length >= 0 && line[loc-1-nodes[tmp_node].length] == tmp_ch){

				nodes[last_node].suffix_link = nodes[tmp_node].children[tmp_ch-base_ch];
				break;
			}
		}
	}
}

int get_index(){

	return last_node;
}

void init(string arg_line){

	line = arg_line;
	num_nodes = 0;

	base_ch = '?';

	root = 0;
	nodes[root].suffix_link = -1;

	for(int i = 0; i < NUM; i++){

		nodes[i].parent_id = -1;
		nodes[i].count = 0;

		for(int k = 0; k < 28; k++){
			nodes[i].children[k] = -1;
		}
	}

	num_nodes = 2;
	last_node = root;

	nodes[root].length = -1;
	nodes[root+1].length = 0;

	nodes[root].suffix_link = root;
	nodes[root+1].suffix_link = root;

	nodes[root].parent_id = -1;
	nodes[root+1].parent_id = root;
}

int main(){

	cin >> input_S >> input_T;

	string LINE = input_S + "?@" + input_T;

	init(LINE);

	int tmp_index;

	for(int i = 0; i < 2; i++){
		for(int k = 0; k < NUM; k++){

			dp[i][k] = 0;
		}
	}

	for(int i = 0; i < LINE.length(); i++){

		add(i);
		tmp_index = get_index();

		if(i < input_S.length()){

			dp[S][tmp_index]++;

		}else if(i >= input_S.length()+2){

			dp[T][tmp_index]++;
		}
	}

	ll ans = 0;

	for(int i = num_nodes-1; i >= 2; i--){

		ans += dp[S][i]*dp[T][i];
		dp[S][nodes[i].suffix_link] += dp[S][i];
		dp[T][nodes[i].suffix_link] += dp[T][i];
	}

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

    return 0;
}




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

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL);
    double L;
    cin >> L;
    L /= 3.0;
    printf("%.6f\n", pow(L, 3));
    return 0;
}

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

string smax(const string &l, const string &r){
    if (l == r)
        return r;
    if (l.size() != r.size())
        return l.size() > r.size() ? l : r;
    for (int i = 0; i < l.size(); i++){
        if (l[i] > r[i])
            return l;
        if (r[i] > l[i])
            return r;
    }
}

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> A(m);
    vector<int> Z = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};
    copy_n(istream_iterator<int>(cin), m, A.begin());
    vector<int> T(8, -1);
    for (const auto &a: A)
        T[Z[a]] = max(T[Z[a]], a);
    vector<pair<int, char>> B;
    for (int i = 0; i < 8; i++){
        if (T[i] > 0)
            B.push_back({i, T[i] + '0'});
    }

    vector<string> DP(n + 1, "");
    vector<bool> F(n + 1);
    F[0] = true;
    for (int i = 0; i < n; i++){
        if (!F[i]) continue;
        for (const auto &b: B){
            const int& j = b.first;
            if (i + j <= n){
                DP[i + j] = smax(DP[i + j], DP[i] + b.second);
                F[i + j] = true;
            }
        }
    }

    cout << DP[n] << endl;
}

Measured memory_bytes: 44928
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;
typedef pair<Int,Int> P;

int main(){
    Int N, K; cin >> N >> K;
    vector<Int> A(N);
    rep(i,N) cin >> A[i];

    for(int i=K; i<N; i++){
        if(A[i-K] < A[i]){
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
}

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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n,m;
	cin>>n>>m;
	vector<pair<int,int>>d(n);
	for(auto&i:d)cin>>i.first>>i.second;
	sort(d.begin(),d.end());
	int64_t ans=0;
	for(int i=0,cnt=0,tmp;cnt!=m;++i){
		tmp=min(m-cnt,d.at(i).second);
		cnt+=tmp;
		ans+=(int64_t)tmp*d.at(i).first;
	}
	cout<<ans<<"\n"s;
}

Measured memory_bytes: 1024
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author tatsumack
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>

#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>

#define int long long
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, n) for (int i = 1, i##_len = (n); i <= i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)

using namespace std;

typedef pair<int, int> P;

class DClassified {
public:
    static constexpr int kStressIterations = 0;

    static void generateTest(std::ostream& test) {
    }

    vector<vector<int>> ans;

    void calc(int l, int r, int x) {
        if (r - l <= 1) return;
        int m = (l + r) / 2;
        FOR(i, l, m - 1) {
            FOR(j, m, r - 1) {
                ans[i][j] = x;
            }
        }
        calc(l, m, x + 1);
        calc(m, r, x + 1);
    }

    void solve(std::istream& cin, std::ostream& cout) {
        int N;
        cin >> N;
        ans = vector<vector<int>>(N, vector<int>(N));
        calc(0, N, 1);
        REP(i, N) {
            FOR(j, i + 1, N - 1) {
                cout << ans[i][j] << " ";
            }
            cout << endl;
        }
    }
};


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    std::istream& in(std::cin);
    std::ostream& out(std::cout);

    DClassified solver;
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 2432
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<cmath>
using namespace std;

int main()
{
    int n, k;
    int i;
    int cost, mini = 1000000000;
    
    cin >> n >> k;
    
    int x[n];
    
    for(i = 0; i < n; i++) {
        cin >> x[i];
    }
    
    for(i = 0; i < n-k+1; i++) {
        if(((x[i] > 0)&&(x[i+k-1] < 0)) || ((x[i] < 0)&&(x[i+k-1] > 0))) {
            cost = min(abs(x[i]), abs(x[i+k-1])) * 2 + max(abs(x[i]), abs(x[i+k-1]));
        } else {
            cost = max(abs(x[i]), abs(x[i+k-1]));
        }
        if(cost < mini) {
            mini = cost;
        }
    }
    
    cout << mini << endl;
    
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
 
int main(int argc, const char * argv[]) {
    int r, c;
    std::cin >> r >> c;
    int rowsum, element;
    int colsum[c + 1] = {};
    for (int j = 0; j < r; j++) {
        rowsum = 0;
        for (int i = 0; i < c; i++) {
            std::cin >> element;
            rowsum += element;
            colsum[i] += element;
            std::cout << element << " ";
        }
        colsum[c] += rowsum;
        std::cout << rowsum << std::endl;
    }
    for (int i = 0; i < c; i++) {
        std::cout << colsum[i] << " ";
    }
    std::cout << colsum[c] << std::endl;
    return 0;
}

Measured memory_bytes: 3104
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 
#define U_MAP unordered_map<ll,ll>

ll n,cnt,ans,a[ohara],b[ohara],c[ohara],d,tmp,tmpp,m,h,w,x,y,sum,pos,k,ma,mb;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll dp[100][500][500];
//dp@[aaaaa][i][j]:=i [g] : j [g] の時、最小何円

//-------------------------↓↓↓↓↓↓------------------------

//------ 自分を天才だと信じる ------

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

    cin>>n>>ma>>mb;
    rep(i,50){
        rep(j,500){
            rep(k,500){
                dp[i][j][k]=LINF;
            }
        }
    }
    rep(i,n){
        cin>>a[i]>>b[i]>>c[i];
    }
    dp[0][a[0]][b[0]]=c[0];
    dp[0][0][0]=0;
    rrep(i,1,n){
        rrep(j,0,500-10){
            rrep(k,0,500-10){
                if(j>=a[i]&&k>=b[i])dp[i][j][k]=min({dp[i][j][k],dp[i-1][j][k],dp[i-1][j-a[i]][k-b[i]]+c[i]});
                else dp[i][j][k]=min({dp[i][j][k],dp[i-1][j][k]});
            }
        }
    }
    ll kake=1;
    ans=LINF;
    while(1){
        ans=min(ans,dp[n-1][ma*kake][mb*kake]);
        kake++;
        if(ma*kake>500-10||mb*kake>500-10)break;
    }
    if(ans!=LINF)Cout(ans);
    else Cout(-1);
    return 0;
}


Measured memory_bytes: 104704
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	s = readline() |> chomp
	t = readline() |> chomp
	q = readline() |> parseInt
	as = zeros(Int,length(s)+1)
	bs = zeros(Int,length(s)+1)
	at = zeros(Int,length(t)+1)
	bt = zeros(Int,length(t)+1)
	for i in 1:length(s)
		as[i+1] = as[i]
		bs[i+1] = bs[i]
		if s[i] == 'A'
			as[i+1] += 1
		else
			bs[i+1] += 1
		end
	end
	for i in 1:length(t)
		at[i+1] = at[i]
		bt[i+1] = bt[i]
		if t[i] == 'A'
			at[i+1] += 1
		else
			bt[i+1] += 1
		end
	end

	for i in 1:q
		a,b,c,d = readline() |> split |> parseMap
		asv = as[b+1]-as[a]
		bsv = bs[b+1]-bs[a]
		atv = at[d+1]-at[c]
		btv = bt[d+1]-bt[c]
		if (asv+bsv*2)%3==(atv+btv*2)%3 || (2*asv+bsv)%3==(2*atv+btv)%3
			println("YES")
		else
			println("NO")
		end
	end
end

main()

Measured memory_bytes: 162440
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
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; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second < b.second; }

const int MOD = 1000000007;

int main() {
    SS(long double,l)
    p(l/3*l/3*l/3);
}

Measured memory_bytes: 256
# coding:utf-8


a = int(raw_input())
#print a

a1 = a/100 #100の位
a = a%100
a2 = a/10  #10の位
a = a%10
a3 = a     #1の位

# print a
# print a1
# print a2
# print a3


if a1 == 1:
    a1 = 9
else:
    if a1 == 9:
        a1 = 1

if a2 == 1:
    a2 = 9
else:
    if a2 == 9:
        a2 = 1

if a3 == 1:
    a3 = 9
else:
    if a3 == 9:
        a3 = 1

print a1*100 + a2*10 + a3
# print a1
# print a2
# print a3



Measured memory_bytes: 2568
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <queue>
#include <deque>
#include <cassert>
#include <random>  
#include <ctime>
#define pb push_back
#define x first
#define y second
#define files(FILENAME) read(FILENAME); write(FILENAME)
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
using namespace std;

template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
typedef long long base;
typedef pair <int, int> point;


const string FILENAME = "input";
const int MAXN = 1e5 + 10;

long long n;

int main() {
	ios::sync_with_stdio(0);
	srand(time(0));
	//read(FILENAME);
	cin >> n;
	for (long long a = 1; a <= 3500; ++a) {
		for (long long b = 1; b <= 3500; ++b) {
			long long A1 = n * a * b;
			long long A2 = 4 * a * b - n * (a + b);
			if (A2 > 0 && A1 % A2 == 0) {
				cout << a << ' ' << b << ' '  << A1 / A2 << endl;
				return 0;
			}
		}
	}
}











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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, X, Y;
    cin >> N >> X >> Y;
    vector<ll> ans(N - 1);
    repi2(i, 1, N - 1) {
        repi2(j, i + 1, N) {
            ll mini = min({abs(i - j), abs(X - i) + 1 + abs(Y - j), abs(X - j) + 1 + abs(Y - i)});
            ans[mini - 1]++;
        }
    }
    iter(i, ans) cout << i << endl;
    return 0;
}


Measured memory_bytes: 3632
n = int(input())
words = {"AC":0, "WA":0, "TLE":0, "RE":0}
for i in range(n):
  a = input()
  words[a] += 1
print("AC x " + str(words["AC"]))
print("WA x " + str(words["WA"]))
print("TLE x " + str(words["TLE"]))
print("RE x " + str(words["RE"]))

Measured memory_bytes: 9164
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if((a == b && a != c) | (a == c && b != c) | (b == c && a != c)){
  	cout << "Yes" << endl;
    }else{
    	cout << "No" << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
#define fori(i,a,b) for(int i=(a);i<(int)(b);i++)
#define repi(i,n) fori(i,0,n)
#define forr(i,a,b) for(int i=int(b-1);i>=int(a);i--)
#define repr(i,n) forr(i,0,n)
#define all(x) (x).begin(),(x).end()
#define fill(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define mp make_pair
#define pcnt __builtin_popcount
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;}

void solve(){
    ll t;cin>>t;
    repi(i,t){
        ll n,d;
        cin>>n>>d;
        priority_queue<ll,vector<ll>,greater<ll>> q;
        q.push(d);
        repi(j,n-1){
            ll x=q.top();
            q.pop();
            q.push(127);
            q.push(127^x);
        }
        ll sum=0;
        while(!q.empty()){
            ll x=q.top();
            q.pop();
            sum+=x;
        }
        cout<<sum<<endl;
    }
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define chmin(x,y) x = min(x,y)
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
    int N;
	cin >> N;
    vector<vector<int>> a(N, vector<int>(N));
    rep(i,N) rep(j,N) cin >> a[i][j];

    vector<vector<ll>> dp(30, vector<ll>((1<<21)+10));
    dp[0][0] = 1;

    rep(i,N) rep(s,(1<<N)) {
        if (dp[i][s] != 0) rep(j, N) {
            if (!(s&(1<<j)) && a[i][j]) {
                dp[i+1][s|(1<<j)] = (dp[i+1][s|(1<<j)] + dp[i][s]) % MOD;
            } 
        }
    }
	cout << dp[N][(1<<N)-1] << endl;
	return 0;
}


Measured memory_bytes: 508288
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> P;

signed main(){
    vector<int> prime(100010, 1), num(100010, 0);
    prime[0] = 0; prime[1] = 0;
    for(int i = 2; i < prime.size(); i++){
        if(!prime[i]) continue;
        for(int j = i * 2; j < prime.size(); j += i){
            prime[j] = 0;
        }
    }
    for(int n = 3; n < prime.size(); n++){
        if(prime[n] && prime[(n + 1)/2]){
            num[n] = 1;
        }
    }
    for(int i = 1; i < num.size(); i++) num[i] += num[i - 1]; 
    int Q; cin >> Q;
    for(int i = 0; i < Q; i++){
        int l, r; cin >> l >> r;
        cout << num[r] - num[l - 1] << '\n';
     }
}    

Measured memory_bytes: 2176
#include<bits/stdc++.h>
#define maxn 500010
#define mod 998244353
using namespace std;
typedef long long ll;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,m,mx,mn;
int ci_n[maxn],ci_m[maxn];
int fac[maxn],inv[maxn];
int quick_pow(int x,int p)
{
    int an=1,po=x;
    while(p)
    {
        if(p&1)  an=1ll*an*po%mod;
        po=1ll*po*po%mod;
        p>>=1;
    }
    return an;
}
int ans;
void add(int &x,int y)
{
    x=(x+y>=mod)?x+y-mod:x+y;
}
int C(int x,int y)
{
    return 1ll*fac[x]*inv[y]%mod*inv[x-y]%mod;
}
int main()
{
    n=read();m=read();mx=max(n,m);mn=min(n,m);
    fac[0]=1;
    for(int i=1;i<=mx;i++)  fac[i]=1ll*fac[i-1]*i%mod;
    inv[mx]=quick_pow(fac[mx],mod-2);
    for(int i=mx-1;i>=0;i--)  inv[i]=1ll*inv[i+1]*(i+1)%mod;
    ci_m[0]=ci_n[0]=1;
    for(int i=1;i<=n;i++)  ci_m[i]=1ll*ci_m[i-1]*(m+1)%mod;
    for(int i=1;i<=m;i++)  ci_n[i]=1ll*ci_n[i-1]*(n+1)%mod;
    for(int i=0;i<=mn;i++)
    {
        int tmp=1ll*C(n,i)*C(m,i)%mod*fac[i]%mod*ci_m[n-i]%mod*ci_n[m-i]%mod;
        add(ans,(i&1)?mod-tmp:tmp);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define rep(i,N) for(long long i = 0; i < (long long)(N); i++)
#define repr(i,N) for(long long i = (long long)(N) - 1; i >= 0; i--)
#define rep1(i,N) for(long long i = 1; i <= (long long)(N) ; i++)
#define repr1(i,N) for(long long i = (N) ; (long long)(i) > 0 ; i--)
#define each(x,v) for(auto& x : v)
#define all(v) (v).begin(),(v).end()
#define sz(v) ((int)(v).size())
#define ini(...) int __VA_ARGS__; in(__VA_ARGS__)
#define inl(...) long long __VA_ARGS__; in(__VA_ARGS__)
#define ins(...) string __VA_ARGS__; in(__VA_ARGS__)
using namespace std; void solve();
using ll = long long; template<class T = ll> using V = vector<T>;
using vi = V<int>; using vl = V<>; using vvi = V< V<int> >;
constexpr int inf = 1001001001; constexpr ll infLL = (1LL << 61) - 1;
struct IoSetupNya {IoSetupNya() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); cerr << fixed << setprecision(7);} } iosetupnya;
template<typename T, typename U> inline bool amin(T &x, U y) { return (y < x) ? (x = y, true) : false; }
template<typename T, typename U> inline bool amax(T &x, U y) { return (x < y) ? (x = y, true) : false; }
template<typename T, typename U> ostream& operator <<(ostream& os, const pair<T, U> &p) { os << p.first << " " << p.second; return os; }
template<typename T, typename U> istream& operator >>(istream& is, pair<T, U> &p) { is >> p.first >> p.second; return is; }
template<typename T> ostream& operator <<(ostream& os, const vector<T> &v) { int s = (int)v.size(); rep(i,s) os << (i ? " " : "") << v[i]; return os; }
template<typename T> istream& operator >>(istream& is, vector<T> &v) { for(auto &x : v) is >> x; return is; }
void in(){} template <typename T,class... U> void in(T &t,U &...u){ cin >> t; in(u...);}
void out(){cout << "\n";} template <typename T,class... U> void out(const T &t,const U &...u){ cout << t; if(sizeof...(u)) cout << " "; out(u...);}
template<typename T>void die(T x){out(x); exit(0);}
#ifdef NyaanDebug
  #include "NyaanDebug.h"
  #define trc(...) do { cerr << #__VA_ARGS__ << " = "; dbg_out(__VA_ARGS__);} while(0)
  #define trca(v,N) do { cerr << #v << " = "; array_out(v , N);cout << endl;} while(0)
#else
  #define trc(...)
  #define trca(...)
  int main(){solve();}
#endif
 
#define inc(...) char __VA_ARGS__; in(__VA_ARGS__)
#define in2(N,s,t) rep(i,N){in(s[i] , t[i]);}
#define in3(N,s,t,u) rep(i,N){in(s[i] , t[i] , u[i]);}
using vd = V<double>; using vs = V<string>; using vvl = V< V<> >;
template<typename T>using heap = priority_queue< T , V<T> , greater<T> >;
 
using P = pair<ll,char>; using vp = V<P>;
constexpr int MOD = /**/ 1000000007; //*/ 998244353;
//////////////////

void solve(){
  ini(N , M);
  vi cnt(N);
  rep(i , M){
    ini(x , y); x--; y--;
    cnt[x]++ , cnt[y]++;
  }
  each(x , cnt){
    if(x % 2) die("NO");
  }
  out("YES");
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#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 pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
lll gcd(lll a,lll b,lll &x,lll &y){if(!b){x=1;y=0;return a;}lll d=gcd(b,a%b,y,x);y-=a/b*x;return d;}
ll gcd(ll a,ll b){lll x=0,y=0; return gcd(a, b, x, y);}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
const int N = 0;
int n;
string w, w2;
set<string> s;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n;
  FOR(i, 0, n){
    cin >> w;
    if(s.find(w) != s.end() || i && w[0] != w2[sz(w2)-1]){
      cout << "No" << endl;
      return 0;
    }
    w2 = w;
    s.insert(w);
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    static int[] w;
    static int k;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
            k = sc.nextInt();
            w = new int[n];

        int minP = 0;
        int maxP = (int) 1E9;
        for (int i = 0; i < n; i++) {
            w[i] = sc.nextInt();
        }

        // f(p) が初めてn以上になるpを求める。
        int midP = 0;
        while (maxP > minP) {
            midP = (maxP + minP) / 2;
            int tempN = f(midP);
            
            if (tempN >= n) maxP = midP;
            else if (tempN < n) minP = midP + 1;
        }
        System.out.println(maxP);
    }
    
    // 最大積載量pのトラックk台に、wの要素はいくつ載せられるか?
    static int f(int p) {
        int i = 0;
        for (int iK = 0; iK < k; iK++) {
            int pK = 0;
            while (pK + w[i] <= p) {
                pK += w[i];
                i++;
                if (i == w.length) return w.length;
            }
        }
        return i;
    }
}


Measured memory_bytes: 71876
import sys


class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)

    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s

    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i


MOD = 998244353
n = int(input())
xys = []
ys = []
for line in sys.stdin:
    x, y = map(int, line.split())
    xys.append((x, y))
    ys.append(y)
ys.sort()
y_dict = {y: i + 1 for i, y in enumerate(ys)}
xys = [(x, y_dict[y]) for x, y in xys]
xys.sort()
f_bit = Bit(n)
b_bit = Bit(n)
for i in range(1, n + 1):
    b_bit.add(i, 1)

p2d = [1]
for i in range(n):
    p2d.append(p2d[-1] * 2 % MOD)

ans = 0
for i, (x, y) in enumerate(xys):
    b_bit.add(y, -1)
    a = f_bit.sum(y)
    b = i - a
    c = b_bit.sum(y)
    d = (n - i - 1) - c
    f_bit.add(y, 1)
    # print(i, x, y, a, b, c, d)
    pa, pb, pc, pd = p2d[a], p2d[b], p2d[c], p2d[d]
    tmp = p2d[n - 1]
    tmp += (pa - 1) * (pd - 1) * pb * pc
    tmp += (pb - 1) * (pc - 1) * pa * pd
    tmp -= (pa - 1) * (pb - 1) * (pc - 1) * (pd - 1)
    ans = (ans + tmp) % MOD
print(ans)


Measured memory_bytes: 112980
#include<stdio.h>
#include<math.h>
main(){
  int i,N,l,sum=0;
  scanf("%d",&N);
  i=N;
  for(l=(int)log10(N);l>=0;l--){
    sum+=N/(int)pow(10,l);
    N%=(int)pow(10,l);
  }
  if(i%sum) puts("No");
  else puts("Yes");
}


Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<cstdio>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int INF = 1e9 + 7;
int H, W;;
vector<vector<char>>G;
char a[1010][1010];
ll dp[1010][1010] = {};
int main() {
	cin >> H >> W;
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			cin >> a[i][j];
		}
	}
	dp[0][0] = 1;
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (a[i][j] == '#')continue;
			dp[i + 1][j] += dp[i][j];
			dp[i + 1][j] %= INF;
			dp[i][j + 1] += dp[i][j];
			dp[i][j + 1] %= INF;
		}
	}
	cout << dp[H - 1][W - 1] << endl;
	return 0;
}

Measured memory_bytes: 9216
#include <stdio.h>
int main(){
  int N, K, i, x, res=0;
  scanf("%d %d", &N, &K);
  for (i=0; i<N; i++) {
    scanf("%d", &x);
    if (x*2<(K-x)*2) res+=x*2;
    else res+=(K-x)*2;
  }
  printf("%d\n", res);
  return 0;
}

Measured memory_bytes: 128
st = list(input())
ls = list(set(st))
abc = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
set_ab = set(abc) - set(ls)
ans = list(set_ab)
ans.sort()
if ans:
    print(ans[0])
else:
    print("None")


Measured memory_bytes: 3956
#include <bits/stdc++.h>
using namespace std;
int solve(int A,int B, int C){
    int sum=0;
    if(C<=B){
        return sum=B+C;
    }
    else if(C<=A+B){
        sum=B+C;
        return sum;
    }
    else if (C>A+B) {
          sum=A+2*B+1;
          return sum;
    }
return 0;
}

int main(){
    int A,B,C;
    cin>>A>>B>>C;
    int sum=solve(A,B,C);
    cout<<sum<<endl;
}

Measured memory_bytes: 256
def main():
    S = list(map(int, input().split('/')))
    if S[0] < 2019:
        print('Heisei')
    elif S[0] == 2019:
        if S[1] <= 4:
            print('Heisei')
        else:
            print('TBD')
    else:
        print('TBD')


main()

Measured memory_bytes: 38256
#define ioFix ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

long long madd(long long x, long long y, long long modulo) {
  return (x + y) % modulo;
}

long long mmult(long long x, long long y, long long modulo) {
  return (x * y) % modulo;
}

long long mpow(long long base, long long exponent, long long modulo) {
  long long res = 1;
  for(int i = 0; i < exponent; i++)
    res = (res * base) % modulo;
  return res;
}

long long mfac(long long n, long long modulo) {
  long long res = 1;
  for(int i = 2; i <= n; i++)
    res = (res * i) % modulo;
  return res;
}

long long mcomb(long long n, long long k, long long modulo) {
  return mfac(n, modulo) / mmult(mfac(k, modulo), mfac(n-k, modulo), modulo);
}


#define PI (2.0 * acos(0.0))
#define INF (int)1e9
#define LINF (long long)1e18
#define EPS 1e-9

#define ll long long
#define ull unsigned long long

#define pii pair<int, int>
#define pll pair<long long, long long>
#define pdd pair<double, double>
#define pcc pair<char, char>
#define pbb pair<bool, bool>

#define vi vector<int>
#define vvi vector<vector<int>>
#define vd vector<double>
#define vvd vector<vector<double>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vvs vector<vector<string>>

#define REP(n) for(int xix = 0; xix < (n); xix++)
#define FOR(i, from, to) for(int (i) = from; (i) < (to); (i)++)
#define RANGE(i, from, to) for(int (i) = from; (i) <= (to); (i)++)
#define ALL(x) x.begin(),x.end()

#define pb push_back
#define mp make_pair
#define mt make_tuple

#define fillArray(arr, val) std::fill(std::begin(arr), std::end(arr), (val))

#define pow2(x) ((x)*(x))
#define mod(x, m) ((((x) % (m)) + (m)) % (m))
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))

#define watch(x) cout << (#x) << " is " << (x) << endl
#define watchVector(v) { for(int xvx = 0; xvx < (v).size(); xvx++) { cout << (v)[xvx] << " "; } cout << endl; }
#define watchArray(arr, n) { for(int xax = 0; xax < (n); xax++) { cout << (arr)[xax] << " "; } cout << endl; }
#define watchMatrix(x, rows, cols) for(int r = 0; r < (rows); r++) { for(int c = 0; c < (cols); c++) { cout << (x)[r][c] << " "; } cout << endl; }



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


int main() {
  ioFix;
  int N, H, W;
  cin >> N >> H >> W;
  int counter = 0;
  REP(N) {
    int h, w;
    cin >> h >> w;
    if(h >= H && w >= W)
      counter++;
  }
  cout << counter << endl;
}


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

int main()
{
    int k,a,b;
    scanf("%d%d%d",&k,&a,&b);
    int i,flag=0;
    for(i=a;i<=b;i++){
        if(i%k==0)
            flag=1;
    }
    if(flag)
        printf("OK");
    else
        printf("NG");

    return 0;
}


Measured memory_bytes: 1684
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = Integer.parseInt(scan.next());
		int K = Integer.parseInt(scan.next());
		long count = 0;
		if (K % 2 == 1) {
			for (int i = 1; i <= N; i++) {
				if (i % K == 0) {
					count++;
				}
			}
			count=count*count*count;
		} else {
			long count1 = 0;
			long count2 = 0;
			for (int i = 1; i <= N; i++) {
				if (i % K == 0) {
					count1++;
				} else if (i % K == (K / 2)) {
					count2++;
				}
			}
			count = count1*count1*count1 + count2*count2*count2;
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define reptr(i,n) for(int (i)=(n);(i)>=0;--(i))
#define All(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
const ll MOD=1e9+7;
using namespace std;

int main(){
  ll N,a[5];
  cin >> N;
  rep(i,5){
    cin >> a[i];
  }
  sort(a,a+5);
  ll ans = 4;
  ans += ( (N%a[0]==0) ? (N/a[0]) : (N/a[0]+1) );
  cout << ans << endl;
}

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

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

    string s;
    cin>>s;
    int n=s.size();
    int cnt=0;
    for(int i=0;i<n;i++){
        if(s[i]=='o') cnt++;
    }
    if(15-n + cnt >=8) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
int v[10];
int ans = 1490390;
int n,A,B,C;
void dfs(int a,int b,int c,int i,int unite){
  if(v[i] == -1){
    if(a == 0 || b == 0 || c == 0)return;
    std::vector<int>tmp(3);
    tmp[0] = a,tmp[1] = b,tmp[2] = c;
    sort(tmp.rbegin(),tmp.rend());
    a = tmp[0],b = tmp[1],c = tmp[2];
    int cost = 0;
    cost = abs(a - A) + abs(b - B) + abs(c - C) + unite;
    ans = std::min(ans,cost);
    return;
  }
  if(a == 0)dfs(a + v[i],b,c,i + 1,unite);
  else dfs(a + v[i],b,c,i + 1,unite + 10);
  if(b == 0)dfs(a ,b + v[i],c,i + 1,unite);
  else dfs(a ,b + v[i],c,i + 1,unite + 10);
  if(c == 0)dfs(a,b,c + v[i],i + 1,unite);
  else dfs(a,b,c + v[i],i + 1,unite + 10);
  dfs(a,b,c,i + 1,unite);
}
int main(){
  std::cin >> n >> A >> B >> C;
  for(int i = 0; i < n; i++)std::cin >> v[i];
  v[n] = -1;
  dfs(0,0,0,0,0);
  std::cout << ans << std::endl;
}


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

template <typename T>
struct Compress {
    vector<T> xs;
    int size = 0;

    Compress() = default;

    Compress(const vector<T>& vs) {
        add(vs);
    }

    void add(const vector<T>& vs) {
        copy(vs.begin(), vs.end(), back_inserter(xs));
    }

    void add(const T& x) {
        xs.push_back(x);
    }

    void build() {
        sort(xs.begin(), xs.end());
        xs.erase(unique(xs.begin(), xs.end()), xs.end());
        size = xs.size();
    }

    vector<int> compress(const vector<T>& vs) {
        vector<int> ret;
        transform(vs.begin(), vs.end(), back_inserter(ret), [&](const T& x) {
            return lower_bound(xs.begin(), xs.end(), x) - xs.begin();
        });
        return ret;
    }

    int compress(const T& x) {
        return lower_bound(xs.begin(), xs.end(), x) - xs.begin();
    }

    T decompress(int i) {
        return xs[i];
    }
};

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

    int N;
    cin >> N;
    vector<int> x1(N), y1(N), x2(N), y2(N);
    for (int i = 0; i < N; i++) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
    Compress<int> cx, cy;
    cx.add(x1);
    cx.add(x2);
    cy.add(y1);
    cy.add(y2);
    cx.build();
    cy.build();
    vector<vector<int>> cnt(2 * N, vector<int>(2 * N));
    for (int i = 0; i < N; i++) {
        int xx1 = cx.compress(x1[i]), xx2 = cx.compress(x2[i]);
        int yy1 = cy.compress(y1[i]), yy2 = cy.compress(y2[i]);
        cnt[xx1][yy1]++;
        cnt[xx1][yy2]--;
        cnt[xx2][yy1]--;
        cnt[xx2][yy2]++;
    }
    ll ans = 0;
    for (int i = 0; i < 2 * N; i++) {
        for (int j = 0; j < 2 * N; j++) {
            if (i > 0) cnt[i][j] += cnt[i-1][j];
            if (j > 0) cnt[i][j] += cnt[i][j-1];
            if (i > 0 && j > 0) cnt[i][j] -= cnt[i-1][j-1];
            if (cnt[i][j]) ans += (ll) (cx.decompress(i + 1) - cx.decompress(i)) * (cy.decompress(j + 1) - cy.decompress(j));
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 65632
#include <bits/stdc++.h>
using namespace std;
#define rep(i,x) for(int i=0;i<x;i++)
 
int main(){
    long long h,w,m,ans(0);
    cin >> h >> w;
 
    m = h*w;
 
    if(h==1||w==1){
        puts("1");
        return 0;
    }
 
    if(m%2==0){
        cout << m/2 << endl;
        return 0;
    }else{
        cout << m/2+1 << endl;
        return 0;
    }
}

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

ll p[51]={};
ll a[51]={};

ll saiki(ll N, ll X){
    if(N == 0){
        return ((X<=0)?0:1);
    }else{
        if(X <= ll(a[N]/2)){
            return saiki(N-1, X-1);
        }else if(X == ll(a[N]/2) +1){
            return p[N-1] + 1;
        }else{
            return p[N-1] + 1 + saiki(N-1, X-2-a[N-1]);
        }
        //pair<ll,ll> p = saiki(N-1);
        //return make_pair(p.first*2+1, p.second*2+2);
    }
}

int main(){
    ll N,X;
    cin >> N >> X;
    p[0] = 1;
    a[0] = 1;
    rep(i,N){
        p[i+1] = p[i]*2 + 1;
        a[i+1] = a[i]*2 + 3;
    }
    ll ans = saiki(N,X);

    cout << ans << endl;
}
/*
1 3 7
1 5 13
*/
//BBPPPB P BPPPBB

Measured memory_bytes: 256
import std.stdio,
       std.string,
       std.conv;

void main() {
    int N;
    while(N = readln.chomp.to!int, N) {
        auto i = readln.split;
        int[] a;
        foreach(v; i)
            a ~= v.to!int;
        int o, t;
        foreach(v; a) {
            if(v > 0)
                o++;
            if(v > 1)
                t++;
        }
        if(!t)
            "NA".writeln;
        else
            (o+1).writeln;
    }
}

Measured memory_bytes: 4340