akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Prob0002
{
    class Program
    {
        const char splitBy = ' ';

        static void Main(string[] args)
        {
            string line;
            while (!string.IsNullOrEmpty(line = System.Console.ReadLine()))
            {
                string[] ab = line.Split(splitBy);
                int a = Convert.ToInt32(ab[0]);
                int b = Convert.ToInt32(ab[1]);
                Console.WriteLine((int)Math.Log10(a + b) + 1);
            }
        }


    }
}

Measured memory_bytes: 5732
//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

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

template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
    return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
    auto inner = make_vec_nd(init, rest...);
    return vector<decltype(inner)>(size, inner);
}

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)

struct Edge {
    ll from;
    ll to;
    ll score;
};

int main() {
    ll N, M, P;
    cin >> N >> M >> P;
    vector<Edge> edges;
    rep(i,0,M) {
        ll A, B, C;
        cin >> A >> B >> C;
        A--;
        B--;
        edges.push_back({A, B, C-P});
    }
    vector<ll> score(N, numeric_limits<ll>::min());
    score[0] = 0;
    vector<bool> loop(N);
    vector<bool> inv_reachable(N);
    inv_reachable[N-1] = true;
    rep(i,0,2*M) {
        for (Edge e : edges) {
            if (score[e.from] != numeric_limits<ll>::min()
                && score[e.from] + e.score > score[e.to]) {
                if (i >= M) {
                    loop[e.to] = true;
                }
                score[e.to] = score[e.from] + e.score;
            }
            if (inv_reachable[e.to]) {
                inv_reachable[e.from] = true;
            }
        }
    }
    rep(i,0,N) {
        if (loop[i] && inv_reachable[i]) {
            cout << -1 << endl;
            return 0;
        }
    }
    cout << max((ll)0, score[N-1]) << endl;
}


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

int main() {
	int n;
	cin>>n;
	int d[n];
	for(int i=0; i<n;i++){
		cin>>d[i];
	}
	int sum=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(i!=j){
				sum+=d[i]*d[j];
			}
		}
	}
	cout<<sum/2;
}

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

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	map<char,string> inp;
	string s; cin>>s; inp['A'] = s;
	cin>>s; inp['B'] = s;
	cin>>s; inp['C'] = s;
	char start = 'A';
	while(true){
		char nxt = inp[start][0]; inp[start].erase(inp[start].begin());
		if( nxt == 'a' ){ start = 'A'; }
		if( nxt == 'b' ){ start = 'B'; }
		if( nxt == 'c' ){ start = 'C'; }
		if( inp[start].size() == 0 ){ cout<<start<<endl; return 0; }
	}
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX(A, B) (((A) < (B)) ? (B) : (A))
#define MIN(A, B) (((A) < (B)) ? (A) : (B))

