akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<sstream>
#include<cmath>
#include<climits>
#include<algorithm>
#include<bitset>
#include<set>
#include<stack>
#include<queue>
#include<iomanip>
#include<memory.h>
#include<complex>
using namespace std;  

// type
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef tuple<int,int> tii;

// define & const valur
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pb push_back
#define mt make_tuple
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-5;
const double PI = M_PI; 
#define DIV int(1e9+7)
// for debug 
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
// useful func
inline ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if((n&1)==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}
 
/* Coding Space*/
string F(string s){
  rep(i,s.size())
    if(s[i] == '?')
      s[i] = 'a';
  return s;
}
int main(){
  string s,t; cin >> s >> t;
  int ss = s.size();
  rep(i,51)
    s = s + " ";
  set<string> ans;
  for(int i = ss-1; i >= 0; i--){
    string ts = s;
    for(int j = 0;j < (int)t.size(); j++){
      if(s[i+j] != t[j] && s[i+j] != '?')  break;
      else ts[i+j] = t[j];
      if(j == (int)t.size()-1)  ans.insert(ts);
    }
  }
  if(ans.size() > 0)
    cout << F(*ans.begin()).substr(0,ss) << endl;
  else
    cout << "UNRESTORABLE" << endl;
}

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

int main(){
  
  int N,i;
  cin >> N;
  long long A[N];
  long long sq[N];
  rep(i,N){
    cin >> A[i];
    sq[i]=0;
  }
  sort(A,A+N);
  int n=0;
  for(i=N-1;i>0;i--){
    if(A[i]==A[i-1]){
      sq[n]=A[i];
      n+=1;
    }
  }

  for(i=1;i<N;i++){
    if(sq[i-1]!=sq[i]){
      long long h= sq[i-1];
      long long w= sq[i];
      cout << h*w << endl;
      return 0;
    }else if(sq[i-1]==sq[i] && sq[i]==sq[i+1]){
      long long h2= sq[i-1];
      long long w2= sq[i];
      cout << h2*w2 << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  
  return 0;
}
 

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

typedef pair<int,int> P;

int main() {
    int N;
    while (cin >> N, N) {
        vector<vector<P> > rank(11);
        vector<int> univ_id(1001);

        for (int c = 0; c < N; c++) {
            int i, u, a, p;
            cin >> i >> u >> a >> p;
            rank[a].push_back(P(p,i));
            univ_id[i] = u;
        }

        for (auto& i : rank)
            sort(i.begin(), i.end());

        int count = 0;
        vector<int> univ_cnt(1001);
        for (int i = 10; i > -1; i--) {
            for (auto team : rank[i]) {
                int I = team.second;
                int pena = team.first;
                int limit = 0;
                if (count < 10) limit = 3;
                else if (count < 20) limit = 2;
                else if (count < 26) limit = 1;
                else limit = 0;
                if (univ_cnt[univ_id[I]] < limit) {
                    cout << I << endl;
                    univ_cnt[univ_id[I]]++;
                    count++;
                }
            }
        }
    }

    return 0;
}

Measured memory_bytes: 3020
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

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

	if (s == "Sunny")
	{
		cout << "Cloudy";
	}
	else if (s == "Cloudy")
	{
		cout << "Rainy";
	}
	else
	{
		cout << "Sunny";
	}
	cout << endl;
}

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

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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;

ll MAX = 1e15;
double PI = 3.141592653589793238463;
//double PI = acos(-1);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;



void solve(){
    ll n;
    cin >> n;
    vector<pair<ll,ll>> nums(n);
    vector<ll> L(n), R(n);
    for(ll i=0; i<n; i++){
        ll l,r;
        cin >> l >> r;
        nums[i] = {l,r};
        L[i]=l;
        R[i]=r;
    }
    sort(nums.begin(), nums.end());
    sort(L.begin(), L.end());
    sort(R.begin(), R.end());
    if(n%2==0){
        ll idx1 = n/2-1, idx2 = n/2;
        ll l1 = L[idx1], r1 = R[idx1], l2 = L[idx2], r2 = R[idx2];
        ll l = l1+l2, r=r1+r2;
        cout << r-l+1;
    }
    else {
        ll idx = (n+1)/2-1;
        ll l = L[idx];
        ll r = R[idx];
        cout << r-l+1;


    }


}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif


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


    return 0;
}


