akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <utility>
#include <algorithm>
#include <cstdio>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <fstream>
#include <cmath>
#include <random>
#include <complex>
#include <functional>
#include <bitset>
#include <sstream>
#include <cassert>
#include <time.h>

#define ll int64_t
#define Rep(i, n) for (ll i = 0; i < n; i++)
using namespace std;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll inf = 1LL << 60;

template<class T> inline void chmin(T& a, T b) {
    if (a > b) {
        a = b;
    }
}
template<class T> inline void chmax(T& a, T b) {
    if (a < b) {
        a = b;
    }
}
void printvec (vec &v) {
    Rep (i, (ll)v.size()) {
        cout << v[i] << " \n"[i+1 == (ll)v.size()];
    }
}

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

    ll N;
    cin >> N;

    ll ans = 0;
    map<ll, ll> cnt;
    for (ll x = 1; x <= 200; x++) {
        for (ll y = 1; y <= 200; y++) {
            for (ll z = 1; z <= 200; z++) {
                cnt[x*x+y*y+z*z+x*y+y*z+z*x]++;
            }
        }
    }

    for (ll i = 1; i <= N; i++) {
        cout << cnt[i] << "\n";
    }
}


Measured memory_bytes: 14104
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>>
#include <functional>
#include <string>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}

ll func(ll b, ll n) {
	if (n < b)
		return n;
	return func(b, n/b) + n%b;
}

signed main() {
	int n,l,q;
	scnaf("%d", &n);
	vector<int> h(n);
	REP(i, n) {
		scnaf("%d", &h[i]);
	}

	scanf("%d %d", &l, &q);

	int db[100001][31] = {};
	
	REP(i, n-1) {
		db[i][0] = upper_bound(ALL(h), h[i] + l) - h.begin() - 1;
	}
	db[n - 1][0] = INT_MAX;
		rep(j, 1, 31) {
	REP(i, n) {
		if (db[i][j - 1] == INT_MAX)
			db[i][j] = INT_MAX;
		else 
			db[i][j] = db[db[i][j-1]][j - 1];
		}
	}

	REP(i, q) {
		int a, b;
		scanf("%d %d", &a, &b);
		a--, b--;
		if (b < a)
			swap(a, b);

		int ans = 0;

		int now = a;

		while (now < b) {
			if (b <= db[now][0]) {
				ans++;
				break;
			}
			auto buf = upper_bound(begin(db[now]), end(db[now]), b);
			buf--;
			ans += (1 << (buf - begin(db[now])));
			now = *buf;
		}

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

	return 0;
}

Measured memory_bytes: 13312
import numpy as np
H,W,K = (int(x) for x in input().split())
Tile = np.zeros((H,W),dtype=bool)
Count = 0
for T in range(0,H):
    Tile[T,:] = np.array([True if I=='#' else False for I in list(input())])
for TT in range(0,pow(2,H)):
    DrawG = list(int(x) for x in list(('{:0'+str(H)+'b}').format(TT,'b')))
    GTile = np.copy(Tile)
    for TH in range(0,H):
        if DrawG[TH]==1:
            GTile[TH,:] = False
    for TTT in range(0,pow(2,W)):
        WTile = np.copy(GTile)
        DrawL = list(int(x) for x in list(('{:0'+str(W)+'b}').format(TTT,'b')))
        for TTW in range(0,W):
            if DrawL[TTW]==1:
                WTile[:,TTW] = False
        if np.sum(WTile)==K:
            Count += 1
print(Count)

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

int main() {
	int n; cin>>n;
	ll prev=2, current=1, next;
	while (n>1) {
		next=prev+current;
		prev=current;
		current=next;
		n--;
	}
	cout << current << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n, m;
	cin >> n >> m;
	string str1 = "", str2 = "";
	for(int i =0; i<m;i++)
	{
		str1+=to_string(n);
	}
	for(int i =0; i<n;i++)
	{
		str2+=to_string(m);
	}
	if(str1 > str2)
	{
		cout << str2 ;
	}
	else
	{
		cout << str1;
	}
}


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

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

  cout << (N/2+N%2) << endl;
}


Measured memory_bytes: 256
//https://atcoder.jp/contests/abc170/tasks/abc170_b
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll x;
	cin>>x;
	ll y;
	cin>>y;
	ll c;
	ll t;
	t=(y-(2*x))/2;
	c=((4*x)-y)/2;
	if(c<0||t<0)
	{
		cout<<"No"<<"\n";
	}
	else if((c+t==x)&&((2*c)+(4*t)==y))
	{
		cout<<"Yes"<<"\n";
	}	
	else
	{
		cout<<"No"<<"\n";
	}
	return 0;
}


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

