akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  rep(i,n) p[i]++;
  int mx = 0;
  int s = 0;
  queue<int> q;
  rep(i,n) {
    s += p[i];
    q.push(p[i]);
    if (q.size() > k) {
      s -= q.front(); q.pop();
    }
    if (q.size() == k) {
      mx = max(mx, s);
    }
  }
  double ans = mx;
  ans /= 2;
  printf("%.10f\n", ans);
  return 0;
}


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

int main() {
  int n;
  cin>>n;
  vector<int> v(n);
  rep(i,n) cin>>v[i];
  sort(v.begin(),v.end());
  cout<<v[n-1]-v[0]<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long int;
const ll p =1e9 + 7;
ll modpower(ll base, ll power, ll mod=p){
    ll ans =1;
    base%=p;
    while(power){
        if(power&1){
            ans*=base;
            ans%=p;
        }
        base*=base;
        base%=p;
        power>>=1;
    }
    return ans;
}
vector<ll> fact;
vector<ll> invfact;
void computefactorial(int n){
    ++n;
    fact.resize(n);
    invfact.resize(n);
    fact[0]=1;
    for(int i=1;i<n;i++){
        fact[i]=i*fact[i-1];
        fact[i]%=p;
    }
    invfact[n-1]=modpower(fact[n-1],p-2);
    for(int i=n-2;i>=0;i--){
        invfact[i]=(i+1)*invfact[i+1];
        invfact[i]%=p;
    }
}
inline ll ncr(int n,int r){
    if(r>n || n<0){
        return 0;
    }
    return fact[n] * invfact[r]%p * invfact[n-r]%p;
}
void solve(){
    int h,w,a,b;
    cin>>h>>w>>a>>b;   
    ll ans = ncr((h-1)+(w-1),h-1);
    for(int i=0;i<b;i++){
        ans-=ncr((h-a-1) + (i), i) * ncr((a-1)+(w-i-1),w-i-1);
        ans%=p;
    }
    if(ans<0){
        ans+=p;
    }
    cout<<ans<<"\n";
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    computefactorial(3e5 + 7);
    solve();
}

Measured memory_bytes: 7892
#include <bits/stdc++.h>
#define Nmax 100005
#define pb push_back

using namespace std;

vector <int> L[Nmax];
int grad[Nmax],n,val[Nmax],Bad;
long long dp[Nmax];

inline void dfs(int nod, int tata)
{
    long long sum=0,cnt=0;
    for(auto it : L[nod])
    {
        if(it==tata) continue;
        dfs(it,nod);
        sum+=dp[it];
    }

    if(grad[nod]==1)
    {
        dp[nod]=val[nod]; return;
    }

    long long b = 2LL * (sum-val[nod]);
    long long a = sum-b;

    if(a<0 || b<0)
    {
        Bad=1; return;
    }

    for(auto it : L[nod])
    {
        if(it==tata) continue;
        cnt+=max(0LL,dp[it]-b/2);
    }

    if(cnt>a)
    {
        Bad=1; return;
    }

    dp[nod]=a;
}

int main()
{
    int i,x,y,rad;
    //#ifndef ONLINE_JUDGE
     //   ifstream cin("date.in");
      //  ofstream cout("date.out");
    //#endif
    cin>>n;
    for(i=1;i<=n;++i) cin>>val[i];

    if(n==2)
    {
        if(val[1]==val[2]) cout<<"YES\n";
        else cout<<"NO\n";
        return 0;
    }

    for(i=1;i<n;++i)
    {
        cin>>x>>y;
        L[x].pb(y); L[y].pb(x);
        ++grad[x]; ++grad[y];
    }

    for(rad=1;rad<=n && grad[rad]<=1;++rad);

    dfs(rad,0);

    if(Bad || dp[rad]) cout<<"NO\n";
    else cout<<"YES\n";

    return 0;
}


Measured memory_bytes: 12032
#include<stdio.h>
#include<cstdio>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>

#include<stack>
#include<queue>
#include<time.h>
#include<set>
#include<map>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a,b) for(int i=a;i>b;i--)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;
const ll mod = 998244353;


ll N,X[200001],x[200001];


int main() {
	cin >> N;
	FOR(i, 0, N) {
		cin >> X[i];
		x[i] = X[i];
	}
	sort(X, X + N);

	FOR(i, 0, N) {

		if (x[i] <= X[N / 2 - 1]) {
			cout << X[N / 2 ] << endl;
		}
		else cout << X[N / 2-1] << endl;

	}

	return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REP(i,n) for(int (i)=0;(i)<=(int)(n);(i)++)
#define rep1(i,x,n) for(int (i)=(x);(i)<(int)(n);(i)++)
#define REP1(i,x,n) for(int (i)=(x);(i)<=(int)(n);(i)++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using Int = long long;

//INT_MAX = 2147483647;
//LLONG_MAX = 9223372036854775807;
//ULLONG_MAX = 18446744073709551615;
const int MOD = 1000000007;
const ll INF = numeric_limits<ll>::max();
const int inf = 1e8;
typedef pair<int,int> P;
typedef std::priority_queue<int> IntPrioQueue;
typedef std::priority_queue<int, std::vector<int>, std::greater<int> > IntReversePrioQueue;

//少数点表示
//cout << std::fixed << std::setprecision(14) << 値

int main(){
    cin.tie( 0 ); ios::sync_with_stdio( false );
    int n,m,c;
    cin >> n >> m >> c;
    vector<int> b(m);
    vector<vector<int>> a(n,vector<int>(m));

    rep(i,m) cin >> b[i];
    rep(i,n){
        rep(j,m){
            cin >> a[i][j];
        }
    }

    int ans = 0;
    rep(i,n){
        int cnt = 0;
        rep(j,m){
            cnt+=a[i][j]*b[j];
        }
        cnt+=c;
        if(cnt>0) ans++;
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    int  a, b;
    cin >> a >> b;
    cout << (a*3+b)/2;
    
    cout << endl;
}


Measured memory_bytes: 256
// #pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define String std::string
#define fi first
#define se second
#define mp std::make_pair
#define Pair std::pair<int, int>
#define Map std::map< int, int >
#define Vector std::vector<int>
 
using std::cin;
using std::cout;
using std::endl;
 
typedef long long ll;
typedef unsigned long long ull;
 
const int N = 2000000 + 5;
const int M = 1000 + 5;
const int K = 1e7 + 5;
const int MOD = 1e9 + 7;
const int inv2 = 500000004;
const ull BASE = 19260817;
const int dx[] = { 0, 1, -1, 0, 1, -1, 1, -1 };
const int dy[] = { 1, 0, 0, -1, 1, -1, -1, 1 };
const double PI = acos(-1);
 
template<class T>
inline T readT() {
    T res = 0, f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
    for (; isdigit(ch); ch = getchar()) res = (res << 1) + (res << 3) + ch - '0';
    return res * f;
}
#define read readT<int>

int n, a[55], sum, ans;

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i], sum += a[i];
    ans = sum;
    for (int i = 1; i <= n; i++) {
        ans = std::min(ans, sum - a[i] / 2);
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <string>
using namespace std;
char s [ 4 ];
int main(){
	cin >> s;
	string a = s;
	string b = "B";
	string::size_type idx;
	idx = a.find ( b );
	if ( idx == string::npos )
		cout << "ABC" ;
	else
		cout << "ARC" ;
	return 0;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] syain = new int[N];

        for (int i = 0; i < N - 1; i++) {
            syain[sc.nextInt()-1]++;
        }

        for (int a : syain) {
            System.out.println(a);
        }
    }
}

Measured memory_bytes: 54256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  char c[4][4];
  rep(i, 0, 3) {
    scanf("%s", c[i]);
  }

  printf("%c%c%c\n", c[0][0], c[1][1], c[2][2]);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;
#define int LL

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

int const MAXN = 1e5 + 5;
char T[MAXN];
int cs[MAXN], cr[MAXN], cp[MAXN];

signed main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif

  int n, k, r, s, p;
  cin >> n >> k >> r >> s >> p;
  cin >> (T + 1);
  int ans = 0;
  for (RI i = 1; i <= n; ++i) {
    if (T[i] == 'r') {
      if (i <= k) ans += p, cr[i] = 1;
      else if (!cr[i - k]) ans += p, cr[i] = 1;
    }
    if (T[i] == 's') {
      if (i <= k) ans += r, cs[i] = 1;
      else if (!cs[i - k]) ans += r, cs[i] = 1;
    }
    if (T[i] == 'p') {
      if (i <= k) ans += s, cp[i] = 1;
      else if (!cp[i - k]) ans += s, cp[i] = 1;
    }
  }
  cout << ans << endl;


  return 0;
}

