akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
const int inf=1e9+7;
const ll INF=1LL<<61;
const ll mod=1e9+7;

template<class T>
inline bool chmax(T &a, T b) {
  if(a < b) {
    a = b;
    return true;
  }
  return false;
}

template<class T>
inline bool chmin(T &a, T b) {
  if(a > b) {
    a = b;
    return true;
  }
  return false;
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int i,j;
  int n,k,c;
  cin>>n>>k>>c;
  string s;
  cin>>s;
  if(c==0){
    int z=0;
    for(i=0;i<n;i++){
      if(s[i]=='o') z++;
    }
    if(z==k){
      for(i=0;i<n;i++){
        if(s[i]=='o') cout<<i+1<<endl;
      }
    }
    return 0;
  }
  VI dp1(n);
  VI dp2(n);
  for(i=0;i<n;i++){
    if(s[i]=='x') {
      if(i==0) dp1[i]=0;
      else dp1[i]=dp1[i-1];
    }
    else {
      if(i-c-1<0) dp1[i]=1;
      else dp1[i]=1+dp1[i-c-1];
    }
  }
  for(i=n-1;i>=0;i--){
    if(s[i]=='x') {
      if(i==n-1) dp2[i]=0;
      else dp2[i]=dp2[i+1];
    }
    else {
      if(i+c+1>=n) dp2[i]=1;
      else dp2[i]=1+dp2[i+c+1];
    }
  }
  VI w(2*n+3,0);
  //VI w2(2*n+3,0);
  for(i=-c-1;i<n;i++){
    j=i+c+1;
    int cnt;
    if(i<0) cnt=0;
    else cnt=dp1[i];
    if(j<n) cnt+=dp2[j];
    if(cnt>=k){
      //cout<<i<<" "<<j<<endl;
      w[max(0,i+1)]++;
      w[j]--;
    }
  }
  int tmp=0;
  for(i=0;i<n;i++){
    tmp+=w[i];
    if(tmp==0&&s[i]=='o') cout<<i+1<<endl;
    //tmp+=w2[i];
  }
  return 0;
}


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

using namespace std;
typedef uint32_t u32;

u32 gcd(u32 x, u32 y)
{
    if (x < y) return gcd(y, x);
    u32 mod;
    while (mod = (x % y)) {
        x = y;
        y = mod;
    }
    return y;
}


int main()
{
    u32 n;
    cin >> n;
    vector<u32> vec(n);
    for (u32 i = 0; i < n; i++) {
        u32 t;
        cin >> t;
        vec[i] = t;
    }
    vector<u32> chunks((n >> 10) + 1);
    for (u32 i = 0; i <= (n >> 10); i++) {
        u32 m = i << 10;
        u32 k = m + 1024 < n ? m + 1024 : n;
        u32 val = vec[m];
        for (u32 j = m + 1; j < k; j++) {
            val = gcd(val, vec[j]);
        }
        chunks[i] = val;
    }
    // i番目以外のGCD 
    if (n == 2) {
        if (vec[0] > vec[1]) {
            cout << vec[0] << endl;
        } else {
            cout << vec[1] << endl;
        }
        return 0;
    }
    u32 gcdmax = 1;
    for (u32 i = 0; i < n; i++) {
        u32 cnkid = i >> 10;
        u32 val = i ? vec[0] : vec[1];
        u32 stop = (cnkid << 10) + 1024 < n ? (cnkid << 10) + 1024 : n;
        for (u32 j = 0; j < chunks.size(); j++) {
            if (j == cnkid) continue;
            val = gcd(val, chunks[j]);
            if (val <= gcdmax) goto SKIP;
        }
        for (u32 j = cnkid << 10; j < stop; j++) {
            if (j == i) continue;
            val = gcd(val, vec[j]);
            if (val <= gcdmax) goto SKIP;
        }
        gcdmax = val;
SKIP:
        1;
    }
    cout << gcdmax << endl;
}


Measured memory_bytes: 640
import math

def func(b, n):
  if n < b:
    return n
  else:
    return func(b, math.floor(n / b)) + math.fmod(n, b)

def solver(n, s):
  if n == s:
    print n+1
    return
  elif n < s:
    print "-1"
    return

  lim = int(math.sqrt(n))
  for i in range(2, lim+1):
    if func(i, n) == s:
      print i
      return

  for i in range(lim):
    p = lim - i
    b = (n-s)/p+1
    cut = int(b)
    if b - cut == 0 and b > lim:
      if func(b, n) == s:
        print b
        return

  print "-1"
  return

n = int(raw_input())
s = int(raw_input())
solver(n, s)

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

