akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int N;
int a[60], b[60];

bool G[60][60];
bool vis[60];

void dfs(int v) {
    vis[v] = true;
    for (int i = 0; i < N; ++i) {
        if (G[v][i] == false) continue;//今回はNが小さい
        if (vis[i] == true) continue;//既に訪れている 
        dfs(i);
    }
}

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

    for (int i = 0; i < M; ++i) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
        G[a[i]][b[i]] = G[b[i]][a[i]] = true;//橋の作成
    }//グラフ作成完了

    int cou = 0;//橋の個数
    for (int i = 0; i < M; ++i) {
        G[a[i]][b[i]] = G[b[i]][a[i]] = false;//橋の消去
        fill(vis, vis + N, false);//連結判定のため初期化

        dfs(0);//頂点0とつながっていなければその時点で非連結になっている

        bool no_connect = false;//端であるか否か
        for (int j = 0; j < N; ++j) {//N個の頂点全てに訪れているはず
            if (vis[j] == false) no_connect = true;
        }
        if (no_connect) cou++;

        G[a[i]][b[i]] = G[b[i]][a[i]] = true;//橋の復元
    }

    cout << cou << endl;
}

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

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

    vector<string> S(N);
    for (int i = 0; i < N; i++) {
        cin >> S[i];
    }
    long long int M, A, R, C, H;
    M = 0;
    A = 0;
    R = 0;
    C = 0;
    H = 0;

    for (int i = 0; i < N; i++) {
        switch (S[i][0]) {
            case 'M':
                M++;
                break;
            case 'A':
                A++;
                break;
            case 'R':
                R++;
                break;
            case 'C':
                C++;
                break;
            case 'H':
                H++;
                break;
        }
    }

    long long int count = 0;

    count += M * A * R;
    count += M * A * C;
    count += M * A * H;
    count += M * R * C;
    count += M * R * H;
    count += M * C * H;
    count += A * R * C;
    count += A * R * H;
    count += A * C * H;
    count += R * C * H;

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 6144
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
using namespace std;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1LL << 60;
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

int P;
ll comb[3030][3030];
void combinit(ll p) {
	for (int i = 0; i <= p; i++) {
		comb[i][0] = 1LL;
		comb[i][i] = 1LL;
	}
	for (int i = 1; i <= p; i++) {
		for (int j = 1; j <= i - 1; j++) {
			comb[i][j] = comb[i - 1][j] + comb[i - 1][j - 1];
			comb[i][j] %= P;
		}
	}
}

ll modpow(ll a, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % P;
		a = a * a % P;
		n >>= 1;
	}
	return res;
}

vector<int> mul(int j) {
	vector<int>res(P);
	for (int i = 0; i < P; i++) {
		ll temp = modpow(j,P-1-i);
		if ((P - 1 - i) % 2) {
			temp *= -1;
			temp += P;
			temp %= P;
		}
		temp *= comb[P-1][i];
		temp %= P;
		res[i] = temp;
	}
	return res;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	
	cin >> P;
	combinit(P);
	vector<int>ans(P);
	int cnt = 0;
	for (int i = 0; i < P; i++) {
		int a;
		cin >> a;
		if (a) {
			cnt++;
			auto v = mul(i);
			for (int j = 0; j < P; j++) {
				ans[j] += -v[j]+P;
				ans[j] %= P;
			}
		}
	}

	ans[0] += cnt;
	ans[0] %= P;
	for (int i = 0; i < P; i++)cout << ans[i] << " ";
	cout << endl;
	
	return 0;
}



Measured memory_bytes: 70272
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int stoi (string s )
{
	stringstream ss (s );
	int res = 0;
	ss >> res;

	return res;
}

