akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

template <typename T>
class SegTree {
 private:
    int _n;
    T _init_val;
    std::vector<T> _data;
    std::function<T(T, T)> _f;

    T _query(int a, int b, int k, int l, int r) {
        // [a b)と[l r]が交差しない
        if (r <= a || b <= l) return _init_val;

        // [a b)が[l r]を含む
        if (a <= l && r <= b) return _data[k];

        T vl = _query(a, b, k*2+1, l, (l+r)/2);
        T vr = _query(a, b, k*2+2, (l+r)/2, r);

        return _f(vl, vr);
    }

 public:
    SegTree(int n, T init_val, std::function<T(T, T)> f) {
        _init_val = init_val;
        _n = 1;
        _f = f;

        while (_n < n)
            _n *= 2;
        _data.resize(2 * _n, init_val);
    }

    T get(int k) {
        return _data[k + _n - 1];
    }

    void update(int k, T a) {
        k += _n-1;
        _data[k] = a;
        while (k > 0) {
            k = (k-1)/2;
            _data[k] = _f(_data[k*2+1], _data[k*2+2]);
        }
    }

    // [a b)の範囲でfを適用
    T query(int a, int b) {
        return _query(a, b, 0, 0, _n);
    }

    // 先頭からチェックし，はじめてxを満たしたインデックス
    int lower_bound(T x) {
        return _lower_bound(x, 0);
    }

    int _lower_bound(T x, int k) {
        if (k >= _n-1) {
            return k - (_n - 1);  // 葉
        } else if (_data[k] < x) {
            return _n;  // 該当なし
        } else if (x <= _data[k * 2 + 1]) {
            return _lower_bound(x, k * 2 + 1);
        } else {
            return _lower_bound(x - _data[k * 2 + 1] , k * 2 + 2);
        }
    }
};

ll N, offset=100000;
vector<ll> a;

ll f(ll x, ll y){
    return x+y;
}

// 中央値がx以上の部分列が (N(N+1)/2 + 1)/2 個以上あればTrue
bool check(ll x) {
    SegTree<ll> sg(N+offset, 0, f); // sg.query(0, t+1): t以下の出現数
    ll s = 0,  t = 0;
    sg.update(offset, 1);
    rep(r,0,N){
        if (x <= a[r])
            t++;
        else
            t--;
        s += sg.query(0, offset+t+1);
        // cout<<"r="<<r<<",t="<<t<<",que="<<sg.query(0, offset+t+1)<<endl;
        sg.update(offset+t, sg.get(offset+t)+1);
    }
    // cout<<"s="<<s<<endl;
    return s >= (N*(N+1)/2+1)/2;
}

signed main() {
    cin >> N;
    a.resize(N);
    rep(i,0,N){
        cin>>a[i];
    }
    ll ok = 0, ng = 1ll << 62;
    // ll ok = 0, ng = 60;
    while (ok + 1 < ng) {
        ll m = (ok+ng)/2;
        // cout<<"ok="<<ok<<",ng="<<ng<<",m="<<m<<endl;
        bool c = check(m);
        // cout<<"c="<<c<<endl;
        if (c)
            ok = m;
        else
            ng = m;
    }
    cout<<ok<<endl;
    return 0;
}


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

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using pll = pair<ll,ll>;

#define INF (1LL << 60)
#define MOD 1000000007
#define PI 3.14159265358979323846

#define REP(i,m,n) for(ll (i)=(m),(i_len)=(n);(i)<(i_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define PR(x) cout << (x) << endl
#define PS(x) cout << (x) << " "
#define SZ(x) ((ll)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define REV(x) reverse(ALL((x)))
#define ASC(x) sort(ALL((x)))
#define DESC(x) ASC((x)); REV((x))
#define pb push_back
#define eb emplace_back

int main()
{
    string S;
    cin >> S;
    vec A(26, 0);
    REP(i,0,SZ(S)) ++A[S[i]-'a']; 
    bool f = true;
    REP(i,0,26) if(A[i] > 1) f = false;
    if(f) PR("yes");
    else PR("no");


    return 0;
}

/*



*/

Measured memory_bytes: 3580
package main

import "fmt"

func main() {
	var n int
	fmt.Scanf("%d", &n)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scanf("%d", &a[i])
	}

	fmt.Println(solve(n, a))
}

func solve(n int, a []int) int {
	sum := 0
	max := a[0]

	for i := 0; i < n; i++ {
		max = maxInt(max, a[i])
		sum += (max - a[i])
	}

	return sum
}

func maxInt(a, b int) int {
	if a >= b {
		return a
	}

	return b
}


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

using namespace std;

int A,B;
int a[5001];
int b[5001];
int dp[2][5001];

int main(){
    cin>>A>>B;
    for(int i=0;i<A;i++)cin>>a[i];
    for(int i=0;i<B;i++)cin>>b[i];
    int ret=0;
    for(int pos=A;pos>=0;pos--){
        int prv=(pos+1)%2;
        int cur=pos%2;
        for(int j=B;j>=0;j--){
            int res=0;
            if(pos==A||j==B)res=0;
            else{
                if(a[pos]==b[j])res=max(res,dp[prv][j+1]+1);
                res=max(res,dp[prv][j]);
            }
            dp[cur][j]=res;
            ret=max(ret,res);
        }
    }
    cout<<ret<<endl;
    return 0;
}

