akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
// const int MOD = 1e9 + 7;

int main() {
    string N;
    cin >> N;
    int n = (int)N.size();
    int sum = 0;
    for (int i = 0; i < n; i++) {
        sum += (int)(N[i] - '0');
    }
    int a = (int)(N[0] - '0') - 1;
    cout << max(a + (n - 1) * 9, sum) << endl;
}


Measured memory_bytes: 256
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
  "sort"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt() int {
  n, _ := strconv.Atoi(NextLine())
  return n
}
func NextIntVec() []int {
  L := strings.Split(NextLine(), " ")
  N := make([]int, len(L))
  for i := range N {
    N[i], _ = strconv.Atoi(L[i])
  }
  return N
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}

func main() {
  HWN := NextIntVec()
  H, W, N := HWN[0], HWN[1], HWN[2]
  T := make([][]int, W + 1)
  for i := range T {
    T[i] = []int{i, H}
  }
  B := make([][]int, W + 1)
  for i := range B {
    B[i] = make([]int, 0)
  }
  for i := 0; i < N; i++ {
    hw := NextIntVec()
    h, w := hw[0], hw[1]
    B[w] = append(B[w], h)
  }
  for i := range B {
    sort.Ints(B[i])
  }
  for i := range T[1:] {
    T[i + 1][0] = MaxInt(T[i][0] + 1, T[i + 1][0])
    T[i + 1][1] = MinInt(T[i][1], T[i + 1][1])
    for _, b := range B[i + 1] {
      if b < T[i + 1][0] { continue }
      if b == T[i + 1][0] {
        T[i + 1][0]++
      } else {
        T[i + 1][1] = MinInt(b - 1, T[i + 1][1])
      }
    }
  }
  Write(T[W][1])
  Output()
}

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

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

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && (ch != '-')) ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int const MAXN = 3005, mod = 1e9 + 7;
int f[MAXN][MAXN];
int a[MAXN];

inline int qpow(int a, int k) {
  int re = 1;
  for (; k; k >>= 1, a = a * a % mod)
    if (k & 1) re = re * a % mod;
  return re;
}

signed main() {

#ifdef LOCAL
  FILEIO("a");
#endif

  int n, q; read(n), read(q);
  for (RI i = 1; i <= n; ++i) read(a[i]);
  for (RI i = 1; i <= n; ++i)
    for (RI j = 1; j <= n; ++j)
      f[i][j] = a[i] > a[j];
  int inv2 = qpow(2, mod - 2);
  for (RI i = 1, x, y; i <= q; ++i) {
    read(x), read(y);
    f[x][y] = f[y][x] = (f[x][y] + f[y][x]) * inv2 % mod;
    for (RI j = 1; j <= n; ++j)
      if (j != x && j != y) {
        f[x][j] = f[y][j] = (f[x][j] + f[y][j]) * inv2 % mod;
        f[j][x] = f[j][y] = (f[j][x] + f[j][y]) * inv2 % mod;
      }
  }
  int ans = 0;
  for (RI i = 1; i <= n; ++i)
    for (RI j = i + 1; j <= n; ++j)
      ans = (ans + f[i][j]) % mod;
  printf("%lld\n", ans * qpow(2, q) % mod);

  cerr << (double)(clock()) / CLOCKS_PER_SEC * 1000 << "ms" << endl;

  return 0;
}

// created by Daniel yuan

Measured memory_bytes: 70784
a,b=map(int,input().split())
List=list(map(int,input().split()))
c=[]
time=0
for j in range(b-1):
  c.append(List[time+1]-List[time])
  time=time+1
c.append(List[0]+a-List[b-1])
print(a-max(c))

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

