akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include  "bits/stdc++.h"
using namespace std;
#define I_AM_SPEED  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define printclock  cerr <<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<" sec\n";
#define mp(a , b)   make_pair(a , b)
#define eb(a)       emplace_back(a)
#define SZ(n)       ((int)(n).size())
#define all(n)      (n).begin(), (n).end()
#define anal           '\n'
#define mod         1000000007
#define fst         first
#define sec         second
#define pr(n)       cerr << n  << " ";
#define pfor(a)     for(auto (w) : (a)) pr(w)
//const double PI = acos(-1.0);
typedef long long ll;
typedef unsigned long long ull;

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-


//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
int main(){
I_AM_SPEED;
#ifndef ONLINE_JUDGE  
        freopen("input.in", "r", stdin);
        freopen("output.in", "w", stdout);
#endif 
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
    
     int n; cin >> n;
     if(n == 0) cout << "1\n";
     else if(n == 1) cout << "0\n";

//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
//printclock; 
return  0 ;      
}        



      

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
using P = complex<double>;

namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}

const double EPS { 1e-9 };
auto m = [](int x) { return x % 3; };

double cross(const P& a, const P& b) {
  return imag(conj(a) * b);
}

double area2(const vector<P> p) {
  P a { p[1] - p[0] };
  P b { p[2] - p[0] };
  return abs(real(a) * imag(b) - imag(a) * real(b));
}

int main() {
  vector<P> p(3);
  for (int i = 0; i < 3; i++) {
    double x, y; cin >> x >> y;
    p[i] = { x, y };
  }
  double ls {}, lmx {};
  for (int i = 0; i < 3; i++) {
    double l { abs(p[m(i + 1)] - p[m(i)]) };
    ls += l;
    lmx = max(lmx, l);
  }
  double r { area2(p) / ls };
  cout << fixed << setprecision(10) << lmx * r / (lmx + 2.0 * r) << endl;
  return 0;
}


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

int main() {
  int N , M , max = 0 , get ;
  cin >> N ;
  vector<string> blue(N);
  for ( int i = 0 ; i < N ; i++ ){
    cin >> blue.at(i) ;
  }
  cin >> M ;
  vector<string> red(M) ;
  for ( int i = 0 ; i < M ; i++ ){
    cin >> red.at(i) ;
  }
  for ( int i = 0 ; i < N ; i++ ){
    get = 0 ;
    for ( int j = 0 ; j < N ; j++ ){
      if ( blue.at(i) == blue.at(j) ){
        get++;
      }
    }
    for ( int j = 0 ; j < M ; j++ ){
      if ( blue.at(i) == red.at(j) ){
        get--;
      }
    }
    if ( get > max ){
      max = get ;
    }
  }
  cout << max << endl;
}


Measured memory_bytes: 256
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: 23892
#[allow(dead_code)]
fn main() {
    let x = i::s();
    let mut tbuf = 0;
    let mut sbuf = 0;
    for i in 0..x.len() {
        if x[i] == 'S' {
            sbuf += 1;
        }
        if x[i] == 'T' {
            if sbuf > 0 {
                sbuf -= 1;
            } else {
                tbuf += 1;
            }
        }
    }
    println!("{}", tbuf * 2);
}

#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet, VecDeque};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::num::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(dead_code)]
mod i {
    use super::*;

    pub fn read<T: FromStr>() -> T {
        stdin()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>()
            .parse::<T>()
            .ok()
            .unwrap()
    }

    pub fn str() -> String {
        read()
    }

    pub fn s() -> Vec<char> {
        str().chars().collect()
    }

    pub fn i() -> i64 {
        read()
    }

    pub fn u() -> usize {
        read()
    }

    pub fn f() -> f64 {
        read()
    }

    pub fn c() -> char {
        read::<String>().pop().unwrap()
    }

    pub fn iv(n: usize) -> Vec<i64> {
        (0..n).map(|_| i()).collect()
    }

