akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
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 (b<a) { a=b; return 1; } return 0; }

// constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
// constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    VP ps(n);
    REP(i,0,n) {
        cin >> ps[i].first >> ps[i].second;
    }
    set<int> us,ds;
    REP(i,0,n) {
        us.insert(ps[i].first + ps[i].second);
        ds.insert(ps[i].first - ps[i].second);
    }
    sort(all(ps),[](auto &l, auto &r) {
        return l.first < r.first;
    });
    int ans = 0;
    REP(i,0,n-1) {
        if (us.empty()) break;
        int d = *us.rbegin() - ps[i].first - ps[i].second;
        // dump(d);
        chmax(d,*ds.rbegin() - ps[i].first + ps[i].second);
        chmax(ans,d);
        us.erase(ps[i].first + ps[i].second);
        ds.erase(ps[i].first - ps[i].second);
    }
    cout << ans << endl;
}

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

Measured memory_bytes: 23556
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){

	int A, B;
	string op;
	cin >> A >> op >> B;

	if (op == "+"){
		cout << A + B << endl;
	}
	
	else if (op == "-"){
		cout << A - B << endl;
	}
}




Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

int main() {
    init();

    int n;
    cin >> n;
    VL a(n);
    ll ans = 0, sum = 0;
    FOR(i, 0, n) {
        cin >> a[i];
        sum = (a[i] ? sum + a[i] : 0);
        ans += sum / 2;
        sum %= 2;
    }
    cout << ans << "\n";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using LL = long long; using PII = pair<LL, LL>; using VI = vector<LL>; using VVI = vector<VI>;
using VB = vector<bool>; using VS = vector<string>; using VP = vector<PII>;
#define VV(T)        vector<vector<T>>
#define PB           push_back
#define MP           make_pair
#define SZ(a)        LL((a).size())
#define EACH(x, c)   for (auto x : (c))
#define ALL(c)       (c).begin(), (c).end()
#define REVERSE(c)   reverse(ALL(c))
#define SORT(c)      stable_sort(ALL(c))
#define RSORT(c)     stable_sort((c).rbegin(), (c).rend())
#define FOR(i, a, b) for (LL i = (a); i < (b); ++i)
#define REP(i, n)    FOR(i, 0, n)
#define $(x)         {cout << #x << " = " << (x) << endl;}

const LL MOD = 1000000007;
inline LL mod_add(LL a, LL b) { return (a + b) % MOD; }
inline LL mod_sub(LL a, LL b) { return (a + MOD - b) % MOD; }
inline LL mod_mul(LL a, LL b) { return ((a % MOD) * (b % MOD)) % MOD; }
LL mod_bipow(LL x, LL y) {   // x^y by bisection method
    if (y == 0) return 1;
    else if (y == 1) return x % MOD;
    else if (y % 2 == 0) {
        LL val = mod_bipow(x, (LL)(y / 2));
        return mod_mul(val, val);
    } else {
        LL val = mod_bipow(x, (LL)(y / 2));
        return mod_mul(mod_mul(val, val), x);
    }
}
LL mod_inv(LL x) { return mod_bipow(x, MOD - 2); }   // x^{-1} = x^{MOD-2} (MOD: prime number)
LL mod_div(LL a, LL b) { return mod_mul(a, mod_inv(b)); }   // a/b = a*b^{-1}

void solve(LL N, LL K, vector<LL> A){
    LL ans = 0;
    LL cl = mod_div(mod_mul(mod_sub(K, 1), K), 2);
    LL cr = mod_div(mod_mul(K, mod_add(K, 1)), 2);
    //$(cl);
    //$(cr);
    REP(i, N) {
        LL left = 0, right = 0;   // smaller than A[i]
        REP(j, i) {
            if (A[j] < A[i]) left++;
        }
        FOR(j, i + 1, N) {
            if (A[i] > A[j]) right++;
        }
        //$(left);
        //$(right);
        ans = mod_add(ans, mod_add(mod_mul(cr, right), mod_mul(cl, left)));
    }
    cout << ans << endl;
}

int main(){
    LL N;
    scanf("%lld",&N);
    LL K;
    scanf("%lld",&K);
    vector<LL> A(N-1-0+1);
    for(int i = 0 ; i < N-1-0+1 ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, K, move(A));
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int a[100]={0};
    int n=0;
    int min=0;
    int temp=0;
    int counter=0;
    scanf("%d", &n);
    for(int e=0;e<n;e++){scanf("%d", &a[e]);}
    for(int i=0;i<n-1;i++)
    {
        min=i;
        for(int j=i;j<n;j++)
        {
            if(a[min]>a[j])
            {min=j;}
        }
        if(min!=i)
        {
            temp=a[min];
            a[min]=a[i];
            a[i]=temp;
            counter++;
        }
    }
    for(int m=0;m<n;m++)
    {
        if(m!=n-1)
        {printf("%d ", a[m]);}
        else{printf("%d\n", a[m]);}
    }
    printf("%d\n", counter);
    return 0;
}



Measured memory_bytes: 2052
#include <stdio.h>

#define WIDTH 10
#define HEIGHT 10

int field[ WIDTH ][ HEIGHT ];
const int dx[ 3 ][ 4 ] = { { -1, 0, 1, 0 }, { -1, 1, -1, 1 }, { -2, 0, 2, 0 } };
const int dy[ 3 ][ 4 ] = { { 0, -1, 0, 1 }, { -1, -1, 1, 1 }, { 0, -2, 0, 2 } };

int main( void ) {
	int i, j, x, y, size, white, max;

	while ( scanf( "%d,%d,%d", &x, &y, &size ) == 3 ) {
		field[ x ][ y ]++;

		for ( i = 0; i < size; i++ )
			for ( j = 0; j < 4; j++ ) {
				int nx = x + dx[ i ][ j ], ny = y + dy[ i ][ j ];

				if ( nx >= 0 && nx < WIDTH && ny >= 0 && ny < HEIGHT )
					field[ nx ][ ny ]++;
			}
	}

	white = 0;
	max = 0;
	for ( y = 0; y < HEIGHT; y++ )
		for ( x = 0; x < WIDTH; x++ )
			if ( !field[ x ][ y ] )
				white++;
			else if ( max < field[ x ][ y ] )
				max = field[ x ][ y ];

	printf( "%d\n%d\n", white, max );

	return 0;
}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int n,m,f=0,x,y,d[100005],fail[100005];
vector<int>v;
pair<int,int>e[100005];
int get(int x)
{
    return fail[x]==x?x:fail[x]=get(fail[x]);
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        scanf("%d%d",&x,&y);
        d[x]++;
        d[y]++;
        e[i]=make_pair(x,y);
    }
    bool flag=false;
    for(int i=1;i<=n;i++)
        if(d[i]%2)
        {flag=false;break;}
        else if(d[i]>=6) flag=true;
        else if(d[i]>=4)
        {
            f++;
            v.push_back(i);
            if(f>=3) flag=true;
        }
    if(f==2&&!flag)
    {
        for(int i=1;i<=n;i++)
            fail[i]=i;
        for(int i=1;i<=m;i++)
        {
            int x=e[i].first,y=e[i].second;
            if(x==v[0]||y==v[0]) continue;
            fail[get(x)]=fail[get(y)];
        }
        for(int i=1;i<=n;i++)
            f+=fail[i]==i;
        if(f>=5) flag=true;
    }
    printf(flag?"Yes":"No");
}

Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>

