akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <functional>
using namespace std;

typedef long long ll;

int n, m;
bool f[200001], l[200001];

int main() {
	cin >> n;
	int p = 1;
	while (p <= n) p *= 2;
	cout << p / 2 << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <iomanip>

using namespace std;

vector<vector<int>> v;
vector<int> d, pr;
int depth = 0;
int n, k;

void dfs(int u, int p = -1) {
    pr[u] = p;
    d[u] = 1;
    if (u == n - 1) {
        k = depth - 1;
    }
    for (int i = 0; i < v[u].size(); i++) {
        if (v[u][i] != p) {
            depth++;
            dfs(v[u][i], u);
            depth--;
            d[u] += d[v[u][i]];
        }
    }
}

int main() {
    cin >> n;
    v.resize(n);
    d.resize(n);
    pr.resize(n);
    for (int i = 1; i < n; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    dfs(0);
    int cnt1 = 0, cnt2 = 0;
    int node = n - 1;
    for (int i = 0; i < k / 2; i++) {
        node = pr[node];
    }
    cnt1 = d[0] - d[node] - 1;
    cnt2 = d[node] - 1;
    if (cnt1 <= cnt2) {
        cout << "Snuke" << endl;
    } else {
        cout << "Fennec" << endl;
    }
}


Measured memory_bytes: 11136
#include <cstdio>
#include <cstring>
#include <vector>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;

char buf[15];
ll calc(int bg, int ed) {
  ll res = 0;
  for(int i = bg; i < ed; ++i) {
    res = res * 10 + (buf[i]-'0');
  }
  return res;
}

int main(void) {
  scanf("%s", buf);
  int len = strlen(buf);
  ll res = 0;
  REP(pat, 1 << (len-1)) {
    int last = 0;
    REP(i, len-1) {
      if(pat & (1 << i)) {
        res += calc(last, i+1);
        last = i+1;
      }
    }
    res += calc(last, len);
  }
  printf("%lld\n", res);
  return 0;
}



Measured memory_bytes: 128
#include <stdio.h>

int main(){
  int n, a, b;
  scanf("%d%d%d", &n, &a, &b);
  int sum = 0;
  for(int i=1; i<=n; i++){
    int summ = i%10 + i/10%10 + i/100%10 + i/1000%10 + i/10000;
    if(a <= summ && summ <= b)
      sum += i;
  }
  printf("%d\n", sum);
}

Measured memory_bytes: 128
#python3
from collections import deque
from heapq import heappop, heappush
def main():
    n, k = map(int, input().split())
    vs = [int(i) for i in input().split()]
    ans = 0
    for l in range(k+1):
        for r in range(k-l+1):
            dl = k-l-r
            q = deque(vs)
            hav = []
            for _ in range(l):
                if len(q) == 0:
                    continue
                v = q.popleft()
                heappush(hav, v)
            for _ in range(r):
                if len(q) == 0:
                    continue
                u = q.pop()
                heappush(hav, u)
            for i in range(dl):
                if len(hav) == 0:
                    break
                val = heappop(hav)
                if val > 0:
                    heappush(hav, val)
            ans = max(ans, sum(hav))
    print(ans)
main()

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

int main() {
  int64_t a,b,c;
  cin>>a>>b>>c;
  if(4*a*b<(c-a-b)*(c-a-b)&&(c-a-b)>0){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define faster  ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pb push_back
const double PI = acos(-1.0);
using namespace std;

int main()
{
    faster

    ll x,k,d;

    cin>>x>>k>>d;


    ll a=abs(x);

    ll s=a/d;

    if(k<=s)
    {
        cout<<a-(k*d)<<endl;
    }
    else
    {
        k=k-s;
        a=a-(s*d);


        if(k%2==0)
            cout<<a<<endl;
        else
            cout<<abs(d-a)<<endl;

        //cout<<k<<" "<<a<<endl;
    }




    return 0;
}


Measured memory_bytes: 3692
#include<cstdio>
#include<algorithm>
using namespace std;
int dpu[200001],dpd[200001],dpr[200001],dpl[200001],h,w,n,sr,sc;
char s[200010],t[200010];
int main(){
    int flag=0;
    scanf("%d %d %d",&h,&w,&n);
    scanf("%d %d",&sr,&sc);
    scanf("%s",s);
    scanf("%s",t);
    dpr[n]=w+1;
    dpl[n]=0;
    dpu[n]=0;
    dpd[n]=h+1;
    for(int i=n-1;i>=0;i--){
        if(t[i]=='L'){
            dpr[i]=dpr[i+1]+1;
        }
        else{
            dpr[i]=dpr[i+1];
        }
        if(s[i]=='R'){
            dpr[i]=min(w,dpr[i]-1);
        }
        else{
            dpr[i]=min(w+1,dpr[i]);
        }
    }
    for(int i=n-1;i>=0;i--){
        if(t[i]=='R'){
            dpl[i]=dpl[i+1]-1;
        }
        else{
            dpl[i]=dpl[i+1];
        }
        if(s[i]=='L'){
            dpl[i]=max(1,dpl[i]+1);
        }
        else{
            dpl[i]=max(0,dpl[i]);
        }
    }
    for(int i=n-1;i>=0;i--){
        if(t[i]=='U'){
            dpd[i]=dpd[i+1]+1;
        }
        else{
            dpd[i]=dpd[i+1];
        }
        if(s[i]=='D'){
            dpd[i]=min(h,dpd[i]-1);
        }
        else{
            dpd[i]=min(h+1,dpd[i]);
        }
    }
    for(int i=n-1;i>=0;i--){
        if(t[i]=='D'){
            dpu[i]=dpu[i+1]-1;
        }
        else{
            dpu[i]=dpu[i+1];
        }
        if(s[i]=='U'){
            dpu[i]=max(1,dpu[i]+1);
        }
        else{
            dpu[i]=max(0,dpu[i]);
        }
    }
    for(int i=0;i<n;i++){
        if(dpr[i]-1<=dpl[i]||dpd[i]-1<=dpu[i]){
            flag=1;
        }
    }
    if(dpu[0]>=sr||dpd[0]<=sr||dpr[0]<=sc||dpl[0]>=sc||flag){
        printf("NO\n");
    }
    else{
        printf("YES\n");
    }
}

Measured memory_bytes: 3712
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<vector>
#include<cmath>
#include<ctime>
#include<queue>
#include<map>
#include<set>
#define LL long long
#define db double

using namespace std;
const int N=2e5+10,mod=1e9+7;
int rd()
{
    int x=0,w=1;char ch=0;
    while(ch<'0'||ch>'9'){if(ch=='-') w=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+(ch^48);ch=getchar();}
    return x*w;
}
struct node
{
	int x,y;
	bool operator < (const node &bb) const {return y!=bb.y?y<bb.y:x<bb.x;}
}b[N],a[N];
int n,mx[N][20],mi[N][20],l2[N],sm=1;
int gmx(int l,int r)
{
	int z=l2[r-l+1];
	return max(mx[l][z],mx[r-(1<<z)+1][z]);
}
int gmi(int l,int r)
{
	int z=l2[r-l+1];
	return min(mi[l][z],mi[r-(1<<z)+1][z]);
}
int c[N];
void ad(int x,int y){while(x<=n) c[x]=(c[x]+y)%mod,x+=x&(-x);}
int gsm(int x){int an=x>=0;while(x>0) an=(an+c[x])%mod,x-=x&(-x);return an;}

int main()
{
	n=rd();
	for(int i=1;i<=n;++i) b[i].x=rd(),b[i].y=rd();
	sort(b+1,b+n+1);
	for(int i=1;i<=n;++i) mx[i][0]=mi[i][0]=b[i].x;
	for(int i=2;i<=n;++i) l2[i]=l2[i>>1]+1;
	for(int j=1;j<=l2[n];++j)
		for(int i=1;i+(1<<j)-1<=n;++i)
		{
			mx[i][j]=max(mx[i][j-1],mx[i+(1<<(j-1))][j-1]);
			mi[i][j]=min(mi[i][j-1],mi[i+(1<<(j-1))][j-1]);
		}
	for(int i=1;i<=n;++i)
	{
		a[i].x=a[i].y=i;
		int l=1,r=i-1;
		while(l<=r)
		{
			int mid=(l+r)>>1;
			if(gmx(1,mid)>b[i].x) a[i].x=mid,r=mid-1;
			else l=mid+1;
		}
		l=i+1,r=n;
		while(l<=r)
		{
			int mid=(l+r)>>1;
			if(gmi(mid,r)<b[i].x) a[i].y=mid,l=mid+1;
			else r=mid-1;
		}
	}
	sort(a+1,a+n+1);
	for(int i=1;i<=n;++i)
	{
		int ll=a[i].x,rr=a[i].y;
		int nf=(sm-gsm(ll-2)+mod)%mod;
		sm=(sm+nf)%mod;
		ad(rr,nf);
	}
	printf("%d\n",(sm-gsm(n-1)+mod)%mod);
    return 0;
}


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


    using namespace std;
    typedef long long ll;
    # define M_PI  3.14159265358979323846
    const int MOD=1e9+7;

    void solve(){
        string s;
        cin>>s;
        int n=s.size();
        for(int i=0;i<n;i++){
            if(s[i]=='?' && ((i+1<n && s[i+1]=='P') || (i-1>=0 && s[i-1]=='P'))){
                s[i]='D';
            }
            else if(s[i]=='?' && i+1<n && s[i+1]=='?'){
                s[i]='P';
                s[i+1]='D';
            }
            else if(s[i]=='?' && i+1<n && s[i+1]=='D')
                s[i]='P';
            else if(s[i]=='?')
                s[i]='D';
        }
        cout<<s;
        
//        for(int i=0;i<n;i++){
//            if(s[i]=='?')
//                s[i]='D';
//        }
//        cout<<s;
    }

    int main(){
        ios::sync_with_stdio(0);
        cin.tie(0);
        cout.tie(0);
        cout<<fixed;
        cout<<setprecision(10);
        int t=1;
//        cin>>t;
        for(int i=1;i<=t;i++){
            solve();
        }
        return 0;
    }


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

typedef long long int ll;

int main()
{
    ll n;
    string s;
    cin >> n >> s;
    vector<ll> a(26);
    for(ll i = 0;i < n;i++){
        a[s[i] - 'a']++;
    }

    ll ans = 1;
    for(ll i = 0;i < 26;i++){
        ans *= a[i] + 1;
        ans %= 1000000007;
    }

    cout << ans - 1;


    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;

int pri[1000000];
int sz;

void get_pri()
{
    sz=0;
    for(int i=2;i<=999999;i++)
    {
        int ok=0;
        for(int j=2;j*j<=i;j++)
            if(i%j==0){
                ok=1;
                break;
            }
        if(ok==0)
            pri[sz++]=i;
    }
}

int main()
{
    int n;
    get_pri();
    while(scanf("%d",&n)!=EOF)
    {
        int pos=lower_bound(pri,pri+sz,n)-pri;
        if(pri[pos]==n)
            printf("%d\n",pos+1);
        else
            printf("%d\n",pos);
    }
    return 0;
}

Measured memory_bytes: 1492
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

int main() {
    long long int n, ans = 0;
    cin >> n;

    for (long long int i = 1; i <= (long long int)sqrt(n); i++) {
        if (n % i != 0) {
            continue;
        }
        long long int m = n / i - 1;
        if (m > i) {
            ans += m;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	//"math"
	// "sort"
	//"regexp"
)

var a, b, max int

func main() {
	fmt.Scan(&a)
	fmt.Scan(&b)
	max = a + b
	if max < a-b {
		max = a - b
	}

	if max < a*b {
		max = a * b
	}
	fmt.Println(max)
}

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

int H, W;
char farms[101][101];
const int X[4] = {-1, 0, 0, 1};
const int Y[4] = {0, -1, 1, 0};

void dfs(int x, int y){
  char f = farms[x][y];
  farms[x][y] = '.';
  for (int i = 0; i < 4; i++) {
      int nx = x + X[i], ny = y + Y[i];
      if (0 <= nx && nx < H && 0 <= ny && ny < W && farms[nx][ny] == f){
        dfs(nx, ny);
    }
  }
  return ;
}


int solve(){
  int res = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (farms[i][j] != '.'){
        dfs(i, j);
        res++;
      }
    }
  }
  return res;
}

int main() {
  for (int i = 0; i < 101; i++) {
    for (int j = 0; j < 101; j++) {
      farms[i][j] = '.';
    }
  }
  cin >> H >> W;
  while (!(H == 0 && W == 0)){
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        cin >> farms[i][j];
      }
    }
    cout << solve() << endl;
    cin >> H >> W;
  }
  return 0;
}

Measured memory_bytes: 3540
#include<iostream>
    #include<stdio.h>
    //#include <bits/stdc++.h>
    #include<vector>
    #include<float.h>
    #include<algorithm>
    #include<string>
    #include<cstring>
    #include<math.h>
    #include<sstream>
    #include<set>
    #include<map>
    #include<queue>

    #define INF 1e9
    #define rep(i,n)for(int i=0;(i)<(int)(n);i++)
    #define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
    #define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
    #define vec(type,n) vector<type>(n)
    #define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))

    using namespace std;
    
    int main(){
      long a,b;
      cin>>a>>b;
      if(b-a>=2020){
        cout<<0<<endl;
        return 0;
      }
      auto p = vec(int,b-a+1);
      int cnt = 0;
      REP(i,a,b){
       p[cnt] = i%2019;
       cnt++;
       if(cnt>=2019)break;
      }
      int mn = 2020;
      rep(i,cnt){
        rep(j,cnt){
          if(i == j)continue;
          mn = min(mn,p[i]*p[j]%2019);
        }
      }
      cout<<mn<<endl;
    }


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

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.next());
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = Integer.parseInt(sc.next());
		}
		Arrays.sort(a);
		System.out.println(a[a.length - 1] - a[0]);
		sc.close();
	}
}

