akhauriyash/Code-Regression huggingface dataset:
/// Tricky, Accepted
#include <bits/stdc++.h>
#define MX 1000000
#define pf printf
#define sf scanf
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define db double
#define fl float
#define ii pair <int,int>
#define ff first
#define ss second
#define pb push_back
#define ps push
#define pp pop()
#define tp top()
#define ft front()
#define cl clear()
#define max3(a,b,c) max(a, max(b,c))
#define min3(a,b,c) min(a, min(b,c))
#define SA(name,size) sort(name, name+size)
#define SV(name) sort(name.begin(), name.end())
#define RV(name) reverse(name.begin(), name.end());
#define loop(a,n) for(int i=a; i<n; i++)
#define nloop(j,a,n) for(int j=a; j<n; j++)
#define Case int T; scanf("%d", &T); for(int cas = 1; cas <= T; ++cas)
#define CaseF(n) for(int cas=1; cas<=n; cas++)
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define pr(x) cout << x << endl
#define pr2(x,y) cout << x << " " << y << endl
#define prln pf("\n")
using namespace std;

/**------------------------------Graph Moves-----------------------------------*/
/* anti-clockwise, starting from 0 degree */
///int dx[]={1,0,-1,0}; int dy[]={0,1,0,-1}; // 4 direction
///int dx[]={1,1,0,-1,-1,-1,0,1}; int dy[]={0,1,1,1,0,-1,-1,-1}; //8 direction
///int dx[]={2,1,-1,-2,-2,-1,1,2}; int dy[]={1,2,2,1,-1,-2,-2,-1}; //Knight Direction
///int dx[]={2,1,-1,-2,-1,1}; int dy[]={0,1,1,0,-1,-1}; //Hexagonal Direction
/*----------------------------------------------------------------------------*/

int bigmod(int n, int pow, int mod){
    if(pow==0) return 1;
    int x=bigmod(n, pow/2, mod);
    x=((x%mod)*(x%mod))%mod;
    if(pow%2==1) x=((x%mod)*(n%mod))%mod;
    return x;
}

inline int getint(){
    int x;
    scanf("%d",&x);
    return x;
}
#define II getint()

inline long long getlonglong(){
    long long x;
    scanf("%lld",&x);
    return x;
}
#define LL getlonglong()

inline float getfloat(){
    float x;
    scanf("%f",&x);
    return x;
}
#define FF getfloat()

inline double getdouble(){
    double x;
    scanf("%lf",&x);
    return x;
}
#define DB getdouble()

inline string getstring(){
    string s;
    cin>>s;
    return s;
}
#define SS getstring()

/**------------------------------------------------------------------------------------------*/

#define PI acos(-1)

struct point{
    double x,y;
    double operator * (point b){
        return x*b.x + y*b.y;
    }
    double operator ^ (point b){
        return x*b.y - b.x*y;
    }
    point operator - (point b){
        point Vector;
        Vector.x = x-b.x;
        Vector.y = y-b.y;
        return Vector;
    }
};

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

    int q;
    sf("%d",&q);
    while(q--){
        point p0, p1, p2, p3;
        sf("%lf %lf %lf %lf %lf %lf %lf %lf",&p0.x,&p0.y,&p1.x,&p1.y,&p2.x,&p2.y,&p3.x,&p3.y);
        point vect1 = p1-p0;
        point vect2 = p3-p2;
        if((vect1*vect2)==0)
            pf("1\n");
        else if((vect1^vect2)==0)
            pf("2\n");
        else
            pf("0\n");
    }

    return 0;
}


Measured memory_bytes: 3240
#include <iostream>
using namespace std;
int main(){
    
    int H , W ;
    
    do{
        cin >> H >> W ;
        if((H == 0)&&(W == 0)){
        }else{
            for(int i = 1 ; i <= H ; i++){
                if(i == 1){
                    for(int j = 1 ; j <= W ; j++){
                        cout << "#" ;
                    }
                        cout << endl ;
                }else if(i == H){
                    for(int j = 1 ; j <= W ; j++){
                        cout << "#" ;
                    }
                        cout << endl ;
                }else{
                        cout << "#" ;
                    for(int j = 2 ; j <= W - 1 ; j++){
                        cout << "." ;
                    }
                        cout << "#" << endl ;
                }
            }
        cout << endl ;
        }
    }while((H > 0)||(W > 0));
    
    
    

}


Measured memory_bytes: 3092
import java.util.*;
public class Main {
	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		new AOJ();
	}
	
	class  AOJ{
		ArrayList<Integer> gets;
		ArrayList<Integer> never;
		public AOJ(){
			Scanner in = new Scanner(System.in);
			while(true){
				int n = in.nextInt();//n-1までの街数
				int m = in.nextInt();//橋の数
				if(n+m==0)break;
				int[][] edge = new int[n][n];
				for(int i=0;i<n;i++)for(int s=0;s<n;s++)edge[i][s]=Integer.MAX_VALUE;
				for(int i=0;i<m;i++){
					int a=in.nextInt();
					int b=in.nextInt();
					edge[a][b]=in.nextInt();
					edge[b][a]=edge[a][b];
				}
				int result=0;
				int min[] = new int[n];
				boolean[] sw = new boolean[n];
				Arrays.fill(min,Integer.MAX_VALUE);
				sw[0] = true;
				for(int i=1;i<n;i++)if(!sw[i]&&min[i]>edge[i][0])min[i]=edge[i][0];
				while(true){
					int target = -1;
					for(int s=0;s<n;s++){
						if(!sw[s]&&(target==-1||min[target]>min[s])){
							target=s;
						}
					}
					if(target==-1)break;
					result+=min[target];
					sw[target]=true;
					for(int i=0;i<n;i++)if(!sw[i]&&min[i]>edge[i][target])min[i]=edge[i][target];
				}
				System.out.println(result);
			}
			
			
			
			
		}
	}
	
}