    pub fn iv2(n: usize) -> Vec<(i64, i64)> {
        (0..n).map(|_| iv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn uv(n: usize) -> Vec<usize> {
        (0..n).map(|_| u()).collect()
    }

    pub fn uv2(n: usize) -> Vec<(usize, usize)> {
        (0..n).map(|_| uv(2)).map(|a| (a[0], a[1])).collect()
    }

    pub fn fv(n: usize) -> Vec<f64> {
        (0..n).map(|_| f()).collect()
    }

    pub fn cmap(h: usize) -> Vec<Vec<char>> {
        (0..h).map(|_| s()).collect()
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair

using namespace std;

const int N = int(2e5) + 7;
const int oo = int(1e9) + 7;

int n, k, a[N], change, d[N];
vector<int> g[N];

int DFS(int u) {
    if(d[u] != -1) return d[u];
    int dep = 0;
    int&res = d[u];
    for(int v: g[u]) {
        dep = DFS(v);
        if(dep == k - 1 && u != 1) ++change;
        else res = max(res, dep);
    }
    return res + 1;
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n >> k;
    for(int i = 1; i <= n; ++i) cin >> a[i];
    if(a[1] != 1) a[1] = 1, ++change;
    for(int i = 2; i <= n; ++i) g[a[i]].pb(i);
    memset(&d, -1, sizeof d);
    DFS(1);
    cout << change;
}


Measured memory_bytes: 14208
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
typedef pair<int,int> pii;
typedef pair<pii,int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef long long ll;
#define loop(n)      for(int i=0;i<(n);i++)
#define lp(x,s,e)    for(int x=(s);x<(e);x++)
#define lpe(x,s,e)    for(int x=(s);x<=(e);x++)
#define MP make_pair
#define PB push_back
#define all(a)  a.begin(),a.end()
#define clr(x,val) memset((x),(val),sizeof(x))
#define endl '\n'

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    vector<int>v;
    vector<int>ans;
    for(int i=1;i<=n;i++){
     if(i%2==1){
     v.push_back(i);
     }
    }
    int si=v.size();
    int counter=0;
    for(int i=0;i<si;i++){
    for(int j=1;j<=v[i];j++){
     if(v[i]%j==0){
      counter++;
     }
     if(counter==8){
      ans.push_back(counter);
     }
    }
    counter=0;
    }
    cout<<ans.size();
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! debug {
	($($a:expr),*) => {
		println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
	}
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(dead_code)]
const MOD: usize = 1e9 as usize + 7;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let a = sc.read_vec::<i64>(n);

    if a[0] != 0 {
        println!("-1");
        return;
    }

    let mut ans = 0_i64;
    for i in 1..n {
        if a[i] - a[i - 1] > 1 {
            println!("-1");
            return;
        }

        if a[i] == a[i - 1] + 1 {
            ans += 1;
        } else {
            ans += a[i];
        }
    }
    println!("{}", ans);
}

pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: std::ops::Deref<Target = str>>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn read_chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    pub fn read_char_grid(&mut self, n: usize) -> Vec<Vec<char>> {
        (0..n).map(|_| self.read_chars()).collect()
    }
    pub fn read_matrix<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n)
            .map(|_| (0..m).map(|_| self.read()).collect())
            .collect()
    }
}

#[allow(dead_code)]
fn yn(flag: bool) {
    if flag {
        println!("Yes");
    } else {
        println!("No");
    }
}


Measured memory_bytes: 3576
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<int, lint> pil;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int n, a[1<<18];

int getval(int i){
    return i >= 0 ? a[i] : 0;
}

void update(pii &p, pii &q){
    vector<int> v = {p.fi, p.se, q.fi, q.se};
    sort(v.begin(), v.end(), [&](int i, int j){return getval(i) > getval(j);});
    v.erase(unique(v.begin(), v.end()), v.end());
    if(v.size() == 1) p = {-1, -1};
    else p = {v[0], v[1]};
}

int main(){
    scanf("%d", &n);
    rep(i, 1<<n) scanf("%d", &a[i]);
    pii dp[1<<n];
    rep(i, 1<<n) dp[i] = {-1, -1};
    rep(i, 1<<n) dp[i] = {i, -1};
    rep(S, 1<<n)rep(i, n)if(S>>i & 1){
        update(dp[S], dp[S ^ (1<<i)]);
    }
    int ans[1<<n];
    rep(i, 1<<n) ans[i] = getval(dp[i].fi) + getval(dp[i].se);
    partial_sum(ans, ans+(1<<n), ans, [](int x, int y){return max(x, y);});
    For(i, 1, 1<<n) printf("%d\n", ans[i]);
}

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


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

    int R;
    cin >> R;


    cout << 2*R*3.14159<<endl;


}


Measured memory_bytes: 3804
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>
#include <assert.h>
#include <sys/time.h>
#include <fstream>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define REP(i,n)  FOR(i,0,n)
#define each(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define deb(x) cerr << #x << " = " << (x) << " , ";
#define debl cerr << " (L" << __LINE__ << ")"<< endl;
#define sz(s) (int)((s).size())


#define clr(a) memset((a),0,sizeof(a))
#define nclr(a) memset((a),-1,sizeof(a))
#define pb push_back
#define INRANGE(x,s,e) ((s)<=(x) && (x)<(e))
#define MP(x,y) make_pair((x),(y))

double pi=3.14159265358979323846;

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;

template<typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& z){
	os << "[ ";
	REP(i,z.size())os << z[i] << ", " ;
	return ( os << "]" << endl);
}

template<typename T> std::ostream& operator<<(std::ostream& os, const set<T>& z){
	os << "set( ";
	EACH(p,z)os << (*p) << ", " ;
	return ( os << ")" << endl);
}

template<typename T,typename U> std::ostream& operator<<(std::ostream& os, const map<T,U>& z){
	os << "{ ";
	EACH(p,z)os << (p->first) << ": " << (p->second) << ", " ;
	return ( os << "}" << endl);
}

template<typename T,typename U> std::ostream& operator<<(std::ostream& os, const pair<T,U>& z){
	return ( os << "(" << z.first << ", " << z.second << ",)" );
}

