akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iomanip>
#include<set>
#include <numeric>
#pragma region Macros
#define int long long
#define double long double
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define DIVCEIL(a,b) ((a+b-1)/b)
//int CHMAX

int intpow(int a, int n) {
	// a^nのint ver
	rep(i, n - 1)
		a *= a;
	return a;
}
int MODPOW(int a, int n, int mod) {
	// a^n mod
	int ans = 1;
	while (n > 0) {
		if (n & 1)
			ans = ans * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return ans;
}
int FACT(int a) {
	if (a == 0)
		return 1;
	else
		return a * FACT(a - 1);
}
int MODFACT(int a, int mod) {
	if (a == 0)
		return 1;
	else
		return (a * FACT(a - 1)) % mod;
}
int nPr(int n, int r) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++)
		sum *= i;
	return sum;
}
int MODnPr(int n, int r, int mod) {
	int s = n - r + 1;
	int sum = 1;
	for (int i = s; i <= n; i++) {
		sum *= i;
		sum = sum % MOD;
	}
	return sum;
}
//int nCr(int n, int r)
int nCr2(int n, int r) {
	return FACT(n) / (FACT(r) * FACT(n - r));
}
int GCD(int a, int b)
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b)
{
	return  a * b / GCD(a, b);
}
int NUMOFDIV(int n) {
	//約数の数（だっけ？）
	int ans = 0;
	REP(i, n) {
		if (n % i == 0)
			ans++;
	}
	return ans;
}
int CEIL1(int n) {
	//1桁目切り上げ
	return (n + 9) / 10 * 10;
}
int GetDigit(int n) {
	return log10(n) + 1;
}
int DIGIT(int n, int k) {
	//nのk桁目
	rep(i, k - 1)
		n /= 10;
	return n % 10;
}
int DIGITSUM(int n) {
	int sum = 0, dig;
	while (n) {
		dig = n % 10;
		sum += dig;
		n /= 10;
	}
	return sum;
}
int DIVTIME(int n, int k) {
	//nをkで何回割れるか的な
	int div = 0;
	while (n % k == 0) {
		div++;
		n /= k;
	}
	return div;
}
int binary(int n) {
	//10進数→2進数
	int ans = 0;
	for (int i = 0; n > 0; i++) {
		ans += n % 2 * intpow(10, i);
		n /= 2;
	}
	return ans;
}
int intabs(int n) {
	if (n < 0)
		return -1 * n;
	else
		return n;
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}
inline bool between(int x, int min, int max) {
	if (min < x && x < max)
		return true;
	else
		return false;
}
inline bool PRIMEOR(int x) {
	if (x == 1)
		return false;
	if (x == 2)
		return true;
	if (x % 2 == 0)
		return false;
	double sqrtx = sqrt(x);
	for (int i = 3; i <= sqrtx; i += 2) {
		if (x % i == 0)
			return false;
	}
	return true;
}
bool SQRTOR(int n) {
	if (sqrt(n) == (int)sqrt(n))
		return true;
	else
		return false;
}
// 順位付け
using namespace std;
#pragma endregion

