akhauriyash/Code-Regression huggingface dataset:
#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 SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define RVSORT(v) sort(v.rbegin(), v.rend());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}

ll modpow(ll n,ll k){
  if(k == 1){
    return n;
  }else if(k == 0){
    return 1;
  }else if(k%2==0){
    ll memo = modpow(n,k/2)%MOD;
    return memo*memo%MOD;
  }else{
    return n * modpow(n,k-1)%MOD;
  }
}

int main(){

  int ans = 0;
  int x,y;
  cin>>x>>y;

  switch(x){
    case 1:ans+=300000;break;
    case 2:ans += 200000;break;
    case 3:ans+=100000;break;
  }
  switch(y){
    case 1:ans+=300000;break;
    case 2:ans += 200000;break;
    case 3:ans+=100000;break;
  }

  if(x==1&&y==1){
    ans+= 400000;
  }

  cout<<ans<<endl;
 

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<map>  
#include<set>
#include<iterator>
#include<list>
#include<utility>
#include<cstdlib>
#include<queue>
#include<stack>
#include<bitset>
//#include<bits/stdc++.h>
#define PI  2*acos(0.0)
#define pb push_back

       
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;



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


ll a,b,c,d,x,y;

 cin>>a>>b>>c>>d;
 
 vector<ll>v;
 v.pb(a*c);
 v.pb(a*d);
 v.pb(b*c);
 v.pb(b*d);
 
 cout<<*max_element(v.begin(),v.
 end());



	
	
	return 0;
	
	
	       /***Israil Hosen
	            Computer Science & Engineering
	         University Of Rajshahi.
	         ***/
	
	
	
}


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

const long long MOD = 1000000000 + 7;

int main()
{
	auto& in = cin;

	int N;
	in >> N;

	long long t = 1;
	long long s9 = 1;
	long long s8 = 1;
	for (int i = 0; i < N; ++i) {
		t *= 10;
		s9 *= 9;
		s8 *= 8;
		t %= MOD;
		s9 %= MOD;
		s8 %= MOD;
	}
	long long a = t - s9 - s9 + s8;
	while (a < 0)
		a += MOD;
	cout << a;

	return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF INT_MAX
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define sec second
#define fir first
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
typedef vector<int> Vec;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};



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

	int A, B, m;
	cin >> A >> B >> m;
	int a[A], b[B];
	rep(i, A) cin >> a[i];
	rep(j, B) cin >> b[j];
	int x[m], y[m], c[m];
	int ans = INF;

	rep(i, m) {
		cin >> x[i] >> y[i] >> c[i];
		x[i]--; y[i]--;
		chmin(ans, a[x[i]] + b[y[i]] - c[i]);
	}
	sort(a, a + A);
	sort(b, b + B);
	chmin(ans, a[0] + b[0]);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4224
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

const bool ready = [](){
    ios_base::sync_with_stdio(false); cin.tie(0);
    cout << fixed << setprecision(12);
    return true;
}();

const double PI = acos(-1);
using ll= long long;
#define int ll
#define fori(n) for(int i=0; i<int(n); i++)

#define cini(i) int i; cin>>i;
#define cins(s) string s; cin>>s;
#define cind(d) double d; cin>>d;
#define cinai(a,n) vi a(n); fori(n) { cin>>a[i]; }
#define cinas(s,n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a,n) vd a(n); fori(n) { cin>>a[i]; }

using pii= pair<int, int>;
using pdd= pair<double, double>;
using vd= vector<double>;
using vb= vector<bool>;
using vi= vector<int>;
using vvi= vector<vi>;
using vs= vector<string>;

void solve() {
    cini(a);
    cins(s);
    int b=0;
    for(char c : s) {
        if(c=='.')
            continue;
        b*=10;
        b+=c-'0';
    }

    int ans=(a*b)/100;
    cout<<ans<<endl;
}

signed main() {
    solve();
}

// FIRST THINK, THEN CODE
// DO NOT JUMP BETWEEN PROBLEMS


Measured memory_bytes: 3656
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
using namespace std;
#define re register
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
int n,a[1000002],m,k;
char s[2000002];
int main(){
	scanf("%s",s+1);
	n=strlen(s+1);
	for(re int i=1;i<=n;++i)k+=(s[i]-'0');
	if(k%9)puts("No");
	else puts("Yes");
}

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define INF 1000000000

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef long double ld;

int vector_finder(std::vector<int> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance(vec.begin(), itr);
  if (index != vec.size()) { // 発見できたとき
    return 1;
  } else { // 発見できなかったとき
    return 0;
  }
}

struct edge_t {
  int dest;
  int weight;
};

struct vertex_t {
  vector<edge_t> edges;
  vector<int> weight;

  // for dijkstra
  bool done; // confirm or not
  int cost;  // now cost
  int from;