const int N=10000005;
long long d[N];
int main()
{
    for(int i=1;i<=N;i++){
        for(int j=i;j<N;j+=i){
            d[j]++;
        }
    }
    for(int i=1;i<N;i++) d[i]*=i;
    for(int i=1;i<N;i++) d[i]+=d[i-1];
    int n;
    scanf("%d",&n);
    printf("%lld",d[n]); 
    return 0;
}

Measured memory_bytes: 81884
fun main(args: Array<String>) {
    val h = readLine()!!.toLong()
    var h1 = h
    var cnt = 0
    while (h1 > 1) {
        cnt++
        h1 /= 2
    }
    println((0..cnt).fold(0L) { acc, i -> acc + Math.pow(2.0, i.toDouble()).toLong() })
}


Measured memory_bytes: 31736
#include<stdio.h>

int main()

{
    int x,y;
    char operator;


    while(scanf("%d %c %d", &x, &operator, &y)!=EOF)
    {
        if(operator=='?')
        {
            break;
        }

        switch(operator)
       {
        case'+':
        printf("%d\n", x+y);
        break;

        case'-':
        printf("%d\n", x-y);
        break;

        case'*':
        printf("%d\n", x*y);
        break;

        case'/':
        printf("%d\n", x/y);
        break;

    }
}

    return 0;



}



Measured memory_bytes: 2024
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl((ld)1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"

bool solve(){  
  ll n,m;cin>>n>>m;
  cout<<n*(n-1)/2+m*(m-1)/2<<endl;
  return false;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
	cout<<setprecision(30);
	return solve();
}


Measured memory_bytes: 764
#include<iostream>
#include<string>
#include<stack>
using namespace std;
typedef long long int llint;

int main(){
	string S;
	cin >> S;
	stack<llint> num;
	for(int i=0;i<S.length();i++){
		if(S[i]=='B'){
			num.push(S.length()-1-i);
		}
	}
	llint sum=0;
	for(int i=0;!num.empty();i++,num.pop()){
		llint n=num.top();
		sum+=n-i;
	}
	cout << sum << endl;
	return 0;
}


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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

ll P = 998244353;
ll pw(ll a, ll b) {
  if (b == 0)
    return 1;
  if (b == 1)
    return a;
  if (b % 2 == 0)
    return pw((a * a) % P, b / 2);
  return (pw(a, b - 1) * a) % P;
}
ll dp[301][90001] = {0};
ll dp2[301][90001] = {0};
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  vll a(n), s(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    s[i + 1] = s[i] + a[i];
  }
  dp[0][0] = 1;
  // dp[i][j] := iまでで B+Gがjであるような色の塗り方
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 90000; j++) {
      dp[i + 1][j] += dp[i][j];
      dp[i + 1][j] %= P;
      if (j + a[i] <= 90000) {
        dp[i + 1][j + a[i]] += dp[i][j] * 2;
        dp[i + 1][j + a[i]] %= P;
      }
    }
  }
  dp2[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 90000; j++) {
      dp2[i + 1][j] += dp2[i][j];
      dp2[i + 1][j] %= P;
      if (j + a[i] <= 90000) {
        dp2[i + 1][j + a[i]] += dp2[i][j];
        dp2[i + 1][j + a[i]] %= P;
      }
    }
  }

  ll no = 0;
  for (ll i = 0; i <= s[n]; i++) {
    ll R = s[n] - i;
    if (R >= (s[n] + 1) / 2) {
      no += dp[n][i];
      no %= P;
    }
  }
  ll same = 0;
  if (s[n] % 2 == 0)
    same = dp2[n][s[n] / 2];
  ll ans = pw(3, n);
  ans += P * 3 - no * 3;
  ans %= P;
  ans += same * 3;
  ans %= P;

  cout << ans << endl;

  return 0;
}


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit32(x) (1 << (x))
#define bit64(x) (1ll << (x))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T exp(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> inline T bis(T ok, T ng, function<bool(T)> f, T eps = 1) { while (abs(ok - ng) > eps) { T mi = (ok + ng) / 2; (f(mi) ? ok : ng) = mi; } return ok; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }

