akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#define ll long long
using namespace std;

const ll N=210;
ll n,ans,a[N],b[N],c[N],mod[N];

inline ll read(){
    ll x=0,tmp=1;
    char ch=getchar();
    while(!isdigit(ch)){
        if(ch=='-') tmp=-1;
        ch=getchar();
    }
    while(isdigit(ch)){
        x=(x<<3)+(x<<1)+(ch^48);
        ch=getchar();
    }
    return tmp*x;
}

inline ll ksm(ll x,ll y,ll mod){
    ll ans=0;
    while(y){
        if(y&1) ans=(ans+x)%mod;
        x=(x+x)%mod;
        y>>=1;
    }
    return ans;
}

ll exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){
        x=1; y=0;
        return a;
    }
    ll gcd=exgcd(b,a%b,y,x); y-=a/b*x;
    return gcd;
}

inline ll exCRT(){
    ll M=mod[1],ans=c[1];
    for(ll i=2; i<=n; i++){
        ll A=M,B=mod[i],C=(c[i]-ans%B+B)%B,x,y;
        ll gcd=exgcd(A,B,x,y),bg=B/gcd;
        if(C%gcd) return -1;
        x=ksm(x,C/gcd,bg);
        ans+=x*M;
        M*=bg;
        ans=(ans%M+M)%M;
    }
    return (ans%M+M)%M;
}

inline bool check(){
    for(ll i=1; i<=n; i++){
        if(a[i]!=i) return 0;
    }
    return 1;
}

int main(){
    n=read();
    for(ll i=1; i<=n; i++) a[i]=read();
    for(ll i=1; i<=n; i++) b[i]=read();
    if(check()) return printf("0\n")&0;    
    for(ll i=1; i<=n; i++){
        while(c[i]<=n&&a[i]!=i){
            a[i]=b[a[i]];
            c[i]++;
        }
        if(c[i]>n) return printf("-1\n")&0;
        do{
            a[i]=b[a[i]];
            mod[i]++;
        }while(a[i]!=i);
    }
    cout<<exCRT()<<endl;
    return 0;
}


Measured memory_bytes: 3132
using System;

namespace ABC054B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] bufs = Console.ReadLine().Split(' ');
            int N = Int32.Parse(bufs[0]);
            int M = Int32.Parse(bufs[1]);
            string[] A = new string[N];
            string[] B = new string[M];

            bool res = false;

            for (int i = 0; i < N; i++)
            {
                A[i] = Console.ReadLine();
            }
            for (int i = 0; i < M; i++)
            {
                B[i] = Console.ReadLine();
            }

            int cur = -1;
            int seek = 0;

            while (seek < (N - M + 1))
            {
                cur = A[seek].IndexOf(B[0], cur + 1);
                seek++;
                if (cur != -1)
                {
                    int j = 1;
                    while (j < M)
                    {
                        if (A[seek].IndexOf(B[j], cur, M) != cur) { break; }
                        seek++;
                        j++;
                    }
                    if (j >= M)
                    {
                        res = true;
                    }
                }
            }

            Console.WriteLine(res ? "Yes" : "No");
            return;
        }

    }
}


Measured memory_bytes: 13396
//tourist
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int> 
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fi first
#define se second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
map<ll,int> ret;
int n;
inline void die(){
    puts("-1");
    exit(0);
}
int main(){
    cin>>n;
    vector<ll> d(n);
    for(int i=0;i<n;i++){
        cin>>d[i];
        ret[d[i]]=i;
    }
    vector<int> siz(n,1);
    vector<pii> ans;
    for(int i=0;i<n-1;i++){
        auto it=ret.rbegin();
        int now=it->se;
        ll need=d[now]-n+2*siz[now];
        if(!ret.count(need) || ret[need]==now)
            die();
        int par=ret[need];
        ans.pb(mp(now,par));
        siz[par]+=siz[now];
        ret.erase(--ret.end());
    }
    vector<ll> real_dist(n,-1);
    real_dist[0]=0;
    vector<vector<int> > g(n);
    for(int i=0;i<ans.size();i++){
        g[ans[i].fi].pb(ans[i].se);
        g[ans[i].se].pb(ans[i].fi);
    }
    vector<int> que(1,0);//和queue过不去 
    for(int b=0;b<que.size();b++){
        for(int j=0;j<g[que[b]].size();j++){
            if(real_dist[g[que[b]][j]]==-1){
                que.pb(g[que[b]][j]);
                real_dist[g[que[b]][j]]=real_dist[que[b]]+1;
            }
        }
    }
    if(accumulate(real_dist.begin(),real_dist.end(),(ll)0)!=d[0])
        die();
    for(int i=0;i<ans.size();i++)
        cout<<ans[i].fi+1<<" "<<ans[i].se+1<<endl;
    return 0;
}

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

int main(void){
	int array[3];
	cin >>array[0] >>array[1] >>array[2];
	sort(array, array+3);
	cout <<array[0] <<" " <<array[1] <<" " <<array[2]  <<endl;
	return 0;
}

Measured memory_bytes: 1184
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
ll t1, t2, a1 ,a2, b1, b2;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> t1>>t2>>a1>>a2>>b1>>b2;
    ll hant=t1*a1;
    ll hana=t1*b1;
    ll fant=t2*a2;
    ll fana=t2*b2;
    ll zent=hant-hana;
    ll zena=fant-fana;
    ll zensa=zent+zena;
    if(zensa==0) return cout<<"infinity"<<"\n",0;
    if(zent>0&&zensa>0) return cout<<0<<"\n",0;
    if(zent<0&&zensa<0) return cout<<0<<"\n",0;
    else{
        cout << abs(zent)/abs(zensa)*2+(abs(zent)%abs(zensa)>0) << "\n";
    }
}



Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define maxn 110000
using namespace std;

