akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#include <random>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
//#define int long long

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

// constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
// constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    int cnt = 0;
    REP(i,1,n+1) cnt += (n - 1) / i;
    cout << cnt << endl;
}

signed main() {
    solve();
    
    return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define REREP(i,n) for(int i=int(n-1); i>=0; i--)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define REFOR(i,m,n) for(int i=int(n-1); i>=int(m); i--)
#define ALL(obj) (obj).begin(),(obj).end()
 
#define VI vector<int>
#define VVI vector<vector<int>>
#define VVVI vector<vector<vector<int>>>
#define VD vector<double>
#define VVD vector<vector<double>>
#define VVVD vector<vector<vector<double>>>
#define VL vector<ll>
#define VVL vector<vector<ll>>
#define VVVL vector<vector<vector<ll>>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define VVVB vector<vector<vector<bool>>>
#define VS vector<string>
#define VVS vector<vector<string>>
#define VVVS vector<vector<vector<string>>>
 
#define PII pair<int,int>
#define PDD pair<double,double>
#define PLL pair<ll,ll>
#define VPII vector<pair<int,int>>
#define VVPII vector<vector<pair<int,int>>>
#define VVVPII vector<vector<vector<pair<int,int>>>>
#define VPLL vector<pair<ll,ll>>
#define VVPLL vector<vector<pair<ll,ll>>>
#define VVVPLL vector<vector<vector<pair<ll,ll>>>>
 
#define SUMI(obj) accumulate((obj).begin(), (obj).end(), 0)
#define SUMD(obj) accumulate((obj).begin(), (obj).end(), 0.)
#define SUML(obj) accumulate((obj).begin(), (obj).end(), 0LL)
#define SORT(obj) sort((obj).begin(), (obj).end()) // 1,2,3,4,5...
#define RESORT(obj) sort((obj).begin(), (obj).end(), greater<int>()) // 5,4,3,2,1...
#define UB(obj,n) upper_bound((obj).begin(), (obj).end(), n) //itr > n
#define LB(obj,n) lower_bound((obj).begin(), (obj).end(), n) //itr>= n

#define PB push_back
#define Cout(str) cout << str << endl

const ll MOD = (ll)1e9 + 7;
const ll HINF = (ll)1e18;
const ll LINF = (ll)1e9;
const ll EPS = (ll)1e-8;

int main(){
	int n,m;
	int a,b,c,d;
	int sum;
	string str;
	string s,t;
	char ch;
	VI vi;
	vector<char> vc;
	VS vs;
	int reserve_vi = 100;
	map<int, int> table; 
	string str2, str3;
	map<char, string> vowel;
	vector<char> vowel_vec = {'a', 'e', 'i', 'o', 'u'};

	//cin >> n >> m;
	cin >> a >> b;
	//cin >> a >> b >> c;
	//cin >> a >> b >> c >> d;
	//cin >> str;
	//cin >> str >> str2 >> str3;
	//cin >> n;
	
	//cin >> s >> t;
	//cin >> ch;
	//cin >> a >> ch >> b;
	

	cout << (a+b)%24 << endl;
	//cout << accumulate(vi.begin(), vi.begin()+n, 0) << endl;
	//replace(ALL(str), ',', ' ');

	//swap(a, b);
	//vi.resize(N);
	//fill(vi.begin(), vi.end(), 1);
	//vi.reserve(reserve_vi);
	//vi.PB(n);

	//vc.resize(5);
	//vc[i] = (str[i]);

	//sort(vc.begin(), vc.end(), greater<char>());
	//sort(vc.begin(), vc.end());

	//for(auto itr = table.begin(); itr != table.end(); ++itr) {
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <set>
#include <map>
using namespace std;

void solve(vector<string> arr) {
    /*
    for (int i = 0; i < 9; i++) {
        for (int j = 0; j < 9; j++) {
            cout << arr[i][j];
            if ((j+1)%3 == 0) {
                cout << " ";
            }
        }
        cout << endl;
        if ((i+1)%3 == 0) {
            cout << endl;
        }
    }
    */

    int i = 0;
    for (int k = 0; k < 3; k++) {
        int tmp = k;
        for (int j = 1; j <= 3; j++) {
            arr[i][tmp] = arr[i][tmp] == '1' ? '2' : '1';
            tmp+=3;
            i+=1;
        }
    }


    /*
    for (int i = 0; i < 9; i++) {
        for (int j = 0; j < 9; j++) {
            cout << arr[i][j];
            if ((j+1)%3 == 0) {
                cout << " ";
            }
        }
        cout << endl;
        if ((i+1)%3 == 0) {
            cout << endl;
        }
    }
    */
    for (string s : arr) {
        cout << s << endl;
    }

}

int main()
{
    int a;
    cin >> a;
    cout << a + pow(a, 2) + pow(a, 3) << endl;



}


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

using ll = long long;

void check(vector<string> x) {
    rep(i, x.size()) {
        cout << x[i] << "\n";
    }
    cout << "\n";
}

int main() {
    int H, W, K;
    cin >> H >> W >> K;
    vector<string> b(H), c(H);
    rep(i, H) {
        cin >> b[i];
        b[i].push_back('.');
        //cout << b[i] << i << "\n";
    }
    //rep(i, H) cout << c[i] << "\n";
    int maxans = 0;
    rep(j, W) rep(j0, H) {
        rep(i, H) c[i] = b[i];
        int ans = 0;
        c[j0][j] = '0';
        //check(c);
        int score = 1;
        rep(i, 900) {
            bool f = true;
            //石の落下
            //cout << "drop\n";
            rep(k, W) {
                //cout << "k=" << k << "\n";
                for (int l = H - 1; l > 0; l--) {
                    //cout << "l=" << l << "\n";
                    if (c[l][k] == '0') {
                        int m = 1;
                        while (l - m >= 0 && c[l - m][k] == '0') m++;
                        if (l - m >= 0) {
                            for (int n = l; n - m >= 0; n--) {
                                c[n][k] = c[n - m][k];
                            }
                            rep(n, m) c[n][k] = '0';
                            //check(c);
                        }
                    }
                }
            }
            //check(c);
            //K個並んでいるところを消す
            rep(k, H) {
                //cout << "k=" << k << "\n";
                int l = 0, r = 0;
                while (r < W) {
                    //cout << "l=" << l << " r=" << r << "\n";
                    if (c[k][l] == '0') {
                        l++;
                        r = l;
                        continue;
                    }
                    if (c[k][r] != c[k][r + 1]) {
                        if (r - l + 1 >= K) {
                            ans += score * (r - l + 1) * (c[k][l] - '0');
                            for (int m = l; m <= r; m++) {
                                c[k][m] = '0';
                            }
                            f = false;
                            //cout << "!\n";
                            //check(c);
                        }
                        r++;
                        l = r;
                    } else {
                        r++;
                    }
                }
            }
            if (f) break;
            score *= 2;
        }
        maxans = max(maxans, ans);
    }
    cout << maxans << "\n";
}

Measured memory_bytes: 256
#include<cstdio>

int main() {
    int a,b,c,n;
    int s = 0;
    scanf("%d %d %d",&a,&b,&c);
    for(int i = a;i <= b;i++) {
        if(a <= i && i <= b && c % i == 0) {
            s += 1;
        }
    }
    printf("%d\n",s);
    return 0;
}


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


int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    int now = 1;
    rep(i,n){
        if(a[i] == now) now++;
    }
    int ans = n - now + 1;
    if(ans != n) cout << ans << endl;
  	else cout << -1 << endl;
}

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

using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define RE(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(int)(n)-1)
#define R(i,n) REP(i,n)
#define VI vector<int>
#define PII pair<int,int>
#define LD long double
#define FI first
#define SE second
#define st FI
#define nd SE
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())

