akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int MOD = 1e9 + 7;

void add(int &a, int b)
{
	a+=b;
	while(a>=MOD) a-=MOD;
}

int mult(int a, int b)
{
	return (a*1LL*b)%MOD;
}

vector<vector<int> > S;
bool su[150001];
int adj[150001][11];
map<vector<int>, int> ma;

void dfs(int sum, vector<int> V)
{
	S.pb(V);
	ma[V] = int(S.size()) - 1;
	for(int i=1;i<=7;i++)
	{
		if(sum+i<=17)
		{
			vi tmp=V;
			tmp.pb(i);
			dfs(sum+i,tmp);
		}
	}
}

int dp[41][150001][2];

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	dfs(0,{});
	for(int i=0;i<S.size();i++)
	{
		vi cur = S[i];
		int sum=0;
		for(int j=0;j<cur.size();j++) sum+=cur[j];
		for(int j=1;j<=10;j++)
		{
			if(j>=8)
			{
				adj[i][j]=0;
				continue;
			}
			vi tmp = cur;
			tmp.pb(j);
			int s = sum+j;
			reverse(tmp.begin(),tmp.end());
			while(!tmp.empty()&&s>17)
			{
				s-=tmp.back();
				tmp.pop_back();
			}
			reverse(tmp.begin(),tmp.end());
			adj[i][j] = ma[tmp];
		}
	}
	int n; int X[3];
	cin>>n>>X[0]>>X[1]>>X[2];
	for(int i=0;i<S.size();i++)
	{
		vi cur=S[i];
		bool pos=1;
		int s=0;
		while(s<X[2])
		{
			if(!cur.empty())
			{
				s+=cur.back();
				cur.pop_back();
			}
			else 
			{
				pos=0;
				break;
			}
		}
		if(s!=X[2])
		{
			pos=0;
			continue;
		}
		s=0;
		while(s<X[1])
		{
			if(!cur.empty())
			{
				s+=cur.back();
				cur.pop_back();
			}
			else 
			{
				pos=0;
				break;
			}
		}
		if(s!=X[1])
		{
			pos=0;
			continue;
		}
		s=0;
		while(s<X[0])
		{
			if(!cur.empty())
			{
				s+=cur.back();
				cur.pop_back();
			}
			else 
			{
				pos=0;
				break;
			}
		}
		if(s!=X[0])
		{
			pos=0;
			continue;
		}
		if(pos)
		{
			su[i]=1;
		}
	}
	dp[0][0][0] = 1;
	
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<S.size();j++)
		{
			for(int k=1;k<=10;k++)
			{
				int u = j; int v = adj[j][k];
				{
					int newl=0;
					int curv=v;
					if(su[v])
					{
						newl=1;
						curv=0;
					}
					add(dp[i][curv][newl],dp[i-1][u][0]);
				}
			}
		}
	}
	
	int sum=0;
	int cur=1;
	for(int j=n;j>=1;j--)
	{
		add(sum,mult(dp[j][0][1],cur));
		cur=mult(cur,10);
	}
	cout<<sum<<'\n';
}


Measured memory_bytes: 77488
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define All(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()   //reverse
#define strall(v) (v).cbegin(),(v).cend() //const_itterator
#define IN(a, b, x) (a<=x&&x<b)
using namespace std;
using ll = long long;
using Pair = pair<int,int>;
using Graph = vector<vector<ll>>;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<typename t, typename u, typename Comp=less<>>
bool chmax(t& xmax, const u& x, Comp comp={}) { if(comp(xmax, x)) { xmax = x; return true; } return false;}
template<typename t, typename u, typename Comp=less<>>
bool chmin(t& xmin, const u& x, Comp comp={}) { if(comp(x, xmin)) { xmin = x; return true;} return false;}
const int INF = 1e9;
const ll infl = ll(1e18)+5;

/*
*ios::sync_with_stdio(false);
*cin.tie(0);
*/

struct Edge{
  ll to,id;
};
using Gp = vector<vector<Edge>>; 
vector<int> path;
bool dfs(const Gp &G,int u,int v,int p){
  if(u == v){
    return true;
  }
  for(auto e:G[u]){
    if(e.to != p){
      if(dfs(G,e.to,v,u)){
      path.push_back(e.id); 
      return true;
    }
    }
  }
  return false;
}

int main(){
  int N;cin >> N;
  Gp G(N);
  rep(i,N-1){
    int a,b;
    cin >> a >> b;
    a--,b--;
    G[a].push_back({b,i});
    G[b].push_back({a,i});
  }
  int M;
  cin >> M;
  vector<ll> cons(M);
  rep(i,M){
    int u,v;
    cin >> u >> v;
    u--,v--;
    path =vector<int>();
    dfs(G,u,v,-1);
    for(auto e:path){
      cons[i] |= 1LL << e;
    }
  }
  //包除原理
  ll ans =0;
  rep(bit,1LL << M){
    ll eset = 0;
    rep(i,M){
      if(bit & (1LL<<i)){
        eset |= cons[i];
      }
    }
    int white = __builtin_popcountll(eset);
    ll num = 1LL << (N-1 - white);
    if(__builtin_popcountll(bit)%2 == 0){ //制約が奇数か偶数か
      ans+=num;
    }else{
      ans-=num;
    }
  }
  cout << ans  << endl;
  return 0;
}


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

int main()
{
  int N = 0, K = 0;
  cin >> N >> K;
  int h = 0;
  int count = 0;
  for (int i = 0; i < N; ++i)
  {
    cin >> h;
    if (K <= h)
      ++count;
  }
  cout << count;
  return 0;
}


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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)


int main(void){


	int N; cin >> N;
	vector<int> p(N);
	REP(i,N) cin >> p[i];

	bool flag = false;
	int cnt = 0;
	REP(i,N){
		if(i+1 != p[i]) cnt++;
	}

	if(cnt < 3) cout << "YES" << endl;
	else cout << "NO" << endl;



	return 0;

}


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

