akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int Count (string S) {
  int ret = 0;
  for (int i = 0; i < S.size(); i++) {
    if (S.at(i) == 'D') ret++;
  }
  for (int i = 0; i < S.size() - 1; i++) {
    if (S.at(i) == 'P' && S.at(i + 1) == 'D') ret++;
  }
  return ret;
}

  
  
int main() {
  string s;
  cin >> s;
  for (int i = 0; i < s.size(); i++) {
	if (s.at(i) == '?')  s.at(i) = 'D';
  }
  cout << s << endl;
  
  
}
  

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

int main() {
    int N, x;
    cin >> N >> x;
    int a[N];
    for (int i = 0; i < N; i++) cin >> a[i];

    sort(a, a + N);
    int ans = 0;
    for (int i = 0; i < N - 1; i++) {
        if (x - a[i] >= 0) {
            x -= a[i];
            ans++;
        }
    }
    if (x > 0 && x - a[N-1] == 0) ans++;
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
class Diagram:
    def __init__(self, n, xs):
        self.n = n
        self.xs = xs + [[0, 0, 0]]

    def departure(self, i, t):
        if i == self.n - 1:
            return t
        s = self.xs[i][1]
        f = self.xs[i][2]
        c = s // f
        x = max(s, t)
        d, m = divmod(x, f)
        if m == 0:
            return x
        else:
            return f*(d+1)

    def arrival(self, i, t):
        return self.departure(i, t) + self.xs[i][0]



if __name__ == "__main__":
    n = int(input())
    xs = [list(map(int, input().split())) for i in range(n-1)]
    d = Diagram(n, xs)

    ys = [0]*n
    for i in range(n):
        for j in range(i,n) :
            ys[i] = d.arrival(j, ys[i])
    for y in ys:
        print(y)

Measured memory_bytes: 3188
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <utility>
#include <numeric>

using namespace std;
typedef long long llong;
typedef unsigned long long ullong;

const ullong MOD = 1000000000 + 7;

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

	int mins = 999999;
	for (int i = 1; i < n; i++)
	{
		int a = 0;
		for (int j = i; j > 0; j /= 10)
		{
			a += j % 10;
		}

		int b = 0;
		for (int j = n - i; j > 0; j /= 10)
		{
			b += j % 10;
		}

		mins = min(mins, a + b);
	}

	cout << mins << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace ::std;
int main()
{
  int d;
  scanf("%d", &d);
  if (d == 25)
  {
    cout << "Christmas\n";
  }
  else if(d >= 22 && d <= 24)
  {
    int n = 25 - d;
    cout << "Christmas";
    for (int i = 0; i < n; i++)
    {
      cout << " Eve";
    }
    cout << "\n";
  }

  return 0;
}

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

int main() {

	int K,S,x,y,z,a1=0,a2=0,a3=0,ans;
	
	cin >> K>>S;

  for(int x=0; x<=K;x++){
    for(int y=x; y<=K;y++){
      for(int z=y; z<=K;z++){
        if(z==S-x-y){
        if(x==y&&y==z){a1++;}
        else if(x==y||y==z||x==z){a2++;}
        else{a3++;}}
      }}}
  ans+=a1+3*a2+6*a3;
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long tint;
 
const tint INF = 2e14+1;
const long double PI = 3.141592;
const int MOD = 998244353;
 
#define forsn(i, s, n) for(int i=s;i<int(n);i++)
#define forn(i, n) forsn(i, 0, n)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define NACHO ios_base::sync_with_stdio(0);cin.tie(NULL);
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

vector<int> dx = {1,-1,0,0};
vector<int> dy = {0,0,1,-1};

bool esValido(int n, int m, int x, int y){
	return (0<=x && x<n && 0<=y && y<m);
}

int main(){
	int n, m; cin >> n >> m;
	vector<string> a (n);
	forn(i, n) cin >> a[i];
	int maxi = 0;
	forn(i, n){
		forn(j, m){
			if(a[i][j] == '#') continue;
			vector<vector<int>> distance (n, vector<int> (m)); distance[i][j] = 0;
			vector<vector<bool>> visited (n, vector<bool> (m, 0)); visited[i][j] = 1;
			queue<pair<int,int>> q;
			q.push({i, j});
			while(!q.empty()){
				auto s = q.front();
				q.pop();
				forn(k, 4){
					int x = s.first+dx[k];
					int y = s.second+dy[k];
					if(esValido(n, m, x, y) && !visited[x][y] && a[x][y] != '#'){
						visited[x][y] = 1;
						distance[x][y] = distance[s.first][s.second]+1;
						maxi = max(maxi, distance[x][y]);
						q.push({x,y});
					}
				}
			}

		}
	}
	cout << maxi << "\n";
}

	


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

std::vector<bool> IsPrime;
void sieve(LL max){
    if(max+1 > IsPrime.size()){     // resizeで要素数が減らないように
        IsPrime.resize(max+1,true); // IsPrimeに必要な要素数を確保
    } 
    IsPrime[0] = false; // 0は素数ではない
    IsPrime[1] = false; // 1は素数ではない

    for(LL i=2; i*i<=max; ++i) // 0からsqrt(max)まで調べる
        if(IsPrime[i]) // iが素数ならば
            for(LL j=2; i*j<=max; ++j) // (max以下の)iの倍数は
                IsPrime[i*j] = false;      // 素数ではない
}


int main(){
    int N;cin >> N;
    sieve(55555);
    vector<int> num;
    rep(i,IsPrime.size())if(IsPrime[i])if(i % 5 == 1)num.push_back(i);
    rep(i,N)cout << num[i] << " ";
    cout << endl;
}



Measured memory_bytes: 256
N = int(input())
X = sorted([list(map(int, input().split())) for _ in range(N)], key=lambda x: (x[0], -x[1]))


front = []
most_left_R = float('inf')
for l, r in X:
    most_left_R = min(r, most_left_R)
    front.append(max(0, most_left_R - l + 1))

back = []
most_left_R = float('inf')
for l, r in X[::-1]:
    most_left_R = min(r, most_left_R)
    back.append(max(0, most_left_R - X[-1][0] + 1))
back = back[::-1]

ans = 0
for i in range(N - 1):
    ans = max(ans, front[i] + back[i + 1])

most_left_R = min([r for l, r in X])
for l, r in X:
    ans = max(ans, (r - l + 1) + max(0, most_left_R - X[-1][0] + 1))
print(ans)


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

struct node{
  unsigned int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

NodePointer nil;


NodePointer listSearch(int key)
{
  NodePointer x;
  for(x = nil->next;x != nil;x = x->next)
    {
      if(key == x->key)
	{
	  return x;
	}
    }
  return NULL;
}

void init()
{
  nil = malloc(sizeof(struct node));
  nil->next = nil;
  nil->prev = nil;
}

void printList(){
  NodePointer cur = nil->next;
  int isf = 1;
  while(1){
    if( cur == nil)
      {
	break;
      }
    if(isf == 0)
      {
	printf(" ");
      }
    printf("%d",cur->key);
    cur = cur->next;
    isf = 0;
  }
  printf("\n");
}

void deleteNode(NodePointer t)
{
  t->prev->next = t->next;
  t->next->prev = t->prev;
}

void deleteFirst()
{
  NodePointer t = nil->next;
  if(t == nil)
    {
      return;
    }
  deleteNode(t);
}

void deleteLast()
{
  NodePointer t = nil->prev;
  if(t == nil)
    {
      return;
    }
  deleteNode(t);
}

void delete(int key)
{
  NodePointer t;
  if(listSearch(key) == NULL)
    {
      return;
    }
  t = listSearch(key);
  deleteNode(t);
}

void insert(int key)
{
  NodePointer x;
  x = malloc(sizeof(struct node));
  x->key = key;

  x->next = nil ->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}


int main()
{
  int key,n,i;
  int size = 0;
  char com[20];
  int np = 0,nd = 0;
  scanf("%d",&n);
  init();
  for(i = 0;i < n;i++)
    {
      scanf("%s",com);
      if(com[0] == 'i')
	{
	  scanf("%d",&key);
	  insert(key);
	  np++;
	  size++;
	}
      else if (com[0] == 'd')
	{
	  if(strlen(com) > 6)
	    {
	      if(com[6] == 'F')
		{
		  deleteFirst();
		}
	      else if(com[6] == 'L')
		{
		  deleteLast();
		}
	    }
	  else
	    {
	      scanf("%d",&key);
	      delete(key);
	      nd++;
	    }
	  size--;
	}
    }
  printList();
  return 0;
}



Measured memory_bytes: 36072
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,x,n) for (int i = x; i < n; i++)
using ll = long long int;
int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A.at(i);
    sort(A.begin(),A.end());
    reverse(A.begin(),A.end());
    ll ans=0;
    rep(i,N) {
        if (i==0) continue;
        else if (i==1) ans += A.at(0);
        else ans += A.at(i/2);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3988
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

int ok(int x,ll k, vector<int> &a){
	int res = 0;
	rep(i, a.size()) {
		res += (a[i] - 1) / x;
	}
	return res <= k;
}

int main()
{
	int n, x, t;
	cin >> n >> x >> t;

	if(n % x == 0)
		cout << (n / x) * t << endl;
	else
		cout << ((n / x) + 1) * t << endl;

	int ans = 0, num = 0;


	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#define local
//if you find any bug in my code, please tell me.
typedef pair<int,int> p;
queue<p> q;
int main()
{
#ifdef local
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
#endif
    int x,t,i;
    cin>>x;
    t=2*x;
    for(i=sqrt(t); ; i++)
        if(i*(i-1)>=t) break;
    cout<<i-1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(){
  int n,*num,i,j,t,cnt=0;
  scanf("%d",&n);
  num = (int *)malloc(n * sizeof(int));
  for(i=0;i<n;i++)scanf("%d",&num[i]);
  
  for(i = 0; i < n-1 ; i++){
    for(j = n-1; j > i ; j --){
      if(num[j-1] > num[j]){
        t = num[j];num[j] = num[j-1];num[j-1] = t;
        cnt++;
       }
    }
  }
  for(i=0;i<n;i++){
    if(i == n-1){
      printf("%d",num[i]);
      break;
     }
     printf("%d ",num[i]);
  }
  /*
    i=0;
  while(i<n){
    if(i == n-1) printf("%d\n",num[i]);break;
    printf("%d",num[i]);
      i++;
      printf(" ");
  }
  */
 
  printf("\n%d\n",cnt);
  return 0;
}



Measured memory_bytes: 2104
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
 
 
    int n,x,y,mi,ma,mid,tmp;
    cin >> n >> x >> y;
    mi = min(x,y)-1;
    ma = max(x,y)-1;
    int diff = ma - mi;
    int ans[n-1];
    //ans初期化
    REP(i,n){
        ans[i] = 0;
    }

    REP(i,n){
        REP(j,i){
            tmp = min(abs(j-i), abs(mi-j)+1+abs(ma-i)); //距離
            if (tmp>=0 && tmp<=n-1){
                ans[tmp-1] += 1;
            } else {
                cout << "ERROR";
            }   
        }
    }
    
    REP(i,n-1){
        cout << ans[i] << endl;
    }
   
}


Measured memory_bytes: 256
n = int(input())
a = sorted(list(map(int,input().split())), reverse = True)
ans = 1

if 0 in a:
    print(0)
else:
    for i in range(n):
        ans *= a[i]
        if ans > 10**18:
            print(-1)
            exit()
    
    print(ans)

Measured memory_bytes: 84760
#include <cmath>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

int N;
int A[200010];
long B[200010];

long calc(int b) {

	long res = 0;
	for (int i = 0; i < N; i++) {
		res += abs(A[i] - (b + i+1));
	}

	return res;
}

int main() {
	
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		B[i] = A[i] - (i+1);
	}

	sort(B, B + N, greater<>());

	int b = B[N / 2];
	long res[3] = {calc(b), calc(b+1), calc(b-1)};

	cout << min(min(res[0], res[1]), res[2]) << endl;

	return 0;
}

Measured memory_bytes: 2560
n = int(input())
seq = list(map(int, input().split()))
q = int(input())
mlist = list(map(int, input().split()))
mins = min(seq)
sums = 0
for a in seq:
    sums += a

def check(i, m):
    global mins
    if m == 0:
        return True
    elif i >= n or mins > m:
        return False
    res = check(i+1, m) or check(i+1, m - seq[i])
    return res

for m in mlist:
    if (mins > m or sums < m):
        print('no')
    elif(check(0,m)):
        print('yes')
    else:
        print('no')


Measured memory_bytes: 5628
N = int(input())
nums = input().split()
mul = int(nums[0])
if str(0) in nums:
    mul = 0
else:
    for i in nums[1:]:
        mul *= int(i)
        if len(str(mul)) >= 19 and str(mul) != "1000000000000000000":
            mul = -1
            break
print(mul)

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define UNIQUE(c) sort(ALL(c)), c.erase(unique(ALL(c)), c.end())

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int N; cin >> N;
  vector<int> P(N), order(N);
  REP(i, N) cin >> P[i], P[i]--, order[P[i]] = i;

  std::multiset<int> bin_tree = {-1, -1, N, N};
  ll ans = 0;
  bin_tree.emplace(order[N-1]);
  for (int i = N-2; i >= 0; i--) {
    ll p = i+1;
    int idx = order[i];

    bin_tree.emplace(idx);
    auto it = bin_tree.lower_bound(idx);
    auto next_it = next(it), next_next_it = next(next_it);
    auto prev_it = prev(it), prev_prev_it = prev(prev_it);

    ll n_left, n_right;
    // it => left, next_it => right
    n_left = *it - *prev_it;
    n_right = *next_next_it - *next_it;
    ans += n_left * n_right * p;
    // prev_it => left, it => right
    n_left = *prev_it - *prev_prev_it;
    n_right = *next_it - *it;
    ans += n_left * n_right * p;
  }
  cout << ans << endl;

  return 0;
}


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

struct process{
	char name[10];
	int time;
	process* next;
	process* prev;
};

int main(){

	process job[100002];

	int timer = 0;
	int numOfJob;
	int quantum;
	
	cin >> numOfJob;
	cin >> quantum;
	
	
	for(int i = 1; i <= numOfJob; i++){
		cin >> job[i].name;
		cin >> job[i].time;
		job[i].next = &job[i + 1];
		job[i].prev =  &job[i - 1];
	}

	job[numOfJob].next = &job[1];
	job[1].prev = &job[numOfJob];

	process* cjob = &job[1];

	while(cjob->next != cjob){

		//cout<< cjob->prev->name << " <=prev= " << cjob->name << " =next=> " << cjob->next->name << endl;
		

		if(cjob->time > quantum){
			cjob->time -=  quantum;
			timer += quantum;
		}else{
			timer += cjob->time;
			cout << cjob->name << " " << timer << endl;
			cjob->prev->next = cjob->next;
			cjob->next->prev = cjob->prev;
		}
		cjob = cjob->next;

	}
	cout << cjob->name << " " << timer + cjob->time << endl;


	

	return 0;
}

Measured memory_bytes: 2736
//#include <bits/stdc++.h>
#include <vector>
//#include <stdio.h>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {


    // 配列
    vector<int> X(3); // int型の配列変数vecを宣言

    cin >> X.at(0) >> X.at(1) >> X.at(2);

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

    if ((X.at(0) == 5) && (X.at(1) == 5) && (X.at(2) == 7)) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }

}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <iomanip>
#include <string>
using namespace std;

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

	int x[5];
	int ans = 0;
	for (int i = 0; i < 5; i++) {
		cin >> x[i];
		if (x[i] == 0)ans = ++i;
	}

	cout << ans << endl;

	return 0;
}


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

