akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll                long long int
#define ld                long double
#define pb                push_back
#define mk                make_pair
#define in(i,a,n)         for(ll i=0;i<n;++i) cin>>a[i];
#define out(i,a,n)        for(ll i=0;i<n;++i) cout<<a[i]<<" ";
#define sz(c)             (ll)c.size()
#define all(c)            c.begin(), c.end()
#define rall(c)           c.rbegin(), c.rend()
#define loop(i,a,b)       for(ll i=a;i<b;i++)
#define rloop(i,a,b)      for(ll i=a;i>b;i--)
#define F                 first
#define S                 second
#define copy(a,b)         copy(all(a),back_inserter(b));
#define intersect(a,b,w)    set_intersection(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define union(a,b,w)      set_union(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define diff(a,b,w)       set_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
#define symdiff(a,b,w)    set_symmetric_difference(a.begin(), a.end(),b.begin(), b.end(),back_inserter(w));
const ll N=300001;
const ll MOD = 1000 * 1000 * 1000 + 7;
ll mod(ll n) {
    return (n % MOD + MOD) % MOD;
}

void solve(){
    ll n, k = 0, i, x, y;
    cin >> x >> n;
    loop(i,0,n){
        cin >> y;
        k += y;
    }
    cout << max((ll)-1, x - k);
}

signed main(){
    //fin fout
    fast
    ll t=1; //cin>>t;
    while(t--) solve();
}  

Measured memory_bytes: 3652
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	if n == 1 {
		fmt.Println(m)
		return
	}

	ans := 1
	for i := 2; i*i <= m; i++ {
		if m%i != 0 {
			continue
		}
		j := m / i
		if i*n <= m && i > ans {
			ans = i
		}
		if j*n <= m && j > ans {
			ans = j
		}
	}
	fmt.Println(ans)
}


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

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

// auto mod int

i64 MOD = 1'000'000'007;

