akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <utility>
#include <memory>
#include <functional>
#include <deque>
#include <cctype>
#include <ctime>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


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

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll;
typedef vector<vector<long long> > vvll;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}

#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i,n) _rep2((i),0,(n))
#define _rep2(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define fi first
#define se second
#define mkp make_pair
#define DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

void mainmain(){
	int n;
	cin>>n;
	vint D(n);
	rep(i,n) cin>>D[i];
	sort(ALL(D));
	int l = 0;
	int r = 13;
	while(r-l>1){
		int mid = (r+l)/2;
		// cout<<l<<" "<<r<<endl;
		bool ok = true;
		multiset<int> se;
		se.insert(0);
		se.insert(24);
		rep(i,n){
			auto it = se.upper_bound(D[i]);
			it--;
			int tmp = *it;
			if(D[i]-tmp<mid) se.insert(24-D[i]);
			else se.insert(D[i]);
		}
		auto it = se.begin();
		it++;
		while(it!=se.end()){
			auto it2 = it;
			it2--;
			if(*it - *it2 < mid) ok = false;
			it++;
		}
		if(ok) l = mid;
		else r = mid;
	}
	cout<<l<<endl;
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout<<fixed<<setprecision(20);
    mainmain();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  double l; cin >> l;
  double ans = pow(l/3.0,3);
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int N = nextInt();


  map<string,int> count;
  REP(i, N) {
    string s; cin >> s;
    ++count[s];
  }

  int best = 0;
  vector<string> ans;
  for (auto p : count) {
    if (best < p.second) {
      best = p.second;
      ans.clear();
      ans.push_back(p.first);
    } else if (best == p.second) {
      ans.push_back(p.first);
    }
  }
  sort(ALL(ans));
  for (auto s : ans) {
    printf("%s\n", s.c_str());
  }
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 26868
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, T, mincost=INF;
  vector<int> c(N), t(N);
  cin >> N >> T;
  REP(i,N) {
    cin >> c.at(i) >> t.at(i);
    if(t.at(i)<=T) {
      if(c.at(i)<mincost) mincost=c.at(i);
    }
  }
  if(mincost==2147483647) cout << "TLE" << endl;
  else cout << mincost << endl;
}

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

int main(){
  int n, p;
  int player[50];

  while(1){
    cin >> n >> p;
    if(n == 0 || p == 0) break;
    for(int i = 0; i < n; i++) player[i] = 0;

    //ゲーム開始
    int i = 0;
    int win = p;
    while(1){
      if(p > 0){
	p--;
	player[i]++;
	//勝利条件
	if(p == 0 && player[i] == win){
	  cout << i << endl;
	  break;
	}
      }else{
	p += player[i];
	player[i] = 0;
      }
      i++;
      if(i == n) i = 0;
    }
  }

  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using vvd = vector<vd>;
using vl = vector<ll>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using vs = vector<string>;
#define rep(i,n) range(i,0,n)
#define range(i,a,n) for(int i=a;i<n;i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.141592653589793

template<class S, class T>ostream&operator<<(ostream&os, pair<S, T>p)
{
	os << "[" << p.first << "," << p.second << "]"; return os;
}
template<class S>auto&operator<<(ostream&os, vector<S>t)
{
	bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; }
	return os;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s1, s2;
	while (cin >> s1, s1!="." ) {
		cin >> s2;
		vector<pair<string, int>> tok1(1);
		vector<pair<string, int>> tok2(1);
		int inner = 0;
		for (auto c : s1) {
			if (c == '"') {
				if (inner == 0) {
					inner = 1;
				}
				else {
					inner = 0;
				}
				tok1.emplace_back("", inner);
			}
			else {
				tok1.back().first += c;
			}
		}
		inner = 0;
		for (auto c : s2) {
			if (c == '"') {
				if (inner == 0) {
					inner = 1;
				}
				else {
					inner = 0;
				}
				tok2.emplace_back("", inner);
			}
			else {
				tok2.back().first += c;
			}
		}
		int ans = 0;
		if (tok1.size() == tok2.size()) {
			int diff = 0;
			rep(i, tok1.size()) {
				if (tok1[i].sc != tok2[i].sc) {
					ans = 2; break;
				}
				else {
					if (tok1[i].sc == 0) {
						if (tok1[i].fs != tok2[i].fs) {
							ans = 2;
							break;
						}
					}
					else {
						if (tok1[i].fs != tok2[i].fs) {
							ans++;
						}
					}
				}
			}
		}
		else {
			ans = 2;
		}
		if (ans == 0)cout << "IDENTICAL" << endl;
		else if (ans == 1)cout << "CLOSE" << endl;
		else cout << "DIFFERENT" << endl;
	}
	return 0;
}



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

using namespace std;

const int maxn = 1e5 + 5;
vector<int> jobs[maxn];