double get_time(){
	struct timeval tv;
	gettimeofday(&tv, NULL);
	return tv.tv_sec + tv.tv_usec*1e-6;
}

typedef unsigned int uint32_t;
struct RND{
	uint32_t x;
	uint32_t y;
	uint32_t z;
	uint32_t w;
	RND(){
		x=123456789;
		y=362436069;
		z=521288629;
		w=88675123;
	}
	void init(int seed){
		x=123456789;
		y=362436069;
		z=521288629;
		w=seed+100;
		REP(i,10)get();
	}
	uint32_t get(){
		uint32_t t;
		t=x^(x<<11);
		x=y;y=z;z=w;
		w=(w^(w>>19))^(t^(t>>8));
		return w;
	}
};
RND rnd;

ll K,T;
vl a;

void _main(istream &inp){
	inp >> K >> T;
	a = vl(T);
	rep(i,T) inp >> a[i];
	sort(a.begin(), a.end());
	ll tot = 0;
	rep(j,a.size()) tot+=a[j];
	ll maxi = *max_element(a.begin(), a.end());
	cout << max(0LL, 2*maxi-tot-1) << endl;


}

int main(){
	if(0){
		ifstream ifs("test.txt");
		_main(ifs);
	}
	else{
		_main(cin);
	}
	return 0;
}


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

typedef long long ll;

#define int ll
#define all(v) v.begin(), v.end()
#define reps(__i, a, b) for (int __i = a; i < b; i++)
#define rep(__i, n) reps(__i, 0, n)

const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;