Measured memory_bytes: 26288
/*~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
    WRITER:kakitamasziru/OxOmisosiru
~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=*/
#ifdef LOCAL_JUDGE
#define _GLIBCXX_DEBUG //FOR THE DEBUG! COMMENT OUT THIS WHEN SUBMITTING!
#endif
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <iomanip>
#include <limits>//setprecision
//#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <math.h>//pow,,,
#include <cmath>//abs,,,
//#include <unordered_map> // unordered_map
//#include <unordered_set> // unordered_set
#include <bitset> // bitset
//#include <cctype> // isupper, islower, isdigit, toupper, tolower
//It is so troublesome that I include bits/stdc++.h !
using namespace std;

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 100100100100;
const int MOD = 1000000007;
typedef pair<int,int> P;
//NのM乗を求める(繰り返し二乗法)
long long mod_pow(long long N, long long M) {
    if (M == 0) return 1;
    long long res = mod_pow((N * N) % MOD, M / 2);
    //最下位ビット(*N)が1の時は単独でNをかける
    if (M & 1) res = (res * N) % MOD;

    return res %= MOD;
}
long long nCr(long long n, long long r) {
    long long A = 1, B = 1;
    //Aが分子Bが1/r!
    for (long long i = n - r + 1; i <= n; i++) {
        A = A * i % MOD;
    }
    for (long long i = 1; i <= r; i++) {
        B = B * i % MOD;
    }
    B = mod_pow(B, MOD - 2);
    B %= MOD;
    //Bは割るのではなく掛ける
    return (A * B) % MOD;
}

long long gcd(long long a, long long b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}
 
long long lcm(long long a, long long b) {
    return a * b / gcd(a, b);
}

long long A,B;

bool ok(long long key,long long index){
    string S = to_string(index);
    long long nagasa = S.size();
    if(index*A+nagasa*B > key) return true;
    else if(index*A+nagasa*B <= key) return false;
}

long long binary_search(long long key,long long size){
    //left,right,midはいずれもindex
    long long left = -1,right = size;
    while(right - left > 1){
        long long mid = left + (right-left)/2;
        long long hantei = ok(key,mid);
        if(hantei) right = mid;
        else left = mid;
    }
    if(left == -1)return 0;
    return left;
}

int main() {
    int N;cin >> N;
    set<string> T;
    for(int i = 0;i<N;i++){
        string S;cin >> S;
        T.insert(S);
    }

    cout << T.size() << endl;

    // PLEASE GIVE ME THE "ACCEPTED" !
}

Measured memory_bytes: 19204
#include <bits/stdc++.h>
#define ll long long
#define ar array
#define nl '\n'
#define AC ios_base::sync_with_stdio(0); cin.tie(NULL);
using namespace std;
const int M = 1e9+7;
const int N = 2*1e5;

set<string> s;

int main(){
    AC
    int n;
    cin>>n;
    for(int i=0; i<n; i++){
        string k;
        cin>>k;
        s.insert(k);
    }
    cout<<s.size()<<endl;
}

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

#define int long long
#define double long double
#define rep(i, n) for (int i = 0; i < (int) n; i++)
#define reps(i, n) for (int i = 1; i <= (int) n; i++)
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase(unique(v.begin(), v.end()), v.end());
#define bit(n) (1LL << (n))
#define dump(x) cerr << #x " = " << x << endl
using vint = vector<int>;
using vvint = vector<vint>;
using pint = pair<int, int>;
constexpr double pi = 3.1415926535897932384626433832795028;
constexpr int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<typename T> using priority_queue_rev = priority_queue<T, vector<T>, greater<T>>;
template<typename T1, typename T2> inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> inline bool chmin(T1 &a, const T2 &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}
template<typename T> ostream &operator<<(ostream &os, const vector<T> &p) {
    os << "{";
    for (auto itr = p.begin(); itr != p.end(); itr++) {
        itr++;
        if (itr != p.end()) { os << ", "; }
        itr--;
    }
    os << "}";
    return os;
}
struct SetUp {
    static constexpr int PREC = 20;
    SetUp() {
        cout << fixed << setprecision(PREC);
        cerr << fixed << setprecision(PREC);
    };
} setUp;

int N, M;
int A[110000], B[110000];
vint G[110000];
bool visited[110000], finished[110000];
bool dfs(int idx, int par) {
    if (visited[idx]) { return finished[idx]; }
    visited[idx] = true;
    bool ret = true;
    rep(i, G[idx].size()) {
        if (G[idx][i] == par) { continue; }
        if (dfs(G[idx][i], idx)) {
            ret = !ret;
            cout << idx << " " << G[idx][i] << endl;
        }
    }
    finished[idx] = true;
    if (!ret) { cout << idx << " " << par << endl; }
    return ret;

}
signed main() {
    cin >> N >> M;
    rep(i, M) {
        cin >> A[i] >> B[i];
        G[A[i]].push_back(B[i]);
        G[B[i]].push_back(A[i]);
    }
    if (M & 1) {
        cout << -1 << endl;
        return 0;
    }
    dfs(1, 0);
}


Measured memory_bytes: 16768
process.stdin.resume();
process.stdin.setEncoding('utf8');

var g_input = '';
process.stdin.on('data', function(chunk) {
    g_input += chunk;
});

process.stdin.on('end', function() {
    Main(g_input.split(/\r?\n/));
});