int main() {
  int N, M, C;

  cin >> N;
  cin >> M;
  cin >> C;

  /*
     int *a = new int[M], *B = new int[M]; // それぞれの行
     int **A = new int*[N]; // 特徴量を持つ行列
   */
  typedef long long LONG;
  vector<LONG> a{M}, B{M};
  vector<vector<LONG>> A;

  cin.ignore();
    cin.clear();
B.clear();
  for(int j = 0; j < M; ++j) {
    LONG tb;
    cin >> tb;
    //cout << tb << endl;
    B.push_back(tb);
  }

  for(int i = 0; i < N; ++i) {
      cin.clear();
a.clear();
    for(int j = 0; j < M; ++j) {
      LONG ta;
      cin >> ta;
      a.push_back(ta);
    }
    A.push_back(a);
  }

/*
  cout << "print:" << endl;
  for(auto elm : B) {
    cout << elm << " ";
  }
  cout << endl;

  for(auto row : A) {
    for(auto r : row) {
      cout << r << " ";
    }
    cout << endl;
  }
*/


  int count = 0;
  for(int i = 0; i < N; ++i) {
    int tmp = 0;
    for(int j = 0; j < M; ++j) {
      tmp += A[i][j] * B[j];
    }
    tmp += C;
    if(tmp > 0) count++;
  }
  cout << count << endl;

  /*
     delete[] a, B;
     for(int i = 0; i < N; ++i) {
     delete[] A[i];
     }
     delete[] A;
   */

  return 0;
}


Measured memory_bytes: 256
package main

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

func main() {
	fmt.Println(parseProblem(os.Stdin))
}

func parseProblem(r io.Reader) string {
	const (
		initialBufSize = 100000
		maxBufSize     = 1000000
	)
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	k := scanInt(sc)
	str := scanString(sc)
	if len(str) > k {
		return str[0:k] + "..."
	}
	return str
}

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1776
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>

#include <algorithm>
#include <numeric>
#include <cmath>

using namespace std;
typedef long long ll;
const long double PI = (acos(-1));
const long long MOD = 1000000007;
#define rep(i,n) REP(i,0,n)
#define REP(i,x,n) for(int i=x;i<n;++i)

///////////////////////////////////////////////////
// -------------------- I/O -------------------- //
///////////////////////////////////////////////////
// https://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords
template<typename T> void outputVec(const std::vector<T>& vec, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	for (auto it = vec.begin(); it != vec.end() - 1; ++it) { std::cout << *it << " "; }
	std::cout << *(vec.end() - 1) << "\n";
}
template<typename T> void outputVal(const T& res, const int precision = 0) {
	if (precision > 0) std::cout << std::fixed << std::setprecision(precision);
	std::cout << res << "\n";
}
template<typename T> T inputVal() { T a; std::cin >> a; return a; }
template<typename T> std::vector<T> inputVec(int N) {
	std::vector<T> vec(N);
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
	return vec;
}
template<typename T> void inputVec(std::vector<T>& vec) {
	for (auto it = vec.begin(); it != vec.end(); ++it) { std::cin >> *it; }
}

///////////////////////////////////////////////////
// ------------------- utils ------------------- //
///////////////////////////////////////////////////
// change min/max
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; }

///////////////////////////////////////////////////
// ------------------- main -------------------- //
///////////////////////////////////////////////////
void Main() {
	const int X = inputVal<int>();
	if (X < 100) {
		cout << "0" << endl;
		return;
	}

	int nbLim = X / 100;
	int nb    = X - nbLim * 100;

	if (nbLim >= nb) {
		cout << "1" << endl;
		return;
	}

	int nbGoods = 0;
	for (int i = 5; i > 0; --i) {
		const int div = nb / i;
		nbGoods += div;
		nb -= div * i;
		if (nbGoods > nbLim) {
			cout << "0" << endl; return;
		}
		if (nb == 0) {
			cout << "1" << endl; return;
		}
	}

}

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	std::cout << std::fixed << std::setprecision(15);
	Main();

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(void) {
	string S;
	cin >> S;
	string ans;
	for (int i = 0; S[i] != NULL; i++) {
		if (S[i] == '0')ans += '0';
		if (S[i] == '1')ans += '1';
		if (S[i] == 'B'&&ans.size() != 0)ans.pop_back();
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

#define MAX_DATA 500000

int temp[MAX_DATA];   
int count=0;

void MergeSort(int x[ ], int left, int right);
 
void MergeSort(int x[ ], int left, int right)
{
    int mid, i, j, k;
	
    if (left >= right)              
        return;                     

                                   
    mid = (left + right) / 2;      
    MergeSort(x, left, mid);        
    MergeSort(x, mid + 1, right);   

      
    for (i = left; i <= mid; i++)
        temp[i] = x[i];

      
    for (i = mid + 1, j = right; i <= right; i++, j--)
        temp[i] = x[j];

    i = left;         
    j = right;        
    
    for (k = left; k <= right; k++)    
      if (temp[i] <= temp[j]){      
	x[k] = temp[i++];
	count++;}
      else{
	x[k] = temp[j--];
	count++;}
    
}

int main()
{
  int i,n,x[MAX_DATA];

  scanf("%d",&n);
  for(i=0; i<n; i++)
    scanf("%d",&x[i]);

    MergeSort(x, 0, n - 1);
    
    for (i = 0; i < n-1; i++)
        printf("%d ", x[i]);
    printf("%d\n",x[i]);
    printf("%d\n",count);

    return 0;
}

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

int main() {
	int n;
	cin >> n;
	int F[50];
	F[0] = F[1] = 1;
	for (int i = 2; i <= n; i++)F[i] = F[i - 1] + F[i - 2];
	cout << F[n] << endl;
	return 0;
}


Measured memory_bytes: 3092
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/optional.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptor/reversed.hpp>
namespace adaptor = boost::adaptors;
template<class T>using p_queue = std::priority_queue<T, std::vector<T>, std::greater<>>;
struct union_find
{
	std::vector<int> upper, rank;
	std::size_t dsize;
	union_find(std::size_t size) :upper(size, -1), rank(size, 0), dsize(size)
	{
	}

	int group(int index)
	{
		if (upper[index] == -1)
		{
			return index;
		}
		else
		{
			return upper[index] = group(upper[index]);
		}
	}

	bool merge(int x, int y)
	{
		auto gx = group(x);
		auto gy = group(y);
		if (gx != gy)
		{
			--dsize;
			if (rank[gx] < rank[gy])
			{
				upper[gx] = gy;
			}
			else if (rank[gx] > rank[gy])
			{
				upper[gy] = gx;
			}
			else
			{
				upper[gx] = gy;
				++rank[gx];
			}
			return true;
		}
		return false;
	}

	auto get()
	{
		std::map<int, std::set<int>> ret;
		for (int i = 0; i < upper.size(); ++i)
		{
			ret[group(i)].emplace(i);
		}
		return ret;
	}

	auto tops()
	{
		std::set<int> ret;
		for (int i = 0; i < upper.size(); ++i)
		{
			ret.emplace(group(i));
		}
		return ret;
	}

	bool is_same_group(int x, int y)
	{
		return group(x) == group(y);
	}

	std::size_t size()
	{
		return dsize;
	}
};

void Main()
{
	int N, M;
	std::cin >> N >> M;
	union_find uf(N);
	for (int i : boost::irange(0, M))
	{
		int x, y, z;
		std::cin >> x >> y >> z;
		uf.merge(x - 1, y - 1);
	}
	std::cout << uf.size() << std::endl;
}

int main()
{
	std::cin.tie(nullptr);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}

Measured memory_bytes: 1024
import sys, os.path

if(os.path.exists('input.txt')):
    sys.stdin = open('input.txt',"r")
    sys.stdout = open('output.txt',"w")

sys.setrecursionlimit(10 ** 5)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))

