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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define BIT(bit,a,n) for (int bit = a;bit < (1<<n);bit++) // {0, 1, ..., n-1} の部分集合の全探索 // n番目のフラグが立っている状態は (1<<n)

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20

typedef long long ll;
using namespace std;

int n,a,b;
int cnt = 0;
int main() {
    scanf("%d%d%d",&n,&a,&b);

    rep(i,1,n+1){
        int c = i;
        int sum = 0;
        while(c != 0){
            sum += c%10;
            c /= 10;
        }
        if(a <= sum && sum <= b) cnt += i;
    }
    pout(cnt);
    return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#define int long long
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define itr(i,x) for(auto i=(x).begin();i!=(x).end();++i)
#define All(x) (x).begin(),(x).end()
#define gridif(a,x,b) if((a)<=(x)&&(x)<(b))

using namespace std;
using Graph = vector<vector<int>>;
typedef pair<int,int> P;
const int mod=1000000007;

int digitsum(int n,int b){
	if(b<2) return -1;
	if(n<b) return n;
	return digitsum(n/b,b)+n%b;
}
int mpow(int a,int x);
int m_inv(int n);
vector<int> split(int n,int a);
string xal_number(int n,int x);
int gcd(int x,int y){return y?gcd(y,x%y):x;}
int lcm(int x,int y){return x*y/gcd(x,y);}
class Factorial{
private:
	vector<int> fac;
public:
	Factorial(int N){
		fac.push_back(1);
		rep(i,N) fac.push_back(fac[i]*(i+1)%mod);
	}
	int fact(int a){return fac[a];}
	int ifac(int a){return m_inv(fac[a]);}
	int cmb(int n,int r);
};
struct UnionFind {
    vector<int> par; // 親ノード
    UnionFind(int n = 1) { init(n);}
    void init(int n = 1) {
        par.resize(n);
        rep(i,n) par[i] = -1;
    }
    int root(int x) {
        if (par[x] <0) return x;
        else return par[x] = root(par[x]);      
    }
    int size(int x){ return -par[root(x)];}
    bool issame(int x, int y) {return root(x)==root(y);}
    bool connect(int x, int y);
};

signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(b-a==c-b) cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, n) for (int i = (a); i < (n); i++)
#define repb(i, n) for (int i = (n - 1); i >= 0; i--)
#define repb2(i, a, n) for (int i = (n - 1); i >= (a); i--)
#define all(x) x.begin(), x.end()
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define pb push_back
#define mp make_pair
#define fir first
#define sec second

int main() {
    int N, Q;
    int l, r;
    string S;
    cin >> N >> Q >> S;
    vector<int> ans(N, 0);
    rep(i, N) {
        if (i != 0) {
            ans[i] = ans[i - 1];
        }
        if (S[i] == 'A' && S[i + 1] == 'C') {
            ans[i]++;
        }
    }
    rep(i, Q) {
        cin >> l >> r;
        co(ans[r - 2] - ans[l - 2]);
    }
    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define int long long
using namespace std;

int X, Y, Z, A, B, C, N, ans[1005];

void cal(int x, int y, int z, int origin){
  
  int i = 0, j = 0;
  int cnt[1005] = {};
  int ori = origin % N;
  
  while(1){
    
    int len = min( y - i - 1, j ) + 1;
    
    cnt[ori] += len;
    
    ori = ( ori + 1 ) % N;
    
    if( j == x - 1 ){
      
      if( i == y - 1 ) break;
      else i++;
      
    }else j++;
    
  }
  
  for(int l=0;l<N;l++){
  
    for(int k=0;k<N;k++){
      
      int L = z - k;
      
      if( L <= 0 ) break;
      
      int target = ( l + k ) % N;
      
      ans[target] += ( L / N + ( L % N != 0 ) ) * cnt[l];
      
    }
    
  }
  
}

void check(int x, int y, int z, int origin){
  
  if( x <= 0 || y <= 0 || z <= 0 ) return;
  
  cal( x, y, z, origin );
  
}

signed main(){
  
  cin>>X>>Y>>Z>>A>>B>>C>>N;
  
  check( X - A, Y - B, Z - C, 0 );
  
  check( X - A, B, Z - C, 1 );
  
  check( A, B, Z - C, 2 );
  
  check( A, Y - B, Z - C, 1 );
  
  check( X - A, Y - B, C, 1 );
  
  check( X - A, B, C, 2 );
  
  check( A, B, C, 3 );
  
  check( A, Y - B, C, 2 );
  
  for(int i=0;i<N;i++){
    if(i) cout<<' ';
    cout<<ans[i];
  }
  
  cout<<endl;
  
  return 0;
}



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

#define COUT(x) cout << #x << " = " << (x) << ", "
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
typedef long long ll;
const int MOD = 1000000007;

int main(){
  int H,W,D;
  cin >> H >> W >> D;
  vector<pair<int,int>> Grid(H*W+1);
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      int a;
      cin >> a;
      Grid[a].first = i + 1;
      Grid[a].second = j + 1;
    }
  }
  vector<ll> Sum(H*W+1);
  for(int i = 1; i <= H*W; i++){
    if(i <= D){
      Sum[i] = 0;
    }else{
      Sum[i] = Sum[i-D] + abs(Grid[i].first - Grid[i-D].first) + abs(Grid[i].second - Grid[i-D].second);
    }
  }
  int Q;
  cin >> Q;
  for(int i = 0; i < Q; i++){
    int l,r;
    cin >> l >> r;
    int res = Sum[r] - Sum[l];
    cout << res << endl;
  }
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second
 
const int mx=100010;
const ll mod=1e9+7;


