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

using namespace std;
#define ll long long
#define ld long double
#define f first
#define s second

ll n , m , k , ans = 1e9 , sum[15][3005];
string a[12];
vector<int> v;

void pre()
{
    for(int i=1; i<=n; i++)
    {
        for(int j=1; j<=m; j++)
            sum[i][j] = sum[i-1][j] + sum[i][j-1] - sum[i-1][j-1] + (a[i][j]-'0');
    }
}

ll get(int r , int c , int r2 , int c2)
{
    ll tmp = sum[r2][c2];
    tmp -= sum[r2][c-1];
    tmp -= sum[r-1][c2];
    tmp += sum[r-1][c-1];
    return tmp;
}

void solve(int i)
{
    if (i == n)
    {
        v.push_back(n);

        int res = v.size()-2 , rr , c , rr2 , c2;
        for(int l=1; l<=m; l)
        {
            for(int r=l; r<=m; r++)
            {
                for(int j=0; j<v.size()-1; j++)
                {
                    rr = v[j]+1 , rr2 = v[j+1];
                    c = l , c2 = r;
                    if (get(rr,c,rr2,c2) > k)
                    {
                        if (l==r)
                        {
                            v.pop_back();
                            return;
                        }
                        res++ , l = r;
                        goto here;
                    }
                }
            }
            break;
            here:
            continue;
        }
        v.pop_back();
        ans = min(ans , (ll)res);
        return;
    }

    v.push_back(i);
    solve(i+1);
    v.pop_back();
    solve(i+1);
}

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

    cin >> n >> m >> k;
    for(int i=1; i<=n; i++)
    {
        cin >> a[i];
        a[i] = ' '+a[i];
    }

    pre();

    v.push_back(0);
    solve(1);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stdlib.h>
#include <map>
#include <cmath>
#define MOD_P 1000000007
#define ll long long
using namespace std;

int main()
{
	string test;
	cin >> test;
	bool flag = true;

	for (int i = 0; test[i]; i++) {
		if (i % 2 && test[i] == 'R') {
			flag = false;
			break;
		} else if ((!(i % 2)) && test[i] == 'L') {
			flag = false;
			break;
		}
	}

	printf("%s", flag ? "Yes" : "No");
	
	return 0;
}




Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int i,n,a[100002]={0},k,q,t;
	scanf("%d %d %d", &n, &k, &q);
	for(i=0; i<q; i++)
	{
		scanf("%d", &t);
		a[t]++;
	}
	for(i=1; i<=n; i++)
	{
		if(k-q+a[i]>0) printf("Yes\n");
		else printf("No\n");
	}
	return 0;
}

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

int main(){
  int n,l,sum=0;
  cin >>n>>l;
  for(int i=1;i<=n;i++){
    sum+=l+i-1;
  }
  int min=l+1-1;
  int max=l+n-1;
  int add=0;
  if(max<=0){add-=max;}
  else if(min<=0){add=0;}
  else{
    add-=min;
  }
  cout <<sum+add;
}

Measured memory_bytes: 256
n, x = map(int, input().split())

a = list(map(int, input().split()))

if a[0] > x:
    cnt = a[0] - x
    a[0] = x
else:
    cnt = 0

for i in range(1, n):
    if a[i] + a[i-1] > x:
        cnt += a[i] + a[i-1] - x
        a[i] = x - a[i-1]

print(cnt)

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

ll n,m,v,p,a[100000];

bool f(ll x){
    if(x<p)return 1;
    if(a[x]+m<a[p-1])return 0;
    ll y=((p-1)+(n-x))*m;
    FOR(i,p-1,x)y+=a[x]+m-a[i];
    return y>=m*v;
}

int main(){
    cin>>n>>m>>v>>p;
    rep(i,n)cin>>a[i];
    sort(a,a+n,greater<ll>());

    ll l=0,r=n,mid;
    while(l+1<r){
        mid=(l+r)/2;
        if(f(mid))l=mid;
        else r=mid;
    }
    cout<<r<<endl;
}

Measured memory_bytes: 1152
import numpy

N = int(input())
p = [int(x) for x in input().split()]
p = [0] + p + [0]

S = numpy.sum(numpy.abs(numpy.diff(p)))

for i in range(1, N + 1):
    print(S - numpy.abs(p[i] - p[i - 1]) - numpy.abs(p[i + 1] - p[i]) + numpy.abs(p[i + 1] - p[i - 1]))

Measured memory_bytes: 37800
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;

int main() {
    int N, ans = 0; cin >> N;
    set<int> S;
    for(int i=0; i<N; i++) {
        int v; cin >> v;
        if(S.lower_bound(v) == S.begin()) ans++;
        S.emplace(v);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i)
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()) , v.end());
#define dis distance
#define so sort
#define rev reverse
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;

int main (){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vi B;
    REP(i,n){
        int a;
        cin >> a;
        if(i % 2 == 0)B.pub(a);
        else B.insert(B.begin(),a);
    }
    if(n%2!=0)rev(ALL(B));
    REP(i,n){
        if(i!=0) cout << " ";
        cout << B[i];
    }
    cout << endl;
    return 0;
}

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

int main() {
	int N, M, C;
	int B[20];
	int A;
	cin >> N >> M >> C;
	for (int i = 0; i < M; i++) {
		cin >> B[i];
	}
	
	int sum = 0, count = 0;
	for (int i = 0; i < N; i++) {
		sum = 0;
		for (int j = 0; j < M; j++) {
			cin >> A;
			sum += A * B[j];
		}
		sum += C;
		if (sum > 0) {
			count++;
		}
	}
	cout << count;
	return 0;
}

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