int main() {
  string s;
  cin >> s;
  rep(i,0,s.length()) {
    s[i] = 'x';
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long int

int main()
 {
	//code
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll N,W,i,j;
    cin>>N>>W;
    ll A[N+1][2],dp[N+1][W+1];
    for(i=1;i<=N;i++)
        cin>>A[i][0]>>A[i][1];
    for(i=0;i<=N;i++)
    {
        for(j=0;j<=W;j++)
        {
            if(i==0 || j==0)
                dp[i][j]=0;
            else if(A[i][0] <= j)
                dp[i][j] = max(dp[i-1][j],dp[i-1][j-A[i][0]]+A[i][1]);
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    cout<<dp[N][W]<<endl;
	return 0;
}

Measured memory_bytes: 79104
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int D= sc.nextInt();
		switch (D) {
		case 22:
			System.out.println("Christmas Eve Eve Eve");
			break;
		case 23:
			System.out.println("Christmas Eve Eve");
			break;
		case 24:
			System.out.println("Christmas Eve");
			break;
		default:
			System.out.println("Christmas");
			break;
		}
	}
}

Measured memory_bytes: 21204
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <utility>
#include <numeric>
#include <deque>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cmath>
#include <limits>
#include <cassert>

#define for0(i, N)    for (int i = 0  ; i <  (N); ++i)
#define for1n(i, N)   for (int i = 1  ; i <= (N); ++i)
#define for1(i, N)    for (int i = 1  ; i <  (N); ++i)
#define forn(i, N)    for (int i = 0  ; i <= (N); ++i)
#define forx(i, N, x) for (int i = (x); i <  (N); ++i)
#define forl(i, n, x, a) for (int i = (x), a = 0; a < (n);  \
                              i = (i + 1) % (n), ++a)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef priority_queue<ll> pq;
typedef priority_queue<ll,vector<ll>, greater<ll>> pql;
typedef stack<ll> stk;
typedef queue<ll> qu;


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

    int N;

    cin >> N;

    int B[(int)1e5];

    for0(i, N - 1){
        cin >> B[i];
    }

    int result = 0;
    result += B[0];

    for0(i, N - 2){
        result += min(B[i], B[i + 1]);
    }
    result += B[N - 2];

    cout << result;


    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++)
#include <set>
#include <math.h>
#define pai 3.14159265358979323846264338327950288;
#define keta(n) cout << fixed << setprecision((n));
using ll = long long;
int main()
{
  int n,x;
  cin>>n>>x;
  int a=1000,sum =0;
  rep(i,n){
    int m;
    cin>>m;
    sum += m;
    a= min(a,m);
  }
  cout<<n+(x-sum)/a;
    
    
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long N;
    cin >> N;
    vector<long> B(N-1);
    for(size_t i=0;i<N-1; i++)
    {
        cin >> B[i];
    }
    ll total = 0;
    for(size_t i=1;i<N-1; i++)
    {
        total += min(B[i-1], B[i]);
    }
    total += B[0] + B[N-2];
    cout << total << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <algorithm>
#include <functional>

#include <deque>

using namespace std;

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

	long long N, M;
	cin >> N >> M;

	long long M_div_2 = M / 2;
	if (M_div_2 < N)
	{
		cout << min(M_div_2, N);
	}
	else
	{
		M_div_2 -= N;
		cout << N + max(0LL, (M_div_2 / 2));
	}

	return 0;
}

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

template<typename T>
struct Seg{
private:
    vector<T> node;
    int n;
    function<T(T,T)> f;
    T def;

public:
    Seg(int siz, T d, function<T(T,T)> f) : def(d), f(f) {
        n = 1;
        while(n < siz)  n *= 2;
        node.resize(2*n-1, def);
    }
    Seg(vector<T> v, T d, function<T(T,T)> f) : def(d), f(f){
        n = 1;
        while(n < v.size())  n *= 2;
        node.resize(2*n-1);
        for(int i = 0; i < v.size(); i++)   node[n-1+i] = v[i];
        for(int i = n-2; i >= 0; i--)   node[i] = f(node[2*i+1], node[2*i+2]);
    }

    void update(int x, T val){
        x += n-1;
        node[x] = f(node[x], val); /* ! */
        while(x){
            x = (x-1)/2;
            node[x] = f(node[2*x+1], node[2*x+2]);
        }
    }

    T query(int a, int b){
        int L = a+n-1, R = b+n-1;
        T ret = def;
        while(L < R){
            if((R&1) == 0)  ret = f(ret, node[--R]);
            if((L&1) == 0)  ret = f(ret, node[L++]);
            L >>= 1, R >>= 1;
        }
        return ret;
    }
};

typedef pair<int,int> pii;

int main(){
    int n;
    cin >> n;
    vector<int> v;
    vector<pii> vp;
    for(int i = 0; i < n; i++){
        int x, l;
        cin >> x >> l;
        vp.push_back({x-l, x+l});
        v.push_back(x-l);
        v.push_back(x+l);
    }
    v.push_back(-2e9-1);
    v.push_back(2e9+1);
    sort(v.begin(), v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
    auto f = [&](int x)->int{
        return lower_bound(v.begin(),v.end(),x)-v.begin();
    };
    Seg<int> seg(v.size(), 0, [](int x, int y){return max(x,y);});
    sort(vp.begin(), vp.end());
    for(int i = 0; i < n; i++){
        seg.update(f(vp[i].second), seg.query(0, f(vp[i].first)+1)+1);
    }
    cout << seg.query(0, v.size()) << endl;
    return 0;
}

Measured memory_bytes: 4076
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,s,f) for(i=s;i<f;i++)
#define hi cout<<'h'<<'i'<<'\n' 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define B begin()
#define E end()
#define vi vector<int>
#define vii vector<pair<int,int>>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define mod2 998244353
#define space 100005
//<<fixed << setprecision(9)

int main()
{
	int n,i,j,t;
	boost;

	cin>>n;
	string s;cin>>s;
	int ans=1;
	rep(i,1,n)
	{
		if(s[i]!=s[i-1])ans++;
	}
	cout<<ans;
	return 0;
}



