akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define LLIandI pair<long long int , int>
#define ll long long

int main(void){
    int N;
    scanf("%d",&N);
    int H[22];
    int high=0;
    int ans=0;
    rep(i,N){
        scanf("%d",&H[i]);
        if(H[i]>=high){
            high=H[i];
            ans++;
        }
    }
    printf("%d\n",ans);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<ll>;
#define _GLIBCXX_DEBUG
#define rep(i, a, b) for(int i = a; i < b; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    int n; cin>>n;
    vector<int> p(n);
    rep(i,0,n) cin>>p[i];
    int ans=0;
    rep(i,0,n-2){
        if((p[i+1]>p[i]&&p[i+1]<p[i+2])||(p[i+1]<p[i]&&p[i+1]>p[i+2]))
        ans++;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
'use strict'
function main(input: string) {
    const n: number = Number(input.split('\n')[0]);
    if (n >= 3200) {
        console.log(input.split('\n')[1]);
        return;
    }
    console.log("red");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,A[100005],dp[100005];
int main()
{
  cin>>n;
  for(long long i=1;i<=n;i++)
    cin>>A[i];
  dp[1]=0; dp[2]=abs(A[1]-A[2]); 
  //cout<<dp[2];
  for(long long i=3;i<=n;i++)
    dp[i]=min(abs(A[i]-A[i-1])+dp[i-1],abs(A[i]-A[i-2])+dp[i-2]);
    //for(long long i=1;i<=n;i++)
    //cout<<dp[i]<<" ";
  cout<<dp[n];
  
}

Measured memory_bytes: 1792
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;
static import std.ascii;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] lreads(T = long)(long n){return generate(()=>readln.chomp.to!T()).take(n).array();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue(T, alias less = "a<b") = BinaryHeap!(Array!T, less);
// dfmt on

void main()
{
    long N, U, V;
    scan(N, U, V);
    U--, V--;
    auto G = new long[][](N);
    foreach (_; 0 .. N - 1)
    {
        long A, B;
        scan(A, B);
        A--, B--;
        G[A] ~= B;
        G[B] ~= A;
    }

    if (G[U].length == 1 && G[U][0] == V)
    {
        writeln(0);
        return;
    }

    void bfs1(ref long[] leave, ref long[] dist, long v)
    {
        DList!long S;
        S.insertBack(v);
        dist[] = -1;
        dist[v] = 0;
        leave[] = true;
        while (!S.empty)
        {
            long u = S.front;
            S.removeFront;
            foreach (w; G[u])
                if (dist[w] == -1)
                {
                    dist[w] = dist[u] + 1;
                    S.insertBack(w);
                    leave[u] = false;
                }
        }
    }

    auto du = new long[](N);
    auto l = new long[](N);
    auto dv = new long[](N);
    bfs1(l, du, U);
    bfs1(l, dv, V);
    long e = V;
    foreach (w; 0 .. N)
        if (du[w] < dv[w] && dv[e] < dv[w] && l[w])
            e = w;
    // du.writeln;
    // dv.writeln;
    // writeln(e, " ", du[e], " ", dv[e]);
    writeln(dv[e] - 1);
}


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

#define rep(i,n) for(ll i=0;i<ll(n);i++)
#define YESNO(T) if(T){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define yesno(T) if(T){cout<<"yes"<<endl;}else{cout<<"no"<<endl;}
#define YesNo(T) if(T){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
const double pi = 3.14159265358979;



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

    ll n;
    cin >> n;
    vector<ll> c(n-1);
    vector<ll> s(n-1);
    vector<ll> f(n-1);
    for (ll i = 0;i < n-1;i++){
        cin >> c[i] >> s[i] >> f[i];
    }

    vector<ll> ans(505,0);

    for (ll i = 0; i < n; i++){
        for (ll j = i; j < n-1; j++){
            if (s[j] >= ans[i]){
                ans[i] = s[j] + c[j];
            }
            else{
                ll x = (ans[i] + f[j] -1)/f[j];
                ans[i] = f[j]*x + c[j];
            }
        }
    }

    for (ll i = 0; i < n; i++){
        cout << ans[i] << endl;
    }
}

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

int main(){
  for(int i = 0; i < 10000; i++){
    int n;
    cin >> n;
    double s = 0;
    if(n == 0){
      break;
    }
    else{
      vector<double> v(n, 0);
      vector<double> w(n, 0);
      double sum1 = 0;
      double sum2 = 0;
      for(int j = 0; j < n; j++){
        cin >> v[j];
        sum1 += v[j]; 
        w[j] = pow(v[j], 2);
        sum2 += w[j];
      }
      sum1 = pow(sum1 / n, 2);
      sum2 = sum2 / n;
       
      double s = pow(sum2 - sum1, 0.5);
      cout << fixed << setprecision(7);
      cout << s << endl;
    }
  }
}


Measured memory_bytes: 3400
#include<bits/stdc++.h>
using namespace std;
#define V vector
#define L long long
#define W V<L>
#define R(n) for(L i=0;i<n;i++)
W S(V<W>&p,L E){if(!E){return{1,0};}V<V<W>>T(2);for(W x:p){T[x[1]&1].push_back({x[0]/2,x[1]/2});if(x[0]&1){T[(x[1]+1)&1].push_back({x[0]/2,(x[1]+1)/2});}}R(2){L c=0;for(W x:T[!i]){L Q=(2*x[0]+x[1])%3;c^=Q+1;}if(!c){W A=S(T[i],E-1);A[0]*=2;A[1]*=2;A[1]+=i;return A;}}for(W&v:p){v[0]++;}W A=S(p,E);A[0]--;return A;}
int main(){L M=2e17,n;cin>>n;V<W>p(n);R(n){L a,b;cin>>a>>b;p[i]={a+M,b+M};}W Q=S(p,70);cout<<Q[0]-M<<" "<<Q[1]-M;}

Measured memory_bytes: 37052
/******************************************
*    AUTHOR:         julianferres         *
******************************************/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define forr(i, a, b) for(int i = (a); i < (int) (b); i++)
#define forn(i, n) forr(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(c) (c).begin(),(c).end()
#define DBG(x) cerr << #x << " = " << (x) << endl
#define esta(x,c) ((c).find(x) != (c).end())
#define RAYA cerr << "===============================" << endl
const int INF = 2000000000;
#define MOD 1000000007
#define MAXN 200005

int main(){
    FIN;

    ll n;
    cin >> n;
    vector<vi> dp(n + 1, vi(3,0));

    ll a, b, c;
    cin >> dp[0][0] >> dp[0][1] >> dp[0][2];
    forr(i,1,n){
        cin >> a >> b >> c;
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a;
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b;
        dp[i][2] = max(dp[i - 1][0], dp[i - 1][1]) + c;
    }
    cout << max(max(dp[n - 1][0], dp[n - 1][1]), dp[n - 1][2]) << endl;

    return 0;
}



Measured memory_bytes: 5760
#include <iostream>
#define R(i,n) for(int i=0;i<(n);i++)
#include<algorithm>
#include<vector>
using namespace std;

int main() {
    int n,ans=0;
    cin >> n;
    vector<int> vec(n);
    R(i,n) cin>>vec.at(i);
    R(i,n) {
        if (i %2==0 && vec.at(i)%2==1){
        ans++;
        }
    }
    cout<<ans<<endl;

    return 0;


}


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

using ll = long long;
using ld  = long double;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=9223372036854775807;
const ll MOD=1e9+7;
const ld PI=acos(-1);
const ld EPS = 1e-10; //微調整用（EPSより小さいと0と判定など）

int ii() { int x; if (scanf("%d", &x)==1) return x; else return 0; }
long long il() { long long x; if (scanf("%lld", &x)==1) return x; else return 0; }
string is() { string x; cin >> x; return x; }
char ic() { char x; cin >> x; return x; }
void oi(int x) { printf("%d ", x); }
void ol(long long x) { printf("%lld ", x); }
void od_nosp(double x) { printf("%.15f", x); } // 古い問題用
void od(double x) { printf("%.15f ", x); }
// long doubleで受け取り、fをLfなどに変えて出力すると、変な数値が出る
// それをなんとかするには独自の出力を作らなければならなそう
void os(const string &s) { printf("%s ", s.c_str()); }
void oc(const char &c) { printf("%c ", c); }
#define o_map(v){cerr << #v << endl; for(const auto& xxx: v){cout << xxx.first << " " << xxx.second << "\n";}} //動作未確認
void br() { putchar('\n'); }

// #define gcd __gcd //llは受け取らない C++17~のgcdと違うので注意
// int lcm(int a, int b){return a / gcd(a, b) * b;}
#define b_e(a) a.begin(),a.end() //sort(b_e(vec));
#define REP(i,m,n) for(ll i=(ll)(m) ; i < (ll)(n) ; i++ )
#define DREP(i,m,n) for(ll i=(ll)(m) ; i > (ll)(n) ; i-- )
#define rep(i,n) REP(i,0,n)
#define m_p(a,b) make_pair(a,b)
#define p_b push_back
#define SZ(x) ((ll)(x).size()) //size()がunsignedなのでエラー避けに
#define endk '\n'


// coutによるpairの出力（空白区切り）
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << " " << p.second << ")";}
// coutによるvectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << " "; //"\t"に変えるとTabで見やすく区切る
  }
  return s;
}
// coutによる多次元vectorの出力（空白区切り）
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i] << endl;
  }
  return s;
}