int main(){
    ll n; cin >> n;
    vector<ll> a(n);
    map<ll,ll> mp; 
    rep(i,n){
        ll tmp; cin >> tmp;
        mp[tmp]++;
    }

    ll ans = 0;
    for(auto x:mp){
        if(x.first < x.second){
            ans += x.second - x.first;
        }else if(x.first > x.second){
            ans += x.second;
        }
    }

    put(ans);
}

Measured memory_bytes: 9964
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int mod=1e9+7;
string sa;
ll d,dp[10010][110];
ll dfs_dp(int pos,ll sta,bool lim)
{
	if(pos==sa.size())
		return sta%d==0;
	if(!lim && dp[pos][sta]!=-1)
		return dp[pos][sta];
	ll up=lim?(sa[pos]-'0'):9,res=0;
	for(int i=0;i<=up;i++)
		res=(res+dfs_dp(pos+1,(sta+i)%d,lim&(i==up)))%mod;
	if(!lim)
		dp[pos][sta]=res;
	return res;
}
ll work()
{
	return dfs_dp(0,0,1);
}
int main()
{
	memset(dp,-1,sizeof(dp));
	cin>>sa>>d;
	cout<<(work()+mod-1)%mod<<endl;
	return 0;
}

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

using namespace std;

int main()
{
  int n = 1, p, N, a, b, sum, ans = 0;

  scanf("%d %d %d", &N, &a, &b);

  while (n <= N)
  {
    sum = 0;

    p = n;
    // printf("%d\n", p);
    while (p > 0)
    {
      sum += (p % 10);
      p /= 10;
    }

    if (a <= sum && sum <= b)
    {
      ans += n;
    }
    n++;
  }

  printf("%d", ans);
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>

using namespace std;

typedef long long int lli;

int gcd(int a, int b) {
	return b != 0 ? gcd(b, a%b) : a;
}
lli gcd(lli a, lli b) {
	return b != 0 ? gcd(b, a%b) : a;
}
int lcm(int a, int b) {
	return a * b / gcd(a, b);
}
lli lcm(lli a, lli b) {
	return a * b / gcd(a, b);
}

#define N_MAX 100000
#define MOD 1000000007

//lli fac[N_MAX], finv[N_MAX], inv[N_MAX];
//
//void COMinit() {
//	fac[0] = fac[1] = 1;
//	finv[0] = finv[1] = 1;
//	inv[1] = 1;
//	for (int i = 2; i < N_MAX; i++) {
//		fac[i] = fac[i - 1] * i % MOD;
//		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
//		finv[i] = finv[i - 1] * inv[i] % MOD;
//	}
//}
//
//lli COM(int n, int k) {
//	if (n < k) return 0;
//	if (n < 0 || k < 0) return 0;
//	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
//}
//
//lli modpow(lli base, lli p)
//{
//	if (0 == p) {
//		return 1;
//	}
//	if (0 == p % 2) {
//		lli val = modpow(base, p / 2);
//		return (val*val) % MOD;
//	}
//	else {
//		return (modpow(base, p - 1)*base) % MOD;
//	}
//}

pair<int,int> table[N_MAX];

void solv()
{
	int N; scanf("%d", &N);
	for (int i = 0; i < N; i++) {
		int x, l; scanf("%d%d", &x, &l);
		table[i] = make_pair(x + l, x - l);
	}

	sort(table, table + N);

	int right = table[0].second;
	int ret = 0;
	for (int i = 0; i < N; i++) {
		if (table[i].second >= right) {
			right = table[i].first;
			ret++;
		}
	}

	printf("%d", ret);

	return;
}

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	solv();

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}


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

struct node{
  int key;
  struct node *parent;
  struct node *left;
  struct node *right;
} ;

typedef struct node Node;

Node *root, *NIL;

void Insert(int);
void Inorder(Node *);
void Preorder(Node *);

int main()
{
  int n,i,a;
  char in[7],insert[7] = "insert";
  scanf("%d",&n);
  for(i = 0; i < n; i++){
    scanf("%s",in);
    if(strcmp(in, insert) == 0) {
      scanf("%d",&a);
      Insert(a);
    }
    else {
      Inorder(root);
      printf("\n");
      Preorder(root);
      printf("\n");
    }
  }
  return 0;
}

void Insert(int a) {
  Node *b = NIL;
  Node *c = root;
  Node *d;

  d = malloc(sizeof(Node));
  d -> key = a;
  d -> left = NIL;
  d -> right = NIL;
  while(c != NIL) {
    b = c;
    if(d -> key < c -> key) c = c -> left;
    else  c = c -> right;
  }

  d -> parent = b;
  if(b == NIL)  root = d;
  else { 
    if(d -> key < b -> key)  b -> left = d;
    else    b -> right = d;
  }
}

void Inorder(Node *u) {
  if(u == NIL) return;
  else {
    Inorder(u -> left);
    printf(" %d", u->key);
    Inorder(u -> right);
  }
}

void Preorder(Node *u) {
  if(u == NIL) return;
  else {
    printf(" %d", u->key);
    Preorder(u -> left);
    Preorder(u -> right);
  }
}

Measured memory_bytes: 24048
#include <sstream>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iterator>
#include <numeric>
#include <functional>
#include <climits>