function Main(input) {

    var values = input[0].split(' ');
    var x = parseInt(values[0], 10);
    var y = parseInt(values[1], 10);
    var z = parseInt(values[2], 10);

    var ans = Math.floor((x - z) / (y + z));
    console.log(ans);

    return 0;
}


Measured memory_bytes: 22332
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        if (n % 2 == 0) {
            if (n / 2 >= k) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        } else {
            if ((n  + 1)/ 2 >= k) {
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }
        }


    }

}


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

int main(){
  int n,m;
  cin>>n>>m;
  P A[1001];
  for(int i=0;i<m;i++)cin>>A[i].first>>A[i].second;
  sort(A,A+m,greater<P>());
  int ans=0;
  for(int i=0;i<m-1;i++){
    if(A[i].first>=n)continue;
    ans+=(n-A[i].first);
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3100
def d_brick_break():
    N = int(input())
    A = [int(i) for i in input().split()]

    try:
        most_left_one = A.index(1)
    except ValueError:
        return -1  # 1 が見当たらなければ満足できない

    ans = most_left_one  # 1 より左のレンガはすべて砕く
    current_searching = 1
    for a in A[most_left_one:]:
        if current_searching == a:
            current_searching += 1
        else:
            ans += 1
    return ans

print(d_brick_break())

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

int main() {
  int N, M, L[100000], R[100000];
  cin >> N >> M;
  for (int i = 0; i < M; ++i) {
    cin >> L[i] >> R[i];
  }
  int max_L = L[0], min_R = R[0];
  for (int i = 0; i < M; ++i) {
    max_L = L[i] > max_L ? L[i] : max_L;
    min_R = R[i] < min_R ? R[i] : min_R;
  }
  cout << (min_R - max_L + 1 < 0 ? 0 : min_R - max_L + 1) << endl;
  return 0;
}

Measured memory_bytes: 1024
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int sx=sc.nextInt();
        int sy=sc.nextInt();
        int tx=sc.nextInt();
        int ty=sc.nextInt();
        for(int i=0;i<tx-sx;i++){
            System.out.print("R");
        }
        for(int i=0;i<ty-sy;i++){
            System.out.print("U");
        }
        for(int i=0;i<tx-sx;i++){
            System.out.print("L");
        }
        for(int i=0;i<ty-sy;i++){
            System.out.print("D");
        }
        System.out.print("D");
        for(int i=0;i<tx-sx+1;i++){
            System.out.print("R");
        }
        for(int i=0;i<ty-sy+1;i++){
            System.out.print("U");
        }
        System.out.print("L");
        System.out.print("U");
        for(int i=0;i<tx-sx+1;i++){
            System.out.print("L");
        }
        for(int i=0;i<ty-sy+1;i++){
            System.out.print("D");
        }
        System.out.println("R");
    }

}


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

int main()
{
	int A, B, C;
	std::cin >> A >> B;
	C = A * B;
	if (C % 2 == 0) {
		std::cout << "Even" << std::endl;
	} else {
		std::cout << "Odd" << std::endl;
	}
	return 0;
}

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

typedef string::iterator S;
string HOSHINO("Hoshino");
int lh = HOSHINO.size();
string HOSHINA("Hoshina");
string trg;

string hoshina(string& trg){
    if( trg.size() < lh ) return trg;
    for(S it = trg.begin(); it+lh-1!=trg.end(); it++){
        string cp(it, it+lh);
        if( cp == HOSHINO ) trg.replace(it,it+lh,HOSHINA);
    }
    return trg;
}

int main(){
    int n;
    cin >> n;
    getline(cin, trg);
    while(n--){
        getline(cin, trg);
        cout << hoshina(trg) << endl;
    }
    return 0;
}