def solve():
    sum=0
    lst = list(input())
    for _ in range(len(lst)):
        sum+=int(lst[_])
    if sum%9==0:
        print("Yes")
    else:
        print("No")
solve()

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

int main() {
int A;
  cin >> A;
  if(A == 0){
    cout << 1;
  }
  else{
    cout << 0;
  }
 
}


Measured memory_bytes: 3580
def rain_flows_into_dams(a)
  x1 = a.map.with_index do |v, i|
    sign = (i % 2 == 0 ? 1 : -1)
    sign * v
  end.inject(:+)

  ans = [x1]
  1.upto(a.size - 1) do |i|
    ans[i] = 2 * a[i - 1] - ans[i - 1]
  end
  puts ans.join("\s")
end

gets
a = gets.split.map(&:to_i)
rain_flows_into_dams(a)

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

int main(){
  int a[3];
  int b[3];

  int grid[3][3];
  for(int i = 0;i < 3;i++){
    for(int j = 0;j < 3;j++){
      cin >> grid[i][j];
    }
  }

  a[0] = 0;
  b[0] = grid[0][0];
  b[1] = grid[0][1];
  b[2] = grid[0][2];
  a[1] = grid[1][0] - b[0];
  a[2] = grid[2][0] - b[0];

  bool flag = true;
  for(int i = 0;i < 3;i++){
    for(int j = 0;j < 3;j++){
      if(grid[i][j] != a[i] + b[j])flag = false;
    }
  }

  if(!flag)cout << "No" << endl;
  else cout << "Yes" << endl;
 }


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const ll MOD = 1000000007;
ll cnt =0,ans=0;
const int MAX = 510000;


const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

int main(){
   int n,k;   cin >> n >> k;
   
   int l[k],r[k];
   for(int i=0;i<k;i++){
       cin >> l[i] >> r[i];
   }
   vector<mint> dp(n+1);
   dp[1] = 1;
   vector<mint> dpsum(n+1);
   dpsum[1] = 1;
   for(int i=2;i<=n;i++){
       for(int j=0;j<k;j++){
           int li = i - r[j];
           int ri = i - l[j];
           
           li = max(li,1);
           if(ri<0)continue;
           dp[i] += dpsum[ri]  - dpsum[li-1];
           
       }
       dpsum[i] = dpsum[i-1] + dp[i];
       
   }
   cout << dp[n] << endl;
}

Measured memory_bytes: 6404
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using pint = std::pair<int, int>;
using pll = std::pair<ll, ll>;
using std::vector;

#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

//////////////////////////////////////


//////////////////////////////////////

