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

#define ll long long
#define ld long double
#define maxn 300000
#define pii pair<int, int>
using namespace std;

int seg[maxn*4];
int n;


void update(int ss, int se, int cur, int up, int spot) {
	if (spot < ss || se < spot || ss > se) return;
	if (ss == se && ss == spot) {
		seg[cur] = up;
		return;
	}
	int mid = (ss+se)/2;
	update(ss, mid, cur*2+1, up, spot);
	update(mid+1, se, cur*2+2, up, spot);
	seg[cur] = max(seg[cur*2+1], seg[cur*2+2]);
}

void upd(int val, int spot) {
	update(0, n-1, 0, val, spot);
}

int qu(int qs, int qe, int ss, int se, int cur) {
	if (qe < ss || se < qs) return -1;
	// cout << "   " << ss << " " << se << endl;

	if (qs <= ss && se <= qe) return seg[cur];
	int mid = (ss+se)/2;
	return max(qu(qs, qe, ss, mid, cur*2+1), 
		qu(qs, qe, mid+1, se, cur*2+2));
}


int query(int qs, int qe) {
	return qu(qs, qe, 0, n-1, 0);
}

int main() {
	const long double pi = 
	3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679L;
	// ios_base::sync_with_stdio(false);
	// cin.tie(NULL);
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	int N;
	cin >> N;
	vector<pii> cos;
	vector<int> ys;
	int x, y;
	
	if (x1 > x2) {
		int xtemp = x1;
		x1 = x2;
		x2 = xtemp;
		int ytemp = y1;
		y1 = y2;
		y2 = ytemp;
	}
	bool flip = false;
	if (y1 > y2) {
		flip = true;
		y2 = y1 + y1-y2;
	}
	for (int i = 0; i < N; i++) {
		cin >> x >> y;
		if (flip) {
			y = y1 + y1-y;
		}
		if (x < x1 || x > x2) continue;
		if (y <= y2 && y >= y1) {

			cos.push_back(pii(x, y));
			ys.push_back(y);
		}
	}
	sort(cos.begin(), cos.end());
	sort(ys.begin(), ys.end());
	map<int, int> ycomp;
	n = cos.size();
	for (int i = 0; i < cos.size(); i++) {
		ycomp[ys[i]] = i;
	}
	for (int i = 0; i < maxn*4; i++) {
		seg[i] = -1;
	}
	int most = 0;
	for (int i = 0; i < n; i++) {
		int cur = query(0, ycomp[cos[i].second]) + 1;
		cur = max(cur, 1);
		most = max(most, cur);
		upd(cur, ycomp[cos[i].second]);
		// cout << "-->    " << cos[i].first << " " << 
		// 	cos[i].second << "    " << cur <<  "   " <<
			// ycomp[cos[i].second] <<  endl;
	}
	ld dist = 100.0L*(y2 - y1 + x2-x1);
	int rows = y2-y1+1;
	int cols = x2-x1+1;
	if (most == rows || most == cols) {
		most--;
		dist += (10.0L*pi)-20.0L;
	}
	ld fact = (5.0L*pi)-20.0L;
	if (most > 0) dist += (most + 0.0L)*(fact);
	cout << fixed << setprecision(25);
	cout << dist << endl;
	// cout << most << endl;
	// cin >> n;
}

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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

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

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;

    string S;
    cin >> S;

    S = "#" + S + "#";
    for (ll i = A; i <= C; i++) {
        if (S[i] == '#' && S[i+1] == '#') {
            No;
            return 0;
        }
    }

    for (ll i = B; i <= D; i++) {
        if (S[i] == '#' && S[i+1] == '#') {
            No;
            return 0;
        }
    }

    if (D < C) {
        for (ll i = B; i <= D; i++) {
            if (S[i-1] == '.' && S[i] == '.' && S[i+1] == '.') {
                Yes
                return 0;
            }
        }
        No
        return 0;
    }
    Yes
    return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
void err () {
  cout << "No" << '\n';
  exit(0);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s, t;
  cin >> s >> t;
  int n = s.length();
  map<int, int> mp;
  map<int, int> np;
  for (int i = 0; i < n; i++) {
    int is = s[i] - 'a';
    int it = t[i] - 'a';
    if (mp.find(is) != mp.end()) {
      if (mp[is] != it) err();
    } else if (np.find(it) != np.end()) {
      if (np[it] != is) err();
    } else {
      mp[is] = it;
      np[it] = is;
    }
  }
  cout << "Yes" << '\n';
  return 0;
}

Measured memory_bytes: 916
a,b,c,d,e,f=map(int,input().split())
res=-1
ans=[0,0]
s1=set()
s2=set()
for x in range(0,f+1,100*a):
  for y in range(0,f+1-x,100*b):
    s1.add(x+y)
for x in range(0,f+1,c):
  for y in range(0,f+1-x,d):
    s2.add(x+y)
for x in s1:
  for y in s2:
    if x*e/100>=y and 0<x+y<=f:
      tmp=y/(x+y)
      if tmp>res:
        res=tmp
        ans=[x+y,y]
print(*ans)

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

#include <cstdlib>  // abs() for integer 絶対値求めやつ

#include <cmath>    // abs() for float, and fabs()

#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i< (n);i++)

#define SORT(a) sort((a).begin(),(a).end());

#define che(a,string) cout<<string<<":"<<(a)<<endl;

#define ch(a,string) cout<<string<<":"<<(a)<<" ";

using namespace std;

typedef pair<int,int> p;

