akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

typedef long long ll;
const int N = 1000005;
const ll INF = 0x3f3f3f3f3f3f3f3f;
int n, q, a, b, p[N];

struct SegTree {
  int l, r;
  ll min1, min2, tag;
} t[N << 2];

void build(int p, int l, int r) {
  t[p].l = l, t[p].r = r, t[p].min1 = t[p].min2 = INF, t[p].tag = 0;
  if (l == r) return;
  int mid = (l + r) >> 1;
  build(p << 1, l, mid), build(p << 1 | 1, mid + 1, r);
}

void pushdown(int p) {
  if (!t[p].tag) return;
  t[p<<1].tag += t[p].tag, t[p<<1|1].tag += t[p].tag;
  t[p<<1].min1 += t[p].tag, t[p<<1|1].min1 += t[p].tag;
  t[p<<1].min2 += t[p].tag, t[p<<1|1].min2 += t[p].tag;
  t[p].tag = 0;
}

void change(int p, int x, ll o) {
  if (t[p].l == t[p].r) {
    t[p].min1 = std::min(t[p].min1, o - t[p].l);
    t[p].min2 = std::min(t[p].min2, o + t[p].l);
    return;
  }
  int mid = (t[p].l + t[p].r) >> 1;
  pushdown(p);
  if (x <= mid) change(p << 1, x, o);
  else change(p << 1 | 1, x, o);
  t[p].min1 = std::min(t[p<<1].min1, t[p<<1|1].min1);
  t[p].min2 = std::min(t[p<<1].min2, t[p<<1|1].min2);
}

ll query1(int p, int l, int r) {
  if (t[p].l >= l && t[p].r <= r) return t[p].min1;
  int mid = (t[p].l + t[p].r) >> 1; ll ret = INF;
  pushdown(p);
  if (l <= mid) ret = std::min(ret, query1(p << 1, l, r));
  if (r > mid) ret = std::min(ret, query1(p << 1 | 1, l, r));
  return ret;
}

ll query2(int p, int l, int r) {
  if (t[p].l >= l && t[p].r <= r) return t[p].min2;
  int mid = (t[p].l + t[p].r) >> 1; ll ret = INF;
  pushdown(p);
  if (l <= mid) ret = std::min(ret, query2(p << 1, l, r));
  if (r > mid) ret = std::min(ret, query2(p << 1 | 1, l, r));
  return ret;
}

ll query(int p) {
  if (t[p].l == t[p].r) return (t[p].min2 - t[p].l);
  pushdown(p);
  return std::min(query(p << 1), query(p << 1 | 1));
}

signed main() {
  scanf("%d%d%d%d", &n, &q, &a, &b);
  for (int i = 1; i <= q; ++i) scanf("%d", p + i);
  build(1, 1, n);
  p[0] = a;
  change(1, b, 0);
  for (int i = 1; i <= q; ++i) {
    ll qwq = std::min(query1(1, 1, p[i]) + p[i], query2(1, p[i], n) - p[i]);
    t[1].tag += abs(p[i] - p[i-1]);
    t[1].min1 += abs(p[i] - p[i-1]);
    t[1].min2 += abs(p[i] - p[i-1]);
    change(1, p[i-1], qwq);
  }
  printf("%lld\n", query(1));
  return 0;
}

Measured memory_bytes: 20736
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define powerof2 ()
#define mp make_pair
#define pi acos(-1)
using ll = long long;
const ll M = 1000000007;
const ll M1= 998244353;
using vl = vector<ll>;
using pll =  pair<ll,ll>;
ll power(ll x,ll y){
	if(y==0)
		return 1;
	ll res=power(x,y/2);
	res=(res*res);
	if(y&1)
		res=(res*x);
	return res;
}
 
ll powermod(ll x,ll y,ll mod){
	if(y==0)
		return 1;
	ll res=powermod(x,y/2,mod);
	res=(res*res)%mod;
	if(y&1)
		res=(res*x)%mod;
	return res;
}
/*ll binarysearch(ll va)
{
	ll n=1;
	ll l=va+1,u=n;
	ll st=num.order_of_key(va);
	while(l+1<u)
	{
		m=(l+u)/2;
		ll in=num.order_of_key(m);
		if(in-st==m-va)
		{
			l=m;
		}
		else
		{
            u=m;
		}
	}
	if(num1.find(l)==num1.end())
		return l;
	return u;
}*/
void solve(){
	string s,t;
	cin>>s;
	cin>>t;
	int cnt=0;
	for(int i=0;i<(int)s.size();i++){
		if(s[i]!=t[i]) cnt++;
	}
	cout<<cnt;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // cin>>t;
 
    for(int i=1;i<=t;i++)
    {//cout<<"Case #"<<i<<": ";
    solve();}
    return 0;
}

