akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define inf 2000000000
#define infLL 2000000000000000000
#define MAX 5000010
#define sf(a) scanf("%d", &a)
#define sfl(a) scanf("%lld", &a)
#define pf(a) printf("%d ", a)
#define pfl(a) printf("%lld\n", a)
#define Case(t) printf("Case %d: ", t)
#define pii pair<int, int>
#define MOD 1000000007
#define mod 998244353
#define PI acos(-1.0)
#define eps 1e-9
#define mem(a, b) memset(a, b, sizeof(a))
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);

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

inline int Set(int N, int pos){return N=N | (1<<pos);}
inline int Reset(int N, int pos){return N=N & ~(1<<pos);}
inline bool Check(ll N, ll pos){return (bool)(N & (1LL<<pos));}

inline void normal(ll &a) { a %= mod; (a < 0) && (a += mod); }
inline ll modMul(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a * b) % mod; }
inline ll modAdd(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); return (a + b) % mod; }
inline ll modSub(ll a, ll b) { a %= mod, b %= mod; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1; while (p) { if (p & 1LL) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modInverse(ll a) { return modPow(a, mod - 2); }
inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); }

ll fast_exp(ll x, ll n, ll m)
{
    ll res = 1;
    while(n>0)
    {
        if(n%2==1)
            res = (res * x) % m;
        x = (x * x) % m;
        n/=2;
    }
    return res%m;
}

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...);
}

clock_t t_Start;
void Start()
{
    t_Start = clock();
}
void End()
{
    double Time = (double)(clock()-t_Start)/CLOCKS_PER_SEC;
    error(Time);
}

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet;
typedef tree<int,null_type,greater<int>,rb_tree_tag,tree_order_statistics_node_update>orderedSet1;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    //Start();

    FASTIO;
    ll n, m;
    cin>>n>>m;
    ll a[n+5];
    ll sum = 0;
    for(int i = 0; i < n; i++)
        cin>>a[i], sum+=a[i];
    sort(a, a+n);
    reverse(a, a+n);
    ll cnt = 0;
    ll tot = ceil((double)sum / (4.0 * (double)m));
    for(int i = 0; i < n; i++)
    {
        if(tot > a[i])
            break;
        cnt++;
    }
    if(cnt>=m)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    //End();
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    string a;   
	bool v[2]={0}; 
    cin>>a;
    int la=a.length();
    for(int i=0;i<la;i++)
	{
        if(a[i]=='C') 
			v[0]=1;
        if(a[i]=='F'&&v[0])  
			v[1]=1; 
    }
    if(v[1]) 
		cout<<"Yes";
    else 
		cout<<"No";
    return 0;
}

Measured memory_bytes: 256
unittest
{
	assert( [ "4", "2 3 7 9" ].parse.expand.solve == 7 );
	assert( [ "8", "3 1 4 1 5 9 2 6" ].parse.expand.solve == 8 );
}



import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
	stdin.byLineCopy.parse.expand.solve.writeln;
}

auto parse( Range )( Range input )
if( isInputRange!Range && is( ElementType!Range == string ) )
{
	auto n = input.front.strip.to!( long );
	input.popFront;
	auto as = input.front.split.to!( long[] );
	return tuple( as );
}

auto solve( long[] as )
{
	auto mm = as.reduce!( max, min );
	return mm[ 0 ] - mm[ 1 ];
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    string s;
    cin >> s;
    int a1, a2;
    a1 = stoi(s.substr(0, 2));
    a2 = stoi(s.substr(2, 4));
    if (a1 >= 1 && a1 <= 12 && a2 >= 1 && a2 <= 12) puts("AMBIGUOUS");
    else if (a1 >= 1 && a1 <= 12) puts("MMYY");
    else if (a2 >= 1 && a2 <= 12) puts("YYMM");
    else puts("NA");

    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

struct UnionFind{
  vector<int> v;
  UnionFind(int n) : v(n, -1) {}
  void init(){ for(int i = 0;i < v.size();i++)v[i]=-1; }
  int find(int x) { return v[x] < 0 ? x : v[x] = find(v[x]); }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (-v[x] < -v[y]) swap(x, y);
    v[x] += v[y]; v[y] = x;
    return true;
  }
  bool root(int x) { return v[x] < 0; }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -v[find(x)]; }
};

ll n,m;
ll a[55],b[55];

int main(){
	cin>>n>>m;
  rep(i,m){
    cin>>a[i]>>b[i];
    a[i]--; b[i]--;
  }
  ll cnt=0;
  rep(i,m){
    UnionFind uf(n);
    rep(j,m){
      if(j!=i){
        uf.unite(a[j],b[j]);
      }
    }
    if(!uf.same(a[i],b[i]))cnt++;
  }
  cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print :fiveam))
                 (shadow :run)
                 (use-package :fiveam)))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

;; BEGIN_INSERTED_CONTENTS
(defun string-prefix-p (prefix string)
    (let* ((x (string prefix))
           (y (string string))
           (lx (length x))
           (ly (length y)))
      (and (<= lx ly) (string= x y :end2 lx))))
