akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>


#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()


using namespace std;
using namespace __gnu_pbds;

template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
using ll  = long long;

using point = complex<double>;
using ii = pair<int,ll>;

void err(istream_iterator<string> it) {cerr << endl;}
template<typename T, typename... Args>void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << " = " << a << endl;err(++it, args...);}




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

const double EPS = 1e-9;
const long long mod = 1e9 + 7;
const long long INF = 1e18;
const int N = 5e5 + 5;
const ll CONSTANT = 9e18 + 7;




int n, q;
int a[N];
int BIT[N];
void add(int i, int v){

    while(i < N){
        BIT[i] += v;
        i += (i & -i);
    }
}
int g(int i){
    int ret = 0;
    while(i > 0){
        ret += BIT[i];
        i -= (i &-i);
    }
    return ret;
}
int range(int l, int r){
    return g(r) - g(l - 1);
}

vector<int>qry[N];
vector<int>id[N];

bool cmp(int i, int j){
    return a[i] < a[j];
}
int pos[N];
vector<int>ans(N);
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); // TLE
    cin >> n >> q;
    for(int i = 1; i <= n; ++i)
            cin >> a[i];
    int l , r;
    for(int i = 1; i <= q; ++i){
        cin >> l >> r;
        id[r].push_back(i);
        qry[r].push_back(l);
    }


    for(int i = 1; i <= n; ++i){

        if(pos[a[i]])add(pos[a[i]],-1);
        add(i,1);
        pos[a[i]] = i;

        for(int j = 0; j < qry[i].size(); ++j){

            ans[id[i][j]] = range(qry[i][j],i);
        }
    }
    for(int i = 1; i <= q; ++i)cout << ans[i] << '\n';

    return 0;
}


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

int main() {
  int N; cin >> N;
  string a; cin >> a;

  int c = 0;
  string tmp;
  for (int i=0; i<a.length()-2; i++) {
    tmp = a[i];
    tmp += a[i+1];
    tmp += a[i+2];
    if (tmp == "ABC") c++;

  }

  cout << c << endl;

  return 0;
}


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

const int mod=998244353;

long C[2001][2001];

long comb(int n){
	for(int i=0;i<=n;i++){
		C[i][0]=1;
		for(int j=1;j<i;j++){
			C[i][j]=C[i-1][j-1]+C[i-1][j];
			C[i][j]%=mod;
		}
		C[i][i]=1;
	}
}