Measured memory_bytes: 19412
/* ****revpro**** */
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define endl     '\n'
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define rep(i,a,b)  for(ll i=a;i<b;i++)
#define repr(i,a,b) for(ll i=b-1;i>=a;i--)    
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define mii      map<ll,ll>
using namespace std;

#define N  100005
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;  
#define ordered_set tree<double, null_type,less<double>, rb_tree_tag,tree_order_statistics_node_update> 
signed main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS=1;
//  cin>>TESTS;
  while(TESTS--)
  {
    ll n;
    ll ans=0;
    cin>>n;
    ll d[n];
    rep(i,0,n) cin>>d[i];
    rep(i,0,n)rep(j,i+1,n) ans+=d[i]*d[j];
    cout<<ans; 
  }
  return 0;
}

Measured memory_bytes: 256
#include <cstdlib>

#include <algorithm>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <stdio.h>
#include <string>
#include <vector>
#include <set>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const double PI = 3.1415926535897932;

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

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

int main()
{
	ll X, K, D;
	cin >> X >> K >> D;

	X = abs(X);
	ll ans;
	if (X / D > K) {
		ans = X - D * K;
	}
	else {
		ll cnt = X / D;
		K -= cnt;
		X -= cnt * D;
		if (K % 2 == 0) {
			ans = X;
		}
		else {
			ans = abs(X-D);
		}
	}

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

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+1;
int m, n; map<int,int> bomb; vector<pair<int,int>> g[N]; 
vector<int> activated, x, s; bool visited[N];
inline void read_bombs() {
	for (int a, b, i = 0; i < n; ++i) 
    	cin >> a >> b, bomb[a] = b;
	for (auto &q: bomb) 
		activated.push_back(q.second), q.second = activated.size()-1;
	activated.push_back(0), x.push_back(activated.front()), bomb[INT_MAX] = n; }
inline void read_cord(int i) {
	int l, r; 
	cin >> l >> r, 
    l = bomb.lower_bound(l)->second, r = bomb.lower_bound(r+1)->second,
    g[l].emplace_back(i,r), g[r].emplace_back(i,l); }
int dfs(int u, int p = -1) {
	int t = x[u];
	visited[u] = true; 
	for (auto e: g[u]) 
    	if (e.second != p and not visited[e.second] and dfs(e.second,u)) 
    		s.push_back(e.first), t ^= 1;
	return t; }
inline void write_ans() {
    cout << s.size() << "\n";
    sort(s.begin(), s.end());
    for (auto cord: s) 
      cout << cord <<  ' '; }
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cin >> n >> m, read_bombs();
	for (int i = 0, j = 1; i < n; i = j++) 
    	x.push_back(activated[j] != activated[i]);
	for (int i = 1; i <= m; ++i) 
		read_cord(i);
	for (int i = 0; i <= n; ++i) 
    	if (not visited[i] and dfs(i)) 
    		cout << -1, exit(0);
    write_ans(); }