//最大値、最小値の更新。更新したor等しければtrueを返す
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

//4近傍（上下左右） rep(i, 2) にすると右・下だけに進む
vector<int> dx_4 = {1, 0, -1, 0};
vector<int> dy_4 = {0, 1, 0, -1};

// -------- template end - //


// - library ------------- //


// --------- library end - //



int main(){

  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  vector<ll> ans(4);

  ans[0] = a * c;
  ans[1] = a * d;
  ans[2] = b * c;
  ans[3] = b * d;

  ll anss = ans[0];
  rep(i, 3){
    chmax(anss, ans[i+1]);
  }

  cout << anss << endk;

}



Measured memory_bytes: 3628
/*
 * 高橋君は胃が強いので、賞味期限を X 日まで過ぎた食品を食べてもお腹を壊しません。 賞味期限を X+1 日以上過ぎた食品を食べると、お腹を壊します。
 * 
 * また、賞味期限を過ぎずに食べると、おいしく感じます。そうでない場合、おいしく感じません。
 * 
 * 高橋君は、賞味期限の A 日前に食品を買ってきて、買ってから B 日後に食べました。
 * 
 * 高橋君が食品をおいしく感じた場合 delicious を、おいしくは感じなかったがお腹は壊さなかった場合 safe を、お腹を壊した場合 dangerous を出力するプログラムを作成してください。
 */

import java.util.*;
	public class Main{
        public static void main(String[] args){
            Scanner sc = new Scanner(System.in);
            //入力
            int x = Integer.parseInt(sc.next());
            int a = Integer.parseInt(sc.next());
            int b = Integer.parseInt(sc.next());
            
            //出力
            if(a>=b){
            	System.out.println("delicious");
            }else if(a+x>=b){
            	System.out.println("safe");
            }else{
            	System.out.println("dangerous");
            }  
            sc.close();
        }
    }
	

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