/* long long は long long int の略*/
#define M 1046527
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){
	return key % M; 
}
int h2(int key){ 
	return 1 + (key % (M - 1)); 
}

int find(char str[]){
	long long key, i, h;
	key = getKey(str);
	for(i = 0; ; i++){
		h = (h1(key) + i * h2(key)) % M;
		if(strcmp(H[h],str) == 0){
			return 1;
		}
		else if(strlen(H[h]) == 0){
			return 0;
		}
	}
	return 0;
}

int insert(char str[]){
	long long key, i, h;
	key = getKey(str);
	for(i = 0; ; i++){
		h = (h1(key) + i * h2(key)) % M;
		if(strcmp(H[h],str) == 0){
			return 1;
		}
		else if(strlen(H[h]) == 0){
			strcpy(H[h],str);
			return 0;
		}
	}
	return 0;
}

int main(){
    int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
	scanf("%s %s", com, str);
	
	if ( com[0] == 'i' ){
	    insert(str);
	} else {
	    if (find(str)){
		printf("yes\n");
	    } else {
		printf("no\n");
	    }
	}
    }

    return 0;
}


Measured memory_bytes: 16100
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,count=0;
  cin >>A;
  int keta=to_string(A).size();
  float dam=1;
  for(int i=1;i<keta;i++)
    dam=dam*10;
  while(A!=0){
      //int keta=to_string(A)
      if(keta%2==1){
          count++;
      }
      if(A==(int)dam){
      dam=dam/10;
      keta --;
      }
      A--;
      
  }
  cout <<count<<endl;
}
 

Measured memory_bytes: 256
# include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	string s;
	cin >> n >> s;
	for(int i = 0; i < s.size(); i++){
		char c = (s[i] - 'A' + n) % 26 + 'A';
		cout << c;
	}
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){

  int a,b,c,x,ans = 0;
  cin >> a >> b >> c >> x;
  for (int i = 0; i <= a; i++){
  for (int j = 0; j <= b; j++){
  for (int k = 0; k <= c; k++){
  if (i * 500 + j * 100 + k * 50 == x){
  ans++;
  }
  }
  }
  }
  
  cout << ans << endl;
  
return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
using namespace std;
#define ll long long int
#define pb push_back
vector<ll> adj[50001];
int visited[50001];
map<vector<ll>, ll> mp;
void dfs(vector<ll> &v,int u)
{
	// cout<<u<<" ";
	visited[u] = 1;
	v.pb(u);
	for(auto i:adj[u])
	{
		if(!visited[i])
			dfs(v,i);
	}
}

int main(){
	ll n, k;
	cin>>n>>k;
	vector<ll> p(n+1);
	vector<ll> c(n+1);
	int i, j;
	ll ans = LONG_MIN;
	for(i = 1; i <= n; i++)
		cin>>p[i];
	for(i = 1; i <= n; i++){
		cin>>c[i];
		ans = max(ans,c[i]);
	}
	memset(visited,0,sizeof(visited));
	int curr = 1, f = 0;
	while(curr<=n)
	{
		// cout<<curr<<" ";
		if(visited[curr]==1){
			curr++;
			continue;
		}
		// cout<<curr<<" ";
		adj[curr].pb(p[curr]);
		visited[curr] = 1;
		curr = p[curr];
	}
	// cout<<"\n";
	vector<vector<ll>> w;
	memset(visited,0,sizeof(visited));
	for(i = 1; i <= n; i++)
	{
		vector<ll> v;
		if(visited[i]==0){
			dfs(v, i);
			// cout<<"\n";
			w.pb(v);
		}
	}
	int x = w.size();
	vector<ll> sum;
	for(i = 0; i < w.size(); i++)
	{
		ll s = 0;
		for(j = 0; j < w[i].size(); j++)
			s = s + c[w[i][j]];
		sum.pb(s);
		// cout<<s<<" ";
	}
	// cout<<"\n";
	int m;
	for(i = 0; i < w.size(); i++)
	{
		for(j = 0; j < w[i].size(); j++)
		{
			ll s = 0;
			ll r = k%w[i].size();
			ll q = k/w[i].size();
			if(r==0)
			{
				r = w[i].size();
				q--;
			}
			if(sum[i]<0)
			{
				ll lim;
				if(q>=1)
					lim = w[i].size();
				else
					lim = r;
				for(int cnt = 0,m = j; cnt<lim; m++,cnt++)
				{
					s = s + c[w[i][m%w[i].size()]];
					ans = max(ans,s);
				}
				continue;
			}
			s = s + q*sum[i];
			// cout<<w[i].size()<<"\n";
			ans = max(ans , s);
			for(m = j; m < r + j; m++)
			{
				s = s + c[w[i][m%w[i].size()]];
				ans = max(ans,s);
				// cout<<s<<" "<<c[w[i][m%w[i].size()]]<<"\n";
			}
		}
	}
	// cout<<"\n";
	cout<<ans;
}
  

Measured memory_bytes: 5676
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	long long ans=0;
	for(int i=1;i<=n;i++)
	{
		if(i%3==0||i%5==0)
			continue;
		ans+=i;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3624
#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i,n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin() , v.end()
#define inputv(v,n) rep(i,n){\
    ll x;\
    cin>>x;\
    v.push_back(x);\
    }
const ll INF = 999999999999999;
const ll MOD = 1000000007;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans = 0;
vl gragh[100101],visited(100002,0),cost1(100002,0),cost2(100002, 0);
void dfs(ll x,ll t) {
	visited[x] = 1;
	cost1[x] = t;
	for (ll i : gragh[x]) {
		if (visited[i] == 0) {
			dfs(i, t + 1);
		}
	}
}
void dfs2(ll x, ll t) {
	visited[x] = 1;
	cost2[x] = t;
	for (ll i : gragh[x]) {
		if (visited[i] == 0) {
			dfs2(i, t + 1);
		}
	}
}
bool check(ll x) {
	k = 0;
	for (ll i = 1; i < n + 1; i++) {
		if (cost1[i] <= x && cost2[i] > x)k = 1;
	}
	if (k == 0)return true;
	return false;
}
ll nibutan(void) {
	ll ok = n, ng = -1, mid;
	while (ok - ng > 1) {
		mid = (ok + ng) / 2;
		if (check(mid))ok = mid;
		else ng = mid;
	}
	return ok;
}
int main() {
	cin >> n >> p >> q;
	rep(i, n - 1) {
		cin >> a >> b;
		gragh[a].push_back(b);
		gragh[b].push_back(a);
	}

	dfs(p,0);
	visited = vl(100001, 0);
	dfs2(q, 0);

	

	cout << nibutan()-1 << endl;
}

Measured memory_bytes: 11008
/*
 * ARC092_D.cpp
 *
 *  Created on: May 19, 2018
 *      Author: 13743
 */
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}