typedef long long ll;
typedef pair<int, int> ii;

int main()
{
    int n;
    scanf("%d", &n);

    int mx = 0, ans = 0;
    for (int i = 0; i < n; i++) {
        int num;
        scanf("%d", &num);

        if (mx <= num)
            ans++;
        mx = max(mx, num);
    }
    printf("%d\n", ans);

    return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

class DDisjointSetOfCommonDivisors {
public:
vector<int64_t> factor(int64_t n){
    vector<int64_t> F;
    for (int64_t i = 1; i * i <= n; i++){
        if (i * i == n){
            F.push_back(i);
            break;
        }
        if (n % i == 0){
            F.push_back(i);
            F.push_back(n / i);
        }
    }

    return F;
}


vector<bool> hurui(int n){
    vector<bool> P(n + 1, true);
    P[0] = false;
    P[1] = false;

    for (int i = 2; i <= n; i++){
        if(!P[i])
            continue;
        for (int j = 2 * i; j <= n; j += i)
            P[j] = false;
    }

    return P;
}

void solve(std::istream& cin, std::ostream& cout) {
    int64_t a, b;
    cin >> a >> b;

    auto F = factor(a);
    auto G = factor(b);

    map<int64_t, int> H;
    set<int64_t> is_not_prime;
    is_not_prime.insert(1);

    for (auto &f: F)
        H[f]++;
    for (auto &g: G)
        H[g]++;


    int ans = 1;
    for (auto h: H){
        if (h.second < 2)
            continue;
        if (!is_not_prime.count(h.first)){
            for (auto &g: H){
                if (h.first == g.first)
                    continue;
                if (g.first % h.first == 0)
                    is_not_prime.insert(g.first);
            }
            ans++;
        }
    }


    cout << ans << endl;
}
};

int main() {
	DDisjointSetOfCommonDivisors solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1152
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <iostream>
#define INF 2000000000
using namespace std;
int main(){
  int N,M,a[51],b[51],c[51],d[51];
  scanf("%d %d",&N,&M);
  for(int i=1;i<=N;i++) scanf("%d %d",&a[i],&b[i]);
  for(int i=1;i<=M;i++) scanf("%d %d",&c[i],&d[i]);
  for(int i=1;i<=N;i++){
    int p=INF,num=1;
    for(int j=M;j>=1;j--){
      if(p>=abs(a[i]-c[j])+abs(b[i]-d[j])){
        p=abs(a[i]-c[j])+abs(b[i]-d[j]);
        num=j;
      }
    }
    printf("%d\n",num);
  }
  return 0;
}


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

//https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

//https://onlinejudge.u-aizu.ac.jp/solutions/problem/ALDS1_5_B/review/2709881/arsenic28/Rust
trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}

fn enum_divisors(n: usize) -> Vec<usize>{
    let mut res: Vec<usize> = Vec::new();
    let mut i = 1;
    while i*i <= n{
        if n % i == 0 {
            res.push(i);
            if n/i != i {
                res.push(n/i);
            }
        }
        i += 1;
    }
    res.sort();
    res
}

fn main() {
    let n: usize = read();
    let mut a: Vec<u64> = (0..n).map(|_| read()).collect();
    let mut balls = vec![0;n+1];
    let mut ans: Vec<usize> = Vec::new();
    a.insert(0, 0);

    for i in (1..=n).rev(){
        if a[i] != balls[i]%2 {
            ans.push(i);
            let divs = enum_divisors(i);
            for d in divs.into_iter(){
                balls[d] += 1;
            }

        }
    }
    
    println!("{}",ans.len());
    if ans.len() > 0 {
        println!("{}",ans.iter().join(" "));
    }

}


Measured memory_bytes: 13496
/*
 * @Author: RBQRBQ
 * @Date: 2020-04-02 17:25:22
 * @LastEditors: RBQRBQ
 * @LastEditTime: 2020-04-02 21:01:12
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef pair<int,int> pii;
namespace IO{
    template<typename T>inline void read(T &x){
        x=0;ll f=1;char ch=getchar();
        while(!isdigit(ch)){if(ch=='-')f=-f;ch=getchar();}
        while(isdigit(ch)){x=x*10+ch-48;ch=getchar();}
        x=x*f;
    }
}
using namespace IO;
ll a[100000+10];
ll n,m,v,p;
bool cmp(ll a,ll b)
{
    return (a>b);
}
bool judge(ll x)
{
    if(x<=p) return true;
    if(a[x]+m<a[p]) return false;
    if(p-1+n-x>=v) return true;
    ll sum=(p)*m+(n-x)*m;
    for(int i=p;i<=x-1;i++)
    sum+=a[x]+m-a[i];
    if(sum<m*v) return false;
    else return true;
}
int main()
{
    read(n),read(m),read(v),read(p);
    for(int i=1;i<=n;i++)
    {
        read(a[i]);
    }
    sort(a+1,a+n+1,cmp);
    ll l=0,r=n;
    while(l<r)
    {
        ll mid=(l+r+1)/2;
        if(judge(mid)) l=mid;
        else r=mid-1;
    }
    cout<<l;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define readInt(x) scanf("%d", &x)
#define readStr(x) scanf("%s", x)
#define rep(i, n) for(int i=0; i<(n); ++i)
#define write(x) cout << (x) << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1 << 28;
const int MAX = 1e5 + 10;

int N;
char s[300010];

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

    int totcnt = 0;
    rep(i, N) {
        if (s[i] == 'W') totcnt++;
    }

    int ans = INF;
    int cnt = 0;
    rep(i, N) {
        int newcnt = cnt + (s[i] == 'W');
        int sum = cnt + (N -1  - i - totcnt + newcnt);
        if (sum < ans) ans = sum;
        cnt = newcnt;
    }
    write(ans);
}

Measured memory_bytes: 512
# -*- coding: utf-8 -*-

N=int(raw_input())

a_num = 1
b_num = 1

for i in xrange(N):
        ratio_a, ratio_b = map(int,raw_input().split())

        base_n = max( (a_num - 1) // ratio_a + 1 , (b_num - 1 ) // ratio_b + 1)

        a_num = ratio_a * base_n
        b_num = ratio_b * base_n

print int(a_num + b_num)

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  int x, y, z;
  cin >> x >> y >> z;
  int ans = 0;
  x -= z;
  ans += x / (y + z);
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3624
n, k = map(int, input().split())
r, s, p = map(int, input().split())
T = list(input())

for i in range(k, n):
    if T[i] == T[i-k]:
        T[i] = 'x'

points = 0
for i in range(n):
    if T[i] == 'r':
        points += p
    elif T[i] == 's':
        points += r
    elif T[i] == 'p':
        points += s

print(points)

Measured memory_bytes: 4084
n = int(input())
x = input()

f = [-1] * (n+10)
f[0] = 0

for i in range(1, n+10):
    # python bitcount で見つけたこれを参考に https://ameblo.jp/316228/entry-10518720149.html
    f[i] = f[i % bin(i).count('1')] + 1

init_bitcount = x.count('1')
# Xを init_bitcount+1とinit_bitcount-1で割った余り

x_mod_01 = 0
for digit in x:
    x_mod_01 *= 2
    if digit == '1':
        x_mod_01 += 1
    x_mod_01 %= (init_bitcount+1)

if init_bitcount != 1:
    x_mod_10 = 0
    for digit in x:
        x_mod_10 *= 2
        if digit == '1':
            x_mod_10 += 1
        x_mod_10 %= (init_bitcount-1)

# print(x_mod_01, x_mod_10, init_bitcount)

power_mod_01 = [-1] * (n+10)
power_mod_01[0] = 1
for i in range(1, n+10):
    power_mod_01[i] = power_mod_01[i-1] * 2 % (init_bitcount + 1)

if init_bitcount != 1:
    power_mod_10 = [-1] * (n+10)
    power_mod_10[0] = 1
    for i in range(1, n+10):
        power_mod_10[i] = power_mod_10[i-1] * 2 % (init_bitcount - 1)


for i in range(n):
    if x[i] == '0':
        # 0→1
        first_residue = (x_mod_01 + power_mod_01[n - i - 1]) % (init_bitcount+1)
        print(f[first_residue] + 1)
    else:
        if init_bitcount == 1:
            # 立っているビットの数は0桁、つまりX_i = 0なのでf(X_i) = 0
            print(0)
            continue
        # 1→0
        first_residue = (x_mod_10 - power_mod_10[n - i - 1]) % (init_bitcount-1)
        print(f[first_residue] + 1)

# https://twitter.com/kyopro_friends/status/1281949470100353024
# https://atcoder.jp/contests/aising2020/editorial 公式
# 1回の操作で桁数以下に落ちることに注意すると、操作の繰り返しで急速に値が小さくなり、少ない回数で0に到着する。
# したがってfの表を作るのは今回不要。愚直にやってもできるので。初回の高速化だけが必要。


Measured memory_bytes: 26848
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD (long long)1000000007
#define INF (long long)998244353
using namespace std;

int main(void){
    long long n,k;
    cin >> n >> k;
    vector<int> a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    long long  sumk=0;
    long long sumj=0;
    if(k%2==0)sumk=k/2*(k+(long long)1);
    else sumk=(k+(long long)1)/2*k;
    sumj=sumk-k;
    sumj=sumj%MOD;
    sumk=sumk%MOD;
    long long ans=0;
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(i==j)continue;
            if(a[i]>a[j]){
                if(i>j)ans+=sumj;
                else ans+=sumk;
            }
        }
    }
    cout << ans%MOD << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <set>
#include <sstream>
#include <cmath>
#include <deque>
#include <list>
#include <bitset>
using namespace  std;
typedef pair<long long , long long> P;
typedef long long int64;
typedef long long lint;
#define REP(i, n) for(long long (i)=0; (i)<(n); ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define FST first
#define SND second

signed main(){
    int k;
    int A[5];
    REP(i, 5) cin >> A[i];
    cin >> k;
    int ans = 0;
    REP(i, 5){
        FOR(j, i, 5){
            if(abs(A[i]-A[j])>k){
                cout << ":(" << endl;
                return 0;
            } 
        }
    }
    cout << "Yay!" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define ll long long 
#define mp make_pair
#define pb push_back
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const long double PI = acos(-1.0);
const ll Mod=1000000007;
ll dp[101][5][5][5],n;
ll findans(ll pos,ll prev1,ll prev2,ll prev3)
{
    if(pos==n)
      return 1;
    if(dp[pos][prev1][prev2][prev3]!=-1)
      return dp[pos][prev1][prev2][prev3];
  ll  res=0;
  for(int curr=1;curr<=4;curr++)
  {
    if(prev2==1&&prev1==2&&curr==3)
      continue;
    if(prev2==1&&prev1==3&&curr==2)
      continue;
    if(prev2==3&&prev1==1&&curr==2)
      continue;
    if(prev3==1&&prev1==3&&curr==2)
      continue;
    if(prev3==1&&prev2==3&&curr==2)
      continue;

    res+=(findans(pos+1,curr,prev1,prev2)%Mod);
    res%=Mod;
  }
  return dp[pos][prev1][prev2][prev3]=res;
}
int main()
{
   //IOS;
  //#ifndef ONLINE_JUDGE
  //freopen("input.txt","r",stdin);
  //#endif
  

   ll ti,i,j;
   ti=1;
   
   while(ti>0)
   {
    cin>>n;

    
    memset(dp,-1,sizeof(dp));
    cout<<findans(0,0,0,0);
    ti--;
    }
  
  cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
}

Measured memory_bytes: 384
N, M, *LRD = map(int, open(0).read().split())

E = [[] for _ in range(N + 1)]
for l, r, d in zip(*[iter(LRD)] * 3):
    E[l].append((r, d))
    E[r].append((l, -d))

visited = [False] * (N + 1)
D = [0] * (N + 1)
for i in range(1, N + 1):
    if visited[i]:
        continue

    S = [i]
    while S:
        v = S.pop()
        for u, d in E[v]:
            if not visited[u]:
                visited[u] = True
                D[u] = D[v] + d
                S.append(u)

            elif D[u] != D[v] + d:
                print("No")
                quit()

print("Yes")

Measured memory_bytes: 70972
n,k = map(int, input().split())
sunuke = []
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    sunuke.append(a)
count_lst=[]
for j in sunuke:
    for a in range(1,n+1):
        if a in j:
            count_lst.append(a)
count=0
for z in range(1, n+1):
    if z not in count_lst:
        count+=1

print(count)

Measured memory_bytes: 9232
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define mkp(a, b) make_pair(a, b)
#define pb(t) push_back(t)
#define ft first
#define sc second
#define pt(num) cout << num << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define INF 1000000000000000000
#define MOD 1000000007LL
#define MAX 101010
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;




int main(void) {
    ll N, M;
    cin >> N >> M;
    ll i;
    P p[MAX];
    
    for(i=0; i<M; i++) {
        cin >> p[i].sc >> p[i].ft;
        p[i].ft--; p[i].sc--;
    }
    sort(p, p+M);
    
    ll ans=0;
    ll t=-1;
    for(i=0; i<M; i++) {
        if(t<p[i].sc) {
            ans++;
            t=p[i].ft-1;
        }
    }
    pt(ans);

}



Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

using ll = long long;
using Pr = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

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

ll N;
ll P[250010];
ll h[250010];
bool used[250010];

ll bfs( ll i, ll j ) {
  ll ret = h[i*N+j];
  ll nh = h[i*N+j]+used[i*N+j];

  rep( d, 4 ) {
    ll ni = i+dy[d], nj = j+dx[d];

    if( ni < 0 || ni >= N || nj < 0 || nj >= N )
      continue;

    if( nh < h[ni*N+nj] ) {
      h[ni*N+nj] = nh;
      bfs( ni, nj );
    }
  }

  return ret;
}

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

  rep( i, N*N )
    std::cin >> P[i], --P[i];

  rep( i, N*N ) {
    ll r = i/N, c = i%N;

    h[i] = std::min( { r, N-r-1, c, N-c-1 } );
    used[i] = true;
  }

  ll ans = 0;

  rep( i, N*N ) {
    ll r = P[i]/N;
    ll c = P[i]%N;

    used[r*N+c] = false;
    ans += bfs( r, c );
  }

  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 27108
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long ll;
typedef vector<vector<int>> Graph;
Graph G(100010);
int room[100010] = { };
int main() {
  int n, m, a, b;
  cin >> n >> m;
  rep(i,m)
  {
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  room[1] = 1;
  queue<int> q;
  q.push(1);
  int cnt = 0;
  while (!q.empty()) {
    int c = q.front();
    q.pop();
    rep(i,G[c].size())
    {
      if (room[G[c][i]] == 0) {
        room[G[c][i]] = c;
        q.push(G[c][i]);
        cnt++;
      }
    }
  }
  if (cnt != n - 1) {
    cout << "No";
  } else {
    cout << "Yes" << endl;
    for (int i = 2; i <= n; i++)
      cout << room[i] << endl;
  }
}

Measured memory_bytes: 10368
/*           pmaik
    ░▒▓█►─═ Maneesh ═─◄█▓▒░


          ( •̪●)
        ███████]▄▄▄▄▄▄▄▄▃  ▃  ▃ 
    ▂▄▅█████████▅▄▃▂
   [███████████████████]
  ...◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤......  */

#include<bits/stdc++.h>
using namespace std;
#define inf() ifstream cin("in00.txt")
#define onf() ofstream cout("out00.txt")
#define ll long long int
#define pb push_back
#define pf push_front
#define mp make_pair
#define pii pair<ll,ll>
#define fi first
#define se second
#define M 1000000007
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL);