using namespace std;
typedef unsigned long long ull;
typedef long long ll;

int n, k;
vector<int> w;


bool ok(int p){
  int i = 0;
  int t = 0;
  while(i < n && t < k){
    int s = 0;
    while(i < n){
      if(s + w[i] <= p){
        s += w[i++];
      } else {
        break;
      }
    }
    t++;
  }
  return i==n;
}

int main(int argc, char *argv[]){
  cin >> n >> k;
  w.resize(n);
  for (size_t i = 0; i < n; i++) {
    cin >> w[i];
  }
  int l = 0, r = 10000;
  while(!ok(r)){
    r *= 2;
  }
  while(l != r-1){
    int c = (l+r) / 2;
    if(ok(c)){
      r = c;
    } else{
      l = c;
    }
  }
  cout << r << endl;
  
  return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <deque>
using namespace std;
using P = pair<int,int>;
typedef long long int ll;
#define rep(i, n) for (int(i) = 0; (i) < (n); (i)++)

int main(){ 
  int n,k;cin >> n >> k;
  int cnt=0;
  rep(i,n){
    int h;
    cin >> h;
    if(h>=k){
      cnt++;
    }
  }
  cout << cnt << endl;
  return 0;
}



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

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;

using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using vll = V<ll>;
using vvll = V<V<ll>>;
using vvvll = V<V<V<ll>>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vvpll = V<vpll>;
using vtpll = V<tpll>;
using vst = V<str>;
using vch = V<char>;
using vvch = V<vch>;
using qll = queue<ll>;
using vqll = V<qll>;

#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin() 
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl
#define pb(a) push_back(a)
#define pob pop_back()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,b) substr(a,b)
#define cfs(a) cout<<fixed<<setprecision(a) //
/*vvll v(n,vll(m)) n行m列  continue
A.erase(A.begin()+i); 配列Aのi番目を消せる
std::binary_search(v.bgn,v.en,a); 二分探索
abs(a,b)   pow(a,n)  to_string  stoll
auto Iter=lower_bound(v.bgn,v.en,a); v[i]>=aのv[i]
v.insert(lower_bound(v.bgn,v.en,a),b); bを入れられる
lower upper  co(*Iter) co(Iter-v.bgn) v[i]>=aとなる初のi
priority_queue<ll> pque; pque.push(ai); pque.top()→max(ai) 
vqll q(3);  q[0].push(0); q[0].push(2); q[0].push(1);
q[0].front()→0 q[0].back()→1 q[0].pop(); q[0].front()→2
que.pop() que.sz while(!que.empty())
*/

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
#define comuse Comuse()
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
ll pow_mod(ll a,ll n,ll m){
  ll res=1;
  for(;n>0;n/=2){
    if(n%2==1)res=(res*a)%m;
    a=(a*a)%m;
  }
  return res;
}


int main(){
  ll n,k;
  cin>>n>>k;
  vll v(n);
  ll c=0;
  FOR(i,0,n){
    cin>>v[i];
    if(v[i]==1){
      c=i;
    }
  }
  //co(c);
  ll ans=0;
  ll add=0;
  if(c<k-1){
    add=k-c-1;
    ans++;
  }
  else if(c%(k-1)==0){
    ans+=c/(k-1);
  }
  else{
    add+=(k-1)-c%(k-1);
    ans+=c/(k-1)+1;
  }
  c+=add;
  if((n-c-1)%(k-1)==0||c>=n-1){
    ans+=(n-c-1)/(k-1);
  }
  else{
    ans+=(n-c-1)/(k-1)+1;
  }
  co(ans);
}
  
  

Measured memory_bytes: 1024
s = input()
possible = []
for i in range(2**4):
    st = "" 
    if i & 1 << 0:
        st += "A"
    st += "KIH"
    if i & 1 << 1:
        st += "A"
    st += "B"
    if i & 1 << 2:
        st += "A"
    st += "R"
    if i & 1 << 3:
        st += "A"
    possible.append(st)
if s in possible:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 100000001;

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

    vector<int> p(n);
    rep(i,n){
        cin >> p.at(i);
    }
    vector<int> q(n-k);
    

    int max = 0;
    for(int i=0; i<n-k; i++){
        q.at(i)=p.at(i+k);
    }
    vector<int> r(n-k);
    for(int i=0; i<n-k; i++){
        r.at(i)=q.at(i)-p.at(i);
    }
    vector<int> s(n-k+1);
    int t=0;
    rep(i,k){
        t+=p.at(i);
    }
    s.at(0)=t;
    for(int i=1; i<n-k+1; i++){
        s.at(i)=s.at(i-1)+r.at(i-1);
    }

    sort( s.begin(), s.end() );
    max = s.back();

    cout << fixed << setprecision(15) << (max+k)/2.0 << endl;

    return 0;
}

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

using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7;

ll calc_pow(ll x, ll pow) {
    if (pow == 0) return 1;
    ll a = calc_pow(x, pow / 2);
    a = a * a % MOD;
    if (pow % 2 == 1) a *= x;
    return a % MOD;
}

ll calc_div(ll a, ll b) {
    return a * calc_pow(b, MOD - 2) % MOD;
}