int main()
{
	stack<int> st;

	string in = "";
	while (cin >> in ){
		if (isdigit(in[0]) ){
			st.push (stoi (in ) );
		}else{
			char op = in[0];
			int b = st.top(); st.pop();
			int a = st.top(); st.pop();
			int c;
			switch (op ){
				case '+':
					c = a + b; st.push(c);
					break;
				case '-':
					c = a - b; st.push(c);
					break;
				case '*':
					c = a * b; st.push(c);
					break;
				case '/':
					c = a / b; st.push(c);
					break;
			} // end switch
		} // end if
	} // end while
	int res = st.top();
	cout << res << endl;
		
	return 0;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
ll mod=1000000007;

int main(){
    std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    ll ar[n];
    ll ma=0;
    for(int i=0;i<n;i++){
        cin>>ar[i];
        ma=max(ma,ar[i]);
    }
    ll sum=0,fl=0;
    for(int i=0;i<n;i++){
        if(ar[i]==ma&&fl==0){fl=1;continue;}
        else sum+=ar[i];
    }
    if(ma<sum)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;
typedef long long int ll;

ll GCD(ll a,ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a,ll b) { return a / GCD(a,b) * b; }

int main(){
	int n; cin >> n;
	ll ans=1;
	for(int i=0;i<n;i++){
		ll t; cin >> t;
		ans=LCM(ans,t);
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
using ll = long long;

int main() {
  ll x, k, d;
  cin >> x >> k >> d;

  if (0 <= x && k % 2 == 0) {
    ll a1 = x / 2 / d * 2;
    ll a2 = x / 2 / d * 2 + 2; 
    ll y1 = x - d * a1;
    ll y2 = x - d * a2;
    ll ans = min(abs(y1), abs(y2));
    if (k < a1)
      ans = x - d * k;
    cout << ans << endl;
  }
  else if (0 <= x && k % 2 == 1) {
    ll a1 = (x - d) / 2 / d * 2 + 1;
    ll a2 = (x - d) / 2 / d * 2 + 3; 
    ll y1 = x - d * a1;
    ll y2 = x - d * a2;
    ll ans = min(abs(y1), abs(y2));
    if (k < a1)
      ans = x - d * k;
    cout << ans << endl;
  }
  else if (x < 0 && k % 2 == 0) {
    ll a1 =  -x / 2 / d * 2;
    ll a2 = -x / 2 / d * 2 + 2; 
    ll y1 = x + d * a1;
    ll y2 = x + d * a2;
    ll ans = min(abs(y1), abs(y2));
    if (k < a1)
      ans = abs(x + d * k);
    cout << ans << endl;
  }
  else {
    ll a1 = - (x + d) / 2 / d * 2 + 1;
    ll a2 = - (x + d) / 2 / d * 2 + 3; 
    ll y1 = x + d * a1;
    ll y2 = x + d * a2;
    ll ans = min(abs(y1), abs(y2));
    if (k < a1)
      ans = abs(x + d * k);
    cout << ans << endl;
  }

}


Measured memory_bytes: 3552
#include<bits/stdc++.h>
#include<unistd.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;

int main(){
    int N;cin>>N;
    vector<ll> a(N);
    ll S=0;
    REP(i, N){
        cin >> a[i];
        S+=a[i];
        a[i]*=N;
    }
    pair<int,int> ans=make_pair(0,10000);
    REP(i,N){
        if(ans.second>abs(S-a[i])){
            ans=make_pair(i,abs(S-a[i]));
        }
    }
    cout<<ans.first<<endl;
}


Measured memory_bytes: 256
N = int(input())

count = 0
no = True

for _ in range(N):
  d1, d2 = map(int, input().split())
  if d1 == d2:
    count += 1
  else:
    count = 0
  
  if count == 3:
    print("Yes")
    no = False
    break

if no:
  print("No")

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;

int main(void) {
    int n;
    cin >> n;
    int a = n % 10;
    if(a == 2 || a== 4 || a == 5 || a == 7 || a==9) {
        cout << "hon" << endl;
    }else if (a == 0 || a == 1 || a== 6 || a== 8) {
        cout << "pon" << endl;
    }else {
        cout << "bon" << endl;
    }
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> P;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int main() {
  int q;
  cin >> q;
  REP(i, q) {
    string X, Y;
    cin >> X >> Y;
    vector<vector<int>> dp(Y.size() + 5, vector<int>(X.size() + 5, 0));
    for (int i = 0; i < Y.size(); i++) {
      for (int j = 0; j < X.size(); j++) {
        if (Y[i] == X[j]) {
          chmax(dp[i + 1][j + 1], dp[i][j] + 1);
          chmax(dp[i + 1][j + 1], dp[i][j + 1]);
          chmax(dp[i + 1][j + 1], dp[i + 1][j]);
        } else {
          chmax(dp[i + 1][j + 1], dp[i][j + 1]);
          chmax(dp[i + 1][j + 1], dp[i + 1][j]);
        }
      }
    }
    cout << dp[Y.size()][X.size()] << endl;
  }
}


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

using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;

#define REPS(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) REPS(i, 0, n)
#define RREP(i, n) REPS(i, 1, n + 1)
#define DEPS(i, a, n) for (int i = (a); i >= n; --i)
#define DEP(i, n) DEPS(i, n, 0)

#define vint(v,n) vector<int> v(n); REP(i,n) cin >> v[i];
#define vlint(v,n) vector<ll int> v(n); REP(i,n) cin >> v[i];
#define vdouble(v,n) vector<double> v(n); REP(i,n) cin >> v[i];
#define vvdoube(v,n1,n2) vector<vector<double> > v(n1, vector<double>(n2, 0)); REP(i,n1) REP(j,n1) cin >> v[i][j];
#define string(x) string x; cin >> x;
#define vstring(v,n) vector<string> v(n); REP(i,n){string a; std::cin >> a; v.push_back(a); }

#define all(v) (v).begin(), (v).end()
#define rall(v) (v).begin(), (v).end(), std::greater<int>()
#define len(v) (v).length()

static const string abet("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
static const long long int MOD = 1000000007;
static const double PI=3.1415926535897932;
static const int INF = 0x3f3f3f3f;
static const int INFTY = (1 << 29);
static const long long LINFTY = (1LL << 32);

static const int dy4[]={0, 0, 1, -1};
static const int dx4[]={1, -1, 0, 0};
static const int dx8[] = {1, 1, 1, 0, 0, -1, -1, -1};
static const int dy8[] = {-1, 0, 1, -1, 1, -1, 0, 1};


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

  
      int n, W;
   
      cin >> n >> W;
   
      int v[n], w[n];
      int dp[W + 1];
   
      for(int i = 0; i < n; ++i) {
          cin >> v[i] >> w[i];
      }
   
      fill(dp, dp + W + 1, 0);
   
      for(int i = 0; i < n; ++i) {
          for(int j = W; j >= w[i]; --j) {
              dp[j] = max(dp[j], dp[j - w[i]] + v[i]);
          }
      }
   
      cout << dp[W] << endl;
   
  }

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

int A, B;
string S;

bool check() {
  if (S.size() != A + B + 1) {
    return false;
  }
  for (int i = 0; i < A; i++) {
    if (S[i] == '-') {
      return false;
    }
  }
  if (S[A] != '-') {
    return false;
  }
  for (int i = A + 1; i < A + B + 1; i++) {
    if (S[i] == '-') {
      return false;
    }
  }
  return true;
}

void solve() {
  if (check()) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

int main() {
  cin >> A >> B;
  cin >> S;

  solve();
  return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
void solve() {
    int i,j,k,l,r,x,y; string s;
    bool exit = false;
    vector <int> A;
    cin>>N;
    FOR(i,N){
        int input;
        cin>>input;
        input--;
        A.push_back(input);
    }
    A.push_back(-1);
    vector <int> seqNum;
    int prev=A[0];
    int cnt=0;
    int now;
    FORR(now,A){
        if(prev == now){
            cnt++;
        }else{
            seqNum.push_back(cnt);
            cnt=1;
        }
        prev=now;
    }
    int ret = 0;
    FORR(i,seqNum){
        ret += i / 2;
    }
    cout<< ret <<endl;

    /*cin>>N;
    vector<ll> V;
    FOR(x,N+1) {
            FOR(y,N+1) {
                    ll ret=1;
                    FOR(i,x) ret*=2;
                    FOR(i,y) ret*=5;
                    V.push_back(ret);
            }
    }
    sort(ALL(V));
    FORR(v,V) cout<<v<<endl;*/
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}



Measured memory_bytes: 256
import sys
import collections
n = int(input())
vl = list(map(int,input().split()))

v1 = collections.Counter(vl[0::2])
v2 = collections.Counter(vl[1::2])


v1s = []
for a,b in v1.items():
    v1s.append((b,a))

v2s = []
for a,b in v2.items():
    v2s.append((b,a))

v1s = sorted(v1s)
v2s = sorted(v2s)

if v1s[-1][1] != v2s[-1][1]:
    print(n - v1s[-1][0] - v2s[-1][0])
else:
    if len(v2s) == 1:
        p2 = 0
    else:
        p2 = v2s[-2][0]
    if len(v1s) == 1:
        p1 = 0
    else:
        p1 = v1s[-2][0]
    ans = min(n - v1s[-1][0] - p2, n - p1 - v2s[-1][0])
    print(ans)

Measured memory_bytes: 63876
/*g++ main.cpp -o main.out*/
/*./main.out*/

#include<bits/stdc++.h>
using namespace std;

#define LL long long
#define LD long double
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

#define NO_TLE std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ree(a,n) memset(a,n,sizeof(a));

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))

int main()
{
    double r;
    cin>>r;
    printf("%.9f\n",2*PI*r);
    return 0;
}














Measured memory_bytes: 3788
#include <iostream>
#include <string>
#include <sstream>
#include <vector>

int main() {
	std::string N;
	std::getline(std::cin, N);

	std::string line;
	std::getline(std::cin, line);
	std::istringstream iss(line);

	int in;
	std::vector<int> list;
	while (iss >> in)
		list.push_back(in);

	int pairs = 0;
	for (int i = 0; i < list.size(); ++i) {
		if (list[list[i] - 1] == i + 1)
			pairs++;
	}
	std::cout << pairs/2;
}

Measured memory_bytes: 2308
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(int i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

int main(){
    long long N, W;
    cin >> N >> W;
    vector<long long> w(N), v(N);
    REP(i, N)
        cin >> w[i] >> v[i];

    vector<vector<long long>> dp(N+1, vector<long long>(100001, 1LL<<60));
    dp[0][0] = 0;

    REP(i, N){
        dp[i+1] = dp[i];
        REP(j, 100001){
            long long to = j + v[i];
            if(to > 100000) continue;
            dp[i+1][to] = min(dp[i+1][to], dp[i][j] + w[i]);
        }
    }
    long long ans = 0;
    for(int i=100000; i>=0; i--){
        if(dp[N][i] <= W){
            ans = i;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 80256
#include<iostream>
#include<algorithm>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int64_t A, B, C;
  char c;
  std::cin >> A >> B >> c >> C;
  int64_t ans = A*B + (A*C)/100;
  fin(ans);
  return 0;
}


Measured memory_bytes: 3652
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
typedef long long ll;
using namespace std;

struct edge {
	int to, dist;
};

int N, M, L, Q;
int dist[300][300];
vector<edge>v[300];

int main() {
	scanf("%d%d%d", &N, &M, &L);
	for (int i = 0; i < M; i++) {
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		if (c > L)continue;
		a--;
		b--;
		v[a].push_back({ b,c });
		v[b].push_back({ a,c });
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			dist[i][j] = -1;
		}
	}
	for (int i = 0; i < N; i++) {
		priority_queue<pair<pair<int, int>, int>, vector<pair<pair<int, int>, int>>, greater<pair<pair<int, int>, int>>>pq;
		pq.push({ {0,0},i });
		while (!pq.empty()) {
			int x = pq.top().second;
			int f = pq.top().first.first;
			ll d = pq.top().first.second;
			pq.pop();
			if (dist[i][x] == -1) {
				dist[i][x] = f;
				for (edge e : v[x]) {
					if (dist[i][e.to] == -1) {
						if (d + e.dist > L) {
							pq.push({ {f + 1,e.dist},e.to });
						}
						else {
							pq.push({ {f,d + e.dist}, e.to });
						}
					}
				}
			}
		}
	}
	scanf("%d", &Q);
	while (Q--) {
		int s, t;
		scanf("%d%d", &s, &t);
		s--;
		t--;
		printf("%d\n", dist[s][t]);
	}
}

Measured memory_bytes: 3176
#include<bits/stdc++.h>
#define rep(i,n) for(int i = 0;i<n;i++)
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;}

int n,m;
int ans = 0;
vector<vector<int>>g;
void dfs(int v,vector<bool>& check) {
    check[v] = true;
    for(auto nv : g[v]) {
        if(!check[nv]) {
            dfs(nv,check);
            int tmp = 0;
            rep(i,check.size()) {
                if(!check[i]) break;
                tmp++;
            }
            if(tmp == n) ans++;
            check[nv] = false;
        }
    }
}
int main() {
    cin >> n >> m;
    g.resize(n);
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        a--;b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    vector<bool>check(n,false);
    dfs(0,check);
    cout << ans << endl;
}
    

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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define DISP1(as)		for(auto it : as) cout<<it.f<<" "<<it.s<<") ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	2e+5 + 99;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e+9 + 7;

// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, k, l, q, x;
string s;

// <---------------------- > //


// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n;
	vll a(n);

	for(ll i=0;i<n;i++) cin>>a[i];

	ll total = 0;
	for(ll i=0;i<n;i++) total ^= a[i];

	for(ll i=0;i<n;i++) {
		cout<<(total ^ a[i]) <<" ";
	}	
}


int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {

		MAIN();
	}
	return 0;
}


Measured memory_bytes: 4764
n, k = map(int, input().split())
p = list(map(int, input().split()))

e = [(x + 1) / 2 for x in p]
s = sum(e[:k])
maxsum = s
for i in range(n - k):
    s = s - e[i] + e[k + i]
    maxsum = max(maxsum, s)

print(maxsum)

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

int main() {
  vector<vector<int>> A(3, vector<int>(3));
  int N;
  vector<int> B(N);
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      cin >> A[i][j];
    }
  }
  cin >> N;
  for(int i=0; i<N; i++){
    cin >> B[i];
  }
  
  vector<vector<int>> checked(3,vector<int>(3,0));
  for(int i=0; i<3; i++){
    for(int j=0; j<3; j++){
      for(int k=0; k<N; k++){
        if(A[i][j] == B[k]){
          checked[i][j] = 1;
          break;
        }
      }
    }
  }
  
  string ans = "No";
  if(checked[0][0] + checked[0][1] + checked[0][2] == 3) ans = "Yes";
  if(checked[1][0] + checked[1][1] + checked[1][2] == 3) ans = "Yes";
  if(checked[2][0] + checked[2][1] + checked[2][2] == 3) ans = "Yes";
  if(checked[0][0] + checked[1][0] + checked[2][0] == 3) ans = "Yes";
  if(checked[0][1] + checked[1][1] + checked[2][1] == 3) ans = "Yes";
  if(checked[0][2] + checked[1][2] + checked[2][2] == 3) ans = "Yes";
  if(checked[0][0] + checked[1][1] + checked[2][2] == 3) ans = "Yes";
  if(checked[0][2] + checked[1][1] + checked[2][0] == 3) ans = "Yes";
  
  cout << ans << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
using namespace std;
const int tINF = (int)INT_MAX;
const long long lINF = (long long)LLONG_MAX;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	#ifdef DEBUG
			assert(freopen("inp", "r", stdin));
			assert(freopen("out", "w",stdout));
	#else
			#define cerr if(false)cerr
	#endif
    ll k,x;
    cin >>k >> x;
    if(500LL * k >= x){
        cout << "Yes\n";
    }
    else
        cout << "No\n";
   cerr << "Time execute: " << (double)clock() / (double)CLOCKS_PER_SEC 
    << " sec" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <iomanip>
using namespace std;
#define all(x) x.begin(), x.end()
typedef vector <int> vi;
typedef pair<int,int> ii;
typedef long long ll;
typedef long double ld;
const int mod = 1e9 + 7;
const ll inf = 3e18 + 5;
int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
int mul(int a, int b) { return 1LL * a * b % mod; }
int sub(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
int ctz(int x) { return __builtin_ctz(x); }
int clz(int x) { return __builtin_clz(x); }

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  #ifdef LOCAL
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
  #endif

	char c;
  cin >> c;
  cout << char(c + 1);
}

Measured memory_bytes: 256
N = int(input())

RED = []
BLUE = []

for i in range(N):
  a, b = map(int,input().split())
  RED.append((a,b))

for i in range(N):
  c, d = map(int,input().split())
  BLUE.append((c,d))

RED.sort(key=lambda x: -x[1]) #y座標が大きい順
BLUE.sort(key=lambda x: x[0]) #x座標が小さい順

# print(RED, BLUE)
SELECTED_RED = set()
SELECTED_BLUE = set()

for i in range(N):
  for j in range(N):
    if i in SELECTED_RED or j in SELECTED_BLUE:
       continue
    
    a, b = RED[i]
    c, d = BLUE[j]
    if a < c and b < d:
      # d以下の最大のy座標はbである
      SELECTED_RED.add(i)
      SELECTED_BLUE.add(j)

print(len(SELECTED_RED))

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

int main() {
    int a,b,c;cin>>a>>b>>c;
    if(b+c<a)cout<<0<<endl;
    else cout<<b+c-a<<endl;
} 

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#define MOD 1000000007
using namespace std;
typedef long long ll;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

int N, H, W, fa[200005], vcnt[200005], ecnt[200005];
struct card {int r, c, val;} c[100005];

inline bool operator < (const card &c1, const card &c2) {return c1.val > c2.val;}
int getf(const int &u) {return fa[u] == u ? u : fa[u] = getf(fa[u]);}

int main(){
	getint(N), getint(H), getint(W);
	for(register int i = 1; i <= H + W; i++) fa[i] = i, vcnt[i] = 1, ecnt[i] = 0;
	for(register int i = 1; i <= N; i++) getint(c[i].r), getint(c[i].c), getint(c[i].val);
	sort(c + 1, c + N + 1); ll ans = 0;
	for(register int i = 1; i <= N; i++){
		const int u = getf(c[i].r), v = getf(H + c[i].c);
		if(u == v){
			if(ecnt[u] >= vcnt[u]) continue;
			ans += c[i].val, ecnt[u]++;
		}
		else{
			if(ecnt[u] + ecnt[v] >= vcnt[u] + vcnt[v]) continue;
			ans += c[i].val, ecnt[u] += ecnt[v] + 1, vcnt[u] += vcnt[v], fa[v] = u;
		}
	}
	return printf("%lld\n", ans), 0;
}

Measured memory_bytes: 5504
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <numeric>
#include <sstream>

#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())

using namespace std;
typedef long long ll;

int main() {
#ifdef RUN_LOCAL
  ifstream in("../input.txt");
  cin.rdbuf(in.rdbuf());
#endif

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

  int n;
  cin >> n;
  int d = n%10;

  if (d == 2 || d == 4 || d == 5 || d == 7 || d == 9) {
    cout << "hon" << endl;
  }
  else if (d == 3) {
    cout << "bon" << endl;
  }
  else {
    cout << "pon" << endl;
  }






  return 0;
}


Measured memory_bytes: 3040
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

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

	auto result = "second";
	for (auto i = 0; i < N; ++i)
	{
		auto a = 0ll;
		cin >> a;
		if ((a % 2) != 0)
		{
			result = "first";
		}
	}

	cout << result << endl;

	return 0;
}

Measured memory_bytes: 256
#!usr/bim/python
#! -*- coding: utf-8 -*-

from collections import OrderedDict
import numpy as np
import copy

n = raw_input()
n = int(n)

dic = OrderedDict()
for i in range(26):
    dic[chr(97+i)] = 0

counter = np.zeros([26,n],dtype=np.int16)

for i in range(n):
    new_dic = copy.deepcopy(dic)
    s = raw_input()
    for j in range(len(s)):
        new_dic[s[j]] += 1
    j = 0
    for key,val in new_dic.items():
        counter[j][i] = val
        j += 1

ans = ""
for i in range(26):
    for j in range(np.min(counter[i])):
        ans += chr(97+i)

print ans


Measured memory_bytes: 18032
#include<stdio.h>

int main(){
  int n,i,j,max_l,max_key;
  int l[201],temp,sum;

  scanf("%d", &n);

  for(i=1;i<=2*n;i++){
    scanf("%d",&l[i]);
  }



  for(i=1;i<=2*n;i++){
    max_l = 0;
    for(j=i;j<=2*n;j++){
      if(max_l < l[j]){ max_key=j;max_l = l[j];}
    }
    temp       = l[i];
    l[i]       = l[max_key];
    l[max_key] = temp;
  }

  sum=0;
  for(i=2;i<=2*n;i=i+2){
    sum += l[i];
  }


  printf("%d \n",sum);


  return 0;
}


Measured memory_bytes: 128
s = input()
s1 = int(s[:2])
s2 = int(s[2:])
if 1 <= s1 <= 12:
    if 1 <= s2 <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= s2 <= 12:
        print("YYMM")
    else:
        print("NA")


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
int main(){
	int N, C, K; 
	cin >> N >> C >> K; 
	int T[100010] = {}; 
	for(int i = 0; i < N; i++) cin >> T[i]; 
	T[N] = 2e9 + 114514; sort(T, T+N); 
	int L = 0; int count = 0; 
	while(L < N){
		L += C; 
		for(int R = L - C; R < L && R <= N; R++){
			if(T[R] > T[L - C] + K){
				L = R; break; 
			}
		}
		count ++; 
	}
	cout << count << endl; 
}

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

struct UnionFind {
	vector<int> p;
	UnionFind(int n) : p(n,-1) {}

	int root(int x) {
		if (p.at(x) < 0)
			return x;
		return p.at(x) = root(p.at(x));
	}

	bool issame(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 0;
		if(p.at(x) > p.at(y))
			swap(x,y);

		p.at(x) += p.at(y);
		p.at(y) = x;
		return 1;
	}

	int size(int x) {
		return -p.at(root(x));
	}
};


int main() {
	int N,M,K,A,B;
	cin >> N >> M >> K;

	UnionFind uf(N);
	vector<set<int>> fb(N);

	rep(i,M) {
		cin >> A >> B;
		uf.merge(--A,--B);
		fb.at(A).insert(B);
		fb.at(B).insert(A);
	}

	rep(i,K) {
		cin >> A >> B;
		if(uf.issame(--A,--B)) {
			fb.at(A).insert(B);
			fb.at(B).insert(A);
		}
	}

	rep(i,N)
		cout << uf.size(i)-fb.at(i).size()-1 << " ";
	cout << endl;
}

Measured memory_bytes: 24704
#include <iostream>

int main(void){
  int N,M;

  std::cin >> N >> M;

  bool possible[N+1];
  int count[N+1];
  for(int i=1; i<=N; i++){
    count[i] = 1;
    possible[i] = (i==1);
  }

  int x,y;
  for(int i=0; i<M; i++){
    std::cin >> x >> y;

    count[x]--;
    count[y]++;
    if(possible[x]){
      possible[y] = true;
    }
    if(count[x]==0){
      possible[x] = false;
    }
  }

  int countPossible = 0;
  for(int i=1; i<=N; i++){
    if(possible[i]){
      countPossible++;
    }
  }

  std::cout << countPossible << std::endl;
  return 0;
}

Measured memory_bytes: 768
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepLRE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};

/* Macros reg. ends here */

const ll INF = 1LL << 50;

int main() {
  // ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll n;
  cin >> n;

  multiset<ll, greater<ll>> as;
  rep(i, n) {
    ll a;
    cin >> a;
    as.emplace(a);
  }

  ll ans = 0;
  while (!as.empty()) {
    auto itr = as.begin();
    as.erase(itr);
    ll a = *itr;
    for (ll i = 1; i <= 2*a; i *= 2) {
      ll b = i - a;
      auto itrb = as.find(b);
      if(itrb != as.end()){
        ans++;
        as.erase(itrb);
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 12984
import numpy as np
H, N = list(map(int, input().split()))
A = np.empty(N, int)
B = np.empty(N, int)
for i in range(N):
    A[i], B[i] = list(map(int, input().split()))


DP = np.empty(H+1, int)
DP[0] = 0
for i in range(1, H+1):
    I = i-A;
    I[I<0] = 0
    DP[i] = np.min(DP[I] + B)
    
print(DP[H])

Measured memory_bytes: 14552
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int[] A = new int[N];
		for(int i = 0; i < N; i++) {
			A[i]=Integer.parseInt(sc.next());
		}

		sc.close();

		int count = 0;
		boolean inc = false;
		boolean dec = false;
		boolean first = true;
		for(int i = 1; i < N; i++) {
			if(first) {
				first = false;
				if(A[i] > A[i-1]) {
					inc = true;
					dec = false;
				}else if(A[i] < A[i-1]) {
					inc = false;
					dec = true;
				}else if(A[i] == A[i-1]) {
					inc = false;
					dec = false;
					first = true;
				}
			}

			if((A[i] < A[i-1] && inc) || (A[i] > A[i-1] && dec)) {
				inc = false;
				dec = false;
				first = true;
				count++;
			}
		}

		count++;
		System.out.println(count);

	}

}


Measured memory_bytes: 47968
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

int main() {
  int s, w; cin >> s >> w;
  if (w >= s) cout << "unsafe" << endl;
  else cout << "safe" << endl;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
typedef long long int lint;

#define PI acos(-1)
#define INF64 1LL << 60
#define INF32 1 << 29
#define all(a) (a).begin(), (a).end()
#define INV ((long long int)1000000007)

using namespace std;

void execute()
{
	string S, U;
	int s, u;
	string check;
	cin >> S >> U;
	cin >> s >> u;
	cin >> check;

	if (check.compare(S) == 0)
		cout << s - 1 << " " << u << endl;
	else
		cout << s << " " << u - 1 << endl;
	return;
}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	execute();

	int stop;
	cin >> stop;

	return 0;
}

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

int main(){
  int n, a, b;
  std::cin >> n >> a >> b;
  string s;
  std::cin >> s;
  int region = 0, oversee = 0;
  for (int i = 0; i < s.length(); i++) {
    if(s[i] == 'a'){
      region++;
    } else if(s[i] == 'b'){
      oversee++;
    }
    if(s[i] == 'a' and region + min(oversee, b) <= a + b){
      std::cout << "Yes" << std::endl;
    }else if(s[i] == 'b' and region + min(oversee, b) <= a + b and oversee <= b){
      std::cout << "Yes" << std::endl;
    }else{
      std::cout << "No" << std::endl;
    }
  }
  return 0;
}



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

#define FORE(i, a) for (auto i = a.begin(); i != a.end(); ++i)
#define REPU(i, a, b) for (int i = (a); i < (b); ++i)
#define REPD(i, a, b) for (int i = (a); i > (b); --i)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())

vector<string> split(const string &s, char c) {
	vector<string> v;
	stringstream ss(s);
	string x;
	while (getline(ss, x, c)) v.push_back(x);
	return v;
}

#define DEBUG(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }

void err(vector<string>::iterator it) {}

template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << "[DEBUG] " << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

typedef long long ll;
const int MOD = 1000000007;

template<class T, class U> inline T tmin(T a, U b) { return (a < b) ? a : b; }
template<class T, class U> inline T tmax(T a, U b) { return (a > b) ? a : b; }
template<class T, class U> inline void amax(T &a, U b) { if (b > a) a = b; }
template<class T, class U> inline void amin(T &a, U b) { if (b < a) a = b; }
template<class T> inline T tabs(T a) { return (a > 0) ? a : -a; }
template<class T> T gcd(T a, T b) { while (b != 0) { T c = a; a = b; b = c % b; } return a; }

int main(int argc, char *argv[]) {
	ios_base::sync_with_stdio(false);

	string s;

	cin >> s;
	int n = s.size();
	int ans = 0;
	REPU(i, 0, n) {
		if (i < (n + 1) / 2) {
			if (s[i] == 'p') ans--;
		}
		else {
			if (s[i] == 'g') ans++;
		}
	}
	amax(ans, 0);
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 512
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
      Scanner scn = new Scanner(System.in);
      boolean n[]=new boolean[scn.nextInt()+1];
      int h[]=new int[n.length];
      int m=scn.nextInt();
      int ans=0;
      
      for(int i=1;i<h.length;i++){
          h[i]=scn.nextInt();
          n[i]=true;
      }
      for(int i=0;i<m;i++){
          int a=scn.nextInt();
          int b=scn.nextInt();
          if(h[a]<h[b]){
            n[a]=false;
          }else if(h[a]==h[b]){
            n[a]=false;
            n[b]=false;
          }else{
            n[b]=false;
          }
      }
      for (int i=0;i<n.length;i++){
          if(n[i]) ans++;
      }
      System.out.println(ans);
    }
}


Measured memory_bytes: 59780
#include<iostream>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef vector< vector<int> > talbe;
int main()
{
    int n,m;
    cin>>n>>m;
    talbe l(m);
    rep(i,m)
    {
        int k;
        cin>>k;
        rep(j,k)
        {
            int tmp;
            cin>>tmp;
            l[i].push_back(tmp);
        }
    }
    vector<int> p(m);
    rep(i,m) cin>>p[i];
    int count=0;
    for (int bit = 0; bit <(1<<n); bit++)
    {
        bool flag=true;
        for (int i = 0; i < m; i++)
        {
            int sum=0;
            for (int j = 0; j < l[i].size(); j++)
            {
                if(bit & (1<<l[i][j]-1))sum++;
            }
            if(sum%2!=p[i])
            {
                flag=false;
                break;
            }
        }
        if(flag)count++;
    }
    cout<<count<<endl;

    return 0;
}

Measured memory_bytes: 256
//	-*- mode: C++ -*-
//	Official House
//		You manage 4 buildings, each of which has 3 floors, each of which consists of 10 rooms. Write a program which reads a sequence of tenant/leaver notices, and reports the number of tenants for each room.

//		For each notice, you are given four integers b, f, r and v which represent that v persons entered to room r of fth floor at building b. If v is negative, it means that v persons left.

//		Assume that initially no person lives in the building.

//	Input
//		In the first line, the number of notices n is given. In the following n lines, a set of four integers b, f, r and v which represents ith notice is given in a line.

//	Output
//		For each building, print the information of 1st, 2nd and 3rd floor in this order. For each floor information, print the number of tenants of 1st, 2nd, .. and 10th room in this order. Print a single space character before the number of tenants. Print "####################" (20 '#') between buildings.

//	Constraints
//		No incorrect building, floor and room numbers are given.
//		0 ≤ the number of tenants during the management ≤ 9
//	Sample Input
//		3
//		1 1 3 8
//		3 2 2 7
//		4 3 8 1
//	Sample Output
//		 0 0 8 0 0 0 0 0 0 0
//		 0 0 0 0 0 0 0 0 0 0
//		 0 0 0 0 0 0 0 0 0 0
//		####################
//		 0 0 0 0 0 0 0 0 0 0
//		 0 0 0 0 0 0 0 0 0 0
//		 0 0 0 0 0 0 0 0 0 0
//		####################
//		 0 0 0 0 0 0 0 0 0 0
//		 0 7 0 0 0 0 0 0 0 0
//		 0 0 0 0 0 0 0 0 0 0
//		####################
//		 0 0 0 0 0 0 0 0 0 0
//		 0 0 0 0 0 0 0 0 0 0
//		 0 0 0 0 0 0 0 1 0 0

#include <iostream>
#include <vector>

int	main(int argc,
		 char *argv[])
{
    std::vector<std::vector<std::vector<unsigned int>>>	building	{{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
				{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
					{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},},
		{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
				{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
					{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},},
		{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
				{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
					{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},},
		{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
				{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},
					{0, 0, 0, 0, 0, 0, 0, 0, 0, 0,},},};

	unsigned int	n	{0};

	std::cin >> n;

	for(unsigned int i = 0; i < n; i++){
		unsigned int	b	{0};
		unsigned int	f	{0};
		unsigned int	r	{0};
		int				p	{0};

		std::cin >> b >> f >> r >> p;

		building[b - 1 ][f - 1 ][r - 1]	+= p;
	}

	unsigned int h	{0};
	for(auto f : building){
		if(h == 0){
			h++;
		}
		else{
			std::cout << "####################\n";
		}

		for(auto r : f){
			for(auto p : r){
				std::cout << ' ' << p;
			}
			std::cout << '\n';
		}
	}

    return 0;
}



Measured memory_bytes: 3136
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	int n;map<ll,int> m;vector<ll> a;
	cin>>n;
	fori(n){
		int hoge;
		cin>>hoge;
		auto itr=m.find(hoge);
		if(itr!=m.end()){
			++m[hoge];
		}else{
			m[hoge]=1;
			a.push_back(hoge);
		}
	}

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

	if(m.size()==1&&a[0]==0){
		cout<<"Yes";return 0;
	}
	if(m.size()==2&&a[0]==0&&m[0]==n/3){
		cout<<"Yes";return 0;
	}
	if(n%3==0&&m.size()==3&&(m[a[0]]==n/3)&&(m[a[1]]==n/3)&&(m[a[2]]==n/3)&&(a[0]^a[1]^a[2])==0){
		cout<<"Yes";return 0;
	}
	cout<<"No";
}

Measured memory_bytes: 5620
import sys
input = sys.stdin.readline

s = input()
cnt = 0

if s[0] == 'R':
  cnt = 1
  if s[1] == 'R':
    cnt = 2
    if s[2] == 'R':
      cnt = 3
else:
  if s[1] == 'R':
    cnt = 1
    if s[2] == 'R':
      cnt = 2
  else:
    if s[2] == 'R':
      cnt = 1
      
print(cnt)
    

Measured memory_bytes: 9048
import java.util.Scanner;
 
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int n = scn.nextInt();
long x = 1;
for (int i = 2; i <= n; i++) {
x = x * i;
}
System.out.println(x);
}
}

Measured memory_bytes: 15320
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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

int N,b;

int main(){
    cin>>N>>b;
    if(N<6)out(0);
    else if(N<13)out(b/2);
    else out(b);
    
    
}


Measured memory_bytes: 764
main :: IO ()
main = do
  [a,b] <- map read . words <$> getLine
  print $ numOfPlndrm a b

numOfPlndrm
  :: Int -> Int -> Int
numOfPlndrm a b = length . filter isP $ [a .. b]

isP 
  :: Int -> Bool
isP n = n == revInt n

revInt
  :: Int -> Int
revInt = read . reverse . show

Measured memory_bytes: 1020
#include <iostream>
#include <string.h>
#include <stdio.h>
using namespace std;
int n, cnt = 0, a[62][3], sum = 0;
int main()
{
    //    while (1) {
    cin>>n; n--;
    int i, ed = 1, x = 1;
//    cnt = 0; sum = 0;
    for(i=1;i<20 && n;i++,x<<=1) {
        if(x > n) break;
        a[++cnt][0] = i; a[cnt][1] = i+1; a[cnt][2] = x;
        a[++cnt][0] = i; a[cnt][1] = i+1; a[cnt][2] = 0;
        n -= x; sum += x; ed = i+1;
    }
    if(n) {
        ed = i; i++;
        for(; i>=1; i--) {
            while(1<<(i-1) <= n) {
                n -= (1<<(i-1));
                a[++cnt][0] = i; a[cnt][1] = ed; a[cnt][2] = sum + 1;
                sum = sum + (1<<(i-1));
            }
        }
    }
    cout<<ed<<" "<<cnt<<endl;
    for(int i=1;i<=cnt;i++) {
        printf("%d %d %d\n", a[i][0], a[i][1], a[i][2]);
    }
    //    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
void solve()
{
    int d,t,s;
    cin >> d >> t >> s;
    if(s*t>=d)
    cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
    
}
int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    solve();
    return 0;
    
}

Measured memory_bytes: 3648
package main
import (
  "bufio"
  "fmt"
  // "math"
  "os"
  "strconv"
  "strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
  var line1, line2, line3 []int
  sc.Scan(); line1 = arrayAtoi(strings.Split(sc.Text(), " "))
  sc.Scan(); line2 = arrayAtoi(strings.Split(sc.Text(), " "))
  sc.Scan(); line3 = arrayAtoi(strings.Split(sc.Text(), " "))

  capX := line1[2]
  capY := line1[3]

  borderX := arrayMax(append(line2, capX))
  borderY := arrayMin(append(line3, capY))

  if borderX >= borderY {
    fmt.Println("War")
    return
  }
  fmt.Println("No War")  
}

// 配列中の文字列を全て数値に変換
func arrayAtoi(array []string) []int {
  retarray := []int{}
  for _, v := range array {
    num, e := strconv.Atoi(v)
    if e != nil {
      panic(e)
    }
    retarray = append(retarray, num)
  }
  return retarray
}

// 配列中の最大値を返す
func arrayMax(array []int) int {
  max := array[0]
  for _, v := range array {
    if v > max {
      max = v
    }
  }
  return max
}

// 配列中の最小値を返す
func arrayMin(array []int) int {
  min := array[0]
  for _, v := range array {
    if v < min {
      min = v
    }
  }
  return min
}


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

ulong diff(ulong a, ulong b){
    return __builtin_ctzl(a^b);
}

ulong hd(ulong a, ulong b){
    return __builtin_popcountl(a^b);
}

ulong bit_remove(ulong a, ulong n){
    ulong low  = a & ((1<<n)-1);
    ulong high = (a >> (n+1)) << n;
    return high | low;
}

ulong bit_insert(ulong a, ulong n, ulong b){
    ulong low  = a & ((1<<n)-1);
    ulong high = (a >> n) << (n+1);
    return high | (b<<n) | low;
}
#define N 17
long data[1<<N];

void solve(const long n, const long a, const long b, const size_t sp, const size_t ep){
    if(n==1){
        data[sp+0] = a;
        data[sp+1] = b;
        return;
    }
    ulong d = diff(a, b);
    ulong aa = bit_remove(a, d);
    ulong ab = bit_remove(a, d) ^ 1;
    ulong bb = bit_remove(b, d);
    const size_t mp = (sp+ep)/2;
    solve(n-1, aa, ab, sp, mp);
    solve(n-1, ab, bb, mp, ep);
    for(size_t i=sp; i<mp; i++){
        data[i] = bit_insert(data[i], d, (a&(1<<d)) >> d);
    }
    for(size_t i=mp; i<ep; i++){
        data[i] = bit_insert(data[i], d, (b&(1<<d)) >> d);
    }
}

int main(void){
    long n, a, b;
    std::cin >> n >> a >> b;
    if(__builtin_popcountl(a)%2 == __builtin_popcountl(b)%2){
        std::cout << "NO" << std::endl;
        return 0;
    }
    solve(n, a, b, 0, 1<<n);
    const size_t m = 1<<n;
    printf("YES\n");
    for(size_t i=0; i<m-1; i++){
        printf("%ld ", data[i]);
    }
    printf("%ld\n", data[m-1]);
    return 0;
}


Measured memory_bytes: 2048