pair<ll,ll> maxx(ll a, ll b, ll c)
{
	pair<ll,ll>p;
	if(a>b && a>c)
	{
		p.first=0;
		if(b>=c)
			p.second=1;
		else
			p.second=2;
	}
	else if(b>a && b>c)
	{
		p.first=1;
		if(a>=c)
			p.second=0;
		else
			p.second=2;
	}
	else// if(c>=a && c>=b)
	{
		p.first=2;
		if(a>=b)
			p.second=0;
		else
			p.second=1;
	}

	return p;
}

void solve()
{
	ll n;
	cin>>n;
	ll i,a[n+1][3];
	for(i=1; i<=n; i++)
		cin>>a[i][0]>>a[i][1]>>a[i][2];

	ll dp[n+1][3],res;
	dp[1][0]=a[1][0];
	dp[1][1]=a[1][1];
	dp[1][2]=a[1][2];

	for(i=2; i<=n; i++)
	{
		dp[i][0]=a[i][0]+max(dp[i-1][1], dp[i-1][2]);
		dp[i][1]=a[i][1]+max(dp[i-1][0], dp[i-1][2]);
		dp[i][2]=a[i][2]+max(dp[i-1][0], dp[i-1][1]);
	}

	res=max(dp[n][0], max(dp[n][1], dp[n][2]));
	cout<<res<<endl;
}