int main() {
    int n, a, b;
    cin >> n >> a >> b;

    ll all = calc_pow(2, n) - 1;
    ll onlyA = 1;
    for (int i = 1; i <= a; i++) {
        onlyA *= (n + 1) - i, onlyA %= MOD;
        onlyA = calc_div(onlyA, i), onlyA %= MOD;
    }
    ll onlyB = 1;
    for (int i = 1; i <= b; i++) {
        onlyB *= (n + 1) - i, onlyB %= MOD;
        onlyB = calc_div(onlyB, i), onlyB %= MOD;
    }

    ll ret = all - (onlyA + onlyB);
    cout << (ret + MOD * 10) % MOD << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>

using namespace std;
using ll = long long;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI = 4.0 * atan(1.0);

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

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

    cout << max(0, C - (A - B)) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

string S;

int main(void)
{
	cin >> S;
	if (S[0] == S[1] && S[0] == S[2]) {
		cout << "Yes\n";
		return 0;
	}
	if (S[1] == S[2] && S[2] == S[3]) {
		cout << "Yes\n";
		return 0;
	}
	cout << "No\n";
	return 0;
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/abl/tasks/abl_a
#include <bits/stdc++.h>

using namespace std;

int main() {
    int k;
    cin>>k;
    for (int i=1; i<=k; i++) {
        cout<<"ACL";
    }
    cout<<"\n";
    
    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
long m,n,i,k,l,s;
int main()
{
    scanf("%ld",&n);
    l=n;
    s=0;
    printf("%ld:",n);
    for(i=2; i<=sqrt(n); i++)
    {
        while(l%i==0)
        {
            printf(" %ld",i);
            l=l/i;
            s=1;
        }
    }
    if(l!=1&&s==1)
        printf(" %ld",l);
    if(s==0)
        printf(" %ld",n);
    printf("\n");
    return 0;
}

Measured memory_bytes: 1848
#include<bits/stdc++.h>
#define maxn 500100
using namespace std;
int pre[maxn],suf[maxn],a[maxn],n,m;
int main(){
	scanf("%d%d",&n,&m),pre[0]=m;
	for(int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		pre[i]=min(pre[i-1],abs(pre[i-1]-a[i]));
	}
	scanf("%d",&m);
	suf[n]=1;
	for(int i=n-1;i>=1;--i)
		if(suf[i+1]<=(a[i+1]>>1))
			suf[i]=suf[i+1];
		else suf[i]=min(pre[0]+2,suf[i+1]+a[i+1]);
	for(int i=1,x;i<=m;++i)
		scanf("%d",&x),puts(pre[x-1]>=suf[x]?"YES":"NO");
}

Measured memory_bytes: 7808
#include<bits/stdc++.h>
using namespace std;
#define N 10010
int v[N],n,nxt[N],ec,x,y,h[N],a[N],f[N];
void add(int x,int y){v[++ec]=y;nxt[ec]=h[x];h[x]=ec;}
void dfs(int x,int fa){
	for(int i=h[x];i;i=nxt[i])
		if(v[i]!=fa&&a[x]>a[v[i]]){
			dfs(v[i],x);
			if(!f[v[i]]){
				f[x]=1;
				return;
			}
		}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",a+i);
	for(int i=1;i<n;i++){
		scanf("%d%d",&x,&y);
		add(x,y);add(y,x);
	}
	for(int i=1;i<=n;i++){
		memset(f,0,sizeof(f));
		dfs(i,0);
		if(f[i])printf("%d ",i);
	}
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll long long

using pi = pair<int, int>;

typedef tree< pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update>Order_Set;

Order_Set X;

const int mxn = 2e5+100;
const int Mod = 1e9+7;

int arr[mxn], qs[mxn];
int bitOn[55];
map<int,int>Mp, cnt, op;
vector<int>Pi, Ans;
vector<int>G[mxn];
set<int>seet[mxn];

int main()
{
     ios::sync_with_stdio(false);
     int n=5;
     vector<int>v(n);
     for(int i=0 ; i<n ; i++) cin>>v[i];
     int k;
     cin>>k;
     sort(v.begin(), v.end());
     (v[4]-v[0] <= k) ? puts("Yay!") : puts(":(");

     return 0;
}




Measured memory_bytes: 14592
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MAX_C 1000000001

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

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());

  if (a[m-1] * 4 * m >= all) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import java.util.*;

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

        String S = sc.next();
        String f = S.substring(0, 2);
        String b = S.substring(2);
        int fm = Integer.parseInt(f);
        int bm = Integer.parseInt(b);

        if(fm>12 && bm>12){
            System.out.println("NA");
        }
        else if((fm>12 && bm==0) || (fm==0 && bm>12) || (fm==0 & bm==0)){
            System.out.println("NA");
        }
        else if(fm<=12 && fm>0 && bm<=12 && bm>0){
            System.out.println("AMBIGUOUS");
        }
        else if((fm>12 || fm==0) && bm<=12 && bm>0){
            System.out.println("YYMM");
        }
        else if((bm>12 || bm==0) && fm<=12 && fm>0){
            System.out.println("MMYY");
        }
    }
}

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

int main(){
  int n;
  cin>>n;
  vector<int>a(n);
  rep(i,n){
    cin>>a.at(i);
  }
  bool ex=false;
  rep(i,n){
    rep(j,n){
      swap(a.at(i),a.at(j));
      bool ch=true;
      rep(i,n-1){
        if(a.at(i)>a.at(i+1)){
          ch=false;
        }
      }
      if(ch){
        ex=true;
      }
      swap(a.at(i),a.at(j));
    }
  }
  if(ex){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
    string s;
    cin >> s;
    int ans = 0;
    for(int i=0;i<s.size();i++){
        if(s[i] == '+'){
            ans++;
        }
        else if(s[i] == '-'){
            ans--;
        }
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
N=int(input())
S=[input() for i in range(N)]
from collections import defaultdict
d=defaultdict(int)
for s in S:
    s=''.join(sorted([c for c in s]))
    d[s]+=1
a=0
for v in d.values():
    if v>1:
        a+=v*(v-1)//2
print(a)

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

#define rep(i,n) for(long long i=0; i<(long long)(n);i++)
#define rep2(i,s,n) for(long long i=(s); i<(long long)(n);i++)

#define mod 1e9+7;
#define inf 1e18+7;

typedef long long ll;

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

    vector<int>a(n),B(n);
    rep(i,n){
        cin>>a[i];
    }

    rep(i,n){
        B[i]=a[i]-(i+1);
    }

    sort(B.begin(),B.end());
    int b=B[n/2];

    ll ans=0;
    rep(i,n){
        ans+=abs(a[i]-(b+i+1));
    }

    cout<<ans<<endl;
}


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

int main(void)
{
	int n;
	int *a;
	scanf("%d",&n);
	a = (int *)malloc(sizeof(int)*(n));
	int i = 0;
	while (i < n)
	{
		scanf("%d",&a[i]);
		i++;
	}
	double ans = 0;
	i = 0;
	while (i < n)
	{
		ans += 1.0/(double)a[i];
		i++;
	}
	printf("%.10f\n",1.0/ans);
	return(0);
}


Measured memory_bytes: 128
#include<iostream>
using namespace std;
int main()
{
	long long a, b;
	while (scanf("%lld%lld", &a, &b) != EOF)
	{
		if (2 * a <= b)
		{
			printf("%lld\n", a + (b - 2 * a) / 4);
		}
		else
		{
			printf("%lld\n", b / 2);
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1LL << 60;
ll MOD = 1000000000 + 7;

int main() {
    int n;
    ll time = 1;
    cin >> n;
    for (int i = 0; i < n; i++) {
        ll t;
        cin >> t;
        time = (time / gcd<ll>(t, time)) * t;
    }
    cout << time << endl;
    return 0;
}

Measured memory_bytes: 3556
#include <cstdio>
#include <cctype>
#include <cstdlib>

using namespace std;

int main() {
    char s[25];
    int a, b;

    scanf("%d%d", &a, &b);
    scanf("%s", s);

    for (int i = 0; i < a; ++i) {
        if (!isdigit(s[i])){
            puts("No");
            exit(0);
        }
    }
    if (s[a] != '-'){
        puts("No");
        exit(0);
    }
        
    for (int i = a + 1; i < a + b + 1; ++i) {
        if (!isdigit(s[i])){
            puts("No");
            exit(0);
        }
            
    }

    puts("Yes");
    return 0;
}


Measured memory_bytes: 128
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#define ll long long
#define inf 1000000000
#define mod 1000000007
#define eps 1e-10
#define rep(i, l, r) for(int i=l; i<r; ++i)
const double pi=acos(-1.0);

using namespace std;
int t;
int n, d;
int main(){
	scanf("%d%d", &n, &d);
	int ans=0;
	while(n--){
		int x, y;
		scanf("%d%d", &x, &y);
		if(1ll*x*x+1ll*y*y<=1ll*d*d) ++ans;
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
const std::string yes = "Yes";
const std::string no  = "No";


std::vector<std::pair<long long, long long>> prime_factor(const long long N){
    long long n=N;
    std::vector<std::pair<long long, long long>> x;
    for(long long a=2; a*a <= n; ++a){
        if(n%a!=0) continue;
        long long ex = 0;
        while (n % a == 0) {
            ++ex;
            n /= a;
        }
        x.push_back({a, ex});
    }
    if(n!=1) x.push_back({n, 1});
    return x;
}

int main(){
    ll n,p;
    std::cin >> n >> p;
    std::vector<std::pair<long long, long long>> pv = prime_factor(p);

    ll ans = 1;
    for(auto pvi:pv){
        ans *= pow(pvi.first, pvi.second/n);
    }
    std::cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 4016
def F(n):
    res = 0
    if n % 4 == 0:
        res = n
    elif n % 4 == 1:
        res = 1
    elif n % 4 == 2:
        res = 1^n
    else:
        res = 0
        
    return res

def main():
    A, B = map(int, input().split())
    ans = F(A-1) ^ F(B)

    #print(A, B, F(A-1), F(B))

    print(ans)

main()


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

#define int long long

typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

int N;
int A[111];

signed main(){
    scanf("%lld",&N);
    rep(i,N)scanf("%lld",&A[i]);

    rep(i,N){
        int cur=i;
        while(cur>0&&A[cur-1]>A[cur]){
            swap(A[cur],A[cur-1]);
            cur--;
        }
        rep(j,N){
            if(j)printf(" ");
            printf("%lld",A[j]);
        }
        puts("");
    }
    return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
#ifdef LOCAL_TEST
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif
	string s;
	cin >> s;
	set<char> st;
	for(auto& c : s) st.insert(c);
	map<char, char> mp;
	mp['S'] = 'N';
	mp['N'] = 'S';
	mp['E'] = 'W';
	mp['W'] = 'E';
	string yes = "Yes", no = "No";
	for(auto& c : st) {
		if(st.count(mp[c]) == 0) {
			cout << no << endl;
			return 0;
		}
	}
	cout << yes << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Globalization;
using System.IO.Pipes;
using System.Runtime.InteropServices;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());

            if (a % 2 == 0) Console.WriteLine(a);
            else Console.WriteLine(a * 2);
        }

    }
}


Measured memory_bytes: 27228
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl '\n'
using namespace std;
const ll mod = (ll)1e9+7;
const int INF = 0x3f3f3f3f;
ll max(ll a, ll b){return a > b ? a : b;}
ll min(ll a, ll b){return a < b ? a : b;}

pair<int, int> a[101];
map<int, map<int, int> > mp;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    for(int i=0; i<n; i++)
    {
        int x, y;
        cin >> x >> y;
        a[i] = {x, y};
        mp[x][y]=1;
    }
    int m=0;
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
        {
            if(i==j) continue;
            int c=0;
            pair<int, int> p = {a[i].first-a[j].first, a[i].second-a[j].second};
            for(int k=0; k<n; k++)
            {
                if(mp[p.first+a[k].first][p.second+a[k].second]) c++;
            }
            m=max(m, c);
        }
    }
    cout << n-m;
}

//TODO: 56
//come back to 50D, 55D, DP-J



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

#define ll long long //data types used often, but you don't want to type them time by time
#define ull unsigned long long
#define ui unsigned int
#define mod 998244353
#define us unsigned short
#define IOS ios_base::sync_with_stdio(0); //to synchronize the input of cin and scanf
#define INF LONG_MAX
#define PI 3.1415926535897932384626
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define rep(x,j,n)for(int x=j;x<n;x++)
#define all(x) (x).begin(), (x).end()

typedef vector<pair<ll,ll>> vpi;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll,ll> pi;

bool prime(ll n)
{
    if(n<=1)return false;
    if(n<=3)return true;
    if(n%2==0||n%3==0)return false;
    for(ll i=5;i*i<=n;i+=6)
    {
        if(n%i==0||n%(i+2)==0)return false;
    }
    return true;
}

ll modexp(ll a,ll b,ll m)
{
    ll r=1;
    a=a%m;
    while(b>0)
    {
        if(b&1)r=(r*a)%m;
        b = b>>1;
        a=(a*a)%m;
    }
    return r%m;
}

ll addmod(ll a,ll b)
{
    return (a+b)%mod;
}
ll mulmod(ll a,ll b)
{
    a %=mod;
    b%=mod;
    return (a*b)%mod;
}
ll submod(ll a,ll b)
{
    ll x  = a-b;
    if(x<0)x+=mod;
    x%=mod;
    return x;
}
bool comp(pair<pi,ll>a,pair<pi,ll>b)
{
    if(a.fi.fi==b.fi.fi)return a.fi.se<b.fi.se;
    return a.fi.fi<b.fi.fi;
}


int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ll a,b; cin>>a>>b;
cout<<a*b<<endl;

return 0;
}
/*
5 10 10
22 23
17 19
13 17
8 12
2 6
*/


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
int main() {
	long long int N;
	vector<long long int> vec(5);
	cin>>N;
	for(int i=0; i<5; i++){
		cin>>vec[i];
	}
	sort(vec.begin(), vec.end());
	long long int ans=0;
	if(N%vec[0]==0){
		ans=N/vec[0];
	}
	else{
		ans=N/vec[0]+1;
	}
	ans+=4;
	cout<<ans<<endl;
}

Measured memory_bytes: 256
def solve(s, t):
    assert len(s) == len(t)
    res = 0
    for i, ss in enumerate(s):
        if ss == t[i]:
            res += 1
    return res


if __name__ == "__main__":
    S = list(input())
    T = list(input())
    print(solve(S, T))


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class AtCoderrr
    {
        static long N,K;
        static long[] Member, Foods;
        static void Main(string[] args)
        {
            long[] nk = ReadLine().Split(' ').Select(long.Parse).ToArray();
            N = nk[0];
            K = nk[1];
            Member = ReadLine().Split(' ').Select(long.Parse).ToArray();
            Foods = ReadLine().Split(' ').Select(long.Parse).ToArray();
            Array.Sort(Member);
            Array.Reverse(Member);
            Array.Sort(Foods);
            if (is_possible(0))
            {
                WriteLine(0);
                return;
            }

            //ここから二分探索
            //求めるべき答えを見つけ出す
            long left = 0, right = (long)1e18;
            while (right-left > 1)
            {
                var mid = (left + right) / 2;
                if (!is_possible(mid))
                {
                    left = mid;
                }
                else
                {
                    right = mid;
                }
            }
            WriteLine(right);
        }


        static bool is_possible(long target)
        {
            long ex = 0;
            for (int i = 0; i < N; i++)
            {
                long need = target / Foods[i];
                ex += Max(0, Member[i] - need);
            }
            return ex <= K;
        }
    }
}


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

using namespace std;

int selectionSort(int A[], int N)
{
  int minj;
  int changecount = 0;
  for (int i = 0; i < N - 1; i++){
    minj = i;
    for (int j = i; j < N; j++){
      if (A[j] < A[minj]){
        minj = j;
      }
    }
    swap(A[i], A[minj]);
    if (i != minj) changecount++;
  }
  return changecount;
}

int main()
{
  int n;
  int changecount;
  cin >> n;
  int A[n];
  for (int i = 0; i < n; i++) cin >> A[i];
  changecount = selectionSort(A, n);
  for (int i = 0; i < n; i++){
    if (i != 0){
      cout << " ";
    }
    cout << A[i];
  }
  cout << endl;
  cout << changecount << endl;
  return 0;
}



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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> ss(h);
  rep(i, h) cin >> ss[i];

  string ans = "Yes";
  rep(i, h) {
    string row = ss[i];
    rep (j, w) {
      char c = row[j];
      if (c == '.') continue;
      queue<P> q;
      if (i != 0) {
        q.push(make_pair(i-1, j));
      }
      if (i != h-1) q.push(make_pair(i+1, j));
      if (j != 0) q.push(make_pair(i, j-1));
      if (j != w-1) q.push(make_pair(i, j+1));

      bool isAllDot = true;
      while(!q.empty()) {
        P p = q.front();
        q.pop();
        if (ss[p.first][p.second] == '#') {
          isAllDot = false;
          break;
        }
      }
      if (isAllDot) {
        ans = "No";
        cout << ans << endl;
        return 0;
      }
    }
  }

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


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

#define rep(i,j,n) for(i=j;i<n;i++)
#define repi(i,j,n) for(i=j;i>n;i--)
#define inf 100001
#define M 1000000007
#define ll long long
#define vll vector<long long>
#define vi vector<int>
#define pll pair<long long,long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int> >
#define vpll vector<pair<long long,long long> >
#define pb push_back
#define pf pop_front
#define mp make_pair
#define F first
#define S second


ll power(ll a,ll m,ll mod){
	ll ans=1;
	while(m){
		if(m%2){
			ans*=a;
			ans%=(mod);
		}
		a=(a*a)%(mod);
		m>>=1;
	}
	return ans;
}


void init(long long* a,long long n,long long val){
	for(long long i=0;i<n;i++)
		a[i]=val;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);	
	ll t=1,i,j;
	ll a,b,c;
	cin>>a>>b;
	c=a^b;
	cout<<c<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <cmath>

using namespace std;

typedef complex<double> xy_t;

double cross_product(xy_t a, xy_t b) {
	return (conj(a) * b).imag();
}

const double eps = 1e-11;

int main() {
	int n;
	double x[4];
	double y[4];
	cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 4; j++) {
			cin >> x[j] >> y[j];
		}
		bool result = abs(cross_product(xy_t(x[0], y[0]) - xy_t(x[1], y[1]), 
						xy_t(x[2], y[2]) - xy_t(x[3], y[3]))) < eps;
		cout << (result ? "YES" : "NO") << endl;
	}
}