Measured memory_bytes: 3780
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
    ll n;
    cin>>n;
    vl a,b;
    rep(i,n)
    {
        ll c;
        cin>>c;
        a.pb(c);
    }
    rep(i,n)
    {
        ll c;
        cin>>c;
        b.pb(c);
    }
    ll dp[(1<<n)+100];
    rep(i,(1<<n)+100)
    {
        dp[i]=mod;
    }
    dp[0]=0;
    int cost[(1<<n)+100][55];
    rep(i,(1<<n)+100)
    {
        rep(j,55)
            cost[i][j]=mod;
    }
    cost[0][0]=0;
    for(int i=0;i<(1<<n);i++)
    {
        if(dp[i]==mod)
            continue;
        int set=(__builtin_popcount(i));
        int cnt=0;
        for(int j=0;j<n;j++)
        {
            if((i&(1<<j))!=0)
                continue;
            int parity=abs(set-j);
            parity%=2;
            int nxt;
            if(parity==1)
                nxt=b[j];
            else
                nxt=a[j];
            if(nxt>=dp[i])
            {
                for(int k=0;k<=nxt;k++)
                    cost[(i|(1<<j))][nxt]=min(cost[(i|(1<<j))][nxt],cost[i][k]+cnt);
                dp[(i|(1<<j))]=min(dp[(i|(1<<j))],(ll)nxt);
            }
            cnt++;
        }
    }
    if(dp[(1<<n)-1]!=mod)
    {
        ll ans=mod;
        for(int i=0;i<=50;i++)
        {
            ans=min((ll)cost[(1<<n)-1][i],ans);
        }
        cout<<ans<<'\n';
    }
    else
    {
        cout<<"-1\n";
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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

int main() {
string s;
  cin >> s;
  if(s.at(0) != s.at(1) && s.at(1) != s.at(2) && s.at(2)
     != s.at(3)) cout << "Good" << endl;
  else cout << "Bad" << endl;
  
}


Measured memory_bytes: 256
// ================
// Himanshu Lal
// MNIT Jaipur
// ================
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define TEZ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define pb push_back
#define INF 1e18
#define vi vector<pair<ll,ll>>
#define ff first
#define ss second
#define mp map<ll,ll>
#define test ll tp; cin>>tp; while(tp--)
#define srt(v) sort(v.begin(),v.end())
double pi=acos(-1);
void OJ(){
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
}
int main(){
    TEZ;
    ll n;
    cin>>n;
    string s;
    cin>>s;
    ll w=0,r=0;
    f(i,0,n){
        if(s[i]=='W')
            w++;
        else
            r++;
    }
    if(w==n or r==n){
        cout<<"0";
        return 0;
    }
    w=0;r=0;
    f(i,0,n){
        if(s[i]=='W')
            w++;  
    }
    ll c=w;
    rf(i,n-1,0){
        if(c==0)
            break;
        if(s[i]=='R')
        r++;
        c--;
    }
    cout<<r<<endl;
    
}

Measured memory_bytes: 3760
/*
AUTHOR: Aman Raj
LANG: C++
*/

using namespace std;

typedef   long long  int ll;
#include <bits/stdc++.h>


//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
#define fast  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
#define all(a) a.begin(),a.end()
//#define mod 998244353


#define mod   1000000007

#define inf 1e18
//#define mod 3
#define flush fflush(stdout)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
typedef cc_hash_table<ll, ll, hash< ll > > ht;

// find_by_order()  // order_of_key
typedef tree<
    ll,
    null_type,
    less<ll>,
    rb_tree_tag,
    tree_order_statistics_node_update>
    ordered_set;






ll power1(ll a, ll b)//a raised to power b
   {  if(b<=0) return 1; if(b==1) return a;
       ll c=power1(a,b/2);
        c*=c;c%=mod;if(b%2==1) c*=a;c%=mod;
        return c;
   }
   ll mi(ll a,ll m)
   { ll c= power1(a,m-2);

     return c;
   }



 struct less_then_greater {
    template<typename T, typename U>
    bool operator()(T const& lhs, U const& rhs) const {
        if (lhs.first < rhs.first) return true;
        if (rhs.first < lhs.first) return false;
        return lhs.second > rhs.second;
    }
};
 /*std::priority_queue<std::pair<int, int>,
                    std::vector<std::pair<int, int>>,
                    less_then_greater
                   > pq;*/
  /*   #define MAXN 1000001
ll spf[MAXN];
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<MAXN; i++)

        // marking smallest prime factor for every
        // number to be itself.
        spf[i] = i;

    // separately marking spf for every even
    // number as 2
    for (int i=4; i<MAXN; i+=2)
        spf[i] = 2;

    for (int i=3; i*i<MAXN; i++)
    {
        // checking if i is prime
        if (spf[i] == i)
        {
            // marking SPF for all numbers divisible by i
            for (int j=i*i; j<MAXN; j+=i)

                // marking spf[j] if it is not
                // previously marked
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}
vector<ll> getFactorization(ll x)
{
    vector<ll> ret;
    while (x != 1)
    {
        ret.push_back(spf[x]);
        x = x / spf[x];
    }
    return ret;
}
*/
// take multiset of all edges
// meanwhile for all cc keep record of all edges in multiset too which can be used to digest
// one line or two lines
//

 int main()
 {   ll n;cin>>n;
      cout<< ((n+999)/1000)*1000 - n<<endl;
     return 0;
 }



Measured memory_bytes: 3624
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimization("Ofast")
#pragma GCC optimization("unroll-loops")

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pll;
typedef pair<string, string> pss;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<vpll> vvpll;
typedef unordered_map<ll, ll> um;
typedef unordered_set<ll> us;

#define fastio ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#define ts ll t; in(t) while (t--) solve();
#define ks ll t; in(t) FOR(i, 1, t+1) out("Case #" << i << ": " << solve());
#define endl '\n'
#define ln cout << endl;
#define in(x) cin >> x;
#define out(x) cout << x << endl;
#define flush cout << flush;
#define reset(a, b) memset(a, b, sizeof(a));
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define FORI(i, a, b, c) for (ll i = a; i < b; i += c)
#define FORD(i, a, b) for (ll i = a; i > b; i--)
#define FOREACH(it, v, r) for (auto it = v.begin() + r; it != v.end(); it++)
#define FORALL(it, v) for (auto it : v)
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define vin(v, x) vll v(x); FOR(i, 0, x) in(v[i])
#define all(v) v.begin(), v.end()
#define allr(v, r) v.begin(), v.begin() + r
#define showv(v) FORALL(it, v) cout << it << ' '; ln
#define printv(v) FORALL(it, v) out(it)
#define show2d(v) FORALL(it, v) { FORALL(j, it) cout << j << ' '; ln}
#define showm(v) FORALL(it, v) cout << it.F << ": " << it.S << ' '; ln
#define sortv(v) sort(all(v));
#define revv(v) reverse(all(v));
#define maxv(v) *max_element(all(v))
#define minv(v) *min_element(all(v))
#define gcd __gcd
#define checkbit(n, i) (n >> i) & 1               // check ith bit
#define bitcount __builtin_popcount               // count set bits
#define firstbitindex __builtin_ctz               // count trailing zeros
#define lastbitindex __builtin_clz                // count leading zeros
#define bitparity __builtin_parity                // check set bits are even or odd
#define findv(v, x) (find(all(v), x) != v.end())  // find in a vector
#define findsm(u, x) (u.find(x) != u.end())       // find in a set / map
#define findstr(s, x) (s.find(x) != string::npos) // find in a string
#define sz(a) a.size()
#define precise(x) cout << fixed << setprecision(x);

const ll MAXN = 1e6 + 5, MOD = 998244353, SIZE = 2e7, INF = 0x7f7f7f7f7f7f7f7f;
const double EPS = 1e-9, PI = acos(-1);
const int INFi = 0x7f7f7f7f;

//<<------Declare Variables Here----->>//

//<<-----Implement Functions Here---->>//
void solve()
{
    ll X, Y, a, b;
    in(X >> Y)
    b = Y / 2 - X;
    a = X - b;
    if (a >= 0 && b >= 0 && Y % 2 == 0)
        out("Yes")
    else
        out("No")
}

//<<----------Start of Main---------->>//
int main()
{
    fastio
    solve();
    return 0;
}

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


template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v){
    if(!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p) {
    out << "[" << p.first << ", " << p.second << "]";
    return out;
}
//---------

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    stack<char> st;
    for(auto &a : s){
        if(a == 'S'){
            st.push(a);
        }else if(st.empty() || a == 'T' && st.top() == 'T'){
            st.push(a);
        }else if(st.empty() || a == 'T' && st.top() == 'S' ){
            st.pop();
        }
    }
    cout << st.size() << endl;
    
}

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