Measured memory_bytes: 9520
#include <string>
#include <vector>
#include <iomanip>
#include <iostream>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
int n; long long a[100009], b[100009];
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
	long long ans = 1LL << 60;
	for (int i = 0; i < 2; i++) {
		string t;
		long long s = 0, ret = 0;
		for (int j = 0; j < n; j++) t += ((i + j) % 2 ? '+' : '-'), b[j] = a[j];
		for (int j = 0; j < n; j++) {
			if (t[j] == '+') {
				if (s + b[j] <= 0) {
					long long d = 1 - (s + b[j]);
					b[j] += d;
					ret += d;
				}
				s += b[j];
			}
			else {
				if (s + b[j] >= 0) {
					long long d = (s + b[j]) + 1;
					b[j] -= d;
					ret += d;
				}
				s += b[j];
			}
		}
		ans = min(ans, ret);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2076
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = (int)1e9 + 7;

int f(int n){
    int ret = 0;
    while(n > 0){
        ret += n % 10;
        n /= 10;
    }
    return ret;
}


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a, b;
    cin >> n >> a >> b;
    LL ans = 0;
    REP(i, n){
        int tmp = f(i+1);
        if(tmp >= a && tmp <= b) ans += i+1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var ar = new int[num + 2];
        ar[0] = 0;
        ar[num + 1] = 0;
        var a = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        for (var i = 0; i < num; i++)
            ar[i + 1] = a[i];
        var sum = 0;
        for (var i = 0; i < num + 1; i++)
            sum += Abs(ar[i] - ar[i + 1]);
        for(var i = 0; i < num; i++)
        {
            var s = sum;
            s += Abs(ar[i] - ar[i + 2]) - (Abs(ar[i] - ar[i + 1]) + Abs(ar[i + 1] - ar[i + 2]));
            WriteLine(s);
        }
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}

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

using namespace std;

#define INF (int)(1e9)

// Relevant constraints
// 2 <= N <= 10^5
// 1 <= K <= 100
// 2 secs

// Generalized version of frog1
// to K possible steps instead of 2
// Naturally, this turns the complexity
// required from O(n) to O(nK)
// This is acceptable for our constraints

// Recurrence to optimize:
// c(n) = min({c(n - 1) + cost(n, n - 1), c(n - 2) + cost(n, n - 2), ...,
//             c(n - k) + cost(n, n - k)})

// It doesn't matter how we use K in the future
// so that parameter is irrelevant for larger values
// and doesn't need to be stored
unordered_map<int, int> map_dp;
int solve_memo(const vector<int> &h, int n, int k) {
	if (n < 0)
		return INF;
	if (n == 0)
		return 0;
	if (map_dp.find(n) != map_dp.end())
		return map_dp[n];

	int min_n = INF;
	for (int i = 1; i <= k; ++i) {
		// don't access h out of bounds
		if (n - i < 0)
			break;

		min_n = min(min_n,
			    solve_memo(h, n - i, k) + abs(h[n] - h[n - i]));
	}

	return map_dp[n] = min_n;
}

int solve_tab(const vector<int> &h, int n, int k) {
	vector<int> dp(n);

	// Initial conditions
	dp[0] = 0;
	dp[1] = abs(h[0] - h[1]);

	for (int i = 2; i < n; ++i) {
		int min_n = INF;
		for (int j = 1; j <= k; ++j) {
			if (i - j < 0)
				break;

			min_n = min(min_n, dp[i - j] + abs(h[i] - h[i - j]));
		}
		dp[i] = min_n;
	}

	// dp[n - 1] represents the minimum cost
	// to get to stone n
	// in general dp[i] represents the minimum
	// cost to get to stone i
	return dp[n - 1];
}

int main() {

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

	int n, k;
	cin >> n >> k;

	vector<int> h(n);
	for (int i = 0; i < n; ++i) {
		cin >> h[i];
	}

	// n - 1 to accomodate the array size
	cout << solve_memo(h, n - 1, k) << '\n';
	// cout << solve_tab(h, n, k) << '\n';

	return 0;
}


Measured memory_bytes: 11044
#include <cstdio>
int N, Y;

int ans[3] = {-1, -1, -1};

int main()
{
    scanf("%d", &N);
    scanf("%d", &Y);
    Y /= 1000;
    int rest;
    int rest_z;
    for (int z = Y / 10; z >= 0; z--) {
        rest = Y - 10 * z;
        rest_z = N - z;

        if (rest > 5 * rest_z) {
            break;
        }
        if (rest < rest_z) {
            continue;
        }
        if ((rest - N + z) % 4 == 0) {
            ans[1] = (rest - (N - z)) / 4;
            ans[2] = rest - ans[1] * 5;
            ans[0] = z;
            break;
        }
    }
    printf("%d %d %d", ans[0], ans[1], ans[2]);

    return 0;
}


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

   typedef long long ll;
   typedef pair<ll, ll> Pii;
   typedef vector<ll> Vi;
   typedef vector<Vi> VVi;

   const double EPS = (1e-7);
   const ll INF =(1e13);
   const double PI = (acos(-1));
   const ll MOD = ll(1e9) + 7;

   #define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
   #define REPR(i, n) for(ll i = n; i > -1; i--)
   #define FOR(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
   #define ALL(x) (x).begin(),(x).end()
   #define SORT(x) sort((x).begin(), (x).end())
   #define RSORT(x) sort((x).rbegin(), (x).rend())
   #define REVERSE(x) reverse((x).begin(), (x).end())
   #define SZ(x) ((ll)(x).size())
   #define pb push_back
   #define mp make_pair

   //chmax(a, b): a>bならaをbで更新　更新したときにtrueを返す
   //chmin(a, b): a<bならaをbで更新　更新したときにtrueを返す
   template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
   template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

   #define dump(x) cerr<< #x << "= " << (x) << endl;

   ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
   ll pow(ll a, ll b){if (b == 0) return 1; else if (b % 2 == 0) return pow(a * a, b / 2); else return pow(a * a, b / 2) * a;}
   ll pow(ll a, ll b, ll m){if (b == 0) return 1; else if (a == 0) return 0; else if (b % 2 == 0) return (pow((a * a) % m, b / 2, m) % m); else return (pow((a * a) % m, b / 2, m) * a) % m;}
   ll residue(ll a, ll m){return ((a % m) + m) % m;};

   ll dx[4]={1,0,-1,0};
   ll dy[4]={0,1,0,-1};
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n; cin >> n;
  Vi s(n); REP(i,n) cin >> s[i];
  ll ans = 0;
  for(ll k = 1 ; k < n; k++){
    if((n - 1) % k != 0){
      ll temp = 0;
      for(ll j = 0; j + k < n; j += k){
        temp += s[j] + s[n - 1 - j];
        chmax(ans, temp);
      }
    }
    else{
      ll temp = 0;
      for(ll j = 0; j < n - 1 - j; j += k){
        temp += s[j] + s[n - 1 - j];
        chmax(ans, temp);
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 1024
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>

using namespace std;

int main(void) {
   string S;
   cin>>S;
   int A=0;
   for(int i=0;i<3;i++){
       if(S[i]=='o'){
           A++;
       }
   }

   cout<<700+A*100<<endl;

}


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

int main(){
    long long N,M;
    cin >> N >> M;
    vector<ll> A(N),S(N+1,0);
    rep(i,N){
        cin >> A[i];
    }
    sort(A.begin(), A.end(), greater<int>());
    S[0] = A[0];
    rep(i,N-1){
        S[i+1] = S[i] + A[i+1];
        //cout << S[i+1] << endl;
    }
    ll L=0, R=1e10+10;
    while(L+1 < R){
        ll X = (L+R)/2;
        ll tot = 0;
        rep(i,N){
            ll l=-1,r=N;
            while(l+1 < r){
                int m = (l+r)/2;
                if(A[i]+A[m] >= X){
                    l = m;
                }else{
                    r = m;
                }
            }
            tot += l+1;
        }
        if(tot <= M){
            R = X;
        }else{
            L = X;
        }
    }
    ll X = R;
    //cout << X << endl;
    ll sum = 0,tot = 0;
    rep(i,N){
        ll l=-1,r=N;
        while(l+1 < r){
            int m = (l+r)/2;
            if(A[i]+A[m] >= X){
                l = m;
            }else{
                r = m;
            }
        }
        sum += (l+1)*A[i];
        if(l >= 0){
            sum += S[l];
        }
        
        tot += l+1;
    }
    if(tot < M){
        sum += L*(M-tot);
    }
    cout << sum << endl;
}


Measured memory_bytes: 1792
def d(p):
    return sum(abs(x[i] - y[i]) ** p for i in range(n)) ** (1 / p)


n = int(input())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
print(d(1), d(2), d(3), max([abs(x[i] - y[i]) for i in range(n)]), sep="\n")



Measured memory_bytes: 5652
a, b, c = gets.strip.split.map(&:to_i)
min, mid, max = [a, b, c].sort

ans = (max - mid) / 2 + (max - min) / 2

p = [(max - mid) % 2, (max - min) % 2].inject(&:+)
if p == 1
  puts ans + 2
elsif p == 2
  puts ans + 1
else
  puts ans
end


Measured memory_bytes: 1788
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  
  int n;
  cin>>n;
  std::vector<int64_t> a(n+1);
  std::vector<int64_t> b(n);
  for(int i=0;i<n+1;i++){
    cin>>a[i];
  }
  for(int i=0;i<n;i++){
    cin>>b[i];
  }
  
  int64_t result=0;
  for(int p=n-1;p>=0;p--){
    if(a[p+1]>=b[p]){
      a[p+1]-=b[p];
      result+=b[p];
      b[p]=0;
    }else{
      result+=a[p+1];
      b[p]-=a[p+1];
      a[p+1]=0;
      if(a[p]>=b[p]){
        result+=b[p];
        a[p]-=b[p];
        b[p]=0;
      }else{
        result+=a[p];
        b[p]-=a[p];
        a[p]=0;
      }
    }
  }
  
  cout<<result<<endl;
  

  return 0;
}


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


void solve(long long N){
    cout << pow(N, 3) << endl;
}

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


Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010


int main(){
  int n, m;
  ll x[SIZE], y[SIZE], z[SIZE];
  ll ans = 0;
  
  scanf("%d%d", &n,&m);

  for(int i=0;i<n;i++){
    scanf("%lld%lld%lld", x+i, y+i, z+i);
  }

  for(int i=-1;i<=1;i+=2){
    for(int j=-1;j<=1;j+=2){
      for(int k=-1;k<=1;k+=2){
        ll calc = 0;
        vector<ll> vec;
        
        
        for(int p=0;p<n;p++){
          vec.push_back((ll)x[p]*i + y[p]*j + z[p]*k);        
        }

        sort(vec.begin(), vec.end(), greater<ll>());

        for(int p=0;p<m;p++){
          calc += vec[p];
        }

        ans = max(ans, calc);
        
      }
    }
  }

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



Measured memory_bytes: 2304
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <iomanip>
#include <cassert>

using namespace std;
typedef long long ll;

int main()
{
   ll N, Q;
   cin >> N >> Q;
   set<pair<int, int>> tate;
   set<pair<int, int>> yoko;
   tate.insert(make_pair(N, N));
   yoko.insert(make_pair(N, N));
   long long ans = 0;
   for (int i = 0; i < Q; i++)
   {
      int op, x;
      cin >> op >> x;
      if (op == 1)
      {
         auto it = tate.lower_bound(make_pair(x, 0));
         int bound = (*it).second;
         ans += bound - 2;
         yoko.insert(make_pair(bound, x));
      }
      else
      {
         auto it = yoko.lower_bound(make_pair(x, 0));
         int bound = (*it).second;
         ans += bound - 2;
         tate.insert(make_pair(bound, x));
      }
   }
   cout << (N - 2) * (N - 2) - ans << endl;
   return 0;
}


Measured memory_bytes: 12940
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var K = int.Parse(Console.ReadLine());
            var balls = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var total = 0;
            foreach (var ball in balls)
            {
                total += Math.Min(ball, Math.Abs(K - ball)) * 2;
            }
            Console.WriteLine(total);
        }
    }
}


Measured memory_bytes: 13396
#include <stdio.h>

int main(void) {
    int x, y, tmp;
    while (1) {
        scanf("%d %d", &x, &y);
        if (x == 0 && y == 0) break;
        if (y < x) {
            tmp = x;
            x = y;
            y = tmp;
        }
        printf("%d %d\n", x, y);
    }
    return 0;
}


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

typedef long long ll;
const ll MOD = 1e9 + 7;
const ll inf = 1LL<<60;
const double eps = 1e-9;

int main()
{
    int n;
    cin >> n;
    cout << n*n*n << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(int argc, char const *argv[])
{
	char N[4];
	scanf("%s",N);
	int i;
	for(i=0;i<4;i++) {
		if (N[i+1]=='\0') {
			break;
		}
	}
	if (N[i]=='2' || N[i]=='4' ||N[i]=='5' ||N[i]=='7' ||N[i]=='9') {
		printf("hon\n");
	}else if(N[i]=='0' ||N[i]=='1' ||N[i]=='6' ||N[i]=='8') {
		printf("pon\n");
	}else{
		printf("bon\n");
	}

	return 0;
}


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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VC> VVC;
typedef vector<VB> VVB;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef pair<LL,LL> PLL;
typedef vector<PII> VPII;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define PF push_front
#define POB pop_back()
#define POF pop_front()
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define LB lower_bound
#define UB upper_bound
#define SORTR(c) sort((c).begin(), (c).end(), greater<int>())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define FORR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REPR(i,n) RFOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = INT_MAX;
const LL LINF = LLONG_MAX;
const LL MOD = 1e9+7;
const LL MODD = 998244353;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()

VI dx = {1,0,-1,0};
VI dy = {0,1,0,-1};

LL Gcd(LL a, LL b) {
  return __gcd(a,b);
}

LL Lcm(LL a, LL b) {
  LL abd = Gcd(a,b);
  LL x = a / abd, y = b / abd;
  
  return x*y*abd;
}


LL RepSqu(LL N, LL P, LL M) {
  if(N == 0) {
    return 0;
  }
  
  if(P == 0) {
    return 1;
  }
  if(P%2 == 0) {
    LL t = RepSqu(N, P/2, M);
    return t*t % M;
  }
  return (N * RepSqu(N, P-1, M)) % M;
}


int main() {
  
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N, D;
  cin >> N;
  
  LL ans=1;
  
  VLL T(N,0), A(N);
  
  REP(i,N){
    cin >> D;
    T.at(D)++;
    A.at(i) = D;
  }
  
  if(T.at(0) != 1) {
    cout << 0 << endl;
    return 0;
  }
  if(A.at(0) != 0){
    cout << 0 << endl;
    return 0;
  }
  
  FOR(i,1,N){
    ans *= T.at(A.at(i)-1);
    ans %= MODD;
  }
  
  cout << ans%MODD << endl;
  
  return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b;
        int c;
        if(a == 1){
            System.out.println("Hello World");
        }
        if(a == 2){
            b = sc.nextInt();
            c = sc.nextInt();
            System.out.println(b + c);
        }
    }
}

Measured memory_bytes: 25172
loop do
  n, m = gets.split.map(&:to_i)
  break if n.zero? && m.zero?

  orchard = []
  n.times do
    orchard << gets.chomp.chars
  end
  angle = [1,0, 0,1, -1,0, 0,-1]
  count = 0

  0.upto(n-1) do |x|
    0.upto(m-1) do |y|
      next if orchard[x][y].nil?
      
      temp = [x, y]
      f = orchard[x][y]
      orchard[x][y] = nil

      loop do
        i = temp.shift
        j = temp.shift
        angle.each_slice(2) do |a, b|
          ii = a + i
          jj = b + j
          if (0..n-1).include?(ii) && (0..m-1).include?(jj) && f == orchard[ii][jj]
            temp << ii << jj
            orchard[ii][jj] = nil
          end
        end
        if temp.empty?
          count += 1
          break
        end
      end
    end
  end

  puts count
end

Measured memory_bytes: 7752
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int n = sc.nextInt();
		sc.close();
		
		int beggerVal = 0;
		if(h < w) {
			beggerVal = w;
		}else {
			beggerVal = h;
		}
		
		if(n % beggerVal == 0) {
			System.out.println(n/beggerVal);
		}else {
			System.out.println(n/beggerVal + 1);
		}
	}

}