Measured memory_bytes: 1228
n = int(input())
l = [input() for i in range(n)]
d={}

for i in range(len(l)):
    if l[i] in d:
        d[l[i]]+=1
    else:
        d[l[i]]=1

largest=max(d.values())
ans=[]
for key in d.keys():
    if d[key]==largest:
        ans.append(key)
ans=sorted(ans)
for word in ans:
    print(word)


Measured memory_bytes: 99052
//#include "stdafx.h"
#include<bits/stdc++.h> 
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
using namespace std;
int sum,n,x,a[101];
int main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	
	cin >>n>>x;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	sort(a,a+n);
	x-=sum;
	if(a[0]<=x)
		cout<<n+(x/a[0])<<"\n";
	else
		cout<<n<<"\n";

	return 0;
}

Measured memory_bytes: 3628
import sys
from pprint import pprint

def solve(n, info):
    ans = 0
    for i in range(2 ** n):
        true_info = {}
        p_info = [0] * n
        for j in range(n):
            if (i >> j) & 1:
                true_info[j] = info[j]
                for x, y in info[j]:
                    if y == 1:
                        true_info[x-1] = info[x-1]
                # pprint(info[j])
                p_info[j] = 1
        # print("p_info")
        # pprint(p_info)
        # print("true_info")
        # pprint(true_info)
        flag = True
        for _, info_list in true_info.items():
            for x, y in info_list:
                if p_info[x-1] != y:
                    flag = False
                    break
            if not flag:
                break

        if flag:
            # pprint(true_info)
            ans = max(ans, sum(p_info))

    print(ans)