int a[200001];
int b[200001];
int bsort[200001];

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

	int N;
	cin >> N;
	REP(i, N) {
		cin >> a[i];
	}
	REP(i, N) {
		cin >> b[i];
	}

	int ans = 0;
	REP(c, 29) {
		int bits = 0;
		int T = 1<<c;
		REP(i, N) {
			bsort[i] = b[i] % (2*T);
		}
		sort(bsort, bsort+N);
		REP(i, N) {
			int amod = a[i] % (2*T);
			int l1 = T-amod;
			int r1 = 2*T-amod;
			int l2 = 3*T-amod;
			int r2 = 4*T-amod;
			bits += lower_bound(bsort, bsort+N, r1) - lower_bound(bsort, bsort+N, l1);
			bits += lower_bound(bsort, bsort+N, r2) - lower_bound(bsort, bsort+N, l2);
		}
		if(bits&1) {
			ans += (1<<c);
		}
	}

	cout << ans << endl;
}






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

const int N = 2e5 + 10;

int mn[N][20], mx[N][20];
int a[N];

	int n, k;
// struct {
	void rmq_init (int n) {
		for (int i = 1; i <= n; i++) {
			mn[i][0] = mx[i][0] = a[i];
		}
		for (int j = 1; (1 << j) <= n; j++) {
			for (int i = 1; i + (1 << j) - 1 <= n; i++) {
				mn[i][j] = min(mn[i][j - 1], mn[i + (1 << (j - 1))][j - 1]);
				mx[i][j] = max(mx[i][j - 1], mx[i + (1 << (j - 1))][j - 1]);
			}
		}
	}

	inline int rmq1 (int l, int r) {
		int k = log2(r - l + 1);
		return min(mn[l][k], mn[r - (1 << k) + 1][k]);
	}

	inline int rmq2 (int l, int r) {
		int k = log2(r - l + 1);
		return max(mx[l][k], mx[r - (1 << k) + 1][k]);
	}
// } rmq;


int t_a[ N ];
int t_b[ N ];

void get_f(){
    for (int i=2;i<=n;i++)
    if ( a[i] > a[i-1] )
        t_a[i]=1;
    for (int i=1;i<=n;i++)
        t_b[i]=t_b[i-1]+t_a[i];

    /*
    for (int i=1;i<=n;i++)
        printf("%d ",t_a[i]);
    puts("");

    for (int i=1;i<=n;i++)
        printf("%d ",t_b[i]);
    puts("");
    */
}

bool flag=1;
bool check(int l,int r){
if ( t_b[r]-t_b[l] != k-1 )
    return 1;

if ( flag )
{
    flag=0;
    return 1;
}
else
    return 0;

}

int main (void) {
	scanf("%d%d", &n, &k);
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
	}
	rmq_init(n);
	get_f();

	int ans = 1;
    check(1,k);

	for (int i = k + 1; i <= n; i++) {
		int val1 = rmq1(i - k + 1, i - 1);
		int val2 = rmq2(i - k + 1, i - 1);
		//cout << a[i - k] << " " << val << " " << a[i] << endl;
		//if (a[i - k] < val && val < a[i]) {
		if (a[i - k] < val1 && val2 < a[i]) {

		} else {
		    if ( check(i-k+1,i) )
			    ans ++;
		}
	}

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


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

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

#define all(x)          x.begin(), x.end()
#define kill(x)         return cout << x << endl, 0
#define X               first
#define Y               second
#define sep             ' '
#define endl            '\n'

ll pw(ll a, ll b, ll mod) {
    if (!b)    return 1;
    if (b & 1) return a * pw(a * a % mod, b / 2, mod) % mod;
    return pw(a * a % mod, b / 2, mod) % mod;
}

const ll N    = 1e5 + 10;
const ll MOD  = 1e9 + 7;
const ll INF  = 1e18;

