akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <atcoder/all>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pii pair<int,int>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define endl '\n'
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))

using namespace std;

using namespace atcoder;

using mint = modint998244353;

struct S{
    mint a;
    int size;
};

struct F{
    mint a,b;
};

S op(S l,S r){
    return S{l.a+r.a,l.size+r.size};
}
S e(){
    return S{0,0};
}
S mapping(F l,S r){
    return S{r.a*l.a+r.size*l.b,r.size};
}
F composition(F l,F r){
    return F{r.a*l.a,r.b*l.a+l.b};
}
F id(){
    return F{1,0};
}
int main(){
    int n,q;
    cin >> n >> q;
    vector<S> a(n);
    rep(i,n){
        int x;
        cin >> x;
        a[i]=S{x,1};
    }
    lazy_segtree<S,op,e,F,mapping,composition,id> seg(a);
    
    rep(i,q){
        int t;
        cin >> t;
        if(t==0){
            int l,r,c,d;
            cin >> l >> r >> c >> d;
            seg.apply(l,r,F{c,d});
            
        }
        if(t==1){
            int l,r;
            cin >> l >> r;
            cout << seg.prod(l,r).a.val() << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 19344
#include <iostream>
#include <stdio.h> 
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
	string s;
	cin>>s;
	int len=s.size();
	printf("%c%d%c\n",s[0],len-2,s[len-1]);
	return 0;
}

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


int main() {
  int N,M,K;
  cin>>N>>M>>K;
  bool flg=0;
  for(int i=0;i<=N;i++){
      for(int j=0;j<=M;j++){
        //cout<<M*i+N*j-i*j*2<<endl;
        if(M*i+N*j-i*j*2==K) flg=1;
      }
  }
  if(flg) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define inf 999999999
#define loop(i, a, b) for (int i = (a), i##len = (b); i < i##len; ++i)
#define rep(i, n) loop(i, 0, n)
#define lin long long
#define lfl long double
string s;
int main(void)
{
    cin >> s;

    int res1 = 0;
    int res2 = 0;
    rep(i, s.length())
    {
        if(s[i] != '0' + i % 2)
            res1++;

        if(s[i] != '0' + 1 - i % 2)
            res2++;
    }

    cout << min(res1,res2) << endl;

    return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>

template <int MOD>
struct ModInt {
    using lint = long long;
    int val;

    // constructor
    ModInt(lint v = 0) : val(v % MOD) {
        if (val < 0) val += MOD;
    };

    // unary operator
    ModInt operator+() const { return ModInt(val); }
    ModInt operator-() const { return ModInt(MOD - val); }
    ModInt inv() const { return this->pow(MOD - 2); }

    // arithmetic
    ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
    ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
    ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
    ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
    ModInt pow(lint n) const {
        auto x = ModInt(1);
        auto b = *this;
        while (n > 0) {
            if (n & 1) x *= b;
            n >>= 1;
            b *= b;
        }
        return x;
    }

    // compound assignment
    ModInt& operator+=(const ModInt& x) {
        if ((val += x.val) >= MOD) val -= MOD;
        return *this;
    }
    ModInt& operator-=(const ModInt& x) {
        if ((val -= x.val) < 0) val += MOD;
        return *this;
    }
    ModInt& operator*=(const ModInt& x) {
        val = lint(val) * x.val % MOD;
        return *this;
    }
    ModInt& operator/=(const ModInt& x) { return *this *= x.inv(); }

    // compare
    bool operator==(const ModInt& b) const { return val == b.val; }
    bool operator!=(const ModInt& b) const { return val != b.val; }

    // I/O
    friend std::istream& operator>>(std::istream& is, ModInt& x) noexcept { return is >> x.val; }
    friend std::ostream& operator<<(std::ostream& os, const ModInt& x) noexcept { return os << x.val; }
};

constexpr int MOD = 1e9 + 7;
using mint = ModInt<MOD>;

template <class T>
struct Combination {
    int max_n;
    std::vector<T> f, invf;

    explicit Combination(int n)
        : max_n(n), f(n + 1), invf(n + 1) {
        f[0] = 1;
        for (int i = 1; i <= n; ++i) {
            f[i] = f[i - 1] * i;
        }

        invf[max_n] = f[max_n].inv();
        for (int i = max_n - 1; i >= 0; --i) {
            invf[i] = invf[i + 1] * (i + 1);
        }
    }

    T fact(int n) const { return f[n]; }
    T invfact(int n) const { return invf[n]; }
    T perm(int a, int b) const {
        return a < b || b < 0 ? T(0) : f[a] * invf[a - b];
    }
    T comb(int a, int b) const {
        return a < b || b < 0 ? T(0) : f[a] * invf[a - b] * invf[b];
    }
};

const Combination<mint> C(1000000);

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

    std::vector<int> xs(n);
    for (auto& x : xs) std::cin >> x;
    std::sort(xs.begin(), xs.end());

    mint ans = 0;
    for (int i = 0; i < n; ++i) {
        ans += C.comb(i, k - 1) * xs[i];
    }

    std::reverse(xs.begin(), xs.end());
    for (int i = 0; i < n; ++i) {
        ans -= C.comb(i, k - 1) * xs[i];
    }

    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 8448
#include <bits/stdc++.h>
using namespace std;
int a[27],b[27];
int main()
{
    memset(a,0,sizeof(a));
    memset(b,0,sizeof(b));
    int n;
    string s;
    cin>>n>>s;
    for(int i=0;i<n;++i)
        b[s[i]-96]++;
    int maxv=0;
    for(int i=0;i<n-1;++i)
    {
        b[s[i]-96]--;
        a[s[i]-96]++;
        int f=0;
        for(int j=0;j<=26;j++)
            if(a[j]&&b[j])
                f++;
        maxv=max(maxv,f);
    }
    cout<<maxv;
    return 0;
}

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

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

const int INF = (int) 1e9;
const ll LINF = (ll) 4e18;
const ll MOD = (ll) (1e9 + 7);
const double PI = acos(-1.0);

#define REP(i,m,n) for(ll i = m; i < (ll)(n); ++i)
#define rep(i,n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbg2(x_) for(auto a_ : x_) cerr << a_ << " "; cerr << endl;
#define dbg3(x_ , sx_) rep(i, sx_) cerr << x_[i] << " "; cerr << endl;
vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

inline ll CEIL(ll a, ll b) {
    return (a + b - 1) / b;
}

void finish() {
    cout << -1 << endl;
    exit(0);
}

//------------------------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<ll> h(100200, LINF);
    rep(i, n) cin >> h[i];
    vector<ll> Min(100200, LINF);
    Min[0] = 0;

    rep(i, n) {
        for (int j = 1; j <= k; ++j) {
            Min[i + j] = min(Min[i + j], Min[i] + abs(h[i + j] - h[i]));
        }
    }

    cout << Min[n - 1] << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<long long, long long>
#define ff first
#define ss second

main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    string s, t; cin >> s >> t;
    int N = s.size(), M = t.size();
    if(N > M){swap(N, M), swap(s, t);}
    int DP[N+1][M+1];
    pii p[N+1][M+1];
    memset(DP, 0, sizeof(DP));
    memset(p, 0, sizeof(p));
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= M; j++){
            if(s[i-1] == t[j-1]){
                DP[i][j] = DP[i-1][j-1] + 1;
                p[i][j] = {i, j}; 
            }
            else{
                DP[i][j] = max(DP[i-1][j], DP[i][j-1]);
                if(DP[i-1][j] > DP[i][j-1]) p[i][j] = p[i-1][j];
                else p[i][j] = p[i][j-1];
            }
        }
    }
    pii pos = {N, M};
    string ans = "";
    while(true){
        while(p[pos.ff][pos.ss].ff != pos.ff || p[pos.ff][pos.ss].ss != pos.ss){
            pos = p[pos.ff][pos.ss];
        }
        if(!p[pos.ff][pos.ss].ff && !p[pos.ff][pos.ss].ss) break;
        ans += s[pos.ff-1];
        pos.ff--, pos.ss--;
    }
    reverse(ans.begin(), ans.end());
    cout << ans;
}

Measured memory_bytes: 179492
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < ll , ll >
#define F first
#define S second
#define int long long int
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define err(A) cout << #A << " = " << (A) << endl
using namespace std;

const int N=1e5+100,M=20;

ll a[N];
ll par[N][M];
int32_t main(){
    sync;
    ll n,l;
    cin >> n;
    for (int i=0;i<n;i++){
        cin >> a[i];
    }
    cin >> l;
    for (int i=0;i<n;i++){
        ll z=lower_bound(a,a+n,a[i]+l+1)-a-1;
        par[i][0]=z;
     //   cout << i << " " << par[i][0] << endl;
    }
    for (int i=1;i<M;i++){
        for (int j=0;j<n;j++){
            par[j][i]=par[par[j][i-1]][i-1];
         //   cout << j << " " << i << " " << par[j][i] << endl;
        }
    }
    ll q;
    cin >> q;
    for (int i=0;i<q;i++){
        ll u,v;
        cin >> u >> v;
        u--,v--;
        if (v<u){
            swap(u,v);
        }
        ll t=u;
        ll ans=0;
        for (int j=M-1;j>-1;j--){
            if (par[t][j]<v){
                ans+=(1<<j);
                t=par[t][j];
            }
        }
        cout << ans+1 << endl;
    }


}


Measured memory_bytes: 17280
#include <cstdio>
#include <cstring>
#include<iostream>

using namespace std;


char s[100001];
long int k = 0;
int n = 0;
int main(void) {
	

	

	cin >> s;
	cin >> k;


	int Len = strlen(s);

	for (int i = 0; i < Len; i++) {
		if (s[i] != 'a'&&i + 1 != Len) {
			//aにするのに必要な数
			n = ('z' - s[i]) + 1;
			if (k - n >= 0) {
				k -= n;
				s[i] = 'a';
			}
		}
	}	
	if (k != 0) {
	
		s[Len-1] = 'a'+((s[Len - 1]-'a')+k)%26;
	}
	cout << s;

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const ll mod = 1000000007;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;

vector<string> a(0);
vector<string> b(0);

ll f(ll x){
    if(x==1){
        a.push_back("a");
        return 0;
    }else{
        f(x-1);
        b = a;
        for(auto i:b){
            ll s=i.size();
            if(s!=x-1) continue;
            ll c = 0;
            for(int j=0;j<s;j++){
                ll d =  i.at(j) - 'a';
                c = max(c,d);
            }
            for(int j=0;j<=c+1;j++){
                char e = 'a' + j;
                a.push_back(i+e);
            }
        }         
    }
    return 0;
}

int main(){
    ll n ; cin >> n;
    f(n);
    sort(a.begin(),a.end());
    for(auto output : a){
        if(output.size()!=n) continue;
        cout << output << endl;
    }
}

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

using namespace std;

typedef long long ll;

const int mod = 998244353;

void add(ll &x, ll y) {
    x += y;
    if (x >= mod) {
        x -= mod;
    }
}

ll powmod(ll a, ll b, ll p = mod) {
    ll res = 1;
    while (b) {
        if (b & 1) {
            res = res * 1ll * a % p, --b;
        } else {
            a = a * 1ll * a % p, b >>= 1;
        }
    }
    return res;
}

ll rev(int a) {
    return powmod(a, mod - 2);
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    vector<ll> inv(1000001);
    inv[1] = 1;
    for (int i = 2; i <= 1000000; ++i) {
        for (int j = 2; j * j <= i; ++j) {
            if (i % j == 0) {
                inv[i] = (inv[j] * inv[i / j]) % mod;
                break;
            }
        }
        if (inv[i] == 0) {
            inv[i] = rev(i);
        }
    }
    vector<ll> w(1000001);
    w[1] = 1;
    for (int i = 2; i <= 1000000; ++i) {
        add(w[i], inv[i] - 1);
        for (int j = 2ll * i; j <= 1000000; j += i) {
            add(w[j], mod - w[i]);
        }
    }
    int n;
    cin >> n;
    vector<int> a(1000001);
    for (int i = 0; i < n; ++i) {
        int x;
        cin >> x;
        a[x]++;
    }
    ll ans = 0;
    for (int d = 1; d <= 1000000; ++d) {
        ll sum = 0, squares = 0;
        for (int k = 1; k <= 1000000 / d; ++k) {
            add(sum, (1ll * k * d * a[k * d]) % mod);
            add(squares, (1ll * k * k * d * d * a[k * d]) % mod);
        }
        add(ans, (w[d] * (mod + (sum * sum) % mod - squares)) % mod);
    }
    cout << (ans * inv[2]) % mod;
    return 0;
}

Measured memory_bytes: 19840
#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    switch (n % 10) {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
        cout << "hon" << endl;
        break;
    case 0:
    case 1:
    case 6:
    case 8:
        cout << "pon" << endl;
        break;

    default:
        cout << "bon" << endl;
        break;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>

using namespace std;

int main()
{
	int n, ans = 0;

	while (cin >> n) {
		for (int i = 0; i < 10; i++) {
			for (int j = 0; j < 10; j++) {
				for (int k = 0; k < 10; k++) {	 
					for (int l = 0; l < 10; l++) {
						if (i + j + k + l == n) {
							ans++;
						}
					}
				}
			}
		}
		cout << ans << endl;
		ans = 0;
	}
}

Measured memory_bytes: 3028
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
typedef pair<P, int> NP;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

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

	// count white
	int white = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (c[i][j] == '.') white++;
		}
	}

	// set start
	queue<NP> Q;
	Q.push(NP(P(0, 0), 0));

	// bfs
	int route = 0;
	bool is_goal = false;
	while (!Q.empty()) {
		int y = Q.front().first.first;
		int x = Q.front().first.second;
		int lv = Q.front().second;
		Q.pop();

		for (int i = 0; i < 4; i++) {
			int ny = y + dy[i];
			int nx = x + dx[i];
			if (ny < 0 || H <= ny || nx < 0 || W <= nx) continue;
			if (ny == H - 1 && nx == W - 1) {
				route = lv + 2;
				is_goal = true;
				break;
			}
			if (c[ny][nx] == '.') {
				Q.push(NP(P(ny, nx), lv + 1));
				c[ny][nx] = 'V';
			}
		}
		if (is_goal) break;
	}

	int res = white - route;
	if (!is_goal) res = -1;
	cout << res << endl;
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
        cin >> a[i];
    long long dp[n-1][21]={};
    dp[0][a[0]]=1;
    for(int i=1;i<n-1;i++){//dp[i][j+a[i]]
        for(int j=0;j<21;j++){
            if(j+a[i]<=20) dp[i][j+a[i]]+=dp[i-1][j];
            if(j-a[i]>=0) dp[i][j-a[i]]+=dp[i-1][j];
        }
    }
    cout << dp[n-2][a[n-1]] << endl;
    return 0;
}