signed main(){
	int N, ans = 0;
	cin >> N;
	vector<vector<int>> vv(10, vector<int>(10));
	REP(i, N)
		vv[DIGIT(i,GetDigit(i))][DIGIT(i,1)]++;
	REP(i, 9) {
		REP(j, 9)
			ans += vv[i][j] * vv[j][i];
	}
	cout << ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<string>
#include<climits>
#include<stack>
#include<queue>
#include<unordered_map>
#include<map>
#include<set>
#include <fstream>
#include<list>

#define loopi(x,y) for(int i = x;i<(y);i++)
#define loopj(x,y) for(int j = x;j<(y);j++)
#define rloopi(x,y) for(int i = x;i>=(y);i--)
#define rloopj(x,y) for(int j = x;j>=(y);j--)


#define nl cout<<"\n";
#define ll long long int
#define mod  1000000007


using namespace std;

int main()
{

	ios :: sync_with_stdio(false);
	cin.tie(nullptr);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n;
	cin >> n;
	vector<int> A(n);
	for (int i = 0; i < n; i++)
	{
		cin >> A[i];
	}
	long long height = 0;
	for (int i = 1; i < n; i++)
	{
		if (A[i - 1] > A[i])
		{
			height = height + A[i - 1] - A[i];
			A[i] = A[i - 1];
		}

	}

	cout << height;


	return 0;
}

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

int main()
{
     int n;
     cin>>n;
  
   vector<tuple<string,int,int>>rest(n);
  
   for(int i=0;i<n;i++)
   { 
       string name;
       int tensuu,id;
       id = i+1;
      cin>>name>>tensuu;
      tensuu=-tensuu;
     
      rest.at(i) = make_tuple(name,tensuu,id);
     
   }
     sort(rest.begin(),rest.end());
  
  for(auto x:rest)
  {
      string s;
      int p,id;
    
    tie(s,p,id) = x;
    
    cout<<id<<endl;
  }

}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>

using namespace std;

void Get(priority_queue<int64_t>& q, int64_t N) {
  for (size_t n = 0; n < N; ++n) {
    int64_t p;
    cin >> p;
    q.push(p);
  }
}

int main() {
  int64_t X, Y, A, B, C;
  cin >> X >> Y >> A >> B >> C;
  
  priority_queue<int64_t> red;
  priority_queue<int64_t> green;
  priority_queue<int64_t> trans;

  Get(red, A);
  Get(green, B);
  Get(trans, C);  

  vector<int64_t> selected;
  selected.reserve(X + Y);
  int64_t sum = 0;
  for (size_t x = 0; x < X; ++x) {
    int64_t n = red.top();
    sum += n;
    selected.push_back(n);
    red.pop();
  }
  for (size_t y = 0; y < Y; ++y) {
    int64_t n = green.top();
    sum += n;
    selected.push_back(n);
    green.pop();
  }
  sort(selected.begin(), selected.end());
  for (size_t c = 0; c < C; ++c) {
    int64_t t = trans.top();
    if (selected[c] < t) {
      sum += t - selected[c];
    } else {
      break;
    }
    trans.pop();
  }
  cout << sum << endl;
  
  return 0;
}


Measured memory_bytes: 4084
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;

void findDivisor(long long n, vector<long long>& divisor)
{
    divisor.clear();
    stack<long long> stk;
    for(long long i=1; i*i<=n; ++i){
        if(n % i == 0){
            divisor.push_back(i);
            if(i * i < n)
                stk.push(n / i);
        }
    }
    while(!stk.empty()){
        divisor.push_back(stk.top());
        stk.pop();
    }
}

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

    vector<long long> v;
    findDivisor(n, v);

    long long ans = 0;
    for(long long x : v){
        long long m = n / x - 1;
        if(x < m)
            ans += m;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ", "; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ", "; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << ", " << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << ": " << v.second << ", "; os << "}"; return os; }
template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) { vec.resize(len); for (auto &v : vec) ndarray(v, args...); }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
template<typename T1, typename T2> pair<T1, T2> operator+(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first + r.first, l.second + r.second); }
template<typename T1, typename T2> pair<T1, T2> operator-(const pair<T1, T2> &l, const pair<T1, T2> &r) { return make_pair(l.first - r.first, l.second - r.second); }
#define f first
#define s second
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long num;
    cin >> num;
    if(num % 2 == 1)
        cout << 0;
    else {
        long long ans = 0, expo = 10;
        while(num >= expo) {
            ans += (num / expo);
            expo *= 5;
        }
        cout << ans;
    }
}

Measured memory_bytes: 3580
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner kb = new Scanner(System.in);
		int i = kb.nextInt();
		int j = kb.nextInt();
		if (i < 10) {
			System.out.println(j + 100 * (10 - i));
		} else {
			System.out.println(j);
		}
		kb.close();
	}

}


Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")


int main() {

    ll n,a; cin >> n;
    map<ll,ll> mp;
    set<ll> st;
    ll ans = 1;
    ll prev,val;
    bool f = false;

    rep(i,n){
        cin >> a;
        if(mp.count(a) == 0) mp[a] = 1;
        else mp[a] ++;
        st.insert(a);

        if(a == 0 && i != 0){
            cout << 0;
            return 0;
        }
        if(a == 0 && i == 0) f = true;
    }

    if(!f){
        cout << 0;
        return 0;
    }



    for(auto itr = st.begin(); itr != st.end(); ++itr) {
        if(*itr == 0) {
            prev = mp[*itr];
            val = *itr;
        }
        else{
            if(*itr - val != 1){
                cout << 0;
                return 0;
            }
            if(prev == 0){
                cout << 0;
                return 0;
            }
            rep(i,mp[*itr]){
                ans = (prev*ans)%998244353;
            }
            prev = mp[*itr];
            val = *itr;
        }
    }
    cout << ans;


    return 0;
}


Measured memory_bytes: 14360
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
					*/

#include <stdio.h>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>

#pragma GCC optimize("Ofast")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printin(a) printf(a ? "possible\n" : "inposible\n")
#define printdb(a) printf("%.50lf\n", a)//少数出力
#define printdbd(a) printf("%.16lf\n", a)//少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str())//string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2)//等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0