// created by Daniel yuan


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

#define endl '\n'
#define int long long

const int N = 110, W = 1e5+9;
int cache[N][W], items[N][2], n, w;
bool vis[N][W];

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

	cin >> n >> w;
	for(int i = 1; i <= n; i ++) {
		for(int j = 0; j < 2; j ++) {
			cin >> items[i][j];
		}
	}
	vis[0][w] = true;
	for(int i = 1; i <= n; i ++) {
		for(int j = 0; j <= w; j ++) {
			cache[i][j] = cache[i-1][j];
			vis[i][j] = vis[i-1][j];
		}
		for(int j = 0; j <= w; j ++) {
			if(vis[i][j]) {
				if(j - items[i][0] >= 0) {
					cache[i][j-items[i][0]] = max(cache[i][j] + items[i][1], cache[i][j-items[i][0]]);
					vis[i][j-items[i][0]] = true;
				}
			}
		}
	}
	cout << *max_element(cache[n], cache[n] + W) << endl;

	return 0;
}

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

#define MOD 1000000007
template<typename ty1,typename ty2>
inline int add(ty1 x, ty2 y) {
	if(y>=MOD)y%=MOD;
	if(x>=MOD)x%=MOD;
    x += y; return x < MOD ? x : x - MOD;
}
template<typename ty1,typename ty2>
inline void addto(ty1 &x, ty2 y) {
		  if(y>=MOD)y%=MOD;
		  if(x>=MOD)x%=MOD;
	      x += y; if (x >= MOD) x -= MOD;
}
template<typename ty1,typename ty2>
inline int sub(ty1 x, ty2 y) {
		if(y>=MOD)y%=MOD;
		 if(x>=MOD)x%=MOD;
        x -= y; return x < 0 ? x + MOD : x;
}
template<typename ty1,typename ty2>
inline void subto(ty1 &x, ty2 y) {
	if(y>=MOD)y%=MOD;
	if(x>=MOD)x%=MOD;
    x -= y; if (x < 0) x += MOD;
}
template<typename ty1,typename ty2>
inline int mul(ty1 x, ty2 y) {
        if(y>=MOD)y%=MOD;
		if(x>=MOD)x%=MOD;
        return 1ll * x * y % MOD;
}
template<typename ty1,typename ty2>
void multo(ty1 &x, ty2 y) {
        if(y>=MOD)y%=MOD;
		if(x>=MOD)x%=MOD;
        x=1ll * x * y % MOD;
}

#define MOD 1000000007
long long int ppow(long long int i, long long int j){
		long long int res = 1LL;
		while (j){
			if ((j & 1LL)){
				res *= i;
				if (res >= MOD){
					res %= MOD;
				}
			}
			j >>= 1;
			i *= i;
			if (i >= MOD){
				i %= MOD;
			}
		}
		return res;
	}
class Combination{
	
public:
	vector<long long int> k;
	vector<long long int> r;
	void resize(int N){
		k.resize(N + 2);
		r.resize(N + 2);
		k[0] = 1;
		for (int i = 1; i < N+2; i++){
			k[i] = k[i - 1];
			k[i] *= i;
			if (k[i] >= MOD)k[i] %= MOD;
		}
		long long int al = k[k.size() - 1];
		long long int iv = ppow(k[k.size() - 1],MOD-2);
		r[k.size() - 1] = iv;
		for (int i = (int)(r.size()) - 2; i >= 0; i--){
			r[i] = r[i + 1] * (i + 1);
			if (r[i] >= MOD){
				r[i] %= MOD;
			}
		}
	}
	long long int C(int a, int b){
		if (a < b)return 0;
		long long int up = k[a];
		long long int dw = r[b] * r[a - b];
		dw %= MOD;
		up *= dw;
		up %= MOD;
		return up;
	}
	long long int H(int a, int b){
		return C(a + b - 1, b);
	}
	long long int catalan_number(int n){
		return (C(2 * n, n) + MOD - C(2 * n, n - 1)) % MOD;
	}
};
Combination C;