Measured memory_bytes: 19708
#!/usr/bin/env python3
from itertools import product, permutations, combinations
from bisect import bisect_right,bisect_left

N=int(input())

tbl = [[0] * 10 for i in range(10)]

for i in range(1, N+1):
    num = str(i)
    s = int(num[0])
    e = int(num[-1])
    tbl[s][e] += 1

cnt = 0
for i in range(10):
    for j in range(10):
        cnt += tbl[i][j] * tbl[j][i]
print(cnt)

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<string>
#include<cstdlib>
//#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long INF = 1LL << 40;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
// ----------------------------------------------------------------------------

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  sort(s.begin(),s.end());
  vector<int> ok(26,0);
  for(int i=0; i<s.size(); i++){
    ok[s[i] - 'a']++;
  }
  for(int i=1; i<n; i++){
    string t;
    cin >> t;
    sort(t.begin(),t.end());
    vector<int> temp(26,0);
    for(int j=0; j<t.size(); j++){
      temp[t[j] - 'a']++;
    }
    for(int j=0; j<26; j++){
      chmin(ok[j],temp[j]);
    }
  }
  for(int i=0; i<26; i++){
    for(int j=0; j<ok[i]; j++){
      cout << (char)('a'+i);
    }
  }
  cout << endl;
  return 0;
}


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