int main(){
  string s;
  cin >> s;
  rep(i,3){
    if(s[i]=='9'){ s[i]='1'; } else { s[i]='9'; }
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
require 'tsort'
class Hash
    include TSort
    alias tsort_each_node each_key
    def tsort_each_child(node, &block)
        (self[node] || []).each(&block)
    end
end
n = gets.to_i
g = {}
n.times do
    i, op, j = gets.chomp.split
    if op == 'lock'
        (g[?d + j] ||= []) << ?u + i
    else
        (g[?u + i] ||= []) << ?d + j
    end
end
begin
    g.tsort
    puts 0
rescue
    puts 1
end


Measured memory_bytes: 9692
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    l=list(map(int,input().split()))
    wa=sum(l)
    lgu=l[1::2]
    yama1=wa-2*sum(lgu)
    pre=yama1
    print(pre,end=' ')
    for i in range(n-1):
        nextyama=2*l[i]-pre
        pre=nextyama
        print(nextyama,end=' ')
    print()
resolve()

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

list=[]
for i in range(100):#cakes
    for j in range(100):#donuts
        cost=4*i+7*j
        if cost<=100:
            list.append(cost)

ans=0
for i in range(len(list)):
  if n==list[i]:
    ans=1
    
print('Yes' if ans==1 else 'No')



Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
ll h;
ll a[100001],b[100001];

bool C(ll v){
	if(a[n-1]*v>=h)return true;
	ll sum=a[n-1]*v;
	for(int i=0;i<min(n,(int)v);i++){
		sum-=a[n-1];
		sum+=b[n-1-i];
		if(sum>=h)return true;
	}
	return false;
}

int main(void){
	scanf("%d%lld",&n,&h);
	for(int i=0;i<n;i++){
		scanf("%lld %lld",&a[i],&b[i]);
	}
	sort(a,a+n);
	sort(b,b+n);
	ll l=-1,r=h;
	while(l+1<r){
		ll mid=(l+r)/2LL;
		if(C(mid))r=mid;
		else l=mid;
	}
	printf("%lld\n",r);
	return 0;
}

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

using namespace std;
using lli = long long int;

int main() {
    lli x;
    cin >> x;

    lli ans = 0;

    lli tmp = x / 11;

    if (x - 11 * tmp == 0) {
        ans = 2*tmp;
    } else if (x - 11 * tmp <= 6) {
        ans = 2 * tmp + 1;
    } else {
        ans = 2 * tmp + 2;
    }

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

Measured memory_bytes: 888
#include "bits/stdc++.h"
using namespace std;
const int N = 2e5 + 5;
int n , m;
int l[N] , r[N];
vector < int > v[N];
priority_queue < int > pq;
int cnt[N];
bool check(int val){
	while(!pq.empty()){
		pq.pop();
	}
	for(int i = 0 ; i <= m + 1 ; ++i){
		cnt[i] = 0;
	}
	int tot = 0;
	int mx = 0;
	for(int i = 0 ; i <= m ; ++i){
		tot += i ? 1 : val;
		for(int r : v[i]){
			pq.push(-r);
		}
		while(pq.size() > tot){
			++cnt[-pq.top()];
			pq.pop();
		}
	}
	mx = pq.size();
	if(cnt[m + 1]){
		return 0;
	}
	tot = 0;
	int s = 0;
	for(int i = m ; i >= 1 ; --i){
		s += cnt[i];
		++tot;
		if(s > tot){
			return 0;
		}
	}
	s = m - s;
	return mx <= val + s;
}
int main(){
	scanf("%d %d" , &n , &m);
	for(int i = 1 ; i <= n ; ++i){
		scanf("%d %d" , l + i , r + i);
		v[l[i]].emplace_back(r[i]);
	}
	int l = 0;
	int r = n;
	while(l < r){
		int mid = l + r >> 1;
		if(check(mid)){
			r = mid;
		}
		else{
			l = mid + 1;
		}
	}
	printf("%d\n" , l);
}

Measured memory_bytes: 12028
#include <ios>
#include <iostream>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>
#include <iomanip>

typedef long long ll;

using namespace std;

int main() {
    int N;
    cin >> N;
    vector<pair<int, int>> a(N);
    vector<int> order(N);
    for (int i = 0; i < N; i++) {
        int x, y;
        cin >> x >> y;
        a[i] = make_pair(x, y);
        order[i] = i;
    }

    double total = 0;
    ll count = 0;
    do {
        for (int i = 1; i < N; i++) {
            int x1 = a[order[i - 1]].first;
            int y1 = a[order[i - 1]].second;
            int x2 = a[order[i]].first;
            int y2 = a[order[i]].second;
            total += sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
        }
        count++;
    } while (next_permutation(order.begin(), order.end()));
    cout << fixed << setprecision(10) << total / count << endl;
    return 0;
}



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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
//const ull mod = 1e9 + 7;
const ll mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
  os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
  for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}

// conversion number to bit
string num2bit(ll num, ll len){
  string bit = "";
  REP(i, len){
    bit += char('0'+(num>>i & 1));
  }
  return bit;
}

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

    ll N;
    cin >> N;
    vector<ll> P(N);
    REP(i, N) cin >> P[i];
    ll mi = (1ll<<60);
    ll res = 0;
    REP(i, N){
    	if(mi>P[i]) res++;
    	mi = min(mi, P[i]);
    }
    cout << res << endl;
    return 0;
}

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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {
    ll N, K;
    cin >> N >> K;
    vector<ll> H(N);
    REP(i, N) cin >> H[i];

    sort(H.begin(), H.end());
   
    ll ans = 0;
    for (int i = 0; i < N-K; i++) {
        ans += H[i];
    }
    print(ans);
}

signed main() {
    solve();
}


Measured memory_bytes: 1792
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (true) {
            int a = scanner.nextInt();
            if (a == 0)
                break;
            double sum = 0;
            int[] b = new int[a];
            for (int i = 0; i < a; i++) {
                b[i] = scanner.nextInt();
                sum += b[i];
            }
            double m = sum / a;
            double aa = 0;
            for (int i = 0; i < a; i++) {
                aa += Math.pow(b[i] - m, 2) / a;
            }
            System.out.println(Math.sqrt(aa));
 
        }
 
    }
}