Measured memory_bytes: 512
use std::io::*;

fn operate<T: IntoIterator<Item = (u8, u8)>>(iter: T, masks: &[u64]) {
  let mut bits = 0u64;

  for (query, i) in iter {
    if query == 0 {
      println!("{}",
        if bits & (1u64 << i) != 0 {
          "1"
        } else {
          "0"
        }
      );
      continue;
    }

    let mask = masks[i as usize];

    match query {
      1 => { bits |= mask; },

      2 => { bits &= !mask; },

      3 => { bits ^= mask; },

      4 => println!("{}",
        if bits & mask == mask { "1" } else { "0" }
      ),

      5 => println!("{}",
        if bits & mask != 0u64 { "1" } else { "0" }
      ),

      6 => println!("{}",
        if bits & mask == 0u64 { "1" } else { "0" }
      ),

      7 => println!("{}", (bits & mask).count_ones()),

      8 => println!("{}", bits & mask),

      _ => unreachable!()
    }
  }
}

fn main() {
  let stdin = stdin();
  let mut lines = stdin.lock().lines().map(|l| l.unwrap());

  let n = lines.next().unwrap().parse().unwrap();
  let mask: Vec<u64> = lines.by_ref().take(n).map(|line| {
    line.split_whitespace()
      .skip(1)
      .map(|s| s.parse::<u8>().unwrap())
      .fold(0u64, |acc, b| acc | (1u64 << b))
  }).collect();

  let q = lines.next().unwrap().parse().unwrap();
  let query = lines.take(q).map(|line| {
    let mut args = line.split_whitespace().map(|s| s.parse::<u8>().unwrap());

    (args.next().unwrap(), args.next().unwrap())
  });

  operate(query, &mask);
}



Measured memory_bytes: 5052
#include "bits/stdc++.h"
using namespace std;