int main() {
    
    int a, b;
    cin >> a >> b;
    if (a > b) {
        int c = a;
        a = b;
        b = c;
    }
    FOR(i, 0, b) {
        cout << a;
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(a) for(int i=0; i<a; i++)



int main ()
{
	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
 
	long long int n; long long int base = 100; long long int count = 0;
	cin >> n;
	
	while(1)
	{
		base = base + base/100;
		count++;
		if(base>=n)
		{
			cout << count;
			break;
		}
	}
	
	return 0;
}



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

const ll INF = 1e18;

void solve() {

    ll x, k, d;
    cin >> x >> k >> d;
    x = abs(x);

    ll need = x/d;
    ll ans = INF;
    if (k <= need) {
        ans = x-k*d;
    } else {
        ll left = (k-need)%2;
        if (left) {
            ans = abs((x%d) - d);
        } else {
            ans = (x%d);
        }

        if (k-need > 0) {
            left = (k-need-1)%2;
            if (left) {
                ans = min(ans, (x%d));
            } else {
                ans = min(ans, abs((x%d)-d));
            }
        }
    }
    ans = abs(ans);
    printf("%lld\n", ans);
}


int main() {
    int T = 1;
    // scanf("%d", &T);
    while (T--) {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int n;
    cin>>n;
    vector<int> a(n);
    cin>>a;
    map<int,int> f,b;
    vector<int> ans;
    REP(i,n) {
        f[a[i]]++;
        b[a[n-1-i]]++;
        if(f==b) {
            ans.push_back(i+1);
        }
    }
    cout<<ans<<endl;
    return 0;
}




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

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

  cout << (B % A == 0 ? A + B : B - A) << endl;
}

Measured memory_bytes: 3624
import Control.Applicative ((<$>))
import Control.Monad (unless)
import Data.List (foldl')

main :: IO ()
main = do
  cs <- map read <$> words <$> getLine
  unless (cs == [0]) $ do
    solve cs >>= print
    main

solve :: [Int] -> IO Int
solve = return . maximum . (0:) . foldl' f [0]
  where f xs y = [w | u <- xs, v <- g y, let w = u + v, w <= 21]
        g x | x == 1 = [1, 11]
            | x >= 10 = [10]
            | otherwise = [x]



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

double area(vector<double> &x, vector<double> &y, vector<char> &d, double t) {
  double xmin = 1e18, xmax = -1e18, ymin = 1e18, ymax = -1e18;
  for (int i = 0; i < x.size(); i++) {
    double nx = x.at(i), ny = y.at(i);
    if (d.at(i) == 'L') nx -= t;
    else if (d.at(i) == 'R') nx += t;
    else if (d.at(i) == 'U') ny += t;
    else ny -= t;
    xmin = min(xmin, nx);
    xmax = max(xmax, nx);
    ymin = min(ymin, ny);
    ymax = max(ymax, ny);
  }
  return (xmax - xmin) * (ymax - ymin);
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  vector<double> x(n), y(n);
  vector<char> d(n);
  for (int i = 0; i < n; i++) cin >> x.at(i) >> y.at(i) >> d.at(i);
  
  vector<double> event;
  event.emplace_back(0);
  
  { // xmax
    double xmaxv = -1e9, xmaxr = -1e9, xmaxl = -1e9;
    for (int i = 0; i < n; i++) {
      if (d.at(i) == 'R') xmaxr = max(xmaxr, x.at(i));
      else if (d.at(i) == 'L') xmaxl = max(xmaxl, x.at(i));
      else xmaxv = max(xmaxv, x.at(i));
    }
    if (xmaxr < xmaxv) {
      event.emplace_back(xmaxv - xmaxr);
    }
    if (xmaxv < xmaxl) {
      event.emplace_back(xmaxl - xmaxv);
    }
    if (xmaxr < xmaxl) {
      event.emplace_back((xmaxl - xmaxr) / 2);
    }
  }
  
  { // xmin
    double xminv = 1e9, xminr = 1e9, xminl = 1e9;
    for (int i = 0; i < n; i++) {
      if (d.at(i) == 'R') xminr = min(xminr, x.at(i));
      else if (d.at(i) == 'L') xminl = min(xminl, x.at(i));
      else xminv = min(xminv, x.at(i));
    }
    if (xminr < xminv) {
      event.emplace_back(xminv - xminr);
    }
    if (xminv < xminl) {
      event.emplace_back(xminl - xminv);
    }
    if (xminr < xminl) {
      event.emplace_back((xminl - xminr) / 2);
    }
  }
  
  { // ymax
    double ymaxh = -1e9, ymaxu = -1e9, ymaxd = -1e9;
    for (int i = 0; i < n; i++) {
      if (d.at(i) == 'U') ymaxu = max(ymaxu, y.at(i));
      else if (d.at(i) == 'D') ymaxd = max(ymaxd, y.at(i));
      else ymaxh = max(ymaxh, y.at(i));
    }
    if (ymaxu < ymaxh) {
      event.emplace_back(ymaxh - ymaxu);
    }
    if (ymaxh < ymaxd) {
      event.emplace_back(ymaxd - ymaxh);
    }
    if (ymaxu < ymaxd) {
      event.emplace_back((ymaxd - ymaxu) / 2);
    }
  }
  
  { // ymin
    double yminh = 1e9, yminu = 1e9, ymind = 1e9;
    for (int i = 0; i < n; i++) {
      if (d.at(i) == 'U') yminu = min(yminu, y.at(i));
      else if (d.at(i) == 'D') ymind = min(ymind, y.at(i));
      else yminh = min(yminh, y.at(i));
    }
    if (yminu < yminh) {
      event.emplace_back(yminh - yminu);
    }
    if (yminh < ymind) {
      event.emplace_back(ymind - yminh);
    }
    if (yminu < ymind) {
      event.emplace_back((ymind - yminu) / 2);
    }
  }
  
  double ans = 1e18;
  for (int i = 0; i < event.size(); i++) {
    ans = min(ans, area(x, y, d, event.at(i)));
  }
  
  cout << fixed << setprecision(10) << ans << '\n';
}

Measured memory_bytes: 5260
a, b, n = map(int, input().split())

def f(x):
    return ((a * x) // b) - (a * (x // b))

if n < b - 1:
    max = f(n)
elif b == 1:
    max = 0
else:
    x = b - 1
    max = f(x)
    while x <= n:
        if max < f(x):
            max = f(x)
        x += b

print(max)

Measured memory_bytes: 61796
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))
order = {}
for i in range(n):
    order[a[i]] = i+1
sorted_order = sorted(order.items(), key=lambda x: x[0])
for o in sorted_order:
    print(o[1], end=' ')


Measured memory_bytes: 25400
#include <iostream>

using namespace std;

int main()
{
	int a,b,sum,diff,product;
	cin>>a>>b;
	sum = a+b;
	diff = a-b;
	product = a*b;
	if (sum>=diff && sum>=product){
		cout<<sum<<endl;
	}
	if (diff>sum && diff>=product){
		cout<<diff<<endl;
	}
	if (product>sum && product>diff){
		cout<<product<<endl;
	}
	return 0;
}

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

using namespace std;

struct Combination {
  int mod;
  vector< int64_t > mfact, rfact;

  Combination(int sz, int mod) : mfact(sz + 1), rfact(sz + 1), mod(mod) {
    mfact[0] = 1;
    for(int i = 1; i < mfact.size(); i++) {
      mfact[i] = mfact[i - 1] * i % mod;
    }
    rfact[sz] = inv(mfact[sz]);
    for(int i = sz - 1; i >= 0; i--) {
      rfact[i] = rfact[i + 1] * (i + 1) % mod;
    }
  }

  int64_t fact(int k) const {
    return (mfact[k]);
  }

  int64_t pow(int64_t x, int64_t n) const {
    int64_t ret = 1;
    while(n > 0) {
      if(n & 1) (ret *= x) %= mod;
      (x *= x) %= mod;
      n >>= 1;
    }
    return (ret);
  }

  int64_t inv(int64_t x) const {
    return (pow(x, mod - 2));
  }

  int64_t P(int n, int r) const {
    if(r < 0 || n < r) return (0);
    return (mfact[n] * rfact[n - r] % mod);
  }

  int64_t C(int p, int q) const {
    if(q < 0 || p < q) return (0);
    return (mfact[p] * rfact[q] % mod * rfact[p - q] % mod);
  }

  int64_t H(int n, int r) const {
    if(n < 0 || r < 0) return (0);
    return (r == 0 ? 1 : C(n + r - 1, r));
  }
};

using int64 = long long;
const int mod = 1e9 + 7;

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

  Combination beet(1 << 17, mod);
  vector< int > sz;
  int mul = 1;
  for(int i = 0; i < N; i++) {
    sz.emplace_back(mul);
    mul *= 2;
  }
  int people = (1 << N) - 1;

  vector< int64 > dp(1 << sz.size());
  dp[0] = 1;

  for(int i = M - 1; i >= 0; i--) {
    vector< int64 > dp2(dp);
    for(int j = 0; j < (1 << sz.size()); j++) {
      if(dp[j] == 0) continue;
      int rem = people - A[i];
      for(int k = 0; k < sz.size(); k++) {
        if((j >> k) & 1) rem -= sz[k];
      }
      if(rem < 0) continue;
      for(int k = 0; k < sz.size(); k++) {
        if((j >> k) & 1) continue;
        (dp2[j | (1 << k)] += dp[j] * beet.C(rem, sz[k]-1) % mod * beet.mfact[sz[k]] % mod) %= mod;
      }
    }
    dp.swap(dp2);
  }

  int64 ret = 0;
  for(int i = 0; i < (1 << sz.size()); i++) {
    int rest = people;
    for(int j = 0; j < sz.size(); j++) {
      if((i >> j) & 1) rest -= sz[j];
    }
    auto add = (dp[i] * beet.mfact[rest]) % mod;
    if(__builtin_parity(i)) (ret += mod - add) %= mod;
    else (ret += add) %= mod;
  }
  (ret *= (1 << N)) %= mod;
  cout << ret << endl;
}

Measured memory_bytes: 3456
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "unistd.h"
#include "string.h"
#include <math.h>
int ans=0;
int main(int argc, char* argv[]){
  double a,b,c,sum;
  scanf("%lf",&a);
  printf("%.0lf\n",pow(a,3));
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mp make_pair
#define pb push_back
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)


int main(){

  string s;
  cin >> s;
  int ans=INT_MAX;
  rep(i,s.size()-2){
    int a=atoi(s.substr(i,3).c_str());
    ans = min(abs(753-a), ans);
  }
  cout << ans << endl;
  
    return 0;

}


Measured memory_bytes: 256
#include<iostream>
#include<cstdlib>
#include<stack>
using namespace std;

int main(){
stack<int> S;
int a,b,x;
string s;

while(cin >> s){
  if(s[0] == '+'){
    a=S.top();S.pop();
    b=S.top();S.pop();
    S.push(a+b);
  }else if(s[0]=='-'){
    b=S.top();S.pop();
    a=S.top();S.pop();
    S.push(a-b);
  }else if(s[0]=='*'){
    a=S.top();S.pop();
    b=S.top();S.pop();
    S.push(a*b);
  }else {
    S.push(atoi(s.c_str()));
  }
}
cout<<S.top()<<endl;
return 0;
}



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

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

    vector<int> maxl(n+2, 0), maxr(n+2, 0); 
    for (int i = 1; i <= n; i++) {
        maxl[i] = max(maxl[i-1], a[i-1]);
        maxr[n-i+1] = max(maxr[n-i+2], a[n-i]);
    }
    for (int i = 1; i <= n; i++) cout << max(maxl[i-1], maxr[i+1]) << endl;
    return 0;
}