int main() {
  int x;
  scanf("%d", &x);
  if (x == 3 || x == 5 || x == 7) 
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807


int main() {
    ll n, x;
    cin >> n >> x;
    vector<ll> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    reverse(a.begin(),a.end());
    vector<ll> asum(n);
    asum[0] = a[0];
    for(int i = 1; i < n; i++){
        asum[i] = asum[i-1] + a[i];
    }


    ll ans = LLINF;
    for(int i = 1; i <= n; i++){
        bool overflow = false;
        ll cost = (i+n)*x;
        cost += 5*asum[i-1];
        ll prevcost = cost;
        ll num = 2*i-1;
        ll cnt = 1;
        while(num < n){
            ll coef = 2*cnt+3;
            cost += coef*(asum[num]-asum[num-i]);
            if(prevcost > cost){overflow = true;}
            else{prevcost = cost;}
            cnt++;
            num += i;
        }
        if(overflow){continue;}
        cost += (2*cnt+3)*(asum[n-1]-asum[num-i]);
        ans = min(ans, cost);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3328
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 1))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (ql:quickload '(:cl-debug-print :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defun ensure-list (x) (if (listp x) x (list x)))
(defmacro nlet (name args &body body)
  (let ((args (mapcar #'ensure-list args)))
    `(labels ((,name ,(mapcar #'car args) ,@body))
       (,name ,@(mapcar #'cadr args)))))

(declaim (inline split-to-list))
(defun split-to-list (str size)
  (declare (optimize (speed 3) (safety 1))
           (fixnum size)
           (string str))
  (loop for idx below size
        for pos1 = 0 then (1+ pos2)
        for pos2 = (position #\space str :start pos1 :test #'char=)
        collect (parse-integer str :start pos1 :end pos2)))

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

;; Hauptteil
(declaim (inline extract-available-bars))
(defun extract-available-bars (list)
  (nlet recurse ((list list) (hash (make-hash-table)) res)
    (cond ((null list) res)
          ((gethash (car list) hash)
           (setf (gethash (car list) hash) nil)
           (recurse (cdr list) hash (cons (car list) res)))
          (t (setf (gethash (car list) hash) t)
             (recurse (cdr list) hash res)))))

(deftype uint nil `(integer 0 ,(expt 10 9)))
(defun main ()
  (declare #.OPT)
  (let* ((n (read))
         (bars (split-to-list (read-line) n))
         (available-bars (extract-available-bars bars)))
    (if (null (cdr available-bars))
        (println 0)
        (let* ((longest (reduce #'max available-bars))
               (second-longest (reduce #'max (delete longest available-bars :count 1))))
          (println (* longest second-longest))))))

#-swank(main)


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

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y) swap(x, y);

	while (0 < y) {
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
Type lcm(Type x, Type y)
{
	return x * y / gcd(x, y);
}

template<class Type>
bool is_prime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2) {
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++) {
		if (isPrime[i]) {
			Type j = i + i;
			while (j <= n) {
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binary_search_judge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binary_search(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok)) {
		int mid = (ng + ok) / 2;
		if (binary_search_judge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

int main()
{
	char c;
	cin >> c;
	cout << char(c + 1) << endl;
}

Measured memory_bytes: 764
#include <stdio.h>
#define MAX 100
static const int INFTY = (1<<21);
int n,A[MAX][MAX];

int prim();

int main(){
  int i,j,s;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&s);
      A[i][j]=(s==-1)?INFTY : s;
    }
  }
  printf("%d\n",prim());
  return 0;
}

int prim(){
  int e,min,i,v,sum=0;
  int g[MAX],r[MAX],a[MAX];

  for(i=0;i<n;i++){
    g[i]=INFTY;
    r[i]=-1;
    a[i]=0;
  }
  g[0]=0;

  while(1){
    min=INFTY;
    e=-1;
    for(i=0;i<n;i++){
      if(min>g[i]&&a[i]!=2){
	e=i;
	min=g[i];
      }
    }
    if(e==-1)
      break;
    a[e]=2;
    for(v=0;v<n;v++){
      if(a[v]!=2&&A[e][v]!=INFTY){
	if(g[v]>A[e][v]){
	  g[v]=A[e][v];
	  r[v]=e;
	  a[v]=1;
	}
      }
    }
  }
  for(i=0;i<n;i++){
    if(r[i]!=-1)
      sum+=A[i][r[i]];
  }
  return sum;
}



Measured memory_bytes: 2056
#include <stdio.h>

int main(void) {
    int s;
    scanf("%d", &s);

    int h, m;
    h = s / 3600; s -= 3600*h;
    m = s / 60; s -= 60*m;
    printf("%d:%d:%d\n", h, m, s);

    return 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>
#include <set>
#include <cmath>
using namespace std;

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

    int ans = 0;
    while(*max_element(h.begin(), h.end()) > 0){
        int l = 0;
        for(int i=0; i<N; i++){
            if(h[i] > 0){
                l = i;
                break;
            }
        }
        int r = N-1;
        for(int i=l+1; i<N; i++){
            if(h[i] == 0){
                r = i-1;
                break;
            }
        }
        for(int i=l; i<=r; i++)
            h[i]--;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplece_back
#define mp make_pair
#define i_i pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< i_i >
#define Edge pair< i_i, int>
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; scanf("%lld", &x);
#define int2(x, y) int x, y; scanf("%lld %lld", &x, &y);
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
 
//int dxy[5] = {0, 1, 0, -1, 0};
// assign

int fact[1145140];
int pascal_table[100][100];

void make_pascal(int mod)
{
    rep(i, 100) {
        pascal_table[i][0] = 1;
        for (int j = 1; j < i; j++) {
            pascal_table[i][j] = (pascal_table[i-1][j-1] +
                pascal_table[i-1][j]) % mod;
        }
        pascal_table[i][i] = 1;
    }
}

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

int extgcd(int a, int b, int &x, int &y)
{
    int d = a;
    if (b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    } else { x = 1; y = 0; }
    return d;
}

int repow(int x, int n, int mod)
{
    if (n == 0) return 1;
    int res = repow(x * x % mod, n / 2, mod);
    if (n & 1) res = res + x % mod;
    return res;
}

int mod_inverse(int a, int m)
{
    int x, y;
    extgcd(a, m, x, y);
    return ( m + x % m ) % m;
}

int table(int n)
{
    int sum = 1;
    fact[0] = 1;
    Rep(i, n+2) {
        sum *= i;
        sum %= MOD;
        fact[i] = sum;
    }
}

int mod_fact(int n, int p, int &e)
{
    e = 0;
    if (n == 0) return 1;
    int res = mod_fact(n / p, p, e);
    e += n / p;

    if (n / p % 2 != 0) return res * (p - fact[n % p]) % p;
    return res * fact[n % p] % p;
}

int mod_comb(int n, int k, int p) {
    if (n < 0 || k < 0 || n < k) return 0;
    int e1, e2, e3;
    int a1 = mod_fact(n, p, e1), a2 = mod_fact(k, p, e2), a3 = mod_fact(n-k, p, e3);
    if (e1 > e2 + e3) return 0;
    return a1 * mod_inverse(a2 * a3 % p, p) % p;
}

int ncm(int n, int r)
{
    if (r == 0) return 1;
    return (n-r+1) * ncm(n, r-1) / r;
}


signed main()
{
    int2(h, w);
    int2(a, b);
    table(1001000);

    int ans = 0;
    Rep(i, h-a+1) {
        int bef = 1;
        if (i == 1 || b == 1) {
            bef = 1;
        } else {
            bef = mod_comb( b-1+i-1, i-1, MOD);
        }
        //cout << "(" << bef << ",";
        if (w - b == 1) {
            ans += bef;
        } else {
            bef *= mod_comb( h - i + w - b-1, w - b-1, MOD);
            /*
            cout <<  mod_comb( h - i + w - b-1, w - b-1, MOD) << ")" << 
                endl;
                */
            ans += (bef % MOD);
        }
        ans %= MOD;
    }
    cout << ans << endl;


    return 0;
}



Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define FOR(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define FORUL(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#define FORULE(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define FOREACH(it, X) for(__typeof((X).begin()) it = (X).begin(); it != (X).end(); it++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define AUTOVAR(newvar,v) auto newvar = (v)
#else
#define AUTOVAR(newvar,v) __typeof(newvar) r = (v)
#endif
#define PB(x) push_back(x)
#define MP(x,y) make_pair((x),(y))
#define MEMSET(m,v) memset(m,v,sizeof(m))

typedef long long				 ll;
typedef unsigned long long		ull;

#define DEBUG 1

#if DEBUG
#define DOUT cout<<"["<<__LINE__<<"]:"
#else
#define DOUT 0 && cout
#endif

using namespace std;


int main(int argc, char *argv[])
{
	ios::sync_with_stdio(false);

	int r;
	cin >> r;
	cout << r*r << endl;

	return 0;
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;

int main() {
  ll A;
  long double B;
  cin >> A >> B;
  B *= 100.0;
  B = round(B);
  ll ans = A * B;
  ans /= 100;
  cout << ans << "\n";
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double ld;
#define F first
#define S second
#define fi(a, b) for(ll i=(a);i<=b;i++)
#define fj(a, b) for(ll j=(a);j<=b;j++)
#define fid(a, b) for(ll i=(a);i>=b;i--)
#define fjd(a, b) for(ll i=(a);i>=b;j--)

template<class T> ostream& operator<<(ostream &os, vector<T> V) {
    os << "[ ";
    for(auto v : V) os << v << " ";
    os << "]";
	return os;
}
template<class T> ostream& operator<<(ostream &os, set<T> S){
    os << "{ ";
    for(auto s:S) os<<s<<" ";
    return os<<"}";
}
template<class T> ostream& operator<<(ostream &os, multiset<T> S){
    os << "{ ";
    for(auto s:S) os<<s<<" ";
    return os<<"}";
}
template<class L, class R> ostream& operator<<(ostream &os, pair<L,R> P) {
    return os << "(" << P.first << "," << P.second << ")";
}
template<class L, class R> ostream& operator<<(ostream &os, map<L,R> M) {
    os << "{ ";
    for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") ";
    return os<<"}";
}
template<class L, class R> ostream& operator<<(ostream &os, unordered_map<L,R> M) {
    os << "{ ";
    for(auto m:M) os<<"("<<m.F<<":"<<m.S<<") ";
    return os<<"}";
}

// Kevin Mathew T
// Birla Institute of Technology, Mesra
// LinkedIn - https://www.linkedin.com/in/KevinMathewT/
// GitHub - https://github.com/KevinMathewT
// CodeForces - https://codeforces.com/profile/KevinMathew
// CodeChef - https://www.codechef.com/users/KevinMathew
// HackerRank - https://www.hackerrank.com/KevinMathew

const ll N = 100010, M = 1e9 + 7;
ll n, a, b;
string s;

void solve(){
	cin >> n >> a >> b;
	cin >> s;

	ll tota = 0, totb = 0, sel = 0;
	fi(0, s.size() - 1) {
		if(s[i] == 'a') {
			if(sel < ((a + b))) {
				cout << "Yes\n";
				tota++;
				sel++;
			} else {
				cout << "No\n";
			}
		} else if(s[i] == 'b') {
			totb++;
			if(sel < (a + b) && totb <= b) {
				cout << "Yes\n";
				sel++;
			} else {
				cout << "No\n";
			}
		} else {
			cout << "No\n";
			continue;
		}
	}
}

int main(){
	// freopen("input.txt", "r", stdin);		//Comment
	// freopen("output.txt", "w", stdout);		//this out.
	ios::sync_with_stdio(false);			//Not
	cin.tie(NULL);							//this.
	cout.tie(0);							//or this.

	// ll T;
	// cin >> T;
	// while(T--)
		solve();

	return 0;
}

Measured memory_bytes: 848
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)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::Ordering;
fn main() {
    input! {
        n: usize,
        a: [u32; n],
    };
    if n < 3 {
        println!("1");
        return;
    }
    let mut ans = 1;
    let mut last_order = Ordering::Equal;

    for v in a.windows(2) {
        match last_order{
            Ordering::Equal => {
                last_order = v[1].cmp(&v[0]);
            },
            Ordering::Greater => {
                if v[1] < v[0] {
                    ans += 1;
                    last_order = Ordering::Equal;
                }
            },
            Ordering::Less => {
                if v[1] > v[0] {
                    ans += 1;
                    last_order = Ordering::Equal;
                }
            },
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define SZ(x) ((int)(x).size())
typedef long long ll;
typedef pair<int, int> pii;

const int N = 1003;

int n, m;
char a[N][N];
bool vis[N][N];
queue<pii> Q;

int di[] = { -1, 0, 0, 1 };
int dj[] = { 0, -1, 1, 0 };

int main() {
	std::ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (a[i][j] == '#') {
				Q.push( { i, j });
				vis[i][j] = 1;
			}
		}
	}
	int res = 0;
	while (!Q.empty()) {
		int sz = Q.size();
		while (sz--) {
			auto cur = Q.front();
			Q.pop();
			for (int d = 0; d < 4; d++) {
				int ni = cur.first + di[d];
				int nj = cur.second + dj[d];
				if (ni < 0 || ni >= n || nj < 0 || nj >= m || vis[ni][nj])
					continue;
				Q.push( { ni, nj });
				vis[ni][nj] = 1;
			}
		}
		res++;
	}
	cout << res - 1 << endl;
	return 0;
}


Measured memory_bytes: 10384
#include<bits/stdc++.h>
using namespace std;
 
 string s, t;
  
 int main(){ 

  cin >> s >> t;

   sort (s.begin(), s.end());
   sort (t.rbegin(), t.rend());


  if (s < t) cout << "Yes" << endl;    
   else cout << "No" << endl;

 return 0;
}	

Measured memory_bytes: 256
num = list(map(int,input().split()))

if (num[0] == 1) or (num[1] == 1):
  ans = 1
else:
  w_1 = int((num[1]+1)/2)
  w_2 = int(num[1]/2)

  h_1 = int((num[0]+1)/2)
  h_2 = num[0] - h_1

  ans = h_1*w_1 + h_2*w_2

print(ans)

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    long long n, a, b;
    cin >> n >> a >> b;

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

    long long left = 0, right = 0;
    for (int i = 0; i < n; i++) {
        right = max(right, h[i]);
    }

    while (left < right) {
        long long mid = left + (right - left) / 2;

        long long cnt = 0;
        for (int i = 0; i < n; i++) {
            if (h[i] - mid * b > 0) {
                cnt += (h[i] - mid * b + a - b - 1) / (a - b);
            }
        }

        if (cnt <= mid && right == mid) {
            break;
        } else if (cnt <= mid) {
            right = mid;
        } else {
            left = mid + 1;
        }
    }

    cout << left << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll a, b, n, x, ans=0, num;

    cin >> a >> b >> n;

    num = min(n, b-1);

    cout << a*num/b-num/b*a << endl;

    return 0;
}

Measured memory_bytes: 3676
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

int main()
{
	double x, q;
	while(cin >> q)
	{
		if(q == -1)	
			break;
		x = q / 2.0;
		while (std::abs(x*x*x-q) >= 0.00001*q)
			x -= (x*x*x - q) / (3*x*x);
		printf("%f\n", x);
	}
}

Measured memory_bytes: 1228
#include "stdio.h"

enum {
  A,
  B,
  C,
  D,
  T_len
};

int main(){
  int N;
  int price[T_len];
  int cup_num[T_len];
  int least_cost[100];

  scanf("%d",&N);
  scanf("%d%d%d%d",price,price+1,price+2,price+3);
  scanf("%d%d%d%d",cup_num,cup_num+1,cup_num+2,cup_num+3);

  //printf("%d\n",N);
  //printf("%d %d %d %d\n",price[0],price[1],price[2],price[3]);
  //printf("%d %d %d %d\n",cup_num[0],cup_num[1],cup_num[2],cup_num[3]);

  least_cost[0]=0;

  for(int i=1;i<=N;i++) least_cost[i]=-1;

  for(int i=0;i<N;i++){
    for (int j=0;j<T_len;j++){
      int cost=least_cost[i]+price[j];
      
      for(int k=i;k<=i+cup_num[j]&&k<=N;k++){
	if (least_cost[k]==-1)
	  least_cost[k]=cost;
	else if (least_cost[k]>cost)
	  least_cost[k]=cost;

	//printf("i=%d,j=%d,k=%d\n",i,j,k);
      }


    }
  }

  //for(int i=0;i<=N;i++) printf("%d\t",least_cost[i]);

  printf("%d\n",least_cost[N]);

  return 0;
}



Measured memory_bytes: 2092
n = int(input())
x = list(map(int,input().split()))

x.sort()
ans = 0
min_ans = 10**9

for i in range(x[0],x[-1]+1):
    for j in range(len(x)):
        ans += (x[j]-i)**2
        
    if min_ans > ans:
        min_ans = ans
    
    ans = 0

print(min_ans)

Measured memory_bytes: 3064
import java.util.LinkedList;
import java.util.Scanner;
 
public class Main {
    private static Scanner sc;
    public static void main(String[] args){
        sc=new Scanner(System.in);
        LinkedList<String> name=new LinkedList<String>();
        LinkedList<Integer> time=new LinkedList<Integer>();
        int n=sc.nextInt();
        int q=sc.nextInt();
        int t=0;
        for(int i=0;i<n;i++){
            name.add(sc.next());
            time.add(sc.nextInt());
        }
        while(!name.isEmpty()){
            if(time.peek()<=q){
                System.out.print(name.poll()+" ");
                t=t+time.poll();
                System.out.println(t);
            }else{
                name.add(name.poll());
                time.add(time.poll()-q);
                t=t+q;
            }
        }
    }
 
}

Measured memory_bytes: 76800
#include <iostream>

using namespace std;

const int MOD = 1000 * 1000 * 1000 + 7;
const int MAXN = 1000 * 100 + 10;

int h[MAXN], t[MAXN], a[MAXN];

int main()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; i++)
		h[i] = -1;
	for (int i = 0; i < n; i++)
	{
		cin >> t[i];
		if (i == 0 || t[i] > t[i - 1])
			h[i] = t[i];
	}
	for (int i = 0; i < n; i++)
		cin >> a[i];
	for (int i = n - 1; i >= 0; i--)
	{
		if (i == n - 1 || a[i] > a[i + 1])
		{
			if (h[i] != -1 && a[i] != h[i])
			{
				cout << 0 << endl;
				return 0;
			}
			else
				h[i] = a[i];
		}
	}
	long long ans = 1;
	for (int i = 0; i < n; i++)
		if (h[i] == -1)
		{
			ans *= min(t[i], a[i]);
			ans %= MOD;
		}
		else if (h[i] > min(t[i], a[i]))
		{
			cout << 0 << endl;
			return 0;
		}
	cout << ans << endl;
}

Measured memory_bytes: 1408
N, M = map(int, input().split())
A = list(map(int, input().split()))

# 数字kに対するマッチ必要本数を返す
def num(k):
    costs = [2, 5, 5, 4, 5, 6, 3, 7, 6]
    return costs[k-1]

# 動的計画法
# dp(i) := i本の最大桁数(i = 0,1,...,N)
# constructor
inf = 1000
# -infに設定しないと数字の選択時にミスる
dp = [-inf for _ in range(N+1)]
dp[0] = 0

cost_list = [num(k) for k in A]
for i in range(1, N+1):
    for cost in cost_list:
        if i - cost < 0:
            pass
        else:
            temp = dp[i - cost] + 1
            dp[i] = max(dp[i], temp)

ans = ''
many = N
for d in range(dp[N]): # 各桁
    for k in sorted(A, reverse=True):
        if many - num(k) < 0:
            pass
        else:
            if dp[many - num(k)] == dp[many] - 1:
                ans += str(k)
                many -= num(k)
                break
            else:
                pass

print(int(ans))


Measured memory_bytes: 3444
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define len(X) ((int)(X).size())

#ifdef __LOCAL
#define DBG(X) cout << #X << "=" << (X) << '\n';
#define SAY(X) cout << (X) << '\n';
#else
#define DBG(X)
#define SAY(X)
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);

const int NIL = -1;
static mt19937 _g(time(nullptr));

std::string pad(int num)
{
    char buffer[4];
    std::snprintf(buffer, sizeof(buffer), "%03d", num);
    return buffer;
}

inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#endif

ll solve()
{
    ll X;

    std::cin >> X;

    ll a = 0;
    unordered_map<ll, ll> cache;
    double res = 0;

    while (res <= std::numeric_limits<ll>::max()) {
        res =  pow(a, 5);
        if (res > std::numeric_limits<ll>::max()) break;
        cache[res] = a;
        ++a;
    }

    a = -1;
    res = 0;
    while (res >= std::numeric_limits<ll>::min()) {
        res =  pow(a, 5);
        if (res < std::numeric_limits<ll>::min()) break;
        cache[res] = a;
        --a;
    }

    for (auto &it : cache) {
        if(cache.count(it.first + X) != 0) {
            cout << cache[it.first + X] << " " << it.second << endl;
            return 0;
        }
    }

    return 0;
}

int main()
{
//    std::cout << solve() << std::endl;
    solve();

    return 0;
}

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

int main(){
    string s;
    char ans=123;
    
    cin >> s;
    vector<int> a(200);
    rep(i,200){
        a[i]=0;
    }
    

    rep(i,s.size()){
        a[s[i]]++;
    }
    for(char i= 'a';i<='z';i++){
        if(a[i]==0){
            ans=min(ans,i);
        }
    }
    if(ans==123){
        cout << "None" << endl;
    }   
    else{
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3752
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cmath>

using namespace std;

#define all(c) c.begin(),c.end()
#define repeat(i,n) for(int i=0;i<static_cast<int>(n);i++)
#define debug(x) #x << "=" << (x)
#define dump(x) cerr << debug(x) << " (L:" << __LINE__ << ")"<< endl

typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<string> vs;

template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec){
    os << "[";
    for(int i = 0; i < vec.size(); i++){
        os << vec[i] << ",";
    }
    os << "]";
    return os;
}

template<typename T>
T input(){
    T t;
    cin >> t;
    return t;
}

template<typename T>
vector<T> input(const int N){
    vector<T> v(N);
    repeat(i,N) cin >> v[i];
    return v;
}

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

long long lcm(long long a, long long b){
    return (a / gcd(a, b)) * b;
}

long long mul(const long long& a, const long long& b, const long long& mod) {
    return ((a % mod) * (b % mod)) % mod;
}

long long power(const long long& x, const long long& y, const long long& mod) {
    if (y == 0) {
        return 1;
    } else if (y == 1) {
        return x % mod;
    } else {
        long long value = power(x, y / 2, mod);
        if (y % 2 == 0) {
            return mul(value, value, mod);
        } else {
            return mul(value, value, mod) * x % mod;
        }
    }
}

long long div(const long long& a, const long long& b, const long long& mod) {
    return mul(a, power(b, mod - 2, mod), mod);
}

map<long long, long long> factorials;
long long factorial(const long long& n, const long long& mod) {
    if (n == 0 || n == 1) {
        return 1;
    }
    if (factorials[n] != 0) {
        return factorials[n];
    }
    factorials[n] = n * factorial(n - 1, mod) % mod;
    return factorials[n] % mod;
}

long long combination(const long long& n, const long long& x, const long long& mod) {
    long long numerator = 1;
    long long denominator = 1;
    repeat(i, x) {
        numerator *= (n - i) % mod;
        numerator %= mod;
        denominator *= (i + 1) % mod;
        denominator %= mod;
    }
    return div(numerator, denominator, mod);
}

int main(){
    string S;
    cin >> S;
    char smallest = 'a';

    sort(all(S));
    for (int i = 0; i < S.size(); ++i) {
        if (S[i] == smallest) {
            smallest++;
        }
    }
    if ('z' < smallest) {
        cout << "None" << endl;
    } else {
        cout << smallest << endl;
    }
    return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
static const int MOD = 1000000007;
using ll = long long;
int main(){
    int x;
    cin>>x;
    if(x==3 or x==5 or x==7){
        cout<<"YES"<<endl;
    }
    else cout<<"NO"<<endl;
}

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

using namespace std;

int main() {
    long N, K, d;
    cin >> N >> K;
    int xs[100] = {0};

    while (cin >> d) {
        for (int i = 0; i < d; i++) {
            int x;
            cin >> x;
            xs[x-1] = 1;
        }
        //for (int i = 0; i < N; i++) {
        //    cout << " " << xs[i];
        //}
        //cout << "\n";
    }

    int count = 0;
    for (int i = 0; i < N; i++) {
        if (xs[i] == 0) {
            count += 1;
        }
    }

    //cout << "N:" << N << " K:" << K << endl;
    cout << count << endl;
}

Measured memory_bytes: 3628
#include<iostream>
#include<math.h>
using namespace std;

int main() {

    int n;
    cin >> n;
    int s = 0;
    int s2 = 0;
    int* x = new int[n];
    for (int i = 0; i < n; ++i) {
        cin >> x[i];
        s += x[i];
        s2 += x[i] * x[i];
    }

    double min_p_f = (double)s / (double)n;

    int minp = round(min_p_f);

    cout << s2 - (2 * minp * s) + (n * minp * minp) << endl;

    delete[] x;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 1000000;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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


int main() {

	ll a, b, c;
	cin >> a >> b >> c;
	cout << a * b / 2;


	system("PAUSE");
}

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

int main(){
  int N, cnt = 100000000, tmp;
  cin >> N;
  vector<int> V(N);
  for (int i = 0; i < N; i++) cin >> V.at(i);
  for (int i = 0; i < N; i++){
    tmp = 0;
    while(V.at(i) % 2 == 0){
      V.at(i) /= 2;
      tmp++;
    }
    cnt = min(cnt, tmp);
  }
  cout << min(cnt, tmp) << endl;
  return 0;
}

Measured memory_bytes: 3600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Deque;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.function.BiConsumer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			long n = in.nextLong();
			HashMap<Long, Long> map = new HashMap<Long, Long>();
			for (long i = 0; i < n; i++) {
				long tmp = in.nextLong();
				if (map.containsKey(tmp)) {
					map.put(tmp, map.get(tmp) + 1);
				} else {
					map.put(tmp, (long) 1);
				}
			}
			long m = in.nextLong();
			String ans = "YES";
			for (long i = 0; i < m; i++) {
				long tmp = in.nextLong();
				if (map.containsKey(tmp)) {
					if (map.get(tmp) == 0) {
						ans = "NO";
						break;
					} else {
						map.put(tmp, map.get(tmp) - 1);
					}
				} else {
					ans = "NO";
				}
			}
			out.println(ans);
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

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

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

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

	}
}


Measured memory_bytes: 86248
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

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

int main(int argc, char **argv)
{
    int A, B, T;
    cin >> A >> B >> T;
    int n = 0;
    int c = A;
    while (c <= T) {
        n += B;
        c += A;
    }
    cout << n << endl;
    return 0;
}


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

int main(){
    
    int n;
    int i, j, k;
    int count[4][3][10] = {{{}}};
    
    cin >> n;
    int a,b,c,d;
    for(i=0; i<n; i++){
        cin >> a >> b >> c >> d;
        count[a-1][b-1][c-1] += d;
    }
    
    for(i=0; i<4; i++){
        for (j = 0; j < 3; j++){
            for (k = 0; k < 10; k++){
                cout << " ";
                cout << count[i][j][k];
            }
            cout << endl;
        }
        if (i < 3)cout << "####################" << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
a, b = map(int, input().split())
s = a+b
t = a-b
u = a*b

if s >= t:
    if s >= u:
        print(s)
    else:
        print(u)
elif t >= u:
    if t >= s:
        print(t)
    else:
        print(s)
elif u >= s:
    if u >= t:
        print(u)
    else:
        print(t)

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

int main() {
  int N, L, m=0, S=0;
  cin >> N;
  for (int i=0; i<N; i++) {
    cin >> L;
    m=max(m, L);
    S+=L;
  }
  if (S>2*m) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}



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

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i=0;i<n;i++)

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

    ll n, m;
    ll result = 0;
	cin >> n >> m;
    vector<pair<ll, ll> > drinks;
    rep(i, n){
        ll a, b;
        cin >> a >> b;
        drinks.push_back(make_pair(a, b));
    }

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

/*
    rep(i, n){
        cout << drinks[i].first << " " << drinks[i].second << endl;
    }
    */

    rep(i, n){
        if(drinks[i].second >= m){
            result += drinks[i].first * m;
            break;
        }else{
            result += drinks[i].first * drinks[i].second;
            m -= drinks[i].second;
        }
    }
    


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


Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
int main ()
{

    int n;cin>>n;
    string s;cin>>s;
    string str1 = "", str2 = "";
    for(int i =0; i<n/2; i++)str1+=s[i];
     for(int i =n/2; i<n; i++)str2+=s[i];
     if(str1 == str2)cout<<"Yes"<<endl;
     else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
import sys
from collections import defaultdict
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**6)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    N, M = geta(int)
    g = defaultdict(lambda: [])
    for _ in range(M):
        x, y = geta(int)
        g[x].append(y)

    dp = [-1] * (N + 1)

    def dfs(i):
        if dp[i] == -1:
            dist = 0
            for j in g[i]:
                dist_j = 1 + dfs(j)
                if dist_j > dist: dist = dist_j
            dp[i] = dist
        return dp[i]

    ans = 0
    for i in range(1, N + 1):
        tmp = dfs(i)
        if tmp > ans: ans = tmp

    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 76056
#include<iostream>
#define ll long long
#include<algorithm>
#include<vector>
using namespace std;

int main()
{
    ll n,w;
    cin>>n>>w;
    vector<vector<ll>> knapsack(n);
    ll temp;
    for(ll i=0; i<n; ++i)
    {
        cin>>temp;
        knapsack[i].push_back(temp);
        cin>>temp;
        knapsack[i].push_back(temp);

    }

    //sort(knapsack.begin(), knapsack.end());

    //vector<ll> arr1(w+1), arr2(w+1);
    vector<ll> *ptr1 = new vector<ll> (w+1, 0);
    vector<ll> *ptr2 = new vector<ll> (w+1, 0);
    //ptr1 = arr1;
    //ptr2 = arr2;






    for(ll i=0; i<n; ++i)
    {
        for(ll j=1; j<=w; ++j)
        {
            if(knapsack[i][0] <= j)
            {
                (*ptr2)[j] = max((*ptr1)[j], knapsack[i][1] + (*ptr1)[j-knapsack[i][0]]);
            }
            else
            {
                (*ptr2)[j] = (*ptr1)[j];
            }
        }
        if(i != n-1)
        {
            vector<ll> *temp = ptr1;
            ptr1 = ptr2;
            ptr2 = temp;
        }
    }
    cout<<(*ptr2)[w];
    return 0;
}


Measured memory_bytes: 1792
#![allow(unused)]

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules ! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
macro_rules ! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }
macro_rules ! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
//入力マクロここまで

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;

fn main() {
    input! {
        s: chars,
    }

    let mut max = 0;
    let mut cnt = 0;

    for i in 0..s.len() {
        match s[i] {
            'A' | 'T' | 'C' | 'G' => cnt += 1,
            _ => {
                if cnt > max {
                    max = cnt;
                }
                cnt = 0;
            }
        }
    }

    if cnt > max {
        max = cnt;
    }

    println!("{}", max);
}


Measured memory_bytes: 4352
import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        long X = sc.nextLong();
        long Y = sc.nextLong();

        if (Math.abs(X - Y) <= 1) {
            _out.println("Brown");
        } else {
            _out.println("Alice");
        }
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Measured memory_bytes: 23764
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
  int N; cin>>N;
  int answer=0;
  REP(i,N+1){
    int ans=0;
    REP(j,i+1)if(i%j==0)ans++;
    if(ans==8&&i%2==1)answer++;
  }
  cout<<answer<<endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,bb,ba;
    long long res = 0;
    cin>>n;
    cin>>bb;
   res += bb;
    for(int i = 1;i<n-1;i++){
        cin>>ba;
      if(bb>ba){
        res+=ba;
      }else{
        res+=bb;
      }
      bb = ba;
    }
    cin>>bb;
    res += bb;
  cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256