Measured memory_bytes: 904
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <cmath>
#include <map>
#include <tuple>
#include <queue>
#include <stack>
#include <iomanip>

#define MOD (1000000007)
using namespace std;
typedef long long ll;

// a^n mod を計算する
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

const int MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];

ll modinv(ll a, ll mod) {
    ll b = mod, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= mod;
    if (u < 0) u += mod;
    return u;
}

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

// 負の数にも対応した % 演算
ll mod(ll val, ll m) {
  ll res = val % m;
  if (res < 0) res += m;
  return res;
}
int main() {

    COMinit();
    
    ll n, a, b;
    cin >> n >> a >> b;

    ll minv = min(a, n-a);
    ll maxv = max(a, n-a);

    ll com_n_a = 1;
    for(ll copy = n; copy > maxv; copy--) {
        com_n_a *= copy % MOD;
        com_n_a %= MOD;
    }
    for(ll copy = 1; copy <= minv; copy++) {
        com_n_a *= inv[copy] % MOD;
        com_n_a %= MOD;
    }

    
    minv = min(b, n-b);
    maxv = max(b, n-b);

    ll com_n_b = 1;
    for(ll copy = n; copy > maxv; copy--) {
        com_n_b *= copy % MOD;
        com_n_b %= MOD;
    }
    for(ll copy = 1; copy <= minv; copy++) {
        com_n_b *= inv[copy] % MOD;
        com_n_b %= MOD;
    }

    //cout << modpow(2, n, MOD) <<","<<com_n_a<<","<<com_n_b  << endl;
    cout << mod(modpow(2, n, MOD) - com_n_a - com_n_b - 1, MOD) << endl;




    return 0;
}


Measured memory_bytes: 12160
/* {{{ */
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
/* }}} */

fn main() {
    input! {
        h: usize,
        w: usize,
        ss: [chars;h]
    }
    let mut tt = vec![vec![0;w];h];
    for i in 0..h {
        let mut l = 0;
        let mut r = 0;
        for j in 0..w {
            if ss[i][j] == '#' {
                l = 0;
            } else {
                l += 1;
                tt[i][j] += l;
            }
            let rj = w-j-1;
            if ss[i][rj] == '#' {
                r = 0;
            } else {
                r += 1;
                tt[i][rj] += r;
            }
        }
    }
    for j in 0..w {
        let mut l = 0;
        let mut r = 0;
        for i in 0..h {
            if ss[i][j] == '#' {
                l = 0;
            } else {
                l += 1;
                tt[i][j] += l;
            }
            let ri = h-i-1;
            if ss[ri][j] == '#' {
                r = 0;
            } else {
                r += 1;
                tt[ri][j] += r;
            }
        }
    }
    let mut max = 0;
    for l in tt {
        for c in l {
            max = std::cmp::max(max, c);
        }
    }
    println!("{}", max - 3);
}
/* vim:set foldmethod=marker: */


Measured memory_bytes: 41208
#include <iostream>
#include <ctime>
#include <cstdlib>

using namespace std;
const int NMAX = 10000;

void print(int* A, int N)
{
   cout << A[0]; 
   for (int k = 1; k < N;k++) {
     cout << " " << A[k] ; 
   }
   cout << endl;
}

int GCD(int x, int y)
{
  if (y == 0) {
    return x;
  } else {
    return GCD(y, x%y);
  }
}


int main()
{
  int x,y;
  cin >> x >> y;
  if (x < y) {
    int tmp;
     tmp = y;
    y = x;
    x = tmp;
  }
  cout << GCD(x,y) << endl;
  return 0;
}

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

#define scanI(n) scanf("%d", &n)
#define scanL(n) scanf("%ld", &n)
#define scanLL(n) scan("%lld", &n)
#define scanII(a, b) scanf("%d %d", &a, &b)
#define scanIII(a, b, c) scanf("%d %d %d", &a, &b, &c);
#define printI(n) printf("%d", n)
#define printII(a,b) printf("%d %d", a, b)
#define PRINT(list) for(auto i : list) printf("%d ", i); printf("\n");
#define PRINTARR(ar_, n_) for(int i_=0; i_<n_; i_++){printf("%d ", ar_[i_]);} printf("\n");
#define DPRINT(dlist) for(auto list : dlist) { PRsINT(list); printf("\n"); }
#define INIT(ar, n, val) for(int _i=0; _i<n; _i++) ar[_i] = val;
#define ALL(x) x.begin(), x.end()
#define VI vector<int>
#define LL long long
#define MOD 1000000007
#define PI 3.142857


using namespace std;

void test(){
}

int main(){
    int n,a;
    scanII(n,a);
    printf("%d", n*n-a  );
    return 0;
}


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

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

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

  ll N, C, K;
  cin >> N >> C >> K;
  vector<ll> T(N);
  REP(i, N) { cin >> T.at(i); }
  sort(T.begin(), T.end());
  vector<ll> T2(N - 1);
  REP(i, N - 1) { T2.at(i) = T.at(i + 1) - T.at(i); }

  ll ans = 0;
  ll base = T.at(0);
  ll limit = base + K;
  ll current = base;
  ll count = 1;
  REP(i, N - 1) {
    current += T2.at(i);
    // cout << base << ":" << limit << ":" << current << ":" << count << ":" <<
    // ans
    //  << endl;

    if (count == C || current > limit) {
      base = current;
      limit = base + K;
      ans += (count + C - 1) / C;
      count = 1;
    } else {
      ++count;
    }
  }

  // cout << base << ":" << limit << ":" << current << ":" << count << ":" <<
  // ans
  //  << endl;

  ans += (count + C - 1) / C;

  cout << ans << endl;

  return 0;
}


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