int main()
{
    int n, m;
    cin >> n >> m;
    long long answer = 0, day = 0;

    priority_queue<int> valid;

    for (int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        jobs[a].push_back(b);
    }

    for (int i = m - 1; i >= 0; i--)
    {
        for (auto x : jobs[m - i])
            valid.push(x);

        if (!valid.empty())
        {
            answer += valid.top();
            valid.pop();
        }
    }

    cout << answer << endl;

    return 0;
}

Measured memory_bytes: 5632
use std::cmp::min;
use std::collections::HashMap;

#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr)=>{
        {
        (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn to_map(s: &str) -> HashMap<char, usize> {
    let mut map = HashMap::new();
    for c in s.chars() {
        let n = map.entry(c).or_insert(0);
        *n += 1
    }
    map
}

fn main() {
    let n = scan!(usize);
    let ss = scan!(;;n);

    let mut map = to_map(&ss[0]);
    for s in ss.iter() {
        let m = to_map(&s);
        for (k, v) in map.clone().iter() {
            if m.contains_key(k) {
                let val = map.entry(*k).or_insert(0);
                *val = min(m[k], *v)
            } else {
                map.remove(k);
            }
        }
    }

    let mut acc = String::new();
    for (k, v) in map.iter() {
        for _ in 0..*v {
            acc.push(*k)
        }
    }
    let mut tmp: Vec<_> = acc.chars().collect();
    tmp.sort();
    println!("{}", tmp.into_iter().collect::<String>())
}


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

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <limits>
#include <iomanip>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

ll GCD(ll a, ll b) { if(b==0) return a; else return GCD(b, a%b); }
ll LCM(ll a, ll b) { return a/GCD(a,b)*b; }

class CHAndV {
public:
	void solve(std::istream& in, std::ostream& out) {
        int h,w,k;in>>h>>w>>k;
        vector<string> c(h);
        rep(i,h) in>>c.at(i);

        int ans=0;
        int res=0;
        for(int i = 0;i < (1 << h); ++i){
            for(int j = 0;j<(1<<w); ++j){
                bitset<6> hb(i);
                bitset<6> wb(j);
                res = 0;
                rep(ii, h){
                    rep(jj, w){
                        if(c.at(ii).at(jj)=='#' && hb.test(ii) && wb.test(jj)) ++res;
                    }
                }
                if(res==k) ++ans;

            }
        }
        out<<ans<<endl;

	}
};


int main() {
	CHAndV solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3164
#include <iostream>
#include <string>
#include <map>
#include <vector>
#define rep(i, n) for(int i=0 ; i<n; ++i)
#define rep2(i, j, n) for(int i=j; i<n; ++i)
using namespace std;
typedef long long ll;
typedef unsigned long ul;


int main(){

    ll N;
    cin>>N;
    string S;
    cin >> S;
    int flag = 1;
    while(true){
        flag = 1;
        rep(i, S.size()-1){
            if(S[i] == S[i+1]){
                S.erase(i,1);
                flag = 0;
            }
        }
        if(flag == 1)break;
    }
    cout<<S.size()<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define INF 1.0e9
using namespace std;
typedef long long ll;

int ABC[3];

int main() {
    for (int i = 0; i < 3; i++) cin >> ABC[i];
    sort(begin(ABC), end(ABC));
    cout << ABC[2]*10 + ABC[1] + ABC[0] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int h, n;
	cin >> h >> n;
	int sum = 0;
	for (int i = 0; i < n; ++i) {
		int x;
		cin >> x;
		sum += x;
	}
	if (sum >= h) {
		cout << "Yes\n";
	} else {
		cout << "No\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n); i >= 0; i--)
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;
// 多次元 vector 生成
template <class T> vector<T> make_vec(size_t a) { return vector<T>(a); }
template <class T, class... Ts> auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

int dp[45][420][420];

int main() {
    int N, Ma, Mb;
    cin >> N >> Ma >> Mb;

    vector<int> a(N), b(N), c(N);
    REP(i, N) { cin >> a.at(i) >> b.at(i) >> c.at(i); }

    REP(i, 45) {
        REP(j, 420) {
            REP(k, 420) { dp[i][j][k] = INF; }
        }
        dp[i][0][0] = 0;
    }

    REP(i, N) {
        REP(j, 400) {
            REP(k, 400) {
                if (dp[i][j][k] != INF) {
                    FOR(l, i, N) { chmin(dp[l + 1][j + a[i]][k + b[i]], dp[i][j][k] + c[i]); }
                }
            }
        }
    }
    /*
        REP(j, 10) {
            REP(k, 10) { cout << dp[N][j][k] << " "; }
            cout << endl;
        }
    */
    int ans = INF;
    FOR(i, 1, 405) {
        int a = i * Ma;
        int b = i * Mb;
        if (a > 400 || b > 400) {
            break;
        }
        // cout << ans << endl;
        chmin(ans, dp[N][a][b]);
    }
    if (ans != INF) {
        cout << ans << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}


Measured memory_bytes: 31232
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 100000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define OUT(a) cout<<(a)<<endl
const int MAX = 1000000;
const int MOD = 1000000007;

int main(){
	vector<int> a(3);
	REP(i,3){
		cin>>a[i];
	}
	sort(ALL(a));
	if((a[0]==a[1]&&a[0]!=a[2])||(a[0]!=a[1]&&a[1]==a[2])) OUT("Yes");
	else OUT("No");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
		cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
	}
#else
#define debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define rall(c) c.rbegin(), c.rend()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
#define init(a, x) memset(a,x,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)
const int L=2e3+7;
map<ll,ll> counter;
ll fastexpo(ll x,ll y,ll m=1e9+7)
{
	ll temp=1;
	while(y>0)
	{
		if(y&1)temp = ((temp%m)*(x%m))%m;
		x = ((x%m)*(x%m))%m;
		y>>=1;
	}return temp;
}
ll dp[L], m = 1e9 + 7;
ll solve(ll s)
{
	if(s<0)return 0;
	if(s==0)return 1;
	if(dp[s] != -1)return dp[s];
	ll &ret = dp[s];
	ret = 0;
	FOR(i,3,s+1)
	{
		ret += solve( s-i);
		ret %= m;
	}
	// debug(x,s,ret);
	return ret;
}
void fff()
{
	ll s;
	cin >> s;
	FOR(i,0,s+1)
	{
		dp[i] =-1;
	}
	cout << solve(s) << ln;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//int t;cin >> t;while(t--)
	fff();
	return 0;
}

Measured memory_bytes: 3692
use proconio::input;
use proconio::marker::*;

fn main() {
    input! {
        s: Chars,
        t: Chars,
    }
    let mut f: bool = true;
    for i in 0..s.len(){
        if s[i] != t[i]{
            f = false;
        }
    }
    println!("{}", if f {"Yes"} else {"No"});
}


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

int main(){
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    int dp[k+1]={};
    for(int i=0;i<a[i];i++){
        dp[i]=2;
    }
    dp[a[0]]=1;

    for(int j=0;j<=k;j++){
        bool ok=false;
        for(int i=0;i<n;i++){
            if(j-a[i]<0) continue;
            if(dp[j-a[i]]==2) {ok=true;break;}
        }
        if(ok) dp[j]=1;
        else dp[j]=2;
    }
    if(dp[k]==1) cout<<"First";
    else if(dp[k]==2) cout<<"Second";
    
}

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

int main() {
  
  int A, B;
  cin >> A >> B;
  
  
  if( A<=5 ){ cout << 0 << endl; }
  else if( A<13 ){ cout << B/2 << endl; }
  else{ cout << B << endl; }
  

}

Measured memory_bytes: 764
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def main():
    S = input()
    for c in ascii_lowercase:
        if c not in S:
            print(c)
            return
    print("None")


if __name__ == '__main__':
    main()


Measured memory_bytes: 4712
#include <iostream>
#include <cstring>
#include<string>
#include<cctype>
using namespace std;


string TOupper(string a){
	string b = a;
	for (int j = 0; j < a.size(); j++){
		b[j] = toupper(a[j]);

	}
	
	return b;
}


int main(){
	string W;
	cin >> W;
	W = TOupper(W);
	int cnt = 0;
	while (1){
		string w;
		cin >> w;

		if (w == "END_OF_TEXT") break;
		else{
			w = TOupper(w);
			if (w == W) cnt++;
		}
	}

	cout << cnt << endl;

	return 0;
}



Measured memory_bytes: 3216
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn main(){
    let line: Vec<usize> = read_as_vec();
    let m = 2019;
    let (l, r) = (line[0], line[1]);

    if l/m != r/m{
        println!("0");
        return;
    }
    let lmod: usize = l%m;
    let rmod: usize = r%m;

    let mut ans = m;
    //println!("{:?}, {:?}", lmod, rmod);
    for i in lmod..rmod{
        for j in i+1..rmod+1{
            if (i*j)%m < ans{
                ans = (i*j)%m;
            }
        }
    }

    println!("{}", ans);
 }


Measured memory_bytes: 4352
#include <stdio.h>

int main(void){
    int a[1000];
    
    int i,n;
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    for(int j=0;j<n/2;j++){
        int temp=a[j];
        a[j]=a[n-j-1];
        a[n-j-1]=temp;
    }
    for(i=0;i<n;i++){
        if(i)printf(" ");
        printf("%d",a[i]);
    }
    printf("\n");
    
    return(0);
}




Measured memory_bytes: 2104
import itertools
l = itertools.permutations(range(8))
n = int(input())
r = [0] * n
c = [0] * n
for i in range(n):
    r[i], c[i] = map(int, input().split())
for a in l:
    m = [[0]* 8 for i in range(8)]
    for i in range(8):
        m[i][a[i]] = 1
    ok = 1
    for i in range(n):
        if m[r[i]][c[i]] != 1:
            ok = 0
    for j in range(8):
        if sum([m[i+j][i] for i in range(8-j)])>=2:
            ok = 0
        if sum([m[i][i+j] for i in range(8-j)])>=2:
            ok = 0
        if sum([m[i][j-i] for i in range(j+1)])>=2:
            ok = 0
        if sum([m[7-j+i][7-i] for i in range(j+1)])>=2:
            ok = 0
    if ok:
        for i in range(8):
            print(''.join(['Q' if m[i][j]==1 else '.' for j in range(8)]))


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

using namespace std;

#define rep(i, n) for (int i = 0; i < int(n); ++i)

int main() {
  int r[3] = {};
  while (true) {
    int a[3];
    rep (i, 3) cin >> a[i];
    sort(a, a + 3);
    if (a[0] + a[1] <= a[2]) break;
    if (a[0] * a[0] + a[1] * a[1] == a[2] * a[2]) ++r[0];
    if (a[0] * a[0] + a[1] * a[1] >  a[2] * a[2]) ++r[1];
    if (a[0] * a[0] + a[1] * a[1] <  a[2] * a[2]) ++r[2];
  }
  cout << r[0] + r[1] + r[2];
  rep (i, 3) cout << " " << r[i];
  cout << endl;
  return 0;
}

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

int main(){
  string a, op, b;
  cin >> a >> op >> b;
  int i_a = atoi(a.c_str());
  int i_b = atoi(b.c_str());
  cout << (op == "+" ? i_a + i_b : i_a - i_b) << endl;
}

Measured memory_bytes: 3132
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
using namespace std;
using Int = long long;
using ll = long long;
using Double = long double;
const Int INF = 1LL<<55;
const Int mod = (1e9)+7;
using P = pair<Int,Int>;
using T = tuple<Int,Int,Int>;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
ostream& operator<<(ostream& o,T t){return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){Int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){Int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}
class UF{
public:
  Int V;
  vector<Int> par,rnk,sz;
  set<Int> group;
  
  UF(){}
  UF(Int V):V(V),par(V),rnk(V,0),sz(V,1){
    for(Int i=0;i<V;i++)par[i]=i;
    for(Int i=1;i<V;i++) group.insert(i);
  }

  
  
  Int find(Int x){
    assert(x < V);
    if(par[x]==x)return x;
    return par[x]=find(par[x]);
  }
  
  void unite(Int x,Int y){
    x=find(x), y=find(y);
    if(x==y)return;
    if(rnk[x]<rnk[y])par[x]=y, sz[y] += sz[x], group.erase(x);
    else{
      par[y]=x;
      sz[x] += sz[y];
      group.erase(y);
      if(rnk[x]==rnk[y])rnk[x]++;
    }
  }

  bool same(Int x,Int y){return find(x)==find(y);}

  Int size(Int x){return sz[find(x)];}
};


Int n,m,K;
vector<T> E;
vector<Int> C;

Int kuraskal(){
  sort(E.begin(), E.end());
  UF uf(n + K+10);
  for(Int i=0;i<n;i++) if(C[i] != 0) uf.unite(i,n+C[i]);
  
  Int ans = 0, cnt = 0;
  for(Int i=0;i<m;i++){
    Int w,a,b; tie(w, a, b) = E[i];
    if(cnt == K-1) continue;
    if(uf.same(a, b)) continue;
    uf.unite(a, b);
    ans += w;
    cnt++;
  }
  if(cnt != K-1) return -1;
  return ans;
}


signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  cin>>n>>m>>K;

  C.resize(n);
  cin>>C;
  
  for(Int i=0;i<m;i++){
    Int a, b, w;
    cin>>a>>b>>w; a--,b--;
    E.push_back(T(w,a,b));
  }
  
  Int ans = kuraskal();
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 17520
#ifndef LOCAL
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#else
#include <iostream>
#include <iomanip> 
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <memory>
#include <cctype>
#include <cstring>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; } sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; } eni(!=) cerr << boolalpha << i; ris; } eni(==) ris << range(begin(i), end(i)); } sim, class b dor(pair < b, c > d) { ris << "(" << d.first << ", " << d.second << ")"; } sim dor(rge<c> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

template<typename T> void setmax(T& x, T y) {x = max(x, y);}
template<typename T> void setmin(T& x, T y) {x = min(x, y);}
#define fix(a) fixed << setprecision(a)
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define rep(i, a, b) for (int i = int(a); i < int(b); i++)
#define all(V) V.begin(), V.end()
#define rall(V) V.rbegin(), V.rend()
#define len(V) (int)V.size()
#define ll long long
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define endl '\n'

void solve(){
  int a, b, c;
  cin >> a >> b >> c;
  for (int i = 1; i <= 200; i++){
    if ((a * i) % b == c){
      cout << "YES";
      return;
    }
  }
  cout << "NO";
}

int main() {
  ios::sync_with_stdio(false);
  // cin.tie(0); cout.tie(0);
  int t = 1;
  // cin >> t;
  forn(i, t){
    solve();
  }
}

/* 

k (k-1) (k-1)

2 6 3
4 6 5
6 6 7
7 7 7

*/

Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


int main() {
    int A, B;
    cin >> A >> B;
    cout << A * B << endl;
}

















Measured memory_bytes: 3632
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

#define getchar getchar
#define putchar putchar
int32_t nextint(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); bool s=false; if(c=='-'){s=true;c=getchar();} uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
int64_t nextlong(void){ char c=getchar(); while(c!='-'&&(c<'0'||'9'<c)) c=getchar(); int s=0; if(c=='-'){s=1;c=getchar();} uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar(); } return s?-x:x; }
uint32_t nextstr(char *s){ char c=getchar(); while(c==' '||c=='\n') c=getchar(); uint32_t len=0; while(c!=' '&&c!='\n'){ *s++=c; len++; c=getchar(); } *s='\0'; return len; }

char ans[11];
int main(void){
	long n=nextlong();
	int a=0;
	long b=1, c=0;
	while(c<n){
		a++;
		b*=26;
		c+=b;
	}
	long k=n-c+b-1;
	char *s=&ans[9];
	while(a-->0){
		*s=k%26+'a';
		k/=26;
		s--;
	}
	printf("%s\n", s+1);
}


Measured memory_bytes: 1532
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <string>
#include <set>
#include <bitset>
#include <unordered_map>
#include <cmath>
#include <functional>
#include <map>
#include <cstdlib>
#include <stack>

using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
template <class T>
using Vvec = vector<vector<T> >;
using Graph = Vvec<int>;

template <class T>
void debug(T& v)
{
    for(auto& x: v) cout << x << " ";
    cout << endl;
}

bool alln(vector<int>& A){
    for(auto& x: A){
        if(x != A.size()) return false;
    }
    return true;
}

int main()
{
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    for(auto& x: A) cin >> x;

    vector<int> B(N);
    for(int k=0; k<K; k++){
        if(alln(A)){
            debug(A); return 0;
        }
        for(int i=0; i<N; i++){
            int l = max(0, i-A[i]);
            int r = i+A[i]+1;
            B[l]++;
            if(r<N) B[r]--;
        }
        for(int i=1; i<N; i++) B[i] = B[i-1] + B[i];

        for(int i=0; i<N; i++){
            A[i] = B[i];
            B[i] = 0;
        }
    }

    debug(A);
}

Measured memory_bytes: 4816
#include<bits/stdc++.h>
using namespace std;
int cnt,sum,ans;
int n,s;
void dfs(int sum,int k,int cnt){
	if(sum==s&&k<=
			10&&cnt==n){
		ans++;
		return;
	}
	if(sum>s||k==10||cnt>n)return;
	dfs(sum+k,k+1,cnt+1);
	dfs(sum,k+1,cnt);
}

int main() {

	while(1){
	cin>>n>>s;
	if(n==0&&s==0) break;
	ans=0;
	dfs(0,0,0);
	cout<<ans<<endl;
	}
}

Measured memory_bytes: 3004
#pragma warning(disable:4996)
#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;
TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM K, TNM V> using umap = unordered_map<K, V>;
TPL<TNM K, TNM V> using uset = unordered_set<K, V>;

TPL<class T> inline void OUT(const T &x) { cout << x << "\n"; }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;

TPL<TNM V, TNM H> void resize(vector<V>& v, const H h) { v.resize(h); }
TPL<TNM V, TNM H, TNM ... T> inline void resize(vector<V>& v, const H& h, const T ... t) { v.resize(h); for (auto& _v : v) resize(_v, t ...); }
TPL<TNM V, TNM T> void fill(V& x, const T& val) { x = val; }
TPL<TNM V, TNM T> inline void fill(vector<V>& vec, const T& val) { for (auto& v : vec) fill(v, val); }
TPL<TNM T> inline void UNIQUE(vector<T>& vec) { sort(ALL(vec)); vec.erase(unique(ALL(vec)), vec.end()); }
inline bool range2d(int x, int y, int W, int H) { return (x >= 0) && (y >= 0) && (W > x) && (H > y); }

int main(void) {
	string S, T;
	cin >> S >> T;
	int N = S.size();
	set<char> sS, sT;
	int cntS, cntT;
	cntS = cntT = 0;
	map<char, int> mS, mT;
	
	mS[S[0]] = cntS;
	mT[T[0]] = cntT;

	for (int i = 1; i < N; ++i) {
		if (!sS.count(S[i])) {
			cntS++;
			mS[S[i]] = cntS;
		}
		sS.insert(S[i]);

		if (!sT.count(T[i])) {
			cntT++;
			mT[T[i]] = cntT;
		}

		sT.insert(T[i]);
	}

	string S2, T2;
	REP(i, N) {
		int s = mS[S[i]];
		int t = mT[T[i]];
		S2 += to_string(s);
		T2 += to_string(t);
	}

	cout << (S2 == T2 ? "Yes" : "No") << endl;
	return 0;
}


Measured memory_bytes: 1684
#include <bits/stdc++.h>
#define int long long
#define ll long long
#define rep(i,n) for(int i=0;i<n;i++)
#define INF LLONG_MAX
#define eps LDBL_EPSILON
#define moder 1000000007
#define pie 3.141592653589793238462643383279
#define P std::pair<int,int>
#define prique priority_queue
using namespace std;
int n,ans[250010],used[510];
P x[510];
signed main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x[i].first;
		x[i].second=i;
		ans[x[i].first]=i;
	}
	sort(x+1,x+n+1);
	for(int i=1;i<=n*n;i++){
		if(ans[i]){
			used[ans[i]]++;
			continue;
		}
		bool flag=false;
		for(int j=1;j<=n;j++){
			if(i<x[j].first&&used[x[j].second]+1<x[j].second){
				ans[i]=x[j].second;
				used[x[j].second]++;
				flag=true;
				break;
			}
		}
		if(flag)continue;
		for(int j=1;j<=n;j++){
			if(used[x[j].second]+1<=n){
				ans[i]=x[j].second;
				used[x[j].second]++;
				flag=true;
				break;
			}
		}
		if(!flag){
			puts("No");
			return 0;
		}
	}
	memset(used,0,sizeof(used));
	for(int i=1;i<=n*n;i++){
		used[ans[i]]++;
		for(int j=1;j<=n;j++){
			if(i==x[j].first&&used[x[j].second]!=x[j].second){
				puts("No");
				return 0;
			}
		}
	}
	puts("Yes");
	for(int i=1;i<=n*n;i++)cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 3072
import java.io.IOException
import java.lang.NumberFormatException
import java.lang.StringBuilder

object AMain{
    fun solve(){
        val x = nextInt()
        if(x >= 30){
            println("Yes")
        }else{
            println("No")
        }
    }

    // Scanner based on uwi-san's Java FastScanner
    val stream = System.`in`
    val buffer = ByteArray(1024)
    var ptr = 0
    var buflen = 0

    fun hasNextByte(): Boolean{
        if(ptr < buflen){
            return true
        }else{
            ptr = 0
            try{
                buflen = stream.read(buffer)
            }catch (e: IOException){
                e.printStackTrace()
            }
            if(buflen <= 0){
                return false
            }
        }
        return true
    }

    fun readByte() =
        if(hasNextByte()) buffer[ptr++]
        else -1

    fun isPrintableChar(c: Byte) = c in 33..126

    fun hasNext(): Boolean{
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++
        return hasNextByte()
    }

    fun next(): String{
        if(!hasNext()) throw NoSuchElementException()
        val sb = StringBuilder()
        var b = readByte()
        while(isPrintableChar(b)){
            sb.appendCodePoint(b.toInt())
            b = readByte()
        }
        return sb.toString()
    }

    fun nextLong(): Long{
        if(!hasNext()) throw NoSuchElementException()
        var n = 0L
        var minus = false
        var b = readByte()
        if(b == '-'.toByte()){
            minus = true
            b = readByte()
        }
        if(b !in '0'.toByte()..'9'.toByte())
            throw NumberFormatException()
        while(true){
            if(b in '0'.toByte()..'9'.toByte()){
                n *= 10
                n += b - '0'.toByte()
            }else if(!isPrintableChar(b)){
                return if(minus) -n else n
            }else{
                throw NumberFormatException()
            }
            b = readByte()
        }
    }

    fun nextInt(): Int{
        val n1 = nextLong()
        if(n1 !in Int.MIN_VALUE..Int.MAX_VALUE)
            throw NumberFormatException()
        return n1.toInt()
    }

    fun NextDouble() = next().toDouble()
}

fun main(){
    AMain.solve()
}



Measured memory_bytes: 33796
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int right_ix[200000];
int bin[200000][20];
int num[200000];

void num2bin(const int _num, int _binary[20]) {
	int dammy = _num;
	REP(i, 20) {
		_binary[i] = dammy % 2;
		dammy /= 2;
	}
}

bool update_sum(ll &_sum, const int _num) {
	int sum_bin[20], num_bin[20];
	num2bin(_sum, sum_bin);
	num2bin(_num, num_bin);
	REP(i, 20) {
		if (sum_bin[i] == 1 && num_bin[i] == 1) return false;
	}
	_sum += _num;
	return true;
}

int main() {
	int N;
	cin >> N;
	REP(i, N) {
		cin >> num[i];
	}

	ll ans = 0;
	ll sum = 0;

	// しゃく取り法
	// Start
	REP(i, N) {

		if (i > 0) {
			sum -= num[i - 1];
			right_ix[i] = right_ix[i - 1];

			// End
			REPS(j, right_ix[i - 1] + 1, N) {
				if (update_sum(sum, num[j])) {
					right_ix[i] = j;
				}
				else {
					right_ix[i] = j - 1;
					break;
				}
			}
		}
		// i==0 のとき
		else {
			REP(j, N) {
				if (update_sum(sum, num[j])) {
					right_ix[0] = j;
				}
				else {
					right_ix[0] = j - 1;
					break;
				}
			}
		}
		//cout << right_ix[i] << endl;
		ans += (right_ix[i] - i + 1);
	}
	cout << ans;
	system("pause");
	return 0;
}

Measured memory_bytes: 2040
#include<stdio.h>
int N;
char s[11] = "a";
void nyan(int x){
	if(x == N){
		puts(s);
		return;
	}
	char maxi = 'a';
	for(int i=0; i<x; i++)maxi = maxi<s[i]?s[i]:maxi;
	for(char c='a'; c<=maxi+1; c++){
		s[x] = c;
		nyan(x+1);
	}
	return;
}
int main(){
	scanf("%d", &N);
	nyan(1);
	return 0;
}


Measured memory_bytes: 1660
/*
find integral(0, 600) x^2
*/

#include<iostream>
#include<fstream>
using namespace std;

int f(int x);
const int btm = 0, top = 600;

int main() {
	int d;

	while(cin >> d && d != EOF) {
		int itg = 0;
		for(int i = btm + d; i < top; i += d) { itg += f(i) * d; }

		cout << itg << endl;
	}
}

int f(int x) {
	return x * x;
}

Measured memory_bytes: 0
n,a,b=map(int,input().split())
s=input()
c,d=0,0
for i in range(n):
  f=0
  if s[i]=="a":
    if c<a+b:
      f=1
      c+=1
  if s[i]=="b":
    if c<a+b and d<b:
      f=1
      c+=1
      d+=1
  print("Yes" if f==1 else "No")

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

int main()
{
    std::ios_base::sync_with_stdio(0);
    int n;
    std::cin >> n;
    int result = 0;
    int b;
    std::cin >> b;
    result += b;
    for (int i=1;i<n-1;++i)
    {
        int bb;
        std::cin >> bb;
        result += std::min(b, bb);
        b = bb;
    }
    result += b;
    std::cout << result << std::endl;
    return 0;
}

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

int main() {
	
	int  n, m;
	cin >> n >> m;
	vector<int> k(m);
	vector<vector<int>> s(m, vector<int>(n));
	vector<int> p(m);
	
	rep(i, m){
		cin >> k[i];
		rep(j, k[i]){
			cin >> s[i][j];
		}
	}
	rep(i, m) cin >> p[i];
	
	int res = 0;
	
	for(int bit = 0; bit < (1<<n); bit++){
		bool flag = 0;
		rep(i, m){
			bool parity = 0;
			rep(j, k[i]){
				if( (1 << (s[i][j]-1) ) & bit ) parity ^= 1;
			}
			if(parity == p[i]) continue;
			else{
				flag = 1;
				break;
			}
		}
		if(flag == 0) res++;
	}
	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;cin>>n;
  vector<ll>a(n),sum(n+1);
  rep(i,n)cin>>a[i];
  rep(i,n)sum[i+1]=sum[i]+a[i];
  ll res=1e15;
  rep(i,n)
  {
    //cout<<i<<endl;
    ll suml=sum[i+1],sumr=sum[n]-sum[i+1];
    auto itl=lower_bound(all(sum),(suml+1)/2);
    ll p=max(suml-*itl,*(--itl)),q=suml-p;
    auto itr=lower_bound(all(sum),(sumr+1)/2+suml);
    //cout<<*itr<<endl;
    ll r=max(sumr+suml-*itr,*(--itr)-suml),s=sumr-r;
    //cout<<p<<" "<<q<<" "<<r<<" "<<s<<endl;;
    chmin(res,max({p,q,r,s})-min({p,q,r,s}));

  }
  cout<<res<<endl;
  return 0;

}


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

typedef long long llong;

const int maxn=1e5;

int m,d;

int main()
{
    scanf("%d%d",&m,&d);
    int ans=0;
    for(int i=1;i<=m;i++)
    {
        for(int j=10;j<=d;j++)
        {
            if(j%10<2||j/10<2) continue;
            if(i==j%10*(j/10%10))
                ans++;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import Data.IORef
import Control.Monad
 
main :: IO()
main = getLine >> getContents >>= solve.map read.lines >>= print
 
solve :: [Int] -> IO Int
solve (x:y:xs) = do
                  a <- newIORef (y - x)
                  b <- newIORef (min x y)
                  forM_ xs $ \z -> do
                    a' <- readIORef a
                    b' <- readIORef b
                    when (z - b' > a') $ writeIORef a (z - b')
                    when (z < b')      $ writeIORef b z
                  readIORef a

Measured memory_bytes: 5492
#include <bits/stdc++.h>
using namespace std;
char in[120];
pair<pair<string,int>,int> p[110];
int main(){
int a;scanf("%d",&a);
for(int i=0;i<a;i++){
int t;scanf("%s%d",in,&t);
string tmp=in;
p[i]=make_pair(make_pair(in,-t),i);
}
std::sort(p,p+a);
for(int i=0;i<a;i++)printf("%d\n",p[i].second+1);
}

Measured memory_bytes: 256
#include<stdio.h>

int main(void){
	char number[1001];
	int num,sum=0;
	int j;
	
	while(1){
		scanf("%s",number);
		if(number[0]=='0')break;
		
		for(j =0;number[j]!='\0';j++){
			num=number[j] -'0';
			sum +=num;
		}
		printf("%d\n",sum);
		sum =0;
	}
	return 0;
}

Measured memory_bytes: 536
#include <iostream>

using namespace std;
int main() {
    int n,s=0;
    int C[100],V[100],delt[100]={0};
    cin>>n;
    for (int i = 0; i < n; ++i) {
        cin>>C[i];

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

    }
    for (int i = 0; i < n; ++i) {
        if(C[i]-V[i]>0)
            s+=C[i]-V[i];

    }
    cout<<s<<endl;


}

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

using namespace std;
typedef long long int ll;
const int N=1050,M=1000000007;
char s[N][N];
int dp[N][N],n,m;
int play(int x,int y){
	if(dp[x][y]!=-1) return dp[x][y];
	int sum=0;
	if(x+1<n&&s[x+1][y]!='#') sum=(sum+play(x+1,y)%M)%M;
	if(y+1<m&&s[x][y+1]!='#') sum=(sum+play(x,y+1)%M)%M;
	dp[x][y]=sum;
	return dp[x][y];
}
int main(){
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(NULL);
	int i,j;
	cin>>n>>m;
	for(i=0;i<n;++i) for(j=0;j<m;++j){
		cin>>s[i][j];
		dp[i][j]=-1;
	}
	dp[n-1][m-1]=1;
	cout<<play(0,0);
}

Measured memory_bytes: 8732
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		System.out.println((H - h) * (W - w));

	}

}


Measured memory_bytes: 25300
// Aizu 1200: Goldbach's Conjecture
// 2017.9.16 bal4u@uu
#include <stdio.h>

#define MAX  32768	 // 2^15
#define SQRT 181     // sqrt(MAX)
char prime[MAX + 3], *p, *q, *pmax = prime + MAX;

void mkprime()
{
	int k;
	prime[1] = 1;
//	for (p = prime + 4; p <= pmax; p += 2) *p = 1;
	for (k = 3, p = prime + 3; k <= SQRT; k += 2, p += 2)
		if (!*p) for (q = p + k; q <= pmax; q += k) *q = 1;
}

int main()
{
	int n, m, p, ans;

	mkprime();
	while (scanf("%d", &n) && n) {
		if (n == 4) ans = 1;
		else for (ans = 0, m = n >> 1, p = 3; p <= m; p += 2) if (!prime[p] && !prime[n - p]) ans++;
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1820
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			while(sc.hasNext()) {
				int N=sc.nextInt();
				int M=sc.nextInt();
				if(N+M==0) break;
				int[] p=new int[M+1];
				for(int i=0; i<N; i++) {
					int d=sc.nextInt();
					int v=sc.nextInt();
					p[d]=Math.max(v, p[d]);
				}
				int sum=0;
				for(int i=1; i<=M; i++) {
					sum+=p[i];
				}
				System.out.println(sum);
			}
			
			
		}
		
	}
}


Measured memory_bytes: 35828
#include <iostream>
#include <vector>
#include <string>

int main()
{
    int x, y, z;
    std::cin >> x >> y >> z;

    int i = 0;
    int f = y * i + z * (i + 1);
    while (f <= x)
    {
        i++;
        f = y * i + z * (i + 1);
       
    }

    std::cout << i - 1 << "\n";
}

Measured memory_bytes: 3576
#include <iostream>
#include <cstdio>
#include <string.h>
#include <vector>
#include <queue>
using namespace std;


int main(){

    int k;
    cin >> k;
    queue<long long> q;
    vector<long long> v;
    q.push(1);
    q.push(2);
    q.push(3);
    q.push(4);
    q.push(5);
    q.push(6);
    q.push(7);
    q.push(8);
    q.push(9);

    long long x;

    long long a;
    long long b;
    long long c;

    for(int i = 0; i < k; i++){
        x = q.front();
        q.pop();

        v.push_back(x);

        if(x % 10 != 0){
            a = 10 * x + (x % 10) - 1;
            q.push(a);
        }

        b = 10 * x + (x % 10);
        q.push(b);

        if(x % 10 != 9){
            c = 10 * x + (x % 10) + 1;
            q.push(c);
        }
    }

    

    printf("%lld\n", v[k - 1]);

    return 0;




}

Measured memory_bytes: 2548