Measured memory_bytes: 21844
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        a: i32,
        b: i32
    }
    println!("{}", if a < 10 && b < 10 {a * b} else { -1 });
}
/* vim:set foldmethod=marker: */


Measured memory_bytes: 4352
using System;
using System.Linq;
namespace aizu
{
    class OnlineJudge
    {
        public static void Main()
        {
           int count = int.Parse(Console.ReadLine());
            for(int i = 0;i < count; ++i){
                double[] point = (from q in Console.ReadLine().Split() select double.Parse(q)).ToArray();
				// (point[2] - point[0]) : (point[3] - point[1]) = (point[6] - point[4]) : (point[7] - point[5])
            	Console.WriteLine((point[2] - point[0]) * (point[7] - point[5]) == (point[3] - point[1]) * (point[6] - point[4]) ? "YES" : "NO");
			}
        }
    }
}

Measured memory_bytes: 6000
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using ii = pair<int, int>;
using vii = vector<ii>;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int a, b, c;
    cin >> a >> b >> c;
    cout << min(c, b / a);
}


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

char s[10000];

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	cin >> s;
	int n = strlen(s);
	for (int i = 0; i < n - 8; i++) cout << s[i];
	return 0;
}


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

using namespace std;

const int NS = (int)1e5 + 4, MOD = (int)1e9 + 7;;
int N;
char s[NS];
int d[NS][20];