template<class C> void mini(C& _a4, C _b4) { _a4 = min(_a4, _b4); }
template<class C> void maxi(C& _a4, C _b4) { _a4 = max(_a4, _b4); }

template<class TH> void _dbg(const char *sdbg, TH h){ cerr<<sdbg<<'='<<h<<endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
  while(*sdbg!=',')cerr<<*sdbg++;cerr<<'='<<h<<','; _dbg(sdbg+1, a...);
}

template<class T> ostream& operator<<(ostream& os, vector<T> V) {
  os << "["; for (auto& vv : V) os << vv << ","; os << "]";
  return os;
}

#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (__VA_ARGS__)
#define cerr if(0)cout
#endif


int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  int a,b;
  cin >> a >> b;
  if(a > 0){
    cout << "Positive\n";
  } else if(b >= 0){
    cout << "Zero\n";
  } else if((b - a)&1){
    cout << "Positive\n";  
  }else{
    cout << "Negative\n";
  }
}


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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using Pair = pair<int, int>;
const ll mod = 1e9 + 7;


template<class T>
T gcd(T a, T b)
{
  if(a && b) {
    return gcd(min(a, b), max(a, b) % min(a, b));
  } else {
    return a;
  }
}

template<class T>
T lcm(T a, T b)
{
  return a / gcd(a, b) * b;
}

ll power(ll base, ll exponent, ll module)
{
  if(exponent % 2) {
    return power(base, exponent - 1, module) * base % module;
  } else if(exponent) {
    ll root_ans = power(base, exponent / 2, module);
    return root_ans * root_ans % module;
  } else {
    return 1;
  }
}

struct combination
{
  vector<ll> fact, inv;
  combination(int sz) : fact(sz + 1), inv(sz + 1)
  {
    fact[0] = 1;
    for(int i = 1; i <= sz; i++) {
      fact[i] = fact[i - 1] * i % mod;
    }
    inv[sz] = power(fact[sz], mod - 2, mod);
    for(int i = sz - 1; i >= 0; i--) {
      inv[i] = inv[i + 1] * (i + 1) % mod;
    }
  }
  ll Pair(int n, int r)
  {
    if(r < 0 || n < r) return 0;
    return (fact[n] * inv[n - r] % mod);
  }
  ll C(int p, int q)
  {
    if(q < 0 || p < q) return 0;
    return (fact[p] * inv[q] % mod * inv[p - q] % mod);
  }
};

template<typename T>
void print_vec(vector<T>& v)
{
  for(const auto& e: v) {
    cout << e << " ";
  }
  cout << endl;
}
template<typename T>
void print_2dvec(vector<vector<T>>& m)
{
  for(const auto& v: m) {
    for(const auto& e: v) {
      cout << e << " ";
    }
    cout << endl;
  }
}



struct Edge
{
  int to, id;
  Edge(int to, int id): to(to), id(id) {}
};