int main()
{
    fastio;

    solve();

    return 0;
}


Measured memory_bytes: 8332
/*
	Created by : imay_10
	" It won't be EASY, but I'll make it "
*/

#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;
const int mod = 1e9+7;
const ll inf = 1e18;
const double pi = 3.1415926535897932384626;

// Utility for fast exponentiation
ll mpow(ll a,ll b,ll m){
    ll res=1;
    //a%=m;
    while(b){
    	if(b%2) res=res*a%m;
		a=a*a%m;
		b/=2;
	}
	return res;
}

// Utility for modular inverse
ll inv(ll a,ll m){
	return mpow(a,m-2,m);
}

// Utility for GCD Calculation
ll gcd(ll a,ll b){
	if(b==0) return a;
	return gcd(b,a%b);
}

// Utility for binomial coefficient
ll ncr(ll n,ll k)
{
    if(n<k)
        return 0;
    ll C[n + 1][k + 1];
    ll i,j;
    for(i=0;i<=n;i++){
        for(j=0;j<=min(i,k);j++){
            if (j==0 || j==i)
                C[i][j]=1;
            else
                C[i][j]=(C[i-1][j-1]+C[i-1][j])%mod;
        }
    }
    return C[n][k];
}

void solve(){
	//code
	ll n,m1=INT_MIN,m2=INT_MAX,m3=INT_MIN,m4=INT_MAX;
	cin>>n;
	ll x[n],y[n];
	for(int i=0;i<n;i++){
		cin>>x[i]>>y[i];
		m1=max(m1,x[i]+y[i]);
		m2=min(m2,x[i]+y[i]);
		m3=max(m3,x[i]-y[i]);
		m4=min(m4,x[i]-y[i]);
	}
	cout<<max((m1-m2),(m3-m4));	
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	solve();
 	return 0;
}


