akhauriyash/Code-Regression huggingface dataset:
from collections import defaultdict
import sys

input = sys.stdin.buffer.readline

def scc(V, E):
    g = defaultdict(list)
    rg = defaultdict(list)
    for u, v in E:
        g[u].append(v)
        rg[v].append(u)


    o = []
    done = set()
    for u in V:
        if u in done:
            continue

        s = [(u, True)]
        while s:
            u, f = s.pop()
            if f:
                if u in done:
                    continue
                done.add(u)
                s.append((u, False))
                for v in g[u]:
                    if v in done:
                        continue
                    s.append((v, True))
            else:
                o.append(u)

    done = set()
    ans = []
    while o:
        u = o.pop()
        if u in done:
            continue

        s = [u]
        vv = [u]
        done.add(u)
        while s:
            u = s.pop()
            for v in rg[u]:
                if v in done:
                    continue
                vv.append(v)
                s.append(v)
                done.add(v)
        ans.append(vv)


    return ans


def atcoder_practice2_g():
    N, M = map(int, input().split())

    E = []
    for _ in range(M):
        a, b = map(int, input().split())
        E.append((a, b))
    V = list(range(N))
    vv = scc(V, E)
    print(len(vv))
    for r in vv:
        print(len(r), *r)


def test():
    g = {
        1: [2],
        5: [2],
        2: [4, 3],
        3: [4, 7, 6],
        4: [5, 8],
        6: [9],
        7: [8],
        8: [9],
        9: [7, 10],
        10: []
    }

    V = list(range(1, 11))
    E = []
    for u, e in g.items():
        for v in e:
            E.append((u, v))

    vv = scc(V, E)
    for r in vv:
        print(r)


if __name__ == "__main__":
    # test()
    atcoder_practice2_g()


Measured memory_bytes: 332788
#include<iostream>
#include<cmath>
#define n 100;
using namespace std;

int main() {

	unsigned long long int x;
	cin >> x;

	unsigned long long  int ans = n;
	unsigned long long int i = 0;
	while (x > ans) {
		ans *= (long double)1.01;
		i++;
	}

	cout << i << endl;

	return 0;

}

Measured memory_bytes: 3624
#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  long long ans = 0;
  REP(i, n) {
    int temp; cin >> temp;
    ans += temp - 1;
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
//#pragma comment(linker, "/STACK:102400000,102400000") 
#pragma warning(disable:4996)
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define eps 1e-10
#define LL_INF 0x33ffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 1e5 + 5;
const ll mod = 1e9 + 7;
const double PI = acos(-1.0);
ll po(ll a, ll b) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a, ll b) { if (a == 0) { return b; } else { return gcd(b%a, a); } }

int n;
int val[maxn], ans[maxn], p1[maxn], p2[maxn];
map<int, int>hax;

void solve()
{
	sa(n);
	repp(i, 1, n)
	{
		sa(val[i]);
		ans[i] = val[i];
	}
	sort(ans + 1, ans + n + 1);
	repp(i, 1, n)
	{
		hax[ans[i]] = i;
		p2[i] = i;
	}
	repp(i, 1, n)
	{
		p1[hax[val[i]]] = i;
	}
	int r = 0;
	repp(i, 1, n)
	{
		if (abs((p1[i] - p2[i])) & 1)
		{
			r++;
		}
	}
	printf("%d", r / 2);
}

int main()
{
	solve();
	return 0;
}


Measured memory_bytes: 6528
#include <stdio.h>


int quick(int a[],int left,int right);
int swap(int* ,int* );                	

int main(void){
	int N,M;
	scanf("%d %d",&N,&M);
	
	int X[M],i;
	int min;
	for(i=0;i<M;i++){
	scanf("%d",&X[i]);
	}
	quick(X,0,M);

/*			for(i=0;i<M;i++){
				printf("%d ",X[i]);
		}
*/
	//N<Mを考える
	if(N<M){
		int sa[M-1];
		for(i=0;i<M-1;i++){
			sa[i]=X[i+1]-X[i];
			}
		quick(sa,0,M-1);
/*					printf("\n");
					for(i=0;i<M-1;i++){
					printf("%d ",sa[i]);
					}
*/
		min=0;
		for(i=0;i<M-N;i++){
			min+=sa[i];
		}
		printf("%d",min);
	} else printf("0");
	
		return 0;
}

int quick(int a[],int left, int right){	//クイックソート関数
	if(right-left<=1) return 0;
	
	/*printf("\n");
	for(int n=0;n<10;n++){  		//確認用
				printf("%d ",a[n]);
	}*/
				
	
	int j,pivot,pivot_index;
	//i:pivot未満を左詰めで格納 j:左から走査 pivot:適当な要素
	
	pivot_index=(left+right)/2;
	pivot=a[pivot_index];
	swap(&a[pivot_index],&a[right-1]);		//pivot=5,N-10  3,6,5,9,23,5,6,1,0,7
	
	
	int i=left; 
	for(j=left;j<right-1;++j){
		if (a[j]<pivot){
			swap(&a[j],&a[i++]);
				
		}
	}
			swap(&a[i],&a[right-1]);
	
	    quick(a,left,i);
		quick(a,i+1,right);
		
	return 0;
	
}

int swap(int *a,int *b){
	int tmp;
	tmp=*a;
	*a=*b;
	*b=tmp;
	return 0;
}


Measured memory_bytes: 4224
import math
import sys
def input():
    return sys.stdin.readline().rstrip('\n')