if __name__ == '__main__':
    n = int(sys.stdin.readline().strip())
    info = []
    for i in range(n):
        a = int(sys.stdin.readline().strip())
        info.append([])
        for _ in range(a):
            x, y = map(int, sys.stdin.readline().strip().split(" "))
            info[i].append((x, y))
    
    # pprint(info)
    solve(n, info)

Measured memory_bytes: 45164
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;
#define int long long
signed main(){
    int n;
    cin>>n;
    int a=1;
    for(int i=1;i<=n;i++){
        a*=i;
        a=a%1000000007;
    }
    cout<<a<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

using namespace std;
using ll  = long long;
using pll = pair<ll, ll>;

const ll MOD  = 1e9 + 7;
const ll LINF = 1LL << 62;
const int INF = 1e9 + 7;


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

    vector<ll> sum_a(n+1), sum_b(m+1);
    sum_a[0] = sum_b[0] = 0;

    rep(i, n){
        ll a;
        cin >> a;
        sum_a[i+1] = sum_a[i] + a;
    }
    rep(i, m){
        ll b;
        cin >> b;
        sum_b[i+1] = sum_b[i] + b;
    }

    if(k >= sum_a[n] + sum_b[m]){
        cout << n + m << endl;
        return 0;
    }

    ll ans = 0;
    rep(i, n+1){
        ll v = k - sum_a[i];
        ll cnt = i;
        if(v < 0)continue;
        if(v >= sum_b[m]){
            ans = max(ans, cnt+m);
            continue;
        }

        auto itr = upper_bound(ALL(sum_b), v);
        ll pos = itr - sum_b.begin()-1;
        cnt += pos;
        // cout << i << ", " << pos << "=" << sum_a[i] + sum_b[pos] << ":" << v << endl;
        ans = max(ans, cnt);
    }

    cout << ans << endl;
}