int n, G[N];
vector<int> adj[N];

void DFS(int u, int p) {
    for (int v : adj[u]) if (v != p) {
        DFS(v, u);
        G[u] ^= G[v] + 1;
    }
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    cin >> n;
    for (int i = 0; i < n - 1; i++) {
        int u, v; cin >> u >> v;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    DFS(1, 0);
    cout << (G[1] ? "Alice" : "Bob") << endl;
    return 0;
}


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

using namespace std;

using ll = long long;

constexpr ll MOD = 1e9 + 7;

map<pair<ll, ll>, ll> memo;

ll Dfs(ll s, ll x) {
    if (memo.count(make_pair(s, x)) != 0) return memo[make_pair(s, x)];
    if (s == 0) return 1;
    else if (x == 0) return (s / 2) + 1;

    ll res = Dfs(s / 2, x / 2) % MOD;
    if (1 <= s && 1 <= x) res = (res + Dfs((s - 1) / 2, (x - 1) / 2)) % MOD;
    if (2 <= s) res = (res + Dfs((s - 2) / 2, x / 2)) % MOD;

    return memo[make_pair(s, x)] = res;
}

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

    ll n;
    cin >> n;
    cout << Dfs(n, n) << endl;

    return 0;
}


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

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

    std::vector<int> xs(n), cnt(n, 0);
    for (auto& x : xs) {
        std::cin >> x;
        ++cnt[--x];
    }

    std::set<int> ss;
    for (int x = 0; x < n; ++x) ss.insert(x);
  	// まだ決まっていない数の集合

    std::vector<int> ans;
    ans.reserve(n);

    int out = -1;  // 直前の数に指されている数
    while (ss.size() > 3) {
        int x = *ss.begin();
        if (x == out) {
          	// 指されていたら次へ
            if (ss.size() == 1) {
                std::cout << -1 << std::endl;
                return 0;
            } else {
                x = *(++ss.begin());
            }
        }

        int k = ss.size();
        int y = xs[x];
        if (ss.count(y) && cnt[y] == k - 1) x = y;
      	// y以外がyを指している場合

        ss.erase(x);
        ans.push_back(x);
        --cnt[xs[x]];
        out = xs[x];
    }

  	// 最後の全探索
    std::vector<int> rem(ss.begin(), ss.end());
    do {
        auto tmpans = ans;
        for (auto x : rem) ans.push_back(x);

        bool ok = true;
        for (int i = 0; i < n - 1; ++i) {
            if (ans[i + 1] == xs[ans[i]]) ok = false;
        }

        if (ok) {
            for (auto x : ans) std::cout << x + 1 << " ";
            std::cout << std::endl;
            return 0;
        }

        ans = tmpans;
    } while (std::next_permutation(rem.begin(), rem.end()));

    std::cout << -1 << std::endl;
    return 0;
}


Measured memory_bytes: 6656
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>

using namespace std;

int main(){

  int n;
  cin >> n;
  string s;
  cin >> s;
  int x = 0;
  int xmax = 0;
  for (int i=0; i<s.size(); i++){
    if (s[i] == 'I'){
      x += 1;
    }
    else {
      x -= 1;
    }
    xmax = max(x, xmax);
  }

  cout << xmax << endl;

  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<cstdio>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	int pn = 1;
	if (*ci == '-') {
		pn = -1;
		ci++;
	}
	ll tmp = *(ll*)ci;
	int dig = ((tmp & ma0) ^ ma0) ? 68 - __builtin_ctzll((tmp & ma0) ^ ma0) : 0;
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += (64 - dig >> 3);
	while ((ct = *ci++) >= '0') tmp = tmp * 10 + ct - '0';
	return pn * tmp;
}

void pakuri_sort(int N, ll A[]) {
	const int b = 8;
	ll tmp[200001];
	rep(k, 4) {
		int kazu[1 << b] = {}, kazu2[1 << b] = {};
		rep(i, N) kazu[A[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu[i + 1] += kazu[i];
		for (int i = N - 1; i >= 0; i--) tmp[--kazu[A[i] >> k * b & ((1 << b) - 1)]] = A[i];
		k++;
		rep(i, N) kazu2[tmp[i] >> k * b & ((1 << b) - 1)]++;
		rep(i, (1 << b) - 1) kazu2[i + 1] += kazu2[i];
		for (int i = N - 1; i >= 0; i--) A[--kazu2[tmp[i] >> k * b & ((1 << b) - 1)]] = tmp[i];
	}
}

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


	int N = getint();
	ll A[200001];
	A[0] = 0;
	rep1(i, N) {
		A[i] = getint() + A[i - 1];
	}

	pakuri_sort(N + 1, A);

	ll kotae = 0;
	int kazu = 1;
	rep(i, N) {
		if (A[i + 1] != A[i]) kazu = 1;
		else kotae += kazu++;
	}

	printf("%lld\n", kotae);

	Would you please return 0;
}

Measured memory_bytes: 4852
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef DEBBY
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define ll long long
#define rep(i,a,b) for(int i=int(a); i<=int(b); i++)
#define sz(v)  (int)(v).size()
#define all(v) (v).begin(), (v).end()
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pi>
#define fs first
#define sd second
#define pb push_back


void solve(){
    string s; cin >> s;
    sort(all(s));
    if(s[0]==s[1] && s[1]!=s[2] && s[2]==s[3])
      cout << "Yes";
    else
      cout << "No";
} 

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}
    