void solve() {
  int n;
  cin >> n;
  unordered_map<int, int> mp;
  rep(i, n) {
    int a;
    cin >> a;
    mp[a]++;
  }
  vi32 arr;
  each(m, mp) arr.emplace_back(m.second);
  sort(all(arr));
  reverse(all(arr));
  int m = arr.size();
  vi64 sums(m + 1);
  rep(i, m) sums[i + 1] += sums[i] + arr[i];
  int ans = n;
  reps(k, n) {
    while (ans) {
      int x = bis<int>(m, -1, [&](int i) { return ans > arr[i]; });
      i64 men = (i64) k * ans;
      men -= (i64) x * ans;
      i64 sum = sums[m] - sums[x];
      if (men <= sum) break;
      ans--;
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 19444
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

int main(void) {
    ll A, B, C, K;
    cin >> A >> B >> C >> K;

    if (K <= A) {
        cout << K << endl;
    } else if (K <= A + B) {
        cout << A << endl;
    } else {
        cout << A - (K - (A + B)) << endl;;
    }

    return 0;
}


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

int N,K,k[100],i,t,p,dp[105][3][3][3],M=10000;

int dfs(int d,int s1,int s2,int s3)
{
	int i,r=0;
	if(s1>=0&&s2>=0&&s3>=0&&dp[d][s1][s2][s3]!=-1)return dp[d][s1][s2][s3];
	if(s1==s2&&s2==s3)
		return 0;
	if(d==N)
		return 1;
	if(k[d]!=-1)
		r=dfs(d+1,s2,s3,k[d]);
	else
		for(i=0;i<3;i++)
			r=(r+dfs(d+1,s2,s3,i))%M;
	if(s1>=0&&s2>=0&&s3>=0)dp[d][s1][s2][s3]=r;
	return r;
}

int main()
{
	memset(k,-1,sizeof(k));
	memset(dp,-1,sizeof(dp));
	scanf("%d%d",&N,&K);
	for(i=0;i<K;i++)
	{
		scanf("%d%d",&t,&p);
		k[t-1]=p-1;
	}
	printf("%d\n",dfs(0,-1,-2,-3));
	return 0;
}

Measured memory_bytes: 620
//Atcoder
import java.io.*;
import java.util.*;

public class Main {

	static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner() {
            try {
                br = new BufferedReader(new InputStreamReader(System.in));
                st = new StringTokenizer(br.readLine());
            } catch (Exception e){e.printStackTrace();}
        }

        public String next() {
            if (st.hasMoreTokens()) return st.nextToken();
            try {st = new StringTokenizer(br.readLine());}
            catch (Exception e) {e.printStackTrace();}
            return st.nextToken();
        }

        public int nextInt() {return Integer.parseInt(next());}

        public long nextLong() {return Long.parseLong(next());}

        public double nextDouble() {return Double.parseDouble(next());}

        public String nextLine() {
            String line = "";
            if(st.hasMoreTokens()) line = st.nextToken();
            else try {return br.readLine();}catch(IOException e){e.printStackTrace();}
            while(st.hasMoreTokens()) line += " "+st.nextToken();
            return line;
        }
    }

	public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);

        int a = sc.nextInt(), b = sc.nextInt(), k = sc.nextInt();
        int small = Math.min(a, b);
        int cnt = 0;

        for(int i=small;i>=1;i--) {
            if(a % i == 0 && b % i == 0) {
                cnt++;
            }
            if(cnt == k) {
                pw.println(i);
                break;
            }
        }

        pw.close();
    }
}


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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (a == 0) return 0; else if (b % 2 == 0) return (pow((a * a) % m, b / 2, m) % m); else return (pow((a * a) % m, b / 2, m) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

   ll dx[4]={1,0,-1,0};
   ll dy[4]={0,1,0,-1};

int main(){
  string S; cin >> S;
  ll n = S.size();
  ll temp1 = 0, temp2 = 0;
  REP(i, n){
    if(i % 2 == 0){
      temp1 += (S[i] == '1');
      temp2 += (S[i] == '0');
    }
    else{
      temp1 += (S[i] == '0');
      temp2 += (S[i] == '1');
    }
  }
  cout << min(temp1, temp2) << endl;
}


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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };




void solve() {
    int N, K; cin >> N >> K;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];
    modint res1 = 0, res2=0;
    sort(all(a));
    rep(i, N){
        // int n1 = upper_bound(all(a), a[i]) - a.begin();
        // int n2 = lower_bound(all(a), a[i]) - a.begin();
        if(i+1 >= K){
            res1 += modint(a[i])*comb(i, K-1);
        }
        if(N-i >= K){
            res2 += modint(a[i])*comb(N-i-1, K-1);
        }
    }
    modint res = res1 - res2;
    cout << res.n << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 8152
n = int(input())

ans = 0
for a in range(1, n + 1):
    q = n // a
    r = n % a

    # a <= b
    # b: a, a+1, ..., q
    # c: ...  ,r + a, r
    if q < a:
        continue
    
    else:
        # a < b, a == b
        ans += ((q - a) * 2 + 1)
        if r == 0:
            if a == q:
                ans -= 1
            else:
                ans -= 2
        # print(a, ans)

print(ans)


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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

int dp[80001][11];