  bool operator<(const vertex_t &another) const { // priority --> min
    return another.cost < cost;                   // order(cost)
  }

  bool operator>(const vertex_t &another) const { // priority --> min
    return another.cost > cost;                   // order(cost)
  }

  bool operator==(const vertex_t &another) const {
    return another.cost == cost; // order(cost)
  }

  vertex_t() {
    cost = INF;
    done = false;
  }
};

int bellman_ford(vector<vertex_t> &graph, int size, int start) {
  int i, j, k, count = 0;
  bool flag = false;
  graph[start].cost = 0;
  REP(i, size) {
    REP(j, size) {
      vertex_t cur = graph[j];
      for (edge_t edge : cur.edges) {
        if (cur.cost + edge.weight < graph[edge.dest].cost) {
          if (i == size - 1)
            flag = true;
          graph[edge.dest].cost = cur.cost + edge.weight;
        }
      }
    }
  }
  if (flag) {
    return 1;
  } else {
    return 0;
  }
}

class tree_t {
  public:
  bool is_leaf;
  tree_t *right;
  tree_t *left;

  tree_t() {
    is_leaf = false;
    right = NULL;
    left = NULL;
  }
};

vector<string> splitstr(const string &s, char delim) {
  vector<string> elems;
  string item;
  for (char ch : s) {
    if (ch == delim) {
      if (!item.empty())
        elems.push_back(item);
      item.clear();
    } else {
      item += ch;
    }
  }
  if (!item.empty())
    elems.push_back(item);
  return elems;
}

////////////////////////// let's code! /////////////////////////////

int i, j, k;

///// variables frequent to use /////

unsigned GetDigit(unsigned num) {
  unsigned digit = 0;
  while (num != 0) {
    num /= 10;
    digit++;
  }
  return digit;
}