int main(){
	string s;
	cin >> s;
	int n=s.length();
	int red[n]={};
	red[0]=(s[0]=='0'?2:s[0]=='1'?1:0);
	for(int i=1;i<n;i++) red[i]+=red[i-1]+(s[i]=='0'?2:s[i]=='1'?1:0);
	
	long dp[n+1][2*n+1]={};
	dp[1][0]=(s[0]!='0'?1:0);
	dp[1][1]=(s[0]!='2'?1:0);
	for(int i=2;i<=n;i++){
		for(int j=max(0,red[i-1]-i);j<=min(i,red[i-1]);j++){
			dp[i][j]=(dp[i-1][j]+(j!=0?dp[i-1][j-1]:0))%mod;
		}
	}
	comb(n);
	long ans=0;
	for(int i=max(0,red[n-1]-n);i<=min(n,red[n-1]);i++){
		ans+=dp[n][i]*C[n][red[n-1]-i]%mod;
		ans%=mod;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 92672
#include <bits/stdc++.h>
 #include <math.h>
 #include <iostream>
 #include <iomanip>
 using namespace std;
 
 int main(){
    long long H;
    long long tmp;
    unsigned long ans = 1;
    int i;
   

    cin >> H;

    tmp = log2(H)/1;
    ans = (ans << (tmp+1))-1;

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


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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
ll nextLong() { ll x; scanf("%lld", &x); return x;}

int main2() {
  int A = nextInt();
  int B = nextInt();
  int C = nextInt();
  int D = nextInt();
  cout << min(A,B)+min(C,D) << endl;
  return 0;
}

int main() {

#ifdef LOCAL
  for (;!cin.eof();cin>>ws)
#endif
    main2();
  return 0;
}

Measured memory_bytes: 256
/*
 * FileName:     A
 * CreatedDate:  2020-04-19 20:57:47 +0900
 * LastModified: 2020-04-19 21:05:11 +0900
 */

#include <stdio.h>

int main(void){
    double R;
    scanf("%lf",&R);
    printf("%lf\n",2*3.1415926*R);
    return 0;
}


Measured memory_bytes: 1748
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>//sort,reverse
#include<utility>//pair
#include<queue>//queue,priority queue
#include<deque>//double_ended queue
using namespace std;
int main()
{ 
    long long int n;
    long long int k;
    cin>>n>>k;
    if(n%2==0){
        n=n/2;
        if(k>n){
            cout<<-1<<endl;
        }
        else{
            for(int i=0;i<n;i++){
                cout<<k+2*i<<' '<<k+3*n-i<<' '<<k+4*n+i<<endl;
            }
            cout<<k+2*n-1<<' '<<k+2*n<<' '<<k+5*n<<endl;
            for(int i=0;i<n-1;i++){
                cout<<k+1+2*i<<' '<<k+4*n-1-i<<' '<<k+5*n+1+i<<endl;
            }
        }
    }
    else{
        if(k>(n+1)/2){
            cout<<-1<<endl;
        }
        else{
            for(int i=0;i<(n+1)/2;i++){
                cout<<k+2*i<<' '<<k+n+(n+1)/2-1-i<<' '<<k+n*2+i<<endl;
            }
            for(int i=0;i<(n-1)/2;i++){
                cout<<k+1+2*i<<' '<<k+2*n-1-i<<' '<<k+2*n+(n+1)/2+i<<endl;
            }

        }
    }
    return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll n,k;
    cin >> n >> k;
    vector<ll> h(n);
    rep(i,n) cin >> h[i];

    sort(h.begin(), h.end());
    // vector<ll> ruisekiwa;
    // ruisekiwa.push_back(0);

    // rep(i,n) ruisekiwa.push_back(ruisekiwa[i] + h[i]);

    // rep(i,n+1) {
    //     cout << ruisekiwa[i] << endl;
    // }
    ll ans = INF;
    for (int i = 0; i+k-1<n ; i++) {
        // ll tmp = ruisekiwa[i+k] - ruisekiwa[i];
        ll tmp = h[i+k-1] - h[i];
        ans = min(ans, tmp);
    }
    cout << ans << endl;
}


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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;

template<typename H> bool chmin(H& v1, const H v2) { if (v1 > v2) { v1 = v2; return true; } return false; }
template<typename H> bool chmax(H& v1, const H v2) { if (v1 < v2) { v1 = v2; return true; } return false; }
template<typename H> void read(H& head) { cin >> head; }
template<typename H, typename ...T> void read(H& head, T& ...tail) { cin >> head; read(tail...); }
template<typename H> void write(H head) { cout << head << '\n'; }
template<typename H, typename ...T> void write(H head, T ...tail) { cout << head << " "; write(tail...); }
template<typename ...T> void die(T ...tok) { write(tok...); exit(0); }

int h, w;
int c[10][10];
int a[200][200];

int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);

	read(h, w);
	rep(i, 0, 10) rep(j, 0, 10) read(c[i][j]);
	rep(i, 0, h) rep(j, 0, w) read(a[i][j]);

	rep(k, 0, 10) rep(i, 0, 10) rep(j, 0, 10)
		chmin(c[i][j], c[i][k] + c[k][j]);
	
	ll ans = 0;
	rep(i, 0, h) rep(j, 0, w) if (a[i][j] != -1) 
		ans += c[a[i][j]][1];

	die(ans);
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef long long ll;
const int INF = 1e9;

int main(){
    int N;
    cin >> N;
    vector<int> x(N),y(N),h(N);
    int si = -1;
    rep(i,N){
        cin >> x[i] >> y[i] >> h[i];
        if(h[i]>0)si = i;
    }

    for(int i = 0; i <= 100; i++){
        for(int j = 0; j <= 100; j++){
            bool ok = true;
            int ht = abs(x[si]-j)+abs(y[si]-i)+h[si];
            for(int k = 0; k < N; k++){
                if(!ok)break;
                if(h[k] != max(ht-abs(x[k]-j)-abs(y[k]-i),0))ok = false;
            }
            if(ok){
                printf("%d %d %d\n",j,i,ht);
                return 0;
            }
        }
    }
 
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main()
{
	char a[2];
	
	scanf("%c", a);

	if (a[0] == 'a') {
		printf("vowel\n");
	}
	else if (a[0] == 'i') {
		printf("vowel\n");
	}
	else if (a[0] == 'u') {
		printf("vowel\n");
	}
	else if (a[0]== 'e') {
		printf("vowel\n");
	}
	else if (a[0] == 'o') {
		printf("vowel\n");
	}
	else {
		printf("consonant\n");
	}

	return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm> 
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1000000007;
const ll INF = 1000000000000000001;

int n;
int a[100010];
int main(void){
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];

    sort(a, a + n);
    reverse(a, a + n);

    int ans = 0;
    for (int i = 0; i < n; i++){
        if (i % 2 == 0) ans += a[i];
        else ans -= a[i];
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
from collections import deque
from sys import stdin


def main():
    height, width = map(int, stdin.readline().split())
    q = deque([])
    grid = [list(stdin.readline()) for _ in range(height)]
    distance = [[-1 for _ in range(width)] for _ in range(height)]
    for i in range(height):
        for j in range(width):
            if grid[i][j] == "#":
                q.append((i, j))
                distance[i][j] = 0
    answer = 0
    delta = ((0, 1), (1, 0), (0, -1), (-1, 0))
    while q:
        y, x = q.popleft()
        answer = distance[y][x]
        for dy, dx in delta:
            new_y = y + dy
            new_x = x + dx
            if 0 <= new_y < height and 0 <= new_x < width and grid[new_y][new_x] == ".":
                distance[new_y][new_x] = answer + 1
                grid[new_y][new_x] = "#"
                q.append((new_y, new_x))
    print(answer)


if __name__ == '__main__':
    main()



Measured memory_bytes: 122204
// Dont hack this or I hack ur mama
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <map>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#define ll long long 
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define EPS (1e-9)
using namespace std;

////////////// END OF TEMPLATE
const int nmax = 100010;
int n;
vector < int > graph[nmax];
int p[nmax];
bool visited[nmax];
void find(int u)
{
	visited[u] = true;
	for(int i = 0 ;i < graph[u].size();++i)
	{
		if(visited[graph[u][i]])
			continue;
		find(graph[u][i]);
		p[graph[u][i]] = u;
	}
}
int cnt(int u)
{
	int ret = 1;
	visited[u] = true;
	for(int i = 0 ;i < graph[u].size();++i)
	{
		if(visited[graph[u][i]])
			continue;
		ret += cnt(graph[u][i]);
	}
	return ret;
}
void del(int x, int y)
{
	for(int i = 0 ;i  < graph[x].size(); ++i)
	{
		if(graph[x][i] == y)
			graph[x][i] = x;
	}
	for(int i = 0 ;i  < graph[y].size(); ++i)
	{
		if(graph[y][i] == x)
			graph[y][i] = y;
	}

}
void read()
{
	cin >> n;
	for(int i =0 ; i < n-1; ++i)
	{
		int u,v;
		cin >> u >> v;
		graph[u].pb(v);
		graph[v].pb(u);
	}

}
void solve()
{
	find(1);
	vector < int > path;
	int P = p[n];
	while(P > 1)
	{
		path.pb(P);	
		P = p[P];
	}
	
	if(path.size() == 0)
		del(1,n);
	else if(path.size() == 1)
		del(path[0],n);
	else{
		del(path[path.size()/2],path[path.size()/2-1]);
	}
	
	
	for(int i = 1; i<=n;++i)
		visited[i] = false;
	int cnto = cnt(1);
	int cntn = cnt(n);

	if(cnto <= cntn)
		cout << "Snuke\n";
	else
		cout << "Fennec\n";
}
int main()
{
	std::ios::sync_with_stdio(false);
	read();
	solve();
	return 0;
}


Measured memory_bytes: 11516
def main():
    A, B, K = (int(i) for i in input().split())
    for k in range(K):
        if k & 1:
            if B & 1:
                B -= 1
            A += B//2
            B //= 2
        else:
            if A & 1:
                A -= 1
            B += A//2
            A //= 2
    print(A, B)


if __name__ == '__main__':
    main()


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long Q,H,S,D,N;
    cin >>Q>>H>>S>>D>>N;
    long long q=Q*8,h=H*4,s=S*2,d=D;
    long long X=min((min(q,h)),min(s,d));
    long long Y=min((min(Q*4,H*2)),S);
    if(N%2==0){
        cout <<N/2*X<<endl;
    }
    else{
        cout <<N/2*X+Y<<endl;
    }
}

Measured memory_bytes: 3636
fn main(){
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).unwrap();
	let n = s.trim().parse::<i32>().unwrap();
	if n % 10 == 9 || n / 10 == 9 {
		println!("Yes");
	} else {
		println!("No");
	}
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr ll MOD = 1e9+7;
// dp[i][j] = 和が i 以下になる j 項の数列の数
ll dp[2001][668] = {};
int main()
{
    int s;
    cin >> s;
    for(int i=3; i<=s; ++i){
        dp[i][1] = i-2;
    }
    for(int j=2; j*3<=s; ++j){
        for(int i=3; i<=s; ++i){
            // dp[i][j] = 
            //   和が i-3 以下になる j-1 項の数列の数（これはぴったり和が i になる）
            // + 和が i-1 以下になる j 項の数列の数（これは和が i-1 以下なのでdisjoint）
            dp[i][j] = (dp[i-3][j-1] + dp[i-1][j])% MOD;
        }
    }
    ll ans=0;
    for(int j=1; j*3<=s; ++j){
        ans += dp[s][j] - dp[s-1][j] + MOD;
    }
    cout << ans%MOD;
    return 0;
}


Measured memory_bytes: 13872
#pragma region includes, macros
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <map>
#include <set>
#include <list>
#include <unordered_set>
#include <unordered_map>
#include <stdlib.h>

using namespace std;
 
typedef long long i64;
typedef pair<i64, i64> P;

template<class T>
const T INF = numeric_limits<T>::max();
template<class T>
const T SINF = numeric_limits<T>::max() / 10;
static const i64 MOD = 1000000007;

//int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
//int dx[5] = {-1,0,0,0,1}, dy[5] = {0,-1,0,1,0};
//int dx[8] = {-1,0,1,1,1,0,-1,-1}, dy[8] = {1,1,1,0,-1,-1,-1,0};
//int dx[9] = {-1,0,1,1,1,0,-1,-1,0}, dy[9] = {1,1,1,0,-1,-1,-1,0,0};

struct edge {
	i64 from, to, cost;
	edge(i64 to, i64 cost) : from(-1), to(to), cost(cost) {}
	edge(i64 src, i64 to, i64 cost) : from(src), to(to), cost(cost) {}
};

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}
#pragma endregion

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	i64 n, m;
	cin >> n >> m;
	vector<P> v;
	for(int i = 0; i < n; ++i){
		i64 a, b;
		cin >> a >> b;
		v.push_back(P(a, b));
	}
	sort(v.begin(), v.end());
	i64 sum = 0, cnt = 0;
	for(int i = 0; i < n; ++i){
		if(cnt >= m) break;
		if(cnt + v[i].second >= m){
			sum += (m - cnt) * v[i].first;
			cnt = m;
		}else{
			sum += v[i].first * v[i].second;
			cnt += v[i].second;
		}
	}
	cout << sum << endl;
}

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

using namespace std;
using ll = long long;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;

  ll h = 0, nn = 0, w = 0;
  for (ll i = 1; i <= 3500 && h == 0; ++i) {
    for (ll j = 1; j <= 3500 && h == 0; ++j) {
      ll l = n * i * j;
      ll m = 4ll * (l / n) - (l / i + l / j);
      if (m <= 0) {
        continue;
      }

      if (l % m != 0) {
        continue;
      }

      h = i;
      nn = j;
      w = l / m;
    }
  }

  cout << h << ' ' << nn << ' ' << w << '\n';
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
inline int gi(){
  char ch=getchar();int x=0,q=0;
  while(ch<'0' || ch>'9') ch=='-'?q=1:0,ch=getchar();
  while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
  return q?(-x):x;
}
int f[35000][17],w[35000],c[17][17];
void dp(int &x,int y){
  if (x<y) x=y;
  return;
}
int main(){
  int n=gi(),m=gi(),z,a,b,p,S=(1<<n)-1,d=0;
  for (int i=1; i<=m; ++i){
    a=gi(),b=gi(),p=gi();
    c[a][b]+=p,c[b][a]+=p;
    z=(1<<(a-1))|(1<<(b-1));
    for (int s=1; s<(1<<n); ++s)
      if ((s&z)==z)
	w[s]+=p;
    d+=p;
  }
  memset(f,-100,sizeof(f));
  f[1][1]=0;
  for (int s=1; s<=S; ++s)
    for (int i=1; i<=n; ++i)
      if (s&(1<<(i-1))){
	for (int j=1; j<=n; ++j)
	  if (!(s&(1<<(j-1)))&&c[i][j])
	    dp(f[s|(1<<(j-1))][j],f[s][i]+c[i][j]);
	for (int t=S^s; t; t=(t-1)&(S^s))
	  dp(f[s|t][i],f[s][i]+w[t|1<<(i-1)]);
      }
  int ans=0;
  for (int s=1; s<=S; ++s)
    dp(ans,f[s][n]);
  cout<<d-ans;
  return 0;
}


Measured memory_bytes: 2688
// Author by Md. Jashim Uddin_RMSTU

#include<bits/stdc++.h>
using namespace std;
#define     sf(a)           scanf("%d",&a)
#define     sff(a,b)        scanf("%d %d",&a,&b)
#define     sfff(a,b,c)     scanf("%d %d %d",&a,&b, &c)
#define     pb              push_back
#define     ll              long  long int
#define     fast            ios_base :: sync_with_stdio(false);cin.tie(0)
#define     pi              2*acos(0)
#define     sp              fixed<<setprecision
#define     lcm(a,b)        (a*b)/gcd(a,b)
#define     gcd(a,b)        _gcd(a,b)
#define     forn(i,n)       for(int i=1;i<=n;i++)
#define     M              10000
int main()
 {
   int n;
   cin>>n;
   string s,ss;
   cin>>s>>ss;
   for(int i=0;i<n;++i)cout<<s[i]<<ss[i];

     return 0;
 }



Measured memory_bytes: 256
A = int(input())
B = int(input())

if (A==1 or A==2) and (B==1 or B==2):
  print(3)
elif (A==2 or A==3) and (B==2 or B==3):
  print(1)
elif (A==1 or A==3) and (B==1 or B==3):
  print(2)


Measured memory_bytes: 3060
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

fn main() {
    input!{
        n: u64,
    }
    let mut tmp = 1;
    loop {
        if tmp * 2 > n {
            println!("{}", tmp);
            return;
        }
        tmp *= 2;
    }
}


Measured memory_bytes: 4352
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,s,f) for(int i=s;i<f;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define endl "\n"
#define fcout cout<<fixed<<setprecision(15)
typedef pair<int, int> P;
//struct edge { int to, cost; };

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; }

bool prime(int n) {
    for (int i = 2; i <= sqrt(n); i++) {
        if (n % i == 0)return false;
    }
    return n != 1;
}
int gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
int lcm(int x, int y) {
return x / gcd(x, y) * y;
}
int mod_pow(int n, int p, int m) {
    if (p == 0) return 1;
    if (p % 2 == 0) {
        int t = mod_pow(n, p / 2, m);
        return (t * t) % m;
    }
    return n * mod_pow(n, p - 1, m) % m;
}
int extGCD(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    long long d = extGCD(b, a % b, y, x);
    y -= a / b * x;
    return d;
}
int modinv(int a, int m) {
    int b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
int modinv2(int a, int mod) {
    return mod_pow(a, mod - 2, mod);
}
int digit(int x) {
    int cnt = 0;
    while (x > 0) {
        cnt += x % 10;
        x /= 10;
    }
    return cnt;
}
int read() {
    int tmp;
    cin >> tmp;
    return tmp;
}
int xor128() {
    static int x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    int t = (x xor (x << 11));
    x = y; y = z; z = w;
    return (w = (w xor (w >> 19)) xor (t xor (t >> 8)));
}
map<int, int> factaring(int x) {
    map<int, int>ans;
    int now = 2;
    while (now * now <= x) {
        if (x % now == 0) {
            x /= now;
            ans[now]++;
        }
        else now++;
    }
    if (x != 1) ans[x]++;
    return ans;
}
int comb(int n, int k, int mod) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    k = min(k, n - k);
    int x = 1, y = 1;
    rep(i, k) {
        y *= i + 1;
        y %= mod;
    }
    for (int i = n - k + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }
    return x * modinv(y, mod) % mod;
}

signed main() {
    //srand((unsigned)time(NULL));

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

    int x;
    cin >> x;
    int a = 100;
    int cnt = 0;
    while (1) {
        a *= 1.01;
        cnt++;
        if (a >= x) {
            cout << cnt << endl;
            return 0;
        }
    }

    return 0;
}


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

int main() {
  double r;
  cin >> r;
  
  double s = r * r * 3.14159265358979;
  double l = r * 2 * 3.14159265358979;
  printf("%.8f %.8f\n", s,l);
}


Measured memory_bytes: 3212
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;

int main(){
	char com[20002];
	scanf("%s", com);
	vector<int> h;
	h.push_back(0);
	h.push_back(0);
	for (int i = 0; i < (int)strlen(com); i++){
		switch (com[i]){
		case '_':
			h.push_back(h[i + 1]);
			break;
		case '\\':
			h.push_back(h[i + 1] - 1);
			break;
		case '/':
			h.push_back(h[i + 1] + 1);
			break;
		default:
			break;
		}
	}
	
	int min = h[1];
	int max = h[1];
	for (int i = 2; i < (int)h.size(); i++){
		if (min > h[i]) min = h[i];
		if (max < h[i]) max = h[i];
	}
	h[0] = min;
	h.push_back(min);
	
	vector<int> smoothed(h.size(), max);
	int curmax = h[0];
	for (int i = 0; i < (int)h.size(); i++){
		if (h[i] > curmax) curmax = h[i];
		smoothed[i] = curmax;
		if (curmax == max) break;
	}
	curmax = h[h.size() - 1];
	for (int i = h.size() - 1; i >= 0; i--){
		if (h[i] > curmax) curmax = h[i];
		smoothed[i] = curmax;
		if (curmax == max) break;
	}

	int water = 0;
	int sum = 0;
	bool ispond = false;
	vector<int> ponds;
	for (int i = 0; i < h.size(); i++){
		if (smoothed[i] > h[i]){
			ispond = true;
		}
		if (ispond) water += ((smoothed[i] - h[i]) + (smoothed[i - 1] - h[i - 1]));
		if (ispond && smoothed[i] == h[i]){
			ispond = false;
			ponds.push_back(water/2);
			sum += water / 2;
			water = 0;
		}
	}

	cout << sum << endl << ponds.size();
	for (int i = 0; i < ponds.size(); i++){
		cout << " " << ponds[i];
	}
	cout << endl;
		
	return 0;
}


Measured memory_bytes: 3384
//! ----------------------------------------------
//! Framework <https://github.com/vain0x/procon>
//!
//! See the bottom of file for solution.
//! ----------------------------------------------

#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Display, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

/// Print values to standard error if debug mode.
#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), stderr());
            writeln!(err, "\x1B[33m{}\x1B[0m = {:?}", e, $e).unwrap()
        })*
    };
}

