akhauriyash/Code-Regression huggingface dataset:
//----------------------------------------------------------------------
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
//----------------------------------------------------------------------
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    double L ; cin >> L;

    double x = L/3.0;
    std::cout << std::fixed;
    std::cout << std::setprecision(16);
    cout << x * x * x << endl;
    return 0;
}


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

int main(){
  int N, L;
  cin >> N >> L;
  string S[N];
  for (int i=0;i<N;i++) cin >> S[i];
  sort(S, S+N);

  string retval = "";
  for (int i=0;i<N;i++) retval += S[i];

  cout << retval << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000000 
const long long  MOD =1e9+7;
#define MAXR 100000 
int main(){
    string S;
    cin >> S;
    if(S[0]=='R'){
        if(S[1]=='R'){
            if(S[2]=='R')cout << 3 << endl;
            else cout << 2 << endl;
        }else{
                if(S[2]=='R')cout << 1 << endl;
                else cout << 1 << endl;
        }
    }else{
        if(S[1]=='R'){
            if(S[2]=='R')cout << 2 << endl;
            else cout << 1 << endl;
        }else{
            if(S[2]=='R')cout << 1 << endl;
            else cout << 0 << endl;
        }
    }
}

Measured memory_bytes: 3624
#include <iostream>
#include<algorithm>
#include<set>
#include<queue>
#define rep(i,j,n) for(int i=j;i<n;i++)
using namespace std;
#define int long long
int mul[214514];
int divi[214514];
#define inf 1000000007
int pow(int x,int n,int in){
    int tmp=1;
    if(n>0){
        tmp=pow(x,n/2,in);
        if(n%2==0)tmp=(tmp*tmp)%in;
        else tmp=(tmp*tmp)%in*x%in;
    }
    return tmp;
}
int cal(int n,int r){
    if(n==0||r==0||n==r)return 1;
    else return (((mul[n]*divi[r])%inf)*divi[n-r])%inf;
}
signed main(){
    int h,w,a,b;cin>>h>>w>>a>>b;
    int sum=h+w-2;

    mul[0]=1,mul[1]=1;
    
    rep(i,2,sum+1){
        mul[i]=(mul[i-1]*i)%inf;
    }
    divi[sum]=pow(mul[sum],inf-2,inf);
    for(int i=sum-1;i>=2;i--){
        divi[i]=(divi[i+1]*(i+1))%inf;
    }
    divi[1]=1,divi[0]=1;
    int ans=0;
    rep(i,b,w){
        ans+=cal(h-a+i-1,i)*cal(a+w-2-i,a-1);
        ans%=inf;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3328
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		WriteLine(Solve());
		Out.Flush();
	}
	int X, Y;
	int V(int x, int y) => x * Y + y;
	int[,] d;
	bool[,] done, map;
	int Solve()
	{
		var I = G;
		Y = I[0]; X = I[1];
		P.X = X; P.Y = Y;
		d = new int[X, Y];
		map = new bool[X, Y];
		done = new bool[X, Y];
		var white = 0;
		for (var y = 0; y < Y; y++)
		{
			var S = Str;
			for (var x = 0; x < X; x++) if (map[x, y] = S[x] == '.') white++;
		}
		var q = new Queue<P>();
		q.Enqueue(new P(0, 0, 0));
		while (q.Count > 0)
		{
			var p = q.Dequeue();
			if (done[p.x, p.y] || !map[p.x, p.y]) continue;
			d[p.x, p.y] = p.d;
			done[p.x, p.y] = true;
			foreach (var r in p) q.Enqueue(r);
		}
		if (!done[X - 1, Y - 1]) return -1;
		return white - d[X - 1, Y - 1] - 1;
	}
}
struct P : IEnumerable<P>
{
	public static int X, Y;
	public readonly int x, y, d;
	public P(int a, int b, int c) { x = a; y = b; d = c; }
	public IEnumerator<P> GetEnumerator()
	{
		if (x > 0) yield return new P(x - 1, y, d + 1);
		if (y > 0) yield return new P(x, y - 1, d + 1);
		if (x + 1 < X) yield return new P(x + 1, y, d + 1);
		if (y + 1 < Y) yield return new P(x, y + 1, d + 1);
	}
	IEnumerator IEnumerable.GetEnumerator() => (IEnumerator)GetEnumerator();
}


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

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    ll sum = 0;
    rep(i,n){
        cin>>a[i];
        sum += a[i];
    }
    vector<ll> s(n+1, 0);
    rep(i,n){
        s[i+1] = s[i] + a[i];
    }
    ll ans = 1e18;
    rep(i,n){
        ans = min(ans, abs(sum -2*s[i]));
    }
    cout<< ans << endl;
    
    
    return 0;
}


Measured memory_bytes: 3328
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define IFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define RPT(i,a,b) for(int i=(a);i<((a)+(b));++i)
#define IRPT(i,a,b) for(int i=((a)+(b)-1);i>=(a);--i)
#define BITBOOL(x,a) (((x)>>(a))&1)
int main() {
    int n; ll t;
    cin >> n >> t; t++;
    using P = pair<ll, ll>;
    vector<P> f;
    vector<ll> ones;
    FOR(i,0,n) {
        ll a, b;
        cin >> a >> b; a++; b++;
        if (a == 1) {
            ones.push_back(b);
        } else {
            f.push_back({a, b});
        }
    }
    sort(f.begin(), f.end(), [&](P x, P y) {
        // fx -> fy
        ll z0 = x.second * y.first + y.second;
        // fy -> fx
        ll z1 = y.second * x.first + x.second;
 
        return z0 < z1;
    });
 
    sort(ones.begin(), ones.end());
 
    vector<ll> dp(50, 1000000000 + 10);
    dp[0] = 1;
    for (auto p: f) {
        for (int i = 48; i >= 0; i--) {
            dp[i + 1] = min(dp[i + 1], dp[i] * p.first + p.second);
        }
    }
 
    int ans = 0;
    FOR(i,0,50) {
        ll now = dp[i];
        if (t < now) continue;
        int cnt = i;
        for (ll x: ones) {
            if (t < now + x) break;
            cnt++;
            now += x;
        }
        ans = max(ans, cnt);
    }
 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6512
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996)
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
#define MOD 1000000007
using namespace std;