int main(){
	string s,t;
	cin>>s>>t;
	int n = s.size();
	char k =t.at(0);
	int l =0;
	int ans = 0;
	rep(i,n){
		if(k==s.at(i)){
			 l=i;
	//		 ch(l,'l');
			 break;
		  }
	  }
	  //l banme ikou zenbu issyoka tasikameru .
		rep(i,n){
		  int d=l+i;
		  if(d>=n){
			d-=n;
			}
		  if(t.at(i)!=s.at(d)){
	//			ch(s[i],"s[i]");
	//			  ch(t[d],"t[d]");
				ans = 1;
				break;
			  }
		  }
		  if(ans==1){
			  cout<<"No"<<endl;
			}
			else{
				cout<<"Yes"<<endl;
			  }
			  }


Measured memory_bytes: 384
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long

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

  ll x,a; cin >> x >> a;
  if (x < a) cout << 0 << endl;
  else cout << 10 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
const double eps = 1e-8;
const int MOD = 1000000007;
// int main() {
//     cin.tie(0);
//     ios::sync_with_stdio(false);
//     cout << fixed << setprecision(10);
//
// }
ll powm(ll a, ll n, ll m) {
    ll ret = 1;
    while (n > 0) {
        if (n & 1) (ret *= a) %= m;
        (a *= a) %= m;
        n >>= 1;
    }
    return ret;
}
ll invm(ll a, ll m) {
    return powm(a, m-2, m);
}
vector<ll> fact;
void init_fact(int n, ll m) {
    fact.assign(n+1, 1);
    for (int i = 2; i <= n; ++i) {
        (fact[i] = fact[i-1] * i) %= m;
    }
}
// require init_fact(GREATER THAN OR EQUAL TO n, m)
ll C(ll n, ll r, ll m) {
    return (fact[n] * invm((fact[r] * fact[n-r]) % m, m)) % m;
}
// Stirling number
// Stirling(n, k) := the number of cases
//            to split n balls(distinguished)
//            into k boxes(not distinguished)
//            s.t. each box contains at least one ball.
//
// require init_fact(GREATER THAN OR EQUAL TO k, m)
ll Stirling(ll n, ll k, ll m) {
    ll ret = 0;
    for (ll l = 0; l <= k; ++l) {
        ll tmp = (C(k, l, m) * powm((k-l) % m, n, m)) % m;
        if (l & 1) tmp = (-tmp + m) % m;
        (ret += tmp) %= m;
    }
    return (ret *= invm(fact[k], m)) %= m;
}
// Bell number
// Bell(n, k) := the number of cases
//            to split n balls(distinguished)
//            into k boxes(not distinguished)
//
// require init_fact(GREATER THAN OR EQUAL TO k, m)
ll Bell(ll n, ll k, ll m) {
    ll ret = 0;
    for (ll l = 0; l <= k; ++l) {
        (ret += Stirling(n, l, m)) %= m;
    }
    return ret;
}
// Partition function
// Partition[k][n] := the number of cases
//            to split n balls(not distinguished)
//            into k boxes(not distinguished)
vector<vector<ll>> Part;
void init_partition(ll k, ll n, ll m) {
    Part.assign(k+1, vector<ll>(n+1, 0));
    Part[0][0] = 1;
    for (int i = 1; i <= k; ++i) {
        for (int j = 0; j <= n; ++j) {
            if (j-i >= 0) {
                Part[i][j] = (Part[i-1][j] + Part[i][j-i]) % m;
            } else {
                Part[i][j] = Part[i-1][j];
            }
        }
    }
}
int main() {
    ll n, k; cin >> n >> k;
    const ll mod = 1e9+7;
    init_fact(k, mod);
    cout << Stirling(n, k, mod) << endl;
}



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

using namespace std;

string s;

