akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stack>
#include <utility>
#include <vector>
using namespace std;

typedef pair<int, int> edge;

void evenOfOdd_dfs(vector<edge> *c, vector<int> &dist, int start = 0) {
  dist[start] = 0;
  stack<int> s;
  s.push(start);
  while (!s.empty()) {
    int current = s.top();
    s.pop();
    for (const auto &e : c[current]) {
      if (dist[e.first] == -1) {
        s.push(e.first);
        dist[e.first] = (dist[current] + e.second) % 2;
      }
    }
  }
}

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

  vector<edge> *c = new vector<edge>[n];

  for (int i = 0; i < n - 1; i++) {
    int x, y, z;
    cin >> x >> y >> z;
    x--;
    y--;
    c[x].push_back(make_pair(y, z));
    c[y].push_back(make_pair(x, z));
  }

  vector<int> dist(n, -1);

  evenOfOdd_dfs(c, dist, 0);

  for (const auto &var : dist) {
    cout << var % 2 << endl;
  }

  delete[] c;
  return 0;
}


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

const int MAX = 100 / 0.08;
int main() {
    string s;
    int q;
    cin >> s;
    cin >> q;

    int t, f;
    char c;

    // reverseか？
    bool r = false;
    rep(i, q) {
        cin >> t;
        if (t == 1) {
            r = !r;
        } else {
            cin >> f >> c;
            if (r) {
                f = f == 1 ? 2 : 1;
            }
            if (f == 1)  { 
                string f = {c};
                s.insert(0, f); 
            } else {
                s.push_back(c);
            }
        }
    }
    if (r) reverse(s.begin(), s.end());
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 900
#include <bits/stdc++.h>
#include <map>
using namespace std;
#define ll long long 
int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll n,c=0;
    cin>>n;
    map<string,ll> a;
    for(ll i=0;i<n;i++){
        string s;
        cin>>s;
        sort(s.begin(),s.end());
        a[s]++;
    }
    for(auto d:a){
        ll x=d.second;
        c+=(x*(x-1))/2;
    }
    cout<<c<<endl;
    return 0;
}

Measured memory_bytes: 11264
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#define ll long long

using namespace std;

long long MOD = 1000000007;

