akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define erep(i,n) for (int i = 0; i <= (n); ++i)
#define brep(i,n) for (int i = n; i >= 0; i--)
#define PI 3.14159265359
using namespace std;
using P = pair<int,int>;
using ll = long long;
using Graph = vector<vector<int> > ;
const int INF = 100005;
const int MAX_K = 55;
const int MAX_W = 200005; 
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

// ユークリッド互除法
unsigned gcd(unsigned a, unsigned b) {
  while(1) {
    if(a < b) swap(a, b);
    if(!b) break;
    a %= b;
  }
  return a;
}

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

/*
int main() {
    // 前処理
    COMinit();

    // 計算例
    cout << COM(100000, 50000) << endl;
}
*/

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%MOD+MOD)%MOD){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD-a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= MOD; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main(){
  int n;
  cin >> n;
  while(n>0){
    int k = n%10;
    if(k == 7){
      cout << "Yes" << endl;
      return 0;
    }
    n /= 10;
  }
  cout << "No" << endl;

}

Measured memory_bytes: 3592
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

int main()
{
    int p[20];
    int n,i,j=0;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        scanf("%d",&p[i]);
    }
    for(i=2;i<n;i++)
    {
        if((p[i-2]<p[i-1]&&p[i-1]<p[i])||(p[i]<p[i-1]&&p[i-1]<p[i-2]))
        {
            j++;
        }
    }
    printf("%d",j);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;
int main(void) {
    int a, b, c;
    cin >> a >> b >> c;
    if ((a == b && a != c) || (a == c && a != b) || (b == c && a != b)) {
        cout << "Yes\n";
    }
    else {
        cout << "No\n";
    }
    return 0;
}

Measured memory_bytes: 256
#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"
typedef long long ll;
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    double l;
    cin >> l;
    double x = l / 3;
    double ans = x * x * x;
    cout << setprecision(13) << fixed << ans << endl;
    return 0;
}


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

using namespace std;
#define inputInt(a) int a; cin >> a; 
#define inputInt2(a,b) int a; int b; cin >> a >> b; 
#define inputInt3(a,b,c) int a; int b; int c; cin >> a >> b >> c;
#define inputLong(a) long a;cin >> a; 
#define inputIntArray(a,N) int a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputLongArray(a,N) long a[N];for(int i=0;i<N;i++){cin >> a[i];}
#define inputIntArray2(a,b,N) int a[N]; int b[N]; for(int i=0;i<N;i++){cin >> a[i] >> b[i];}
#define output(answer) cout << answer << endl;
#define fN(i,N)    for(int i=0; i<N; i++)
#define fSE(i,s,e) for(int i=s; i<=e; i++)
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const ll MOD2 = 998244353;
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; }

