akhauriyash/Code-Regression huggingface dataset:
//7550
//再帰関数
//感想：値を重複なしでカウントするのが大変//後ろにつけるだけでいい？
using System;
using System.Linq;
using System.Collections.Generic;

namespace tst
{
    class Program
    {
        public static int N = 0;
        public static int cnt = 0;
        public static bool Check(int v, int keta, bool alflag)
        {
            if (keta == 0)
            {
                return false;
            }
            else if (alflag == true)
            {
                //再帰前がすでに357入っていた時
                return true;
            }
            else
            {
                int[] K = new int[keta];
                //357ならK[0]=7,K[1]=5,K[2]=3
                for (int i = 0; i < keta; i++)
                {
                    K[i] = v%10;
                    v /= 10;
                }
                //フラグのリセット
                bool flag3 = false;
                bool flag5 = false;
                bool flag7 = false;
                foreach (int x in K)
                {
                    if (x == 3) flag3 = true;
                    else if (x == 5) flag5 = true;
                    else if (x == 7) flag7 = true;
                    else continue;
                }
                if (flag3 == true && flag5 == true && flag7 == true)
                {//357すべて含まれていたら返り値true
                    return true;
                }
                else return false;

            }
        } 
        static void Keisan(long v, int keta)
        {
            //Console.Write(v);
            if (v>N)
            {//終了条件
                //Console.WriteLine(" return");
                return;
            }
            bool alflag = false;
            //終了条件突破し、753数ならカウント増やす
            if (Check((int)v, keta, alflag))
            {
               // Console.WriteLine(" true");
                alflag = true;
                cnt++;
            }
            else
            {
                //Console.WriteLine(" false");
            }
            //末尾に3,5,7をつける
            Keisan(v * 10 + 3, keta + 1);
            Keisan(v * 10 + 5, keta + 1);
            Keisan(v * 10 + 7, keta + 1);

        }

        public static void Main()
        {
            //入力
            N = int.Parse(Console.ReadLine());
            //とりま準753数（333や57557含む）をゼロから始める
            Keisan(0, 0);
            //出力
            Console.WriteLine(cnt);
            
        }

    }
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  int M;
  ll K;
  cin >> M >> K;

  if(M == 1){
    if(K == 0){
      cout << 0 << " " << 0 << " " << 1 << " " << 1 << endl;
    }else{
      cout << -1 << endl;
    }

  }else{

    ll max_K = modpow(2, M, 1e9+7)-1;

    if(K > max_K){
      cout << -1 << endl;
    }else{
      vector<ll> ans;

      //max_K ~ 0を、降順に
      for(int i = max_K; i >= 0; i--){
        if(i != K){
          ans.push_back(i);
        }
      }
      ans.push_back(K);
      for(int i = 0; i <= max_K; i++){
        if(i != K){
          ans.push_back(i);
        }
      }
      ans.push_back(K);
      for(int i = 0; i < ans.size(); i++){
        cout << ans[i] << " ";
      }
      cout << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 4080
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:512000000")
#include<utility>
#include<iostream>
#include<fstream>
#include<vector>
#include<array>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<ctime>
#include<functional>
#include<random>
#include<climits>
#include<queue>
#include<stack>
#include<deque>
#include<bitset>
#include<map>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<cassert>
#include<ccomplex>

#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
#pragma GCC optimize("unroll-loops")
#define int128 __int128
#else
#define int128 long long
#endif

#define all(x) x.begin(), x.end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define mp make_pair
#define X first
#define Y second

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;
mt19937_64 gen(time(nullptr));

ll mod = 1e9 + 7;

namespace {
    ll mul(ll a, ll b) {
        ll val = a * b - (ll)((ld)a * b / mod) * mod;
        if (val < 0) val += mod;
        if (val >= mod) val -= mod;
        return val;
    }
    ll poww(ll a, ll b) {
        ll val = 1;
        a %= mod;
        while (b > 0) {
            if (b % 2) val = mul(a, val);
            a = mul(a, a);
            b >>= 1;
        }
        return val % mod;
    }
    ll inv(ll a) {
        return poww(a, mod - 2);
    }
}

ll const maxn = 3e5 + 5;


signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen("output.txt", "w", stdout);
    
    ll n; cin >> n;
    vector<ll>a(n), b(n);
    for (ll i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
    }
    sort(all(a));
    sort(all(b));
    
    if (n % 2) {
        cout << b[n / 2] - a[n / 2] + 1 << endl;
    } else {
        cout << b[n / 2] + b[n/2 - 1] - a[n / 2] - a[n/2 - 1] + 1 << endl;

    }




    return 0;
}

/*

*/

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


int main(){
	
	int n;
	cin >> n;
	int a[n];
	for(int i = n-1;i >= 0;i--){
		cin >> a[i];
	}
	for(int j = 0;j < n;j++){
		cout << a[j];
		if(j < n-1)cout << " ";
	}
	cout << endl;
	return 0;
}

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

#define ll long long
#define mod 1000000007
#define ffor(i,a,b) for(int i=a;i<b;i++)
#define bfor(i,a,b) for(int i=a-1;i>=b;i--)
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define mem(x,y) memset(x,y,sizeof(x))
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sz(x) (int)x.size()
#define fast  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI 3.14159265358979323846
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define endl '\n'

int main()
{
    

    int n;
    cin>>n;
    ll ans=0;
    string s;
    cin>>s;
    ll r[n+1]={0},g[n+1]={0},b[n+1]={0};
    bfor(i,n,0)
    {
        r[i]=r[i+1];
        g[i]=g[i+1];
        b[i]=b[i+1];
        if(s[i]=='R') r[i]++;
        else if(s[i]=='G') g[i]++;
        else b[i]++;
    }
    map<char,int> m;
    map<int,char> m1;
    m['R']=1; m1[1]='R';
    m['G']=2; m1[2]='G';
    m['B']=3; m1[3]='B';
    ffor(i,0,n)
    {
        ffor(j,i+1,n)
        {
            if(s[i]!=s[j])
            {
                ll x=0;
                char ch=m1[6-m[s[i]]-m[s[j]]];
                if(ch=='R') x+=r[j+1];
                else if(ch=='G') x+=g[j+1];
                else x+=b[j+1];
                if(2*j-i<n&&s[2*j-i]==ch) x--;
                ans+=x;
              //  cout<<i<<" "<<j<<" "<<x<<endl;
            }
        }
    }
    cout<<ans;
    
    return 0;
}



Measured memory_bytes: 3700
#include <iostream>
using namespace std;
int main(void){
    int p[20] = {};
    int num;
    cin >> num;
    for (int i = 0; i < num; i++) {
        cin >> p[i];
    }

    int cnt = 0;
    for (int i = 0; i < num - 2; i++) {
        if(p[i] < p[i+1] && p[i+1] < p[i+2]) {
            cnt++;
        } else if(p[i] > p[i+1] && p[i+1] > p[i+2]) {
            cnt++;
        }
    }
    
    cout << cnt << endl;
}


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

//const long double PIL = 3.141592653589793238462643383279502884L;
//const double PI = 3.14159265358979323846;

#define sz(a) int((a).size())
#define all(c) (c).begin(), (c).end()
#define what_is(x) cerr << #x << " is " << x << endl;

using ll = long long;
using ii = pair<int,int>;
using vi = vector<int>;
using vll = vector<long long>;
using vii = vector<pair<int,int>>;

int main() {
	//~ ios::sync_with_stdio(0);
	//~ cin.tie(0);
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a+3);
	printf("%d\n", a[2] - a[0]);
}


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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int n,m;
  ll k;
  cin >> n >> m >> k;
  vector<int> a(n);
  vector<int> b(m);
  int i;
  rep(i,n) cin >> a[i];
  rep(i,m) cin >> b[i];
  vector<ll> suma(n+1,0);
  vector<ll> sumb(m+1,0);
  rep(i,n) suma[i+1] = suma[i]+a[i];
  rep(i,m) sumb[i+1] = sumb[i]+b[i];
  ll na = n;
  ll nb = 0;
  ll ans = 0;
  while(na >= 0 && nb <= m)
  {
    ll now = suma[na]+sumb[nb];
    if(now <= k)
    {
      ans = max(ans,na+nb);
      nb++;
    }
    else
    {
      na--;
    }
  }
  cout << ans << "\n";
}


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