def calc(N, A):
    result = 0
    diff = [i - A[i] for i in range(N)]
    d1 = {}
    for x in diff:
        d1[x] = (d1[x] if x in d1 else 0) + 1 
    plus = [i + A[i] for i in range(N)]
    d2 = {}
    for x in plus:
        d2[x] = (d2[x] if x in d2 else 0) + 1
    for x in d1:
        y = d2[x] if x in d2 else 0
        result += d1[x] * y
    return result
    

N = int(input())
A = [int(s) for s in input().split()]
print(calc(N, A))

Measured memory_bytes: 143404
def A_hex(X, Y):
    x = [10, 11, 12, 13, 14, 15, 16][ord(X) - ord('A')]
    y = [10, 11, 12, 13, 14, 15, 16][ord(Y) - ord('A')]
    if x > y:
        return '>'
    elif x < y:
        return '<'
    else:
        return '='

X,Y = input().split()
print(A_hex(X, Y))

Measured memory_bytes: 3064
# include<iostream>
# include<cstdio>
using namespace std;
int A[105];
int sumM(int x,int y)
{
	return ((x-1)/y+1);
}
int main()
{
	int N,D,X;
	cin>>N;
	cin>>D>>X;
	for (int i=1;i<=N;i++)
	{
		cin>>A[i];
	}
	int sum=0;
	for (int i=1;i<=N;i++)
	{

		sum+=sumM(D,A[i]);
	}
	sum=sum+X;
	cout<<sum<<endl;
	return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<vector>
#include<cctype>
using namespace std;
int n;
inline int numtot(int x)
{
	int tot(0);
	while(x){tot+=(x%10),x/=10;}
	return tot;
}
signed main()
{
	int l,r,ans(0);
	scanf("%d%d%d",&n,&l,&r);
	for(register int i(1);i<=n;i++){ans+=(((l<=(numtot(i)))&&((numtot(i))<=r))*i);}
	printf("%d",ans);
	return putchar(10),0;
}

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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

template<typename T1,typename T2> using M = map< T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;
using Mci = M<char, int>;

int main(){
    int n;
    cin>>n;
    Vi d(n);
    REP(i,n) cin>>d[i];
    
    sort(ALL(d));

    int m = d.size()/2;

    cout<<d[m]-d[m-1]<<endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
 
int main(){
 
  int n;
  cin >> n;
 
  vector<int> ar(n);
  for(auto &c: ar) 
    cin >> c;
 
  int res = 0;
  for(int i = 0; i < n; i++){
    int cnt = 0;
    while(i + 1 < n && ar[i + 1] <= ar[i]){
      cnt++;
      i++;
    }
    res = max(res, cnt);
  }
  cout << res << endl;
}


Measured memory_bytes: 640
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */
//codeforces
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define mp make_pair
#define pb push_back
#define sz(v) ((int)v.size())
#define all(v) v.begin(), v.end()
void parseArray(ll* A,ll n){ for ( ll K = 0; K < n; K++){ cin >> A[K]; } }
ll modInverse(ll a, ll b){ return 1<a ? b - modInverse(b%a,a)*b/a : 1; }
ll gcd(ll a, ll b){ return b?gcd(b, a % b):a; }
ll lcm(ll a, ll b){ return (a*b)/gcd(a, b); }
ld dist(ll x, ll y, ll a, ll b){ return sqrt((x - a)*(x - a) + (y - b)*(y - b)); }
void debug(ll* a, ll n) { for ( int k = 0; k < n; k++ ){ cout << a[k] << " ";} cerr << "\n"; }

char g[25][25];
ll h, w;
ll bfs(pair<ll, ll> s, pair<ll, ll> d) {
	queue<pair<pair<ll, ll>, ll>> q; 
	q.push({s, 0}); 
	bool vis[25][25]; memset(vis, 0, sizeof vis);
	vis[s.first][s.second] = true; 
	for ( int k = 0; k < h; k++ )
		for ( int j = 0; j < w; j++ )
			if (g[k][j] == '#')
				vis[k][j] = true;
	while (!q.empty()) { 
		pair<pair<ll, ll>, ll> p = q.front(); 
		q.pop(); 
		if (p.first.first == d.first && p.first.second == d.second) 
			return p.second;
		if (p.first.first - 1 >= 0 && vis[p.first.first - 1][p.first.second] == false) { 
			q.push({{p.first.first - 1, p.first.second}, p.second + 1}); 
			vis[p.first.first - 1][p.first.second] = true; 
		} 
		if (p.first.first + 1 < h && vis[p.first.first + 1][p.first.second] == false) { 
			q.push({{p.first.first + 1, p.first.second}, p.second + 1}); 
			vis[p.first.first + 1][p.first.second] = true; 
		} 
		if (p.first.second - 1 >= 0 && vis[p.first.first][p.first.second - 1] == false) { 
			q.push({{p.first.first, p.first.second - 1}, p.second + 1}); 
			vis[p.first.first][p.first.second - 1] = true; 
		} 
		if (p.first.second + 1 < w && vis[p.first.first][p.first.second + 1] == false) { 
			q.push({{p.first.first, p.first.second + 1}, p.second + 1}); 
			vis[p.first.first][p.first.second + 1] = true; 
		} 
	} 
	return -1; 
}

int main(){
	FASTIO;
	cin >> h >> w;
	for ( int k = 0; k < h; k++ )
		cin >> g[k];
	ll ans = 0;
	for ( int k = 0; k < h; k++ )
		for ( int j = 0; j < w; j++ )
			for ( int i = 0; i < h; i++ )
				for ( int l = 0; l < w; l++ )
					if (g[k][j] != '#' && g[i][l] != '#') {
						ll x = bfs({k, j}, {i, l});
						ans = max(ans, x);
					}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int main(){
	int s;
	scanf("%d",&s);
	int a;
	int b;
	int c;
	int d;
	a=s%10;
	s=s/10;
	b=s%10;
	s=s/10;
	c=s%10;
	s=s/10;
	d=s;
	if(a==b||b==c||c==d)printf("Bad\n");
	else printf("Good\n");
	return 0;
}

Measured memory_bytes: 128
//ABC112B
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <math.h>
#include<stdio.h>
using namespace std;

int main(){
	int n, T;
	cin >> n >> T;
	int ans = 100000;
	for(int i=0;i<n;i++){
		int c, t;
		cin >> c >> t;
		if(t<=T){
			ans = min(ans,c);
		}
	}
	if(ans == 100000){
		cout << "TLE" << endl;
	}else{
		cout << ans << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#ifdef TEST
#define getchar_unlocked _getchar_nolock
#define putchar_unlocked _putchar_nolock
#endif
#define int long long
#define ins insert
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define pp pop
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define g0(a) get<0>(a)
#define g1(a) get<1>(a)
#define g2(a) get<2>(a)
#define g3(a) get<3>(a)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef double db;
typedef long long ll;
typedef pair<int, int> ii;
typedef tuple<int, int, int> iii;
typedef tree<pair<int, int>, null_type, less<pair<int, int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<pair<int, int>, null_type, less<pair<int, int> >, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int N, T, S;

main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N;
	for (int i = 1, u, v; i < N; i++) {
		cin >> u >> v;
		if (u > v) swap(u, v);
		S += u * (N - v + 1);
	}
	for (int i = 1; i <= N; i++)
		T += (N - i + 1) * (N - i + 2) / 2;
	cout << T - S << '\n';
}


Measured memory_bytes: 3664
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#define NIL -1
#define MAX 600000
#define REP(i,s,n) for(int i=s;i<n;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
int n;
int root;
int *p = new int[MAX];       //    p---|  Unit
int *left2 = new  int[MAX]; // left2 --|--------> T
int *right2 = new int[MAX]; //right2---|
int *key = new int[MAX];     // key----|
  
   
void Init(){
  rep(i,MAX){
    p[i]=left2[i]=right2[i]=key[i]=NIL;
  }
}
  
int TREE_MINIMUM(int x){
  while(left2[x] != NIL){
    x = left2[x];
  }
  return x;
}
  
  
int TREE_SUCCESSOR(int x){
  if(right2[x] != NIL)return TREE_MINIMUM(right2[x]);
  int y = p[x];
  while(y != NIL && x == right2[y]){
    x = y;
    y = p[y];
  }
  return y;
}
   
void TREE_DELETE(int z){
  int y,x;
  if(left2[z] == NIL || right2[z] == NIL)y = z;
  else y = TREE_SUCCESSOR(z);
  
  if(left2[y] != NIL)x = left2[y];
  else x = right2[y];
  
  if(x != NIL)p[x]=p[y];
  if(p[y] == NIL)root = x;
  else if(y == left2[p[y]])left2[p[y]] = x;
  else right2[p[y]] = x;
  
  if(y != z)key[z] = key[y];
  
}
  
  
bool SEARCH(int x,int k){
  if(k == key[x])return true;
  if(x == NIL)return false;
  if(k < key[x])return SEARCH(left2[x],k);
  else return SEARCH(right2[x],k);
}
  
   
void TREE_INSERT(int z){
  int y = NIL;
  int x = root;
   
  while(x != NIL){
    y = x;
    if(key[z] < key[x]){
      x = left2[x];
    }
    else x = right2[x];
  }
  p[z]=y;
  if(y == NIL){
    root = z;
  }
  else if(key[z] < key[y]){
    left2[y] = z;
  }else{
    right2[y] = z;
  }
   
}
  
int IndexSearch(int x){
  for(int i=0;i<MAX;i++){
    if(key[i] == x)return i;
  }
  return -1;
}
  
  
void InorderTreeWalk(int x){
  if(x != NIL){
    InorderTreeWalk(left2[x]);
    printf(" %d",key[x]);
    InorderTreeWalk(right2[x]);
  }
}
   
void PreorderTreeWalk(int x){
  if(x != NIL){
    printf(" %d",key[x]);
    PreorderTreeWalk(left2[x]);
    PreorderTreeWalk(right2[x]);
  }
}
   
   
int main(){
  int val;
  string op;
  long long zr;                   
  
   
  scanf("%d",&n);
  Init();
  root = -1;
  zr=0;
  while(n-- > 0){
    cin >> op;
    if(op == "insert"){
      scanf("%d",&val);
      key[zr]=val;       
      TREE_INSERT(zr);
      zr++;
    }else if(op == "print"){
      InorderTreeWalk(root);
      printf("\n");
      PreorderTreeWalk(root);
      printf("\n");
    }
    else if(op == "find"){
      scanf("%d",&val);
      if(SEARCH(root,val)){
    printf("yes\n");
      }else{
    printf("no\n");
      }
         
   
    }
    else if(op == "delete"){
      scanf("%d",&val);
      int inthis = IndexSearch(val);
      if(inthis != -1){
      TREE_DELETE(inthis);
      }
    }
  
  }
   
  delete [] p;
  delete [] left2;
  delete [] right2;
  delete [] key;
  
  return 0;
}

Measured memory_bytes: 10000
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Random;
import java.util.StringTokenizer;

public final class Main {

    public static void main(String[] args) {
        final FastScanner fs = new FastScanner();
        final int n = fs.nextInt();
        int count = 0;
        for (int i = 0; i < n; i++) {
            int l = fs.nextInt();
            int r = fs.nextInt();
            if (l == r) {
                if (++count == 3) {
                    System.out.println("Yes");
                    return;
                }
            } else {
                count = 0;
            }
        }
        System.out.println("No");
    }

    static final class Utils {
        public static void shuffleSort(int[] arr) {
            shuffle(arr);
            Arrays.sort(arr);
        }

        public static void shuffleSort(long[] arr) {
            shuffle(arr);
            Arrays.sort(arr);
        }

        public static void shuffle(int[] arr) {
            final Random r = new Random();

            for (int i = 0; i <= arr.length - 2; i++) {
                final int j = i + r.nextInt(arr.length - i);
                swap(arr, i, j);
            }
        }

        public static void shuffle(long[] arr) {
            final Random r = new Random();

            for (int i = 0; i <= arr.length - 2; i++) {
                final int j = i + r.nextInt(arr.length - i);
                swap(arr, i, j);
            }
        }

        public static void swap(int[] arr, int i, int j) {
            final int t = arr[i];
            arr[i] = arr[j];
            arr[j] = t;
        }

        public static void swap(long[] arr, int i, int j) {
            final long t = arr[i];
            arr[i] = arr[j];
            arr[j] = t;
        }

        private Utils() {}
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        private String next() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    //noinspection CallToPrintStackTrace
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        int[] nextIntArray(int n) {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++) { a[i] = nextInt(); }
            return a;
        }

        long[] nextLongArray(int n) {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++) { a[i] = nextLong(); }
            return a;
        }
    }
}


Measured memory_bytes: 32864
#include <bits/stdc++.h>
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define showvp(p) rep(i,p.size()) printf("%d %d\n", p[i].first, p[i].second);
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define incl(v,x) find(rng(v),x)!=v.end()
#define incls(s,c) s.find(c)!=string::npos
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define bit(n,k) ((n>>k)&1) // nのk bit目
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vs = vector<string>;
using P = pair<int, int>;
using T = tuple<int, int, int>;
using vp = vector<P>;
using vt = vector<T>;
const int mod = 1000000007;
const double EPS = 1e-9;
//const long double EPS = 1e-14;
const int INF = (1<<30)-1;
const ll LINF = (1LL<<62)-1;
#define dame { puts("No"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
inline int in() { int x; scanf("%d",&x); return x;}
//template<class T = int> inline T in() { T x; cin >> x; return (x);}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
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;}

ll dp[1005][20005];

int main () {
  ll h, n;
  cin >> h >> n;
  vl a(n), b(n);
  rep(i,n) cin >> a[i] >> b[i];

  rep(i,1005)rep(j,20005) dp[i][j] = LINF;
  dp[0][0] = 0;
  rep(i,n)rep(j,h+1) {
    dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
    dp[i+1][min(j+a[i],h)] = min(dp[i+1][min(j+a[i],h)], dp[i+1][j]+b[i]);
  }
  cout << dp[n][h] << endl;
  return 0;
}

Measured memory_bytes: 157312
// j;main(i){for(;9/i;i+=!(j%=9))printf("%dx%d=%d\n",i,j,++j*i);}

// k;main(a,b){for(;k=~scanf("%d%d",&a,&b);printf("%.f\n",a+b?log10(a+b)+1:1.));}
k;main(a,b){for(;k=~scanf("%d%d",&a,&b);printf("%d\n",a+b?(int)log10(a+b)+1:1));}


// #include <stdio.h>
 
// int main( void ) {
//     int a, b, d, tmp;
 
//     for ( ; scanf( "%d %d", &a, &b ) == 2; printf( "%d\n", d ) ) {
//         tmp = a + b;
//         for ( d = 1; tmp /= 10; d++ ) ;
//     }
 
//     return 0;
// }

// main(i,a,t,p,j){for(;~scanf("%d",&t)?i++<4?t<p?p=t:1:t<j?j=t:1:!printf("%d\n",p+j-50););}




// double a,b,c,d;i;main(){scanf("%lf%lf%lf%lf",&a,&b,&c,&d);i=!printf("%f\n",hypot(a-c,b-d));}
// double c[4];i;main(){for(;~scanf("%lf",c+i++););i=!printf("%f\n",hypot(*c-c[2],c[1]-c[3]));}
// double c[4],*p=c;i;main(){for(;~scanf("%lf",p++););i=!printf("%f\n",hypot(*c-c[2],c[1]-c[3]));}
// double c[],*p=c;main(){for(;~scanf("%lf",p++););p=!printf("%f\n",hypot(*c-c[2],c[1]-c[3]));}
// double a,b,c,d,*p=&d;main(){for(;~scanf("%lf",p++););p=!printf("%f\n",hypot(d-c,b-a));}




// s,n,i;main(x,y){for(;~scanf("%d,%d",&x,&y)?s+=x*y:!printf("%d\n%.f\n",s,.5+1.*n/i);i++)n+=y;}


// L;main(A,B,C,D){scanf("%d%d%d%d%d",&L,&A,&B,&C,&D);L=!printf("%.f\n",L-fmax(--A/C,--B/D)-1);}
// a,b,c,d,e,*p=&d;main(){for(;~scanf("%d",p++););p=!printf("%.f\n",d-fmax(--b/c,--e/a)-1);}



// char c[];p;main(t){for(;gets(c)**c;p=!puts(strncat(c,c,p%=strlen(c))+p))for(gets(&t);scanf("%d ",&t);p+=t);}

Measured memory_bytes: 644
#include<stdio.h>

int main(){
  int x;
  int i = 1;
  while(1){
    scanf("%d",&x);
    if(i <= 10000){
      if(1 <= x&&10000 >= x){
        printf("Case %d: %d\n",i,x);
        i++;
    }else if(x == 0){
      break;
    }
  }else break;
}
  return 0;
}

Measured memory_bytes: 1752
module Main where

import Data.Functor
import Data.List

main :: IO ()
main = do
  { xs <- getInts
  ; let result = sort xs
  ; putInts result
  }

getInts :: IO [Int]
getInts = map read . words <$> getLine

putInts :: [Int] -> IO ()
putInts = putStrLn . unwords . map show

Measured memory_bytes: 3672
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

using namespace std;

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

	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;

	int xlength = x2 - x1;
	int ylength = y2 - y1;

	int x3 = x2 - ylength;
	int y3 = y2 + xlength;

	int x4 = x1 - ylength;
	int y4 = y1 + xlength;

	cout << x3 << " " << y3 << " " << x4 << " " << y4;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = sc.nextInt();
		int total = 0;
		for(int i=0;i<=n;i++){
			total += i;
		}
		System.out.println(total);
	}

}