#define forn(i,n) for (int i = 0; i < int(n); i++)
#define si(c) ((int)(c).size())

typedef pair<int,int> pii;

const int INF = 1.1e9;

pii inter(pii a, pii b) {
    return make_pair(max(a.first, b.first), min(a.second, b.second));
}

int len(pii x) { return max(0, x.second - x.first); }

vector<pii> cum(const vector<pii> &p) {
    int n = si(p);
    vector<pii> res(n+1);
    res[0] = make_pair(-INF,INF);
    forn(i,n) res[i+1] = inter(res[i], p[i]);
    return res;
}

int main() {
    int n; cin >> n;
    vector<pii> p(n);
    forn(i,n) {
        cin >> p[i].first >> p[i].second; 
        p[i].second++;
    }
    sort(p.begin(), p.end());

    auto pre = cum(p);
    reverse(p.begin(), p.end());
    auto suf = cum(p);
    reverse(p.begin(), p.end());

    int ans = 0;
    for (int a = 1, b = n-2; b > 0; a++, b--) {
        ans = max(ans, len(inter(pre[a], suf[b])) + len(p[a]));
    }
    for (int a = 1, b = n-1; b > 0; a++, b--) {
        ans = max(ans, len(pre[a]) + len(suf[b]));
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2560
package main

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

var sc *bufio.Scanner
var out *bufio.Writer

func main() {
	sc = bufio.NewScanner(os.Stdin)
	//bytes, _ := ioutil.ReadFile("./stdin.txt")
	//sc = bufio.NewScanner(strings.NewReader(string(bytes)))
	out = bufio.NewWriter(os.Stdout)
	buf := make([]byte, 1<<20)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush()

	a, b, q := nextInt(), nextInt(), nextInt()
	s, t, x := nextInts(a), nextInts(b), nextInts(q)

	for i := 0; i < q; i++ {
		std := near(s, t, x[i], 0)
		tsd := near(t, s, x[i], 0)

		fmt.Fprintln(out, intMin(std, tsd))
	}

}

func near(arr, sub []int, x, d int) int {
	i := sort.Search(len(arr), func(i int) bool { return arr[i] > x })
	if i == len(arr) {
		if sub == nil {
			return d + x - arr[i-1]
		}
		return d + near(sub, nil, arr[i-1], x-arr[i-1])
	}
	if i == 0 {
		if sub == nil {
			return d + arr[i] - x
		}
		return d + near(sub, nil, arr[i], arr[i]-x)
	}
	d1 := arr[i] - x
	d2 := x - arr[i-1]
	if sub == nil {
		return d + intMin(d1, d2)
	}
	return d + intMin(near(sub, nil, arr[i], d1), near(sub, nil, arr[i-1], d2))
}

func next() string {
	sc.Scan()
	return sc.Text()
}
func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}
func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func intMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}
func intMax(a, b int) int {
	if a > b {
		return a
	}
	return b
}


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

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

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7



//メイン関数
int main()
{
	int N;
	cin >> N;
	vector<ll> h(N);
	REP(i, N)cin >> h[i];

	vector<ll> dp(N, INFL);
	dp[0] = 0;
	REP(i, N - 1)
	{
		if(i + 1 < N)dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
		if(i + 2 < N)dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
	}
	cout << dp[N - 1] << endl;
	cin>>N;
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define INF (ll)(1e18)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }


template<typename T>
class SegTree {
    int n;
    T def;
    vector<T> data;
    function<T(T, T)> operation;
    function<T(T, T)> update;
    
    T _query(int a, int b, int k, int l, int r) {
        if (r <= a || l >= b) return def;
        if (a <= l && r <= b) return data[k];
        T c1 = _query(a, b, 2 * k + 1, l, (l + r) / 2);
        T c2 = _query(a, b, 2 * k + 2, (l + r) / 2, r);
        return operation(c1, c2);
    }
    
public:
    SegTree<T>(int _n, T _def, function<T(T, T)> _operation, function<T(T, T)> _update)
            : def(_def), operation(_operation), update(_update) {
                n = 1;
                while (n < _n) n *= 2;
                data = vector<T>(2 * n - 1, def);
            }
    
    void change(int i, T x) {
        i += n - 1;
        data[i] = update(data[i], x);
        while (i > 0) {
            i = (i - 1) / 2;
            data[i] = operation(data[i * 2 + 1], data[i * 2 + 2]);
        }
    }
    
    T query(int a, int b) {
        return _query(a, b, 0, 0, n);
    }
    
    T operator[](int i) { return data[i + n - 1]; }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    
    SegTree<int> sgt(n + 1, inf,
                     [](int a, int b) { return min(a, b); },
                     [](int a, int b) { return b; });
    sgt.change(n, 0);
    
    for (int i = n - 1; i >= 0; --i) {
        if (s[i] == '1') continue;
        int mi = sgt.query(i + 1, min(i + m + 1, n + 1));
        if (mi != inf) sgt.change(i, mi + 1);
    }
    // rep(i, n + 1) cout << sgt[i] << " "; cout << endl;
    
    if (sgt[0] == inf) { cout << -1 << endl; return 0; }
    
    vector<int> ans;
    ans.eb(0);
    int table[200005] = {0};
    table[sgt[0]] = 1;
    
    rep3(i, 1, n + 1) {
        if (sgt[i] != sgt[i - 1] && sgt[i] != inf && table[sgt[i]] == 0) {
            ans.eb(i);
            table[sgt[i]] = 1;
        }
    }
    