Measured memory_bytes: 6424
//PKMKB
#include <bits/stdc++.h>
#define ll long long int
#define max(a,b) (a>b?a:b)
#define min(a,b) (a<b?a:b)
#define scanarr(a,b,c) for( i=b;i<c;i++)cin>>a[i]
#define showarr(a,b,c) for( i=b;i<c;i++)cout<<a[i]<<' '
#define ln cout<<'\n'
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define mod 1000000007
#define MAX 100005
using namespace std;
////////////////////////////////////////////////////////////////CODE STARTS HERE////////////////////////////////////////////////////////////////

void solve(){
   
   int i, n, tmp, q, b, c;
   cin >> n;
   int xr = 0;
   vector <int> ans(n, 0), nums(n,0), pre(n, 0), suff(n, 0);
   
   for(i = 0; i < n; ++i){

       cin >> nums[i];
       xr ^= nums[i];
   }

   for(i = 0; i < n; ++i)
    cout<< (xr ^ nums[i]) << " "; 

    ln;

    

}
int main(){

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    #endif
   
    solve();
}


Measured memory_bytes: 6348
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#include <string>
#include <math.h>
#include <set>
#include <string>
#include <malloc.h>
using namespace std;

int main()
{
	int N,M;
	cin>>N>>M;
	vector<int> like;
	like.resize(M);
	for(int i=0; i<M; i++)
	{
		like[i]=0;
	}
	for(int i=0; i<N; i++)
	{
		int K;
		cin>>K;
		for(int j=0; j<K; j++)
		{
			int index;
			cin>>index;
			index--;
			like[index]+=1;
		}
	}
	int cnt = 0;
	for(int i=0; i<M; i++)
	{
		if(like[i] == N)
		{
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

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

int main(){
    int x;  cin >> x;
    //エラトステネスの篩
    vector<int>prime(1e5+11, 1);
    prime[0] = 0;
    prime[1] = 0;
    for(int p = 2; p*p <= 1e5+10; p++){
        if(!prime[p])  continue;
        for(int i = p*2; i <= 1e5+10; i+=p) prime[i] = 0;
    }
    int ans = x;
    for(; !prime[ans]; ++ans);
    cout << ans << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <string>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
using namespace std;

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

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

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

    vector<pll> bas(n);
    for (auto& ba : bas) { cin >> ba.second >> ba.first; }

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

    const auto isOK = [&]()
    {
        ll sum = 0;

        for (const auto& ba : bas)
        {
            sum += ba.second;

            if (ba.first < sum) { return false; }
        }

        return true;
    };

    const bool res = isOK();
    cout << (res ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 3328
#include <cstdio>  
#include <stack>  
#include <queue>
#include <cmath>  
#include <vector>  
#include <cstring>  
#include<set>
#include<map>
#include<ctime>
#include<string>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
typedef pair<int, int> P;
typedef pair<double, double> Pd;
typedef unsigned long long uLL;
const int M = 2005;
const int N = 1000005;
const int mod = 1000000007;
const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const LL lINF = 0x3f3f3f3f3f3f3f3fLL;
const int sINF = 0xcfcfcfcf;
#define ls (rt<<1)
#define rs (rt<<1|1)
LL sum, n, tmp;
int main()
{
	while (~scanf("%lld",&n))
	{
		sum = 0;
		while (n--)
		{
			scanf("%lld", &tmp);
			sum += tmp - 1;
		}
		printf("%lld\n", sum);
	}
}

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

#define TASK ""
#define openfile ({freopen(TASK".inp", "r", stdin); freopen(TASK".out", "w", stdout);})

const int N = 100005;

int q, k;
int n;
vector <pair <int, int> > g[N];
long long dep[N];

void dfs(int u, int p) {
	for (int i = 0; i < g[u].size(); i++) {
		int v = g[u][i].first;
		int w = g[u][i].second;
		if (v == p) continue;
		dep[v] = dep[u] + w;
		dfs(v, u);
	}
}

int main() {
	//openfile;
	scanf("%d", &n);
	for (int i = 1; i < n; i++) {
		int u, v, w;
		scanf("%d %d %d", &u, &v, &w);
		g[u].push_back(make_pair(v, w));
		g[v].push_back(make_pair(u, w));
	}
	scanf("%d %d", &q, &k);
	dfs(k, 0);
	while (q--) {
		int u, v; scanf("%d %d", &u, &v);
		printf("%lld\n", dep[u] + dep[v]);
	}
	return 0;
}

Measured memory_bytes: 14336
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        int k = in.nextInt();
        int x = in.nextInt();
        for(int i=Math.max(x-k+1,-1000000);i<=Math.min(x+k-1,1000000);i++){
            out.print(i+" ");
        }
        out.println();
    }
    
    /************* SOLUTION ENDS HERE **********/
}

Measured memory_bytes: 22612