/// Read from standard input and parse each word.
/// - `read!(T, U, ..)` parses a line as a tuple of words.
/// - `read![[T]]` parses a line as an array of words.
/// - `read![..; N]` parses `N` lines, using `read!(..)` repeatedly.
#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

/// Read a line from standard input.
#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();

    #[allow(deprecated)]
    buf.trim_right().to_owned()
}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let C = read![String; 2];

    let C = C
        .into_iter()
        .map(|row| row.chars().collect::<Vec<_>>())
        .collect::<Vec<_>>();

    let ok = (0..3).all(|i| C[0][i] == C[1][2 - i]);

    println!("{}", if ok { "YES" } else { "NO" })
}


Measured memory_bytes: 4352
n, m, q = gets.split.map(&:to_i) 

trains = Array.new(n+1){Array.new(n+1)}
all_trains = Array.new(n+1){Array.new(n+1)}
ending_trains = Array.new(n+1){Array.new(n+1)}

for i in 1..n 
	for j in 1..n 
		trains[i][j] = 0
		all_trains[i][j] = 0
		ending_trains[i][j] = 0
	end
end

for i in 1..m 
	l, r = gets.split.map(&:to_i)
	trains[l][r] += 1
end

for j in 1..n
	for i in (1..j).reverse_each
		if i == j
			ending_trains[i][j] = trains[i][j]
		else
			ending_trains[i][j] = ending_trains[i+1][j] + trains[i][j]
		end
	end