Measured memory_bytes: 6700
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)
using Graph = vector<vector<int>>;

int main(){
    int n;
    cin>>n;
    Graph G(n);
    for(int i=0;i<n-1;i++){
        G[i].push_back(i+1);
        G[i+1].push_back(i);
    }
    int x,y;
    cin>>x>>y;
    G[x-1].push_back(y-1);
    G[y-1].push_back(x-1);

    vector<int> ans(n);

    for(int i=0;i<n;i++){
        vector<int> dist(n,-1);
        queue<int> que;

        dist[i] = 0;
        que.push(i);

        while(!que.empty()){
            int v = que.front();
            que.pop();

            for(int nv : G[v]){
                if(dist[nv] != -1) continue;
                //if(nv < i) continue;

                dist[nv] = dist[v] + 1;
                que.push(nv);

                ans[dist[nv]]++;
                //if(dist[nv] == 3) cout<<i<<" "<<nv<<endl;
            }
        }
    }

    for(int i=1;i<n;i++) cout<<ans[i]/2<<endl;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n;
    cin>>n;
    int a[101]={};
    REP(i,n) cin>>a[i];
    int cnt=0;
    bool flg=true;
    while(flg){
        flg=false;
        FORR(i,1,n){
            if(a[i]<a[i-1]){
                swap(a[i],a[i-1]);
                flg=true;
                cnt++;
            }
        }
    }

    REP(i,n){
        cout<<a[i];
        if(i==n-1) cout<<endl;
        else cout<<" ";
    }
    cout << cnt << endl;
    return 0;
}


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