    // rep(i, sz(ans)) cout << ans[i] << " "; cout << endl;
    rep3(i, 1, sz(ans)) cout << ans[i] - ans[i - 1] << " "; cout << endl;
}


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

vector<pair<long long, long long> > prime_factorize(long long N) {
	vector<pair<long long, long long> > res;
	for (long long a = 2; a * a <= N; ++a) {
		if (N % a != 0) continue;
		long long ex = 0; // 指数

		// 割れる限り割り続ける
		while (N % a == 0) {
			++ex;
			N /= a;
		}

		// その結果を push
		res.push_back({ a, ex });
	}

	// 最後に残った数について
	if (N != 1) res.push_back({ N, 1 });
	return res;
}

int main() {
	long long N;
	cin >> N;
	const auto &res = prime_factorize(N);
	int64_t count = 0;
	for (auto p : res) {
		int64_t a = p.second,b=1;
		while (b <= a) {
			a -= b;
			b++;
			count++;
		}
		
		
	}
	cout << count;
	return 0;
}

Measured memory_bytes: 3632
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <map>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iostream>
#include <iterator>
#include <memory>

using namespace std;

#if 1
#define PRINT(x) { cout << #x << ": " << (x) << endl; }
#define PRINT_CONTAINER(x)  { cout << #x << ": ";                       \
        for (size_t ix = 0; ix < (x).size(); ++ix) cout << (x)[ix] << ", "; \
        cout << endl; }
#else
#define PRINT(x)
#define PRINT_CONTAINER(x)
#endif

typedef pair<int, int> p;

int n;
vector<int> a;
vector<int> b;

int main(int argc, char *argv[]) {
    scanf("%d", &n);
    int tmp;
    for (int i = 0; i < n; ++i) {
        scanf("%d", &tmp);
        a.push_back(tmp);
    }
    for (int i = 0; i < n; ++i) {
        scanf("%d", &tmp);
        b.push_back(tmp);
    }
    // int abmax = *max_element(a.begin(), a.end()) +
    //             *max_element(b.begin(), b.end());
    // int bitmax = abmax == 0 ? 0 : ceil(log(abmax) / log(2));
    vector<int> ai(n);
    vector<int> bi(n);
    int x = 0;
    for (int i = 0; i <= 29; ++i) {
        int q = 1 << i;
        int p = 1 << (i + 1);
        for (int j = 0; j < b.size(); ++j) {
            bi[j] = b[j] % p;
        }
        sort(bi.begin(), bi.end());
        for (int j = 0; j < a.size(); ++j) {
            int ai = a[j] % p;
            auto t1 = lower_bound(bi.begin(), bi.end(), q - ai);
            auto t2 = lower_bound(t1, bi.end(), 2 * q - ai);
            auto t3 = lower_bound(t2, bi.end(), 3 * q - ai);
            int num = distance(t1, t2) + distance(t3, bi.end());
            if (num % 2 == 1)
                x ^= q;
        }
    }
    printf("%d\n", x);
}


Measured memory_bytes: 3444
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
long long int i,j,k,n,ans=0;
void dfs(long long int x){
  if(x>n){
    return;
  }
  i=0,j=0,k=0;
  long long int a=x;
  while(a>0){
    if(a%10==3){
      i=1;
    }
    else if(a%10==5){
      j=1;
    }
    else{
      k=1;
    }
    a=a/10;
  }
  if(i==1 &&j==1 &&k==1){
    ans++;
  }
    dfs(x*10+3);
    dfs(x*10+5);
    dfs(x*10+7);
}
int main(){
  scanf("%lld\n",&n);
  dfs(3);
  dfs(5);
  dfs(7);
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 256
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const N = Number(input[0][0]);

  for (let i = 1; i <= 9; i++) {
    const x = i * 100 + i * 10 + i;

    if (N <= x) {
      return x;
    }
  }

  return 0;
};

console.log(main(read()));


Measured memory_bytes: 29568
#include <bits/stdc++.h>
#define rep(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define rrep(i, a, n) for (int i = (int)(a); i >= (int)(n); --i)
#define debug(x) cerr << #x << " = " << x << "\n"
#define debugv(x) \
  rep(f, 0, (x.size() - 1)) cerr << x[f] << (f == (x.size() - 1) ? "\n" : " ")
#define all(x) x.begin(), x.end()
#define int long long
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
const int MX = 1e5 + 5, INF = 5 << 28, MOD = 1e9 + 7;

int H, W;
vector<string> C;
void input() {
  int x, y, z;
  cin >> H >> W;
  C.resize(H);
  rep(i, 0, H - 1) { cin >> C[i]; }

}
void solve() {
  int md = 1;
  rep(i, 0, 2 * H - 1) { cout << C[i / 2] << endl; };
  ;
}
signed main() {
  input();
  solve();
  return 0;
}

Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
#define INF 1000000000
#define M_INF -1000000000
typedef long long int ll;