end

queries = Array.new
for j in 1..q 
	pi, qi = gets.split.map(&:to_i)
	query = {p: pi, q: qi}
	queries.push(query)
end


for i in 1..n 
	for j in i..n 
		if i == j 
		    all_trains[i][j] = ending_trains[i][j]
		else
			all_trains[i][j] = all_trains[i][j-1] + ending_trains[i][j]
		end
	end
end

for i in 0..q-1
	left = queries[i][:p] 
	right = queries[i][:q]
	
	puts all_trains[left][right]
end

Measured memory_bytes: 38012
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num::clamp;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout()]
fn main() {
    input! {
        n: usize, m: usize,
        mut ab: [(isize, i64); n]
    }

    ab.sort_by_key(|&(a, b)| (Reverse(b), a));
    let mut booked = (0..m as isize).collect_vec();
    let mut ans = 0;
    for (days, money) in ab {
        let idx = m as isize - days;
        if idx < 0 {
            continue;
        }
        let mut idx2 = booked[idx as usize];
        while idx2 >= 0 && idx2 != booked[idx2 as usize]  {
            idx2 -= 1;
        }
        if idx2 >= 0 {
            ans += money;
            booked[idx2 as usize] = idx2 - 1;
        }
        booked[idx as usize] = idx2 - 1;
    }
    println!("{}", ans);
}


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