Measured memory_bytes: 9044
#include<stdio.h>

void trace(int A[],int N){
    int i;
    for(i=0;i<N;i++){
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n");
}
void insertionSort(int A[],int N){
    int i,j,v;
    for(i=1;i<N;i++){
        v=A[i];
        j=i-1;
        while(j>=0 && A[j]>v){
            A[j+1]=A[j];
            j--;
        }
        A[j+1]=v;
        trace(A,N);
    }
}
int main(){
    int N,i,j;
    int A[100];
    scanf("%d",&N);
    for(i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    
    trace(A,N);
    insertionSort(A,N);
    
    return 0;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

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

const llong inf = 1'000'000'000'000'007ll;
const llong mod = 1e9+7;

int main() {
	llong H, W, K;
	vector<string> cake;
	vector<vector<int>> area;

	cin >> H >> W >> K;
	cake.resize(H);
	area.resize(H, vector<int>(W, 0));
	for (auto &in: cake) {
		cin >> in;
	}

	queue<lpair> que, que1, que2;

	int cnt = 0;
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (cake[i][j] == '#') {
				area[i][j] = (++cnt);
				que.push(lpair(i, j));
			}
		}
	}

	while (que.size()) {
		que1.push(que.front());
		que.pop();
		while (que1.size()) {
			lpair now = que1.front();
			que1.pop();

			if (1 <= now.second && area[now.first][now.second-1] == 0) {
				area[now.first][now.second-1] = area[now.first][now.second];
				que1.push(lpair(now.first, now.second-1));
			}

			if (now.second < W-1 && area[now.first][now.second+1] == 0) {
				area[now.first][now.second+1] = area[now.first][now.second];
				que1.push(lpair(now.first, now.second+1));
			}

			que2.push(now);
		}
	}

	while (que2.size()) {
		lpair now = que2.front();
		que2.pop();

		if (1 <= now.first && area[now.first-1][now.second] == 0) {
			area[now.first-1][now.second] = area[now.first][now.second];
			que2.push(lpair(now.first-1, now.second));
		}

		if (now.first < H-1 && area[now.first+1][now.second] == 0) {
			area[now.first+1][now.second] = area[now.first][now.second];
			que2.push(lpair(now.first+1, now.second));
		}
	}

	for (auto &h: area) {
		for (auto &w: h) {
			cout << w << " ";
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 2816
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>

using namespace std;

int main(void){
    int a,b,c,k;

    cin >> a >> b >> c;
    cin >> k;

    int sum=0;
    int tmp=0;
    int tmp2=0;
    tmp = max(a, b);
    tmp = max(tmp, c);
    tmp2 = a + b +c - tmp;

    sum = tmp*pow(2,k) + tmp2;
   cout << sum << endl;
   return 0;

   
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		int c = saori.saori_hayami();
		if(a == b){
			System.out.println(c);
		} else if(b == c){
			System.out.println(a);
		} else {
			System.out.println(b);
		}
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define all(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main(){
    int N;
    cin>>N;
    if(N%10==2||N%10==4||N%10==5||N%10==7||N%10==9){
        cout << "hon" << endl;
        return 0;
    }else if(N%10==3){
        cout << "bon" << endl;
        return 0;
    }
    cout << "pon" << endl;
    return 0;
}


Measured memory_bytes: 3608
import sys
import itertools
sys.setrecursionlimit(10000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy

if __name__ == "__main__":
    n = input()
    s = 0
    for i in n:
        s += int(i)
    if s%9 == 0:
        print("Yes")
    else:
        print("No")

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

int main(){
  int n;
  cin >> n;
  int tar = (n-1)/2 +1;
  vector<double> pn(n);
  for(int i=0; i<n; ++i) cin >> pn[i];
  vector<double> dp(tar+1,0);
  dp[0] = 1;
  for(int i=0; i<n; ++i) for(int j=min(i+1,tar); j>=0; --j){
    if(j == tar) dp[j] = dp[j] + dp[j-1] *pn[i];
    else if(j != 0) dp[j] = dp[j] *(1-pn[i]) +dp[j-1] *pn[i];
    else dp[j] = dp[j] *(1-pn[i]);
  }
  printf("%.10f\n",dp[tar]);
}

Measured memory_bytes: 3812
#include <stdio.h>
#include <math.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    double r;
    double a,b;
    scanf("%lf",&r);
    
    a = M_PI*r*r;
    b = 2*M_PI*r;
    
    printf("%f %f\n",a,b);
    return 0;
}


Measured memory_bytes: 2104
#include <iostream>

#include <map>
#include <cmath>
#include <vector>
#include <cstring>
#include <algorithm>

using namespace std;

using ll = long long;
using ii = pair<ll, ll>;

int main()
{
    ios::sync_with_stdio(false);

    ll M, N;
    cin >> M >> N;

    if (M == 1 and N == 1)
    {
        cout << 1 << endl;
        return 0;
    }

    if (M == 1)
    {
        cout << N - 2 << endl;
        return 0;
    }

    if (N == 1)
    {
        cout << M - 2 << endl;
        return 0;
    }

    cout << (M - 2) * (N - 2) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h> 
int main(){
  int i=0,j=0;
  char a[1200];
  
  while(1){
    scanf("%c",&a[j]);
      if(a[j]=='\n') break;
      j++;
    }
    for(i=0;i<j;i++){

      if(a[i]>=65 && a[i]<=90){
	a[i]+=32;
      }
      else if(a[i]>=97 && a[i]<=122) {
	a[i]-=32;
      }
    }
  
  
    for(i=0;i<j;i++){
      printf("%c",a[i]);
    }

    printf("\n");


    return 0;
    }

Measured memory_bytes: 524
/*input
10
5 3
5 7
8 9
1 9
9 10
8 4
7 4
6 10
7 2
*/

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

int main() {
    int N;
    cin >> N;
    vector<P> es(N-1);
    rep(i, N-1) {
        int u, v;
        cin >> u >> v;
        if (u > v) swap(u, v);
        es[i] = P(u, v);
    }
    // sort(es.begin(), es.end(), [](int x, int y) {
    //     return x.second-x.first < y.second-y.first;
    // });
    ll ans = 0;
    rep(i, N-1) ans -= (ll)es[i].first*(N-es[i].second+1);
    for (int i = 0; i <= N; i++) ans += (ll)i*(i+1)/2;
    cout << ans << endl;
}

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

public class Main {
 
	
	public static int get(String a[],int index,int k,boolean visited[]) {
		
		if(index==a.length-1) {
			return 0;
		}
		if(index>=a.length || index<0 || visited[index]) {
			return Integer.MAX_VALUE/2;
		}
		
		visited[index] = true;
		int min = Integer.MAX_VALUE/2;
		for(int i=index+1;i<=index+k && i<a.length;i++) {
			if(a[index].charAt(i)=='1') {
				min = Math.min(min, get(a,i,k,visited)+1);
			}
		}
		for(int i=index-1;i>=index-k && i>=0;i--) {
			if(a[index].charAt(i)=='1') {
				min = Math.min(min, get(a,i,k,visited)+1);
			}
		}
		
		return min;
	}
	
	public static void main(String[] args) {
		
		Scanner s = new Scanner(System.in);
		
			long h = s.nextLong();
			long ctr=1,sum=0;
			while(h>0) {
				sum+=ctr;
				ctr*=2;
				h=h/2;
			}
			System.out.println(sum);
		
	    
		
	}
}

Measured memory_bytes: 21844
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)%MOD) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int N;
i64 Z, W;
i64 A[2020];

i64 dpx[2020][2020], dpy[2020][2020];
i64 accx[2020][2020], accy[2020][2020];

const i64 HOGE = 12345679803412LL;

i64 solveX(int, int);
i64 solveY(int, int);


i64 accX(int p, int q)
{
	if (accx[p][q] != HOGE) return accx[p][q];
	i64 v = HOGE;
	v = min(v, solveX(p, q));
	if (p < N) v = min(v, accX(p + 1, q));

	return accx[p][q] = v;
}
i64 accY(int p, int q)
{
	if (accy[p][q] != HOGE) return accy[p][q];
	i64 v = -HOGE;
	v = max(v, solveY(p, q));
	if (p < N) v = max(v, accY(p + 1, q));

	return accy[p][q] = v;
}
i64 solveX(int sp, int having)
{
	if (sp == N) {
		return abs(A[sp - 1] - A[having]);
	}
	if (dpx[sp][having] != HOGE) return dpx[sp][having];

	i64 ret = accY(sp + 1, sp - 1);
	return dpx[sp][having] = ret;
}
i64 solveY(int sp, int having)
{
	if (sp == N) {
		return abs(A[sp - 1] - A[having]);
	}
	if (dpy[sp][having] != HOGE) return dpy[sp][having];

	i64 ret = accX(sp + 1, sp - 1);
	return dpy[sp][having] = ret;
}


int main()
{
	scanf("%d%lld%lld", &N, &Z, &W);
	for (int i = 2; i < N + 2; ++i) scanf("%lld", A + i);
	A[0] = Z;
	A[1] = W;

	N += 2;

	for (int i = 0; i <= N + 1; ++i) {
		for (int j = 0; j <= N + 1; ++j) {
			dpx[i][j] = dpy[i][j] = HOGE;
			accx[i][j] = accy[i][j] = HOGE;
		}
	}
	printf("%lld\n", solveX(2, 0));

	return 0;
}


Measured memory_bytes: 127616
// Written By NewbieChd
#include <iostream>
#include <iomanip>
#include <cmath>
// #define double long double
using namespace std;

const int maxN = 100003;
inline double square(double x) { return x * x; }

struct Vector {
    double x, y;
    Vector() {}
    Vector(double x, double y) : x(x), y(y) {}
    friend Vector operator+(const Vector& a, const Vector& b) { return Vector(a.x + b.x, a.y + b.y); }
    friend Vector operator-(const Vector& a, const Vector& b) { return Vector(a.x - b.x, a.y - b.y); }
    friend Vector operator*(const Vector& a, const double& b) { return Vector(a.x * b, a.y * b); }
    friend Vector operator/(const Vector& a, const double& b) { return Vector(a.x / b, a.y / b); }
    inline double length() { return sqrt(square(x) + square(y)); }
    inline void read() { cin >> x >> y; }
    inline void write() { cout << fixed << setprecision(10) << x << ' ' << y << '\n'; }
};
inline double distance(Vector a, Vector b) { return sqrt(square(b.x - a.x) + square(b.y - a.y)); }
inline double dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
inline double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }

inline Vector project(Vector a, Vector b, Vector c) {
    b = a - b;
    return b * (dot(b, c - a) / square(b.length())) + a;
}

int main() {
    ios::sync_with_stdio(false);
    Vector a, b, c;
    a.read(), b.read();
    int Q;
    for (cin >> Q; Q; --Q)
        c.read(), project(a, b, c).write();
    return 0;
}



Measured memory_bytes: 3292
import numpy as np

def calc(a , b):
    arr = np.array([0,0,0])
    arr[0] = a + b
    arr[1] = a - b
    arr[2] = a * b
    return np.max(arr)

l = list(map(int, input().split()))
print(calc(l[0], l[1]))

Measured memory_bytes: 18440
#include <stdio.h>
#include <stdlib.h>
#define NUM 1000000007

long long int factorial(int x){
	long long ans=1;
	for(int i=1;i<=x;i++){
		ans *= i;
		ans %= NUM;
	}
	
	
	return ans;
}

int main(void){
	int n,m;
	long long ans;
	scanf("%d%d",&n,&m);
	if(m>n){ ans=m; m=n; n=ans;}
	if(n-m==1){
		ans = factorial(n)*factorial(n-1)%NUM;
	}else if(n==m){
		ans = 2*factorial(n)*factorial(n)%NUM;
	}else{
		ans = 0;
	}
	printf("%lld",ans);
	return 0;
}

Measured memory_bytes: 128
/**
 *   author: malviyanshiv
 *   created: 10 August 2019  17:33:09
**/

#include <bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for(int i = a; i < b; i++)
#define RREP(i, a, b) for(int i = a-1; i >= b; i--)
#define FORE(a) for(auto ele : a )
#define ALL(a) begin(a), end(a)
#define RPB(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

#define PB push_back
#define MP make_pair
#define MOD 1000000007
#define INF 0x7fffffff
#define LINF 2000000000000000007
#define F first
#define S second
#define TC int t; cin >> t; while(t--)
#define SET(a,b) memset(a,b,sizeof(a))

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

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


void optimizeIO(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
}

int main(){
    optimizeIO();

    ll k, x;
    cin >> k >> x;
    ll v = x - k + 1;
    v = max(-1000000ll, v);
    while(v < x){
        cout << v << " ";
        v++;
    }
    v = x+k-1;
    v = min(1000000ll, v);
    while(x <= v){
        cout << x << " ";
        x++;
    }
    
    return 0;
}

Measured memory_bytes: 256
N = int(input())
unit_list = [1, 6, 6**2, 6**3, 6**4, 6**5, 6**6, 9, 9**2, 9**3, 9**4, 9**5]
unit_list.sort(reverse=True)

memo = {}

def count_withdraw_Z(amount):
    result = []
    
    tmp = memo.get(amount, 0)
    if tmp != 0:
        return tmp
    
    for unit in unit_list:
        if unit == amount:
            memo[amount] = 1
            return 1
        elif unit < amount:
            result.append(count_withdraw_Z(amount - unit) + 1)
    
    memo[amount] = min(result)
    return memo[amount]

print(count_withdraw_Z(N))


Measured memory_bytes: 15116
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>

using namespace std;

struct SAT2 {
  vector<vector<int>> g;
  SAT2(int n) : g(n * 2, vector<int>(n * 2)) {};

  void add(int i, bool ii, int j, bool jj) {
    g[i * 2 + 1 - ii][j * 2 + jj] = true;
    g[j * 2 + 1 - jj][i * 2 + ii] = true;
  }
  
  bool can() {
    const int n = g.size();
    for (int k = 0; k < n; k++)
    for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      g[i][j] |= g[i][k] & g[k][j];
    for (int i = 0; i < n / 2; i++) {
      if (g[i * 2][i * 2 + 1] && g[i * 2 + 1][i * 2]) return false;
    }
    return true;
  }
};

int dist(int a, int b) {
  a %= 24;
  b %= 24;
  if (a > b) swap(a, b);
  return min(b - a, 24 - (b - a));
}

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

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

  for (int ans = 12; ans >= 0; ans--) {
    SAT2 sat(n + 1);
    for (int i = 0; i <= n; i++) {
      for (int j = i + 1; j <= n; j++) {
        if (dist(a[i], a[j]) < ans) {
          // not a[i] or not a[j]
          sat.add(i, 1, j, 1);
        }
        if (dist(a[i], 24 - a[j]) < ans) {
          // not a[i] or not a[j]
          sat.add(i, 1, j, 0);
        }
        if (dist(24 - a[i], 24 - a[j]) < ans) {
          // not a[i] or not a[j]
          sat.add(i, 0, j, 0);
        }
        if (dist(24 - a[i], a[j]) < ans) {
          // not a[i] or not a[j]
          sat.add(i, 0, j, 1);
        }
      }
    }
    if (sat.can()) {
      cout << ans << endl;
      return 0;
    }
  }
  cout << 0 << endl;
}


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

#define MAX_N 100

int N;
int a[MAX_N] = {};
int sum = 0;


void solve(){
  int mean1;
  int mean2;
  mean1 = int(sum / N);
  mean2 = mean1 + 1;
  long int ans1 = 0;
  long int ans2 = 0;
  for(int i = 0; i < N; i++){
    ans1 += (a[i] - mean1) * (a[i] - mean1);
    ans2 += (a[i] - mean2) * (a[i] - mean2);
  }
  if(ans1 > ans2) cout << ans2 << endl;
  else cout << ans1 << endl;
}


int main(){
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> a[i];
    sum += a[i];
  }
  solve();
  return 0;
}


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

int main() {
  string s, t;
  cin >> s >> t;
  int ans = 0;
  for (int i = 0; i < s.length(); i++) {
    if(s[i] != t[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}


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

/* typedef */
/* long系 */
typedef long long ll;   // long long
typedef long double ld; // long double
/* vector系 */
typedef vector<int> vi;                    // intのvector
typedef vector<double> vd;                 // doubleのvector
typedef vector<ll> vll;                    // llのvector
typedef vector<ld> vld;                    // ldのvector
typedef vector<pair<int, int>> vi_i;       // i_iのvector
typedef vector<pair<double, double>> vd_d; // d_dのvector
typedef vector<pair<ll, ll>> vl_l;         // l_lのvector
typedef vector<pair<ld, ld>> vld_ld;       // ld_ldのvector
typedef vector<string> vs;                 // stringのvector
/* pair系 */
typedef pair<int, int> i_i;       // int同士のpair
typedef pair<double, double> d_d; // double同士のpair
typedef pair<ll, ll> l_l;         // ll同士のpair
typedef pair<ld, ld> ld_ld;       // ld同士のpair

/* define */
#define pb push_back              // push_back
#define all(v) v.begin(), v.end() // コンテナ全体
#define PI (acos(-1))             // 円周率pi

void Main(void)
{
    ll n;
    cin >> n;
    vs s;
    s.resize(n);
    for (ll rct = 0; rct < n; rct++)
    {
        cin >> s[rct];
    }
    sort(all(s));
    ll ans = 1;
    for (ll i = 1; i < n; i++)
    {
        if (s[i] != s[i - 1])
            ans++;
    }
    cout << ans << endl;
}

int main(int argc, char *argv[])
{
    // cin, coutの高速化、ただしcのIOと一緒にしない
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    // fixed -> 少数の形で出力、setprecision -> 少数第n位まで出力
    cout << fixed << setprecision(15);
    // main実行
    Main();

    return 0;
}


Measured memory_bytes: 9504
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <iomanip>
#include <climits>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<PII> VPI;
typedef vector<PLL> VPL;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pf push_front
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ub upper_bound
#define lb lower_bound

int main(){
  int A,B,C,D,K;
  cin>>A>>B>>C>>D>>K;
  ll tmp=C*60+D-A*60-B;
  cout<<max(0ll,tmp-K)<<endl;
}


Measured memory_bytes: 3636
#include <algorithm>
#include<stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stack>
#include <queue>
#include<map>
#include <set>
#include<math.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define rep(i,n) for(ll i=0;i<n;++i)
#define Rep(i,n) for(ll i=1;i<=n;++i)
#define loop(i,m,n) for(ll i=m;i<n;++i)
#define ggr getchar(); getchar();return 0;
#define pie 3.141592653589793238462643383279
#define elif else if
#define P pair<ll,ll>
#define prique priority_queue<ll>
#define ALL(a)  (a).begin(),(a).end()
const int mod = 1000000007;
const int mod2 = 998244353;
int bin(int bina) {
	int ans = 0;
	for (int i = 0; bina > 0; i++)
	{
		ans = ans + (bina % 2) * pow(10, i);
		bina = bina / 2;
	}
	return ans;
}
bool prime(int n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n % i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int x) {
	if (x == 0)return 1;
	return kai(x - 1) * x % mod;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int nCr(int n, int r) {
	int ans = 1;
	for (ll i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (ll i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
int per(int n, int r) {
	r = n - r;
	int sum = 1;
	int i;
	for (i = n; i >= r + 1; i--)sum *= i;
	return sum;
}
struct union_find {
	int par[200010], size_[200010];
	void init(int x) {
		rep(i, x) { par[i] = i; size_[i] = 1; }
	}
	int find(int x) {
		if (par[x] == x)return x;
		return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x == y)return;
		if (size_[x] < size_[y]) {
			par[x] = y;
			size_[y] += size_[x];
		}
		else {
			par[y] = x;
			size_[x] += size_[y];
		}
	}
};

int ctoi(const char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return -1;
	}
}
int keta(int a) {
	return to_string(a).size();
}
int a[1010];
signed main() {
	int n;
	cin>>n;
	int ans=1;
	Rep(i,n){
		int memo=i;
		for(int j=2;j<=n;++j){
			while(memo%j==0){
				memo/=j;
				a[j]++;
			}
		}
	}
	Rep(i,n){
		ans*=(a[i]+1);
		ans%=mod;
	}
	cout<<ans<<endl;
}




Measured memory_bytes: 256
n,x=map(int,input().split())
L = list(map(int,input().split()))
d=0
i=1
for l in L:
	i+=1
	d+=l
	if d==x:
		print(i)
		exit()
	if d>x:
		print(i-1)
		exit()
print(n+1)

Measured memory_bytes: 3060