Measured memory_bytes: 256
#include <bits/stdc++.h>
char t1[110];
char t2[1510];
int main(){
    int i,j;
    int n1,n2;
    int cnt=0;
    scanf("%s",t1);
    for(i=0;i<strlen(t1);i++){
        t1[i]=tolower(t1[i]);
    }
    while(scanf("%s",t2)){
        if(strcmp(t2,"END_OF_TEXT")==0) break;
        for(i=0;i<strlen(t2);i++){
            t2[i]=tolower(t2[i]);
        }
        if(strcmp(t1,t2)==0) cnt++;
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 3204
import std.stdio;
import std.string;
import std.conv;

void main() {
  int[10] xs;
  for(uint i = 0; i < 10; i++) {
    xs[i] = to!int(chomp(readln()));
  }

  xs.sort;

  writeln(xs[9]);
  writeln(xs[8]);
  writeln(xs[7]);
}

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

string a, b;

int main(void){
    
    cin >> a >> b;
    
    string c = a, d = b;
    reverse(c.begin(), c.end()), reverse(d.begin(), d.end());
    
    if(a == d && b == c) printf("YES\n");
    else printf("NO\n");
    
    return 0;
}


Measured memory_bytes: 256
/*D - Line++*/

#include <bits/stdc++.h>

using namespace std;

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

	int nodos;
	int x, y;

	cin >> nodos >> x >> y;

	vector<int> ans(nodos);

	for (int inicio = 1; inicio <= nodos; ++inicio)
	{
		for (int final = inicio + 1; final <= nodos; ++final)
		{
			// Distancia de inicio a final.
			int dist = 0;

			if (final <= x or inicio >= y)
				dist = final - inicio;
			else
			{
				int d1 = final - inicio;
				int d2 = abs(x - inicio) + 1 + abs(y - final);
				dist = min(d1, d2);
			}

			++ans[dist];
		}
	}

	for (int i = 1; i < nodos; ++i)
		cout << ans[i] << "\n";

	return 0;
}

Measured memory_bytes: 256
#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 gcd(int a, int b) {
	if (a % b == 0) {
		return (b);
	}
	else {
		return (gcd(b, a % b));
	}
}
int main() {
	int n, k;
	int a[100010];
	cin >> n >> k;
	if (n == 1) {
		cin >> a[0];
		if (a[0] == k) {
			cout << "POSSIBLE" << endl;
		}
		else {
			cout << "IMPOSSIBLE" << endl;
		}
		return 0;
	}
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a, a + n);
	int ans = gcd(a[0], a[1]);
	for (int j = 2; j < n; j++) {
		ans = gcd(a[j], ans);
	}
	if (k % ans == 0) {
		if (a[n - 1] < k) {
			cout << "IMPOSSIBLE" << endl;
		}
		else {
			cout << "POSSIBLE" << endl;
		}
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}
	return 0;
}

Measured memory_bytes: 640
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cassert>
#include <cmath>
#include <sstream>
#include <complex>
//#include <unordered_map>
using namespace std;

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<unsigned, unsigned> uu;
typedef pair<ll, ll> l4;


#define pb push_back
#define mp make_pair

const int maxn = 1e5+1;
ll a[maxn];
int n;
int main()
{
  scanf("%d", &n);
  for (int i = 0; i < n; ++i)
    scanf("%lld", a+i);
  sort(a, a+n);
  ll ans = 0;
  ll tar = 1;
  int cnt = 0;
  for (int i = n-1; i >= 1; --i)
    {
      if (a[i] == a[i-1])
	{
	  cnt += 1;
	  tar *= a[i];
	  --i;
	  if (cnt == 2)
	    {
	      ans = tar;
	      break;
	    }
	}
    }
  printf("%lld\n", ans);
}


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

using namespace std;

int N;
map<int, int> MP;
long long sum = 0;

long long query(int b, int c)
{
    int nb = MP[b];
    sum += (c - b) * nb;
    MP[c] += nb;
    MP[b] = 0;
    return sum;
}

int main()
{
    // 入力
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int a;
        cin >> a;
        MP[a]++;
        sum += a;
    }

    // クエリ
    int Q;
    cin >> Q;
    vector<long long> ans(Q);
    for (int i = 0; i < Q; i++)
    {
        int b, c;
        cin >> b >> c;
        ans[i] = query(b, c);
    }

    for (auto &&a : ans)
    {
        cout << a << endl;
    }

    return 0;
}

Measured memory_bytes: 8380
N = int(input())
A = [tuple(map(int, input().split())) for _ in range(N)]
B = [tuple(map(int, input().split())) for _ in range(N)]

A.sort()
B.sort()

cnt = 0
for u, v in B:
    maxy = -1
    maxi = -1

    for i, (x, y) in enumerate(A):

        if x >= u:
            break
        if y >= v:
            continue

        if maxy < y:
            maxy = y
            maxi = i

    if maxy > -1:
        A.pop(maxi)
        cnt += 1

print(cnt)


Measured memory_bytes: 3064
package main
 
import (
    "bufio"
    "fmt"
    "os"
    "strconv"
)

func main(){
    
    n := nextInt64()
    s := nextInt64()
    
    var ans int64
    
    if s > n {
        // s > nである場合、該当するbは存在しない
        fmt.Println(-1)
        os.Exit(0)
    } else if s == n {
        // sとnが等しい場合、n+1が最小のbとなる
        fmt.Println(n+1)
        os.Exit(0)
    }
    for i := int64(2); i*i<=n; i++{
        if chk(n, i, s) {
            fmt.Println(i)
            os.Exit(0)
        }
    }
    now := n-s
    ans = -1
    for i := int64(1); i*i<=now; i++{
		if now%i==0 {
            x := i+1
			if chk(n,x,s) {
                if ans==-1 || ans>x {
					ans = x
                }
			}
			x = now/i+1;
			if chk(n,x,s) {
                if ans==-1 || ans>x {
					ans=x
                }
			}
		}
    }
    fmt.Println(ans);
}

// nとiからdigitSumを計算し、sと一致するかチェックする
func chk(n, i, s int64) bool{
    digitSum := int64(0)
    x := n
	for x > 0 {
		digitSum += x%i
		x /= i
	}
	return digitSum == s
}
 
/* templates */