namespace ABC091B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var cards = new Dictionary<string, int>();
            for (var i = 0; i < N; i++)
            {
                var s = Console.ReadLine();
                if (cards.ContainsKey(s))
                {
                    cards[s]++;
                }
                else
                {
                    cards[s] = 1;
                }
            }
            var M = int.Parse(Console.ReadLine());
            for (var i = 0; i < M; i++)
            {
                var s = Console.ReadLine();
                if (cards.ContainsKey(s))
                {
                    cards[s]--;
                }
                else
                {
                    cards[s] = -1;
                }
            }

            var answer = Math.Max(0, cards.Values.Max());
            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 28324
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass
{
	public const long Giri = 1000000007;

	public static void Main(string[] args)
	{
		var s = Console.ReadLine();
		
		s = s.Replace("eraser", "").Replace("erase", "").Replace("dreamer", "").Replace("dream", "");
		
		Console.WriteLine(s.Length==0?"YES":"NO");
	}
	
	static long GCD(long a, long b)
	{
		var v = new[] { a, b };
		while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
		return v[0];
	}
	public static string[] Input() { return Console.ReadLine().Split(' '); }
	public static int Clamp(int val, int max, int min = 0) { return Math.Min(max, Math.Max(min, val)); }
}

public static class Smarter
{
	public static int ToInt(this string str) { return int.Parse(str); }
	public static long ToLong(this string str) { return long.Parse(str); }
	public static int[] ToInt(this string[] str)
	{
		var r = new int[str.Length];
		for(int i = 0; i < str.Length; i++) r[i] = str[i].ToInt();
		return r;
	 }
}