int main(){
    string s;
    cin >> s;
    string dir = "NSWE";
    vector<int> cnt(4, 0);
    for (int i = 0; i < s.size(); i++) {
        for (int j = 0; j < 4; j++){
            if (s[i] == dir[j]) cnt[j]++;
        }
    }
    bool flag = true;
    for (int i = 0; i < 4; i++){
        if (cnt[i] > 0){
            if (cnt[i + 1 - 2 * (i % 2)] == 0) flag = false;
        }
    }
    if (flag) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
// [[ABC134C] Exception Handling] https://www.luogu.com.cn/problem/AT4843
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <iostream>
using namespace std;
int n;
long long h[100005];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }

  for (int i = n - 1; i > 0; i--) {
    if (h[i - 1] - 1 > h[i]) {
      cout << "No\n";
      return 0;
    } else if (h[i-1]-1 == h[i]) {
      h[i-1]--;
    }
  }

  cout << "Yes\n";
  return 0;
}


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

int ans = 700;

int main() 
{
    char a, b, c;
    cin >> a >> b >> c;
    if(a == 'o') ans += 100;
    if(b == 'o') ans += 100;
    if(c == 'o') ans += 100;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,m,k;
    cin>>n>>m>>k;
    vector<long long>a,b;
    for(int i=0;i<n;i++)
    {
        long long x;
        cin>>x;
        a.push_back(x);
    }
    for(int i=0;i<m;i++)
    {
        long long x;
        cin>>x;
        b.push_back(x);
    }
    for(int i=1;i<n;i++)
    a[i]=a[i]+a[i-1];
    for(int i=1;i<m;i++)
    b[i]=b[i]+b[i-1];
    long long ans=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]>k)
        break;
        long long search=lower_bound(b.begin(),b.end(),k-a[i])-b.begin();
        if(b[search]==k-a[i])
        search++;
        ans=max(ans,i+1+search);
    }
    for(int i=0;i<m;i++)
    {
        if(b[i]>k)
        break;
        long long search=lower_bound(a.begin(),a.end(),k-b[i])-a.begin();
        if(a[search]==k-b[i])
        search++;
        ans=max(ans,i+1+search);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 7908
#include<algorithm>
using namespace std;
int n,ans,a[100001];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)scanf("%d",&a[i]);
	for (int i=1;i<=n;i++)
		if (a[i]==i)
		{
			swap(a[i+1],a[i]);
			ans++;
		}
	printf("%d",ans);
}

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

using namespace std;

bool cmp(pair<string, int> &a, pair<string, int> &b) {
	if (a.first == b.first) {
		return b.second < a.second;
	}
	return (a.first < b.first);
}