int s[maxn];
int getdis(int x,int y){return max(y,x)-min(x,y);}
int main()
{
	int n,i,k,ans=2147483647;scanf("%d%d",&n,&k);
	for(i=1;i<=n;i++)	scanf("%d",&s[i]);
	for(i=1;i<=n;i++)
	{
		if(i>=k)	ans=min(ans,getdis(s[i],0)+getdis(s[i-k+1],s[i]));
		if(i<=n-k+1)	ans=min(ans,getdis(s[i],0)+getdis(s[i+k-1],s[i]));
	}
	printf("%d\n",ans);
	return 0;
}

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

#define select(_1, _2, x, ...) x

#define repn(i, n) for (int i = 0; i < (n); i++)
#define repr(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, ...) select(__VA_ARGS__, repr, repn)(i, __VA_ARGS__)

#define rrepn(i, n) for (int i = (n - 1); i >= 0; i--)
#define rrepr(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define rrep(i, ...) select(__VA_ARGS__, rrepr, rrepn)(i, __VA_ARGS__)

#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;

const int INF = 1e9;
const ll LINF = 1e18;


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

    vector<ll> w(N), v(N);
    rep(i, N) cin >> w[i] >> v[i];

    vector<vector<ll>> dp(N + 1, vector<ll>(100001, LINF));

    dp[0][0] = 0;

    rep(i, N) rep(j, 100001) {
        if (j - v[i] >= 0)
            dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i]);
        else
            dp[i + 1][j] = dp[i][j];
    }

    rrep(i, 100001) {
        if (dp[N][i] <= W) {
            cout << i << endl;
            break;
        }
    }

    return 0;
}


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

int main() {
    int a,b,c;
    cin>>a>>b>>c;
    int count=0;
    for(int i=a;i<=b;i++){
        if(c%i==0){
            count++;
        }
    }
    cout<<count<<endl;
    return 0;
}


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

int main() {
  int N, W;
  cin >> N >> W;
  vector<long> DP(W + 1, -1);
  DP.at(0) = 0;
  for (int w, v; cin >> w >> v;) {
    for (int i = W; i >= 0; i--) {
      if (DP.at(i) == -1) continue;
      if (i + w > W) continue;
      DP.at(i + w) = max(DP.at(i + w), DP.at(i) + v);
    }
  }
  cout << *max_element(DP.begin(), DP.end()) << "\n";
}

Measured memory_bytes: 1024
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;

void main() {
    while(true) {
        int N = readln.chomp.to!int;
        if (N == 0) break;

        int[][] ans = [[-1, -1]];
        readln.split.to!(int[]).each!((a) {
            if (a == ans.back.back+1) {
                ans.back.back++;
            } else {
                ans ~= [a, a];
            }
        });
        ans[1..$].map!(a => a.front==a.back ? a.front.to!string : a.front.to!string~"-"~a.back.to!string).reduce!((a, b) => a~" "~b).writeln;
    }
}

Measured memory_bytes: 2496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define endl                        '\n'
#define debug(x)                    cerr << #x << ": " <<  x << endl;
#define fast_io;                    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
const ll MAXN=1e6 + 10;
const ll LOG=22;
const ll INF=8e18;
const ll MOD=1e9 + 7; // 998244353; // 1e9 + 9;
int main(){
fast_io;
ll n,A,B,m=0;
cin>>n>>A>>B;
ll a[10000000];
for(int i=0;i<n;i++){
      cin>>a[i];
}
for(int i=0;i<n-1;i++){
      m=m+min(A*(a[i+1]-a[i]),B);
}
cout<<m;
return 0;
}


Measured memory_bytes: 1024
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
const int Q=230123;
int las[Q],e[Q<<1],nn[Q<<1];
int inc=0;
void ins(int x,int y)
{
	e[++inc]=y;
	nn[inc]=las[x];
	las[x]=inc;
}
int Time=0;
int vis[Q];
int flag;
int fa[Q];
int cir[Q]={0},tot=0;
int isrt[Q];
void ddd(int x)
{
	if(flag)return;
	vis[x]=Time;
	if(vis[fa[x]]){
		if(vis[fa[x]]==vis[x]){
			int t=x;
			do{
				cir[++tot]=t;
				isrt[t]=1;
				t=fa[t];
			}while(t!=x);
		}
		return;
	}
	ddd(fa[x]);
}
int mx[Q];
int cnt[Q];
void dfs(int x)
{
	for(int t=las[x];t;t=nn[t]){
		int y=e[t];
		if(isrt[y])continue;
		dfs(y);
	}
	++Time;
	for(int t=las[x];t;t=nn[t]){
		int y=e[t];
		if(isrt[y])continue;
		cnt[mx[y]]=Time;
	}
	for(mx[x]=0;cnt[mx[x]]==Time;++mx[x]);
}
int main()
{
	int n;
	int x;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&x),ins(x,i),fa[i]=x;
	for(int i=1;i<=n;i++)
		if(!vis[i])++Time,ddd(i);
	Time=0;
	if(tot%2==0)return puts("POSSIBLE")&0;
	for(int i=1;i<=tot;i++)
		dfs(cir[i]);
	for(int i=2;i<=tot;i++)
		if(mx[cir[i]]!=mx[cir[i-1]])
		return puts("POSSIBLE")&0;
	puts("IMPOSSIBLE");
	return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