struct SqrtDecomposition {
    const ll sqrtN = 512;
    ll N, K;
    vector<ll> data;
    vector<ll> bucketSum, bucketAdd;
    vector<bool> lazyFlag;
    vector<ll> lazyUpdate;
    SqrtDecomposition(ll n, ll x = 0LL) : N(n) {
        K = (N + sqrtN - 1) / sqrtN;
        data.assign(K * sqrtN, x);
        bucketSum.assign(K, x*sqrtN);
        bucketAdd.assign(K, 0ll);
        lazyFlag.assign(K, false);
        lazyUpdate.assign(K, x);
    }
    void eval(ll k) {
        if (lazyFlag[k]) {
            lazyFlag[k] = false;
            for (ll i = k * sqrtN; i < (k + 1) * sqrtN; ++i) {
                data[i] = lazyUpdate[k];
            }
        }
    }
    // [s, t)
    void add(ll s, ll t, ll x) {
        for (ll k = 0; k < K; ++k) {
            ll l = k * sqrtN, r = (k + 1) * sqrtN;
            if (r <= s || t <= l) continue;
            if (s <= l && r <= t) {
                bucketAdd[k] += x;
            } else {
                for (ll i = max(s, l); i < min(t, r); ++i) {
                    data[i] += x;
                    bucketSum[k] += x;
                }
            }
        }
    }
    // [s, t)
    void update(ll s, ll t, ll x) {
        for (ll k = 0; k < K; ++k) {
            ll l = k * sqrtN, r = (k + 1) * sqrtN;
            if (r <= s || t <= l) continue;
            if (s <= l && r <= t) {
                bucketSum[k] = x * sqrtN;
                bucketAdd[k] = 0ll;
                lazyFlag[k] = true;
                lazyUpdate[k] = x;
            } else {
                eval(k);
                for (ll i = l; i < r; ++i) {
                    data[i] = data[i] + bucketAdd[k];
                }
                bucketAdd[k] = 0;
                for (ll i = max(s, l); i < min(t, r); ++i) {
                    data[i] = x;
                }
                ll &sumVal = bucketSum[k] = 0ll;
                for (ll i = l; i < r; ++i) {
                    sumVal = sumVal + data[i];
                }
            }
        }
    }
    // [s, t)
    ll getSum(ll s, ll t) {
        ll sumVal = 0;
        for (ll k = 0; k < K; ++k) {
            ll l = k * sqrtN, r = (k + 1) * sqrtN;
            if (r <= s || t <= l) continue;
            if (s <= l && r <= t) {
                sumVal = sumVal + bucketSum[k] + bucketAdd[k] * sqrtN;
            } else {
                eval(k);
                for (ll i = max(s, l); i < min(t, r); ++i) {
                    sumVal = sumVal + data[i] + bucketAdd[k];
                }
            }
        }
        return sumVal;
    }
};

int main() {
    int n, q;
    cin >> n >> q;
    SqrtDecomposition ruq(n, (1LL<<31)-1);
    for(int i=0; i<q; i++){
        int c;
        cin >> c;
        if(c){
            int k;
            cin >> k;
            cout << ruq.getSum(k,k+1) << endl;
        }
        else{
            int s, t, x;
            cin >> s >> t >> x;
            ruq.update(s,t+1,x);
        }
    }
    return 0;
}


Measured memory_bytes: 3600
#include <iostream>
#include <vector>
#include <numeric>

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) cin >> a.at(i);
    int q;
    cin >> q;
    vector<int> m(q);
    for (int i = 0; i < q; ++i) cin >> m.at(i);
    vector<bool> res(q, false);
    for (int bit = 0; bit < (1<<n); ++bit) {
        vector<int> S;
        for (int i = 0; i < n; ++i) {
            if (bit & (1<<i)) S.push_back(a.at(i));
        }
        int sum = accumulate(S.begin(), S.end(), 0);
        for (size_t i = 0; i < m.size(); ++i) {
            if (sum == m.at(i)) res.at(i) = true;
        }
    } 
    for (size_t i = 0; i < res.size(); ++i) 
        if (res.at(i)) cout << "yes" << endl;
        else cout << "no" << endl;
    return 0;
}


Measured memory_bytes: 3132
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc= new Scanner(System.in);
        int S = sc.nextInt();
      	int W = sc.nextInt();
        boolean isSafe = S > W;
      String ans = "unsafe";  
      if (isSafe) ans = "safe";
      	System.out.println(ans);
    } 
}

