akhauriyash/Code-Regression huggingface dataset:
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

#define _USE_MATH_DEFINES

#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <unordered_map>
#include <stack>
#include <list>
#include <math.h>
#include <bitset>
#include <iterator>
#include <map>
#include <iomanip>
#include <functional>
#include <string>
#include <algorithm>
#include <queue>
#include <random>
#include <numeric>
#include <set>
#include <cassert>
#include <cmath>
#include <cinttypes>

using namespace std;

template<class T> ostream& operator<<(ostream& os, const vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) os << *i << (i == end(v) - 1 ? "" : " "); return os;
}
template<class T> istream& operator>>(istream& is, vector<T>& v) {
	for (auto i = begin(v); i != end(v); i++) is >> *i; return is;
}
template<class T> T read_val() { throw 1; }
template<> int read_val() { int tmp; scanf("%" PRId32, &tmp); return tmp; }
template<> long long read_val() { long long tmp; scanf("%" PRId64, &tmp); return tmp; }
auto read_int = read_val<int>; auto read_long = read_val<long long>;
template<class T> void scanf_vec(vector<T>& vec) { for (int i = 0; i < vec.size(); i++) vec[i] = read_val<T>(); }

#define MOD 1000000007
#define inf 2000000000
#define FWT_SIZE 2000000
#define pii pair<int,int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define sort_all(x) sort(all(x))
#define make_unique(x) (x).erase(unique(all(x)), (x).end())


long long a, b, c, d;

map<long long, long long> mm;

long long rec(long long n)
{
	if (n == 1)
		return d;
	if (mm.find(n) != mm.end())
	{
		return mm[n];
	}
	long long ans = 3LL * 1e18;
	if (n < ans / d) ans = n * d;
	
	if (n >= 3)
	{
		long long rem3 = n % 3;
		//if (rem3 < (3 - rem3))
			ans = min(ans, d * rem3 + b + rec(n / 3LL));
		//else
			ans = min(ans, (3 - rem3) * d + b + rec(n / 3LL + 1LL));
	}

	if (n>=5)
	{
		long long rem5 = n % 5;
//		if (rem5 < (5 - rem5))
			ans = min(ans, d * rem5 + c + rec(n / 5LL));
	//	else
			ans = min(ans, d * (5 - rem5) + c + rec(n / 5LL + 1LL));
	}

	if (1)
	{
		if (n % 2 == 0)
			ans = min(ans, a + rec(n / 2LL));
		else
		{
				ans = min(ans, d + a + rec((n + 1) / 2LL));
				ans = min(ans, d + a + rec((n) / 2LL));

		}
	}
	mm[n] = ans;
	return ans;
}

int main() {

#if defined(_DEBUG)
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int t;
	cin >> t;
	while (t-- > 0)
	{
		long long n;
		mm.clear();
		cin >>n>> a >> b >> c >> d;
		cout << rec(n) << "\n";
	}

	return 0;
}

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        int k = in.ni();
        int n = in.ni();
        int max = 0;
        int[] a = in.ni(n);
        for (int i = 1; i < n; i++) {
            max = Math.max(max,a[i]-a[i-1]);
        }
        max = Math.max(max, a[0]+k-a[n-1]);
        out.println(k-max);
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 48520
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut 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)*}
    };
}
#[allow(unused_macros)]
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)*}
    };
}

#[allow(unused_macros)]
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! {
        n: usize, m: usize, x: i32, y: i32,
        xs: [i32; n],
        ys: [i32; m],
    }
    
    let mut xss = xs.clone();
    let mut yss = ys.clone();
    xss.sort();
    yss.sort();
    
    let mut flag = false;

    for i in x+1..y {
        if xss[n-1] < i && yss[0] >= i {
            flag = true;
        }
    }

    if flag {
        println!("No War");
    } else {
        println!("War");
    }


}


Measured memory_bytes: 4352
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#define loop(i,b,n) for(int i = b; i<n; i++)
#define rep(i,n)  loop(i,0,n)
#define INF 10000
using namespace std;

int main (){
    
    int d,number;
    int temp[210] = {0};
    int dp[500][500];
    rep(i,500)
        rep(j,500)
    dp[i][j] = -INF;
    int Min[210] = {0},Max[210] = {0},c[210] = {0};
    cin  >> d >> number;
    rep(i,d)
        cin >> temp[i+1];
    rep(i,number)
        cin >> Min[i+1] >> Max[i+1] >> c[i+1];
    loop(j,1,d+1)//day
    {
        
        loop(k,1,number+1)// k
        {
            if(Min[k] <= temp[j] && temp[j] <=Max[k])
            {
                if(j == 1)
                    dp[j][c[k]] = 0;
                else
                {
                    dp[j][c[k]] = 0;
                    loop(l,0,500)
                    {
                        if(dp[j-1][l] != -INF)
                        {
                            dp[j][c[k]] = max(abs(c[k]-l)+dp[j-1][l],dp[j][c[k]]);
                            //cout << abs(c[k]-l)<< " " ;
                        }
                        
                    }
                    
                    
                }	
            }
            
        }
        
    }
    
    int answer = 2;
    rep(i,200)
        answer = max(answer,dp[d][i]);
    cout << answer << endl;
    
    return 0;
} 