signed main()
{
    int q, h, s, d, n;
    cin >> q >> h >> s >> d >> n;

    int p25 = q, p5 = min(q * 2, h), l1 = min(p5 * 2, s), l2 = min(l1 * 2, d);

    int sum = 0;
    sum += (n / 2) * l2;
    n %= 2;
    sum += n * l1;

    cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <bitset>
#include<vector>
#include<utility>
#include<fstream>
#include<queue>
#include <iomanip>
#include<numeric>
#include<set>
#include<map>
#include<functional>
using namespace std;
#define rep(i, k) for (i = 0; i < k; i++) 
typedef long long ll;
typedef pair<ll, ll> l_l;
int i, j;

int main() {
	int k, l,z;
	cin >> k;
	string s = "ABC" + to_string(k);
	cout << s;
}


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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int N;
vector<int> A;
vector<int> B;
int main() {
    cin >> N;
    A.resize(N);
    B.resize(N);
    rep(i, N) cin >> A[i];
    rep(i, N) if (i) B[i] = A[i] - A[i - 1];
    vector<int> C;
    rep(i, N) if(B[i]) C.push_back(B[i]);

    // rep(i, C.size()) cout << C[i] << " ";
    // cout << endl;
    if (C.size() == 0) {
        cout << "1" << endl;
        return 0;
    }
    bool sign = C[0] > 0;
    int ans = 0;
    rep(i, C.size()) {
        if (sign && C[i] < 0) ans++, i++;
        if (!sign && C[i] > 0) ans++, i++;
        if (i >= C.size()) break;
        sign = C[i] > 0;
    }
    cout << ans + 1 << endl;

    return 0;
}


Measured memory_bytes: 1660
#include<cstdio>

using namespace std;

int main()
{
	int a,b,n;
	while(scanf("%d%d%d",&a,&b,&n)!=EOF)
	{
		int c=a/b;
		a-=b*c;
		int ans=0;
		for(int i=0;i<n;i++)
		{
			ans+=(a*10)/b;
			a=(a*10)%b;
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 0
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<utility>
#include<array>
#include<cassert>
#include<list>
#include<experimental/any>
#include<cstring>
#include<cctype>
#include<ctime>
#include<cstdbool>
#include<cstdint>
#include<cstddef>
#include<set>
#include<unordered_set>
#include<bitset>

using namespace std;
using experimental::any;

#define SPEEDY cin.tie(0);ios::sync_with_stdio(false);

#define REP(i,n) for(int i=0;i<(n);i++)
#define ARREP(i,n,X) for(int i=0;i<(n);i++)cin>>X[i]
#define FOR(i,X,n) for(int i=(X);i<(n);i++)
#define EREP(i,n) for(int i=1;i<=n;i++)

#define MODE 0
#define DEB(X) if(MODE)cout<< #X <<": "<<X<<" ";
#define DEB2(X) if(MODE)cout<<X<<" ";
#define ARDEB(i,X) if(MODE)cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define TFDEB(f) if(MODE){(f)? cout<<"true ":cout<<"false ";}
#define FORDEB(n,X) if(MODE)for(int i=0;i<(n);i++)ARDEB(i,X)
#define END if(MODE)cout<<endl;

typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
#define ALL(X) X.begin(),X.end()
struct edge{int to,cost;};
struct P2{int x,y;};
//struct edge{int from,cost,to;};
#define Endl endl

const int MOD7=1000000007;
const int INF=100000000;
const int SET=1000;

int main(){
	int n,m,a[200001],b[200001]={},count=0,sum2=0,kind=0;
	cin>>n>>m;
	REP(i,n){
		cin>>a[i];
		a[i]--;
		b[a[i]]++;
	}
	REP(i,10){ARDEB(i,b)END}
	sort(b,b+200000);
	//REP(i,10){ARDEB(i,b)END}
	for(int i=199999,st=0;0<=i&&st<5;i--,st++){ARDEB(i,b)END}
	REP(i,200000){
		if(b[i]>0)kind++;
	}
	DEB(kind)END
	for(int i=199999;0<=i;i--){
		count++;
		if(count>kind)break;
		if(count<=m){
			sum2+=b[i];
		}
		DEB(count)END
	}
	cout<<n-sum2<<endl;
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> ans(n + 1);
  for(int x = 1; x * x <= n; x++){
    for(int y = 1; x + x + y * y <= n; y++){
      for(int z = 1; x * x + y * y + z * z + x * y + y * z + z * x <= n; z++){
        ans[x * x + y * y + z * z + x * y + y * z + z * x]++;
      }
    }
  }
  for(int i = 1; i <= n; i++){
    cout << ans[i] << endl;
  }
}

Measured memory_bytes: 3568
#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <queue>
#include <deque>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <limits>
#include <climits>

using namespace std;

int main(){
    int a, b; cin >> a >> b;
    --a; --b;
    vector<bool> bs(3, true);
    bs[a]=bs[b]=false;
    for(int i=0; i<3; ++i){
        if(bs[i]) cout << i+1 << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
 
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef deque<bool> db;
template<class T> using vv=vector<vector< T > >;

bool question(ll n) {
  printf("? %lld\n", n);
  fflush(stdout);
  char c;
  scanf(" %c", &c);
  fflush(stdin);
  if (c == 'Y') {
    return true;
  } if (c == 'N') {
    return false;
  }
  assert (false);
}

void print_ans(ll n) {
  printf("! %lld\n", n);
  fflush(stdout);
  exit(0);
}

ll po10(int k) {
  ll ret = 1;
  rep (i, k) {
    ret *= 10;
  }
  return ret;
}

int main() {
  int ds = 1;
  for ( ;ds <= 9 ; ++ds) {
    if (!question(po10(ds))) {
      break;
    }
    if (ds == 9) {
      ll ans = 0;
      rep (i, 10) {
        ans += 5 * po10(i);
        if (question(ans)) {
          print_ans(po10(i));
        }
      }
      assert (false);
    }
  }
  ll l = po10(ds - 1);
  ll r = po10(ds) - 1;
  while (r - l > 1) {
    ll mid = (l + r) / 2;
    if (question(mid * 10)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  print_ans(r);

  return 0;
}


Measured memory_bytes: 724
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#define REP(i, N) for(int i = 0; i < N; ++i)
#define REEP(i, N) for(int i = N - 1; i >= 0; --i)
#define ALL(a) (a).begin(),(a).end()
#define FOR(i,m,n) for(int i = m; i < n; ++i)
#define RFOR(i,m,n) for(int i = n - 1; i >= m; --i)
#define CIN(a) cin >> a
#define CIN2(a, b) cin >> a >> b
#define CIN3(a, b, c) cin >> a >> b >> c
#define COUT(a) cout << a << endl
#define COUT2(a, b) cout << a << " " << b << endl
#define COUT3(a, b, c) cout << a << " " << b << " " << c << endl
#define pb push_back
#define PB push_back
#define VINT(v, n) vector<int> v(n); REP(i, n) { v[i] = 0 }
#define VINT2(v, n, m) vector<vector<int> > v(n, vector<int>(m)); REP(i, n) { REP(j, m) { v[i][j] = 0 } }
#define VCHAR(v, n) vector<char>v(n)
#define KIRIAGE(a, b) a += (b - a % b) % b
#define CEIL(c, a, b) if(a % b == 0) { c = a / b;} else { c = a / b + 1;}
#define sp(n) setprecision(n)
#define INF 1000000000
#define MOD 1000000007

using namespace std;
typedef pair<int, int> P;
typedef long long ll;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
	int A, B, C, D;
	CIN2(A,B);
	CIN2(C,D);
	COUT(max(A * B, C * D));
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
int a,b,c,d,e;
cin>>a>>b>>c>>d>>e;
if(a==0)
cout<<1;
else if(b==0)
cout<<2;
else if(c==0)
cout<<3;
else if(d==0)
cout<<4;
else if(e==0)
cout<<5;
}


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

using namespace std;
using ll = long long;

template<class T>
vector<T> subvec(vector<T> vec, ll l, ll num) {
    vector<T> ret;
    for(ll i = l; i < l + num; i++)ret.emplace_back(vec[i]);
    return ret;
}



int main()
{
    ll n, k; cin >> n >> k;
    vector<ll> a(n);
    for(ll i = 0; i < n; i++)cin >> a[i];
    sort(a.begin(), a.end());

    ll p1 = 0, m1 = 0;
    for(ll i = 0; i < n; i++) {
        if(a[i] < 0)m1++;
        if(a[i] > 0)p1++;
    }

    ll plus = (m1 * (m1 - 1)) / 2 + (p1 * (p1 - 1)) / 2, mina = (p1 * m1);
    ll zero = (n * (n - 1)) / 2 - (plus + mina);

    cerr << mina << " : " << zero << " : " << plus << endl;


    if(k > mina && k <= (mina + zero)) {
        cout << 0 << endl;
        return 0;
    }


    //答えは負
    if(k <= mina) 
    {
        ll lef = -2e18, rig = 0; //tより小さいのはk個以下か?
        for(ll i = 0; i < 100; i++) {
            ll mid = (rig + lef) / 2; //mid <- t
            ll cnt = 0;
            for(ll i = 0; i < n; i++) {
                if(a[i] <= 0)continue;
                auto itr = lower_bound(a.begin(), a.end(), mid / a[i]); //itrより前は掛けてmid以上になるもの
                cnt += itr - a.begin();
            }
            (cnt < k ? lef : rig) = mid;
        }
        cout << lef << endl;
    } 
    else 
    //答えは正
    {

        vector<ll> fu = subvec(a, 0, lower_bound(a.begin(), a.end(), 0) - a.begin());
        vector<ll> si = subvec(a, upper_bound(a.begin(), a.end(), 0) - a.begin(), a.end() - upper_bound(a.begin(), a.end(), 0) );
        for(auto &i : fu)i *= -1;
        ll lef = 0, rig = 2e18; //t以下のものはk個以下か? ooooooooooooooooxxxxx
        reverse(fu.begin(), fu.end());

        k -= (mina + zero); k--;
        for(ll i = 0; i < 100; i++) {
            ll mid = (rig + lef) / 2;
            ll cnt = 0;
            ll m = fu.size();
            ll o = si.size();
            for(ll i = 0; i < m; i++) {
                auto itr = lower_bound(fu.begin() + i + 1, fu.end(), (mid  + fu[i] - 1) / fu[i]);
                cnt += (itr - fu.begin() - (i + 1));
            }

            for(ll i = 0; i < o; i++) {
                auto itr = lower_bound(si.begin() + i + 1, si.end(), (mid + si[i] - 1) / si[i]);
                cnt += (itr - si.begin() - (i + 1)) ;
            }
            (cnt <= k ? lef : rig) = mid;
        }
        cout << lef << endl;
    }

}

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

using namespace std;

using LL = long long;
const int N = 1e5 + 3;
pair<int, int> p[N];

signed main() {
    ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) {
        int x, r;
        cin >> x >> r;
        p[i] = {x + r, x - r};
    }

    sort(p + 1, p + 1 + n);

    int last = p[1].first;

    int ans = 1;
    for (int i = 2; i <= n; i++) {
        if (p[i].second >= last) {
            ans++;
            last = p[i].first;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		//?????£?????????
		int numN;
		String[] InputList = new String[2];
		String[][] Card = new String[4][13];
		String[] NumList;

		Scanner sc = null;

		//?????§????????¨??????????????????
		for (int i = 0; i < Card[0].length; i++) {
				Card[0][i] = "S" + (i + 1);
		}
		for (int i = 0; i < Card[0].length; i++) {
			Card[1][i] = "H" + (i + 1);
		}
		for (int i = 0; i < Card[0].length; i++) {
			Card[2][i] = "C" + (i + 1);
		}
		for (int i = 0; i < Card[0].length; i++) {
			Card[3][i] = "D" + (i + 1);
		}

		try {
			//??\????????????
			sc = new Scanner(System.in);
			numN = sc.nextInt();
			NumList = new String[numN];

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

				for (int j = 0; j < InputList.length; j++) {
				//????????????????????????
					String s = sc.next();
					InputList[j] = s;
				}

				//???????????£??\
				NumList[i] = InputList[0] + InputList[1];
			}
			//?????¨??????????????§??????
			for (int i = 0; i < Card.length; i++) {
				for (int j = 0; j < Card[i].length; j++) {
					if(!Arrays.asList(NumList).contains(Card[i][j])){
						System.out.println(Card[i][j].substring(0, 1) + " " + Card[i][j].substring(1));
					}
				}
			}
			//System.out.println(Type);

		} finally {
			sc.close();
		}
	}

}

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


using namespace std;

int main(void) {
    string S;
    cin>>S;
    int A=0;
    int B=0;
    int N=S.length();
    for(int i=0;i<N;i++){
        if(S[i]=='A'||S[i]=='T'||S[i]=='G'||S[i]=='C'){
            A++;
        }
        else{
            if(B<A){
                B=A;
            }
            A=0;
        }
    }
    cout<<max(A,B)<<endl;
}


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

int main() {
  int a, b;
  cin >> a >> b;
  if (a < 10 && b < 10) {
    cout << a * b << endl;
    return 0;
  }
  cout << -1 << endl;

  return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


int main(void){

    int n, a[10005], b[10005];
    cin >> n;

    for(int i = 0; i < n; ++i) cin >> a[i];
    for(int i = 0; i < n; ++i) cin >> b[i];

    ll x = 0, y = 0;
    for(int i = 0; i < n; ++i){
        if(a[i] > b[i]){
            x += a[i] - b[i];
        }else{
            y += (b[i] - a[i]) / 2;
        }
    }

    if(x <= y){
        cout << "Yes" << "\n";
    }else{
        cout << "No" << "\n";
    }

    return 0;
}


Measured memory_bytes: 3684
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		double[] ave = new double[n];

		for (int i = 0; i < n; i++) {
			int roll = sc.nextInt();
			ave[i] = (double) (roll + 1) / 2;
		}

		double sum = 0;
		for (int i = 0; i < k; i++) {
			sum += ave[i];
		}
		double max = sum;

		for (int i = 0; i < n - k; i++) {
			sum = sum - ave[i] + ave[i + k];
			max = Math.max(max, sum);
		}

		System.out.println(max);

	}

}


Measured memory_bytes: 61852
#include<bits/stdc++.h>
using namespace std;
#define ll long long
map<string,int> mp;//mp[string]
int num,n;
string s;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>s;
		if(mp[s]) mp[s]++;//出现次数
		else
		{
			num++;
			mp[s]=1;	
		} 
	}
	cout<<num;	
return 0;
}


Measured memory_bytes: 19184
# -*- coding: utf-8 -*-
# 整数の入力
# コンテナの座標（西→東）
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

# 電波が届く最大の距離
k = int(input())

# 最大の距離(=e-a)
max_dis = e -a
        
# 出力
if max_dis <= k:
  print('Yay!')
else:
    print(':(')


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int roop;
  int P=0,W=0,G=0,Y=0;
  cin >> roop;
  for(int i =1;i <= roop;i++){
    string arare;
    cin >> arare;
    if((arare=="P")&&(P ==0)){
      P++;
    }else if((arare=="W")&&(W ==0)){
      W++;
    }else if((arare=="G")&&(G ==0)){
      G++;
    }else if((arare=="Y")&&(Y ==0)){
      Y++;
    }
  }
  int sum = P+W+G+Y;
  if(sum ==3){
    cout << "Three" << endl;
  }else if(sum == 4){
    cout << "Four" << endl;
  }
}


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


int A[3];

int main(){
	int a,b,c,sum;
	cin >> A[0] >> A[1] >> A[2];
	sort(A,A+3);
	
	a=A[0];
	b=A[1];
	c=A[2];
	
	sum=c-a+c-b;
	cout << (sum%2?sum/2+2:sum/2) << endl;
	
	return 0;
}

Measured memory_bytes: 256
//{{{
#include <bits/stdc++.h>
using namespace std;
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop,~))(__VA_ARGS__)
#define loop(n) rep2(_loop_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define repN(a) repX a
#define repX(a0,a1,a2,x,...) x
typedef long long ll;
const int MOD = 1e9+7;
//}}}