Measured memory_bytes: 3112
import java.util.*;
class Main
{
  public static void main(String[] args)
  {
    Scanner a = new Scanner(System.in);
    String input = a.nextLine();
    String[] spt = input.split(" ");
    int num1 = Integer.parseInt(spt[0]);
    int num2 = Integer.parseInt(spt[1]);
    int num3 = Integer.parseInt(spt[2]);
    
    if(num1 < num2 && num2 < num3) 
    {
            System.out.println("Yes");
    }
    else 
    {
            System.out.println("No");
    }
  }
}


Measured memory_bytes: 26128
#include<iostream>

using namespace std;

int main(void)
{
  int a,b;  cin>>a>>b;
  int r1=a+b,r2=a-b,r3=a*b;
  
  if((r1>=r2)&&(r1>=r3)){cout<<r1<<endl;}
  else if((r2>=r1)&&(r2>=r3)){cout<<r2<<endl;}
  else if((r3>=r1)&&(r3>=r2)){cout<<r3<<endl;}
  
  return 0;
}


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


int main(){
    int n,q;
    long long k;
    cin >> n >> k >> q;
    unordered_map<int,int> points;
    int a;
    for(int i=0;i<q;i++){
        cin >> a;
        points[a]++;
    }
    for(int i=1;i<=n;i++){
        if(k-(q-points[i]) >= 1){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 4772
// 'By Anki'
 
#include<bits/stdc++.h>
// #include<iostream>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define wr(i) cout<<#i<<" = "<<i<<",  ";
#define wre(i) cout<<#i<<"  =  "<<i<<endl;
#define all(v) v.begin(),v.end()
typedef long long ll;
#define lim 1000000007LL
typedef unsigned long long ull;
#define M 100006LL
using u64= uint64_t;
// using i128= __int128;
// typedef unsigned int uint128_t __attribute__((mode(TI)));
 
ll gcd(ll a,ll b){
    return b?gcd(b,a%b):a;
}
 
ll fact(ll n)
{
    ll ans=1LL;
    while(n)
    ans*=(n--);
    return ans;
 
}
 
ll phi(ll n){
    ll res=n;
    for(int i=2;i*i<=n;i++){
        if(n%i==0){
            while(n%i==0)n/=i;
            res-=res/i;
        }
    }
    if(n>1)res-=res/n;
    return res;
}

ll a[100][100];
void sparse(vector<ll>v)
{
    ll n=v.size();
    ll k=log2(n)+1;
    for(int i=0;i<n;i++)a[i][0]=v[i];
    for(int j=1;j<=k;j++)
    {
        for(int i=0;i+(1<<j)<=n;i++)
        a[i][j]=a[i][j-1]+a[i+(1<<(j-1))][j-1];
    }
}
int main()
{
fast
ll t=1LL;

for(;t;t--){
    ll n,m;cin>>n>>m;cout<<n*m<<"\n";
} 
}

Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define fi first
#define se second
#define inf (INT_MAX/2-1)
#define infl (1LL<<60)
#define vi vector<int>
#define pb push_back
#define sz(a) (int)(a).size()
#define all(a) begin(a),end(a)
#define y0 y5656
#define y1 y7878
#define aaa system("pause");
#define dbg(x) cerr<<(#x)<<": "<<(x)<<'\n',aaa
#define dbga(x,n) cerr<<(#x)<<"[]: ";for(int _=0;_<n;_++)cerr<<x[_]<<' ';cerr<<'\n',aaa
#define dbgs(x) cerr<<(#x)<<"[stl]: ";for(int _:x)cerr<<_<<' ';cerr<<'\n',aaa
#define dbgp(x) cerr<<(#x)<<": "<<x.fi<<' '<<x.se<<'\n',aaa
#define maxn 100000

using namespace std;

struct yes { int r[2][2]; int R; };

ll mod;
vi g[maxn+5], fii[maxn+5], pref[maxn+5], suff[maxn+5];
int wh[maxn+5];///wh[nod]=indicele unde se gaseste nod in fii[tata[nod]]
int tata[maxn+5];
ll jos[maxn+5], sus[maxn+5];
///jos[nod]=in cate moduri poti face o pata care porneste din nod si merge in subarbore
///sus[nod]=in cate moduri poti face o pata care porneste din nod si merge in supraarbore

void mad (ll &a, ll b) { a = (a+b) % mod; }
void mul (ll &a, ll b) { a = (a*b) % mod; }

ll msu (vector<ll> u) {
  ll w = 0;
  for (ll x: u) mad(w, x);
  return w;
}

ll mpr (vector<ll> u) {
  ll w = 1;
  for (ll x: u) mul(w, x);
  return w;
}

void dfsi (int nod, int t) {
  tata[nod] = t;
  for (int nn: g[nod])
    if (nn != t) wh[nn] = sz(fii[nod]), fii[nod].pb(nn), dfsi(nn, nod);
}

void dfsj (int nod) {
  for (int nn: fii[nod]) dfsj(nn);
  jos[nod] = 1;
  for (int nn: fii[nod]) mul(jos[nod], msu({jos[nn], 1}));
}

void dfss (int nod) {
  if (nod == 1) sus[nod] = 1;
  else {
    ll cur = sus[tata[nod]];
    if (wh[nod] > 0) mul(cur, pref[tata[nod]][wh[nod]-1]);
    if (wh[nod] < sz(fii[tata[nod]])-1) mul(cur, suff[tata[nod]][wh[nod]+1]);
    sus[nod] = msu({cur, 1});
  }
  for (int nn: fii[nod]) dfss(nn);
}

int main () {
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int n; cin >> n >> mod;
  int i, j, z, a, b;
  for (i = 1; i < n; i++) {
    cin >> a >> b;
    g[a].pb(b); g[b].pb(a);
  }
  dfsi(1, 0);
  dfsj(1);
  for (i = 1; i <= n; i++)
    if (sz(fii[i]) > 0) {
      pref[i].resize(sz(fii[i]));
      pref[i][0] = msu({jos[fii[i][0]], 1});
      for (j = 1; j < sz(fii[i]); j++)
        pref[i][j] = mpr({pref[i][j-1], msu({jos[fii[i][j]], 1})});
      suff[i].resize(sz(fii[i]));
      suff[i][sz(fii[i])-1] = msu({jos[fii[i][sz(fii[i])-1]], 1});
      for (j = sz(fii[i])-2; j >= 0; j--)
        suff[i][j] = mpr({suff[i][j+1], msu({jos[fii[i][j]], 1})});
    }
  dfss(1);
  for (i = 1; i <= n; i++) cout << mpr({sus[i], jos[i]}) << '\n';
  return 0;
}


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

#define ll          long long
#define pb          push_back
#define all(a)      (a).begin(),(a).end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=b;i>=a;i--)    
#define cls(a) a.clear()
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rs(a,n) a.resize(n)  
#define time        cerr << "Time elapsed: " << (double)1000 * clock() / CLOCKS_PER_SEC << "ms\n";
#define sf(a) scanf("%d",&a)
#define vi vector<int>
#define pf(b) printf("%d\n",b)

using namespace std;

void test_case()
{  
  int a,b;
  cin>>a>>b;
  cout<<a*b<<"\n";
    }

int main()
{
	fast;
	
	
	test_case();
	
	return 0;
	}


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

#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define for1(i, n) for (int i = 1; i <= (int)n; ++i)
#define fore(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

using namespace std;

typedef long long i64;
typedef vector<int> vi;
typedef vector<i64> vi64;
typedef vector<vi> vvi;
typedef vector<vi64> vvi64;
typedef double ld;

i64 dp[101][8];

int main() {
    
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int H, W, K;
    cin >> H >> W >> K;

    int n = (1 << (W - 1));
    int h = 0;

    vector<vector<int>> vv;

    forn(i, n) {

        vector<int> v(W - 1);
        forn(w, W - 1) {
            if ( ( i >> w ) & 1 ) {
                v[w] = 1;
            } else {
                v[w] = 0;
            }
        }

        bool isok = true;

        forn(j, v.size() - 1) {
            if (v[j] > 0 and v[j + 1] > 0) {
                isok = false;
                break;
            }
        }

        if (isok) vv.emplace_back(v);
    }

//        for (auto v : vv) {
//            forn(w, W - 1) {
//                cout << v[W - w - 2] ;
//            } cout << endl;
//        }

    dp[0][0] = 1;

    for1(h, H) {

//        cout << "h = " << h - 1 << endl;
//        forn(w, W) cout << dp[h - 1][w] << " "; cout << endl;

        for (auto v : vv) {

            forn(w, W) {
    
                if (w < W - 1 and v[w] > 0) {
                    dp[h][w + 1] += dp[h - 1][w];
                    dp[h][w + 1] %= MOD;
                } else if (w > 0 and w < W and v[w - 1] > 0) {
                    dp[h][w - 1] += dp[h - 1][w];
                    dp[h][w - 1] %= MOD;
                } else {
                    dp[h][w] += dp[h - 1][w];
                    dp[h][w] %= MOD;
                }
            
            }
        }
    }

//        cout << "H = " << H << endl;
//        forn(w, W) cout << dp[H][w] << " "; cout << endl;

    cout << dp[H][K - 1] << endl;
    return 0;
}


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

using namespace std;

typedef long long lli;
typedef double lld;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<double> vdl;
typedef vector<vector<lli>> mat;
typedef vector<vdl> mad;
typedef unordered_map<lli,unordered_map<lli,lli>> graph;
typedef complex<double> cmp;
typedef vector<cmp> vcl;

lli n;
vll e,o,a;
lli mem = 0;
lli s,t;
vll ans;
bool check(){
  for(lli i = 1;i <= n;i++){
    if(a[i] > 0) return true;
  }
  return false;
}

int main(){
  cin >> n;
  o.push_back(0);
  e.push_back(0);
  a = vll(n+1);
  for(lli i = 1;i <= n;i++){
    cin >> a[i];
    if(i%2) o.push_back(a[i] > 0 ? a[i] : 0);
    else e.push_back(a[i] > 0 ? a[i] : 0);
  }
  if(check() == false){
    lli m = max_element(a.begin()+1,a.end())-a.begin();
    for(lli i = n;i > m;i--) ans.push_back(i);
    for(lli i = 1;i < m;i++) ans.push_back(1);
    cout << a[m] << endl;
    cout << ans.size() << endl;
    for(lli x : ans) cout << x << endl;
    return 0;
  }
  for(lli i = 1;i < o.size();i++){
    o[i] += o[i-1];
  }
  for(lli i = 1;i < e.size();i++){
    e[i] += e[i-1];
  }
  for(lli i = 0;i < o.size();i++){
    for(lli j = i+1;j < o.size();j++){
      if(mem < o[j]-o[i]){
        mem = o[j]-o[i];
        s = 2*(i+1)-1;
        t = 2*j-1;
      }
    }
  }
  for(lli i = 0;i < e.size();i++){
    for(lli j = i+1;j < e.size();j++){
      if(mem < e[j]-e[i]){
        mem = e[j]-e[i];
        s = 2*(i+1);
        t = 2*j;
      }
    }
  }
  lli r = 1;
  lli l = n;
  lli i = 1;
  lli j = n;
  while(i < s){
    ans.push_back(r);
    i++;
    l--;
  }
  while(a[i] <= 0){
    ans.push_back(r);
    ans.push_back(r);
    i++,i++;
    l--,l--;
  }
  while(j > t){
    ans.push_back(l);
    j--;
    l--;
  }
  while(a[j] <= 0){
    ans.push_back(l);
    ans.push_back(l);
    j--,j--;
    l--,l--;
  }
  s = i;
  for(lli k = 0;i < j;i+=2,k+=2){
    if(a[i] <= 0) ans.push_back(r+k),k-=2,l-=2;
  }
  while(l > 1){
    ans.push_back(2);
    l-=2;
  }
  cout << mem << endl;
  cout << ans.size() << endl;
  for(lli x : ans) cout << x << endl;
  return 0;


}


Measured memory_bytes: 256
#include <cstdio>

long long N, K;
int A[200004];
int Visited[200004] = { 0 };
int Stack[200004] = { 0 };
int ju = 0;
int main() {
	scanf("%lld %lld", &N, &K);
	for (int i = 1; i <= N; i++) {
		scanf("%d", &A[i]);
	}
	int now = 1;
	for (int i = 1; ; i++) {
		now = A[now];
		Stack[i] = now;
		if (Visited[now]) {
			ju = i - Visited[now];
			break;
		}
		Visited[now] = i;
		if (i == K) {
			printf("%d", now);
			return 0;
		}
	}
	printf("%d", Stack[(K - Visited[now]) % ju + Visited[now]]);
}

Measured memory_bytes: 5408
h, w = map(int, input().split())
s = []
for _ in range(h):
    s.append(input())

dxdy = [(0,-1), (-1,0), (0,1), (1,0)]
for y, row in enumerate(s):
    for x, e in enumerate(row):
        if e=='.':
            continue
        for dx, dy in dxdy:
            if not (0<=x+dx<w and 0<=y+dy<h):
                continue
            if s[y+dy][x+dx]=='#':
                break
        else:
            print('No')
            break
    else:
        continue
    break
else:
    print('Yes')

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, m;
  cin >> n >> m;
  
  int ac = 0, wa = 0;
  vector<int> p(m), check(n + 1, 0), check2(n + 1, 0);
  vector<string> s(m);
  for(int i = 0; i < m; i++){
    cin >> p.at(i) >> s.at(i);
    if(check.at(p.at(i)) == 0){
      if(s.at(i) == "AC"){
        ac++;
        check.at(p.at(i))++;
        wa += check2.at(p.at(i));
      }
      else{
        check2.at(p.at(i))++;
      }
    }
  }
  
  cout << ac << " " << wa << '\n';
}

Measured memory_bytes: 6912
package main

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

var to [][][]int
var color []int

func main() {
	var n int
	fmt.Scan(&n)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	to = make([][][]int, n)
	for i := 0; i < n-1; i++ {
		sc.Scan()
		a, _ := strconv.Atoi(sc.Text())
		sc.Scan()
		b, _ := strconv.Atoi(sc.Text())
		a--
		b--
		to[a] = append(to[a], []int{b, i})
		to[b] = append(to[b], []int{a, i})
	}
	color = make([]int, n-1)
	dfs(0, -1, 0)
	m := 0
	for i := range color {
		m = max(m, color[i])
	}
	fmt.Println(m)
	for i := range color {
		fmt.Println(color[i])
	}
}

func dfs(k, p, pc int) {
	nc := 1
	for _, v := range to[k] {
		nk, en := v[0], v[1]
		if nk == p {
			continue
		}
		if nc == pc {
			nc++
		}
		color[en] = nc
		dfs(nk, k, nc)
		nc++
	}
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 25216
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define MOD 1000000007
#define MOD2 998244353
#define int long long
//#define PI 3.14159265358979

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

using namespace std;

template < typename T >
ostream &operator<<(ostream &os, const vector< T > &A) {
	for (int i = 0; i < A.size(); i++)
		os << A[i] << " ";
	os << endl;
	return os;
}
template <>
ostream &operator<<(ostream &os, const vector< vector< int > > &A) {
	int N = A.size();
	int M;
	if (N > 0)
		M = A[0].size();
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < M; j++)
			os << A[i][j] << " ";
		os << endl;
	}
	return os;
}

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

struct edge {
	int from, to, d, c;
	edge(int _from = 0, int _to = 0, int _d = 0, int _c = 0) {
		from = _from;
		to = _to;
		d = _d;
		c = _c;
	}
	bool operator<(const edge &rhs) const {
		return (d == rhs.d) ? (c < rhs.c) : (d < rhs.d);
	}
};
struct aabb {
	int x1, y1, x2, y2;
	aabb(int x1, int y1, int x2, int y2) : x1(x1), y1(y1), x2(x2), y2(y2) {}
};

typedef vector< edge > edges;
typedef vector< edges > graph;
struct flow {
	int to, cap, rev, cost;
	flow(int to = 0, int cap = 0, int rev = 0, int cost = 0) : to(to), cap(cap), rev(rev), cost(cost) {}
};
typedef vector< vector< flow > > flows;

const int di[4] = {0, -1, 0, 1};
const int dj[4] = {-1, 0, 1, 0};
const int ci[5] = {0, 0, -1, 0, 1};
const int cj[5] = {0, -1, 0, 1, 0};
const ll LINF = LLONG_MAX / 2;
const int INF = INT_MAX / 2;
const double PI = acos(-1);

int pow2(int n) { return 1 << n; }
template < typename T, typename U >
bool chmin(T &x, const U &y) {
	if (x > y) {
		x = y;
		return true;
	}
	return false;
}
template < typename T, typename U >
bool chmax(T &x, const U &y) {
	if (x < y) {
		x = y;
		return true;
	}
	return false;
}

struct initializer {
	initializer() {
		cout << fixed << setprecision(20);
	}
};
initializer _____;

int N, M, K, T, Q, H, W;
int dfs(vector< vector< int > > &G, int x, int p) {
	int ret = 0;
	rep(i, G[x].size()) {
		int j = G[x][i];
		if (j == p)
			continue;
		ret ^= (dfs(G, j, x) + 1);
	}
	return ret;
}
signed main() {
	cin >> N;
	vector< vector< int > > G(N);
	rep(i, N - 1) {
		int x, y;
		cin >> x >> y;
		--x;
		--y;
		G[x].push_back(y);
		G[y].push_back(x);
	}
	string ans;
	if (!dfs(G, 0, -1)) {
		ans = "Bob";
	} else {
		ans = "Alice";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 11904
/*  Don’t Quit
    
    When things go wrong as they sometimes will;
        When the road you’re trudging seems all uphill;
            When the funds are low, and the debts are high;
                And you want to smile, but you have to sigh;
                    When care is pressing you down a bit
                        Rest if you must, but don’t you quit.
*/
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=3e5+10;

int gcd(int n,int m)
{
    if(n==0)
        return m;
    else
        return gcd(m%n,n);
}
int a[N];
int32_t main()
{
   int n;
   cin>>n;
   for(int i=1;i<=n;i++)
   {
        cin>>a[i];

   }
   int sum=0;
   int ans=0;
   for(int i=1;i<=n;i++)
   {
        sum+=a[i];
        if(i%2==1)
        {
            if(sum<0)
            {
                
            }
            else
            {
                ans+=sum+1;
                sum=-1;

            }
        }
        else
        {
            if(sum>0)
            {

            }
                
            else
            {
                ans+=abs(sum)+1;
                sum=1;
                
            }
        }
        //cout<<sum<<" "<<ans<<endl;
   }
   int ans1=ans;
   ans=0;
   sum=0;
   for(int i=1;i<=n;i++)
   {
        sum+=a[i];
        if(i%2==1)
        {
            if(sum>0)
                continue;
            else
            {
                ans+=abs(sum)+1;
                sum=1;
                
            }
        }
        else
        {
            if(sum<0)
            {
                continue;
            }
            else
            {
                ans+=sum+1;
                sum=-1;

            }
        }
   }
   cout<<min(ans,ans1)<<endl;



}

Measured memory_bytes: 1024
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

void dfs(ll now, ll p, const vector<vector<pll>>& g, vl& path_bit) {
  for (auto&& i : g[now]) {
    if (i.first != p) {
      path_bit[i.first] |= path_bit[now] | (1LL << i.second);
      dfs(i.first, now, g, path_bit);
    }
  }
}

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

  ll n, m;
  cin >> n;
  vl a(n-1), b(n-1);
  vector<vector<pll>> g(n);

  rep(i, n-1) {
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
    g[a[i]].emplace_back(b[i], i);
    g[b[i]].emplace_back(a[i], i);
  }

  cin >> m;
  vl u(m), v(m);
  rep(i, m) {
    cin >> u[i] >> v[i];
    u[i]--;
    v[i]--;
  }

  vl path_bit(n, 0);
  dfs(0, 0, g, path_bit);
  rep(i, n) {
    //cerr << bitset<10>(path_bit[i]) << endl;
  }

  ll ans = 0;
  rep(bit, 1LL<<m) {
    ll edge_bit = 0;
    rep(i, m) {
      if (bit >> i & 1) {
        edge_bit |= (path_bit[u[i]] xor path_bit[v[i]]);
      }
    }
    ll cnt = __builtin_popcountll(bit);
    ans += (cnt%2 ? -1 : 1) * (1LL << (n-1-__builtin_popcountll(edge_bit)));
    //cerr << ans << endl;
  }
    assert(ans >= 0);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include"iomanip"
#include"iostream"
#include"limits"
#include"cmath"
#include"vector"
#include"algorithm"
#include"list"
#include"queue"
#include"stack"
#include"set"
#include"unordered_set"
#include"map"
#include"unordered_map"
#include"string"
#include"cstring"
#include"assert.h"
using namespace std;
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define mp make_pair
#define pb push_back
#define mset(a,b) memset(a,b,sizeof(a))
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
int main()
{
    ll k,a,b;
    scanf("%lld%lld%lld",&k,&a,&b);
    if(a>=k)
    {
        puts("1");
        return 0;
    }
    if(b>=a)
    {
        puts("-1\n");
        return 0;
    }
    cout<<1+2*((k-a+a-b-1)/(a-b))<<'\n';
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

string reverse(string input, int length);

int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
	double l;
	cin >> l;
	double edge = l/3;
	double vol = pow(edge, 3);
	cout << fixed << setprecision(12) << vol;
}

Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
#include<stack>
#include <cmath>
#include<bits/stdc++.h>
#include<math.h>
#include<iomanip>
#define cinf(n,x) for(int i=0;i<n;i++) cin >> x[i];
#define pi pair<int,int> 
using namespace std;
using ll = long long;

int main(){
    int n; cin >> n;
    int a[n];
    for(int i=1;i<=n;i++){
        cin >> a[i];
    }
    int b[n]; int M=0;
    for(int i=n;i>0;i--){
        if(i>n/2) b[i] = a[i];
        else{
            int c=0;
            for(int j=2;j*i<=n;j++){
               c += b[j*i];
            }
            if(c % 2 == a[i]) b[i] = 0;
            else b[i] = 1;
        }
        M += b[i];
    }
    cout << M << endl;
    for(int i=1;i<=n;i++){
        if(b[i] == 1) cout << i << " ";
    }
    return 0;
}



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

const ll LINF = 1e18;
const int INF = 1e9;
const ll MOD = 1000000007;

int main(){

    int x, y;
    cin >> x >> y;

    bool ok = false;
    for(int i = 0; i <= 100; i++){
        for(int j = 0; j <= 100; j++){
            if(x == i + j){
                if(y == i*2 + j*4) ok = true;
            }
        }
    }
    if(ok) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3668
fun main(args: Array<String>) {
    val (k, a, b) = readLine()!!.split(' ').map(String::toLong)
    if ((b - a).toDouble() / 2 > 1.0) {
        var num = 1L
        var i = 1L
        while (i <= k) {
            if (i == k) {
                num++
            } else {
                if (num < a) {
                    num++
                } else {
                    num = num - a + b
                    i++
                }
            }
            i++
        }
        println(num)
    } else {
        println(k + 1)
    }
}


Measured memory_bytes: 38000
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Tree t = new Tree(n);

        for(int i = 0; i < n; i++) {
        	int id = sc.nextInt();
        	int k = sc.nextInt();
        	int pc = -1;
        	for(int j = 0; j < k; j++) {
        		int c = sc.nextInt();
        		if(j == 0)
        			t.node[id].left = c;
        		else
        			t.node[pc].right = c;
        		t.node[c].parent = id;
        		pc = c;
        	}
        }

        for(int i = 0; i < n; i++)
        	t.print(i);

        sc.close();
        System.exit(0);
	}
}
class Tree {
	class Node {
		int parent = -1;
		int left = -1;
		int right = -1;

		public int getDepth() {
			if(parent == -1)
				return 0;
			else
				return node[parent].getDepth() + 1;
		}

		public String getType() {
			if (parent == -1)
                return "root";
            else if (left == -1)
                return "leaf";
            else
                return "internal node";
		}
	}
	Node[] node;

	public Tree(int n) {
		node = new Node[n];
		for(int i = 0; i < n; i++)
			node[i] = new Node();
	}

	public void print(int i) {
		System.out.print("node " + i + ": parent = " + node[i].parent
				+ ", depth = " + node[i].getDepth() + ", " + node[i].getType() + ", [" );
		if(node[i].left != -1) {
			System.out.print(node[i].left);
            for (int c = node[node[i].left].right; c != -1; c = node[c].right)
                System.out.print(", " + c);
		}
		System.out.println("]");
	}
}



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

long long searchRGB(vector<int> const & R, vector<int> const & G, vector<int> const & B)
{
	long long cnt = 0;
	for (int r : R)
	{
		//cout << r << endl;
		for (int g : G)
		{
			for (int b : B)
			{
				//if (r >= g) swap(r, g);
				//if (g >= b) swap(g, b);
				//if (r >= g) swap(r, g);

				int rt, gt, bt;
				rt = min(min(r,g),b);
				bt = max(max(r,g),b);
				if (rt < r && r < bt) gt = r;
				else if (rt < g && g < bt) gt = g;
				else if (rt < b && b < bt) gt = b;


				//if ( !( rt < gt  && gt < bt) ) cout << "error" << endl;

				//int rg = abs(gt - rt);
				//int gb = abs(bt - gt);
				if (gt - rt == bt -gt)
				{
					continue;
				}
					
				
				cnt++;
			}
		}
	}

	return cnt;
}

int main()
{
	int n;
	cin >> n;
	vector<char> s(n);
	vector<int> R, G, B;
	//char c;
	//scanf("%c", &c);
	for (int i=0; i<n; i++)
	{
		char c;
		cin >> c;
		//scanf("%c", &c);
		s.at(i) = c;
		if (c == 'R') R.push_back(i);
		else if (c == 'G') G.push_back(i);
		else B.push_back(i);
	}

	long long rgb = R.size() * G.size() * B.size();

	long long ex = 0;
	for (int i=0; i<n; i++)
	{
		for (int k=1; k<n; k++)
		{
			if (i + 2*k >= n) break;
			if ( s.at(i) != s.at(i+k) && s.at(i+k) != s.at(i+ 2*k) && s.at(i) != s.at(i+2*k) ) ex++;	
		}
	}
	//cout << rgb << " " << ex << endl;
	cout << rgb - ex << endl;




}

Measured memory_bytes: 3648
n,k=map(int,input().split())
p=list(map(int,input().split()))
for i in range(n):p[i]=(p[i]+1)/2
s=sum(p[:k])
m=s
for i in range(k,n):
  s+=p[i]-p[i-k]
  m=max(m,s)
print(m)

Measured memory_bytes: 25060
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
typedef long long ll;
const ll MOD=1000000007;
using namespace std;
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }

int main(void){
    // Your code here!
    int n; cin >> n; 
    map<string,int> mp;
    rep(i,n) {
        string s; cin >> s;
        mp[s]++;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
}


Measured memory_bytes: 3636
#include<iostream>
#include<string>
using namespace std;
int main()
{
  int n,i=0;
  string s,t,res="NO";
  cin >> s;
  n=s.size();
  while(true){
    if(i==n){
      res="YES";
      break;
    }
    if(i>n-5) break;
    t=s.substr(i,5);
    if(t!="dream"&&t!="erase") break;
    if(t=="dream"){
      if(i<=n-7&&s.substr(i+5,2)=="er"&&
         (i==n-7||i<=n-8&&s[i+7]!='a'))
        i+=7;
      else
        i+=5;
      continue;
    }
    if(i<=n-6&&s[i+5]=='r'){
      i+=6;
    }else{
      i+=5;
    }
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 512
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))}
const main=()=>{
  let [n,m]=tnn(2)
  let citys=new Array(n)
  citys.fill(0)
  for(let i=0;i<m;i++){
    citys[tn()-1]++
    citys[tn()-1]++
  }
  for(let i=0;i<n;i++){
    to(citys[i])
  }
}
main()

Measured memory_bytes: 7372
#include <cstdio>
#include <algorithm>
#include <cstdlib>

using namespace std;

const int N = 9;

int a[N];
int b[N];
int p[N];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
    --a[i];
  }
  for (int i = 0; i < n; ++i) {
    scanf("%d", b + i);
    --b[i];
  }
  for (int i = 0; i < n; ++i) {
    p[i] = i;
  }
  int ka = -1, kb = -1;
  int cnt = 0;
  do {
    {
      bool ok = true;
      for (int i = 0; i < n; ++i) {
        if (a[i] != p[i]) {
          ok = false;
        }
      }
      if (ok) {
        ka = cnt;
      }
    }
    {
      bool ok = true;
      for (int i = 0; i < n; ++i) {
        if (b[i] != p[i]) {
          ok = false;
        }
      }
      if (ok) {
        kb = cnt;
      }
    }
    ++cnt;
  } while (next_permutation(p, p + n));
  printf("%d\n", abs(ka - kb));
}