struct mint {
  long long x;
  mint(long long x = 0) : x((x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(long long t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  i64 K;
  cin >> K;
  MOD = K;
  mint s = 7;
  int i = 1;
  mint m = 10;
  set<i64> seen;
  for (;; ++i, m *= 10) {
    if (s.x == 0) {
      cout << i << endl;
      return 0;
    }
    i64 y = s.x * MOD + m.x;
    if (seen.count(y)) {
      break;
    }
    seen.emplace(y);
    s += m * 7;
  }
  cout << -1 << endl;
}


Measured memory_bytes: 50420
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 2019;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	string s;
	cin >> s;
	ll n = s.size();
	Vec t(n);
	rep(i, n) t[i] = s[i] - '0';
	Vec pos(n);
	repr(i, n){
		if(i == n - 1) pos[i] = 1;
		else pos[i] = (pos[i + 1] * 10) % MOD;
	}

	Vec cnt(MOD);
	cnt[0]++;

	ll r = 0;
	repr(i, n){
		r += pos[i] * t[i];
		r %= MOD;
		cnt[r]++;
	}

	ll ans = 0;
	rep(i, MOD) ans += cnt[i] * (cnt[i] - 1) / 2;

	co(ans);

	return 0;
}


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

using namespace std;


int main()
{
	int N, M;
	cin >> N >> M;
	vector<int> a(N + 1, 1);
	for (int i = 0; i < M; i++)
	{
		int m;
		cin >> m;
		a[m] = 0;
	}

	vector<int> dp(100000, 0);

	dp[0] = 1;
	for (int i = 0; i <= N; i++)
	{
		dp[i + 1] += a[i] * dp[i];
		dp[i + 1] %= 1000000007;
		dp[i + 2] += a[i] * dp[i];
		dp[i + 2] %= 1000000007;
	}

	cout << dp[N] << endl;

	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

ll power(int x, int n)
{
	ll power = 1;
	for (int i = 0; i < n; i++) power *= x;
	return power;
}
int main()
{
	int N, P, A[60];
	cin >> N >> P;
	bool flag = true;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if (A[i] % 2 == 1) flag = false;
	}
	if (flag) {
		if (P == 0) cout << power(2, N) << endl;
		else cout << "0" << endl;
	}
	else {
		cout << power(2, N - 1) << endl;
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
	cin>>a>>b;
	if(b%2){
		cout<<"No";return 0;
	}
	if(b/2>=a && b/2<=2*a){
		cout<<"Yes";return 0;
	}
	else cout<<"No";
	return 0;
}

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

int main() {
  int n;
  scanf("%d", &n);
  vector<int> a(n);
  for(int i = 0; i < n; i++) scanf("%d", &a[i]), a[i]--;
  set<int> list;
  int t = 0;
  list.insert(0);
  while(list.find(1) == list.end()) {
    if(list.find(a[t]) == list.end())
      list.insert(a[t]), t = a[t];
    else {
      printf("-1\n");
      return 0;
    }
  }
  printf("%d\n", list.size() - 1);
}

Measured memory_bytes: 5376
#include <stdio.h>
int main()
{
	int a,b,c;
	int sum;
	scanf("%d %d %d", &a, &b, &c);
	sum = a+b+c;
	if (sum >= 22) {
		printf("bust\n");
	}
	else {
		printf("win\n");
	}
	return 0;
}

Measured memory_bytes: 3132
def main():
    #入力
    N, A, B, C, D = (int(_) for _ in input().split())
    A, B, C, D = A-1, B-1, C-1, D-1
    S = input()

    sa, sb = S[A:C+1], S[B:D+1]
    can1 = can2 = True
    for i in range(len(sa)-1):
        if sa[i] == '#' and sa[i+1] == '#': can1 = False
    for i in range(len(sb)-1):
        if sb[i] == '#' and sb[i+1] == '#': can2 = False
    can = can1 and can2

    if can and D < C:
        sc = S[B-1:D+2]
        can3 = False
        for i in range(len(sc)-2):
            if sc[i] == '.' and sc[i+1] == '.' and sc[i+2] == '.': can3 = True
        can = can and can3

    print('Yes' if can else 'No')
    return

if __name__ == '__main__':
    main()


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

typedef long long int int64;

int cmp(const void *a,const void *b){
  return *(int *)a-*(int *)b;
}

void run(void){
  int n;
  scanf("%d",&n);
  int *a=(int *)calloc(3*n,sizeof(int));
  int i;
  for(i=0;i<3*n;i++) scanf("%d",a+i);
  qsort(a,n,sizeof(int),cmp);
  qsort(a+n,n,sizeof(int),cmp);
  qsort(a+2*n,n,sizeof(int),cmp);
  int64 ans=0;
  int j=0;
  int k=0;
  for(i=0;i<n;i++){
    while(j<n && a[j]<a[n+i]) j++;
    while(k<n && a[n+i]>=a[k+2*n]) k++;
    ans+=(int64)j*(n-k);
  }
  printf("%lld\n",ans);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n) ;i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
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; }



int main(int argc, char const *argv[]) {
  ll n;cin >> n;
  vector<ll> a(n);
  map<ll,ll> mp;
  rep(i,n) {
    cin >> a[i];
    mp[a[i]]++;
  }
  ll sum=0;
  for(ll i=0;i<=n;i++){
    sum+=mp[i]*(mp[i]-1)/2;
  }
  //cout << sum << endl;

  rep(i,n){
    ll ans=sum-mp[a[i]]*(mp[a[i]]-1)/2;
    ans+=max((mp[a[i]]-1)*(mp[a[i]]-2)/2,(ll)0);
    cout << ans << endl;
  }

  return 0;
}


Measured memory_bytes: 16640
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
input:
2 1 1
2
0 1 4 1
3 0 3 3

output:
1.00000000 1.00000000 3.00000000 1.00000000
3.00000000 1.00000000 3.00000000 1.00000000
"""

import math
import sys
from operator import attrgetter


class Segment(object):
    __slots__ = ('source', 'target')

    def __init__(self, source, target):
        self.source = complex(source)
        self.target = complex(target)


class Circle(object):
    __slots__ = ('centre', 'radius')

    def __init__(self, centre, radius):
        self.centre = complex(centre)
        self.radius = float(radius)


def dot(a, b):
    return a.real * b.real + a.imag * b.imag


def project(s, p):
    base_vector = s.target - s.source
    prj_ratio = dot(p - s.source, base_vector) / pow(abs(base_vector), 2)
    return s.source + base_vector * prj_ratio


def get_cross_point(c, l):
    prj_vector = project(l, c.centre)
    line_unit_vector = (l.target - l.source) / (abs(l.target - l.source))
    base = math.sqrt(pow(c.radius, 2) - pow(abs(prj_vector - c.centre), 2))
    ans = [prj_vector + line_unit_vector * base, prj_vector - line_unit_vector * base]

    ans.sort(key=attrgetter('real', 'imag'))
    return ans


def solve(_lines):
    for line in _lines:
        line_axis = tuple(map(int, line))
        p0, p1 = (x + y * 1j for x, y in zip(line_axis[::2], line_axis[1::2]))
        l = Segment(p0, p1)
        cp1, cp2 = get_cross_point(circle, l)
        print('{0:.8f} {1:.8f} {2:.8f} {3:.8f}'.format(cp1.real, cp1.imag, cp2.real, cp2.imag))

    return None


if __name__ == '__main__':
    _input = sys.stdin.readlines()

    cx, cy, r = map(int, _input[0].split())
    q_num = int(_input[1])
    lines = map(lambda x: x.split(), _input[2:])

    circle = Circle(cx + cy * 1j, r)
    solve(lines)

Measured memory_bytes: 7900
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int n;
	cin>>n;
	map<string,int> mp;
	rep(i,n){
		string s;
		cin>>s;
		mp[s]++;
	}
	vector<string> ans={"AC","WA","TLE","RE"};
	rep(i,4){
		if(mp.find(ans[i])==mp.end()) mp[ans[i]]=0;
		for(auto itr:mp){
			if(itr.fi!=ans[i]) continue;
			cout<<ans[i]<<' '<<"x"<<' '<<itr.se<<endl;
		}
	}
}

Measured memory_bytes: 3576
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f
#include <cstdio>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
 
using namespace std;
 
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P > PP;
 
int tx[] = {0,1,0,-1};
int ty[] = {-1,0,1,0};
 
static const double EPS = 1e-8;

bool visited[51][51][1<<2];

void dfs(char stage[51][51],int occupy[51][51],int sx,int sy,int w,int h){
  if(visited[sx][sy][occupy[sy][sx]]) return;

  visited[sx][sy][occupy[sy][sx]] = true;
  for(int i=0;i<4;i++){
    int dx = tx[i] + sx;
    int dy = ty[i] + sy;
    if(dx < 0 || dx >= w || dy < 0 || dy >= h) continue;
    if(stage[dy][dx] == 'B' || stage[dy][dx] == 'W') continue;
    
       occupy[dy][dx] |= occupy[sy][sx];
       dfs(stage,occupy,dx,dy,w,h);
  }
}



int main(){
  int w,h;
  while(~scanf("%d %d",&w,&h)){
    if(w==0 && h==0) break;
    char stage[51][51];
    int occupy[51][51];
    memset(stage,'\0',sizeof(stage));
    memset(occupy,0,sizeof(occupy));
    memset(visited,0,sizeof(visited));
    for(int y=0;y<h;y++){
      char buf[51];
      scanf("%s",buf);
      for(int x=0;x<w;x++){
	stage[y][x] = buf[x];
	if(buf[x] == 'B') occupy[y][x] = 1;
	if(buf[x] == 'W') occupy[y][x] = (1<<1);
      }
    }
    for(int y=0;y<h;y++){
      for(int x=0;x<w;x++){
	if(stage[y][x] == '.') continue;
	dfs(stage,occupy,x,y,w,h);
      }
    }

    int B_num = 0;
    int W_num = 0;
    for(int y=0;y<h;y++){
      for(int x=0;x<w;x++){
	if(occupy[y][x] != (1<<2) - 1){
	  if((occupy[y][x] & 1) && stage[y][x] != 'B') B_num++;
	  if((occupy[y][x] & (1<<1)) && stage[y][x] != 'W') W_num++;
	}
      }
    }

    printf("%d %d\n",B_num,W_num);
  }
}

Measured memory_bytes: 1328
#include<bits/stdc++.h>
#define ll long long 
#define rep(i,n) for(ll i=0;i<n;i++)
using namespace std;
signed main(){
  string s;
  ll a[100]={};
  cin>>s;
  rep(i,s.size()) a[s[i]-'a'] = 1;
  rep(i,26){
    if(a[i]==0){
      cout<<(char)(i+'a')<<"\n";
      return 0;
    }
  }
  cout<<"None\n";
  return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 3e18;
const double INFD = 1e30;
const double EPS = 1e-10;
const double PI = acos(-1);
const int MOD = 998244353;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 200005;
const int MAXV = 3;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE = 1;
int arr[MAXN];
int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        arr[i] = read<int>();
    }
    sort(arr, arr + n);
    ll ans = arr[n - 1];
    int i = n - 3;
    int tot = n - 2;
    for (; i - 1 >= 0; i -= 2) {
        ans += 2 * arr[tot];
        tot--;
    }
    if (i >= 0) {
        ans += arr[tot];
    }
    printf("%lld\n", ans);
    return 0;
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> a(n);
  int i, j;
  for(i = 0; i < n; i++)
  {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  int p, q;
  p = 0;
  q = 0;
  for(i = 0; i < n; i++)
  {
    if(a.at(i) >= 0)p++;
    else q++;
  }
  if(p == 0)
  {
    p = 1;
    q = n-1;
  }
  if(q == 0)
  {
    p = n-1;
    q = 1;
  }
  int ans = 0;
  for(i = 0; i < n; i++)
  {
    if(i<q) ans -= a.at(i);
    else ans += a.at(i);
  }
  cout << ans << endl;
  for(i = q; i < n-1; i++)
  {
    cout << a.at(0) << ' ' << a.at(i) << endl;
    a.at(0) -= a.at(i);
  }
  for(i = 0; i < q; i++)
  {
    cout << a.at(n-1) << ' ' << a.at(i) << endl;
    a.at(n-1) -= a.at(i);
  }
}

Measured memory_bytes: 2304
#include <iostream>
const int first = 100000;
int round_up(int price) // 1000????????????????????????
{
    if (price%1000 == 0) {
        return price;
    }
    int complement  = 1000 - price%1000; // ?£???°
    return (price + complement);
}
int get_dept(int n) // n??±??????
{
    int dept = first;
    for (int i=0; i<n; i++) {
        dept += dept * 0.05;
        dept = round_up(dept);
    }
    return dept;
}
int main()
{
    int n;
    std::cin  >> n;
    std::cout << get_dept(n) << std::endl;
}

Measured memory_bytes: 2968
#include<cstdio>
#include<iostream>
#include<cctype>
using namespace std;

int main(){
  char ch;
  int cnt[26] = {};

  while( cin >> ch ){
    ch = tolower(ch);
    if( isalpha(ch) ){
      cnt[ch-'a']++;
    }
  }

  for(int i = 0; i < 26; i++){
    printf("%c : %d\n", i+'a', cnt[i]);
  }
  
  return 0;
}

Measured memory_bytes: 1124
#include<bits/stdc++.h>
 
#define pb push_back
// #define mp make_pair
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell1 1000000007
#define hell2 1000000009
#define pi 3.1415926535
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define ll unsigned long long
#define ld long double 
#define no_of_digits(n) floor(log10(n)) + 1
#define see(x) cerr << (#x) << " is " << (x) << endl
#define INF 1e13
#define LL_MAX 1e18
// memset(array, -1, sizeof(array[0][0]) * row * count)
using namespace std;
 
ll mult(ll a,ll b, ll p=hell1){   return ((a%p)*(b%p))%p; }
ll multbig(ll a,ll b,ll mod=hell1){   if(a==0 or b==0) return 0;if(a==1 or b==1) return (a*b)%mod;ll cur=multbig(a,b/2,mod);cur=(2*cur)%mod;if(b%2) cur=(cur+a)%mod;return cur;}
ll add(ll a, ll b, ll p=hell1){ if(a>=p) a%=p; if(b>=p) b%=p; if(a+b>p) return (a + b)%p; else return a+b;}
ll sub(ll a, ll b, ll p=hell1){return (a%p - b%p + p)%p;}
ll fpow(ll n, ll k, ll p = hell1) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = hell1) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = hell1){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}
int isPowerof2(ll x) { return (x && !(x & x-1)); } 
ll log2(ll x) { ll res = 0; while (x >>= 1) res++; return res; } 
bool isPerfectSquare(long double x) {long double sr = sqrt(x); return ((sr - floor(sr)) == 0); }
bool check(ll i,ll j,ll n){return (i>=0 && i<n && j>=0 &&  j<n);} //matrix boundary checking
 
 
ll ceil(const ll &a, const ll &b){return (a - 1)/b + 1;}
 
// max({a, b, c, d})
// cout << fixed for removing e notation
 
bool comp(pair<ll, ll>a, pair<ll, ll>b)
{
    if(a.se*b.fi + b.se > b.se*a.fi + a.se) return true;
    else return false;
}
 
void convert(int arr[], int n) 
{ 
    int temp[n+1];
    for(int i=1;i<=n;i++)
        temp[i] = arr[i]; 
    // memcpy(temp, arr, n*sizeof(int)); 
  
    sort(temp+1, temp+n+1);   
    unordered_map<int, int> umap;
    int val = 1; 
    for (int i = 1; i <= n; i++) 
        umap[temp[i]] = val++;
    for (int i = 1; i <= n; i++) 
        arr[i] = umap[arr[i]]; 
}
 
bool prime[10000005];
void SieveOfEratosthenes(int n) 
{
    memset(prime, true, sizeof(prime)); 
    prime[0] = prime[1] = 0;
    for (int p=2; p*p<=n; p++) 
    {
        if (prime[p] == true) 
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
    }
}

int foo(int a, int b, int c)
{
    return (abs(a-b) + abs(b-c) + abs(a-c));
}


ll getFirstSetBitPos(ll n) 
{ 
    return log2(n & -n) + 1; 
} 

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

    ll a[n];

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

    cout << ans << "\n";
}


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

int main() {
  int x, y;

  while (cin >> x >> y) {
    if (x == 0 && y == 0) break;
    if (x < y) cout << x << " " << y << endl;
    else cout << y << " " << x << endl;
  }

  return 0;
}

Measured memory_bytes: 3084
def bit(n)
  return "0" if n == 0
  b = n.bit_length
  x = ""
  b.times do |i|
    if i == 0
      if ((n+1)/2) % 2 == 1
        x = "1" + x
      else
        x = "0" + x
      end
    else
      if (n + 2**i) % (2 ** (i+1)) < 2 ** i && ((n + 2**i) % (2 ** (i+1))) % 2 == 0
        x = "1" + x
      else
        x = "0" + x
      end
    end
  end
  x
end
a,b = gets.chomp.split(" ").map(&:to_i)
if a == 0
  puts bit(b).to_i(2)
else
  puts bit(a-1).to_i(2) ^ bit(b).to_i(2)
end


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

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

using namespace std;

const int MAX = 40;
int W,H,cq,ca;
char field[MAX][MAX];
int memo[MAX*MAX][MAX*MAX][2]; // dp[Queen][Army][phase( 0 : Queen, 1 : Army )] := state
int dx[] = {0,0,1,0,-1};
int dy[] = {0,1,0,-1,0};

bool isValid(int x,int y) { return 0 <= x && x < W && 0 <= y && y < H; }

#define REPEAT 0
#define ESCAPE 1
#define CATCH -1

void compute(){

  vector<int> E;

  rep(i,H) rep(j,W) {
    if( field[i][j] == 'Q' ) field[i][j] = '.', cq = j + i * W;
    if( field[i][j] == 'A' ) field[i][j] = '.', ca  = j + i * W;
    if( field[i][j] == 'E' ) E.push_back(j+i*W);
  }

  rep(i,H*W) rep(j,H*W) rep(k,2) memo[i][j][k] = REPEAT;
  
  rep(i,(int)E.size()) rep(j,H*W) if( E[i] != j ) memo[E[i]][j][0] = ESCAPE;

  rep(i,H*W) rep(k,2) if( field[i/W][i%W] != '#' ) memo[i][i][k] = CATCH;

  bool update = true;
  while( update ){
    update = false;
    rep(queen,H*W){
      rep(army,H*W){
	rep(phase,2){
	  if( memo[queen][army][phase] != REPEAT ) continue;
	  if( phase ) { // Army
	    bool escape = true;
	    bool cat = false;
	    REP(i,0,5){
	      int nx = army % W + dx[i], ny = army / W + dy[i];
	      if( !isValid(nx,ny) ) continue;
	      if( field[ny][nx] == '#' ) continue;
	      if( memo[queen][nx+ny*W][!phase] == CATCH  ) { cat = true; }
	      if( memo[queen][nx+ny*W][!phase] != ESCAPE ) { escape = false; }
	    }
	    if( cat    ) memo[queen][army][phase] = CATCH , update = true;
	    if( escape ) memo[queen][army][phase] = ESCAPE, update = true;
	  } else { // Queen
	    bool escape = false;
	    bool cat = true;
	    REP(i,0,5) {
	      int nx = queen % W + dx[i], ny = queen / W + dy[i];
	      if( !isValid(nx,ny) ) continue;
	      if( field[ny][nx] == '#' ) continue;
	      if( memo[nx+ny*W][army][!phase] == ESCAPE ) { escape = true; }
	      if( memo[nx+ny*W][army][!phase] != CATCH  ) { cat = false; }
	    }
	    if( escape ) memo[queen][army][phase] = ESCAPE, update = true;
	    if( cat    ) memo[queen][army][phase] = CATCH , update = true;
	  }
	}
      }
    }
    /*
    cout << endl;
    cout << "------ " << endl;
    rep(i,H*W) rep(j,H*W) {
      cout << endl;
      cout << memo[i][j][0] << " " << memo[i][j][1] << endl;
      rep(y,H) {
	rep(x,W) {
	  if( x + y * W == i && i == j ) cout << "X";
	  else if( x + y * W == i ) cout << "Q";
	  else if( x + y * W == j ) cout << "A";
	  else cout << field[y][x];
	}
	cout << endl;
      }
    }
    */
  }
  if( memo[cq][ca][0] == REPEAT ) puts("Queen can not escape and Army can not catch Queen.");
  else if( memo[cq][ca][0] == ESCAPE ) puts("Queen can escape.");
  else puts("Army can catch Queen.");
}

int main(){
  while( cin >> W >> H, W|H ){
    rep(i,H) rep(j,W) cin >> field[i][j];
    compute();
  }
  return 0;
}

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

using namespace std;

int main() {



	int x;
	scanf("%d", &x);
	int max = 0;

	if(x == 1) {
		printf("1\n");
	} else if(x == 2) {
		printf("2\n");
	} else {
		for(int i = 2; i < sqrt(x); i++) {
			int count = i;
			while(count <= x) {
				count = count * i;
			}

			if((count/i) > max) {
				max = (count/i);
			}
		}

		printf("%d\n", max);
 	}

 	

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const ll LL_INF = 1e18;
const int MOD = 1e9 + 7;

using namespace std;

bool used[303][303];
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  int dist[303][303];
  REP(i,N){
    REP(j,N){
      cin >> dist[i][j];
    }
  }
  REP(k,N){
    REP(i,N){
      REP(j,N){
        if(dist[i][j] == 0) continue;
        if(dist[i][j] > dist[i][k] + dist[k][j]){
          cout << -1 << endl;
          return 0;
        }
      }
    }
  }
  long long ans = 0;
  REP(i,N){
    REP(j,i){
      ans += dist[i][j];
    }
  }
  REP(k,N){
    REP(i,N){
      REP(j,N){
        if(dist[i][k] == 0 || dist[k][j] == 0 || dist[i][j] == 0) continue;
        if(dist[i][j] == dist[i][k] + dist[k][j] && not used[i][j]){
          used[i][j] = used[j][i] = true;
          ans -= dist[i][j];
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include <cstdlib>

using namespace std;

int main(){

	int n,d,x,a,count=0;
	cin >> n >> d >> x;
	vector<int> aa;
	for(int i = 0; i < n; i++){
		cin >> a;
		aa.push_back(a);
	}

	for(int i = 0; i < n; i++){
		int whi = 0;
		while( aa[i]*whi + 1 <= d ){
			count ++;
			whi++;
		}
	}
	cout<< count + x << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

int main(){
    int n;cin >> n;
    vector<int> a(n+1),k(n+1,0);
    for (int i = 0; i < n; i++) {
        cin >> a[i+1];
    }
    bool f=true;
    vector<int> ans;
    for (int i = n; i >= 1; i--) {
        int sum = 0;
        for (int j = i; j <= n; j+=i) {
            sum += k[j];
        }
        if(sum%2!=a[i]){
            ans.pb(i);
            k[i]=1;
        }
    }
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i] << (i==ans.size()-1?"\n":" ");
    }
    return 0;
}


Measured memory_bytes: 3064
#include <map>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <stdio.h>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <iostream>
#include <queue>
#include <set>
#define ll long long
#define sf(a) scanf("%lld",&a)
#define pf(b) printf("%lld",b)
#define sp printf(" ")
#define nw printf("\n")
#define mp make_pair
#define pi pair<ll,ll>
#define f first
#define s second
#define pb push_back
#define sor(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define fast ios_base::sync_with_stdio(false)
using namespace std;

ll c[300009],r[300009];
vector<ll> all[300009];
int main()
{
  ll n,m,k;
  cin>>n>>m>>k;
  ll maxc,ans,x,y,cmax;
  ans=maxc=cmax=0;
  for(ll i=0;i<k;i++)
  {
    cin>>x>>y;
    r[x]++;
    c[y]++;
    all[x].pb(y);
  }
  for(ll i=1;i<=m;i++)
    maxc=max(maxc,c[i]);
  for(ll i=1;i<=m;i++)
    if(c[i]==maxc) cmax++;
  for(ll i=1;i<=n;i++){
    ll val=r[i]+maxc;
    ll cc=0;
    for(auto e:all[i]) if(c[e]==maxc) cc++;
    if(cc==cmax) val--;
    ans=max(ans,val);
  }
  cout<<ans;
}


Measured memory_bytes: 24224
class UnionFind:
    def __init__(self, length):
        self.par = [-1 for _ in range(length)]
        self.rank = [0 for _ in range(length)]
 
    def root(self,x):
        if (self.par[x] < 0 ):
             return x
        else:
            #change connection
            root = self.root(self.par[x])
            self.par[x] = root
            return root
    
    def unite(self,x,y):
        root_x = self.root(x)
        root_y = self.root(y)
        if (root_x==root_y):
            return 
        else:
            if self.rank[root_x] < self.rank[root_y]:
                self.par[root_y] += self.par[root_x]
                self.par[root_x] = root_y

            else:
                self.par[root_x] += self.par[root_y]
                self.par[root_y] = root_x
                if self.rank[root_x] == self.rank[root_y]:
                    self.rank[root_x]+=1
        
    def same(self,x,y):
        root_x = self.root(x)
        root_y = self.root(y)
        return root_x == root_y 
    
    def size(self,x):
        return -self.par[self.root(x)]

"""
uf = UnionFind(5)
uf.unite(3,4)
uf.unite(1,2)

uf.unite(1,4)
print(uf.size_dict)
"""
def solve(edges,N,M):
 
    score= N*(N-1)//2
    outputs = [score]
    uf = UnionFind(N)
    for edge in edges[::-1]:
        if not uf.same(*edge):
            score -= uf.size(edge[0]) * uf.size(edge[1])
            uf.unite(*edge)
        outputs.append(score)
    for i in range(M):
        print(int(outputs[M-i-1]))

def get_input():
    N,M = map(int, input().split())
    edges = [tuple(map(lambda x:  int(x)-1, input().split())) for _ in range(M)]
    return N,M,edges

N,M,edges = get_input()
# = 10**6
#M=10**5
#import numpy as np
#edges = [(np.random.randint(N),np.random.randint(N)) for i in range(M)]
solve(edges,N,M)

Measured memory_bytes: 23284
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long long INF = 1e15;

#include <math.h>
#define PI 3.14159265358979323846264338327950L



int main() {
    
    long long n;
    cin >> n;
    int x = 7 % n;

    for (int i = 0; i < 30000000; i++) {
        if (x == 0) {
            cout << i + 1;
            return 0;
        }
        x *= 10;
        x += 7;
        x %= n;
    }
    cout << -1;

    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cmath>
#include <vector>

using namespace std;

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

  vector<int> a(n);
  for(int idx = 0; idx < n; idx++) std::cin >> a[idx];

  int all_combination = pow(3, n);
  int even_num_cnt = 0;
  for(int idx = 0; idx < n; idx++){
    if(a[idx] % 2 == 0){
      even_num_cnt += 1;
    }
  }

  int sub_combination = pow(2, even_num_cnt);

  std::cout << all_combination - sub_combination << '\n';

  return 0;
}


Measured memory_bytes: 256
n=int(input())
A=[int(i) for i in input().split()]

x = A[-1]
i=0
for j in range(n-1):
    if A[j]<=x:
        A_j=A[j]
        A[j]=A[i]
        A[i]=A_j
        i+=1
A[-1]=A[i]
A[i]=[x]

print(*A)


Measured memory_bytes: 16364
#include <bits/stdc++.h>                 // [PRIMES]               1777 ~2^10.80
using namespace std;                     //                       10333 ~2^13.33
using ll = long long;                    // seq 1 128 | factor   100333 ~2^16.61
using ld = long double;                  //   | grep -v ' .* '  1300111 ~2^20.31
using vl = vector<ll>;                   //                    10300777 ~2^23.30
using vvl = vector<vl>;                  //                   100400999 ~2^26.58
using pll = pair<ll,ll>;                 //                  1300400999 ~2^30.28
using vpll = vector<pll>;                //                 10200500333 ~2^33.25
using vb = vector<bool>;                 //                100200400777 ~2^36.54
using vs = vector<string>;               //               1200300700111 ~2^40.13
const ll oo = 0x3f3f3f3f3f3f3f3fLL;      //              10200300500777 ~2^43.21
const ld eps = 1e-9;                     //             100200300400777 ~2^46.51
#define sz(c) ll((c).size())             //            1200300400600999 ~2^50.09
#define all(c) begin(c),end(c)           //           10200300400600111 ~2^53.18
#define mp make_pair                     //          100200300400600333 ~2^56.48
#define mt make_tuple                    //         1200300400500800999 ~2^60.06
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(0) cerr << "TR: " << (#X) << " = " << (X) << endl; })

int main(){
	cin.sync_with_stdio(0);
	cin.tie(0);

	ll N, W; cin >> N >> W;
	vpll items(N+1);
	FOR(i,1,N+1) cin >> items[i].xx >> items[i].yy;

	map<ll, ll> best;
	best[0] = 0;

	FOR(i,1,N+1) {
		TR(i);
		ll w, v;
		tie(w, v) = items[i];
		TR(w);
		TR(v);

		map<ll, ll> old(best);

		for (auto c : old) {
			pll next = {c.xx + w, c.yy + v};

			if (old.count(next.xx)) {
				if (old[next.xx] < next.yy) {
					best[next.xx] = next.yy;
				}
			} else {
				best[next.xx] = next.yy;
			}
		}

		ll cur = -1;
		for (auto it = best.begin(); it != best.end(); ) {
			if (it->yy <= cur) {
				it = best.erase(it);
			} else {
				cur = it->yy;
				it++;
			}
		}

#if 0
		for (auto c : best) {
			cerr << c.xx << " " << c.yy << "\n";
		}
#endif
	}

	auto res = best.upper_bound(W);
	res--;
	cout << (*res).yy << "\n";

	return 0;
}


Measured memory_bytes: 896
s = input()

vocabs = ["dream","dreamer","erase","eraser"]

cnt = 0
t = ""
while cnt <= len(s) - 8:
    if s[cnt] == "d":
        if s[cnt+5] == "d":
            cnt += 5
            t += vocabs[0]
        elif s[cnt+5] == "e":
            if s[cnt+7] == "a":
                cnt += 5
                t += vocabs[0]
            else:
                cnt += 7
                t += vocabs[1]
        else:
            break
    elif s[cnt] == "e":
        if s[cnt+5] == "r":
            cnt += 6
            t += vocabs[3]
        else:
            cnt += 5
            t += vocabs[2]
    else:
        break

if s[cnt:] == vocabs[0]:
    t+= vocabs[0]
elif s[cnt:] == vocabs[1]:
    t+= vocabs[1]
elif s[cnt:] == vocabs[2]:
    t+= vocabs[2]
elif s[cnt:] == vocabs[3]:
    t+= vocabs[3]


if s == t:
    print("YES")
else:
    print("NO")

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

int main() {
	int n,key;
	string command;
	list<int> lst;
	cin >> n;
	for(int i=0; i<n; ++i) {
		cin >> command;
		if(command=="insert") {
			cin >> key;
			lst.push_front(key);
		} else if(command=="delete") {
			cin >> key;
			for(auto itr=lst.begin(); itr!=lst.end(); ++itr) {
				if((*itr)==key) {
					lst.erase(itr);
					break;
				}
			}
		} else if(command=="deleteFirst") {
			lst.pop_front();
		} else if(command=="deleteLast") {
			lst.pop_back();
		}
	}

	for(auto itr=lst.begin(); itr!=--(lst.end()); ++itr) {
		cout << *itr << " ";
	}
	cout << lst.back() << endl;
	return 0;
}

Measured memory_bytes: 34424
#include <iostream>
using namespace std;
#define Nmax 10000

void BubbleSort(int a[], int n)
{
	for (int i = 0; i < n; i++) {
		for (int j = n - 1; j > i; j--) {
			if (a[j] < a[j - 1]) {
				int temp = a[j];
				a[j] = a[j - 1];
				a[j - 1] = temp;
			}
		}
	}
}

long sum(int a[], int n) {
	long temp = 0;
	for (int i = 0; i < n; i++) {
		temp += a[i];
	}
	return temp;
}

int main()
{
	int n = 0;
	int a[Nmax] = { 0 };

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

	BubbleSort(a, n);

	cout << a[0] << " " << a[n - 1] << " " << sum(a, n) << endl;

	return 0;
}


Measured memory_bytes: 3132
import java.util.Scanner;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] d = new int[n];
    int ans = 1;
    for (int cnt = 0; cnt < n; cnt++) {
      d[cnt] = sc.nextInt();
    }

    Arrays.sort(d);
    for (int cnt = 1; cnt < n; cnt++) {
      if (d[cnt] != d[cnt - 1]) {
        ans++;
      }
    }
    System.out.println(ans);
    sc.close();
  }
}

Measured memory_bytes: 35932
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
  string s;
  cin >> s;
  if (s[1] == s[2] && s[2] == s[3]) cout << "Yes";
  else if (s[0] == s[1] && s[1] == s[2]) cout << "Yes";
  else cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  int i, n, a[100];

  scanf("%d",&n);

  for(i = 0; i < n; i++) 
    scanf("%d", &a[i]);
  for(i = 1; i <= n; i++){
    printf("%d", a[n-i]);
    if(i == n)
      printf("\n");
    else
      printf(" ");
  }
  return 0;
}


Measured memory_bytes: 2112
#include <stdio.h>

int main(void)
{

	int A = 0, B = 0, point, i, j;

	for(i = 0; i < 2; i++) {
		for(j = 0; j < 4; j++) {
			scanf("%d", &point);
			if(i == 0) {
				A += point;
			}
			else {
				B += point;
			}
		}
	}

	if(A > B) {
		printf("%d\n", A);
	}
	else {
		printf("%d\n", B);
	}

	return 0;

}

Measured memory_bytes: 592
#include "bits/stdc++.h"
using namespace std;

int main() {
 
	int n, k;
	cin >> n >> k;
	
	bool blocked[n+1];
	memset(blocked, 0, sizeof blocked);
	
	for (int i=0; i<k; i++) {
		int a;
		cin >> a;
		blocked[a] = true;
	}
	
	int ways[n+1];
	ways[0] = !blocked[0];
	if (blocked[1]) ways[1] = 0;
	else ways[1] = ways[0];
	for (int i=2; i<=n; i++) {
		if (blocked[i]) ways[i] = 0;
		else ways[i] = ways[i-1] + ways[i-2];
		ways[i] = ways[i] % 1000000007;
	}
	
	cout << ways[n] << endl;
	
}


Measured memory_bytes: 768
s=input()
s1=[]
s2=[]
a=0
b=0
for i in range(len(s)):
    if i%2==0:
        s1.append("0")
    else:
        s1.append("1")
for i in range(len(s)):
    if i%2==0:
        s2.append("1")
    else:
        s2.append("0")
for i in range(len(s)):
    if s[i]==s1[i]:
        a+=1
    if s[i]==s2[i]:
        b+=1
print(min(a,b))

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

bool kansu(int x,int y){
    if(y%2==0){
        if(2*x<=y && y<=4*x) return true;
    }
    return false;
}

int main(void){
    int x,y;
    cin>>x>>y;
    if(kansu(x,y)) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}



Measured memory_bytes: 3544
n, k = map(int, input().split())
ns = [i for i in range(1,n+1)]
d = []
a = []

for k in range(2*k):
    if k % 2 == 0:
        d.append(int(input()))
    else:
        a.append(list(map(int, input().split())))

a = set(sum(a,[]))
ans = set(ns) - a
print(len(ans))

Measured memory_bytes: 9208
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

s = input()
if s[2] == s[3] and s[4] == s[5]:
    print("Yes")
else:
    print("No")




Measured memory_bytes: 5716
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;

int main(){
    DRI(N);
    LL x=1,y=1;
    REP(i,N){
        LL a,b;
        cin>>a>>b;
        LL mul=(x+a-1)/a;
        mul=max(mul,(y+b-1)/b);
        x=a*mul;
        y=b*mul;
    }
    cout<<x+y<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
#define Endl endl
const int INF=100000000;

int main(){
	int n;
	unordered_set<int> s;
	cin>>n;
	REP(i,n){
		int a;
		cin>>a;
		if(s.find(a)!=s.end()){
			s.erase(a);
		}
		else{
			s.insert(a);
		}
	}
	cout<<s.size()<<endl;
	return 0;
}

Measured memory_bytes: 4388
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <queue>
#include <stack> 
#include <sstream>
#include <set>

typedef  long long ll;
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = { 0, 1, 0,-1};
const int INF = 1e9;
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
int guki (int a){
    if(a%2==0) return 0;
    else return 1;
}
int gcd(int a, int b){
    if(a%b==0){
        return b;
    }else{
        return (gcd(b,a%b));
    }
}
int lcm(int a, int b){
    int x = gcd(a,b);
    return (a*b/x);
}
ll nCr (ll n, ll r){
    ll ans = 1;
    for(ll i = n ; i > n-r ; i --){
        ans *= i;
    }
    for(ll i = 1 ; i<= r; i ++){
        ans /= i;
    }
    return ans ;
}

int nPr (int n,int r){
    int ans = 1;
    for(int i = n ; i > n-r ; i --){
        ans *= i;
    }
    return ans ;
}




using namespace std;
int main(){
    ll n,W;
    cin >> n >>W;
    vector<vector<ll>> dp(n+1,vector<ll>(W+1));
    
    ll w[110],v[110];

    for(int i=1;i<=n;i++){
        cin >> w[i] >> v[i];
    }

    for(int i = 1;i<=n;i++){
        for(int j = 0;j <=W;j++){
            dp[i][j] = dp[i-1][j];
            if(j-w[i] >= 0){
                dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]] + v[i]);
            }
        }
    }

    cout << dp[n][W] <<endl;

}





Measured memory_bytes: 83152
# C - /\/\/\/

from collections import defaultdict
import sys
readline = sys.stdin.readline

n = int(readline())
v = list(int(x) for x in readline().split())

d0 = defaultdict(int)
d1 = defaultdict(int)
d0[0] = 0
d1[0] = 0
for i in range(n):
    if i%2:
        d1[v[i]] += 1
    else:
        d0[v[i]] += 1

d0 = list(d0.items())
d1 = list(d1.items())
d0.sort(key=lambda x: x[1], reverse=True)
d1.sort(key=lambda x: x[1], reverse=True)

if d0[0][0] != d1[0][0]:
    ans = n - d0[0][1] - d1[0][1]
else:
    ans = n - max(d0[0][1] + d1[1][1], d0[1][1] + d1[0][1])
print(ans)

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

typedef long long ll;

int ret(int X)
{
    switch (X)
    {
    case 1:
        return 300000;
    case 2:
        return 200000;
    case 3:
        return 100000;

    default:
        return 0;
    }
}

int main()
{
    int X, Y;
    cin >> X >> Y;
    if (X == 1 && Y == 1)
    {
        cout << ret(X) + ret(Y) + 400000 << endl;
    }
    else
    {
        cout << ret(X) + ret(Y) << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define m long long
#define r(s,i,n) for(m i=s;i<n;i++)
m w[555][555],p[1234];
int main(){m n;cin>>n;m t=0;r(2,i,9999){
		bool a=true;r(2,j,i){if(i%j==0)a=false;}if(a)p[t]=i,t++;}r(0,i,555)r(0,j,555)if(i%2==j%2)w[i][j]=p[(i+j)/2]*p[(i+1662-j)/2];r(0,i,555)r(0,j,555)if(w[i][j]==0&&i>0&&i<554)w[i][j]=w[i-1][j]*w[i+1][j]+1;r(0,i,n)r(0,j,n)cout<<w[i+1][j+1]<<" ";}

Measured memory_bytes: 6096