int main(void)
{
    char grade[5] = {'A', 'B', 'C', 'D', 'F'};
    while(1) {
        int m,f,r, i;
        cin >>m>>f>>r;
        if(m==-1&&r==-1&&f==-1) break;
        if(m==-1||f==-1) i = 4;
        else if(m+f>=80) i = 0;
        else if(m+f>=65) i = 1;
        else if(m+f>=50) i = 2;
        else if(m+f>=30) {
            i = 3;
            if(r>=50) i = 2;
        }
        else i = 4;
        printf("%c\n",grade[i]);
    }
}


Measured memory_bytes: 3144
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve(){
  ll n, k;
  cin >> n >> k;
	for(ll i = k-n+1; i<k+n; i++)
		cout << i << " ";
		
		cout << endl;
}
int main()
{
		    ios_base::sync_with_stdio(false);
			cin.tie(NULL);
	int t = 1; 
	//cin >> t;
	while(t--)
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

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

	        for(int i=n-1;i>0;i--) {
	        		System.out.print(a[i]+" ");
	        		}
	        System.out.println(a[0]);
	    }
	}


Measured memory_bytes: 26256
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define sc second
#define forn(i,n) for(ll i = 1;i<=n;++i)
#define pb push_back
#define endl '\n'
#define po(x) (1ll<<x)
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> pp;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> satan_set;
const ll DIM = 100+7;
const ll INF = 10E16;
ll prime(ll x){
    ll sq = sqrt(x);
    for(ll i = 2;i<sq;++i)if (x%i==0)return 0;
    return 1;
}
int main()
{
    //freopen("input.txt","r",stdin);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll x; cin>>x;
    for(ll i = x;i<=INF;++i){
        if (prime(i)){
            cout<<i<<endl;
            return 0;
        }
    }
    return 0;
}