int main(){
int a,b,c,k;
cin>>a>>b>>c>>k;
if(k<=a){
    cout<<k<<endl;
}
  else if(k>a && k<=a+b){
cout<<a<<endl;  }
   else if(k>a+b){
  cout<<a+((k-(a+b))*-1)<<endl;
}
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <functional>
#include <map>
#include <set>
#define Rep(i, n) for(int i=0;i<n;++i)
#define rep(i, n) for(int i=1;i<=n;++i)
#define ll long long int
#define INF 100000000
#define MOD 1000000007
#define PI 3.14159265359
#define All(a) (a).begin(), (a).end()

using namespace std;
using P = pair<ll, ll>;
 
int dx[4] = {0, 1, 0, -1};
int dy[4] = {1, 0, -1, 0};

struct Edge {
  int to;     
  ll weight; 
  Edge(int t, ll w) : to(t), weight(w) { }
};

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


int N, M;
using Graph = vector<vector<int>>;
vector<bool> seen;

void dfs(Graph& G, int point) {
  seen[point] = true;

  for (auto next_v : G[point]) {
    if (seen[next_v]) continue;
    dfs(G, next_v);
  }
}

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

  Graph G(N+1);

  Rep(i, M) {
    int x, y, z;
    cin >> x >> y >> z;

    G[x].push_back(y);
    G[y].push_back(x);
  }

  seen.assign(N+1, false);

  int ans = 0;

  rep(i, N) {
    if (!seen[i]) {
      ans++;
      dfs(G, i);
    } 
  }

  cout << ans << "\n";
}

Measured memory_bytes: 10368
import java.util.*;
 
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int start = a+b;
        
      if(start>23){
        start = start-24;
      }
       
       System.out.print(start);
      
    }
}

Measured memory_bytes: 21844
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
   	String s = sc.next();
    int count = 0;
    int istack = 0;
    int count_min;
    
    if(s.charAt(0) == 'E') istack = 1;
    for(int i = 0;i < n;i++){
      if(s.charAt(i) == 'E') count++;
    }
    count_min = count-istack;
    for(int i = 0; i < n-1;i++){
      istack = 0;
      if(s.charAt(i+1) == 'E') istack = 1;
      if(s.charAt(i) == 'E') count--;
      else count++;
      if(count-istack < count_min) count_min = count-istack;
    }
  	System.out.println(count_min);
    
    
  }
}


Measured memory_bytes: 42396
#include<iostream>
using namespace std;
float f(float x)
{
	if (x < 0)x = -x;
	return x;
}
int main()
{
	int num;
	cin >> num;
	float T, A;
	cin >> T >> A;
	float minn=10000000;
	int index;
	for (int i = 0; i < num; i++)
	{
		float a;
		cin >> a;
		float b =T - a*0.006;
		if (f(minn - A)>f(b - A))
		{
			minn = b;
			index = i + 1;
		}
	}
	cout << index << endl;
	cin.get(), cin.get();
	return 0;
}

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

const int MAXN = 200005;

vector<int> group[MAXN];
int parent[MAXN];

int Find(int x)
{
	if (x == parent[x])
		return x;
	else
		return parent[x] = Find(parent[x]);
}