vector<Edge> g[50];
vector<int> es;

bool dfs(int v, int tv, int p=-1)
{
  if (v == tv) {
    es = vector<int>();
    return true;
  }
  for (Edge e: g[v]) {
    if (e.to == p) continue;
    if (dfs(e.to, tv, v)) {
      es.push_back(e.id);
      return true;
    }
  }
  return false;
}


int main(int argc, char const* argv[])
{
  int n, m;
  cin >> n;
  REP(i, n - 1) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    g[a].emplace_back(b, i);
    g[b].emplace_back(a, i);
  }

  cin >> m;
  vector<ll> eset(m);
  REP(i, m) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    dfs(a, b);
    for(int e: es) {
      // cout << "e: " << e << "\n";
      eset.at(i) |= 1ll << e;
    }
    // cout << "====" << "\n";
  }

  ll ans = 0;
  REP(i, 1 << m) {
    ll mask = 0;
    REP(j, m) {
      if (i >> j & 1) mask |= eset.at(j);
    }
    // cout << "mask: " << mask << "\n";
    int white = __builtin_popcountll(mask);
    ll now = 1ll << (n - 1 - white);
    if (__builtin_popcountll(i) % 2 == 0) ans += now;
    else ans -= now;
  }

  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 384
import bisect
def main():
    N, M, K = map(int, input().split())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    bt = []
    at = []
    at.append(0)
    bt.append(0)
    for i in range(M):
        bt.append(bt[-1] + B[i])
    for i in range(N):
        at.append(at[-1] + A[i])
    m = 0
    for i in range(N+1):
        t = K - at[i]
        if t < 0:
            break
        j = bisect.bisect_right(bt, t)
        m = max(m, i+j-1)
    return m
print(main())


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

int main()
{
  int N; cin >> N;
  vector<int> a(N);
  for (int i=0; i<N; i++){
    cin >> a[i];
  }

  vector<vector<ll>> dp(N+1, vector<ll>(N+1, 0));
  for (int len=1; len<=N; len++) {
    for (int i=0; i+len<=N; i++) {
      int j = i+len;
      if ((N-len)%2 == 0) {
        // dp[i,j) = max(dp[i,j-1)+a[i] , a[i]+dp[i+1, j))
        dp[i][j] = max(dp[i][j-1]+a[j-1], a[i]+dp[i+1][j]);
      } else {
        // dp[i,j) = min(dp[i,j-1)-a[i] , -a[i]+dp[i+1, j))
        dp[i][j] = min(dp[i][j-1]-a[j-1], -a[i]+dp[i+1][j]);
      }
    }
  }
  cout << dp[0][N] << endl;

  return 0;
}


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

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

	int a,b,k;
	cin>>a>>b>>k;
	for(int i=min(a,b);i>=1;i--){
		if(a%i==0 && b%i==0) k-=1;
		if(k==0){
			cout<<i<<"\n";
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
//↓見なくていいよ！ここから--------------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
var obj;
var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + (end) + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  var returnObj = {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(!this.hasNext()){throw "ArrayIndexOutOfBoundsException これ以上ないよ";}else{var returnInput = this.list[this.index];this.index++;return returnInput;}}
  };
  return returnObj;
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す 1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//↑見なくていいよ！ここまで--------------------------------------------------
function Main(){
	var N = nextInt();
	var list = [];
	for(var i = 0; i < N; i++){
		var a = nextInt();
		if(i == 0){
			list.push(a);
			continue;
		}
		var index = binarySearch(list,a);
		if(index == list.length){
			list.push(a);
		}else{
			list[index] = a
		}
		//myerr(list);
	}
	myout(list.length);
}
function binarySearch(list,search){
  //listはあらかじめ昇順ソート済みとする。右側が有効エリア、左側が無効エリアと仮定し、
  //searchによって返す要素(インデックス)は ok:有効な部分の最小値、ng:無効な部分の最大値
  var ng = -1;
  var ok = list.length;
  var center;
  while(Math.abs(ok - ng) > 1){
    center = Math.floor((ok + ng) / 2);
    if(list[center] < search){
       ok = center;
    }else{
       ng = center;
    }
  }
  return ok;
  //return ng;
}

Measured memory_bytes: 45016
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
typedef long long ll;

int main(){
  string s;
  cin >> s;
  int n = s.size();
  rep(i,n){
    if(s[i] == ',') cout << " ";
    if(s[i] != ',') cout << s[i];
  }
  cout << endl;
}

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()      //昇順
#define RALL(obj) (obj).rbegin(), (obj).rend()   //降順
#define print(obj) cout << obj << endl
#define scan(obj) cin >> obj

typedef long long ll;

using namespace std;

int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    print(min(b / a, c));
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
    int a,b;
    cin >> a;
    cin >> b;
    if(a > b){
      cout << "a" << " > " << "b" << endl;
    }else if(a < b){
      cout << "a" << " < " << "b" << endl;
    }else{
      cout << "a" << " == " << "b" << endl;
    }
    return 0;
}



Measured memory_bytes: 3088
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define F0(i,n) for (int i = 0; i < n; i++)
#define F1(i,n) for (int i = 1; i <= n; i++)
#define CL(a,x) memset(x, a, sizeof(x));
#define SZ(x) ((int)x.size())
const double eps = 1e-10;
const int inf = 1000000009;
int i, j, k, m, n, l;
int ans;