Measured memory_bytes: 35844
/*{{{*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<iostream>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include<bitset>
#include<vector>
#include<limits.h>
#include<assert.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(LL &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const LL &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
int x[SIZE],y[SIZE];
int main(){
    int n; R(n);
    REP(i,n){
        R(x[i],y[i]);
    }
    int an=0;
    map<PII,int>AA;
    REP(i,n)REP(j,n){
        if(i==j)continue;
        int v1=y[i]-y[j],v2=x[j]-x[i];
        AA[{v1,v2}]++;
        an=max(an,AA[{v1,v2}]);
    }
    W(n-an);
    return 0;
}


Measured memory_bytes: 2432
<?php
fscanf(STDIN, "%d %d %d", $n, $a, $b);
$x = 0;
for ($p = 1; $p <= $n; $p++) {
	$s = 0;
	$p = "$p";
	for ($i = 0; $i < strlen($p); $i++) {
		$s += $p[$i];
		if ($s > $b) continue 2;
	}
	if ($s >= $a) $x += $p;
}
echo $x;

Measured memory_bytes: 4728
/**
 *    author:  tourist
 *    created: 14.06.2020 20:28:25       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int h, w, k;
  cin >> h >> w >> k;
  vector<string> s(h);
  for (int i = 0; i < h; i++) {
    cin >> s[i];
  }
  int ans = (int) 1e9;
  for (int t = 0; t < (1 << (h - 1)); t++) {
    vector<int> sum(h);
    int cuts = __builtin_popcount(t);
    int idle = 0;
    for (int j = 0; j < w; j++) {
      int ptr = 0;
      for (int i = 0; i < h; i++) {
        sum[ptr] += (int) (s[i][j] - '0');
        if (t & (1 << i)) {
          ptr = i + 1;
        }
      }
      bool bad = false;
      for (int i = 0; i < h; i++) {
        if (sum[i] > k) {
          bad = true;
          ++idle;
          --j;
          ++cuts;
          fill(sum.begin(), sum.end(), 0);
          break;
        }
      }
      if (!bad) {
        idle = 0;
      }
      if (idle >= 2) {
        cuts = ans;
        break;
      }
    }
    ans = min(ans, cuts);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
w, h, n = map(int, input().split())
min_x, min_y, max_x, max_y = 0, 0, w, h
for _ in range(n):
  x, y, a = map(int, input().split())
  if a == 1:
    min_x = max(x, min_x)
  elif a == 2:
    max_x = min(x, max_x)
  elif a == 3:
    min_y = max(y, min_y)
  else:
    max_y = min(y, max_y)
s = (max_x - min_x if max_x >= min_x else 0) * (max_y - min_y if max_y >= min_y else 0)
print(s)

Measured memory_bytes: 3064
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
typedef long long ll;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

ll dp[110][100100];

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> a(N);
    rep(i, N) cin >> a[i];
    dp[0][0] = 1;

    for(int i = 0; i < N; i++) {
        vector<ll> sum(K + 2);

        for(int j = 0; j <= K; j++) {
            sum[j + 1] = (sum[j] + dp[i][j]) % MOD;
        }

        for(int j = 0; j <= K; j++) {
            dp[i + 1][j] = (sum[j + 1] - sum[max(j - a[i], 0)] + MOD) % MOD;
        }
    }

    cout << dp[N][K] << endl;
    return 0;
}

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

using namespace std;

//int N,M,K,L,R,H,W;
long long int N,M,K,L,R,H,W;

//constexpr long long int MOD=1000000007;
//constexpr  int MOD=1000000007;
constexpr int MOD=998244353;
//constexpr long long int MOD=998244353;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>N;
	string s;
	cin>>s;
	vector<string>u(N);
	for(auto &i:u)cin>>i;
	int ans=0;
	for(auto i:u){
		int add=0;
		for(int l=0;l<i.size();l++){
			for(int j=1;j<i.size();j++){
				string t;
				for(int k=l;k<i.size()&&t.size()<s.size();k+=j){
					t.push_back(i[k]);
				}
				if(s==t)add|=1;
			}
		}
		ans+=add;
		//cout<<ans<<endl;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3232
import java.util.Scanner;

public class Main {

	public static void main(String[] args) 
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int els = 0;
		
		if(n == 1)
		{
			System.out.println("Yes");
			System.out.println("2");
			System.out.println("1 1");
			System.out.println("1 1");
			return;
		}

		int canner = 1;
		for(int i = 2; canner <= 100000; i++)
		{
			canner += i;
//			System.out.println(canner);
			if(canner == n)
			{
				System.out.println("Yes");
				els = i;
				break;
			}
		}
		if(els == 0)
		{
			System.out.println("No");
			return;
		}
		
		System.out.println((els+1));
		
		int[][] table = new int[els][els+1];
		
		int curstart = 1;
		int curend = 0;
		for(int offset = 0; offset < els; offset++)
		{
			for(int x = offset; x < els; x++)
			{
				table[x][offset] = curstart+(x-offset);
				
				curend = curstart+x-offset;
			}
			for(int y = offset+1; y <= els; y++)
			{
				table[offset][y] = (curstart+y-1-offset);
			}
			
			curstart = curend+1;
		}
		
		StringBuilder sb = new StringBuilder();
		
		for(int y = 0; y <= els; y++)
		{
			sb.append(els + " ");
			for(int x = 0; x < els; x++)
			{
				if(x>0)sb.append(' ');
				sb.append(table[x][y]);
			}
			sb.append('\n');
		}
		
		System.out.print(sb);

	}

}


Measured memory_bytes: 30624
#include <bits/stdc++.h>
 
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
 
const int MAXN = 1e5+2;
const int MOD = 1e9+7;
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second 
#define debug(x)  do{cerr<<#x<<": "<<x<<"\n";}while(0)
#define debugv(x) do{cerr<<#x<<": ";for(auto&e: (x))cerr<<e<<" ";cerr<<"\n";}while(0)
#define FAIL0 {cout << "0\n"; return 0;}
#define FAIL1 {cout << "-1\n"; return 0;}
#define FAILNO {cout << "No\n"; return 0;}
#define YES {cout << "YES\n"; return 0;}

int f(int n) {
    int r = 0;
    while (n) {
        r++;
        n /= 10;
    }

    return r;
}
int main() {
#ifdef OJ
    freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);
#endif
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (f(i)%2) ans++;
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#define REP(i, n) for (int i = 0; i < (n); i++)
#include <iostream>
using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w,n;
    cin >> h >> w;
    cin >> n;
    
    int a[100001];

    REP(i,n) cin >> a[i];

    int b[100001];

    int l = 0;    
    REP(i,n){
        REP(j, a[i]){
            b[l] = i+1;
            l++;
        }        
    }

    int i = 0;
    while(i != h*w){
        if((i/w)%2 == 0) cout << b[i]<< " ";
        else cout << b[(i/w)*w+w-(i%w)-1] <<" ";
		i++;
        if(i%w == 0) cout << endl;
    }

    return 0;
}


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

int main() {
  int a=0,b=0,n;
  cin>>n;
  vector<int> s(n);
  for(int i=0;i<n;i++) {
    cin>>s[i];
  }
  sort(s.begin(),s.end());
  reverse(s.begin(),s.end());
  for(int i=0;i<n;i++) {
    if(i%2==0) a+=s[i];
    else b+=s[i];
  }
  cout<<a-b<<endl;
}


Measured memory_bytes: 3632
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef long long int ll;
void swap(ll *x, ll *y) {
    ll temp;
    temp = *x;
    *x = *y;
    *y = temp;
}
ll asc(const void *a, const void *b) { return *(ll *)a - *(ll *)b; }
ll desc(const void *a, const void *b) { return *(ll *)b - *(ll *)a; }
ll max(ll x, ll y) { return x > y ? x : y; }
ll min(ll x, ll y) { return x > y ? y : x; }
/*void qsort(配列のアドレス,配列のサイズ,sizeof(配列の型),比較関数(昇順or降順))
 */

