akhauriyash/Code-Regression huggingface dataset:
// I make this just for fun because i'm done
// Aimi Haraguni >> Konomi Suzuki >> Yui >>  Ikimono Gakari >> Garnidelia >> Kalafina >> Eir Aoi.   .. dude? 
// problems that involves any kind of persistent data structures are the best of the best, are not them?
 
// #pragma GCC optimize ("Ofast,unroll-loops")
// #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
 
#define pb push_back
#define ff  first
#define ss second
#define tm1 first
#define tm2 second.first
#define tm3 second.second
#define sz(x) ll(x.size())
#define all(v) (v).begin(), (v).end()
// #define fill(x, v) memset(x, v, sizeof(x))
#define FER(i,a,b) for(int i=int(a); i< int(b); ++i)
#define IFR(i,a,b) for(int i=int(a); i>=int(b); --i )
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
 
// #define N 21000000
// #define M 19
// #define mod 
#define mod  998244353
#define mod1 1000000007
#define mod2 1000000009
#define bas 987625403
#define sqr(x) (x)*(x)  
#define INF 3000000000000000000
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<ll, ii > tri;
typedef vector<ll> vi;
typedef vector<vi> vv;
typedef vector<ii> vii;
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> S_t;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
 
#define trace(...) fff(#__VA_ARGS__, __VA_ARGS__)
template<typename t> void fff(const char* x, t&& val1) { cout<<x<< " : "<<val1<<"\n";}
template<typename t1, typename... t2> void fff(const char* x, t1&& val1, t2&&... val2){
    const char* xd=strchr(x+1, ',');
    cout.write(x, xd-x)<<" : "<<val1<<" | ";
    fff(xd+1, val2...);
}
 
inline ll add(ll a, ll b, ll m) { return a+b < m? a+b : a+b-m;}
inline ll rem(ll a, ll b, ll m) { return a >= b? a - b: a- b + m;}
inline ll mul(ll a, ll b, ll m) { return (long long) a*b%m;}
inline void Mul(ll &a, ll b, ll m) { a = (long long) a*b%m;}
inline ll bp(ll a, ll p, ll m){
	ll ret;
	for(ret = 1; p; p>>=1, Mul(a, a, m)) (p & 1) && (Mul(ret, a, m), 1);
	return ret;
}
 
static inline void read(ll &x) { cin>>x;}
 
ll br[1<<20];
 