int good[501][501], dead, kill[501];
int x[100001], y[100001];
vector<pii> adj[501];

void dfs(int i, int t) {
	if (dead) return;
	for (pii p : adj[i]) {
		if (dead) return;
		if (p.second < t) {
			if (kill[p.first]) {
				dead = 1;
				return;
			}
			kill[p.first] = 1;
			dfs(p.first, p.second);
		}
	}
}

int main() {
//	freopen("x.in", "r", stdin);

	cin >> n >> m;
	F0(i, m) {
		cin >> x[i] >> y[i];
		x[i]--;
		y[i]--;
		adj[x[i]].push_back(pii(y[i], i));
		adj[y[i]].push_back(pii(x[i], i));
	}

	F0(i, n) F0(j, i) {
		dead = 0;
		F0(j, n) kill[j] = 0;
		dfs(i, m);
		if (kill[j]) continue;
		dfs(j, m);
		if (!dead) ans++;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int arr[MAX],segment_tree[MAX];
void Construct_Tree(int low,int high,int pos)
{
    if(low==high)
    {
        segment_tree[pos]=arr[low];
        return ;
    }
    int mid=(low+high)/2;
    Construct_Tree(low,mid,pos*2+1);
    Construct_Tree(mid+1,high,pos*2+2);
    segment_tree[pos]=__gcd(segment_tree[2*pos+1],segment_tree[2*pos+2]);
}
int Range_min_query(int st,int en,int low,int high,int pos)
{

    if(st<=low && en>=high)
        return segment_tree[pos];//total overlap

    if(st>high || en<low)
        return 0;// no overlap

    int mid=(low+high)/2;

    return __gcd(Range_min_query(st,en,low,mid,2*pos+1),Range_min_query(st,en,mid+1,high,2*pos+2));
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    int n;
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>arr[i];
    int mx=1;
    Construct_Tree(0,n-1,0);
    for(int i=0; i<n; i++)
    {
        int l=Range_min_query(0,i-1,0,n-1,0);
        int r=Range_min_query(i+1,n-1,0,n-1,0);
        mx=max(mx,__gcd(l,r));
    }
    cout<<mx<<endl;


    return 0;
}


Measured memory_bytes: 5028
import java.io.*;
import java.util.*;

public class Main {

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null; }
        String next() { while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try { tokenizer = new StringTokenizer(reader.readLine()); } 
                catch (IOException e) { throw new RuntimeException(e);} }
            return tokenizer.nextToken(); }
        public int nextInt() { return Integer.parseInt(next()); }
        public long nextLong() { return Long.parseLong(next()); }
        public double nextDouble() { return Double.parseDouble(next()); }
    }

    static InputReader r = new InputReader(System.in);
    static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) {
        
        int n = r.nextInt(); // items
        int m = r.nextInt(); // tickets
        PriorityQueue<Integer> q = new PriorityQueue<Integer>(new S());
        for(int i = 1; i <= n; i++){
            q.add(r.nextInt());
        }
        for(int i = 1; i <= m; i++){
            q.add(q.remove() / 2);
        }
        long sum = 0;
        while(q.size() > 0){
            sum += q.remove();
        }
        pw.println(sum);
        pw.close();
    }

    static class S implements Comparator<Integer>{
        public int compare(Integer a, Integer b){
            return b - a;
        }
    }
}

/**
                _        _                 _                                                
               | |      | |               | |                                               
   ___ ___   __| | ___  | |__  _   _    __| | __ _ _ __ _ __ ___ _ __     _   _  __ _  ___  
  / __/ _ \ / _` |/ _ \ | '_ \| | | |  / _` |/ _` | '__| '__/ _ \ '_ \   | | | |/ _` |/ _ \ 
 | (_| (_) | (_| |  __/ | |_) | |_| | | (_| | (_| | |  | | |  __/ | | |  | |_| | (_| | (_) |
  \___\___/ \__,_|\___| |_.__/ \__, |  \__,_|\__,_|_|  |_|  \___|_| |_|   \__, |\__,_|\___/ 
                                __/ |                               ______ __/ |            
                               |___/                               |______|___/             
 */

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


char w[100];
int len;
int cnt[26];