Measured memory_bytes: 31724
N, M = map(int, input().split())
student = [list(map(int, input().split())) for i in range(N)]
check = [list(map(int, input().split())) for i in range(M)]

tmp = []
for i in range(len(student)):
    for j in range(len(check)):
        x = abs(student[i][0] - check[j][0])
        y = abs(student[i][1] - check[j][1])
        tmp.append(x+y)
    print(tmp.index(min(tmp))+1)
    tmp = []

Measured memory_bytes: 9168
#include<stdio.h>
#include<vector>
#define F() {\
if(i==0) printf("%s%d",x++?" ":"",v[i]);\
else printf("%s%d-%d",x++?" ":"",v[0],v[i]);\
v.erase(v.begin(),v.begin()+i+1);\
	i=0;}
int main()
{
	int n,i,x;
	while(scanf("%d",&n),n)
	{
		std::vector<int> v(n);
		for(i=0;i<n;++i)scanf("%d",&x),v[i]=x;
		for(x=i=0;i<v.size()-1;)
		{
			if(v[i]+1!=v[i+1]){F()}
			else ++i;
		}
		if(v.size())F();
		puts("");
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
struct Node {
  int key;
  Node *parent = nullptr, *left = nullptr, *right = nullptr;
};
void insert(Node *root, int key) {
  auto x = root;
  auto *parent = x->parent;

  while (x != nullptr) {
    parent = x;
    if (x->key > key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }

  if (parent->key > key) {
    parent->left = new Node{key, parent, nullptr, nullptr};
  } else {
    parent->right = new Node{key, parent, nullptr, nullptr};
  }
}
bool find_bitree(Node *root, int key) {
  Node *parent = nullptr;
  auto x = root;

  while (x != nullptr) {
    parent = x;
    if (x->key == key) {
      return true;
    } else if (x->key > key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  return false;
}

Node *getSuccessor(Node *z) {
  Node *successor = z->right;
  while (successor->left != nullptr) {
    successor = successor->left;
  }

  return successor;
}
void delete_key(Node *root, int key) {
  Node *parent = nullptr;
  auto z = root;
  while (z->key != key) {
    parent = z;
    if (z->key > key) {
      z = z->left;
    } else {
      z = z->right;
    }
  }

  Node *to_delete, *child;
  if (z->left == nullptr || z->right == nullptr) {
    to_delete = z;
  } else {
    to_delete = getSuccessor(z);
    z->key = to_delete->key;
  }

  if (to_delete->left != nullptr) {
    child = to_delete->left;
  } else {
    child = to_delete->right;
  }

  if (child != nullptr) {
    child->parent = to_delete->parent;
  }

  to_delete->parent->left == to_delete ? to_delete->parent->left = child
                                       : to_delete->parent->right = child;
  // delete to_delete;
}
void printNodePreOrder(Node *root) {
  if (root == nullptr) return;
  cout << ' ' << root->key;
  printNodePreOrder(root->left);
  printNodePreOrder(root->right);
}
void printNodeInOrder(Node *root) {
  if (root == nullptr) return;
  printNodeInOrder(root->left);
  cout << ' ' << root->key;
  printNodeInOrder(root->right);
}
int main() {
  string op;
  int m, k;
  Node *root = nullptr;
  cin >> m;
  for (size_t i = 0; i < m; i++) {
    cin >> op;
    if (op == "insert") {
      cin >> k;
      if (root == nullptr) {
        root = new Node{k};
      } else {
        insert(root, k);
      }

    } else if (op == "print") {
      printNodeInOrder(root);
      cout << endl;
      printNodePreOrder(root);
      cout << endl;
    } else if (op == "find") {
      cin >> k;
      if (find_bitree(root, k)) {
        cout << "yes" << endl;
      } else {
        cout << "no" << endl;
      }
    } else if (op == "delete") {
      cin >> k;
      delete_key(root, k);
    }
  }
}



Measured memory_bytes: 21804
import java.util.Arrays;
import java.util.Scanner;
 
class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = sc.nextInt();
		int[] m = new int[n];
		int cnt = n;
		for(int i = 0;i < n;i++){
			m[i] = sc.nextInt();
		}
		for(int i : m){
			x -= i;
		}
		Arrays.sort(m);
		
		System.out.println((int)(cnt+Math.floor(x/m[0])));
	}
}


Measured memory_bytes: 23252
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
int n, m, k;
int cnt[N];
string s;
int a[N];
vector < int > g[N];
int u[N];

int col = 0;
void dfs (int v, int par = 0) {
	u[v] = 1;
	a[v] = par;

	queue < int > q;
	q.push(1);

	while(sz(q)) {
		v = q.front();
		++col;
		q.pop();
		for (auto to : g[v]) if (!u[to]) {
			u[to] = 1;
			q.push(to);
			a[to] = v;
		}
	}
}

int main () {
	SpeedForce;
	cin >> n >> m;
	For (i, 1, m) {
		int l, r;
		cin >> l >> r;
		g[l].pb(r);
		g[r].pb(l);
	}

	dfs(1);
	if(col != n) {
		cout << "No\n";
		exit(0);
	}
	cout << "Yes\n";
	For (i, 2, n) cout << a[i] << '\n';
	//cout << '\n';


	return Accepted;
}

// B...a

Measured memory_bytes: 22744
#include <bits/stdc++.h>
#define rep(i,a) for(int i=0;i<int(a);++i)
#define REP(i,a,b) for(int i=int(a);i<int(b);++i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
using ll = long long;
using itn = int;
using namespace std;
static const long double GRATIO=(long double)(1+sqrt(5))/2;
ll GCD(ll a, ll b){
    return b ? GCD(b, a%b) : a;
}
ll LCM(ll a, ll b){
    return a/GCD(a,b)*b;
}
int main(){
    int N,K;
    string S;
    cin>>N>>K>>S;
    vector<int> nums;
    vector<int> sum;
    
    int num=0;
    nums.push_back(0);
    rep(i,N){
        nums.at(num)++;
        if(i+1<N && S.at(i+1)!=S.at(i)) nums.push_back(0),num++;
    }
    
    sum.push_back(0);
    for(auto i=nums.begin(); i!=nums.end(); i++){
        sum.push_back(sum.back()+*i);
    }
    
    int size=sum.size();
    int ans=0;
    for(int i=0; i<size-1; i++){
        if(S.at(sum.at(i))-1=='0'){
            int itr=min(i+2*K+1,size-1);
            int tmp=sum.at(itr)-sum.at(i);
            ans=max(ans,tmp);
            
        }else{
            int itr=min(i+2*K,size-1);
            int tmp=sum.at(itr)-sum.at(i);
            ans=max(ans,tmp);
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1528
N = int(input())

D = [i for i in range(3, 55556, 2)]
T = [0 for i in range(len(D))]

L5 = []
for i in range(len(D)):
  if T[i] == 0:
    if D[i] % 5 == 1:
      L5.append(D[i])
    for j in range(i + D[i], len(D), D[i]):
      D[j] = -1

Ans = "2"
for i in range(N - 1):
  Ans += " " + str(L5[i])
  
print(Ans)


Measured memory_bytes: 4468
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e6 + 7
)

var buf []byte = make([]byte, maxBufSize)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBufSize)
}

func main() {
	a := nextInt()
	fmt.Println(a + a*a + a*a*a)
}

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func abs(a int) int {
	if a > 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	res := p
	if q == 0 {
		return 1
	}
	for i := 0; i < q-1; i++ {
		res *= p
	}
	return res
}

func MinOf(vars ...int) int {
	min := vars[0]
	for _, i := range vars {
		if min > i {
			min = i
		}
	}
	return min
}

func MaxOf(vars ...int) int {
	max := vars[0]
	for _, i := range vars {
		if max < i {
			max = i
		}
	}
	return max
}

func gcdof2numbers(a int, b int) int {
	if b == 0 {
		return a
	}
	return gcdof2numbers(b, a%b)
}

func lcmof2numbers(a int, b int) int {
	return a / gcdof2numbers(a, b) * b
}

// マイナスの場合は考慮していない
func fuctorial(a int) int {
	if a == 1 || a == 0 {
		return 1
	} else {
		return fuctorial(a-1) * a
	}
}

func NextPermutation(x sort.Interface) bool {
	n := x.Len() - 1
	if n < 1 {
		return false
	}
	j := n - 1
	for ; !x.Less(j, j+1); j-- {
		if j == 0 {
			return false
		}
	}
	l := n
	for !x.Less(j, l) {
		l--
	}
	x.Swap(j, l)
	for k, l := j+1, n; k < l; {
		x.Swap(k, l)
		k++
		l--
	}
	return true
}

// 素因数分解したmapを返す
func primeFuctorize(n int) map[int]int {
	pf := map[int]int{}
	for i := 2; i*i <= n; i++ {
		for n%i == 0 {
			pf[i]++
			n /= i
		}
	}
	if n != 1 {
		pf[n]++
	}
	return pf
}


Measured memory_bytes: 1808
//#include<iostream>
//#include<cstdio>
//
//
//int search(int *A,int n,int key) {
//	int i = 0;
//	A[n] = key;
//	while (A[i] != key)i++;
//	return i != n;
//
//}
//int main(){
//
//	int i,n,A[10000 + 1],q,key,sum = 0;
//
//	scanf("%d", &n);
//	for (i = 0; i < n; i++)scanf("%d", &A[i]);
//
//	scanf("%d", &q);
//	for (i = 0; i < q; i++) {
//		scanf("%d", &key);
//		if (search(A, n, key))sum++;
//	}
//	printf("%d\n", sum);
//
//	return 0;
//}

//round2

#include<iostream>
using namespace std;


int ans = 0;
void linearSearch(int *A,int key,int n) {

	for (int i = 0; i < n; i++) {

		if (A[i] == key) {
			ans++;
			break;
		}
	}


}

int main() {

	int n,q,key;
	cin >> n;
	int A[10005];

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

	cin >> q;
	for (int i = 0; i < q; i++) {
		cin >> key;

		linearSearch(A, key, n);


	}

	cout << ans << endl;
	return 0;

}


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

using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
typedef long double ld;

int x[20][20], y[20][20];

int main() {
#ifdef cute
	freopen("in", "r", stdin);
#endif
	ios::sync_with_stdio(false);
	cin.tie(NULL);


	int n;
	cin >> n;
	int a[n];
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		for(int j = 0; j < a[i]; j++)
			cin >> x[i][j] >> y[i][j];
	}
	
	int res = 0;
	for(int mask = 1; mask < (1 << n); mask++) {
		bool ok = 1;
		for(int i = 0; i < n; i++) {
			if(!(mask & (1 << i))) continue;
			for(int j = 0; j < a[i]; j++) {
				if(((mask >> (x[i][j]-1)) & 1) ^ y[i][j]) ok = 0;
			}
		}
		if(ok) res = max(res, __builtin_popcount(mask));
	}
	cout << res;


#ifdef cute
	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << " ms.\n";
#endif
}

// g++ o .cpp -O2 -std=c++11 -D cute -Wall -Wno-unused-result



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

typedef long long ll;
typedef unsigned long long ull;

int main()
{
    ll N, M, Q;
    cin >> N >> M >> Q;
    vector<ll> A(Q), B(Q), C(Q), D(Q);
    for(int i=0;i<Q;i++){
        cin >> A[i] >> B[i] >> C[i] >> D[i];
    }
    vector<ll> vec(N, 1);
    ll res = 0;
    while(true){
        ll vsum = 0;
        for(int i=0; i<Q; i++){
            if(vec[B[i]-1] - vec[A[i]-1] == C[i]) vsum += D[i];
        }
        res = max(res, vsum);

        bool allM = true;
        for(int i=0; i<N; i++){
            if(vec[i] != M) allM = false;
        }
        if(allM) break;

        // Increment
        for(int i=N-1; i>=0; i--){
            if(vec[i] == M) continue;
            vec[i]++;
            for(int j=i+1; j<N; j++){
                vec[j] = vec[i];
            }
            break;
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()

using ll = long long;
using ld = long double;
using namespace std;

const ll inf = 2e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 5;

int n, a[N];

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

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

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

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

    int t = 1;
    // cin>>t;

    while (t-- > 0) {
        code();
    }
}

Measured memory_bytes: 4364
if __name__ == '__main__':
    N, M, K = map(int, input().split()) 
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    
    acc_A = []
    acc_B = []
    acc_A.append(0)
    acc_B.append(0)
    
    sum_a = 0
    sum_b = 0

    for a in A:
        sum_a += a
        acc_A.append(sum_a)

    for b in B:
        sum_b += b
        acc_B.append(sum_b)

    large_ar = []
    small_ar = []

    if N > M:
        large_ar = acc_A
        small_ar = acc_B
    else:
        large_ar = acc_B
        small_ar = acc_A
    
    ans = 0
    for i in range(len(small_ar)):
        for j in range(ans-i+1, len(large_ar)):
            if large_ar[j] + small_ar[i] <= K:
                ans = max(ans, i+j)
            else: break
    print(ans)

Measured memory_bytes: 131948
N = int(input())
H = list(map(int, input().split(' ')))
i = 1
a = 0
while i < N:
    if H[i-1] <= H[i]-1:
        H[i] = H[i] - 1
    i += 1
i = 1
while i < N:
    if H[i-1] > H[i]:
        print("No")
        quit()
    i += 1
print("Yes")

Measured memory_bytes: 14396
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt(), A = cin.getIntArray(N);
    A.sort((a, b) => b - a);
    A.push(0);
    let a = A[0], h = Math.floor(a / 2);
    let max = 0, b1 = 0, b2 = 0;
    for (let n = 1; n < N; n++) {
        if (h <= A[n]) {
            b1 = A[n];
            b2 = A[n+1];
        }
    }
    if (Math.abs(h - b1) <= Math.abs(h - b2)) 
        console.log(`${a} ${b1}`);
    else
        console.log(`${a} ${b2}`);
}
class Inputer{constructor(t){if(typeof t=='undefined')throw new Error('引数（stdin）を省略できません！');this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){if(typeof t=='undefined')throw new Error('引数（1以上）を省略できません！');let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 32048
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
#define fir first
#define sec second
#define mod 998244353
inline int read()
{
	char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
	int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
	if(nega==-1) return -ans;
	return ans;
}
typedef pair<int,int> pii;
int add(int x,int y){return x+y>mod?x+y-mod:x+y;}
int sub(int x,int y){return x-y<0?x-y+mod:x-y;}

signed main()
{
#ifdef __LOCAL__
	freopen("in.txt","r",stdin);
#endif
	int w=read(),n=read();
	for(int i=1;i<=n;i++) w-=read();
	if(w<=0) cout<<"Yes\n";
	else cout<<"No\n";
#ifdef __LOCAL__
	cout<<"Time Used : "<<clock()<<endl;
#endif
	return 0;
}



Measured memory_bytes: 256
//ABC080B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <climits>
#include <cfloat>
#include <string>
using namespace std;

int main(){
	int n;
	cin >> n;
	int f = 0;
	int a = n;
	for(int i=0;i<9;i++){
		f += n%10;
		n /= 10;
	}
	if(a%f == 0){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
	return 0;
}

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

typedef long long ll;
using namespace std;

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

    // 先頭から見ていくバージョン
    int counter = 0, result = 0;
    int formerHeight;
    for (int i = 0; i < n; i++) {
        int currentHeight;
        cin >> currentHeight;
        if (i > 0 && formerHeight >= currentHeight) {
            ++counter;
        } else if (i > 0 && formerHeight < currentHeight) {
            counter = 0;
        }
        result = max(result, counter);
        formerHeight = currentHeight;
    }

    cout << result << endl;
}


Measured memory_bytes: 256
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, long.Parse);
        var amax = a.Max();
        var amin = a.Min();
        Console.WriteLine(amax - amin);
    }
}

Measured memory_bytes: 13268
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

int main(){
  int n,q;
  cin>>n>>q;
  
  string s;
  cin>>s;
  
  int A[n+1];
  A[0]=0;
  for(int i=1;i<n;i++){
    if(s[i-1]=='A' && s[i]=='C') A[i]=A[i-1]+1;
    else A[i]=A[i-1];
  }
  A[n]=A[n-1];
  
  int l,r;
  int ans;
  rep(i,q){
    cin>>l>>r;
    if(r<n && s[r-1]=='A' && s[r]=='C') ans=A[r]-A[l-1]-1;
    else ans=A[r]-A[l-1];
    cout<<ans<<endl;
  }
    
  return 0;
}

Measured memory_bytes: 4100
#include<bits/stdc++.h>
using namespace std;
#define N 100005
#define pii pair<int,int>
vector<pii> g[N];
void addedge(int f,int t,int d){
    g[f].push_back(make_pair(t,d));
    g[t].push_back(make_pair(f,d));
}
int sz[N],center,fl;
long long ans=0;
int n;
void DFS(int u,int fr){
    sz[u]=1;int mx=0;
    for(pii i:g[u])
        if(i.first!=fr){
            DFS(i.first,u);
            sz[u]+=sz[i.first];
            if(sz[i.first]*2==n) ans-=i.second,fl=1;
            mx=max(mx,sz[i.first]);
            ans+=min(sz[i.first],n-sz[i.first])*2LL*i.second;
        }
    mx=max(mx,n-sz[u]);
    if(mx*2<=n) center=u;
}
int main(){
    scanf("%d",&n);
    for(int i=1,f,t,d;i<n;i++)
        scanf("%d%d%d",&f,&t,&d),addedge(f,t,d);
    DFS(1,0);
    if(fl==1) cout<<ans<<endl;
    else {
        int t=1e9;for(pii i:g[center]) t=min(t,i.second);
        cout<<ans-t<<endl;
    }
    return 0;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
#define pb push_back
#define long long long
#define pll pair < long , long >
#define vll vector < pll >
#define ml map < long , long >
#define mll map < pll , long >
#define x first
#define y second
#define vl vector < long >
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
long i,n,v[200005][26]={0},dp[200005],d[26],j,ans=0;
int main()
{
    string s;
    cin>>s;
    n=s.size();
    memset(d,-1,sizeof d);
    d[s[n-1]-'a']=n-1;
    for(j=0;j<26;++j)
    v[n-1][j]=n;
    for(i=n-2;i>=0;i--)
    {
        d[s[i]-'a']=i;
        for(j=0;j<26;++j)
        v[i][j]=v[i+1][j];
        v[i][s[i+1]-'a']=i+1;
    }
    for(j=0;j<26;++j)
    if(d[j]==-1) {cout<<(char)(j+'a');return 0;}
    for(i=n-1;i>=0;i--)
    {
        dp[i]=1e9;
        for(j=0;j<26;++j)
        dp[i]=min(dp[i],dp[v[i][j]]+1);
        ans=max(ans,dp[i]);
    }
    for(i=0;i<26;++i)
    if(dp[d[i]]!=ans) break;
    if(i==26) ans++;
    while(ans)
    {
        for(i=0;i<26;++i)
        if(dp[d[i]]!=ans) break;
        cout<<(char)('a'+i);
        i=d[i];
        for(j=0;j<26;++j)
        d[j]=v[i][j];
        ans--;
    }
    return 0;
}


Measured memory_bytes: 42756
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Diagnostics;
using static System.Console;
using Pair = System.Collections.Generic.KeyValuePair<int, int>;
//using System.Numerics;
//using static System.Math;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 };
    readonly int mod = 1000000007;
    readonly string alfa = "abcdefghijklmnopqrstuvwxyz";
    readonly string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    int N, T;
    void solve()
    {
        N = cin.nextint;
        T = cin.nextint;
        var A = cin.scanint;


        int min = A[0];
        int max = A[0];

        int mincnt = 1;
        int maxcnt = 1;

        int value = 0;
        int valuecnt = 1;

        for (int i = 1; i < N; i++)
        {
            if (min == A[i])
            {
                mincnt++;
                continue;
            }
            if (A[i] < min)
            {
                min = A[i];
                mincnt = 1;
                continue;
            }

            if (value < A[i] - min)
            {
                value = A[i] - min;
                maxcnt = mincnt;
                valuecnt = 1;
            }
            else if (value == A[i] - min)
            {
                maxcnt++;
                valuecnt++;
            }
            //WriteLine(value + " " + valuecnt + " " + maxcnt);
        }

        //WriteLine(value + " " + valuecnt + " " + maxcnt);
        WriteLine(Math.Min(valuecnt, maxcnt));


    }

}

class Scanner
{
    string[] s; int i;
    char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
}

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

int main(){
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int> sum(n+1);
    sum[0]=sum[1]=0;
    rp(i,n-1){
        if(s.at(i)=='A'&&s.at(i+1)=='C')
        sum[i+2]=sum[i+1]+1;
        else sum[i+2]=sum[i+1];
    }
    queue<int> que;
    rp(i,q){
        int l,r;
        cin >> l >> r;
        if(l>1&&s.at(l-2)=='A'&&s.at(l-1)=='C')
            que.push(sum[r]-sum[l-1]-1);
        else
        {
            que.push(sum[r]-sum[l-1]);
        }
        
    }
    while(!que.empty()){
        int a=que.front(); que.pop();
        cout << a << endl;
    }
    return 0;
}

Measured memory_bytes: 1792
char buf[1800000],f[5];
sz,osz;
#define rd(x)x=0;for(;;){k=buf[sz++];if(k<'0')break;x=x*10+k-'0';}
N,M,L,Q;
D[301][301];
i,j,k;
a,b,c;
main()
{
	read(0,buf,1800000);
	rd(N);rd(M);rd(L);
	for(i=0;i<N;i++)for(j=0;j<N;j++)D[i][j]=1000000001;
	for(i=0;i<M;i++)
	{
		rd(a);rd(b);rd(c);
		--a;
		--b;
		D[a][b]=D[b][a]=c;
	}
	for(k=0;k<N;k++)for(i=0;i<N;i++)for(j=0;j<N;j++)
		if(D[i][j]>D[i][k]+D[k][j])D[i][j]=D[i][k]+D[k][j];
	for(i=0;i<N;i++)for(j=0;j<N;j++)D[i][j]=(D[i][j]>L)*1000000000+1;
	for(k=0;k<N;k++)for(i=0;i<N;i++)for(j=0;j<N;j++)
		if(D[i][j]>D[i][k]+D[k][j])D[i][j]=D[i][k]+D[k][j];
	rd(Q);
	for(i=0;i<Q;i++)
	{
		rd(a);rd(b);
		--a;
		--b;
		if(D[a][b]<1000000000)
		{
			c=D[a][b]-1;
			k=0;
			do{
				f[k++]=c%10+'0';
				c/=10;
			}while(c);
			for(;k--;)buf[osz++]=f[k];
		}
		else buf[osz++]='-',buf[osz++]='1';
		buf[osz++]='\n';
	}
	write(1,buf,osz);
}

Measured memory_bytes: 2176
//  RAKSHIT KADAM
 #include <bits/stdc++.h>
 
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree< int ,  null_type ,  less<int> ,  rb_tree_tag ,  tree_order_statistics_node_update>
 #warning !!!check the size of arrayss!!!
 #define ll long long
 #define int long long
 #define MOD  1000000007
 #define newMOD  998244353
 #define MAX 300006
 #define P(gg) for(auto rax:gg){cout<<rax<<" ";}cout<<endl;
 #define Need_for_speed(activated) ios_base :: sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
 #define satisfy ll t; cin>> t; while(t--)
 #define inp(n) int n;cin >> n
 #define mp make_pair
 #define pb push_back
 #define endl "\n"
 #define x first
 #define y second
 #define fore(i,a,b) for(ll i=a;i<b;i++)
 #define forci(i,n) for(ll i=0;i<n;i++)
 #define INF 2000000000000000005

 #define vi vector<ll>
#define pi 3.1415926535897932384626433832795
#define Endl endl
#define lb lower_bound
#define ub upper_bound

using namespace std;
//ll gcd(ll a, ll b){if (b == 0)return a;return gcd(b, a % b);}
//int power(int x, unsigned int y, unsigned int m){ if (y == 0) return 1;int p = power(x, y/2, m) % m;  p = (p * p) % m;                                                  return (y%2 == 0)? p : (x * p) % m;}
 //ddfdsfdfs

//ll modInverse(int a, int m){ return power(a, m-2, m);} // if a and m are relativelyprime

void solve()
{
    ll n,a,b;cin>>n>>a>>b;
    ll ans=0;ll t;
    t=(n/(a+b));
    ans+=t*a;
    ans+=min(a,n-t*(a+b));
    cout<<ans<<endl;
}
signed main()
{
 
   
    Need_for_speed(activated);
//satisfy
//    {
//   solve();
//    }


 solve();
    return 0;
}


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

using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

const int N = 1e5;
const ll INF = 1e18;
ll vt[N];

void solve() {
  int n; cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> vt[i];
  }
  ll pref = 2;
  ll ans = vt[0] - 1;
  for (int pos = 1; pos < n; pos++) {
    if (vt[pos] == pref) {
      pref++; continue;
    }
    int res = (vt[pos] - 1) / pref;
    if (res == 0) continue;
    ans += res;
  }
  cout << ans;
}

// CHECK LIMITS (n <= 10^5)
// CHECK CORNER CASES (n == 1)

int main() {
  ios::sync_with_stdio(NULL), cin.tie(0), cout.tie(0);
  cout.setf(ios::fixed), cout.precision(2);
  //cout << 1.0 * clock() / CLOCKS_PER_SEC << endl;
  solve();
}


Measured memory_bytes: 4424
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def ceil(x):
    return int((-x)//1*(-1))


N, A, B = map(int, input().split())
hp = [int(input()) for _ in range(N)]
diff = A-B


def check(x, HP):
    cnt = 0
    for i in range(N):
        if HP[i]-B*x <= 0:
            break
        else:
            cnt += ceil((HP[i]-B*x)/diff)
    return cnt <= x


def solve2():
    HP = sorted(hp, reverse=True)
    mi = HP[0]//A
    ma = ceil(HP[0]/B)
    while mi <= ma:
        mid = (mi+ma)//2
        if check(mid, HP):
            ma = mid-1
        else:
            mi = mid+1
    print(mi)


def check2(x, hp):
    l = [a-B*x for a in hp]
    ret = 0
    for a in l:
        if a <= 0:
            continue
        else:
            ret += ceil(a/diff)
    return ret <= x


def solve3():
    mi = max(hp)//A
    ma = ceil(max(hp)/B)
    while mi <= ma:
        mid = (mi+ma)//2
        if check2(mid, hp):
            ma = mid-1
        else:
            mi = mid+1
    print(mi)


solve3()


Measured memory_bytes: 117964
(defun search-value (target &optional (i 1) (result-list (list nil)))
  (if (> (* i i) target)
      (car (sort (cdr (reverse result-list)) #'<))
      (progn
        (when (= (mod target i) 0)
          (let ((j (/ target i)))
            (push (- (+ i j) 2) result-list)))
        (search-value target (1+ i) result-list))))

(princ (search-value (read)))


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

#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define MIN(a) *min_element(all(a))
#define MAX(a) *max_element(all(a))
#define SUM(a, b) accumulate(all(a), b)
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define FOR(i, m, n) for(int (i)=(m); (i)<(n); i++)
#define FORR(i, m, n) for(int (i)=(n)-1; (i)>=(m); i--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
#define debug(x) cerr << #x << " = " << x << endl
//#define int long long

typedef long long ll;
typedef unsigned long long ull;
//ll const MOD = 998244353;
ll const MOD = 1e9+7;
ll const INF = 1e18;

template<typename T> int size(const T& a){return (int)a.size();}
template<typename T> T Div(T a, T b){return (a + b - 1) / b;}
template<typename T> bool chmin(T& a, const T& b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, const T& b){if(a < b){a = b; return true;} return false;}



signed main(){
    int a, b, h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;
    return 0;
}


Measured memory_bytes: 256
n = int(input())
lis = []
li = list(map(str,input().split()))
if n % 2 == 0:
    b = li[1::2]
    for m in range(n//2):lis.append(b[-(m + 1)])
    print(" ".join(lis[::] + li[::2]))
else:
    b = li[::2]
    for m in range((n//2)+1):lis.append(b[-(m + 1)])
    print(" ".join(lis[::]+li[1::2]))

Measured memory_bytes: 25924
import copy

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

k = 1 + n%2
INF = 10**18
dp = [[-INF]*4 for i in range(n+5)]
dp[0][0] = 0

for i in range(n):
    for j in range(k+1):
        dp[i+1][j+1] = max(dp[i+1][j+1], dp[i][j])
        now = copy.deepcopy(dp[i][j])
        if (i+j) % 2 == 0:
            now += a[i]
        dp[i+1][j] = max(dp[i+1][j], now)
print(dp[n][k])


Measured memory_bytes: 121288
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a,b,c,x,y;
    while (cin>>n>>a>>b>>c>>x) {
        if (n==0&&a==0&&b==0&&c==0&&x==0) {
            break;
        } else {
            std::deque<int> deq;
            for (int i=0;i<n;i++) {
                cin>>y;
                deq.emplace_back(y);
            }
            int frame=0;
            int count=0;
            int j=0;
            while (frame<=10000) {
                if (x==deq[j]) {
                    j++;
                    count++;
                    
                }
                x=(a*x+b)%c;
                if (count==n) {
                    break;
                }
                frame++;
            }
            if (frame!=10001) {
                cout<<frame<<endl;
            } else {
                cout<<-1<<endl;
            }
        }
    }
}



Measured memory_bytes: 3008
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Edge = pair<int, ll>;
using Graph = vector<vector<int>>;
using WeightedGraph = vector<vector<Edge>>;
const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

const int CASES = 3;

void solve() {
    ll A, B, C, D; cin >> A >> B >> C >> D;
    bool f = true;
    for (int i = 0; i < 1000; ++i) {
        C-=B;
        if(C<=0){
            f = true;
            break;
        }
        A-=D;
        if(A<=0){
            f = false;
            break;
        }
    }
    string ans = "No";
    if(f) ans = "Yes";
    cout << ans << endl;
}

int main() {
#ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt", "input5.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
#else

    solve();

#endif
    return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <cstdlib>
#include <stack>
#include <string>
using namespace std;
int main(void) {
	stack<int> S;
	string s;
	int a, b, x;
	while (cin >> s) {
		if (s == "+") {
			a = S.top(); S.pop();
			b = S.top(); S.pop();
			S.push(a + b);
		} else if (s == "-") {
			b = S.top(); S.pop();
			a = S.top(); S.pop();
			S.push(a - b);
		} else if (s == "*") {
			a = S.top(); S.pop();
			b = S.top(); S.pop();
			S.push(a * b);
		} else {
			S.push(atoi(s.c_str()));
		}
	}
	cout << S.top() << endl;
}


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

#define dump(...) do{print_vars(cout<<"# "<<#__VA_ARGS__<<'=',__VA_ARGS__);cout<<endl;}while(0)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

template<typename T,typename U>bool chmin(T& a,const U& b){return a>b?(a=b,1):0;}
template<typename T,typename U>bool chmax(T& a,const U& b){return a<b?(a=b,1):0;}

void print_vars(ostream&){}
template<typename Car,typename... Cdr>
void print_vars(ostream& os,const Car& car,const Cdr&... cdr){
	print_vars(os<<car<<(sizeof...(cdr)?",":""),cdr...);
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}

template<int I,typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<int I,typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	os<<get<I>(t)<<(sizeof...(Cdr)?",":"");
	print_tuple<I+1,Cdr...>(os,t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<0,Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	#ifndef _GLIBCXX_DEBUG
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	constexpr char endl='\n';
	#endif

	for(int n;cin>>n&&n;){
		vi a(n);
		rep(i,n) cin>>a[i];

		ll p=0;
		rep(i,n)
			if(abs(a[i])>abs(a[p]))
				p=i;

		vector<tuple<int,int>> res;
		if(a[p]<0){
			res.emplace_back(p,n-2);
			res.emplace_back(p,n-2);
			peri(i,1,n-1){
				res.emplace_back(i,i-1);
				res.emplace_back(i,i-1);
			}
		}
		else{
			res.emplace_back(p,1);
			res.emplace_back(p,1);
			repi(i,1,n-1){
				res.emplace_back(i,i+1);
				res.emplace_back(i,i+1);
			}
		}

		cout<<res.size()<<endl;
		for(auto t:res){
			int x,y; tie(x,y)=t;
			cout<<x+1<<' '<<y+1<<endl;
		}
	}
}


Measured memory_bytes: 256