inline ll solve(vi &ar){
	vi tnt;
	ll tot = 1000, n = sz(ar);
	FER(i, 0, n){
		if(!sz(tnt)) {
			tnt.pb(ar[i]);
			continue;
		}
		if(tnt.back() <= ar[i]) tnt.pb(ar[i]);
		else{
			ll cnt = tot / tnt[0];
			ll ret = tot%tnt[0];
			ll ven = cnt*tnt.back();
			tot = ret + ven;
			while(sz(tnt)) tnt.pop_back();
			tnt.pb(ar[i]);
		}
	}
	ll cnt = tot/tnt[0];
	ll ret = tot%tnt[0];
	ll ven = cnt*tnt.back();
	tot = ret + ven;
	while(sz(tnt)) tnt.pop_back();
	return tot;
}
int main(){
	fastio;
	ll n; read(n);
	FER(i, 0, n) read(br[i]);
	vi tnt;
	ll ans = 0;
	FER(i, 0, n){
		tnt.pb(br[i]);
		ans = max(ans, solve(tnt));
	}
	tnt.clear();
	IFR(i, n-1, 0){
		tnt.pb(br[i]);
		reverse(all(tnt));
		ans = max(ans, solve(tnt));
		reverse(all(tnt));
	}
	cout<<ans<<"\n";
	return 0;
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <iomanip>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef int64_t Int;
const double pi = M_PI;

int main()
{
    int H, W;

    while (true)
    {
        cin >> H >> W;
        if (H == 0 && W == 0)
        {
            break;
        }

        for (int i = 0; i < H; i++)
        {
            for (int j = 0; j < W; j++)
            {
                cout << '#';
            }
            cout << endl;
        }
        cout << endl;
    }
}



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

using namespace std;

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

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


int main(){
    long int n, p;
    cin >> n >> p;
    string s;
    cin >> s;
    long int poss[n];
    long int m[p];
    fill(m, m + p, 0);
    long int ans = 0;
    if(p != 2 && p != 5){
        poss[n-1] = (long int)(s[n-1] - '0') % p;
        m[poss[n-1]]++;
        for (long int i = n - 2; i >= 0; i--){
            long int b = s[i] - '0';
            long int num = b * modpow(10, n - i - 1, p) + poss[i+1];
            poss[i] = num % p;
            m[poss[i]]++;
        }

        for (long int i = 0; i < p; i++){
            if (i == 0){
                ans += (m[i] * (m[i] + 1)) / 2;
            }else{
                if (m[i] != 0){
                    ans += ((m[i] - 1) * m[i]) / 2;
                }
            }
        }
        
    }else if(p == 5){
        rep(i, n){
            if (s[i] == '5' || s[i] == '0'){
                ans += i + 1;
            }
        }
    }else if(p == 2){
        rep(i, n){
            if ((long int)(s[i] - '0') % 2 == 0){
                ans += i + 1;
            }
        }        
    }
    // rep(i, n) cout << poss[i] << " ";
    // cout << endl;
    // rep(i, p) cout << m[i] << " ";
    // cout << endl;
    cout << ans << endl;
    
}

Measured memory_bytes: 2180
////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

const int N = 400;
LL psum[N + 5];
LL dp[N + 5][N + 5];
LL arr[N + 5];

LL solve(int l,int r) {
	if(l == r) return 0;
	LL &res = dp[l][r];
	if(res != -1) return res;
	res = 1e18;
	for(int i = l;i < r;i++) {
		res = min(res, solve(l,i) + solve(i + 1,r) + psum[r] - psum[l - 1]);
	}
	return res;
}

void hora(int tc) {
	int n;
	cin>>n;
	for(int i = 1;i <= n;i++) {
		cin>>arr[i];
		psum[i] = psum[i - 1] + arr[i];
	}
	memset(dp, -1, sizeof dp);
	cout<<solve(1,n)<<endl;
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}



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

int main()
{
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  
  int count = 0;
  for (int i = 0; i <= a; i ++)
  {
    for (int j = 0; j <= b; j ++)
    {
      for (int k = 0; k <= c; k ++)
      {
        if (i * 500 + j * 100 + k * 50 == x) count ++;
      }
    }
  }
  
  cout << count;
  return 0;
}


Measured memory_bytes: 256
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#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>
#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>

//Others
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
const int dx[8] = { -1,0,1,-1,1,-1,0,1 };
const int dy[8] = { 1,1,1,0,0,-1,-1,-1 };


//LOVE NyantakoGG	https://www.youtube.com/channel/UC6XdFs8T6Ei54O0FYl3PVVA


using namespace std;



int main() {
	double N, D;
	cin >> N >> D;
	D = D * 2 + 1;
	cout << ceil(N / D) << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;

long gcd(long n,long m){
  long nn,mm;
  if(n > m){
    nn = n;
    mm = m;
  }
  else{
    nn = m;
    mm = n;
  }

  if(nn % mm == 0){
    return mm;
  }else{
    return gcd(mm,nn % mm);
  }
}

int main(){
  long n,ii,jj,min=LONG_MAX;
  vector<long> a,mm,nn;
  vector<long> right,left,max2;

  cin >> n;
  a.resize(n);
  mm.resize(n);
  nn.resize(n);
  right.resize(n + 2);
  left.resize(n + 2);
  max2.resize(n);
  for(ii=0;ii<n;ii++){
    cin >> a[ii];
    if(a[ii] < min){
      min = a[ii];
    }
    mm[ii] = 0;
    nn[ii] = 0;
  }

  left[0] = a[0];

  for(ii=1;ii<n;ii++){
    left[ii] = gcd(left[ii-1],a[ii]);
    //cout << left[ii] << endl;
  }

  right[n-1] = a[n-1];

  for(ii=n-2;ii>=0;ii--){
    right[ii] = gcd(right[ii+1],a[ii]);
    //cout << right[ii] << endl;
  }

  for(ii=0;ii<n;ii++){
    //cout << "ii:" << ii << "right" << right[ii] << "left" << left[ii] << endl;
  }

  for(ii=0;ii<n;ii++){
    if(ii == 0){
      max2[0] = right[1];
    }
    else if(ii == n -1){
      max2[ii] = left[ii-1];
    }
    else{
      max2[ii] = gcd(left[ii-1],right[ii+1]);
    }
  }
  
  long max = 0;
  long change;
  long ret;

  for(ii=0;ii<n;ii++){
    if(max2[ii] > max){
      max = max2[ii];
    }
  }
  

  cout << max << endl;
  
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  if(N == 100000){
    cout << 90909 << endl;
  }
  
  if(10000 <= N && N <= 99999){
    cout << 9 + 900 + N - 10000 + 1 << endl;
  }
  
  if(1000 <= N && N <= 9999){
    cout << 909 << endl;
  }
  
  if(100 <= N && N <= 999){
    cout << 9 + N - 100 + 1<< endl;
  }
  
  if(10 <= N && N <= 99){
    cout << 9 << endl;
  }
  
  if(1 <= N && N <= 9){
    cout << N << endl;
  }
  
}


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

#define ff first
#define ss second
#define pb push_back
#define ll long long
#define ull unsigned long long
#define min3(a, b, c) min(a, min(b, c))
#define max3(a, b, c) max(a, max(b, c))
#define mst(ss,b) memset(ss,b,sizeof(ss));
#define dbg(x) cout << #x << "= " << x << endl;
typedef pair <int, int> pii;
const int inf = 0x3f3f3f3f;
const ll INF = (1LL<<62)-1;
const ll mod = 1e9+7;
const int N = 105;

char s[N];

int  main(){
    scanf("%s", s+1);
    int n = strlen(s+1);
    int ans = inf;
    for(char c='a'; c<='z'; c++){
        s[0] = c; s[n+1] = c;
        int st = 0;
        int tmp = 0;
        for(int i=1; i<=n+1; i++){
            if(s[i] == c){
                tmp = max(tmp, i-st-1);
                st = i;
            }
        }
        ans = min(ans, tmp);
    }
    printf("%d\n", ans);
    return 0;
}


//    lower_bound()
//    __builtin_popcount()
//    ios::sync_with_stdio(false);
//    freopen("in.txt","r",stdin);
//    freopen("out.txt","w",stdout);
//    const double eps=1e-12;
//    #pragma comment(linker,"/STACK:102400000,102400000")



Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cctype>
#include<iostream>
#include<string>
#include<sstream>
#include<set>
#include<map>
#include<vector>
#include<algorithm>
#include<queue>
#include<utility>
using namespace std;

#define i64 long long int
// #define i128 __int128_t

int main() {
	i64 n, k;
	cin>>n>>k;
	
	i64 x = n/k;
	i64 ans = x*x*x;
	
	if (k%2==0) {
		if (n%k>=k/2) x++;
		ans += x*x*x;
	}
	
	cout<<ans<<endl;
	
	return 0;
}	


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<(x)<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-9;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

ll m[252521];

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  int n, p;
  string s;
  cin>>n>>p>>s;
  ll ans=0;
  if(p==2 || p==5){
    REP(i, n){
      int x=s[i]-'0';
      if(x%p==0){
        ans+=i+1;
      }
    }
    cout<<ans<<'\n';
    return 0;
  }
  int ten=1;
  FORR(i, 0, n){
    m[i]=(m[i+1]+ten*(s[i]-'0'))%p;
    ten=(ten*10)%p;
  }
  sort(m, m+n+1);
  ll l=0, r=0;
  while(l<n+1){
    while(r<n+1 && m[l]==m[r]){
      ++r;
    }
    ans+=(r-l)*(r-l-1)/2;
    l=r;
  }
  cout<<ans<<'\n';
  return 0;
}


Measured memory_bytes: 2196
import itertools
X,N = map(int,input().split())

if N == 0 :
    print(X)
    exit()

P = list(map(int,input().split()))

L = sorted([abs(X-p) for p in P])
if 0 not in L :
    print(X)
    exit()

DL = list(set([x for x in L if L.count(x) > 1]))

ans_abs = 1
for i,x in enumerate(DL) :
    if x == i+1 :
        ans_abs += 1
    else :
        break

if X-ans_abs in P :
    print(X+ans_abs)
else :
    print(X-ans_abs)

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

int main(){
    string s;
    cin>>s;
    int cnt=0;
    auto i=s.begin();
    auto j=s.end()-1;
    while(i<j){
        if(*i!=*j) cnt++;
        i++;
        j--;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <list>
#include <algorithm>

using namespace std;

int main() {
	int q, x;
	char cmd[20];

	list<int> v;
	scanf("%d", &q);
	for (int i = 0; i < q; i++) {
		scanf("%s", cmd);
		if (cmd[0] == 'i') {
			scanf("%d", &x);
			v.push_front(x);
		}
		else if (cmd[6] == 'L') {
			v.pop_back();
		}
		else if (cmd[6] == 'F') {
			v.pop_front();
		}
		else if (cmd[0] == 'd') {
			scanf("%d", &x);
			for (list<int>::iterator it = v.begin(); it != v.end(); it++) {
				if (*it == x) {
					v.erase(it);
					break;
				}
			}
		}
	}
	int i = 0;
	for (list<int>::iterator it = v.begin(); it != v.end(); it++) {
		if (i++) {
			printf(" ");
		}
		printf("%d", *it);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 33908
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<cmath>
#include<sstream>
#include<iomanip>
#include <map>
#include <stack>
 
const int64_t cc = pow( 10, 9 );
//std::cout<< std::fixed << std::setprecision(10) << ( double )( max ) / 2;
bool sort_pair( std::pair< std::string, int64_t > origin, std::pair< std::string, int64_t > another )
{
    return origin.second  > another.second;
}
 
int main()
{
    std::string word = "aa";
    int64_t a,b,c,d,e;
    int64_t list[3][3];

    for( int i = 0; i < 3; i++ )
    {
        for( int r = 0; r < 3; r++ )
        {
            std::cin>> list[i][r];
        }
    }

    bool o = false;
    
    for( int a1 = 0; a1 <= 100; a1++ )
    {
        int64_t b1 = list[0][0] - a1;
        int64_t b2 = list[0][1] - a1;
        int64_t b3 = list[0][2] - a1;
        
        int64_t a2 = list[1][0] - b1;
        int64_t a3 = list[2][0] - b1;

        if( a2 + b2 == list[1][1]
            && a2 + b3 == list[1][2]
            && a3 + b2 == list[2][1]
            && a3 + b3 == list[2][2] )
        {
            o = true;
            break;
        }
    }

    if( o )
    {
        std::cout<< "Yes\n";
    }
    else
    {
        std::cout<< "No\n";
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <functional>
#include <iostream>
#include <string>
#include <vector>
#include <set>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;

bool is_zorome(string s) {
  set<int> c(s.begin(), s.end());
  return c.size() == 1;
}

int main() {
  int N;
  cin >> N;
  
  for (int i = N; i <= 999; i++) {
    if (is_zorome(to_string(i))) {
      cout << i << endl;
      return 0;
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
import sys


def allocate(count, weights):
    """allocate all packages of weights onto trucks.
    returns maximum load of trucks.

    >>> allocate(2, [1, 2, 2, 6])
    6
    >>> allocate(3, [8, 1, 7, 3, 9])
    10
    """
    def loadable_counts(maxweight):
        n = 0
        l = 0
        c = count
        for w in weights:
            l += w
            if l > maxweight:
                l = w
                c -= 1

            if c <= 0:
                return n

            n += 1
        return n

    i = max(weights)
    j = max(weights) * len(weights) // count

    while i < j:
        mid = (i + j) // 2
        if loadable_counts(mid) < len(weights):
            i = mid + 1
        else:
            j = mid

    return i


def run():
    k, n = [int(i) for i in input().split()]
    ws = []
    for i in sys.stdin:
        ws.append(int(i))

    print(allocate(n, ws))


if __name__ == '__main__':
    run()



Measured memory_bytes: 9576
#include <cstdio>
#include <sstream>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <iostream>
#include <fstream>
#include <numeric>
#include <string>
#include <vector>
#include <cstring>
#include <map>
#include <iterator>
#include <iomanip>
#include <unordered_map>

using namespace std;


int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int a,b;
    cin>>a>>b;
    if(a>8 || b>8)
        cout<<":(";
    else cout<<"Yay!";
}


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

std::vector<unsigned> gaps;

unsigned insertion_sort(unsigned a[], unsigned n, unsigned gap = 1){
  unsigned count = 0;
  for(unsigned i = gap; i < n; i++){
    unsigned v = a[i];
    int j = i - gap;
    while(j >= 0 && a[j] > v){
      a[j+gap] = a[j];
      j -= gap;
      count++;
    }
    a[j+gap] = v;
  }
  return count;
}

void make_gap_table(unsigned n){
  unsigned h = 1;
  unsigned i = 1;
  while(h <= n){
    gaps.push_back(h);
    h = pow(4,i) + 3*pow(2,i-1) + 1;
    i++;
  }
}

void shell_sort(unsigned a[], unsigned n){
  make_gap_table(n);
  unsigned count = 0;
  for(int i=gaps.size()-1;i>=0;i--){
    count += insertion_sort(a,n,gaps[i]);
  }

  std::cout << gaps.size() << '\n';

  for(int i=gaps.size()-1;i;i--){
    std::cout << gaps[i] << ' ';
  }
  std::cout << gaps[0] << '\n';

  std::cout << count << '\n';
}

int main(){
  std::ios::sync_with_stdio(false);
  unsigned n;
  unsigned buf;
  std::vector<unsigned> a;
  std::cin >> n;
  for(unsigned i = 0; i < n; i++){
    std::cin >> buf;
    a.push_back(buf);
  }

  shell_sort(a.data(),a.size());
  for(auto &v : a){
    std::cout << v << '\n';
  }
}

Measured memory_bytes: 6736
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations, accumulate
from operator import add, mul, sub, itemgetter, attrgetter


import sys
# sys.setrecursionlimit(10**6)
# readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(readline())


def read_int_n():
    return list(map(int, readline().split()))


def read_float():
    return float(readline())


def read_float_n():
    return list(map(float, readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def ep(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.perf_counter()
        ret = f(*args, **kwargs)
        e = time.perf_counter()

        ep(e - s, 'sec')
        return ret

    return wrap


class UnionFind():
    def __init__(self):
        self.__table = {}
        self.__size = defaultdict(lambda: 1)
        self.__rank = defaultdict(lambda: 1)

    def __root(self, x):
        if x not in self.__table:
            self.__table[x] = x
        elif x != self.__table[x]:
            self.__table[x] = self.__root(self.__table[x])
        return self.__table[x]

    def same(self, x, y):
        return self.__root(x) == self.__root(y)

    def union(self, x, y):
        x = self.__root(x)
        y = self.__root(y)
        if x == y:
            return False

        if self.__rank[x] < self.__rank[y]:
            self.__table[x] = y
            self.__size[y] += self.__size[x]
        else:
            self.__table[y] = x
            self.__size[x] += self.__size[y]
            if self.__rank[x] == self.__rank[y]:
                self.__rank[x] += 1
        return True

    def size(self, x):
        return self.__size[self.__root(x)]

    def num_of_group(self):
        g = 0
        for k, v in self.__table.items():
            if k == v:
                g += 1
        return g


@mt
def slv(N, Q, TUV):
    uf = UnionFind()

    ans = []
    for t, u, v in TUV:
        if t == 1:
            ans.append(1 if uf.same(u, v) else 0)
        else:
            uf.union(u, v)

    return ans


def main():
    N, Q = read_int_n()
    TUV = [read_int_n() for _ in range(Q)]
    print(*slv(N, Q, TUV), sep='\n')


if __name__ == '__main__':
    main()


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

using namespace std;

int main(void){
	
	
	unsigned sum,temp,i,n;
	
	vector<unsigned> cus;
	vector<unsigned> wait;
		
	while(cin>>n,n){
		
		cus.clear();
		wait.clear();
		i=sum=temp=0;
			
		for(int k=0;k<n;k++){
			cin>>i;
			cus.push_back(i);
		}
	
		sort(cus.begin(),cus.end());

		for(int k=0;k<cus.size();k++){
			for(int m=0;m<k;m++){
				temp=temp+cus[m];
			}
			wait.push_back(temp);
			temp=0;
		}
	
		for(int k=0;k<wait.size();k++){
			sum=sum+wait[k];
		}
		cout<<sum<<endl;
	}
}

Measured memory_bytes: 1060
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;

int dp[31];

const int DIV = 3650;

int main(void)
{
	while(1){
		int num;
		cin >> num;
		if(num == 0)
			return 0;
		memset(dp,0,sizeof(dp));
		dp[0] = 1;
		for(int i=1;i<=num;++i){//どの段から？
			for(int j=1;j<=3;++j){//何段？
				if(i-j < 0)
					continue;
				dp[i] += dp[i-j];
			}
		}
		cout << ceil((double)dp[num]/DIV) << endl;
	}
	return 0;
}

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

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

int past = 4280, w;

int solve() {
  int res = 4280 - 1150;
  
  if (w >= 10 && w < 20) {
    REP(i,10,w) res -= 125;
  }
  else if (w >= 20 && w < 30) {
    res -= 1250;
    REP(i,20,w) res -= 140;
  }
  else if (w >= 30) {
    res -= (1250 + 1400);
    REP(i,30,w) res -= 160;
  }
  return res;
}

int main (int argc, char const* argv[]) {
  while (cin>>w) {
    if (w == -1) break;
    cout<<solve()<<endl;;
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define pb push_back
#define si second
#define int long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define  mod 1000000007
#define double long double
#define all(o) o.begin(),o.end()
using namespace std;
int power(int x, int y)
{
    int res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1; // y = y/2
        x = (x*x) % mod;
    }
    return res%mod;
}
int n,m,k,a[3005][3005],dp[3005][3005][4];

int f(int r,int c,int cur)
{
	if(r>n || c>m )
		return 0;
	int ans=0;
	if(dp[r][c][cur]!=-1)
		return dp[r][c][cur];
	if(cur==3)

	{
		ans=max(f(r+1,c,0),f(r,c+1,cur));
	}
	else
	{
		ans=max(ans,a[r][c]+f(r,c+1,cur+1));
		ans=max(ans,f(r,c+1,cur));
		ans=max(ans,f(r+1,c,0)+a[r][c]);
	}
	return  dp[r][c][cur]=ans;
}
int32_t main(){
	fast
	int i,j,l;
	cin>>n>>m>>k;
	memset(dp,-1,sizeof(dp));
	int x,y,val;
	for(i=0;i<k;i++)
	{	cin>>x>>y>>val;
		a[x][y]=val;
	}	
	cout<<f(1,1,0)<<"\n";



}




Measured memory_bytes: 356632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next(),b=sc.next(),c=sc.next();
		StringBuilder A = new StringBuilder();
		StringBuilder B = new StringBuilder();
		StringBuilder C = new StringBuilder();
		A.append(a);
		B.append(b);
		C.append(c);
		char next = 'a';
		for(int i=0;i<301;i++) {
			if(next=='a') {
				if(A.length()==0) {
					System.out.println("A");
					break;
				}
				next = A.charAt(0);
				A.deleteCharAt(0);
			}else if(next=='b') {
				if(B.length()==0){
					System.out.println("B");
					break;
				}
				next = B.charAt(0);
				B.deleteCharAt(0);
			}else{
				if(C.length()==0) {
					System.out.println("C");
					break;
				}
				next = C.charAt(0);
				C.deleteCharAt(0);
			}
		}

	}
	public static int sample(int n) {
		return n;
	}

}


Measured memory_bytes: 23252
N=int(input())
S=list(map(int,input().split()))
a=[]
i=0 #リスト
m=0
while i<N-1:
    if S[i]>=S[i+1]:
        m+=1
        if i<N-3:
            if S[i+1]<S[i+2]:
                a.append(m)
                m=0
    i+=1
a.append(m)
print(max(a))
        

Measured memory_bytes: 63856
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]
#a = [int(input()) for _ in range(n)]

a,b,k=map(int, input().split())

ans = []
for i in range(a,min(b+1,a+k)):
    ans.append(i)
for i in range(b,max(a-1,b-k),-1):
    ans.append(i)
ans = list(set(ans))
ans.sort()
for i in range(len(ans)):
    print(ans[i])






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

#define ll long long
#define inf 1e9+7;

const int mxN = 1e5;
ll N, K, h[mxN], dp[mxN];

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> N >> K;
	for(int i = 0; i < N; ++i)
		cin >> h[i];
	for(int i = 0; i < N; ++i)
		dp[i] = inf;
	dp[0] = 0;
	for(int i = 1; i < N; ++i){
		for(int j = 1; j <= K; ++j){
			if(i>=j)
				dp[i] = min(dp[i-j]+abs(h[i-j]-h[i]), dp[i]);
		}
	}
	cout << dp[N-1] << '\n';
	return 0;
}



Measured memory_bytes: 5176
#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() {
  string S;
  cin >> S;
  int len = S.size();
  int num[2] = {};
  REP(i, len) {
    num[(i+S[i])%2]++;
  }
  cout << (num[0] < num[1] ? num[0] : num[1]) << endl;
}

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


int main() {
   
   int D,G;
   cin >> D >> G;
   int Ag[D],Ad[D],bit=0;
   for(int i=0;i<D;i++){
       cin >> Ad[i] >> Ag[i];
       bit += Ad[i];
       //cout << Ad[i] <<" "<<Ag[i]<<endl;
   }
   
   long long sum=0,sum_cnt=0,MIN = 1000000;
    for(int i=0;i<(1 << D);i++){
      for(int k=0;k<D;k++){
          if((1<<k)&i){
              sum += Ag[k] + Ad[k]*100*(k+1); //ボーナス時の点数の部分集合
              sum_cnt += Ad[k];
          }
      }
      //cout << "SUM = "<<sum<<"CNT = "<<sum_cnt<<endl;
      if(sum >= G) MIN = min(sum_cnt,MIN);//SUMの条件を満たし,カウントが最小値なら格納する
      else{
          for(int k=D-1;k>=0;k--){
              if(!((1<<k)&i)){
                  double remain = G-sum;
                  //cout << remain/((k+1)*100) <<endl;
                  if(remain/((k+1)*100) <= Ad[k]-1){
                      int s=ceil(remain/((k+1)*100));
                      sum += s*100*(k+1);
                      sum_cnt += s;
                      //cout<< "s= " <<s<<endl;
                      break;
                  }else{
                      sum += (Ad[k]-1)*100*(k+1);
                      sum_cnt +=Ad[k]-1;                  }
              }
          }
         // cout <<"sum_cnt = "<<sum_cnt<<endl;
          //cout <<"SUM = "<<sum<<endl;
          if(sum >= G) MIN = min(sum_cnt,MIN);
      }
      sum = 0;
      sum_cnt=0;
    }

    cout << MIN << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] arg){
        Scanner sc = new Scanner(System.in);
        for(int i=1;i<=10000;i++){
            int a = sc.nextInt();
            if(a==0) break;
            System.out.println("Case "+i+": "+a);
        }
        sc.close();
    }
}


Measured memory_bytes: 42600
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

int main() {
  i64 N;
  cin >> N;
  vector<i64> A(N), B(N);
  rep(i,0,N) cin >> A[i] >> B[i];
  vector<i64> idx(N);
  rep(i,0,N) idx[i] = i;
  sort(all(idx), [&](i64 i, i64 j) { return B[i] < B[j]; });

  i64 sum = 0;
  for(auto i: idx) {
    sum += A[i];
    if(sum > B[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}


Measured memory_bytes: 4992
#include<stdio.h>
#include<string>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<string.h>

using namespace std;

typedef pair<int,int> pii;

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)


int main(){
	int q,n,a;
	double d;
	char s[9],b[32];
	scanf("%d",&q);
	rep(i,q){
		scanf("%s",s);
		n=a=0;
		d=0;
		rep(j,8){
			n = n << 4;
			if(s[j]>='0'&& s[j]<='9')n+=(s[j]-'0');
			else n+=(s[j]-'a'+10);
		}
		rep(j,7){
			int p = (n & (1 << j));
			d += p!=0;
			d/=2.0;
		}
		for(int j=30;j>6;j--){
			a*=2;
			if(n & (1<<j))a+=1;
		}
		printf("%s%d.",(n&(1<<31)?"-":""),a);
		do{
			d *= 10;
			int t=floor(d);
			printf("%d",t);
			d-=t;
		}while(d!=0);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1200
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef long long ll;
const ll mod = 1000000007;

ll pow(ll a, ll x, ll p){
  	ll tmp=1;
  	while(x>0){
    	if(x%2 == 1){
          	tmp = (a*tmp)%p;
        }
      	a = (a*a)%p;
      	x /= 2;
    }
  	return(tmp);
}

ll inv(ll a, ll p){
  	return pow(a,p-2,p);
}

ll factorial(ll n, ll p){
  	ll res = 1;
  	for(ll i=1;i<=n;i++){
      	res = (res*i)%p;
    }
  	return res;
}

/*
ll combination(ll n, ll r, ll p){
    ll res=1;
  	ll tmp1 = fact.at(n);
  	ll tmp2 = fact.at(n-r);
  	ll tmp3 = fact.at(r);
  	res = ( ( (tmp1 * inv(tmp2,p) ) % p) * inv(tmp3,p) ) % p;
  	return res;
}
*/

ll perm(ll n, ll r, ll p){
  ll ans=1;
  for(ll i=1;i<=r;i++){
    ans = (ans*(n-i+1)) % p;
  }
  return ans;
}

ll combination(ll n, ll r, ll p){
  ll ans = 1;
  for(ll i=1;i<=r;i++){
    ll x = (n+1-i)*inv(i,p) % p;
    ans = (ans * x) % p; 
  }
  return(ans);
}

int main() {
  ll n;
  cin >> n;
  if(n==1){
    cout << 0 << endl;
    return(0);
  }
  
  ll tmp1 = pow(10,n,mod);
  ll tmp2 = (pow(9,n,mod)*2)%mod;
  ll tmp3 = pow(8,n,mod);
  cout << (((tmp1-tmp2+mod)%mod)+tmp3)%mod << endl;
  
  return(0);
}

Measured memory_bytes: 3632
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] arg) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        scan.nextLine();
        List<Integer> aList = Arrays.stream(scan.nextLine().split(" "))
                .map(Integer::parseInt).collect(Collectors.toList());

        AtomicBoolean bool = new AtomicBoolean(false);
        aList.forEach(a -> {
            if(a % 2 == 0) {
                if(a % 3 != 0 && a % 5 != 0) {
                    System.out.println("DENIED");
                    System.exit(0);
                }
            }
        });
        System.out.println("APPROVED");
    }
}


Measured memory_bytes: 28884
#include<bits/stdc++.h>
using namespace std;
void rd(int &x){
  int k, m=0;
  x=0;
  for(;;){
    k = getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
int rd(char c[]){
  int i, sz=0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
void wt_L(int x){
  char f[10];
  int m=0, s=0;
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    putchar_unlocked('-');
  }
  while(s--){
    putchar_unlocked(f[s]+'0');
  }
}
char S[333][333];
int N;
int main(){
  int f, i, ii, j, jj, k, res=0;
  rd(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=0;Lj4PdHRW<N;Lj4PdHRW++){
      rd(S[Lj4PdHRW]);
    }
  }
  for(k=0;k<N;k++){
    f = 1;
    for(i=0;i<N;i++){
      ii = (i+k) % N;
      for(j=0;j<N;j++){
        jj = (j+k) % N;
        if(S[ii][j] != S[jj][i]){
          f = 0;
          break;
        }
      }
      if(!f){
        break;
      }
    }
    res += f;
  }
  res *= N;
  wt_L(res);
  putchar_unlocked('\n');
  return 0;
}
// cLay varsion 20180303-1 [beta]

// --- original code ---
// int N;
// char S[333][333];
// {
//   int i, j, k, f, ii, jj;
//   int res = 0;
//   rd(N,S(N));
// 
//   rep(k,N){
//     f = 1;
//     rep(i,N){
//       ii = (i+k) % N;
//       rep(j,N){
//         jj = (j+k) % N;
//         if(S[ii][j] != S[jj][i]){
//           f = 0;
//           break;
//         }
//       }
//       if(!f) break;
//     }
//     res += f;
//   }
// 
//   res *= N;
//   wt(res);
// }


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
#include<map>
#include<set>
#include<queue>
#include<math.h>
using namespace std;
#define N (1000000000+7)
#define INF 1e16
typedef pair<int,int> P;
typedef long long ll;

int graph[60][60];


int main(void){
    ll n,t,a,ans1=0,ans2=0;
    cin>>n;
    for(ll i=0;i<n;i++){
        cin>>t>>a;
        if(ans1<=t){
            if(ans2<=a){
                ans1=t;
                ans2=a;
            }
            else{
                ll p=ans2/a;
                if(ans2%a!=0)p++;
                ans1=t*p;
                ans2=a*p;
            }
        }
        else{
            if(ans2<=a){
                ll p=ans1/t;
                if(ans1%t!=0)p++;
                ans1=t*p;
                ans2=a*p;
            }
            else{
                ll p1=ans1/t;
                if(ans1%t!=0)p1++;
                ll t1=t*p1;
                ll a1=a*p1;
                ll p2=ans2/a;
                if(ans2%a!=0)p2++;
                ll t2=t*p2;
                ll a2=a*p2;
                if((t1>=t)&&(a1>=a)){
                    if((t2>=t)&&(a2>=a)){
                        if(t1+a1>=t2+a2){
                            ans1=t1;
                            ans2=a1;
                        }
                        else{
                            ans1=t2;
                            ans2=a2;
                        }
                    }
                    else{
                        ans1=t1;
                        ans2=a1;
                    }
                }
                else{
                    if((t2>=t)&&(a2>=a)){
                        ans1=t2;
                        ans2=a2;
                    }
                }
            }
        }
        //cout<<ans1<<" "<<ans2<<endl;
    }
    cout<<ans1+ans2<<endl;
    return 0;
}

Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

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

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

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

	if (n == 3 || n == 5 || n == 7) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}

	return 0;
}

Measured memory_bytes: 256
r,c=map(int,input().split(" "))
originalMatrix=[[0 for i in range(c+1)] for j in range(r+1)]

values=[]

for i in range(r):
    values=list(map(int,input().split(" ")))
    for j in range(c+1):
        if j!=c:
            originalMatrix[i][j]=values[j]
        else:
            originalMatrix[i][j]=sum(values)

for i in range(r):
    for j in range(c+1):
        originalMatrix[r][j]+=originalMatrix[i][j]

for i in range(r+1):
    for j in range(c+1):
        if j!=c:
            print(originalMatrix[i][j],end=" ")
        else:
            print(originalMatrix[i][j],end="")   
            print("")


Measured memory_bytes: 6220
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    sort(arr,arr+n,greater<int>());
    int x=n-2;
    int64_t sum=arr[0];
    int i=1;
    while(x!=0)
    {
        if(x==2)
        {
            sum+=arr[i]*2;
            x-=2;
            i++;
            break;
        }
        else if(x==1)
        {
            sum+=arr[i];
            x--;
            i++;
            break;
        }
        else
        {
            sum+=arr[i]*2;
            x-=2;
            i++;
        }
    }
    cout<<sum;
    return 0;
}


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

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  if(((A == 5)&&(B == 5)&&(C == 7))||
    ((A == 5)&&(B == 7)&&(C == 5))||
    ((A == 7)&&(B == 5)&&(C == 5)))
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<vector>

using namespace std;

vector<int> G;
long long int cnt = 0;

int insertion_sort(long long int *A, int n, int g){
  for(int i = g; i < n; i++){
    int v = A[i];
    int j = i - g;
    while(j >= 0 && v < A[j]){
      A[j + g] = A[j];
      j -= g;
      cnt++;
    }
    A[j + g] = v;
  }
  return 0;
}

int shell_sort(long long int *A, int n){
  for(int i = 1; ; ){
    if(i > n)
      break;
    G.push_back(i);
    i = 3 * i + 1;
  }

  for(int i = G.size() - 1; i >= 0; i--){
    insertion_sort(A, n, G[i]);
  }
  return 0;
}

int main(void){
  int n;
  long long int A[1000001];
  scanf("%d", &n);
  for(int i = 0; i < n; i++){
    scanf("%lld", &A[i]);
  }

  shell_sort(A, n);

  printf("%lu\n", G.size());

  for(int i = G.size() - 1; i >= 0; i--){
    printf("%d", G[i]);
    if(i != 0){
      printf(" ");
    }
  }
  printf("\n");
  printf("%lld\n", cnt);

  for(int i = 0; i < n; i++){
    printf("%lld\n", A[i]);
  }

  return 0;
}



Measured memory_bytes: 11068
package main

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

func main() {
	h := readInt()
	ans, i := 0, 0
	for h > 0 {
		ans += int(math.Pow(2, float64(i)))
		h /= 2
		i++
	}
	fmt.Println(ans)
}

// sort ------------------------------------------------------------

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

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

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcd(m, n int) int {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcm(m, n int) int {
	return m / gcd(m, n) * n
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define pb push_back
#define pf pop_front
#define mp make_pair
#define mod 1000000007
using namespace std;

void print(auto a)
{
	for(int i=0;i<a.size();i++)
		cout<<a[i]<<' ';
	cout<<endl;
}

signed main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;
	cin>>n;
	vector<ll> a(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	
	ll dp[n][n];
	ll pre[n+1]={0};
	
	for(int i=1;i<=n;i++)
		pre[i]=pre[i-1]+a[i-1];
	
	for(int i=0;i<n;i++)
	{
		for(int j=i;j>=0;j--)
		{
			if(i==j)
			{
				dp[i][j]=0;
				continue;
			}
			
			dp[j][i]=1e18;
			for(int k=j;k<i;k++)
			{
				//cout<<j<<','<<k<<','<<i<<'-'<<dp[k][i]+dp[j][k]<<endl;
				dp[j][i]=min(dp[j][i],dp[j][k]+pre[k+1]-pre[j]+dp[k+1][i]+pre[i+1]-pre[k+1]);
			}
			
		}
	}
	//for(int i=0;i<n;i++)
	//{
		//for(int j=i;j>=0;j--)
	//		cout<<j<<' '<<i<<" -> "<<dp[j][i]<<endl;
	//}
	cout<<dp[0][n-1]<<endl;
}

Measured memory_bytes: 1536
// tzl ak IOI! 

#include<bits/stdc++.h>

#define HEAP priority_queue
#define rep(i, n) for(int i = 0, _end_ = (n); i < _end_; ++i)
#define per(i, n) for(int i = (n) - 1; i >= 0 ; --i)
#define forn(i, l, r) for(int i = (l), _end_ = (r); i <= _end_; ++i)
#define nrof(i, r, l) for(int i = (r), _end_ = (l); i >= _end_; --i)
#define FOR(a, b) for(auto (a): (b))
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define X first
#define Y second
#define eps 1e-6
#define pi 3.1415926535897932384626433832795
#define SZ(x) (int)x.size()
#define ALL(x) x.begin(), x.end()
#define FILL(a, b) memset((a), (b), sizeof((a)))
#define MCPY(a, b) memcpy((a), (b), sizeof((b)))

using namespace std;

typedef long long LL;
typedef double flt;
typedef vector<int> vi;
typedef vector<LL> vl;
typedef pair<int,int> pii;
typedef pair<int,LL> pil;
typedef pair<LL,int> pli;
typedef pair<LL,LL> pll;
typedef vector<pil> vil;
typedef vector<pii> vii;
typedef vector<pli> vli;
typedef vector<pll> vll;

const int iinf = 1e9 + 7;
const LL linf = 1ll << 60;
const flt dinf = 1e60;

template <typename T>
inline void scf(T &x)
{
	bool f = 0; x = 0; char c = getchar();
	while((c < '0' || c > '9') && c != '-') c = getchar();
	if(c == '-') { f = 1; c = getchar(); }
	while(c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	if(f) x = -x; return;
}

template <typename T1, typename T2>
void scf(T1 &x, T2 &y) { scf(x); return scf(y); }

template <typename T1, typename T2, typename T3>
void scf(T1 &x, T2 &y, T3 &z) { scf(x); scf(y); return scf(z); }

template <typename T1, typename T2, typename T3, typename T4>
void scf(T1 &x, T2 &y, T3 &z, T4 &w) { scf(x); scf(y); scf(z); return scf(w); }

inline char mygetchar(){ char c = getchar(); while(c == ' ' || c == '\n') c = getchar(); return c; }

template <typename T>
void chkmax(T &x, const T &y){ if(y > x) x = y; return; }

template <typename T>
void chkmin(T &x, const T &y){ if(y < x) x = y; return; }

#ifdef ONLINE_JUDGE
#define debug(x,c) ;
#else
#define DEBUG
#define debug(x,c) cerr<<#x<<"="<<x<<c;
#endif

void TZL();

void RANK1();

#define tzl int
#define ak main
#define IOI ()
tzl ak IOI
{
#undef tzl
#undef ak
#undef IOI

	TZL();
	RANK1();

#define tzl return
#define caisi 0
#define myy ;
	tzl caisi myy
#undef tzl
#undef caisi
#undef myy
}

//---------------------------head----------------------------

const int N = 1e5 + 100;

int n, m;
vi g[N];
deque<int> ans;
bool vis[N];

void TZL()
{
	scf(n, m);
	rep(i, m)
	{
		int u, v;
		scf(u, v);
		g[u].pb(v);
		g[v].pb(u);
	}
	return;
}

void dfs(int u)
{
	ans.pb(u);
	vis[u] = 1;
	for(int v: g[u]) if(!vis[v])
	{
		return dfs(v);
	}
	return;
}

void RANK1()
{
	dfs(1);
	reverse(ALL(ans));
	ans.pop_back();
	dfs(1);
	printf("%d\n", SZ(ans));
	for(int x: ans) printf("%d ", x);
}

Measured memory_bytes: 6784
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdio>
#include<queue>
#include<deque>
#include<vector>
#include<map>
#include<iomanip>
#include<functional>
#include<cmath>
#include<time.h>
#include<list>
#include<set>
#include<stack>
using namespace std;
int a[105];
int n,ans;
int main()
{
	ans = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
	}
	for (int i = 1; i < n; i++)
	{
		if (a[i] == a[i - 1])
		{
			ans++;
			a[i] = 0;
		}
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256