int ctoi(const char c) {
	return c - '0';
}
int keta(int a) {
	return to_string(a).size();
}
int a[10], b[10], c[10];
bool d[10];
signed main(){
	int n, m;
	cin >> n >> m;
	rep(i, m) {
		cin >> a[i] >> b[i];
	}
	rep(i, m) {
		if (!d[a[i]]) {
			c[a[i]] = b[i];
			d[a[i]] = true; 
		}
		if (d[a[i]] && c[a[i]] != b[i]) {
			cout << -1 << endl; return 0;
		}
		if (a[i] == 1 && b[i] == 0&&n!=1) {
			cout << -1 << endl; return 0;
		}
	}
	if (c[1] == 0 && n != 1) {
		c[1] = 1;
	}
	Rep(i, n) {
		cout << c[i];
	}
	cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define repr(i,from,to) for(int (i)=(from);(i)<(to);(i)++)
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
// const bool debug=true;
const bool debug=false;
#define DEBUG if(debug==true)
#define vprint(x) for(auto a:(x)) cout << x << endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1000000007;
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(void) {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k,c;cin>>n>>k>>c;
    string s;
    cin>>s;
    vector<ll> fw(k,-1),bk(k,-1);
    ll cnt = 0;
    rep(i,n) {
        if (s[i]=='x') {
            continue;
        }
        if (cnt==0) {
            fw[0] = i;
            ++cnt;
        }
        else if (fw[cnt-1]+c<i) {
            fw[cnt] = i;
            ++cnt;
        }
        if (cnt==k) break;
    }

    cnt--;
    for(int i=n-1;i>=0;i--) {
        if (s[i]=='x') continue;
        if (cnt==k-1) {
            bk[k-1] = i;
            --cnt;
        }
        else if (bk[cnt+1]-c>i) {
            bk[cnt] = i;
            --cnt;
        }
        if (cnt==-1) break;
    }
    rep(i,k) {
        if (fw[i]==bk[i]) {
            cout << fw[i]+1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 5012
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
	ll n,m,k;
	cin>>n>>m>>k;
	vector<ll> a(n);vector<ll> b(m);
	vector<ll> prefa(n+2);vector<ll> prefb(m+2);
	prefa[0]=0;prefb[0]=0;
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
		prefa[i+1]=prefa[i]+a[i];
	}
	for(ll i=0;i<m;i++)
	{
		cin>>b[i];
		prefb[i+1]=prefb[i]+b[i];
	}
	ll ans=0;ll j=m;
	for(ll i=0;i<n+1;i++)
	{
		if(prefa[i]>k){
			break;
		}
		ll target=(k-prefa[i]);
		ll lo=0;ll hi=m;
		while(lo<=hi)
		{
			ll mid=lo+(hi-lo)/2;
			if(prefb[mid]<=target)
			{
				j=mid;
				lo=mid+1;
			}
			else{
				hi=mid-1;
			}
			
		}
	
		ans=max(ans,i+j);
		
	}
	cout<<ans<<"\n";
	
	return 0;
}

Measured memory_bytes: 9576
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;
using ll = long long;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

const string YES = "YES";
const string NO = "NO";

void solve(vector<ll> N) {
  sort(ALL(N));
  bool pred = accumulate(ALL(N), 0,
                         [](int acc, int x) { return acc * 10 + x; }) == 1479;
  cout << (pred ? YES : NO) << endl;
}

int main() {
  vector<ll> N(4);
  for (int i = 0; i < 4; i++) {
    cin >> N[i];
  }
  solve(move(N));
  return 0;
}


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

#define ll long long int
#define rep(i, a, n) for (ll i = a; i < n; i++)
#define repm(i, a, n) for (ll i = a; i >= n; i--)
#define INF 1e9
#define LINF 1e17
#define MOD (int)(1e9 + 7)
#define mod (int)(1e9 + 7)
#define pi 3.141592653589
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vi vector<int>
#define vll vector<ll>
#define vd vector<double>
#define vb vector<bool>
#define vs vector<string>
#define vii vector<vector<int>>
#define vllll vector<vector<ll>>
#define ALL(a) (a).begin(), (a).end()

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

void print(bool f)
{
    cout << (f ? "Yes" : "No") << endl;
}

void Print(bool f)
{
    cout << (f ? "YES" : "NO") << endl;
}

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

    set<char> st;
    for (auto x : s)
        st.insert(x);
    if (st.size() == 1)
        return cout << 0 << endl, 0;
    ll ans = INF;
    for (auto c : st)
    {
        string t = s;
        ll cnt = 0;
        while (1)
        {
            string tmp;
            set<char> tt;
            rep(i, 0, t.size() - 1)
            {
                tmp += (t[i] == c || t[i + 1] == c ? c : t[i]);
                tt.insert(t[i] == c || t[i + 1] == c ? c : t[i]);
            }
            cnt++;
            if (tt.size() == 1)
                break;
            t = tmp;
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<tuple>
#include<map>
using namespace std;
struct State { bool x[3][3]; };
int p[1020][1020], H, W, dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int M[1020][1020][128];

State slide(int rx, int ry, State S) {
	State T; for (int i = 0; i < 9; i++)T.x[i / 3][i % 3] = false;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			int h1 = i - rx, h2 = j - ry; if (h1 < 0 || h2 < 0)continue;
			T.x[h1][h2] = S.x[i][j];
		}
	}
	return T;
}
int solve(int cx, int cy, State S) {
	State SV = S;
	short SV2 = 0; for (int i = 0; i < 9; i++) { if (S.x[i / 3][i % 3] == true)SV2 += (1 << i); }
	if (M[cx][cy][SV2] >= 1)return M[cx][cy][SV2] - 1;

	if (cx == H && cy == W) { M[cx][cy][SV2] = 1; return 0; }
	if (cx > H || cy > W) { M[cx][cy][SV2] = 100000000; return 99999999; }

	int e1 = 0; if (S.x[1][1] == false && p[cx][cy] >= 1) { S.x[1][1] = true; e1 = p[cx][cy]; }
	vector<tuple<int, int, int>>v;
	for (int i = 0; i < 4; i++) {
		int fx = cx + dx[i], fy = cy + dy[i];
		if (p[fx][fy] >= 1 && S.x[1 + dx[i]][1 + dy[i]] == false)v.push_back(make_tuple(fx, fy, i));
	}
	if (v.size() == 0) {
		int e3 = min(solve(cx + 1, cy, slide(1, 0, S)), solve(cx, cy + 1, slide(0, 1, S))) + e1;
		M[cx][cy][SV2] = e3 + 1;
		return e3;
	}
	int ret = 99999999;
	for (int i = 0; i < (int)v.size(); i++) {
		State Y = S; int e2 = 0;
		for (int j = 0; j < v.size(); j++) {
			if (i != j) { Y.x[1 + dx[get<2>(v[j])]][1 + dy[get<2>(v[j])]] = true; e2 += p[get<0>(v[j])][get<1>(v[j])]; }
		}
		ret = min(ret, solve(cx + 1, cy, slide(1, 0, Y)) + e2 + e1);
		ret = min(ret, solve(cx, cy + 1, slide(0, 1, Y)) + e2 + e1);
	}
	M[cx][cy][SV2] = ret + 1;
	return ret;
}
int main() {
	cin >> H >> W; for (int i = 1; i <= H; i++) { for (int j = 1; j <= W; j++) { char c; cin >> c; if (c >= '1' && c <= '9')p[i][j] = c - '0'; } }
	State T; for (int i = 0; i < 9; i++)T.x[i / 3][i % 3] = false;
	int ans = solve(1, 1, T);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 512060
#include<stdio.h>
int main(void)
{
	int a,b,c,d;
	scanf("%d",&a);
	for(b=0;b<a;b++)
	{
		scanf("%d",&c);
		printf("Case %d:\n",b+1);
		for(d=0;d<10;d++)
		{
			c=c*c%1000000/100;
			printf("%d\n",c);
		}
	}
	return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H, W;
    cin >> H >> W;
    if(H == 1 || W == 1) {
        cout << 1 << endl;
        return 0;
    }
    cout << (H * W + 1) / 2 << endl;

    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define ll                   long long int
#define ld                   long double
#define scl(n)               scanf("%lld",&n)
#define scd(n)               scanf("%lf",&n)
#define eb                   emplace_back
#define pb                   push_back
#define pf                   push_front
#define ppf                  pop_front
#define ppb                  pop_back
#define pi                   acos(-1.0)
#define mod                  1000000007
#define eps                  0.0000000001
#define inf                  9000000000000000
#define en                   "\n"

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

    int n; cin>>n;
    double dam=ceil(n/1000.0);
    cout<<dam*1000-n<<en;

    return 0;
}


Measured memory_bytes: 3796
n,m = map(int,input().split())
roads = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    a,b = a-1,b-1
    roads[a].append(b)
    roads[b].append(a)
[print(len(r)) for r in roads]


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

using namespace std;

int main(){
	string o, e;
	int a=0, b=0;
	
	cin>>o;
	cin>>e;
	
	while(a<o.length() || b<e.length()){
		if(a<o.length()) cout<<o[a];
		if(b<e.length()) cout<<e[b];
		a++;b++;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
#include<math.h>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;

int main(){
  ll a,b;
  cin>>a>>b;
  if(b>=100) a=a*1000+b;
  else if(b>=10) a=a*100+b;
  else a=a*10+b;


  for(ll i=1;i<=1100;i++){
    if(i*i==a){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  
  cout<<"No"<<endl;

}


Measured memory_bytes: 256
import std.stdio, std.math, std.conv, std.array, std.string, std.algorithm;

void main() {
    string str;
    while((str = readln()).length != 0) {
        double v = to!double(str.chomp);
        double t = (v/9.8)^^2 * 4.9;
        int nt = to!int(floor(to!real(t)));
        int h = nt + (5 - nt%5);
        writeln((h+5)/5);
    }
}

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

const int INF = 1<<28;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (auto& i : a) cin >> i;

    vector<int> depth(n, INF);

    int count = 0;
    for (int i = n-1; i >= 0; i--) {
        if (depth[i] == INF) {
            count++;
            depth[i] = 0;
        } else if (depth[i] < k) {
            count++;
        } else if (a[i] == 0) {
            count++;
        }

        if (a[i] > 0) {
            depth[a[i]-1] = min(depth[a[i]-1], depth[i] + 1);
        }
    }

    cout << count << endl;

    return 0;
}

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

#define pb push_back
#define ll long long
#define pi pair<int,int>
#define pii pair<int,pi>
#define pl pair<ll,ll>
#define pll pair<ll,pl>
#define debug cout<<"debugging"<<endl
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int I_LIMIT = 999999999;
ll L_LIMIT = 19999999999999999;
ll mod = 1000000007;
ll factor[1000005];

void seive()
{
    for(ll i=1;i<1000005;i++)
        factor[i]=i;

    for(ll i=2;i<1000005;i++)
    {
        if(factor[i]==i)
        {
            for(ll j=i*i;j<1000005;j+=i)
            {
                if(factor[j]==j)
                    factor[j]=i;
            }
        }
    }
}

int nf(int n) 
{ 
    if (n == 1) 
        return 1; 
  
    ll ans = 1,dup = factor[n],c = 1;
    ll j = n / factor[n]; 
    while (j != 1) 
    {
        if (factor[j] == dup) 
            c += 1; 
        else 
        { 
            dup = factor[j]; 
            ans = ans*(c+1); 
            c = 1; 
        }
        j = j / factor[j]; 
    }
    ans = ans * (c + 1); 
  
    return ans; 
}

void solve()
{
    int n,i,ans=0,c;
    cin>>n;

    ans = 0;
    for(i=1;i<n;i++)
    {
        c = nf(n-i);
        ans += c;
    }

    cout<<ans<<"\n";
    return;
}
int main()
{
    IOS;
    seive();
    solve();
}


Measured memory_bytes: 11460
import java.util.Scanner;


public class Main
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		
		for(int i=0; i<n; i++)
		{
			int b=0, c=0;
			boolean result = true;
			
			for(int j=0; j<10; j++)
			{
				int a = scanner.nextInt();

				if(a > b)
				{
					b = a;
				}
				else if(a > c)
				{
					c = a;
				}
				else 
				{
					result = false;
				}
			}
			
			System.out.println(result ? "YES" : "NO");
		}
	}
}

Measured memory_bytes: 26240
import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, K = map(int, readline().split())
A = list(map(int, readline().split()))

ans = pow(10, 11)

for bit in range(1 << (N)):
    if bin(bit).count('1') < K:
        continue
    acc = 0
    pre = A[0] - 1
    for i, a in enumerate(A[:]):
        if bit & (1 << i):
            if pre < a:
                pre = a
            else:
                acc += pre + 1 - a
                pre = pre + 1
        else:
            if pre < a:
                pre = a

    ans = min(ans, acc)
print(int(ans))


Measured memory_bytes: 12508
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STLL(s) strtoll(s.c_str(), NULL, 10)
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;


int main() {
    
    int n;
    cin>>n;
    rep(i,n){
        int k;
        cin>>k;
        if(k%2==1){
            fin("first");
            return 0;
        }
    }
    fin("second");
}


Measured memory_bytes: 384
/*
#include<rabbit>;
using blueHulkStress;
using AceOfSpades;
*/
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = (1e-9);
typedef long long ll;
typedef unsigned long long ull;
#define flush fflush(stdout), cout.flush()
#define all(v) ((v).begin()),((v).end())
#define rall(v) ((v).rbegin()),((v).rend())
#define clr(v,line) memset(v,line,sizeof(v))
#define rep(i,n) for(int(i)=0;(i)<(int)(n);(i)++)
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define lcm(a,b) (a*(b/__gcd(a,b)))
#define P 1000000007
#define endl '\n'
const int dx[] = {1,-1,0,0,1,-1,1,-1};
const int dy[] = {0,0,1,-1,1,-1,-1,1};
const int dxhorse[] = {-2,-2,-1,-1,1,1,2,2};
const int dyhorse[] = {1,-1,2,-2,2,-2,1,-1};
/*void file() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
}*/

int main(int argc, char const *argv[])
{
	//file();
	
	string s,ans="";cin>>s;
	for(auto i:s)if(i!='B')ans+=i;
	else if(!ans.empty())ans.pop_back();
	cout<<ans;	
}

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

int main(){

	int N, M, K;
	cin >> N >> M;

	int food[30] = {};

	// 最初の人
	for (int i = 0; i < N; i++){
		cin >> K;
		for (int j = 0; j < K; j++){
			int foodN;
			cin >> foodN;
			food[foodN-1]++;
		}
	}
	int count = 0;
	for (int i = 0; i < M; i++){
		if (food[i]==N){
			count++;
		}
	}

	cout << count;

	
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    
    String text1 = sc.next();
    String text2 = sc.next();
    
    char[] c1 = new char[text1.length()];
    char[] c2 = new char[text2.length()];
    
    int count = 0;
    for (int i = 0; i < text1.length(); i++) {
      	c1[i] = text1.charAt(i);
      	c2[i] = text2.charAt(i);
      
      	if (c1[i] != c2[i]) {
          count++;
        }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 41964
//https://atcoder.jp/contests/abc150/tasks/abc150_c
#include <bits/stdc++.h>
#if LOCAL
#include "dump.hpp"
#else
#define dump(...)
#endif
using namespace std;
using ll=long long;
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
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;}
int main() {
    ll N; cin>>N;
    vector<ll> pn(N);
    vector<ll> qn(N);
    for(auto&& p:pn){
        cin>>p;
    }
    for(auto&& q:qn){
        cin>>q;
    }

    vector<ll> v(N);
    FOR(i,0,N){
        v[i]=i+1;
    }
    ll a=-1;
    ll b=-1;
    ll no=0;
	do {
        ++no;
        dump(v);
        if (a<0 && pn==v) a=no;
        if (b<0 && qn==v) b=no;
	} while(std::next_permutation(v.begin(), v.end()));

    cout<<abs(a-b)<<endl;

	return 0;
}

Measured memory_bytes: 256
//#define NDEBUG
#include <cstddef>
#include <cstdint>
#include <vector>

namespace n91 {

using i8 = std::int_least8_t;
using i32 = std::int_least32_t;
using i64 = std::int_least64_t;
using u8 = std::uint_least8_t;
using u32 = std::uint_least32_t;
using u64 = std::uint_least64_t;
using isize = std::ptrdiff_t;
using usize = std::size_t;

class rep {
  const usize f, l;

public:
  class itr {
    friend rep;
    usize i;
    constexpr itr(const usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { ++i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr rep(const usize first, const usize last) noexcept
      : f(first), l(last) {}
  constexpr itr begin() const noexcept { return itr(f); }
  constexpr itr end() const noexcept { return itr(l); }
};
class revrep {
  const usize f, l;

public:
  class itr {
    friend revrep;
    usize i;
    constexpr itr(usize x) noexcept : i(x) {}

  public:
    void operator++() noexcept { --i; }
    constexpr usize operator*() const noexcept { return i; }
    constexpr bool operator!=(const itr x) const noexcept { return i != x.i; }
  };
  constexpr revrep(usize first, usize last) noexcept : f(--first), l(--last) {}
  constexpr itr begin() const noexcept { return itr(l); }
  constexpr itr end() const noexcept { return itr(f); }
};
template <class T> using vec_alias = std::vector<T>;
template <class T> auto md_vec(const usize n, const T &value) {
  return std::vector<T>(n, value);
}
template <class... Args> auto md_vec(const usize n, Args... args) {
  return std::vector<decltype(md_vec(args...))>(n, md_vec(args...));
}
template <class T> constexpr T difference(const T &a, const T &b) {
  return a < b ? b - a : a - b;
}

} // namespace n91

#include <algorithm>
#include <array>
#include <iostream>
#include <utility>

namespace n91 {

void main_() {
  static constexpr usize n = 5;
  u32 ans = 0, red = 0;
  for (const auto i : rep(0, n)) {
    u32 a, b = 0;
    std::cin >> a;
    while ((a + b) % 10 != 0) {
      ++b;
    }
    red = std::max(red, b);
    ans += a + b;
  }
  std::cout << ans - red << std::endl;
}

} // namespace n91

int main() {
  n91::main_();
  return 0;
}


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

void dfs(vector<vector<int> > &ed, vector<vector<int> > &we, int par, long long dis, vector<int> &col,vector<bool> &vis){
    if( vis[par]) return;  vis[par]=1;
    col[par]=(dis+1)%2; int len=ed[par].size();

    int ch;
    for(int i=0; i<len; i++){
        ch=ed[par][i];
        dfs(ed,we,ch,dis+we[par][i],col,vis);
    }
    return;
}


int main(){
    int n; cin>>n;
    vector<vector<int> > ed(n+1); vector<vector<int> > we(n+1);

    int u,v,w;
    for(int i=1; i<n; i++){
        cin>>u>>v>>w;
        ed[u].push_back(v); we[u].push_back(w);
        ed[v].push_back(u); we[v].push_back(w);
    }

    vector<int> col(n+1); long long dis=0; vector<bool> vis(n+1);
    dfs(ed,we,1,dis,col,vis);
    for(int i=1; i<=n; i++){
        cout<<col[i]<<endl;
    }

}








Measured memory_bytes: 14848
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

ll gcd(ll a, ll b) {
    if(a < b){
        return gcd(b, a);
    }
    ll r;
    while ((r=a%b)) {
        a = b;
        b = r;
    }
    return b;
}

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

int main(){
    ll n;
    cin >> n;
    vector<ll> t(n);
    for(int i = 0; i < n; ++i){
        cin >> t.at(i);
    }
    ll ans = t.at(0);
    for(int i = 1; i < n; ++i){
        ans = lcm(ans, t.at(i));
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f
#define MEM(x, y) memset(x, y, sizeof(x))
#define Maxn 1000000000000 + 10
using namespace std;
string s;
ll len;
ll ans;
void solve(ll start, ll sum, ll flag) //搜索起始位置，上一次共有sum个连续的<或者>,上一次有没有出现<>
{
    ll i;
    ll f = 0;
    ll cnt = 1; //计数
    char r = s[start];
    for (i = start + 1; i < len; i++)
    {
        if (s[i] == r)
            cnt++;
        else
        {
            if (r == '<' && s[i] == '>') //存在<>,f=1
                f = 1;
            break;
        }
    }
    if (flag == 1)
    {
        if (cnt > sum)
        {
            if (cnt > 1)
            {
                ans += (cnt + 1) * cnt / 2;
                ans -= sum;
            }
            else
            {
                ans += 1;
                ans -= sum;
            }
        }
        else
        {
            if (cnt > 1)
            {
                ans += (cnt + 1) * cnt / 2;
                ans -= cnt;
            }
            else
            {
                ans += 1;
                ans -= cnt;
            }
        }
        if (i >= len)//遍历完成
            return;
        return solve(i, cnt, f);
    }
    else
    {
        if (cnt > 1)
            ans += (cnt + 1) * cnt / 2;
        else
        {
            ans += 1;
        }
        if (i >= len)//遍历完成
            return;
        return solve(i, cnt, f);
    }
}
int main()
{
    ans = 0;
    cin >> s;
    len = s.size();
    solve(0, 0, 0);
    cout << ans << endl;
}


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

double a, seq[10];

void solve() {
	seq[0] = a;

	double sum = a;
	for (int i = 1; i < 10; i++) {
		if (i % 2) {
			seq[i] = seq[i-1] * 2.0;
		} else {
			seq[i] = seq[i-1] / 3.0;
		}
		sum += seq[i];
	}

	//cout<<sum<<endl;
	printf("%.8f\n", sum);
}

int main(int argc, const char *argv[]) {
	while (cin>>a) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 0
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;
using TextReader = System.IO.TextReader;
using System.Text;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var N = consoleReader.Int;
            return 48 - N;
        }
        #region いつもの
#pragma warning disable
        private ConsoleReader consoleReader;
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program(new ConsoleReader(Console.In)).Calc()); static string AllLines<T>(IEnumerable<T> source) => string.Join("\n", source);
    }
    public class ConsoleReader
    {
        private string[] ReadLineSplit() => textReader.ReadLine().Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries);
        private string[] line = Array.Empty<string>();
        private int linePosition;
        private TextReader textReader;
        public ConsoleReader(TextReader tr) { textReader = tr; }
        public int Int => int.Parse(String);
        public long Long => long.Parse(String);
        public double Double => double.Parse(String);
        public string String
        {
            get
            {
                if (linePosition >= line.Length)
                {
                    linePosition = 0;
                    line = ReadLineSplit();
                }
                return line[linePosition++];
            }
        }
        public class SplitLine
        {
            private string[] splited;
            public SplitLine(ConsoleReader cr) { splited = cr.ReadLineSplit(); cr.line = Array.Empty<string>(); }
            public int[] Int => String.Select(x => int.Parse(x)).ToArray();
            public int[] Int0 => String.Select(x => int.Parse(x) - 1).ToArray();
            public long[] Long => String.Select(x => long.Parse(x)).ToArray();
            public double[] Double => String.Select(x => double.Parse(x)).ToArray();
            public string[] String => splited;
        }
        public SplitLine Split => new SplitLine(this);
        public class RepeatReader : IEnumerable<ConsoleReader>
        {
            ConsoleReader cr; int count;
            public RepeatReader(ConsoleReader cr, int count) { this.cr = cr; this.count = count; }
            public IEnumerator<ConsoleReader> GetEnumerator() => Enumerable.Repeat(cr, count).GetEnumerator();
            System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();

            public IEnumerable<string> String => this.Select(cr => cr.String);
            public IEnumerable<int> Int => this.Select(cr => cr.Int);
            public IEnumerable<int> Int0 => this.Select(cr => cr.Int - 1);
            public IEnumerable<long> Long => this.Select(cr => cr.Long);
            public IEnumerable<double> Double => this.Select(cr => cr.Double);
        }
        public RepeatReader Repeat(int count) => new RepeatReader(this, count);
    }
    #endregion
}

Measured memory_bytes: 11092
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	int i;
	i = abs(a-e);
	if (i <= k) {
		cout << "Yay!" << endl;
	}
	else {
		cout << ":(" << endl;
	}
	system("pause");
	return 0;
}

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

int main(void){
    int a,b;
    cin >> a >> b;
    if(a >=13){
        cout << b << endl;
    }else if(a >= 6 && 12 >= a){
        cout << b/2 << endl;
    }else{
        cout << 0 << endl;
    }
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
flag = 0
ans = 0
while flag == 0:
    for i in range(N):
        if A[i]%2 == 1:
            flag = 1
            break
        else:
            A[i] = A[i]/2
    if flag == 0:
        ans += 1
print(ans)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

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


void solve(long long N, long long A, long long B){
    cout << min(B, A*N) << "\n"; 
}

int main(){

    long long N;
    scanf("%lld",&N);
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    solve(N, A, B);
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
long long n, s, x, ans, a[200005];
int main() {
	int i, j;
	scanf("%lld", &n);
	for(i=0; i<n; i++) scanf("%lld", a+i);
	for(i=j=0; i<n; i++) {
		for(; j<n; j++) {
			if(s+a[j] != (x^a[j])) break;
			s += a[j];
			x ^= a[j];
		}
		ans += j-i;
		s -= a[i];
		x ^= a[i];
	}
	printf("%lld", ans);
	return 0;
}

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

typedef long long int64;

const int MAX_N = int(2e5) + 10;

int n, tot;
int64 cnt, k;
int nxt[MAX_N], pos[MAX_N], beg[MAX_N], len[MAX_N], ans[MAX_N], a[MAX_N];

int main() {
	std::cin >> n >> k;
	k = k * n;
	for (int i = 1; i <= n; ++i) {
		scanf("%d", a + i);
		if (!beg[a[i]]) {
			beg[a[i]] = i;
			pos[a[i]] = i;
		} else {
			nxt[pos[a[i]]] = i;
			pos[a[i]] = i;
		}
		nxt[i] = beg[a[i]];
	}

	for (int i = 1; i <= n; ++i) {
		len[i] = nxt[i] > i ? nxt[i] - i + 1 : n - (i - nxt[i] - 1);
	}

	{
		int x = 1;
		cnt = 0LL;
		for (;;) {
			cnt += len[x];
			x = nxt[x] + 1;
			if (x > n) x -= n;
			if (x == 1) break;
		}
	}
	k = k % cnt;

	if (!k) return 0;
	{
		int x = 1;
		cnt = 0;
		for (;;) {
			cnt += len[x];
			if (cnt >= k) {
				cnt -= len[x];
				for (int j = x; j <= x + k - cnt - 1; ++j) {
					int t = j > n ? j - n : j;
					ans[++tot] = a[t];
				}
				for (int i = 1; i <= tot; ++i) {
					pos[ans[i]] = beg[ans[i]] = nxt[i] = 0;
				}

				for (int i = 1; i <= tot; ++i) {
					if (!beg[ans[i]]) {
						beg[ans[i]] = i;
						pos[ans[i]] = i;
					} else {
						nxt[pos[ans[i]]] = i;
						pos[ans[i]] = i;
					}
					nxt[i] = beg[ans[i]];
				}
				int p = 1;
				while (p <= tot) {
					if (nxt[p] > p) {
						p = nxt[p] + 1;
					} else {
						printf("%d ", ans[p]);
						++p;
					}
				}
				return 0;
			}
			x = nxt[x] + 1;
			if (x > n) x -= n;
		}
	}
}

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

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

  int n, k;
  string s;
  cin >> n >> k >> s;
  rep(i, 0, n) {
    if (i == k - 1)
      cout << (char)(s[k - 1] + 32);
    else
      cout << s[i];
  }
  cout << endl;
}


Measured memory_bytes: 256
#include <string>
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#define rep(i,n) for(int i = 0; i < (n); i++)
using namespace std;
int main()
{
   int k;
   cin >> k;
   rep(i,k) cout << "ACL";
   cout << endl;
}

Measured memory_bytes: 3500