int main() {
	int n;
	cin >> n;
	string x;
	int s;
	vector<pair<string, int>> v;
	for (int i = 0; i < n; i++) {cin >> x >> s; v.push_back(make_pair(x, s)); }
	auto w = v;
	sort(v.begin(), v.end(), cmp);
	//for (int i = 0; i < n; i++) cout << v[i].first << " " << v[i].second << endl;
	
	for (int i = 0; i < n; i++) {
		cout << (find(w.begin(), w.end(), v[i]) - w.begin() + 1)<< "\n";
	}
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define REP(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
#define SUM(x) accumulate(ALL(x),0);
#define FI first
#define SE second
#define PB push_back
#define EB emplace_back
#define SZ(x) (int)(x).size()
#define BN(x) ((1<<x)-1)
#define DUP(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
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() {
  string S;
  cin >> S;
  vector<int> dp(S.size());
  dp[0] = 0;
  for (int i = 1; i < S.size(); ++i) {
    char cur_s = S[i];
    char last_s = S[i - 1];
    if (cur_s == last_s) {
      dp[i] = dp[i - 1] + 1;
      if (cur_s == '0') {
        S[i] = '1';
      } else {
        S[i] = '0';
      }
    } else {
      dp[i] = dp[i - 1];
    }
  }
  cout << dp[S.size() - 1] << endl;
}

Measured memory_bytes: 896
#include "bits/stdc++.h"
using namespace std;
#ifndef LOCAL
#define endl '\n'
#endif

#define fr(i, a, b) for(int i = a; i <= b; i++)
#define rf(i, a, b) for(int i = a; i >= b; i--)
#define pf push_front
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) (int)x.size()
#define lb lower_bound
#define ub upper_bound

typedef long long ll;
typedef long double f80;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int pct(int x) { return __builtin_popcount(x); }
int pct(ll x) { return __builtin_popcountll(x); }
int bt(int x) { return 31 - __builtin_clz(x); } // floor(log2(x))
int bt(ll x) { return 63 - __builtin_clzll(x); } // floor(log2(x))
int cdiv(int a, int b) { return a / b + !(a < 0 || a % b == 0); }
ll cdiv(ll a, ll b) { return a / b + !(a < 0 || a % b == 0); }
int nxt_C(int x) { int c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }
ll nxt_C(ll x) { ll c = x & -x, r = x + c; return (((r ^ x) >> 2) / c) | r; }

vector<int> get_bits(int mask) {
	vector<int> bb;
	while(mask) { int b = bt(mask); bb.pb(b); mask ^= (1 << b); }
	reverse(all(bb));
	return bb;
}

int get_mask(vector<int> v) {
	int mask = 0;
	for(int x : v) { mask ^= (1 << x); }
	return mask;
}

template<typename T>
void uniq(vector<T> &v) { sort(all(v)); v.resize(unique(all(v)) - v.begin()); }

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll rand(ll l, ll r){
	uniform_int_distribution<ll> uid(l, r);
	return uid(rng);
}

void sc() {}

template <typename Head, typename... Tail>
void sc(Head &H, Tail &... T) { cin >> H; sc(T...); }

#ifdef LOCAL
#define debug(...) cerr << "[L:" << __LINE__ << "][" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// #ifndef LOCAL
// string to_string(__int128 x) {
// 	string s = "";
// 	bool neg = 0;
// 	if(x < 0) { s += "-"; neg = 1; x = -x; }
// 	if(!x) s += '0';
// 	while(x) {
// 		int rem = x % 10;
// 		s += to_string(rem);
// 		x /= 10;
// 	}
// 	reverse(s.begin() + neg, s.end());
// 	return s;
// }
// #endif

const int mod = 1e9 + 7; // 998244353;

int pwr(int a,ll b) {
	int ans = 1;
	while(b) {
		if(b & 1) ans = (ans * 1LL * a) % mod;
		a = (a * 1LL * a) % mod;
		b >>= 1;
	}
	return ans;
}

/*
	Lookout for overflows!!
	Check array sizes!!
	Clear before test cases!!
	Use the correct modulo!!
	Check for corner cases!!
	Are you forgetting something?!
	Read problem statement carefully!!!
*/

const int N = 1e5 + 5;
ll a[N];

ll dp[N][2];

void solve() {
	int n;
    sc(n);
    fr(i, 1, n) {
        sc(a[i]);
    }
    fr(i, 2, n + 1) {
        fr(j, 0, 1) {
            fr(k, 0, 1) {
                if(a[i - 1] >= j + k) {
                    dp[i][k] = max(dp[i][k], dp[i - 1][j] + k + (a[i - 1] - j - k) / 2);
                    // debug(i, k, dp[i][k]);
                }
            }
        }
    }
    cout << dp[n + 1][0];
}

int main() {
	ios :: sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t = 1;
	// cin >> t;
	for(int tt = 1; tt <= t; tt++) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 6000
#!/usr/bin/env python3
import sys
import math

def solve(N: int):
    odd = math.floor(N / 2) if not N % 2 else math.floor(N / 2) + 1
    print("{0:.10f}".format(odd / N))
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
import java.util.Scanner;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int O = sc.nextInt();
        
        int[] L = new int[M];
        
        for(int i = 0 ; i < M ;i++) {
        	L[i] = sc.nextInt();
        }
        int count = 0;
        int judge = O;
        
        for(int i = 0 ; i < N ;i++) {
        	for(int m = 0 ; m < M;m++) {
        		judge += sc.nextInt()*L[m];
        	}
        	if(judge > 0) {
        		count++;
        	}
        		judge = O;
        	
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
#define N 1000000

#define pb push_back
#define mp make_pair
#define int long long

int32_t main()
{
    int n,k,x;
    cin>>n>>k;
    int v[n+1];
    for(int i=1;i<=n;i++) {cin>>v[i];}
    int dp[n+1];
    memset(dp,N,sizeof(dp));
    dp[0]=0;
    dp[1]=0;
    for(int i=1;i<=n;i++)
    {
    	for(int j=1;j<=k;j++)
    	{
    		if(i+j>n) continue;
    		dp[i+j]=min(dp[i+j],dp[i]+abs(v[i]-v[i+j]));
    	}
    }
    cout<<dp[n];
    return 0;

}


Measured memory_bytes: 1792
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<ctime>
#include<cstdlib>
#include<sys/time.h>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
inline int ri()
{
	register int x=0;register bool f=0;register char ch=getchar();
	while(ch>'9'||ch<'0'){if(ch=='-')f=1;ch=getchar();}
	while(ch<='9'&&ch>='0'){x=x*10+ch-'0';ch=getchar();};
	return f?-x:x;
}
void wi(ll x)
{
	if(x<0)	x=-x,putchar('-');
	if(x>9)	wi(x/10);
	putchar('0'+x%10);
}

int main()
{
	ll n=ri(),k=ri(),a,b,l,r,mid;
	ll res=0;
	for(b=k+1;b<=n;b++)
	{
		for(a=0;a+b<=n;a+=b)
		{
			res+=min(b-k,n-a+1);
		//	printf("a=%d b=%d res=%lld\n",a,b,res);
		}
		l=a,r=n;
		while(l<=r)
		{
			mid=(l+r)>>1;
			if(mid%b>=k)	r=mid-1;
			else	l=mid+1;
		}
		res+=n-l+1;
		if(k==0)	res--;
	}
	wi(res);putchar('\n');
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <ios> 
#include <vector>
#include <string>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#include <map>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define sz(c) ((int)(c).size())

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;
const int MAX=1010;
const long double INF=1e18;

struct edge{int to; long double cost;};
typedef pair<long double,int> P;
int N;
vector<edge> G[MAX];
ld d[MAX];

void add_edge(int u, int v, ld cost){
	edge e = {v, cost};
	G[u].push_back(e);
}

void Dij(int s){
	priority_queue<P,vector<P>, greater<P>> que;
	rep(i,N+2)d[i]=INF; //1-indexedならrep1に変更;
	d[s] = 0;
	que.push(make_pair(0,s));
	
	while(!que.empty()){
		P p = que.top();que.pop();
		int v=p.second;
		if(d[v] < p.first) continue;
		for(int i = 0; i < G[v].size(); i++){
			edge e = G[v][i];
			if(d[e.to] > d[v]+e.cost){
				d[e.to] = d[v]+e.cost;
				que.push(make_pair(d[e.to], e.to));
			}
		}
	}
}

ld dist(ld x1, ld y1, ld x2, ld y2){
	return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

int main(){
	ld xs, ys, xt, yt;
	cin>>xs>>ys>>xt>>yt;
	cin>>N;
	ld x[MAX], y[MAX], r[MAX];
	x[0]=xs;
	y[0]=ys;
	r[0]=0;
	rep1(i,N)cin>>x[i]>>y[i]>>r[i];
	x[N+1]=xt;
	y[N+1]=yt;
	r[N+1]=0;
	
	rep(i,N+2)rep(j,N+2)if(i<j){
		ld sd=dist(x[i], y[i], x[j], y[j])-r[i]-r[j];
		if(sd>=0){
          	add_edge(i, j, sd);
          	add_edge(j, i, sd);
        }
		else{
          	add_edge(i, j, 0);
          	add_edge(j, i, 0);
        }
	}
	Dij(0);
  	cout<<fixed;
  	cout<<setprecision(12)<<d[N+1]<<endl;
}

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	vector<string> lst={"SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"};
	string s; cin>>s;
	for (int i=0; i<7; i++)
		if(s==lst[i]) {
			cout<<7-i<<"\n";
			break;
		}
	return 0;
}

Measured memory_bytes: 256
S = str(input())
T = str(input())

Slen = len(S)
Tlen = len(T)
diff = Slen - Tlen

ans = [0] * (diff+1)
for i in range(diff+1):
	S_i = i
	for j in range(Tlen):
		if S[S_i] != T[j]:
			ans[i] = ans[i] + 1
		S_i += 1
min_ans = min(ans)
print(min_ans)

Measured memory_bytes: 9132
n, x, m =list(map(int, input().split()))

# 循環が先頭ではなく途中に戻るパターンもある

mod_list = [x]
mod_dict = {x: 0}
now = x
idx = 0

while True:
    now = now ** 2
    now %= m

    idx += 1
    if now in mod_dict:
        # 周期が見つかった
        period = idx - mod_dict[now]
        initial = mod_dict[now]
        break
    else:
        mod_list.append(now)
        mod_dict[now] = idx
    
# print(mod_list)
# print(mod_list[:initial])
# print(initial)

if n <= initial:
    print(sum(mod_list[:n]))
else:
    ans = 0
    ans += sum(mod_list[:initial])

    loop_num = (n - initial) // period
    rest = (n - initial) % period

    ans += sum(mod_list[initial:]) * loop_num
    ans += sum(mod_list[initial: initial+rest])
    print(ans)



Measured memory_bytes: 15740
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const int N=1e5+10;
int a[N],b[N],c[N];

void solve(){
    int n,k;
    scanf("%d%d",&n,&k);
    if(k<=(n+1)/2){
        for(int i=1;i<=n;i++) a[i]=i+k-1;
        int index=0;
        for(int i=k+2*n-1;i>=k+n;i-=2) b[++index]=i;
        for(int i=k+2*n-2;i>=k+n;i-=2) b[++index]=i;
        index=0;
        for(int i=k+k+2*n-1;i>=k+2*n;i--) c[++index]=i;
        for(int i=k+3*n-1;i>k+k+2*n-1;i--) c[++index]=i;

        for(int i=1;i<=n;i++){
            assert(a[i]+b[i]<=c[i]);
            printf("%d %d %d\n",a[i],b[i],c[i]);
        }
    }
    else printf("-1\n");
}

int main(){

    solve();
	return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
#define int long long 
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define ld long double
#define F first
#define S second
int const M=2e5+10,mod=1e9+7,inf=1e9+10;
int n,a[M],ans[M];
pii cur[M];
main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)cin>>cur[i].F,cur[i].S=i;
	sort(cur+1,cur+n+1);
	for(int i=1;i<=n;i++)
	{
		if(i<=n/2)ans[cur[i].S]=cur[n/2+1].F;
		else ans[cur[i].S]=cur[n/2].F;
	}
	for(int i=1;i<=n;i++)cout<<ans[i]<<"\n";
}

Measured memory_bytes: 8320
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
  int x;
  scanf("%d",&x);
  if(x==7||x==5||x==3){
    printf("YES\n");
  }else{
    printf("NO\n");
  }
  return 0;
}


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

#define INF 1e9
using namespace std;
using ll = long long;

int main() {

    string S; cin >> S;

    ll ans = 700;

    for (int i = 0; i < S.size(); ++i) {
        if (S[i] == 'o') {
            ans += 100;
        }
    }

    cout << ans << endl;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<ld> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;

#define fi first
#define se second
#define endl '\n'
#define MOD(n,k) ( (n % k) + k ) % k
#define isOn(S, j) (S & (1 << j) )
#define setBit(S, j) (S | (1 << j ) )
#define LSB(S) (S & (-S))

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

	cin >> n;

	while (n - LSB(n) > 0)
		n -= LSB(n);

	cout << n << endl;

	return 0;
}


Measured memory_bytes: 256
import Control.Applicative
main = do
  [a, b] <- map read . words <$> getLine
  putStrLn $ a `compare'` b
  
compare' :: Int -> Int -> String
compare' a b
  | ordering == LT = "a < b"
  | ordering == GT = "a > b"
  | ordering == EQ = "a == b"
  where ordering = a `compare` b


Measured memory_bytes: 3604
#include<iostream>
#include<bits/stdc++.h> 
using namespace std;
int v[105],w[100005];
long long dp[100005]={0};
long long knapsack(int n,int W)
{
	int i,j;
	for(i=0;i<n;i++)
	{
		for(j=W;j>=w[i];j--)
			dp[j]=max(dp[j],dp[j-w[i]]+v[i]);	
	}
	return dp[W];
}
int main()
{
	int i,n,W;
	cin>>n>>W;
	for(i=0;i<n;i++)
	{
		cin>>w[i]>>v[i];
	}
	cout<<knapsack(n,W)<<endl;
}

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

using namespace std;

const int N = 200010;

int a[2][N];
int lg[N];
int f[2][18][N];

inline int get(int l, int r, int w) {
  int k = lg[r - l + 1];
  return a[w][f[w][k][l]] < a[w][f[w][k][r - (1 << k) + 1]] ? f[w][k][l] : f[w][k][r - (1 << k) + 1];
}

struct E {
  int l, r, p, q, w;
  E() {}
  E(int nl, int nr, int np, int nq, int nw) : l(nl), r(nr), p(np), q(nq), w(nw) {}
  bool operator < (const E &o) const {
    return a[w][p] < a[o.w][o.p];
  }
};

const int inf = 1e9;

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int w = i % 2;
    scanf("%d", a[w] + i);
    a[1 - w][i] = inf;
  }
  lg[0] = -1;
  for (int i = 1; i < N; ++i) {
    lg[i] = lg[i / 2] + 1;
  }
  for (int w = 0; w < 2; ++w) {
    for (int j = 0, d = 1; d <= n; ++j, d *= 2) {
      for (int i = 0; i + d <= n; ++i) {
        if (j == 0) {
          f[w][j][i] = i;
        } else {
          f[w][j][i] = (a[w][f[w][j - 1][i]] < a[w][f[w][j - 1][i + d / 2]] ? f[w][j - 1][i] : f[w][j - 1][i + d / 2]);
        }
      }
    }
  }
  int p = get(0, n - 1, 0);
  int q = get(p + 1, n - 1, 1);
  set <E> s;
  s.emplace(0, n - 1, p, q, 0);
  for (int i = 0; i < n; i += 2) {
    if (i > 0) putchar(' ');
    p = s.begin()->p;
    q = s.begin()->q;
    int w = s.begin()->w;
    printf("%d %d", a[w][p], a[1 - w][q]);
    int l = s.begin()->l;
    int r = s.begin()->r;
    s.erase(s.begin());
    int nw = 1 - w;
    if (l < p - 1) {
      int np = get(l, p - 1, w);
      int nq = get(np + 1, p - 1, 1 - w);
      s.emplace(l, p - 1, np, nq, w);
    }
    if (p + 1 < q - 1) {
      int np = get(p + 1, q - 1, nw);
      int nq = get(np + 1, q - 1, 1 - nw);
      s.emplace(p + 1, q - 1, np, nq, nw);
    }
    if (q + 1 < r) {
      int np = get(q + 1, r, w);
      int nq = get(np + 1, r, 1 - w);
      s.emplace(q + 1, r, np, nq, w);
    }
  }
  putchar('\n');
}