int main(){
    scanf("%s", s + 1); N = strlen(s + 1);
    d[0][0] = 1;
    for(int i = 1; i <= N; ++i){
        for(int j = 0; j < 13; ++j){
            for(int x = 0; x < 10; ++x){
                if(s[i] != '?' && s[i] - '0' != x){
                    continue;
                }
                int gap = (j * 10 + x) % 13;
                d[i][gap] = (d[i - 1][j] + d[i][gap]) % MOD;
            }
        }
    }
    printf("%d\n", d[N][5]);
    return 0;
}


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

int main(){
  int N;
  cin>>N;
  int64_t Lucas[90];
  Lucas[0]=2LL;
  Lucas[1]=1LL;
  for (int i=2;i<=N;i++){
    Lucas[i]=Lucas[i-1]+Lucas[i-2];
  }
  cout<<Lucas[N]<<endl;
}

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

int main() {
  
  int last = 0 , mini = 10 , ans =  0;
  vector<int> cost(5);
  vector<int> real(5);
  
  for (int i = 0; i < 5 ; i++){
    cin >> cost.at(i) ;
    if (cost.at(i) % 10 == 0){
      real.at(i) = cost.at(i);
    }
    else{
      real.at(i) = (cost.at(i)/10)*10 + 10;
      if (cost.at(i) % 10 < mini){
        mini = cost.at(i) % 10;
        last = i;
      }
    }
  }
  
  for (int i = 0; i < 5 ; i++){
     
    if (last == i)
      ans += cost.at(i);
    else
      ans += real.at(i);
  }
  
  cout << ans << endl;
  
}


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

