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

using namespace std;

int main(void) {
  int n, m, x;
  cin >> n >> m >> x;
  
  vector<int> price(n);
  int ans = 999999999;
  vector<vector<int>> plus(n, vector<int>(m));
  vector<int> skill(m);
  int temp;
  bool flag;
  
  for (int i = 0;i < n;i++) {
    cin >> price[i];
    for (int j = 0;j < m;j++) {
      cin >> plus[i][j];
    }
  }
  
  for (int bit = 0; bit < (1<<n); bit++) {
    vector<int> S;
    for (int i = 0; i < n; ++i) {
      if (bit & (1<<i)) { // 列挙に i が含まれるか
        S.push_back(i);
      }
    }

    int temp_price = 0;
    for (int i = 0;i < m;i++) {
      skill[i] = 0;
    }
    for (int i = 0; i < (int)S.size(); ++i) {
      temp_price += price[S[i]];
      for (int j = 0;j < m;j++) {
        skill[j] += plus[S[i]][j];
      }
    }
    flag = true;
    for (int j = 0;j < m;j++) {
      if (skill[j] < x) flag = false;
    }
    if (flag) {
      if (ans > temp_price) ans = temp_price;
    }
  }

  if (ans >= 999999999) ans = -1;
  
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3532
#include <bits/stdc++.h>
#define _ << ' ' <<
#define _squ(x)  ((x) * (x))
#define debug(var)  do{std::cout << #var << " : "; view(var);}while(0)
#define line_debug(var)  do{std::cout << "l" << __LINE__ << " " << #var << " : "; view(var);}while(0)
#define _max(v)  *max_element(v.begin(), v.end())
#define _min(v)  *min_element(v.begin(), v.end())
#define _sort(var)  std::sort(var.begin(), var.end());
#define _rsort(var)  std::sort(var.begin(), var.end(), std::greater<>());
using namespace std;
using ll = long long;
int gcd(int m, int n){return !n ? m : gcd(n, m%n);}
template<typename T> using V = std::vector<T>;
template<typename T> using VV = std::vector<std::vector<T>>;
template<typename T> using VVV = std::vector<std::vector<std::vector<T>>>;
template<typename T> void view(const T e){ std::cout << e << std::endl;}
template<typename T> void view(const std::vector<T>& v){ for(const auto& e : v) std::cout << e << " "; std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T>>& vv){ for(const auto& v : vv){ view(v); } }

int main(){
//  int i, j;
  int a1, a2, a3;
  cin >> a1 >> a2 >> a3;
  cout << (a1+a2+a3>=22? "bust" : "win") << endl;
//  V<int> v(N);
//  for(i=0; i<v.size(); i++) cin >> v[i];

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
 
#define pii pair<int, int>
#define F first
#define S second
#define pb push_back
 
const int N = 2e5 + 5;
const int mod = 1e9+7;
const ll INF = (ll)1e18;

struct seg_tree{
    vector<ll> seg;
    int n;

    seg_tree(int x) : n(x){
        seg.resize(4*n+5, 0);
    }

    void update(int ind, ll val, int l = 0, int r = -1, int i = 0){
        if(r == -1) r += n;
        if(l == r) return void(seg[i] = max(seg[i], val));
        int m = (l+r) >> 1;
        if(m >= ind) update(ind, val, l, m, i*2+1);
        else update(ind, val, m+1, r, i*2+2);
        seg[i] = max(seg[i*2+1], seg[i*2+2]);
    }

    ll query(int x, int y, int l = 0, int r = -1, int i = 0){
        if(r == -1) r += n;
        if(r < x || l > y) return 0;
        if(l >= x && r <= y) return seg[i];
        int m = (l+r) >> 1;
        return max(query(x, y, l, m, i*2+1), query(x, y, m+1, r, i*2+2));
    }
};

int main(){
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
 
    int n;
    cin >> n;
    vector<int> h(n);
    for(int j = 0; j < n; j++) cin >> h[j];
    vector<int> a(n);
    for(int j = 0; j < n; j++) cin >> a[j];

    seg_tree seg(N);
    for(int j = 0; j < n; j++){
        // take it 
        ll mx = seg.query(0, h[j]-1) + a[j];
        seg.update(h[j], mx);
        // don't take it
    }
    cout << seg.query(0, N-1);
    return 0;
}


Measured memory_bytes: 8064
#include<iostream>
#include<algorithm>
#include<vector>
#define lamba ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define all(x) x.begin(), x.end()
using namespace std;

const int zyan = 1e2 + 1;

int n, a[105], mn = zyan, mx = -zyan;

int fast() {
cin >> n;

for(int i=1;i<=n;i++){
cin >> a[i];
mn = min(mn, a[i]);
mx = max(mx, a[i]);
}
/*
int checker = 0;

for(int i=2;i<=n;i++){
	if(a[i] == a[1])checker++;
}


if(checker == n-1){
cout << 0;
return 0;
}*/

int mid = (mn + mx) % 2 + (mn + mx) >> 1;

int res = 0;

for(int i=1;i<=n;i++){
	if(mid == a[i])continue;
	else res += (a[i] * a[i]) - (a[i] * mid) - (mid * a[i]) + (mid * mid);
}

cout << res;

}

int f(int x){
	long long cur = 0;
	for(int i=1;i<=n;i++){
		cur += (a[i] - x) * 1ll * (a[i] - x);
	}
	return cur;
}

int main(){
lamba;

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

	int ans = 1e9;
/*
	for (int j = -200; j <= 200; ++j) {
		long long cur = 0;
		for (int i = 1; i <= n; ++i) {
			cur += (a[i] - j) * 1ll * (a[i] - j);
		}
		cout << j << ' ' << cur << '\n';
	}
*/
	double l = -2000, r = 2000, EPS = -1e9;
	while(r - l > 4){
		double m1 = l + (r - l) / 3;
		double m2 = r - (r - l) / 3;
	
		if(f (m1) > f (m2))
			l = m1;
		else
			r = m2;	
	}	

	for (int i = l; i <= r; ++i) {
		ans = min(ans, f(i));
	}

	cout << ans;

return 0;
}


Measured memory_bytes: 256
a,b,c,d,e=map(int, input().split())

if a == 0:
    print('1')
elif b == 0:
    print('2')
elif c == 0:
    print('3')
elif d == 0:
    print('4')
elif e == 0:
    print('5')
else :
    print('none')


Measured memory_bytes: 9056
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define x first
#define y second
#define mod 1e9+7
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rof(i,a,b) for(ll i=a;i>b;i--)

ll lcm(ll a, ll b){
    return a / __gcd(a, b) * b;
}
//memset can initialize to 0 or -1 ONLY
// memset(a,0,sizeof(a[0][0])*n*n); //2D array
//memset(a, 0, sizeof(a));  //1D array
//memset(str, 't', sizeof(str)); // string
void solve()
{
   int n,m;cin>>n>>m;
   cout<< ((n*(n-1))/2)+((m*(m-1))/2)<<endl;
    
}


int main()
{

ios_base::sync_with_stdio(false);
    cin.tie(NULL);

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

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
 
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("-ffloat-store")
 
#define int  long long
#define rep(i,begin,end) for(__typeof(end)i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define F first
#define S second
#define sz(x) ((int)x.size())
#define pb push_back
#define pf push_front
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define what_is(x) cerr << #x << " is " << x <<"\n";
#define sortA(v) sort(v.begin(), v.end())
#define sortD(v) sort(v.rbegin(), v.rend())
#define PI 3.14159265358979323846
#define vout(a) for(auto x:a) cout<<x<<" ";
#define INF 10000000000000000 //1e16
 
// #define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
 
 
// using namespace __gnu_pbds;
using namespace std;
 
using ll  = long long;
using vi  = vector<int>;
using pii = pair<int,int>;
using vii = vector<pii>;
using mi  = multiset<int>;
using mii = multiset<pii>;
 
int lcm(int a,int b) {return (a*(b/__gcd(a,b)));}



const int p=(int)1e9+7;

int modp(int a,int m,int n)
{
    n=n%(m-1);
    a=a%m;
    int res=1;
    while(n>0)
    {
        if(n&1) res=(res*a)%m;
        a=(a*a)%m;
        n>>=1;
    }
    return res;
}

int modInverse(int n, int p) 
{ 
    return modp(n, p, p-2); 
}

int nCrModP(int n, int r,int p) 
{ 
    if (r==0) return 1; 
    int fac[n+1]; 
    fac[0] = 1; 
    for (int i=1 ; i<=min(n,200001ll); i++) fac[i] = fac[i-1]*i%p; 
  
    return (fac[n]*modInverse(fac[r],p)%p*modInverse(fac[n-r],p)%p)%p; 
} 

void solve()
{
    int n,m,t,i,k,r,l,u,v,w,j,s,sum=0,pos,flag=0,count=0;
    string S,T,U; 
    int a,b;
    cin>>n>>a>>b;
    int ans=modp(2,mod,n);
    int A,B;
    A=1;
    a=min(a,n-a);
    rep(i,0,a)
    {
        // A=((A%mod)+(((n-i)%mod+mod)%mod*modInverse(i+1,mod)))%mod;
        int x=((n-i)%mod+mod)%mod;
        int y=modInverse(i+1,mod);
        int xy=((x%mod)*(y%mod))%mod;
        A=(A%mod)*xy%mod;
        A%=mod;
        // cout<<x<<" "<<y<<" "<<xy<<"\n";
    }
    B=1;
    b=min(b,n-b);
    rep(i,0,b)
    {
        // B=((B%mod)+(((n-i)%mod+mod)%mod*modInverse(i+1,mod)))%mod;
        int x=((n-i)%mod+mod)%mod;
        int y=modInverse(i+1,mod);
        int xy=((x%mod)*(y%mod))%mod;
        B=(B%mod)*xy%mod;
        B%=mod;
        // cout<<x<<" "<<y<<"\n";
    }
    // A=nCrModP(n,a,p);
    // B=nCrModP(n,b,p);
    // cout<<A<<" "<<B<<"\n";
    // cout<<ans-A-B-1<<"\n";
    ans=(ans%mod-A%mod+mod)%mod;
    ans=(ans%mod-B%mod+mod)%mod;
    ans=(ans%mod-1+mod)%mod;
    // ans=(ans%mod-A%mod-B%mod-1+mod+mod)%mod;
    cout<<ans;
}

 

signed main()
{

    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
        if(t)cout<<"\n";
    }
    return 0;
}

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


void solve(long long X){
    long long joy = 0;

    joy += (X / 500) * 1000;
    joy += ( (X % 500) / 5 ) * 5;

    cout << joy << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long X;
    scanf("%lld",&X);
    solve(X);
    return 0;
}


Measured memory_bytes: 256
s = int(input())
m = 1
if s == 1:
    print(4)
elif s == 2:
    print(4)
else:
    while 1:
        if s == 1:
            break
        if s % 2 == 0:
            s = s // 2
            m += 1
        else:
            s = 3*s+1
            m += 1
    m += 1
    print(m)

Measured memory_bytes: 38256
#include <stdio.h>
#include <stdlib.h>

const int x=2e9;
const int amb=-2e9;
const int inf=2e9;
int a[1010], xs[1010];

#define max(a, b) ((a)>(b)?(a):(b))
#define min(a, b) ((a)<(b)?(a):(b))

int main(void)
{
    int n;
    while (scanf("%d", &n), n) {
        char s[16];
        int i, lb=-inf, ub=inf, none=0, amb=0;
        for(i=0;i<n;++i) {
            scanf("%s", s);
            a[i]=(*s=='x')?x:atoi(s);
            if(i>0) {
                if (a[i-1]==x && a[i]==x) none=1;
                else if (a[i-1]!=x && a[i]!=x) {
                    if (i%2==1 && a[i-1]>=a[i]) none=1;
                    if (i%2==0 && a[i-1]<=a[i]) none=1;
                }
                else if (a[i-1]!=x) {
                    if (i%2==1) lb=max(lb, a[i-1]+1);
                    if (i%2==0) ub=min(ub, a[i-1]-1);
                }
                else {
                    if (i%2==1) ub=min(ub, a[i]-1);
                    if (i%2==0) lb=max(lb, a[i]+1);
                }
            }
        }
        if (none || lb>ub) { puts("none"); continue; }
        if (lb!=ub) { puts("ambiguous"); continue; }
        printf("%d\n", lb);
    }
    return 0;
}

Measured memory_bytes: 620
#include<bits/stdc++.h>
using namespace std;
int cmp(int a,int b)
{
	return a>b; 
}
int sum=0;
int f[4];
int main()
{
	cin>>f[1]>>f[2]>>f[3];
	sort(f+1,f+4,cmp);
	if((f[1]+f[2]+f[3])%2==0)
	{
		int b=0;
		if(f[1]%2==1)
			f[1]++,f[2]++,sum++;
		for(int i=2;i<=3;i++)
		{
			int s=f[1]-f[i];
			if(s%2==1 && b==0)
				sum++,b++;
			sum+=s/2;
		}
	}
	else
	{
		int b=0;
		if(f[1]%2==0)
			f[1]++,f[2]++,sum++;
		for(int i=2;i<=3;i++)
		{
			int s=f[1]-f[i];
			if(s%2==1 && b==0)
				sum++,b++;
			sum+=s/2;
		}
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 3640
#include<stdio.h>
#include<iostream>
using namespace std;

int N;
int a[100100];
int main (){
    cin >> N;
    for(int i=0; i<N; i++){
        int x;
        cin >> x;
        a[x]++;
    }
    int ans = 0;
    for(int i=1; i<100010; i++){
        ans = max( ans, a[i-1] + a[i] + a[i+1]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf = 1e18;

vector<mp> knapsack_table(vector<mp> &a){ // [s,t)
    int n = a.size();
    vector<mp> res( (1<<n) , mp(inf,inf)  );
    res[0] =  mp(0,0) ;
    for(int i=0;i< (1<<n) ; i++){
	for(int j=0;j<n;j++){
		if( (i>>j) & 1 ) continue;
		res[i|(1<<j)] =  min(res[ i | (1<<j) ] , mp(res[i].first +a[j].first , res[i].second + a[j].second  ) ) ;
	}
    }
    return res;
}

int main(){
    ll n,w;
    cin>>n>>w;
    vector<mp> a(n),b,c;//(w,v)
    for(int i=0;i<n;i++) cin>>a[i].second>>a[i].first;
    for(int i=0; i < n/2;i++) b.push_back( a[i] );
    for(int i=n/2;i < n;i++) c.push_back(a[i] );
    vector<mp> resb = knapsack_table(b);
    vector<mp> resc = knapsack_table(c);
    sort(resb.begin(),resb.end());
    sort(resc.begin(),resc.end());
    ll ans = 0;
    for(int i=1;i < resc.size();i++) resc[i].second = max( resc[i].second , resc[i-1].second ); // V maxの値に変える
    for(int i=0; i < resb.size() ;i++){
	ll W = resb[i].first;
	if( W > w ) break;
	ll V = resb[i].second;
	auto it = upper_bound(resc.begin(),resc.end(), mp(w-W, inf )  );
	int t = it-resc.begin();
	if(t==0) continue;
	if( W + resc[t-1].first > w) continue;
	ans = max( ans , V + resc[t-1].second ) ;
    }
    cout<<ans<<endl;

    return 0;
}



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

int main()
{
	int A, B;
	int max;
	cin >> A >> B;
	int a1, a2, a3;
	
	a1 = A + B;
	a2 = A - B;
	a3 = A * B;
	
	if (a1 > a2) {
		if (a1 > a3) {
			max = a1;
		}
		else {
			max = a3;
		}
	}
	else if (a2 > a3) {
		max = a2;
		
	}
	else {
		max = a3;
	}

	cout << max;
	
	

}

Measured memory_bytes: 256
D,G=map(int,input().strip().split())
pc=[]
for _ in range(D):
    pc.append(list(map(int,input().strip().split())))

N=0
for i in range(D):
    N+=pc[i][0]

MIN_SUM=N
for n in range(2**D):
    score=0
    SUM=0
    for i in range(D):
        if (n>>i)&1==1:
            SUM+=pc[i][0]
            score+=100*(i+1)*pc[i][0]+pc[i][1]
    if score>=G:
        pass
    else:
        for j in reversed(range(D)):
            if (n>>j)&1==0:
                cnt=0
                while cnt<=pc[j][0]-2 and score<G:
                    score+=100*(j+1)
                    SUM+=1
                    cnt+=1
    if score>=G and SUM<=MIN_SUM:
        MIN_SUM=SUM

print(MIN_SUM)

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

typedef unsigned long long int ull;
typedef long double ldb;
typedef long long int ll;

#define MOD1        1000000007
#define MOD2        998244353
#define PI          3.1415926535897932384626433832795
#define FILL(a, value) memset(a, value, sizeof(a))
#define BOOST       ios_base::sync_with_stdio(false); cin.tie(NULL)
#define what_is(x)  cerr << #x << " is " << x << endl;
#define ASSERT(left,operator,right) { if(!((left) operator (right))){ std::cerr << "ASSERT FAILED: " << #left << #operator << #right << " @ " << __FILE__ << " (" << __LINE__ << "). " << #left << "=" << (left) << "; " << #right << "=" << (right) << std::endl; } }

#define rep01(k,n)      for (ll i=k; i<n; i++)
#define rep02(k,n)      for (ll j=k; j<n; j++)
#define rep03(k,n)      for (ll k=k; k<n; k++)
#define rep11(k,n)      for (ll i=k; i<=n; i++)
#define rep12(k,n)      for (ll j=k; j<=n; j++)
#define rep13(k,n)      for (ll k=k; k<=n; k++)
#define repIT(c,it)     for(typeof(c.begin()) it = c.begin(); it != c.end(); ++it)
#define all(c)      c.begin(), c.end()

using namespace std;

const double pi = acos(-1.0);
const double epsilon = 1e-9;        // Add epsilon when casting double to int to avoid rounding pitfall issues, eg, 0.94*8178 in int
const int maxn = 1e6+10;


void solve()
{
    ll n;
    cin >> n;

    ll ans = 1;
    ll maxct = 0;

    for(int i = 1; i <= n; i++)
    {
        int ct = 0;
        ll temp = i;
        while(temp % 2 == 0)
        {
            temp /= 2;
            ct++;
        }

        if(ct > maxct)
        {
            maxct = ct;
            ans = i;
        }
    }
    cout << ans;
    
}

int main()
{
    
    int t = 1;
    //cin >> t;
    while(t--)
        solve();

    cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
    return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
#define cool ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
int main()
{ 
    cool;
    long long int n,sum=0;
    cin>>n;
    n-=1;
    sum=((n*(n+1))/2);
    cout<<sum;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

#define MOD 1000000007

ll dp[101][256][101];

int main() {
    int n, k;
    cin >> n >> k;
    VI a(n);
    REP(i,n) cin >> a[i];

    dp[0][0][0] = 1;
    REP(i,n){
        REP(j,256){
            REP(k,n){
                dp[i+1][j^a[i]][k+1] = (dp[i+1][j^a[i]][k+1] + dp[i][j][k]) % MOD;
                dp[i+1][j][k] = (dp[i+1][j][k] + dp[i][j][k]) % MOD;
            }
        }
    }

    ll ans = 0;

    ll f = 1;
    FOR(p,1,n){
        f = (f * p) % MOD;
        ll r = (f * dp[n][k][p]) % MOD;
        ans = (ans + r) % MOD;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 20480
#include <cstdio>
#include <algorithm>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

using ll = long long;
constexpr ll mod = 1000000007;

ll N, M;
ll S[2010], T[2010];
ll dp[2010][2010], sum[2010][2010];

int main()
{
  scanf( "%lld%lld", &N, &M );
  rep( i, N )
    scanf( "%lld", S+i );
  rep( i, M )
    scanf( "%lld", T+i );

  rep( i, N ) rep( j, M )
  {
    if( S[i] == T[j] )
      dp[i+1][j+1] = (sum[i][j]+1)%mod;

    sum[i+1][j+1] = (((sum[i+1][j]+sum[i][j+1])%mod-sum[i][j]+mod)%mod+dp[i+1][j+1])%mod;
  }

  printf( "%lld\n", (sum[N][M]+1)%mod );

  return 0;
}

Measured memory_bytes: 62976
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> v,vmin,vmax;
    rep(i,n){
        int a;
        cin >> a;
        v.push_back(a);
    }
    vector<int> org(n,0);
    vector<int> s = v;




    if(k < 100){
    rep(j,k){
        v= s;
        s =org;
        vmin.clear();
        vmax.clear();
        rep(i,n){
            vmin.push_back(i-v[i]);
            vmax.push_back(i+v[i]);
        }

        vmin.push_back(1000000);
        vmax.push_back(1000000);
        sort(vmin.begin(),vmin.end());
        sort(vmax.begin(),vmax.end());
        // if(vmin[n-1]<0 &&vmax[n-1]>n-1 ){
        //     rep(i,n){
        //         s[i] += (n-1)* (k-j);
        //     }
        //     break;
        // }
        int value =0 ;
        int i = 0,mini = 0,maxi= 0;
        //i = max(0,vmin[0]);
        //s = org;
        while(i < n){
            if(i >= vmin[mini]){
                value++;
                mini++;
            }else if(i > vmax[maxi]){
                value --;
                maxi++;
            }else{
                s[i]=value;
                i++;
            }
            //cout << i  <<" " <<   value<< " " << mini << " " <<maxi << endl;
        }
    }
    }
    else{
        rep(i,n){
            s[i] = n;
        }
    }
    
    rep(i,n){
        cout << s[i] << " ";
    }
    cout << endl;
}


Measured memory_bytes: 7488
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdlib>
#include<queue>
#include<set>
#include<cstdio>

using namespace std;

#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define P pair<int, int>

typedef vector<int> vec;
typedef vector<vec> mat;

int main(){
    int x[5];
    int ans;
    rep(i, 5){
        cin >> x[i];
        if(x[i] == 0){
            ans = i + 1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3616
// Solution to https://atcoder.jp/contests/dp/tasks/dp_v
#include <algorithm>
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

int N, MOD;
vector<vector<int>> adj;

// down[node] = number of ways to paint node's subtree where node must be painted black.
// up[node] = number of ways to color the subtree of node that its parent is responsible for, empty coloring included.
vector<int> down;
vector<int> up;

void solve_down(int node, int parent) {
    vector<int> &children = adj[node];

    // Erase the edge from node to parent.
    auto parent_it = find(children.begin(), children.end(), parent);

    if (parent_it != children.end())
        children.erase(parent_it);

    down[node] = 1;

    for (int child : children) {
        assert(child != parent);
        solve_down(child, node);
        down[node] = (int64_t) down[node] * (down[child] + 1) % MOD;
    }
}

void solve_up(int node, int parent) {
    vector<int> &children = adj[node];
    int n = children.size();
    vector<int> prefix(n + 1, 1), suffix(n + 1, 1);

    for (int i = 0; i < n; i++)
        prefix[i + 1] = (int64_t) prefix[i] * (down[children[i]] + 1) % MOD;

    for (int i = n - 1; i >= 0; i--)
        suffix[i] = (int64_t) suffix[i + 1] * (down[children[i]] + 1) % MOD;

    for (int i = 0; i < n; i++)
        up[children[i]] = (1 + (int64_t) prefix[i] * suffix[i + 1] % MOD * up[node]) % MOD;

    for (int child : children) {
        assert(child != parent);
        solve_up(child, node);
    }
}

int main() {
    ios::sync_with_stdio(false);
#ifndef NEAL_DEBUG
    cin.tie(nullptr);
#endif

    cin >> N >> MOD;
    adj.assign(N, {});

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

    down.resize(N);
    solve_down(0, -1);

    up.resize(N);
    up[0] = 1;
    solve_up(0, -1);

    for (int i = 0; i < N; i++)
        cout << (int64_t) up[i] * down[i] % MOD << '\n';
}


Measured memory_bytes: 18688
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Atcoder
{
    class aaaa
    {
        static void Main(string[] args)
        {
            string N  = Console.ReadLine();

            string ans ="No";
            for (int i =0;i<N.Length-2;i++){
                    string target= N.Substring(i,3);
                    if(target[0] == target[1] && target[1] == target[2] ){
                        ans = "Yes";
                    }
            }
            
            Console.WriteLine(ans);
            
        }
    }
}

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

#define int long long
#define itn int
#define For(i, a, b) for (int i = (a); i <= static_cast<int>(b); i++)
#define Forr(i, a, b) for (int i = (a); i >= static_cast<int>(b); i--)
#define rep(i, n) For(i, 0, n - 1)
#define repall(i, arr) for (auto& i : (arr))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define dump(x) cerr << #x << " = " << (x) << '\n'
#define dump2(x, y) \
    cerr << #x << " = " << (x) << " " << #y << " = " << (y) << '\n'
#define SZ(x) ((int)(x).size())
#define bit(n) (1LL << (n))
constexpr int MOD = 1e9 + 7;

template <typename T>
using pq = priority_queue<T>;
template <typename T>
using pqr = priority_queue<T, vector<T>, greater<T>>;
const int INF = LLONG_MAX / 2;
using P = pair<int, int>;
using vec = vector<int>;
template <typename T>
using mat = vector<vector<T>>;

// clang-format off
template <typename T1, typename T2>
ostream& operator<<(ostream& stream, const pair<T1, T2>& p) { return stream << p.first << "," << p.second; }
template <typename T>
void print(const vector<T> vec) { rep (i, vec.size() - 1) cout << vec[i] << ' '; cout << vec[vec.size() - 1] << '\n'; }
template <typename Arg>
void print(const Arg arg) { cout << arg << '\n'; }
template <typename Head, typename... Args>
void print(const Head head, const Args... args) { cout << head << " "; print(args...); }
template <typename T, typename U>
void init(vector<T>& v, vector<U>& w) { rep (i, v.size()) cin >> v[i] >> w[i]; }
template <typename T>
void init(vector<T>& v) { rep (i, v.size()) cin >> v[i]; }
template <typename T>
T sum_(vector<T> vec, T init = 0) { return std::accumulate(all(vec), T(init)); }
template<typename T>
bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T>
bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <typename T>
int index(const T& vec, const typename T::iterator it) { return distance(vec.begin(), it); }
template <typename T = int>
mat<T> mmat(int n, int m=0) { return mat<T>(n, vector<T>(m)); }
template <typename T = int>
vector<T> ivec(int n) { vector<T> v(n); init(v); return v; }
// clang-format on

void yn(bool tf) { print(tf ? "Yes" : "No"); }
void YN(bool tf) { print(tf ? "YES" : "NO"); }

int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
// -------------------------------------------------------------------
// sort 1 2 3 4
// pqr 1 2 3 must impl >

signed main() {
    cin.tie(0), cout.tie(0), ios::sync_with_stdio(false);
    vec a = ivec(9);
    vector<bool> ok(9);
    int n;
    cin >> n;
    int b;
    rep (i, n) {
        cin >> b;
        rep (j, 9)
            if (a[j] == b) ok[j] = true;
    }

    if ((ok[0] and ok[1] and ok[2]) or (ok[3] and ok[4] and ok[5]) or
        (ok[6] and ok[7] and ok[8]) or (ok[0] and ok[3] and ok[6]) or
        (ok[1] and ok[4] and ok[7]) or (ok[2] and ok[5] and ok[8]) or
        (ok[0] and ok[4] and ok[8]) or (ok[2] and ok[4] and ok[6]))
        print("Yes");
    else
        print("No");

    return 0;
}


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

int main(){
	char ch;
	for( int i = 0; i < 3; i++ ){
		for( int j = 0; j < 3; j++ ){
			cin >> ch;
			if( i == j ) cout << ch;
		}
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int b,i,cnt=0,leap=0;
	char a[10]={};
	int c[200]={};
	while(gets(a)){
		for(i=0;i<4;i++){
			b=a[i];
			c[b]++;
			if(c[b]){
				cnt++;
				if(c[b]==2){
					leap++;
				}
			}
		}if(cnt==4&&leap==2){
			printf("Yes\n");
		}else{
			printf("No\n");
		}cnt=0;leap=0;
	} 
} 

Measured memory_bytes: 128
kn=input().split()
k=int(kn[0])
n=int(kn[1])
disfn=[int(i) for i in input().split()]
dismax=disfn[0]+k-disfn[-1]
for i in range(n-1):
	if dismax<disfn[i+1]-disfn[i]:
		dismax=disfn[i+1]-disfn[i]
print(k-dismax)

Measured memory_bytes: 24908
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define pb(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return(1);
    ll sol=power(a,b/2,m);
    sol=(sol*sol)%m;
    if(b%2==1)
        sol=(sol*a)%m;
    return(sol);
}
ll gcd(ll a,ll b)
{
	if(a%b==0)
		return b;
	else
		return gcd(b,a%b);
}
int a[3];
void solve()
{
    ll sol=1;
    int k;
    cin>>a[0]>>a[1]>>a[2]>>k;
    sort(a,a+3);
    for(int i=0;i<k;i++)
    {
        sol=sol*2;
    }
    sol=sol*a[2]+a[1]+a[0];
    cout<<sol;
}
int main()
{
    int t=1;
    //cin>>t;
    while(t--)
    {
        solve();
    }
	return 0;
}


Measured memory_bytes: 256
def mf(num,mod):
  ret=1
  for i in range(1,num+1):
    ret=(ret*i)%mod
  return ret

def rev(num,pow,mod):
  ret=1
  while pow>0:
    if pow&1!=0:
      ret=(ret*num)%mod
    pow=pow>>1
    num=(num*num)%mod
  return ret

h,w,a,b=map(int,input().split())
mod=10**9+7
ans=[]
s=0
tb=rev(mf(b,mod),mod-2,mod)
tf=mf(b-1,mod)
trev=[rev(mf(h-a-1,mod),mod-2,mod)]
for i in range(h-a-1,0,-1):
  trev.append((trev[h-a-1-i]*i)%mod)
trev=trev[::-1]
for i in range(h-a):
  tf=(tf*(b+i))%mod
  ans.append((tf*tb*trev[i])%mod)
  ans[i]=(ans[i]-s)%mod
  s+=ans[i]
tb=rev(mf(w-b-1,mod),mod-2,mod)
tf=mf(w+a-b-2,mod)
trev=[rev(mf(h-1,mod),mod-2,mod)]
for i in range(h-1,0,-1):
  trev.append((trev[h-1-i]*i)%mod)
for i in range(h-a-1,-1,-1):
  tf=(tf*(w-b-1+h-i-1))%mod
  ans[i]=(ans[i]*(tf*tb*trev[i])%mod)
ret=0
for i in range(h-a):
  ret+=ans[i]
  ret=ret%mod
print(ret)

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

int main() {
  
  int n;
  cin >> n;
  long long mod = 1000000007;
  
  //ans は 一桁 ＝ 10個 0,9なしはともに9のn乗  両方なしは8のn乗 全ては10のn乗
  long long ans1 = 1;
  long long ans2 = 1;
  long long ans3 = 1;
  for(int i =  0; i < n; i++){
    ans1 = ans1 * 10 % mod;
    ans2 = ans2 * 9 % mod;
    ans3 = ans3 * 8 % mod;
  }
  
  long long x = ans1 - ans2 - ans2 + ans3;
  x %= mod;
  x = (x + mod)%mod;
  cout << x << endl;

}



Measured memory_bytes: 3580
#include <cstdlib>
#include <cstring>
#include <array>
#include <iostream>
#include <string>


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

  std::array<std::string, 3> strArray;
  std::cin >> strArray[0] >> strArray[1] >> strArray[2];
  for (const auto& s : strArray) {
    std::cout << static_cast<char>(std::toupper(s[0]));
  }
  std::cout << std::flush;

  return EXIT_SUCCESS;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1000000007, INF = 1e9;

int main()
{
    set<int> s;
    rep(i, 4){
        int a;
        cin >> a;
        s.insert(a);
    }
    if(s.count(1) && s.count(4) && s.count(7) && s.count(9)){
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
#define LL long long
#define DB double
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MIN(x,y) ((x)<(y)?(x):(y))
#define MAX(x,y) ((x)<(y)?(y):(x))
#define FOR(i,a,n) for(i=a;i<n;i++)
#define rep(i,n) FOR(i,0,n)
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000001
#define NUM 200010

void swap(LL* a,LL* b){LL tmp=*a;*a=*b;*b=tmp;}
void YN(int a){if(a==1)printf("Yes\n");if(a==0)printf("No\n");}
LL lpow(LL a,LL n){LL ans=pow(a,n)*10;if(ans%10<5)return ans/10;return ans/10+1;}
LL dup(LL a,LL d){if(a%d==0)return a/d;else return a/d+1;}
LL GCD(LL a,LL b){LL c=1,tmp=MAX(a,b);b=MIN(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int lcmpr(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return -1;if(*(LL*)a<*(LL*)b)return 1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int ccmpr(const void* a,const void* b){return *(char*)b-*(char*)a;}
int scmp(const void* a,const void* b){return strcmp((char*)a,(char*)b);}
int scmpr(const void* a,const void* b){return strcmp((char*)b,(char*)a);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(&m,&d);x-=k*y;swap(&x,&y);}return mod(a*mod(x,MOD),MOD);}
LL FAC(LL a){LL i,ans=1;FOR(i,1,a+1){ans*=i;if(MOD>0&&ans>MOD)ans%=MOD;}return ans;}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}

LL par[NUM];
void UF(){for(LL i=0;i<NUM;i++)par[i]=-1;}
LL Root(LL x){if(par[x]<0)return x;else return par[x]=Root(par[x]);}
LL Size(LL x){return -par[Root(x)];}
bool Same(LL x,LL y){return Root(x)==Root(y);}
void Unite(LL x,LL y){x=Root(x);y=Root(y);if(x!=y){if(Size(x)<Size(y))swap(&x,&y);par[x]+=par[y];par[y]=x;}}

int main(){
  LL N,M,K,i,ans=0;
  scanf("%lld%lld%lld",&N,&M,&K);
  LL A[M],B[M],C[K],D[K],a[N+1];
  FOR(i,1,N+1)a[i]=0;
  FOR(i,0,M)scanf("%lld%lld",&A[i],&B[i]);
  FOR(i,0,K)scanf("%lld%lld",&C[i],&D[i]);
  UF();
  FOR(i,0,M){
    Unite(A[i],B[i]);
    a[A[i]]--,a[B[i]]--;
  }
  FOR(i,0,K){
    if(Same(C[i],D[i])){
      a[C[i]]--,a[D[i]]--;
    }
  }
  FOR(i,1,N+1){
    printf("%lld ",a[i]+Size(i)-1);
  }

  //printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 6784
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N = I()
CSF = [tuple(MI()) for i_ in range(N-1)]

for i in range(N):
    time = 0
    for j in range(i,N-1):
        c,s,f = CSF[j]
        if time < s:
            time = s
        else:
            time = s+f*((time-s+f-1)//f)
        time += c
    print(time)


Measured memory_bytes: 72344
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            var xu = Enumerable
                .Range(0, n)
                .Select(_ => Console.ReadLine().Split(' '))
                .Select(x => new
                {
                    x = decimal.Parse(x[0]),
                    u = x[1] == "JPY" ? 1 : 380000,
                })
                .Sum(x => x.x * x.u);

            Console.WriteLine(xu);
        }
    }
}


Measured memory_bytes: 11348
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cctype>

#include <algorithm>
#include <random>
#include <bitset>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <vector>
#include <chrono>
#include <iostream>
#include <limits>
#include <numeric>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

template <class T>
istream& operator>>(istream& is, vector<T>& v) {
  for (T& x : v)
    is >> x;
  return is;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  if (!v.empty()) {
    os << v.front();
    for (int i = 1; i < v.size(); ++i)
      os << ' ' << v[i];
  }
  return os;
}

const int P = 1000000007;

int norm(int x) { return x >= P ? (x - P) : x; }

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

void sub(int& x, int y) { if ((x -= y) < 0) x += P; }

void exGcd(int a, int b, int& x, int& y) {
  if (!b) {
    x = 1;
    y = 0;
    return;
  }
  exGcd(b, a % b, y, x);
  y -= a / b * x;
}

int inv(int a) {
  int x, y;
  exGcd(a, P, x, y);
  return norm(x + P);
}

int mpow(int x, int k) {
  int ret = 1;
  while (k) {
    if (k & 1)
      ret = ret * (ll)x % P;
    x = x * (ll)x % P;
    k >>= 1;
  }
  return ret;
}


const int N = 5010;

int a[N];
int sz[N], f[N], dp[N];
bool vis[N];

int find(int x) { return f[x] == x ? x : f[x] = find(f[x]); }

int main() {
#ifdef ELEGIA
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i)
    cin >> a[i];
  int nv = inv(n - 1);
  int ans = n;
  iota(f + 1, f + n + 1, 1);
  fill(sz + 1, sz + n + 1, 1);
  for (int i = 1; i <= n; ++i) {
    if (a[i] != -1) {
      int x = find(i), y = find(a[i]);
      if (x != y) {
        sz[x] += sz[y];
        f[y] = x;
      } else {
        sub(ans, 1);
      }
    }
  }
  dp[0] = 1;
  for (int i = 1; i <= n; ++i) {
    if (a[i] == -1) {
      add(ans, nv);
      int p = sz[find(i)] * (ll)nv % P;
      for (int j = n; j; --j)
        dp[j] = (dp[j] + dp[j - 1] * (ll)p) % P;
    }
  }
  int fac = 1;
  for (int i = 1; i <= n; ++i) {
    if (i > 1) fac = fac * (ll)(i - 1) % P;
    sub(ans, fac * (ll)dp[i] % P);
  }

  ans = ans * (ll)mpow(n - 1, count(a + 1, a + n + 1, -1)) % P;

  cout << ans << '\n';

#ifdef ELEGIA
  LOG("Time: %dms\n", int ((clock()
          -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


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

#define MAX_A 1000000

int main() {
    int N; cin >> N;
    vector<int> count(MAX_A + 1, 0);
    vector<int> state(MAX_A + 1, true);
    vector<int> A(N);
    for (int i = 0; i < N; i++) {
        int a; cin >> a;
        count[a]++;
    }
    for (int i = 1; i <= MAX_A; i++) {
        if (count[i] > 0 && state[i]) {
            int k = 2;
            while (i * k <= MAX_A) {
                state[i*k] = false;
                k++;
            }
        }
    }
    int ans = 0;
    for (int i = 1; i <= MAX_A; i++) {
        if (count[i] == 1 && state[i]) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 11968
import java.util.*;



public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<Integer> list = new ArrayList<Integer>();
        while(true){
            String S = sc.next();
            if(S.equals("0")){
                break;
            }
            char[] c = S.toCharArray();
            int sum = 0;
            for(int i=0;i<c.length;i++){
                sum += (int)(c[i]-'0');
            }
            list.add(sum);
        }
        for(int i=0;i<list.size();i++){
            System.out.println(list.get(i));
        }

    }
}



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

const int MAXN = 1e5;
int b[MAXN];

main() {
    int n;
    cin >> n;
    for (int i = 0; i < n - 1; ++i) {
        cin >> b[i];
    }
    int ans = 0;
    for (int i = 0; i < n - 1; ++i) {
        if (i == 0) {
            ans += b[i];
        }
        if (i != 0) {
            ans += min(b[i], b[i - 1]);
        }
        if (i == n - 2) {
            ans += b[i];
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

int main() {
	int n ,i;
	int *a, *b, *c;
	scanf("%d",&n);
	a = (int *)malloc( sizeof(int) * n );
	b = (int *)malloc( sizeof(int) * n );
	c = (int *)malloc( sizeof(int) * n );
	for(i=0; i<n; i++) {
		scanf("%d %d %d",&a[i],&b[i],&c[i]);
	}
	for(i=0; i<n; i++) {
		if (( a[i]*a[i]+b[i]*b[i] == c[i]*c[i] )||
			( b[i]*b[i]+c[i]*c[i] == a[i]*a[i] )||
		( c[i]*c[i]+a[i]*a[i] == b[i]*b[i] )) {
			printf("YES\n");
		}else{
			printf("NO\n");
		}
	}
	free(a);
	free(b);
	free(c);
	return 0;
}

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

int main(void){
  int a,b,c;cin >> a >> b >> c;
  string s = "No";
  if(a<b){
    if(a< c and b > c){
      s = "Yes";
    }
  }else{
    if(a>c and b<c){
      s = "Yes";
    }
  }
  put(s);
}

Measured memory_bytes: 256
S = input().strip()

alpha = [chr(i) for i in range(ord("a"), ord("z")+1)]
d = {}
for i in alpha:
    d[i] = 0

for i in S:
    d[i] += 1

is_none = True
for i in alpha:
    if d[i] == 0:
        is_none = False
        print(i)
        break

if is_none:
    print("None")


Measured memory_bytes: 9060
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());

        // 主処理
        int result = n % 2 == 0 ? n : n * 2;

        // 出力
        System.out.println(result);
        sc.close();
    }
}


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

int main() {
  string s; cin >> s;
  int len = s.size();
  int ans = 0;
  rep(i,len){
    //cout << s[i] << " " << s[len-i-1] << endl;
    if(s[i] != s[len-i-1]) ans++;
  }
  cout << ans/2 << endl;
}


Measured memory_bytes: 3636
class UnionFind():
    #負の値はルートで集合の個数
    #正の値は次の要素を返す
    def __init__(self,size):
        self.table = [-1 for _  in range(size)]
        self.size_ = [1 for _  in range(size)] 
    #集合の代表を求める
    def find(self,x):
        while self.table[x] >= 0:
            #根に来た時,self.table[根のindex]は負の値なのでx = 根のindexで値が返される。
            x = self.table[x]
        return x
    #併合
    def find_size(self,x):
        s1=self.find(x)
        return self.size_[s1]
    def union(self,x,y):
        s1 = self.find(x)#根のindex,table[s1]がグラフの高さ
        s2 = self.find(y)
        if s1 != s2:#根が異なる場合
            if self.table[s1] != self.table[s2]:#グラフの高さが異なる場合
                if self.table[s1] < self.table[s2]:
                    self.table[s2] = s1
                else:
                    self.table[s1] = s2
            else:
                #グラフの長さが同じ場合,どちらを根にしても変わらない
                #その際,グラフが1長くなることを考慮する
                self.table[s1] += -1
                self.table[s2] = s1
            a=self.size_[s1]+self.size_[s2]
            self.size_[s1]=a
            self.size_[s2]=a
        return
N,M,K=map(int,input().split())
count=[-1 for i in range(N)]
G = UnionFind(N)
for i in range(M):
    A,B=map(int,input().split())
    if A != B:#自己ループは実装しない
        G.union(A-1,B-1)
        count[A-1]-=1
        count[B-1]-=1
for i in range(N):
    count[i]+=G.find_size(i)
for j in range(K):
    C,D=map(int,input().split())
    if G.find(C-1) == G.find(D-1):
        count[C-1]-=1
        count[D-1]-=1
print(*count)

Measured memory_bytes: 17372
#include <bits/stdc++.h>
#define INF INT_MAX
using namespace std;
int dp[100005],h[100005];
int rec(int i,int n,int k){
	if(i==n)return 0;
	if(dp[i]!=-1)return dp[i];
	int mini=INT_MAX;
     for(int j=1;j<=k;j++){
	         int 	x=i+j<=n?abs(h[i]-h[i+j])+rec(i+j,n,k):INF;
	      mini=min(mini,x);
     }
     return dp[i]=mini;
	          
}
int main() {
     int n,i,k;
     cin>>n>>k;
     for(i=1;i<=n;i++){
     	cin>>h[i];
     }
     for(i=1;i<=n;i++){
     	dp[i]=-1;
     }
   int  ans=rec(1,n,k);
   cout<<ans<<endl;
	return 0;
}

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

using namespace std;
#define _for(i,j,N) for(int i = (j);i < (N);i++)
#define _rep(i,j,N) for(int i = (j);i <= (N);i++)
#define _dec(i,N,j) for(int i = (N-1);i >= (j);i--)
#define _rec(i,N,j) for(int i = (N);i >=(j);i--)
#define ALL(x) x.begin(),x.end()
#define MEM(a,n) memset(a,n,sizeof(a))
#define fst first
#define scd second
#define PB push_back
#define MP make_pair

typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

int get_int(){int x;scanf("%d",&x);return x;}
LL get_ll(){LL x;scanf("%lld",&x);return x;}
double get_db(){double x;scanf("%lf",&x);return x;}

template<typename T> int chmin(T &a,T b){if(a > b){a = b;return 1;}else return 0;}
template<typename T> int chmax(T &a,T b){if(a < b){a = b;return 1;}else return 0;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {_for(i,0,v.size()) os << v[i] << " ";return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v){for(auto a:v) os << a <<" ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& v){os << v.fst <<" "<<v.scd << " ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& v){for(auto a:v) cout << a << endl;return os;}

static const int dx[8] = { 1,  0, -1,  0,  1, -1,  1, -1};
static const int dy[8] = { 0,  1,  0, -1,  1, -1, -1,  1};
const double pi  = acos(-1.0);
const double eps = 1e-8;
const LL  INF  = 0x3f3f3f3f3f3f3f3f;
const int inf  = 0x3f3f3f3f;
const int mod = 1e9+7;

int N,K;
const int maxn = 1e2+5;

int G[maxn][maxn];

vector<pii> ans;

int main()
{
    int N,K;
    cin >> N >> K;
    _rep(i,1,N){
        _rep(j,1,N){
            G[i][j] = 1;
        }
    }
    int cnt = 0;
    _rep(i,1,N){
        if(cnt == K) break;
        _for(j,i+1,N){
            if(cnt == K) break;
            G[i][j] = 0;
            cnt++;
        }
    }
     _rep(i,1,N){
        _rep(j,i+1,N){
            if(G[i][j]) ans.push_back(MP(i,j));
        }
    }

    if(cnt == K){
        cout << ans.size() <<endl;
        _for(i,0,ans.size()){
            cout << ans[i].first << " "<<ans[i].second<<endl;
        }

    }else cout << -1 << endl;


    return 0;
}


Measured memory_bytes: 384
package main

import (
	"fmt"
	"sort"
)

func main() {
	var N, max int
	var S string
	fmt.Scan(&N)
	m := map[string]int{}
	for i := 0; i < N; i++ {
		fmt.Scan(&S)
		m[S]++
		max = Max(max, m[S])
	}
	var a []string
	for k, v := range m {
		if v == max {
			a = append(a, k)
		}
	}
	sort.Sort(sort.StringSlice(a))
	for i := 0; i < len(a); i++ {
		fmt.Println(a[i])
	}

}

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


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

using namespace std;
const int maxn = 100 + 5;

int a[maxn];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);

    sort(a + 1, a + 1 + n);
    int res = 0;

    for (int i = 1; i <= n; i++)
        for (int j = i + 1; j <= n; j++)
            for (int k = j + 1; k <= n; k++) {
                if (a[i] == a[j] || a[i] == a[k] || a[j] == a[k]) continue;
                if (a[i] + a[j] > a[k]) res++;
            }

    printf("%d\n", res);
    return 0;
}


Measured memory_bytes: 3760
s = input()
K = int(input())
n1 = list(s)
n2 = [s[i:i+2] for i in range(len(s)-1)]
n3 = [s[i:i+3] for i in range(len(s)-2)]
n4 = [s[i:i+4] for i in range(len(s)-3)]
n5 = [s[i:i+5] for i in range(len(s)-4)]
cat = list(set(n1 + n2 + n3 + n4 + n5))
cat.sort()
#print(cat)
print(cat[K-1])

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

vector<int> G[SIZE];
vector<int> ans(SIZE), a(SIZE);
vector<int> L;
void dfs(int k = 0, int p = -1){
    int flag = -1;
    int itr = lower_bound(L.begin(), L.end(), a[k]) - L.begin();
    if (itr == L.size()){
        L.push_back(a[k]);
    }
    else {
        flag = L[itr];
        L[itr] = a[k];
    }
    ans[k] = L.size();
    for (auto &&i : G[k]){
        if (i == p)continue;
        dfs(i, k);
    }
    if (flag == -1)L.pop_back();
    else L[itr] = flag;
}
int main() {
    cin.tie(nullptr); ios::sync_with_stdio(false);
    int n; cin >> n;
    rep(i,n)cin >> a[i];
    rep(i,n-1){
        int u, v; cin >> u >> v;
        u--; v--;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    dfs();
    rep(i,n)
        cout << ans[i] << endl;
}

Measured memory_bytes: 27208
s = input()
while True:
  n = len(s)
  if n==0:
    print("YES")
    exit()
  if n>=5:
    if s[n-5:n] == "dream":
      s = s[:n-5]
      continue
    if s[n-5:n] == "erase":
      s = s[:n-5]
      continue
  if n>=6:
    if s[n-6:n] == "eraser":
      s = s[:n-6]
      continue
  if n>=7:
    if s[n-7:n] == "dreamer":
      s = s[:n-7]
      continue
  break
print("NO")
  

Measured memory_bytes: 3260
#include <iostream>
using namespace std;
int main() {
int a,b;


cin>>a>>b;
if(a+b>a-b&&a+b>=a*b){
    cout<<a+b;}
else if(a-b>a+b&&a-b>a*b){
        cout<<a-b;}
else if(a*b>a-b&&a*b>=a+b){
        cout<<a*b;}
else if(a==0&&b==0){
    cout<<"0";
}
else if(a!=0&&b==0){
    cout<<a;
}


    return 0;
}


Measured memory_bytes: 256