(defun string-suffix-p (string suffix)
    (let* ((x (string string))
           (y (string suffix))
           (lx (length x))
           (ly (length y)))
      (and (<= ly lx) (string= x y :start1 (- lx ly)))))

(defmacro nlet (name args &body body)
  (labels ((ensure-list (x) (if (listp x) x (list x))))
    (let ((args (mapcar #'ensure-list args)))
      `(labels ((,name ,(mapcar #'car args) ,@body))
         (,name ,@(mapcar #'cadr args))))))

(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

;; Hauptteil

(defun main ()
  (let* ((s (read-line)))
    (if (or (string-prefix-p "keyence" s)
            (string-suffix-p s "keyence")
            (and (string-prefix-p "k" s)
                 (string-suffix-p s "eyence"))
            (and (string-prefix-p "ke" s)
                 (string-suffix-p s "yence"))
            (and (string-prefix-p "key" s)
                 (string-suffix-p s "ence"))
            (and (string-prefix-p "keye" s)
                 (string-suffix-p s "nce"))
            (and (string-prefix-p "keyen" s)
                 (string-suffix-p s "ce"))
            (and (string-prefix-p "keyenc" s)
                 (string-suffix-p s "e")))
        (write-line "YES")
        (write-line "NO"))))

#-swank(main)


Measured memory_bytes: 16992
def main():
    N, K = (int(i) for i in input().split())
    if K == 0:
        return print(N**2)
    ans = 0
    for b in range(2, N+1):
        if K > b-1:
            continue
        pat = N//b
        ans += pat*(b-K)
        m = N % b
        if K <= m:
            ans += m-K+1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38896
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include<algorithm>

using namespace std;


int main() {
	long long  n;
	cin >> n;
	priority_queue<long long,vector<long long>, greater<long long>> travelTime;
	for (int i = 0; i < 5; i++) {
		long long tmp;
		cin >> tmp;
		travelTime.push(tmp);
	}

	long long min = travelTime.top();

	long long time = n / min + (n%min != 0)+4;


	cout << time << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef pair<l_l,ll> lll;
typedef vector<string> vs;
const ll dx[4]={1,-1,0,0};
const ll dy[4]={0,0,1,-1};
#define pb push_back
#define sz(x) (int)(x).size()
#define fi first
#define se second
#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)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
const int mod = 1000000007;
struct mint {
ll x;
mint(ll x=0):x((x%mod+mod)%mod){}
mint operator-() const { return mint(-x);}
mint& operator+=(const mint a) {
if ((x += a.x) >= mod) x -= mod;
return *this;
}
mint& operator-=(const mint a) {
if ((x += mod-a.x) >= mod) x -= mod;
return *this;
}
mint& operator*=(const mint a) {
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const {
mint res(*this);
return res+=a;
}
mint operator-(const mint a) const {
mint res(*this);
return res-=a;
}
mint operator*(const mint a) const {
mint res(*this);
return res*=a;
}
mint pow(ll t) const {
if (!t) return 1;
mint a = pow(t>>1);
a *= a;
if (t&1) a *= *this;
return a;
}
mint inv() const {
return pow(mod-2);
}
mint& operator/=(const mint a) {
return (*this) *= a.inv();
}
mint operator/(const mint a) const {
mint res(*this);
return res/=a;
}
};
ll n,k;
mint dp[110][100100];
mint dp_sum[110][100100];
int main(){
    cin>>n>>k;
    vl a(n);rep(i,n)cin>>a[i];
    dp[0][0]=1;
    rep(i,k+1)dp_sum[0][i]=1;
    for(int i=1;i<=n;i++){
        for(int j=0;j<=k;j++){
            dp[i][j]=dp_sum[i-1][j];
            if(j-a[i-1]-1>=0)dp[i][j]-=dp_sum[i-1][j-a[i-1]-1];
            if(j-1>=0)dp_sum[i][j]=dp_sum[i][j-1]+dp[i][j];
            else dp_sum[i][j]=dp[i][j];
        }
    }
    cout<<dp[n][k].x<<endl;
    return 0;
}

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

#define         eps         10e-9
#define         pi          2*acos(0)
#define         P1          1e9+7
#define         P2          1e9+9
#define         ll          long long
#define         S           stack
#define         V           vector
#define         Q           queue
#define         SE          set
#define         ST          string

using namespace std;

int main()
{
    string s,t;
    int i,ctn=0;
    cin>>s>>t;
    for (i=0; i<3; i++)
    {
        if(s[i]==t[i])
            ctn++;
    }
    cout<<ctn<<endl;
    return 0;
}



Measured memory_bytes: 256
fun main(args: Array<String>) {
    val (row, column) = readLine()?.split(" ")?.map { it.toInt() } ?: return
    val matrix = Array(row, { intArrayOf() })
    (0 until row).forEach { i ->
        val rowElements = readLine()?.split(" ")?.map { it.toInt() }?.toIntArray() ?: return
        matrix.set(i, rowElements)
    }
    val columnVector = IntArray(column)
    (0 until column).forEach { i ->
        val columnVectorElement = readLine()?.toInt() ?: return
        columnVector[i] = columnVectorElement
    }
    val answerMatrix = IntArray(row)
    for ((index1, rowOfMatrix) in matrix.withIndex()) {
        for((index2, value) in rowOfMatrix.withIndex()) {
            var answer = answerMatrix.getOrElse(index1, { 0 })
            answer += columnVector.get(index2) * value
            answerMatrix.set(index1, answer)
        }
    }
    answerMatrix.forEach { it ->
        println(it)
    }
}


Measured memory_bytes: 37064
#include<stdio.h>
#define ran 222222
int cnt[ran],a[ran];
int n,m;

struct Node{
	int add, val_small, val_cnt;
	void addon(int x){
		add += x;
		val_small += x;
	}
};

Node seg[ran*4];
void push(int i){
	int&tmp = seg[i].add;
	if(tmp == 0)return;
	seg[i*2].addon(tmp);
	seg[i*2+1].addon(tmp);
	tmp = 0;
}
void merge(Node&A,const Node&B,const Node&C){
	if(B.val_small == C.val_small){
		A.val_small = B.val_small;
		A.val_cnt = B.val_cnt + C.val_cnt;
	}else
	if(B.val_small < C.val_small){
		A.val_small = B.val_small;
		A.val_cnt = B.val_cnt;
	}else{
		A.val_small = C.val_small;
		A.val_cnt = C.val_cnt;
	}
}
void upd(int i,int s,int e,int l,int r,int z){
	if(s == l && e == r){
		seg[i].addon(z);
		return;
	}
	push(i);
	int m = (s+e)/2;
	if(r<=m)upd(i*2,s,m,l,r,z);else
	if(l>m)upd(i*2+1,m+1,e,l,r,z);else{
		upd(i*2,s,m,l,m,z);
		upd(i*2+1,m+1,e,m+1,r,z);
	}
	merge(seg[i],seg[i*2],seg[i*2+1]);
}
void draw(int id,int z){
	int L = id - cnt[id] + 1, R = id;
	if(L > R)return;
	if(L <= 0)L = 1;
//	printf("draw %d %d %d\n",L,R,z);
	upd(1,1,n,L,R,z);
}
void build(int i,int s,int e){
	seg[i].add = 0;
	if(s==e){
		seg[i].val_small = 0;
		seg[i].val_cnt = 1;
		return;
	}
	int m = (s+e)/2;
	build(i*2,s,m);
	build(i*2+1,m+1,e);
	merge(seg[i],seg[i*2],seg[i*2+1]);
}
void show_tree(int i,int s,int e,int x){
	x += seg[i].add;
	if(s == e)
		printf("%d ",x);
	else{
		int m=(s+e)/2;
		show_tree(i*2,s,m,x);
		show_tree(i*2+1,m+1,e,x);
	}
}

int main(){
	scanf("%d%d",&n,&m);
	for(int i=1; i<=n; i++){
		scanf("%d",&a[i]);
		cnt[a[i]]++;
	}
	build(1,1,n);
	for(int i=1; i<=n; i++)
		draw(i, 1);
	while(m--){
		int x,y;
		scanf("%d%d",&x,&y);
		draw(a[x], -1);
		cnt[a[x]]--;
		draw(a[x], 1);
		draw(y, -1);
		a[x] = y;
		cnt[y] ++;
		draw(y, 1);
//		show_tree(1,1,n,0);
		printf("%d\n", seg[1].val_small == 0?seg[1].val_cnt : 0);
	}
	return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <limits>
#include <cmath>
#include <cassert>

using namespace std;
using ll = long long;

const int INF = 1<<30;
const int MOD = (int)1e9 + 7;
const int MAX_N = (int)1e5 + 5;
#define debug(x) cout << #x << ": " << x << endl

void Shuffle(vector<int> &card)
{
    int n = card.size() / 2;
    vector<int> tmp;
    for(int i = 0; i < n; i++)
    {
        tmp.push_back(card[i]);
        tmp.push_back(card[i + n]);
    }
    card = tmp;
}

void cut(int k, vector<int> &card)
{
    for(int i = 0; i < k; i++) card.push_back(card[i]);
    card.erase(card.begin(), card.begin() + k);
}

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> card(2 * n);
    iota(card.begin(), card.end(), 0);
    int m; cin >> m;
    for(int i = 0; i < m; i++)
    {
        int k; cin >> k;
        if(k == 0) Shuffle(card);
        else cut(k, card);
    }
    for(int i = 0; i < card.size(); i++)
    {
        cout << card[i] + 1 << endl;
    }
    return 0;
}




Measured memory_bytes: 3184
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#include<cstring>

using namespace std;
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<ll, ll>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define print(x) cout << (x) << endl

class mint {
    long long x;
public:
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x;
        return os;
    }
};

/* -- template -- */

int main() {
    int N, M; cin >> N >> M;
    int A[M], B[M];
    vector<vector<int>>G(N);
    rep(i, M) {
        cin >> A[i] >> B[i];
        --A[i], --B[i];
        G[A[i]].pb(B[i]);
        G[B[i]].pb(A[i]);
    }
    queue<int>Q;
    Q.push(0);
    vector<P> dist(N, mp(INF, -1));
    dist[0] = mp(0, -1);
    while(!Q.empty()) {
        int q = Q.front(); Q.pop();
        for(int next : G[q]) {
            if(dist[next].first == INF) Q.push(next);
            if(dist[next].first > dist[q].first + 1) {
                dist[next] = mp(dist[q].first + 1, q + 1);
            }
        }
    }
    cout << "Yes" << endl;
    rep(i, N - 1) {
        cout << dist[i + 1].second << endl;
    }
}


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

using namespace std;
mt19937_64 rng(58);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    double l;
    cin >> l;
    cout << setprecision(10) << (l / 3) * (l / 3) * (l / 3) << "\n";
}

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

long gcd(long a, long b){
	long l = max(a, b);
	long s = min(a, b);
	long c = l % s;
	while(c){
		l = s;
		s = c;
		c = l % s;
	}
	return s;
}

long long lcm(long long a, long b){
	long long ans;
	ans = (long long) a / gcd(a, b) * b;
	return ans;
}

int main(){
	int n;
	long t;
	long long ans;
	cin >> n >> ans;
	for(int i=1; i < n; i++){
		cin >> t;
		ans = lcm(ans, t);
	}
	cout << ans;
}



Measured memory_bytes: 256
import java.io.InputStreamReader
import java.io.BufferedReader

fun main(args: Array<String>) {
  val br = BufferedReader(InputStreamReader(System.`in`))

  val(x, y) = br.readLine().split(" "). map { it.toLong() }

  tailrec fun rec(acc: Long, cnt: Int): Int =
    if(acc > y)  cnt
    else rec(acc*2, cnt+1)

  val ans = rec(x, 0)
  println(ans)
}

Measured memory_bytes: 35488
#define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
  out << "(" << a.first << "," << a.second << ")";
  return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
#define SZ(x) (int)((x).size())
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

struct fast_ios {
  fast_ios() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
  };
} fast_ios_;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> f(n);
  for (int i = 0; i < n; ++i) f[i] = i;

  function<int(int)> find =
    [&] (int x) {
      if (f[x] != f[f[x]]) f[x] = find(f[x]);
      return f[x];
    };

  while (m--) {
    int op, x, y;
    cin >> op >> x >> y;
    if (op == 0) {
      int rx = find(x), ry = find(y);
      if (rx != ry) f[ry] = rx;
    } else {
      cout << (find(x) == find(y)) << '\n';
    }
  }
  return 0;
}


Measured memory_bytes: 3512
N, M = map(int, input().split())
ans = [0, N]
for _ in range(M):
  L, R = map(int, input().split())
  ans[0] = max(ans[0], L)
  ans[1] = min(ans[1], R)
if ans[0] <= ans[1]:
  print(ans[1] - ans[0] + 1)
else:
  print(0)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double lb;
#define REP(i,j,n) for (int i=j;i<(n);i++)
#define RREP(i,n) for (int i = n; 0<i;i--)
#define print(out) cout<< out  << "\n";
#define mod 1000000007
const int INF = 1e9;

int main(){
  int N;
  cin>>N;
  vector<int> D(N);
  int ans=0;
  REP(i,0,N)cin>>D[i];
  REP(i,0,N)REP(j,i+1,N)ans+=D[i]*D[j];
  print(ans)
}


Measured memory_bytes: 256
import static java.lang.Math.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int h = in.nextInt();
			int w = in.nextInt();

			int[][] mat = new int[h][w];
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					mat[i][j] = in.nextInt();
				}
			}

			long[][] dp = new long[h][w];
			long ans = 0;
			for (int i = 0; i < h; i++) {
				if (mat[i][0] == 0) {
					dp[i][0] = 1;
				}
				ans = max(ans, dp[i][0]);
			}
			for (int i = 0; i < w; i++) {
				if (mat[0][i] == 0) {
					dp[0][i] = 1;
				}
				ans = max(ans, dp[0][i]);
			}

			for (int i = 1; i < h; i++) {
				for (int j = 1; j < w; j++) {
					if (mat[i][j] == 0) {
						dp[i][j] = min(min(dp[i-1][j-1], dp[i][j-1]), dp[i-1][j])+1;
					}
					ans = max(ans, dp[i][j]);
				}
			}

			out.println(ans*ans);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}
}



Measured memory_bytes: 121416
#include <stdio.h>
#include <stdbool.h>

#define MAX 1000000

int main(void)
{
    int i, j;

    bool isPrime[MAX];
    isPrime[0] = isPrime[1] = false;
    for (i = 2; i < MAX; i++) {
        isPrime[i] = true;
    }

    int n, n_max = 2;
    int cnt;
    while (scanf("%d", &n) != EOF) {
        if (n > n_max) {
            for (i = n_max; i <= n; i++) {
                if (isPrime[i] == true) {
                    for (j = i + i; j <= MAX; j += i) {
                        isPrime[j] = false;
                    }
                }
            }
            n_max = n;
        }
        cnt = 0;
        for (i = 2; i <= n; i++) {
            if (isPrime[i] == true) {
                cnt++;
            }
        }
        printf("%d\n", cnt);

    }

    return 0;
}

Measured memory_bytes: 1572
import sys

def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while a % b > 0:
        a, b = b, a % b
    return b 

def solve():
    input = sys.stdin.readline
    N = int(input())
    A = [int(a) for a in input().split()]
    mod = 7 + 10 ** 9
    gcdA = A[0]
    lcmA = A[0]
    for i in range(1, N):
        gcdA = gcd(lcmA, A[i])
        lcmA = (lcmA * A[i]) // gcdA
    lcmA %= mod
    Ans = 0
    for a in A:
        Ans += (lcmA * pow(a, mod - 2, mod)) % mod
        Ans %= mod
    print(Ans)


    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 4084
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bitset>
#include <list>
#include <stdexcept>
#include <functional>
#include <utility>
#include <ctime>
#include <random>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;;
#define MEM(a,b) memset((a),(b),sizeof(a))
const LL INF = 1e9 + 7;
const int N = 2e4 + 10;

int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int a, b, c;
	cin >> a >> b >> c;
	if (a > b) swap(a, b);
	if (b > c) swap(b, c);
	if (a > b) swap(a, b);
	if (a == 5 && b == 5 && c == 7) puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 256
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

int A,B;
inline void solve(){
  IN2(A,B);
  if(A==B)OUT("Draw");
  else if(A==1)OUT("Alice");
  else if(B==1)OUT("Bob");
  else if(A>B)OUT("Alice");
  else if(A<B)OUT("Bob");
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func nextFloat64() float64 {
	f, _ := strconv.ParseFloat(next(), 64)
	return f
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func main() {
	sc.Split(bufio.ScanWords)
	n, k := nextInt(), nextInt()
	a := nextInts(n)
	// 変数未使用エラー回避
	a[0] = 0

	sum := k
	ans := 1
	for sum < n {
		sum = sum - 1 + k
		ans++
	}
	fmt.Println(ans)
}


Measured memory_bytes: 2048
N,K=map(int,input().split())
MOD=998244353
S=[]
for _ in range(K):
    L,R=map(int,input().split())
    S.append((L,R))
S.sort()
dp=[0]*(N+1)
dp[1]=1
ans=[0]*(K+1)
for i in range(2,N+1):
    for j in range(K):
        L,R=S[j][0],S[j][1]
        if L>=i:
            break
        l=max(0,i-R)
        r=min(i-1,i-L)
        ans[j]+=dp[r]-dp[l-1]
    dp[i]+=sum(ans)
    dp[i]%=MOD
print(dp[N]%MOD)

Measured memory_bytes: 75960
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
#define pii pair<int,int>
#define vpii vector<pii>
using namespace std;
const int maxn = 200100;
const ll mod = 998244353;
vpii a;
int n;

int val[maxn];
int tree[4*maxn];

ll dp[maxn];

void update(int uind, int uval, int li=0, int ri=n-1, int index=1) {
	if(li == ri) tree[index] = uval;
	else {
		int mid = (li + ri) / 2;

		if(uind <= mid) update(uind, uval , li, mid, 2*index);
		else update(uind, uval, mid+1, ri, 2*index+1);

		tree[index] = max(tree[2*index], tree[2*index+1]);
	}
}

int query(int ql, int qr, int li=0, int ri=n-1, int index=1) {
	if(li > qr || ri < ql) return 0;
	if(li >= ql && ri <= qr) return tree[index];
	else {
		int mid = (li + ri) / 2;
		return max(query(ql, qr, li, mid, 2*index), query(ql, qr, mid+1, ri, 2*index+1));
	}
}

int main() {
	cin>>n;
	int pos, d;
	for(int i=0;i<n;i++) {
		cin>>pos>>d;
		a.pb(mp(pos, d));
	}

	sort(a.begin(), a.end());
	val[n-1] = n-1;
	update(n-1, n-1);
	dp[n] = 1;
	dp[n-1] = 2;

	for(int i=n-2;i>=0;i--) {
		int ind = i;
		for(int cekor=n/2;cekor>0;cekor/=2) {
			while(ind + cekor <= n-1 && a[i].first + a[i].second > a[ind + cekor].first) ind += cekor;
		}
		val[i] = max(i, query(i, ind));
	
		dp[i] += dp[val[i] + 1]; dp[i] %= mod;
		dp[i] += dp[i+1]; dp[i] %= mod;

		//cout<<i<<": "<<val[i]<<" - "<<dp[i]<<"\n";

		update(i, val[i]);
	}
	cout<<dp[0]<<"\n";
}

Measured memory_bytes: 6768
n = input()
h = list(map(int, input().split()))
first = h[0]
for i in range(1, first):
    num = h.count(i)
    for j in range(num):
        h.remove(i)
deled_num = len(h)
x = 0
for j in range(deled_num - 1):
    if h[x] > h[x+1]:
        h.pop(x+1)
    else:
        x += 1
print(len(h))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);i++)
//#define int long long  
int main(){
    int Ans=0;
    int H,W;
    int c[11][11];
    int A[205][205];
    cin >> H >>W;
    REP(i,10){
        REP(j,10){
            cin >> c[i][j];
        }
    }
    REP(i,H){
        REP(j,W){
            cin >> A[i][j];
        }
    }
    REP(k,10){
        REP(i,10){
            REP(j,10){
                c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
            }
        }
    }
    
    
    /*REP(i,10){
        REP(j,10){
            cout << c[i][j] << " ";
        }
        cout << endl;
    }*/
    REP(i,H){
        REP(j,W){
            if(A[i][j]!=-1){
                Ans+=c[A[i][j]][1];
            }
        }
    }
    cout << Ans << endl;
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define r1(i, n) for (int i=0;i<n;i++)
#define r2(i, n) for (int i=1;i<n;i++)
#define intc(n) int n; cin >> n;
#define ll long long
#define llc(n) ll n; cin >> n;
using namespace std;
int main() {
    llc(n);
    intc(k);
    int a=1;
    while(n/k>0) {
        a++;
        n/=k;
    }
    cout << a << endl;
}

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

int K, T;
int a[555];

int main() {
	scanf("%d%d", &K, &T);
	for(int i=0;i<T;i++) scanf("%d", &a[i]);
	sort(a,a+T);
	for(int i=T-3;i>=0;i--)
		a[T-2] += a[i];
	int ans = a[T-1];
	if(T>1) ans -= a[T-2];
	printf("%d\n", max(0, ans-1));
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
char s[2][60];
int vis[2][60];
int k[60];
int cnt = 0;
int main()
{
	int N; scanf("%d", &N);
	scanf("%s%s", s[0],s[1]);
	for (int i = 0; i < N; i++) {
		if (s[0][i] == s[1][i]) {
			k[cnt++] = 1;
		}
		else {
			k[cnt++] = 2;
			i++;
		}
	}
	long long ans = 1;
	if (k[0] == 2)ans = 6;
	else ans = 3;
	for (int i = 1; i < cnt; i++) {
		if (k[i] == 2 && k[i - 1] == 1)ans = ans * 2 % 1000000007;
		else if (k[i] == 2 && k[i - 1] == 2)ans = ans * 3 % 1000000007;
		else if (k[i] == 1 && k[i - 1] == 1)ans = ans * 2 % 1000000007;
	}
	printf("%lld", ans);
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] c = S.toCharArray();
        int N = S.length();
        int ans=N/2;
        loop:for (ans=N/2;ans<=N;ans++) {
            // for (int j=N-ans+1;j<ans;j++) {
            for (int j=N-ans+1;j<ans;j+=Math.max(1, 2*ans-N-2)) {
                if (c[j]!=c[j-1]) {
                    break loop;
                }
            }
        }
        System.out.println(ans-1);
    }
}

Measured memory_bytes: 27708
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <cstdlib>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion

vector<int> v(11, 0);
vector<int> a(55), b(55), c(55), d(55);
int n, m, q;
int res = 0;

void solver()
{
	int tmp = 0;
	rep(i, q)
	{
		if (v[b[i]] - v[a[i]] == c[i])tmp += d[i];
	}
	res = max(res, tmp);
}

void dfs(int cnt, int mn)
{
	if (cnt == n)
	{
		solver();
		return;
	}
	for (int i = mn; i <= m; ++i)
	{
		v[cnt] = i;
		dfs(cnt + 1, i);
	}
}

int main()
{
	cin >> n >> m >> q;
	rep(i, q)
	{
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		--a[i], --b[i];
	}
	dfs(0, 1);
	cout << res << endl;
}

Measured memory_bytes: 3604
N, M = list(map(int, input().split()))

C = []

for i in range(N):
    a, b = list(map(int, input().split()))
    C.append([a, b])

C.sort()

k = 0
ans = 0

for i in range(N):
    if k + C[i][1] <= M:
        k += C[i][1]
        ans += C[i][0] * C[i][1]
    
    else:
        ans += (M - k) * C[i][0]
        break

print(ans)

Measured memory_bytes: 20464
n, m = map(int, input().split())
li = [list(map(int, input().split())) for i in range(m)]

left = 0
right = n

for i in li:
  left = max(i[0], left)
  right = min(i[1], right)
  
if right < left:
  print(0)
else:
  print(right - left + 1)

Measured memory_bytes: 60376
#include <bits/stdc++.h>
using namespace std;
int main(void){
    vector<int> s(8);
    int d[4]={-1,1,-4,4};
    queue<vector<int>> que;
    que.push({0,1,2,3,4,5,6,7});
    map<vector<int>,int> arrived;
    arrived[{0,1,2,3,4,5,6,7}]=0;
    while(!que.empty()){
        vector<int> now=que.front();
        que.pop();
        int pos=find(now.begin(),now.end(),0)-now.begin();
        for(int i=0;i<4;i++){
            if((pos+d[i]<8)&&(pos+d[i]>=0)){
                if(pos==3&&pos+d[i]==4){
                    continue;
                }
                if(pos==4&&pos+d[i]==3){
                    continue;
                }
                vector<int> tmp=now;
                swap(tmp[pos],tmp[pos+d[i]]);
                if(arrived.find(tmp)==arrived.end()){
                    que.push(tmp);
                    arrived[tmp]=arrived[now]+1;    
                }
            }
        }
    }
    while(cin>>s[0]){
        for(int i=1;i<8;i++){
            cin>>s[i];
        }
        cout<<arrived[s]<<endl;
    }
}



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

#define F first
#define S second

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 210, M = 110, INF = 0x3f3f3f3f;

int n, m, k;
int g[N][N], r[N];

int main()
{
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= n; i ++ )
		for (int j = 1; j <= n; j ++ )
			if (i == j) g[i][j] = 0;
			else g[i][j] = INF;
			
	for (int i = 0; i < k; i ++ ) scanf("%d", &r[i]);
	sort(r, r + k);
			
	for (int i = 0; i < m; i ++ )
	{
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		g[a][b] = g[b][a] = min(g[a][b], c);
	}
	
	for (int k = 1; k <= n; k ++ )
		for (int i = 1; i <= n; i ++ )
			for (int j = 1; j <= n; j ++ )
				g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
				
	// for (int i = 1; i <= n; i ++ )
	// {
		// for (int j = 1; j <= n; j ++ )
			// cout << g[i][j] << ' ';
		// puts("");
	// }
				
	LL res = 1e18;	
	do
	{
		// for (int i = 0; i < k; i ++ ) cout << r[i] << ' ';
		// puts("");
		LL sum = 0;
		for (int i = 1; i < k; i ++ ) sum += g[r[i]][r[i - 1]];
		res = min(res, sum);
	}while(next_permutation(r, r + k));
	
	printf("%lld\n", res);
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#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 ifaxb(a, x, b) if (a < x && x < b)  // 比較は昇順
#define vi vector<int>
#define vii vector<vi>
#define vs vector<string>
#define vss vector<vs>
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define pq priority_queue
#define ipair pair<int, int>
#define spair pair<string, string>
#define lpair pair<LL, LL>
#define MP make_pair
#define MM multimap
#define PB push_back
#define INF 2147483647
#define _INF -2147483647
#define pi 3.1415926536
#define MAXN 100004
using namespace std;
typedef long long ll;

int main() {
    int H, W, h, w;
    cin >> H >> W;
    cin >> h >> w;
    cout << (H - h) * (W - w) << endl;

    return 0;
}

Measured memory_bytes: 256
import std.stdio;
import std.string;
import std.conv;
import std.array;
import std.algorithm;

void main() {
    auto input = readln.split.map!(to!int);
    int a = input[0];
    int b = input[1];

    int d = a / b;
    int r = a % b;
    double f = a.to!double / b;

    writefln("%s %s %.6f", d, r, f);
}

Measured memory_bytes: 2508
#include<stdio.h>
#include<math.h>

int main(){
  int i,j,k=0;
  int N;
  scanf("%d",&N);
  for(i=1;i<=N;i++){
    for(j=2;j <1000;j++){
      if(N < pow(i,j))
        break;
      if(k < pow(i,j))
        k=pow(i,j);
    }
  }
  
  printf("%d\n",k);
  return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<stdlib.h>

int i,j,a[20];

int comp(const void *p,const void *q){
	return *(int *)q-*(int *)p;
}

int main(){
	scanf("%d",&a[0]);
	for(i=1;i<10;i++)scanf("\n%d",&a[i]);
	
	qsort(a,10,sizeof(int),comp);
	
	printf("%d\n",a[0]);
	printf("%d\n",a[1]);
	printf("%d\n",a[2]);
	
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>

int main(void)
{

    int a,b;

    scanf("%d %d",&a,&b);

    if(a<b)printf("a < b\n");
    else if(a>b)printf("a > b\n");
    else if(a==b)printf("a == b\n");

    return 0;
}


Measured memory_bytes: 2040
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll mod=1e9+7;
const int inf=1<<30;

int main(){
  int n; cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  rep(i,n) cin >> a[i];
  ll sum=0;
  rep(i,n){
    b[i]=a[i]-(i+1);
  }
  sort(all(b));
  ll ans=0;
  rep(i,n){
    ans+=abs(b[n/2]-b[i]);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
function exec(N, M, A, B) {
  const a_max = Math.max.apply(null, A);
  const b_max = Math.max.apply(null, B);
  const max = Math.max(a_max, b_max);

  const A_Set = new Set(A);
  const B_Set = new Set(B);

  const mod = 10 ** 9 + 7;

  const already_A = [];
  const already_B = [];

  let ans = 1;

  for (let i = max; i > 0; i--) {
    const a_exists = A_Set.has(i);
    const b_exists = B_Set.has(i);
    if (a_exists && b_exists) {
      already_A.push(i);
      already_B.push(i);
    } else if (a_exists) {
      already_A.push(i);
      ans = ans * already_B.length;
      ans = ans % mod;
    } else if (b_exists) {
      already_B.push(i);
      ans = ans * already_A.length;
      ans = ans % mod;
    } else {
      let tmp = ((already_A.length * already_B.length) % mod) - (N * M - i);
      if (tmp < 0) {
        tmp += mod;
      }
      ans = (ans * tmp) % mod;
    }
  }

  return ans % mod;
}

function main(input) {
  let array = input.split("\n");
  let NM_array = array[0].split(" ").map(item => parseInt(item));
  let A_array = array[1].split(" ").map(item => parseInt(item));
  let B_array = array[2].split(" ").map(item => parseInt(item));
  return exec(NM_array[0], NM_array[1], A_array, B_array);
}

const input = require("fs").readFileSync("/dev/stdin", "utf8");
console.log(main(input));


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

#define rep(i, n) for(int i = 0; i < (n); ++i)

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

const int MAX = 1e5 + 5;
const int INF = 1e9;
const int MOD = 1e9 + 7;

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

    ll a[MAX], b[MAX];
    ll sumA = 0, sumB = 0;
    rep(i, N) {
        cin >> a[i];
        sumA += a[i];
    }
    rep(i, N) {
        cin >> b[i];
        sumB += b[i];
    }

    ll cnt = 0;
    rep(i, N) {
        if (a[i] < b[i]) {
            cnt += (b[i] - a[i] + 1) / 2;
        }
    }

    if (cnt <= sumB - sumA) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 384
lis = input().split()
lis_a = lis[0][len(lis[0])-1]
lis_bt = lis[1][0]
lis_bf = lis[1][len(lis[1])-1]
lis_c = lis[2][0]

if lis_a == lis_bt and lis_bf == lis_c:
  print("YES")
else:
  print("NO")

Measured memory_bytes: 3060
#include <iostream>
#include <list>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <chrono>
#include <math.h>
using namespace std;

using lli = long long int;
using Vint = std::vector<int>;
using Vlli = std::vector<lli>;
using Wint = std::vector<Vint>;
using Wlli = std::vector<Vlli>;
using Vbool = std::vector<bool>;
using Wbool = std::vector<Vbool>;
using pii = std::pair<int, int>;
using pll = std::pair<lli, lli>;
template <class T>
using Vec = std::vector<T>;

constexpr int MOD = 1e9 + 7;
constexpr int INFi = 2e9 + 1;
constexpr lli INFl = (lli)(9e18) + 1;
const vector<pii> DXDY = {std::make_pair(1, 0), std::make_pair(-1, 0), std::make_pair(0, 1), std::make_pair(0, -1)};
constexpr char BR = '\n';

#define DEBUG(x) std::cerr << #x << " = " << x << '\n';
#define FOR(i, a, b) for(int (i) = (a); (i) < (b); ++(i))
#define FOReq(i, a, b) for(int (i) = (a); (i) <= (b); ++(i))
#define rFOR(i, a, b) for(int (i) = (b); (i) >= (a); --(i))
#define FORstep(i, a, b, step) for(int (i) = (a); i < (b); i += (step))
#define REP(i, n) FOR(i, 0, n)
#define rREP(i, n) rFOR(i, 0, (n-1))
#define vREP(ele, vec) for(auto &(ele) : (vec))
#define vREPcopy(ele, vec) for(auto (ele) : (vec))
#define SORT(A) std::sort((A).begin(), (A).end())
#define RSORT(A) std::sort((A).rbegin(), (A).rend())
// 座標圧縮 (for vector) : ソートしてから使うのが一般的 ; SORT(A) => COORDINATE_COMPRESSION(A)
#define COORDINATE_COMPRESSION(A) (A).erase(unique((A).begin(),(A).end()),(A).end())



template <class T> inline int argmin(std::vector<T> vec){return min_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline int argmax(std::vector<T> vec){return max_element(vec.begin(), vec.end()) - vec.begin();}
template <class T> inline void chmax(T &a, T b){if(a < b) a = b;}
template <class T> inline void chmin(T &a, T b){if(a > b) a = b;}
template <class T> inline void reverseSORT(Vec<T> &Array){
  std::sort(Array.begin(), Array.end(), std::greater<T>());
}
inline int BitI(int k){return 1 << k;}
inline lli BitL(int k){return 1LL << k;}
inline void putsDouble(double d){printf("%.16lf\n", d);}
inline int toInt(const string &s){int res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
inline long long int toLong(const string &s){lli res = 0; for(char a : s) res = 10 * res + (a - '0'); return res;}
template <class T> inline std::string toString(T n){
  if(n == 0) return "0";
  std::string res;
  if(n < 0){n = -n;while(n != 0){res += (char)(n % 10 + '0'); n /= 10;}
  std::reverse(res.begin(), res.end()); return '-' + res;}
  while(n != 0){res += (char)(n % 10 + '0'); n /= 10;} std::reverse(res.begin(), res.end()); return res;
}

// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~






int main(void){
    int a, p; cin >> a >> p;
    int res = (3 * a + p) / 2;
    cout << res << BR;
    return 0;
}

Measured memory_bytes: 888