Measured memory_bytes: 3968
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def solve():
    a = input()
    if a.isupper():
        print("A")
    else:
        print("a")


def main():
    solve()


if __name__ == '__main__':
    main()


Measured memory_bytes: 9828
#include <bits/stdc++.h>
#define rep(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define repr(i, n, m) for (int i = (int)(n) - 1; i >= (int)(m); i--)
using namespace std;
using ll = int64_t;
const int MOD = 1000000007; // 10^9+7

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> h(N);
    rep(i, 0, N) cin >> h[i];

    vector<ll> dp(N, INT64_MAX);
    dp[0] = 0;
    
    // rep(i, 0, N -1)
    // {
    //     rep(k, 1, K + 1)
    //     {
    //         if (i + k < N) dp[i + k] = min(dp[i + k], dp[i] + abs(h[i] - h[i + k]));
    //     }    
    // }

    rep(i, 1, N)
    {
        rep(k, 1, K + 1)
        {
            if (i - k >= 0) dp[i] = min(dp[i], dp[i - k] + abs(h[i - k] - h[i]));
        }
    }

    cout << dp[N - 1] << endl;
}


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

int main(){
  int num;
  int kekka = 0;
  
  cin >> num;
  vector<int> vec(num);
  for(int i = 0; i < num; i++){
    if(i == num -1){
      vec.at(i) = vec.at(i-1);
      break;
    }
    cin >> vec.at(i);
  }

  
  for(int i = 0; i < num; i++){
    if(i == 0){
      kekka += vec.at(i);
      continue;
    }
    
    if(vec.at(i) <= vec.at(i-1)){
      kekka += vec.at(i);
    }else{
      kekka += vec.at(i-1);
    }
  }
  
  cout << kekka;
}

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

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define start_routine() int begtime = clock();
#define end_routine() int endtime = clock(); cerr << endl << "Time elapsed: " << (endtime - begtime)*1000/CLOCKS_PER_SEC << " ms"; return 0
#define speed() cin.tie(0), cout.tie(0), ios_base::sync_with_stdio(false)
#define exit(a, b) return cout << a, b;