const long max_comb=200100;
vector<ll> fac(max_comb+1); //n! (mod M)
vector<ll> ifac(max_comb+1); //k!^(-1) (mod M)

ll mpow(ll x, ll n){ //x^n(mod M)
    ll ans = 1;
    while(n != 0){
        if(n&1) ans = ans*x % MOD;
        x = x*x % MOD;
        n = n >> 1;
    }
    return ans;
}

ll minv(ll x){
    return mpow( x, MOD-2 );
}

ll comb(long a, long b){     // C(a,b) = a! * b!^(-1) * (a-b)^(-1)
    if(a == 0 && b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b]* ifac[b] % MOD;
    return tmp * fac[a] % MOD;
}

ll perm(long a, long b){     // P(a,b) = a! * (a-b)!^(-1)
    if(b == 0)return 1;
    if(a < b || a < 0)return 0;
    ll tmp = ifac[a-b] % MOD;
    return tmp * fac[a] % MOD;
}

void pre_comb()
{
    fac[0] = 1;
    ifac[0] = 1;
    for(long i = 0; i<max_comb; i++){
        fac[i+1] = fac[i]*(i+1) % MOD; // n!(mod M)
        ifac[i+1] = ifac[i]*minv(i+1) % MOD; // k!^(-1) (mod M)
    }
    return;
}

int main(int argc, char* argv[])
{
    ll h, w, a, b;
    scanf("%lld%lld%lld%lld", &h, &w, &a, &b);

    pre_comb();

    ll ans = 0;
    ll j;
    for(j=b; j<w; j++) {
        ll tmp0 = comb(h-a-1+j, j);
        ll tmp1 = comb(a-1+w-1-j, a-1);
        ans = (ans + (tmp0 * tmp1 % MOD)) %MOD;
    }
    
    printf("%lld\n", ans);
 
    return 0;
}


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