func Max(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r < a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Min(a []int) int {
    r := a[0]
    for i := 0; i < len(a); i++ {
        if r > a[i] {
            r = a[i]
        }
    }
    return r
}
 
func Sum(a []int) (r int) {
    for i := range a {
        r += a[i]
    }
    return r
}
 
func Abs(a float64) float64 {
    if a < 0 {
        return -a
    }
    return a
}
 
type Pair struct {
    a, b int
}
 
type Pairs []Pair
 
func (p Pairs) Len() int {
    return len(p)
}
 
func (p Pairs) Swap(i, j int) {
    p[i], p[j] = p[j], p[i]
}
 
func (p Pairs) Less(i, j int) bool {
    return p[i].b < p[j].b
}
 
var nextReader func() string
 
func init() {
    nextReader = NewScanner()
}
 
func NewScanner() func() string {
    r := bufio.NewScanner(os.Stdin)
    r.Buffer(make([]byte, 1024), int(1e+11))
    r.Split(bufio.ScanWords)
    return func() string {
        r.Scan()
        return r.Text()
    }
}

func nextString() string {
    return nextReader()
}
 
func nextInt64() int64 {
    v, _ := strconv.ParseInt(nextReader(), 10, 64)
    return v
}
 
func nextInt() int {
    v, _ := strconv.Atoi(nextReader())
    return v
}
 
func nextInts(n int) []int {
    r := make([]int, n)
    for i := 0; i < n; i++ {
        r[i] = nextInt()
    }
    return r
}

func nextStrings(n int) []string {
    r := make([]string, n)
    for i := 0; i < n; i++ {
        r[i] = nextString()
    }
    return r
}

func nextFloat64() float64 {
    f, _ := strconv.ParseFloat(nextReader(), 64)
    return f
}


Measured memory_bytes: 640
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner in = new Scanner(System.in); 
		boolean flag = false;
		int n=in.nextInt();
		String a=in.nextLine();
		while(n--!=0)
		{
			char ch[] = in.nextLine().toCharArray();
			for(int i=0 ; i<ch.length-6; i++)
			{
				if(ch[i]=='H'&&ch[i+1]=='o'&&ch[i+2]=='s'&&ch[i+3]=='h'&&ch[i+4]=='i'&&ch[i+5]=='n'&&ch[i+6]=='o')
				{
					ch[i+6]='a';	
				}
			}
			for(int i=0; i<ch.length; i++)
				System.out.print(ch[i]);
			System.out.println();
		}
	}
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

const int inf = 1e9 + 7;