int main(){
	int N;
	cin >> N;

	map<char, ll> m;
	rep(i, N){
		string s;
		cin >> s;
		m[s[0]]++;
	}
	char arr[] = "MARCH";

	ll ans = 0;
	rep(i, 5){
		rep(j, i + 1, 5){
			rep(k, j + 1, 5){
				ans += m[arr[i]] * m[arr[j]] * m[arr[k]];
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Maxn 107
#define inf 1000007
char s[Maxn][Maxn];
int last[1000007],pre[1000007],other[1000007],len[1000007],cnt=0;
int n,m;
int calc(int x,int y)
{
    return (x-1)*m+y;
}
void insert(int u,int v,int l)
{
    other[++cnt]=v,pre[cnt]=last[u],last[u]=cnt;
    len[cnt]=l;
}
int dis[1000007];
bool vis[1000007];
priority_queue<pair<int,int> >que;
int dijkstra(int s,int t)
{
    for (int i=1;i<=t;i++)
        dis[i]=inf;
    memset(vis,false,sizeof(vis));
    while (!que.empty()) que.pop();
    que.push(make_pair(0,s));
    dis[s]=0;
    while (!que.empty())
    {
        int u=que.top().second;
        que.pop();
        if (vis[u]) continue;
        vis[u]=true;
        for (int q=last[u];q;q=pre[q])
        {
            int v=other[q];
            if (dis[v]>dis[u]+len[q])
            {
                dis[v]=dis[u]+len[q];
                que.push(make_pair(-dis[v],v));
            }
        }
    }
    return dis[t];
}
int main()
{
    scanf("%d%d",&n,&m);
    for (int i=1;i<=n;i++)
        scanf("%s",s[i]+1);
    for (int i=1;i<=n;i++)
        for (int j=1;j<=m;j++)
        {
            if (i<n)
            {
                int tmp=0;
                if (s[i][j]=='.'&&s[i][j]!=s[i+1][j]) tmp=1;
                insert(calc(i,j),calc(i+1,j),tmp);
            }
            if (j<m)
            {
                int tmp=0;
                if (s[i][j]=='.'&&s[i][j]!=s[i][j+1]) tmp=1;
                insert(calc(i,j),calc(i,j+1),tmp);
            }
        }
    int S=n*m+1,T=n*m+2;
    if (s[1][1]=='.') insert(S,calc(1,1),0); else insert(S,calc(1,1),1);
    insert(calc(n,m),T,0);
    printf("%d\n",dijkstra(S,T));
    return 0;
}

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

#define vec                vector<int>
#define vecll              vector<ll>
#define vecd               vector<double>
#define vecst              vector<string>
#define vecb               vector<bool>
#define vec2(var, n, m)    vector<vector<int>>  var(n, vector<int>(m, 0))
#define vecb2(var, n, m)   vector<vector<bool>> var(n, vector<bool>(m, false))
#define vecll2(var, n, m)  vector<vector<ll>>   var(n, vector<ll>(m, INF))

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << (var) << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << (var) << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << (var);
#define prt2(v1, v2)     cout << (v1) << " " << (v2) << "\n"
#define prt3(v1, v2, v3) cout << (v1) << " " << (v2) << " " << (v3) << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt(ok ? "Yes" : "No");}
//----------------------------------------------------------------

int main(void) {
  int v, e;
  cin >> v >> e;
  vector<vector<ll>> dist(v, vector<ll>(v, -1));
  rep(i,e){
    ll a, b, d;
    cin >> a >> b >> d;
    dist[a][b] = d;
  }

  ll INF = 1e18;
  vector<vector<ll>> dp((1<<v), vector<ll>(v, INF));
  dp[1][0] = 0;
  rep(i,(1<<v)){
    rep(j,v){
      if(dp[i][j]==INF) continue;
      rep(k,v){
        if(i&(1<<k)) continue;
        if(dist[j][k]<0) continue;

        int next_i = i | (1<<k);
        chmin(dp[next_i][k], dp[i][j] + dist[j][k]);
      }
    }
  }

  ll ans=INF;
  rep(i,v){
    if(dist[i][0]<0)continue;
    chmin(ans, dp[(1<<v)-1][i] + dist[i][0]);
  }

  if(ans==INF){
    prt(-1);
  } else {
    prt(ans);
  }

}



Measured memory_bytes: 7548
#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    int a, b, c, tmp;
    int answer[n];
    for (int i = 0; i < n; i++) {
        scanf("%d %d %d", &a, &b, &c);
        if (b < a) {
            tmp = b;
            b = a;
            a = tmp;
        }
        if (c < b) {
            tmp = c;
            c = b;
            b = tmp;
        }
        if (c * c == a * a + b * b) {
            answer[i] = 1;
        } else {
            answer[i] = 0;
        }
    }
    for (int i = 0; i < n; i++) {
        if (answer[i] == 1) {
            printf("YES\n");
        } else {
            printf("NO\n");
        }
    }

    return 0;
}



Measured memory_bytes: 2148
N, K = map(int,input().split())
S = input()

def calculate(n, k, s):
    s = list(s)

    result = [{'start': 0, 'end': 0}]
    for i in range(n):

        previous = s[i - 1]
        current = s[i]

        if i == 0:
            if s[i] == '1':
                result.append({'start': 0})
        else:
            if (current == '0') and (previous == '1'):
                res = result[-1]
                res.__setitem__('end', i)
                result[-1] = res

            if (current == '1') and (previous == '0'):
                result.append({'start': i})

        if i == n - 1 and s[i] == '1':
            res = result[-1]
            res.__setitem__('end', i + 1)
            result[-1] = res

    result.append({'start': n, 'end': n})


    # print(result)
    maxValue = 0
    if len(result) > k:
        for i in range(len(result) - k):
            val = result[i + k]['end'] - result[i]['start']
            maxValue = max(val, maxValue)
    else:
        maxValue = max(maxValue, result[-1]['end'] - result[0]['start'])


    print(maxValue)


calculate(N, K, S)


Measured memory_bytes: 25244
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int x, y;
    cin >> x >> y;
    rep(i,x+1){
        if(i * 2 + (x - i) * 4 == y){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}




Measured memory_bytes: 3636
n, y = map(int, input().split())

result = [-1, -1, -1]
for a in range(n + 1):
    for b in range(n + 1):
        rest = y - 10000 * a - 5000 * b
        if 1000 * (n - a - b) == rest and (n - a - b) >= 0:
            result[0] = a
            result[1] = b
            result[2] = n - a - b
            break

    if result[0] != -1:
        break

print(result[0], result[1], result[2])


Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

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

    int ans = max(0, a - 2 * b);
    cout << ans << endl;

    return 0;
}


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

int main(){
    string A,B,C;
    cin >> A;
    cin >> B;
    cin >> C;

    if(A[A.length()-1]==B[0] && B[B.length()-1]==C[0]){
        printf("YES");
        return 0;
    }else{
        printf("NO");
        return 0;
    }
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int x = sc.nextInt();
        int y = sc.nextInt();
        int ans=0;
        for(int i=1;i<n+1;i++) {
        	if(i>k) {
        		ans+=y;
        	}
        	else {
        		ans+=x;
        	}
        }
        System.out.print(ans);
    }
}

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

int main() {
  int N, A, x = 1;
  cin >> N >> A;
  
  for (int i = 0; i < N; i++) {
    if (x < A) {
      x *= 2;
    } else {
      x += A;
    }
  }
  
  cout << x << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;

 int main(void){
   int N;
   cin >> N;
   int T[N];
   rep(i,N) cin >> T[i];
   int M;
   cin >> M;
   int P[M],X[M];
   rep(i,M) cin >> P[i] >> X[i];
   rep(i,M) P[i]--;
   rep(i,M){
     int ans=accumulate(T,T+N,0);
     ans-=T[P[i]]-X[i];
     cout << ans << endl;
   }
 }

Measured memory_bytes: 256
from collections import Counter
from operator import mul
from functools import reduce
import sys
input = sys.stdin.readline

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

def main():
    N = int(input())
    A = list(map(int, input().split()))

    ans = [0] * N
    cnt = Counter(A)
    s = 0
    for key, value in cnt.items():
        if value < 2:
            continue
        s += combinations_count(value, 2)
    
    for i in range(N):
        if cnt[A[i]]-1 == 0:
            ans[i] = s
        elif cnt[A[i]]-1 == 1:
            ans[i] = s - combinations_count(cnt[A[i]], 2)
        else:
            ans[i] = s - combinations_count(cnt[A[i]], 2) + combinations_count(cnt[A[i]]-1, 2)
    
    print(*ans, sep="\n")

main()

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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

const int inf=LLONG_MAX/3;

signed main(){
	int n=read(),c=read(),k=read();
	vi t;
	REP(i,n)t.PB(read());
	sort(ALL(t));
	int ans=0;
	int i=0;
	while(i<n){
		int j=i;
		while(j<n&&j-i<c&&t[j]-t[i]<=k)
			j++;
		ans++;
		i=j;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
long long x[100005];
int main()
{
	long long n,a,b;
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
	cin>>x[i];
	long long ans=0;
	for(int i=2;i<=n;i++)
	{
		long long m=a*(x[i]-x[i-1]);
		if(m<b)
		ans+=m;
		else
		ans+=b;
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstring>
using namespace std;
int arr[3001],n;
long long dp[3001][3001];
long long solve(int i,int j)
{ if(i>j)
 return 0;
 if(dp[i][j]!=-1)
   return dp[i][j];
 dp[i][j]=max(arr[i]+min(solve(i+2,j),solve(i+1,j-1)),arr[j]+min(solve(i+1,j-1),solve(i,j-2)));
return dp[i][j];
	
}
int main()
{ memset(dp,-1,sizeof(dp));
cin>>n;
long long sum=0;
for(int i=0;i<n;i++)
	{
	 cin>>arr[i];
	  sum+=arr[i];
    }
long long 	int x=solve(0,n-1);
	long long int y=sum-solve(0,n-1);
	cout<<x-y;
	
}

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

const long long mod = 1e9+7;
long long a[200005], sum[200005], ans, n;

int main() {
    cin >> n;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = n; i >= 1; i--)
        sum[i] = (sum[i+1]+a[i])%mod;

    for(int i = 1; i < n; i++) {
        ans += a[i]*sum[i+1];
        ans %= mod;
    }
    cout << ans;
}


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

const int N = 200 * 1000 + 5, A = 2005;
const int mod = 1000 * 1000 * 1000 + 7;

long long dp[2 * A][2 * A];
long long gl[2 * A][2 * A];
long long fac[4 * A];
int po(int x, int y) {
	if (y == 0)
		return 1;
	long long ans = po(x, y / 2);
	ans *= ans;
	ans %= mod;
	if (y % 2 == 1) {
		ans *= x;
		ans %= mod;
	}
	return ans;
}
long long chs(int x, int y) {
	long long ans = fac[x];
	ans *= po(fac[y], mod - 2);
	ans %= mod;
	ans *= po(fac[x - y], mod - 2);
	ans %= mod;
	return ans;
}
int main() {
	fac[0] = 1;
	for (int i = 1; i < 4 * A; i++) {
		fac[i] = fac[i - 1] * i;
		fac[i] %= mod;
	}
	int n;
	cin >> n;
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		int x, y;
		cin >> x >> y;
		dp[A - x][A - y]++;
		gl[x + A][y + A]++;
		ans -= chs(2 * x + 2 * y, 2 * x);
		ans += mod;
		ans %= mod;
	}
	for (int i = 1; i < 2 * A; i++) {
		for (int j = 1; j < 2 * A; j++) {
			dp[i][j] += dp[i - 1][j];
			dp[i][j] %= mod;
			dp[i][j] += dp[i][j - 1];
			dp[i][j] %= mod;
			ans += 1ll * dp[i][j] * gl[i][j];
			ans %= mod;
		}
	}
	ans *= po(2, mod - 2);
	ans %= mod;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 190208