#define PB push_back
#define MP make_pair

#define sd(n) scanf("%d", &n)
#define pdn(n) printf("%lld\n", n);
#define pds(n) printf("%lld ", n);
#define endl '\n'

#define forn(a, b, i) for (int i = a; i < b; i += 1)
#define all(v) v.begin(), v.end() 

using vi = vector<int>;
using vb = vector<bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

#define print(stuff) cout << stuff << endl
#define len(stuff) stuff.size()

#define int long long
#define float long double 
#define ll long long

const int inf = (int) 1e16;
const int upper = (int) 4e5 + 15;
const int M = (ll) 1e9 + 7;
const int mod = (ll) 998244353;
const double eps =  1e-8;

vector<int> topo, indeg;
vector<vi> adj;

priority_queue<pair<int, int>> q;

signed main () {
	start_routine();
	speed();
	#ifndef ONLINE_JUDGE
	// freopen("input.txt", "r", stdin);	
	// freopen("output.txt", "w", stdout);
	// freopen("errlog.txt", "w", stderr);
	#endif

	int n, m; cin >> n >> m;
	adj.resize(n + 1);
	indeg.resize(n + 1, 0);

	for (int i = 1; i <= m; i += 1) {
		int a, b; cin >> a >> b;
		adj[a].push_back(b);
		indeg[b] += 1;
	}

	vi dp(n + 1, 0);
	vb in(n + 1, false);
	for (int i = 1; i <= n; i += 1) {
		if (indeg[i] == 0) {
			q.push(make_pair(0, i));
		}
	}
	while (!q.empty()) {
		int curv = q.top().second;
		q.pop();

		if (in[curv]) continue;

		topo.push_back(curv);
		in[curv] = true;
		for (auto i: adj[curv]) {
			indeg[i] -= 1;
			q.push(make_pair(-indeg[i], i));
		}
	}

	for (int i = 0; i < len(topo); i += 1) {
		int curv = topo[i];
		for (auto j: adj[curv]) {
			dp[j] = max(dp[j], dp[curv] + 1);
		}
	}

	int mx = 0;

	for (int i = 1; i <= n; i += 1) mx = max(mx, (int) dp[i]);

	cout << mx;
 	end_routine();	
}

Measured memory_bytes: 8056
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