int main()
{
  //input
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int N; cin >> N;
  //main
  
  
  // output
  if(N%2){cout << N*2 << endl;}
  else{cout << N << endl;}

  return 0;
}


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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie();
	ll n;
	cin>>n;
	ll now=100;
	for(ll i=1;;i++){
		now+=now*0.01;
		if(now>=n){
			cout<<i<<endl;
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 3640
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	ans := 0
	for i := 1; i <= n; i++ {
		// i は倍数　と 初項
		makkou := n - n%i
		kousuu := (makkou-i)/i + 1
		ans += (i + makkou) * kousuu / 2
	}
	fmt.Println(ans)
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
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;}
//自作関数
template<class T> ll llpow(T x,T n){ll ans=1;while(n--){ans*=x;}return ans;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;

ll gcd(ll x,ll y){
    if(y==0)return x;
    else {
        return gcd(y,x%y);
    }
}
ll lcm(ll x,ll y){
    return x/gcd(x,y)*y;
}
int main(){
    int n;
    cin>>n;
    vector<ll> t(n);
    rep(i,n)cin>>t[i];
    sort(t.begin(),t.end(),greater<ll>());
    ll ans=1;
    rep(i,n){
        ans=lcm(t[i],ans);
    }
    cout<<ans<<endl;
    return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define all(n) begin(n), end(n)
struct cww
{
    cww()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
    }
} star;
const long long INF = numeric_limits<long long>::max();
typedef long long ll;
typedef vector<int> vint;
typedef vector<char> vchar;
typedef vector<vector<int>> vvint;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef unsigned long long ull;
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;
}
template <typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template <typename T, typename... Ts>
auto make_v(size_t a, Ts... ts)
{
    return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template <typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template <typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v)
{
    for (auto &e : t)
        fill_v(e, v);
}
int main()
{
    ll N, ans = 0;
    cin >> N;
    map<ll, ll, greater<ll>> A;
    ll keta = 32;
    rep(i, N)
    {
        ll a;
        cin >> a;
        A[a]++;
    }
    for (int i = 0; i < N and !A.empty(); i++)
    {
        ll M = A.begin()->first;
        A[M]--;
        if (A[M] == 0)
            A.erase(A.begin());
        ll k = 1;
        while (k <= M)
        {
            k *= 2;
        }
        ll dif = k - M;
        if (A.count(dif) > 0)
        {
            ans++;
            A[dif]--;
            if (A[dif] == 0)
            {
                A.erase(dif);
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 12800
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7,MAX = 1e5;

int main()
{
	int n,a,b;
	cin >> n >> a >> b;
	string s;
	cin >> s;
	int now=0;int nowg =0;
	for(int i = 0;i< n;i++)
	{
		if(s[i]=='a')
		{
			if(a+b>now)
			{
				cout<<"Yes"<<endl;
				now++;
			}
			else
			{
				cout<<"No"<<endl;
			}
		}
		else if(s[i]=='b')
		{
			if(a+b>now&&b>nowg)
			{
				cout<<"Yes"<<endl;
				now++;
				nowg++;
			}
			else
			{
				cout<<"No"<<endl;
			}
		}
		else
		{
			cout<<"No"<<endl;
		}
		
		
	}
	return 0;
}

Measured memory_bytes: 896
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;

class Main{

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String input = br.readLine();
		StringTokenizer st = new StringTokenizer(input, " ");
		double[] x = new double[2];
		double[] y = new double[2];

		for(int i = 0; i < 2; i++){

			x[i] = Double.parseDouble(st.nextToken());
			y[i] = Double.parseDouble(st.nextToken());

		}

		double pow_width = Math.pow(x[1] - x[0], 2);
		double pow_height = Math.pow(y[1] - y[0], 2);
		double distance = Math.sqrt(pow_width + pow_height);

		System.out.printf("%.8f", distance);

	}
}

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

using namespace std;

const int N = 1000;

int c[N + 1][N + 1];

int LCS(string X, string Y) {
  int m = X.size();
  int n = Y.size();
  int maxl = 0;
  X = ' ' + X;  // X[0]に空白を挿入
  Y = ' ' + Y;  // Y[0]に空白を挿入

  for (int i = 0; i <= m; i++) c[i][0] = 0;
  for (int j = 1; j <= n; j++) c[0][j] = 0;

  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) {
      if (X[i] == Y[j]) {
        c[i][j] = c[i - 1][j - 1] + 1;
      } else {
        c[i][j] = max(c[i - 1][j], c[i][j - 1]);
      }
      maxl = max(maxl, c[i][j]);
    }
  }

  return maxl;
}

int main() {
  string s1, s2;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s1 >> s2;
    cout << LCS(s1, s2) << "\n";
  }

  return 0;
}


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

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();}

typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

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

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

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; }

int main(void){
    int N; cin >> N; cout << N*(N+1)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.IO;

namespace AtCoder.XXX.B
{ 
    public class Program
    {
        public static void Main(string[] args)
        {
            var datas = new List<int>();
            var n = int.Parse(r());
            var cnt = 0;
            for(var i = 0; i < n;i++)
			{
                var a = int.Parse(r());
                datas.Add(a);
			}
            while(true)
			{
                if(datas.Count == 0)
				{
                    break;
				}
                var min = datas.Min();
                datas.RemoveAll(x => x==min);
                cnt++;
			}
            P(cnt);
        }

        private static StreamReader sr;
        public static int[] Ecr()
        {
            if (sr == null)
            {
                sr = new StreamReader("input.txt", Encoding.GetEncoding("UTF-8"));
            }
            return sr.ReadLine().Split().Select(int.Parse).ToArray();
        }
        public static  int[] cr()
        {
            return Console.ReadLine().Split().Select(int.Parse).ToArray();
        }
        public static string Er()
        {
            if (sr == null)
            {
                sr = new StreamReader("input.txt", Encoding.GetEncoding("UTF-8"));
            }
            return sr.ReadLine();
        }
        public static string r()
        {
            return Console.ReadLine();
        }
        public static int cri()
        {
            return int.Parse(Console.ReadLine());
        }
        public static void P(string str)
        {
            Console.WriteLine(str);
        }
        public static void P(int num)
        {
            P(num.ToString());
        }
    }
}


Measured memory_bytes: 13268
def main(n):
	lst= []
	for i in range(1,n+1):
		c, v = input().split()
		lst += [[c, -int(v), i]]
	lst.sort(key=lambda x:(x[0], x[1]))
	for i in lst:
		print(i[2])
	return

main(int(input()))

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

const long long mod = (long long)1e9 + 7;
long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

//const long long mod = (long long)1e9 + 7;
int main()
{
	int n;
	cin >> n;
	
	vector<int> sum, diff;
	for(int i = 0; i < n; i++)
	{
	    int x,y;
	    cin >> x >> y;
	    
	    sum.push_back(x + y);
	    diff.push_back(x - y);
	}
	
	sort(sum.begin(), sum.end());
	sort(diff.begin(), diff.end());
	
	cout << max(sum[sum.size() - 1] - sum[0], diff[diff.size() - 1] - diff[0]) << endl;
	return 0;
}

Measured memory_bytes: 5076
#include <iostream>

int main() {
  	int n[3]{};
	int v[3]{1,0,-1};
  	int K;
  
  	std::cin >> n[0] >> n[1] >> n[2] >> K;

	int sum {}, diff{};
  	for(int i = 0; i < 3 && K > 0; ++i, K-=diff) {
    	diff = (n[i] < K ? n[i] : K);
    	sum += diff*v[i];
    }
	std::cout << sum << std::endl;
}



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

#define mp make_pair
#define pb push_back

#define int int64_t
#define ld long double

const int MOD = 1e9+7;
const int N = 1e6+5;

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

    int n;
    cin>>n;
    ld ans=1;
    ans*=2;
    ans*=n;
    ans*=acos(-1);
    cout<<setprecision(17)<<ans;

    return 0;
}