Measured memory_bytes: 13140
class PriorityQueue
  def initialize(&comp)
    @heap = []
    @node_num = 0
    if !block_given?
      @comp = lambda { |x, y| x <= y }
    else
      @comp = comp
    end
  end

  def push(x)
    i = @node_num # 自分のノード番号
    @node_num += 1
    while i > 0
      par = (i - 1) / 2 # 親のノード番号
      break if @comp.call(@heap[par], x) # 逆転してないなら抜ける
      # 親ノードを下ろして自分を上に
      @heap[i] = @heap[par]
      i = par
    end
    @heap[i] = x
  end

  alias_method(:<<, :push)

  def pop
    # 最(小|大)値
    ret = @heap[0]
    # 根にもってくる値
    @node_num -= 1
    x = @heap[@node_num]
    # 根から下ろしていく
    i = 0
    while i * 2 + 1 < @node_num
      # 子どうしを比較
      a, b = i * 2 + 1, i * 2 + 2
      a = b if b < @node_num && !@comp.call(@heap[a], @heap[b])
      break if @comp.call(x, @heap[a])
      @heap[i] = @heap[a]
      i = a
    end
    @heap[i] = x
    return ret
  end

  def get
    @node_num == 0 ? nil : @heap[0]
  end

  def empty?
    return get.nil?
  end

  def sum
    @heap.inject(:+)
  end
end

n, m = gets.split.map(&:to_i)
a = gets.split.map(&:to_i).sort.reverse
q = PriorityQueue.new(){ |x, y| x > y }
a.each do |ai|
    q << ai
end
m.times do
    max_n = q.pop()
    q << (max_n / 2)
end
p q.sum


Measured memory_bytes: 13080
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <math.h> 
#include <iomanip>
#include <string.h>
#include <vector>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
 
const int N = 2e5 + 5;
 
 
int vis[N];
 
 
int32_t  main() {
 
	IOS;
 
	
	int a;
	double b;
 
	cin >> a >> b;
 
	int c = b * 100+0.5;
 
	int ans = a*c /100; 
	cout << fixed << ans << endl;
 
 
}

Measured memory_bytes: 3196
#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 +7;

long long powmod(long long x, long long y){
    long long ret=1;
    while(y--){
        ret *= x;
        ret %= mod;
    }
    return ret;
}

int main(){
    long long N; cin>>N;
    
    long long all = powmod(10,N);
    long long no0 = powmod(9,N);
    long long no9 = powmod(9,N);
    long long no09 = powmod(8,N);
    long long ans = all - no0 - no9 + no09;
    ans = (ans%mod+mod)%mod;
    cout << ans << endl;
}




Measured memory_bytes: 3636
from itertools import accumulate 
n,k=map(int,input().split())
A=[int(i) for i in input().split()]
S=list(accumulate(A))
S.insert(0,0)