Measured memory_bytes: 1216
/*
Stranger than the comet as it streaks across the sky
Stranger than the truth I know before my open eyes
I have dealt in mysteries and trickery, of light to entertain
Looked into the abyss, called it by its name

I have plundered time itself, put the world inside it
And the mysteries, day and night, divide it
A plague of wonders, on your knees beside me
Know the secrets, you shall not deride us

My dreams of empire for my frozen queen
Will come to pass
Know me, the Magus
I am Dr. Dee
And this is my house

I am the master of the tides
I shame the mirror in my sight
What random music of the spheres across the years

Know this I will return to this land
Rebuild where the ruins did stand
Chain of the demons set free
Strange alchemy

Gather round the aimless and the feckless and the lame
Hear the master summon up the spirits by their names
I curse you Edward Kelly your betrayal for eternity is damned
Know you speak with demons you cannot command

Even as I looked into the glass then I was blinded
Burning by the Mortlake shore my house my books inside it
You have taken up my wife and lain beside her
Now the black rain on my house, the timbers burning

My dreams of empire for my frozen queen
Will come to pass
Know me, the Magus
I am Dr. Dee
And this was my house

I was the keeper of the books
I had the knowledge of the scrolls
But now through ignorance and fear
I cast a shadow through the years

Know this I will return to this land
Rebuild where the ruins did stand
Chain of the demons set free
Strange alchemy

Know this
I will return to this land
Rebuild where the ruins did stand
Chain of the demons set free
Strange alchemy

Know this
I will return to this land
Rebuild where the ruins did stand
Restore the knowledge memory
Strange alchemy
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery

#define eps 1e-8
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 600000;

long long n,X,a[N],ans;

int main(){
//	freopen("apache.in","r",stdin);
//	freopen("apache.out","w",stdout);
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
	//cin.tie(0);

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

	sort(a,a+n);

	long long t=0;
	for (int i=0;i<n;i++){
		t+=a[i];
		if (t<=X)
			++ans;
	}
	if (ans==n&&t<X)
		--ans;

	cout<<ans<<endl;

//	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 764
#include <cstdio>
#include <iostream>
#include <bitset>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

#define ALL(obj) (obj).begin(), (obj).end() 
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)

ll *buildRMQ(ll *a, ll n) {
  ll logn = 1;
  for (ll k = 1; k < n; k *= 2) ++logn;
  ll *r = new ll[n * logn];
  ll *b = r; copy(a, a+n, b);
  for (ll k = 1; k < n; k *= 2) {
    copy(b, b+n, b+n); b += n;
    rep(i, n-k) b[i] = min(b[i], b[i+k]);
  }
  return r;
}
ll minimum(ll x, ll y, ll *rmq, ll n) {
  ll z = y - x, k = 0, e = 1, s; // y - x >= e = 2^k なる最大 k
  s = ( (z & 0xffff0000) != 0 ) << 4; z >>= s; e <<= s; k |= s;
  s = ( (z & 0x0000ff00) != 0 ) << 3; z >>= s; e <<= s; k |= s;
  s = ( (z & 0x000000f0) != 0 ) << 2; z >>= s; e <<= s; k |= s;
  s = ( (z & 0x0000000c) != 0 ) << 1; z >>= s; e <<= s; k |= s;
  s = ( (z & 0x00000002) != 0 ) << 0; z >>= s; e <<= s; k |= s;
  return min( rmq[x+n*k], rmq[y+n*k-e+1] );
}

int main(){
    ll N,x;
    cin >> N >> x;
    ll aa[4010];
    ll *a = aa + 2000; 
    ll *b = a - N;
    rep(i,N) cin >> a[i];
    rep(i,N) *(a - i - 1) = a[N-1-i];
  //  rep(i, 2 * N) cout << "b[" << i <<"] = " << b[i] << endl;
    ll *rmq = buildRMQ(b, 2 * N);
    ll ans = (ll)1000000000 *2000+1;
    rep(k,N){
        ll cost=0;
        // k denote how many times one spell the magic.
        cost += x * k;
        rep(i,N){
            cost += minimum(i+N-k,i+N,rmq,2*N);
        }
        ans = ans > cost ? cost : ans; 
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
H = gets.to_i

def max_heapify(a, i)
  left = i * 2
  right = left + 1
  largest = (left <= H && a[left] > a[i]) ? left : i
  largest = right if right <= H && a[right] > a[largest]
  if largest != i
    a[i], a[largest] = a[largest], a[i]
    max_heapify(a, largest)
  end
end

a = [nil] * 500000
gets.split().each.with_index(1) do |n, i|
  a[i] = n.to_i
end

(H / 2).downto(1) do |i|
  max_heapify(a, i)
end

a[1 .. H].each do |n|
  print " #{n}"
end
puts



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

int main(){
  int n; cin>>n;
  int s=INT_MAX,g=INT_MIN;
  for(int i=0;i<n;i++){
    int a; cin>>a;
    s=min(s,a);
    g=max(g,a);
  }
  cout<<g-s<<endl;
}

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

#define int long long
#define MOD 1000000007

int N,A,B,C,D;
int F[1010] = {1};
int dp[1010][1010];
int R[1010];

int power(int x,int y)
{
    if(y == 0)return 1;
    int res = power(x * x % MOD,y / 2);
    if(y & 1)res = x * res % MOD;
    return res % MOD;
}

int per(int x,int y)
{
    return F[x] * R[x - y] % MOD;
}

int P(int n,int m)
{
    if(n == 0)return dp[n][m] = 1;
    if(m < A)return dp[n][m] = 0;
    if(dp[n][m] != -1)return dp[n][m];
    int res = P(n,m - 1);
    for(int i = C; n - m * i >= 0 && i <= D; i++)
    {
        res += P(n - m * i,m - 1) *
               per(N - n + m * i,m * i) % MOD *
               power(power(F[m],i),MOD - 2) % MOD *
               R[i] % MOD;
        res %= MOD;
    }
    return dp[n][m] = res % MOD;
}

signed main()
{
    scanf("%lld%lld%lld%lld%lld",&N,&A,&B,&C,&D);
    for(int i = 0; i <= N; i++)for(int j = 0; j <= N; j++)dp[i][j] = -1;
    for(int i = 1; i < 1010; i++)F[i] = F[i - 1] * i % MOD;
    for(int i = 0; i < 1010; i++)R[i] = power(F[i],MOD - 2);
    printf("%lld\n",P(N,B));
    /*for(int i = 0; i <= N; i++)
    {
        for(int j = 0; j <= N; j++)
        {
            printf("  %lld",dp[i][j]);
        }printf("\n");
    }*/
    return 0;
}


Measured memory_bytes: 8192
#include<stdio.h>
#include<cstring>
int main(){
	int sign[50]={0};
	int flag=0;
	char a[101];
	scanf("%s", a); 
	for(int i=0;i<=strlen(a);i++){
		sign[a[i]-'a']++;
	}
	for(int j=0;j<=24;j++){
		if(sign[j]%2!=0){
			flag++;
			break;
		}
	} 
	if(flag==0)
		printf("Yes");
	else
		printf("No");
	return 0;
}

Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - Palindrome-philia
            var S = Console.ReadLine();

            int half = S.Length / 2;
            var left = S.Substring(0, half);
            var right = "";

            if (S.Length % 2 == 0)
            {
                right = S.Substring(half, half);
            }
            else
            {
                right = S.Substring(half + 1, half);
            }
            
            right = String.Join("", right.Reverse());
            int count = 0;

            for(int i = 0; i < half; i++)
            {
                if (left[i] != right[i])
                {
                    count++;
                }
            }

            Console.WriteLine(count);
        }
    }
}

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

const int DIM = 100005;

long long arr[DIM];