int main(void)
{
	int n, m, i;

	scanf("%d %d", &n, &m);

	for (i = 1; i <= n; i++)
		parent[i] = i;

	while (m--)
	{
		int a, b;

		scanf("%d %d", &a, &b);

		a = Find(a);
		b = Find(b);

		if (a != b)
			parent[b] = a;
	}

	for (i = 1; i <= n; i++)
		group[Find(parent[i])].push_back(i);

	int ans = 0;
	for (i = 1; i <= n; i++)
		ans = max(ans, (int)group[i].size());

	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 15296
#include<iostream>
#include<math.h>
using namespace std;
int main(){
    long long int n,d,x,y,cnt=0;
    double ans;
    cin>>n>>d;
    while(n--){
        cin>>x>>y;
        if(x<0){
            x=x*(-1);
        }
        if(y<0){
            y=y*(-1);
        }
        ans=sqrt((x*x)+(y*y));
        if(ans<=d){
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


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

int N,K;

int flog(vector<int> &dp, vector<int> &h, int n){
    if(n==0){
        return 0;
    }

    if(dp[n] != -1){
        return dp[n];
    }

    int mn=2147483647;
    for(int i=1; i<=K; i++){
        if(n-i < 0) break;
        mn=min(mn,abs(h[n]-h[n-i])+flog(dp, h , n-i));
    }
    dp[n] = mn;
    return dp[n];
}




int main(){
    cin>>N>>K;
    vector<int> h(N);
    rep(i,N) cin>>h[i];
    vector<int> dp(N,-1);
    
    // dp[0]=0;
    // for(int i=0; i<N-1; i++){
    //     for(int j=1; j<=K; j++){
    //         if(i+j >=N) break;
    //         dp[i+j] = min(dp[i+j], dp[i] + abs(h[i+j]-h[i]));
    //     }
    // }
    int ans = flog(dp, h , N-1);
    cout << ans << endl;
}


Measured memory_bytes: 11792
#include <iostream>
#include <cmath>
using namespace std;
int main(int argc,char const *argv[])
{
	int n;
	cin>>n;
	int a[2][n];
	int dp[2][n];
	for(int i = 0;i < 2; ++i)
	{
		for(int j = 0;j < n; ++j)
		{
			dp[i][j] = 0;
		}
	}
	for(int i = 0;i < 2; ++i)
	{
		for(int j = 0;j < n; ++j)
		{
			cin>>a[i][j];
		}
	}
	dp[0][0] = a[0][0];
	for(int j = 1;j < n; ++j)
	{
		dp[0][j] = dp[0][j - 1] + a[0][j];
		// printf("dp[%d][%d] = %d\n",0,j,dp[0][j]);
	}
	dp[1][0] = a[0][0] + a[1][0];
	for(int j = 1;j < n; ++j)
	{
		dp[1][j] = max(dp[0][j],dp[1][j - 1]) + a[1][j];
		// printf("dp[%d][%d] = %d\n",1,j,dp[1][j]);
	}
	printf("%d\n",dp[1][n - 1]);
	return 0;
}

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

const int INF = 1000000000;

int main() {
  int a, b, m;
  cin >> a >> b >> m;

  int min_a = INF, min_b = INF;
  vector<int> as(a), bs(b);
  for (int i = 0; i < a; ++i) {
    cin >> as[i];
    min_a = min(min_a, as[i]);
  }
  for (int i = 0; i < b; ++i) {
    cin >> bs[i];
    min_b = min(min_b, bs[i]);
  }

  int cost = min_a + min_b;
  for (int i = 0; i < m; ++i) {
    int x, y, c;
    cin >> x >> y >> c;
    --x, --y;
    int n_cost = as[x] + bs[y] - c;
    cost = min(cost, n_cost);
  }

  cout << cost << endl;
}

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

long long A[100010];
long long B[100010];

int main(void)
{
    long long N;
    cin >> N;
    for(long long i=1;i<=N;++i)
    {
        cin >> A[i] >> B[i];
    }

    long long ans = 0;
    for(long long i=N;i>0;--i)
    {
        if (((A[i] + ans) % B[i]) == 0)
            ans += (((A[i] + ans) / B[i])) * B[i] - (A[i] + ans);
        else
            ans += (((A[i] + ans) / B[i]) + 1) * B[i] - (A[i] + ans);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char s[200];
	cin>>s;
	int n=strlen(s),x=0;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='C') x=1;
		if (x==1&&s[i]=='F')
		{
			cout<<"Yes\n";
			return 0;
		}
	}
	cout<<"No\n";
}

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

int SG(int a, int k) {
  int x = a / k, b = a % k;
  if(!b) return x;
  int t = (b + x) / (x + 1);
  return SG(a - t * (x + 1), k);
}

int main() {
  int n;
  scanf("%d", &n);
  int ans = 0;
  for(int i=1;i<=n;i++) {
      int a, k;
      scanf("%d%d",&a,&k);
      ans ^= SG(a, k);
  }
  puts(ans ? "Takahashi" : "Aoki");
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <map>

using namespace std;

int main()
{
    int H, W;
    cin >> H >> W;
    map<char, int> dict;
    char c;
    for (int i = 0; i < H; ++i)
    {
        for (int j = 0; j < W; ++j)
        {
            cin >> c;
            ++dict[c];
        }
    }

    bool ans = true;
    if (H % 2 == 0 && W % 2 == 0)
    {
        for (auto e : dict)
        {
            if (e.second % 4 != 0)
            {
                ans = false;
            }
        }
    }
    else
    {
        int count = 0;
        for (auto e : dict)
        {
            count += e.second / 4;
        }
        if (count < (W / 2) * (H / 2))
        {
            ans = false;
        }
        else
        {
            count = 0;
            for (auto e : dict)
            {
                if (e.second % 2 != 0)
                {
                    ++count;
                }
            }
            if(H % 2 && W % 2 && count == 1){
                ans = true;
            }
            else if((H%2 == 0 || W%2 == 0) && (count == 0)){
                ans = true;
            }
            else{
                ans = false;
            }
        }
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	vector<char> ans;
	string s;
	cin >> s;
	for(int i = 0;i < s.size();i++){
		if(s[i] == '0'){
			ans.push_back('0');
		}
		if(s[i] == '1'){
			ans.push_back('1');
		}
		if(s[i] == 'B'){
			if(ans.size())ans.pop_back();
		}
	}

	for(char c:ans)cout << c;
	cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repR(i, n) for(ll i = n; i >= 0; ++i)
#define FDS(i, n) for(ll i = 0; i < n; ++i)
#define FDSR(i, n) for(ll i = n; i >= 0; ++i)
#define FOR(i, m, n) for(ll i = m; i < n; ++i)
#define FORR(i, m, n) for(ll i = m;i >= n;--i)
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define itn ll
#define ednl endl
using namespace std;
typedef long long ll;template<typename Typell>Typell G_C_D(Typell a, Typell b){if (a < 0) a = -a;if (b < 0) b = -b;while (b != 0) {a %= b;if (a == 0) return b;b %= a;}return a;}template<typename Typell>
Typell G_C_D(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = G_C_D(a, list[i]);}return a;}template<typename Typell>Typell L_C_M(Typell a, Typell b) {if( a == 0 && b == 0)return 0;return a / G_C_D(a, b) * b;}
template<typename Typell>Typell L_C_M(const std::vector<Typell> &list){Typell a = list[0];for (size_t i = 1; i < list.size(); ++i) {a = L_C_M(a, list[i]);}return a;}

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	ll N,M;
	cin>>N>>M;
	vector<int> L(M);
	vector<int> R(M);
	FDS(i,M){
		cin>>L[i]>>R[i];
	}
	int ML=0,MR=100000;
	FDS(i,M){
		ML=max(L[i],ML);
		MR=min(R[i],MR);
	}
	if(ML>MR)cout<<0<<endl;
	else{
		cout<<MR-ML+1<<endl;
	}
	//////////////
	
	
	
	
	
}

Measured memory_bytes: 1024
/*
  ***
  0.0
  *-*
 * * *
*  *  *
*  *  *
   *
   *
  * *
 *   *
 *   *
 	   	  		*/
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pp pop_back
#define F first
#define S second
// set <int> :: iterator it = x.begin(); it != x.end(); it ++
using namespace std;
ll n,m,a,sum,num,maxi=-10e9,maxn=-10e9,mini=10e9,minn=10e9,s[101];
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie();	cout.tie();
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n>>m>>a;
	while(sum==sum){
		if(m+1<a){
			m++;
		}
		else{
			cout<<"Borys";
			return 0;
		}
		if(a-1>m){
			a--;
		}
		else{
			cout<<"Alice";
			return 0;
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
ll MOD = 1e9+7;

#define vec     vector<int>
#define vecll   vector<ll>
#define vec2    vector<vector<int>>
#define vec2ll  vector<vector<ll>>
#define vpair   vector<pair<int, int>>
#define vpairll vector<pair<ll, ll>>
#define vecst   vector<string>
#define vecb    vector<bool>

#define rep(i,n)         for(ll i=(ll)0; i<(ll)n; i++)
#define REP(i,m,n)       for(ll i=(ll)m; i<(ll)n; i++)
#define arr(var, n)      vec var(n); rep(i,n){cin >> var[i];}
#define arrll(var, n)    vecll var(n); rep(i,n){cin >> var[i];}
#define arrst(var, n)    vecst var(n); rep(i,n){cin >> var[i];}
#define all(var)         (var).begin(), (var).end()
#define sortall(var)     sort(all(var))
#define uniqueall(v)     v.erase(unique(v.begin(), v.end()), v.end());
#define f_sum(var)       accumulate(all(var), 0)
#define f_sumll(var)     accumulate(all(var), 0LL)
#define chmin(v1, v2)    v1 = min(v1, v2)
#define chmax(v1, v2)    v1 = max(v1, v2)
#define mpair(v1, v2)    make_pair(v1, v2)
#define pb(var)          push_back(var)
#define prt(var)         cout << var << "\n"
#define prtd(n, var)     cout << fixed << setprecision(n) << var << "\n"
#define prtfill(n, var)  cout << setw(n) << setfill('0') << var;
#define prt2(v1, v2)     cout << v1 << " " << v2 << "\n"
#define prt3(v1, v2, v3) cout << v1 << " " << v2 << " " << v3 << "\n"
#define prtall(v)        rep(i,v.size()){cout<<v[i]<<(i!=v.size()-1?" ":"\n");}
void prtok(bool ok){prt((ok ? "OK" : "NG"));}
//----------------------------------------------------------------

int main(void) {
  ll x;
  cin >> x;
  ll now=100;
  ll ans=0;
  while(now<x){
    now*=1.01;
    ans++;
  }

  prt(ans);
}


Measured memory_bytes: 3596
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
using namespace std;

int main(){
    long long int n,c=0;
    cin>>n;
    vector<long long int>a(1000000);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a.begin(),a.end(),std::greater<>());
    for(int i=0;i<n-1;i++){
        if(a[i]==a[i+1]){
            c=1;
        }
    }
    if(c==1){
        cout<<"NO"<<endl;
    }
    else{
        cout<<"YES"<<endl;
    }
   return 0;
}

Measured memory_bytes: 8064
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i, n) for (int i = 0; i < n; i++)

int main()
{
    int a, b, k;
    scanf("%d%d%d", &a, &b, &k);
    while (true) {
        if (a % 2 == 1) {
            a--;
        }
        b += a / 2;
        a /= 2;
        if (--k == 0) {
            break;
        }

        if (b % 2 == 1) {
            b--;
        }
        a += b / 2;
        b /= 2;
        if (--k == 0) {
            break;
        }
    }

    printf("%d %d\n", a, b);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
int m;
int k;
int a[300005],b[300005];
int p[300005];
int l[300005];
int totp[300005];
int totl[300005];
int maxp=0;
int maxl=0;
int cntl;
int cntp;
int ans=0;
int main()
{
	scanf("%d %d %d",&n,&m,&k);
	for(int i=1;i<=k;i++)
	{
		scanf("%d %d",&a[i],&b[i]);
		p[a[i]]++;
		l[b[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(p[i]>maxp)
		{
			maxp=p[i];
			cntp=i;
		}
	}
	for(int i=1;i<=k;i++)
	{
		if(a[i]==cntp)
		{
			totl[b[i]]++;
		}
	}
	for(int i=1;i<=m;i++)
	{
		if(l[i]-totl[i]>maxl)
		{
			maxl=l[i]-totl[i];
		}
	}
	ans=max(ans,maxl+maxp);
	maxl=0;
	maxp=0;
	for(int i=1;i<=m;i++)
	{
		if(l[i]>maxl)
		{
			maxl=l[i];
			cntl=i;
		}
	}
	for(int i=1;i<=k;i++)
	{
		if(b[i]==cntl)
		{
			totp[a[i]]++;
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(p[i]-totp[i]>maxp)
		{
			maxp=p[i]-totp[i];
		}
	}
	ans=max(ans,maxl+maxp);
	printf("%d",ans);
}

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

int main(int argc, const char * argv[]) {
    // insert code here...
    int N,A,B;
    std::cin>>N>>A>>B;
    std::cout <<std::min<int>(A,B)<<" "<<std::max<int>(A+B-N,0)<<std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int N=0;
    int i=0,j=0,X,k=0,sum=0;
    char s[200];
    char t[100];

    scanf("%d", &N);
    scanf("%s", s);
  
    if(N % 2 == 0){
    for(;i<N/2;i++){
      //printf("%c%c\n", s[i],s[i+N/2]);
      if(s[i] != s[i+N/2]){
        k++;
      }
    }
    }else{ k = 1; }

    if(k != 0){
      printf("No");
    }else{
      printf("Yes");
    }

    return 0;
}

Measured memory_bytes: 1704
S = input()[::-1]
text = ['dream','dreamer','erase','eraser']
text = [t[::-1] for t in text]

while len(S) > 0:
  for t in text:
    if S.find(t) == 0:
      S = S[len(t):]
      break
  else:
    print('NO')
    break
else:
  print('YES')

Measured memory_bytes: 9188
#include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int x[600],a[600],n,A[300000];
int compare(int k1,int k2){
	return x[k1]<x[k2];
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&x[i]),a[i]=i;
	sort(a+1,a+n+1,compare);
	for (int i=1;i<n;i++) if (x[a[i]]==x[a[i+1]]){
		printf("No\n"); return 0;
	}
	int now=1;
	for (int i=1;i<=n;i++){
		for (int j=1;j<a[i];j++){
			while (now<x[a[i]]&&A[now]) now++;
			A[now]=a[i]; now++;
		}
	//	cout<<i<<" "<<now<<endl;
		if (now>x[a[i]]){
			printf("No\n"); return 0;
		}
		A[x[a[i]]]=a[i];
	}
	now=1;
	for (int i=1;i<=n;i++){
		while (A[now]) now++;
		if (now<x[a[i]]){
			printf("No\n"); return 0;
		}
		for (int j=1;j<=n-a[i];j++){
			while (A[now]) now++;
			A[now]=a[i]; now++;
		}
	}
	printf("Yes\n");
	for (int i=1;i<=n*n;i++) printf("%d ",A[i]);
	return 0;
}
		

Measured memory_bytes: 2176
import itertools

def judge():
  for i in range(3):
    if A[i*3 + 0] + A[i*3 + 1] + A[i*3 + 2]  == 0 or A[0*3 + i] + A[1*3 + i] + A[2*3 + i]  == 0:
      return True
  if A[0*3 + 0] + A[1*3 + 1] + A[2*3 + 2]  == 0 or A[2*3 + 0] + A[1*3 + 1] + A[0*3 + 2]  == 0:
    return True
  return False

A_2d=[list(map(int,list(input().split()))) for i in range(3)]
A=list(itertools.chain.from_iterable(A_2d)) # A_1d

N = int(input())

for _ in range(N):
  b = int(input())
  A = [0 if i == b else i for i in A]
  
if judge():
  print("Yes")
else:
  print("No")

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

const int maxn=110;

int L[maxn],n;

int main(){
	int ans=0;
	cin>>n;
	for(int i=0;i<n;i++) cin>>L[i];
	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[i]==L[k]||L[j]==L[k]) continue;
		if(L[i]+L[j]<=L[k]||L[i]+L[k]<=L[j]||L[j]+L[k]<=L[i]) continue;
		ans++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3628
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll N, M, sumN=1, sumM=1, i;

    cin >> N >> M;

    for(i=1; i<=N; i++){
        sumN *= i;

        if(sumN >= div1){
            sumN = sumN % div1;
        }
    }

    for(i=1; i<=M; i++){
        sumM *= i;

        if(sumM >= div1){
            sumM = sumM % div1;
        }
    }

    if(N>=M+2 || N+2<=M){
        cout << 0 << endl;
    }

    else if(N==M+1 || N+1==M){
        cout << (sumN*sumM)%div1 << endl;
    }

    else{
        cout << (2*sumN*sumM)%div1 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<vector>
#include<complex>
#include<unordered_map>
#define deg(x) cout<<#x<<"="<<x<<endl;
#define fd(x) for(int i=0;i<x;i++)
#define fdd(a,x) for(int i=a;i<x;i++)
#define fx(x,n) for(int i=n-1;i>=x;i--)
#define mst(x) memset(x,0,sizeof(x));
#define fi first
#define se second
#define TB ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define ok "ok"
#define HH puts("");
#define ls rt<<1
#define rs rt<<1|1
#define pb(a,b) a.push_back(b);
#define FIN  freopen("1.in","r",stdin);
#define FOUT freopen("1.out","w",stdout);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<string,int> pss;
typedef unsigned long long ull;
const ll mod=1e9+7;
const ll inf=1e18;
const long double eps=1e-8;
ll qpow(ll a,ll b,ll m){ ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
const double pi=acos(-1);


int main(){
    TB
    int a,b,c;
    cin>>a>>b>>c;
    swap(a,b);
    swap(a,c);
    cout<<a<<" "<<b<<" "<<c;
    return 0;
}


Measured memory_bytes: 384
# abc153B
# https://atcoder.jp/contests/abc153/tasks/abc153_b

# モンスターの体力はH
# アライグマはN種類の必殺技がある
# i番目の必殺技を使うとAiの体力を減らせる
# モンスターの体力が0なら勝ち

# モンスターに勝てたら"Yes"、できなかったら"No"

# 入力
h, n = map(int, input().split())
a = list(map(int, input().split()))

# 処理
# 必殺技を受けた残りの体力
h = h - sum(a)

if h <= 0:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 20616
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int l,r,d,ans=0;
  cin>>l>>r>>d;
  for (int i = l; i < r+1; i++) {
if(i%d==0){
  ans++;
}
}
  cout<<ans<<endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    string s;
    std::deque<char> front;
    std::deque<char> back;
    int count=0;
    while (cin>>s) {
        if (s.size()==1) {
            count++;
        } else {
            for (int i=0;i<(s.size()/2);i++) {
                front.emplace_back(s.at(i));
                back.emplace_back(s.at(s.size()-1-i));
            }
            if (front==back) {
                count++;
            }
            front.clear();
            back.clear();
        }
    }
    cout<<count<<endl;
}


Measured memory_bytes: 3024
N, M = map(int, input().split())
H = list(map(int, input().split()))
graph = [[] * N for _ in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)

ans = 0
for i in range(N):
    now_height = H[i]
    flag = True
    for j in graph[i]:
        if now_height <= H[j]:
            flag = False
            break
    if flag:
        ans += 1
print(ans)


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

static const int N = 100;

int main(){
  int n, p[N + 1], m[N + 1][N + 1];
  cin >> n;
  for(int i=1; i<=n; i++){
    cin >> p[i - 1] >> p[i];
  }

  for(int i=1; i<=n; i++) m[i][i] = 0;
  for(int l=2; l<=n; l++){
    for(int i=1; i<=n-l+1; i++){
      int j = i+l-1;
      m[i][j] = (1 << 21);
      for(int k=i; k<=j-1; k++){
        m[i][j] = min(m[i][j],m[i][k] + m[k+1][j] + p[i-1] * p[k] * p[j]);
      }
    }
  }

  cout << m[1][n] << endl;

  return 0;
}



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

int main() {
  int n;
  cin >> n;
  vector<int> w(n);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> w.at(i);
    sum += w.at(i);
  }
  int s1 = 0, s2 = 0, memo;;
  for (int i = 0; i < n; i++) {
    s1 += w.at(i);
    if (s1 > sum / 2) {
      s2 = sum - s1;
      memo = i;
      break;
    }
  }
  int g1 = sqrt(pow(s1 - s2, 2));
  int g2 = sqrt(pow(s1 - w.at(memo) - s2 - w.at(memo), 2));
  cout << min(g1, g2) << endl;
}

Measured memory_bytes: 256
import java.io.*;
import java.math.BigInteger;
import java.util.*;



public class Main {
	

	public static class FastReader {
		BufferedReader br;
		StringTokenizer root;
		
 
		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
 
		String next() {
			while (root == null || !root.hasMoreTokens()) {
				try {
					root = new StringTokenizer(br.readLine());
				} catch (Exception addd) {
					addd.printStackTrace();
				}
			}
			return root.nextToken();
		}
 
		int nextInt() {
			return Integer.parseInt(next());
		}
 
		double nextDouble() {
			return Double.parseDouble(next());
		}
 
		long nextLong() {
			return Long.parseLong(next());
		}
 
		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception addd) {
				addd.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	
	public static FastReader sc = new FastReader();
 
	static int mod = (int) (1e9+7),MAX=(int) (2e5);
    static List<Integer>[] edges;
    
	public static void main(String[] args) throws IOException {
		int n = sc.nextInt();
		int m = sc.nextInt();
		edges = new ArrayList[n+1];
		for(int i=0;i<edges.length;++i) {
			edges[i] = new ArrayList<>();
		}
		for(int i=1;i<=m;++i) {
			int u = sc.nextInt();
			int v = sc.nextInt();
			edges[u].add(v);
			edges[v].add(u);
		}
		int[] dis = new int[n+1];
		Arrays.fill(dis,-1);
		//dis[0] = 0;
		dis[1] = 1;
		Queue<Integer> q = new LinkedList<>();
		q.add(1);
		while(q.size() > 0) {
			int x = q.poll();
			for(int child : edges[x]) {
				if(dis[child] == -1) {
					q.add(child);
					dis[child] = dis[x]+1;
				}
			}
		}
		boolean found = true;
		for(int i=1;i<=n;++i) {
			if(dis[i] == -1)
				found = false;
		}
		if(found) {
			out.println("Yes");
			int[] ans = new int[n+1];
			for(int i=2;i<=n;++i) {
				int x = dis[i];
				for(int child : edges[i]) {
					if(dis[child] == x-1) {
						ans[i] = child;
						break;
					}
				}
			}
			for(int i=2;i<=n;++i) out.println(ans[i]);
		}else out.print("No");
		out.close();
	}

   
}





Measured memory_bytes: 77604
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
ll modfac(ll a){
    ll ans=1;
    while(a>1){
        ans*=a;
        ans%=1000000007;
        a--;
    }
    return ans;
}
ll modinv(ll a,ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}
struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) {}

    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y);
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};
ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
int main(){
    ll n;cin >> n;
    vl v(n),ans(n,0);
    rep(i,n)cin >> v[i];
    per(i,n){
        ll x=n/(i+1);
        ll sum=0;
        for(int j=1;j<x;j++){
            sum+=ans[(i+1)*(j+1)-1];
        }
        ans[i]=(v[i]+sum)%2;
    }
    ll count=0;
    rep(i,n){
        if(ans[i]==1)count++;
    }
    cout << count <<endl;
    rep(i,n){
        if(ans[i]==1)cout << i+1 << " ";
    }
}

Measured memory_bytes: 3968
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        
        int x = Integer.parseInt(sc.next());
        int y = Integer.parseInt(sc.next());
        int z = Integer.parseInt(sc.next());
        
        System.out.println(z + " " + x + " " + y);
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define EPS 0.0000000001
#define INF 1000000000
#define MOD 1000000007
typedef long long ll;

int main()
{
    int n;
    cin>>n;
    string s;
    int count=0;
    for(int i=1;i<=n;i++){
        s=to_string(i);
        int nn=s.size();
        if(nn%2==1){
            count++;
        }
    }
    cout<<count<<endl;
}


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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;

int main() {
  long long a,b,x;
  cin >>a>>b>>x;
  if(a%x==0){
  cout << b/x-a/x+1 << endl;
  }
  else{
    cout << b/x-a/x << endl;
  }
  
  
}
      
       





      
       







Measured memory_bytes: 3588
#include<bits/stdc++.h>
        #define vll vector<ll>
        #define vi vector<int>
        #define vpll vector<pair<ll,ll>>
        #define pii pair<int,int>
        #define REP(i,a) for(int (i)=0; (i)<(a); (i)++)
        #define RREP(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
        #define REP2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
        #define MOD 1000000007
        #define ALL(v) v.begin(), v.end()
        #define m0(x) memset(x,0,sizeof(x))
        typedef long long ll;
         
        using namespace std;
         
        const int MAX = 1100000;
         
        ll fac[MAX], finv[MAX], inv[MAX];
         
        // テーブルを作る前処理
        void COMinit() {
            fac[0] = fac[1] = 1;
            finv[0] = finv[1] = 1;
            inv[1] = 1;
            for (int i = 2; i < MAX; i++){
                fac[i] = fac[i - 1] * i % MOD;
                inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
                finv[i] = finv[i - 1] * inv[i] % MOD;
            }
        }
         
        // 二項係数計算
        ll COM(int n, int k){
            if (n < k) return 0;
            if (n < 0 || k < 0) return 0;
            return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
        }
         
        int main(){
          ios_base::sync_with_stdio(false);
          cin.tie(NULL);
          ll X,Y;
          cin >> X >> Y;
          if( (Y+X)%3 != 0 ){
            cout << "0";
            return 0;
          }
          ll count = (X+Y)/3; //動かす回数
     
          COMinit();
          cout << COM(count, Y-count);
          return 0;
        }

Measured memory_bytes: 25984
#![allow(non_snake_case)]
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)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($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!(
        s: String,
    );
    let v = vec!["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"];
    let index = v.iter().position(|&x| x == &s).unwrap();
    println!("{}", v.len()-index);
}


Measured memory_bytes: 4352
n = int(input())
l = []
for i in range(n):
    ex,ey,eh = map(int,input().split())
    if eh != 0:
        l.append([ex,ey,eh])

def func2(cx,cy,l):
    ans = l[2] + abs(l[0]-cx) +  abs(l[1]-cy)
    return ans

if len(l) == 1:
    print(l[0][0], l[0][1], l[0][2])
    exit()

for i in range(101):
    for j in range(101):
        for k in range(len(l)-1):
            if func2(i,j,l[k]) == func2(i,j,l[k+1]):
                if k == len(l)-2:
                    print(i, j, func2(i,j,l[k]))
                    exit()
            else:
                break

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
using tii = tuple<int, int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
//#define INF (ll)1E9
#define INF INT_MAX
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

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

//constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

int main(void) {
	int n;
	cin >> n;
	vi v(n),vv(n);
	rep(i, n) {
		cin >> v[i];
		vv[i] = v[i];
	}
	rep(i, n) {
		v[i] -= i; vv[i] -= i;
	}
	sort(all(vv));
	int tmp = vv[n / 2];
	ll ans = 0;
	rep(i, n) {
		ans += abs(v[i] - tmp);
	}
	cout << ans << endl;
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    cin>>s;
    int fl=1;
    for(char c: s){
        if(c=='7'){
            cout<<"Yes"<<endl;
            fl=0;
            break;
        }
    }
    if(fl)cout<<"No"<<endl;
}


Measured memory_bytes: 3600
#include<stdio.h>



int GCD(int a, int b) {
	int A, B, buff;
	// A >= B
	if (b > a) {
		A = b; B = a;
	}
	else { A = a; B = b; }
	while (A%B) {
		buff = B;
		B = A % B;
		A = buff;
	}
	return B;
}

int main() {
	int N, a, b, c;
	int G;
	int GC[1000000];
	scanf("%d", &N);
	if (!(N - 2)) {
		scanf("%d %d", &a, &b);
		G = GCD(a, b);
		for (int i = 1; i <= G; i++) {
			if (a%i == 0 && b%i == 0) {
				GC[i] = i;
			}
			else GC[i] = -i;
		}
		for (int j = 1; j <= G; j++) {
			if (GC[j] < 0)continue;
			printf("%d\n", GC[j]);
		}
	}
	else {
		scanf("%d %d %d", &a, &b, &c);
		G = GCD(c, GCD(a, b));
		for (int i = 1; i <= G; i++) {
			if (a%i == 0 && b%i == 0 && c%i == 0) {
				GC[i] = i;
			}
			else GC[i] = -i;
		}
		for (int j = 1; j <= G; j++) {
			if (GC[j] < 0)continue;
			printf("%d\n", GC[j]);
		}
	}

	return 0;
}


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

int main() {
  int N;
  int sum = 0;
  cin >> N;
  int t = N;
  while(t > 0){
    sum += t % 10;
    t /= 10;
  }
  if(N % sum ==0)
  	cout << "Yes" << endl;
  else
  	cout << "No" << endl;
}

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

int main() {
    long long h; cin >> h;
    long long noMonster = 1;
    long long cnt = 0;
    
    while(h > 0) {
        if (h == 1) {
            h -= 1;
            cnt += noMonster;
        }
        if(h > 1) {
            cnt += noMonster;
            noMonster *= 2;
            h /= 2;
        }
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 256