Measured memory_bytes: 256
//Tuvshee
 
#include<iomanip>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cctype>
#include<vector>
#include<queue>
using namespace std;
#define I int
#define D double
#define F float
#define C char
#define S string
#define B bool
#define L long long
#define rep(n) for(int i=0;i<n;i++)
#define reps(m,n,c) for(int c=m;c<n;c++)
#define repd(m,n,j) for(int j=n;j>m;j--)
#define whL while
#define eL endl
#define oR ||
#define anD &&
#define rtn return
#define pause system("PAUSE")
#define Max 300
#define max(m,n) ((n<m)?m:n)
#define min(m,n) ((n>m)?m:n)
 
int main()
{
	I m,n;
	cin>>m>>n;
	cout<<m/n<<' '<<m%n<<' '<<setprecision(5)<<fixed<<double(m)/n<<eL;
	rtn 0;
}

Measured memory_bytes: 1240
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n, tc; readV(n, tc);
  int[] t; readA(n, t);

  auto ans = 0;
  foreach (i; 0..n-1)
    ans += t[i+1]-t[i] > tc ? tc : t[i+1]-t[i];
  ans += tc;

  writeln(ans);
}


Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define MAX 128
#define fst first
#define sec second
#define pb push_back
#define mp make_pair
#define ALL(x) (x).begin(), (x).end()
#define bit(n) (1LL << (n))
#define int long long
const double PI = 3.141593;
const int MOD = (int)1e9 + 7;
const int INF = 100100100;
const double EPS = 1e-9;
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;}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } //最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); }     //最小公倍数
ll combination(ll n, ll r){if (r * 2 > n)r = n - r;ll dividend = 1;ll divisor = 1;for (ll i = 1; i <= r; ++i){dividend *= (n - i + 1);divisor *= i;}return dividend / divisor;}

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

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

    double l;
    cin >> l;
    printf("%.16f", (l / 3)*(l / 3)*(l / 3));

    return 0;
}

Measured memory_bytes: 256