int main(void)
{
    int n; cin >> n;
    for (int i = 1; i <= n; ++i)
        cin >> arr[i];
    
    pair<long long, long long> pr = make_pair(2, 2);
    for (int i = n; i >= 1; --i) {
        long long val = (pr.first / arr[i]) * arr[i];
        
        if (val < pr.first and val + arr[i] > pr.second) {
            cout << -1;
            return 0;
        }
        
        if (pr.first > val)
            val += arr[i];
        pr.first = val;
        pr.second = (pr.second / arr[i]) * arr[i] + arr[i] - 1;
    }
    
    cout << pr.first << " " << pr.second;
    return 0;
}



Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>

int main (void)
{
    char S[100005], info[100005];
    int idx[100005], ans[100005] = {0,};
    scanf("%s", S);
    int chkIdx = 0, infoIdx = 0, len = strlen(S);
    char pivot = 'R';
    info[0] = 'R'; idx[0] = 0;
    while (++chkIdx < len) {
        if (pivot != S[chkIdx]) {
            pivot = info[++infoIdx] = S[chkIdx];
            idx[infoIdx] = chkIdx;
        }
    }
    idx[infoIdx+1] = len;
/*
    printf("info[] ->\n");
    for (int i = 0; i <= infoIdx; i++)
        printf("%c ", info[i]);
    printf("\n");
    printf("idx[] ->\n");
    for (int i = 0; i <= infoIdx; i++)
        printf("%d ", idx[i]);
    printf("\n");
*/
    for (int i = 0; i <= infoIdx; i++) {
        int plus1, plus2, dir, chg, cnt;

        if (info[i] == 'R') 
            dir = 1;
        else 
            dir = -1;
        plus2 = (idx[i+1] - idx[i]) / 2;
        plus1 = idx[i+1] - idx[i] - plus2;

        if (dir == 1) {
            chg = idx[i+dir];
        }
        else {
            chg = idx[i] - 1;
        }
        cnt = idx[i+1] - idx[i];
        //printf("i: %d, chg: %d, plus1: %d, plus2: %d, cnt: %d\n", i, chg, plus1, plus2, cnt);

        if (cnt % 2 == 0) {
            ans[chg] += plus1;
            ans[chg-dir] += plus2;
        }
        else {
            ans[chg] += plus2;
            ans[chg-dir] += plus1;
        }
   /* for (int i = 0; i < len; i++)
        printf("%d ", ans[i]);
    printf("\n");*/
    }

    for (int i = 0; i < len; i++)
        printf("%d ", ans[i]);
    printf("\n");
}


Measured memory_bytes: 1280
/* 解説見た */
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

typedef std::uint64_t u64;
typedef std::int64_t  i64;
typedef std::uint32_t u32;
typedef std::int32_t  i32;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl

int main(int argc, const char* argv[]) {
  string s;
  cin >> s;
  
  u64 a[2] = {0};
  
  for(u64 i = 0; i < s.length(); ++i) {
    if(s[i] == '0') {
      ++a[0];
    } else {
      ++a[1];
    }
  }
  
  cout << min(a[0], a[1]) * 2 << endl;
  
  return 0;
}

Measured memory_bytes: 512
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        var nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Console.WriteLine(a.OrderBy(x => x).Take(nk[1]).Sum());
    }
}


Measured memory_bytes: 28756
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
 
#define N 2000003
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
const ll INF = 1e18, MOD = 1e9 + 7, MOD2 = 1e6 + 3;

ll p[5001][5001];
ll a[5001], b[5001][200], n, m;

void solve (int t) {
	vector < pair <ll, int> > v;

	for (int i = 0; i < n; i++)
		v.push_back ({-b[i][t], i});

	sort (v.begin(), v.end());

	set <int> s;

	for (auto a : v) {
		ll v = -a.first, l, r, x = a.second;

		auto it = s.upper_bound (x);

		if (it == s.end ()) r = n - 1;
		else r = *it - 1;

		if (it == s.begin ()) l = 0;
		else l = *(--it) + 1;
		p[l][x] += v;
		p[l][r+1] -= v;
		p[x+1][x] -= v;
		p[x+1][r+1] += v;

		//cout << l << ' ' << x << ' ' << r << ' ' << v << endl;

		s.insert (a.second);
	}
}

int main () {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	int ptr = 0;
	//while (true) {
		//if (ptr % 10 == 0) cout << ptr << endl;
		ptr++;
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				p[i][j] = 0;

		for (int i = 1; i < n; i++) {
			cin >> a[i];
			//a[i] = rand () % 100000000;
			//cout << a[i] << ' ';
			a[i] += a[i-1];
		}

		//cout << endl;

		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				cin >> b[i][j];
				//b[i][j] = rand () % 100000000;
				//cout << b[i][j] << ' ';
			}
			//cout << endl;
		}

		for (int i = 0; i < m; i++) {
			solve (i);
		}

		for (int i = 1; i < n; i++) {
			p[0][i] += p[0][i-1];
			p[i][0] += p[i-1][0];
		}

		for (int i = 1; i < n; i++)
			for (int j = 1; j < n; j++)
				p[i][j] += p[i-1][j] + p[i][j-1] - p[i-1][j-1];

		ll ans = 0;

		for (int i = 0; i < n; i++)
			for (int j = i; j < n; j++) {
				ans = max (ans, p[i][j] - a[j] + a[i]);
			}

		ll ans2 = 0;

		/*for (int i = 0; i < n; i++) {
			vector <ll> mx (m);
			ll sum = 0;

			for (int j = i; j < n; j++) {
				for (int k = 0; k < m; k++) {
					sum -= mx[k];
					mx[k] = max (mx[k], b[j][k]);
					sum += mx[k];
				}

				if (sum != p[i][j]) cout << "Mismatch " << i << ' ' << j << ": " << sum << ' ' << p[i][j] << endl;

				ans2 = max (ans2, sum - a[j] + a[i]);
			}
		}*/

		cout << ans << endl;
		//cout << ans << ' ' << ans2;
	//}
}