int n;
int h;
int d;

#define MAX 1000002

#define MOD 1000000007

int dp[MAX];


int main(){
	cin>>n>>h>>d;
	C.resize(1000002);
	int way1=0;  //all
	int k=1;
	for(int j=1;j<=n;j++){
		multo(k,j);
		addto(way1,k);
	}
	int way2=1;
	dp[0]=1;
	for(int i=1;i<=n;i++){
		multo(dp[0],i);
	}
	for(int i=1;i<=h;i++){
		int lef=max(i-d,0);
		int rig=i-1;
		int z=dp[rig];
		if(lef){
			subto(z,dp[lef-1]);
		}
		if(i!=h){
			multo(z,way1);
		}
		else{
			multo(z,way2);
		}
		dp[i]=z;
		if(i!=h){
			addto(dp[i],dp[i-1]);
		}
		else{
			printf("%d\n",dp[h]);
		}
	}
	return 0;
}


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

typedef long long ll;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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; }

const long long INF = 1LL << 60;

int main()
{
    ll N, set1, set2, ans = 0;
    cin >> N;
    set2 = N-1;
    repd(i, 2, N) {
        if (N / i == N % i) {
            ans += i;
        }
        set1 = (N / i) + 1;
        if (set1 <= i) break;
        ll mod = N % set2;
        if (mod == i-1) ans += set2;
        else if (mod == 0) ans += (set2-1);
        set2 = set1 - 1; 
    }
    /*

    repd(i, 2, N) {
        if (N / i > i - 1) continue;
        else {
            set = i;
            break;
        }
    }

    repd(i, set, N) {
        if (N / i == N % i) {
            ans += i;
        }
    }

    */
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
/*
author : seryu
title : ABC170D_"Not Divisible"
*/
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define mreps(i,j,n) for(int i = j; i <= n; i++)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(all(x), val), x.end())
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }

//divisors: enumerate divisors
set<ll> divisors(ll n)
{
	set<ll> res;
	for (ll i = 1; i*i <= n; i++)
	{
		if (n % i == 0)
		{
			res.insert(i);
			res.insert(n / i);
		}
	}
	return res;
}

void solve()
{
	int n;
	cin >> n;
	map<int, int> mp;
	vector<int> a(n);
	int a_ma = 0;
	rep(i, n) 
	{
		cin >> a[i];
		mp[a[i]]++;
		chmax(a_ma, a[i]);
	}
	sort(all(a));
	vector<bool> indivisible(a_ma+1, true);
	int ans = 0;
	rep(i, n)
	{
		if(indivisible[a[i]])
		{
			if(mp[a[i]] == 1)ans++;
			int j = 1;
			while (j * a[i] <= a_ma)
			{
				indivisible[j*a[i]] = false;
				j++;
			}
		}
	}
	cout << ans << endl;
	return;	
}

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	solve();
	return 0;
}


Measured memory_bytes: 13520
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <queue>
#include <stack>

using namespace std;

typedef int itn;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef map<int, int> M;
typedef pair<int, int> P;
typedef stack<int> S;
typedef queue<int> Q;

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

    int h, w;
    cin >> h >> w;
    string s[h];
    for (int i = 0; i < h; ++i)
    {
        cin >> s[i];
    }

    int row[h] = {0};
    int col[w] = {0};
    
    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            if (s[i][j] == '#') row[i] = col[j] = 1;
        }
    }

    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            if ((row[i] == 1) && (col[j] == 1)) cout << s[i][j];
        }
        if (row[i] == 1) cout << endl;
    }

    return 0;
}

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