int main(){
    int n,a[200];
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    qsort(a,n,sizeof(int),desc);

    int bob,alice;
    bob=alice=0;
    for(int i=0;i<n;i++){
        if((i+1)%2)alice+=a[i];
        else bob+=a[i];
    }
    printf("%d\n",alice-bob);
    return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  int T;
  R T;
  while(T--) {
    ll x,y;
    cin >> x >> y;
    if(x>y) swap(x,y);
    ll z=sqrt(x*y);
    if(z*z==x*y) z--;
    ll ans=z*2;
    if(z*(z+1)>=x*y) ans--; 
    if(x<=z) ans--;
    pr(ans);
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}

Measured memory_bytes: 256
#include <iostream>

 

using namespace std;

 

int main()
{
    int i, ans, a, b, c;
    
    cin >> a >> b >> c;
    ans = 0;
    for(i=a; i<=b; i++)
    {
        if( c % i == 0 )
        ans++;
            
    }
    cout << ans << endl;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
#include <cmath>
#include <iostream>
#include <numeric>
#define ll long long
using namespace std;
int main() {
 int A,B,C;
 cin>>A>>B>>C;
 if(A+B+C>=22) cout<<"bust"<<endl;
 else cout<<"win"<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<unordered_set>
#include<unordered_map>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> a(n),b(n),c(n);
	for(int i=0;i<n;i++)
		cin>>a[i]>>b[i]>>c[i];
	vector<vector<int>> dp(n+1,vector<int>(3,0));
	dp[1][0] = a[0];
	dp[1][1] = b[0];
	dp[1][2] = c[0];
	for(int i=2;i<=n;i++){
		dp[i][0] = a[i-1]+max(dp[i-1][1],dp[i-1][2]);
		dp[i][1] = b[i-1]+max(dp[i-1][0],dp[i-1][2]);
		dp[i][2] = c[i-1]+max(dp[i-1][0],dp[i-1][1]);
	}
	cout<<max(dp[n][0],max(dp[n][1],dp[n][2]));
	return 0;
}



Measured memory_bytes: 9836
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<map>
#include<stack>
#include<queue>
#include<iomanip>
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 INF 2e9
#define MOD 1e9+7
#define LINF (long long)4e18

long long  N;

void func(long long i,int use,int &ans){
  if(i > N) return;
  if(use == 0b111) ++ans;
  func(10 * i + 3,use | 0b001,ans);
  func(10 * i + 5,use | 0b010,ans);
  func(10 * i + 7,use | 0b100,ans);
}

int main(){
  cin >> N;
  int ans = 0;
  func(0,0,ans);
  cout << ans << endl;
}


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

int main(void) {
    ll n;
    cin >> n;

    ll a, b, m = n;
    for (ll i = 1; i <= sqrt(n); i++) {
        a = i;
        if (n % a != 0) {
            continue;
        } else {
            b = n / a;
            ll tmp;
            if (a <= b) {
                tmp = max (a, b);
            } else {
                break;
            }
            if (tmp < m) {
                m = tmp;
            }
        }
    }
    int ans = 0;
    while (m > 0) {
        ans++;
        m /= 10;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author NikuKyabe
 */

#include "bits/stdc++.h"
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n)  FOR(i,0,(n))
typedef pair<int,int> P;


class BGoToJail {
public:
	void solve(std::istream& in, std::ostream& out) {
    int n;
    in >> n;
    vector<P> d(n);
    int cnt = 0;
    REP(i, n){
      in >> d[i].first >> d[i].second;
    }
    REP(i, n){
      if(d[i].first == d[i].second){
        cnt++;
      }
      else{
        if(cnt >= 3) break;
        cnt = 0;
      }
    }
    if(cnt >= 3) out << "Yes" << endl;
    else out << "No" << endl;
	}
};


signed main() {
  ios::sync_with_stdio(false);
  cout.tie(0);
  cout << fixed;
	BGoToJail solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3636
from sys import setrecursionlimit
setrecursionlimit(100000)
def inpl():
  return tuple(map(int, input().split()))
V, E = inpl()
graph = [[] for i in range(V)]

for _ in range(E):
  s, t = inpl()
  graph[s].append(t)
  graph[t].append(s)

prenum = [-1] * V
lowest = [float("inf")]*V
found = [False] * V
parent = [-1] *V

result = set()
root = 0

def DFS(i, c, prev):
  global root
  prenum[i] = c
  lowest[i] = c
  found[i] = True

  for p in graph[i]:
    if found[p]:
      if p != prev:
        lowest[i] = min(lowest[i], prenum[p])
    else:
      c = DFS(p, c+1, i)
      lowest[i] = min(lowest[i], lowest[p])

  if prenum[prev] <= lowest[i]:
    result.add(prev)
  parent[i] = prev

  return c

DFS(0, 1, 0)

if parent.count(0) <= 2:
  result = result.difference([0])

for r in sorted(result):
  print(r)



Measured memory_bytes: 19464
#include <bits/stdc++.h>
#define inchar			getchar
#define outchar(x)		putchar(x)
#define ll long long 
#define int long long //
#define all(v) v.begin(), v.end()
#define SP outchar(' ')
#define trace(x) cerr<<#x<<": "<<x<<" "<<endl;
#define LN outchar('\n')
#define endl '\n'
using namespace std;

template<typename T> void inpos(T &x){x=0;register T c=inchar();while(((c<48)||(c>57))&&(c!='-'))c=inchar();bool neg=0; if(c=='-')neg=1;for(;c<48||c>57;c=inchar());for(;c>47&&c<58;c=inchar())x=(x<<3)+(x<<1)+(c&15);if(neg)x=-x;}
template<typename T> void outpos(T n){if(n<0){outchar('-');n*=-1;}char snum[65];int i=0;do{snum[i++]=n%10+'0';n/=10;}while(n);i=i-1;while(i>=0)outchar(snum[i--]);}
inline void instr(char *str){register char c=0;register int i=0;while(c<33)c=inchar();while(c!='\n'&&c!=' '&&c!=EOF){str[i]=c;c=inchar();++i;}str[i]='\0';}
template <typename T, typename TT> inline void inpos(T &n, TT &m) { inpos(n); inpos(m);}
template <typename T, typename TT ,typename TTT> inline void inpos(T &n, TT &m, TTT &o) { inpos(n,m); inpos(o);}
template <typename T, typename TT ,typename TTT, typename TTTT> inline void inpos(T &n, TT &m, TTT &o , TTTT &p) { inpos(n,m); inpos(o,p);}


vector <int> number;
string K; int d;
const int mod = 1e9+7;
const int maxu = 10000+5;
int DP [maxu][105][2];

int solve(int pos, int cModd, int f) {
	if (pos == number.size()) {
		if (cModd == 0) {return 1;} return 0;
	}
	if(DP[pos][cModd][f] != -1) {return DP[pos][cModd][f];}
	int LMT = 9;
	if (f == 0) {
		LMT = number[pos];
	}
	int ans = 0;
	for(int i= 0; i<=LMT ; i++) {
		int nf = f;
		if (f ==0 && i<LMT) {nf = 1;}
		ans+= solve(pos+1, (cModd+i)%d, nf); ans %= mod;
	}
	DP[pos][cModd][f] = ans;
	return ans;
}


int solve (string a) {
	memset(DP, -1, sizeof(DP));
	number.clear();
	for_each(all(K),[](char c) {number.push_back(c-'0');});
	int x = solve(0,0,0);
	return x;
}

int32_t main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	cin >> K >>  d;
	cout << ((solve(K)-1)+mod)%mod<<endl;
	
}

Measured memory_bytes: 17920
#include<iostream>
#include<queue>
#include<cmath>
using namespace std;

int main(){
    long N,K;
    long count=0;
    long min,max;
    cin>>N>>K;
    for(long i=K;i<=N+1;i++){
        min=i*(i-1)/2;
        max=(2*N-i+1)*i/2;
        count+=max-min+1;
        count=count%(1000000000+7);
    }
    cout<<count<<endl;
}



Measured memory_bytes: 3620
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            int A = int.Parse(input[0]);
            int B = int.Parse(input[1]);

            int requiredCount = 0;

            for (requiredCount = 0; ;requiredCount++)
            {
                int unusedPowerTap = A * requiredCount - (requiredCount - 1);

                if (B <= unusedPowerTap)
                {
                    break;
                }
            }

            Console.WriteLine(requiredCount);
        }
    }
}


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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL mod = 1e9+7;