Measured memory_bytes: 207272
# hitachi2020 B

a, b, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

min_price = min(A) + min(B)

for i in range(m):
    x, y, c = map(int, input().split())
    
    if A[x-1] + B[y-1] - c < min_price:
        min_price = A[x-1] + B[y-1] - c

print(min_price)

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

using namespace std;

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

    int n;
    cin>>n;
    for(int i=1;i<10;i++){
        for(int j=1;j<10;j++){
            if(i*j==n){
                cout<<"Yes";
                return 0;
            }
        }
    }
    cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    #define ll long long
    using namespace std;
    ll arr[10000];
    int main()
    {
        ll N, M, a, b;
        cin >> N >> M;
        while(M--){
            cin >> a >> b;
            arr[a]++;
            arr[b]++;
        }
        for(int i = 1; i <= N; i++){
            cout << arr[i] << "\n";
        }
        return 0;
    }

Measured memory_bytes: 256
def main():
    N = int(input())
    A = [0] + list(map(int, input().split())) + [0]

    cost = 0
    for i in range(N+1):
        cost += abs(A[i] - A[i+1])

    for i in range(N):
        ans = cost - abs(A[i] - A[i+1]) - abs(A[i+1]- A[i+2]) + abs(A[i] - A[i+2])
        print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 20452
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define MAXI INT_MAX
#define MINI INT_MIN
#define din(t) long long t;cin>>t; 
#define fi(i,l,r,d) for(i = l; i < r; i+=d)
#define fd(i,l,r,d) for(i = l-1; i >= r; i-=d)

 
int main(){
	din(n)
	ll i=0;
	ll arr[n]={0};
	fi(i,0,n,1)cin>>arr[i];
	ll dp[n]={0};
	dp[0]=0;
	dp[1]=abs(arr[0]-arr[1]);
	fi(i,2,n,1){
		dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
	}
	cout<<dp[n-1];

}



/*
stayinghomesaveslife


*/

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;
const int MOD = 1000000007;
const double pi = acos(-1);

int main() {
    int N,K; cin >> N >> K;
    veci A(N); REP(i,N) cin >> A[i];
    map<int,int> mp;
    REP(i,N) mp[A[i]]++;
    vector<P> res;
    for(auto p : mp) {
        res.push_back({p.second,p.first});
    }
    sort(res.begin(),res.end());
    int ans = 0;
    if(mp.size() <= K) cout << 0 << endl;
    else {
        REP(i,mp.size()-K) ans += res[i].first;
        cout << ans << endl;
    }
}


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

typedef long long ll;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)

ll mod=1e9+7;

using namespace std;


ll inputValue(){
	ll a;
	cin >> a;
	return a;
};

void inputArray(int * p, ll a){
	rep(i, a){
		cin >> p[i];
	}
};

template<typename T>
void inputVector(vector<T>& p, ll a){
	rep(i, a){
		T input;
		cin >> input;
		p.emplace_back(input);
	}
}


template <typename T>
void output(T a) {
	cout << a << "\n";
}

int main(int argc, const char * argv[]) {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
    string s;
    cin >> s;
    
    if(s[0] !=s[1])
        cout << "Yes" << endl;
    else if(s[1]!=s[2])
        cout << "Yes" << endl;
    else 
        cout << "No" << endl;


	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt();
		int []L = new int[N];

		int zahyou = 0;
		int cnt = 1;

		for (int i=0; i<N; i++) {
			L[i] = sc.nextInt();
		}

		for (int i=0; i<N; i++) {
			int tmp = L[i];
			zahyou+=tmp;
			if (zahyou<=X) {
				cnt+=1;
			} else {
				break;
			}

		}

		System.out.println(cnt);

	}

}


Measured memory_bytes: 27212
#include <stdio.h>
#include <string.h>

#define M 1046527
#define NIL (-1)
#define L 14

char H[M][L];

int getChar(char ch){
  if (ch == 'A') return 1;
  else if (ch == 'C') return 2;
  else if (ch == 'G') return 3;
  else if (ch == 'T') return 4;
  else return 0;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for(i = 0; i < strlen(str); i++){
    sum += p * (getChar(str[i]));
    p *= 5;
  }

  return sum;
}

int h1(int key) { return key % M; }
int h2(int key) { return 1 + (key % (M - 1)); }

int find(char str[]){
  long long key, i, h;
  key = getKey(str);
  for (i = 0;; i++){
    h = (h1(key) + i * h2(key)) % M;
    if (strcmp(H[h], str) == 0) return 1;
    else if (strlen(H[h]) == 0) return 0;
  }
}

int insert(char str[]){
  long long key, i, h;
  key = getKey(str);
  for (i = 0;; i++){
    h = (h1(key) + i * h2(key)) % M;
    if (strcmp(H[h], str) == 0) return 1;
    else if (strlen(H[h]) == 0) {
      strcpy(H[h], str);
      return 0;
    }
  }

  return 0;
}

int main(){
  int i, n, h;
  char str[L], com[9];
  for (i = 0; i < M; i++) H[i][0] = '\0';
  scanf("%d", &n);

  for (i = 0; i < n; i++) {
    scanf("%s %s", com, str);
    if (com[0] == 'i') insert(str);
    else if (find(str)) printf("yes\n");
    else printf("no\n");
  }

  return 0;
}