Measured memory_bytes: 34560
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	private static final Integer ZERO = Integer.valueOf(0);

	public static void main(String[] args) {
		Map<Integer, Integer> vpmap = new HashMap<Integer, Integer>();
		int[] vlist = { 200, 300, 500, 1000, 1200, 1500 };
		int[] plist = { 380, 550, 850, (int) (380 * 5 * 0.8),
				(int) (550 * 4 * 0.85), (int) (850 * 3 * 0.88) };
		vpmap.put(ZERO, ZERO);
		for (int i = 0; i < 6; i++) {
			for (int vol = 0; vol + vlist[i] <= 5000; vol += 100) {
				final int setVol = vol + vlist[i];
				if (vpmap.containsKey(vol)) {
					int prePrice = (vpmap.containsKey(setVol)) ? vpmap
							.get(setVol) : Integer.MAX_VALUE;
					vpmap.put(setVol,
							Math.min(vpmap.get(vol) + plist[i], prePrice));
				}

			}
		}
		Scanner in = new Scanner(System.in);
		int need = 0;
		while ((need = in.nextInt()) != 0) {
			System.out.println(vpmap.get(need));
		}

	}
}

Measured memory_bytes: 17224
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

vector<int> v[1111];
int b[5555], dp[5555][5555];

int main(void)
{
	int A, B, a, i, j, ans = 0;

	scanf("%d %d" ,&A, &B);
	for (i = 1; i <= A; i++)
	{
		scanf("%d" ,&a);
		v[a].push_back(i);
	}
	for (i = 1; i <= B; i++)
		scanf("%d" ,&b[i]);

	for (i = 1; i <= B; i++)
	{
		int last = 0;
		for (j = i; j <= B; j++)
		{
			int it = lower_bound(v[b[j]].begin(), v[b[j]].end(), last + 1) - v[b[j]].begin();

			if (it == v[b[j]].size())
				break;

            last = v[b[j]][it];
		}

        ans = max(ans, j - i);
	}

	printf("%d\n" ,ans);
	return 0;
}