int main() {
    int N;
    string S;
    cin >> N;
    cin >> S;
    int res = -1;
    REP(i, N + 1) {
        auto s = S.substr(0, i);
        auto t = S.substr(i, N - i);
        vector<bool> cs(26, false);
        vector<bool> ct(26, false);
        for(auto j : s) {
            cs[j - 'a'] = true;
        }
        for(auto j : t) {
            ct[j - 'a'] = true;
        }
        int x = 0;
        REP(j, 26) {
            x += cs[j] && ct[j];
        }
        res = max(res, x);
    }
    cout << res << endl;
    return 0;
}


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

#define for_(i,a,b) for(int i=a;i<b;i++)
#define minit(a,b) memset(a,b,sizeof(a));

int n, m, k;

int dp[30][(int)1e5];

void solve() {
	minit(dp, 0);
	for_(p,1,m+1) dp[1][p] = 1;
	
	for_(i,1,n) {
		for_(j,1,n*m) {
			if (dp[i][j] == 0) continue;
			for_(p,1,m+1) if (j + p <= n*m) dp[i + 1][j + p] += dp[i][j];
		}
	}
	
	double ans = 0;
	double base = 1.0;
	for_(i,0,n) base *= m;
	for_(i,1,n*m+1) {
		int cnt = dp[n][i];
		if (i <= k) ans += (double)cnt / base;
		else ans += (double)(i - k) * (double)cnt / base;
	}
	
	printf("%.10lf\n", ans);
}