ll c[9];
int main() {
	ll n;
	cin>>n;
	for(int i=0;i<n;i++){
		int z;
		cin>>z;
		if(z>=3200){
			c[0]++;
		}
		else if(z>=2800){
			c[1]=1;
		}
		else if(z>=2400){
			c[2]=1;
		}
		else if(z>=2000){
			c[3]=1;
		}
		else if(z>=1600){
			c[4]=1;
		}
		else if(z>=1200){
			c[5]=1;
		}
		else if(z>=800){
			c[6]=1;
		}
		else if(z>=400){
			c[7]=1;
		}
		else{
			c[8]=1;
		}
	}
	ll ans=0;
	for(int i=1;i<9;i++){
		ans+=c[i];
	}
	if(ans==0){
		ans=1;
		c[0]--;
	}
	cout << ans<< " "<<(ans+c[0]);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define mp make_pair
#define PI pair<int,int>
#define For(i,l,r) for(int i=(int)(l);i<=(int)(r);i++)
#define Rep(i,r,l) for(int i=(int)(r);i>=(int)(l);i--)
#define pb push_back
#define fi first
#define se second
inline char gc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
#define gc getchar
inline ll read(){
	ll x = 0; char ch = gc(); bool positive = 1;
	for (; !isdigit(ch); ch = gc())	if (ch == '-')	positive = 0;
	for (; isdigit(ch); ch = gc())	x = x * 10 + ch - '0';
	return positive ? x : -x;
}
inline void write(ll a){
    if(a<0){
    	a=-a; putchar('-');
	}
    if(a>=10)write(a/10);
    putchar('0'+a%10);
}
inline void writeln(ll a){write(a); puts("");}
inline void wri(ll a){write(a); putchar(' ');}
inline ull rnd(){
	return ((ull)rand()<<30^rand())<<4|rand()%4;
}
const int N=200005;
void GG(){
	puts("No"); exit(0);
}
char s[N];
int f[N];
int main(){
	int n=read(),A=read(),B=read(),C=read(),D=read();
	scanf("%s",s+1);
	f[n+1]=f[n+2]=n+2;
	Rep(i,n,1)if(s[i]=='.')f[i]=max(f[i+1],max(f[i+2],i)); 
	if(f[A]<C||f[B]<D)GG();
	else {
		if(C>D){
			For(i,B,D)if(s[i]==s[i-1]&&s[i]==s[i+1]&&s[i]=='.'){puts("Yes"); return 0;}
			GG();
		}else puts("Yes");
	}
}

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

int main(){
    
    int a,b;
    cin>>a>>b;
    int q=(b-2*a)/2;
    int p = a-q;
    if(p>=0 && q>=0 && p+q==a && b%2==0)
    cout<<"Yes\n";
    else
    cout<<"No\n";
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
const long long INF = 1LL << 60;
const ll C = 1000000000+7;

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

int main() {
    int H, W;
    cin >> H >> W;
    string board[H];
    for(int i=0; i<H; i++) cin >> board[i];

    bool flg;
    for(int i=0; i<H; i++) {
        for(int j=0; j<W; j++) {
            flg = false;
            for(int k=0; k<4; k++) {
                int x = dx[k] + j;
                int y = dy[k] + i;
                if(x >= 0 && y >= 0 && x < W && y < H) {
                    if(board[i][j] == '.') flg = true;
                    else if(board[i][j] == '#' && board[y][x] == '#') flg = true;
                }
            }
            if(flg == false) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3640
import re
nums=input()
s=input()
pfin=''
for idx,ns in enumerate(nums.split()):
  pttr='{},{}'.format(ns,ns)
  pfin+='\d{'+pttr+'}'
  if idx==0: pfin+='-'
print('Yes' if re.match(pfin,s) is not None else 'No')

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

using namespace std;

int main()
{
  string s;
  cin>>s;
  int len=s.length(),count=0,arr[11]={0},j=0;
  s[len]=' ';
  for(int i=0;i<=len;i++){
    if(s[i]=='A' || s[i]=='T' || s[i]=='G' || s[i]=='C'){
        count++;
    }
    else{
        arr[j++]=count;
        count=0;
    }
  }
   sort(arr,arr+11);
  cout<<arr[10];
  return 0;
}


Measured memory_bytes: 3624
#include<stdio.h>
int main(void)
{
  int N;
  double a[10];
  char b[10];
  int c;
  double money=0;
  scanf("%d",&N);
  for(c=0;c<N;c++)
  {
    scanf("%lf %s",&a[c],b);
    if(b[0]=='B')
      a[c]= a[c]*380000;
    money+=a[c];
  }

  printf("%f",money);
  return 0;
}
  

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

using namespace std;

int main(int argc, char const *argv[]) {
  long long n, a[200], cnt, flag;

  cin >> n;

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

  cnt = 0;
  flag = 0;

  while (flag == 0)
  {
    for (long long i = 0; i < n; i++)
    {
      if (a[i] % 2 == 1)
      {
        flag = 1;
        break;
      }
      else
      {
        a[i] /= 2;
      }
    }
    cnt++;
  }
  cout << cnt - 1 << endl;

  return 0;
}


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

const int MAX = 200000;

int main(){
    int R[MAX];
    int n;
    cin >> n;
    for (int i = 0; i < n; i++){cin >> R[i];}
    
    int max_margin = -10000000000;
    int minv       = R[0]        ;
    
    for (int i = 1; i < n; i++){
        max_margin = max(max_margin, R[i] - minv);
        minv       = min(minv, R[i]);
    }
    
    cout << max_margin << endl;
    
    return 0;
}


Measured memory_bytes: 3880
use proconio::input;

fn main() {
    input! {
        n: usize,
        k: i64,
        c: i64,
        s: String,
    }

    let workable: Vec<_> = s.chars().map(|c| c == 'o').collect();

    let mut left = vec![false; n];
    let mut last_i = -(c + 1);
    for i in 0..(n as i64) {
        if last_i + c >= i {
            continue;
        }

        if workable[i as usize] {
            left[i as usize] = true;
            last_i = i;
        }
    }
    let left = left;
    let mut left_c = vec![0i64; n + 2];
    let mut left_l = vec![-(c + 1); n + 2];
    for i in 1..=n {
        left_c[i] = left_c[i - 1];
        if left[i - 1] {
            left_c[i] += 1;
        }

        if left[i - 1] {
            left_l[i] = i as i64;
        } else {
            left_l[i] = left_l[i - 1];
        }
    }
    let left_c = left_c;
    let left_l = left_l;

    let mut right = vec![false; n];
    let mut last_i = n as i64 + c;
    for i in (0..(n as i64)).rev() {
        if i + c >= last_i {
            continue;
        }

        if workable[i as usize] {
            right[i as usize] = true;
            last_i = i;
        }
    }
    let right = right;
    let mut right_c = vec![0i64; n + 2];
    let mut right_l = vec![n as i64 + c; n + 2];
    for i in (1..=n).rev() {
        right_c[i] = right_c[i + 1];
        if right[i - 1] {
            right_c[i] += 1;
        }

        if right[i - 1] {
            right_l[i] = i as i64;
        } else {
            right_l[i] = right_l[i + 1];
        }
    }
    let right_c = right_c;

    let mut ans = vec![];
    for i in 1..=n {
        let mut cap = left_c[i - 1] + right_c[i + 1];
        if right_l[i + 1] - left_l[i - 1] <= c {
            cap -= 1;
        }
        if cap < k {
            ans.push(i);
        }
    }

    for a in ans {
        println!("{}", a);
    }
}


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

int main(){
    int a, b, c, tmp;
    cin >> a >> b >> c;
    if(a > b){
        tmp = a;
        a = b;
        b = tmp;
    }

    if(b > c){
        tmp = b;
        b = c;
        c = tmp;
    }

    if(a > b){
        tmp = a;
        a = b;
        b = tmp;
    }

    cout << a << " " << b << " " << c << endl;

    return 0;
}


Measured memory_bytes: 3084
#include <bits/stdc++.h>
#define int long long
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef tuple<int,int,string,int,string> T;

signed main(){
	int n;
	cin>>n;
	vector<int>v(n);
	r(i,n)cin>>v[i];
	if(prev_permutation(v.begin(),v.end())){
		r(i,n){
			if(i)cout<<' ';
			cout<<v[i];
		}
		cout<<endl;
	}
	next_permutation(v.begin(),v.end());
	r(i,n){
		if(i)cout<<' ';
		cout<<v[i];
	}
	cout<<endl;
	if(next_permutation(v.begin(),v.end())){
		r(i,n){
			if(i)cout<<' ';
			cout<<v[i];
		}
		cout<<endl;
	}
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
vector<int> W(100001);

int main()
{
  int N, a;
  cin >> N;
  for (int i = 0; i <= 5; i++)
  {
    W.at(i) = i;
  }
  for (int i = 6; i <= N; i++)
  {
    a = W.at(i - 1) + 1;
    for (int j = 1; j <= 6; j++)
    {
      if (i - pow(6, j) < 0)
        break;
      a = min(a, W.at(i - pow(6, j)) + 1);
    }
    for (int j = 0; j <= 5; j++)
    {
      if (i - pow(9, j) < 0)
        break;
      a = min(a, W.at(i - pow(9, j)) + 1);
    }
    W.at(i) = a;
  }
  cout << W.at(N) << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define rbg rbegin()
#define red rend()
#define all(x) x.bg,x.ed
#define rall(x) x.rbg,x.red
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> bool chmax(t&a,u b){if(a<b){a=b; return true;} return false;}
template<class t,class u> bool chmin(t&a,u b){if(a>b){a=b; return true;} return false;}
template<class t,class u> t MAX(t a,u b){if(a>=b) return a; return b;}
template<class t,class u> t MIN(t a,u b){if(a<=b) return a; return b;}
template<class t> int SIZE(t s){return (int)s.size();}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using vvi=vc<vc<int>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    int r; cin >> r;
    cout << 3 * r * r << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 998244353
using namespace std;
typedef pair<llint, llint> P;
typedef pair<P, llint> E;

llint n, L, T;
llint x[100005], w[100005], y[100005];
vector<llint> cvec;
vector<P> vec, vec2;
llint ans[100005];

int main(void)
{
	cin >> n >> L >> T;
	for(int i = 1; i <= n; i++) cin >> x[i] >> w[i];
	
	for(int i = 1; i <= n; i++){
		vec.push_back(P(x[i], i));
		if(w[i] == 1) y[i] = (x[i]+T)%L;
		else{
			y[i] = ((x[i]-T)%L+L)%L;
			cvec.push_back(x[i]);
		}
		vec2.push_back(P(y[i], i));
	}
	sort(vec.begin(), vec.end());
	sort(vec2.begin(), vec2.end());
	sort(cvec.begin(), cvec.end());
	llint C = (llint)cvec.size();
	
	llint p = 0;
	for(int i = 1; i <= n; i++){
		if(w[i] == 1){
			p = i;
			break;
		}
	}
	if(C == 0 || p == 0){
		for(int i = 1; i <= n; i++) cout << y[i] << endl;
		return 0;
	}
	
	llint cnt = 2*T/L*C, rem = 2*T%L, pos = x[p];
	llint idx = lower_bound(cvec.begin(), cvec.end(), x[p]) - cvec.begin();
	for(int i = idx%C; ; i = (i+1)%C){
		llint d = ((cvec[i]-pos)%L+L)%L;
		if(d == 0) d = L;
		rem -= d;
		if(rem < 0) break;
		cnt++;
		pos = cvec[i];
	}
	cnt %= n;
	
	llint a, b;
	for(int i = 0; i < vec.size(); i++){
		if(vec[i].second == p){
			a = i;
			break;
		}
	}
	for(int i = (int)vec2.size(); i >= 0; i--){
		if(vec2[i].first == y[p]){
			b = i;
			break;
		}
	}
	
	for(int i = 0; i < n; i++){
		ans[vec[(a+cnt+i)%n].second] = vec2[(b+i)%n].first;
	}
	for(int i = 1; i <= n; i++) cout << ans[i] << endl;
	
	return 0;
}


Measured memory_bytes: 10340
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define str string
#define fi first
#define se second
#define pb push_back
#define SET(a, b) memset(a, b, sizeof(a))
#define eps 1e-6
#define pi atan(1) * 4
#define mod 1000000007
#define inf 1000000000
#define llinf 1000000000000000000
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define FORD(i, a, b) for (int i = (a); i >= (b); i--)
#define FORl(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORDl(i, a, b) for (ll i = (a); i >= (b); i--)
using namespace std;
int num[200005];
int main () {
  int n, k;
  scanf("%d %d", &n, &k);
  FOR(i, 1, n) {
    scanf("%d", &num[i]);
  }
  FOR(i, k + 1, n) {
    if (num[i] > num[i - k]) printf("Yes\n");
    else printf("No\n");
  }
  return 0;
}

Measured memory_bytes: 4464
#include<iostream>
#include<stack>
#include<string>
using namespace std ;

int main(){
	string c ;
	stack<int> s ;
	while(cin >> c){
		if(c=="+"){
			int sub1,sub2 ;
			sub1 = s.top() ; s.pop() ;
			sub2 = s.top() ; s.pop() ;
			s.push(sub1+sub2) ;
		}else if(c=="-"){
			int sub1,sub2 ;
			sub1 = s.top() ; s.pop() ;
			sub2 = s.top() ; s.pop() ;
			s.push(sub2-sub1) ;
		}else if(c=="*"){
			int sub1,sub2 ;
			sub1 = s.top() ; s.pop() ;
			sub2 = s.top() ; s.pop() ;
			s.push(sub1*sub2) ;
		}else{
			s.push(stoi(c)) ;
		}
	}
	cout << s.top() << endl ;
}


Measured memory_bytes: 3212
def main():

    N,D = map(int,input().split())

    power = D*2+1

    if N <= power:
        print(1)
        exit()

    if N%power==0:
        print(int(N/power))
    else:
        print(int((N/power)+1))



if __name__== "__main__":
    main() 


Measured memory_bytes: 2940