int main() {
	int n;
	vector<int> d(3);
	cin >> n >> d[0] >> d[1] >> d[2];
	vector<pair<int, int>> q;
	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		int a = 0, b = 1;
		if (s == "AB") a = 0, b = 1;
		if (s == "AC") a = 0, b = 2;
		if (s == "BC") a = 1, b = 2;
		q.emplace_back(a, b);
	}
	string ans;
	auto add = [&](int a, int b) {
		d[a]++;
		d[b]--;
		ans += 'A' + a;
	};

	q.emplace_back(0, 1);
	for (int i = 0; i < n; i++) {
		int a = q[i].first;
		int b = q[i].second;
		if (!d[a] && !d[b]) {
			cout << "No" << endl;
			return 0;
		}
		if(!d[a]){
			add(a, b);
		}
		else if (!d[b]) {
			add(b, a);
		}
		else {
			int na = q[i + 1].first;
			int nb = q[i + 1].second;
			if (a == na || a == nb) {
				add(a, b);
			}
			else {
				add(b, a);
			}
		}
	}
	cout << "Yes" << endl;
	for (int i = 0; i < n; i++) {
		cout << ans[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 4312
#include <iostream>
using namespace std;
using ll = long long;

ll d(ll n) {
  ll res = 0;
  while (n) {
    res += 1;
    n /= 10;
  }
  return res;
}

ll s(ll n) {
  ll res = 0;
  while (n) {
    res += n % 10;
    n /= 10;
  }
  return res;
}

ll f(ll n) {
  ll x = 1;
  for (int i = 0; i <= d(n); i++) {
    int y = 0;
    while (y < 9 - n / x % 10) {
      if (n * s(n + x) <= (n + x) * s(n)) break;
      y++;
    }
    n += x * y;
    x *= 10;
  }
  return n;
}

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

  int K;
  cin >> K;

  ll n = 0;
  while (K--) {
    n = f(n + 1);
    cout << n << "\n";
  }
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1000000000;

int main() {
    ll N;
    cin >> N;
    vector<ll>A(N);
    for (int i=0; i<N; i++)cin >> A[i];
    for (int i=0; i<N; i++){
        if (A[i] == 0){
            cout << 0 << endl;
            exit(0);
        }
    }

    ll ans = 1;
    for (int i=0; i<N; i++){
        ll emer = INF*INF / ans + 1; //A_iがemer以上だと答えが10^18を超えることになる
        ans *= A[i];
        if (ans > INF*INF || A[i] > emer){
            cout << -1 << endl;
            exit(0);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 4380
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;

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

int n,m,h[101],hnum[101],dh[101];
long long dp[101][101];

int pow_(int x,int y) {///快速幂求 x的y次方
    long long ans = 1;
    if(y > 0) {
        while(y) {
            if(y % 2)ans = ans * x % MOD;
            x = (long long)x * x % MOD;
            y /= 2;
        }
    }
    return ans;
}

int main() {
    scanf("%d",&n);
    for(int i = 1;i <= n;i ++) {
        scanf("%d",&h[i]);
        dh[++ m] = h[i];
    }
    sort(dh + 1,dh + m + 1);///高度排序
    m = unique(dh + 1,dh + m + 1) - dh - 1;///离散化 m是离散化后的长度
    for(int i = 1;i <= n;i ++) {
        hnum[i] = lower_bound(dh + 1,dh + m + 1,h[i]) - dh;
    }
    dp[0][0]=1;
    for(int i = 1;i <= n;i ++) {
        for(int j = hnum[i] + 1;j <= hnum[i - 1];j ++)
            (dp[i][0] += dp[i - 1][j] * 2 % MOD) %= MOD;

        (dp[i][0] += dp[i - 1][0] * 2 % MOD) %= MOD;///交叉或者不交叉

        int d = pow_(2,h[i] - h[i - 1]);
        for(int j = 1;j <= min(hnum[i - 1],hnum[i]);j ++) {
            dp[i][j] = dp[i - 1][j] * d % MOD;
        }
        for(int j = hnum[i - 1] + 1;j <= hnum[i];j ++) {///比前一列高出的部分
            if(j > 1)(dp[i][j] += dp[i - 1][0] * (pow_(2,dh[j] - dh[j - 1]) - 1) % MOD * 2 % MOD * pow_(2,h[i] - dh[j]) % MOD) %= MOD;
            else (dp[i][1] += dp[i - 1][0] * (pow_(2,dh[1]) - 2) % MOD * pow_(2,h[i] - dh[1]) % MOD) %= MOD;///上一列中无重复相同的乘上化不超过上一列高度中有重复的
        }
    }
    long long ans = 0;
    for(int i = 0;i <= hnum[n];i++)
        (ans += dp[n][i]) %= MOD;
    printf("%lld",ans);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI 3.141592653589793
#define rep(i, n) for (int i = 0; i < (n); i++)
#define REP(i, a, n) for (int i = a; i < (n); i++)
#define rrep(i, n, k) for (int i = (n); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> make_vector(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto make_vector(size_t a, Ts... ts){return vector<decltype(make_vector<T>(ts...))>(a, make_vector<T>(ts...));}
const int MOD = 1e9+ 7;
const int INF = numeric_limits<int>::max() - 1e8;
const ll INFLL = numeric_limits<ll>::max() - 1e17;

signed main() {
    ll K;
    cin >> K;
    ll sum = 0;
    for (int i = 1; i <= K; i++) {
        for (int j = 1; j <= K; j++) {
            for (int k = 1; k <= K; k++) {
                sum += gcd(i, gcd(j, k));
            }
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
int prime(int x) {
	if (x < 2)return 0;
	else if (x == 2) return 1;
	if (x % 2 == 0) return 0;
	for (int i = 3; i*i <= x; i += 2) {
		if (x%i == 0) return 0;
	}
	return 1;
}
int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int x = a + b;
	int y = c + d;
	if (x > y)puts("Left");
	else if (x < y)puts("Right");
	else puts("Balanced");
}



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

int main()
{
	string s;
	cin>>s;
	if(s[0]=='R')
	{
		if(s[1]=='R')
		{
			if(s[2]=='R')
				cout<<"3";
			else
				cout<<"2";
		}
		else
			cout<<"1";
	}
	else
	{
		if(s[1]=='R')
		{
			if(s[2]=='R')
				cout<<"2";
			else
				cout<<"1";
		}
		else
		{
			if(s[2]=='R')
				cout<<"1";
			else
				cout<<"0";
		}
	}

	return 0;
}

Measured memory_bytes: 3520
#include <cstdio>
#include <algorithm>
using namespace std;
typedef long long LL;
const int maxn=1e5+10;
int n;
int a[maxn],b[maxn];
int main() {
    scanf("%d",&n);
    for (int i=1;i<=n;i++) scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    b[1]=1;
    b[n]=n&1?1:-1;
    int sign=-1;
    for (int i=2;i<n;i++) {
        b[i]=2*sign;
        sign*=-1;
    }
    sort(b+1,b+1+n);
    LL ans1=0;
    for (int i=n;i>=1;i--) ans1+=b[i]*a[i];
    b[1]=-1;
    b[n]=n&1?-1:1;
    sign=1;
    for (int i=2;i<n;i++) {
        b[i]=2*sign;
        sign*=-1;
    }
    sort(b+1,b+1+n);
    LL ans2=0;
    for (int i=n;i>=1;i--) ans2+=b[i]*a[i];
    printf("%lld\n", max(ans1,ans2));
    return 0;
}

Measured memory_bytes: 1024
'use strict'

function main(s) {

  const n = s.split('\n')[0].split('');

  const pattern1 = n[0] === n[1] && n[1] === n[2];
  const pattern2 = n[1] === n[2] && n[2] === n[3];

  const ans = pattern1 || pattern2;
  console.log(ans ? 'Yes' : 'No');
}

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


Measured memory_bytes: 11468
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;



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

	int H, W;
	cin >> H >> W;
	vvc f(H, vc(W));
	rep(i, H) {
		string str;
		cin >> str;
		rep(j, W) {
			f[i][j] = str[j];
		}
	}
	rep(i, H)rep(j, W){
		if (f[i][j] == '#')continue;
		int num = 0;
		repr(di, -1, 2)repr(dj, -1, 2) {
			if (di == 0 && dj == 0)continue;
			if (i + di < 0 || i + di >= H || j + dj < 0 || j + dj >= W)continue;
			if (f[i + di][j + dj] == '#')num++;
		}
		f[i][j] = (char)('0' + num);
	}
	rep(i, H) {
		rep(j, W) {
			cout << f[i][j];
		}
		cout << endl;
	}

	return 0;
}

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

int main()
{
    int a ,b ,k = 1 ;
    cin >> a >> b ;
    int sum = 0 ;
    if (b <= 9)
        sum = a * 10 + b ;
    else if ( b > 9 && b < 100)
        sum = a * 100 + b ;
    else if (b == 100)
        sum = a * 1000 + b ;
    while (k*k <= sum)
    {
        k ++ ;
    }
    if ((k-1)*(k-1) == sum)
        cout << "Yes" ;
    else
        cout << "No" ;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#define N 60
#define M 33
#define ll long long
using namespace std;
int l[N],id[N];
ll f[N<<3][M];
int main()
{
	int n,c;
	scanf("%d%d",&n,&c);
	for(int i=1;i<=n;i++) scanf("%d",&l[i]);
	sort(l+1,l+n+1);
	for(int i=1;i<n;i++) id[i]=i;
	double ans=0;
	int maxn=1<<(n-1);
	do
	{
		for(int i=0;i<=n*c;i++)
			for(int j=0;j<maxn;j++) f[i][j]=0;
		f[n*l[n]][0]=1;
		for(int i=0;i<n*c;i++)
		if(i%n)
		{
			int u=id[i%n];
			for(int s=0;s<maxn;s++)
			if(!(s&(1<<(u-1))))
			{
				int t=s|(1<<(u-1));
				for(int j=i;j<=n*c;j++)
				f[min(n*c,max(j,i+n*l[u]))][t]+=f[j][s];
			}
		}
		ans+=f[n*c][maxn-1];
	}while(next_permutation(id+1,id+n));
	for(int i=1;i<n;i++) ans/=1.0*i*c;
	printf("%.12f",ans);
	return 0;
}


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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<pii> AB(N);
  for (int i = 0; i < N; i++) {
    int a, b;
    cin >> a >> b;
    AB[i] = make_pair(a, b);
  }
  sort(AB.begin(), AB.end());
  int count = 0;
  ll money = 0;
  for (int i = 0; i < N; i++) {
    if (count + AB[i].second <= M) {
      count += AB[i].second;
      money += 1LL * AB[i].first * AB[i].second;
    } else {
      money += 1LL * (M - count) * AB[i].first;
      break;
    }
  }
  cout << money << '\n';
  return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

int dx[4],dy[4];
bool used[4][4];

int rec(int d){

  if(d>=8)return 1;  

  int tmpx=-1,tmpy=-1;
  for(int i=0;i<4;i++){
    for(int j=0;j<4;j++){
      if(!used[i][j]){
	tmpx=j,tmpy=i;
	goto end;
      }
    }
  }
 end:;

  if(tmpx<0 || tmpy<0)return 0;
  used[tmpy][tmpx]=true;

  int res=0;
  for(int i=0;i<4;i++){
    int nx=tmpx+dx[i],ny=tmpy+dy[i];
    if(nx<0 || ny<0 || 3<nx || 3<ny || used[ny][nx])continue;
    used[ny][nx]=true;
    res+=rec(d+1);
    used[ny][nx]=false;
  }
  used[tmpy][tmpx]=false;
  return res;
}

int main(void){
  
  while(true){
    for(int i=0;i<4;i++){
      cin >> dx[i];
      if(dx[i]>4)return 0;
      cin >> dy[i];
    }
    fill(used[0],used[4],false);
    cout << rec(0) << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1160
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int MOD = 1e9+7, MAX = 1e9, larg = 1e5, INF = -1e9;
long long A,B,C,D,E,F,G,H,I,J,K,L,N,M,O,P,Q,R,S,T,U,V,W,X,Y,Z;
long long max_value = INF, max_index = -1;
long long min_value = MAX, min_index = -1;
long long sum = 0;

typedef pair<int, int> Pa;
typedef long long ll;

int a[100];
int main() {
    cin >> N;
    rep(i, N) cin >> a[i];
    rep(i, N){
        rep(j, N){
            max_value = max((int)max_value, abs(a[i]-a[j]));
        }
    }
    cout << max_value;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
K, X = map(int, input().split())

if 500*K >= X :
  print ("Yes")
else :
  print ("No")

Measured memory_bytes: 38384
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long 
int F[2100010];

int Mul(int a, int b) {
	return ((a % mod) * (b % mod)) % mod;
}

void fact(void) {
	F[0] = 1;
	F[1] = 1;
	for (int i = 2; i <= 2100000; i++) {
		F[i] = Mul(i, F[i - 1]);
	}
}
int square(int x) {
	return (x * x) % mod;
}

int power(int x, int y) {
	if (y == 0) return 1;
	else if (y == 1) return x % mod;
	else if (y % 2 == 0) return square(power(x, y / 2)) % mod;
	else return square(power(x, y / 2)) * x % mod;
}

int Div(int a, int b) {
	return Mul(a, power(b, mod - 2));
}
int P(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return Div(F[n], F[n - r]);
}

int C(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	int ret;
	ret = Div(F[n], Mul(F[n - r], F[r]));
	return ret;
}
int H(int n, int r) {
	if (n == 0 && r == 0) return 1;
	return C(n + r - 1, r);
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int C[200010];
    rep(i, N) cin >> C[i];
    sort(C, C + N, greater<int>());
    int ans = 0;
    int k = power(2, N - 1);
    rep(i, N) {
        ans = (ans + Mul(C[i], k)) % mod;
        //cout << ans << " " << k << endl;
        k = (k + power(2, N - 2)) % mod;
    }   
    cout << Mul(ans, power(2, N)) << endl;


    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) for(int i=0;i < (n);i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define SCANF(i) int i;scanf("%d",&i)
typedef long long ll;
using namespace std;
using P = pair<int,int>;
const long long INF = 1LL << 60;
const int IINF=100000000;
const int MOD = (int)1e9 + 7;
//約数列挙
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    //sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
vector<int> dx={1,0,-1,0};vector<int> dy={0,-1,0,1};

signed main () {
    string weather;cin >> weather;
    int ans = 0;
    if(weather[1]=='R'){
        if(weather[0]=='R' && weather[2]=='R')ans=3;
        else if(weather[0]=='R' || weather[2]=='R')ans=2;
        else ans = 1;
    } else {
        if(weather[0]=='R' || weather[2]=='R')ans=1;
    }
    cout << ans << endl;
}//https://atcoder.jp/contests/abc175/tasks/abc175_a

Measured memory_bytes: 3552
import heapq
n, m = map(int, input().split())
ab = sorted([ list(map(int, input().split())) for _ in range(n) ], reverse=True)
que = []
ans = 0
for i in range(1, m+1):
  while ab and ab[-1][0] <= i:
    t = ab.pop()
    heapq.heappush(que, -t[1])
  if que:
    ans -= heapq.heappop(que)
print(ans)

Measured memory_bytes: 73048
import std;

alias P = Tuple!(long, "x", long, "y");
const MOD = 10^^9 + 7;

long calc(P[] ps, int zeros) {
    long[P] m;
    foreach (p; ps) m[p]++;

    bool[P] used;
    long[] group;
    foreach (p; ps) {
        if (used.get(p, false)) continue;

        // p に属するグループ数
        auto a1 = p;
        auto a2 = P(-p.x, -p.y);
        long acnt = m.get(a1, 0) + m.get(a2, 0);

        // p と垂直な位置関係にある点のグループ数
        auto b1 = P(-p.y, p.x);
        auto b2 = P(p.y, -p.x);
        long bcnt = m.get(b1, 0) + m.get(b2, 0);

        long cnt = 0;
        // s のグループからのみ選ぶ組み合わせ数
        cnt += modpow(2, acnt) - 1; // -1 は何も選ばない分を引いている
        // t のグループからのみ選ぶ組み合わせ数
        cnt += modpow(2, bcnt) - 1;
        // s からも t からも選ばない
        cnt += 1;
        cnt %= MOD;

        group ~= cnt;
        used[a1] = used[a2] = used[b1] = used[b2] = true;
    }

    long ans = 0;
    if (group.length > 0) {
        ans += group.fold!((a, b) => a * b % MOD)(1L);
        ans -= 1; // 全てのグループにおいて何も選ばなかった分の 1 を引く
    }
    ans += zeros;
    return (ans + MOD) % MOD;
}

void main() {
    int n; scan(n);
    P[] ps;
    int zeros = 0;
    foreach (_; 0..n) {
        long a, b; scan(a, b);
        if (a == 0 && b == 0) zeros++;
        else {
            long g = gcd(abs(a), abs(b));
            ps ~= P(a/g, b/g);
        }
    }
    writeln(calc(ps, zeros));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T=string)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readints = reads!int;

long modpow(long x, long k) {
    if (k == 0) return 1;
    if (k % 2 == 0) return modpow(x * x % MOD, k / 2);
    return x * modpow(x, k - 1) % MOD;
}


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

int main(){
    int a,b,c;
    cin >> a>> b >>c;
    if((a==b&&b==c)||(a!=b&&b!=c&&c!=a)){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
}


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

int main() {
  string s;
  cin>>s;
  rep(i,3){
    if(s.at(i)=='7'){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}

Measured memory_bytes: 3616
// B - String Palindrome
#include <bits/stdc++.h>
using namespace std;

bool isPalindrome(string s){
    string t = s;
    reverse(t.begin(), t.end());
    return s == t;
}
int main(){
    string s;
    cin >> s;
    int n = s.size();
    if(isPalindrome(s) && isPalindrome(s.substr(0, (n-1)/2)) && isPalindrome(s.substr((n+3)/2-1))){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
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; }
typedef long long ll;
typedef pair<int,int> P;

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

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> s(n);
  vector<int> t(m);
  rep(i,n)cin >> s[i];
  rep(i,m)cin >> t[i];
  vector<vector<mint>> dp(n+1,vector<mint>(m+1,0));
  rep(i,n+1)rep(j,m+1){
    if(i==0||j==0)dp[i][j]=1;
    else{
      dp[i][j] += dp[i][j-1];
      dp[i][j] += dp[i-1][j];
      if(s[i-1]==t[j-1])dp[i][j] += dp[i-1][j-1];
      dp[i][j] -= dp[i-1][j-1];
    }
  }
  cout << dp[n][m].x << endl;
}

Measured memory_bytes: 31616
#include <bits/stdc++.h>
#define mod 26
#define S str[i]
using namespace std;
string str;
 
string solve(){
  string res;
  stack <int> st;
  for(int i=0;i<str.size();i++){
    int cnt=0;
    while(S=='+'||S=='-')cnt+=(S=='+')-(S=='-'),i++;
    
    if(cnt) res+=((S-'A')+cnt%mod+mod)%mod+'A';
    else if(S!='['&&S!=']')res += S;
    if(S=='?')res[res.size()-1]='A';
    if(S=='[')st.push(res.size());
    if(S==']'){
      reverse(res.begin()+st.top(),res.end());
      st.pop();
    }
  }
  return res;
}
 
int main(){
  while(1){
    cin>>str;
    if(str==".")break;
    cout <<solve()<<endl;
  }
  return 0;
}

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

#define ll long long
#define ull unsigned long long

using namespace std;
const int MAXN = 100010;

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

	vector <int> b(MAXN);
	for (int ii = 0; ii < N; ++ii){
		int a;
		cin >> a;
		b[a] += 1;
		b[a+1] += 1;
		if (a > 0) b[a-1] += 1;
	}

	sort(b.rbegin(), b.rend());
	cout << b[0] << "\n";

	return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
#include <sstream>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5;
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl

String to integer:
stringstream dark(s);
int x = 0; dark >> x;
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}


ll n, m, dp[1000][1000]; char a[1000][1000];    

void solve()
{
    cin >> n >> m;
    for (int i=0; i<n; ++i) for (int j=0; j<m; ++j) cin >> a[i][j];
    for (int i=0; i<n; i++) {
        for (int j=0; j<m; j++) {
            if (i==0&&j==0) dp[i][j]++;
            else if (a[i][j]=='#') continue;
            else if (i==0) dp[i][j] = (dp[i][j-1])%MOD;
            else if (j==0) dp[i][j] = (dp[i-1][j])%MOD;
            else dp[i][j] += (dp[i-1][j] + dp[i][j-1])%MOD;
        }
    }nout(dp[n-1][m-1]%MOD);
    /*for (int i=0; i<n; i++) {
        for (int j=0; j<m; ++j) sout(dp[i][j]);
        cout << endl;
    }*/

}   

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 12396
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cstdlib>
#include<cmath>
using namespace std;
double GetLen(double x1,double y1,double x2,double y2){
  return sqrt((y2-y1)*(y2-y1)+(x2-x1)*(x2-x1));
}
main(){
  int n;
  double x1,y1,x2,y2,x3,y3; 
  double R,rx,ry;
  double a,b,c,a1,b1,c1,a2,b2,c2;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    scanf("%lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3);
    a=GetLen(x1,y1,x2,y2);
    b=GetLen(x2,y2,x3,y3);
    c=GetLen(x3,y3,x1,y1);
    R=(a*b*c)/sqrt((a+b+c)*(-a+b+c)*(a-b+c)*(a+b-c));
    a1=2*(x2-x1);
    b1=2*(y2-y1);
    c1=x1*x1-x2*x2+y1*y1-y2*y2;
    a2=2*(x3-x1);
    b2=2*(y3-y1);
    c2=x1*x1-x3*x3+y1*y1-y3*y3;
    rx=(b1*c2-b2*c1)/(a1*b2-a2*b1);
    ry=(c1*a2-c2*a1)/(a1*b2-a2*b1);
    printf("%.3f %.3f %.3f\n",rx,ry,R);
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std ;
typedef long long ll ;
#define pb push_back
ll cost[100007][5] ;

int main() {
        ll n ,x,y,z,j,i;
        cin >> n ;
        for(i=0;i<100007;i++) for(j=0;j<5;j++) cost[i][j] = 0 ;
        for(i=1;i<=n;i++) {
            cin >> x >> y >> z ;
            if (i==1) {
                cost[i][1] = x ;
                cost[i][2] = y ;
                cost[i][3] = z ;
            }
            else {
                cost[i][1] = max(cost[i-1][2],cost[i-1][3])+x ;
                cost[i][2] = max(cost[i-1][1],cost[i-1][3])+y ;
                cost[i][3] = max(cost[i-1][1],cost[i-1][2])+z ;
            }
        }

        cout << max({cost[n][1],cost[n][2],cost[n][3]})<< endl ;


}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P ,P> PP;
constexpr ll MOD = ll(1e9) + 7;
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e5) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

ll n;
PP pos[4];
string dir = "RULD";
constexpr double dy[] = {0, 1, 0, -1}, dx[] = {1, 0, -1, 0};

double f(double t){
    double x[2] = {-1e9, 1e9}, y[2] = {-1e9, 1e9};
    REP(i,4){
        x[0] = max(x[0], t*dx[i]+pos[i].first.first);
        x[1] = min(x[1], t*dx[i]+pos[i].second.first);
        y[0] = max(y[0], t*dy[i]+pos[i].first.second);
        y[1] = min(y[1], t*dy[i]+pos[i].second.second);
    }
    return (x[0]-x[1])*(y[0]-y[1]);
}

int main() {
    cin >> n;
    REP(i,4){
        pos[i].first.first = -1e9;
        pos[i].first.second = -1e9;
        pos[i].second.first = 1e9;
        pos[i].second.second = 1e9;
    }
    REP(i,n){
        ll x, y;
        char d;
        cin >> x >> y >> d;
        REP(j,4){
            if(d==dir[j]){
                pos[j].first.first = max(pos[j].first.first,x);
                pos[j].second.first = min(pos[j].second.first,x);
                pos[j].first.second = max(pos[j].first.second,y);
                pos[j].second.second = min(pos[j].second.second,y);
            }
        }
    }
    double ans = LLINF;
    REP(i,2.5e8){
        ans = min(ans, f(double(i)/2));
    }
    printf("%.10lf\n",ans);
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.Arrays;
class Main{
	public static void main(String[] args) throws IOException {
		int i,j;
		int[] n = new int[5];
		String[] str = new String[5];
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		str = in.readLine().split(" ");
		Arrays.fill(n,10001);
		for(i=0;i<3;i++)
			n[i] = Integer.parseInt(str[i]);
		Arrays.sort(n);
		System.out.println(n[0]+" "+n[1]+" "+n[2]);
	}
}

Measured memory_bytes: 24356
import java.util.Scanner;

public class Main {
	private static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int l = sc.nextInt();
		String s = sc.next();
		int n = 0;
		int ret = 0;
		for (int i = 0;i < l;i++) {
			char c = s.charAt(i);
			if (c=='I') n++;
			if (c=='D') n--;
			ret = Math.max(ret,n);
		}
		System.out.println(ret);
	}
}


Measured memory_bytes: 9684
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)      x.begin(), x.end()
#define SIZE(x)     static_cast<i64>(x.size())
#define rep(i,n)    for (i64 i = 0, i ## _limit = (n); i < i ## _limit; ++i)
#define reps(i,s,t) for (i64 i = (s), i ## _limit = (t); i <= i ## _limit; ++i)
#define repr(i,s,t) for (i64 i = (s), i ## _limit = (t); i >= i ## _limit; --i)

#ifdef DBG
#define trace(...) _trace(#__VA_ARGS__, __VA_ARGS__);
#else
#define trace(...)
#endif

using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template<class T, class U>inline bool chmax(T &a, const U &b){return b>a && (a=b, true);}
template<class T, class U>inline bool chmin(T &a, const U &b){return b<a && (a=b, true);}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template<class T>
ostream& operator<< (ostream &os, const vector<T> &vec) {
    rep(i, vec.size()) os << vec[i] << (i+1 == vec.size() ? "" : " ");
    return os;
}

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

template<class Itr>
ostream& printContainer(Itr begin, Itr end, const string &separator = " ", ostream &os = cout) {
    const auto rbegin = std::prev(end);
    for (; begin != rbegin; ++begin) os << *begin << separator;
    os << *rbegin;
    return os;
}

ostream& operator<< (ostream &os, ostream&) {
    return os;
}

template <class T>
void _trace(const char *s, T&& x) {
    clog << '{';
    while(*s != '\0') clog << *(s++);
    clog << ":" << setw(3) << x << '}' << endl;
}

template <class Head, class... Tail>
void _trace(const char *s, Head&& head, Tail&&... tail) {
    clog << '{';
    while(*s != ',') clog << *(s++);
    clog << ":" << setw(3) << head << "}, ";
    for (++s; !isgraph(*s); ++s);
    _trace(s, std::forward<Tail>(tail)...);
}
// }}} End Header

signed main()
{
    // ios::sync_with_stdio(false); cin.tie(nullptr);
    i64 N, A, B;
    cin >> N >> A >> B;

    string s;
    cin >> s;

    int all = 0;
    int abroad = 0;

    for (int i = 0; i < s.length(); ++i) {
        if (s[i] == 'a') {
            if (all < A + B) {
                puts("Yes");
                ++all;
            } else {
                puts("No");
            }
        } else if (s[i] == 'b') {
            if (all < A + B && abroad < B) {
                puts("Yes");
                ++all;
                ++abroad;
            } else {
                puts("No");
            }
        } else {
            puts("No");
        }
    }

    return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f(i,x,n) for(int i=x;i<n;++i)
#define ar array
int mod= 998244353;
int32_t main()
{
  int n; cin>>n;
   ar<int,2> a[n];
   f(i,0,n)
   cin>>a[i][0]>>a[i][1];
   sort(a,a+n);
   int dp[n+1];
   f(i,0,n+1)
   dp[i]=-1;dp[n]=1;
   vector<ar<int,2>> v{{n,(int)2e9}};
   for(int i=n-1;i>=0;--i){
      while(v.back()[1]<a[i][0]+a[i][1])
        v.pop_back();
      int p=v.back()[0];
      dp[i]=dp[p];
      dp[i]+=dp[i+1];
      dp[i]%=mod;
      v.push_back({i, a[i][0]});
   }   
   cout<<dp[0];
  return 0;
}


Measured memory_bytes: 7156
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/
struct UnionFind{
	vl par,dist;
	UnionFind(int x){par.assign(x,-1); dist.assign(x,0);}
	ll find(ll x){return par[x]<0?x:find(par[x]);}
	ll depth(ll x){return par[x]<0?0:depth(par[x])+dist[x];}
	bool same(ll x,ll y){return find(x)==find(y);}
	ll size(ll x){return -par[find(x)];}
	ll diff(ll x,ll y){return same(x,y)?depth(x)-depth(y):LINF;}
	void unite(ll x,ll y,ll k=0){
		k+=depth(y); k-=depth(x); k=-k;
		x=find(x); y=find(y);
		if(x==y)return;
		if(size(x)<size(y)){swap(x,y);k=-k;}
		par[x]+=par[y]; par[y]=x; dist[y]=k;
	}
};

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,k;
	cin>>n>>k;
	UnionFind uf(n);
	rep(i,k){
		int a,b,c;
		cin>>a>>b>>c;
		uf.unite(a-1,b-1);
	}
	map<ll,ll> mp;
	rep(i,n)mp[uf.size(i)]++;
	ll ans=0;
	for(auto t : mp){
		ans+=t.sc/t.fs;
	}
	puta(ans);
	return 0;
}

Measured memory_bytes: 1792