L=[ (s-i)%k  for i,s in enumerate(S)]
def f(l):
    return sum([x*(x-1)//2 for x in l])

from collections import Counter

ans=0
d = Counter(L[1:k])
for i in range(n):
    ans += d[L[i]]
    #print(L[i+1:i+k],d)
    d[L[i+1]] -= 1
    if i+k <= n:
        d[L[i+k]] += 1
print(ans)

Measured memory_bytes: 117708
import java.util.*;

public class Main {
  static int[] par;
  static int[] rank;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int k = sc.nextInt();
    par = new int[n + 1];
    rank = new int[n + 1];

    int[] f = new int[n + 1];
    init(n + 1);
    for(int i = 0; i < m; i++) {
      int a = sc.nextInt();
      int b = sc.nextInt();
      f[a]++;
      f[b]++;
      unite(a, b);
    }

    int[] ans = new int[n + 1];

    int[] num = new int[n + 1];

    for(int i = 1; i <= n; i++) {
      num[find(i)]++;
    }
    
    for(int i = 1; i <= n; i++) {
      ans[i] = num[find(i)] - f[i] - 1;
    }

    for(int i = 0; i < k; i++) {
      int c = sc.nextInt();
      int d = sc.nextInt();
      if(same(c, d)) {
        ans[c]--;
        ans[d]--;
      }
    }

    for(int i = 1; i < n + 1; i++) {
      System.out.print(ans[i]);
      System.out.print(" ");
    }
  }
  static void init(int m) {
      for(int i = 0; i < m; i++) {
        par[i] = i;
        rank[i] = 1;
      }
    }
  static int find(int x) {
      if(par[x] == x) {
        return x;
      } else {
        return par[x] = find(par[x]);
      }
    }
  static void unite(int x, int y) {
      x = find(x);
      y = find(y);
      if(x != y) {
        if(rank[x] < rank[y]) {
          par[x] = y;
          rank[y] += rank[x];
        } else {
          if(rank[x] == rank[y]) {
            if(x > y) {
              par[x] = y;
              rank[y] += rank[x];
            } else {
              par[y] = x;
              rank[x] += rank[y];
            }
          } else {
            par[y] = x;
            rank[x] += rank[y];
          }
        }
      }
    }
  static boolean same(int x, int y) {
      return find(x) == find(y);
    }
}

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

template<class Abel> struct STLP{//[0,STLP.n)
    vector<Abel> dat,lazy_val;
    vector<bool> lazy;
    long long n;
    Abel unity;

    STLP(long long n_origin, Abel SUM_UNITY){
        unity=SUM_UNITY;
        long long i=0;
        while(n_origin>(1<<i)) i++;
        n = (1<<i);
        dat.resize(2*n -1);
        lazy_val.resize(2*n-1);
        lazy.resize(2*n-1);
        for(i=0; i< 2*n -1; i++){
            dat[i]=1000000000000;
            lazy_val[i]=SUM_UNITY;
            lazy[i]=0;
        }
    }

    void eval(long long k, long long l, long long r){
        if(lazy[k]==1){
            dat[k]=lazy_val[k];
            if(r-l>1){
                lazy[k*2+1]=1;
                lazy[k*2+2]=1;
                lazy_val[k*2+1]=lazy_val[k];
                lazy_val[k*2+2]=lazy_val[k];
            }
            lazy[k]=0;
            lazy_val[k]=unity;
        }
    }

    void update_range(Abel x, long long a, long long b, long long k, long long l, long long r){//[a,b)
        eval(k,l,r);
        if(r<=a||b<=l) return;
        if(a<=l&&r<=b){
            lazy[k]=1;
            lazy_val[k]=x;
            eval(k,l,r);
            return;
        }
        update_range(x,a,b,k*2+1, l, (l+r)/2);
        update_range(x,a,b,k*2+2, (l+r)/2, r);
        dat[k]=min(dat[k*2+1],dat[k*2+2]);
        return;
    }

    Abel min_range(long long a, long long b, long long k, long long l, long long r){//[a,b)
        eval(k,l,r);
        if(r<=a||b<=l) return 1000000000000;
        if(a<=l&&r<=b) return dat[k];
        Abel vl=min_range(a,b,k*2 +1, l, (l+r)/2);
        Abel vr=min_range(a,b,k*2 +2, (l+r)/2, r);
        return min(vl,vr);
    }
};

int main(){
    long long N,Q;
    cin >> N >> Q;
    long long i,j;
    STLP<long long> STLProw((N-2LL),0LL), STLPcol((N-2LL),0LL);
    long long ans=(N-2)*(N-2);
    long long num, x;
    long long minrow=N-2, mincol=N-2;
    STLProw.update_range(0,0,N-2,0,0,STLProw.n);
    STLPcol.update_range(0,0,N-2,0,0,STLPcol.n);
    for(i=1; i<=Q; i++){
        cin >> num >> x;
        x-=2;
        if(num==1){
            if(x<mincol){
                ans-=minrow;
                STLPcol.update_range(minrow,x,mincol,0,0,STLProw.n);
                mincol=x;
            }else{
                ans-=STLPcol.min_range(x,x+1,0,0,STLPcol.n);
            }
        }else{
            if(x<minrow){
                ans-=mincol;
                STLProw.update_range(mincol,x,minrow,0,0,STLPcol.n);
                minrow=x;
            }else{
                ans-=STLProw.min_range(x,x+1,0,0,STLProw.n);
            }
        }
    }
    cout << ans << endl;
    system("pause");
    return 0;
}

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

int main()
{
	int N;
	int a[100001];
	bool button[100001];
	cin >> N;
	REP(i, 0, N) {
		cin >> a[i];
		button[i] = false;
	}

	int idx = 0, cnt = 0;
	while (!button[idx]) {
		button[idx] = true;

		if (idx == 1) {
			cout << cnt << endl;
			return 0;
		}

		idx = a[idx] - 1;
		cnt++;
	}
	cout << -1 << endl;

	return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  int a,b,c,x,y;
  cin >> a >> b >> c >> x >> y;
  c *= 2;
  int cost = 1e9;
  for(int i=0; i<=1e5; i++){
    cost = min(cost, i*c+max(0,x-i)*a+max(0,y-i)*b);
  }
  cout << cost << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef long long int ll;
constexpr int kN = 100;
int a[kN];
ll dp[kN];
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	dp[1] = 1000;
	for (int i = 2; i <= n; i++) {
		for (int j = 1; j < i; j++) {
			dp[i] = max(dp[i], dp[j]);
			dp[i] = max(dp[i], dp[j] % a[j] + (dp[j] / a[j]) * a[i]);
		}
	}
	printf("%lld\n", dp[n]);
}


Measured memory_bytes: 1680
#include <iostream>

using namespace std;

int main()
{
    int a,b,c,j=0,k=0;
    cin>>a>>b>>c;
    j=b-a;
    k=c-b;
    if(j==k)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }

    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String S = scan.next();
        char[] d = S.toCharArray();
        int i = 0;
        if (d.length % 2 != 0) {
            System.out.println("No");
            return;
        }
        while (i < d.length - 1) {
            if (d[i] == 'h' && d[i+1] == 'i') {
                i += 2;
                continue;
            }
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
    }
}


Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <string>
using namespace std;
typedef long long ll;
#define anyfill(n,s) setw(n) << setfill(s)
int N,M;
int P[100000],Y[100000];
vector<int> yd[100001];
int main(){
  cin>>N>>M;
  for(int i = 0; M > i; i++){
    cin >> P[i] >> Y[i];
    yd[P[i]].push_back(Y[i]);
  }
  for(int i = 1; N >= i; i++){
    sort(yd[i].begin(),yd[i].end());
  }
  for(int i = 0; M > i; i++){
  // cout << anyfill(7-to_string(P[i]).size(),'0') << P[i];
  // int b = lower_bound(yd[P[i]].begin(),yd[P[i]].end(),Y[i])-yd[P[i]].begin()+1;
  // cout << anyfill(7-to_string(b).size(),'0') << b << endl;
    printf("%012lld\n",ll(P[i])*1000000+int(lower_bound(yd[P[i]].begin(),yd[P[i]].end(),Y[i])-yd[P[i]].begin())+1);
  }
}