using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const double PI = acos(-1);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);//最初の改行対策
	while (c != '\n' && c != -1) {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

/*-----------------------------------------ここからコード-----------------------------------------*/


int main() {
	
	string s, t, st;
	cin >> s >> t >> st;
	printYN(s[s.length() - 1] == t[0] && t[t.length() - 1] == st[0]);
	
	Please AC;
}


Measured memory_bytes: 760
#include <bits/stdc++.h>
            #include<iostream>
            #include<cstdio>
            #include<vector>
            #include<queue>
            #include<map>
            #include<cstring>
            #include<string>
            #include <math.h>
            #include<algorithm>
        //    #include <boost/multiprecision/cpp_int.hpp>
            #include<functional>
          #define int long long
            #define inf  1000000007
            #define pa pair<int,int>
    #define ll long long
            #define pal pair<double,int>
            #define ppa pair<int,pa>
             #define ssa pair<string,int>
            #define  mp make_pair
            #define  pb push_back
            #define EPS (1e-10)
            #define equals(a,b) (fabs((a)-(b))<EPS)
     
            using namespace std;
     
            class Point{
            	public:
            	double x,y;
            	Point(double x=0,double y=0):x(x),y(y) {}
            	Point operator + (Point p) {return Point(x+p.x,y+p.y);}
            	Point operator - (Point p) {return Point(x-p.x,y-p.y);}
            	Point operator * (double a) {return Point(x*a,y*a);}
            	Point operator / (double a) {return Point(x/a,y/a);}
            	double absv() {return sqrt(norm());}
            	double norm() {return x*x+y*y;}
            	bool operator < (const Point &p) const{
            		return x != p.x ? x<p.x: y<p.y;
            	}
            	bool operator == (const Point &p) const{
            		return fabs(x-p.x)<EPS && fabs(y-p.y)<EPS;
            	}
            };
            typedef Point Vector;
     
            struct Segment{
            Point p1,p2;
            };
     
        double hen(Vector a){
        if(fabs(a.x)<EPS && a.y>0) return acos(0);
        else if(fabs(a.x)<EPS && a.y<0) return 3*acos(0);
        else if(fabs(a.y)<EPS && a.x<0) return 2*acos(0);
        else if(fabs(a.y)<EPS && a.x>0) return 0.0;
        else if(a.y>0) return acos(a.x/a.absv());
        else return 2*acos(0)+acos(-a.x/a.absv());
     
        }
     
int gcd(int v,int b){
	if(v>b) return gcd(b,v);
	if(v==b) return b;
	if(b%v==0) return v;
	return gcd(v,b%v);
}
            double dot(Vector a,Vector b){
            	return a.x*b.x+a.y*b.y;
            }
            double cross(Vector a,Vector b){
            	return a.x*b.y-a.y*b.x;
            }
        
            //----------------kokomade tenpure------------


int q[300];


    signed  main(){
cin>>q[0]>>q[1]>>q[2];
    	sort(q,q+3);
    	if(q[0]+q[1]==q[2]) cout<<"Yes"<<endl;
    	else cout<<"No"<<endl;
    	
  

    //	printf("%.10f\n",ky[n+1]);
    	return 0;
    }

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

#define rep(i,n) for(int i = 0; i < n; i++)
#define rrep(i,n) for(int i = n - 1; i >= 0; i--)
#define REP(i,k,n) for(int i = k; i < n; i++)

#define vi vector<int>
#define pb push_back
using namespace std;

int main(){
    int n,r;
    while(cin >> n >> r,n) {
        vi card(n);
        rep(i,n) card[i] = n - i;
        rep(i,r){
            int p,c;
            cin >> p >> c;
            vi tmp(c);
            rep(j,c) tmp[j] = card[p - 1 + j];
            rrep(j,p) card[j + c - 1] = card[j - 1];
            rep(j,c) card[j] = tmp[j];
        }
        cout << card[0] << endl;
    }
    return 0;

}



Measured memory_bytes: 3000
#include <iostream>
#include <string>

using namespace std;


int main()
{
    string str;
    
    cin >> str;
    for (auto i = str.end() - 1; i != str.begin() - 1; i--)
    {
        cout << *i;
    }
    
    cout << endl;
    
    return 0;
}


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

class UnionFind {
private:
    int* par;
    int* rank;

public:
    UnionFind(int N) {
        par = new int[N];
        rank = new int[N];
        for (int i = 0; i < N; ++i) {
            par[i] = i;
            rank[i] = 0;
        }
    };
    ~UnionFind() {
        delete[] par;
        delete[] rank;
    };
    int find(int x) {
        if (par[x] == x) {
            return x;
        } else {
            return par[x] = find(par[x]);
        }
    };
    void unite(int x, int y) {
        x = find(x);
        y = find(y);
        if (x == y) return;
        if (rank[x] < rank[y]) {
            par[x] = y;
        } else {
            par[y] = x;
            if (rank[x] == rank[y]) ++rank[x];
        }
    };
    bool same(int x, int y) {
        return find(x) == find(y);
    };
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, K, L;
    cin >> N >> K >> L;
    UnionFind road(N);
    UnionFind train(N);
    int p, q;
    for (int i = 0; i < K; ++i) {
        cin >> p >> q;
        road.unite(p - 1, q - 1);
    }
    for (int i = 0; i < L; ++i) {
        cin >> p >> q;
        train.unite(p - 1, q - 1);
    }
    map<pair<int, int>, int> mp;
    for (int i = 0; i < N; ++i) {
        ++mp[make_pair(road.find(i), train.find(i))];
    }
    for (int i = 0; i < N; ++i) {
        cout << mp[make_pair(road.find(i), train.find(i))];
        if (i != N - 1) cout << ' ';
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 15104
//Keep pluggin',this is your only outlet.
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cctype>
#define MM(x,y) memset(x,y,sizeof(x))
#define MCPY(a,b) memcpy(a,b,sizeof(b))
#define pb push_back
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define fi first
#define mp make_pair
#define se second
using namespace std;
#define int long long

inline int quickpow(int m,int n,int p){int b=1;while(n){if(n&1)b=b*m%p;n=n>>1;m=m*m%p;}return b;}
inline int quickmul(int x,int y,int mod){return (x*y-(int)((long double)x/mod*y)*mod+mod)%mod;}
inline int getinv(int x,int p){return quickpow(x,p-2,p);}
inline int read(void){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){f=ch=='-'?-1:1;ch=getchar();}
    while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
    return x * f;
}
const int MAXN =  1e5 + 100;
int a[MAXN],n,sum[MAXN];
///------------------head------------------
signed main(signed argc, char *argv[]){
    n = read();
    rep(i,1,n) a[i] = read();
    sort(a+1,a+n+1);
    rep(i,1,n) sum[i] = sum[i-1] + a[i];
    int t = 0;
    for (int k = n - 1; k; --k) {
        if (2 * sum[k] < a[k+1]) {
            t = k;
            break;
        }
    }
    printf("%lld\n",n-t);
    return 0;
}

/* Examples: */
/*

*/

/*

*/


Measured memory_bytes: 1792
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let v: Vec<char> = read::<String>().chars().collect();
    let mut cnt = 0i64;
    let mut tmp = 0;
    for i in v {
        if i == 'W' {
            cnt += tmp;
        } else {
            tmp += 1;
        }
    }
    println!("{}", cnt);
}

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

int main() {
  int a,b,c,d,e;
  cin>>a>>b;
  
  c=max(a,b);
  d=min(a,b);
  for(int i=0;i<c;i++){
  	cout<<d;
  }
  cout<<endl;
}

Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#define ps(arr) \
    debug("size %ld: ", arr.size()); \
    for(auto e: arr) cout << e << " "; \
    cout << endl;
#else
#define debug(fmt, ...)
#define ps(arr)
#endif


int main(void) {
    int num;
    cin >> num;
    vector<int> arr(num);
    cins(arr);
    map<int, int> map;
    for(int i = 0; i < num; i++) {
        map[arr[i]]++;
    }

    int ans = 0;
    for(pii p: map) {
        if(p.second%2) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8300
n = int(input())
a = list(map(int, input().split()))

ans = [0]*n

b = []

for i, x in enumerate(a):
    b.append([-x, i])

b.sort()

c = []
p = b[0]
x = [-b[0][0], b[0][1], 1]
for i in range(1, n):
    if -b[i][0] == x[0]:
        x[2] = i+1
    else:
        c.append(x)
        x = [-b[i][0], b[i][1], i+1]
c.append(x)

s = 0
t = c[0][1]
for i in range(len(c)-1):
    x = (c[i][0]-c[i+1][0])*c[i][2]
    t = min(t, c[i][1])
    ans[t] += x
    s += x
ans[min(t, c[-1][1])] += sum(a)-s

for x in ans:
    print(x)


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

int yen, happiness;

int main () {
    scanf("%d", &yen);
    while (yen > 0) {
        yen-=500;
        if (yen < 0) {
            yen += 500;
            break;
        }
        happiness+=1000;
    }
    while (yen> 0) {
        yen-=5;
        if (yen < 0) {
            yen += 5;
            break;
        }
        happiness+=5;
    }
    
    printf("%d\n", happiness);


    return 0;
}

Measured memory_bytes: 3796
import math

A, B, H, M = map(int, input().split())

theta_a = (60 * H + M) / 720
theta_b = M / 60
cos_c = math.cos(2 * (theta_a - theta_b) * math.pi)
c = (A**2 + B**2 - (2 * A * B * cos_c)) ** 0.5

print(c)

Measured memory_bytes: 9488
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int long long

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

void solve();

signed main()
{
    #ifdef _______
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
    #else
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    #endif
    ios_base::sync_with_stdio(0);
    int _ = _ = _ = 1;
    for (_; _; --_)
        solve();
}

const int N = 2e6 + 13, mod = 1e9 + 7;

void solve()
{
    int n;
    cin>>n;
    if (n>=30)
        cout<<"Yes";
    else
        cout<<"No";
}

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



int main(int argc, const char * argv[]) {
    
    int a;
    int b;
    int c;
    
    cin >> a >> b >>c;
    
    
    if (a<b&&b<c&&a<c) {
        
        cout << "Yes" <<endl;
        
    }else{
        
        
        cout << "No" <<endl;
        
    }
    

    
    
    
    return 0;
}



Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
#define next Next
#define gc getchar
#define int long long
const int N=1e6+5;
int n,a[N];
char s[N];
/*char buf[1<<21],*p1=buf,*p2=buf;
inline int gc(){return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++;}*/
inline int read()
{
    int ret=0,f=0;char c=gc();
    while(!isdigit(c)){if(c=='-')f=1;c=gc();}
    while(isdigit(c)){ret=ret*10+c-48;c=gc();}
    if(f)return -ret;return ret;
}
signed main()
{
	int a=read();n=read();
	for(int i=1;i<=n;i++)a-=read();
	if(a<=0)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli n;
vll a;
vll g;
lli ans = 0;

int main(){
    cin >> n;
    a = vll(n);
    for(lli i = 0;i < n;i++) cin >> a[i];
    for(lli i = 1;i <= n;i = 3*i+1){
        g.push_back(i);
    }
    for(lli k = g.size()-1;k >= 0;k--){
        for(lli i = 0;i < n;i++){
            for(lli j = i-g[k];j >= 0 && a[j] > a[j+g[k]];j-=g[k]){
                swap(a[j],a[j+g[k]]);
                ans++;
            }
        }
    }
    cout << g.size() << endl;
    cout << g[g.size()-1];
    for(lli i = g.size()-2;i >= 0;i--){
        cout << " " << g[i];
    }
    cout << endl;
    cout << ans << endl;
    for(lli i = 0;i < n;i++) cout << a[i] << endl;
    return 0;
}

Measured memory_bytes: 10760
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    let [n,m] = nextIntArray()
    let s = []
    let c = []
    for(let i = 0;i<n; i++){
        s.push(nextIntArray())
    }
    for(let i = 0; i<m; i++){
        c.push(nextIntArray())
    }

    for(let i = 0;i<n; i++){
        let d = Number.POSITIVE_INFINITY
        let cj
        for(let j=0;j<m; j++){
            let tmp = Math.abs(s[i][0]-c[j][0]) + Math.abs(s[i][1] - c[j][1])
            if(d > tmp) cj = j
            d = Math.min(d, tmp)
        }
        console.log(cj+1)
    }
}
Main()



Measured memory_bytes: 29688
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
	int n; cin >> n;
	std::vector<int> v(n);

	for (int i = 0; i < n; ++i) cin >> v[i];

	sort(v.begin(), v.end());

	cout << v[n/2] - v[n/2 - 1] << endl; 
}

Measured memory_bytes: 640
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}

#define L first
#define R second


signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N;
	vector<pair<int,int>> in;
	vector<pair<int,int>> fuga;
	int left = -INF, right = INF;
	int temp = 0;
	int ans = 0;
	
	cin>>N;
	
	in.resize(N);
	
	for(int i = 0; i < N; i++){
		cin>>in[i].L>>in[i].R;
		
		left = max(in[i].L, left);
		right = min(in[i].R, right);
		temp = max(in[i].R - in[i].L + 1, temp);
	}
	
	ans = max(right - left + 1, 0ll) + temp;
	
	// cout<<left<<" <> "<<right<<endl;
	
	for(int i = 0; i < N; i++){
		fuga.push_back(make_pair(max(0ll, right - in[i].L + 1), min(0ll, left - in[i].R - 1)));
		// cout<<max(0ll, right - in[i].L + 1)<<" X "<<min(0ll, left - in[i].R - 1)<<endl;
	}
	
	
	sort(fuga.begin(), fuga.end());
	// cout<<endl;
	// for(int i = 0; i < N; i++){
		// cout<<fuga[i].first<<" Y "<<fuga[i].second<<endl;
	// }
	
	for(int i = 1, minimum = -fuga[0].second; i < N; i++){
		ans = max(ans, fuga[i].first + minimum);
		minimum = min(minimum, -fuga[i].second);
	}

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

Measured memory_bytes: 3956
# https://atcoder.jp/contests/abc051/tasks/abc051_d
# 考えたこと
# 1.経路復元
# 2.ダイクストラ時に使った辺記録(こっちで解いてみる)


# あとで必要なのでクラスを準備しておく
from heapq import heapify, heappop, heappush, heappushpop

import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline
ra = range
enu = enumerate


def read_ints():
    return list(map(int, read().split()))


class PriorityQueue:
    def __init__(self, heap):
        '''
        heap ... list
        '''
        self.heap = heap
        heapify(self.heap)

    def push(self, item):
        heappush(self.heap, item)

    def pop(self):
        return heappop(self.heap)

    def pushpop(self, item):
        return heappushpop(self.heap, item)

    def __call__(self):
        return self.heap

    def __len__(self):
        return len(self.heap)


INF = 10**9 + 1


def dijkstra(adj: list, s: int, N: int):
    Color = [0] * N  # 0:未訪問 1:訪問経験あり 2:訪問済み(そこまでの最短経路は確定済み)
    D = [INF] * N  # 本のdと同じ 始点からの距離を記録する
    P = [None] * N  # 本のpと同じ 最短経路木における親を記録する

    # スタートとするノードについて初期化
    D[s] = 0  # スタートまでの距離は必ず0
    P[s] = None  # 親がない(ROOTである)ことを示す
    PQ = PriorityQueue([(0, s)])  # (コスト, ノード番号)で格納 こうするとPQでソートするときに扱いやすい

    # while True:
    while PQ:  # PQに候補がある限り続ける
        # min_cost = INF
        # for i in range(N):
        #     if Color[i] != 2 and D[i] < min_cost:
        #         min_cost = D[i]
        #         u = i
        min_cost, u = PQ.pop()  # 上記の処理はこのように簡略化できる

        Color[u] = 2  # uは訪問済み これから最短経路木に突っ込む作業をする

        if D[u] < min_cost:
            # もし今扱っているmin_costがメモしているやつよりも大きいなら何もしないで次へ(メモしている方を扱えばいいので)
            continue

        # 以下のforではsからの最短経路木にuを追加したときの更新、uまわりで次の最短経路になる候補の更新をしている
        for idx_adj_u, w_adj_u in adj[u]:
            if Color[idx_adj_u] != 2:
                # 訪問済みでなく、u→vへの経路が存在するならば
                if D[u] + w_adj_u < D[idx_adj_u]:
                    D[idx_adj_u] = D[u] + w_adj_u  # u周りにおける最短経路の候補の更新
                    P[idx_adj_u] = u
                    PQ.push((D[idx_adj_u], idx_adj_u))  # ここで候補に追加していっている
                    Color[idx_adj_u] = 1

    return D, P


# load datas
N, M = read_ints()
adj = [[] for _ in range(N)]  # (node_id, 隣接要素, 隣接nodeidとコスト)の順で格納する
for _ in range(M):
    a, b, c = read_ints()
    a -= 1
    b -= 1
    adj[a].append((b, c))
    adj[b].append((a, c))

used_edges = set()
for s in range(N):
    _, P = dijkstra(adj, s, N)
    for i, p in enu(P):
        if p == None:
            continue
        if p > i:
            i, p = p, i
        used_edges.add((i, p))

print(M - len(used_edges))


Measured memory_bytes: 57180
/* ex_3-3. nknm */

#include <stdio.h>

int main(void){

    //NとKを入力し、桁数を数えるためにiを用意
    int N,K;
    int i;
    
    i = 1;

    scanf("%d%d", &N, &K);

    //NをKで割って商の整数部分をKで割ることを繰り返す
    while (N >= K){
        N /= K;
        ++i;
    }

    printf("%d",i);

    return 0;
}

Measured memory_bytes: 128
import java.util.*;
import java.io.*;
 
public class Main {
    static ArrayList<ArrayList<Integer>> to = new ArrayList<>();
    static int[] ans;
    public static void main(String[] args) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt();
        int q = sc.nextInt();
        ans = new int[n];
        for(int i = 0; i < n; i++){
            to.add(new ArrayList<>());
        }
        for(int i = 0; i < n-1; i++){
            int a = sc.nextInt();
            int b = sc.nextInt();
            a--;b--;
            to.get(a).add(b);
            to.get(b).add(a);
        }
        for(int i = 0; i < q; i++){
            int p = sc.nextInt()-1;
            int x = sc.nextInt();
            ans[p] += x;
        }
        dfs(0,-1,0);
        for(int i = 0; i < n; i++){
            System.out.print(ans[i] + " ");
        }
    }
    
    public static void dfs(int v, int p, int counter){
        for(int u : to.get(v)){
            if(u == p) continue;
            dfs(u,v,counter+ans[v]);
        }
        ans[v] += counter;
    }
    
    static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

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

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

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

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

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


Measured memory_bytes: 146168
#include<iostream>
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
#include<vector>
#include<cctype>
#include<string>
#include<set>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
std::string line;
typedef long long ll;

int main(){
   string w;
   cin >> w;
   vector<int> num(26,0);
   rep(i,w.size()){
      num[w[i]-97]++;
   }

   bool flg = 1;
   rep(i,26){
      if(num[i]){
         if(num[i]%2 != 0) flg = 0; 
      }
   }

   if(flg) cout << "Yes" << endl;
   else cout << "No" << endl;



   return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include "time.h"
#include "unistd.h"
#include "string.h"
#include <math.h>
int ans;
int main(int argc, char* argv[]){
  int a,b,c;
  scanf("%x %x",&a,&b);
  if (a>b) {
    printf(">" );
  }else if(a<b){
    printf("<");
  }else{
    printf("=" );
  }
}


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

int main() {

	string s; cin >> s;
	string ans = "No";
	if (s[2] == s[3] && s[4] == s[5]) {
		ans = "Yes";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3592
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

int cmp (const void *a, const void *b) {
  i32 d = *(i32 *)a - *(i32 *)b;
  return d == 0 ? 0 : d > 0 ? -1 : 1;
}

void run (void) {
  i32 n, k;
  scanf ("%" SCNi32 "%" SCNi32, &n, &k);
  i32 len = 26;
  i32*cnt = (i32 *) calloc (len, sizeof (i32));
  while (n--) {
    char p[12];
    scanf ("%s", p);
    cnt[p[0] - 'A']++;
  }
  i32 ans = 0;
  while (1) {
    qsort (cnt, len, sizeof (i32), cmp);
    while (len > 0 && cnt[len - 1] == 0) len--;
    if (len < k) break;
    ans++;
    for (i32 i = 0; i < k; ++i) {
      cnt[i]--;
    }
  }
  printf("%" PRIi32 "\n", ans);
}

int main (void) {
  run ();
  return 0;
}


Measured memory_bytes: 128
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static int D;

        static void Main(string[] args)
        {
            //[summary]B - Good Distance
            var line = ReadLine();
            int N = line[0];
            D = line[1];

            var coords = new List<List<int>>();

            for(int i = 0; i < N; i++)
            {
                var X = ReadLine();
                coords.Add(X);
            }

            var lib = new Library.Combination();
            var combis = lib.AllCombinations<List<int>>(coords, 2);

            int ans = 0;

            foreach(var c in combis)
            {
                if (IsInteger(c[0], c[1]))
                {
                    ans++;
                }
            }

            Console.WriteLine(ans);
        }

        static bool IsInteger(List<int> x1, List<int> x2)
        {
            double d = 0;

            for(int i = 0; i < D; i++)
            {
                d += Math.Pow(x1[i] - x2[i], 2);
            }

            var sqrt = Math.Sqrt(d);

            if (sqrt == Math.Floor(sqrt))
            {
                return true;
            }
            else
            {
                return false;
            }
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var arr = line.Split(' ');

            return arr.Select(x => int.Parse(x)).ToList();
        }
    }
}

namespace Library
{
    class Combination
    {
        public IEnumerable<List<T>> AllCombinations<T>(List<T> source, int n,
                                                       bool isAllowDupication = false)
        {
            //[summary]異なる要素から、n個を選ぶ組み合わせを列挙する
            //"isAllowDupication"を"true"にすると、重複を許可する
            //(重複を許可して、nを要素数と同じにすると、順列を列挙する)

            if (n == 1)
            {
                foreach (var s in source)
                {
                    yield return new List<T> { s };
                }

                yield break;
            }
            else
            {
                for (int i = 0; i < source.Count; i++)
                {
                    List<T> clone;

                    if (isAllowDupication)
                    {
                        //重複を許可する場合は、その要素のみを削除
                        clone = new List<T>(source);
                        clone.RemoveAt(i);
                    }
                    else
                    {
                        //重複を許可しない場合は、自分よりも前の要素はすべて削除
                        clone = new List<T>(source.Skip(i + 1));
                    }

                    //再帰処理
                    var items = AllCombinations(clone, n - 1, isAllowDupication);

                    foreach (var item in items)
                    {
                        item.Insert(0, source[i]);
                        yield return item;
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 13524
#include <stdio.h>
int main(){

  int h,w,i,j;

  while(1){
    
    scanf("%d%d",&h,&w);
    
    if(h==0 && w==0)break;
    
    for(i=0;i<h;i++){
      
      for(j=0;j<w;j++){
	
	if(i%2==0){
	  
	  if(j%2==0) printf("#");
	  else printf(".");

	}else{

	  if(j%2==0) printf(".");
	  else printf("#");

	}
      }
      printf("\n");
    }
    
    printf("\n");
  }

  return 0;
  
}

Measured memory_bytes: 572
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　redcoderになるためAtCoderを巡る旅をしてます。

　　　 　 ＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　 ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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 dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};

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

    int h, w; cin >> h >> w;
    vector<string> a(h);
    rep(i, h) cin >> a[i];
    vector<vector<int>> dist(h, vector<int>(w, -1));

    queue<pair<int,int>> que;

    rep(i, h) {
        rep(j, w) {
            if(a[i][j] == '#') {
                dist[i][j] = 0;
                que.push(make_pair(i, j));
            }
        }
    }

    while(!que.empty()) {
        auto cur = que.front(); que.pop();
        for(int dir = 0; dir < 4; dir++) {
            int nx = cur.first + dx[dir];
            int ny = cur.second + dy[dir];
            if(nx < 0 || nx >= h || ny < 0 || ny >= w) continue;
            if(dist[nx][ny] == -1) {
                dist[nx][ny] = dist[cur.first][cur.second] + 1;
                que.push(make_pair(nx, ny));
            }
        }
    }
    int res = 0;
    rep(i, h) rep(j, w) {
        res = max(res, dist[i][j]);
    }
    cout << res << endl;
}


Measured memory_bytes: 13456
#include <iostream>
#include <map>
using namespace std;
typedef long long ll;

map<ll, ll> _f;
ll f(ll x) {
  if (_f.find(x) != _f.end()) return _f[x];
  if (x == 1) return _f[x] = 1;
  return _f[x] = f(x / 2) * 2 + 1;
}


int main() {
  long long int h;
  cin >> h;
  cout << f(h) << endl;
  return 0;
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int main() {
    fastio();

    string s;
    cin >> s;
    forn(i, s.size()) {
        if (s[i] == '?') {
            s[i] = 'D';
        }
    }

    cout << s << endl;

    return 0;
}

Measured memory_bytes: 3736
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
typedef long long int LL;
typedef vector<int> VI;

int main(){
  LL K, A, B;
  cin >> K >> A >> B;
  if(K < A) {
    cout << K << endl;
    return 0;
  }
  LL ret = A;
  K -= A - 1;
  if(B - A > 2) {
    ret = A + (B - A) * (K / 2);
    K %= 2;
  }
  ret += K;
  cout << ret << endl;
}

Measured memory_bytes: 256
from sys import stdin
import math


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    N = int(_in[0])  # type:int
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = 2**math.floor(math.log(N,2))
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)


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

using namespace std;
#define int long long
#define inf 999999999999999999
#define N 666666
int arr[N];
int n;
signed main(){
	int a,b,c,k;
	int s=0;
	cin>>a>>b>>c>>k;
	if(k>0){
		s+=min(a,k);
		k-=min(a,k);
	}
	if(k>0){
		s+=0*min(b,k);
		k-=min(b,k);
	}
	if(k>0){
		s+=(-1)*min(c,k);
		k-=min(c,k);
	}
	cout<<s;
	return 0;
}

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

int main(){
  int n,k;
  cin >> n;
  vector<int> p(n);
  rep(i,n) cin >> p[i];
  ll ans = 1;
  ll tmp;
  tmp = p[0];
  for(int i = 1;i<n;i++){
    if(p[i]<=tmp){
      tmp=p[i];
      ans+=1;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define in(x) (read(x))
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = l;x<u;x++)
#define RREP(x,l,u) for(ll x = l;x>=u;x--)
#define complete_unique(a) a.erase(unique(a.begin(),a.end()),a.end())
#define mst(x,a) memset(x,a,sizeof(x))
#define all(a) a.begin(),a.end()
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define sqr(x) ((x)*(x))
#define lowbit(x) (x&(-x))
#define lson (ind<<1)
#define rson (ind<<1|1)
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;
const int block_size = 320;
typedef complex<ll> point;
const ll mod = 1e9+7;
const ld eps = 1e-9;
const int inf = mod;
template<typename T>
inline int sign(const T&a){if(a<0)return -1;if(a>0)return 1;return 0;}


template<typename T> inline void read(T &x){
    x = 0; T f = 1; char ch = getchar();
    while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
    while (isdigit(ch))  {x = x * 10 + ch - '0'; ch = getchar();}
    x *= f;
}

int n;const int maxn = 2010;
ll a[maxn];
ll x;

int main(){
	in(n);in(x);
	ll ans = 0;
	REP(i,0,n)in(a[i]),ans+=a[i];
	deque<int>ini;
	REP(i,0,n){
		while(sz(ini) && a[ini.back()]>=a[i])ini.pop_back();
		ini.PB(i);
	}
	REP(sh,0,n){
		deque<int>q = ini;
		ll temp = sh*x;
		REP(i,n,2*n){
			while(sz(q) && i-q.front()>sh)q.pop_front();
			while(sz(q) && a[i%n]<=a[q.back()%n])q.pop_back();
			q.PB(i);
			temp+=a[q.front()%n];
		}
		ans = min(ans,temp);
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256