using namespace std;
constexpr int ms = 1001;
constexpr ll mod = 1e9+7;

void solve() {
    int h, w;
    cin >> h >> w;

    ll dp[ms][ms];
    memset(dp, -1, sizeof(dp));

    vector<string> vs(h);
    for (int i = 0; i < h; ++i) {
        cin >> vs[i];
    }

    function<ll(int i, int j)> calc_dp = [&] (int i, int j) {
        if (i < 0 || j < 0)
            return 0ll;

        if (i == 0 && j == 0)
            return 1ll;

        if (vs[i][j] == '#')
            return 0ll;

        if (dp[i][j] != -1) 
            return dp[i][j];
        
        dp[i][j] = (calc_dp(i-1, j) + calc_dp(i, j-1)) % mod;
        return dp[i][j];
    };

    cout << calc_dp(h-1, w-1) << endl;
}

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

#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t = 1;
    // cin >> t;

    for (int i = 0; i < t; ++i) {
        solve();
    }

    return 0;
}


Measured memory_bytes: 12636
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define INF 1e9+7
#define rep(i,n) for(ll i=0;i<n;i++)
#define pii pair<int,int>
#define pll pair<ll,ll>
const int maxn = 1000000;
ll mod = INF;


int main(){
    ll n;
    ll ans=0;
    cin >> n;
    for(ll a=1;a<=n;a++){
        ans+=(n-1)/a;
    }

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

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

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> h(n);
    rep(i,n) cin >> h[i];

    sort(h.begin(), h.end());

    ll sum = 0;
    rep(i, n - k) sum += h[i];
    cout << sum << endl;
}

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

using namespace std;