int main() {
	while (cin >> n >> m >> k, n) {
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 12912
#include <iostream>
#include <vector>
#include <map>
#include <stack>
#include <list>
#include <queue>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <math.h>

#define PREP(i, m, n) for(int i = m; i < n; i++)
#define MREP(i, m, n) for(int i = m - 1; i >= n; i--)

#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
#define rev(v) v.rbegin(), v.rend()
#define prime first
#define weight second
#define MP make_pair
#define PB push_back

using namespace std;

string rule(int two, int three, int four, int st, map<int, int> table){
	
	if(four == 1) return "four card";
	else if(three == 1){
		if(two == 1) return "full house";
		else return "three card";
	}
	else if(two == 2) return "two pair";
	else if(two == 1) return "one pair";

	for(int i = 0; i < table.size(); i++){
		if(table[i] == st) return "straight";
	}

	return "null";
}

int main(){
	map<int, int> table;
	table[0] = 15;
	table[1] = 20;
	table[2] = 25;
	table[3] = 30;
	table[4] = 35;
	table[5] = 40;
	table[6] = 45;
	table[7] = 50;
	table[8] = 55;
	table[9] = 47;
	
	int tmp = 0;
	while(scanf("%d", &tmp) != EOF){
		vector<int> input;
		input.push_back(tmp);
		for(int i = 0; i < 4; i++){
			scanf(",%d", &tmp);
			input.push_back(tmp);
		}
		
		map<int, int> hand;
		int two = 0, three = 0, four = 0,st = 0;
		
		for(int i = 0; i < 5; i++){
			if(hand.find(input[i]) != hand.end()) hand[input[i]]++;
			else hand[input[i]] = 1;
		}

		for(map<int, int>::iterator it = hand.begin(); it != hand.end(); it++){
			if(it->second == 2) two++;
			else if(it->second == 3) three++;
			else if(it->second == 4) four++;
			st += it->first;
		}

		cout << rule(two, three, four, st, table) << endl;
	}
	return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h> 
using namespace std; 
int main() {
     int a,b,c,d=0;
     scanf("%d %d %d",&a,&b,&c);
    if(a>0&&a<10&&b>0&&b<10&&c>0&&c<10)
    {
         if(a==b&&a!=c) d=1; 
    else if(a==c&&a!=b) d=1; 
    else if(b==c&&b!=a) d=1; 
    else d=0;
        }
    else d=0;
    if(d==1) printf("Yes\n");
     else printf("No\n"); 
    return 0; }


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

int main() {
	int a, b;
	cin >> a >> b;
	for (int i = 0; i < 1000000000; i++) {
		if (abs(a-i) == abs(b-i)) {
			cout << i << endl;
			return 0;
		}
	}
	cout << "IMPOSSIBLE" << endl;
	return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

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

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

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

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

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

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

fn main() {
    input! {
        r: i64,
    }
    println!("{}", 3 * r * r);
}


Measured memory_bytes: 4352
import java.util.Arrays;
import java.util.Comparator;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	public void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] a = new int[n];
		boolean f = false;
		for (int i = 0; i < n; ++i) {
			a[i] = sc.nextInt();
			f |= a[i] >= k;
		}
		if (!f) {
			System.out.println("IMPOSSIBLE");
			return;
		}
		int gcd = a[0];
		for (int i = 0; i < n; ++i) {
			gcd = gcd(a[i], gcd);
		}
		if (k % gcd == 0) {
			System.out.println("POSSIBLE");
		} else {
			System.out.println("IMPOSSIBLE");
		}
	}

	int gcd(int a, int b) {
		// pa + qb = x
		// ua + vb = y
		if (a < b) {
			int tmp = a;
			a = b;
			b = tmp;
		}
		int p = 1, q = 0, u = 0, v = 1;
		int x = a;
		int y = b;
		while (y > 0) {
			p -= x / y * u;
			q -= x / y * v;
			x -= x / y * y;
			int tmp = p;
			p = u;
			u = tmp;
			tmp = q;
			q = v;
			v = tmp;
			tmp = x;
			x = y;
			y = tmp;
		}
		return x;
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}


Measured memory_bytes: 49852
#include <bits/stdc++.h>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

void dijkstra() {
  int minv;
  int d[MAX], color[MAX];

  for (int i = 0; i < n; i++) {
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  color[0] = GRAY;
  while (1) {
    minv = INFTY;
    int u = -1;
    for (int i = 0; i < n; i++) {
      if (minv > d[i] && color[i] != BLACK) {
        u = i;
        minv = d[i];
      }
    }
    if (u == -1) break;
    color[u] = BLACK;
    for (int v = 0; v < n; v++) {
      if (color[v] != BLACK && M[u][v] != INFTY) {
        if (d[v] > d[u] + M[u][v]) {
          d[v] = d[u] + M[u][v];
          color[v] = GRAY;
        }
      }
    }
  }

  for (int i = 0; i < n; i++) {
    cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
  }
}

int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      M[i][j] = INFTY;
    }
  }

  int k, c, u, v;
  for (int i = 0; i < n; i++) {
    cin >> u >> k;
    for (int j = 0; j < k; j++) {
      cin >> v >> c;
      M[u][v] = c;
    }
  }

  dijkstra();

  return 0;
}