Measured memory_bytes: 16088
N, M = input().split()
N = int(N)
M = int(M)
votes_str = list(input().split())
votes = [int(i) for i in votes_str]
votes_sum = sum(votes)
votes.sort(reverse=True)
thresh = votes[M-1]
if thresh < votes_sum/(4*M):
  print("No")
else:
  print("Yes")

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

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

using namespace std;
typedef long long int ll;
const ll INF = 1000000000000000000;
const double PI = acos(-1);

int main()
{
    int k, n;
    cin >> k >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    sort(a.begin(), a.end());

    int max_dist = a[0] + (k - a[n - 1]);
    rep(i, n - 1) {
        int dist = a[i + 1] - a[i];
        max_dist = max(max_dist, dist);
    }
    int ans = k - max_dist;
    cout << ans << endl;
    return 0;
}

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    set<string> st;
    for(unsigned long i{0}; i < N; ++i){
        string s;
        cin >> s;
        st.emplace(s);
    }
    cout << st.size() << endl;
    return 0;
}

Measured memory_bytes: 19224
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mpp make_pair
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
vector<ll>adj[200005];
ll vis[200005];
ll cnt=1,n,m;
void dfs(ll u)
{
    vis[u]=1;
    for(auto it:adj[u])
    {
        if(vis[it]!=1)
        {
            cnt++;
            dfs(it);
        }
    }
}
int main()
{
    fast;
    cin>>n>>m;
    for(ll i=1; i<=m; i++)
    {
        ll x,y;
        cin>>x>>y;
        adj[x].pb(y);
        adj[y].pb(x);
    }
    ll ans=-1;
    for(ll i=1; i<=n; i++)
    {
        if(vis[i]!=1)
        {
            cnt=1;
            dfs(i);
            ans=max(ans,cnt);
        }
    }
    ans=max(ans,cnt);
    cout<<ans<<endl;



}


Measured memory_bytes: 22356
N,Q = list(map(int,input().split()))
C = list(map(int,input().split()))

M = max(C)+1
t1 = [0]*(M)
for v in C:
    t1[v] = 1

t2 = [0]*(M)
v = 0
for i in range(M):
    if t1[i]:
        v = i
    t2[i] = v

for i in range(Q):
    t = int(input())
    n_v = M-1
    m = 0
    while n_v != 0:
        amr = n_v % t
        m = max(m, amr) 
        tmp = n_v-m-1
        if tmp <= 0: break
        n_v = t2[tmp]

    print(m)

Measured memory_bytes: 49308
#include <iostream>
using namespace std;
int n ;
int m(int a)
{
	int res=0;
	while(a) res++ ,a/=10;
	return res;
}
int main() 
{	
	while(cin>>n)
	{
		int ans=0;
		for(int i=1 ;i<=n ;i++)		
			if(m(i)&1) ans++;
		cout<<ans<<'\n';
	}	
}

Measured memory_bytes: 3148
#include<iostream>
#include<cstdio>
#include<string>
#include<map>
using namespace std;

int main() {
  int n;
  char str[10], com[13];
  map<string, bool>  T;

  cin >> n;
  for ( int i = 0; i < n; i++ ) {
    scanf("%s%s", com, str);
    if ( com[0] == 'i' ) T[string(str)] = true;
    else {
      if ( T[string(str)] ) printf("yes\n");
      else printf("no\n");
    }
  }

  return 0;
}


Measured memory_bytes: 47488
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

	int n, a, b;
	cin >> n >> a >> b;
	cout << min(a, b) <<" ";
	if(n<a+b){
		cout << a+b-n << endl;
	} else {
		cout << 0 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct edge{ int from, to, cost; } ;

static const ll INF  = 1LL << 50;
static const int MAX_E = 5e3;
static const int MAX_V = 2500;

edge es[MAX_E];     //辺

ll d[MAX_V];
int V, E, P;

void shortest_path(int s){
    for(int i = 0; i < V; i++) d[i] = INF;
    d[s] = 0;
    int cnt = 0;
    while (true){
        cnt++;
        bool update = false;
        for(int i = 0; i < E; i++){
            edge e = es[i];
            if( d[e.from] != INF && d[e.to] > d[e.from] + e.cost){
                d[e.to] = d[e.from] + e.cost;
                update = true;
            }
        }
        if(!update) break;
        if(cnt > E){
            for(int i = 0; i < V; i++){
                for(int j = 0; j < E; j++){
                    edge e = es[j];
                    if ( d[e.from] != INF && d[e.to] > d[e.from] + e.cost ){
                        d[e.to] = -INF;
                        update = true;
                    }
                }
            }
            break;
        }
    }
    if(d[V-1] == -INF ) cout << -1 << endl;
    else if(d[V-1] < 0)cout << d[V-1] * (-1) << endl;
    else cout << 0 << endl;
}
/*
bool find_negative_loop(){
    memset(d, INF, sizeof(d));
    d[0] = 0;

    for(int i = 0; i < V; i++){
        for(int j = 0; j < E; j++){
            edge e = es[j];
            //cout << "e.from: " << e.from << " e.to :" << e.to << " e.cost " << e.cost << endl; 
            if( d[e.to] > d[e.from] + e.cost){
                //cout << "d[e.to]: " << d[e.to] << " d[e.from]" << d[e.from] << endl;
                d[e.to] = d[e.from] + e.cost;

                //cout << "i "<< i << " j " << j <<  " e.from: " << e.from << " e.to :" << e.to << " e.cost " << e.cost << endl; 
                
                //V回目にもゴールの点の更新があるなら負の閉路が存在する
                if( i == V - 1 && e.to == V - 1) return true;
            }
        }
    }
    return false;
}
*/
int main(){
    cin >> V >> E >> P;
    for(int i = 0; i < E; i++){
        int a, b, c; cin >> a >> b >> c; a--, b--;
        es[i] = {a, b, -(c - P)};
    }
    /*if(find_negative_loop()) {
        cout << -1 << endl;
        return 0;
    }*/
    shortest_path(0);
}

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


int main(void) {
    int A,B,C;
    scanf("%d %d %d",&A,&B,&C);
    int d=C-(A-B);
    if (d>=0) printf("%d",d);
    else printf("0");

return EXIT_SUCCESS;
}


Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    int flag = 0;

    if((A/2 + B/2) < C)
        flag = 1; 

    int dif, c_num;
    if(flag == 0){
        if(X > Y){
            if(2*C > A)
                dif = A*(X - Y);
            else
                dif = 2*C*(X - Y);
            c_num = Y;
        }else {
            if(2*C > B)
                dif = B*(Y - X);
            else
                dif = 2*C*(Y - X);
            c_num = X;            
        }
        cout << 2*C*c_num + dif << endl;
    }else {
        cout <<  A*X + B*Y << endl;
    }



    return 0;
}

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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
using VVD = vector<VD>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;
using VL = vector<long long>;
using VVL = vector<VL>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
#define REPC(var, start, end) for(int var = start; var <= (int)end; ++var)
#define CLEAR(var, with) memset(var, with, sizeof(var))
#define ALL(x) x.begin(), x.end()
#define LL long long
#define ULL unsigned long long
#define TIME cerr << "Time elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms" << endl;
#define DBG(x) cerr << x << endl;