Measured memory_bytes: 2896
#include <iostream>
#include <cstdio>
using namespace std;
int read(){
    int cnt = 0;
    char ch = getchar();
    while (ch < '0' || '9' < ch)
        ch = getchar();
    while ('0' <= ch && ch <= '9'){
        cnt = cnt * 10 + ch - '0';
        ch = getchar();
    }
    return cnt;
}
int main(){
    int k = read(), x = read();
    for (int i = x - k + 1; i <= x + k - 1; ++ i)
        cout << i << " ";
}


Measured memory_bytes: 256
F=lambda x:x if P[x]<0else F(P[x]);N,M,*X=map(int,open(0).read().split());P=[-1]*-~N;S=N*~-N//2;r=[]
while X:
 r+=S,;b,a=sorted(map(F,(X.pop(),X.pop())))
 if a!=b:S-=P[a]*P[b];P[a]+=P[b];P[b]=a
*_,=map(print,r[::-1])

Measured memory_bytes: 25076
import java.util.Arrays;
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;

class Main{
	public static void main(String[]$){
		int n=gInt()*gInt();
		int[][]f=new int[10][10];
		for(int i:rep(10))
			for(int j:rep(10))
				f[i][j]=gInt();
		for(int k:rep(10))
			for(int i:rep(10))
				for(int j:rep(10))
					f[i][j]=Math.min(f[i][j],f[i][k]+f[k][j]);
		int r=0;
		for(int v:rep(n)) {
			v=gInt();
			r+=v==-1?0:f[v][1];
		}
		System.out.println(r);
	}

	static Scanner s=new Scanner(System.in);
	static int gInt() {return Integer.parseInt(s.next());}
	static long gLong() {return Long.parseLong(s.next());}

	static Range rep(int i) {return new Range(i);}
	static Range rep(int f,int t) {return new Range(f,t);}
	static class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{
		int from,to,c;
		Range(int from,int to){
			this.from=from;
			this.to=to;
			this.c=from;
		}
		Range(int n){
			this(0,n-1);
		}
		@Override
		public Iterator<Integer> iterator(){
			return this;
		}
		@Override
		public boolean hasNext(){
			return c<=to;
		}
		@Override
		public int nextInt(){
			return c++;
		}
	}
}