int main() {
	int n;
	cin >> n;
	int sum = 0;
	int tmp = n;
	while(tmp>0){
		sum += tmp%10;
		tmp = tmp/10;
	}
	if(n%sum==0){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;
using namespace std;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
   
    int n;
    cin>>n;
    string s;
    cin>>s;
    n=0;
    int maxn=n;
    rep(i,s.size()){
        
        if(s[i]=='I'){
            n++;
        }else{
            n--;
        }
        if(maxn<n){
            maxn=n;
        }
    }
    cout<<maxn<<endl;
    
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
using namespace std;

const double PI=acos(-1);

int main(){
    vector<vector<int>> a(3,vector<int>(3, 0));
    cin >> a[0][0] >> a[0][1] >> a[0][2] >> a[1][0] >> a[1][1] >> a[1][2] >> a[2][0] >> a[2][1] >> a[2][2];

    int n, b;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> b;
        for(int j = 0; j < 3; j++){
            for(int k = 0; k < 3; k++){
                if(a[j][k] == b) a[j][k] = 0;
            }
        }
    }

    if(a[0][0]+a[0][1]+a[0][2] == 0 ||
        a[1][0]+a[1][1]+a[1][2] == 0 ||
        a[2][0]+a[2][1]+a[2][2] == 0 ||
        a[0][0]+a[1][0]+a[2][0] == 0 ||
        a[0][1]+a[1][1]+a[2][1] == 0 ||
        a[0][2]+a[1][2]+a[2][2] == 0 ||
        a[0][0]+a[1][1]+a[2][2] == 0 ||
        a[0][2]+a[1][1]+a[2][0] == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9+7;
int main() {
    ll n,k;
    cin >> n >> k;
    vector<ll>a(n);
    for(ll i=0;i<n;i++){
        cin >> a[i];
    }
    ll ans=1e15;
    for(ll i=0;i<(1<<n);i++){
        ll cost=0;
        ll mh=0;
        ll num=0;
        vector<ll>b=a;
        for(ll j=0;j<n;j++){
            if(i & (1<<j)){
                cost+=max((ll)0,mh+1-b[j]);
                b[j]=max(b[j],mh+1);
                if(b[j]>mh) num++;
            }
            mh=max(mh,b[j]);
        }
        if(num>=k) ans=min(ans,cost);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3512
#include <bits/stdc++.h>
//#pragma GCC diagnostic error "-Wconversion"
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define mp(a, b) make_pair(a, b)
typedef long long ll;
const ll INF = 1LL << 60;
const ll MOD = (1e9 + 7);
using namespace std;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
ll dp[100010];
ll gcd(ll x, ll y){
  return y == 0 ? x : gcd(y, x % y);
}
ll lcg(ll x, ll y){
  return x * y / gcd(x, y);
}
ll digits(ll x){
  ll length = 0;
  while (x > 0){
    x /= 10;
    length++;
  }
  return length;
  if (x == 0) return 0;
}
map<ll, ll> factor(ll n){
  map<ll, ll> ans;
  ll a = 2;
  while (n >= a * a){
    if (n % a == 0){
      ans[a]++;
      n /= a;
    }
    else a++;
  }
  ans[n]++;
  return ans;
}
template<class T> inline bool chmin(T& a, T b){
  if (a > b){
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b){
  if (a < b){
    a = b;
    return true;
  }
  return false;
}

int main(){
  cout << fixed << setprecision(15);

  int n; cin >> n;

  //ll ans = 0;
  string ans = "No";

  int sum = 0;
  int m = n;
  while (n > 0){
    sum += n % 10;
    n /= 10;
  }
  if (m % sum == 0) ans = "Yes";
  
  cout << ans << endl;

  return 0;
}

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

int main(){
	char s[3];
  	int cnt=0;
  	int i=0;
  for(i=0;i<3;i++){
  	cin>>s[i];
    if(s[i]=='R'){
    	cnt++;
    }
  }	
  if(s[0]=='R' && s[1]=='S'){
  	cnt=1;
  }
  cout<<cnt;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR0(i,n) for(i=0;i<n;i++)
#define FOR(i,j,n) for(i=j;i<n;i++)
#define FORD(i,j,k) for(i=j;i>=k;i--)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define inf 1000000000
#define ninf -1000000000
#define endl '\n' 
#define she_told_me_dont_worry ios_base::sync_with_stdio (false) ; cin.tie(0) ; cout.tie(0) ;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// Use cout.flush() for interactive problems.
// Use this for increased stack size: g++ -o a.exe -Wl,--stack=256000000 -O2 source.cpp
inline long long  MAX2(long long  a, long long int b){return (a)>(b)?(a):(b);}
inline long long  MAX3(long long  a, long long  b,long long  c){return (a)>(b)?((a)>(c)?(a):(c)):((b)>(c)?(b):(c));}
inline long long  MIN2(long long  a, long long  b){return (a)<(b)?(a):(b);}
inline long long  MIN3(long long  a, long long b,long long c){return (a)<(b)?((a)<(c)?(a):(c)):((b)<(c)?(b):(c));}
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< ii > vii;
int main()
{
    she_told_me_dont_worry
    double l;
    cin>>l;
    double side = (l/3);
    double ans = side*side*side;
    cout<<fixed<<setprecision(10);
    cout<<ans<<endl;
    cerr <<endl<< "Time elapsed : " << clock() * 1000.0 / CLOCKS_PER_SEC << " ms" << '\n';
}

Measured memory_bytes: 256
N, M = map(int,input().split())
V = [[int(i)-1 for i in input().split()] for j in range(M)]
ans = [0]*M
P = [-1]*N

def find(a):
    if(P[a] < 0):
        return a
    P[a] = find(P[a])
    return P[a]

def same(a, b):
    return find(a) == find(b)

def size(a):
    return -P[find(a)]

def unite(a,b):
    a = find(a)
    b = find(b)
    if(a == b):
        return false
    if(P[a] > P[b]):
        a,b = b,a
    P[a] += P[b]
    P[b] = a
    
t = N*(N-1)//2
for i in range(M):
    ans[M-1-i] = t
    u,v = V[M-1-i]
    if(same(u,v)):
        continue
    else:
        t -= size(u)*size(v)
        unite(u,v)

print(*ans,sep="\n")
    


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

const int MOD = 1e9 + 7;
const int N = 1e3 + 10;
char a[N][N];

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

  int H,W; cin >> H >> W;
  for(int i = 1; i <= H; i++){
    for(int j = 1; j <= W; j++){
      cin >> a[i][j];
    }
  }

  vector< vector<int> > dp(N,vector<int>(N,0));
  dp[1][1] = 1;
  for(int i = 1; i <= H; i++){
    for(int j = 1; j <= W; j++){
      if(a[i][j] != '.') continue;
      if(i-1 >= 1) (dp[i][j] += dp[i-1][j]) %= MOD;
      if(j-1 >= 1) (dp[i][j] += dp[i][j-1]) %= MOD;
    }
  }
  cout << dp[H][W] << endl;

  return 0;
}


Measured memory_bytes: 9344
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

int main()
{
	string s;
	cin >> s;

	int add = 0;
	for (int i = 0; i < s.length(); i++)
	{
		if (s[i] == 'o')
		{
			add += 100;
		}
	}
	cout << 700 + add << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pii pair<int,int>
const long long MOD=1000000007;

int main(){//価値の総和が(x+y)-(x+y)/2=(x+y)/2だけ下がるので小さい順に足していく
    int n;
    cin>>n;
    vector<int> V(n);
    rep(i,n) cin>>V[i];
    sort(V.begin(),V.end());
    long long numerator=0;
    rep(i,n){
        if(i>1) numerator+=(long long)V[i]*pow(2,i-1);
        else numerator+=(long long)V[i];
    }
    long long denominator=pow(2,n-1);
    cout<<fixed<<setprecision(10)<<(double)numerator/denominator<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define N 1000000007
typedef long long ll;
#define all(v) (v).begin(),(v).end()
#define sz(x) int(x.size())
int main(){
	int a,b;
	cin>>a>>b;
	int ans=(b-1)/(a-1);
	if((b-1)%(a-1)!=0) ans++;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <iomanip>
#include <bitset>
using namespace std;

typedef long long ll;


ll mod = 1e9 + 7;
ll dp[23][(1 << 21) + 3];
vector<int> edg[23];

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			bool a; cin >> a;
			if (a) edg[i].push_back(j);
		}
	}
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < (1 << n); j++) {
			if (dp[i][j] == 0) continue;
			for (int k : edg[i]) {
				if (j&(1 << k)) continue;
				int s = j | (1 << k);
				dp[i + 1][s] += dp[i][j];
				if (dp[i + 1][s] >= mod) dp[i + 1][s] -= mod;
			}
		}
	}
	cout << dp[n][(1 << n) - 1] << endl;
	return 0;
}


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

int main(void){
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  while(1){
    C=C-B;
    A=A-D;
    if(C<=0){
      cout<<"Yes"<<endl;
      break;
    }
    if(A<=0){
      cout<<"No"<<endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 3636
// AtCoder Beginner Contest 100
// A - Happy Birthday!
#include <bits/stdc++.h>
using namespace std;

#define IEF(i, s, t)    for(int i=s; i<t; i++)
#define NEF(i, s, t)    for(int i=s; i>=t; i--)
#define MAXN 100005

int main(){
    ios_base::sync_with_stdio(false);
    int A, B;
    cin >> A >> B;
    if(A < 1 || A > 16)
    {
        cout << ":(";
    } else if(B < 1 || B > 16)
    {
        cout << ":(";
    } else if(A + B > 16)
    {
        cout << ":(";
    } else if(A > 8 || B > 8) 
    {
        cout << ":(";
    } else {
        cout << "Yay!";
    }
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
/*{{{*/
#include <bits/stdc++.h>
#ifdef LOCAL
int c_ = 0;
#define cout (c_?cerr:cout)
#define debug(...) \
{if(!c_++)cerr<<"\033[96;1m"; \
__VA_ARGS__; \
if(!--c_)cerr<<"\033[0m";}
#else
#define debug(...) {}
#endif
#define assrt(...) debug(\
if (not (__VA_ARGS__)) \
    exit((cerr << __LINE__ << ": " << #__VA_ARGS__ << '\n', 0));\
)
#define st first
#define nd second
#define all(...) (__VA_ARGS__).begin(), (__VA_ARGS__).end()
using namespace std; using ll = long long;
template < typename t > using V = vector< t >;
template < typename t, size_t s > using A = array< t, s >;
void print() {cout << '\n';}
template< typename t, typename... v >
void print(const t& a, const v&... b)
{cout << a << (sizeof...(b)?" ":""); print(b...);}
template< typename t > void print_range(t a, const t& b)
{ while (a != b) cout << (*a++) << ' '; cout << '\n';}
#define dump(...) debug(print(#__VA_ARGS__,'=',__VA_ARGS__))
#define dump_range(...) debug(cerr<<#__VA_ARGS__ << ": "; print_range(__VA_ARGS__))
/*}}}*/



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

    int tab[5];
    for (int i = 0; i < 5; ++i)
        cin >> tab[i];
    sort(tab, tab + 5);
    int k; cin >> k;
    if (tab[4] - tab[0] > k)
        cout << ":(" << '\n';
    else
        cout << "Yay!" << '\n';
}

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

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;

int main() {

    int n; cin >> n;

    long double t = 0;

    for (int i = 0; i < n; ++i) {
        long double a; cin >> a;

        t += 1.0 / a;
    }

    cout << fixed << setprecision(10) << 1.0 / t << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
m = sum(A)/N
dif = [0]*N

for i in range(N):
    dif[i] = abs(m - A[i])

for i in range(N):
    if dif[i] == min(dif):
        print(i)
        exit()

Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    int[] p = new int[sc.nextInt()];

    for(int pIdx=0;pIdx<p.length;pIdx++){
      p[pIdx]=sc.nextInt();
    }

    int count=0;
    for(int pIdx = 1;pIdx<p.length-1;pIdx++){
      if(isMatch(p[pIdx-1],p[pIdx],p[pIdx+1]))count++;
    }
    System.out.println(count);
  }

  static boolean isMatch(int pm1, int p0, int pp1) {
//    return (!(p0 < pm1 && p0 < pp1)) && !(p0 > pm1 && p0 > pp1);

    if (p0 < pm1 && p0 < pp1) return false;
    if (p0 > pm1 && p0 > pp1) return false;
    return true;
  }
}


Measured memory_bytes: 21716
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
	int n, temp1, temp2;
	scanf("%d", &n);
	int i, h[n];
	for(i = 0; i < n; i++)
		scanf("%d", h + i);
	int ans[n];
	ans[0] = 0;
	ans[1] = abs(h[1] - h[0]);
	for(i = 2; i < n; i++){
		temp1 = ans[i - 2] + abs(h[i] - h[i - 2]);
		temp2 = ans[i - 1] + abs(h[i] - h[i - 1]);
		ans[i] = (temp1 < temp2) ? temp1 : temp2;
	}
	printf("%d\n", ans[n - 1]);
	return 0;
}

Measured memory_bytes: 2496
//HOW YOU DOI'N........................JT
//Could this code be more bad..........CB
//I know...............................MG
//Hii..................................RG
//Noooooooo............................RG
//I wish I could but I don't want to...PB

//That's what she said.................MS


#include <bits/stdc++.h>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);

#define ll long long
#define ld long double
#define pb push_back
#define mkpr make_pair
#define fi(i,a,b) for (ll i=a;i<b;i++)
#define vll vector<ll>
#define vch vector<char>
#define vst vector<string>
#define vpll vector<pll>
#define vvl vector<vector<ll>>
#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.rbegin(), v.rend())
#define mxe(v) *max_element(v.begin(),v.end())
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ff first
#define ss second
#define mll map<ll, ll>
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)
#define nl "\n"
#define sp " "
#define sz(x)  (int)x.size()

using namespace std;

double PI = (acos(-1));
ll md = 1000000007;
//ll md = 998244353;

ll pw(ll a, ll b){ll c=1,m=a;while (b){if (b&1)c=(c*m);m=(m*m);b/=2;}return c;}
ll pwmd(ll a, ll b){ll c = 1, m = a;while (b){if (b & 1)c = ((c * m)) % md;m = (m * m) % md;b /= 2;}return c;}
ll modinv(ll n){return pwmd(n, md - 2);}
ll min(ll a,ll b){if(a>=b)return b;return a;}
ll nc2(ll n){return (1ll * n * (n - 1)) / 2;}
ll nsum(ll n){return (1ll * n * (n + 1)) / 2;}
bool prime(ll a){for(int i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}

#define MAX_SIZE 1005
void Sieve(vector<int> &primes){bool IsPrime[MAX_SIZE];memset(IsPrime, true, sizeof(IsPrime));
for (int p = 2; p * p < MAX_SIZE; p++){if (IsPrime[p] == true){
			for (int i = p * p; i < MAX_SIZE; i += p)IsPrime[i] = false;}}
	for (int p = 2; p < MAX_SIZE; p++)if (IsPrime[p])primes.push_back(p);}


vector<char> sml={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char> cap={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};



// Lets start ...

void solve(){
    ll n,ans=0;
    cin>>n;
    fi(i,1,n+1){
        if(i%3!=0&&i%5!=0)ans+=i;
    }cout<<ans;
}



int main(){
    //vector<int> primes;
    //Sieve(primes);

    fast
    ll tests=1;
    //cin>>tests;
    while(tests--){
        solve();
    }

    return 0;
    }

// Done:)









Measured memory_bytes: 3668