Measured memory_bytes: 7808
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 11:09-

            int n = sc.nextInt();
            int[] vs = new int[n];

            for (int i = 0; i < vs.length; i++) vs[i] = sc.nextInt();

            int cnt = 0;
            for (int i = 1; i < n - 1; i++) {
                if (vs[i] > vs[i - 1] && vs[i] < vs[i + 1] ||
                        vs[i] < vs[i - 1] && vs[i] > vs[i + 1]) {
                    cnt++;
                }
            }

            out.println(cnt);
        }
    }
}


Measured memory_bytes: 21844
W, H, N = map(int, input().split())
rect = [[1 for i in range(W+1)] for j in range(H+1)]

for i in range(N):
    x, y, a = map(int, input().split())
    if a == 1:
        for j in range(H+1):
            for k in range(x):
                rect[j][k] = 0
    elif a == 2:
        for j in range(H+1):
            for k in range(x+1, W+1):
                rect[j][k] = 0
    elif a == 3:
        for j in range(y):
            for k in range(W+1):
                rect[j][k] = 0
    else:
        for j in range(y+1, H+1):
            for k in range(W+1):
                rect[j][k] = 0
                
ret = 0
for i in range(H):
    for j in range(W):
        if rect[i][j] and rect[i+1][j] and rect[i][j+1] and rect[i+1][j+1]:
            ret += 1
            
print(ret)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cout << (#x) << " is " << (x) << '\n'
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef double db;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a; }
//head

void solve(){
    string s, t;
    cin >> s >> t;
    int n = (int) s.size();
    for (int i = 0; i < n; i++){
        if (s == t){
            cout << "Yes\n";
            return;
        }
        s = s[n-1] + s.substr(0, n-1);
    }
    cout << "No\n";
}

int main(void){ 
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    //int t; cin >> t; while (t--)
        solve();
}

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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<int> VECINT;
typedef vector<ll> VECLL;

int main() {
  // int A,B,C;cin>>A>>B>>C;
  VECINT AS(3);
  REP(i,3) cin>>AS[i];
  sort(ALL(AS));

  // 小さい二つが同じ場合はそれに1を足していくだけ
  if (AS[0]==AS[1]) {
    OUT(AS[2]-AS[1]);
    return 0;
  }

  // 小さい二つに１を足していって、二番目が三番目と同じになるまで
  // 最後に一番目に２づつ足していき、同じか１超えるかたら、揃える
  int first_gap = AS[2]-AS[1];
  int second_gap = AS[2]-(AS[0]+first_gap);
  if (second_gap%2==0) {
    OUT(first_gap+second_gap/2);
  } else {
    OUT(first_gap+second_gap/2+2);
  }

  return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = Integer.parseInt(sc.next());
        
        long[] t = new long[N];
        
        t[0] = Long.parseLong(sc.next());
        long ans = t[0];
        if(N > 1) {
            t[1] = Long.parseLong(sc.next());
            ans = t[0] / saiyaku(t[1], t[0]) * t[1];
            for(int i=2; i<N; i++) {
                t[i] = Long.parseLong(sc.next());
                ans = t[i] / saiyaku(t[i], ans) *ans;
            }
        }
        System.out.println(ans);
        
        
    }
    
    //最大公約数
    public static long saiyaku(long a, long b) {
        if(a < b) return saiyaku(b, a);
        if(b == 0) return a;
        long w = b;
        a = a % b;
        b = w;
        return saiyaku(a, b);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n,i;
    cin>>n;
    vector<int> A(n+1);
    vector<int> B(n+1);
    vector<int> C(n);
    int sum = 0;
    for(i=1;i<=n;i++){
        cin>>A[i];
    }
    for(i=1;i<=n;i++){
        cin>>B[i];
        sum+=B[i];
    }
    for(i=1;i<=n-1;i++){
        cin>>C[i];
    }
    for(i=2;i<=n;i++){
        if(A[i]==A[i-1]+1)
            sum+=C[A[i-1]];
    }

    cout<<sum;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(a == b) {
			System.out.println(a);
		}else {
			if(a > b) {
				System.out.println(a - 1);
			}else {
				System.out.println(a);
			}
		}

	}

}


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

int main() {
  int N, a, b;
  //N = abcdefgh
  cin >> N;
  a = 0;
  b = 1000000000;
  for (int i = 9; i > 0; i --){
    a += N % b / (b / 10);
    b /= 10;
  }
  if (N % a == 0)cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        if (s.charAt(2)==s.charAt(3) && s.charAt(4)==s.charAt(5)){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 22996