Measured memory_bytes: 3768
(defmacro defsolver (name vars &body body)
  `(defun ,name ()
     (let (,@(mapcar #'list
            vars
            (mapcar (constantly '(read))
                vars)))
       ,@body)))

(defsolver solution-d (n)
  (let ((l (loop for i below n collect (cons (read) (read))))
        (ll)
	(acc 0))
    (setf ll (sort l #'< :key #'cdr))
    (format t "~:[No~;Yes~]"
            (every #'(lambda (task)
                   (incf acc (car task))
                   (<= acc (cdr task)))
                   ll))))
(solution-d)

Measured memory_bytes: 63944
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>

using namespace std;

int main()
{
    char s[101];
    cin >> s;
    int length=strlen(s);
    cout << s[0] << length-2 << s[length-1];
    
    return 0;
}

Measured memory_bytes: 384
S = list(input())
Q = int(input())

c = 0
w = []

for i in range(Q) :
    a = input()
    if a[0] == "1" :
        c ^= 1
    else :
        if a[2] == "1" :
            if c == 0 :
                w.append(a[4])
            else :
                S.append(a[4])
        else :
            if c == 0 :
                S.append(a[4])
            else :
                w.append(a[4])
S = w[::-1] + S
print("".join(S) if c == 0 else "".join(S[::-1]))        

Measured memory_bytes: 14856
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    public static void main(String [] args) {
        FastReader reader = new FastReader();

        int N = reader.nextInt();
        int W = reader.nextInt();
        int maxValue = 0;
        int [] weight = new int [N];
        int [] sum = new int [N];
        int [] value = new int [N];

        for (int i = 0; i < N; i++) {
            weight[i] = reader.nextInt();
            value[i] = reader.nextInt();
            sum [i] = value[i] + (i > 0 ? sum[i - 1] : 0);
        }

        long [][] dp = new long [N + 1][sum[N - 1] + 1];

        for (int i = 0; i <= N; i++) {
            Arrays.fill(dp[i], Integer.MAX_VALUE);
            dp[i][0] = 0;
            if (i == 0) continue;
            int wi = weight[i - 1], vi = value[i - 1];
            for (int v = 1; v <= sum[i - 1]; v++) {
                dp[i][v] = dp[i - 1][v];
                int temp = Math.max(0, v - vi);
                dp[i][v] = Math.min(dp[i][v], dp[i - 1][temp] + wi);
                if (dp[i][v] <= W) {
                    maxValue = Math.max(maxValue, v);
                }
            }
        }

        System.out.println(maxValue);

    }


    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 138164
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

priority_queue<lli> q;
string s;
lli x;

int main(){
    do{
        cin >> s;
        if(s == "insert"){
            cin >> x;
            q.push(x);
        }else if(s == "extract"){
            cout << q.top() << endl;
            q.pop();
        }
    }while(s != "end");
    return 0;
}

Measured memory_bytes: 11216
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b;
  cin >> a >> b;
  vector<vector<int>> data(b,vector<int>(2));
  for(int i = 0;i < b;i++){
    for(int j = 0;j < 2;j++){
      cin >> data[i][j];
    }
  }
  for(int k = 0;k < a;k++){
    int count = 0;
      for(int i = 0;i < b;i++){
        for(int j = 0;j < 2;j++){
          if(data[i][j] == k+1){
            count++;
          }
        }
      }
    cout << count << endl;
  }
  
}
       

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
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;}
int const INF = 1001001001;
ll const MOD = 1000000007;


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

int N;
cin >> N;
vi A(N);
rep(i,N) cin >> A[i];

sort(all(A));
cout << abs(A[0] - A[N-1]) << endl;

return 0;
}

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

using namespace std;
using ll = long long;
// #define int ll
using PII = pair<ll, ll>;

#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()

template<typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<typename T> bool IN(T a, T b, T x) { return a<=x&&x<b; }
template<typename T> T ceil(T a, T b) { return a/b + !!(a%b); }

template<typename T> vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts) {
    return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
template<typename T,typename V> typename enable_if<is_class<T>::value==0>::type
fill_v(T &t, const V &v) { t=v; }
template<typename T,typename V> typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t, const V &v ) { for(auto &e:t) fill_v(e,v); }

template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a) {
    out<<'('<<a.first<<','<<a.second<<')'; return out;
}
template<class T>
ostream &operator <<(ostream& out,const vector<T>& a){
    out<<'[';
    for(const T &i: a) out<<i<<',';
    out<<']';
    return out;
}
template<class T>
ostream &operator <<(ostream& out, const set<T>& a) {
    out<<'{';
    for(const T &i: a) out<<i<<',';
    out<<'}';
    return out;
}
template<class T, class S>
ostream &operator <<(ostream& out, const map<T,S>& a) {
    out<<'{';
    for(auto &i: a) out<<i<<',';
    out<<'}';
    return out;
}

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0}; // DRUL
const int INF = 1<<30;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;

// i番目の高さがh[i]のヒストグラム中で最大の長方形の面積
ll largest_rectangle_histogram(vector<ll> h) {
    const ll n = h.size();

    // iを固定して高さがh[i]となる長方形を考えるとl,rは一意に定まる
    // l[i], r[i] をstackを使って求める

    // l[i] = (j<=iかつh[j-1]<h[i]となる最大のj)
    vector<ll> l(n);
    stack<ll> st1;
    REP(i, n) {
        while(st1.size() && h[st1.top()] >= h[i]) st1.pop();
        l[i] = st1.empty() ? 0 : (st1.top()+1);
        st1.push(i);
    }
    // r[i] = (j>iかつh[j]<h[i]となる最小のj)
    vector<ll> r(n);
    stack<ll> st2;
    for(ll i=n-1; i>=0; --i) {
        while(st2.size() && h[st2.top()] >= h[i]) st2.pop();
        r[i] = st2.empty() ? n : st2.top();
        st2.push(i);
    }
    ll ret = 0;
    REP(i, n) ret = max(ret, h[i]*(r[i]-l[i]));
    return ret;
}

namespace DPL3C {
    void solve() {
        ll n;
        cin >> n;
        vector<ll> h(n);
        REP(i, n) cin >> h[i];

        cout << largest_rectangle_histogram(h) << endl;
    }
}

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

    DPL3C::solve();

    return 0;
}



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

int main() {
	long long int x;
	cin >> x;
	long long int y = 100;
	int i = 1;
	for (; ; i++) {
		y = y * 1.01;
		if (y >= x) break;
	}
	cout << i << "\n";
	return 0;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <memory.h>
#include <iomanip>
#include <bitset>
#include <list>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
    int h, w;
    cin >> h >> w;
    string s[30][30];
    for (int i = 0; i < h; ++i)
    {
        for (int j = 0; j < w; ++j)
        {
            cin >> s[i][j];
        }
    }
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            if(s[i][j] == "snuke"){
                cout << (char)('A' + j) << i + 1 << endl;
                break;
            }
        }
    }
    return 0;
}

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

int main(){
    string s, t;
    cin>>s>>t;
    int st[100000];
    st[0]=(s[0]=='A'?1:2);
    for(int i=1; i<=s.size(); i++){
        st[i]=(st[i-1]+(s[i]=='A'?1:2))%3;
    }
    int tt[100000];
    tt[0]=(t[0]=='A'?1:2);
    for(int i=1; i<=t.size(); i++){
        tt[i]=(tt[i-1]+(t[i]=='A'?1:2))%3;
    }

    int q;
    cin>>q;
    for(int i=0; i<q; i++){
        int a, b, c, d;
        cin>>a>>b>>c>>d;
        a--; b--; c--; d--;
        if((st[b]+3-(a!=0?st[a-1]:0))%3==(tt[d]+3-(c!=0?tt[c-1]:0))%3) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;

    }
    return 0;
}


Measured memory_bytes: 1664
import java.util.*;

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

		int temp;
		
		if (a > b){
			temp = b;
			b = a;
			a = temp;
		}
		
		if (b > c){
			temp = c;
			c = b;
			b = temp;
		}
		
		if (a > b){
			temp = b;
			b = a;
			a = temp;
		}
		
		
		System.out.println(a + " " + b + " "  + c);

	}
}

Measured memory_bytes: 17300
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>

using namespace std;

int main(){
	int n,x;
	cin >> n;
	vector<int> a(n,0);
	
	for(int i=0;i<n;i++){
		cin >> x;
		if(i==0){
			a[i]=x;
		}else{
			for(int j=0;j<i;j++){
				if(x>a[j]){
					for(int k=i;k>j;k--){
						a[k]=a[k-1];
					}
					a[j]=x;
					break;
				}else{
					a[i]=x;
				}
			}
		}
	}
	cout << abs(a[0]-a[n-1]) << endl;
	return 0;
}



Measured memory_bytes: 256
[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.toList |> List.map f

let gcd x y =
    let rec aux x y = if y = 0 then x else aux y (x % y)
    aux (abs x) (abs y)

[<EntryPoint>]
let main _ =
    let n = read int
    let xs = reads int |> List.toSeq
    let ls = Seq.scan gcd 0 xs
    let rs = Seq.scanBack gcd xs 0 |> Seq.tail
    Seq.zip ls rs
    |> Seq.map (fun (l, r) -> gcd l r)
    |> Seq.max
    |> printfn "%i"
    0

Measured memory_bytes: 35280
import java.io.*;
import java.util.*;

public class Main {

	final static long MOD = 1000000007L;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static ArrayList<int[]> list = new ArrayList<>();
	public static void main(String[] args) throws Exception {

		String S=nextString();
		char[] c = S.toCharArray();
		long wb = 0;
		long bw = 0;
		for(int i=0;i<c.length-1;i++){
			if(c[i]!=c[i+1]){
				if(c[i]=='W'){
					wb++;
				}else{
					bw++;
				}
			}
		}




		System.out.println(wb+bw);
	}



	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static String concatStringArray(String[] s){
		StringBuffer sb = new StringBuffer();
		for(String x:s){
			sb.append(x);
		}
		return sb.toString();
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}

Measured memory_bytes: 25044
for _ in [0] * int(raw_input()):
  h, m = map(int, raw_input().split(':'))
  x = abs(h * 60 - m * 11)
  if x>360:
    x = 720 - x
  if x<60:
    print 'alert'
  elif 180<=x:
    print 'safe'
  else:
    print 'warning'

Measured memory_bytes: 4200
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int A, B;
  cin>>A>>B;
  cout<<max(A+B, max(A-B, A*B))<<endl;
}



Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PI;
typedef pair<ll, ll> PL;
typedef map<int, int> MI;
typedef set<int> SI;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define COUT(x) cout << (x) << endl

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

int a[1000],cnt[1001];

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

    int n; cin >> n;
    rep(i, n) {
        a[i] = i + 1;
    }
    ll ans = 1;
    for(int i = 2; i <= n; i++) {
        for(int j = 0; j < n; j++) {
            while(a[j] % i == 0 && a[j] != 1){
                cnt[i]++;
                a[j] /= i;
            }
        }
        ans = ans *(cnt[i] + 1) % 1000000007;
    }
    COUT(ans);
}

Measured memory_bytes: 256
#if __has_include("debug.h")
    #include "debug.h"
#else  
#include <bits/stdc++.h>
using namespace std;
#define d(...) 2;
#endif

#define int long long int
#define ld long double

#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"      

#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ff first
#define ss second
#define eps 1e-10
#define PI acos(-1LL)

#define gcd(a,b)            __gcd((a),(b))
#define lcm(a,b)            ((a*b)/gcd(a,b))

void solve();

int32_t main()
{
    #ifdef DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    #endif 

    fast
    
    int t = 1;
	// cin>>t;
	
	while(t--)
	    solve();
	return 0;  
}

void solve()
{
	int i,j;
	int x;
	cin>>x;
	if(x==1)
	{
		cout<<0;
	}
	else
	{
		cout<<1;
	}

}

Measured memory_bytes: 3608
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <stack>
using namespace std;
typedef long long int ll;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(int i=0;i<n;i++)

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

ll beki(ll a, ll b) {
	ll tmp = 1;
	REP(i, b) tmp *= a;
	return tmp;
}

string S, T;
int ans = 0;
int main() {
	cin >> S >> T;
	REP(i, 3) {
		if (S[i] == T[i]) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
h,w = map(int,input().split())
e = []
for i in range(h):
    e.append(list(input()))
rey = [0 for i in range(h)]
rex = [0 for i in range(w)]
for i in range(h):
    count = 0
    for j in range(w):
        if e[i][j] == ".":
            count += 1
    if count == w:
        rey[i] = 1

for i in range(w):
    count = 0
    for j in range(h):
        if e[j][i] == ".":
            count += 1
    if count == h:
        rex[i] = 1

for i in range(h):
    if rey[i]:
        continue
    else:
        for j in range(w):
            if rex[j]:
                continue
            else:
                print(e[i][j],end="")
    print()

Measured memory_bytes: 4596
//B_Grid_Compression
#include <iostream>
#include <string>
using namespace std;

int main(){
  int n,m,i,j,count,hiku=0,herasu=0;
  int retu[101]={};
  char a[101][101];

  cin>>n>>m;
  for(i=0;i<n;i++){
    count=0;
    for(j=0;j<m;j++){
      cin>>a[i-hiku][j];
      if(a[i-hiku][j]=='.') count++;
      if(count==m) hiku++;
    }
  }
  //cout<<endl;
  
  for(i=0;i<m;i++){
    count=0;
    for(j=0;j<n-hiku;j++){
      if(a[j][i]=='.')
	count++;
      if(count==n-hiku){
	retu[i]=100;
      }
      //cout<<a[j][i];
    }
    // cout<<endl;
  }

  /*cout<<endl;
  for(i=0;i<m;i++) cout<<retu[i];
  cout<<endl;*/
  
  for(i=0;i<n-hiku;i++){
    for(j=0;j<m;j++){
      if(retu[j]==100) continue;
      cout<<a[i][j];
	}
    cout<<endl;
  }

  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m,s=0,q;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>q;
        s+=q;
    }
    if(s>n)cout<<-1<<'\n';
    else cout<<n-s<<'\n';
    return 0;
}

Measured memory_bytes: 3600
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define INF 110000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<ll,int> P;

ll dp[110][9];

int main(){
  int H,W,K,C[8]={1,1,2,3,5,8,13,21};
  cin>>H>>W>>K;
  W-=1;
  dp[0][0]=1;

  for(int i=0;i<H;i++){
    for(int j=0;j<=W;j++){
      //cout<<i<<" "<<j<<endl;
      if(j!=0){
        dp[i+1][j-1]+=dp[i][j]*C[j-1]*C[W-j];
        dp[i+1][j-1]%=MOD;
        //cout<<i+1<<" "<<j-1<<" "<<dp[i+1][j-1]<<endl;
      }
      if(j!=W){
        dp[i+1][j+1]+=dp[i][j]*C[j]*C[W-j-1];
        dp[i+1][j+1]%=MOD;
        //cout<<i+1<<" "<<j+1<<" "<<dp[i+1][j+1]<<endl;
      }
      dp[i+1][j]+=dp[i][j]*C[j]*C[W-j];
      dp[i+1][j]%=MOD;
      //cout<<i+1<<" "<<j<<" "<<dp[i+1][j]<<endl;
    }
  }
  cout<<dp[H][K-1]<<endl;
}


Measured memory_bytes: 256
//#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define all(x) x.begin(),x.end()
#define F first
#define S second
#define fo(i,n) for(int i=0;i<(n);i++)
#define inp(a) int a;cin>>a;
#define inpa(a,n)vector<int> a(n);fo(i,n)cin>>a[i];
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
using namespace std;
#define int ll
// #define MAX 20
#define INF (int)1e18

template<class T> ostream& operator<<(ostream& cout,vector<T> V)
{cout<<"[ ";for(auto v:V)cout<<v<<' ';return cout<<']';}
template<class L,class R> ostream& operator<<(ostream& cout,pair<L, R> P)
{return cout<<'('<<P.F<<','<< P.S<<')';}


int n;
string s;
vector<vector<int>> dp;


signed main()
{
	fio
	cin>>n;
	cin>>s;
	dp.resize(n+1,vector<int>(3));
	int done[30001]={0};
	for(int i=1;i<=n;i++)
	{
		if(!done[s[i-1]-'0'])
		{
			dp[i][0]=dp[i-1][0]+1;
			done[s[i-1]-'0']=1;
		}
		else
		{
			dp[i][0]=dp[i-1][0];
		}
	}
	memset(done,0,sizeof(done));
	for(int i=1;i<=n;i++)
	{
		dp[i][1]=dp[i-1][1]+dp[i-1][0]-done[s[i-1]-'0'];
		done[s[i-1]-'0']=dp[i-1][0];
	}
	memset(done,0,sizeof(done));
	for(int i=1;i<=n;i++)
	{
		dp[i][2]=dp[i-1][2]+dp[i-1][1]-done[s[i-1]-'0'];
		done[s[i-1]-'0']=dp[i-1][1];
	}
	// int ans=0;
	// fo(i,n+1)
		// ans+=dp[i][2];
	// cout<<dp<<'\n';
	cout<<dp[n][2]<<'\n';
	printclock;
}

Measured memory_bytes: 2176
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define forin(in, n) for(int i=0; i<n; i++) cin>>in[i]
#define forout(out, n) for(int i=0; i<n; i++) cout<<out[i]<<endl
#define rep(i, n) for(int i=0; i<(n); i++)

int main(){
    string n; cin>> n;
    ll sum=0;
    for(int i=0; i<n.size(); i++){
        int a=n[i]-'0';
        sum += a;
    }
    if (sum % 9 == 0) cout<< "Yes" << endl;
    else cout<< "No" << endl;
}

Measured memory_bytes: 3720
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define all(v) v.begin(), v.end()



int main(void){
    int N, D;
    cin >> N >> D;

	vector<vector<double>> X;
    rep(i,N){
        vector<double> u;
        rep(j,D){
            double a;
            cin >> a;
            u.push_back(a);
        }
        X.push_back(u);
    } 

    int ans = 0;
    double d2 = 0;

    rep(i,N){
        for(int j=i+1; j<N; j++){
            rep(k,D){
                d2 = d2 + (X[i][k]-X[j][k])*(X[i][k]-X[j][k]);
            }
            d2 = sqrt(d2);
            if(d2-floor(d2)==0){
                ans++;
            }
            //cout << d2 << ' ' << floor(d2) << endl;
            d2 = 0;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<string> a(n), top(n), bottom(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    //    string top = "", bottom = "";
    int it = 0;
    int ib = 0;
    for (int i = 0; i < n; i++)
    {
        if (i % 2 != 0)
        {
            top[it] = a[i];
            it++;
        }
        else
        {
            bottom[ib] = a[i];
            ib++;
        }
    }
    if (n % 2 != 0)
    {
        for (int i = 0; i < (n + 1) / 2; i++)
        {
            cout << bottom[(n + 1) / 2 - 1 - i] << " ";
        }
        for (int i = 0; i < n / 2; i++)
        {
            cout << top[i];
            if (i != n / 2 - 1)
                cout << " ";
        }
        cout << endl;
    }
    else
    {
        for (int i = 0; i < (n) / 2; i++)
        {
            cout << top[(n) / 2 - 1 - i] << " ";
        }
        for (int i = 0; i < n / 2; i++)
        {
            cout << bottom[i];
            if (i != n / 2 - 1)
                cout << " ";
        }
        cout << endl;
    }
}

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

#define ll long long
#define vecll vector<long long>
#define vec2ll vector<vector<long long>>
#define vecbool vector<bool>
#define vecpairll vector<pair<long long,long long>>
#define forll(s,a,b) for(long long s = a;s < b;s++)
#define forllde(s,a) for(long long s = a;s > 0;s--)

int main()
{
  ll n, min=LLONG_MAX, c=0, x;
  cin >> n;
  forll(i, 0, n){
	cin >> x;
	if (min >= x){
	  c += 1;
	  min = x;
	}
  }
  cout << c << endl;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
#define REP(i, n) for(int i = 0; i < n; i++)
#define FOR(i, w, n) for(int i = w; i < n; i++)
#define all(a) a.begin(), a.end()
#define SORT(a) sort(all(a))

const double PI = M_PI;
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;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout<<fixed<<setprecision(15);
    
    while(true) {
        int a, b; char op; cin >> a >> op >> b;
        if(op == '+') cout << a + b << endl;
        if(op == '-') cout << a - b << endl;
        if(op == '/') cout << a / b << endl;
        if(op == '*') cout << a * b << endl;
        if(op == '?') break;
    }
    
    return 0;
}



Measured memory_bytes: 3132
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<cmath>
#define INF 2147483647
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
using namespace std;
int main(){
  ll num;
  cin>>num;
  int mi=INF;
  for(ll i=1;i<=sqrt(num);i++){
    if(num%i==0){
      ll ans=num/i;
      int cnt=0;
      while(ans!=0){
	ans/=10;
	cnt++;
      }
      mi=min(mi,cnt);
    }
  }
  cout<<mi<<endl;
  return 0;
}

Measured memory_bytes: 256
module Main where

import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
    [a, b, c, d] <- fmap read . words <$> getLine :: IO [Int]
    case (a + b) `compare` (c + d) of
        LT -> putStrLn "Right"
        EQ -> putStrLn "Balanced"
        GT -> putStrLn "Left"

Measured memory_bytes: 508
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
#include<stack>
#include<cstdlib>
#include<cctype>
using namespace std;
#define ll long long
typedef pair<int,int>P;
const int len=2e5+5;
int arr[len];
int num[len];
int main()
{
	int a,b;
	cin>>a>>b;
	if(a+b==15)puts("+");
	else if(a*b==15)puts("*");
	else puts("x");
}

Measured memory_bytes: 256
X, Y, Z, K = gets.split.map &:to_i
A = gets.split.map(&:to_i).sort.reverse
B = gets.split.map(&:to_i).sort.reverse
C = gets.split.map(&:to_i).sort.reverse

a = []
X.times{|x|
  Y.times{|y|
    Z.times{|z|
      break if (x + 1) * (y + 1) * (z + 1) > K
      a << A[x] + B[y] + C[z]
    }
  }
}

p *a.sort.reverse.shift(K)
# p *a.max(K).sort.reverse


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

#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define REP_REV(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define REPN_REV(i, m, n) for (int (i) = (int)(n) - 1 ; (i) >= m ; --(i))

#define INF 2e9
#define INF_LL 1LL<<60
#define ll long long
#define ALL(v) (v).begin(), (v).end()

typedef pair<ll, ll> P;


int main(){
    string s;
    cin >> s;
    
    ll ans = 0;

    REP(b, 1<<(s.size()-1)) {
        ll tmp = s[0]-'0';
        ll sum = 0;
        REP(i, s.size()-1) {
            if((b >> i) & 1) {
                sum += tmp;
                tmp = s[i+1] - '0';
            } else {
                tmp = 10 * tmp + s[i+1] - '0';
            }
        }
        sum += tmp;
        ans += sum;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mk make_pair
#define rint register int
using namespace std;
inline int read(){int w=1,s=0;char ch=getchar();while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}return w*s;}
struct node{int to,next;} e[1000010];
int tag[1000010],h[1000010],tot,n,fa[200010][21],Max[200010][21],Mx[200010],Maxpos[200010],dep[200010];
inline void add(int from,int to) {e[++tot].next=h[from];h[from]=tot;e[tot].to=to;}
inline void DFS1(int now,int ffa)
{
	fa[now][0]=ffa;Max[now][0]=max(now,ffa);if(now>Mx[ffa]) Maxpos[now]=now;else Maxpos[now]=Maxpos[ffa];dep[now]=dep[ffa]+1;
	Mx[now]=max(now,Mx[ffa]);
	for(rint i=h[now];i;i=e[i].next)
	{
		int to=e[i].to;if(to==ffa) continue;
		DFS1(to,now);
	}
}
inline void DFS2(int now,int ffa)
{
	tag[now]+=tag[ffa];
	for(rint i=h[now];i;i=e[i].next)
	{
		int to=e[i].to;if(to==ffa) continue;
		DFS2(to,now);
	}
}
inline void Build()
{
	for(rint i=1;i<=20;++i) for(rint j=1;j<=n;++j) fa[j][i]=fa[fa[j][i-1]][i-1];
	for(rint i=1;i<=20;++i) for(rint j=1;j<=n;++j) Max[j][i]=max(Max[fa[j][i-1]][i-1],Max[j][i-1]);
	tag[1]=1;
	for(rint i=2;i<=n;++i)
	{
		if(Maxpos[i]==i)
		{
			tag[i]++;continue;
		}
		else 
		{
			int pos=Maxpos[i];
			int now=i;int mx=i;int tt=now;
			for(rint i=20;i>=0;--i) if(dep[fa[now][i]]>=dep[pos]+1) mx=max(mx,Max[now][i]),now=fa[now][i];
			if(mx<Mx[fa[pos][0]]) tt=pos;else tt=now;
			tag[tt]++;//cout<<i<<" "<<tt<<"\n";
		}
	}DFS2(1,0);
}
int main()
{
	n=read();
	for(rint i=1;i<n;++i) {int u=read(),v=read();add(u,v);add(v,u);}
	DFS1(1,0);
	Build();
	for(rint i=2;i<=n;++i) cout<<tag[i]-1<<" ";
	return 0;
}


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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)
// }}} 2

// constants {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// }}} 2

// }}} 1

int main() {

    int a,b,c;

    Scd3(a,b,c);

    int ans = 0;
    Rep(i, 101){
        if( i == a || i == b || i == c) ans++;
    }

    printf ("%d\n", ans);

    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include <math.h>       /* sin */
using namespace std;
#define PI 3.1415926535897932384626


int min(int x, int y) {  
    return (x < y)? x: y;  
}  
 
double calcAngle(double hour, double minute)   {  
   
    double hour_angle = 0.5 * (hour * 60 + minute);  
    double minute_angle = 6 * minute;  
 
    double  angle = abs(hour_angle - minute_angle);  
 
    angle = min(360.0 - angle, angle);  
 
    return angle;  
}

double calcSide(double angle, int p, int q) {
double ans = (p*p*1.0);
ans += (q*q*1.0);
ans -= (2*p*1.0*q*1.0*cos(angle*PI/180));
return sqrt(ans);
}

int main() {

int p, q, hour, minute;
cin>>p>>q>>hour>>minute;

double angle = calcAngle(1.0*hour, 1.0*minute);
// cout<<angle<<endl;
printf("%.12f\n", calcSide(angle, p, q));

}

Measured memory_bytes: 4152