/*
	
*/
string s;
string solve()
{
	VI check(26, 0);
	for(char c : s) ++check[c - 'a'];

	for(int i = 0; i < 26; ++i)
		if(check[i] == 0)
			return string(1, i + 'a');
	return "None";
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
//	freopen("tmp.in", "r", stdin);
	//freopen("tmp.out", "w", stderr);
#endif
	cin >> s;

	cout << solve() << endl;

	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define pii pair<int,int>
#define F first
#define S second
#define maxn 100005
using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n;cin>>n;
    vector<int> c(n+1,0);
    for(int i=2;i<=n;++i)
    {
        int a; cin>>a;
        c[a]++;
    }
    for(int i=1;i<=n;++i)
    {
        cout<<c[i]<<endl;
    }
    return 0;
}


Measured memory_bytes: 3976
import java.util.Scanner;

class Main {
    public static void main(String args[]) {
        StringBuilder sb = new StringBuilder();
        Scanner scan = new Scanner(System.in);

        int i = 0;
        while (true) {
            i++;
            int x = scan.nextInt();
            if(x == 0) {
                break;
            }
            sb.append("Case").append(" ").append(i + ":").append(" ").append(x).append("\n");

        }
        System.out.print(sb);
        sb.setLength(0);
    }
}

Measured memory_bytes: 42076
n = int(input())
a = list(map(int, input().split()))
s, d = [], []
for i in range(n):
    s.append(a[i] + i + 1)
    d.append(i + 1 - a[i])
cnt = dict()
ans = 0
for i in reversed(range(n)):
    if i < n - 1:
        if s[i] in cnt:
            ans += cnt[s[i]]
    if d[i] in cnt:
        cnt[d[i]] += 1
    else:
        cnt[d[i]] = 1
print(ans)


Measured memory_bytes: 126608
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


int main(void) {
    
    int n,k,s;
    cin>>n>>k>>s;
    vi v(n);
    rep(i,k)v[i]=s;
    int t;
    if(s == 1000000000){
        t=1;
    } else t=1000000000;
    for(int i=k;i<n;i++){
        v[i]=t;
    }

    rep(i,n){
        if(i!=0){
            cout<<" "<<v[i];
        } else {
            cout<<v[i];
        }
    }
    cout<<endl;
    
        
}

Measured memory_bytes: 1664
N=int(input())
import math
ans=[0]*(N+1)
n=int(math.sqrt(N))+1
for i in range(1,n+1):
    if i*i +2*i >N:
        break
    for j in range(1,n+1):
        if i*i+j*j+i*j>N:
            break
        for k in range(1,n+1):
            if i*i+j*j+k*k+i*j+j*k+i*k>N:
                break
            else:
                #print(i*i+j*j+k*k+i*j+j*k+i*k,i,j,k)
                ans[i*i+j*j+k*k+i*j+j*k+i*k]+=1
for i in range(len(ans)):
    if i!= 0:
        print(ans[i])

Measured memory_bytes: 9384
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}

int main(){
    int N,M;
    cin >> N >> M;
    int x=0,y=0;
    if(N >= 2) x = N*(N-1)/2;
    if(M >= 2) y = M*(M-1)/2;
    cout << x+y << endl;
    return 0;
}

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

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

inline void solve(){

    int d, p[20];
    int c[20],g;
    int ans = INF;
    cin >> d >> g;
    for(int i = 0; i < d; i++) {
        cin >> p[i] >> c[i];
    }
    
    for(int i = 0; i < (1<<d); i++) {

        int sum=0,num=0,m=-1;
        for(int j = 0; j < d; j++) {
            if( (1<<j) & i) {
                sum += 100*(j+1)*p[j] + c[j];
                num += p[j];
            } else
                m = j + 1;
        }
        if(sum < g){
            int t = 100 * m;
            int n = (g - sum + t - 1) / t;
            if( n >= p[m-1]) continue;
            num += n;
            
        }
        chmin(ans,num);
    }
    
    cout << ans << endl;
}
struct xyz{ xyz(){ cin.tie(0), ios::sync_with_stdio(false); cout <<fixed<<setprecision(12);};}xyzzy;signed main(){solve();return 0;}


Measured memory_bytes: 256