int main() {

  int N;
  cin >> N;

  int H[N];

  REP(i, N) {
    cin >> H[i];
  }

  H[0]--;
  for (i = 1; i < N; i++) {
    //現在のマスが前のマスより高い場合 -> 下げる
    //そのままの場合　現状維持
    //低い場合　→　あげる　一緒にならなかったら失敗

    if (H[i] > H[i - 1]) {
      H[i]--;
    } else if (H[i] == H[i - 1]) {
      // do nothing
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


Measured memory_bytes: 640
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector") 
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

#define int long long
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp(a, b) make_pair(a, b)
#define ret(a) {cout << a; exit(0);}

using namespace std;

mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b,ll mod) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

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

const int N = 2e5 + 123;
int n , m , k;
int a[N] , x[N] , y[N];                                             
string s;
main(){
	ios::sync_with_stdio(0); cin.tie(0);cout.tie(0);
	cin >> n;
	vector < int > v;
	int F = 1;
	for(int i = 1 ; i <= n ;i++){
		cin >> x[i] >> y[i];
		v.pb(i);
		F *= i;
	}
	ld res = 0;
	do{
		ld cur = 0;
		for(int j = 1 ; j < sz(v) ; j++){
			int i = v[j] , id = v[j - 1];
			cur += sqrt((x[i] - x[id])*(x[i] - x[id]) + (y[i] - y[id])*(y[i] - y[id]));
		}
		res += cur;		
	}while(next_permutation(all(v)));
	cout << setprecision(12) << fixed << res/(ld)F;
}


Measured memory_bytes: 256
/*
[agc032] A - Limited Insertion
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;

const int MAX_N = 100;

int N;
vector<int> b;

void solve() {
    deque<int> ans;

    for (int j = 0; j < N; j++) {
        bool updated = false;
        for (int i = b.size() - 1; i >= 0; i--) {
            if (b[i] == i) {
                b.erase(b.begin() + i);
                ans.push_front(i);
                updated = true;
                break;
            }
        }

        if (!updated) {
            cout << -1 << endl;
            return;
        }
    }

    for (int i = 0; i < N; i++) {
        cout << ans[i] + 1 << endl;
    }
}

int main() {
    cin >> N;
    b.resize(N);
    for (int i = 0; i < N; i++) {
        cin >> b[i];
        b[i]--;
    }

    solve();

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <tuple>
#include <cmath>
#include <iomanip>
#include <map>
#include <cstring> //memset(dp,0,sizeof(dp))
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define repp(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
//小数点以下　cout << fixed << setprecision(10) << num << endl;
//桁数はlog10(mid)でやれ　log(mid)/log(10)はWA
//long*long<0で判定するな
//開区間と閉区間
//アルファベットが何番目かは x=s[i]-'a'
//bfsはmain()内で　rep(i,h)rep(j,w)rep(i,4)でバグ
//切り上げ：(a+(b-1))/b
//32bit以上は 1ull<<j]
// map 初期値0 for(auto itr=mp.begin();itr!=mp.end();++itr) itr->fi itr->se で全探索
// for(auto u:mp) u.fi u.se も可能

ll n,m,v,p;
vector<ll> a;

bool C(int x){
    ll res=m*(p-1);
    if(a[x]+m-a[n-p]<0) return 0;
    res+=m*(x+1);
    for (ll j=x+1;j<=n-p;j++){
        res+=a[x]+m-a[j];
    }
    if(res>=v*m) return 1;
    else return 0;
}
int main(){
    cin >> n >> m >> v >> p;
    a.resize(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    
    int l=-1,r=n-p;
    while(r-l>1){
        int mid=(l+r)/2;
        if(C(mid)) r=mid;
        else l=mid;
    }
    cout << n-r << endl;
}



Measured memory_bytes: 1024
#include <stdio.h>

int n, l, a[100000];

int main() {
	scanf("%d%d", &n, &l);
	
	for(int i = 0; i < n; i++) { scanf("%d", &a[i]); }
	
	int pos = -1;
	for(int i = 0; i < n - 1; i++) {
		if(a[i] + a[i + 1] >= l) {
			pos = i;
			break;
		}
	}
	
	if(pos == -1){
		printf("Impossible\n");
	} else {
		printf("Possible\n");
		for(int i = 0    ; i < pos; i++) { printf("%d\n", i + 1); }
		for(int i = n - 2; i > pos; i--) { printf("%d\n", i + 1); }
		printf("%d\n", pos + 1);
	}
	
	return 0;
}


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

int main(){
    int n , k ;
    cin >> n >> k ;
    bool ar[10] ;
    for(int i=0;i<10;i++){
        ar[i] = true ;
    }
    for(int i=0;i<k;i++){
        int x ;
        cin >> x ;
        ar[x] = false ;
    }
    for(int i=n;;i++){
        int x = i ;
        bool ok = true ;
        while(x!=0){
            if ( ar[x%10] == false ){
                ok = false ;
                break;
            }
            x /= 10 ;
        }
        if ( ok ){
            cout << i << endl;
            break;
        }
    }
    return 0 ;
}


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

using namespace std;
#define int long long
#define endl '\n'



int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int w, h; cin >> w >> h;
    int k; cin >> k;
    vector<vector<char>> c(w, vector<char>(h));
    for (int i = 0; i < w; i++) {
        for (int j = 0; j < h; j++) {
            cin >> c[i][j];
        }
    }
    int cnt = 0;
    for (int mask1 = 0; mask1 < (1 << w); mask1++) {
        for (int mask2 = 0; mask2 < (1 << h); mask2++) {
            int nk = 0;
            for (int i = 0; i < w; i++) {
                for (int j = 0; j < h; j++) {
                    if ((mask1 & (1 << i)) && (mask2 & (1 << j)) && c[i][j] == '#') nk++;
                }
            }
            if (nk == k) cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3580
function Main(input){
	var arr = [];
  
  for(var i = 0 ; i < 30; i++){
  	arr.push(0);
  }

	input = input.split("\n");
  var NM = input.shift();
  var N = ~~NM.split(" ")[0];
  
  for(var i = 0; i < N; i++){
  	var KA = input.shift().split(" ").map(a=>~~a);
    var K = ~~KA.shift();
    for(var a of KA){
    	arr[a-1] += 1;
    }
  }
  
  var cnt = 0;
  
  for(var a of arr){
  	if(a == N)cnt++;
  }
  
  return cnt;
}

// If you are interested in the algorithms I used, 
// there is no need to read down from this line.

((b,c,d)=>"undefined"!=typeof require?console.log(Main(require("fs").readFileSync("/dev/stdin","utf8"))):[b=b.split("\n").slice(1,-1).join("\n"),c=function(){try{return Main(b)}catch(f){return f.stack||f.message}}(),d=typeof c,"string"==d||(c=JSON.stringify(c)),$("<form>").append([[10,b],0,[1,d],0,[10,c]].map(f=>$(f?"<textarea>":"<br>",f&&{rows:f[0],cols:40,text:f[1]}))).appendTo("body")])(`
3 4
2 1 3
3 1 2 3
2 3 2
`);

Measured memory_bytes: 7628
r=".IVXLCDM",n=s=p=0,require("fs").readFileSync("/dev/stdin","utf8").split('').map(function(i){i=='\n'?(console.log(s),n=s=p=0):s+=(n=Math.pow(10,~~((n=r.indexOf(i))/2))/(2-(n%2))),n>p?s-=p*2:0,p=n})

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N; cin >> N;
    vec a(N);
    rep(i, N) cin >> a[i];
    a.push_back(0);
    sort(all(a));
    rep(i, N+1){
        if(i%2) a[i] = 24-a[i];
    }
    ll res = INF;
    rep(i, N+1){
        Rep(j, i+1, N+1){
            int tmp = abs(a[i]-a[j]);
            res = min(res, (ll)min(tmp, 24-tmp));
        }
    }

    cout << res << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7736
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdio>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;

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

typedef long long ll;

const int Inf = 1e9;
const double EPS = 1e-9;

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

int lcm(int a, int b) {
    return a * b / gcd(a, b);
}

int bitCount(long bits) {
    bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
    bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
    bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
    bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
    return (bits & 0x0000ffff) + (bits >>16 & 0x0000ffff);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;  cin >> n;
    int left, right;
    right = n % 100;
    left = n / 100;
    if (left >= 1 && left <= 12) {
      if (right >= 1 && right <= 12) {
        cout << "AMBIGUOUS" << '\n';
      } else {
        cout << "MMYY" << '\n';
      }
    } else {
      if (right >= 1 && right <= 12) {
        cout << "YYMM" << '\n';
      } else {
        cout << "NA" << '\n';
      }
    }

    return 0;
}


Measured memory_bytes: 256
#n=int(input())
n,m=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(q)]
b=(n-1)//2
a=b//2
ll=[[0,0]for i in range(b)]
ll[0]=[1,2]

if b//2==b/2:
    for i in range(1,b):
        if i//2!=i/2:
            ll[i]=[2+a-(i//2),2+a-(i//2)+i+1]
        else:
            if i==b-2:
                ll[i]=[3+b//2,3+b//2+b-2+1]
            else:
                ll[i]=[3+b//2+b-2+1-i//2,3+b//2+b-2+1-i//2+i+1]
else:
    for i in range(1,b):
        if i//2==i/2:
            ll[i]=[3+b//2-i//2,3+b//2-i//2+i+1]
        else:
            if i==b-2:
                ll[i]=[3+b//2+1,3+b//2+b-1+1]
            else:
                ll[i]=[3+b//2+b-1+1-(i+1)//2,3+b//2+b-1+1-(i+1)//2+i+1]            

for i in range(m):
    print(*ll[i])
    

Measured memory_bytes: 82340
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>

using namespace std;

int main(int argc, char* argv[])
{
  int N; cin >> N;
  vector<string> S(N);
  map<string, int> same;
  for (int i = 0; i < N; i++) {
    cin >> S[i];
    sort(S[i].begin(), S[i].end());
    if (same.find(S[i]) == same.end()) {
      same[S[i]] = 1;
    } else {
      same[S[i]]++;
    }
  }

  unsigned long long cnt = 0;
  for (map<string, int>::iterator it = same.begin(); it != same.end(); it++) {
    unsigned long long a = it->second;
    cnt += a*(a-1)/2;
  }

  cout << cnt << endl;
  return 0;
}


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


using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL << 60;
const ll mod = 998244353;



int main() {
	
	int n, k;
	cin >> n >> k;
	int ans = 0;

	REP(i, n) {
		int h;
		cin >> h;
		if (h >= k)ans++;
	}
	cout << ans << endl;

}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF=1e9;

int N,M;
int d[105][105],edge[105][105],used[105][105];

int main(){

cin>>N>>M;

for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
        if(i==j) d[i][j]=0;
        else d[i][j]=INF;
    }
}

for(int i=0; i<M; i++){
    int a,b,c; scanf("%d %d %d",&a,&b,&c); a--; b--;
    d[a][b]=c; d[b][a]=c; 
    edge[a][b]++; edge[b][a]++;
    used[a][b]++; used[b][a]++;
}

for(int k=0; k<N; k++){
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
        if(d[i][j]>d[i][k] + d[k][j]){
            if(edge[i][j]){
                if(used[i][j]) used[i][j]=0; 
            }
        }
        d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
    }
  }
}

int cnt=0;
for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
        if(used[i][j]) cnt++;
    }
}

cout<<M-(cnt/2)<<endl;

}

Measured memory_bytes: 384
import math

def main():
    a, b = map(str, input().split())
    a = int(a)
    b = list(b)
    del b[1]
    bb = ""
    for i in b:
        bb += i
    b = int(bb)
    ans = str(a * b)
    if len(ans) <= 2:
        print(0)
        exit()
    ans = ans[: -2]
    ans = int(ans)
    print(ans)

if __name__ == "__main__":
    main()

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

 int main(){
    int A, B;
    cin >> A >> B;
    if(8 >= A && 8 >= B) print("Yay!");
    else print(":(");
 }

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, H, D;
	cin >> N >> H >> D;
	vector<int> dp(H + 1, 0);
	vector<int> f(N + 1);
	f[0] = 1;
	int sum = 0;
	for (int i = 1; i <= N; i++) {
		f[i] = (f[i - 1] * i) % MOD;
		sum = (sum + f[i]) % MOD;
	}

	dp[1] = f[N];
	if (D < H) {
		dp[D + 1] = -f[N];
	}
	for (int i = 1; i <= H; i++) {

		dp[i] = (dp[i - 1] + dp[i]) % MOD;
		if (dp[i] < 0)dp[i] += MOD;
		if (i == H)break;



		int ad = (dp[i] * sum) % MOD;
		dp[i + 1] += ad;
		dp[i + 1] %= MOD;
		int z = i + 1 + D;
		if (z <= H) {
			dp[z] -= ad;
			dp[z] %= MOD;
		}
	}
	//cerr << dp[1] << " " << dp[2] << endl;
	cout << dp[H] << endl;
}

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

#define all(v) v.begin(), v.end()
#define mp make_pair
#define EPS (int)1e-9
#define PI acos(-1)
#define endl '\n'
#define pb push_back
#define fi first
#define se second

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

const int mod = 1000000007;


int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n, x;
	cin >> n;

	deque<int> my_dq;

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

			if(i&1)
				my_dq.push_back(x);
			else
				my_dq.push_front(x);
		}
	else
		for(int i = 1; i <= n; i++)
		{
			cin >> x;

			if(i&1)
				my_dq.push_front(x);
			else
				my_dq.push_back(x);
		}

	for(int i = 0; i < n; i++)
		cout << my_dq[i] << " ";
	return 0;	
}

Measured memory_bytes: 3072
#include<iostream>
#include<string.h>
#include<math.h>

using namespace std;

int main(){
	int tc, n, i, j;;
	
	
		cin>>n;
		
		int a, b;
		cin>>a>>b;
		
		int ans = b/n;
		ans = ans * n;
		
		if(ans>=a && ans<=b) cout<<"OK\n";
		else cout<<"NG\n";
	
	
	return 0;
}

Measured memory_bytes: 3636
/*
#include<rabbit>;
using blueHulkStress;
using AceOfSpades;
*/
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = (1e-9);
typedef long long ll;
typedef unsigned long long ull;
#define flush fflush(stdout), cout.flush()
#define all(v) ((v).begin()),((v).end())
#define rall(v) ((v).rbegin()),((v).rend())
#define clr(v,line) memset(v,line,sizeof(v))
#define rep(i,n) for(int(i)=0;(i)<(int)(n);(i)++)
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define lcm(a,b) (a*(b/__gcd(a,b)))
#define P 1000000007
#define endl '\n'
const int dx[] = {1,-1,0,0,1,-1,1,-1};
const int dy[] = {0,0,1,-1,1,-1,-1,1};
const int dxhorse[] = {-2,-2,-1,-1,1,1,2,2};
const int dyhorse[] = {1,-1,2,-2,2,-2,1,-1};

void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL);
}