int main(){
    int t;
    cin >> t;
    int h,m,s;
    h = t / 3600;
    m = (t % 3600) / 60;
    s = t % 60;
    cout << h << ":" << m << ":" << s << endl;
    
    return 0; 
}


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

int main(void){
    ll a, b;
    cin >> a >> b;

    if(a * b % 2 == 1){
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
n,x,m=map(int,input().split())
s=set()
ct=x
ans=[x]
s.add(x)
f=0
for i in range(n-1):
  ct**=2
  ct%=m
  if ct not in s:
    s.add(ct)
    ans.append(ct)
  else:
    f=1
    break
if f==0:
  print(sum(ans))
  exit()
y=ans.index(ct)
z=sum(ans[y:len(ans)])
z2=0
for i in range(((n-y)%(len(ans)-y))):
  z2+=ans[y+i]
print(sum(ans[0:y])+z*((n-y)//(len(ans)-y))+z2)

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

int main(){
	
	int hit, blow;
	string r, a;
	
	while(cin >> r >> a, r != "0"){
		hit = blow = 0;
		for(int i = 0; i < 4; ++i) if(r[i] == a[i]) ++hit;
		
		for(int i = 0; i < 4; ++i) for(int j = 0; j < 4; ++j) if(r[i] == a[j]) ++blow;
		blow -= hit;
		
		cout << hit << " " << blow << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1184
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const int vx[]={1,0,-1,0}, vy[]={0,1,0,-1};
const ll LINF=1e18;
const ld PI=abs(acos(-1));

ll x[100010], y[100010];

int main(){
	int n,m; cin >> n >> m;
	REP(i,0,n) cin >> x[i]; sort(x, x + n);
	REP(i,0,m) cin >> y[i]; sort(y, y + m);
	
	ll pos = 0, pot = 0;
	REP(i,0,n) (pos += x[i] * i - (n - 1 - i) * x[i]) %= MOD;
	REP(i,0,m) (pot += y[i] * i - (m - 1 - i) * y[i]) %= MOD;
	cout << pos * pot % MOD << endl;
	return 0;
}


Measured memory_bytes: 1920
#include<stdio.h>

int search(int A[], int n, int key){
  int i=0;
  A[n]=key;
  while(A[i]!=key) i++;
  return i!=n;
}

int main(){
  int i,n,A[10000+1],q,key,sum=0;

  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&A[i]);

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&key);
    if(search(A,n,key)) sum++;
  }
  printf("%d\n",sum);

  return 0;
}
		    



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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fm, to)    for (int i = fm; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

int mod = 998244353;
struct modulo {
	int w;
	operator int&() { return w; }
	
	modulo() {}
	modulo(int w) { this->w = w; fix(); }
	void inline fix() { w %= mod; if (w < 0) w += mod; }
	modulo inline fix(int w) const { w %= mod; if (w < 0) w += mod; return w; }
	
	modulo& operator += (modulo b) { if ((w += b.w) >= mod) w -= mod; return *this; }
	modulo& operator -= (modulo b) { if ((w -= b.w) < 0) w -= mod; return *this; }
	modulo& operator *= (modulo b) { w = (num) w * b.w % mod; return *this; }
	modulo& operator /= (modulo b) { w = (num) w * b.inv() % mod; return *this; }
	modulo inline operator + (modulo b) { modulo r = *this; r += b; return r; }
	modulo inline operator - (modulo b) { modulo r = *this; r -= b; return r; }
	modulo inline operator * (modulo b) { modulo r = *this; r *= b; return r; }
	modulo inline operator / (modulo b) { modulo r = *this; r /= b; return r; }
	
	modulo inline inv() const {
		int a = w, m = mod, u = 0, v = 1, t;
		for (; a != 0; t = m / a, m -= t * a, swap(a, m), u -= t * v, swap(u, v));
		return fix(u);
	}
	
	modulo inline pow(int p) const {
		if (!w)  return 0;
		modulo a = *this, r = 1;
		for (; p > 0; a *= a, p >>= 1) if (p & 1) r *= a;
		return r;
	}
};
typedef modulo rem;

const int nsz = int(2e5);
rem n, m, k, inv[nsz + 5], fac[nsz + 5], ifc[nsz + 5], ans;

void inline init() {
	inv[1] = 1;
	circ (i, 2, n) {
		inv[i] = rem(-mod / i) * inv[mod % i];
	}
	fac[0] = ifc[0] = 1;
	cont (i, n) {
		fac[i] = fac[i - 1] * rem(i);
		ifc[i] = ifc[i - 1] * inv[i];
	}
}

rem inline C(int n, int m) { return fac[n] * ifc[m] * ifc[n - m]; }

rem inline f(int n, int k) { return C(n - 1, k) * m * (m - rem(1)).pow(n - k - 1); }

int main() {
	scanf("%d%d%d", &n, &m, &k);
	if (m == 1) {
		printf("%d\n", k == n - rem(1));
		return 0;
	}
	init();
	circ (i, 0, int(k)) {
		ans += f(n, i);
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 6164
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
tuple<int,int,string,long long ,string> a[maxn];
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    rep(i,1,n){
        int v,w;
        string c;
        long long d;
        string s;
        cin>>v>>w>>c>>d>>s;
        a[i]=make_tuple(v,w,c,d,s);
    }
    sort(a+1,a+1+n);
    rep(i,1,n){
        cout<<get<0>(a[i])<<' '<<get<1>(a[i])<<' '<<get<2>(a[i])<<' '<<get<3>(a[i])<<' '<<get<4>(a[i])<<endl;
    }

}
/* 
5
105 24 C 1500000000000 white
100 23 C 1500000000000 blue
105 23 A 1480000000000 pink
110 25 B 1500000000000 black
110 20 A 1300000000000 gree
 */


Measured memory_bytes: 44280
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int a,b,h,m;
    double ans;
    cin>>a>>b>>h>>m;
    double da,db;
    da=(double)a;
    db=(double)b;
    int mm=h*60+m;
    double shongle, longle;
    shongle=0.5*(double)mm;
    longle=6.0*(double)m;
    
    double angle=min(fabs(shongle-longle), 360.0-fabs(shongle-longle));
    double ansans=da*da+db*db;

    if(angle==90){
        ans=sqrt(ansans);
    }else{
        ans=sqrt(ansans-2.0*da*db*(double)cos(angle*(M_PI/180)));
    }

    cout<<fixed<<setprecision(20)<<ans<<endl;
    return 0;
}

Measured memory_bytes: 4060
#include <algorithm>
#include <iostream>
#include <set>
using namespace std;

const int MAXN = 1e5 + 10;
long long e, t, dp[MAXN], mn = 1e17;
int n, x[MAXN];

int main() {
	cin >> n >> e >> t;
	for (int i = 1; i <= n; i++)
		cin >> x[i];
	dp[1] = t;
	int j = 1;
	for (int i = 2; i <= n; i++) {
		while ((x[i] - x[j]) * 2 > t) {
			mn = min(mn, dp[j - 1] - 2 * x[j]);
			j++;
		}
		dp[i] = min(mn + 2 * x[i], dp[j - 1] + t);
	}
	cout << dp[n] + e;
}

Measured memory_bytes: 1408
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>


using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
typedef pair<int, int>P;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 998244353; constexpr int MAX = 2000020;
const double pi = acos(-1); constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;

void solve() {
	int N, M; cin >> N >> M;
	vector<int>cnt(N + 1);
	REP(i, M) {
		int u, v; cin >> u >> v;
		cnt[u]++;
		cnt[v]++;
	}
	REP(i, N + 1) {
		if (cnt[i] & 1) {
			print("NO");
			return;
		}
	}
	print("YES");
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}



Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main(){
    
    long long int x;
    cin>>x;

    long long int yen=100;
    
    long long int i;
    for( i=1;yen<x;i++){
     yen+=(yen)/100;
    }
    cout<<i-1<<endl;
    
    
    return 0;
    
}

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

using namespace std;

typedef long long ll;

int main() {
    
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    
    int n;
    cin >> n;
    vector<int> A(n);
    for(int i = 0; i < n; i++)
    {
        cin >> A[i];
    }
    
    vector<vector<ll>> dp(n,vector<ll>(n,numeric_limits<ll>::max()));
    for(int i = 0; i < n; i++)
    {
        dp[i][i] = 0;
    }
    
    vector<ll> prefixSum(n);
    prefixSum[0] = A[0];
    for(int i = 1; i < n; i++)
    {
        prefixSum[i] = prefixSum[i-1]+A[i];
    }
    
    for(int i = n-1; i >= 0; i--)
    {
        for(int j = i+1; j < n; j++)
        {
            for(int k = i; k < j; k++)
            {
                dp[i][j] = min(dp[i][j],dp[i][k]+dp[k+1][j]);
            }
            
            ll sum = prefixSum[j];
            if(i > 0)
            {
                sum -= prefixSum[i-1];
            }
            dp[i][j] += sum;
        }
    }
    
    // for(int i = 0; i < n; i++)
    // {
    //     for(int j = 0; j < n; j++)
    //     {
    //         cout << dp[i][j] << ' ';
    //     }
    //     cout << '\n';
    // }
    
    cout << dp[0][n-1] << '\n';
    
    return 0;
}

Measured memory_bytes: 1536
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(1,n-1):
    tmp = []
    tmp.append(p[i-1])
    tmp.append(p[i])
    tmp.append(p[i+1])
    tmp.sort()
    
    if tmp[1] == p[i]:
        ans += 1

print(ans)

Measured memory_bytes: 3064
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

n = int(readline())
a = read().split()

print('AC x {}'.format(a.count('AC')))
print('WA x {}'.format(a.count('WA')))
print('TLE x {}'.format(a.count('TLE')))
print('RE x {}'.format(a.count('RE')))

Measured memory_bytes: 75992
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<list>
#include<stack>
#include<map>
#include<set>
#include<string>
#include <sstream>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;

bool binSearchSub(vector<int>* a,int k,int min,int max){
  if(min > max){
    return false;
  }
  else{
    int mid = min + (max - min)/ 2;
    //cout << "min:" << min << "mid:" << mid << "max:" << max << endl;
    if(a->at(mid) > k){
      return binSearchSub(a,k,min,mid-1);
    }
    else if(a->at(mid) < k){
      return binSearchSub(a,k,mid+1,max);
    }
    else{
      return true;
    }
  }

}

bool binSearch(vector<int>* a,int k){
  return binSearchSub(a,k,0,a->size()-1);
}

int main(){
  long ii,jj,kk,n,q,k;
  vector<int> a;

  cin >> n;

  a.resize(n);

  for(ii=0;ii<n;ii++){
    cin >> a[ii];
  }

  cin >> q;


  for(ii=0;ii<q;ii++){
    cin >> k;
    if(binSearch(&a,k)){
      cout << "1" << endl;
    }
    else{
      cout << "0" << endl;
    }
  }
  
  return 0;
}



Measured memory_bytes: 3124
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

ll n, c;

int main() {
    cin >> n >> c;
    V<Pll> s(n+2);
    s[0] = {0, 0};
    s[n+1] = {c, 0};
    REP2(i, 1, n+1) {
        ll x, v; cin >> x >> v;
        s[i] = {x, v};
    }

    ll res = 0;

    V<Pll> left = {{-(n+1), 0}};
    ll maxi = 0, sum = 0;
    RREP(i, n, 1) {
        sum += s[i].second - (s[i+1].first - s[i].first);
        if (sum > maxi) {
            left.push_back({-i, sum});
            maxi = sum;
        }
    }

    sum = 0;
    REP2(i, 1, n+1) {
        sum += s[i].second - (s[i].first - s[i-1].first);
        auto iter = lower_bound(ALL(left), make_pair((ll)-i, 0LL));
        iter--;
        res = max({res, sum, sum - s[i].first + iter->second});
    }

    V<Pll> right = {{0, 0}};
    maxi = 0, sum = 0;
    REP2(i, 1, n+1) {
        sum += s[i].second - (s[i].first - s[i-1].first);
        if (sum > maxi) {
            right.push_back({i, sum});
            maxi = sum;
        }
    }

    sum = 0;
    RREP(i, n, 1) {
        sum += s[i].second - (s[i+1].first - s[i].first);
        auto iter = lower_bound(ALL(right), make_pair((ll)i, 0LL));
        iter--;
        res = max({res, sum, sum - (c - s[i].first) + iter->second});
    }

    cout << res << '\n';

    return 0;
}


Measured memory_bytes: 6384
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
#define mp make_pair
#define mo 1000000007
#define MAX_N 500004
#define INF 2000000000
 
#define fast_io ios::sync_with_stdio(false)


set<int> st[26];

int main()
{
	int n, q, ty, l, r;
	char c;
	string s;
	cin >> n >> s >> q;
	for(int i = 0; i < n; ++i)
		st[s[i] - 'a'].insert(i);
	for(int i = 1; i <= q; ++i)
	{
		cin >> ty;
		if(ty == 1)
		{
			cin >> l >> c;
			l--;
			st[s[l] - 'a'].erase(l);
			st[c - 'a'].insert(l);
			s[l] = c;
		}  
		else
		{
			cin >> l >> r;
			l--;
			r--;
			int ans = 0;
			for(int i = 0; i < 26; ++i)
				if(st[i].lower_bound(l) != st[i].end() && *st[i].lower_bound(l) <= r)
					ans++;
			cout << ans << endl;
		}

	}



}   

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

#define itr(a) begin(a), end(a)
#define pb push_back
#define x first
#define y second
#define endl '\n'

#define FAST cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

#ifndef __LOCAL
#define FILES(namein, nameout) freopen(namein, "r", stdin); freopen(nameout, "w", stdout); FAST;
#else
#define FILES(namein, nameout) FAST;
#endif //__LOCAL

using namespace std;
using namespace __gnu_pbds;
using python = void;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned short uss;
typedef pair<ll, ll> pll;
typedef tree<ll, null_type> ordered_set;

const ll M = 1e9+7;
const ll N = 2e5+228;
constexpr ll inf = 0x3f3f3f3f3f3f3f3f;
ll f[N], of[N];
ll bp(ll a, ll b){
	if(b == 0) return 1;
	if(b == 1) return a;
	ll x = bp((a*a)%M, b/2);
	if(b&1) x = (x*a)%M;
	return x;
}

ll a[N];

python solve(){
	FAST;
	ll n, k;
	cin >> n >> k;
	for(ll i =0;i<n;i++) cin >> a[i];
	sort(a, a+n);
	f[0] = 1;
	for(ll i =1;i<=n;i++) f[i] = (f[i-1]*i)%M;
	of[n] = bp(f[n], M-2);
	for(ll i = n-1;i>=0;i--){
		of[i] = (of[i+1]*(i+1))%M;
	}
	ll res = 0;
	for(ll i = k-1;i<n;i++){
		res += (((((f[i]*of[i-k+1])%M)*of[k-1])%M)*(a[i]))%M;
		res %= M;
	}
	for(ll i = 0;i+k-1<n;++i){
		res += M-((((((f[n-i-1]*of[n-i-k])%M)*of[k-1])%M)*(a[i]))%M);
		res %= M;
	}
	cout << res << '\x0a';
}

signed main(){
	FAST;
	ll q = 1;
	//cin >> q;
	while(q--){
		solve();
	}
}

Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,q;
int all[11];
int BB[21];
ll A[55],B[55],C[55],D[55];
int main()
{		
	cin>>n>>m>>q;	
	for(int i=1;i<=q;i++)
	{
		cin>>A[i]>>B[i]>>C[i]>>D[i];
	}
	for(int i=1;i<m;i++)		
		BB[i]=0;	
	for(int i=m;i<m+n;i++)
		BB[i]=1;
	ll ans=-1;	
	do
	{		
		int VALU=1,CNT=1;
		for(int i=1;i<m+n;i++)
		{
			if(!BB[i]) 
				VALU++;			
			else
				all[CNT++]=VALU;		
		}
		ll sum=0;
		for(int i=1;i<=q;i++)
		{
			if(all[B[i]]-all[A[i]]==C[i])
				sum+=D[i];
		}
		ans=max(ans,sum);
	}while(next_permutation(BB+1,BB+m+n));
	cout<<ans<<endl;
}

Measured memory_bytes: 3596
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {

	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	sc.Text()
	length := 1046527
	hashtable := make([]*Element, length)

	for {
		sc.Scan()
		in := sc.Text()
		if len(in) == 0 {
			break
		}
		command := strings.Split(in, " ")
		insert := command[0] == "insert"
		val := command[1]
		// fmt.Println("KEY:")
		// fmt.Println(key)

		if insert {
			new := Element{val, nil}
			num := generateNum(val)
			key := num % length
			index := 0
			for {
				if hashtable[((1+key%(length-1))*index+key)%length] == nil {
					hashtable[((1+key%(length-1))*index+key)%length] = &new
					break
				} else {
					index++
				}
			}
		} else {
			num := generateNum(val)
			key := num % length
			index := 0
			for {
				if hashtable[((1+key%(length-1))*index+key)%length] == nil {
					fmt.Println("no")
					break
				}

				if hashtable[((1+key%(length-1))*index+key)%length].val == val {
					fmt.Println("yes")
					break
				}

				index++
			}

		}
	}
}

type Element struct {
	val  string
	next *Element
}

func generateNum(val string) int {
	result := 0
	p := 1
	for _, v := range val {
		switch v {
		case 'A':
			result += 1 * p
		case 'C':
			result += 2 * p
		case 'G':
			result += 3 * p
		case 'T':
			result += 4 * p
		}

		p *= 5

	}
	return result
}



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

int main(){
	int n,cnt=0,cnt1=0;
	string s;
	cin>>n>>s;
	for(int i=0;i<s.size();i++)
		if(s[i]=='W')
			cnt++;
	for(int i=n-1;i>=n-cnt;i--)
		if(s[i]=='R')			
			cnt1++;
	printf("%d\n",cnt1);
	return 0;
}

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

int main(){
    int N;
    cin>>N;
    vector<int> V(N),C(N);
    for(int i=0;i<N;i++){
        cin>>V.at(i);
    }
    for(int i=0;i<N;i++){
        cin>>C.at(i);
    }
    vector<int> sum(N);
    for(int i=0;i<N;i++){
        sum.at(i)=V.at(i)-C.at(i);
    }
 int buy=0,benefit=0;
 for(int i=0;i<N;i++){
    buy+=sum.at(i);
    if(benefit<buy){
        benefit=buy;
    }
    else {
        buy-=sum.at(i);
    }
 }
 cout<<benefit<<endl;
}

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

int main(void){
    int A, B;
    cin >> A >> B;
    if(A==B){
        cout << "Draw" << endl;
        return 0;
    }
    if((A==1 || A > B) && B!=1){
        cout << "Alice" << endl;
        return 0; 
    }
    if(B==1 || B > A){
        cout << "Bob" << endl;
        return 0;
    }
}

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

using namespace std;

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

#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<(b);i++)
#define repr(i,b,a) for(int i=int(b);i>=(a);i--)
#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

typedef struct point{
	int a,b,c,d;
	point(int aa,int bb,int cc, int dd){
		a=aa;b=bb;c=cc;d=dd;
	}
} point;

int n,m,q;
vector<point> p;
int best = 0;

void calc(vector<int> ls){
	int res=0;
	for(auto pp: p){
		if(ls[pp.b] - ls[pp.a] == pp.c)res += pp.d;
	}
	best = max(best, res);
}

void dfs(vector<int> ls, int pos){
	if(pos==n){
		calc(ls);
	}else{
		int x = (pos==0?1:ls[pos-1]);
		repi(i, x, m+1){
			ls[pos] = i;
			dfs(ls, pos+1);
		}
	}
}


int main()
{
	cin>>n>>m>>q;
	rep(i,q){
		int a,b,c,d;
		cin>>a>>b>>c>>d;
		a--;b--;
		p.push_back(point(a,b,c,d));
	}

	vector<int> ls(n,0);

	dfs(ls, 0);

	cout<<best<<endl;
	return 0;
}

Measured memory_bytes: 3600
def b():
    n = int(input())
    AC=0
    WA=0
    TLE=0
    RE=0
    while n:
        n-=1
        t= input()
        if t=='AC':
            AC+=1
        elif t=='WA':
            WA+=1
        elif t=='TLE':
            TLE+=1
        else:

            RE+=1
    print("AC x %d"%AC)
    print("WA x %d"% WA)
    print("TLE x %d"% TLE)
    print("RE x %d"% RE)
b()



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

typedef long long ll;
const ll MOD = 1e9+7;
const int N = 1e5+5;


int n,a[N];

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

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

    if(a[1]>1)a[1]--;

    for(int i=2;i<=n;i++){
        if(a[i]>a[i-1]){
            a[i]--;
        }else if(a[i]<a[i-1]){
            cout<<"No";
            return 0;
        }
    }

    cout<<"Yes";

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define ALL(x) begin(x), end(x)
using namespace std;

int solve(int n, vector<int> const & p) {
    vector<int> lis(n + 1, INT_MIN);
    for (int p_i : p) {
        lis[p_i] = max(1, lis[p_i - 1] + 1);
    }
    return n - *max_element(ALL(lis));
}

int main() {
    int n; cin >> n;
    vector<int> p(n);
    REP (i, n) cin >> p[i];
    cout << solve(n, p) << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<iostream>
using namespace std;
 
int main(void){
  char in;
  cin >> in;
  if(in == 'a'|| in == 'i'||in == 'u'||in == 'e'||in == 'o')cout << "vowel"<<endl;
  else cout << "consonant" << endl;
  return 0;
}

Measured memory_bytes: 256
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void setIO(string s = "") {
	// cin.exceptions(cin.failbit); 
	// throws exception when do smth illegal
	// ex. try to read letter into int
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 55;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
 
int rnd (int l, int r) {
	return uniform_int_distribution<int> (l, r)(gen);
}
 
int n, m, k;
ll C[N][N];
int a[N];
int dp[(1<<18)];
const int L = 18;

int main () {
	SpeedForce;
	setIO();
	
	int s, t;
	cin >> n >> k >> s >> t;
	for(int i = 1; i <= n; ++i) {
		cin >> a[i];
		if((s&a[i]) == s && (t|a[i]) == t) {
			continue;
		}
		--i, --n;
	}

	C[0][0] = 1;
	For (i, 1, n) {
		C[i][0] = 1;
		For (j, 1, n) {
			C[i][j] = C[i-1][j-1] + C[i-1][j];
		}
	}

	int goal = (~s)&t;
	ll ans = 0;
	For (i, 1, n) {
		memset(dp, 0, sizeof dp);
		For (j, i+1, n) {
			int msk = ((a[i] ^ a[j])&goal);
			dp[msk] ++;
		}
		for (int bit = 0; bit < L; ++bit) {
			for(int msk = 0; msk < (1<<L); ++msk) if(!(msk&(1<<bit))) {
				dp[msk^(1<<bit)] += dp[msk];
				
			}
		}

		for (int msk = goal; ; msk = (msk-1)&goal) {
			int tot = dp[msk];
			ll sum = 0; 
			for(int i = 0; i < k; ++i)
				sum += C[tot][i];

			if (__builtin_popcount(msk^goal)%2 == 0) ans += sum;
			else ans -= sum;

			if(!msk) break;
		}
	}

	cout << ans << endl;

	return Accepted;
}

// B...a


Measured memory_bytes: 4672
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map>
#include <map>
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
using namespace std;

int main(){
	int a, b;

	cin >> a;
	cin >> b;

	int s;

	s = a * b;

	if (s % 2 == 0) {
		cout << "Even";
	} else {
		cout << "Odd";
	}

	return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

n = int(input())
V = list(map(int, input().split()))
 
def mode(d):
    return sorted(d.items(), key=lambda x: x[1], reverse=True)
 
if len(set(V)) == 1:
    ans = n // 2
else:
    o = defaultdict(int)
    e = defaultdict(int)
    for i in range(n):
        if i % 2 == 0:
            e[V[i]] += 1
        else:
            o[V[i]] += 1
    mode_o = mode(o)
    mode_e = mode(e)
    if mode_o[0][0] != mode_e[0][0]:
        ans = n - mode_o[0][1] - mode_e[0][1]
    else:
        ans = min(n - mode_o[0][1] - mode_e[1][1], n - mode_o[1][1] - mode_e[0][1])
print(ans)


Measured memory_bytes: 22484
N = int(input())
nums = [int(input()) for x in range(N)]

ind = 1
count = 1
while(True):
    next = nums[ind-1]
    if next == 2:
        break
    ind = next
    count+=1
    if count>= 100000:
        count = -1
        break

print(count)

Measured memory_bytes: 7084
#include <iostream>
using namespace std;
 
int main()
{
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int ans = 0;
	if ( k <= a )
	{
		ans += k;
		cout << k << endl;
		return 0;
	}
	else
	{
		ans += a;
		k -= a;
		if(k <= b)
		{
			cout << ans << endl;
		}
		else
		{
			k -= b;
			ans -= k;
			cout << ans << endl;
		}
	}
}


Measured memory_bytes: 3628
a=input()
b=len(a)
def func(x):
  if x == x[::-1]:
    return 1
  else:
    return 0
if func(a) and func(a[0:(b-1)//2]) and func(a[(b+3)//2-1:]):
  print('Yes')
else:
  print('No')

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int di2[] = {1, 1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1};
const int dj2[] = {1, -1, 1, -1, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2, -1, 0, 1, 2, 2};
const int INF = 1 << 28;
const ll INF64 = 1ll << 55;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  ll s; cin >> s;
  if((ll)sqrt(s)*(ll)sqrt(s) == s) {
    cout << 0 << " " << 0 << " " << (ll)sqrt(s) << " " << 0 << " " << 0 << " " << (ll)sqrt(s) << endl;
    return 0;
  }

  ll sqr = (ll)ceil(sqrt(s));
  ll x2 = sqr, y3 = sqr;
  ll y2 = 1;
  ll x3 = sqr*sqr - s;

  cout << 0 << " " << 0 << " " << x2 << " " << y2 << " " << x3 << " " << y3 << endl;
}

Measured memory_bytes: 3740
// inputに入力データ全体が入る
function Main(input) {
    // 1行目がinput[0], 2行目がinput[1], …に入る
    input = input.split("\n");
    // 数値の配列を作る
    const numList0 = input[0].split(' ').map(x => parseInt(x, 10));
    const A = numList0[0];
    const B = numList0[1];

    var count = 0;
    var plug = 1;
    while (plug < B) {
        plug += A - 1;
        count++;
    }

    console.log(count);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 21064
#include<stdio.h>

int main()
{
  int flag=1,N,a,A[100],i,j,c=0;

  scanf("%d",&N);

  for(i=0;i<N;i++)
    {
      scanf("%d",&A[i]);
    }
  
  i=0;
  
  while(flag)
    {
      flag=0;

      for(j = N-1; j >= i+1; j--)
	{
	  if(A[j] < A[j-1]){
	    a = A[j];
	    A[j] = A[j-1];
	    A[j-1] = a;
	    flag = 1;
	    c++;
	  }
	}
      i++;
    }

  for(i=0;i<=N-1;i++)
    {
      printf("%d",A[i]);
      if(i<N-1)printf(" ");
    }
  printf("\n%d\n",c);
  
  
  return 0;
}
	  



Measured memory_bytes: 2044
import sys
input = sys.stdin.readline

def lsearch(h): # 左端を探す
    for i in range(len(h)):
        if h[i] != 0:
            return i
    return len(h)-1

def rsearch(h, l): # 右端を探す
    for i in range(l, len(h)):
        if h[i] == 0:
            return i
    return len(h)

n=int(input())
h=list(map(int, input().split()))
cnt=0
while any(h):
    l=lsearch(h)
    r=rsearch(h, l)
    for i in range(l, r):
        h[i] -= 1
    cnt+=1
print(cnt)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
#define rusha() scanf("%d",&n);rep(i,1,n)scanf("%d",&a[i]);
#define rushb() scanf("%d",&t);while(t--)
#define debug(x) cout<<"LBWNB    "<<x<<"---\n"
#define pb push_back
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
#define p() puts("")
#define mem(a,b) memset(a,b,sizeof a)
#define all(x) (x.begin(),x.end())
using namespace std;
typedef long long ll;
const int mod=998244353;
const int inf=1e9+7;
const int maxn=1e6+10;
int t,n,m;
int a[maxn];
int main(){
    double p;
    scanf("%lf",&p);
    printf("%f\n",p*p*p/3/3/3);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    long a,b,c,x;
    cin>>a>>b>>c;
    if(b-1<c) c=b-1;
    x=floor(a*c/b)-a*floor(c/b);
    cout<<x<<endl;
    return 0;
 }

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define LL long long
using namespace std;
vector<vector<int> >g(300050);
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n,m,u,v; cin>>n>>m;
    for(int i=0;i<m;i++)
    {
        cin>>u>>v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    for(auto i:g[1])
        for(auto j:g[i])
            if(j==n)return cout<<"POSSIBLE",0;
    cout<<"IMPOSSIBLE";
}


Measured memory_bytes: 14320
#include<bits/stdc++.h>
using namespace std;
 
#pragma GCC                   target ("avx2")
#pragma GCC                   optimize("Ofast")
#pragma GCC                   optimization ("O3")
#pragma GCC                   optimization ("unroll-loops")
#pragma GCC                   target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define mod                   1000000007
#define INF                   1000000000000000000
#define int                   long long
#define PI                    3.14159265359
#define Author                std::ios_base::sync_with_stdio(0);
#define ABHISHEK_SHARMA       cout.tie(0);
#define IIIT_ALLAHABAD        cin.tie(0);
#define all(v)                v.begin(),v.end()
#define pb(a)                 push_back(a)
#define lb(v,t)               lower_bound(all(v),t)-v.begin()
#define ub(v,t)               upper_bound(all(v),t)-v.begin()
 
clock_t time_p=clock();
 
void abhishhh1(){
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(double)(time_p)/(1.0*CLOCKS_PER_SEC)<<"\n";
}
 
void solve() {
    int k;
    cin>>k;
    string s;
    cin>>s;
    int f=0;
    while(s.length()>k){
        f=1;
        s.pop_back();
    }
    if(f==1){
        cout<<s+"...";
    }
    else{
        cout<<s;
    }
    
}
 
signed main(){
    //file reader-writer
#ifndef ONLINE_JUDGE
   freopen("input.txt","r",stdin);
   freopen("output.txt","w",stdout);
#endif
    //Booster
    Author
    ABHISHEK_SHARMA
    IIIT_ALLAHABAD
    //Driver Code here
    int t=1;
    //cin>>t;
    for(int i=1; i<=t; i++){
        //cout<<"Case #"<<i<<": ";
        solve();
    }
    abhishhh1();
}

Measured memory_bytes: 3784
"""
                            pppppppppppppppppppp
                         ppppp  ppppppppppppppppppp
                      ppppppp    ppppppppppppppppppppp
                      pppppppp  pppppppppppppppppppppp
                      pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
       ppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppp
      pppppppppppppppppppppppppppppppppppppppppppppppp  ppppppppppppppppppppp
     ppppppppppppppppppppppppppppppppppppppppppppppppp  pppppppppppppppppppppp
    ppppppppppppppppppppppppppppppppppppppppppppppp    pppppppppppppppppppppppp
   pppppppppppppppppppppppppppppppppppppppppppppp     pppppppppppppppppppppppppp
  ppppppppppppppppppppppppppppppppppppppppppppp      pppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppppppp               pppppppppppppppppppppppppppppppp
  pppppppppppppppppppppppppppp     pppppppppppppppppppppppppppppppppppppppppppppp
  ppppppppppppppppppppppppppp    pppppppppppppppppppppppppppppppppppppppppppppppp
    pppppppppppppppppppppppp  pppppppppppppppppppppppppppppppppppppppppppppppppp
     ppppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppppp
      pppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppppp
       ppppppppppppppppppppp  ppppppppppppppppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppppp
                              pppppppppppppppppppppppppppppppp
                              pppppppppppppppppppppp  pppppppp
                              ppppppppppppppppppppp    ppppppp
                                 ppppppppppppppppppp  ppppp
                                    pppppppppppppppppppp
"""


import sys
from functools import lru_cache, cmp_to_key
from collections import defaultdict as dd, deque, Counter as C
from bisect import bisect_left as bl, bisect_right as br, bisect
from heapq import heapify, heappop, heappush
from math import ceil, log, floor, sqrt
mod = pow(10, 9) + 7
mod2 = 998244353
def data(): return sys.stdin.readline().strip()
def out(var, end="\n"): sys.stdout.write(str(var)+end)
def outa(*var, end="\n"): sys.stdout.write(' '.join(map(str, var)) + end)
def L(): return list(sp())
def sl(): return list(ssp())
def sp(): return map(int, data().split())
def ssp(): return map(str, data().split())
def l1d(n, val=0): return [val for i in range(n)]
def l2d(n, m, val=0): return [l1d(n, val) for j in range(m)]


a, b, c, d = sp()
answer = max(a * c, b * d, b * c,  d * a)
if a <= 0 <= b or c <= 0 <= d:
    answer = max(answer, 0)
print(answer)


Measured memory_bytes: 68124
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    int x = Integer.parseInt(in.readLine());
    int ans_500 = x/500*1000;
    int ans_5 = (x%500)/5*5;
    System.out.println(ans_500 + ans_5);
  }
}

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

int main()
{
    cin >> a >> b;
    int ans;
    if (b > 0 && a > 0)
    {
        ans = 1;
    }
    else if (b >= 0 && a <= 0)
    {
        ans = 0;
    }

    if (a < 0 && b < 0)
    {
        if ((b - a) % 2 == 0)
        {
            ans = -1;
        }
        else
        {
            ans = 1;
        }
    }

    if (ans == 1)
    {
        cout << "Positive" << endl;
    }
    if (ans == 0)
    {
        cout << "Zero" << endl;
    }
    if (ans == -1)
    {
        cout << "Negative" << endl;
    }
    return 0;
}


Measured memory_bytes: 3600