int main() {
  int x, y, z;
  int m;
  cin >> x >> y >> z;
  m = x+y;
  if(y+z < m){m = y+z;}
  if(z+x < m){m = z+x;}
  cout << m << endl;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <numeric>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> Pll;

double dp[301][301][301];
int n;

double solve(int c1, int c2, int c3) {
    if(dp[c1][c2][c3]) return dp[c1][c2][c3];
    if(!c1 && !c2 && !c3) return 0.0;

    double p = double(n)/(c1+c2+c3);
    if(c1) p += solve(c1-1, c2, c3) * double(c1)/(c1+c2+c3);
    if(c2) p += solve(c1+1, c2-1, c3) * double(c2)/(c1+c2+c3);
    if(c3) p += solve(c1, c2+1, c3-1) * double(c3)/(c1+c2+c3);

    return dp[c1][c2][c3] = p;
}

int main() {
    cin >> n;
    int c, count[3] = {};
    for(int i=0;i<n;++i) {
        cin >> c;
        ++count[c-1];
    }

    cout << setprecision(12) << solve(count[0], count[1], count[2]) << "\n";
}

Measured memory_bytes: 213248
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

const double EPS = 1e-8;

int dcmp(double d) {
    if (fabs(d) < EPS) {
        return 0;
    }
    else {
        return d < 0? -1 : 1;
    }
}

struct Vector {
    double x, y;
    Vector(double x = 0, double  y = 0):x(x), y(y) {
    }
    
    bool operator< (const Vector& other) const {
        return dcmp(y - other.y) != 0? y < other.y : dcmp(x - other.x) < 0;
    }
};

typedef Vector Point;

struct PointCmp {
    bool operator()(const Point& a, const Point& b) {
        return (dcmp(a.y - b.y) < 0 || 
                (dcmp(a.y - b.y) == 0 && dcmp(a.x - b.x) < 0));
    }
};

//struct PointCmp1 {
//    bool operator()(const Point& a, const Point &b) {
//        return (dcmp(a.x - b.x) < 0 || 
//                (dcmp(a.x - b.x) == 0 && dcmp(a.y - b.y) < 0));
//    }
//};

Vector operator-(const Vector& a, const Vector& b) {
    return Vector(a.x - b.x, a.y - b.y);
}

double cross(const Vector& a, const Vector& b) {
    return a.x * b.y - a.y * b.x;
}

double ccw(const Point& a, const Point& b, const Point& c) {
    return cross(b - a, c - a);
}

int main() {
    int n; 
    cin >> n;
    vector<Point> p(n);
    
    for (int i = 0; i < n; i++) {
        cin >> p[i].x >> p[i].y;
    }
    sort(p.begin(), p.end());
    
    vector<Point> ch(n + 1);
    int m = 0;
    for (int i = 0; i < n; i++) {
        while (m > 1 && dcmp(ccw(ch[m - 2], ch[m - 1], p[i])) < 0) {
            m--;
        }
        ch[m++] = p[i];
    }
    int k = m;
    for (int i = n - 2; i >= 0; i--) {
        while (m > k && dcmp(ccw(ch[m - 2], ch[m - 1], p[i])) < 0) {
            m--;
        }
        ch[m++] = p[i];
    }
    
    if (n > 1) {
        m--;
    }
    
    cout << m << endl;
    
    for (int i = 0; i < m; i++) {
        cout << ch[i].x << " " << ch[i].y << endl;
    }
    
    return 0;
}

Measured memory_bytes: 6048
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
const ll MAX = 1001001;
const ll MOD = 1000000007;
int main()
{
    ll a;
    cin >> a;
    if (a >= 30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  cin >> a >>b;
  if(b<a){
    for (int i = 0; i < a; i++) {
  cout << b;
}
  }
    else{
      for (int i = 0; i < b; i++) {
  cout <<a;
}
}
  cout <<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

int main()
{
  string stro, str;
  while(getline(cin, stro)){
    for(int i = 0; i < 26; i++){
      str = stro;
      for(int j = 0; j < stro.length(); j++){
	if(str[j] >= 'a' && str[j] <= 'z')
	  if(str[j] + i > 'z')
	    str[j] += i - 26;
	  else
	    str[j] += i;
      }
      std::string::size_type f_the = str.find("the", 0);
      std::string::size_type f_this = str.find("this", 0);
      std::string::size_type f_that = str.find("that", 0);
      if((f_the != string::npos && f_the == 0 && (str[f_the + 3] == ' ' || str[f_the + 3] == '.' || str[f_the + 3] == '\0')) || (f_this != string::npos && f_this == 0 && (str[f_this + 4] == ' ' || str[f_this + 4] == '.' || str[f_this + 4] == '\0')) || (f_that != string::npos && f_that == 0 && (str[f_that + 4] == ' ' || str[f_that + 4] == '.' || str[f_that + 4] == '\0')))
	cout << str << endl;
      else if((f_the != string::npos && (str[(f_the - 1 < 0) ? 0 : f_the - 1] == ' ' || str[(f_the - 1 < 0) ? 0 : f_the - 1] == '.' || str[(f_the - 1 < 0) ? 0 : f_the - 1] == '\n') && (str[f_the + 3] == ' ' || str[f_the + 3] == '.' || str[f_the + 3] == '\0')) || (f_this != string::npos && (str[(f_this - 1 < 0) ? 0 : f_this - 1] == ' ' || str[(f_this - 1 < 0) ? 0 : f_this - 1] == '.' || str[(f_this - 1 < 0) ? 0 : f_this - 1] == '\n') && (str[f_this + 4] == ' ' || str[f_this + 4] == '.' || str[f_this + 4] == '\0')) || (f_that != string::npos && (str[(f_that - 1 < 0) ? 0 : f_that - 1] == ' ' || str[(f_that - 1 < 0) ? 0 : f_that - 1] == '.' || str[(f_that - 1 < 0) ? 0 : f_that - 1] == '\n') && (str[f_that + 4] == ' ' || str[f_that + 4] == '.' || str[f_that + 4] == '\0')))
	cout << str << endl;	 
    }
  }
}

Measured memory_bytes: 1184
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#include <cstring>
using namespace std;
#define FOR(i,a,b) for(int i =(a) ; i <= (b); i++)
#define REP(i,n)  FOR( i, 0, (n) - 1 )

int main(){
    int sum=0,max=0,N,P;
    cin >> N;
    REP(i,N){
        cin >> P;
        sum += P;
        max = std::max(P,max);
    }
    cout << sum - max/2 << endl;
}

Measured memory_bytes: 256
def main():
    N = int(input())
    a = 0
    b = 0

    M = int(N**(1/2))
    for i in range(1, M+1):
        if N%i == 0:
            a = i
            b = (N//i)
    print(a + b - 2)
    return 0
if __name__ == '__main__':
    main()

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

#define forn(l, r) for(int i = l; i < (r); ++i)
#define forj(l, r) for(int j = l; j < (r); ++j)
#define TAM 1000100
#define SYNC ios::sync_with_stdio(0);
#define $ << ' ' <<
#define F first
#define S second
#define endl '\n'


using namespace std;

using ll = long long int;
using ii = pair<int, int>;
using vii = vector<ii>;
using vi = vector<int>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const int MAXN = 112345;
const ll mod = 1000000007;


int main() {
    //SYNC
    double n, k, ans = 0, i;
    cin >> n >> k;
    for (int j = 1; j <= n; ++j) {
        i = j;
        ans += 1.0/n * pow(0.5, max(0.0, ceil(log2(k/i))));
        //cout << 1.0/n << ' ' << ceil(log2(k/i)) << ' ' << pow(0.5, ceil(log2(k/i))) << endl;
    }
    cout << fixed << setprecision(12);
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    long long A, B, C;
    cin >> A >> B >> C;

    long long a = min(min(A, B), C);
    long long b = max(max(A, B), C);
    long long c = A + B + C - a -b;

    long long n = b / 2;
    long long m = b - n;

    cout << abs(a * c * n - a * c * m) << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

string s;
int n, ind[500009];
vector<int> vec[500009];

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> s;
	n = s.length();
	n++;
	for (int i = 0; i < n - 1; i++) {
		if (s[i] == '<') {
			vec[i].pb(i + 1);
			ind[i + 1]++;
		}
		else {
			vec[i + 1].pb(i);
			ind[i]++;
		}
	}
	long long ans = 0;
	queue<int> qu;
	for (int i = 0; i < n; i++) {
		if (ind[i] == 0) {
			qu.push(i);
		}
	}
	int lst = qu.back(), lev = 0;
	while (!qu.empty()) {
		auto cur = qu.front();
		qu.pop();
		ans += lev;
		for (int i = 0; i < (int)vec[cur].size(); i++) {
			ind[vec[cur][i]]--;
			if (ind[vec[cur][i]] == 0) {
				qu.push(vec[cur][i]);
			}
		}
		if (lst == cur && !qu.empty()) {
			lev++;
			lst = qu.back();
		}
	}
	cout << ans << E;
	//system("pause");
	return 0;
}

Measured memory_bytes: 30108
#include<iostream>
using namespace std;
string s;
bool m[500][500] = {}, v[500][500] = {};
bool f(int i, int j){
    if(v[i][j]) return m[i][j];
    v[i][j] = true;
    if(i >= j)  return m[i][j] = true;
    if(s[i] != 'm' || s[j] != 'w')  return m[i][j] = false;
    bool r = false;
    for(int k = i+1; k < j; k++){
        if(s[k] == 'e'){
            r |= (f(i+1, k-1)&&f(k+1, j-1));
        }
    }
    return m[i][j] = r;
}
int main(){
    cin >> s;
    cout << (f(0, s.length()-1) ? "Cat" : "Rabbit") << endl;
    return 0;
}


Measured memory_bytes: 3644
from collections import deque

def main():
    N, *AB = map(int, open(0).read().split())
    A, B = AB[::2], AB[1::2]

    E = [[] for _ in range(N + 1)]
    for a, b in zip(A, B):
        E[a].append(b)

    Q = deque([1])
    C = [0] * (N + 1)
    while Q:
        v = Q.popleft()
        c = 0
        for u in E[v]:
            c += 1 + (c + 1 == C[v])
            C[u] = c
            Q.append(u)

    print(max(C))
    for b in B:
        print(C[b])

main()

Measured memory_bytes: 25900
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const long long MAXN=10005,MOD=1e9+7;
long long h,w,k;
long long a[2][2]={{0,0}
				,{0,0}};
long long tu[MAXN][MAXN];
void mul(long long A[2][2],long long B[2][2],long long C[2][2])
{
	long long D[2][2]={{0}};
	for(long long i=0;i<2;i++)
	{
		for(long long j=0;j<2;j++)
		{
			for(long long k=0;k<2;k++)
			{
				D[i][j]+=(B[i][k]*C[k][j])%MOD;
				D[i][j]%=MOD;
			}
		}
	}
	for(long long i=0;i<2;i++)
		for(long long j=0;j<2;j++)
			A[i][j]=D[i][j];
}
void Ksm(long long re[2][2],long long A[2][2],long long y)
{
	long long k[2][2]={{0}};
	k[0][0]=1;
	k[1][1]=1;
	while(y)
	{
		if(y&1)
			mul(k,k,A);
		mul(A,A,A);
		y>>=1;
	}
	for(long long i=0;i<2;i++)
		for(long long j=0;j<2;j++)
			re[i][j]=k[i][j];
}
long long ksm(long long x,long long y)
{
	long long k=1;
	while(y)
	{
		if(y&1)
			k=(k*x)%MOD;
		x=(x*x)%MOD;
		y>>=1;
	}
	return k;
}
long long v,lr,ud,ev,eh;
int main()
{
	scanf("%lld %lld %lld",&h,&w,&k);
	for(long long i=1;i<=h;i++)
	{
		scanf("\n");
		for(long long j=1;j<=w;j++)
		{
			char c;
			scanf("%c",&c);
			if(c=='#')
			{
				tu[i][j]=1;
				v++;
			}
		}
	}
	for(long long i=1;i<=h;i++)
		if(tu[i][1]==tu[i][w]&&tu[i][1]==1)
			lr++;
	for(long long j=1;j<=w;j++)
		if(tu[1][j]==tu[h][j]&&tu[1][j]==1)
			ud++;
	for(long long i=1;i<=h;i++)
	{
		for(long long j=1;j<=w;j++)
		{
			if(tu[i][j]!=1)
				continue;
			if(tu[i][j]==tu[i][j+1])
				ev++;
			if(tu[i][j]==tu[i+1][j])
				eh++;
		}
	}
	if(lr>0&&ud>0)
	{
		printf("1\n");
		return 0;
	}
	if(lr==0&&ud==0)
	{
		printf("%lld\n",ksm(v,k-1));
		return 0;
	}
	if(lr==0)
	{
		lr=ud;
		ev=eh;
	}
	a[0][0]=lr;
	a[0][1]=ev;
	a[1][0]=0;
	a[1][1]=v;
	Ksm(a,a,k-1);
	long long E=a[0][1],V=a[1][1];
	long long ans=((V-E)%MOD+MOD)%MOD;
	printf("%lld\n",ans);
}

Measured memory_bytes: 78336
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 998244353;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n, k;
    cin >> n >> k;

    ll ans = k;
    rep(i, n-1) {
        ans *= k-1;
    }
    
    out(ans);
    re0;
}

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

int ans = 8 ;
int cube[31] = {} ;
int ans_cube[] = {0,1,1,1,1,1,1,1,1,1,2,2,2,4,4,4,6,6,6,5,5,5,3,3,3,3,3,3,3,3,3} ;

void a(){
	swap(cube[1],cube[24]) ;
	swap(cube[4],cube[27]) ;
	swap(cube[7],cube[30]) ;
	swap(cube[10],cube[21]) ;
	swap(cube[16],cube[18]) ;
}

void b(){
	swap(cube[3],cube[22]) ;
	swap(cube[6],cube[25]) ;
	swap(cube[9],cube[28]) ;
	swap(cube[12],cube[19]) ;
	swap(cube[13],cube[15]) ;
}

void c(){
	swap(cube[1],cube[28]) ;
	swap(cube[2],cube[29]) ;
	swap(cube[3],cube[30]) ;
	swap(cube[15],cube[16]) ;
	swap(cube[19],cube[21]) ;
}

void d(){
	swap(cube[7],cube[22]) ;
	swap(cube[8],cube[23]) ;
	swap(cube[9],cube[24]) ;
	swap(cube[13],cube[18]) ;
	swap(cube[10],cube[12]) ;
}

void f( int k ){
	int cnt = 0 ;
	for( int p=1 ; p<=30 && cube[p] == ans_cube[p] ; p++ ) cnt++ ;
	if( cnt == 30 ) ans = min( ans , k ) ;
	
	if( ans <= k ) return ;
	
	a() ; f(k+1) ; a() ;
	if( ans <= k ) return ;
	
	b() ; f(k+1) ; b() ;
	if( ans <= k ) return ;
	
	c() ; f(k+1) ; c() ;
	if( ans <= k ) return ;
	
	d() ; f(k+1) ; d() ;
	if( ans <= k ) return ;
}

main(){
	int n ;
	cin >> n ;
	for( int i=0 ; i<n ; i++ ){
		for( int j=1 ; j<=30 ; j++ ) cin >> cube[j] ;
		ans = 8 ;
		f(0) ;
		cout << ans << endl ;
	}
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <queue>
#include <set>

using namespace std;

typedef unsigned long long int ULL;
typedef long long LL;
typedef long double LD;

const LL inf = 1000000000000000;
const LL mod = 1000000007;

int main()
{
	LL x, y, z;
	cin >> x >> y >> z;
	if (x+y+z >= 22) {
		cout << "bust\n";
	}
	else {
		cout << "win\n";
	}

}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int n,q;
	long k;
	scanf("%d %ld %d",&n,&k,&q);
	long a[100000] = {0};
	for(int i=0;i<q;i++)
	{
		int x;
		scanf("%d",&x);
		a[x-1] +=1;
	}
	for(int i=0;i<n;i++)
	{
		if((k + a[i] -q)>0)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;
typedef vector<lld> vi;
typedef pair<lld,lld> pi;
#define F first
#define S second
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define rep(i,a,b) for (lld i = a; i < b; i++)
lld a,c,r,j,l,x,y,m,b,n,s,f,q,i,z,p,k,d,t,u,e,g;string s1,s2,s3,s4;
vi v[10000001];
int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin>>x>>y;
  if(x==1)
  {
    if(y==1)
      cout<<1;
    else
      cout<<y-2;
  }
  else if(y==1)
  {
    if(x==1)cout<<1;
    else  cout<<x-2;
  }
  else
  {
    cout<<x*(y)-(2*x+(2*y)-4);
  }
}

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

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ull unsigned ll
#define all(x) x.begin(), x.end()
#define CHECK_BIT(var, pos) ((var) & (1<<(pos)))
#define eb emplace_back
const int M = 1e9 + 7;

typedef long double ldb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef tree<
        pair<int, int>,
        null_type,
        less<pair<int, int>>,
        rb_tree_tag,
        tree_order_statistics_node_update> ordered_set;

int main() {
    int n;
    cin >> n;
    vi v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    int c = 0;
    for (int i = 1; i < n - 1; ++i) {
        if (v[i] > min(v[i], min(v[i - 1], v[i + 1])) && v[i] < max(v[i], max(v[i - 1], v[i + 1])))
            c++;
    }
    cout << c << endl;
}

Measured memory_bytes: 256
import math


A, B, H, M= map(float, input().split())

rad_ji = (H * 30 + M * 0.5)%360
rad_hun = M *6


if abs(rad_ji-rad_hun)==180:
    print(float(A+B))
else:
    if abs(rad_ji-rad_hun)>180:
        ans=math.sqrt(A**2+B**2 - 2*A*B*math.cos(math.radians(360-(rad_ji-rad_hun))))
    else:
        ans=math.sqrt(A**2+B**2 - 2*A*B*math.cos(math.radians(rad_ji-rad_hun)))
    print(ans)
    



Measured memory_bytes: 9456
# -*- coding: utf-8 -*-
x = int(input())
a = 0
b = 0
f = 1
if f == 1:
    for a_ in range(-300, 300):
        if f == 1:
            for b_ in range(-300, 300):
                if a_**5-b_**5==x:
                    f = 0
                    print(a_, b_)
                    break

Measured memory_bytes: 64744
x = int(input())

if 400 <= x <= 599:
    print(8)

if 600 <= x <= 799:
    print(7)

if 800 <= x <= 999:
    print(6)

if 1000 <= x <= 1199:
    print(5)

if 1200 <= x <= 1399:
    print(4)

if 1400 <= x <= 1599:
    print(3)

if 1600 <= x <= 1799:
    print(2)

if 1800 <= x <= 1999:
    print(1)


Measured memory_bytes: 9180
// C - Digits in Multiplication
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
	ll N; cin>>N;
	int ans = 11;
	ll s = sqrt(N);
	for(ll a=1; a<=s; a++)
		if(N%a==0) ans = min(ans, (int)log10(max(a, N/a))+1 );
	cout<< ans <<endl;
}

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


int64_t lcm(int64_t m, int64_t n) {
  if (n==0 || m==0) return m;
  else return m/__gcd(m,n)*n;
}

int main() {
  int64_t n, t1, t2=1; cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> t1;
    t2 = lcm(t1, t2);
  }
  cout << t2 << endl;
}



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

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
template<typename T> void view(T cont) {std::cout << cont << std::endl;}
template<typename T> void view(T* cont, ll sz) {rep(i, sz) std::cout << cont[i] << " "; std::cout << std::endl;}
template<typename T> void view(const std::vector<T>& v) {for (const auto& f: v) std::cout << f << " "; std::cout << std::endl;}
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v: vv) {view(v);}}
#define INF 1000000000