int main(int argc, char const *argv[])
{
	ll a,b,x;cin>>a>>b>>x;
	
	if(!a)return cout<<b / x + 1,0;

	cout<<b / x - (a-1) / x;
}	

Measured memory_bytes: 256
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
template <class T> using vec = vector<T>;
using ll = long long;
using vi   = vec<int>;
using vvi  = vec<vi>;
using vvvi = vec<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval>newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int a,b; cin>>a>>b;
  cout << max(0,a-2*b) << endl;
  return 0;
}


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

// nが100でちょうどd回割り切れるか
bool check(int n, int d) {
  int cnt = 0;
  while (n % 100 == 0) {
    cnt += 1;
    n /= 100;
  }
  if (cnt == d) {
    return true;
  } else {
    return false;
  }
}

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

  int ans;
  int cnt = 0;
  for (int i = 1 ; i < 10000000; i++) {
    if (check(i, D)) {
      cnt += 1;
    }
    if (cnt == N) {
      ans = i;
      break;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
(let ((n (read))
      (pre -1)
      (rep 0)
      (temp 0)
      (ans 0))
  (loop repeat n do
        (setf temp (read))
        (if (eq pre temp) (progn (incf rep)
                                 (if (eq 0 (rem rep 2)) (incf ans)))
            (progn (setf pre temp)
                   (setf rep 1))))
  (princ ans))


Measured memory_bytes: 4196
time = 0
overtime = 0
n,q = map(int,input().split())
L = [input().split() for i in range(n)]

while True:
    if len(L) == 0:
        break
    else:
        s = L.pop(0)
        s[1] = int(s[1])
        if s[1] > q:
            s[1] = s[1] - q
            time += q
            L.append(s)
        else:
            time += s[1]
            print(s[0],time)


Measured memory_bytes: 17120
#include <iostream>
using namespace std;
bool flag=false;
int sum,y,ten,fifty,hun,fhun;
int a,b,c,d;
int main(){
	while(1){
		cin >>y;
		if(y==0)break;
		if(flag)cout <<endl;
		cin >>ten >>fifty >>hun >>fhun;
		sum=ten*10+fifty*50+hun*100+fhun*500;
		sum-=y;
		a=sum/500;
		sum=sum%500;
		b=sum/100;
		sum=sum%100;
		c=sum/50;
		sum=sum%50;
		d=sum/10;
		if(ten-d>0)cout << "10 "<<ten-d<<endl;
		if(fifty-c>0)cout << "50 "<<fifty-c<<endl;
		if(hun-b>0)cout << "100 "<<hun-b<<endl;
		if(fhun-a>0)cout << "500 "<<fhun-a<<endl;
		flag=true;
	}
}

Measured memory_bytes: 3020
#include <bits/stdc++.h>
using namespace std;
 
#define int long long
#define REP(i, l, r) for (int i=(l); i<(r); ++i)
#define RREP(i, r, l) for (int i=(r); i>(l); --i)
#define CASET int _T; cin >> _T; REP(caset, 0, _T)
#define print(x) cout << to_string(x) << '\n'
#define vi vector<int>
#define vb vector<bool>
#define vs vector<string>
#define vvi vector<vi>
#define vvb vector<vb>
#define pii pair<int,int>
#define t3i tuple<int,int,int>
#define mii map<int,int>
#define vpii vector<pii>
#define vt3i vector<t3i>
#define sq(x) (x)*(x)
#define inv(x) powa(x, MOD-2)
 
long long INF = 1LL<<60;
long long MOD = 998244353;

string to_string(char &c) {string x(1, c); return x;}
string to_string(const char s[]) {return (string)s;}
string to_string(string &s) {return s;}
string to_string(vb &v) {string res; for (const bool &x : v) res += to_string(x) + ' '; return res;}
template <class C> string to_string(C &v) {string res; for (auto &x : v) res += to_string(x) + ' '; return res;}
template <typename A, typename B> istream &operator>>(istream &is, pair<A, B> &pr) {is >> pr.first >> pr.second; return is;}
template <typename A> istream &operator>>(istream &is, vector<A> &v) {for (auto &x : v) is >> x; return is;}
ostream &operator<<(ostream &os, char &c) {os << (char)c; return os;}
ostream &operator<<(ostream &os, const char s[]) {os << (string)s; return os;}
ostream &operator<<(ostream &os, string &s) {for (char &c : s) os << (char)c; return os;}
template <typename A, typename B> ostream &operator<<(ostream &os, pair<A, B> pr) {os << '(' << pr.first << ", " << pr.second << ')'; return os;}
ostream &operator<<(ostream &os, vb &v) {
    bool first = true;
    os << '[';
    for (const bool &x : v) {
        if (!first) os << ", ";
        first = false;
        os << x;
    }
    os << ']';
    return os;
}
template <class C> ostream &operator<<(ostream &os, C &v) {
    bool first = true;
    os << '[';
    for (auto &x : v) {
        if (!first) os << ", ";
        first = false;
        os << x;
    }
    os << ']';
    return os;
}
string bin_string(int x) {
    const int d = 32;
    string res(d, ' ');
    REP(i, 0, d) res[d-1-i] = '0'+(x>>i & 1LL);
    return res;
}
int powa(int base, int exp) {
    int res = 1;
    while (exp) {
        if (exp&1) res = res*base % MOD;
        base = base*base % MOD;
        exp >>= 1;
    }
    return res;
}

main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    
    int n;
    cin >> n;
    vi a(n);
    cin >> a;

    int mn = INF;
    int res = 0;
    REP(i, 0, n) {
        mn = min(mn, a[i]);
        if (a[i] == mn) ++res;
    }
    print(res);
}


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

using namespace std;
int main()
{
    map<char, int> q;
    char c='a';
    while(c!='\n')
    {
        c = getchar();
        q[c]++;
    }
    for(int i='a';i<='z';i++) if(q[i]%2) printf("No\n"), exit(0);
    puts("Yes\n");
    return 0;
}


Measured memory_bytes: 256
n_cards = int(input())
taro_cards = []
for i in range(n_cards):
    taro_card = input()
    taro_cards.append(taro_card)
full_cards = []
for mark in ['S', 'H', 'C', 'D']:
    for card_number in range(13):
        full_cards.append(mark + " " + str(card_number+1))

missing_cards = []
for card in full_cards:
    if card not in taro_cards:
        missing_cards.append(card)

for missing_card in missing_cards:
    print(missing_card)



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


int main()
{

    int a,b,c,d,s,sum;
    while(~scanf("%d%d%d%d",&a,&b,&c,&d))
    {
        sum=0;
        if(a>b)
        {
            sum+=b;
        }
        else
        {
            sum+=a;
        }
        if(c>d)
        {
            sum+=d;
        }
        else
        {
            sum+=c;
        }
        printf("%d\n",sum);
    }
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<iomanip>
#include<map>
#define ll long long
#define MM(arr,x) memset(arr,x,sizeof(arr))
#define INF 10000000
using namespace std;
int main()
{
	int n,x,t;
	cin>>n>>x>>t;
	if(n%x==0) cout<<n/x*t;
	else cout<<(n/x+1)*t; 
	return 0;
}

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

int main(){
  int h,a;
  cin >> h >> a;
  int i = 0;
  while(h>0){
    h -= a;
    i++;
  }
  cout << i << endl;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define ll long long
#define eb emplace_back
#define P pair<ll,ll>
#define F first
#define S second
#define all(x)  x.begin() ,x.end()
using namespace std;
const int N=2e3+3;
ll dp[N][N]={0};

int main()
{
  ll n;
  cin>>n;
  vector<P> a(n);
   for(int i=0;i<n;i++){cin>>a[i].F;a[i].S=i;}
    sort(all(a),greater<P>());
   // for(P x:a)cout<<x.F<<" "<<x.second<<"\n";
    
  for(int i=0;i<n;i++)
      for(int  j=0;j<=i;j++){
          int r=i-j;
          dp[i+1][j]=max(dp[i+1][j],dp[i][j]+abs(n-1-r-a[i].S)*a[i].F);
        
          dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+abs(j-a[i].S)*a[i].F);
          
      }
  
  ll ans=0;
  for(int i=0;i<=n;i++)ans=max(ans,dp[n][i]);
  cout<<ans<<"\n";
      


}

Measured memory_bytes: 26236
def c_bridge_networkx():
    import networkx as nx
    N, M = [int(i) for i in input().split()]
    Edges = [tuple([int(i) for i in input().split()]) for j in range(M)]

    graph = nx.Graph()
    graph.add_nodes_from(range(1, N + 1))
    graph.add_edges_from(Edges)
    # bridges(graph): graph の橋になる辺を結ぶ頂点の組を返す
    return len(tuple(nx.bridges(graph)))

print(c_bridge_networkx())

Measured memory_bytes: 53464
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){

    for(int T, D, L; cin >> T >> D >> L, T;){
        int ans = 0;
        int lst = 0;
        for(int t = 1; t <= T; t++){
            int x;
            cin >> x;
            if(x < L)continue;
            int nxt = min(T, t + D);
            int diff = nxt - max(t, lst);
            ans += diff;
            lst = nxt;
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3016
n=int(input())
s=input()
r=s.count('R')
g=s.count('G')
b=s.count('B')
ans=0
for i in s:
  if i=='R':
    r-=1
    ans+=g*b
  elif i=='G':
    g-=1
    ans+=r*b
  elif i=='B':
    b-=1
    ans+=g*r
for i in range(n-2):
  for j in range(i+2,n):
    if (i+j)%2!=0:
      pass
    else:
      k=(i+j)//2
      if (s[i]!=s[j])and(s[i]!=s[k])and(s[j]!=s[k]):
        ans-=1
      else:
        pass
print(ans)

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

char bd[2005][2005];
int lcp[2005];
stack< pair<int,int> > stk;

int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=0;i<n;i++){
		scanf("%s",bd[i]);
	}
	int ans = max(n,m);
	for(int i=0;i<m;i++){
		while(!stk.empty()) stk.pop();
		for(int j=1;j<n;j++){
			if(lcp[j] == i){
				if(bd[j-1][i] != bd[j][i]){
					int new_lcp;
					for(new_lcp = i;new_lcp < m;new_lcp++){
						if(bd[j-1][new_lcp] == bd[j][new_lcp]) break;
					}
					lcp[j] = new_lcp;
				}else{
					int new_lcp;
					for(new_lcp = i;new_lcp < m;new_lcp++){
						if(bd[j-1][new_lcp] != bd[j][new_lcp]) break;
					}
					lcp[j] = new_lcp;
				}
			}
			//printf("%d %d %d\n", i, j, lcp[j]);
			pair<int,int> candi = {lcp[j] - i, j-1};
			while(!stk.empty()){
				//printf("loop\n");
				if(stk.top().first <= candi.first) break;
				ans = max(ans, stk.top().first * (j - stk.top().second));
				candi.second = stk.top().second;
				//printf("pop %d %d %d\n", stk.top().first, stk.top().second, stk.top().first * (j - stk.top().second));
				stk.pop();
			}
			//printf("push %d %d\n", candi.first, candi.second);
			stk.push(candi);
		}
		while(!stk.empty()){
			ans = max(ans, stk.top().first * (n - stk.top().second));
			stk.pop();
		}
	}
	printf("%d\n", ans);
}	

Measured memory_bytes: 4224
N = int(input())
p = [int(i) for i in input().split()]
ans = 0

for i in range(N-1):
    if p[i] == i + 1 and p[i+1] == i+2:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1
for i in range(N-1):
    if p[i] == i + 1:
        p[i], p[i+1] = p[i+1], p[i]
        ans += 1
if p[N - 1] == N:
    p[N-2], p[N-1] = p[N-1], p[N-2]
    ans += 1
print(ans)


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

int A, B, C;
int X, Y;
long int cost = 0;
int main(){
    cin >> A >> B >> C >> X >> Y;
    if ((A + B) <= 2 * C){
        cost = A * X + B * Y;
    }
    else{
        int min_num = min(X, Y);
        X -= min_num;
        Y -= min_num;
        cost += 2 * min_num * C;
        if (X == 0){
            cost += min(2 * C * Y, B * Y);
        }
        else{
            cost += min(2 * C * X, A * X);
        }
    }
    cout << cost << endl;
    return 0;
}

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

int main() {
  double W, H, x, y;
  cin >> W >> H >> x >> y;
  cout << fixed << setprecision(10) << (H * W) / 2 << " ";
  if(H / 2 == y && W / 2 == x) 
    cout << 1;
  else
    cout << 0;
}

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

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sumvec(vector<S>&a){return accumulate(all(a),S());}
template<class S>S maxvec(vector<S>&a){return *max_element(all(a));}
template<class S>S minvec(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

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


int main(void){
  	cin.tie(0);
  	ios::sync_with_stdio(false);
  	
    ll n;
    cin>>n;
    if(n%2==1){
        puta("No");
        return 0;
    }
    
    string s;
    cin>>s;
    string s1=s.substr(0,n/2);
    string s2=s.substr(n/2);
    Yn(s1==s2);
    
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll read(){
	ll a=0,b=getchar(),c=1;
	while(!isdigit(b))c=b=='-'?-1:1,b=getchar();
	while(isdigit(b))a=a*10+b-'0',b=getchar();
	return a*c;
}
void print(ll x){
	if(x<0)putchar('-'),x=-x;
	int y=x%10+'0';
	if(x>=10)print(x/10);
	putchar(y);
}
ll n,k,a[100005],dp[100005];
int main(){
	memset(dp,0x3f,sizeof(dp));
	n=read(),k=read();
	for(int i=0;i<n;i++)
		a[i]=read();
	dp[0]=0;
	for(int i=1;i<n;i++)
		for(int j=max(0,(int)(i-k));j<i;j++)
			dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
	print(dp[n-1]);
	return 0;
}

Measured memory_bytes: 1792
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        String s2 = in.next();
        char[] arr = s2.toCharArray();
        String res = "";
        for (int i = 0; i < arr.length - 1; i++) {
            res += arr[i];
        }
        if (s.equals(res)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}

Measured memory_bytes: 39048
#include <bits/stdc++.h>
using namespace std;
int binary(int A[],int n,int key){
    int left=0,right=n;
    while(left<right){
        int mid=((right+left)/2);
        if(A[mid]==key) return mid;
        else if (key<A[mid]) right=mid;
        else left=mid+1;
        }
    return 0;
}

int main(void){
    int key,N,q,sum=0,A[100001];
    cin >> N;
    for(int i=0;i<N;i++){
        cin >> A[i];
    }
    cin >> q;
    for(int i=0;i<q;i++){
        cin >> key;
        if(binary(A,N,key)) sum++;
    }
    cout << sum << endl;
}


Measured memory_bytes: 3516
#include <bits/stdc++.h>
using namespace std;
#define int long long   // aaaaaaaaaaaaaaaaaa
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define allr(x) (x).rbegin(),(x).rend()
#define in(s,x) s.find(x) != s.end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<pair<int,int>> VPII;
const ll mod=1000000007;
const ll INF= 1LL<<60-1;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;} ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
template<typename T, typename U>ostream& operator << (ostream& os, pair<T, U>& pair_var)
{os << pair_var.first << " " << pair_var.second ;return os;}
template<class tContainer>
long long sum(tContainer const& iContainer) {return  std::accumulate(std::begin(iContainer), std::end(iContainer), 0LL);}
 
// head
 
 
int m,n,k,res,tmp,tmp2,tmp3,h,w,x,y;
VI a;
deque<PII> que;
string s;
VI b;
vector<PII> g[2100600];
//int b[2100000];
int c[210] = {};
int rui[210000];
set<int> ch;
 
signed main() {
	cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  rep(i,0,n){
    cin>>m;
    b.pb(m);
  }
  m = 0;
  rep(i,0,n){
    if(i%2 == 0){
    m+=b[i];}
    else{
    m-=b[i];}
  }
  rep(i,0,n){
  cout<<m<<" ";
  b[i]-=m/2;
  m = b[i]*2;
  }
  cout<<endl;
    
}

Measured memory_bytes: 51444
A = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(A[int(input())-1])

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

int main(){
	int n,k;
	int ans=0;
	cin>>n>>k;
	vector<int>flag_n(n);
	rep(i,n){
		flag_n[i]=0;
	}
	rep(i,k){
		int tcnt;
		cin>>tcnt;
		rep(j,tcnt){
			int temp;
			cin>>temp;
			if(flag_n[temp-1]==0)flag_n[temp-1]=1;
		}
	}
	rep(i,n){
		if(flag_n[i]==0)ans++;
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 3632