akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

const int mod = 1000000007;
struct mint {
    ll x; // using long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    
    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    ll n;
    cin>>n;
    vl ts(n), as(n);
    cin>>ts>>as;
    reverse(rng(as));
    
    vl hs(n);
    vl us(n);
    rep(i, n) {
        if (i == 0 || ts[i] > ts[i - 1]) {
            hs[i] = ts[i];
        }
        else {
            us[i] = ts[i];
        }
    }
    rep(i, n) {
        if (i == 0 || as[i] > as[i - 1]) {
            if ((hs[n - i - 1] != 0 && as[i] != hs[n - i - 1]) || (us[n - i - 1] != 0 && as[i] > us[n - i - 1])) {
                cout<<0<<endl;
                return 0;
            }
            hs[n - i - 1] = as[i];
        }
        else {
            if (us[n - i - 1] != 0) chmin(us[n - i - 1], as[i]);
            else us[n - i - 1] = as[i];
        }
    }
    
    mint ans = 1;
    rep(i, n) {
        if (us[i] == 0 || hs[i] != 0) continue;
        ans *= us[i];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3456
#include<stdio.h>

int main(void)
{
	int i,j,h,w,c=0;
	scanf("%d%d",&h,&w);
	char g[h+2][w+2];
	for(i=1;i<=h;i++)
		scanf("%s",g[i]+1);
	
	for(i=0;i<=w+1;i++){
		g[0][i]='.';
		g[h+1][i]='.';
	}
	for(i=0;i<=h+1;i++){
		g[i][0]='.';
		g[i][w+1]='.';
	}

	for(i=1;i<=h;i++){
		for(j=1;j<=w;j++){
			if(((g[i][j]=='#' && g[i-1][j]=='.')&&(g[i][j-1]=='.' && g[i][j+1]=='.')) && g[i+1][j]=='.')
				c=1;
		}
	}
	if(c==1)
		printf("No");
	else
		printf("Yes");
	return 0;
}

Measured memory_bytes: 128
#include <string>
#include <vector>
#include <cstring>
#include <algorithm>
#include <iostream> 

using namespace std;
typedef long long int ll;
typedef long double ld;

//repetition
#define REP(i,n)  for(ll i=0;i<n;i++)

unsigned GetDigit(unsigned num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
 
unsigned binarySearch(ll target, ll max, ll min) {
  while((max - min) > 1) {
      if((max + min)/2 > target) {
        max = (max + min)/2;
        min = min;
      } else {
        max = max;
        min = (max + min)/2;
      }
    }
}

bool primeNumber(ll n){
    if(n < 2) return false;
    else{
        for(ll i = 2; i * i <= n; i++){
            if(n % i == 0) return false;
        }
        return true;
    }
}

ll r,s,p;

ll calc(char sc) {
  ll point = 0;
  if (sc == 'p') {
    point = s;
  } else if(sc == 'r') {
    point = p;
  } else if (sc == 's') {
    point = r;
  }
  return point;
}


int main() {
  ll n,k;
  cin >> n >> k;
  cin >> r >> s >> p;
  vector<bool> vb(k, false);

  ll total = 0;

  string sc;
  cin >> sc;

  REP(i, n) {
    if(i < k) {
      total += calc(sc.at(i));
    } else {
      if(sc.at(i-k) == sc.at(i) && !vb.at(i%k)) {
        vb.at(i%k) = true;
      } else {
        total += calc(sc.at(i));
        vb.at(i%k) = false;
      }
    }
  }

  cout << total << endl;
}


Measured memory_bytes: 512
# coding: utf-8
# Your code here!
n=int(input())
a=list(map(int,input().split()))

l=0
r=0
ans=0

xsum=0
s=0

while(l < n):
#    print(l,r,s,xsum,"l,r,s,xsum")
    if s == xsum and r <= n:
        if r < n:
            s += a[r]
            xsum ^= a[r]
        r+=1
    else:
        s -= a[l]
        xsum ^= a[l]
        ans += r-l-1
        l+=1
#    print(ans)

print(ans)
        


Measured memory_bytes: 24424
#include<bits/stdc++.h>
#define up(l,r,i) for(int i=l;i<=r;i++)
#define dn(l,r,i) for(int i=l;i>=r;i--)
using namespace std;

typedef long long LL;
const int INF =2147483647;
int qread(){
	int w=1,c,ret;
	while((c=getchar())> '9'||c< '0')
	w=(c=='-'?-1:1); ret=c-'0';
	while((c=getchar())>='0'&&c<='9')
	ret=ret*10+c-'0';
	return ret*w;
}
const int MAXN =1e5 +3;
int n,A,B,h[MAXN],ans;
bool check(LL t){
	LL t_=0;
	up(1,n,i) if(h[i]<=t*B) continue;
	else t_+=(LL)ceil((double)(h[i]-t*B)/(A-B));
	return t_<=t;
}
LL calc(){
	LL p=0,k=1;
	while(k){
		if(!check(p+k)) p+=k,k<<=1;
		else k>>=1;
	}
	return p+1;
}
int main(){
	n=qread(),A=qread(),B=qread();
	up(1,n,i) h[i]=qread();
	printf("%lld\n",calc());
	return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,a,b,ans=0;
  cin>>n>>a>>b;

  for(int i=1;i<=n;i++){
    int sum=0;
    int k=i;
    while(k>0){
      sum+=k%10;
      k/=10;
    }
    if(a<=sum && sum<=b) ans+=i;
  }
  cout<<ans;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

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

  llong ans = 0;
  for (llong a = 1; a <= N; a++) {
    for (llong b = a; b < N; b += a) {
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3632
nums =input().split()

if int(nums[0]) >= int(nums[1]):
  min = int(nums[1])
else:
  min = int(nums[0])
  
count = 0
for i in range(min):
  if int(nums[0]) % min == 0 and int(nums[1]) % min == 0:
    count += 1
    if int(nums[2]) == count:
      print(min)
    else:
      min -= 1
  else:
    min -= 1
  

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

int main() {
	int n,q,a,c=0,i,j;
	vector<int> S;
	scanf("%d",&n);
	S.resize(n);
	for(i=0; i<n; ++i) {
		scanf("%d",&S[i]);
	}
	sort(S.begin(),S.end());
	scanf("%d",&q);
	for(j=0; j<q; ++j) {
		i=0;
		scanf("%d",&a);
		while(i<n) {
			if(S[i]>a) break;
			if(S[i]==a) {
				++c;
				break;
			}
			++i;
		}
	}
	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 2760
#include <algorithm>
#include <cmath>
#include <iostream>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define INF (1e9)

int N;

int main() {
    cin >> N;
    cout << 3 * N * N << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdlib>
#include <cstdio>
#define MOD 998244353
typedef long long ll;
inline ll quick_pow(ll a, int n)
{
	ll res = 1;
	while (n)
	{
		if (n & 1)
			res = res * a % MOD;
		a = a * a % MOD;
		n >>= 1;
	}
	return res;
}
ll fact[300005], inv[300005], dp[100005];
inline ll C(int n, int m)
{
	if (n == -1 && m == -1)
		return 1;
	if (n < m || m < 0)
		return 0;
	return fact[n] * inv[m] % MOD * inv[n - m] % MOD;
}
ll work(int n, int m, char *a, char *b, char *c, char *d)
{
	int aa = 0, bb = 0, cc = 0, dd = 0;
	for (int i = 0; i < n; i++)
	{
		aa += a[i] - '0';
		bb += b[i] - '0';
	}
	for (int i = 0; i < m; i++)
	{
		cc += c[i] - '0';
		dd += d[i] - '0';
	}
	if (!aa && !bb && !cc && !dd)
	{
		puts("1");
		exit(0);
	}
	cc = dd = 0;
	for (int i = 0; i < m; i++)
	{
		dp[i] = i ? dp[i - 1] : 0;
		if (c[i] == '1' || d[i] == '1')
			(dp[i] += C(cc + dd + aa - 1, aa - 1)) %= MOD;
		if (c[i] == '1' && d[i] == '1')
			(dp[i] += dp[i]) %= MOD;
		cc += c[i] - '0';
		dd += d[i] - '0';
	}
	ll res = 0;
	cc = dd = 0;
	for (int i = m - 1; i >= 0; i--)
	{
		if (c[i] == '1' || d[i] == '1')
			(res += dp[i] * C(cc + dd + bb - 1, bb - 1)) %= MOD;
		cc += c[i] - '0';
		dd += d[i] - '0';
	}
	return res;
}
char a[100005], b[100005], c[100005], d[100005];
int main()
{
	// freopen("CF17-QA-E.in", "r", stdin);
	fact[0] = inv[0] = 1;
	for (int i = 1; i <= 3e5; i++)
	{
		fact[i] = fact[i - 1] * i % MOD;
		inv[i] = quick_pow(fact[i], MOD - 2);
	}
	int n, m;
	scanf("%d%d%s%s%s%s", &n, &m, a, b, c, d);
	printf("%lld\n", (work(n, m, a, b, c, d) + work(m, n, c, d, a, b)) % MOD);
	return 0;
}


Measured memory_bytes: 6016
macro_rules! get {
      ($t:ty) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.trim().parse::<$t>().unwrap()
          }
      };
      ($($t:ty),*) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              let mut iter = line.split_whitespace();
              (
                  $(iter.next().unwrap().parse::<$t>().unwrap(),)*
              )
          }
      };
      ($t:ty; $n:expr) => {
          (0..$n).map(|_|
              get!($t)
          ).collect::<Vec<_>>()
      };
      ($($t:ty),*; $n:expr) => {
          (0..$n).map(|_|
              get!($($t),*)
          ).collect::<Vec<_>>()
      };
      ($t:ty ;;) => {
          {
              let mut line: String = String::new();
              std::io::stdin().read_line(&mut line).unwrap();
              line.split_whitespace()
                  .map(|t| t.parse::<$t>().unwrap())
                  .collect::<Vec<_>>()
          }
      };
      ($t:ty ;; $n:expr) => {
          (0..$n).map(|_| get!($t ;;)).collect::<Vec<_>>()
      };
}

fn main() {
    // 入力
    let (N, i) = get!(i64, i64);

    let ans = N - i + 1;

    // 出力
    println!("{}", ans);
}


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

int main(){
	int n;	cin>>n;
	int t[n];
	int sum=0;
	for(int i=0;i<n;i++){
		cin>>t[i];
		sum+=t[i];
	}

	int m,p,x;	cin>>m;
	for(int i=0;i<m;i++){
		cin>>p>>x;
		int ans=sum-t[p-1];
		ans+=x;

		cout<<ans<<endl;
		
	}

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////


int main(){fastio
    ll k;cin>>k;
    ll n=1<<k;
    ll a[n];rep(i,0,n-1)cin>>a[i];
    sort(a,a+n);
    reverse(a,a+n);
    bool b[n];memset(b,false,sizeof(b));
    b[0]=true;
    rep(q,1,k){
        vector<ll>v;
        rep(i,0,n-1)if(b[i])v.pb(a[i]);
        ll pos=0;
        ll vs=v.size();
        rep(i,0,n-1){
            if(pos>vs-1)break;
            if(b[i])continue;
            if(v[pos]>a[i]){
                b[i]=true;
                pos++;
            }
        }
        /*rep(i,0,n-1){
            cout<<b[i]<<" ";
        }cout<<endl;*/
    }
    rep(i,0,n-1){
        if(!b[i]){
            cout<<"No"<<endl;return 0;
        }
    }
    cout<<"Yes"<<endl;
    
    
    return 0;
}

/*

#define N 200005
ll n;
ll a[N];

ll ret[N][2];
void cal(){
    set<l_l>s;
    memset(ret,-1,sizeof(ret));
    rep(i,0,n-1){
        while(!s.empty()){
            l_l t=*s.begin();
            if(t.first<a[i]){
                ret[t.second][0]=i;
                s.erase(t);
            }
        }
        s.insert(l_l(a[i],i));
    }
    rep(i,0,n-1){
        
    }
}

int main(){fastio
    
    cin>>n;
    rep(i,0,n-1)cin>>a[i];
    ll dp[n][4];
    cal();
    rep(i,0,n-1)rep(j,0,1){
        dp[i][j]=ret[i][j];
    }
    reverse(a,a+n);
    cal();
    rep(i,0,n-1)rep(j,0,1){
        dp[i][j+2]=ret[i][j];
    }
    reverse(a,a+n);
    
    
    
    return 0;
}
 */













Measured memory_bytes: 4084
// abc175_b
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

template <typename A, typename B> bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#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;
  cin >> N;
  vector<int> L(N);
  int ans = 0;
  rep(i, N) cin >> L[i];
  sort(L.begin(), L.end());

  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      for (int k = j + 1; k < N; ++k) {
        if (L[i] + L[j] > L[k] && L[i] != L[j] && L[j] != L[k] && L[k] != L[i]) {
          ans++;
        }
        // cout<<"k: "<<i<<" L[i]: "<<L[i]<<endl;
        // cout<<"k: "<<j<<" L[j]: "<<L[j]<<endl;
        // cout<<"k: "<<k<<" L[k]: "<<L[k]<<endl;
      }
    }
  }

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


Measured memory_bytes: 3596
//Robs Code
/***********HEADER***************/
#include <iostream>
#include <bitset>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <set>
#include <queue>
#include <map>
/***********MACROS***************/
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define pii pair<int,int>
using namespace std;
int n,m,i,j,l,k,x,y,a,b,cnt[3],sum[3];
/***********MAIN**************/
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n>>m;
	cout<<(n*m)/__gcd(n,m);
	return 0;
}
//.........

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define EM 100000000
using namespace std;
using LL = long long;
using P = pair<LL, LL>;
LL LINF = 1e18;
int INF = 1e9;
LL mod = 1e9+7;
using vint = vector<int>;
using vLL = vector<LL>;
using vvint = vector<vector<int>>;
using vvLL = vector<vector<LL>>;
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; }


vector<int> par(100010), chcnt(100010, 0);
vector<vector<int>> vp(100010);
int used[100010];

void dfs(int s){
	if(used[s])	return;
	used[s] = 1;
	for(auto v : vp[s]){
		if(used[v])	continue;
		par[v] = s;
		dfs(v);
	}
}
int main(){
	int N, K;
	cin >> N >> K;
	
	for(int i = 0; i < N-1;i++){
		int ai, bi;
		cin >> ai >> bi;
		vp[ai-1].push_back(bi-1);
		vp[bi-1].push_back(ai-1);
	}
	par[0] = -1;
	dfs(0);
	LL mod = 1e9+7;
	LL ans = K;
	for(int i = 1;i < N;i++){
		int parpar = par[par[i]];
		int ch = chcnt[par[i]];
		int m = K;
		if(parpar != -1)	m--;
		ans *= (m-ch-1);
		ans %= mod;
		chcnt[par[i]]++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 9216
#include <iostream>
#include<string>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<set>
#include <limits>
#include <numeric>
#include <type_traits>
#include<queue>
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
typedef pair<double,double>P_D;
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define reprev(i, n) for (int i = (int)n - 1; i >= 0; i--)
#define ALL(a)  (a).begin(),(a).end()
#define MAX 100100
#define MAX_N 200100
#define SENTINEL 2000000000
#define MAX_B 1001001
#define NIL -1
#define MOD 1000000007
#define INF 1 << 29
#define INFTY 1000000000000000000LL
int main(){
    int n;cin>>n;
    vector<P>p(n);
    rep(i,n){
        int x,l;cin>>x>>l;
        p[i]=make_pair(x+l,x-l);
    }
    sort(ALL(p));
    int ans=0, now=-SENTINEL;
    rep(i,n){
        if(now<=p[i].second){
            ans++;
            now=p[i].first;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1152
#include <stdio.h>
#include <string.h>
#define MAX 2000000
#define INF 2000000001

void swap(int, int);
int parent(int);
int left(int);
int right(int);
void risePriority(int);
void maxHeapify(int);
void insert(int);
int extract();

int A[MAX];
int length;

int main()
{
  int key;
  char order[8];
	
  length = 0;
  A[0] = INF;
	
  while(1)
    {
      scanf("%s", order);
		
      if(strcmp(order, "insert") == 0)
	{
	  scanf("%d", &key);
	  insert(key);
	}
      if(strcmp(order, "extract") == 0)
	{
	  printf("%d\n", extract());
	}
      if(strcmp(order, "end") == 0)
	{
	  break;
	}
    }
	
  return 0;
}

void swap(int i1, int i2)
{
  int tmp;

  tmp = A[i1];
  A[i1] = A[i2];
  A[i2] = tmp;
}

int parent(int i)
{
  return i / 2;
}

int left(int i)
{
  return 2 * i;
}

int right(int i)
{
  return 2 * i + 1;
}

void risePriority(int i)
{
  int p;
  p = parent(i);
	
  if(A[i] > A[p])
    {
      swap(i, p);
      risePriority(p);
    }
}

void maxHeapify(int i)
{
  int l, r;
  int largest;

  l = left(i);
  r = right(i);

  largest = i;
  if(l <= length && A[l] > A[largest])
    largest = l;
  if(r <= length && A[r] > A[largest])
    largest = r;

  if(largest != i)
    {
      swap(i, largest);
      maxHeapify(largest);
    }
}

void insert(int k)
{
  length++;
  A[length] = k;
	
  risePriority(length);
}

int extract()
{
  int ret;
	
  ret = A[1];
  swap(1, length);
  length--;
  maxHeapify(1);
	
  return ret;
}

Measured memory_bytes: 4696
#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;
typedef long double ld;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

	ld a, b, h, m;
	cin >> a >> b >> h >> m;

	m /= 60.0;

	ld pi = 3.1415926535897932384;
	ld hth = -(h + m) * 2.0 * pi / 12.0;
	ld mth = -m * 2.0 * pi;

	ld hx = a * cos(hth);
	ld hy = a * sin(hth);
	ld mx = b * cos(mth);
	ld my = b * sin(mth);

	cout << fixed << setprecision(12);
	cout << hypot(hx - mx, hy - my) << endl;


}


Measured memory_bytes: 4204
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>
#include <iomanip>
#include <climits>
#include <string>

using namespace std;
using p = pair<int, int>;
const int ll[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; 

int main(){
    int h, w;
    cin >> h >> w;
    char c;
    vector<vector<bool>> s(w, vector<bool>(h));
    vector<p> v;
    for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
            cin >> c;
            if(c == '.'){
                s.at(j).at(i) = true;
                v.push_back(pair<int, int> (j, i));
            }else if(c == '#'){
                s.at(j).at(i) = false;
            }
        }
    }
    int ans=0;
    for(p p_buf: v){
        int s_x = p_buf.first, s_y = p_buf.second, max_cost = 0;
        vector<vector<int>> cost_map(w, vector<int>(h, INT_MAX/2));
        cost_map.at(s_x).at(s_y) = 0;
        queue<p> que;
        que.push(p (s_x, s_y));
        while(!que.empty()){
            p p_now = que.front();
            int x = p_now.first, y = p_now.second;
            que.pop();
            int now_cost = cost_map.at(x).at(y) + 1;
            for(int i=0; i<4; i++){
                int n_x = x + ll[i][0], n_y = y + ll[i][1];
                if(n_x<0 || n_x>=w || n_y<0 || n_y>=h)continue;
                if(s.at(n_x).at(n_y) && now_cost < cost_map.at(n_x).at(n_y)){
                    cost_map.at(n_x).at(n_y) = now_cost;
                    que.push(p (n_x, n_y));
                    if(max_cost < now_cost) max_cost = now_cost;
                }
            }
        }
        if(ans < max_cost) ans = max_cost;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int i = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int i = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int i = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).begin(),(v).end(),greater<>()
#define debug(x) cerr << #x << ':' << x << '\n'
#define Pi 3.1415926535
#define MOD 1000000007
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}
void yes(){cout << "Yes" << '\n';}
void no(){cout << "No" << '\n';}

int solve(){
    string s; cin >> s;
    int n = 0;
    for(char c : s){
        n += c - '0';
        n %= 9;
    }

    if(n%9 == 0) yes();
    else no();
    
    return 0;
}

int main(){
    cin.tie(0);
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 3780
#include<iostream>
#include<vector>
using namespace std;
#define MAX_N 20
#define INF (1<<24)
struct edge{int to,cost;};
typedef pair<int,int> P;
vector<edge> G[MAX_N];
bool visited[MAX_N];
int N;

P rec(int pos){

  visited[pos]=true;
  P res=P(0,0);
  int maxm=0;
  for(int i=0;i<(int)G[pos].size();i++){
    edge e = G[pos][i];
    if(visited[e.to])continue;
    P p = rec(e.to);
    res.second+=(p.second+e.cost+e.cost);
    maxm=max(maxm,e.cost+p.second-p.first);
  }
  res.first=res.second-maxm;
  //cout<<pos<<' '<<res.first<<' '<<res.second<<endl;
  return res;
}

void init(){
  for(int i=0;i<MAX_N;i++){
    G[i].clear();
    visited[i]=false;
  }
}
int main(){
  while(cin>>N&&N){
    init();
    for(int i=0;i<N-1;i++){
      int a,b,c;
      cin>>a>>b>>c;
      a--,b--;
      G[a].push_back((edge){b,c});
      G[b].push_back((edge){a,c});
    }
    for(int i=0;i<N;i++)
      if(G[i].size()==1)visited[i]=true;
    P ans = rec(0);
    cout<<ans.first<<endl;
  }
  return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
#define REP(i,n) for (int i = 1; i <= n; i++)
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define lli long long int
#define INF 1000000000
#define endl '\n'
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;

using namespace std;


int main()
{
	string st;
	cin>>st;
	
	if(st[2] == st[3] && (st[4] == st[5]))
	cout<<"Yes";
	else
	cout<<"No";
}


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

int main()
{
  int stack[100], elem, elem1, elem2, top;
  char c[100];

  top = 0;

  while( scanf("%s", c) != EOF )
    {
     
      if( c[0] == '+' )
	{
	  elem1 = stack[top-1];
	  top--;
	  elem2 = stack[top-1];
	  top--;
	  stack[top] = elem1 + elem2;
	  top++;
	}
      
      else if( c[0] == '-' )
	{
	  elem1 = stack[top-1];
	  top--;
	  elem2 = stack[top-1];
	  top--;
	  stack[top] = elem2 - elem1;
	  top++;
	}

      else if( c[0] == '*' )
	{
	  elem1 = stack[top-1];
	  top--;
	  elem2 = stack[top-1];
	  top--;
	  stack[top] = elem1 * elem2;
	  top++;
	}
      
      else
	{
	  stack[top] = atoi( c );
	  top++;
	}
    }
  
  printf("%d\n", stack[0]);
  
  return 0;
}



Measured memory_bytes: 2108
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert

template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 100001; //check the limits, dummy
 
int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
    int N, M; cin >> N >> M;

    ll K; cin >> K;
    ll A[N], B[M]; F0R(i, N) cin >> A[i];
    F0R(i, M) cin >> B[i];

    ll as = 0; F0R(i, N) as += A[i];
    ll bs = 0;
    int bp = 0;
    int ans = 0;
    F0Rd(i, N+1) {
        if (i < N) as -= A[i];
        if (as <= K) {
            while (bp < M && as + bs + B[bp] <= K) {
                 bs += B[bp]; bp++;
            }
            ckmax(ans, i + bp);
        }
//        cout << as << " " << bs << " " << bp << nl;
    }
    cout << ans << nl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343



Measured memory_bytes: 6784
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        h: usize, _w: usize,
        board: [String; h]
    }
    for row in board {
        println!("{}", row);
        println!("{}", row);
    }
}


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

int main() {

    int N;
    cin >> N;

    vector<int> X(N);
    vector<int> Y(N);
    vector<int> T(N);

    for (int i = 0; i < N; i++) {
        cin >> T.at(i) >> X.at(i) >> Y.at(i);
    }

    int x =  0;
    int y = 0;
    int t= 0;

    int dx = 0;
    int dy = 0;
    int dt = 0;

    bool ok = true;
    for (int i = 0; i < N; i++) {
        dx = abs(x -X.at(i));
        dy = abs(y - Y.at(i));
        dt = T.at(i) - t;

        if (dt - (dx + dy) >= 0 && (dx + dy - dt) % 2 == 0) {
            x = X.at(i);
            y = Y.at(i);
            t = T.at(i);
        }
        else {
            ok = false;
            break;
        }
    }

    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 4576
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)

H, W = map(int, input().split())

grid = [["#"]*(W+2) for _ in range(H+2)]

for i in range(1, H+1):
    s = input()
    for j, c in enumerate(s):
        grid[i][j+1] = c

cntGrid = [[0]*(W+2) for _ in range(H+2)]
for i in range(1, H+1):
    for j in range(1, W+1):
        if grid[i][j] == "#":
            cntGrid[i][j] = "#"
            d = [-1, 0, 1]
            for x in d:
                for y in d:
                    if x == 0 and y == 0:
                        continue
                    else:
                        if not grid[i+x][j+y] == "#":
                            cntGrid[i+x][j+y] += 1
for l in cntGrid[1:-1]:
    print("".join(map(str, l[1:-1])))


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

#define taskname ""
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define for0(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef complex <ld> cd;
typedef vector <cd> vcd;
typedef vector <int> vi;

template<class T> using v2d = vector <vector <T> >;
template<class T> bool uin(T &a, T b)
{
    return a > b ? (a = b, true) : false;
}
template<class T> bool uax(T &a, T b)
{
    return a < b ? (a = b, true) : false;
}

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

const int maxN = 3e3 + 10;
const int maxS = 3e3 + 10;
const ll mod = 998244353;

int n, s, a[maxN];
ll dp[maxS], ans = 0;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> s;
    for1(i, n)
    {
        cin >> a[i];
    }
    for1(i, n)
    {
        dp[0] = i;
        if (s >= a[i])
        {
            ans += dp[s - a[i]] * (n - i + 1) % mod;
            if (ans >= mod)
            {
                ans -= mod;
            }
        }
        for (int j = s; j >= a[i]; --j)
        {
            dp[j] += dp[j - a[i]];
            if (dp[j] >= mod)
            {
                dp[j] -= mod;
            }
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  if(k%2==1){
    int64_t c=n/k;
    cout<<c*c*c<<endl;
  }
  else{
    int64_t c=n/(k/2);
    cout<<(c/2)*(c/2)*(c/2)+(c-c/2)*(c-c/2)*(c-c/2)<<endl;
  }
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 1000007
#define INF63 1061109567
#define INF127 9187201950435737471
#define UINF 18446744073709551615
#define F first
#define S second
#define ll long long
#define N 2010
using namespace std;
ll n,dp[N][N],ans=0;
pair<ll,ll> a[N];
int main(){
	ll i,j,k;
	cin>>n;
	for(i=0;i<n;i++)
	{
		cin>>a[i].F;
		a[i].S=i;
	}
	sort(a,a+n);
	reverse(a,a+n);
	memset(dp,0,sizeof(dp));
	for(i=0;i<n;i++)
	{
		for(j=0;j<=i;j++)
		{
			k=i-j;
			dp[j+1][k]=max(dp[j+1][k],dp[j][k]+abs(a[i].S-j)*a[i].F);
			dp[j][k+1]=max(dp[j][k+1],dp[j][k]+abs(a[i].S-(n-k-1))*a[i].F);
		}
	}
	for(i=0;i<n;i++)
	{
		ans=max(ans,dp[i][n-i]);
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 35240
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)
	for h := 1; h <= 3500; h++ {
		for n := 1; n <= 3500; n++ {
			// 4/N = 1/h + 1/n + 1/w
			// 1/w = 4/N - (1/h + 1/n)
			// h*n*N/w =  4*n*h - (n*N+h*N)
			// w = h*n*N / (4*n*h-(n*N+h*N))
			A := 4*n*h - (n*N + h*N)
			B := h * n * N
			if A > 0 && B%A == 0 {
				w := B / A
				fmt.Println(h, n, w)
				return
			}
		}
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(b);i>(a);--i)
#define eper(i,a,b) for(int i=((int)(a));i>=b;--i)
#define pb push_back
#define mp make_pair
#define INF 2000000000
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a, b)*b;}

string s;
string d[] = {"dream", "dreamer", "erase", "eraser"};
int main() {
 ios::sync_with_stdio ( false );
 cin.tie ( 0 );
    cin >> s;
    int n = (int)s.size();
    int ans = n, pos = n;
    eper(i, n-1, 0) {
        string sub = s.substr(i, pos - i );
        rep(j, 0, 4) {
            if (d[j] == sub) {
                ans -= sub.size();
                pos = i;
            }
        }
    }
    if (ans) cout << "NO" << endl;
    else cout << "YES" << endl;
    return 0;
}


Measured memory_bytes: 512
import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;

public class Main {

	static final Scanner in = new Scanner(System.in);
	static final PrintWriter out = new PrintWriter(System.out,false);
	static boolean debug = false;

	static BitSet ps;

	static BitSet eratosthenes(int m) {
		int n = m + 1;
		BitSet isp = new BitSet();
		if (n < 2) return isp;

		isp.set(2, n, true);

		for (int i=2; i*i<n; i=isp.nextSetBit(i+1)) {
			for (int j=i+i; j<n; j+=i) {
				isp.set(j,false);
			}
		}

		return isp;
	}


	static boolean solve() {
		int n = in.nextInt();
		if (n == 0) return false;

		if (ps.get(n)) {
			out.println("0");
		} else {
			int l = n, r = n;
			while (!ps.get(--l));
			while (!ps.get(++r));
			out.println((r-l));
		}

		return true;
	}

	public static void main(String[] args) {
		debug = args.length > 0;
		long start = System.nanoTime();

		ps = eratosthenes(1300000);

		while(solve());
		out.flush();

		long end = System.nanoTime();
		dump((end - start) / 1000000 + " ms");
		in.close();
		out.close();
	}

	static void dump(Object... o) { if (debug) System.err.println(Arrays.deepToString(o)); }
}

Measured memory_bytes: 30380
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
#import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
#from itertools import accumulate #list(accumulate(A))

N = ii()
V = li()
C = li()

sa = [V[i] - C[i] for i in range(N) if V[i] - C[i] > 0]

print(sum(sa))

Measured memory_bytes: 8876
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()

int main(){
  ll n; cin >> n;
  ll ans = 0;
  while(n>0){
    if(n%10==2) ans++;
    n /= 10;
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<typename T> using gpp_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T, typename L> using gpp_map = tree<T, L, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename T> using gpp_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;*/
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define all(v) v.begin(),v.end()
#define SZ(v) ((int)v.size())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)
#define bit(n) (1LL<<(n))
#define bit_exist(x, n) ((x >> n) & 1)
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v) { cout << #v << "=" << endl; REP(i_debug, v.size()){ cout << v[i_debug] << ","; } cout << endl; }
#define mdebug(m) { cout << #m << "=" << endl; REP(i_debug, m.size()){ REP(j_debug, m[i_debug].size()){ cout << m[i_debug][j_debug] << ","; } cout << endl;} }
#define Return(ans) { cout << (ans) << endl; return 0; }
#define pb push_back
#define f first
#define s second
#define int long long
#define INF 1000000000000000000
template<typename T> istream &operator>>(istream &is, vector<T> &v){ for (auto &x : v) is >> x; return is; }
template<typename T> ostream &operator<<(ostream &os, vector<T> &v){ for(int i = 0; i < v.size(); i++) { cout << v[i]; if(i != v.size() - 1) cout << endl; }; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p){ cout << '(' << p.first << ',' << p.second << ')'; return os; }
template<typename T> void Out(T x) { cout << x << endl; }
template<typename T1, typename T2> void Ans(bool f, T1 y, T2 n) { if(f) Out(y); else Out(n); }

using vec = vector<int>;
using mat = vector<vec>;
using Pii = pair<int, int>;
using PiP = pair<int, Pii>;
using PPi = pair<Pii, int>;
using bools = vector<bool>;
using pairs = vector<Pii>;

//int dx[4] = {1,0,-1,0};
//int dy[4] = {0,1,0,-1};
//char d[4] = {'D','R','U','L'};

const int mod = 1000000007;
//const int mod = 998244353;
//#define Add(x, y) x = (x + (y)) % mod
//#define Mult(x, y) x = (x * (y)) % mod



signed main(){

    int X, Y, Z; cin >> X >> Y >> Z;
    swap(X, Y);
    swap(X, Z);
    cout << X << " " << Y << " " << Z << endl;

    return 0;
}


Measured memory_bytes: 256
import numpy as np

N = int(input())
T, A = map(int, input().split())
height = list(map(int, input().split()))

temp = list(map(lambda x: T - x*0.006, height))

def getNearesValue(list, num):
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]

print(temp.index(getNearesValue(temp, A)) + 1)


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


void sort2vectors_B_up(vector<int> &av, vector<int> &bv) {
  // sort with B in ascending order
        int n = av.size();
        vector<int> p(n), av2(n), bv2(n);
        iota(p.begin(), p.end(), 0);
        sort(p.begin(), p.end(), [&](int a, int b) { return bv[a] < bv[b]; });
        for (int i = 0; i < n; i++) {
                av2[i] = av[p[i]];
                bv2[i] = bv[p[i]];
        }
        av = av2;
        bv = bv2;
}

void printvector(vector<int> vec) {
  for_each(vec.begin(), vec.end(), [](int x) {cout << x;});
  cout << endl;
}

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  vector<int> B(M);
  vector<int> C(N, 0), goal(N, 0);
  for (int i = 0; i < M; ++i) {
    cin >> A.at(i) >> B.at(i);
    --A.at(i);
    --B.at(i);
  }
  int count = 0;
  sort2vectors_B_up(A, B);
  int remove = 0;
  for (int i = 0; i < M; ++i) {    
    if (A.at(i) < remove) {
      continue;
    }
    remove = B.at(i);
    ++count;
  }                                        
  cout << count << endl;
}


Measured memory_bytes: 2944
a,b,c,d= map(int, input().split())

cnt =0
while True:
    if a <= 0:
        print("No")
        exit()
    elif c <= 0:
        print("Yes")
        exit()

    if cnt %2 == 0:
        c -= b
    else:
        a-=d
    cnt+=1


Measured memory_bytes: 61788
#include <bits/stdc++.h>
using namespace std;
#define N 251000
#define ll long long
#define mp make_pair
const ll mod1=1e9+7,mod2=998244353,mod3=19260817;
const ll bas1=2333,bas2=4399,bas3=377,ibas1=461637380,ibas2=924039783,ibas3=18749920;

int n;
ll ans;
char s[N];
ll h1[N],p1[N],h2[N],p2[N],p3[N],h3[N];
map<pair<pair<ll,ll>,ll>,int> m;

ll add1(ll x,ll y) {return (x+y)%mod1;}
ll mul1(ll x,ll y) {return x*y%mod1;}
ll add2(ll x,ll y) {return (x+y)%mod2;}
ll mul2(ll x,ll y) {return x*y%mod2;}
ll add3(ll x,ll y) {return (x+y)%mod3;}
ll mul3(ll x,ll y) {return x*y%mod3;}

int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	p1[0]=1;
	for (int i=1;i<=n;i++) {
		p1[i]=p1[i-1]; h1[i]=h1[i-1];
		if (s[i]=='+') h1[i]=add1(h1[i],p1[i]);
		if (s[i]=='-') h1[i]=add1(h1[i],mod1-p1[i]);
		if (s[i]=='<') p1[i]=mul1(p1[i],ibas1);
		if (s[i]=='>') p1[i]=mul1(p1[i],bas1);
	}
	
	p2[0]=1;
	for (int i=1;i<=n;i++) {
		p2[i]=p2[i-1]; h2[i]=h2[i-1];
		if (s[i]=='+') h2[i]=add2(h2[i],p2[i]);
		if (s[i]=='-') h2[i]=add2(h2[i],mod2-p2[i]);
		if (s[i]=='<') p2[i]=mul2(p2[i],ibas2);
		if (s[i]=='>') p2[i]=mul2(p2[i],bas2);
	}

	p3[0]=1;
	for (int i=1;i<=n;i++) {
		p3[i]=p3[i-1]; h3[i]=h3[i-1];
		if (s[i]=='+') h3[i]=add3(h3[i],p3[i]);
		if (s[i]=='-') h3[i]=add3(h3[i],mod3-p3[i]);
		if (s[i]=='<') p3[i]=mul3(p3[i],ibas3);
		if (s[i]=='>') p3[i]=mul3(p3[i],bas3);
	}
	
	for (int i=n;i;i--) {
		m[mp(mp(h1[i],h2[i]),h3[i])]++;
		ll t1=add1(mul1(h1[n],p1[i-1]),h1[i-1]),t2=add2(mul2(h2[n],p2[i-1]),h2[i-1]),t3=add3(mul3(h3[n],p3[i-1]),h3[i-1]);
		ans+=m[mp(mp(t1,t2),t3)];
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 51328
n=int(input())
s=input()
al=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z']
for i,w in zip(range(len(s)),s):
    idx=al.index(w)+n
    if idx>25:
        idx-=26
    if i==0:
        word=al[idx]
    else:
        word+=al[idx]    
print(word)


Measured memory_bytes: 3064
// Tazoe

#include <iostream>
using namespace std;

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

		if(n==0)
			break;

		char G[257][257];
		for(int i=0; i<=n+1; i++){
			for(int j=0; j<=n+1; j++){
				G[i][j] = '0';
			}
		}

		for(int i=1; i<=n; i++){
			for(int j=1; j<=n; j++){
				cin >> G[i][j];
			}
		}

		int DP[257][257][4];
		for(int i=0; i<=n+1; i++){
			for(int j=0; j<=n+1; j++){
				for(int k=0; k<4; k++){
					DP[i][j][k] = 0;
				}
			}
		}

		int DP_max = 0;

		for(int i=1; i<=n; i++){
			for(int j=1; j<=n; j++){
				if(G[i][j]=='0')
					continue;

				DP[i][j][0] = DP[i-1][j][0]+1;
				DP[i][j][1] = DP[i][j-1][1]+1;
				DP[i][j][2] = DP[i-1][j-1][2]+1;
				DP[i][j][3] = DP[i-1][j+1][3]+1;

				for(int k=0; k<4; k++){
					if(DP[i][j][k]>DP_max){
						DP_max = DP[i][j][k];
					}
				}
			}
		}

		cout << DP_max << '\n';
	}

	return 0;
}

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

int main(){

  long long a,b,k;
  cin >> a >> b >> k;
  
  k-=a;
  a=max((long long)0,-k);
  b=max((long long)0,b-max(k,(long long)0));
  
  cout << a << ' ' << b << endl;
  return 0;
}

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

#define ll long long
#define ar array

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
//freopen("input.txt","r",stdin);
	int n, p;
	string s;
	cin >> n >> p >> s;
	ll ans=0;
	if(p==2) {
		for(int i=0; i<n; ++i)
			if((s[i]-'0')%2==0)
				ans+=i+1;
	} else if(p==5) {
		for(int i=0; i<n; ++i)
			if((s[i]-'0')%5==0)
				ans+=i+1;
	} else {
		map<int, int> mp;
		++mp[0];
		int t=0, p2=1;
		for(int i=n-1; ~i; --i) {
			t=(t+(s[i]-'0')*p2)%p;
			ans+=mp[t];
			mp[t]++;
			p2=p2*10%p;
			//cout<<t<<" "<<ans<<endl;
		}
	}
	cout << ans;
}


Measured memory_bytes: 916
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }


int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  int N; std::cin >> N;
  std::vector<ll> a(N); rep(i,N) std::cin >> a[i];
  ll amax = *std::max_element( all(a) );
  ll amin = *std::min_element( all(a) );
  int amaxid = std::distance(a.begin(), std::max_element( all(a) ));
  int aminid = std::distance(a.begin(), std::min_element( all(a) ));

  std::vector<std::pair<int,int>> ans;
  if ( amax * amin >= 0 ) {
    if ( amax == std::abs(amax) && amin == std::abs(amin) ) {
      for(int i=0; i<N-1; i++) ans.push_back( {i+1, i+2} );
    }
    else {
      for(int i=N-2; i>=0; i--) ans.push_back( {i+2, i+1} );
    }
  }
  else {
    if ( std::abs(amax) >= std::abs(amin) ) {
      for(int i=0; i<N; i++) ans.push_back( {amaxid+1, i+1} );
      for(int i=0; i<N-1; i++) ans.push_back( {i+1, i+2} );
    }
    else {
      for(int i=0; i<N; i++) ans.push_back( {aminid+1, i+1} );
      for(int i=N-2; i>=0; i--) ans.push_back( {i+2, i+1} );
    }
  }
  
  std::cout << sz(ans) << std::endl;
  rep(i,sz(ans)) {
    std::cout << ans[i].first << " " << ans[i].second << std::endl;
//    a[ans[i].second-1] += a[ans[i].first-1];
  }

//  rep(i,N) std::cout << a[i] << " ";
//  std::cout << std::endl;

  return 0;
}


Measured memory_bytes: 256