int main() {
    ios_base::sync_with_stdio(false);
    cin >> s;
    sort (s.begin(), s.end());
    for (int i = 0; i < (int)s.length() - 1; ++i) {
        if (s[i] == s[i+1]) {
            cout << "no" << endl;
            return 0;
        }
    }
    cout << "yes" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#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 <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> P;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    string s;
    cin>>s;
    if(s[3]==s[2] && s[4]==s[5]){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}

Measured memory_bytes: 3608
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


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

    bool dividable = false;
    REP(i, 9){
        if(N % i == 0 && N / i < 10){
            dividable = true;
            break;
        }
    }

    if(dividable){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 3604
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List

main :: IO ()
main = do
  solve <$> (getl $ wrds toInt) <*> getLine >>= mapM_ putStrLn

solve :: [Int] -> String -> [String]
solve [n, a, b] s = f a b s
  where
    f x y [] = []
    f x y (z:zs)
      | z == 'a' = if x > 0 then "Yes" : f (x-1) y zs
                   else if y > 0 then "Yes" : f x (y-1) zs
                        else "No" : f x y zs
      | z == 'b' = if y > 0 then "Yes" : f x (y-1) zs
                   else "No" : f x y zs
      | otherwise = "No" : f x y zs
                    
toInt :: String -> Int
toInt = read

wrds :: (String -> a) -> String -> [a]
wrds f = map f . words

getl :: (String -> a) -> IO a
getl f = f <$> getLine


Measured memory_bytes: 5372
#include<stdio.h>

int main(void)
{
	int W=1,H=1;
	
	for(;W!=0&&H!=0;){
		
		scanf("%d %d",&H,&W);
		
		for(int s=0;s<H;s++){
			
			for(int t=0;t<W;t++){
				
				printf("#");
				
			}
			printf("\n");
		}
		if(H!=0&&W!=0){
			
			printf("\n");
		}
	}
	
	return 0;
}

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

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (int)(m); i < (int)(n); ++i)

// Greatest Common Multiple (GCD)
// 2数の最大公約数 by ユークリッド互助法
template <typename T=long long>
T gcd(T a, T b)
{
    if(b == 0) return a;
    else return gcd<T>(b, a % b);
}

// 3数以上の最大公約数
// a, b, c の最小公約数は a, b の最小公約数と c の最小公約数に等しいことを利用
template <typename T=long long>
T gcd(std::vector<T>& a, int i = 0)  // a[i] と a[i+1] ~ a[end] の最大公約数を返す
{
    if(a.size() < 2) return 0;  // 必要に応じて変える
    if(i == (int) a.size() - 2) return gcd<T>(a[i], a[i+1]);
    return gcd<T>(a[i], gcd(a, i+1));
}


// Least Common Multiple (LCM)
// 2数の最小公倍数
template <typename T=long long>
T lcm(T a, T b) {return a * b / gcd<T>( a, b );}

// 3数以上の最小公倍数
template <typename T=long long>
T lcm(std::vector<T>& a, int i = 0)  // a[i] と a[i+1] ~ a[end] の最小公倍数を返す
{
    if(a.size() < 2) return 0;  // 必要に応じて変える
    if(i == (int) a.size() - 2) return lcm<T>(a[i], a[i+1]);
    return lcm(a[i], lcm<T>(a, i+1));
}

// 2 以上 M 以下の素数をエラトステネスの篩を用いて求める, O( n * loglogn )
void calculatePrimeByEratosthenes( int M, std::vector<long long>& prime )
{
    std::vector<bool> isPrime( M+1, true );  // isPrime[i]: i が素数かどうか
    isPrime[0] = isPrime[1] = false;
    for( int i = 2; i*i <= M; ++i ){
        if( isPrime[i] ){
            // 素数 i の倍数は素数ではない
            for( int j = 2; i*j <= M; ++j ) isPrime[i*j] = false;
        }
    }
    for( int i = 2; i <= M; ++i ){
        if( isPrime[i] ) prime.push_back( i );
    }
}

bool check(vector<long long>& A, int N){
    vector<long long> prime;
    calculatePrimeByEratosthenes(1e+4, prime);

    vector<bool> is_appeared(1e+6+1, false);
    REP(i, N){
        long long tmp = A[i];
        for(auto p: prime){
            if(tmp == 1) continue;
            if(p*p > A[i]){
                if(is_appeared[tmp]) return false;
                is_appeared[tmp] = true;
                break;
            }
            if(tmp%p == 0){
                if(is_appeared[p]) return false;
                is_appeared[p] = true;
                while(tmp%p == 0) tmp /= p;
            }
        }
    }
    return true;
}


int main()
{
    int N;
    cin >> N;
    vector<long long> A(N);
    REP(i, N) cin >> A[i];

    if(gcd<long long>(A) == 1){
        if(check(A, N)) cout << "pairwise coprime" << endl;
        else cout << "setwise coprime" << endl;
    }else cout << "not coprime" << endl;

    return 0;
}

Measured memory_bytes: 26960
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define REP(LoopVariable,numberOFend) for(int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)



int main(){

    int n;
    cin >> n;
    vector<int> a(n), b(n);
    cin >> a[0];
    FOR(i,1,n){
        cin >> a[i];
        a[i] += a[i - 1];
    }
    
    REP(i,n){
        cin >> b[i];
    }

    FOR(i,1,n){
        b[n - 1 - i] += b[n - i];
    }

    int ans = -1;

    REP(i,n){
        ans = max(ans, a[i] + b[i]);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 888
n = int(input())
numList = []
for x in range(n):
	num = [int(x) for x in input().split()]
	if num[0] == num[1]:
		numList.append('True')
	else:
		numList.append('False')
		
	
judge = 'No'
for x in range(len(numList)-2):
    if numList[x] == 'True':
      if numList[x+1] == 'True':
        if numList[x+2] == 'True':
          judge = 'Yes'
print(judge)


Measured memory_bytes: 9184
#include<iostream>
#include<cmath>
#include<unordered_map>
#include<math.h>
#include<vector>
#include<queue>
#include<set>
#include<algorithm>
#include<iomanip>
#include<string>
#include<map>
#define PI 3.14159265
#define mod 998244353  
#define mod1 1e9 + 7  
using namespace std;

int dfs(vector<vector<int>> &graph , vector<int> &visited , int src){
    int maxi = -1;
    for(int i = 0 ; i < graph[src].size() ; ++i){
        if(visited[graph[src][i]] == -1){
            visited[graph[src][i]] = dfs(graph,visited,graph[src][i]);
        }
        maxi = max(visited[graph[src][i]] , maxi);
    }
    visited[src] = maxi + 1;
    return maxi + 1;
}

void func(){

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

double dp[n + 1][n + 1] = {0.000} ;
//row represents number of heads
//col represents number of coins
dp[0][0] = 1;
for(int i = 1 ; i <= n ; ++i){
    dp[0][i] = (1 - p[i - 1]) * dp[0][i - 1];
    dp[i][0] = 0;
}

for(int i = 1; i <= n ; ++i){
    for(int j = 1 ; j <= n ; ++j){
        //Every coin has two option
        //Head or tail.
        //If head we need dp[i - 1][j - 1]*p[i] or if tails we need i heads from j - 1 coins
        dp[i][j] = (dp[i - 1][j - 1] * p[j - 1]) + ((1 - p[j - 1]) * dp[i][j - 1]);

    }
}

double ans = 0.000;
for(int i = (n / 2) + 1 ; i <= n ; ++i){
    ans += dp[i][n];
}
cout <<setprecision(20)<< ans << "\n";
}

int main(){
    int t = 1 , cnt = 0 ;
   // cin >> t;
    
    while(t--){
        
        func();
    }
}

Measured memory_bytes: 70528
#include<bits/stdc++.h>
#include <vector>
using namespace std;
#define vi vector<int>
#define pb push_back
#define p push
#define sll stack<long long>
#define qll queue<long long>
#define vll vector<long long>
#define fori(n) for(int i=0;i<n;i++)
#define forj(n) for(int j=0;j<n;j++)
#define fork(n) for(int k=0;k<n;k++)
#define fori1(n) for(int i=1;i<n;i++)
#define f(i,a,b) for(int i=a;i<=b;i++)
#define ll long long
#define pi 3.14159265358979323
#include <math.h>
#define yn(n) if(n)cout<<"yes\n";else cout<<"no\n";
#define Yn(n) if(n)cout<<"Yes\n";else cout<<"No\n";
#define YN(n) if(n)cout<<"YES\n";else cout<<"NO\n";
#define mp   make_pair 
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
vll v(100000,0);

ll sum = 0;
int md(int n){
	if(n>0)return n;
	else return -n;
}

string str,str2;
void solve(){
	ll n;cin>>n;
	vll v;
	fori(n){
	    ll a;cin>>a;
	    v.pb(a);
	}
	ll ans=0;
	sort(v.begin(),v.end());
	fori(n){
	    for(int j=i+1;j<n;j++){
	        for(int k=j+1;k<n;k++){
	            if(v[i]+v[j]<=v[k])break;
	            if(v[i]+v[j]>v[k]&&v[i]!=v[j]&&v[j]!=v[k]){ans++;}
	           
	        }
	    }
	}
	cout<<ans;
}


int main(){

 
    	
	int t;
	t=1;
	//cin >> t;
	while(t--){
		solve();
		
	}
	
	
	//cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";

}

Measured memory_bytes: 3832
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>

using namespace std;


int main() {
    int A, B, C, K;
    cin >> A >> B >> C >> K;
    if (A >= B&&A >= C) {
        for (int i = 1; i <= K; i++) {
            A *= 2;
        }
    }
    else if (B >= A&&B >= C) {
        for (int i = 1; i <= K; i++) {
            B *= 2;
        }
    }
    else if (C >= A&&C >= B) {
        for (int i = 1; i <= K; i++) {
            C *= 2;
        }
    }

    cout << A + B + C << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
//#define double long double
#define endre getchar();getchar();return 0
#define moder (int)(1e9+7)
#define inf (int)(3e18+7)
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define P pair<int,int>
#define all(v) v.begin(),v.end()
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define vecunique(vec) sort(vec.begin(), vec.end());decltype(vec)::iterator result = std::unique(vec.begin(), vec.end());vec.erase(result, vec.end())
using namespace std;

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1)*x;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	return kai(x)*mod_pow(kai(x - y), moder - 2, moder) % moder*mod_pow(kai(y), moder - 2, moder) % moder;
}
/*--------Library Zone!--------*/


signed main() {
	int a, b, c, d, n;
	cin >> a >> b >> c >> d >> n;
	if (a * 8 < d)d = a * 8;
	if (b * 4 < d)d = b * 4;
	if (c * 2 < d)d = c * 2;
	if (a * 4 < c)c = a * 4;
	if (b * 2 < c)c = b * 2;
	cout << n / 2 * d + n % 2 * c << endl;
	endre;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
string s;

int main(){
    cin>>n>>s;
    int ans=0;
    for(char i='0';i<='9';i++)for(char j='0';j<='9';j++)for(char k='0';k<='9';k++){
        int x=0;
        while(x<n&&s[x]!=i)x++;
        x++;
        while(x<n&&s[x]!=j)x++;
        x++;
        while(x<n&&s[x]!=k)x++;
        if(x<n){
            ans++;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;
typedef vector<P> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<ll,vector<ll>,greater<ll>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const int INF = (1LL << 60); // 1152921504606846976
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }

struct UnionFind {
  private:
  vector<int> child,tree;
  vector<vector<int>> list;

public:
  UnionFind(int v) {
    tree.resize(v);
    list.resize(v);
    REP(i,v) tree[i] = i, list[i].push_back(i);
  }

  int root(int i){
    if(i == tree[i]){
      REP(j,child.size()) tree[child[j]] = i;
      child.clear(); 
      return i;
    }
    else{
      child.push_back(i);
      return i = root(tree[i]);
    }
  }

  int size(int i){
    return list[root(i)].size();
  }

  vector<int> nodes(int no){
    return list[root(no)];
  }

  bool unit(int x, int y){
    x = root(x);
    y = root(y);
    if(x==y) return false;
    if(list[x].size() < list[y].size()) swap(x,y);
    for(int no:list[y]) list[x].emplace_back(no);
    tree[y] = x;
    return true;
  }

  bool isUnit(int x, int y){
    return root(x) == root(y);
  }
};

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n,m;
    cin>>n>>m;
    UnionFind uf(m+n);
    UnionFind uu(m);
    vvec l(n);
    vec k(n);
    rep(i,n){
        cin>>k[i];
        rep(j,k[i]){
            int lll;
            cin>>lll;lll--;
            l[i].pb(lll);
            uf.unit(m+i,lll);
        }
    }
    rep(i,n){
        rep(j,k[i]-1){
            uf.unit(l[i][j],l[i][j+1]);
            uu.unit(l[i][j],l[i][j+1]);
        }
    }
    rep(i,m){
        if(uf.size(i)-uu.size(i)==n){
            cout<<"YES"<<endl;
            return 0;
        }
    }
    cout<<"NO"<<endl;
}

Measured memory_bytes: 26100
#include<bits/stdc++.h>
using namespace std;
#define DEKAI 1000000007
#define INF (1<<28)
#define lp(i,n) lps(i,0,n)
#define lps(i,j,n) for(int i=j;i<n;i++)
#define FDST int hogehogehoge;cin>>hogehogehoge
#define MAX_V 110
#define   int long long

int H, W, L;
string str[MAX_V];
char foo(char temp){
   if(temp == 'S'){
     temp = 'W';
   } else if(temp == 'N'){
     temp = 'E';
   } else if(temp == 'E'){
     temp = 'S';
   } else if(temp == 'W'){
     temp = 'N';
   }
   return temp;
}

signed  main(){
  while(true){
    int xy[2];
    int dp[MAX_V][MAX_V][30] = {}, used[MAX_V][MAX_V] = {};
    char temp;
    cin>>H>>W>>L;

    if(!H&&!W&&!L) break;
    
    for(int i = 0; i < H; i++){
      cin>>str[i];
      for(int j = 0; j < W; j++){
	if(str[i][j] != '.' && str[i][j] != '#'){
	  xy[0] = i; xy[1] = j;
	  temp = str[i][j];
	}
      }
    }

    for(int i = 1; i <= L;){
      int x = xy[1], y = xy[0];
      // char tt  = temp;
      //int xx= x, yy = y;
      //cout<<i<<" "<<x<<" "<<y<<" "<<temp<<endl;
      if(temp == 'S'){
	y++;
      } else if(temp == 'N'){
	y--;
      } else if(temp == 'E'){
	x++;
      } else if(temp == 'W'){
	x--;
      }
      if(0 <= y && y < H && 0 <= x && x < W){
	if(str[y][x] == '#'){
	  temp = foo(temp);
	  dp[y][x][temp-'A'] = i;
	} else {
	  if(dp[y][x][temp-'A']){
	    if((L-i)/(i-dp[y][x][temp-'A'])){
	      i = L-(L-i)%(i-dp[y][x][temp-'A']);
	    } else {
	      xy[0] = y, xy[1] = x;
	      i++;
	    }
	  } else {
	    xy[0] = y, xy[1] = x;
	    dp[y][x][temp-'A'] = i;
	    i++;
	  }
	}
	
      } else {
	temp = foo(temp);
	dp[y][x][temp-'A'] = i;
      }
    }
    cout<<xy[0]+1<<" "<<xy[1]+1<<" "<<temp<<endl;
  }

  return 0;
}


Measured memory_bytes: 5932
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int H,W;
	cin >> H >> W;

	char A[1010][1010];
	REP(i, H) {
		REP(j, W) {
			cin >> A[i][j];
		}
	}
	int C[1010][1010];
	REP(i, H) {
		REP(j, W) {
			C[i][j]=LLINF;
		}
	}


	REP(i, H) {
		int cnt = INF;
		bool F = false;
		REP(j, W) {
			if (A[i][j] == '#') {
				cnt = 0;
				F = true;
			}
			else if(F){
				cnt++;
			}
			C[i][j] = cnt;
		}
	}
	REP(i, H) {
		int cnt = INF;
		bool F = false;
		for (int j = W - 1; j >= 0; j--) {
			if (A[i][j] == '#') {
				cnt = 0;
				F = true;
			}
			else if (F) {
				cnt++;
			}
			C[i][j] = min(cnt, C[i][j]);
		}
	}
	REP(j, W) {
		int cnt = INF;
		bool F = false;
		REP(i, H) {
			if (A[i][j] == '#') {
				cnt = 0;
				F = true;
			}
			else if (F) {
				cnt++;
			}
			C[i][j] = min(cnt, C[i][j]);
		}
	}
	REP(j, W) {
		int cnt = INF;
		bool F = false;
		for (int i = H - 1; i >= 0; i--) {
			if (A[i][j] == '#') {
				cnt = 0;
				F = true;
			}
			else if (F) {
				cnt++;
			}
			C[i][j] = min(cnt, C[i][j]);
		}
	}

	REP(i, H) {
		FOR(j,1, W) {
			if (C[i][j] == 0) {
				C[i][j] = C[i][j - 1];
			}
			else {
				C[i][j] = min(C[i][j - 1] + 1, C[i][j]);
			}
		}
	}
	REP(i, H) {
		for (int j = W - 2; j >= 0; j--) {
			if (C[i][j] == 0) {
				C[i][j] = C[i][j + 1];
			}
			else {
				C[i][j] = min(C[i][j + 1] + 1, C[i][j]);
			}
		}
	}
	FOR(j,0, W) {
		FOR(i,1, H) {
			if (C[i][j] == 0) {
				C[i][j] = C[i-1][j];
			}
			else {
				C[i][j] = min(C[i-1][j] + 1, C[i][j]);
			}
		}
	}
	REP(j, W) {
		for (int i = H - 2; i >= 0; i--) {
			if (C[i][j] == 0) {
				C[i][j] = C[i + 1][j];
			}
			else {
				C[i][j] = min(C[i + 1][j] + 1, C[i][j]);
			}
		}
	}


	int ans = 0;
	REP(i, H) {
		REP(j, W) {
			//cout << C[i][j];
			ans = max(ans, C[i][j]);
		}
		//cout << endl;
	}

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



Measured memory_bytes: 9216
def go(n,x,dx,l):
	return min(n,max(1,x+l*dx))

while 1:
	m,n = map(int,raw_input().split())
	if m == 0: break
	x = y = 1
	dx,dy = 0,1
	while 1:
		com = raw_input().split()
		s = com[0][0]
		if   s == "S": break
		elif s == "F":
			l = int(com[1])
			x,y = go(m,x,dx,l), go(n,y,dy,l)
		elif s == "B":
			l = int(com[1])
			x,y = go(m,x,-dx,l),go(n,y,-dy,l)
		elif s == "R":
			dx,dy = dy,-dx
		elif s == "L":
			dx,dy = -dy,dx
	print x,y

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

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

    string ans = n == 0 ? "0" : "";
    while (n != 0) {
        if (n % 2 != 0) {
            n--;
            ans = "1" + ans;
        } else {
            ans = "0" + ans;
        }
        n /= -2;
    }
    cout << ans << endl;

    return 0;
}

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



vector<string> fill(int n)
{
   if(n==1)
  {
    vector<string> ans;
    ans.push_back("a");
    return ans;
  }

  unordered_map<string,int> mark;

  vector<string> sub= fill(n-1);

   vector<string> ans;

    for(int i=0;i<sub.size();i++)
  {
     for(int j=0;j<sub[i].size();j++)
    {
      string k= sub[i]+sub[i][j];
      if(mark.find(k)==mark.end())
    {
      mark.insert(make_pair(k,1));
      ans.push_back(k);
    }
    }

   // int x= sub[i][sub[i].length()-1]-'a';
    //  x++;

    int x;
    string add;

     int st[26]={};
    for(int r=0;r<sub[i].length();r++)
     st[sub[i][r]-'a']=1;

   for(int i=0;i<26;i++)
    if(st[i]==0)
   {
     x=i;
     break;
   }

    

     switch (x) 
   { 
       case 1: add="b"; 
               break; 
      case 2: add="c"; 
               break;

     case 3: add="d"; 
               break;
case 4: add="e"; 
               break;
case 5: add="f"; 
               break;
case 6: add="g"; 
               break;
case 7: add="h"; 
               break;
case 8: add="i"; 
               break;
case 9: add="j"; 
               break;
case 10: add="k"; 
               break;
case 11: add="l"; 
               break;


       default: printf("Choice other than 1, 2 and 3"); 
                break;   
   } 
    
    string k= sub[i]+add;
    mark.insert(make_pair(k,1));
      ans.push_back(k);
  }

   return ans;
}





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

   string s="";

 vector<string> ans= fill(n);

   //cout<<ans.size()<<endl;

   for(int i=0;i<ans.size();i++)
   cout<<ans[i]<<endl;


   
   
  
 return 0;
}


Measured memory_bytes: 16408
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	cin>>n;
	ll sum=0;
	ll ans1;
	for(ll i=1;i<=n;i++){
		sum+=i;
		ans1=i;
		if(sum>=n){
			break;
		}
	}
	ans1++;
	if(sum!=n){
		cout << "No";
		return 0;
	}
	cout << "Yes"<<endl;
	cout << ans1<<endl;	
	vector<vector<ll>>a(ans1);
	ll k=0,j=1;
	for(ll i=1;i<=n;i++){
		a[k].push_back(i);
		a[k+j].push_back(i);
		if(k+j!=ans1-1){
			j++;
		}
		else{
			k++;j=1;
		}
	}
	for(ll i=0;i<ans1;i++){
		cout << a[i].size()<<" ";
		for(ll j=0;j<a[i].size();j++){
			cout << a[i][j]<<" ";
		}
		cout <<endl;
	}

	
	// your code goes here
	return 0;
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int max3(int a, int b, int c) {
    return max(a, max(b, c));
}

int main() {
    string S, T; cin >> S >> T;
    int table[S.size() + 1][T.size() + 1];
    // init table
    for (int i = 0; i <= S.size(); ++i) table[i][0] = 0;
    for (int i = 0; i <= T.size(); ++i) table[0][i] = 0;

    // create table
    for (int i = 0; i < S.size(); ++i) {
        for (int j = 0; j < T.size(); ++j) {
            table[i + 1][j + 1] = max(
                table[i + 1][j],
                table[i][j + 1]
            );
            if (S[i] == T[j]) table[i + 1][j + 1] = max(table[i][j] + 1, table[i + 1][j + 1]);
        }
    }

    // search table
    ll x = S.size() - 1, y = T.size() - 1;
    vector<char> v;
    while (true) {
        if (x == -1 && y == -1) break;
        int current_num = table[x + 1][y + 1];
        if (x > -1 && table[x][y + 1] == current_num) x--;
        else if (y > -1 && table[x + 1][y] == current_num) y--;
        else {
            v.push_back(S[x]);
            x--; y--;
        }
    }

    // ans
    reverse(v.begin(), v.end());
    for (auto i : v) cout << i;
    cout << endl;
}

Measured memory_bytes: 35456
#include <bits/stdc++.h>
using namespace std;
int ans[100005],siz[100005],par[100005];
bool vis[100005];
int root(int A)
{
    while(A!=par[A])
    {
        A=par[A];
    }
    return A;
}

int union1(int a,int b)
{
    int root_A = root(a);
    int root_B = root(b);
    if(root_A==root_B)
        return 1;
    if(siz[root_A]<siz[root_B])
    {
        par[root_A]=par[root_B];
        siz[root_B]+=siz[root_A];
    }
    else
    {
        par[ root_B ]=par[root_A];
        siz[root_A]+=siz[root_B];
    }
    return 0;
}
void init()
{
    int i;
    for(i=1;i<=100000;i++)
    {
        siz[i]=1;
        ans[i]=0;
        par[i]=i;
    }
}
int main()
{
    init();
    int n,m;
    cin>>n>>m;
    int i;
    long long a,b,c;
    for(i=1;i<=m;i++)
    {
        cin>>a>>b>>c;
        if(union1(a,b))
        {
            ans[root(a)]=1;
        }
    }
    int anss=0;
    for(i=1;i<=n;i++)
    {
        if(!vis[root(i)])
        {
            vis[root(i)]=1;
            anss++;
        }
    }
    cout<<anss<<endl;
}



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

using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;


namespace
{

	ll ModPow(ll a, ll p, ll mod)
	{
		if (p == 0)
			return 1;
		if (p % 2 == 0)
		{
			ll halfp = p / 2;
			ll half = ModPow(a, halfp, mod);
			return (half * half) % mod;
		}
		else
		{
			return (a * ModPow(a, p - 1, mod)) % mod;
		}
	}

	ll Combination(int n, int r, ll mod)
	{
		r = min(r, n - r);
		ll num = 1;
		ll den = 1;
		for (int i = 0; i < r; ++i)
		{
			num *= (n - i);
			num %= mod;
			den *= (i + 1);
			den %= mod;
		}
		ll ret = (num * ModPow(den, mod - 2, mod)) % mod;
		return ret;
	}
}
void ABC145D()
{
	int MOD = 1000000007;
	int X, Y;
	cin >> X >> Y;

	if (X > 2 * Y || Y > 2 * X || (X + Y) % 3 != 0)
	{
		cout << 0 << endl;
		return;
	}
	int Z = (X + Y) / 3;
	X -= Z;
	Y -= Z;
	ll ans = Combination(X + Y, X, MOD);

	cout << ans << endl;
}

int main()
{
	ABC145D();
	return 0;
}


Measured memory_bytes: 256
from collections import Counter

n = int(input())
aa = tuple(map(int, input().split()))
actr = Counter(aa)
q = int(input())

ans = sum([a * n for a, n in actr.items()])
for i in range(q):
    b, c = map(int, input().split())
    n = actr[b]
    ans = ans - b * n + c * n
    actr[c] += n
    del actr[b]
    print(ans)



Measured memory_bytes: 24488
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
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; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
#define fs first
#define sc second

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}
 
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}
 