int main(){
    int N;
    cin >> N;
    int cnt=0;
    for(int i=1; i<=N; i++){
        if(i<10 || (100<=i&&i<1000) || (10000<=i&&i<100000)){
            cnt++;
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"strconv"
	"strings"
)

func main() {
	var n, a, b, t, sum, ans int
	fmt.Scan(&n, &a, &b)
	for i := 1; i <= n; i++ {
		sum = 0
		sa := strings.Split(strconv.Itoa(i), "")
		for _, v := range sa {
			t, _ = strconv.Atoi(v)
			sum += t
		}
		if a <= sum && sum <= b {
			ans += i
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <map>
#include <numeric>
#include <random>
#include <queue>
#include <deque>
#include <tuple>
#include <iomanip>
#include <iterator>
#include <functional>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N;
  cin>>N;
  vector<ll>H(N);
  REP(i,N)cin>>H[i];
  int tmp=0,ans=0;
  REP(i,N-1){
    if(H[i]>=H[i+1]){
      tmp++;
    }else{
      ans=max(ans,tmp);
      tmp=0;
    }
  }
  ans=max(ans,tmp);
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
n=int(input())
A=[3,5,7]
past=int(0)
head=int(2)
for i in range(9):
    for j in range(past,head+1):
        A.append(10*A[j]+3)
        A.append(10*A[j]+5)
        A.append(10*A[j]+7)
    past=head+1
    head=len(A)

ans=int(0)
for i in range(len(A)):
    t=0
    f=0
    s=0
    now=A[i]
    while(now>0):
        if now%10==3:
            t=1
        if now%10==5:
            f=1
        if now%10==7:
            s=1
        now=int(now/10)
    
    if t and f and s and A[i]<=n:
        ans+=1
        
print(ans)

Measured memory_bytes: 7588
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define inRange(x,a,b) (a < x && x < b)

int main(){
    int n, t, s;
    cin >> n >> t >> s;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++)  cin >> a[i] >> b[i];
    vector<vector<int>> dp(n+1, vector<int>(t+1, 0));
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= t-b[i]; j++){
            if(inRange(s, j, j+b[i]))   continue;
            dp[i+1][j+b[i]] = max(dp[i+1][j+b[i]], dp[i][j]+a[i]);
        }
        for(int j = 1; j <= t; j++) dp[i+1][j] = max(dp[i+1][j], dp[i][j]);
    }
    cout << *max_element(dp[n].begin(), dp[n].end()) << endl;
    return 0;
}


Measured memory_bytes: 38240
#include <bits/stdc++.h>
using namespace std;
struct ios_accelerate { ios_accelerate() { ios::sync_with_stdio(false); cin.tie(nullptr); } } CALL;

#define REP(i, n) for(auto (i) = (n)*0; (i) < (n); (i)++)
#define RNG(i, a, b) for(auto (i) = (a); (i) < (b); (i)++)
#define RBF(i, v) for(auto& (i) : (v))
#define ALL(x) (x).begin(), (x).end()

using LL = long long;
using UL = unsigned long;
using ULL = unsigned long long;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
template<typename T> using P = pair<T, T>;

const double PI = 3.141592653589793;
const int MOD = 1000000007;
const LL INF64 = static_cast<LL>(1e18) + 2;
const int INF = static_cast<int>(1e9) + 2;

template<typename T> inline void upsort(vector<T>& x) { sort(x.begin(), x.end()); }
template<typename T> inline void downsort(vector<T>& x) { sort(x.begin(), x.end(), greater<T>()); }
template<typename T> inline void col(T x) { cout << x << '\n'; }
template<> inline void col(double x) { cout << fixed << setprecision(12) << x << '\n'; }

signed main() {
    const vector<pair<int, int>> mv = { make_pair(-1,0), make_pair(0,-1), make_pair(1,0), make_pair(0,1) };
	int h, w;
	cin >> h >> w;
	V<string> M(h + 2, string(w + 2, '#'));
	RNG(i, 1, h + 1) {
		string tmp;
		cin >> tmp;
		RNG(j, 1, w + 1) {
			M[i][j] = tmp[j - 1];
		}
	}

    int ans = 0;
    RNG(sy, 1, h + 1) {
        RNG(sx, 1, w + 1) {
            if (M[sy][sx] == '#') {
                continue;
            }

            vector<vector<int>> distance(h + 2, vector<int>(w + 2, 0));
            vector<vector<bool>> seen(h + 2, vector<bool>(w + 2, false));
            distance[sy][sx] = 0;
            queue<pair<int, int>> que;
            seen[sy][sx] = true;
            que.push(make_pair(sy, sx));
            int dmax = 0;

            while (!que.empty()) {
                int y = que.front().first;
                int x = que.front().second;
                int d = distance[y][x] + 1;
                que.pop();

                for (auto& m : mv) {
                    int my = y + m.first, mx = x + m.second;
                    if (!seen[my][mx] && M[my][mx] == '.') {
                        seen[my][mx] = true;
                        que.push(make_pair(my, mx));
                        distance[my][mx] = d;
                        dmax = max(d, dmax);
                    }
                }
            }

            ans = max(dmax, ans);
        }
    }


    col(ans);
	return 0;
}


Measured memory_bytes: 3636
cnt = 0
def count(A, left, mid, right):
    L = []
    R = []
    for l in A[left:mid]:
        L.append(l)
    for r in A[mid:right]:
        R.append(r)
    global cnt
    l_idx = 0
    r_idx = 0
    cnt_part = 0
    for i in range(left, right):
        if l_idx >= len(L):
            A[i] = R[r_idx]
            r_idx += 1
            continue
        if r_idx >= len(R):
            A[i] = L[l_idx]
            l_idx += 1
            if l_idx < len(L):
                cnt_part += r_idx
            continue
        if L[l_idx] > R[r_idx]:
            A[i] = R[r_idx]
            cnt_part += 1
            r_idx += 1
        else:
            A[i] = L[l_idx]
            l_idx += 1
            if l_idx < len(L):
                cnt_part += r_idx
    cnt += cnt_part
def count_inversion_number(A, left, right):
    if left + 1 < right:
        mid = (left + right) // 2
        count_inversion_number(A, left, mid)
        count_inversion_number(A, mid, right)
        count(A, left, mid, right)
n = int(input())
A = list(map(int, input().split(' ')))
count_inversion_number(A, 0, n)
print(cnt)


Measured memory_bytes: 27480
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> P;
typedef long long ll;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const long long INF = 1000000007;
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
// chmax chmin
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 main(void){
    string s,t; cin >> s >> t;
    cout << t+s << endl;
    return 0;
}

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

int zeller(int y, int m, int d)
{
	int h;
	int C = y / 100;
	int Y = y % 100;
	int R = (-2 * C) + (C / 4);
	
	if (m <= 2){
		m += 14;
	}
	
	h = d + (26 * ++m / 10) + Y + (Y / 4) + R;
	h = h % 7 + 7;
	h %= 7;
	return (h);
}

int main()
{
	int y = 2004;
	int m, d;
	int h;
	
	while (1){
		
		cin >> m >> d;
		if (m == 0){
			break;
		}
		
		h = zeller(y, m, d);
		
		//cout << h << endl;
		switch (h){
		  case 0:
		    cout << "Saturday";
			break;
			
		  case 1:
		    cout << "Sunday";
			break;
			
		  case 2:
		    cout << "Monday";
			break;
			
		  case 3:
		    cout << "Tuesday";
			break;
			
		  case 4:
		    cout << "Wednesday";
			break;
			
		  case 5:
		    cout << "Thursday";
			break;
			
		 case 6:
		   cout << "Friday";
		   break;
		}
		cout << endl;
	}
	
	return (0);
}

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

using namespace std;

constexpr int64_t modulo = UINT64_C(1000000007);

struct solved_t {
  constexpr solved_t() : answers() {
    int64_t fact = 1;
    answers[0][1] = static_cast<int>(fact * 2);
    answers[1][1] = static_cast<int>(fact * 2);
    for (int i = 2; i < 100001; i++) {
      fact *= i;
      fact %= modulo;
      fact *= i;
      fact %= modulo;
      answers[0][i] = static_cast<int>((fact * (i + 1)) % modulo);
      answers[1][i] = static_cast<int>((fact * 2) % modulo);
    }
  }
  int answers[2][100001];
};
static constexpr solved_t solved{};

int main() {
  int n, m;
  std::cin >> n >> m;
  if (n < m) {
    std::swap(n, m);
  }
  std::cout << (n - m >= 2 ? 0 : solved.answers[n == m][m]) << std::endl;
  return 0;
}


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

int main() {
	int N, C;
	cin>>N>>C;
	int schedule[C][100010];
	for(int i=0;i<C;++i){
		for(int j=0;j<1e5+10;++j){
			schedule[i][j] = 0;
		}
	}
	int s, t, c;
	for(int i=0;i<N;++i){
		cin>>s>>t>>c;
		c--;
		schedule[c][s]++;
		schedule[c][t+1]--;
	}

	/**
	for(int i=0;i<C;++i){
		for(int j=0;j<1e5+10;++j){
			cout<<schedule[i][j]<<" ";
		}
		cout<<endl;
	}
	**/

	for(int i=0;i<C;++i){
		for(int j=0;j<1e5+9;++j){
			schedule[i][j+1] += schedule[i][j]; 
		}
	}

	for(int i=0;i<C;++i){
		for(int j=0;j<1e5+9;++j){
			if(schedule[i][j]>0)schedule[i][j] = 1;
		}
	}

	int ans = 0;
	int tmp;
	for(int j=0;j<1e5+5;++j){
		tmp = 0;
		for(int i=0;i<C;++i){
			tmp += schedule[i][j];
		}
		if(ans<tmp)ans=tmp;
	}
	/**
	for(int i=0;i<C;++i){
		for(int j=0;j<1e5+10;++j){
			cout<<schedule[i][j]<<" ";
		}
		cout<<endl;
	}
	cout<<endl;
	**/
	cout<<ans<<endl;
}


Measured memory_bytes: 11904
from collections import deque
N, M = map(int, input().split())
G = [[] for _ in range(N+1)]
for _ in range(M):
    a, b = map(int, input().split())
    G[a].append(b)
    G[b].append(a)
q = deque([1])
closed = [False] * (N+1)
closed[1] = True
Ans = [0] * (N+1)
while q:
    v = q.popleft()
    for u in G[v]:
        if not closed[u]:
            closed[u] = True
            q.append(u)
            Ans[u] = v
print("Yes")
print("\n".join(map(str, Ans[2:])))


Measured memory_bytes: 42376
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <set>
#include <sstream>
#include <cmath>
#include <deque>
#include <list>
#include <bitset>
using namespace  std;
typedef pair<long long , long long> P;
typedef long long int64;
typedef long long lint;
#define REP(i, n) for(long long (i)=0; (i)<(n); ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define FST first
#define SND second

signed main(){
    int a, b, c;
    cin >> a>> b>>c;
    if(a<=c and c<=b) cout << "Yes" << endl;
    else if(a>=c and c>=b)cout << "Yes" << endl; 
    else cout << "No" <<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>

using namespace std;

int main(){

  int n, l;
  cin >> n >> l;

  vector<string> v;
  string t;
  for (int i = 0; i < n; i++){
    cin >> t;
    v.push_back(t);
  }

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

  string s;
  t = v[0];
  s = t;
  for (int i = 1; i < n; i++){
    t = v[i];
    s = s + t;
  }
  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
card_num, target_average = list(map(int, input().split()))
x = list(map(int, input().split()))

dp = [[[0]*(card_num * target_average + 1) for _ in range(card_num + 1)] for _ in range(card_num + 1)]
dp[0][0][0] = 1

# number of cards to be ranged.
for i in range(card_num):
  # number of cards to be selected.
  for n in range(card_num):
    # total sum.
    for sm in range(card_num * target_average):
      if dp[i][n][sm] == 0:
        continue
      # pattern use xi
      dp[i + 1][n][sm] += dp[i][n][sm]
      # pattern not use xi
      if sm + x[i] <= card_num * target_average:
        dp[i + 1][n + 1][sm + x[i]] += dp[i][n][sm]

ans = 0
for n in range(1, card_num + 1):
  ans += dp[card_num][n][n * target_average]

print(ans)


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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;

int main() {
    int N; cin >> N;
    vector<int> A(N); cin >> A;
    vector<int> ans(N);

    for(int i = N; i > 0; i--) {
        int sum = 0;
        for(int j = i; j <= N; j += i) {
            sum += ans[j - 1];
        }
        sum %= 2;
        ans[i - 1] = sum == A[i -1] ? 0 : 1;
    }
    vector<int> ans2;
    rep(i, N) if(ans[i]) ans2.push_back(i + 1);
    cout << ans2.size() << endl;
    rep(i, ans2.size()) cout << ans2[i] << (i == ans2.size() - 1 ? "\n" : " ");
    return 0;
}


Measured memory_bytes: 3064
const main = input => {
  const lines = input.trim().split(/\s|\n/).map(e => Number.parseInt(e))
  const [n, k, ...p] = lines
  return p.sort((a, b) => a - b).slice(0, k).reduce((a, c) => a + c, 0)
}; // Implement this function

console.log(main(require('fs').readFileSync('/dev/stdin', 'utf8'))); // Common part

Measured memory_bytes: 29848
N, K = map(int,input().split())
A = list(map(int,input().split()))
for i in range(K):
    B = [0]*(N+1)
    for j in range(N):
        B[max(0,j-A[j])] += 1
        B[min(N,j+A[j]+1)] -= 1
    for j in range(N):
        A[j] = B[j]
        B[j+1] += B[j]
    if min(A) == N:
        break
print(*A)

Measured memory_bytes: 157344
#include <iostream>

using namespace std;

int main(){
  int N;
  cin >> N;
  int L[N];
  int tri[3];
  int cnt(0);
  for (int i = 0; i < N; ++i)
  {
    cin >> L[i];
  }
  
  for (int i = 0; i + 2 < N; ++i)
  {
    for (int j = i+1; j + 1< N; ++j)
    {
      for (int k = j+1; k < N; ++k)
      {
        tri[0] = max(max(L[i], L[j]), L[k]);
        tri[1] = min(min(L[i], L[j]), L[k]);
        tri[2] = L[i] + L[j] + L[k] - tri[0] - tri[1];
        if ( L[i] < L[j] + L[k] && L[j] < L[i] + L[k] && L[k] < L[j] + L[i] && L[i] != L[j] && L[i] != L[k] && L[k] != L[j])
          cnt++;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}

Measured memory_bytes: 3636
# C - Walking Takahashi

X, K, D = map(int, input().split())
X = abs(X)
d = X // D
m = X % D

if K <= d:
    ans = X - (D * K)
elif (K - d) % 2 == 0:
    ans = X - (D * d)
else:
    ans = X - (D * (d+1))
print(abs(ans))

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

namespace _0137
{
    public class Program

    {
        public static void Main(string[] args)
        {
            int n = RInt();
            for (int i = 0 ; i < n ; i++)
            {
                Console.WriteLine("Case {0}:", i + 1);

                int num = RInt();
                for (int j = 0 ; j < 10 ; j++)
                {
                    int randomNumber = int.Parse((num * num).ToString().PadLeft(8, '0').Substring(2, 4));
                    Console.WriteLine(randomNumber);
                    num = randomNumber;
                }
            }
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



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

using namespace std;

typedef long long ll;
typedef vector<int> vi; 
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;

#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define ini(a, i) memset(a, i, sizeof(a))
#define contains(c, i) ((c).find(i) != (c).end())
#define present(i, c) (find(all(c), i) != (c).end())

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i <= n; i++)
#define repa(i, a, b) for(int i = (a); i < (b); i++)
#define repd(i, n) for(int i = (n)-1; i >= 0; i--)

#define TRACE(x...) x
#define dbg(x) TRACE(cerr << #x" = " << x << endl)
#define dbgall(x) TRACE(cerr << #x" = "; for(auto __i : x) cerr << __i << " "; cerr << endl)
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<class T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<class T, class S>  ostream& operator<<(ostream& os, const pair<T, S>& p) { os << "(" << p.first << ", " << p.second << ")"; return os; }

//=========================

void run_test() {
    int n; cin >> n;
    vi a(n);
    int xort = 0;
    rep(i, n) cin >> a[i], xort ^= a[i];
    rep(i, n) {
        // int xor1;
        // xor1 = a[i];
        // int ans = 0;
        // rep(b, 31) {
        //     if((xor1 & (1 << b)) != (xort & (1 << b))) 
        //         ans |= (1 << b);
        // }
        // cout << ans << " ";
        cout << (a[i] ^ xort) << " ";
    }
    cout << endl;
}

//=========================

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	//int _t = 1, __t; cin >> __t; while(_t <= __t) { cout << "Case #" << _t++ << ": "; run_test(); }
	// int _t; cin >> _t; while(_t--) run_test();
	run_test();
	return 0;	
}



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

class UnionFind
{
private:
    vector<int> parents;

public:
    UnionFind(int n) : parents(n)
    {
        for (int i = 0; i < n; i++)
        {
            parents.at(i) = -1;
        }
    }

    bool is_root(int x)
    {
        return parents.at(x) < 0;
    }

    int size(int x)
    {
        return -parents.at(find(x));
    }

    int find(int x)
    {
        if (is_root(x))
            return x;
        parents.at(x) = find(parents.at(x));
        return parents.at(x);
    }

    void unite(int x, int y)
    {
        x = find(x);
        y = find(y);
        if (x == y)
            return;
        if (size(x) < size(y))
            swap(x, y);
        parents.at(x) -= size(y);
        parents.at(y) = x;
    }

    bool same(int x, int y)
    {
        return find(x) == find(y);
    }
};

void solve(int N, int M, vector<int> A, vector<int> B)
{
    UnionFind tree = UnionFind(N);
    for (int i = 0; i < M; i++)
    {
        tree.unite(A.at(i), B.at(i));
    }

    int res = 0;
    for (int i = 0; i < N; i++)
    {
        res = max(res, tree.size(i));
    }
    cout << res << endl;
}

int main()
{
    int N;
    cin >> N;
    int M;
    cin >> M;
    vector<int> A(M);
    vector<int> B(M);
    for (int i = 0; i < M; i++)
    {
        cin >> A.at(i);
        cin >> B.at(i);
        A.at(i)--;
        B.at(i)--;
    }
    solve(N, M, move(A), move(B));
    return 0;
}


Measured memory_bytes: 5644
#include <iostream>

using namespace std;

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

    for (int i = 0; i < 25; ++i) {
        for (int j = 0; j < 14; ++j) {
            if (4 * i + 7 * j > N) {
                break;
            }
            if (4 * i + 7 * j == N) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long max = (long) Math.pow(10, 18);
        BigInteger maxb = new BigInteger(String.valueOf(max));
        int n = Integer.parseInt(sc.next());
        long[] a = new long[n];
        BigInteger ans = new BigInteger(String.valueOf(1));
        for (int i = 0; i < n; i++) {
            long temp = Long.parseLong(sc.next());
            if (temp == 0) {
                System.out.println(0);
                return;
            }
            a[i] = temp;
        }
        for (int i = 0; i < n; i++) {
            ans = ans.multiply(BigInteger.valueOf(a[i]));
            if (ans.compareTo(maxb) > 0) {
                System.out.println(-1);
                return;
            }
        }
        System.out.println(ans);
    }
}

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

int n;

bool cmp(pair<int, int>& a, pair<int, int>& b) {
	return a.first < b.first || (a.first == b.first && a.second < b.second);
}

int main() {
	cin >> n;
	vector<pair<int, int>> pl(n, make_pair(0, 0));
	for (int i = 0; i < n; i++) {
		cin >> pl[i].first >> pl[i].second;
	}
	sort(pl.begin(), pl.end(), cmp);
	int ans = 0;
	int x = pl[0].first, y = pl[0].second;
	for (int i = 1; i < n; i++) {
		if (pl[i].first > y) {
			ans += y - x + 1;
			x = pl[i].first;
			y = pl[i].second;
		}
		else {
			y = max(y, pl[i].second);
		}
	}
	ans += y - x + 1;
	cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCorder
{
    public static class Program
    {
        static public void Main(string[] args)
        {
            //int cnt = int.Parse(Console.ReadLine());
            string input=  Console.ReadLine();
            char first = input[0];
            string ans = "";
            foreach (char c in input)
            {
                if (first == c)
                {
                    ans = "No";
                }
                else 
                {
                    ans = "Yes";
                    break;
                }
                
            }

            Console.WriteLine(ans);
        }
    }
}




Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <cmath>
#include <numeric>

using namespace std;

int main() {
	int n;
	cin >> n;
	//int pmax = 55555;
	int pmax = 56000;
	vector<int> table = vector<int>(pmax + 1, 1);
	table[0] = 0;
	table[1] = 0;
	vector<int> primes;
	for (int i = 2; i < pmax; ++i) {
		if (table[i] == 1) {
			primes.push_back(i);
			int j = i*2;
			while (j < pmax) {
				table[j] = 0;
				j += i;
			}
		}
	}
	//cout << primes.size() << endl;
	vector<int> picked;
	for (int i = 0; i < primes.size(); ++i) {
		if ( (primes[i] % 10) == 3) {
			picked.push_back(primes[i]);
		}
		if (picked.size() == n) break;
	}
	/*
	vector<int> picked;
	vector<vector<int>> sumex = vector<vector<int>>(5, vector<int>(pmax+1, 0));
	int ind = 1;
	while (picked.size() < n) {
		int p = primes[ind];
		// check
		bool flag = true;
		for (int i = 0; i < pmax && flag; ++i) {
			if (sumex[3][i] == 1) {
				if (i + p < pmax) {
					if (table[i + p]) {
						flag = false;
					}
				}
			}
		}
		// pick
		if (flag) {
			picked.push_back(p);

			//update
			for (int num = 2; num >= 0; --num) {
				for (int i = 0; i < pmax; ++i) {
					if (sumex[num][i] == 1) {
						if (i + p < pmax)
							sumex[num + 1][i + p] = 1;
					}
				}
			}
			sumex[0][p] = 1;
		}
		++ind;
	}
	*/

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

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
    int n;
    int number;
    cin >> n;

    for (int i = 0; i < n; i++){
        int a, b;
        cin >> a >> b;
        number += b - a + 1;
    }
    cout << number;
}

Measured memory_bytes: 256
#pragma GCC optimize("O3")
#pragma GCC target("sse4")

#include <bits/stdc++.h>

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

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;  // check the limits, dummy

typedef long long ll;
const int inf = INT_MAX / 2;
const ll infl = 1LL << 60;
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;
}

template <class T>
void print(const vector<T> v) {
  cout << "[ ";
  F0R(i, v.size()) { cout << v[i] << ' '; }
  cout << "]" << '\n';
}

int mod(int i, int j) {
  return (i % j) < 0 ? (i % j) + 0 + (j < 0 ? -j : j) : (i % j + 0);
}

// --------------------------------------------------------
// This is tool
// --------------------------------------------------------
void Main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int N;
  cin >> N;
  cout << 2 * N * M_PI << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
}

Measured memory_bytes: 3804
#include <iostream>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <functional>
using namespace std;
#define int long long
#define All(v) (v).begin(),(v).end()
int dy[8] = {-1,0,1,0,-1,1,1,-1};
int dx[8] = {0,1,0,-1,1,1,-1,-1};
const int mod = 1000000007;
const int inf = mod*mod;
const int d5 = 100100;
int n;
string s;
string res1 = "SS", res2 = "SW", res3 = "WS", res4 = "WW";

int cal(string res){
    for (int i = 1; i < n;i++){
        if(res[i]=='S'){
            if(s[i]=='o'){
                res += res[i - 1];
            }
            else{
                if(res[i-1]=='S')
                    res += 'W';
                else
                    res += 'S';
            }
        }else{
            if(s[i]=='o'){
                if(res[i-1]=='S')
                    res += 'W';
                else
                    res += 'S';
            }else{
                res += res[i - 1];
            }
        }
    }
    if(res[0]==res[res.size()-1]){
        string t=res.substr(0,n);
        if(s[0]=='o'&&t[0]=='S'){
            if(t[1]==t[t.size()-1]){
                cout<<t<<endl;
                exit(0);
            }
        }else if(s[0]=='o'&&t[0]=='W'){
            if(t[1]!=t[t.size()-1]){
                cout<<t<<endl;
                exit(0);
            }
        }else if(s[0]=='x'&&t[0]=='S'){
            if(t[1]!=t[t.size()-1]){
                cout<<t<<endl;
                exit(0);
            }
        }else{
            if(t[1]==t[t.size()-1]){
                cout<<t<<endl;
                exit(0);
            }
        }
    }
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> s;
    cal(res1);
    cal(res2);
    cal(res3);
    cal(res4);
    cout << -1 << endl;
}


Measured memory_bytes: 768
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
//#define mt make_tuple
//typedef tuple<int,int,int> tp;
//typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n;
	cin>>n;
	vi in(n);
	rep(i,n)cin>>in[i];
	map<ll,ll>ma;
	ll sum=0;
	ma[0]++;
	rep(i,n){
		sum+=in[i];
		ma[sum]++;
	}
	ll out=0;
	for(auto i:ma)
		out+=i.second*(i.second-1)/2;
	cout<<out<<endl;
}









Measured memory_bytes: 13568
import java.util.*;
/*
Main class for AOJ where there is no input.
*/
public class Main{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String str = sc.nextLine();
      String[] arr = str.split(" ");
      int a = Integer.parseInt(arr[0]);
      int b = Integer.parseInt(arr[1]);
      int c = Integer.parseInt(arr[2]);
      int count = 0;
      
      for(int i = a; i <= b; i++){
         if(c%i == 0){
            count++;
         }
      }
      
      System.out.println(count);
      
   }//main
}//class

Measured memory_bytes: 26288
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,long long> pint;
typedef long long ll;
const ll mod= 1e9+7;
const ll  longinf = 1LL<<60;
const int inf=1e9+7;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};


int main(){
  int x,t;
  cin>>x>>t;
  cout<<max(0,x-t)<<endl;

  return 0;
  }

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

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

    int n, m;
    cin >> n >> m;
    vector<int> x(n+1), y(m+1);
    cin >> x[n] >> y[m];
    rep(i, n) cin >> x[i];
    rep(i, m) cin >> y[i];
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    if(x[n]<y[0])
        cout << "No War" << endl;
    else
        cout << "War" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
#define MAX_V 1000
#define INF 1<<29
using namespace std;
 
 
//  geometry
 
 
typedef double D;
typedef complex<D> P;
const D EPS = 1e-9;
#define X real()
#define Y imag()
 
//  flow
 
 
struct edge{int to,cap,rev;};
vector<edge>G[MAX_V];
int level[MAX_V];
int iter[MAX_V];
void add_edge(int from,int to,int cap){
  G[from].push_back((edge){to,cap,G[to].size()});
  G[to].push_back((edge){from,0,G[from].size()-1});
}
void bfs(int s){
  memset(level,-1,sizeof(level));
  queue<int>q;
  level[s]=0;
  q.push(s);
  while(!q.empty()){
    int v=q.front();q.pop();
    for(int i=0;i<G[v].size();i++){
      edge &e=G[v][i];
      if(e.cap>0&&level[e.to]<0){
    level[e.to]=level[v]+1;
    q.push(e.to);
      }
    }
  }
}
int dfs(int v,int t,int f){
  if(v==t)return f;
  for(int &i=iter[v];i<G[v].size();i++){
    edge &e=G[v][i];
    if(e.cap>0&&level[v]<level[e.to]){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
    e.cap-=d;
    G[e.to][e.rev].cap+=d;
    return d;
      }
    }
  }
  return 0;
}
int max_flow(int s,int t){
  int flow=0;
  while(1){
    bfs(s);
    if(level[t]<0)return flow;
    memset(iter,0,sizeof(iter));
    int f;
    while((f=dfs(s,t,INF))>0){
      flow+=f;
    }
  }
}
 
void init(){
  r(i,MAX_V)G[i].clear();
  r(i,MAX_V)level[i]=0;
  r(i,MAX_V)iter[i]=0;
}
 
int n,m;
double xx,yy,vv[101];
double di[101][101];
vector<P>v,vp;
 
int main(){
  while(cin>>n>>m,n){
    vp.clear();
    v.clear();
    r(i,n){
      cin>>xx>>yy>>vv[i];
      v.push_back(P(xx,yy));
    }
    r(i,m){
      cin>>xx>>yy;
      P pt=P(xx,yy);
      vp.push_back(pt);
    }
    r(i,n)r(j,m)di[i][j]=abs(vp[j]-v[i])/vv[i];
    D l=0,r=1e9;
    r(i,145){
       
      init();
      D mid=(l+r)/2;
       
      r(j,n)r(k,m)if(di[j][k]<=mid){
        add_edge(j+1,k+201,1);
      }
      r(j,n)add_edge(0,j+1,1);
      r(j,m)add_edge(j+201,500,1);
 
      int ans=max_flow(0,500);
 
      if(ans==m)r=mid;
      else l=mid;
    }
    printf("%.8f\n",l);
  }
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>

using namespace std;

int main() {
  string s,t;
  cin >> s;

  for(int i = 0; i < s.size(); i++) {
    if(i % 2 == 0) 
        t += s[i];
    else continue;
  }
  cout << t << endl;
}

Measured memory_bytes: 3644
import sys, bisect, math, itertools, heapq, collections
from operator import itemgetter
# a.sort(key=itemgetter(i)) # i番目要素でsort
from functools import lru_cache
# @lru_cache(maxsize=None)
sys.setrecursionlimit(10**8)
input = sys.stdin.readline
INF = float('inf')
mod = 10**9 + 7
eps = 10**-7


def inp():
    '''
    一つの整数
    '''
    return int(input())


def inpl():
    '''
    一行に複数の整数
    '''
    return list(map(int, input().split()))


def str_inp():
    '''
    文字列をリストとして読み込む
    '''
    return list(input()[:-1])


d, t, s = inpl()
if d <= t * s:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 68440
#pragma warning(disable:4996)

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <float.h>

#pragma region 定義
#define i_cin(X) scanf("%d", &X)
#define i_cin2(X,Y) scanf("%d %d",&X,&Y)
#define i_cin4(X,Y,Z,W) scanf("%d %d %d %d",&X,&Y,&Z,&W)
#define i_cin3(X,Y,Z) scanf("%d %d %d",&X,&Y,&Z)
#define l_cin(X) scanf("%ld",&X)
#define f_cin(X) scanf("%f",&X)
#define l_cin2(X,Y) scanf("%ld %ld",&X,&Y)
#define s_cin(X) scanf("%s",&X)
#define ll_cin(X) scanf("%lld", &X)
#define ull_cin(X) scanf("%llu", &X)

#define  i_cout(X) printf("%d\n",X)
#define  f_cout(X) printf("%g\n",X)
#define  i_cout2(X,Y) printf("%d %d\n",X,Y)
#define  l_cout(X) printf("%ld\n",X)
#define  s_cout(X) printf("%s\n",X)

#define  ll_cout(X) printf("%lld\n",X)
#define  ull_cout(X) printf("%llu\n",X)



typedef long long  ll;
typedef unsigned long long  ull;

#define rept(x, s, n) for (int x = s; x < n; x++)

#define S_RTN(S)  s_cout(S);return 0


#define _itoa(A,N) sprintf(A, "%d", N);

int i_cins(int n, int* A);
int l_cins2(int n, long* A, long* B);
int s_dsort(const void* a, const void* b);
int s_asort(const void* a, const void* b);

int  _gcd(int a, int b);
int  _swp(int* a, int* b);
int _cknum(char* a, int n);
int _atoi(char* s, int len);


int s_asorts(const void* a, const void* b);

//昇順
int s_asorts(const void* a, const void* b) {
	return(strcmp((char*)a, (char*)b));
}
int s_dsort(const void* a, const void* b) {
	return(*(int*)b - *(int*)a);
}
int s_asort(const void* a, const void* b) {
	return(*(int*)a - *(int*)b);
}
int l_cins2(int n, long* a, long* b) {
	int i;
	rept(i, 0, n) {
		l_cin2(*(a + i), *(b + i));
	}
	return 0;
}
int i_cins(int n, int* a) {
	int i;
	for (i = 0; i < n; i++) {
		i_cin(*(a + i));
	}

	return 0;
}
int _gcd(int a, int b) {
	int r, tmp;
	if (a < b) { tmp = a; a = b; b = tmp; }
	r = a % b;
	while (r) {
		if (!r) break;
		a = b; b = r;
		r = a % b;
	}
	return(b);
}

long _max(long a, long b) {
	return a > b ? a : b;
}
long _min(long a, long b) {
	return a < b ? a : b;
}
int _swp(int* a, int* b)
{
	int tmp;
	tmp = *b; *b = *a; *a = tmp;
	return 0;
}

int _cknum(char* a, int n) {
	int i;
	char t = '0';

	for (i = 0; i < n; i++) {
		if (a[i] < '0' || a[i]>'9') return 1;
	}
	return 0;
}


int _atoi(char* s, int len) {
	char tmp[20];
	memcpy(tmp, s, len);
	tmp[len] = 0x00;
	return (atoi(tmp));
}
#pragma endregion

int main(void) {
	
	char a[5];

	s_cin(a);
	if (a[1] == 'B') { S_RTN("ARC"); }
	S_RTN("ABC");


	
}
	 

//
//int main(void)
//{
//	ull    a, b, n;
//	ull    y;
//
//	ull_cin(a);	ull_cin(b); ull_cin(n);
//
//	if (n == b||n == a) n--;
//	y = (a * n) / b - a * (n / b);
//
//	ull_cout(y);
//	return 0;
//}

//#define _N 1000000000

//int main(void)
//{
//
//	int  n,i;
//	ull   tmp=1;
//
//	i_cin(n);
//
//	for (i = 1; i <= n; i++) {
//		if (!(tmp % ((ull)_N + 7)))
//			tmp = 1;
//		tmp *= (ull)i;
//	}
//	tmp %= ((ull)_N + 7);
//		
//	ull_cout(tmp);
//	return 0;
//}



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

using namespace std;

static const int INF = 1e9 + 7;

template<typename T>
using Vec = vector<T>;

template<typename T, typename T2>
using P = pair<T, T2>;

template<typename... Args>
using Tup = tuple<Args...>;

template<typename T>
using qp = priority_queue<T, Vec<T>, greater<T> >;

template<typename T>
using pq = priority_queue<T>;

using llong = long long;
using ullong = unsigned long long;
using uint = unsigned int;

template<typename T>
T gcd(T x, T y)
{
	return y ? gcd(y, x % y) : x;
}

void hawawa()
{
	int n, a, b;
	cin >> n >> a >> b;
	if (a > b) swap(a, b);
	cout << a << " " << max(0, b - n + a) << "\n";
}

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


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

int main() {
    int X, Y;
    cin >> X >> Y;
    bool flag = false;

    for(int i = 0; i <= X; i++){
        if(i * 4 + (X - i) * 2 == Y){
            flag = true;
            break;
        }
    }
    if(flag)cout << "Yes" << "\n";
    else cout << "No" << "\n";

    return 0;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> ans(10050);
  for (int i = 1; i<=100 ; i++){
    for (int j = 1; j<=100 ; j++){
      for (int k = 1; k<=100 ; k++){
        int A = i*i + j*j + k*k + i*j + j*k + k*i;
        if ( A <= 10000 ){
          ans.at(A) ++;
        }
      }
    }
  }
  for (int i = 1; i<=N ; i++){
    cout << ans.at(i) << endl;
  }
}

Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;

typedef double Num;
typedef complex<Num> Pt2;

struct Circle2 {
  Pt2 p; Num r;
  Circle2(Pt2 p, Num r) : p(p), r(r) {}
};

const double eps = 1e-10;
const double pi  = 3.14159265358979323846;

Pt2  ortho(Pt2 v)        { return v*Pt2(0,1); }
Pt2  unit (Pt2 v)        { return v/abs(v);   }

vector<Circle2> make_circle(Pt2 a, Pt2 b, Num r) {
	Num d = abs(b-a)/2.0;
	d = sqrt(r*r-d*d); // assert(r*r-d*d >= 0)
	Pt2 p = (b+a)/2.0;
	Pt2 v = unit(ortho(b-a)) * d;

	vector<Circle2> ret;
	ret.push_back(Circle2(p+v,r));
	ret.push_back(Circle2(p-v,r));
	return ret;
}

bool into_circle(Circle2 p, Pt2 a) {
	return abs(a-p.p)*abs(a-p.p) < p.r*p.r+eps;
}

int main()
{
	int N;
	while(cin>>N, N)
	{
		Pt2 ps[300];
		for(int i=0; i<N; i++) {
			Num x,y;
			cin>>x>>y;
			ps[i]=Pt2(x,y);
		}

		int ans=1;
		for(int i=  0; i<N; i++)
		for(int j=i+1; j<N; j++) {
			if(abs(ps[i]-ps[j]) > 2.0) continue;

			vector<Circle2> cs = make_circle(ps[i], ps[j], 1.0);
			for(int k=0; k<2; k++){
				int cnt=0;
				for(int l=0; l<N; l++) {
					if(into_circle(cs[k], ps[l])) cnt++;
				}
				ans=max(ans,cnt);
			}
		}
		cout << ans << endl;
	}
}

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

int main() {
	ios :: sync_with_stdio(false);
	int n;
	while(cin >> n) {
		int ans = 0;
		for(int a = 0; a <= 9; a ++)
			for(int b = 0; b <= 9; b ++)
				for(int c = 0; c <= 9; c ++)
					for(int d = 0; d <= 9; d ++)
						if(a + b + c + d == n)
							ans ++;
		cout << ans << '\n';
	}
	return 0;
}

Measured memory_bytes: 3116
#include <iostream>
#define ll long long
using namespace std;

ll a[410], sum[410];
ll dp[410][410];

int main() {
	int N;
	cin >> N;
	for(int i=0; i<N; ++i){
		cin >> a[i];
		sum[i+1]=sum[i]+a[i];
	}
	for(int i=1; i<N; ++i){
		for(int j=0; j+i<N; ++j){
			ll mn=1e18;
			for(int k=j; k<j+i; ++k) mn=min(mn, dp[j][k]+dp[k+1][j+i]);
			dp[j][j+i]=mn+sum[j+i+1]-sum[j];
		}
	}
	cout << dp[0][N-1] << endl;
	return 0;
}

Measured memory_bytes: 1536
#include<iostream>
using namespace std;
int main(){
 int n;
 cin>>n;
 int ans=0;
 for(int i=1;i<=n;i+=2){
  int p=0;
  for(int j=1;j<=i;j+=2){
   if(i%j==0)p++;
  }
  if(p==8)ans++;
 }
 cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long;
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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e16;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
const ll MAX = 200010;
constexpr ll nx[8] = {1,0,-1,0,-1,-1,1,1};
constexpr ll ny[8] = {0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,k,in;
    cin >> n >> k;
    vector<ll> a(n+1);
    rep(i,n){
        cin >> in;
        a[i+1] = in;
    }
    rep(i,n) a[i+1] += a[i];
    rep(i,n+1){
        a[i] -= i;
    }
    vector<ll> mod;
    rep(i,n+1) mod.push_back(a[i]%k);
    SORT(mod);
    mod.erase(unique(all(mod)),mod.end());
    vector<vector<ll>> cnt(mod.size());
    unordered_map<ll,ll> index;
    rep(i,mod.size()) index.insert(P(mod[i],i));
    rep(i,n+1) cnt[index[a[i]%k]].push_back(i);
    ll ans = 0;
    rep(i,mod.size()){
        rep(j,cnt[i].size()-1){
            ans += lower_bound(all(cnt[i]),cnt[i][j]+k)-(cnt[i].begin()+j)-1;
        }
    }
    PRINT(ans);
}


Measured memory_bytes: 22640