int main() {
  int n, x;
  cin >> n;
  vector<int> data(n);
  priority_queue<int, vector<int>, greater<int> > pq;
  for (int i = 0; i < n; i++) {
    cin >> x;
    pq.push(x);
  }
  double res = 0;
  while (!pq.empty()) {
    x = pq.top();
    pq.pop();
    if (res == 0) {
      res = x;
    } else {
      res = (res + x) / 2; 
    }
  }
  cout << res << endl;
  return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

ll n,K;

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

  cin >> n >> K;
  if(K > (n-1)*(n-2)/2) {
    cout << -1 << endl;
    return 0;
  }

  vector<PII> e;
  FOR(i,1,n) e.push_back(PII(1,i+1));
  if(K==(n-1)*(n-2)/2){
    cout << e.size() << endl;
    rep(i,e.size()){
      cout << e[i].first << ' ' << e[i].second << endl;
    }
    return 0;
  }
  ll cnt = (n-1)*(n-2)/2;
  FOR(i,1,n){
    FOR(j,i+1,n){
      e.push_back(PII(i+1,j+1));
      cnt--;
      if(K==cnt){
        cout << e.size() << endl;
        rep(i,e.size()){
          cout << e[i].first << ' ' << e[i].second << endl;
        }
        return 0;
      }
    }
  }
  return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <time.h>
using namespace std;
typedef long long ll;

struct Edge {
	int from;
	int to;
};

bool cmprFrom(Edge e1, Edge e2)
{
	if (e1.from < e2.from) {
		return true;
	}
	return false;
}

int  main()
{
	int N; cin >> N;
	vector<int> X(N), L(N);
	vector<Edge> E(N);
	for (int i = 0; i < N; ++i) {
		cin >> X[i] >> L[i];
		E[i].from = X[i] - L[i];
		E[i].to = X[i] + L[i];
	}
	sort(E.begin(), E.end(), cmprFrom);
	auto it = E.begin();
	auto nt = it; ++nt;
	while(nt != E.end()){
		if (it->to > nt->from) {
			if (it->to > nt->to) {
				it = E.erase(it);
				nt = it; ++nt;
			}
			else {
				nt = E.erase(nt);
			}
		}
		else {
			it = nt;
			++nt;
		}
	}
	cout << E.size() << endl;;
}


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

typedef long long ll;
ll mod = 1000000007;
bool comp(vector<int> &i, vector<int> &j){
    return i.size() < j.size();
}

bool vis[101];
int assigned[101];
vector<vector<int> > ans(101);
int n;
bool find(int x){
    for(int i=0; i<ans[x].size(); i++){
        if(!vis[ans[x][i]]){
            vis[ans[x][i]] = true;
            if(assigned[ans[x][i]] == -1|| find(assigned[ans[x][i]]))
            {
                assigned[ans[x][i]] = x;
                return true;
            }
        }
    }
    return false;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    memset(vis, false, sizeof(vis));
    memset(assigned, -1, sizeof(assigned));
    int n;
    cin >> n;
    int a, b;
    vector<pair<int, int> > vb, vr;
    for(int i=0; i<n; i++){
        cin >> a >> b;
        vr.push_back({a, b});
    }
    for(int i=0; i<n; i++){
        cin >> a >> b;
        vb.push_back({a, b});
    }
    //sort(vb.begin(), vb.end());
    //sort(vr.begin(), vr.end());
    int cnt = 0;
    for(int i=n-1; i>=0; i--){
        for(int j=0; j<n; j++){
            if(vb[j].first > vr[i].first && vb[j].second > vr[i].second){
                ans[i].push_back(j);
            }
        }
    }
    //sort(ans.begin(), ans.end(), comp);
    for(int i=0; i<n; i++){
        //cout << ans[i].size() << endl;
        //sort(ans[i].begin(), ans[i].end());
        /*if(ans[i].size() == 0) continue;
        else{
            for(int j=0; j<ans[i].size(); j++){
                //cout << ans[i][j] << " ";
                if(!vis[ans[i][j]]){
                    //cout << ans[i][j] << "taken" << endl;
                    vis[ans[i][j]] = true;
                    cnt++;
                    break;
                }
            }
        }*/
        memset(vis, false, sizeof(vis));
        if(find(i)) cnt++;
    }
    cout << cnt << endl;
}

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

void North(int *t, int *b, int *n, int *e, int *s, int *w);
void East(int *t, int *b, int *n, int *e, int *s, int *w);
void South(int *t, int *b, int *n, int *e, int *s, int *w);
void West(int *t, int *b, int *n, int *e, int *s, int *w);
void Right(int *t, int *b, int *n, int *e, int *s, int *w);
void Left(int *t, int *b, int *n, int *e, int *s, int *w);

int main(void){
    int n, top, bottum, north, east, south, west, sum;
    string Turn;
    
    while(1){
        cin >> n;
        if(n==0) break;
        top=1; bottum=6; north=5; east=3; south=2; west=4; //初期化
        sum=top;
        for(int i=0; i<n; i++){
            cin >> Turn;
            if(Turn=="North"){
                North(&top, &bottum, &north, &east, &south, &west);
            }
            else if(Turn=="East"){
                East(&top, &bottum, &north, &east, &south, &west);
            }
            else if(Turn=="South"){
                South(&top, &bottum, &north, &east, &south, &west);
            }
            else if(Turn=="West"){
                West(&top, &bottum, &north, &east, &south, &west);
            }
            else if(Turn=="Right"){
                Right(&top, &bottum, &north, &east, &south, &west);
            }
            else if(Turn=="Left"){
                Left(&top, &bottum, &north, &east, &south, &west);
            }
            //cout << top << bottum << north << east << south << west << endl;
            sum += top;
        }
        cout << sum << endl;
    }
    return 0;
}
void North(int *t, int *b, int *n, int *e, int *s, int *w){
    int temp;
    temp=*t;
    *t=*s;
    *s=*b;
    *b=*n;
    *n=temp;
}
void East(int *t, int *b, int *n, int *e, int *s, int *w){
    int temp;
    temp=*t;
    *t=*w;
    *w=*b;
    *b=*e;
    *e=temp;
}
void South(int *t, int *b, int *n, int *e, int *s, int *w){
    int temp;
    temp=*t;
    *t=*n;
    *n=*b;
    *b=*s;
    *s=temp;
}
void West(int *t, int *b, int *n, int *e, int *s, int *w){
    int temp;
    temp=*t;
    *t=*e;
    *e=*b;
    *b=*w;
    *w=temp;
}
void Right(int *t, int *b, int *n, int *e, int *s, int *w){
    int temp;
    temp=*s;
    *s=*e;
    *e=*n;
    *n=*w;
    *w=temp;
}
void Left(int *t, int *b, int *n, int *e, int *s, int *w){
    int temp;
    temp=*s;
    *s=*w;
    *w=*n;
    *n=*e;
    *e=temp;
}



Measured memory_bytes: 2992
#include<iostream>
#include<stdlib.h>
#include<cstdio>
#include<cmath>
using namespace std;
int B[33], b;
void parse(long long x, int a){
  if ( 32 < a ) return;
  parse(x/2, a+1);
  B[b++] = x%2;
}

main(){
  int tcase; cin>> tcase;
  for ( int i = 0; i < tcase; i++ ){
    long long x;
    char tmp[20];
    string str;
    scanf("%llx", &x);
    b = 1;
    parse(x, 1);
    double d = 0;
    if ( B[1] ) cout << "-";
    for ( int i = 2, s = 23; i <= 25; i++, s-- ) d += (1<<s)*B[i];
    double r = 0.5;
    for ( int i = 26; i <= 32; i++, r /= 2 ) d += B[i]*r;
    sprintf(tmp, "%.10f", d);
    str = string(tmp);
    while( str.size() > 2 && str[str.size()-1] == '0' ) str.erase(str.end()-1);
    if ( str[str.size()-1] == '.' ) str += "0";
    cout <<  str << endl;
  }
}

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

int main(){

  long long N, A=0, B=0, C=0, E=0, ans, num;
  string S;
  cin >> N;
  cin >> S;
  long long D[N], F[N], T[N-1];

  for(long long i=0; i<N; i++){
    if(S[i]=='#'){
      C++;
      D[i]=C;
    }else{
      D[i]=C;
    }
  }


  for(long long i=(N-1); i>=0; --i){
    if(S[i]=='.'){
      E++;
      F[i]=E;
    }else{
      F[i]=E;
    }
  }


  for(long long i=0; i<N; i++){
    if(S[i]=='#') A++;
  }
  for(long long i=0; i<N; i++){
    if(S[i]=='.') B++;
  }

  for(long long i=0; i<N-1; i++){
    T[i] = D[i] + F[i+1];
  }


  sort(T, T+(N-1));

  num = T[0];

  ans = min(A, B);
  ans = min(ans, num);


  cout << ans << endl;

  return 0;
}


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

#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define repd(i, a, b) for (int i=(a);i<(b);i++)
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9

using namespace std;

/**
 * calculate GCD(greatest common divisor)
 * @param a
 * @param b
 * @return
 */
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

/**
 * change minimum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMinimum(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * change maximum
 * @tparam T
 * @param a
 * @param b
 * @return bool
 */
template<class T>
inline bool changeMaximum(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

/**
 * output answer
 * @tparam T
 * @param answer
 * @return
 */
template<typename T>
T output(T answer) {
    cout << answer << endl;
    return 0;
}

/** ----from here ---------------------------------------------------------- */

int main() {
    double W, H;
    double x, y;
    cin >> W >> H;
    cin >> x >> y;

    double ans1 = W * H / 2;
    int ans2 = (x == W / 2 && y == H / 2) ? 1 : 0;


    cout << setprecision(9) << ans1;
    cout << " " << ans2 << endl;

}

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

template<typename T>inline void check_max(T a,T &b){if(a>b)b=a;}

namespace o_o
{
	typedef long long ll;
	const int N=101000;

	ll x[N],w[N];

	int n;
	ll m;


	ll f[N],g[N];

	void solve()
	{
		scanf("%d%lld",&n,&m);
		for(int i=1;i<=n;i++)
			scanf("%lld%lld",x+i,w+i);
		for(int i=1;i<=n;i++)
			w[i]+=w[i-1];

		for(int v=1;v<=n;v++)
		{
			f[v]=x[v]-w[v-1];
			g[v]=(-w[v-1]-(m-x[v])*2);
		}
		for(int i=n;i;i--)check_max(f[i],f[i-1]),check_max(g[i],g[i-1]);


		ll ans=0;
		for(int i=1;i<=n;i++)
			check_max(w[i]-x[i],ans);
		for(int i=1;i<=n;i++)
			check_max(w[n]-w[i-1]-(m-x[i]),ans);


		for(int u=1;u<n;u++)
		{
			check_max((w[u]+w[n]-x[u]*2-m)+f[u+1],ans);
			check_max(w[u]+w[n]-x[u]+g[u+1],ans);
		}

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

int main()
{
	o_o::solve();
	return 0;
}


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

int main(){
  string s, ans="Yes";
  cin >> s;
  for(int i=0;i<s.size();i++){
    if(i%2==0&&s[i]=='L'){
      ans = "No" ;
    }else if(i%2==1&&s[i]=='R'){
      ans = "No" ;
    }
  }
  cout << ans << endl;
}

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

using namespace std;


    


int main() {
    int N, K;
    cin >> N >> K;
    vector<int> vec(N);
    for(int i=0;i<N;i++){
    cin >> vec.at(i);
    }
    
    sort(vec.rbegin(), vec.rend());
    int len=0;
    
    for(int i=0;i<K;i++){
        len+=vec.at(i);
    }

    cout << len << endl;

}
    

Measured memory_bytes: 384
#pragma region macro
#include <bits/stdc++.h>
using i64 = int_fast64_t;
#define repeat(i, a, b) for(int i = (a); (i) < (b); ++(i))
#define rep(i, n) repeat(i, 0, n)

namespace std {
template <typename A, typename B>
string to_string(pair<A, B> p);

string to_string(const string &s) {
    return '"' + s + '"';
}

string to_string(const char *s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for(int i = 0; i < static_cast<int>(v.size()); i++) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for(size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
};  // namespace std
#pragma endregion

void solve() {
    int h, n;
    scanf("%d%d", &h, &n);
    std::vector<std::pair<int, int>> magics(n);
    for(auto &&p : magics) std::cin >> p.first >> p.second;
    constexpr int MAX_N = 1000, MAX_H = 10000;
    // dp配列 dp[i][h]:魔法i以下のものを使って，体力をへらすために必要な魔力の最小値
    std::vector<std::vector<i64>> dp(MAX_N + 10, std::vector<i64>(2 * MAX_H + 10, 1LL << 30));
    rep(i, MAX_N + 10) dp[i][0] = 0;  // 体力を0へらすには0でいい
    rep(i, n) {
        if(i == 0) {
            rep(j, 2 * MAX_H) {
                if(j >= magics[i].first) {
                    dp[i][j] = std::min(dp[i][j], dp[i][j - magics[i].first] + magics[i].second);
                }
            }
        } else {
            rep(j, 2 * MAX_H) {
                dp[i][j] = std::min(dp[i][j], dp[i - 1][j]);
                if(j >= magics[i].first) {
                    dp[i][j] = std::min(dp[i][j], dp[i][j - magics[i].first] + magics[i].second);
                }
            }
        }
    }
    std::cout << *std::min_element(dp[n - 1].begin() + h, dp[n - 1].end()) << std::endl;
}

int main() {
    // std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 162048
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define cy cout<<"Yes"
#define cn cout<<"No"
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).begin(), (x).end()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7
#define LINF 1e18+10  
using ll = long long; 

using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;
using PPI=pair<P,int>;
using Ps=pair<int,string>;

using vi=vector<int>;
using vl=vector<ll>;
using vc=vector<char>;
using vd=vector<double>;
using vs=vector<string>;
using vp=vector<P>;
using vb=vector<bool>;
using vvi =vector<vector<int>>;
using vvl =vector<vector<ll>>;
using vvd=vector<vector<double>>;
using vvc=vector<vector<char>>;
using vvp =vector<vector<P>>;
using vvb=vector<vector<bool>>;
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}

//const ll mod=998244353;
const ll mod=1e9+7;
const ll MAX=300000;

//////////////////////////////////////

int main(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    reverse(s.begin(),s.end());
    int ans=0;
    rep(i,1000){
        int ten=100;
        int now=i/ten;
        int cnt=0;
        rep(j,n){
            if(s[j]-'0'==now){
                ten/=10;
                if(ten>0)now=i/ten;
                now%=10;
            }
            if(ten==0){
                ans++;
                break;
            }
        }
    }
    cout<<ans<<endl;
    return 0;

}

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

using namespace std;

int main(){

    string A;cin>>A;
    LL cnt[26];
    fill_n(cnt,26,0);
    REP(i,A.size())cnt[A[i]-'a']++;
    LL ans = A.size()*(A.size()-1)/2 +1;
    REP(i,26)ans -= (cnt[i]*(cnt[i]-1)/2);
    cout<<ans<<endl;

    return 0;
}

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

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);++i)
#define rep(i,n) REP(i, 0, n)
typedef long long int i64;
typedef pair<int, int> pint;

const i64 INF = 1.0e18;
constexpr i64 f(i64 b, i64 n) {
    return n < b ? n : f(b, n / b) + n % b;
}
int main() {
    i64 N, S; cin >> N >> S;
    if(S == N) {
        cout << N + 1 << endl;
        return 0;
    }
    i64 rootN = static_cast<i64>(sqrt(N - 0.0));
    i64 ans = INF;
    for(i64 b = 2LL; b <= rootN; ++b)
      if(f(b, N) == S)
        ans = min(ans, b);
    if(N < S) goto skip;
    for(i64 p = 1; p <= rootN; ++p) {
        i64 b = (N - S) / p + 1;
        if(b != 1LL && f(b, N) == S)
          ans = min(ans, b);
    }
  skip:
    cout << (ans == INF ? -1 : ans) << endl;
    return 0;
}

Measured memory_bytes: 256