int main()
{
    string s;
    while(cin >>s,(s!="0"))
    {
        memset(dp,0,sizeof(dp));

        int S=s.size();

        if(s[0]!='0') dp[0][s[0]-'0']=1;
        for(int i=1; i<S; ++i)
        {
            int d=s[i]-'0';
            if(d!=0) ++dp[i][d];

            rep(j,11)
            {
                int v=(j*10+d)%11;
                dp[i][v]+=dp[i-1][j];
            }
        }

        int ans=0;
        rep(i,S) ans+=dp[i][0];
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 6720
//84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i,  r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define X real()
#define Y imag()
#define maxN 105
#define oo 2000000007
#define EPS 1e-9
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

ll n, a, b;

int main () {
    cin >> n >> a >> b;
    cout << max(0LL, (a+b*(n-1))-(b+a*(n-1))+1);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;
typedef long long LL;
const int N = 500010,mod = 1e9 + 7;
int fact[N],infact[N];
int n,m;

int qmi(int a,int k)
{
    int res = 1;
    while(k)
    {
        if(k&1) res = (LL)res * a % mod;
        a = (LL)a * a % mod;
        k>>=1;
    }
    return res;
}

int main()
{
    scanf("%d%d",&n,&m);
    fact[0] = infact[0] = 1;
    for(int i=1;i<=m;i++)
    {
        fact[i] = (LL)fact[i-1] * i % mod;
        infact[i] = qmi(fact[i],mod-2);
    }
    
    LL res = 0;
    for(int i=0;i<=n;i++)
    {
        res = (res + (i&1?-1ll:1ll) * fact[n] * infact[i] % mod * infact[n-i]
    % mod * fact[m-i] % mod * infact[m-n] % mod) % mod;
    }
    res = (res + mod) % mod;
    cout << (res * fact[m] % mod * infact[m-n] % mod) << endl;
    return 0;
}

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

using namespace std;

int main(){
 	int X;
	cin >> X;
	int ans = 0;
	if(X < 600) ans = 8;
	else if(X < 800) ans = 7;
	else if(X < 1000) ans = 6;
	else if(X < 1200) ans = 5;
	else if(X < 1400) ans = 4;
	else if(X < 1600) ans = 3;
	else if(X < 1800) ans = 2;
	else if(X < 2000) ans = 1;
	
	cout << ans << endl;
}

Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main()
{
  int a;
  int b;
  int c;
  cin>>a>>b>>c;
  if(a==b){
    cout<<c;
  }
  if(a==c){
    cout<<b;
  }
  if(b==c){
    cout<<a;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
typedef long long ll;

#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define AA(i) cout<<i<<endl;
#define AS(i) cout<<i<<" ";
 
const int INF = 1001001001;
 
using namespace std;
 

int n, m;
vector<int> s(5);
vector<int> c(5);


bool is(string ss) {

    if (ss.size() != n) return false;
    rep(i, m) {
       // AA( typeid( (char)(c[i] + '0')).name() );
       char x = ss[s[i]];
       char y = (char)(c[i] + '0');
       //AA(ss[s[i]] << "  " << c[i] + '0');
       //cout << x << "  " << y << " : ";
        if (x != y) return false;
    }

}
/*
bool is(string str) {
    //AA(str);
    if (str.size() != n) return false;
    for (int i = 0; i < m; ++i) {
        if (str[s[i]] != (char)(c[i] + '0')) {
        //AA(str[s[i]] << " " << (char)(c[i] + '0'));
            return false;
        }
    }

    return true;
}*/
 
int main() {


    cin >> n >> m;

    rep(i, m) {
        cin >> s[i] >> c[i];
        --s[i];
    }


    rep(i, 1000) {
        stringstream iss; iss << i;
        string str = iss.str();


        if (is(str)) {
            AA(str);
            return 0;
        }
        //cout << endl;
    }

    AA(-1);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

const int mod = 1000000007;
struct mint {
    ll x; // using long long ll;
    mint(ll 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(ll 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, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n;
    cin>>n;
    vl cs(n);
    cin>>cs;

    vector<mint> dp(n + 1);
    dp[0] = 1;
    vector<mint> ss(1e6);
    rep(i, n) {
        if (cs[i] == cs[i + 1]) {
            dp[i + 1] = dp[i];
            continue;
        }

        dp[i + 1] = ss[cs[i]];
        dp[i + 1] += dp[i];
        ss[cs[i]] = dp[i + 1];
    }
    cout<<dp[n]<<endl;
}

Measured memory_bytes: 11264
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

//いやーコンテスト中は絶対無理
int hist[300002], cnt[300001];
const int cm = 1 << 17;
char cn[cm], * ci = cn + cm, ct;
inline char getcha() {
	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }
	return *ci++;
}
inline int getint() {
	int A = 0;
	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';
	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}
const int dm = 1 << 21;
char dn[dm], * di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

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


	int N = getint();
	rep(i, N) hist[getint()]++;
	rep1(i, N) cnt[hist[i]]++;
	int k = 1;
	rep(i, N + 1) rep(j, cnt[i]) hist[k++] = i;

	k = N + 1;
	int ruiseki = N;
	int mae = 0;
	for (int i = N; i >= 1; i--) {
		while (hist[k - 1] >= i) {
			ruiseki -= hist[--k];
		}
		int kei = N - k + 1 + ruiseki / i;

		for (int j = mae + 1; j <= kei; j++) putint(i);
		mae = kei;
	}
	for (int j = mae + 1; j <= N; j++) {
		*di++ = '0';
		*di++ = '\n';
	}
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 3840
#![allow(unused_imports)]

use proconio::input;

fn main() {
    input! {
        a: isize,
        b: isize,
        c: isize,
        d: isize,
    }

    solve(a, b, c, d);
}

fn solve(a: isize, b: isize, c: isize, d: isize) {
    let e = a * c;
    let f = a * d;
    let g = b * c;
    let h = b * d;
    let mut ans = e;

    if f > ans {
        ans = f;
    }
    if g > ans {
        ans = g;
    }
    if h > ans {
        ans = h;
    }

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


Measured memory_bytes: 2164
#include<stdio.h>
int main(){
	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);
	if(x-r>=0 && x+r<=W && y-r>=0 && y+r<=H){
		printf("Yes\n");
	}
	if(x-r<0||x+r>W||y-r<0||y+r>H){
		printf("No\n");
	}
	return 0;
}
	
		

Measured memory_bytes: 584
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;


int main()
{
    fast
    string s,t;
    cin >> s >> t;
    int n = s.length();
    int m = t.length();
    vector<vector<int>> dp(n+1, vector<int>(m+1));
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            if(s[i-1]==t[j-1]) dp[i][j] = 1 + dp[i-1][j-1];
            else
            {
                dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            }
            
        }
    }
    int i=n;
    int j=m;
    string res = "";
    int len = dp[n][m];
    res.resize(len);
    while(i>=1 && j>=1){
        if(s[i-1]==t[j-1]){
            res[len-1] = s[i-1];
            i--;
            j--;
            len = len-1;
        }
        else{
            if(dp[i-1][j] > dp[i][j-1]){
                i--;
            }
            else
            {
                j--;
            }
            
        }
    }
    cout << res <<'\n';
    return 0;
}

Measured memory_bytes: 38512
// C++ program to find the longest repeated 
// non-overlapping substring 
#include<bits/stdc++.h> 
using namespace std; 

// Returns the longest repeating non-overlapping 
// substring in str 
string longestRepeatedSubstring(string str) 
{ 
	int n = str.length(); 
	int LCSRe[n+1][n+1]; 

	// Setting all to 0 
	memset(LCSRe, 0, sizeof(LCSRe)); 

	string res; // To store result 
	int res_length = 0; // To store length of result 

	// building table in bottom-up manner 
	int i, index = 0; 
	for (i=1; i<=n; i++) 
	{ 
		for (int j=i+1; j<=n; j++) 
		{ 
			// (j-i) > LCSRe[i-1][j-1] to remove 
			// overlapping 
			if (str[i-1] == str[j-1] && 
				LCSRe[i-1][j-1] < (j - i)) 
			{ 
				LCSRe[i][j] = LCSRe[i-1][j-1] + 1; 

				// updating maximum length of the 
				// substring and updating the finishing 
				// index of the suffix 
				if (LCSRe[i][j] > res_length) 
				{ 
					res_length = LCSRe[i][j]; 
					index = max(i, index); 
				} 
			} 
			else
				LCSRe[i][j] = 0; 
		} 
	} 

	// If we have non-empty result, then insert all 
	// characters from first character to last 
	// character of string 
	if (res_length > 0) 
		for (i = index - res_length + 1; i <= index; i++) 
			res.push_back(str[i-1]); 

	return res; 
} 

// Driver program to test the above function 
int main() 
{ 	int n; cin>>n;
	string str;
  	cin>>str;
	cout << longestRepeatedSubstring(str).length(); 
	return 0; 
} 


Measured memory_bytes: 97920
//状态:AC
//题号:atcoder-abc052 C
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <algorithm>
#include <ctime>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <iomanip>
#include <cassert>
#include <complex>
#include <functional>
#include <list>
#include <cmath>
using namespace std;
typedef long long ll;
int n;
int p[1005];
ll ans=1;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		int t=i;
		for(int j=2;j<=i;j++){
			while(t%j==0){
				t/=j;
				p[j]++;
			}
		}
	}
	for(int i=1;i<=1000;i++)ans=(ans*(p[i]+1))%1000000007;
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
function Main(input) {
    var parseInputs = parseInput(input);
    var result = isEqualityCheck(parseInputs);
    isBeautifulCheck(result);
}
var parseInput = function (input) {
    return input.split(" ");
};
var isEqualityCheck = function (parseInputs) {
    return (parseInputs[1] - parseInputs[0] === parseInputs[2] - parseInputs[1]);
};
var isBeautifulCheck = function (result) {
    console.log(result ? "YES" : "NO");
};

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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

int main() {
    int n;
    cin >> n;
    int t, a;
    cin >> t >> a;
    vector<int> h(n);
    for (int i=0; i<n; i++) cin >> h[i];

    double diff = 100000.0; // between a and h[i]*0.006
    int ans = 0;
    for (int i=0; i<n; i++) {
        double ave = (double)t - (double)h[i]*0.006;
        double t = abs((double)a - ave);
        if (diff > t) {
            diff = t;
            ans = i;
        }
    }

    cout << ans + 1 << endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

class TaskB {
public:
    void solve() {
        ll a, b, n;
        cin >> a >> n;
        for (int i = 0; i < n; i++) {
          cin >> b;
          a -= b;
        }
        cout << (a <= 0 ? "Yes" : "No");
    }
};

int main() {
    TaskB solver;
    solver.solve();
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    while(1){
        int i,n,p;
        cin>>n>>p;
        if(n==0) break;
        vector<int> player(n,0);
        int wan=p;
        i=0;
        while(1){
            if(wan!=0){
                wan--;
                player[i]++;
                if(player[i]==p){
                    cout<<i<<endl;
                    break;
                }
            }else{
                wan=player[i];
                player[i]=0;
            }
            i=(i+1)%n;
        }
    }
}


Measured memory_bytes: 3052
#include<stdio.h>
#include<algorithm>
#include<bitset>
const int N=20001;
struct S{int t,s,d;}a[N];
int C(S l,S r){return l.t<r.t;}
int main()
{
	int n,m,i;
	std::bitset<N>b;
	while(scanf("%d%d",&n,&m),n)
	{
		for(i=1;i<=m;++i)scanf("%d%d%d",&a[i].t,&a[i].s,&a[i].d);
		std::sort(a+1,a+1+m,C);
		b.reset();
		n=b[1]=1;
		for(i=1;i<=m;++i)if(b[a[i].s]&&!b[a[i].d])b[a[i].d]=1,++n;
		printf("%d\n",n);
	}
	return 0;
}

Measured memory_bytes: 1008
#include<stdio.h>

int main(){
  int A[100],i,j,k,temp,num,cnt=0;
  scanf("%d",&k);
  for(i=0;i<k;i++){
    scanf("%d",&A[i]);
  }
  for (i = 0;i < k ;i++) {
    temp=i;
    for (j = i+1;j < k ;j++) {
      if (A[j] < A[temp]) 
	temp = j;
	  }
      num=A[i];
	A[i] = A[temp];
	A[temp] = num;
	if(i!=temp)
	cnt++;
      }
    
    
    for(i=0;i<k;i++){
      if(i)printf(" ");
      printf("%d",A[i]);
    }
    printf("\n");
  printf("%d\n",cnt);
  return 0;
  }
  



Measured memory_bytes: 2096
K = int(input())
d = [1,2,3,4,5,6,7,8,9]

if K <= 9:
  print(K)
  exit()

cnt = 9
while cnt < K:
  _ = d.pop(0)
  matsubi = _%10
  
  if matsubi == 0:
    d.append(_*10+matsubi)
    cnt += 1
    if cnt == K:
      print(d[-1])
      exit()
    d.append(_*10+matsubi+1)
    cnt += 1
    if cnt == K:
      print(d[-1])
      exit()
    
  elif matsubi == 9:
    d.append(_*10+matsubi-1)
    cnt += 1
    if cnt == K:
      print(d[-1])
      exit()

    d.append(_*10+matsubi)
    cnt += 1
    if cnt == K:
      print(d[-1])
      exit()
  else:
    d.append(_*10+matsubi-1)
    cnt += 1
    if cnt == K:
      print(d[-1])
      exit()

    d.append(_*10+matsubi)
    cnt += 1
    if cnt == K:
      print(d[-1])
      exit()

    d.append(_*10+matsubi+1)
    cnt += 1
    if cnt == K:
      print(d[-1])
      exit()

Measured memory_bytes: 42992
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second

using namespace std;

typedef long long ll;

queue <pair <int, int> > qu;
int dist[1005][1005];

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n, m;
    cin >> n >> m;
    for (int i = 1; i <= n; i++)
        for (int j = 1; j <= m; j++)
        {
            dist[i][j] = n + m;
            char c;
            cin >> c;
            if (c == '#')
            {
                dist[i][j] = 0;
                qu.push(mp(i, j));
            }
        }
    int ans = 0;
    while (!qu.empty())
    {
        pair <int, int> A = qu.front();
        qu.pop();
        ans = max(ans, dist[A.x][A.y]);
        if (A.x > 1 && dist[A.x - 1][A.y] > dist[A.x][A.y] + 1)
        {
            dist[A.x - 1][A.y] = dist[A.x][A.y] + 1;
            qu.push(mp(A.x - 1, A.y));
        }
        if (A.y > 1 && dist[A.x][A.y - 1] > dist[A.x][A.y] + 1)
        {
            dist[A.x][A.y - 1] = dist[A.x][A.y] + 1;
            qu.push(mp(A.x, A.y - 1));
        }
        if (A.x < n && dist[A.x + 1][A.y] > dist[A.x][A.y] + 1)
        {
            dist[A.x + 1][A.y] = dist[A.x][A.y] + 1;
            qu.push(mp(A.x + 1, A.y));
        }
        if (A.y < m && dist[A.x][A.y + 1] > dist[A.x][A.y] + 1)
        {
            dist[A.x][A.y + 1] = dist[A.x][A.y] + 1;
            qu.push(mp(A.x, A.y + 1));
        }
    }
    cout << ans;
    return 0;
}



Measured memory_bytes: 12432
#include <iostream>
#include <cstdio>
using namespace std;
int main() {
    int n,m,k;
    cin>>n>>m>>k;
    int i;
    for(i=1;i<=n;i++)
        if(k-m*i==0||(n-2*i!=0&&(k-m*i)%(n-2*i)==0&&(k-m*i)/(n-2*i)>0&&(k-m*i)/(n-2*i)<=m))
            break;
    if(i>n)
        printf("No\n");
    else
        printf("Yes\n");
}


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

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REP1(i, n) for(ll i = 1;i < n;i++)
#define REPR(i, n) for(ll i = n-1;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)

#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())

#define ll long long
#define ALL(a)  (a).begin(),(a).end()

#define pb(a) push_back(a)

int m,k;

int main(){
  cin>>m>>k;
  int mm=1<<m;
  if (m==1){
    if (k==0){
      cout<<"0 0 1 1"<<endl;
      return 0;
    }
    cout<<"-1"<<endl;return 0;
  }else{
    if (k>=mm){
      cout<<"-1"<<endl;return 0;
    }else{
      REP(i,mm){
        if (i!=k)cout<<i<<" ";
      }
      cout<<k<<" ";
      int j;
      REP(i,mm){
        j=mm-1-i;
        if (j!=k)cout<<j<<" ";
      }
      cout<<k<<endl;
    }
  }


  return 0;
}

Measured memory_bytes: 1792
/**
*    author:  yuya1234
*    created: 25.06.2020 15:29:56
**/

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)

#define SORT(s) sort((s).begin(), (s).end())
#define SORTD(s) sort((s).rbegin(), (s).rend())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());

#define SZ(x) ((int)(x).size())
#define MEMSET(v, h) memset((v), h, sizeof(v))

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

    int n, k;
    cin >> n >> k;

    int tmp;
    map<int, int> m;
    vector<int> v;

    REP(i, n)
    {
        cin >> tmp;
        if (m.count(tmp) == 0)
            m.insert(make_pair(tmp, 1));
        else
            m[tmp]++;
    }

    for (auto it = m.begin(); it != m.end(); ++it)
    {
        v.push_back(it->second);
    }
    SORT(v);

    int ans = 0, minA, aa;
    int i = 0;

    while (k < SZ(m))
    {
        
        for (auto it = m.begin(); it != m.end(); ++it)
        {
            if (it->second == v[i])
            {
                ans+=it->second;
                m.erase(it->first);
                break;
            }
        }
        i++;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 13492
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cctype>
#include <cmath>

using namespace std;

int main(int argc, const char * argv[]) {
    
    // input from txt
    //std::ifstream in("test.txt");
    //std::cin.rdbuf(in.rdbuf());
    
    char c;
    cin >> c;
    if(isupper(c)){
        cout << "A" << endl;
    }else{
        cout << "a" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3616
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

/*
1 partition(A, p, r)
2   x = A[r]
3   i = p-1
4   for j = p to r-1
4     if A[j] <= x
5       i = i+1
6       A[i] と A[j] を交換
7   A[i+1] と A[r] を交換
8   return i+1
*/

int partition(vector<int> &a, int p, int r) {
    int x = a[r];
    int i = p-1;
    for(int j=p; j<r; j++) {
        if(a[j]<=x) {
            i++;
            swap(a[i], a[j]);
        }
    }
    swap(a[i+1], a[r]);
    return i+1;
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    int pivot = partition(a, 0, n-1);
    for(int i=0; i<n; i++) {
        (i==pivot ? (cout << "[" << a[i] << "]") : (cout << a[i])) << (i==n-1 ? "\n" : " ");
    }
}


Measured memory_bytes: 3088
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ZYCSwing
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskD solver = new TaskD();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskD {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt(), C = in.nextInt();
            int[][] d = new int[C + 1][C + 1];
            for (int i = 1; i <= C; ++i) {
                for (int j = 1; j <= C; ++j) {
                    d[i][j] = in.nextInt();
                }
            }
            int[][] c = new int[N + 1][N + 1];
            int[][] foo = new int[3][C + 1];
            for (int i = 0; i < 3; ++i) Arrays.fill(foo[i], 0);
            for (int i = 1; i <= N; ++i) {
                for (int j = 1; j <= N; ++j) {
                    c[i][j] = in.nextInt();
                    foo[(i + j) % 3][c[i][j]]++;
                }
            }

            int res = Integer.MAX_VALUE;

            for (int x = 1; x <= C; ++x) {
                int cost1 = 0;
                for (int o = 1; o <= C; ++o) {
                    cost1 += foo[0][o] * d[o][x];
                }
                for (int y = 1; y <= C; ++y) {
                    if (y == x) continue;
                    int cost2 = 0;
                    for (int o = 1; o <= C; ++o) {
                        cost2 += foo[1][o] * d[o][y];
                    }
                    for (int z = 1; z <= C; ++z) {
                        if (z == x || z == y) continue;
                        int cost3 = 0;
                        for (int o = 1; o <= C; ++o) {
                            cost3 += foo[2][o] * d[o][z];
                        }
                        int sum = cost1 + cost2 + cost3;
                        if (sum < res) {
                            res = sum;
                        }
                    }
                }
            }

            out.print(res);
        }

    }
}



Measured memory_bytes: 92360
// abc113_b
#include <bits/stdc++.h>
#ifdef LOCAL
#include "../cxx-prettyprint/prettyprint.hpp"
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))
#define ALL(x) x.begin(), x.end()

#define INF ((1 << 29)-1)
#define MOD (1000000007)

#define print2D(h, w, arr) REP(i, h) { REP(j, w) cout << arr[i][j] << " "; cout << endl; }
#define print_line(vec, n) {for(int i=0;i<(n-1);i++) cout << (vec)[i] << " "; cout << (vec)[(n)-1] << endl;}
template<class T> void print(const T& x){cout << x << endl;}
template<class T, class... A> void print(const T& first, const A&... rest) { cout << first << " "; print(rest...); }
struct PreMain {PreMain(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}} premain;

int main() {
#ifdef LOCAL
    ifstream in("../arg.txt"); cin.rdbuf(in.rdbuf());
#endif

    int N;
    cin >> N;
    int T, A;
    cin >> T >> A;
    vector<int> H(N);
    REP(i, N) cin >> H[i];

    auto f = [&](int x){ return T - 0.006 * x;};

    int mn_i = -1;
    double mn = INF;
    REP(i, N){
        double t = f(H[i]);
        if (abs(t - A) < mn){
            mn_i = i;
            mn = abs(t - A);
        }
    }
    print(mn_i + 1);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;

int main()
{
    ll n;
    cin >> n;
    ll ans = n/500LL * 1000 + n%500LL / 5LL * 5;
    cout << ans << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;

ll mod;

ll powimod(ll x,ll n,ll mod){
    ll res=1;
    while(n){
        if(n&1) res=(res*x)%mod;
        x=(x*x)%mod;
        n>>=1;
    }
    return res;
}

ll powi(ll x,ll n){
    ll res=1;
    while(n){
        if(n&1) res*=x;
        x*=x;
        n>>=1;
    }
    return res;
}

vector<int> z_function(string s) {
    int n = (int) s.length();
    vector<int> z(n);
    for (int i = 1, l = 0, r = 0; i < n; ++i) {
        if (i <= r)
            z[i] = min (r - i + 1, z[i - l]);
        while (i + z[i] < n && s[z[i]] == s[i + z[i]])
            ++z[i];
        if (i + z[i] - 1 > r)
            l = i, r = i + z[i] - 1;
    }
    return z;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin>>s;
    int ans=0;
    if(s[0]=='R'&&s[1]=='R'&&s[2]=='R') ans=3;
    else if(s[0]!='R'&&s[1]!='R'&&s[2]!='R') ans=0;
    else if((s[0]=='R'&&s[1]=='R')||(s[1]=='R'&&s[2]=='R')) ans=2;
    else ans=1;
    cout<<ans;
}


Measured memory_bytes: 3612