Measured memory_bytes: 4080
//#define __USE_MINGW_ANSI_STDIO 0
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#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()
#define IN(a, b, x) (a<=x&&x<b)
#define MP make_pair
#define PB push_back
#define MOD 1000000007
#define INF (1LL<<30)
#define LLINF (1LL<<60)
#define PI 3.14159265359
#define EPS 1e-12
//#define int ll

int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

signed main(void)
{
	int a, b;
	cin >> a >> b;
	if(a == 1) a = 15;
	if(b == 1) b = 15;
	if(a > b) cout << "Alice" << endl;
	else if(a < b) cout << "Bob" << endl;
	else cout << "Draw" << endl;

	return 0;
}


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

struct UnionFind {
    vector<int> p;
    UnionFind(int n) : p(n, -1) {}
    void unite(int a, int b) {
        a = root(a);
        b = root(b);
        if (a != b) {
            if (size(a) > size(b)) swap(a, b);
            p[b] += p[a];
            p[a] = b;
        }
    }
    int root(int a) {
        if (p[a] < 0) return a;
        return p[a] = root(p[a]);
    }
    int size(int a) { return -p[root(a)]; }
};

signed main() {
    while (1) {
        int N;
        cin >> N;
        if (N == 0) break;

        vector<vector<int>> day(31);
        vector<vector<bool>> fr(N, vector<bool>(31));
        rep(i, 0, N) {
            int f;
            cin >> f;
            rep(j, 0, f) {
                int d;
                cin >> d;
                day[d].push_back(i);
                fr[i][d] = true;
            }
        }
        vector<vector<int>> g(31);
        rep(i, 1, 31) {
            rep(j, 1, i) {
                bool same = false;
                rep(k, 0, N) {
                    if (fr[k][i] && fr[k][j]) {
                        same = true;
                    }
                }
                if (same) {
                    g[i].push_back(j);
                }
            }
        }
        
        int ans = -1;
        rep(k, 1, 31) {
            queue<int> q;
            vector<bool> bfs_vis(31);
            vector<bool> vis(N, false);
            q.push(k);
            bfs_vis[k] = true;
            while (q.size()) {
                int v = q.front(); q.pop();
                for (int x : day[v]) vis[x] = true;
                for (int w : g[v]) {
                    if (!bfs_vis[w]) {
                        bfs_vis[w] = true;
                        q.push(w);
                    }
                }
            }
            bool ok = true;
            rep(i, 0, N) {
                if (!vis[i]) ok = false;
            }
            if (ok) {
                ans = k;
                break;
            }
        }

        if (N == 1) {
            ans = 1;
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll mod = 1000000007;

const ll LINF = 1e13;
const ll LLINF = 1e18;
const ll ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
  for (T& x : vec) is >> x; //for(int i=0; i<vec.size(); i++) is >> x[i]; とかでもいい
  return is;
}


ll n, m;

bool isdiv(ll x) {
  bool val = false;

  // if (x * n <= m) {
  //   if ((m - x * n) % x == 0)val = true;
  // }
  if (  (m/x ) >= n   )val = true;

  return val;
}



ll BinarySearch(vector<ll> vec) {
  // key: 検索対象の値
  int left = 0, right = vec.size() - 1, mid;

  while (left < right) {
    mid = (left + right) / 2;
    cerr << vec[mid] << endl;
    if ( !isdiv(vec[mid]) ) {// 半分より下
      right = mid;
    } else {// 半分より上
      left = mid + 1;
    }
  }
  // key が配列の中に見つからない場合

  if (isdiv(vec[left])){
    return vec[left];
  }else{
    return vec[left-1];
  } 

  return -1;
}


vector<ll> enum_div(ll p){//nの約数を列挙{
  vector<ll> ret;
  for (ll i = 1 ; i * i <= p ; ++i){
    if (p % i == 0){
      ret.push_back(i);
      if (i != 1 && i * i != p){
        ret.push_back(p / i);
      }
    }
  }
  return ret;
}


int main() {
  cin >> n >> m;



  ll x = m / 2;
  vector<ll> div;
  div = enum_div(m);
  div.push_back(m);
  sort(div.begin(),div.end());

  // for(auto b:div){
  //   cerr << b <<",";
  // }cerr <<endl <<endl;;

  ll ans = BinarySearch(div);

  // ll ans =0;

  // for(auto d:div){
  //   if (isdiv(d)){
  //     ans = max(ans,d);
  //   }
  // }


  cout << ans ;

}




















Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
#define ll long long 
#define pb push_back
//#define mp make_pair
#define fr first
#define sc second
#define MAX ((ll)(1e15+100))
#define ARRS ((ll)(1e6+100))
#define MOD ((ll)(1e9+7))
#define EP ((double)(1e-9))
#define EPS ((double)(1e-8))
#define pb push_back
#define PI ((double)3.141592653)

ll n,m,k,p,q,h;
ll d,b;
ll a[ARRS];
	string s;

int main(){
	ios::sync_with_stdio(0);
	cin>>n>>k;
	ll pas=0;
	for(int b=k+1; b<=n; b++){
		pas+=(b-k)*(n/b);
		if(n%b>=k)pas+=(n%b-k+1);
		if(!k)pas--;
		//cout<<b<<" " <<pas<<endl;
	}
	cout<<pas;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
#define MAX 101
 
int main() {
    int h, w;
    char a[MAX][MAX];
    cin >> h >> w;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cin >> a[i][j];
        }
    }
 
    for (int i = 0; i < h+2; i++) {
        if (i == 0 || i == h+1) { //一行目と最終行に'#'
            for (int j = 0; j < w+2; j++) {
                cout << "#";
            }
        } else {
            for (int j = 0; j < w+2; j++) {
                if (j == 0 || j == w+1) {//一列目と最終列は"#"
                    cout << "#";
                } else {
                    cout << a[i-1][j-1]; //最初の文字の分が一つずれる
                }
            }
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <array>
#include <tuple>
#include <string>
#include <algorithm>
#include <functional> // greater など
#include <cmath>      // abs など
#include <numeric>    // accumulate, gcd など
#include <cassert>    // assert
#include <stdexcept>
#include <bitset>
using namespace std;

// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
// typedef int128_t ll;
// typedef cpp_int ll;

// GCC, 配列のアクセスなど
#define _GLIBCXX_DEBUG
// Clang, 配列のアクセスなど
#define _LIBCPP_DEBUG 0

// #define NDEBUG 1
// debug用出力 https://trap.jp/post/998/
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T)
{
    cerr << H << " ";
    debug_out(T...);
}
#ifdef NDEBUG
#define debug(...)
#else
#define debug(...) debug_out(__VA_ARGS__)
#endif

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

int n;
ll m;
vector<ll> as;
ll a_gcd = 0, a_lcm = 1;

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

int main()
{
    // 高速な入出力
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(15); // 浮動小数の表示の精度

    cin>>n>>m;
    rep(i,n){
        ll a; cin>>a; a/=2;
        as.push_back(a);
        a_gcd = gcd(a_gcd, a);
    }

    rep(i, n)
    {
        as[i] /= a_gcd;
    }
    m /= a_gcd;

    bool all = true;
    rep(i,n) {
        all &= (as[i] & 1);
    }
    if (!all) { cout << 0 << '\n'; return 0; }

    rep(i,n) {
        a_lcm = lcm(as[i], a_lcm);
        if (a_lcm > m) {
            cout << 0 << '\n'; return 0;
        }
    }
    cout << (m / a_lcm + 1) / 2 << '\n';

    return 0;
}


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

#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define RFOR(i, a, b) for(int i=(a); i>=(b); i--)
#define REP(i, n) FOR(i, 0, n)
#define RREP(i, n) RFOR(i, n, 0)
#define CEIL(n, m) ceil(n/pow(10.0, m))*pow(10.0, m)
#define FLOOR(n, m) floor(n/pow(10.0, m))*pow(10.0, m)
#define ROUND(n, m) round(n/pow(10.0, m))*pow(10.0, m)
#define ALL(x) (x).begin(),(x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define RSORT(x) sort((x).begin(),(x).end(),greater<int>())
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define llong long long
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) " (L" << __LINE__ << ") " << __FILE__ << endl;

void solve()
{
  int ans=0;
  int n, k; cin >> n >> k;
  vector<int> vec(n); REP(i, n) cin >> vec[i];

  ans = (n-1+k-2)/(k-1);

  cout << ans << endl;

}

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


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

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

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

	vector<vector<int>> dp(s.size()+1,vector<int>(t.size()+1,0));
	for(int i=0;i<s.size();i++){
		for(int j=0;j<t.size();j++){
			dp.at(i+1).at(j+1)=max({dp.at(i+1).at(j+1),dp.at(i+1).at(j),dp.at(i).at(j+1)});
			if(s.at(i)==t.at(j))	dp.at(i+1).at(j+1)=max(dp.at(i+1).at(j+1),dp.at(i).at(j)+1);
		}
	}

	string ans="";
	int i=s.size(),j=t.size();
	while(i>0 && j>0){
		if(dp.at(i).at(j)==dp.at(i-1).at(j))	i--;
		else if(dp.at(i).at(j)==dp.at(i).at(j-1))	j--;
		else if(dp.at(i).at(j)==dp.at(i-1).at(j-1)+1){
			i--;
			j--;
			ans=s.at(i)+ans;
		}
	}
	cout << ans << endl;
	
	return 0;
}


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

typedef tuple<int, int, int> ti;
typedef pair<int, int> pi;
int main() {
  int n, C;
  cin>>n>>C;
  vector<ti> a;
  for (int i=0; i<n; i++) {
    int s, t, c;
    cin>>s>>t>>c;
    --c;
    a.emplace_back(s, c, t);
  }
  sort(a.begin(), a.end());
  queue<ti> que;
  for (auto i: a) {
    que.push(i);
  }
  int recoder[C];
  for (int i=0; i<C; i++) recoder[i] = -1;
  int ans = 0;
  int n_recoder = 0;
  for (int i=1; i<=1e5; i++) {
    while (!que.empty()) {
      auto front = que.front();
      int s = get<0>(front);
      int c = get<1>(front);
      int t = get<2>(front);
      if (s > i) {
        break;
      }
      que.pop();
      if (recoder[c] != -1) {
        recoder[c] = t;
        continue;
      }
      int j;
      for (j=0; j<C; j++) {
        if (recoder[j] == -1) {
          continue;
        }
        if (recoder[j] < s) {
          break;
        }
      }
      if (j < C) {
          recoder[j] = -1;
      } else {
        ++n_recoder;
      }
      recoder[c] = t;
    }
    ans = max(n_recoder, ans);
  }
  cout<<ans<<endl;
}

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

int main(){
  int N, l, r = 0;
  int sum = 0;
  cin >> N;
  
  rep(i,N){
    cin >> l >> r;
    sum += r-l+1;
  }
  cout << sum << endl;
}

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

int main() {
    int H, W, d;
    cin >> H >> W >> d;

    string color = "RGBY";
    for (int x = 0; x < H; ++x) {
        for (int y = 0; y < W; ++y) {
            int u = x + y, v = x - y + 100000 * d;
            int kind = 0;
            kind += (u % (d * 2)) / d;
            kind += (v % (d * 2)) / d * 2;

            cout << color[kind];
        }
        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 512
using System;

    class Program
    {
        static void Main(string[] args)
        {
            int r, c, i, j;
            int subTotal = 0;
            int total = 0;

            //整数受け取り
            string[] str = Console.ReadLine().Split(' ');
            r = int.Parse(str[0]);
            c = int.Parse(str[1]);

            //2次元配列数値受け取り
            int[,] array = new int[r, c];

            for (i = 0; i < r; i++)
            {
                string[] str2 = Console.ReadLine().Split(' ');

                for (j = 0; j < c; j++)
                {
                    array[i, j] = int.Parse(str2[j]);
                }
            }

            //横配列計算
            for (i = 0; i < r; i++)
            {
                for (j = 0; j < c; j++)
                {
                    subTotal += array[i, j];
                    Console.Write(array[i, j] + " ");
                }
                Console.Write(subTotal);
                subTotal = 0;
                Console.WriteLine("");
            }

            //縦配列計算
            for (j = 0; j < c; j++)
            {
                for (i = 0; i < r; i++)
                {
                    subTotal += array[i, j];
                }
                Console.Write(subTotal + " ");
                total += subTotal;
                subTotal = 0;
            }
            Console.WriteLine(total);
        }
    }



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

using ll = long long;
using P = pair<int, int>;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main() {
  char c;
  cin >> c;

  char ans;
  if (c == 'A') ans = 'T';
  else if (c == 'T') ans = 'A';
  else if (c == 'C') ans = 'G';
  else ans = 'C';

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


Measured memory_bytes: 256
import java.util.*;
class Main{
	static Scanner s = new Scanner(System.in);
	public static void main(String[] args) {
		System.out.println(Math.max(s.nextInt()+s.nextInt()+s.nextInt()+s.nextInt(),s.nextInt()+s.nextInt()+s.nextInt()+s.nextInt()));
	}
}

Measured memory_bytes: 26044
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

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

ll gcd(ll a , ll b){
	if(b == 0) return a;
	return gcd(b , a % b);	
}
ll lcm(ll a , ll b){
	ll g = gcd(a , b);
	ll lc = (a/g) * b;
	return lc;
}

int main(){
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if(s == "keyence") cout << "YES" << endl;
    else{
      rep(i,s.size()){
        for(int j = 0;j<=s.size()-i;j++){
          string t = s.substr(i,j);
          s.erase(i,j);
          if(s == "keyence"){
            cout << "YES" << endl;
            return 0;
          }
          s.insert(i,t);
        }
      }
      cout << "NO" << endl;
    }
    return 0;
}

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

int main(){
  int N,M;
  int ans=0;
  cin >> N >> M;
  if(N<2){
    ans+=M*(M-1)/2;
  }else if(M<2){
    ans+=N*(N-1)/2;
  }else {
    ans+=M*(M-1)/2;
    ans+=N*(N-1)/2;
  }
  printf("%d",ans);
  return 0;
}

Measured memory_bytes: 256
import Control.Applicative ((<$>), (<*>))
import Data.List (unfoldr, sort)
import Data.Char (isSpace)
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B

getL :: (ByteString -> [Integer]) -> IO [Integer]
getL f = f <$> B.getLine

readIL :: (ByteString -> Maybe (Integer, ByteString)) -> (ByteString -> [Integer])
readIL f = unfoldr g
    where
        g s = do
            (n, s') <- f s
            return (n, B.dropWhile isSpace s')

main :: IO ()
main = do
    [n, k] <- getL (readIL B.readInteger)
    as <- getL (readIL B.readInteger)
    print $ solve n k as

solve :: Integer -> Integer -> [Integer] -> Integer
solve n k as = (innerInv + outerInv) `mod` 1000000007
    where
        innerInv = (inversion' as) * k `mod` 1000000007
        outerInv = ((inversion' $ reverse $ sort as) * k * (k - 1) `div` 2) `mod` 1000000007

inversion :: [Integer] -> Integer
inversion []       = 0
inversion [x]      = 0
inversion (x:y:xs)
    | x > y        = 1 + inversion (x:xs)
    | otherwise    = inversion (x:xs)

inversion' :: [Integer] -> Integer
inversion' []        = 0
inversion' [x]       = 0
inversion' ys@(x:xs) = (inversion ys) `mod` 1000000007 + (inversion' xs) `mod` 1000000007

Measured memory_bytes: 1532
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <string>

#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define vvi vector<vector<int>>
#define INF (int)1e9
#define fora(i,a,b) for(ll i=a;i<b;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define si size()
#define be begin()
#define en end()
#define le length()
#define mp(x,y) make_pair(x,y)
#define mii map<int,int>
using namespace std;

int main()
{   ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    ll n,s=0,p;
    float f;
    cin>>n;
    vll v(n);
    fora(i,0,n)
    {
        cin>>v[i];
        s+=v[i];
    }
    f=(s*1.0)/(n*1.0);
    p=round(f);
    s=0;
    fora(i,0,n)
    {
        s+=(abs(p-v[i]))*(abs(p-v[i]));
    }
    cout<<s;
    return 0;
}




Measured memory_bytes: 256
//~ while (clock()<=69*CLOCKS_PER_SEC)
//~ #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
//~ #pragma GCC target ("avx2")
//~ #pragma GCC optimize("Ofast")
//~ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//~ #pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

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

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#define shandom_ruffle random_shuffle

using ll=long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using vi=vector<int>;
using vll=vector<ll>;
const int nax=1000*1007;
const ll mod=1000*1000*1000+7;
const ll inf=1e18;

int h, w, n;

ll sil[nax];
ll odw[nax];

ll dp[nax];

pii tab[nax];

ll kom(int a, int b)
{
	if (b>a || b<0)
		return 0;
	return sil[a]*(odw[b]*odw[a-b]%mod)%mod;
}

ll tra(int a, int b)
{
	if (a<0 || b<0)
		return 0;
	return kom(a+b, a);
}

int main()
{
	scanf("%d%d%d", &h, &w, &n);
	sil[0]=1;
	odw[0]=odw[1]=1;
	for (int i=1; i<nax; i++)
		sil[i]=(sil[i-1]*i)%mod;
	for (int i=2; i<nax; i++)
		odw[i]=(odw[mod%i]*(mod-mod/i))%mod;
	for (int i=2; i<nax; i++)
		odw[i]=(odw[i-1]*odw[i])%mod;
	for (int i=1; i<=n; i++)
	{
		scanf("%d%d", &tab[i].first, &tab[i].second);
	}
	tab[n+1]={h, w};
	sort(tab+1, tab+1+n);
	//~ debug() << imie(tra(1, 1));
	//~ debug() << imie(tra(2, 2));
	//~ debug() << imie(tra(3, 3));
	//~ debug() << imie(tra(2, 3));
	for (int i=1; i<=n+1; i++)
	{
		dp[i]=tra(tab[i].first-1, tab[i].second-1);
		debug() << i << " " << tab[i] << " " << dp[i];
		for (int j=1; j<i; j++)
		{
			dp[i]-=dp[j]*tra(tab[i].first-tab[j].first, tab[i].second-tab[j].second);
			dp[i]%=mod;
		}
		dp[i]%=mod;
		dp[i]+=mod;
		dp[i]%=mod;
		debug() << i << " " << dp[i];
	}
	printf("%lld\n", dp[n+1]);
	return 0;
}


Measured memory_bytes: 19456
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + end + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw "ArrayIndexOutOfBoundsException ‚There is no more input";}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var s = next();
  var list = ["Sunny", "Cloudy", "Rainy"];
  var output = list.indexOf(s) + 1;
  output %= 3;
  myout(list[output]);
}

Measured memory_bytes: 30080
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
ll sieve[1000001]={0},i,j;
ll power(ll p, ll k)
{
ll a=1;
while(k)
{
if(k&1)
a=(a*p);
p=(p*p);
k>>=1;
}
return a;
}
using namespace std;
  ll countDivisors(ll n) 
{ 
    ll cnt = 0; 
    for (ll i = 1; i <= sqrt(n); i++) { 
        if (n % i == 0) { 
            if (n / i == i) 
                cnt++; 
  
            else 
                cnt = cnt + 2; 
        } 
    } 
    return cnt; 
} 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 int tc=1;
//cin>>tc;
ll cas=1;
 while(tc--)
 {
	 ll n,a,b;
	 cin>>a>>b;
	 ll result=-1;
	 for (int i = 1; i <= 80000; i++) {
		ll te = i * 0.08;
		ll tt = i * 0.1;
 
		if (te == a && tt == b) {
			result = i;
			break;
		}
	}
	cout<<result;
	cout<<"\n"; 
 } 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void pr(A a){cout << a << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
int INF=numeric_limits<int>::max();
// for(int j=0;j<N;++j) {}
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int main(void) {
  int k;cin>>k;
  ll sum=0;
  for(int a=1;a<=k;++a) {
  for(int b=1;b<=k;++b) {
  for(int c=1;c<=k;++c) {
    sum+=gcd(gcd(a,b),c);
  }
  }
  }
  pr(sum);
  return 0;
}


Measured memory_bytes: 3620
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


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


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class Bisect:
    def __init__(self, func):
        self.__func = func

    def bisect_left(self, x, lo, hi):
        while lo < hi:
            mid = (lo+hi)//2
            if self.__func(mid) < x:
                lo = mid+1
            else:
                hi = mid
        return lo

    def bisect_right(self, x, lo, hi):
        while lo < hi:
            mid = (lo+hi)//2
            if x < self.__func(mid):
                hi = mid
            else:
                lo = mid+1
        return lo

@mt
def slv(N, K, A, F):
    A.sort(reverse=True)
    F.sort()

    def possible(c):
        k = K
        for a, f in zip(A, F):
            d = c//f
            if d - a < 0:
                k += d - a
        if k >= 0:
            return 1
        return 0
    
    b = Bisect(possible)
    return b.bisect_left(1, 0, 10**18)


def main():
    N, K = read_int_n()
    A = read_int_n()
    F = read_int_n()
    print(slv(N, K, A, F))


if __name__ == '__main__':
    main()


Measured memory_bytes: 128328
#define _GLIBCXX_DEBUG
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rep2(i,s,n) for(int i=s;i< (int)n; i++)
#define ll long long 
#define all(v) v.begin(),v.end()
using namespace std;
int main(){
  ll n; cin >>n;
  vector<ll> a(n);
  rep(i,n)  cin >>a[i];
  sort(all(a));
  ll key=0;
  vector<ll> v(2,0);
  ll i=n-1;
  while(i>=1){
    if(i>0&&a[i]==a[i-1]){
      key++;
      if(key==1) v[0]=a[i];
      if(key==2) v[1]=a[i];
      i--;
    }
  i--;
  }
  cout <<v[0]*v[1]<<endl;
}

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

int main(){
    //input
    long long N, A[3];
    cin >> N >> A[0] >> A[1] >> A[2];
    string str;
    long long i;
    vector<pair<long long, long long> > S;
    for(i=0; i<N; i++){
        cin >> str;
        if(str=="AB"){
            S.push_back(make_pair(0,1));
        }else if(str=="AC"){//"CA"
            S.push_back(make_pair(2,0));
        }else if(str=="BC"){
            S.push_back(make_pair(1,2));
        }
    }

    //calc
    vector<char> ans;
    long long p,q;
    long long x,y;
    for(i=0; i<N; i++){
        p=S[i].first;
        q=S[i].second;
        if(A[p]<=0 && A[q]<=0){
            break;
        }
        if(A[p]==1 && A[q]==1){
            if(i>=N-1){
                ans.push_back((char)('A'+p));
                A[p]++;
                A[q]--;
            }else{
                x=S[i+1].first;
                y=S[i+1].second;
                if(p==x && q==y){
                    ans.push_back((char)('A'+p));
                    A[p]++;
                    A[q]--;
                }else if(p==y){
                    ans.push_back((char)('A'+p));
                    A[p]++;
                    A[q]--;
                }else if(q==x){
                    ans.push_back((char)('A'+q));
                    A[p]--;
                    A[q]++;
                }
            }
        }else{
            if(A[p]<=A[q]){
                ans.push_back((char)('A'+p));
                A[p]++;
                A[q]--;
            }else{
                ans.push_back((char)('A'+q));
                A[p]--;
                A[q]++;
            }
        }
    }

    //answer
    if(ans.size()>=N){
        cout << "Yes" << endl;
        for(i=0; i<N; i++){
            cout << ans[i] << endl;
        }
    }else{
        cout << "No" << endl;
    }
    system("pause");
    return 0;
}

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

template <class T>
inline void read(T &res)
{
	res = 0; bool bo = 0; char c;
	while (((c = getchar()) < '0' || c > '9') && c != '-');
	if (c == '-') bo = 1; else res = c - 48;
	while ((c = getchar()) >= '0' && c <= '9')
		res = (res << 3) + (res << 1) + (c - 48);
	if (bo) res = ~res + 1;
}

const int N = 2005, M = N << 1, INF = 0x3f3f3f3f;

int n, ecnt, nxt[M], adj[N], go[M], c[N], d[N], f[N], ans = INF;
char s[N];

void add_edge(int u, int v)
{
	nxt[++ecnt] = adj[u]; adj[u] = ecnt; go[ecnt] = v;
	nxt[++ecnt] = adj[v]; adj[v] = ecnt; go[ecnt] = u;
}

void dfs(int u, int fu)
{
	c[u] = s[u] == '1'; d[u] = 0; int vt = 0;
	for (int e = adj[u], v; e; e = nxt[e])
		if ((v = go[e]) != fu)
		{
			dfs(v, u); c[u] += c[v]; d[u] += d[v] + c[v];
			if (d[v] + c[v] > d[vt] + c[vt]) vt = v;
		}
	if ((d[vt] + c[vt] << 1) <= d[u]) return (void) (f[u] = d[u] >> 1);
	int orz = f[vt] << 1;
	if ((d[vt] + c[vt] << 1) - d[u] <= orz) return (void) (f[u] = d[u] >> 1);
	f[u] = f[vt] + (d[u] - d[vt] - c[vt]);
}

int main()
{
	int x, y;
	scanf("%d%s", &n, s + 1);
	for (int i = 1; i < n; i++) read(x), read(y), add_edge(x, y);
	for (int u = 1; u <= n; u++) if (dfs(u, 0), f[u] * 2 == d[u] && f[u] < ans)
		ans = f[u]; 
	return std::cout << (ans == INF ? -1 : ans) << std::endl, 0;
}

Measured memory_bytes: 3756
n = int(input())
H = [int(x) for x in input().strip().split()]

inf = int(10e9 + 7)
dp = [inf] * n
dp[0] = 0
for i in range(n):
    for j in range(i+1,min(n,i+3)):
        dp[j] = min (dp[j], dp[i] + abs(H[i] - H[j]))
print (dp[-1])

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

typedef long long ll;

int main(){
    int N; cin >> N;
    string s; cin >> s;
    ll cnt[3]={};
    for(int i=0;i<N;i++){
        if(s[i]=='R') cnt[0]++;
        else if(s[i]=='G') cnt[1]++;
        else cnt[2]++;
    }
    ll ans=cnt[0]*cnt[1]*cnt[2];
    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            if(2*j-i>=N) continue;
            if(s[i]!=s[j]&&s[i]!=s[2*j-i]&&s[j]!=s[2*j-i]){
                ans--;
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
Option Explicit On

Module Module1

    Sub Main()

        Dim tmp As String() = Split(Console.ReadLine(), " ")
        Dim N As Integer = CInt(tmp(0))
        Dim M As Integer = CInt(tmp(1))
        Dim ans As Integer = N

        Dim H(N - 1) As Integer
        Dim yoi(N - 1) As Boolean
        Dim tmp2 As String() = Split(Console.ReadLine(), " ")
        For i As Integer = 0 To N - 1
            H(i) = CInt(tmp2(i))
            yoi(i) = True
        Next

        Dim a(M - 1) As Integer
        Dim b(M - 1) As Integer
        Dim r(M - 1) As Integer
        For i As Integer = 0 To M - 1
            Dim tmp3 As String() = Split(Console.ReadLine(), " ")
            a(i) = CInt(tmp3(0))
            b(i) = CInt(tmp3(1))
            If H(a(i) - 1) < H(b(i) - 1) Then
                If yoi(a(i) - 1) = True Then
                    ans -= 1
                    yoi(a(i) - 1) = False
                End If
            ElseIf H(a(i) - 1) > H(b(i) - 1) Then
                If yoi(b(i) - 1) = True Then
                    ans -= 1
                    yoi(b(i) - 1) = False
                End If
            Else
                If yoi(a(i) - 1) = True Then
                    ans -= 1
                    yoi(a(i) - 1) = False
                End If
                If yoi(b(i) - 1) = True Then
                    ans -= 1
                    yoi(b(i) - 1) = False
                End If
            End If
        Next

        Console.WriteLine(ans)

    End Sub

End Module


Measured memory_bytes: 57612
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int[] a=new int[101];
        int i,t,j,n,co=0;
        n = sc.nextInt();
        for(i=0;i<n;i++){
            a[i] = sc.nextInt();
        }
        for(i=n-1;i>0;i--){
            for(j=n-1;j>=n-i;j--){
                if(a[j]<a[j-1]){
                    t=a[j];
                    a[j]=a[j-1];
                    a[j-1]=t;
                    co++;
                }

            }
        }

        for(i=0;i<n;i++){
            if(i==0)System.out.print(a[i]);
            else System.out.print(" "+a[i]);
        }
        System.out.println();
        System.out.println(co);
    }
}


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

using namespace std;
const int MAXN = 110;

int N;
int edge[MAXN][MAXN];
int dmin[MAXN];
int mradius;

int radius (int cloc)
{
    int ans = 0;
    for (int i = 0; i < N; i++)
        ans = max (ans, edge[i][cloc]);
    return ans;
}

long long v;

void flood (int cloc, int last, int cdist)
{
    int deg = 0;
    for (int i = 0; i < N; i++)
        if (edge[i][cloc] == 1)
            deg++;

    if (cloc != last)
        deg--;

    dmin[cdist] = max (dmin[cdist], deg);
    for (int i = 0; i < N; i++)
    {
        if (edge[i][cloc] == 1 && i != last)
        {
            flood (i, cloc, cdist + 1);
        }
    }
}

long long get_res (int x, int y)
{
    for (int i = 0; i < MAXN; i++)
        dmin[i] = 0;
    flood (x, y, 0);
    flood (y, x, 0);

    long long ans = 1;
    for (int i = 0; i < mradius - 1; i++)
        ans *= dmin[i];
    return ans;
}

int main()
{
    for (int i = 0; i < MAXN; i++)
        for (int j = 0; j < MAXN; j++)
            edge[i][j] = MAXN;
    for (int i = 0; i < MAXN; i++)
        edge[i][i] = 0;
    cin >> N;
    for (int i = 0; i < N - 1; i++)
    {
        int x, y;
        cin >> x >> y;
        x--, y--;
        edge[x][y] = edge[y][x] = 1;
    }

    for (int k = 0; k < N; k++)
    {
        for (int i = 0; i < N; i++)
            for (int j = 0; j < N; j++)
                edge[i][j] = min (edge[i][j], edge[i][k] + edge[k][j]);
    }

    mradius = MAXN;
    int mloc = -1;
    for (int i = 0; i < N; i++)
    {
        int r = radius (i);
        if (r < mradius)
        {
            mradius = r;
            mloc = i;
        }
    }

    int other_mloc = -1;
    for (int i = 0; i < N; i++)
        if (i != mloc && radius(i) == mradius)
            other_mloc = i;

    if (other_mloc == -1)
        mradius++;
    cout << mradius << " ";

    v = 8e18;
    if (other_mloc != -1)
    {
        cout << 2 * get_res(mloc, other_mloc) << "\n";
    }
    else
    {
        for (int i = 0; i < N; i++)
            if (edge[i][mloc] <= 1)
                v = min (v, (edge[i][mloc] + 1) * get_res(mloc, i));
        cout << v << "\n";
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
     
     
    int main(){
    	int a;
    	double x=0,y;
    	cin >> a;
      y=a;
    	for(int i=1;i<=a;i++){
    		if(i%2) x++;
    	}
    	
    	printf("%.7lf\n",x/y);
    	return 0;
    }

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include<iomanip>
#include<set>
using namespace std ;

#define MAXN 100007
#define MOD 1000000007

int n ;
string a ;



void input ( ) {
    cin >> n ;
    cin >> a ;
}

void solve ( ) {
    long long x = 0 ;
    long long ans = 1 ;
    for ( int i = 0 ; i < 2 * n ; ++ i ) {
        if ( x > ( 2 * n - i ) ) {
            ans = 0 ;
        }
        else {
            if ( a[ i ] == 'W' ) {
                if ( ( x & 1 ) != 0 ) {
                    ++ x ;
                }
                else {
                    ans = ( ans * x ) % MOD ;
                    -- x ;
                }
            }
            else {
                if ( ( x & 1 ) == 0 ) {
                    ++ x ;
                }
                else {
                    ans = ( ans * x ) % MOD ;
                    -- x ;
                }
            }
        }
    }
    for ( int i = 1 ; i <= n ; ++ i ) {
        ans = ( ans * i ) % MOD ;
    }
    printf ( "%lld\n" , ans ) ;
}

int main ( ) {
    ios_base :: sync_with_stdio ( false ) ;
    cin.tie ( NULL ) ;
    input ( ) ;
    solve ( ) ;
    return 0 ;
}



Measured memory_bytes: 720
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef set<int> si;
typedef map<string, int> msi;
typedef greater<int> gt;
typedef priority_queue<int, vector<int>, gt> minq;
typedef long long ll;
typedef pair<ll,ll> pll;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  int n; cin >> n;
  vi h(n);
  vi dp(n);
  dp[n-1] = 0;
  rep(i, n) cin >> h[i];
  int ans =0 ;
  for (int i=n-2; i>=0; i--) {
    if (h[i+1] <= h[i]) {
      dp[i] = dp[i+1] + 1; 
    } else {
      dp[i] = 0;
    }
    ans = max(ans, dp[i]);
  }
  cout << ans << endl;
  return 0;
} 

Measured memory_bytes: 1024
// -----------------------------------
// Author     : MatsuTaku
// Country    : Japan
// Created    : 05/17/20 20:37:02
// -----------------------------------

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

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

  int n; cin>>n;
  vector<string> ans = {
      "pon",
      "pon",
      "hon",
      "bon",
      "hon",
      "hon",
      "pon",
      "hon",
      "pon",
      "hon",
  };
  cout << ans[n%10] << endl;

  return 0;
}


Measured memory_bytes: 3660
#include <algorithm>
#include <iostream> //入出力
#include <stdio.h>
#include <map>
#include <set>
#include <string>
#include <math.h> //算術演算子
#include <vector>
#include <cstdlib>
#include <queue>
#include <stack>
#include <list>
#include <iomanip> //小数点以下を表示させる(setprecision())
//#include <bits/stdc++.h>
using namespace std;
typedef long long ll; //64bit型

#define debug(x) cerr << x << " " \
                      << "(L:" << __LINE__ << ")" << '\n'
#define PRINT(V)                                   \
        {                                          \
                for (int i = 0; i < V.size(); i++) \
                {                                  \
                        cout << V[i] << " ";       \
                }                                  \
                cout << endl;                      \
        }

int gcd(int a, int b)
{
        return b ? gcd(b, a % b) : a;
}

int main()
{
        //input->compute->output//
        int A,B,C;
        cin >> A>>B>>C;
        

        cout << min(A*B,C) << endl;

        return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <bitset>

using namespace std;

//#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

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

//static const ll MOD = 1000000007;
//static const ll INF = 100000000;
//#define PI 3.14159265359

int main() {
    // input
    ll N, M;
    cin >> N >> M;
    ll a[M];
    for (ll i = 0; i < M; i++) {
        cin >> a[i];
    }

    // process
    for (ll i = 0; i < M; ++i) {
        N -= a[i];
    }

    if (N < 0) {
        cout << -1;
    } else {
        cout << N;
    }


    return 0;
}

Measured memory_bytes: 3272