int main(){
    string S,T;
    cin>>S>>T;
    vector<int> s(26,-1),t(26,-1);
    
    for(int i=0;i<S.length();i++){
        int a=S[i]-'a',b=T[i]-'a';
        if(s[a]!=-1||t[b]!=-1){
            if(s[a]!=b || t[b]!=a){
                cout<<"No"<<endl;
                return 0;
            }
        }else{
            s[a]=b;
            t[b]=a;
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}
    

Measured memory_bytes: 776
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

#include <iostream>
#include <complex>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 60

int dp[SIZE][SIZE][SIZE][SIZE][2][2];
bool used[SIZE][SIZE][SIZE][SIZE][2][2];
int sum_a[2][SIZE], a[2][SIZE];

int dfs(int na, int nb, int au, int bu, int ad, int bd, int turn, int empty_passed){
  int res = -INF;

  if(used[au][bu][ad][bd][turn][empty_passed])
    return dp[au][bu][ad][bd][turn][empty_passed];
  
  if(au < na){
    if(a[turn][au] == -1)
      res = max(res, -dfs(nb, na, bu, au+1, bu, ad, 1-turn, 0));
    else
      res = max(res, -dfs(nb, na, bu, au+1, bd, ad, 1-turn, 0));
  }

  if(empty_passed){
    res = max(res, 0);
  }else{
    int add_score = (sum_a[turn][au] - sum_a[turn][ad]) - (sum_a[!turn][bu] - sum_a[!turn][bd]);
    res = max(res, -dfs(nb, na, bu, au, bu, au, 1-turn, au == ad && bu == bd) + add_score);
  }
  
  used[au][bu][ad][bd][turn][empty_passed] = true;
  return dp[au][bu][ad][bd][turn][empty_passed] = res;
}

int main(){
  int n[2];
  scanf("%d%d", n+0,n+1);
  for(int i=0;i<2;i++)
    for(int j=0;j<n[i];j++)
      scanf("%d", a[i]+j);

  for(int i=0;i<2;i++){
    for(int j=0;j<n[i];j++){
      sum_a[i][j+1] = sum_a[i][j] + max(0, a[i][j]);
    }
  }
  
  cout << dfs(n[0], n[1], 0,0,0,0,0,0) << endl;
  
  return 0;
}



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

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    ll a;
    std:vector<int> l;
    l.clear();
    REP(i,3){
        cin >> a;
        l.push_back(a);
    }
    sort(l.begin(), l.end());
    cout << l[0] << " " << l[1] << " " << l[2] << endl;
    return 0;
}


Measured memory_bytes: 3156
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<bitset>
#include<bits/stdc++.h>
#define ld long double
#define ll long long int
#define ull unsigned long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fin(ans) cout<<(ans)<<endl
#define INF INT_MAX
#define vi vector<int>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define vvc vector<vector<char> >
#define vvs vector<vector<string> >
#define P 1000000007
using namespace std;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const long long LLINF=1LL<<60;
//set<int>::iterator it;


int main(void){ios::sync_with_stdio(false);cin.tie(0);
//////////////////////////////////////////////////////
    
    int a,b,t;
    cin >> a >> b >> t;
    cout << t/a*b << endl; 
    
    
    
    
    
    
//////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

ll nCm(ll n, ll m){
    if(m == 0 || m == n){
        return 1;
    } else if(m == 1){
        return n;
    }
    return (nCm(n - 1, m) + nCm(n - 1, m - 1));
}

//-----------------------ここから-----------

int main(void){
    ld r, g;
    cin >> r >> g;

    cout << g + (g - r) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <deque>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    if (a > b) {
        swap(a, b);
    }
    for (int i = 0; i < b; ++i) {
        cout << a;
    }
    cout << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include <cmath>
#include <iomanip>
#include <ctype.h>
#include <numeric>

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi >;
using vl = vector<ll>;
using vvl = vector<vl >;
using pairi = pair<int, int>;
using pairl = pair<ll, ll>;

#define TR ","
#define TS " "
#define rep(i,N) for(ll i=0;i<(ll)N;++i)
#define rpt(i,a,b) for(ll i=a;i<(ll)b;++i)
#define all(v) v.begin(), v.end()
#define IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

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

ll lcm(ll x, ll y) {
    return x / gcd(x, y) * y;
}

ll waz = 76543217;

void printVector(const vector<int>& vec) {
    for (int value : vec) {
        cout << value << " ";
    }
    cout << endl;
}

int main()
{
    IO;

    ll k, n, m;
    set<ll> a;

    cin >> n;
    rep(i, n) {
        cin >> k;
        a.insert(k);
    }

    cin >> m;
    rep(i, m) {
        cin >> k;
        a.insert(k);
    }

    for (set<ll>::iterator it = a.begin(); it != a.end(); it++) {
        cout << *it << endl;
    }

}


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

int main()
{
	int r, g, b, n;
	cin >> r >> g >> b >> n;

	int cnt = 0;

	REP(i, 3001) {
		REP(j, 3001) {
			int num = n - (r*i + g*j);
			if (num % b == 0 && 0 <= num/b && num/b <= 3001)	cnt++;
		}
	}
	cout << cnt << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
using namespace std;
int main(){
    int N;
    string S;
    cin>>N>>S;

    int ans=1;
    for(int i=0;i<S.size()-1;i++){
        if(S[i]==S[i+1]){

        }else{
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
int main() {
	llong ans = 0;
	llong num;
	cin >> num;
	FOR(i,1, sqrt(num)) {
		if (num % i == 0) {
			if (num / i - i > 1) {
				ans += num / i - 1;
			}
		}
	}
	cout <<ans<< endl;
	return 0;
}

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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;


int main(){
  int H, W, M;
  cin >> H >> W >> M;
  
  
  
  vector<int> Hi(H, 0);
  vector<int> Wi(W, 0);
  set<pair<int,int>> bom;
  for(int i = 0; i<M; i++){
    int h,w;
    cin >> h >> w;
    Hi[h-1]++;
    Wi[w-1]++;
    bom.insert(make_pair(h-1,w-1));
  }
  
  
  int max_h = 0;
  int max_w = 0;
  
  for(int i = 0; i<H; i++){
    max_h = max(max_h, Hi[i]);
  }
  for(int i = 0; i<W; i++){
    max_w = max(max_w, Wi[i]);
  }
  
  
  
  vector<int> X(0);
  vector<int> Y(0);
  
  for(int i = 0; i<H; i++){
    if(Hi[i] == max_h){
      X.push_back(i);
    }
  }
  for(int i = 0; i<W; i++){
    if(Wi[i] == max_w){
      Y.push_back(i);
    }
  }
  
  
  
    for(auto p: X){
      for(auto q: Y){
        if(bom.find(make_pair(p,q))==bom.end()){
          cout << max_h+max_w << endl;
          return 0;
        }
      }
    }
  
  cout << max_h+max_w-1 << endl;
  return 0;
}

      
      
       





Measured memory_bytes: 23804
#if loc||local
#define _GLIBCXX_DEBUG
#endif

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

#define rep(i,n) for(ll i=0;i<ll(n);++i)
#define repr(i,n) for(ll i=ll(n);i-->0;)
using ll = int_fast64_t;
using pll = pair<ll,ll>;
constexpr ll INF = 1LL<<60;
constexpr ll MOD = 1e9+7;
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(a>b){a=b;return 1;}return 0;}
#if loc||local
template<class T>void dump(T&& t){cerr<<t<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
void dump(){}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
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> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T,class U> ostream &operator<<(ostream& os,pair<T,U>const& p){os<<p.first<<","<<p.second;return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}

signed main(){

  string s;
  cin>>s;
  if(s.back()=='s')s+="es";
  else s+="s";
  cout<<(s)<<endl;

}

Measured memory_bytes: 3624
/* monkukui 競技プログラミング用のテンプレート  (ここから) */
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using graph = vector<vector<int>>;
using wgraph = vector<vector<pair<int, long long int>>>;
long long int INF = 1001001001001001LL;
int inf = 100100100;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;
long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define srep(i,s,t) for(int i = s; i < t; i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back

/* monkukui 競技プログラミング用のテンプレート (ここまで)*/

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

  vector<vector<lint>> dp(m + 1, vector<lint> ((1 << n), INF));
  dp[0][0] = 0;

  for(lint i = 0; i < m; i++) {
    lint a, b; cin >> a >> b;
    lint mask = 0;
    for(lint j = 0; j < b; j++){
      lint c; cin >> c;
      c--;
      mask = mask | (1 << c);
    }

    for(lint bit = 0; bit < (1 << n); bit++) {
      if(dp[i][bit] == INF) continue;
      lint nxtBit = bit | mask;
      dp[i + 1][nxtBit] = min(dp[i + 1][nxtBit], dp[i][bit] + a);
      dp[i + 1][bit] = min(dp[i + 1][bit], dp[i][bit]);
    }
  }

  lint ans = INF;
  for(lint i = 0; i <= m; i++) ans = min(ans, dp[i][(1 << n) - 1]);

  if(ans == INF) ans = -1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 32384
#include <bits/stdc++.h> 
#define REP(i, b) for(int i = 0; i < (b); i++)
#define REPS(i, b) for(int i = 1; i <= (b); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vs = vector<string>;
using vb = vector<bool>;
using vp = vector<P>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvb = vector<vb>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll  INFL = 1e18;


signed main()
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int A[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    int K; cin >> K;
    cout << A[K-1] << endl;
}

Measured memory_bytes: 256
#include<map>
#include<list>
#include<cmath>
#include<stack>
#include<queue>
#include<vector>
#include<cstring>
#include<iostream>
#include<functional>
#include<algorithm>
using namespace std;
#define LOOP1(n) for(int i=0;i<n;i++)
#define LOOP2(n) for(int j=0;j<n;j++)
#define LOOP3(n) for(int k=0;k<n;k++)
#define Psi pair<string,int>
#define Pis pair<int,string>
#define Pii pair<int,int>
// ??????????????????memset(a,0,sizeof(a));
// ?´???°?????? if(x<2)return0;else if(x==2)return1;if(x%2==0)return0;for(i=3;i*i<=x;i+=2){if(x%i==0)return0;}return1;}p440
//vector size();push_back(x);pop_back();begin();end();insert(p,x);erase(p);clear();
//stack  size();top();pop();push(x);emtpy();
//queue  size();front();pop();push(x);empty();
//priority_queue< ??? , ??\???????????? , less<???> or greater<???> > <int , vector<int> , greater<int> >
static const int MAX = 100;
static const long long  INFTY = (1LL << 32);
int main(){
	int V, E; int s, t;
	long long int G[MAX][MAX];
	cin >> V >> E;
	LOOP1(V){
		LOOP2(V){
			if (i == j) G[i][j] = 0;
			else G[i][j] = INFTY;
		}
	}
	LOOP1(E){
		cin >> s >> t;
		cin >> G[s][t];
	}
	LOOP3(V){
		LOOP1(V){
			if (G[i][k] == INFTY) continue;
			LOOP2(V){
				if (G[k][j] == INFTY) continue;
				G[i][j] = min(G[i][j], G[i][k] + G[k][j]);
			}
		}
	}bool flag = false;
	LOOP1(V) if (G[i][i] < 0) flag = true;
	if (flag) cout << "NEGATIVE CYCLE" << endl;
	else {
		LOOP1(V){
			LOOP2(V){
				if (G[i][j] == INFTY) cout << "INF";
				else cout << G[i][j];
				if (j != V - 1) cout << " ";
			}cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1244
S = input()
K = int(input())
ans = 0

# 先頭と後頭が一致していた場合の例外処理
Sfront = S[0]
Srear  = S[-1]
if Sfront == Srear and K > 1:
    Sleft = S.lstrip(Srear)
    kazu_left = len(S) - len(Sleft)
    ans += int(kazu_left/2)
#     print(ans)
    
    Sleftright = Sleft.rstrip(Srear)
    kazu_right = len(Sleft) - len(Sleftright)
    if kazu_right != 0: # 通常
        ans += int(kazu_right/2)

        kazu_wa = len(S) - len(Sleftright)
        ans += int(kazu_wa/2) * (K-1)

        S = Sleftright
         
    else: # 全部同じ文字の例外
        ans = int(kazu_left * K / 2)
        
        S = ""
else:
    pass

while len(S) > 0:
#     print(S)
    current = S[0]
    Snext = S.lstrip(current)
    kazu = len(S) - len(Snext)
    ans += int(kazu/2) * K
    S = Snext
print(ans)

Measured memory_bytes: 3064
#include <cstdio>
#include <cmath>
#define LOOP(index,times) for(int index=0;index<times;index++)
using namespace std;

int main(){

int n;
float x[3],y[3],detA,a,b,px,py,r;

scanf("%d",&n);

LOOP(i,n){
	scanf("%f %f %f %f %f %f",&x[0],&y[0],&x[1],&y[1],&x[2],&y[2]);

	detA=(x[0]-x[1])*(y[1]-y[2])-(x[1]-x[2])*(y[0]-y[1]);
	a=x[0]*x[0]-x[1]*x[1]+y[0]*y[0]-y[1]*y[1];
	b=x[1]*x[1]-x[2]*x[2]+y[1]*y[1]-y[2]*y[2];
	
	px=0.5/detA*((y[1]-y[2])*a-(y[0]-y[1])*b);
	py=0.5/detA*(-(x[1]-x[2])*a+(x[0]-x[1])*b);
	r=sqrt((px-x[0])*(px-x[0])+(py-y[0])*(py-y[0]));

	printf("%.3f %.3f %.3f\n",px,py,r);
}
return 0;		
}

Measured memory_bytes: 1088
/* 
	Author: ankrypt
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int
#define ff first
#define ss second
#define all(x) x.begin(), x.end() 
#define ub upper_bound
#define lb lower_bound
#define MAX_INT 100005
#define fi(a, b, c, d) for(int a = b; i < c; i += d)
#define fl(a, b, c, d) for(ll a = b; i < c; i += d)
#define quit exit(0)

ll N, M, A, B, C;
ll arr[MAX_INT], arr1[MAX_INT], data[MAX_INT];
std::vector<pair<ll, ll>> V;
map<pair<ll, ll>,pair<ll, ll>> mp;

int main() {
	scanf("%lld %lld", &N, &M);
	for(int i = 0; i < N; i++) {
		scanf("%lld %lld", &arr[i], &arr1[i]);
		V.push_back({arr[i], arr1[i]});
	}
	sort(all(V));
	ll cnt = 0;
	mp[{V[0].first, cnt++}] = {1, V[0].second};
	for(int i = 1; i < V.size(); i++) {
		mp[{V[i].first, cnt++}] = {mp[{V[i - 1].first, cnt - 1}].second + 1, mp[{V[i - 1].first, cnt - 1}].second + V[i].second};
		// cout << mp[{V[i].ff, cnt - 1}].ff << " " << mp[{V[i].ff, cnt - 1}].ss << " \n";
	}
	for(auto x: mp) {
		if(M >= x.ss.ff && M <= x.ss.ss) {
			printf("%lld\n", x.ff.ff);
			break;
		}
	}
	return 0;
}
/*
	Powered by Buggy Plugin
*/




Measured memory_bytes: 11248
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
#define nl "\n"
#define sz(a) (int)(a).size()
#define all(a) (a).begin(),(a).end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;
#define mt make_tuple
#define vec vector

#define int long long

const int mod = (int) 1e9 + 7 ;
const int MOD = (int) 998244353 ;
const int INF = (int) 1e18 ;

typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve() {
	
	int n; cin >> n ;
	vii a,b; 
	rep(i,0,n) {
		int x,y; cin >> x >> y;
		a.eb(x+y) ;
		b.eb(x-y) ;
	}

	sort(all(a)); sort(all(b)) ;

	cout << max(abs(a[n-1]-a[0]),abs(b[n-1]-b[0]));
}

int32_t main() {

#ifdef LOCAL
    freopen("error.txt", "w", stderr);
#endif

    fast;

	// int t; cin >> t; while(t--)
		solve() ;

	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}


Measured memory_bytes: 6676
#include<iostream>
#include<cstring>
using namespace std;
string a;
int ans=0;
int main()
{
	int n;	cin>>n;
	cin>>a;
	for(int i=1;i<n;i++)
	{
		int x=0;
		for(int j=0;j+i<n;j++)
			if(a[j]==a[i+j])
				ans=max(ans , min(++x , i));
			else
				x=0;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
inline void check_max(int a,int &b){if(a>b)b=a;}
namespace dper
{
	const int N=501000,INF=100000000;
	int t[N];
	char s[N];
	int n,ans;
	void initialize()
	{
		scanf("%d",&n);
		scanf("%s",s+1);
		for(int i=1;i<=n;i++)
			t[i]=s[i]-'0';
	}
	int f[N],g[N][4];
	int tot;
	void work()
	{
		ans=0;
		for(int x=1,y;x<=n;x=y+1)
		{
			if(!t[x]){y=x;continue;}
			tot=0;
			int k;
			y=x;
			while(t[y] && y<=n)
			{
				for(k=y;t[k+1] && k<n;k++);
				f[++tot]=k-y+1;
				y=k+2;
			}
			if(tot==1)continue;

//			printf("tot = %d\n",tot);
//			for(int i=1;i<=tot;i++)printf("%d ",f[i]);
//			printf("\n");

			for(int i=1;i<=tot;i++)
				for(int j=0;j<4;j++)
					g[i][j]=-INF;

			g[1][1]=0;

			for(int i=1;i<tot;i++)
			{
				int v0=g[i][0],v1=g[i][1],v2=g[i][2],v3=g[i][3];

				check_max(v0,g[i+1][1]);
				check_max(v1,g[i+1][1]);
				check_max(v2,g[i+1][1]);
				check_max(v3,g[i+1][1]);

				check_max(v1+f[i],g[i+1][2]);
				check_max(v1+f[i+1],g[i+1][0]);
				check_max(v1+f[i+1]-1,g[i+1][3]);

				if(f[i]>1)
				{
					check_max(v2+f[i]-1,g[i+1][2]);
					check_max(v2+f[i+1],g[i+1][0]);
					check_max(v2+f[i+1]-1,g[i+1][3]);
				}

				check_max(v3+1,g[i+1][2]);
				check_max(v3+f[i+1],g[i+1][0]);
				check_max(v3+f[i+1]-1,g[i+1][3]);
			}

			int tmp=0;for(int i=0;i<4;i++)check_max(g[tot][i],tmp);

			ans+=tmp;
		}
	}
	void solve()
	{
		initialize();
		work();
		printf("%d\n",ans);
	}
}
int main()
{
//	freopen("D.in","r",stdin);
//	freopen("D.out","w",stdout);
	dper::solve();
	return 0;
}


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

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

    int count = 0;

    for(int i = 0; i < n; i++) {
        if(h[i] >= k) {
            count++;
        }
    }

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


Measured memory_bytes: 640
#include<iostream>

using namespace std;

int main(){
    int K,S;
    cin>>K>>S;

    long ans=0;

    for(int i=0;i<=K;++i){
        for(int k=0;k<=K;++k){
            int z=S-k-i;
            if(z>=0&&z<=K){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def solve():
    INF = float('inf')

    def min2(x, y): return x if x <= y else y

    H, N = map(int, input().split())
    items = [tuple(map(int, input().split())) for _ in range(N)]

    items.sort()

    dp = [INF] * (H+1)
    dp[0] = 0
    for vi, wi in items:
        for j in range(H-vi+1):
            dp[j+vi] = min2(dp[j+vi], dp[j]+wi)
        for j in range(max(0, H-vi+1), H+1):
            dp[H] = min2(dp[H], dp[j]+wi)
#        print(dp)

    print(dp[H])


solve()


Measured memory_bytes: 9504
#include <stdio.h>
#include <vector> 
#include <algorithm>
#include <functional>
#include <iostream>
#include <set> 
#include <unordered_map>
#include <queue>
void lookvec(std::vector<int> v);
void dim2vec(std::vector<std::vector<int> > G);
void lookset(std::set<int> s);
void lookset(std::set<std::pair<int,int>> s);
void sortvec(std::vector<int> &v);
void reversevec(std::vector<int> &v);
bool test(long long mini);

using namespace std;
class statusNode{
public:
	int now;
	set<int> visitedNode;
};

//隣接行列
int G[9][9];


int main(){

	for (int i = 0; i < 9; i++){
		for (int j = 0; j < 9; j++){
			G[i][j] = 0;
		}
	}

	int N, M,ans=0;
	queue<statusNode> q;
	cin >> N >> M;
	for (int i = 0; i < M; i++){
		int a, b;
		cin >> a >> b;
		G[a][b] = 1;
		G[b][a] = 1;
	}
	statusNode first;
	first.now = 1;
	q.push(first);
	while (q.size() != 0){
		statusNode nowNode = q.front();
		q.pop();
		if (nowNode.visitedNode.size() == N - 1){
			ans += 1;
			continue;
		}
		for (int i = 1; i < N+1;i++){
			if (G[nowNode.now][i] == 1 && nowNode.visitedNode.find(i)==nowNode.visitedNode.end()){
				//繋がっていて、そのパスでまだ未達だったら
				statusNode newnode = nowNode;
				newnode.visitedNode.insert(nowNode.now);
				newnode.now = i;
				q.push(newnode);

			}
		}
	}
	cout << ans << "\n";




	return 0;
}


//vectorの中身をみる関数
void lookvec(std::vector<int> v){
	printf("{");
	{for (int i = 0; i<v.size(); i++) printf("%d,", v[i]); }
	printf("}\n");
}
//二次元vectorの中身をみる関数
void dim2vec(std::vector<std::vector<int> > G){
	int i, j;
	for (i = 0; i < G.size(); i++){
		printf("{");
		for (j = 0; j < G[i].size(); j++){
			printf("%d",G[i][j]);
			if (j != G[i].size() - 1) printf(",");
		}
		printf("}\n");
	}
}

//setの中身を見る関数
void lookset(std::set<int> s){
	std::set< int >::iterator pos = s.begin();//先頭の要素を取得する
	while (pos != s.end()){//最後の要素に達するまでループ
		printf("%d,", *pos);//値を表示

		pos++;//一つ進める
	}
	printf("\n");
}

//setの中身を見る関数
void lookset(std::set<pair<int,int>> s){
	std::set< pair<int,int> >::iterator pos = s.begin();//先頭の要素を取得する
	while (pos != s.end()){//最後の要素に達するまでループ
		printf("<%d, %d>\n", pos->first,pos->second);//値を表示

		pos++;//一つ進める
	}
	printf("\n");
}
void sortvec(std::vector<int> &v){
	std::sort(v.begin(), v.end());
}
void reversevec(std::vector<int> &v){
	std::sort(v.begin(), v.end(), std::greater<int>());//降順ソート
}

Measured memory_bytes: 2048