Measured memory_bytes: 3108
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk) {
    var lines = chunk.toString().split(' ');
    main(lines);
});
 
function main(args){
  var ans = args[0] * args[1]
  if(ans % 2 === 0){
    console.log("Even")
  }else{
    console.log("Odd")
  }
}

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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,a,b) for(int i=(a);i<(b);i++)
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second

using vint=vector<int>;
using pint=pair<int,int>;
using vpint=vector<pint>;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}

template<class A,class B>
ostream& operator<<(ostream& ost,const pair<A,B>&p){
	ost<<"{"<<p.first<<","<<p.second<<"}";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost,const vector<T>&v){
	ost<<"{";
	for(int i=0;i<v.size();i++){
		if(i)ost<<",";
		ost<<v[i];
	}
	ost<<"}";
	return ost;
}

template<uint32_t mod>
struct ModInt{
	uint32_t a;
	ModInt& s(uint32_t vv){
		a=vv<mod?vv:vv-mod;
		return *this;
	}

	ModInt(int64_t x=0){s(x%mod+mod);}

	ModInt& operator+=(const ModInt &x){return s(a+x.a);}
	ModInt& operator-=(const ModInt &x){return s(a+mod-x.a);}
	ModInt& operator*=(const ModInt &x){
		a=uint64_t(a)*x.a%mod;
		return *this;
	}
	ModInt& operator/=(const ModInt &x){
		*this*=x.inv();
		return *this;
	}

	ModInt operator+(const ModInt &x)const{return ModInt(*this)+=x;}
	ModInt operator-(const ModInt &x)const{return ModInt(*this)-=x;}
	ModInt operator*(const ModInt &x)const{return ModInt(*this)*=x;}
	ModInt operator/(const ModInt &x)const{return ModInt(*this)/=x;}
	bool operator==(const ModInt &x)const{return a==x.a;}
	bool operator!=(const ModInt &x)const{return a!=x.a;}
	bool operator<(const ModInt &x)const{return a<x.a;}

	ModInt operator-()const{return ModInt()-*this;}
	ModInt pow(int64_t n)const{
		ModInt res(1),x(*this);
		while(n){
			if(n&1)res*=x;
			x*=x;
			n>>=1;
		}
		return res;
	}

	ModInt inv()const{return pow(mod-2);}
};

template<uint32_t mod>
istream& operator>>(istream& in,ModInt<mod>& a){
	return (in>>a.a);
}
template<uint32_t mod>
ostream& operator<<(ostream& out,const ModInt<mod>& a){
	return (out<<a.a);
}
using mint=ModInt<1000000007>;
//using mint=ModInt<998244353>;

int L,R;
mint dp[66][2][2];
signed main(){
	cin>>L>>R;
	for(int i=60;i>=0;i--){
		rep(j,2)rep(k,2){
			rep(x,2)for(int y=x;y<2;y++){
				if(!j&&(L>>i&1)>x)continue;
				if(!k&&(R>>i&1)<y)continue;
				int nj=j|((L>>i&1)<x);
				int nk=k|((R>>i&1)>y);
				dp[i][nj][nk]+=dp[i+1][j][k];
			}
		}

		if((1ll<<i)>R)continue;
		if((1ll<<i+1)<=L)continue;
		int nj=0;
		int nk=0;
		if((1ll<<i+1)<=R)nk=1;
		if((1ll<<i)>L)nj=1;
		dp[i][nj][nk]+=1;
	}
	mint ans=0;
	rep(i,2)rep(j,2){
		ans+=dp[0][i][j];
	}	
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256