int main(){
    ll N, W; cin >> N >> W;
    vector<ll> w;
    vector<ll> v;
    rep(i, N) {
        int temp_w, temp_v;
        cin >> temp_w >> temp_v;
        w.push_back(temp_w);
        v.push_back(temp_v);
    }
    ll v_sum = accumulate(v.begin(), v.end(), 0LL);
    // view(v_sum);
    vector<vector<ll> > dp(N + 1, vector<ll>(v_sum + 1, INF));
    // view(dp);
    dp[0][0] = 0;
    for (ll i = 0; i < N; i++) {
        for (ll vv = 0; vv <= v_sum; vv++) {
            if (vv >= v[i]) {
                // i+1から始めることで、普通にN回のループでDPテーブルを埋められる。
                // cout << dp[i][vv - v[i]] + w[i] << endl;
                dp[i + 1][vv] = min(dp[i][vv - v[i]] + w[i],
                                    dp[i][vv]);
            } else {
                dp[i + 1][vv] = dp[i][vv];
            }
        }
        // view(dp);
    }
    // view(dp);
    // ll max_v = 0;
    // rep(i, N+1) {
    //     ll temp_max_v = upper_bound(dp[i].begin(), dp[i].end(), W) - dp[i].begin();
    //     if (temp_max_v > max_v) max_v = temp_max_v;
    // }
    // for (int i = 0; i < dp.size(); i++) {
    //     for (int j = 0; j < dp[i].size(); j++) {
    //         if (dp[i][j] == INF) {
    //             cout << "INF" << " ";
    //         } else {
    //             cout << dp[i][j] << " ";
    //         }
    //     }
    //     cout << endl;
    // }
    int max_v;
    for (int i = 0; i < dp[N].size(); i++) {
        if (dp[N][i] <= W) {
            max_v = i;
        }
    }
    cout << max_v << endl;
    // rep(i, v_sum) {
    //     cout << dp[N][i] << endl;
    //     // if (dp[N][i] > W) {
    //     //     cout << i - 1 << endl;
    //     //     break;
    //     // }
    // }
    // view(max_v);
    // cout << dp[W] << endl;
    // for (int i = 0; i < v_sum)
}

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