int main(){
  int n;
  cin>>n;
  vector<P> ans;
  if(n%2==0){
    for(int i=1; i<=n; i++){
      for(int j=i+1; j<=n; j++){
        if(i+j!=n+1) ans.push_back(make_pair(i,j));
      }
    }
  }else{
    for(int i=1; i<=n; i++){
      for(int j=i+1; j<=n; j++){
        if(i+j!=n) ans.push_back(make_pair(i,j));
      }
    }
  }
  cout<<ans.size()<<endl;
  for(auto p : ans){
    cout<<p.first<<" "<<p.second<<endl;
  }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
 
int main(){ //11-b-Harshad_Namber
  string a;
  cin>>a;
  int v=stoi(a);
  int f=v;
  int s=1;
  int sum=0;
  for(int i=1;i<a.size();i++){
    s=s*10;
  }
  for(int i=0;i<a.size();i++){
    sum+=v/s;
    v-=v/s*s;
    s=s/10;
  }
  if(f%sum==0){
    cout<<"Yes"<<endl;
  }
  else{
    cout<<"No"<<endl;
  }
}



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

struct node {
	int k;
	node *p, *l, *r;
};
node *r, *NIL;

void insert(node *u) {
	node *p = NIL, *c = r;
	while (c != NIL) {
		p = c;
		if (u->k < c->k)
			c = c->l;
		else
			c = c->r;
	}
	u->p = p;
	if (p == NIL)
		r = u;
	else if (u->k < p->k)
		p->l = u;
	else
		p->r = u;
}

void inparse(node *u) {
	if (u == NIL)
		return;
	inparse(u->l);
	cout << " " << u->k;
	inparse(u->r);
}

void preparse(node *u) {
	if (u == NIL)
		return;
	cout << " " << u->k;
	preparse(u->l);
	preparse(u->r);
}

void print() {
	inparse(r);
	cout << endl;
	preparse(r);
	cout << endl;
}

node* find(int k, node *u) {
	if (u == NIL)
		return NIL;
	else if (k == u->k)
		return u;
	else if (k < u->k)
		return find(k, u->l);
	else if (k > u->k)
		return find(k, u->r);
}

void del(int k) {
//	node u = find(k);
}

int main() {
	int m;
	cin >> m;
	for (int i = 0; i < m; i++) {
		string cmd;
		cin >> cmd;
		if (cmd[0] == 'i') {
			node *u = (node*) malloc(sizeof(node));
			int k;
			cin >> k;
			u->k = k;
			u->l = NIL;
			u->r = NIL;
			insert(u);
		} else if (cmd[0] == 'f') {
			int k;
			cin >> k;
			cout << (find(k, r) != NIL ? "yes" : "no") << endl;
		} else if (cmd[0] == 'p') {
			print();
		} else if (cmd[0] == 'd') {
			int k;
			cin >> k;
			del(k);
		}
	}
	return 0;
}



Measured memory_bytes: 21804
#include <iostream>
#include<queue>
#include<stack>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<bitset>
#include<unordered_map>

using namespace std;

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define rep(i,j,n) for(ll (i)=(j);(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
const long long MOD = 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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;
}

//グラフ関連
struct Edge {//グラフ
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
		to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

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

	ll n;
	cin >> n;
	Array x(n, 0), y(n, 0);
	REP(i, n)cin >> x[i] >> y[i];
	
	Array order;
	REP(i, n)order.push_back(i);

	vector<vector<double>> d(n, vector<double>(n, 0.0));
	REP(i, n) {
		REP(j, n) {
			d[i][j] = sqrt((x[i]-x[j])* (x[i] - x[j])+(y[i]-y[j])* (y[i] - y[j]));
		}
	}

	double ans = 0;
	double count = 0;
	do {
		double sum = 0;
		REP(i, n - 1) {
			ll u = order[i];
			ll v = order[i + 1];
			sum += d[u][v];
		}
		ans += sum;
		count++;

	} while (next_permutation(all(order)));

	cout << fixed << setprecision(8)<< ans / count << endl;

	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"math"
)

func min(x, y int) int {
	if x < y {
		return x
	}
	return y
}

func main() {
	var s string
	fmt.Scan(&s)

	ans := math.MaxInt64
	for _, r := range "abcdefghijklmnopqrstuvwxyz" {
		t := s
	L:
		for i := 0; i < len(s); i++ {
			for j := range t {
				if j+1 < len(t) && t[j] == t[j+1] {
					continue
				} else if j < len(t)-1 {
					break
				}
				ans = min(ans, i)
				break L
			}

			xs := make([]rune, len(t)-1)
			for j := range xs {
				if rune(t[j]) == r || rune(t[j+1]) == r {
					xs[j] = r
				} else {
					xs[j] = rune(t[j])
				}
			}
			t = string(xs)
		}
	}
	fmt.Println(ans)
}


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

#define pii pair<int, int>
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define ld long double
#define sz(v) int(v.size())
#define all(v) v.begin(), v.end()
#define vec vector<int>
#define dead not_bad

#define left not_right
#define y1 what

using namespace std;

const int N = (int) 3e5 + 10;
const int M = (int) 6e5 + 10;
const ll LINF = (ll) 2e18;
const int INF = (int) 1e9 + 7;
const int mod = 998244353;
const double PI = 3.14159265359;
const ld EPS = (ld) 1e-12;

int n;
string st, ans;
int dp[N];
int nxt[N][26], pre[26];

bool check(int i, int len) {  
  if (i == sz(st)) 
    return true;
  int val = dp[i] - 1;
  return val < len;
}

bool ok(int len) {
  ans = "";
  int ptr = 0;
  for (int i = 0; i < len; i++) {
    for (int alpha = 0; alpha < 26; alpha++) {
      if (check(nxt[ptr][alpha], len - 1 - i)) {
        ans += alpha + 'a';
        ptr = nxt[ptr][alpha];
        break;
      }
    } 
    if (sz(ans) != i + 1)
      return false;
  }
  return true;
}

int main() {
  #define fn "combination"
  #ifdef witch
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
  #else
     // freopen(fn".in", "r", stdin);
     // freopen(fn".out", "w", stdout);
  #endif
  srand(time(0));
  cin >> st;
  st = "#" + st;
  for (int j = 0; j < 26; j++) {
    pre[j] = nxt[sz(st)][j] = sz(st);
  }
  for (int i = sz(st) - 1; i >= 0; i--) {
    int val = INF;
    for (int j = 0; j < 26; j++) {
      val = min(val, dp[pre[j]]);
      nxt[i][j] = pre[j];
    }
    dp[i] = val + 1;
    pre[st[i] - 'a'] = i;
  }
  int l = 1, r = sz(st);
  int len;
  while (l <= r) {
    int mid = (l + r) / 2;
    if (ok(mid)) {
      r = mid - 1;
      len = mid;
    } else {
      l = mid + 1;
    }
  }
 // cout << len << endl;
  ok(len);
  cout << ans;
  return 0;
}

Measured memory_bytes: 23744
#include<bits/stdc++.h>
using namespace std;
long long x[100001]; 
int main(){
    long long ans = 0,n,a,b;
    cin >> n >> a >> b;
    for(int i = 1;i <= n;i++) cin >> x[i];
    for(int i = 2;i <= n;i++) ans += min((x[i] - x[i - 1]) * a,b); 
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
#include <ctime>
#include <complex>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
ll pcount(ll x) {return __builtin_popcountll(x);}
//const int mod = 1e9 + 7;
const int mod = 998244353;

int main(){
	int h,w; cin >> h >> w;
	vs s(h); rep(i,h) cin >> s[i];
	vl dist(h+1,-1);
	int ans = w;
	rep(j,w){
		vector<pii> st;
		st.emplace_back(0,0);
		REP(i,1,h+1){
			if(i < h){
				if(j==0 || dist[i] == 1){
					int d = 0;
					bool rev = s[i][j] != s[i-1][j];
					REP(k,j,w){
						if(rev == (s[i][k] != s[i-1][k])) d++;
						else break;
					}
					dist[i] = d;
				}else{
					dist[i]--;
				}
			}else{
				dist[i] = 0;
			}
			if(st.empty() || st.back().first < dist[i]){
				st.emplace_back(dist[i],i);
			}else{
				int pos = i;
				while(!st.empty()){
					if(st.back().first >= dist[i]){
						pii p = st.back();
						chmax(ans, p.first*(i-p.second)+p.first);
						pos = p.second;
						st.pop_back();
					}else{
						st.emplace_back(dist[i], pos);
						break;
					}
				}
			}
		}
	}
	cout << ans << "\n";
}

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

#define ll long long
#define COMBI_SIZE 1000

// 自然数xをn進法で表現した時の桁数
ll digit(ll x, ll n)
{
    ll i = 1;
    for(i = 0;0 < x;i++) {
        x /= n;
    }
    return i;
}

// xが素数かどうか
bool isprime(ll x)
{
    if(x == 1)return false;
    if(x == 2)return true;
    if(x%2 == 0)return false;

    for(ll i = 3;i*i <= x;i += 2) {
        if(x%i == 0)return false;
    }
    return true;
}


bool combi_init = false;
ll combi_memo[COMBI_SIZE][COMBI_SIZE];
// nCr
ll combi(ll n, ll r)
{
    if(!combi_init) {
        combi_init = true;
        for(ll i = 0;i < COMBI_SIZE;i++) {
            for(ll j = 0;j < COMBI_SIZE;j++) {
                combi_memo[i][j] = i == j || j == 0;
            }
        }
    }

    if(n < 0 || n < r) {
        return 0;
    }

    if(combi_memo[n][r] == 0) {
        combi_memo[n][r] = combi(n - 1, r - 1) + combi(n - 1, r);
    }
    return combi_memo[n][r];
}

struct si {
    ll i;
    ll p;
    ll y;
    ll o;
};

int main()
{
    ll N;
    ll M;

    scanf("%lld %lld", &N, &M);

    si s[M + 1];
    s[0] = {0, 0, 0, 0};
    for(ll i = 1;i <= M;i++) {
        ll p;
        ll y;
        scanf("%lld %lld", &p, &y);
        s[i] = {i, p, y, 0};
    }

    ll ken[N + 1];
    for(ll i = 0;i <= N;i++) {
        ken[i] = 0;
    }

    sort(s + 1, s + M + 1, [](const si& s1, const si& s2){return s1.y < s2.y;});

    for(ll i = 1;i <= M;i++) {
        ll x = s[i].p;
        ken[x]++;
        s[i].o = ken[x];
    }

    sort(s + 1, s + M + 1, [](const si& s1, const si& s2){return s1.i < s2.i;});

    for(ll i = 1;i <= M;i++) {
        printf("%06lld%06lld\n", s[i].p, s[i].o);
    }

    return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
int a, b, c, k, sum;

int main() {
    cin.tie(0); ios::sync_with_stdio(0);
    cin >> c >> b >> a >> k;
    sum += min(k, c);
    k -= sum;
    k -= min(k, b);
    sum -= min(k, a);
    cout << sum;
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>

#define ff first
#define ss second

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

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

    int n,k,q;
    cin>>n>>k>>q;
    vector<int> v(n);
    for(int i=0; i<q; i++){
        int a;
        cin>>a;
        v[a-1]+=1;
    }
    for(int i=0; i<n; i++){
        if(k-(q-v[i])<=0) cout<<"No\n";
        else cout<<"Yes\n";
    }

    return 0;
}


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

int main(){
	int n; cin >> n;
	vector<int> h(n); rep(i,n) cin >> h[i];
	int ans = 0;
	int cnt = 0;
	rep(i,n-1){
		if(h[i]>=h[i+1]) cnt++;
		else{
			ans = max(ans, cnt);
			cnt = 0;
		}
	}
  	ans = max(ans, cnt);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i=0; i<(n); i++)
int main(){
    set<string> d;
    int n;
    cin >> n;
    string com;
    string key;
    rep(i, n){
        cin >> com;
        if (com == "insert"){
            cin >> key;
            d.insert(key);
        }
        else{
            cin >> key;
            if (d.find(key) == d.end()) cout << "no" << endl;
            else cout << "yes" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 32548
/**
*    author:  boutarou
*    created: 20.06.2020 00:16:38
**/

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < int(n); i++)
#define fcout cout << fixed << setprecision(15)
using lint = long long;
using P = pair<int, int>;

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

const double PI = 3.1415926535897932;

int n;
int a[100005];
int cnt[100005];
int ans[100005];
int out = 0;
vector<int>belong[100005];

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> n;
	rep(i, n - 1) {
		cin >> a[i + 1];
		a[i + 1]--;
		cnt[a[i + 1]]++;
	}
	stack<int>st;
	rep(i, n) if (cnt[i] == 0) st.push(i);
	while (!st.empty()) {
		int now = st.top(); st.pop();
		if (belong[now].empty()) ans[now] = 0;
		else {
			int ma = 0;
			sort(belong[now].rbegin(), belong[now].rend());
			rep(i, belong[now].size()) {
				chmax(ma, belong[now][i] + i + 1);
			}
			ans[now] = ma;
		}
		belong[a[now]].emplace_back(ans[now]);
		cnt[a[now]]--;
		if (cnt[a[now]] == 0) st.push(a[now]);
	}
	rep(i, n) {
		chmax(out, ans[i]);
	}
	cout << out << endl;
	
	return 0;
}

Measured memory_bytes: 10156
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  int N, A, B, C, D;
  cin >> N >> A >> B >> C >> D;
  A--; B--; C--; D--;
  string S;
  cin >> S;
  int tmp, tmp2;
  bool ok = false;
  if(C < D) {
    tmp = 0;
    REP(i, B, D) {
      if(S[i] == '#') tmp++;
      else tmp = 0;
      if(tmp > 1) { cout << "No" << endl; return 0; }
    }
    tmp = 0;
    REP(i, A, C) {
      if(S[i] == '#') tmp++;
      else tmp = 0;
      if(tmp > 1) { cout << "No" << endl; return 0; }
    }
    cout << "Yes" << endl;
  } else {
    tmp = 0;
    tmp2 = S[B-1] == '.' ? 1 : 0;
    REP(i, B, D+1) {
      if(S[i] == '#') {
	tmp++;
	tmp2 = 0;
      }
      else { tmp = 0; tmp2++; }
      if(tmp > 1) { cout << "No" << endl; return 0; }
      if(tmp2 > 2) ok = true;
    }
    if((S[D-1] == '#' || S[D+1] == '#') && !ok) { cout << "No" << endl; return 0; }
    tmp = 0;
    REP(i, A, C) {
      if(S[i] == '#') tmp++;
      else tmp = 0;
      if(tmp > 1) { cout << "No" << endl; return 0; }
    }
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 640
from collections import deque

S = input()
Q = int(input())
ans = deque(S)
reverse = False

for _ in range(Q):
    query = input().split()
    if query[0] == "1":
        reverse = not reverse
    if query[0] == "2":
        F, C = query[1:]
        if (F == "1" and not reverse) or (F == "2" and reverse):
            ans.appendleft(C)
        else:
            ans.append(C)

if reverse:
    print("".join(reversed(ans)))
else:
    print("".join(ans))


Measured memory_bytes: 8692
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int th,ts,ah,as;
	cin>>th>>ts>>ah>>as;
	while(1)
	{
		ah-=ts;
		if(ah<=0)
		{
			cout<<"Yes"<<endl;
			return 0;
		}
		th-=as;
		if(th<=0)
		{
			cout<<"No"<<endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3640
import java.util.Arrays
import java.util.ArrayList

const val MOD: Long = (1e9+7).toLong()
fun Double.format(digits: Int) = String.format("%.${digits}f", this)
fun <T : Comparable<T>> Iterable<T>.argmax(): Int? = withIndex().maxBy{it.value}?.index
fun <T : Comparable<T>> Iterable<T>.argmin(): Int? = withIndex().minBy{it.value}?.index

fun main(args: Array<String>) {
    val reader = System.`in`.bufferedReader()
    val (n, k) = reader.readLine()!!.split(" ").map{it.toLong()}

    var l = k
    var m = n
    var i = 0
    var res = 0.0
    if (l <= m) {
        res += (m - l + 1.0) / n * Math.pow(0.5, i.toDouble())
        m = l - 1
        if (l <= 1) {
            println(res)
            return
        }
    }
    while (true) {
        val a = (l+1) / 2
        l = a
        i += 1
        if (a > m) continue

        res += (m - a + 1.0) / n * Math.pow(0.5, i.toDouble())
        m = a - 1
        if (a <= 1) {
            break
        }
    }

    println(res)
}


Measured memory_bytes: 33992
#include <iostream>

using namespace std;

int main ()
{
  int X;
  int N;
  cin >> X >> N;
  if (N > 0)
    {
      int p[N];
      int buff[2];
      for(int i = 0 ; i < N; i++)
        cin >> p[i];
      for(int i = 0 ; i < 101 ; i++)
        {
          buff[0]=X-i;
          buff[1]=X+i;
          for (int j = 0; j < N; j++)
            {
              if (p[j] == X-i)
                {
                  buff[0]=102;
                  break;
                }
            }
          for (int j = 0; j < N; j++)
            {
              if (p[j] == X+i)
                {
                  buff[1]=102;
                  break;
                }
            }
          if( (buff[0]!=102) || (buff[1]!=102) )
            break;
        }
      if (buff[0]!=102)
        cout << buff[0] << endl;
      else
        cout << buff[1] << endl;
    }
  else
    cout << X << endl;
  return 0;
}

Measured memory_bytes: 3568
#include<bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
//long long int countt[200003];
#include<ext/pb_ds/assoc_container.hpp> // include the associative containers or group of templates such as set, multimap, map etc.
#include<ext/pb_ds/tree_policy.hpp> // include the tree_order_statistics_node update
using namespace __gnu_pbds; //necessary for the GNU based Policy based data structures.
typedef tree<pair<int,int> ,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#define int long long
#define endl "\n"

signed main()
{
    FAST;
    
    int i=0,j=0,k=0,n=0,m=0,count=0,temp=0;
    int temp1=0,temp2=0,temp3=0,x=0,l=0,y=0,sum=0;
    int left=0,up=0,down=0,start=0,end=0,r=0,qq=0,total=0;
    int maxx=0,minn=0,curr=0,ans=0,places=0,zeroes=0,low=0,high=0;
    int prev=0,mid=0,z=0,d=0,val=0,pos=0,shift=0,h=0,right=0,var=0;
    
    int a,b,c;
    cin>>a>>b>>c>>d;
    
    
    if((a-1)/d >= (c-1)/b ) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    
    
    
    
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  set<int> S;
  int N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    S.insert(a);
  }
  cout << S.size() << endl;
}


Measured memory_bytes: 256
N = int(input())
ans = [0]*N
n = int(N**0.5 + 1)
for x in range(1, n+1):
    for y in range(1, n+1):
        for z in range(1, n+1):
            a = x**2 + y**2 + z**2 + x*y + y*z + x*z
            if a <= N:
                ans[a-1] += 1
for i in range(N):
    print(ans[i])

Measured memory_bytes: 9504
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

const int MOD_TYPE = 1;
const ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const ld PI = acos(-1.0);
const ld EPS = 1e-11;

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  ll n, a, b, c, d;
  cin >> n >> a >> b >> c >> d;
  b -= a;
  for (ll k = 0; k <= n - 1; k++)
  {
    ll l = (n - 1) - k;
    if (-k * d + l * c <= b && b <= -k * c + l * d)
    {
      YES(true);
      return 0;
    }
  }
  YES(false);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const ll MOD=1000000007,INF=1ll<<60;
int dx[]={0,0,1,-1},dy[]={-1,1,0,0};

vint v(5);

signed main() {
    IOS();
    rep(i,0,5)cin>>v[i];
    sort(all(v));
    
    int mi=INF;
    do{
        int now=0;
        rep(i,0,5){
            now+=v[i];
            if(now%10&&i!=4)now+=10-(now%10);
        }
        chmin(mi,now);
    }while(next_permutation(all(v)));
    cout<<mi<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <numeric>

using namespace std;
#define modd 1000000007


typedef pair<long long, long long> pl;

typedef pair<long long, string> pls;


#define ll long long




/*
class UnionFind {
public:
	vector <ll> par; 
	vector <ll> siz;
	vector <ll> gr;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) ,gr(sz_){
		for (ll i = 0; i < sz_; ++i) par[i] = i; 
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};*/


long long N, M, K, a, b, c, d, e,H, W,Q;
long long A[200000]= {};
long long B[200005] = {};
long long C[20][200] = {};
bool f;
bool ff;
string S[200];
set <long long>sll;
pl buf;
pls bufls;
vector <long long>vl;
vector <pl>vpl;
vector <pls>vpls;
vector <string> vs;

struct ST
{
	long long hajime;
	long long owari;
	long long zahyou;
	int bangou;

	bool operator<(const ST& another) const
	{
		return hajime < another.hajime;//年齢を比較
	};

};



vector <ST> vst;
ST st[200005];

int main() {

	cin >> N>>K;

	a = N+(K/2);

	
	cout << a << endl;

	return 0;

}


Measured memory_bytes: 2304
#include <iostream>
#include <map>
#include <string>

using str = std::string;

int main() {
  std::map<std::string, int> state;
  state["A"] = 0;
  state["B"] = 1;
  state["A*B"] = 2;
  const auto get = [&](const std::string& s) -> int {
    if (state.count(s)) {
      return state[s];
    }
    else {
      int siz = state.size();
      state[s] = siz;
      return siz;
    }
  };

  int count = 0;

  const auto plus = [&](const str& l, const str& x, const str& y) {
    std::cout << "+ " << get(x) << " " << get(y) << " " << get(l) << "\n";
    count += 1;
  };
  const auto less = [&](const str& l, const str& x, const str& y) {
    std::cout << "< " << get(x) << " " << get(y) << " " << get(l) << "\n";
    count += 1;
  };

  std::cout << "31753\n";

  less("many", "0", "A");
  less("temp", "0", "B");
  plus("many", "many", "temp");
  less("1", "0", "many");
  for (int i = 2; i < 10; ++i) {
    plus(std::to_string(i), std::to_string(i - 1), "1");
  }

  const auto poweq = [&](const str& s, int k) {
    while (k--) {
      plus(s, s, s);
     }
  };

  plus("p0", "0", "1");
  for (int i = 1; i < 30; ++i) {
    plus("p" + std::to_string(i), "p" + std::to_string(i - 1), "p" + std::to_string(i - 1));
  }

  for (int i = 29; i >= 0; --i) {
    plus("temp", "prev", "p" + std::to_string(i));
    less("A" + std::to_string(i), "A", "temp");
    less("A" + std::to_string(i), "A" + std::to_string(i), "1");
    poweq("A" + std::to_string(i), i);
    plus("prev", "prev", "A" + std::to_string(i));
  }
  less("prev", "0", "0");
  for (int i = 29; i >= 0; --i) {
    plus("temp", "prev", "p" + std::to_string(i));
    less("B" + std::to_string(i), "B", "temp");
    less("B" + std::to_string(i), "B" + std::to_string(i), "1");
    poweq("B" + std::to_string(i), i);
    plus("prev", "prev", "B" + std::to_string(i));
  }

  for (int i = 0; i < 30; ++i) {
    for (int j = 0; j < 30; ++j) {
      less("temp", "0", "A" + std::to_string(i));
      less("temp2", "0", "B" + std::to_string(j));
      plus("temp", "temp", "temp2");
      less("temp", "1", "temp");
      poweq("temp", i + j);
      plus("A*B", "A*B", "temp");
    }
  }

  return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>

using namespace std;

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

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

int main()
{
  int N, K;
  vector<int> p;
  cin >> N >> K;
  for (int i = 0; i < N; i++) {
    int a;
    cin >> a;
    p.push_back(a);
  }

  int64_t sum = accumulate(p.begin(), p.begin() + K, 0);

  int64_t max_num = sum;

  for (int i = 0; i < N - K; i++) {
    sum = sum - p[i] + p[i + K];
    chmax(max_num, sum);
  }

  cout << fixed << setprecision(8) << (double)((max_num + K) / 2.0);

  return 0;
}


Measured memory_bytes: 1400
def main():
    a, b = map(int, input().split(' '))
    d_s = make_divisors(a, b)

    ans = []

    for j in d_s:
        flg = True
        for k in d_s:
            if k == 1 or j == k:
                continue
            if j % k == 0:
                flg = False
                break
        if flg:
            ans.append(j)
    print(len(ans))


def make_divisors(a, b):
    A = []
    B = []
    n = max(a, b)
    for i in range(1, int(n**0.5)+1):
        if a % i == 0:
            A.append(i)
            if i != a // i:
                A.append(a//i)
        if b % i == 0:
            B.append(i)
            if i != b // i:
                B.append(b//i)
    return list(set(A) & set(B))


if __name__ == '__main__':
    main()


Measured memory_bytes: 5068
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

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, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }
mint fact(int n) {
  if(n == 1 || n == 0) return 1;
  mint res = n;
  return res * fact(n - 1);
}

int main() {
  ll n, s;
  cin >> n >> s;
  vl a(n);
  rep(i, n) cin >> a[i];
  mint dp[6010] = {}, ans = 0;
  rep(i, n) {
    dp[0] += 1;
    for(ll j = s - 1; j >= 0; j--) dp[j + a[i]] += dp[j];
    ans += dp[s];
  }
  cout << ans << endl;
}

Measured memory_bytes: 3640
n,x=map(int,input().split())

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

c=0

for i in range(n-1):
    if a[i]+a[i+1]>x:
        c+=a[i]+a[i+1]-x
        if x-a[i]>=0:
            a[i+1]=x-a[i]
        else:
            a[i+1]=0
            a[i]=x

print(c)

Measured memory_bytes: 14252
n,y = map(int,input().split())
for i in range(n+1):
    for j in range(n+1):
        k = n-i-j
        if i*10000+j*5000+k*1000 == y and 0 <= k <= 2000:
            print(i,j,k)
            exit()
print("-1 -1 -1")

Measured memory_bytes: 2940
import queue
n,m = map(int,input().split())
graph = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    graph[a-1].append(b)
    graph[b-1].append(a)
ans = [0]* n
q = queue.deque()
q.append(1)
while q:
    tmp = q.popleft()
    for i in graph[tmp-1]:
        if ans[i-1] == 0:
            q.append(i)
            ans[i-1] = tmp
                
if 0 in ans:
    print('No')
        
else:
    print('Yes')
    for i in range(1,n):
        print(ans[i])

Measured memory_bytes: 96800
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef long double D;
typedef complex<D> P;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;

template<typename T,typename U>istream & operator >> (istream &i,pair<T,U> &A){i>>A.F>>A.S; return i;}
template<typename T>istream & operator >> (istream &i,vector<T> &A){for(auto &I:A){i>>I;} return i;}
template<typename T,typename U>ostream & operator << (ostream &o,const pair<T,U> &A){o<<A.F<<" "<<A.S; return o;}
template<typename T>ostream & operator << (ostream &o,const vector<T> &A){ll i=A.size(); for(auto &I:A){o<<I<<(--i?" ":"");} return o;}
template<typename T>vector<T> & cset(vector<T> &A,T e=T()){for(auto &I:A){I=e;} return A;}




int main(){
  string s;
  cin>>s;
  ll n=(ll)s.size();
  vector<ll> A(n);
  vector<ll> nx(n);
  for(int i=0;i<n;i++){A[i]=i;}
  vector<ll> B=A;
  vector<ll> ans(n);
  for(int i=0;i<n;i++){ans[i]=i;}
  
  for(int j=0;j<n;j++){
    if(s[A[j]]=='L'){
      A[j]--;
    }
    else{
      A[j]++;
    }
  }

  auto dbl=[&](vector<ll> &A)->void{
             nx=A;
             for(int j=0;j<n;j++){A[j]=nx[nx[j]];}
           };

  auto con=[&](vector<ll> &ans,vector<ll> &A)->void{
             for(int j=0;j<n;j++){ans[j]=A[ans[j]];}
           };

  auto ten=[&]()->void{
             ll k=9;
             B=A;
             while(k>0){
               if(k&1){con(A,B);}
               dbl(B);
               k>>=1;
             }
           };

  for(int i=0;i<100;i++){ten();}
  
  
  vector<ll> cnt(n,0);
  for(auto &I:A){
    cnt[I]++;
  }
  cout<<cnt<<endl;
  
  return 0;
}


Measured memory_bytes: 4608
#include<bits/stdc++.h>
#define ll long long
#define int long long
 
#define sz(c) c.size()
#define fr first
#define sc second
#define pb push_back
#define sz(c) c.size()
#define ppb  pop_back
#define all(a)      (a).begin(),(a).end()
#define rep(i,a,n)   for( int i=a ; i<n ; i++)
#define U 1000000007
#define N 100005
#define ins insert
using namespace std;
signed main()
{
  ios_base::sync_with_stdio(false);
  int n,m;
  cin>>n>>m;
  int w[n+1],v[n+1],dp[m+1];
  rep(i,1,n+1) cin>>w[i]>>v[i];

  rep(i,0,m+1) dp[i]=0;
 
  rep(i,1,n+1)
  {
    for(int j=m;j>=0;j--)
    {
      if(j+w[i]<=m)
        dp[j+w[i]]=max(dp[j+w[i]],dp[j]+v[i]);
    }
  }

  int ans=0;
  rep(i,0,m+1) ans=max(ans,dp[i]);
  cout<<ans;
  
 
 
 
 
}

Measured memory_bytes: 1024
#line 2 "../../library/template.hpp"
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pl = pair<ll, ll>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0; i < (ll)n; i++)
#define rep3(i, l, r) for(ll i = l; i < (ll)r; i++)
#define per(i, n) for(ll i = n-1; i >= 0; i--)
#define per3(i, l, r) for(ll i = r-1; i >= (ll)l; i--)
#define all(v) begin(v), end(v)
template<class T, class U>
inline void cmax(T& a, U b) { if (a < b) a = b; }
template<class T, class U>
inline void cmin(T& a, U b) { if (a > b) a = b; }

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
  }
} io_setup;

constexpr char el = '\n';
#line 2 "e.cpp"

int main() {
  ll h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  rep(i, h) {
    cin >> s[i];
  }

  ll ans = 1LL<<60;
  rep(bit, 1LL<<(h-1)) {
    ll sum = __builtin_popcountll(bit);
    ll tmp = sum+1;


    bool ff = 1;

    //cerr << "bit " << bit << el;
    vl cnt(tmp);
    rep(i, w) {
      vl cnt2(tmp);
      ll ind = 0;
      rep(j, h) {
        if (s[j][i] == '1') cnt2[ind]++;
        if ((bit>>j) & 1) {
          ind++;
        }
      }

      bool f = 1;
      rep(j, tmp) {
        if (cnt[j] + cnt2[j] > k) {
          f = 0;
          break;
        }
      }

      rep(j, tmp) {
        if (cnt2[j] > k) {
          ff = 0;
          break;
        }
      }

      //cerr << "f " << f << endl;
      if (f) {
        rep(j, tmp) {
          cnt[j] += cnt2[j];
        }
      } else {
        sum++;
        rep(j, tmp) {
          cnt[j] = cnt2[j];
        }
      }

//      cerr << "cnt " << el;
//      rep(j, tmp) {
//        cerr << cnt[j] << " ";
//      }
//      cerr << el << "cnt2 " << el;
//      rep(j, tmp) {
//        cerr << cnt2[j] << " ";
      //}
      //cerr << el;
    }

    //cerr << sum << el << el;

    if (ff) cmin(ans, sum);
  }

  assert(ans >= 0);
  assert(ans != 1LL<<60);

  cout << ans << el;
  cout << flush;
}


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

import sys
import copy

sys.setrecursionlimit(1000000)


# input = sys.stdin.readline

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

S = input().rstrip()
S = sorted(S)

if S[0] == S[1] and S[2] == S[3] and S[0] != S[3]:
    print("Yes")
else:
    print("No")


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

int power(int a, int n)
{
    if(n == 0)
    {
        return 1;
    }
    else if(n == 1)
    {
        return a;
    }
    return (a * power(a, n - 1));
}

int main()
{
    int n;
    cin >> n;
    int ans = power(n,1) + power(n,2) + power(n,3);
    cout << ans;
}


Measured memory_bytes: 3632
#include<cstdio>
#include<cmath>

int main()
{
	int n, d, ct = 0;
	scanf("%d %d", &n, &d);
	
	while(n--)
	{
		double x, y;
		scanf("%lf %lf", &x, &y);
		
		double dis = sqrt(x * x + y * y);
		if(dis <= d) ct++;
	}
	printf("%d\n", ct);
}

Measured memory_bytes: 2204
import java.util.*;

public class Main {

  public static void main (String[] args) {

    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int K = sc.nextInt();
    int[] A = new int[N];

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

    sc.close(); 

    System.out.println((int)Math.ceil((double)(N-1)/(K-1)));

  }

}

Measured memory_bytes: 50304
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
int main() {
    long long n;
    long long sum = 0;
    cin >> n;
    for (long long i = 1; i <= n; i++) {
        sum += i * (n + 1 - i);
    }
    for (long long i = 0; i < n - 1; i++) {
        long long u, v;
        cin >> u >> v;
        if (u > v) {
            swap(u, v);
        }
        sum -= u * (n + 1 - v);
    }
    cout << sum << endl;
}

Measured memory_bytes: 3632
import numpy as np
n, m = map(int, input().split())
'''
xx = []
yy = []
'''
box = np.zeros((n, 2))
box[:, 0] = 1
box[0, 1] = 1


count = 0
for _ in range(m):
    x, y = map(int, input().split())
    '''
    xx.append(x)
    yy.append(y)
    '''
    if (box[x - 1, 1] == 1):
        box[y - 1, 1] = 1

    box[x - 1, 0] -= 1

    if (box[x - 1, 0] == 0):
        box[x - 1, 1] = 0

    box[y - 1, 0] += 1

    # 赤玉が一度でもある場合
tar = box[:, 1]
ans = np.sum(tar != 0)
print(ans)

#xy = [list(map(int, input().split())) for _ in range(m)]


Measured memory_bytes: 14152
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#include<algorithm>//next_permutation
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
#define large "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#define small "abcdefghijklmnopqrstuvwxyz"
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

const ll MOD = 998244353;
const ll MAX = 200001;

ll mod(ll a){
  return a % MOD;
}

ll lcm(ll a,ll b){
  return (a*b)/gcd(a,b);
}

ll fac[MAX], finv[MAX], inv[MAX];

void nCrprep() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

ll nCr(ll n, ll r){
    if (n < r) return 0;
    if (n < 0 || r < 0) return 0;
    return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}
int main(){
  string s; cin >> s;
  
  if(s[0] == '9' or s[1] == '9') cout << "Yes" << endl;
  else cout << "No" << endl;
  
}

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

char t[200000], d[200000];

int main(){
  int N, Q;
  string s;
  cin >> N >> Q;
  cin >> s;

  for(int i = 0; i < Q; i++){
    cin >> t[i] >> d[i];
  }

  int drop_r = 0;
  char ng = 'n';
  int pointer = N - 1;
  for(int i = Q - 1; i >= 0; i--){
    if(t[i] == ng && d[i] == 'L'){
      pointer++;
      if(pointer + 1 < N){
        ng = s[pointer + 1];
      }else{
        ng = 'n';
      }
    }
    if(t[i] == s[pointer] && d[i] == 'R'){
      ng = s[pointer];
      pointer--;
      if(pointer < 0){
        break;
      }
    }
  }
  drop_r = (N - 1) - pointer;
  int drop_l = 0;
  ng = 'n';
  pointer = 0;
  for(int i = Q - 1; i >= 0; i--){
    if(t[i] == ng && d[i] == 'R'){
      pointer--;
      if(pointer - 1 >= 0){
        ng = s[pointer - 1];
      }else{
        ng = 'n';
      }
    }
    if(t[i] == s[pointer] && d[i] == 'L'){
      ng = s[pointer];
      pointer++;
      if(pointer >= N){
        break;
      }
    }
  }
  drop_l = pointer;

  int ans = N - (drop_r + drop_l);
  if(ans < 0){
    ans = 0;
  }

  cout << ans << endl;
}

Measured memory_bytes: 900