int main(void) {
  cin >> w;
  len = strlen(w);

  REP(i, 0, 26) {
    cnt[i] = 0;
  }

  REP(i, 0, len) {
    cnt[w[i] - 'a']++;
  }

  REP(i, 0, 26) {
    if(cnt[i] % 2 != 0) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if(s.size() < 4) cout << "No" << endl;
    else if(s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I'){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3648
package main

import (
	"fmt"
)

func main() {
	var k int
	fmt.Scan(&k)

	x := 7 % k
	for i := 1; i <= k; i++ {
		if x == 0 {
			fmt.Println(i)
			return
		}
		x = (x*10 + 7) % k
	}
	fmt.Println(-1)
}


Measured memory_bytes: 1784
#include<bits/stdc++.h>
#define X first
#define Y second
#define pb emplace_back
#define FOR(i,a,b) for(int (i)=(a);i<(b);++(i))
#define EFOR(i,a,b) for(int (i)=(a);i<=(b);++(i))
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define reps(X,S,Y) for (int (X) = S;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define rreps(X,S,Y) for (int (X) = (Y)-1;(X) >= (S);--(X))
#define all(X) (X).begin(),(X).end()
#define rall(X) (X).rbegin(),(X).rend()
#define eb emplace_back
#define UNIQUE(X) (X).erase(unique(all(X)),(X).end())

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef ll LL;
typedef pii PII;
typedef pll PLL;
template<class T> using vv=vector<vector<T>>;
template<class T> inline bool MX(T &l,const T &r){return l<r?l=r,1:0;}
template<class T> inline bool MN(T &l,const T &r){return l>r?l=r,1:0;}
const ll MOD=1e9+7;

int N;
string S;
char buf[1145141];
int Q;

int main() {
  scanf("%d", &N);
  scanf("%s", buf);
  S = buf;
  scanf("%d", &Q);
  rep(_, Q) {
    int k;
    scanf("%d", &k);
    deque<pii> deq;
    int base = 0;
    LL sum = 0;
    LL ans = 0;
    rrep(i, N) {
      while (!deq.empty() && deq.front().first - i >= k) {
        sum -= base+deq.front().second;
        deq.pop_front();
      }

      if (buf[i] == 'C') {
        deq.push_back(pii(i, -base));
      } else if (buf[i] == 'M') {
        base++;
        sum += deq.size();
      } else if (buf[i] == 'D') {
        ans += sum;
      }
    }
    printf("%lld\n", ans);
  }
}


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

using namespace std;

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

    int adj[n][n];
    int inf = 2001;

    for(int i = 0; i < n; i++) {
        for(int j = 0; j < n; j++) {
            int k; cin >> k;
            adj[i][j] = k == -1 ? inf : k;
        }
    }

    int sd[n] = {1};
    int ans = 0;

    while(true) {
        int a = -1, c = inf;

        for(int i = 0; i < n; i++) {
            if(sd[i] == 0) { 
                if(a == -1) {
                    a = i;
                }
                continue;
            }
            for(int j = 0; j < n; j++) {
                if(adj[i][j] < c && sd[j] == 0) {
                    c = adj[i][j];
                    a = j;
                }
            }
        }

        if(a == -1) break;

        ans += c;
        sd[a] = 1;
    }

    cout << ans << endl;

}

Measured memory_bytes: 3100
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


def main():
    S = input()
    result = 'Yes'
    for i, s in enumerate(S):
        if i % 2 == 0:
            if s not in ['R', 'U', 'D']:
                result = 'No'
        else:
            if s not in ['L', 'U', 'D']:
                result = 'No'

    print(result)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
p = sorted(p)[-X:]
q = sorted(q)[-Y:]
pq = p + q
pq.sort()
r.sort()
N = X + Y
cnt = 0

from collections import deque
pq = deque(pq)
r = deque(r)

pq_max = pq.pop()
r_max = r.pop()
emp = deque()

for _ in range(N):
    if pq_max >= r_max:
        cnt += pq_max
        if pq == emp:
            pq_max = 0
        else:
            pq_max = pq.pop()
    else:
        cnt += r_max
        if r == emp:
            r_max = 0
        else:
            r_max = r.pop()

print(cnt)

Measured memory_bytes: 23328
//Author: Fuadul Hasan(fuadul202@gmail.com)
#include<bits/stdc++.h>
using namespace std;

#define ll long long
const int N   = 2e5 + 5;

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

	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}	
	int cnt = 0;
	for(int i=0;i<n;i++){
		bool f = true;
		for(int j=0;j<i;j++){
			if(a[j]>a[i]){
				f = false;
			}
		}
		if(f){
			cnt++;
		}
	}


	cout<<cnt<<endl;	

	return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    ll X;
    cin >> X;
    ll t = 0;
    for (ll n = X; n > 0; n /= 10)
        t += n % 10;

    if (X % t == 0)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main()
{
	int n[5],i,b=0,r;
	scanf("%d %d %d %d %d",&n[0],&n[1],&n[2],&n[3],&n[4]);
	while(b==0)
	{
		b=1;
		for(i=0;i<4;i++)
		if(n[i]<n[i+1])r=n[i],n[i]=n[i+1],n[i+1]=r,b=0;
	}
	printf("%d",n[0]);
	for(i=1;i<5;i++)
	printf(" %d",n[i]);
	printf("\n");
	return 0;
}

Measured memory_bytes: 0
#include <cstdio>
#include <vector>
#include <utility>
using namespace std;

int main() 
{
	long long n;
	scanf("%lld", &n);
	vector<pair<long long, int> > fact;
	for (int i = 2; (long long)i * i <= n; ++i) if (!(n % i)) {
		fact.push_back(make_pair(i, 0));
		do {
			++fact.back().second;
			n /= i;
		} while (!(n % i));
	}
	if (n > 1) fact.push_back(make_pair(n, 1));
	int op = 0;
	for (int i = 0; i < fact.size(); ++i) {
		for (int j = 1; j <= fact[i].second; ++j) {
			++op;
			fact[i].second -= j;
		}
	}
	printf("%d\n", op);
	return 0;
}


Measured memory_bytes: 3140
#include <map>
#include <string>
#include <iostream>
using namespace std;
const int mod = 1000000007;
const string cand = "ATGC";
bool valid(string last) {
	if (last.size() < 3) return true;
	if (last.find("AGC") != string::npos) return false;
	for (int i = 1; i < last.size(); ++i) {
		swap(last[i - 1], last[i]);
		if (last.find("AGC") != string::npos) return false;
		swap(last[i - 1], last[i]);
	}
	return true;
}
map<string, bool> vis[109];
map<string, int> dp[109];
int solve(int limit, string last) {
	if (limit == 0) {
		return 1;
	}
	if (vis[limit][last]) return dp[limit][last];
	int ans = 0;
	for (int i = 0; i < 4; ++i) {
		string nxt = last + cand[i];
		if (nxt.size() >= 5) nxt = nxt.substr(1);
		if (valid(nxt)) {
			ans += solve(limit - 1, nxt);
			if (ans >= mod) ans -= mod;
		}
	}
	vis[limit][last] = true;
	dp[limit][last] = ans;
	return ans;
}
int main() {
	int n;
	cin >> n;
	int ans = solve(n, string());
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
    int n;
    cin >> n;
    set<int> a;
    for(int i = 0; i < n; i++){
        int b;
        cin >> b;
        if(a.count(b))
        a.erase(b);
        else 
        a.insert(b);
    }
    cout << a.size() << endl;
}

Measured memory_bytes: 4864
#include<cstdio>
#include<algorithm>
#include<queue>
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<stack>
#include<map>
#include<cstring>
#define eps 1e-8
#define pi acos(-1)
#define mp make_pair
#define PH push
#define pb push_back
#define PII pair<ll,ll>
#define VI vector<int>
#define fi first
#define se second
#define N(a,b) a=N(a,b)
#define Min(a,b) a=min(a,b)
#define sqr(x) ((x)*(x))
#define CL(a) memset(a,0,sizeof a)
#define fr(i,n) for(int i=1;i<=n;i++)
#define FR(i,S,n) for(int i=S;i<=n;i++)
#define dr(i,n) for(int i=n;i;i--)
#define DR(i,n,S) for(int i=n;i>=S;i--)
#define SZ(x) ((int)(x).size())
#define all(n) n.begin(),n.end()
#define rd(x) scanf("%d",&x)
#define pr(x) printf("%d",x)
#define prn(x) printf("%d\n",x)
typedef long long ll;
typedef unsigned long long ull;
ll expow(ll a,ll b,ll p) {ll v=1; for (; b; b>>=1,a=a*a%p)if (b&1)v=v*a%p; return v;}
ll inv(ll a,ll p) {return expow(a,p-2,p);}
using namespace std;
const int N=1000+10;
set<string>q;
int main(){
    string s;
    int k;
    cin>>s>>k;
    int n=s.size();
   for (int i=0;i<n;i++){
    	for (int j=1;j<=min(k,n-i);j++){
      	string t=s.substr(i,j);
        q.insert(t);
        }
    }
    auto pos=q.begin();
    for(int i=0;i<k-1;i++)pos++;
    cout<<*pos<<endl;
    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
//ranker
using namespace std;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using pii = pair<int, int>;
using pis = pair<int, string>;
using psi = pair<string, int>;
using D = double;


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

  int N;
  while(1){
    cin >> N;
    if(N==0) break;
    string moji;
    int Right=0, Left=0;
    int cnt=0;
    int memo=0;

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

      cin >> moji;
      if(moji == "lu") Left = 1;
      else if (moji == "ru") Right = 1;
      else if (moji == "ld") Left = 0;
      else Right = 0;

      if(Left == Right && Left != memo){
        cnt++;
        memo = Left;
      }
    }
    cout << cnt << endl;
}
  return 0;
}

Measured memory_bytes: 3184
n = int(input())
plist = [tuple(map(int, input().split())) for i in range(n)]
plist = sorted(plist, key = lambda x: -x[2])

for x in range(0,101):
    for y in range(0,101):
        h = -1
        for i in plist:
            diff = abs(i[0]-x) + abs(i[1]-y)
            if h == -1:
                h = diff + i[2]
            elif i[2] == 0:
                if h > diff:
                    break
            else:
                if h != diff + i[2]:
                    break
        else:
            if h <= 0:
                pass
            else:
                print("{} {} {}".format(x, y, h))

Measured memory_bytes: 3064
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>

using namespace std;

#define INF (1 << 30)
#define INFL (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define EPS 1e-10

using ll = long long;
using ull = unsigned long long;

int main() {
    ll n;
    cin >> n;
    cout << n * (n - 1) / 2 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/

int main(void){
  /*
  解法3
  0-indexed(0からn-1まで)として
  A[i]:=[0,i)までの和
  という(n+1)要素からなる累積和の配列を作っておく
  
  (答え)=((0~(i-1)までの総和)*(i番目の要素))の総和
  ということがわかるので，それを実装

  しっかり書くと
   A[1]*A[0]
  +A[2]*(A[1]+A[0])
  +A[3]*(A[2]+A[1]+A[0])
  ...
  ということがわかる

  常にMODを取らないといけないけど，2の逆元を考える必要がないので楽かも
  */
  long int n;
  scanf("%ld",&n);

  long int A[n+1];

  long int MOD=1e9+7;

  A[0]=0;
  for(int i=1;i<n+1;i++){
    scanf("%ld",&A[i]);
    A[i]+=A[i-1];
    
    //常にMODを取る！
    A[i]%=MOD;
  }

  long int ans=0;
  for(int i=1;i<n+1;i++){
    ans+=A[i-1]*(A[i]-A[i-1]+MOD);

    //常にMODを取る！
    ans%=MOD;
  }

  printf("%ld\n",ans);

  return 0;
}

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

const Int Nmax = 1<<9;

int main() {

    Int N; cin >> N;
    vector<Int> V(N), W(N);
    rep(i,N) cin >> V[i] >> W[i];
    Int Q;
    cin >> Q;
    vector<Int> v(Q), L(Q);
    Int Lmax = 0;
    rep(i,Q) {
        cin >> v[i] >> L[i];
        v[i]--;
        Lmax = max(Lmax, L[i]);
    }
    Lmax++;

    Int N2 = min(Nmax,N);
    vector<vector<Int>> dp(N2, vector<Int>(Lmax,0));

    rep(i,N2) rep(j,Lmax) {
        if (i == 0) {
            if (j >= W[0]) dp[i][j] = V[0];
        }
        else {
            int k = (i+1) / 2 - 1;
            if (j >= W[i]) dp[i][j] = max(dp[k][j], dp[k][j-W[i]] + V[i]);
            else dp[i][j] = dp[k][j];
        }
    }

    rep(i,Q) {
        if (v[i] < N2) cout << dp[v[i]][L[i]] << endl;
        else {
            vector<Int> seq(0);
            seq.push_back(v[i]);
            Int now = v[i];
            while(true) {
                now = (now+1) / 2 - 1;
                seq.push_back(now);
                if (now < N2) break;
            }
            reverse(seq.begin(),seq.end());
            Int res = seq.size() - 1;
            Int ans = dp[seq[0]][L[i]];
            for (int bit = 1; bit < (1<<res); bit++) {
                Int sum = 0, val = 0;
                rep(j,res) {
                    if (bit & (1<<j)) {
                        sum += W[seq[j+1]];
                        val += V[seq[j+1]];
                    }
                }
                if (L[i] >= sum) {
                    ans = max(ans, dp[seq[0]][L[i] - sum] + val);
                }
            }
            cout << ans << endl;
        }
    }
  
}

Measured memory_bytes: 411140
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
	unsigned short *A, *B;
	int C[VMAX+1];
	int n, i, j;
	
	scanf("%d", &n);
	
	A = malloc(sizeof(short)*n+1);
	B = malloc(sizeof(short)*n+1);
	
	/* your code */
	for(i=0; i<=VMAX; i++) C[i] = 0;
	
	for(i=0; i<n; i++){
		scanf("%hu", &A[i+1]);
		C[A[i + 1]]++;
	}
	
	for(i=1; i<=VMAX; i++) C[i] = C[i] + C[i - 1];
	
	for(j=1; j<=n; j++){
		B[C[A[j]]] = A[j];
		C[A[j]]--;
	}
	
	for(i=1; i<=n; i++){
		if(i>1) printf(" ");
		printf("%d", B[i]);
	}
	printf("\n");
	

	return 0;
}



Measured memory_bytes: 9584
#include <iostream>

using namespace std;

int main(){
  string s;
  cin >> s;
  if(s.size() < 4) {printf("NA");return 0;}

  int a=0,b=0;
  a = s[1]-'0' + (s[0]-'0') *10;
  b = s[3]-'0' + (s[2]-'0') *10;

  if(a >= 0 && a <= 99 && b > 0 && b <= 12){
    if (a > 0 && a<=12 && b >= 0 && b <=99){
      printf("AMBIGUOUS");
      return 0;
    }
    else{
      printf("YYMM");
      return 0;
    }
  }
  int t=a;
  a=b;b=t;
  if(a >= 0 && a <= 99 && b > 0 && b <= 12){
    if (a > 0 && a<=12 && b >= 0 && b <=99){
      printf("AMBIGUOUS");
      return 0;
    }
    else{
      printf("MMYY");
      return 0;
    }
  }
  printf("NA");
  return 0;
}


Measured memory_bytes: 256
import Foundation

let a = readLine() 
let str = String(UTF8String: a!)!


var mone = 0
var newString = ""
for i in str.characters {
    newString.appendContentsOf(String(i))
    if mone == 3 {
        newString.appendContentsOf(String(" "))
    }
    mone++
    
}

print(newString.uppercaseString)

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define FOR1(i, n) FOR(i, 1, n+1)
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define int long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
#define myCeil(dividend, divisor) ceil((double)(dividend) / (double)(divisor))
#define myFloor(dividend, divisor) floor((double)(dividend) / (double)(divisor))
#define calcDigits(num) floor(log10(num))+1

#define dl(line) cerr << "RUN: until " << (line) << "th line." << endl;
#define dv(name, value) cerr << (name) << " is " << (value) << endl;
#define da(v)  cerr << "["; REPI(itr, v){cerr << *itr << (itr != --v.end() ? ", " : "");} cerr << "]" << endl;
#define dpa(v) cerr << "[ " << endl;REPI(itr, v) { cerr << "  [" << (*itr).first << ", " << (*itr).second << ']' << (itr != --v.end() ? "," : "") << endl; } cerr << "]" << endl;


void solve(std::string S){
  string sunney = "Sunny";
  string cloudy = "Cloudy";
  string rainy = "Rainy";
  string ans = "";
  dv("s",S);
  if (S == sunney){ ans = cloudy;}
  else if (S == cloudy){ ans = rainy;}
  else if (S == rainy){ans = sunney;}
  cout << ans << endl;
}

signed main(){
  std::string S;
  std::cin >> S;
  solve(S);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Ms(a,b) memset(a,b,sizeof a);
#define db(x) cout<<#x<<"="<<x<<endl;
using namespace std;
int n;
int main() {
	scanf("%d",&n);
	printf("%lld\n",3ll*n*n);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fp(i, l, r) for(register int i = (l); i <= (r); ++i)
#define fd(i, l, r) for(register int i = (l); i >= (r); --i)
#define il inline
using namespace std;

il int init() {
  int n, num[3005], ans = 0;
  scanf("%d", &n);
  fp(i, 1, n) {
    scanf("%d", &num[i]);
    ans += num[i];
  }
  printf("%d\n", ans - n);
}

int main() {
  init();
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:1048576")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;
typedef tuple <int, int, int> t3;

int IT_MAX = 1 << 18;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 1234567890123456789ll;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<(n);i++)

int in[305][305];
bool chk[305];
int cnt[305];
int main() {
	int N, M, i, j, k;
	scanf("%d %d", &N, &M);
	for (i = 1; i <= N; i++) for (j = 1; j <= M; j++) scanf("%d", &in[i][j]);

	int ans = INF;
	for (i = 1; i <= M; i++) {
		for (j = 1; j <= M; j++) cnt[j] = 0;
		for (j = 1; j <= N; j++) {
			for (k = 1; k <= M; k++) if (!chk[in[j][k]]) break;
			cnt[in[j][k]]++;
		}

		int mx = 0, mxp = 0;
		for (j = 1; j <= M; j++) {
			if (mx < cnt[j]) mxp = j;
			mx = max(mx, cnt[j]);
		}
		ans = min(ans, mx);
		chk[mxp] = true;
	}
	return !printf("%d\n", ans);
}

Measured memory_bytes: 640
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

func abs(a int) int {
	if a < 0 {
		return -a
	} else {
		return a
	}
}

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func countStudents(height []int32) int32 {
	// Write your code here
	// var count int32
	ideal := make([]int32, len(height))
	for i := 0; i < len(height); i++ {
		ideal[i] = height[i]
	}

	for i := 0; i < len(ideal); i++ {
		for j := i; j < len(ideal)-1; j++ {
			if ideal[j] > ideal[j+1] {
				tmp := ideal[j]
				ideal[j] = ideal[j+1]
				ideal[j+1] = tmp
			}
		}
	}

	for i := 0; i < len(height); i++ {
		fmt.Print(height[i])
	}
	var count int32
	for i := 0; i < len(height); i++ {
		if ideal[i] != height[i] {
			count++

		}
	}

	return count
}
func main() {
	sc.Split(bufio.ScanWords)
	a:=nextInt()
	b:=nextInt()

	if a<0 && b>0 {
		fmt.Println("Zero")
	}else if (a<0 && b<0 ) && (b-a)%2==0{
		fmt.Println("Negative")
	}else{
		fmt.Println("Positive")
	}

}


Measured memory_bytes: 1772
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Si = new int[N];
   for(int i = 0; i<N;i++)
   {
		Si[i] = sc.nextInt();       
   }
   Arrays.sort(Si);
   double half = ((double)Si[0]+(double)Si[1])/2;
   for(int i = 2; i<N;i++)
   {
		half = (half+(double)Si[i])/2;
   }
   System.out.println(half);
 }
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
#define int long long
using namespace std;
string s;
main(){
cin>>s;
if(s.size()%2==1){
    cout<<"No";
    return 0;
}
string a="";
for(int k=0;k<s.size();k+=2)
    a+="hi";
if(a==s)
    cout<<"Yes";
    else cout<<"No";
return 0;
}


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

int main(){
  ll i,j;
  ll n;
  ll ans = 0;

  scanf("%lld", &n);

  ll t;
  for(i = 1;i <= n;i++){
    t = n/i;
    ans += t*(t + 1)*i/2;
  }

  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 3752
#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int main () {
  int N;
  cin >> N;
  int s[110];
  for (auto i = 0; i < N; ++i) {
    cin >> s[i];
  }
  set<int> S[110];
  S[0].insert(0);
  for (auto i = 0; i < N; ++i) {
    for (auto x : S[i]) {
      S[i+1].insert(x + s[i]);
      S[i+1].insert(x);
    }
  }
  auto it = S[N].end();
  --it;
  for (; it != S[N].begin(); --it) {
    if ((*it)%10 == 0) {
      continue;
    } else {
      cout << *it << endl;
      return 0;
    }
  }
  cout << 0 << endl;
}


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

int main()
{
    string s; cin >> s;
    if(s == "SUN") cout << 7 << endl;
    else if(s == "MON") cout << 6 << endl;
    else if(s == "TUE") cout << 5 << endl;
    else if(s == "WED") cout << 4 << endl;
    else if(s == "THU") cout << 3 << endl;
    else if(s == "FRI") cout << 2 << endl;
    else if(s == "SAT") cout << 1 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;

int main(){
    int x; cin >> x;
    while(true){
        bool ok = true;
        for(int i = 2; i < x; i++){
            if(x % i == 0){
                ok = false;
                break;
            } 
        }
        if(ok) break;
        x++;
    }
    cout << x << endl;
    return 0;
}

Measured memory_bytes: 256