// 1 2 3
//


Measured memory_bytes: 256
n, m = map(int, input().split())
h = list(map(int, input().split()))
l = [True] * (n + 1)
l[0] = False
for _ in range(m):
  a, b = map(int, input().split())
  if h[a-1] > h[b-1]:
    l[b] = False
  elif h[a-1] == h[b-1]:
    l[a] = False
    l[b] = False
  elif h[a-1] < h[b-1]:
    l[a] = False
ans = 0
for i in range(1, n+1):
  if l[i]:
    ans += 1
print(ans)

Measured memory_bytes: 20024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

int main() {
    string s;
    cin >> s;

    int cnt = 0;
    int ans = s.size();
    for(int i = 0; i < s.size(); i++){
        if(s[i]=='S'){
            cnt++;
        }
        if(s[i]=='T' && cnt>0){
            ans -= 2;
            cnt--;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define N 100005
int n,m,c,fa[N],sz[N];vector<int> e[N];
void clear() {for(int i=1;i<=n;++i) fa[i]=i,sz[i]=1;}
int rt(int x) {return x==fa[x]?x:fa[x]=rt(fa[x]);}
void merge(int x,int y) {x=rt(x);y=rt(y);if(x!=y) fa[x]=y,sz[y]+=sz[x];}
int main()
{
	scanf("%d %d %d",&n,&m,&c);clear(); 
	for(int i=1,x,y;i<=m;++i) scanf("%d %d",&x,&y),e[x].push_back(y),e[y].push_back(x),merge(x,y);
	for(int i=1,x,y;i<=c;++i) scanf("%d %d",&x,&y),e[x].push_back(y),e[y].push_back(x);
	for(int i=1,res;i<=n;++i)
	{
		res=sz[rt(i)]-1;
		for(int j=0;j<e[i].size();++j) if(rt(i)==rt(e[i][j])) --res;printf("%d ",res);
	}return 0;
}

Measured memory_bytes: 8696
#[derive(PartialEq, Eq)]
pub struct Reverse<T>(pub T);

impl<T: PartialOrd> PartialOrd for Reverse<T> {
    #[inline]
    fn partial_cmp(&self, other: &Reverse<T>) -> Option<Ordering> {
        other.0.partial_cmp(&self.0)
    }

    #[inline]
    fn lt(&self, other: &Self) -> bool {
        other.0 < self.0
    }
    #[inline]
    fn le(&self, other: &Self) -> bool {
        other.0 <= self.0
    }
    #[inline]
    fn gt(&self, other: &Self) -> bool {
        other.0 > self.0
    }
    #[inline]
    fn ge(&self, other: &Self) -> bool {
        other.0 >= self.0
    }
}

impl<T: Ord> Ord for Reverse<T> {
    #[inline]
    fn cmp(&self, other: &Reverse<T>) -> Ordering {
        other.0.cmp(&self.0)
    }
}

#[derive(Debug, Clone, Copy)]
struct Edge {
    cost: usize,
    node: usize,
}

#[derive(Debug, Clone, Copy)]
struct State {
    dist: usize,
    position: usize,
}

fn shortest_path(adjl: &Vec<Vec<Edge>>, start: usize) -> Vec<usize> {
    let mut dist = vec![INF; adjl.len()];
    let mut que: BinaryHeap<(Reverse<usize>, usize)> = BinaryHeap::new();
    que.push((Reverse(0), start));
    while let Some((Reverse(c), node)) = que.pop() {
        if dist[node] < c {
            continue;
        }
        dist[node] = c;
        for next in &adjl[node] {
            if c + next.cost < dist[next.node] {
                que.push((Reverse(c + next.cost), next.node));
            }
        }
    }
    dist
}

fn solve() {
    let (v, e, start): (usize, usize, usize) = (read::<usize>(), read::<usize>(), read::<usize>());
    let mut adjl = vec![vec![]; v];
    for _ in 0..e {
        let (s, t, cost): (usize, usize, usize) =
            (read::<usize>(), read::<usize>(), read::<usize>());
        adjl[s].push(Edge { cost, node: t });
    }
    // println!("{:?}", adjl);
    for d in shortest_path(&adjl, start) {
        if d == INF {
            println!("INF");
        } else {
            println!("{}", d);
        }
    }
}

fn main() {
    let stack_size = 104_857_600;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min, Ord, Ordering, PartialOrd};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;
const INF: usize = std::usize::MAX;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========



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

#define pb(n) push_back(n)
#define fi first
#define se second
#define X real()
#define Y imag()
#define value(x,y,w,h) (x >= 0 && x < w && y >= 0 && y < h)
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using comd = complex<double>;
using pii = pair<int,int> ;

constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};
const int MAX_N = 1048576;

int n;
pii dat[2*MAX_N - 1];

void init(int n_){
  n = 1;
  while(n < n_){
    n *= 2;
  }
  int tmp = n;
  for(int i =0; i < tmp-1;++i){
    dat[i] = make_pair(0,0);
  }
}

void update(int k, int a){
  k += n-1;
  dat[k] = make_pair(a,k);
  while(k>0){
    k = (k-1)/2;
    if(dat[k*2+1].fi > dat[k*2+2].fi){
      dat[k] = dat[k*2+1];
    }
    else if(dat[k*2+1].fi == dat[k*2+2].fi){
      dat[k] = make_pair(dat[k*2+1].fi,min(dat[k*2+1].se,dat[k*2+2].se));
    }
    else{
      dat[k] = dat[k*2+2];
    }
  }
}

int query(int a,int b,int k,int l, int r){
  if(r <= a || b <= l){
    return 0;
  }
  if(a <= l && r <= b){
    return dat[k].fi;
  }
  else{
    int vl = query(a,b,k*2+1,l,(l+r)/2);
    int vr = query(a,b,k*2+2,(l+r)/2,r);
    return max(vl,vr);
  }
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N,q,a,v;
  cin >> N >> q;
  init(N);
  rep(i,q){
    cin >> a >> v;
    --a;
    update(a,v+dat[a+n-1].fi);
    //ans
    cout << dat[0].se-n+2 << " " << dat[0].fi << endl;
  }
  return 0;
}

Measured memory_bytes: 19112
#include <iostream>
    #include <cstring>
    #include <vector>
    #include <set>
    #include <map>
    #include <sstream>
    #include <cstdio>
    #include <algorithm>
    #include <stack>
    #include <queue>
    #include <cmath>
    #include <iomanip>
    #include<fstream>
    //#include <bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    const ll INF = (1 << 30);
    const ll inf = (1LL << 60LL);
    const ll maxn = 2e5 + 5;
    const int MOD = 1e9 + 7;
    ll a, b;
    ll f(ll n){
        if(n % 4LL == 0LL){
            return n;
        }
        if(n % 4LL == 1LL){
            return 1LL;
        }
        if(n % 4LL == 2LL){
            return n + 1;
        }
        if(n % 4LL == 3LL){
            return 0;
        }
        return -1;
    }
    int main(int argc, const char * argv[]) {
        ios_base::sync_with_stdio(false);
        cin >> a >> b;
        ll ret = f(b);
        ll ret2 = f(max(0LL, a - 1));
        if(a == b) return 0 * printf("%lld\n", a);
        cout << (ret ^ ret2) << endl;
        return 0;
    }


Measured memory_bytes: 256