int main(){
	stack<int> b,c;
	int n;
	cin>>n;

	for(int i=0;i<n;i++){
		bool flag=true;
		b.push(0);c.push(0);
		for(int j=0;j<10;j++){
			int t;
			cin>>t;
			if(b.top()<t && c.top()<t){
				if(b.top()>c.top()) b.push(t);
				else c.push(t);
			}
			else if(b.top()<t){
				b.push(t);
			}
			else if(c.top()<t){
				c.push(t);
			}
			else {
				flag=false;
			}
		}
		cout<<(flag?"YES":"NO")<<endl;

		while(!b.empty()) b.pop();
		while(!c.empty()) c.pop();
	}
	return 0;
}

Measured memory_bytes: 1192
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
constexpr int MOD=1000000007;
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
#define fi first
#define se second
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};
const int MAX_N=2e5+5;

int main(void){
    lint N;
    cin >> N;
    lint A[N];
    rep(i,N-1) cin >> A[i];
    lint ans[N]={};
    rep(i,N-1) ans[A[i]-1]++;
    rep(i,N) cout << ans[i] << endl;
}

Measured memory_bytes: 6740
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <chrono>

using namespace std;
using namespace chrono;
 
typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

//#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define loop(x,n) for(int x = 0; x < n; ++x)
#define FORd(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto& a : x)