template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;

int dp[110][11000];

int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n,W;
    cin >> n >> W;
    vector<int> v(n);
    vector<int> w(n);
    rep(i, n){
      cin >> v[i] >> w[i];
    }
    rep(i, n){
      rep(j, W + 1){
         if(j >= w[i]) chmax(dp[i + 1][j], dp[i][j - w[i]] + v[i]);
         chmax(dp[i + 1][j], dp[i][j]);
      }
    }
    print(dp[n][W]);
}


Measured memory_bytes: 7368
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define PI acos(-1)
#define sz 100010
#define RUN_FAST ios::sync_with_stdio(false);
using namespace std;

int main()
{
    RUN_FAST; cin.tie(nullptr);
    int n, m, tmp;
    cin >> n >> m;
    n--, m--;
    tmp=n*(n+1)/2+m*(m+1)/2;
    cout << tmp << endl;
    return 0;
}


Measured memory_bytes: 3608
#include <stdio.h>
int main (){
int a,b,k=1;
scanf ("%d%d",&a,&b);
for (int i=0;i<a;i++){
if (k<b){
k=k+k;
}
else {
k=k+b;
}
}
printf ("%d",k);
return 0;
}

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

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int MOD = 1000000009;
const long long INF = 1LL << 60;

int main() {
    ll N, M;
    cin >> N >> M;
    vector<pll> AB(N);
    for (int i = 0; i < N; ++i) cin >> AB[i].first >> AB[i].second;
    sort(AB.begin(), AB.end());
    ll res = 0;
    for (int i = 0; i < N && M > 0; ++i) {
        res += AB[i].first * min(M, AB[i].second);
        M-=min(M, AB[i].second);
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 4796
#include <cstdio>
#include <vector>
using namespace std;
int main() {
    int N,M;
    while (scanf("%d%d",&N,&M)) {
        if (N==0&&M==0) break;
        vector<int> map(N);
        for (int i=0; i<N; i++) scanf("%d",&map[i]);
        int res=0,tmp,cnt=0;
        bool flag=true;
        for (int i=0; i<M; i++) {
            scanf("%d",&tmp);
            if (flag) {
                res+=tmp;
                if (res<N-1) {
                    res+=map[res]; cnt++;
                    if (res>=N-1) flag=false;
                } else if (res>=N-1) {
                    cnt++;
                    flag=false;
                }
            }
        }
        printf("%d\n",cnt);
    }
}

Measured memory_bytes: 0
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn Agrawal coderbond007  PLEASE!! PLEASE!! HACK MY SOLUTION!!
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            char[] s = in.nextString().toCharArray();
            int[] countAll = StringUtils.countAll(s);
            for (int i = 'a'; i <= 'z'; i++) {
                if (countAll[i] == 0) {
                    out.println((char) (i));
                    return;
                }
            }
            out.println("None");
        }

    }

    static class StringUtils {
        public static int[] countAll(char[] string) {
            int[] c = new int[128];
            for (char s : string) {
                c[s]++;
            }
            return c;
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public String nextString() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = pread();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        private boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        private static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 21588
n,k=[int(s) for s in input().split(' ')]
gl=[]
c=0
for _ in range(k):
    z=input()
    for s in input().split(' '):
         gl.append(int(s))

for sn in range(1,n+1):
    if sn in gl:
        continue
    else:
        c+=1
print(c)


Measured memory_bytes: 9180
#include <bits/stdc++.h>
#include<cmath>
using namespace std;
#define int unsigned long long 
#define mod 1000000007
void dfs(vector<int> adj[] , int src , vector<bool>& visited,int& len)
{
    len++;
    visited[src] = true;
    
    for(auto it : adj[src])
    {
        if(!visited[it])
          dfs(adj,it,visited,len);
    }
}

signed main() {
    
    int n;
    cin>>n;
    int m;
    cin>>m;
    set<pair<int,int>> s;
    
    vector<int> adj[n];
    
    for(int i = 0;i<m;i++)
    {
        int u , v;
        cin>>u>>v;
        u--;v--;
        if(s.find({u,v})!=s.end() || s.find({v,u})!=s.end())
        {
            
        }
        else
        {
            s.insert({u,v});
            adj[u].push_back(v);
            adj[v].push_back(u);
        }
    }  
        // now we have to find the max length of the connected components..
        
        int res = 0;
        vector<bool> visited(n,false);
        for(int i = 0;i<n;i++)
        {
            if(!visited[i])
            {
                int length = 0;
                dfs(adj,i,visited,length);
                res = max(res , length);
                
            }
        }
    
    
    cout<<res<<"\n";
   
 
}

Measured memory_bytes: 39504
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<vector>
#include<cstdio>

using namespace std;
/*
int find(int x, vector<int> &p) {
if (p[x] == x)return x;
return p[x] = find(p[x], p);
}

void uni(int x, int y, vector<int> &p) {
x = find(x, p);
y = find(y, p);
p[x] = y;
}

int same(int x, int y, vector<int> p) {
if (find(x, p) == find(y, p))return 1;
return 0;
}
*/

//long long a[1002];


int main()
{
	long long N, M, cnt = 0, tmp, ans = 0;
	cin >> N >> M;
	vector<long long> X(M), D(M-1);

	for (int i = 0; i < M; i++) {
		cin >> X[i];
	}
	sort(X.begin(), X.end());
	long long sum = X[M-1] - X[0];
	for (int i = 0; i < M-1; i++) {
		D[i] = X[i + 1] - X[i];
	}

	sort(D.begin(), D.end());
	for (int i = 0; i < N - 1; i++) {
		if (M - 2 - i < 0) {
			sum = 0;
			break;
		}
		sum -= D[M - 2 - i];
		if (sum <= 0) {
			sum = 0; 
			break;
		}
	}

	cout << sum;

	char qq;
	cin >> qq;
	return 0;
}

Measured memory_bytes: 1792
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define REPR(i,n) for(int i=n-1;i>=0;i--)
#define FORR(i,n,m) for(int i=n-1;i>=m;i--)
#define all(in) in.begin(),in.end()
#define ALL(in,K) in,in+K
#define INF 1e18
#define MOD 100000007
#define SIZE 10005
#define PI 	3.14159265358979323846

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,c;
    cin >> a >> b >> c;
    cout << (a-b)%c << endl;
}

Measured memory_bytes: 256
# # -*- coding: utf-8 -*-
import math

# A, B, H, M, = 3, 4, 10, 40
# A, B, H, M, = 3, 4, 9, 0

A, B, H, M, = map(int, input().split(' '))
s_needle = 30 * H + 0.5 * M
l_needle = 6 * M

s_x, s_y = math.cos(math.radians(s_needle)) * A, math.sin(math.radians(s_needle)) * A
l_x, l_y = math.cos(math.radians(l_needle)) * B, math.sin(math.radians(l_needle)) * B

# print(s_needle, s_x, s_y)
# print(l_needle, l_x, l_y)

l = math.sqrt((s_x - l_x)**2 + (s_y - l_y)**2)
print(l)


Measured memory_bytes: 62564
s = input()

dp = [[0 for i in range(len(s))] for i in range(30)]

for i in range(len(s)):
    if s[i] == "L":
        dp[0][i] = i - 1
    else:
        dp[0][i] = i + 1

for x in range(1,30):
    for i in range(len(s)):
        j = dp[x-1][i] #iにいた人が2^x-1回移動した後にいるマス
        dp[x][i] = dp[x-1][j]
 
now = [i for i in range(len(s))]
k = 10 ** 5
for i in range(30):
    if k & 2 ** i > 0:
        for j in range(len(now)):
            now[j] = dp[i][now[j]]
        k -= 2 ** i
ans = [0 for i in range(len(s))]
for i in now:
    ans[i] +=1
print(*ans)


Measured memory_bytes: 39652
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int A,B,C,D;cin>>A>>B>>C>>D;
  
  if(A*B>=C*D){
    cout<<A*B<<endl;
  }
  else{
    cout<<C*D<<endl;
  }
}

Measured memory_bytes: 3632
N = int(input())
A = list(map(int, input().split()))
 
def gcd(x, y):
  if x % y == 0:
    return y
  else:
    return gcd(y, x % y)
 
num = A[0]
for i in range(1, N):
  num = gcd(max(num, A[i]), min(num, A[i]))
 
print(num)


Measured memory_bytes: 14252