int main(void) {
    int sum = 100000;
    int n;
    
    cin >> n;
    
    for(int i = 0; i < n; ++i) {
        sum *= 1.05;
        if((sum % 1000) != 0) {
            sum = (sum / 1000 + 1) * 1000;
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 3104
#ifdef LOCAL
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <cstring>
#else
#include <bits/stdc++.h>
#endif
using namespace std ;

typedef long long ll ;
#define rep(i , n ) for ( int i =0; i < n ; i++)
#define _sort(arg) sort(begin(arg), end(arg))
#define MOD 1000000007
#define pb push_back
#define DEBUG(x) cout << #x << ": " << x << endl;

/*
__attribute__((constructor))
void initial()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);
}
*/

int cal(int a[])
{
	int count = 0;
	count += (a[1]-a[0]) / 2;
	count += a[2] - a[1];
	return count;
}
int main()
{
	cin.tie(NULL);
	ios::sync_with_stdio(false);

	int a[3];
	
	cin >> a[0] >> a[1] >> a[2];

	sort(a, a+3);

	int a_r = a[0] & 0x1;

	int b_r = a[1] & 0x1;

	int c_r = a[2] & 0x1;

	int count = 0;

	if (a_r == b_r)
	{
		if (a_r == c_r)
		{
			count = cal(a);
		}
		else
		{
			a[0]++;
			a[1]++;
			count = 1 + cal(a);
		}
	}
	else 
	{
		if (a_r == c_r)
		{
			a[0]++;
			a[2]++;
			count = 1 + cal(a);
		}
		else
		{
			a[1]++;
			a[2]++;
			count = 1 + cal(a);
		}
	}

	cout << count << endl;
	
	return 0;
}


Measured memory_bytes: 256
n,m = list(map(int,input().split()))
before_list = input().split()[1:]
for i in range(n-1):
    now_list = input().split()[1:]
    before_list = list(set(before_list) & set(now_list))
    if len(before_list) == 0:
        break
print(len(before_list))

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

int main() {
  ll n, a, b, c, d, e;
  cin >> n >> a >> b >> c >> d >> e;
  ll limit = min(a, min(b, min(c, min(d, e))));
  ll times;
  if(n%limit == 0) times = n/limit;
  else times = n/limit + 1;
  cout << times + (ll)4 << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define intt int64_t
#define all(vec) vec.begin(), vec.end()

int main() {
    int d, n;
    scanf("%d %d", &d, &n);
    int ans = (n == 100 ? 101 : n);
    rep(i,d) ans *= 100;
    printf("%d\n", ans);
}


Measured memory_bytes: 256
/* In the name of Anton */

/*
* Motto :)
*
*
*
*
*
*/

#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define repa(i,a,n) for(int i=a;i<=n;i++)
#define repb(i,a,n) for(int i=a;i>=n;i--)
#define trav(x,a) for(auto &x: a)
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
#define fst first
#define snd second
#define pb push_back
#define mp make_pair
#define vt vector
typedef long double ld;
typedef pair <int,int> pii;
typedef vector <int> vi;
typedef long long ll;

template<class A> void read(vt<A>& v);
template<class T> void read(T& x){
  cin>>x;
}

void read(double &d){
  string t;
  read(t);
  d=stod(t);
}
void read(long double &d){
  string t;
  read(t);
  d=stold(t);
}

template<class H, class... T> void read(H &h, T&...t){
  read(h);
  read(t...);
}

template <class A> void read(vt<A> &x){
  trav(a,x)
    read(a);
}

string to_string(char c){
  return string(1,c);
}

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

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

string to_string(string s){
  return string(s);
}

string to_string(vt<bool> v){
  string res;
  rep(i,sz(v)){
    res+=char('0'+v[i]);
  }
  return res;
}

template<class T> string to_string(T v){
  bool f=1;
  string res;
  trav(x,v){
    if(!f)
      res+=' ';
    f=0;
    res+=to_string(x);
  }
  return res;
}

template<class A> void write(A x){
  cout<<to_string(x);
}

template<class H, class...T> void write(const H& h, const T&...t){
  write(h);
  write(t...);
}

void print(){
  write("\n");
}

template<class H, class...T> void print(const H& h, const T&...t){
  write(h);
  if(sizeof...(t))
    write(' ');
  print(t...);
}

/* -----------------------------------------------------------------------------------------------*/

void pre(){

}

void solve(){
  ll a,b,c,d;
  read(a,b,c,d);

  ll temp1=b*d;
  ll ans=temp1;

  ans=max(ans,a*c);
  ans=max(ans,a*d);
  ans=max(ans,b*c);

  print(ans);
}

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  pre();
  int t=1;
  // read(t);
  rep(i,t) solve();
  return 0;
}


Measured memory_bytes: 3696
#include <stdio.h>

int main()
{
    int m, f, r;
    while (1){
        scanf(" %d %d %d", &m, &f, &r);
        if (m == -1 && f == -1 && r == -1){
            break;
        }
        if (m == -1 || f == -1){
            printf("F\n");
        }
        else if (m + f >= 80){
            printf("A\n");
        }
        else if (m + f >= 65 && m + f < 80){
            printf("B\n");
        }
        else if (m + f >= 50 && m + f < 65){
            printf("C\n");
        }
        else if (m + f >= 30 && m + f < 50){
            if (r >= 50){
                printf("C\n");
            }
            else {
                printf("D\n");
            }
        }
        else if (m + f < 30){
            printf("F\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2104
/*Saurav Paul*/
#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define boost ios_base::sync_with_stdio(0);
#pragma GCC optimize("O3")
#define loop(i, a, b) for (ll i = a; i <= b; ++i)
#define eb emplace_back
#define itoc(c) ((char)(((int)'0') + c))
#define ctoi(c) ((int)(((int)c) - '0'))
#define all(p) p.begin(), p.end()
#define bug() debug() <<

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

#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 PAUL
	~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 dbg(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

#ifdef ONLINE_JUDGE
#define cerr   \
	if (false) \
	cerr
#endif
int main();
void file()
{
#ifdef PAUL
	freopen("in.txt", "r", stdin);
	//freopen("out.txt","w",stdout);
#endif
}
void time()
{
#ifdef PAUL
	cerr << "\nTime elapsed: " << (double)(1.0 * (double)clock() / CLOCKS_PER_SEC) << " s.\n";
#endif
}
///////////////////////
using pii = pair<int, int>;
vector<vector<pii>> graph(1, vector<pii>());

bool check(int x, int var)
{
	return (var & (1 << x));
}
void bit_set(int x, int &var)
{
	var = (var | (1 << x));
}
void reset(int x, int &var)
{
	var = (var & !(1 << x));
}

int main()
{
	boost;
	int n;
	cin >> n;
	graph = vector<vector<pii>>(n + 1, vector<pii>());
	int contra = 0;
	for (int i = 0; i < n; i++)
	{
		int x;
		cin >> x;
		while (x--)
		{
			int a, b;
			cin >> a >> b;
			graph[i].push_back(make_pair(a-1, b));
		}
	}
	int lim = (1 << n) , ans = 0 ;
	for(int mask = 0 ; mask < lim ; mask ++){
		int var =  mask ;
		int person = 0 ;
		bool ok = true ;
		while(var && ok){
			if(var&1){
				for(auto x : graph[person]){
					if(check(x.first,mask) ^ (x.second)){
						ok = false;
						break ;
					}
				}
			}
			person ++ ;
			var >>= 1;

		}
		if(ok)
			ans = max(ans, __builtin_popcount(mask)) ;
	}
	cout << ans << endl ;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

struct UnionFind {
    vector<int> parent;
    vector<int> rank;
    vector<ll> size;

    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        parent.resize(n);
        rank.resize(n);
        size.resize(n);
        rep(i, n) {
            parent[i] = i;
            size[i] = 1;
        }
    }

    int root(int x) {
        if (parent[x] == x) return x;
        parent[x] = root(parent[x]);
        return parent[x];
    }

    bool isSame(int x, int y) {
        return root(x) == root(y);
    }

    void unite(int x, int y) {
        if (isSame(x, y)) return;
        x = root(x); y = root(y);
        if (rank[x] > rank[y]) swap(x, y);
        if (rank[x] == rank[y]) rank[x]++;
        parent[y] = x;
        size[x] += size[y];
    }

    ll get_size(int x) {
        if (root(x) == x) return size[x];
        size[x] = get_size(root(x));
        return size[x];
    }
};

int main() {
    ll N, M; cin >> N >> M;
    vector<ll> A(M), B(M);
    for (ll i = M-1; i >= 0; i--) {
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
    }
    vector<ll> ans(M);
    ans[M-1] = N*(N-1)/2;
    UnionFind UF = UnionFind(N);
    rep(i, M-1) {
        if (UF.isSame(A[i], B[i])) {
            ans[M-i-2] = ans[M-i-1];
            continue;
        }
        ans[M-i-2] = ans[M-i-1] - UF.get_size(A[i])*UF.get_size(B[i]);
        UF.unite(A[i], B[i]);
    }
    rep(i, M) cout << ans[i] << endl;
}


Measured memory_bytes: 7372
import sys

# S = input()
# N, M = map(int, input().split())
# nums = list(map(int, input().split()))
# nums_2d = [list(map(int, input().split())) for _ in range(N)]


def main():

    N, M = map(int, input().split())
    As = list(map(int, input().split()))

    total = sum(As)
    ans = N - total if total <= N else -1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 10188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	int a[3];
	for(int i = 0; i < 3; i++)
		cin >> a[i];
	sort(a,a+3);
	if(a[0] != a[2] && (a[0] == a[1] || a[1] == a[2]))
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
#define rg register
using std::cin;
using std::cout;
typedef long long ll;
ll min(ll x, ll y) { return x < y ? x : y; }
ll max(ll x, ll y) { return x > y ? x : y; }
const int Maxn = 1e6 + 5;
inline ll read()
{
	rg ll res = 0, sign = 1;
	rg char ch = getchar();
	while (!isdigit(ch))
	{
		if (ch == '-')
			sign = -1;
		ch = getchar();
	}
	do
	{
		res = (res << 3) + (res << 1) + (ch ^ 48);
		ch = getchar();
	} while (isdigit(ch));
	return res * sign;
}
int prime[Maxn], cnt, ans;
bool P[Maxn];
ll A, B;
ll gcd(ll x, ll y)
{
	ll z = x % y;
	while (z)
	{
		x = y;
		y = z;
		z = x % y;
	}
	return y;
}
int main()
{
	for (int i = 2; i <= 1000000; i++)
	{
		if (!P[i])
			prime[++cnt] = i;
		for (int j = 1; j <= cnt && i * prime[j] <= 1000000; j++)
		{
			P[i * prime[j]] = true;
			if (i % prime[j] == 0)
				break;
		}
	}
	rg ll x;
	cin >> A >> B;
	x = gcd(A, B);
	for (int i = 1; i <= cnt && x != 1; i++)
		if (x % prime[i] == 0)
		{
			ans++;
			while (x % prime[i] == 0)
				x /= prime[i];
		}
	if (x != 1)
		ans++;
	cout << ans + 1 << '\n';
	return 0;
}
//D

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

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

	ll H, W;
	cin >> H >> W;
	ll A = H * W;

	ll ans = 1LL << 50;
	for(int loop = 0; loop < 2; loop++) {
		for(int i = 1; i < H; i++) {
			ll a = i * W;
			ll h = H - i, w = W;
			ll b1 = h * (w / 2), b2 = A - a - b1;
			ll c1 = w * (h / 2), c2 = A - a - c1;
			ans = min(ans, max({ a, b1, b2 }) - min({ a, b1, b2 }));
			ans = min(ans, max({ a, c1, c2 }) - min({ a, c1, c2 }));
		}
		swap(H, W);
	}


	cout << ans << endl;
}

Measured memory_bytes: 256
"use strict";
function I(s,f){this._s=s.split("\n");this._c=0;this._l=0;this._f=f||Number}I.prototype.a=function(){var l=this._s[this._l];if(!l)return;var t=l.trim().split(" ");var a=t[this._c];this._c++;if(t.length===this._c){this._c=0;this._l++}return this._f(a)};I.prototype.l=function(){var l=this._s[this._l];if(!l)return;this._c=0;this._l++;return l.split(" ").map(this._f)};

function main(input) {
  var o = new I(input,String);

  var n = Number(o.a());
  var s = o.a();

  var white = 0;
  var black = 0;
  for (var i = 0; i < s.length; i++) {
    if (s[i] === ".") white += 1;
  }

  let min = white;
  for (var i = 0; i < s.length; i++) {
    if (s[i] === "#") {
      black += 1;
    } else {
      white -= 1;
    }

    if (black + white < min) {
      min = black + white;
    }
  }
  console.log(min);
}


main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
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); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

int n, a, b;

int main(){
    INIT;
    cin >> n >> a >> b;
    cout << min(a, b) << " " << max(a + b - n, 0) << endl;
}

Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, M;
    cin >> N >> M;

    int x[N];
    int y[N];
    int z[N];
    for (int i = 0; i < N ;i++) {
        cin >> x[i] >> y[i] >> z[i];
    }

    int ret = -1;

    for (int mask = 0; mask < (1 << 3); mask++) {
        int sum[N];
        fill(sum, sum + N, 0);
        for (int j = 0; j < N; j++) {
            sum[j] += ((mask >> 0 & 1) == 1) ? -x[j] : x[j];
            sum[j] += ((mask >> 1 & 1) == 1) ? -y[j] : y[j];
            sum[j] += ((mask >> 2 & 1) == 1) ? -z[j] : z[j];
        }

        sort(sum, sum + N);
        int s = 0;
        for (int j = N - 1; j >= (N - 1 - M + 1); j--) {
            s += sum[j];
        }

        ret = max(ret, s);
    }

    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 256
house = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n=int(input())
for x in range(n):
    a,b,c,d=map(int,input().split())
    house[a-1][b-1][c-1]+=d
for i in range(4):
    for j in range(3):
        for k in range(10):
            print(f' {house[i][j][k]}',end="")
        print()
    if int(i)<3: print("#"*20)


Measured memory_bytes: 5640
#include <algorithm>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;

void recordStep(vector<ll>& a, vector<int>& step, int k) {
  step.push_back(k + 1);
  if (k == 0 || k == a.size() - 1) {
    a.erase(a.begin() + k);
  } else {
    ll sum = a[k - 1] + a[k + 1];
    a.erase(a.begin() + k);
    a.erase(a.begin() + k);
    a[k - 1] = sum;
  }
}

pair<ll, vector<int>> solveOne(vector<ll> a, int s) {
  ll max_k = s;
  for (int i = s; i < a.size(); i += 2) {
    if (a[i] > a[max_k]) {
      max_k = i;
    }
  }
  vector<int> step;
  for (int t = 0; t < max_k; t++) {
    recordStep(a, step, 0);
  }
  while (a.size() > 1) {
    recordStep(a, step, a.size() - 1);
  }
  return make_pair(a[0], step);
}

pair<ll, vector<int>> solve(vector<ll> a, int s) {
  auto ansOne = solveOne(a, s);
  if (ansOne.first < 0) {
    return ansOne;
  }
  vector<int> step;
  while (s > 0) {
    recordStep(a, step, 0);
    --s;
  }
  while (a.size() > 2) {
    if (a[0] >= 0 && a[2] >= 0) {
      recordStep(a, step, 1);
    } else if (a[0] < 0) {
      recordStep(a, step, 0);
      recordStep(a, step, 0);
    } else if (a[2] < 0) {
      if (a.size() < 4) {
        break;
      }
      recordStep(a, step, 2);
    }
  }
  while (a.size() > 1) {
    recordStep(a, step, a.size() - 1);
  }
  return make_pair(a[0], step);
}

int main() {
  int N;
  while (cin >> N) {
    vector<ll> a(N);
    for (int i = 0; i < N; i++) {
      cin >> a[i];
    }
    auto ans = max(solve(a, 0), solve(a, 1));
    cout << ans.first << endl;
    cout << ans.second.size() << endl;
    for (int k : ans.second) {
      cout << k << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll N, K, X, Y;
    cin >> N >> K >> X >> Y;

    cout << min(N, K) * X + max((ll)0, N - K) * Y << endl;

    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define LL long long int

int main() {
	LL a,b,c;
	cin>>a>>b>>c;
	if(a+b+c>=22){
	    cout<<"bust"<<endl;
	}
	else{
	    cout<<"win"<<endl;
	}
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> vec;

	for (int i = 0; i < n; ++i) {
		int d;
		cin >> d;
		vec.push_back(d);
	}

	sort(vec.begin(), vec.end());
	int count = 1;

	if (n == 0) count = 0;
	else if (n == 1) count = 1;

	else {
		for (int i = 0; i < vec.size() - 1; ++i) {
			if (vec[i] != vec[i + 1]) {
				count++;
			}
		}
	}

	cout << count;
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <deque>
#include <map>
#include <set>
#include <cassert>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) ((int)(x).size())
#define It iterator
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;

int a,b,t;

int gcd(int a, int b){
    while(1){
        if(a<b) swap(a,b);
        if(a%b==0) return b;
        a=a%b;
    }
}

int main() {
    //freopen("test.in","r",stdin);
    int x1,x2,y1,y2;
    cin>>x1>>y1>>x2>>y2;
    a=abs(x1-x2);
    b=abs(y1-y2);
    t=gcd(a,b);
    a/=t, b/=t;
    cout<<(a+b-1)*t;


    return 0;
}


Measured memory_bytes: 256
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        int[] input1 = MyUtil.ReadIntArray();
        int people = input1[0];
        int foodCount = input1[1];

        int[] deta = new int[foodCount];

        for (int i = 0; i < people; i++)
        {
            int[] input = MyUtil.ReadIntArray();
            for (int j = 1; j < input.Length; j++)
            {
                deta[input[j] - 1]++;
            }
        }

        Console.WriteLine(deta.Where(fd => fd == people).Count());

        ReadKey();
    }
}

static class MyUtil
{
    public static int[] ReadIntArray()
    {
        return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
    }

    /// <summary>
    /// <see cref="IEnumerable{T}"/>の各要素を並べてコンソールに出力します。各要素の間には半角スペースが一つ入ります。
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="ts"></param>
    public static void WriteToConsole<T>(this IEnumerable<T> ts)
    {
        StringBuilder stringBuilder = new StringBuilder();
        foreach (T t in ts)
        {
            stringBuilder.Append(t.ToString());
            stringBuilder.Append(" ");
        }
        stringBuilder.Remove(stringBuilder.Length - 1, 1);
        Console.WriteLine(stringBuilder.ToString());
    }
}


Measured memory_bytes: 13396
package main

import (
  "bufio"
  "fmt"
  "os"
  "strconv"
  "strings"
)

const INF int64 = 10000000000000000

func main() {
  input := Input{bufio.NewReaderSize(os.Stdin,100)}
  r,c := input.Next2Ints()
  n := input.NextInt()
  m := r+c
  g := NewGraph(m)
  for i:=0;i<n;i++ {
    x,y,a := input.Next3Ints()
    x,y = x-1,y-1+r
    g.Add(x,y,int64(a))
    g.Add(y,x,int64(a))
  }
  d := make([]int64,m)
  used := make([]bool,m)
  var dfs func(int,int64) (bool,int64,int64)
  dfs = func(v int,w int64) (bool,int64,int64) {
    d[v] = w
    used[v] = true
    ok := true
    x,y := INF,INF
    if v < r {
      x = w
    } else {
      y = w
    }
    for _,e := range g[v] {
      if used[e.to] {
        if w+d[e.to] != e.cost { ok = false }
        continue
      }
      b,p,q := dfs(e.to,e.cost-w)
      ok = b && ok
      x = min(x,p)
      y = min(y,q)
    }
    return ok,x,y
  }
  for i:=0;i<m;i++ {
    if used[i] { continue }
    ok,x,y := dfs(i,0)
    if !ok || x+y < 0 { fmt.Println("No");return }
  }
  fmt.Println("Yes")
}

func min(n,m int64) int64 {
  if n < m { return n }
  return m
}

type Edge struct { to int;cost int64 }
type Graph [][]Edge
func NewGraph(n int) Graph { return make([][]Edge,n) }
func(g Graph) AddEdge(from int,e Edge) { g[from] = append(g[from],e) }
func(g Graph) Add(from,to int,cost int64) { g.AddEdge(from,Edge{to,cost}) }

type Input struct { reader *bufio.Reader }
func(i *Input) NextLine() string {
  var buffer []byte
  for {
    line,isPrefix,err := i.reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer,line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func(i *Input) NextInt() int {
  n,_ := strconv.Atoi(i.NextLine())
  return n
}
func(i *Input) Next2Ints() (int,int) {
  s := strings.Fields(i.NextLine())
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  return x,y
}
func(i *Input) Next3Ints() (int,int,int) {
  s := strings.Fields(i.NextLine())
  x,_ := strconv.Atoi(s[0])
  y,_ := strconv.Atoi(s[1])
  z,_ := strconv.Atoi(s[2])
  return x,y,z
}

Measured memory_bytes: 73344
#include <algorithm>
#include <cassert>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

using namespace std;

#define int long long int
#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define capi(x) int x;cin>>x
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

using vi = vector<int>;

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

#define P (1'000'000'007)

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

    vi vp, vc;

    rep(i, n) {
        capi(p);
        vp.push_back(p - 1);
    }

    rep(i, n) {
        capi(c);
        vc.push_back(c);
    }

    int ans = INT_MIN;

    rep(i, n) {
        int res = 0;
        int acc = 0;
        bool rooped = false;
        int p = i;
        vector<bool> vf(n, false);

        for (int c = 0; c < k; ++c) {
            p = vp[p];
            if (vf[p] && !rooped) {
                rooped = true;
                acc += ((k - c) / res  - 1) * acc;
                c += ((k - c) / res - 1) * res;
                chmax(ans, acc);
                if (c >= k) break;
            }
            ++res;
            vf[p] = true;
            acc += vc[p];
            chmax(ans, acc);
            // debug(p);
            // debug(c);
            // debug(ans);
        }
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 3272
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define rep2(i,n) for(int i=1; i<=(n); ++i)
#define all(x) (x).begin(),(x).end()
#define Sort(x) sort((x).begin(),(x).end())
#define Sort2(x) sort((x).begin(),(x).end(), greater<int>())
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main()
{
    double a,b,h,m; cin >> a >> b >> h >> m;
    double theta,theta1,theta2;
    const double pi = acos(-1);
    theta1 = h * 30 + m * 0.5;
    theta2 = m * 6;
	theta = theta1 - theta2;
    theta = theta * pi / 180;

    double ans2 = a*a + b*b - (2*a*b*cos(theta));
    cout << fixed << setprecision(20);
    cout << sqrt(ans2) << endl;
}

/*
Ctrl+@ でコンソールを開け、以下で実行。
g++ b.cpp
./a.out
*/


Measured memory_bytes: 4068
import numpy as np
import copy

def erase_same(h):
    a_max = np.argmax(h)
    while a_max > 0 and h[a_max] == h[a_max-1]:
        h = np.delete(h, a_max-1)
        a_max = np.argmax(h)
    
    while a_max < len(h) - 1 and h[a_max] == h[a_max+1]:
        h = np.delete(h, a_max+1)
        a_max = np.argmax(h)
    
    return h, a_max

n = int(input())
H = [int(i) for i in input().split()]
h = np.array(H)
cnt = 0

h_min = min(h)
h -= h_min
cnt += h_min

h, a_max = erase_same(h)

while sum(h) > 0:
    if a_max == 0:
        tonari = h[a_max+1]
    elif a_max == len(h) - 1:
        tonari = h[a_max-1]
    else:
        tonari = max(h[a_max-1], h[a_max+1])
    cnt += h[a_max] - tonari
    h[a_max] = copy.deepcopy(tonari)
    h, a_max = erase_same(h)


print(cnt)

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

#define name ""
#define ini freopen(name".inp","r",stdin); freopen(name".out","w",stdout)
#define foe(it,c) for (__typeof(c.begin()) it = c.begin(); it != c.end(); it++)
#define long long long 
#define db double 
#define pii pair <int, int>
#define pll pair <long, long>
#define all(c) c.begin(), c.end()
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

const int INF = 1e9+7;
const int MOD = 998244353;
const int dx[4] = {0,0,-1,1};
const int dy[4] = {-1,1,0,0};

long dp[3001];

int main()
{
  fastio;
  int n, s; long res = 0;
  cin >> n >> s;
  for (int i = 1; i <= n; i++){
    int x; cin >> x;
    if (x > s) continue;
    if (x == s){
      (res += 1ll * i * (n - i + 1)) %= MOD;
    }
    else{
      (res += dp[s - x] * (n - i + 1)) %= MOD;
      for (int j = s; j > x; j--) (dp[j] += dp[j - x]) %= MOD;
      (dp[x] += i) %= MOD;
    }
  }
  cout << res;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int K,X,i;
	int cnt=0;
	scanf("%d%d",&K,&X);
	for(i=X-K+1;i<=X+K-1;i++)
	{
		printf("%d ",X-K+1+cnt);
		cnt++;
	}
	return 0;
}


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

using namespace std;

const int MAXN = 5007;

bool used[MAXN][MAXN];

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    
    string s;
    cin >> s;
    int k;
    cin >> k;
    
    int n = s.size();
    vector <string> a;
    for (int l = 0; l < n; ++l) {
        for (int r = l; r < min(n, l + 6); ++r) {
            a.push_back(s.substr(l, r - l + 1));
        }
    }
    sort(a.begin(), a.end());
    unique(a.begin(), a.end());
    cout << a[k - 1] << '\n';
    return 0;
}

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

#define full (m == 100 || e == 100 || j == 100)
#define avg(n) (m + e + j >= n)
#define me80 (m >= 80 || e >= 80)

int main() {
	int n, m, e, j;
	while (1) {
		cin >> n; if (n == 0) break;
		for (int i = 0; i < n; i++) {
			cin >> m >> e >> j;
			if (full || m + e >= 180 || avg(240)) cout << "A" << endl;
			else if (avg(210) || (avg(150) && me80)) cout << "B" << endl;
			else cout << "C" << endl;
		}
	}
	return 0;
}


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

// int/long:		-2147483648 - 2147483648 (-2^31 <= int < 2^31)
// long/long long:	-9223372036854775808 - 9223372036854775807 (-2^63 <= long < 2^63)
#define	INF (1<<29)
//536870912

#define	MOD 1000000007

int	main() {
	string S;
	cin >>S;
	if (S.at(0)==S.at(2))
		cout <<"Yes" <<endl;
	else
		cout <<"No" <<endl;
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vll = vector<vl>;
using Pll = pair<ll, ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(v) v.begin(), v.end()
#define sz(x) ((int) x.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define F first
#define S second
const int MOD = 1e9+7;
const ll INF = 2e15;
template<class T> void print(const T& t){ cout << t << endl; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

int main(){
  string n;
  cin >> n;
  ll sum = 0;
  rep(i,sz(n)){
    sum += n[i] - '0';
  }
  cout << (sum % 9 == 0 ? "Yes" : "No");
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

vector<int> a, dp;

int main()
{
    int n, k;
    cin>>n>>k;
    if (k == 1)
        cout<<0<<endl;
    else
        cout<<n-k<<endl;
    return 0;
}


Measured memory_bytes: 256
def main():
	n = int(input())
	def dfs(s):
		if int(s) > n:
			return 0
		ret = 1 if all(s.count(c) > 0 for c in "753") else 0
		for c in "753":
			ret += dfs(s+c)
		return ret
	print(dfs("0"))

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
function Main(s){
  s = s.split("\n");
  var n = +s[0];
  s = s[1];
  var ans = 0;
  var m = 0;
  var x = "";
  var f = 1;
  for(var i = 1; i < n; i++){
    for(var j = 0; j < i; j++){
      for(var k = 0; k < x.length; k++){
        if(x[k] === s[j])f = 0;
      }
      if(f)
      for(var k = i; k < n; k++){
        if(s[j] === s[k]){
          x += s[j];
          m++;
          break;
        }
      }
      f = 1;
    }
    ans = Math.max(ans, m);
    m = 0;
    x = "";
  }
  console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin","utf8").trim());

Measured memory_bytes: 21064
#include <stdio.h>
//#include <math.h>
#define MIN(x,y) (((x) > (y)) ? (y) : (x))
#define ABS(x) ((x) >= 0 ? (x) : (-(x)))
int main() {
  int k, a, b;
  scanf("%d", &k);
  scanf("%d %d", &a, &b);
  for (int i = a; i <= b; i++) {
    if (i % k == 0) {
      printf("OK");
      return 0;
    }
  }
  printf("NG");
  return 0;
}

Measured memory_bytes: 2156
#include <iostream>
#include <algorithm>

using namespace std;

int main(void){
long long int a, b, c, k;

cin >> a >> b >> c >> k;

long long int t = max(a, max(b, c));

for (int i = 0; i < k; i++){
t *= 2;
}

cout << t + a + b + c - max(a, max(b, c)) << endl;
}

Measured memory_bytes: 256
n = int(input())

def g(n, x):
    f = 1 if x == 2 else 2
    if n == 0:
        return 0
    else:
        return g(n // x, x) + n // x // f

if n % 2 != 0:
    print(0)
else:
    print(min(g(n, 2), g(n, 5)))

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

int main() {

	char c1,c2,c3;
	cin >> c1 >> c2 >> c3;

	int count = 0;
	if (c1 == '1') count++;
	if (c2 == '1') count++;
	if (c3 == '1') count++;

	cout << count << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main(){
	int a,count=0;
  	for(int i=0;i<3;i++){
    	scanf("%d",&a);
      	if(a==5||a==7){
        	count+=a;
        }else{
        	break;
        }
    }
  	if(count==17){printf("YES");}else{printf("NO");}
  	return 0;
}

Measured memory_bytes: 128
N = int(input())
S = [0]*N
for i in range(0,N):
    S[i] = input()

S = sorted(S)

words = [0]
word_num = 0
word_count = []
count = 0
max = 0
for i in range(0,N):
    if len(words) == 0:
        words.append(S[i])
        word_num += 1
        count += 1
    elif len(words) != 0 and S[i] != words[word_num]:
        word_count.append(count)
        if count > max:
            max = count
        count = 1
        words.append(S[i])
        word_num += 1
    elif words[word_num] == S[i]:
        count += 1
word_count.append(count)
if count > max:
            max = count

max_words = []
for i in range(0,len(words)):
    if word_count[i] == max:
        max_words.append(words[i])

for i in max_words:
    print(i)





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

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        while(true) {
            int H = Integer.parseInt(sc.next());
            int W = Integer.parseInt(sc.next());
            if (H == 0 && W == 0) {
                break;
            }
            for (int i = 0; i < H; i++) {
                String S = "";
                for (int j = 0; j < W; j++) {
                    if ((i == 0 || i + 1 == H) || (j == 0 || j + 1 == W)) {
                        S += "#";
                    } else {
                        S += ".";
                    }
                }
                out.printf("%s\n", S);
            }
            out.printf("\n");
        }
        out.flush();
    }
}


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

int main(){
    int t8, t10;
    cin >> t8 >> t10;

    int pivot = t10 * 10;
    while(1){
        if(pivot*8/100 == t8 && pivot*10/100 == t10){
            cout << pivot <<endl;
            return 0;
        }
        pivot++;
        if(pivot*8/100 > t8) break;
    }
    cout << "-1" << endl;

    return 0;
}

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

int main()
{
    int n, min, max;
    long long sum;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        int a;
        scanf("%d", &a);
        if (i == 0)
        {
            min = a;
            max = a;
            sum = a;
        }
        else
        {
            min = std::min(min, a);
            max = std::max(max, a);
            sum += a;
        }
    }
    printf("%d %d %lld\n", min, max, sum);
}


Measured memory_bytes: 3232
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef vector<int> VI;
typedef pair<int, int> PI;
const double EPS = 1e-9;
#define rep(i,s,n) for(int i=(s); i < int(n); ++i)

const int N = 101;
const int V = 1e5 + 1;
int v[N], w[N];
int n, wlim;
int tv[N];

int dp[N][V];
const int INF = 0x2fffffff;
const int DEBUG = 0;

int solve(void) {
  dp[0][0] = 0;
  int total_v = 1;
  rep(i, 0, n) {
    total_v += v[i];
  }
  rep(j, 1, total_v) {
    dp[0][j] = INF;
  }
  rep(i, 1, n + 1) {
    rep(j, 0, total_v) {
      int res = dp[i-1][j];
      int val = v[i-1];
      int wei = w[i-1];
      if (val <= j) {
	res = min(res, dp[i - 1][j - val] + wei);
      } else {
	res = min(res, wei);
      }
      if(DEBUG) {
	cout << "dp[" << i << "][" << j << "] = " << res << endl;
      }
      dp[i][j] = res;
    }
  }
  int q = 0;
  rep(i,0,total_v) {
    if (dp[n][i] <= wlim) {
      q = i;
    }
  }
  if(DEBUG) {
    cout << "q = " << q << endl;
  }
  int rem = q;
  int sum = 0;
  for (int i = n; i > 0; --i) {
    int val = v[i-1];
    int wei = w[i-1];
    if (val <= rem && dp[i][rem] - wei == dp[i - 1][rem - val]) {
      // output (i - 1)
      sum += tv[i - 1];
      rem -= val;
    }
  }
  return sum;
}


int main(void) {
  cin >> n >> wlim;
  double max_v = 0.0;
  rep(i, 0, n) {
    cin >> tv[i] >> w[i];
    max_v = max(max_v, (double) tv[i]);
  }
  double k = 36;
  //double scale = max(1.0, max_v / (k + 1) / n);
  double scale = 1.0;
  rep(i, 0, n) {
    v[i] = (int) floor(tv[i] / scale);
  }
  cout << solve() << endl;
}

Measured memory_bytes: 40612
#include <iostream>
#include <vector>
#include <math.h>

static const int DataMax = 1000;	// Max value of elements

typedef struct _triangle
{
    int count;	// Number of elements
    std::vector<int> vec[DataMax];
} triangle_t;

static void inputData(triangle_t& data, int& num)
{
    int v1, v2, v3;

    if (0x00 == &data) {
        std::cerr << "data is null" << std::endl;
        return;
    }

    std::cin >> num;
    for (int i = 0; i < num; i++) {
        std::cin >> v1 >> v2 >> v3;
        data.vec[data.count].push_back(v1);
        data.vec[data.count].push_back(v2);
	data.vec[data.count].push_back(v3);
        data.count++;
    }
}

static bool isRightTriangle(std::vector<int>& vec)
{
    if (0x00 == &vec) {
        std::cerr << "vec is null" << std::endl;
        return false;
    }

    if ((int)pow((double)vec.at(0), 2.0) + (int)pow((double)vec.at(1), 2.0) == (int)pow((double)vec.at(2), 2.0)) {
        return true;
    } else if((int)pow((double)vec.at(1), 2.0) + (int)pow((double)vec.at(2), 2.0) == (int)pow((double)vec.at(0), 2.0)) {
        return true;
    } else if ((int)pow((double)vec.at(0), 2.0) + (int)pow((double)vec.at(2), 2.0) == (int)pow((double)vec.at(1), 2.0)) {
        return true;
    }

    return false;
}

int main()
{
    triangle_t triangle = {0};
    int num = 0;

    inputData(triangle, num);
    for (int i = 0; i < num; i++) {
        if (true == isRightTriangle(triangle.vec[i])) {
            std::cout << "YES" << std::endl;
        } else {
            std::cout << "NO" << std::endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3144
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define pb push_back
#define eb emplace_back

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;

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

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

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    else return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

int INF = 1e9+7;

template<class T>
void dcomb(T n,T m, string s){
    if(n==0) cout << s << endl;
    else {
        for(T i=0; i<m; ++i){
            dcomb(n-1,m,s+to_string(i));
        }
    }
}

int main(){
    ll n;
    vl ab(n,0);
    ll ans = 0;
    cin >> n;
    rep(i,n){
        ll a,b;
        cin >> a >> b;
        ab[i] = a+b;
        ans -=b;
    }
    sort(ab.begin(),ab.end());
    reverse(ab.begin(),ab.end());
    rep(i,n){
        if(i%2==1) continue;
        ans += ab[i];
    }
    cout << ans << endl;
}

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

int main() {
  double r;
  cin >> r;
  double pi = 3.141592653589;
  double s = pi * r * r;
  double l = 2 * pi * r;
  cout << fixed << setprecision(10);
  cout << s << " " << l << endl;
}



Measured memory_bytes: 3264
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
//using namespace boost::multiprecision;  
//using namespace boost::math;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod = 1e9+7; 
constexpr int MOD = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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

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

    int a;
    cin >> a;
    
    cout << a + a * a + a * a * a << '\n';

    return 0;
}




Measured memory_bytes: 3640