#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound

#define sz(x) (int)x.size()
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize

const int MOD = 1000000007; // 998244353
const ll INF = 1e18;
const int MX = 100001;

string get_str() {
    string temp;
    cin >> temp;
    return temp;
}
int get_int() {
    int temp;
    cin >> temp;
    return temp;
}




int main() {
    
    int a; cin >> a; cout << a + a*a + a*a*a << endl;

}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
#define int long long
typedef long long ll;
using namespace std;

const int K = 5555;
int od[K], d[K];
int k, q, n, x, m;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> k >> q;
    rep(i, 0, k - 1) {
        cin >> od[i];
    }
    while(q--) {
        cin >> n >> x >> m;
        rep(i, 0, k - 1) {
            d[i] = od[i] % m;
        }
        int a = x;
        rep(j, 0, k - 1) {
            a += (n - 1) / k * d[j];
            if((n - 1) % k > j) {
                a += d[j];
            }
        }
        int b = 0;
        rep(j, 0, k - 1) {
            if(d[j]) continue;
            b += (n - 1) / k;
            if((n - 1) % k > j) {
                b++;
            }
        }
        int ans = n - 1 - (a / m - x / m) - b;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define REP1(i,n) for(int i=1;i<=(int)(n);i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;

int main(){
  double n,d;
  cin >> n >> d;
  int cnt=0;
  vector<vector<double>> in(n,vector<double>(2,0));
  REP(i,n){
    cin >> in.at(i).at(0);
    cin >> in.at(i).at(1);
  }
  double dst=0;
  REP(i,n){
    dst=0;
    dst=sqrt(in.at(i).at(0)*in.at(i).at(0) + in.at(i).at(1)*in.at(i).at(1));
    if(dst<=d)cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 14464
fun main(args: Array<String>) {
    val mod = 998244353L

    val (N, S) = readInputLine().split(" ").map { it.toInt() }
    val AArr = readInputLine().split(" ").map { it.toInt() }.toIntArray()
    
    val dp = LongArray(2 * (S + 1) * 3)
    dp[0] = 1L

    for (i in 0 until N) {
        for (j in 0..S) {
            dp[(i + 1) % 2 * (S + 1) * 3 + j * 3] = 0L
            dp[(i + 1) % 2 * (S + 1) * 3 + j * 3 + 1] = 0L
            dp[(i + 1) % 2 * (S + 1) * 3 + j * 3 + 2] = 0L
        }
        for (j in 0..S) {
            dp[(i + 1) % 2 * (S + 1) * 3 + j * 3] += dp[i % 2 * (S + 1) * 3 + j * 3]
            dp[(i + 1) % 2 * (S + 1) * 3 + j * 3] %= mod
            dp[(i + 1) % 2 * (S + 1) * 3 + j * 3 + 1] += dp[i % 2 * (S + 1) * 3 + j * 3] + dp[i % 2 * (S + 1) * 3 + j * 3 + 1]
            dp[(i + 1) % 2 * (S + 1) * 3 + j * 3 + 1] %= mod
            dp[(i + 1) % 2 * (S + 1) * 3 + j * 3 + 2] += dp[i % 2 * (S + 1) * 3 + j * 3] + dp[i % 2 * (S + 1) * 3 + j * 3 + 1] + dp[i % 2 * (S + 1) * 3 + j * 3 + 2]
            dp[(i + 1) % 2 * (S + 1) * 3 + j * 3 + 2] %= mod

            if (j + AArr[i] <= S) {
                dp[(i + 1) % 2 * (S + 1) * 3 + (j + AArr[i]) * 3 + 1] += dp[i % 2 * (S + 1) * 3 + j * 3] + dp[i % 2 * (S + 1) * 3 + j * 3 + 1]
                dp[(i + 1) % 2 * (S + 1) * 3 + (j + AArr[i]) * 3 + 1] %= mod
                dp[(i + 1) % 2 * (S + 1) * 3 + (j + AArr[i]) * 3 + 2] += dp[i % 2 * (S + 1) * 3 + j * 3] + dp[i % 2 * (S + 1) * 3 + j * 3 + 1]
                dp[(i + 1) % 2 * (S + 1) * 3 + (j + AArr[i]) * 3 + 2] %= mod
            }
        }
    }

    println(dp[N % 2 * (S + 1) * 3 + S * 3 + 2])
}

fun readInputLine(): String {
    return readLine()!!
}


Measured memory_bytes: 38408
N=int(input())
X=[]

for i in range(0,N):
    S,P=input().split()
    P=int(P)
    X.append([S,P,i+1])

X.sort()

for i in range(0,N-1):
    for j in range(i+1,N):
        if X[i][0]==X[j][0]:
            if X[i][1]<X[j][1]:
                tmp=X[i]
                X[i]=X[j]
                X[j]=tmp

for i in range(0,N):
    print(X[i][2])

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define X first
#define Y second
#define pb push_back
#define max_el(x) max_element(x.begin(),x.end())-x.begin()
#define min_el(x) min_element(x.begin(),x.end())-x.begin()
#define mp make_pair
#define endl '\n'
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
using namespace std;
// DONT USE MEMSET, USE VECTORS

int main(){
	fastread;
	ld l;
	cin>>l;
	ld s = l/3;
	ld v = s*s*s;
	cout<<fixed<<setprecision(10);
	cout<<v<<endl;
	return 0;
}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    
    int k = -1;
    for (int i = 1; i < 500; i++) {
        if (i * (i - 1) / 2 == n) {
            k = i;
            break;
        }
    }
    
    if (k == -1) {
        cout << "No" << endl;
        return 0;
    }
    
    vector<int> s[k];
    int x = 0;
    for (int i = 0; i < k; i++) {
        for (int j = i + 1; j < k; j++) {
            x++;
            s[i].push_back(x);
            s[j].push_back(x);
        }
    }
    
    cout << "Yes" << endl;
    cout << k << endl;
    for (int i = 0; i < k; i++) {
        cout << s[i].size();
        for (int j : s[i]) {
            cout << " " << j;
        }
        cout << endl;
    }
    
    return 0;
}

Measured memory_bytes: 2304
s = input()
gp = []
boundary = [0]
ln = len(s)
for i in range(ln - 1):
	ss = s[i:i + 2]
	if ss == 'RL':
		gp.append(i + 1)
	if ss == 'LR':
		boundary.append(i + 1)
boundary.append(ln)
ans = []
group = 0
for i in range(ln):
	if i != gp[group]:
		ans.append('0')
		if i == boundary[group + 1]:
			group += 1
		continue
	gl = boundary[group + 1] - boundary[group]
	evens = (gl + 1) // 2
	odds =  gl // 2
	ans[i - 1] = str(evens if (i - boundary[group]) % 2 else odds)
	ans.append(str(odds if (i - boundary[group]) % 2 else evens))
print(' '.join(ans))


Measured memory_bytes: 14060
#include <bits/stdc++.h>
#define fst first
#define snd second
#define rep(n) for(lint I = 0; (I) < (lint)(n); ++(I))
#define repeat(i, n) for(lint i = 0; (i) < (lint)(n); ++(i))
#define repeat_to(i, n) for(lint i = 0; (i) <= (lint)(n); ++(i))
#define repeat_from(i, m, n) for(lint i = (m); (i) < (lint)(n); ++(i))
#define repeat_from_to(i, m, n) for(lint i = (m); (i) <= (lint)(n); ++(i))
#define repeat_reverse_from_to(i, m, n) for(lint i = (m); (i) >= (lint)(n); --(i))
#define el cout<<endl
#define dump(x) cout<<" "<<#x<<"="<<x
#define vdump(v) for(size_t I=0; I<v.size(); ++I){cout<<" "<<#v<<"["<<I<<"]="<<v[I];} cout<<endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    int n, z, w;
    cin >> n >> z >> w;
    vector<int> a(n);
    repeat (i, n) cin >> a[i];
    if (n == 1) cout << abs(a[0] - w);
    else cout << max(abs(a[n-1] - w), abs(a[n-2] - a[n-1]));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

// increment
#define rep_n(_1, _2, _3, NAME, ...) NAME
#define rep_2(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep_3(i, initial, n) for (int i = (int)(initial); i < (int)(n); ++i)
#define repeat(...) rep_n(__VA_ARGS__, rep_3, rep_2, rep_1)(__VA_ARGS__)
// decrement
#define rep_r_n(_1, _2, _3, NAME, ...) NAME
#define rep_r_2(i, n) for (int i = (int)(n); i > 0; i--)
#define rep_r_3(i, initial, n) for (int i = (int)(initial); i > (int)(n); i--)
#define repeat_r(...) rep_r_n(__VA_ARGS__, rep_r_3, rep_r_2)(__VA_ARGS__)
// define variable
using namespace std;
typedef long long ll;
using mpint = boost::multiprecision::cpp_int; // 多倍長整数（任意精度）
typedef pair<int, int> P;
const double EPS = numeric_limits<double>::epsilon();
// 最大公約数
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// 最小公倍数
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
// char -> int
int ctoi(char c) { return (int)(c - '0'); }

int main() {
	int N;
	cin >> N;

	vector<ll> a;
	repeat(i, N) {
		ll n = 0;
		cin >> n;

		if ((n % 2) == 0) {
			a.push_back(n);
		}
	}
	
	ll result = 0;

	repeat(i, a.size()) {
		while (a[i]%2 == 0) {
			a[i] /= 2;
			result++;
		}
	}

	cout << result << endl;
	return 0;
}


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


def log(*args):
    print(*args, file=sys.stderr)


def main():
    n = int(input())
    ss = []
    for _ in range(n):
        ss.append(sorted(input().strip()))
    mapList = [dict() for _ in range(n)]
    for i in range(ord('a'), ord('z') + 1):
        c = chr(i)
        for j in range(len(ss)):
            s = ss[j]
            mapList[j][c] = 0
            for ch in s:
                if ch == c:
                    mapList[j][c] += 1
                else:
                    break
            ss[j] = ss[j][mapList[j][c]:]
    ans = ''
    for i in range(ord('a'), ord('z') + 1):
        c = chr(i)
        count = 100
        for map in mapList:
            count = min(count, map[c])
        ans += c * count
    print(ans)


if __name__ == '__main__':
    main()


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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int64_t> H(N);
  int64_t attack = 0;
  for (int i = 0; i < N; i++){
    cin >> H[i];
  }
  sort(H.begin(), H.end());
  if (N > K){
    for (int i = 0; i < N - K; i++){
      attack += H[i];
    }
    cout << attack << endl;
  }
  else{
    cout << 0 << endl;
  }
}


Measured memory_bytes: 1792