Measured memory_bytes: 42860
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<string>
#include <cctype>
#include <cstdlib>
#include<bitset>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

using namespace std;
using ll = long long;
typedef pair<int, int> P;

int main(){
for(int i=1; i<=5; i++){
    int a; cin >> a;
    if(a==0) out(i);
}
}


Measured memory_bytes: 3668
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

long long GetSum(long long b, long long n) {
    long long result = 0;
    while (n > 0) {
        result += n % b;
        n /= b;
    }
    return result;
}

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

    long long n, s;
    cin >> n >> s;

    long long bResult = -1;

    auto updateResult = [&bResult, n, s] (long long b) {
        if (b >= 2 && GetSum(b, n) == s && (b < bResult || bResult == -1)) {
            bResult = b;
        }
    };

    updateResult(n + 1);

    if (n > s) {
        const long long m = n - s;
        for (long long d = 1; d * d <= m; ++d) {
            if (m % d == 0) {
                long long d1 = d;
                long long d2 = m / d1;

                updateResult(d1 + 1);
                updateResult(d2 + 1);
            }
        }
    }

    for (long long b = 2; b * b <= n; ++b) {
        updateResult(b);
    }

    cout << bResult << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#include <vector>
#include <cstring>
#include <queue>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define akumanosuuji = 666;
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
ll MAX(ll a,ll b,ll c){return max(a,max(b,c));}
ll MIN(ll a,ll b,ll c){return min(a,min(b,c));}
const ll mod = 1e9+7;
const int dx[4] = {0,1,0,-1};
const int dy[4] = {1,0,-1,0};
template<class T> inline bool chmax(T &a,T& b){if(a < b){a = b; return true;} else return false;}
template<class T> inline bool chmin(T &a,T& b){if(a > b){a = b; return true;} else return false;}
int main(){
    int a,b,x;
    cin >> a >> b >> x;
    a <= x && x <= a+b ? cout << "YES" << endl : cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end() 
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000
using namespace std;
typedef long long ll;

int main() {
    int ord;
    ll N, A, B, F;

    cin >> N;

    int ord_min = INF;

    FOR(i, 1, sqrt(N) + 1){
        A = i;

        if (N%i == 0){
            B = N / i;

            F = max(A, B);

            ord = log10(F) + 1;

            if (ord < ord_min){
                ord_min = ord;
            }   
        }
    }
    cout << ord_min << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import static java.lang.System.out;

public class Main{
    static MyReader in = new MyReader();

    public static void main(String[] args){
        int K = in.i();
        int m = 0;
        int ans = -1;
        for (int i = 1; i <= K; i++) {
            m = (10 * m + 7) % K;
            if (m == 0) {
                ans = i;
                break;
            }
        }
        out.println(ans);
    }

    static class MyReader extends BufferedReader {
        char[] cbuf = new char[1024];
        int head = 0;
        int tail = 0;

        MyReader() {
            super(new InputStreamReader(System.in));
        }

        char next() {
            if (head == tail) {
                try {
                    tail = read(cbuf, 0, cbuf.length);
                } catch (IOException e) {}
                head = 0;
            }
            return cbuf[head++];
        }

        void back() {
            head--;
        }

        boolean minus() {
            boolean minus;
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    if (!(minus = c == '-')) back();
                    return minus;
                }
            }
        }

        void skip() {
            while (true) {
                char c = next();
                if (c != ' ' && c != '\n' && c != '\r') {
                    back();
                    break;
                }
            }
        }

        char[] s(final int N) {
            skip();
            char[] s = new char[N];
            for (int i = 0; i < s.length; i++) {
                s[i] = next();
            }
            return s;
        }

        int i() {
            boolean minus = minus();
            int n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }

        int[] ii(final int N) {
            int[] a = new int[N];
            for (int j = 0; j < a.length; j++) a[j] = i();
            return a;
        }

        long l() {
            boolean minus = minus();
            long n = 0;
            while (true) {
                int k = next() - '0';
                if (k < 0 || 9 < k) break;
                n = 10 * n + k;
            }
            return minus ? -n : n;
        }
    }
}


Measured memory_bytes: 32664
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(void) {

	int n, num = 0;
	cin >> n;

	int a[n], rennum = 0;
	bool renzoku = false;

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

		if (i > 0) {
			if (a[i] == a[i - 1]) {
				rennum++;
				if (i == n - 1)num += (rennum + 1) / 2;
			}
			else {
				num += (rennum + 1) / 2;
				rennum = 0;
			}
		}
	}

	cout << num << "\n";


	return 0;
}

Measured memory_bytes: 384
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << endl;
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << "";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define wh while
#define ve vector
#define mp make_pair
#define tp tuple
#define mt make_tuple
#define pb push_back
#define pof pop_front
#define pob pop_back
#define pf push_front
#define fr front
#define ft first
#define sc second
#define tos to_string
#define len length
#define rt return
#define br break
#define con continue
#define lcm(n, m) (n * m / __gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m) - 1;i>=(int)(n);i--)
#define rev(i, m) revi(i, m, 0)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define all(n) n.begin(), n.end()
#define allr(n) n.rbegin(), n.rend()
#define sp(n) cout << fixed << setprecision(n)
#define pi 3.14159265358979323846
#define inf 1000000007
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数
// __builtin_popcount bitの個数

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

int main() {
  int h, w;
  ci(h, w);
  ve<ve<st>> S(h, ve<st>(w));
  rep(i, h){
    rep(j, w){
      ci(S.at(i).at(j));
      if(S.at(i).at(j) == "snuke"){
        cout << char('A' + j) << i + 1 << endl;
        rt 0;
      }
    }
  }
}


Measured memory_bytes: 256
table = list(map(int,input().split()))

for i in range(2,0,-1):
    k = 0
    while k < i:
        if table[k] > table[k+1]:
            table[k],table[k+1] = table[k+1],table[k]
        k += 1;


print(table[0],table[1],table[2])



Measured memory_bytes: 5600