akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <numeric>
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;

    for (int i = 1; i < n; i++) {
        if (k <= 0) break;
        if (s[i] != s[i-1]) {
            int end = n-1;
            for (int j = i+1; j < n; j++) {
                if (s[j] == s[i-1]) {
                    end = j-1; 
                    break;
                }
            }
            // 反転
            for (int j = i; j <= end; j++) {
                if (s[j] == 'R') s[j] = 'L';
                else if (s[j] == 'L') s[j] = 'R';
            }
            k--;
        }
    }

    int cnt = 0;
    for (int i = 0; i < n-1; i++) {
        if (s[i] == s[i+1]) cnt++;
    }
    cout << cnt << endl;
}


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

int main(){
    int N, A, B;
    array<int, 3> p({0, 0, 0});
    scanf("%d%d%d", &N, &A, &B);
    for(int i = 0, c; i < N; ++i){
        scanf("%d", &c);
        ++p[(c > A) + (c > B)];
    }
    printf("%d", *min_element(p.begin(), p.end()));
    return 0;
}

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

typedef long long ll;

const ll MOD = 1e9 + 7;

int main() {
    string S;
    cin >> S;
    int N = S.size() + 1;
    vector<ll> a(N, 0);
    ll ans = 0, i = 0;
    while (i < N - 1) {
        int up = 0, down = 0;
        while (S[i] == '<') {
            up++;
            i++;
        }
        while (S[i] == '>') {
            down++;
            i++;
        }
        ll a = max(up, down), b = min(up, down);
        ans += a * (a + 1) / 2 + b * (b - 1) / 2;
    }
    cout << ans << endl;
}

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

typedef long long ll;
#define endl "\n"

int32_t main()
{
	ios_base::sync_with_stdio(false);
  	cin.tie(nullptr);
  	cout.tie(nullptr);
  
	ll n;
	cin>>n ;
	ll ans=0;
	for(ll i=1;i<=n;i++)
		ans+=i*(n-i+1);

	for(ll i=1;i<n;i++)
	{
		ll x,y;
		cin>>x>>y;
		if(x>y) swap(x,y);
		ans-=x*(n-y+1);
	}

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


Measured memory_bytes: 3612
import math
a,b,h,m=map(int,input().split())

l = (6*m + 6*60*h) % 360
s = (m/2 + 60*h/2) % 360

c = math.radians(abs(l-s))
ans = a**2 + b**2 - 2*a*b*math.cos(c)
print(ans**0.5)

Measured memory_bytes: 62612
import java.util.Iterator;
import java.util.PrimitiveIterator;
import java.util.Scanner;
import java.util.stream.IntStream;
import java.util.stream.Stream;

class Main{
	private void solve(){
		gInt();
		System.out.println(Math.abs(gInt()-gInt())%2==0?"Alice":"Borys");
	}

	public static void main(String[] $){
		new Main().solve();
		System.out.flush();
	}

	static Scanner s=new Scanner(System.in);


	static int gInt(){
		return s.nextInt();
	}

	static long gLong(){
		return s.nextLong();
	}

	static long gDouble(){
		return s.nextLong();
	}


	static Range rep(int i){
		return new Range(i);
	}
	static Range rep(int f,int t,int d){
		return new Range(f,t,d);
	}
	static Range rep(int f,int t){
		return rep(f,t,1);
	}
	static Range rrep(int f,int t){
		return rep(f,t,-1);
	}

	static class Range implements Iterable<Integer>,PrimitiveIterator.OfInt{

		int to,cur,d;

		Range(int from,int to,int d){
			this.cur=from-d;
			this.to=to;
			this.d=d;
		}

		Range(int n){
			this(0,n-1,1);
		}

		@Override
		public Iterator<Integer> iterator(){
			return this;
		}

		@Override
		public boolean hasNext(){
			return cur+d==to||(cur!=to&&(cur<to==cur+d<to));
		}

		@Override
		public int nextInt(){
			return cur+=d;
		}
	}


	static IntStream REPS(int v){
		return IntStream.range(0,v);
	}

	static IntStream REPS(int l,int r){
		return IntStream.rangeClosed(l,r);
	}


	static IntStream ints(int n){
		return REPS(n).map(i->gInt());
	}

	static Stream<String> strs(int n){
		return REPS(n).mapToObj(i->s.next());
	}

}

Measured memory_bytes: 23636
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<stack>
#include<cmath>
using namespace std;
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define All(v) (v).begin(),(v).end()
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
int main(){
    string s;
    cin >> s;
    set<int> se;
    rep(i,s.length()){
        if(se.count(s[i])){
            cout << "no" << endl;
            return 0;
        }
        se.emplace(s[i]);
    }
    cout << "yes" << endl;
}

Measured memory_bytes: 256
#ifdef BUILT_LOCAL

#include "niklib.h"

#endif

#include <iostream>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <string>
#include <cstdio>
#include <map>
#include <set>
#include <list>

using namespace std;

typedef long long ll;
constexpr ll mod = 1000000007;

ll n, m, s[2000], t[2000];

ll rec1(ll, ll);

ll rec2(ll, ll);

ll dp[2][2000][2000][2];

ll rec1(ll a, ll b) {
    if (a < 0 || b < 0) return 0;
    if (dp[0][a][b][0] == 0) {
        dp[0][a][b][0] = 1;
        dp[0][a][b][1] = (a < 0 || b < 0 || s[a] != t[b]) ? 0 : (rec2(a - 1, b - 1) + 1) % mod;
    }
    return dp[0][a][b][1];
}

ll rec2(ll a, ll b) {
    if (a < 0 || b < 0) return 0;
    if (dp[1][a][b][0] == 0) {
        dp[1][a][b][0] = 1;
        dp[1][a][b][1] = (a < 0 || b < 0) ? 0 :
                         (rec2(a - 1, b) + rec2(a, b - 1) - rec2(a - 1, b - 1) + rec1(a, b) + mod) %
                         mod;
    }
    return dp[1][a][b][1];
}

int main() {
    cin >> n >> m;
    for (int i = 0; i < 2000; i++)
        for (int j = 0; j < 2000; j++)
            dp[0][i][j][0] = dp[0][i][j][1] = dp[1][i][j][0] = dp[1][i][j][1] = 0;
    for (int i = 0; i < n; i++) cin >> s[i];
    for (int i = 0; i < m; i++) cin >> t[i];
    cout << (rec2(n - 1, m - 1) + 1) % mod << endl;
}

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

int32_t main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n; cin >> n;
	long long mx1 = -2e9, mx2 = -2e9, mn1 = 2e9, mn2 = 2e9;
	for (int i = 0; i < n; i++) {
		long long x, y; cin >> x >> y;
		mx1 = max(mx1, x + y);
		mn1 = min(mn1, x + y);		
		mx2 = max(mx2, x - y);
		mn2 = min(mn2, x - y);
	}
	cout << max(mx1 - mn1, mx2 - mn2) << '\n';
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
#include <fstream>
#include <map>
#include <cassert>
#include <sstream>
#include <numeric>
#include <regex>
#include <cctype>
#include <utility>
#include <stdio.h>
#include <set>
#include <queue>
#include <deque>

typedef long long ll;

#define vi vector<int>
#define vs vector<string>
#define vc vector<char>
#define MOD 1000000007
#define pb push_back
#define llnums vector<ll>
#define FOR(i,n) for(int i{0}; i < n; ++i)

using namespace std;

int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n,k,x,y,ans=0;
  cin >> n >> k >> x >> y;
  if (n > k) {
      for (int i=0; i < k; i++) {
          ans += x;
      }
      for (int i=k; i < n; i++) {
          ans += y;
      }
  }
  else {
      for (int i=0; i < n; i++) {
          ans += x;
      }
  }
  cout << ans << '\n';
  return 0;
}









Measured memory_bytes: 3652
def cmb(n, r, mod):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range(2, 10 ** 6 + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod // i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)

def main():
    N, K = map(int, input().split())
    for i in range(1, K+1):
        print((cmb(K-1, i-1, mod) * cmb(N-K+1, i, mod))%mod)
main()



Measured memory_bytes: 122272
route_time = [int(i) for i in input().split()]
max_route_time = 0
sum_route_time = 0

for i in route_time:
    if max_route_time < i:
        max_route_time = i
    sum_route_time += i

sum_route_time -= max_route_time

print(sum_route_time)


Measured memory_bytes: 2940
#import<bits/stdc++.h>
#define elif else if
using namespace std;


int a,b,c;
string s,t,r;

int main(void){
    cin>>a>>b;
    if ((a+b)%3==0 or a%3==0 or b%3==0)puts("Possible");
    else puts("Impossible");
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<climits>
#include<set>
#include<map>
#define ll long long
using namespace std;

int main() {
	ll x, t;
	cin >> x >> t;
	cout << ((x - t>0)?(x-t):0) << endl;
}


Measured memory_bytes: 256
import java.io.PrintWriter

fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = nextList().map(String::toInt)
fun nextLongList() = nextList().map(String::toLong)
fun nextDoubleList() = nextList().map(String::toDouble)

val pw = PrintWriter(System.out)
fun print(s: Any = "") = pw.print(s)
fun println(s: Any = "") = pw.println(s)

fun <T> Iterable<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)
fun <T> Array<T>.join(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "") = joinToString(separator, prefix, postfix)

fun main(args: Array<String>) {
    main()
    pw.flush()
}

fun main() {
    val (N, M) = nextIntList()
    val S = Array(N) {
        val (a, b) = nextLongList()
        P(a, b)
    }
    val C = Array(M) { i ->
        val (c, d) = nextLongList()
        Pair(i + 1, P(c, d))
    }
    for (s in S) {
        println(C.map { e -> Pair(e.first, s.manhattanTo(e.second)) }.minBy { it.second }!!.first)
    }
}

data class P(val x: Long, val y: Long) {
    fun manhattanTo(o: P) = Math.abs(x - o.x) + Math.abs(y - o.y)
}

Measured memory_bytes: 37864
#include<stdio.h>

int main(){
  int topn;
  int top,dou;
  int caldou,caltop[100];
  int i,j,a,b;

  scanf("%d",&topn);

  scanf("%d %d",&dou,&top);
  scanf("%d",&caldou);
  for(i=0;i<topn;i++)
    scanf("%d",&caltop[i]);

  for(i=0;i<topn;i++)
    for(j=0;j<topn-1;j++){
      if(caltop[j]<caltop[j+1]){
	a=caltop[j];
	caltop[j]=caltop[j+1];
	caltop[j+1]=a;
      }
    }

  int pay,calbest,paybest;

  pay=dou;
  calbest=caldou/pay;
  paybest=pay;

  for(i=0;i<topn;i++){
    pay+=top;
    caldou+=caltop[i];

    if(calbest<=caldou/pay){
      calbest=caldou/pay;
      paybest=pay;
    }
  }

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

  return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<complex>
#include<unordered_map>

#define INF 1000000000ll
#define MOD 1000000007ll
#define EPS 1e-8

#define REP(i, m) for(long long i = 0; i < m; ++i)
#define FOR(i, n, m) for(long long i = n; i < m; ++i)
#define ALL(v) v.begin(), v.end()
#define pb push_back

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main() {
	ios::sync_with_stdio(false);
	vector<int> n(3);
	REP(i,3) cin>>n[i];
	sort(ALL(n));
	cout<<n[0]+n[1]<<endl;
}


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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}

ll inp[300010];

ll sm[300010][62];

int main(){

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

    int n;
    cin>>n;

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

    for(int i = n; i >= 1; i--) {
        for(int j = 0; j <= 61; j++) {
            sm[i][j] = sm[i+1][j];
            if(inp[i] & (1ll<<j)) {
                sm[i][j]++;
            }
        }
    }

    ll ans = 0;

    for(int i = 1; i < n; i++) {
        for(int j = 0; j <= 61; j++) {
            if(inp[i] & (1ll<<j)) {
                ans = ans + ((n-i-sm[i+1][j])%mod)*((1ll<<j)%mod);
            } else {
                ans = ans + ((sm[i+1][j])%mod)*((1ll<<j)%mod);
            }
            ans = ans % mod;
        }
    }

    cout<<ans<<endl;




}


Measured memory_bytes: 147968
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
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; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;
 
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(void)
{
    ll h;
    cin >> h;

    ll ee = floor(log2(h)) + 1;
    cout << (ll)pow(2, ee) - 1<< endl;

    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ul;
#define all(x) (x).begin(), (x).end()
#define pi 3.1415926536

struct TreeNode {
    int val;
    TreeNode* left;
    TreeNode* right;

    TreeNode(int x): val(x), left(NULL), right(NULL){}
};

struct ListNode {
    int val;
    ListNode* next;

    ListNode(int x): val(x), next(NULL){}
};

int nxt(){
    int x;
    cin>>x;
    return x;
}

ll nxtLong(){
    ll x;
    cin>>x;
    return x;
}

string nxtStr(){
    string x;
    cin>>x;
    return x;
}

char nxtChar(){
    char x;
    cin>>x;
    return x;
}

double nxtDouble(){
    double x;
    cin>>x;
    return x;
}

ld nxtLDouble(){
    ld x;
    cin>>x;
    return x;
}

TreeNode* makeTree(int n){
    queue<TreeNode*> tree_nodes;
    TreeNode* root;
    if(n){
        root = new TreeNode(nxt());
        tree_nodes.push(root);
    }else{
        return NULL;
    }
    while(!tree_nodes.empty()){
        TreeNode* node = tree_nodes.front();
        tree_nodes.pop();
        bool left;
        cin>>left;
        if(left){
            node->left = new TreeNode(nxt());
            tree_nodes.push(node->left);
        }
        bool right;
        cin>>right;
        if(right){
            node->right = new TreeNode(nxt());
            tree_nodes.push(node->right);
        }
    }
    return root;
}

ListNode* makeLinkedList(int n){
    ListNode* list = new ListNode(0);
    ListNode* dummy = list;

    for(int i=0;i<n;++i){
        list->next = new ListNode(nxt());
        list = list->next;
    }

    return dummy->next;
}

void solve(){
    int n = nxt();
    ll d = nxtLong();
    d *= d;

    vector<ll> dist(n);

    for(int i=0;i<n;++i){
        int x = nxt(), y = nxt();
        dist[i] = (ll)x*(ll)x + (ll)y*(ll)y;
    }

    sort(all(dist));

    auto it = upper_bound(all(dist), d);
    if(it == dist.begin()){
        cout<<0<<endl;
        return;
    }

    --it;
    int ind = it-dist.begin();
    cout<<ind+1<<endl;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout<<fixed<<setprecision(9);
    //ll t;
    //cin>>t;
    //while(t--){
    //    solve();
    //}
    solve();
    return 0;
}


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

using namespace std;

typedef long long ll;

const int N = 200010;
const int MOD = 998244353;

struct point {
  int x, y;
  point() {}
};

int ft[N];

int mul(int a, int b) {
  return (ll) a * b % MOD;
}

int add(int a, int b) {
  return (a + b) % MOD;
}

int sub(int a, int b) {
  return ((a - b) % MOD + MOD) % MOD;
}

void inc(int i) {
  while (i < N) {
    ++ft[i];
    i += i & -i;
  }
}

int get(int i) {
  int sum = 0;
  while (i) {
    sum += ft[i];
    i -= i & -i;
  }
  return sum;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<point> P(n);
  map<int, int> fake;
  for (point &p : P) {
    cin >> p.x >> p.y;
    fake[p.y];
  }
  int id = 0;
  for (auto &f : fake) {
    f.second = ++id;
  }
  vector<int> pw(n + 1, 1);
  for (int i = 1; i <= n; ++i) {
    pw[i] = mul(pw[i - 1], 2);
  }
  for (int i = 0; i <= n; ++i) {
    pw[i] = sub(pw[i], 1);
  }
  sort(P.begin(), P.end(), [&](const point &a, const point &b) {
    return a.x < b.x;
  });
  int asw = mul(n, pw[n]);
  for (int i = 0; i < n; ++i) {
    asw = sub(asw, pw[i]);
    asw = sub(asw, pw[n - i - 1]);
    int j = fake[P[i].y];
    int u = get(j);
    asw = add(asw, pw[u]);
    asw = add(asw, pw[i - u]);
    inc(j);
  }
  fill(ft, ft + N, 0);
  for (int i = n - 1; i >= 0; --i) {
    int j = fake[P[i].y];
    int u = get(j);
    asw = add(asw, pw[u]);
    asw = add(asw, pw[n - i - u - 1]);
    inc(j);
  }
  sort(P.begin(), P.end(), [&](const point &a, const point &b) {
    return a.y < b.y;
  });
  for (int i = 0; i < n; ++i) {
    asw = sub(asw, pw[i]);
    asw = sub(asw, pw[n - i - 1]);
  }
  cout << asw << endl;
  return 0;
}


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

using namespace std;

const int C = 40;
const int N = 510;
int cnt[3][C], D[C][C];
int n, c, col;

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

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

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			cin >> col;
			cnt[(i+j)%3][col]++;
		}
	}

	int ans = 1e9;
	for (int i = 1; i <= c; i++) {
		for (int j = 1; j <= c; j++) {
			if (j == i) continue;
			for (int k = 1; k <= c; k++) {
				if (i == k || j == k) continue;
				int ct = 0;
				for (int l = 0; l < 3; l++) {
					for (int m = 1; m <= c; m++) {
						if (l == 0) {
							ct += cnt[l][m] * D[m][i];
						}
						if (l == 1) {
							ct += cnt[l][m] * D[m][j];
						}
						if (l == 2) {
							ct += cnt[l][m] * D[m][k];
						}
					}
				}
				ans = min(ans, ct);
			}
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int Ycounter = 0;
  for(int i = 0; i < N ; i++){
    string S;
    cin >> S;
    if (S == "Y"){
     Ycounter++; 
    }
  }
  if (Ycounter == 0){
   cout << "Three" << endl; 
  }
  else {
   cout << "Four" << endl; 
  }
}

Measured memory_bytes: 256
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[list(map(int,input().split())) for i in range(n)]

ans=0

for i in range(n):
  res=c
  for j in range(m):
    res+=a[i][j]*b[j]
  if res>0:
    ans+=1
print(ans)

Measured memory_bytes: 9172
/*+lmake
 * STD = c++14
 * DEFINE += WAAUTOMATON
 */
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#ifdef WAAUTOMATON
#define debug(args...)                                                                             \
    {                                                                                              \
        dbg, args;                                                                                 \
        cerr << endl;                                                                              \
    }
#else
#define debug(args...) // Just strip off all debug tokens
#endif

struct debugger
{
    template <typename T>
    debugger &operator,(const T &v)
    {
        cerr << v << " ";
        return *this;
    }
} dbg;

bool a[100];
void solve(string S)
{
    for (auto i : S) {
        a[i] = true;
    }
	if (a['N']==a['S'] && a['W']==a['E']) puts("Yes");
	else puts("No");
}

int main()
{
#ifdef WAAUTOMATON
    // freopen("in.txt","r",stdin);
#endif
    string S;
    cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
import sys

a0, a1, a2 = map(int, input().split())
a3, a4, a5 = map(int, input().split())
a6, a7, a8 = map(int, input().split())
N=int(input())
arr = [int(input()) for _ in range(N)]
bin =[a0,a1,a2,a3,a4,a5,a6,a7,a8]

for i in range(len(arr)):
    for j in range(len(bin)):
        if bin[j] == arr[i]:
            bin[j]=0
    
if bin[0] == 0 and bin[3] == 0 and bin[6] == 0:
    print("Yes")
    exit()

if bin[1] == 0 and bin[4] == 0 and bin[7] == 0:
    print("Yes")
    exit()

if bin[2] == 0 and bin[5] == 0 and bin[8] == 0:
    print("Yes")
    exit()

if bin[0] == 0 and bin[1] == 0 and bin[2] == 0:
    print("Yes")
    exit()

if bin[3] == 0 and bin[4] == 0 and bin[5] == 0:
    print("Yes")
    exit()

if bin[6] == 0 and bin[7] == 0 and bin[8] == 0:
    print("Yes")
    exit()

if bin[0] == 0 and bin[4] == 0 and bin[8] == 0:
    print("Yes")
    exit()

if bin[2] == 0 and bin[4] == 0 and bin[6] == 0:
    print("Yes")
    exit()

print('No')



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

int main() {
	long long n , d;
	cin >> n >> d;
	const long long min = d * d;
	int total = 0;
	for (int i = 0; i < n; ++i) {
		long long x, y;
		cin >> x >> y;
		if ((x * x + y * y) <= min) {
			++total;
		}
	}
	cout << total << endl;
}

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

//#pragma GCC optimize("O3", "no-stack-protector")
//#pragma GCC target("sse4", "avx", "popcnt", "lzcnt", "sse3", "sse4.1", "sse4.2", "sse2", "tune=native")
//#pragma GCC optimize ("unroll-loops")

using namespace std;

using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    int ans = 0, a;
    multiset<int, greater<int>> kek;
    for (int i = 0; i < n; ++i) {
        cin >> a;
        kek.insert(a);
    }
    while (!kek.empty()) {
        auto p = kek.begin();
        int v = *p;
        kek.erase(p);
        for (int i = 30; i >= 1; --i) {
            if (kek.count((1 << i) - v)) {
                ++ans;
                kek.erase(kek.find((1 << i) - v));
                break;
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
map<ll,ll> m;
void solve(ll n){
    for(auto kv:m){
        while(n%kv.first==0){n/=kv.first;m[kv.first]++;}
    }
}
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    m[2]=0;
    m[3]=0;
    for(int i=5;i<=1000;i+=2){
        bool b=true;
        for(int j=3;j<min(32,i);j+=2)if(i%j==0)b=false;
        if(b)m[i]=0;
    }
    ll n;
    cin>>n;
    for(ll i=1;i<=n;i++)solve(i);
    ll ans=1;
    for(auto kv:m){
        ans*=kv.second+1;
        ans%=(ll)1e9+7;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
S = list(input())
value = [0] * (len(S) + 1)
  
for i in range(len(S)):
  if S[i] == '<':
    if value[i] == 0:
      value[i+1] = 1
    else:
      value[i+1] = value[i] + 1

for i in reversed(range(len(S))):
  if S[i] == '>':
    if value[i+1] == 0 and value[i] == 0:
      value[i] = 1
    elif value[i] <= value[i+1]:
      value[i] = value[i+1] + 1
print(sum(value))


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;
const int MOD = 1e9 + 7;

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

    n[3] = '8';
    cout << n << endl;
    return (0);
}


Measured memory_bytes: 3572
n,k=map(int,input().split())
p=[(i+1)/2 for i in map(float,input().split())]
MAX=sum(p[0:k])
s=[MAX]*n
for i in range(0,n-k):
    s[i+1]=p[i+k]+s[i]-p[i]
    MAX=max(MAX,s[i+1])
print(MAX)

Measured memory_bytes: 23588
#include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <deque>
#include <stack>
using namespace std;



long long int gcd(long long int x,long long int y){
    if(x<y){
        swap(x,y);
    }
    long long int z=x%y;
    if(z==0){
        return y;
    }
    else{
        return gcd(y,z);
    }
};

long long int lcm(long long int x,long long int y){
    long long int ans=x*y/gcd(x,y);
    return ans;
}
    
int main(){
    long long int A,B;
    cin >> A >> B;
    //cout << A << ',' << B << '!';
    //cout << gcd(A,B);
    cout << lcm(A,B);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <iomanip>
#include <utility>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<29)
#define ld long double
#define ll long long

using namespace std;

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;


int main(){
  int N;
  int H,W;
  cin >> N >> H >> W;
  cout << (N-H+1)*(N-W+1) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>
#include<map>
 
using namespace std;
#define mod 1000000007
#define ll long long 
 
 
 
 
int A[100009];  
int B[100009];
int C[100009];
int dp[100009][3]={-1};
int n,k;
int solve(int  n){
    for(int i=0;i<n;i++){
   for(int j=0;j<3;j++){
   if(i==0){
if(j==0){
dp[i][j]=A[i];
}
else if(j==1){
dp[i][j]=B[i];}
else{
dp[i][j]=C[i];}
}

else{
for(int k=0;k<3;k++){
if(j==k){continue;}
if(j==0){dp[i][j]=max(dp[i][j],dp[i-1][k]+A[i]);}
else if(j==1){dp[i][j]=max(dp[i][j],dp[i-1][k]+B[i]);}
else if(j==2){dp[i][j]=max(dp[i][j],dp[i-1][k]+C[i]);}
}
}
}
}
int m=0;
 m=max(m,dp[n-1][0]);
m=max(m,dp[n-1][1]);
m=max(m,dp[n-1][2]);
return m;
}
int main() {
 
	memset(dp, -1, sizeof(dp));
	cin>>n;
 
	for(int i = 0; i < n; i++) {
		cin>>A[i]>>B[i]>>C[i];
                
	}
 
	cout<<solve(n)<<endl;
 
	return 0;
}



Measured memory_bytes: 5928
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef queue<int> qi;
typedef queue<ll> ql;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define pq priority_queue
#define rep(i,n) for (int i=0;i<n;i++)
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define INF 2000000009
ll n;
ll gcd(ll a,ll b){
	if (a==0) return 1;
	else if (b==0) return 1;
	if (a<b) swap(a,b);
	return a%b? gcd(b,a%b):b;
}
int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    //printf("%d",gcd(12,8));
    for (ll i=1;i<=3500;i++){
    	for (ll j=i;j<=3500;j++){
    		//printf("111\n");
    		ll a,b;
    		a=4*i*j-n*j-n*i;
    		b=n*i*j;
    		if (a<0||b<0||b==0) continue;
    		//printf("2");
    		ll x=gcd(a,b);
    		a/=x;
    		b/=x;
    		if (a==1){
    			cout<<i<<" "<<j<<" "<<b;
    			return 0;
    		}
    		else{
    			//printf("%d %d %d\n",i,j,b);
    		}
    	}
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;cin>>s;
  deque<char>ans;
  int size=s.size();
  for(int i=0;i<size;i++){
    if(s.at(i)=='0')ans.push_back('0');
    else if(s.at(i)=='1')ans.push_back('1');
    else{
      if(ans.empty())continue;
      ans.pop_back();
    }
  }
  while(!ans.empty()){
    cout <<ans.front();
    ans.pop_front();
  }
  cout <<endl;
}

Measured memory_bytes: 3584
from statistics import median as m
n=int(input())
a=[0]*n
b=[0]*n
for i in range(n):
  x,y=map(int,input().split())
  a[i]=x
  b[i]=y
x=m(a)
y=m(b)
if n%2==0:
  x*=2
  y*=2
print(int(y-x+1))

Measured memory_bytes: 28900
#[warn(non_snake_case)]
use std::io;
use std::io::Write;

fn main() {
	let mut input = String::new();

	let n: u32 = match io::stdin().read_line(&mut input) {
			Ok(_) => input.trim().parse().unwrap(),
			Err(_) => panic!("read error!")
		};
	input.clear();
	let mut A: Vec<u32> = match io::stdin().read_line(&mut input) {
			Ok(_) => input.trim().split(" ").map(|s| s.parse().unwrap()).collect(),
			Err(_) => panic!("parse error!")
		};
	let A = A.as_slice();
    let mut C: [u32; 10001] = [0; 10001];
    let mut B: Vec<u32> = vec![0; n as usize];
    let mut B = B.as_mut_slice();

    for &v in A {
    	C[v as usize] += 1;
     }

    for i in 1..10001 {
    	C[i] += C[i-1];
    }

	for i in (0..n).rev() {
		B[(C[A[i as usize] as usize] - 1) as usize] = A[i as usize];
		C[A[i as usize] as usize] -= 1;
	}

	print!("{}\n", B.iter().map(|n| n.to_string()).collect::<Vec<String>>().join(" "));
}


Measured memory_bytes: 103360
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define MIN(a, b) ((a) > (b) ? (b) : (a))

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;

#define INF INT_MAX/3
#define MAX_N 1000
ll n;
void solve(){
   cin.tie(0);
  ios::sync_with_stdio(false);
  cin>>n;
  std::vector<ll> v(n);
  std::vector<P> w(n);
  rep(i,n) {
    cin>>v[i];
    w[i] = P(v[i],i);
  }
  sort(all(w));
  rep(i,n){
    if(v[i] < w[n/2].fi) cout<<w[n/2].fi<<endl;
    else cout<<w[n/2-1].fi<<endl;
  }

}
int main(){
  solve();
  return 0;
}


Measured memory_bytes: 5376
import java.util.*;

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

class Solver {

    private void replace(char[][] S, int H, int W, int ii, int jj) {
        if (S[ii][jj] == '#') {
            return;
        }

        char cnt = 0;
        for (int i = Math.max(ii - 1, 0); i <= Math.min(ii + 1, H - 1); i++) {
            for (int j = Math.max(jj - 1, 0); j <= Math.min(jj + 1, W - 1); j++) {
                if (S[i][j] == '#') {
                    cnt++;
                    continue;
                }
            }
        }
        cnt += '0';
        S[ii][jj] = cnt;
    }

    public void run() {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        char[][] S = new char[H][];

        for (int i = 0; i < H; i++) {
            S[i] = sc.next().toCharArray();
        }

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                replace(S, H, W, i, j);
            }
        }

        for (int i = 0; i < H; i++) {
            System.out.println(S[i]);
        }

        return;
    }

}

Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <algorithm>

using namespace std;
 
    
    
int main(){
  int a,b,aa,bb,prize;
  cin>>a>>b;
  prize=-1;
  for ( double i = 10; i < 1099; i++)
  {
    aa=int(i*0.08);
    bb=int(i*0.1);
    if ((aa==a)&&(bb==b))
    {
      prize=i;
      break;
    }
    
  }
  cout<<prize<<endl;
    return 0;
}

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

using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define REP(i, l, n) for(int i=(l), i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back

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

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

char alpha[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};

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


class UnionFind{
    public:
        vector<int> uni;
        UnionFind(int s) : uni(s, -1) { }
 
       //頂点aが所属するグループを調べる
        int root(int a)
        {
            if (uni[a] < 0) return a;
            return uni[a] = root(uni[a]);
        }
    
        //頂点aと頂点bを繋ぐ。もともと同じグループの時falseを返す
        bool connect(int a,int b)
        {
            a = root(a);
            b = root(b);
            if (a == b) return false;
    
            if (uni[a] > uni[b])
            {
                a ^= b;
                b ^= a;
                a ^= b;
            }
    
            uni[a] = uni[a] + uni[b];
            uni[b] = a;
            return true;
        }
    
        //頂点a,bが同じグループであるかを調べる
        bool isConnect(int a,int b)
        {
            return root(a) == root(b);
        }
    
        //頂点aを含むグループの頂点数を調べる
        int size(int a)
        {
            return -uni[root(a)];
        }
    
    };


int main(){
    int n, m; cin >> n >> m;
    UnionFind un(n+1); //宣言
    REP(i, 0, m){
        int a, b; cin >> a >> b;
        a--; b--;
        un.connect(a, b);
    }
    int ans = 0;
    REP(i, 0, n){
        chmax(ans, un.size(i));
    }
    cout << ans << endl;
}

Measured memory_bytes: 4008
using System;
using System.Linq;

namespace AtCoderBeginnerContest153
{
	class Program
	{
		static void Main(string[] args)
		{
			var numbers = ReadIntArray();
			var specials = ReadIntArray();

			if(numbers[0] <= specials.Sum())
			{
				Console.WriteLine("Yes");
			}
			else
			{
				Console.WriteLine("No");
			}
		}

		public static int ReadInt()
			=> int.Parse(Console.ReadLine());

		public static int[] ReadIntArray()
			=> Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

		public static long ReadLong()
			=> long.Parse(Console.ReadLine());

		public static long[] ReadLongArray()
			=> Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();

		public static string ReadString()
			=> Console.ReadLine();

		public static string[] ReadStringArray()
			=> Console.ReadLine().Split();
	}
}


Measured memory_bytes: 19680
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x1 = sc.nextInt();
    int x2 = sc.nextInt();
    int x3 = sc.nextInt();
    int x4 = sc.nextInt();
    int x5 = sc.nextInt();
    
    if(x1==0)System.out.println(1);
    if(x2==0)System.out.println(2);
    if(x3==0)System.out.println(3);
    if(x4==0)System.out.println(4);
    if(x5==0)System.out.println(5);
  }
}

Measured memory_bytes: 35572
#include <stdio.h>
 
int main(void) {
    int i,j,k;
    int n,x;
    int count=0;
    
    while(1){        
        scanf("%d %d", &n, &x);
        //???????????¶
        if(n==0 && x==0) break;
        
        count=0;
        for(i=1;i<=n-2;i++){
            for(j=i+1;j<=n-1;j++){
                for(k=j+1;k<=n;k++){
                                if(i+j+k==x) count++;
                                }
            }
        }
        printf("%d\n", count);
    }
    
    return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<cmath>
#include<vector>
using namespace std;
bool x[10000001];int y[4000]; vector<int>a, b;
int main() {
	for (int i = 2; i < 4000; i++) {
		for (int j = 2; j <= sqrt(i); j++) {
			if (i%j == 0) { goto E; }
		}
		b.push_back(i);
		y[i] = y[i - 1] + 1; goto G;
	E:;
		y[i] = y[i - 1];
	G:;
	}
	int loop = 0;
	for (int i = 3; i < 10000000; i += 2) {
		for (int j = 0; j < y[(int)sqrt(i)]; j++) {
			if (i%b[j] == 0) { 
				goto F; 
			}
			loop++;
		}
		x[i] = true;
	F:;
	}
	for (int i = 0; i < 9999993; i++) {
		if (x[i] == 1 && x[i + 2] == 1 && x[i + 6] == 1 && x[i + 8] == 1) {
			a.push_back(i + 8);
		}
	}
	int n, maxn = 0;
	while (true) {
		maxn = 0;
		cin >> n;
		if (n == 0) { break; }
		for (int i = 0; i < a.size(); i++) {
			if (a[i] <= n) { maxn = a[i]; }
		}
		cout << maxn << endl;
	}
}

Measured memory_bytes: 12820
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d;//thi,ans;
  cin>>a>>b>>c>>d;
  double g,h;
  g=a;
  h=b;//string s="...",ans;
  a=ceil(g/d);
  c=ceil(c/h);
  //cin>>ans;
 // if(ans.length()>=n)  { ans=ans.substr(0,n); ans+=s;}
  
 /* set<int>a={2,4,5,7,9},b={0,1,6,8};
  n=n%10;
  if(a.count(n)) s="h"+s;
  else if(b.count(n)) s="p"+s;
  else s="b"+s;
  m=m*6;
 h=(60*h+m)/2;
  thi=cos((m-h)*3.14/180);
  ans=sqrt(a*a+b*b-2*a*b*thi);*/
  //cout<<a<<" "<<c<<endl;
  if(a<c)
  cout<<"No"<<endl;
  else cout<<"Yes"<<endl;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll N=1e6+5,inf=1e18,mod=1e9+7;
#define test ll testcases;cin>>testcases; while(testcases--)
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define vld vector<ld>
#define pll pair<ll,ll> 
#define pld pair<ld,ld> 
#define vpll vector<pll>
#define vpld vector<pld>
#define all(X) X.begin(),X.end()
#define sz(x) ((ll)((x).size()))
const ld pi=3.141592653589793238;

bool check_prime(ll n)
{
	ll flag=0,i;
	for(i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			flag=1;
			break;
		}
	}
	if(n==1)
	{
		return false;
	}
	else if(flag==0 || n==2 || n==3)
	{
		return true;
	}
	else
	{
		return false;
	}
}

ll fastexpo(ll a,ll b,ll MOD) 
{
	ll result=1;
	while(b>0)
	{
		if(b%2==1)
		{
			result=(result*a)%MOD;
		}
		a=(a*a)%MOD;
		b=b/2;
	}
	return result;
}
vll G[N];
ll dp[N];

ll dfs(ll node)
{
	if(sz(G[node])==0)
	{
		return 0;
	}
	if(dp[node]!=-1)
	{
		return dp[node];
	}
	ll i,ans=0;
	for(i=0;i<sz(G[node]);i++)
	{
		ans=max(ans,1+dfs(G[node][i]));
	}
	dp[node]=ans;
	return ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,m,i,u,v,ans,p;
    cin>>n>>m;
    for(i=1;i<=m;i++)
    {
    	cin>>u>>v;
    	G[u].pb(v);
    } 
    memset(dp,-1,sizeof(dp));
    ans=0;
    for(i=1;i<=n;i++)
    {
    	if(dp[i]==-1)
    	{
    		p=dfs(i);
    	}
    }
    for(i=1;i<=n;i++)
    {
    	ans=max(ans,dp[i]);
    }
    cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 39944
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main() {

    int n;
    scanf("%d", &n);
    
    for(int i=0; i<n;i++){
        char s;
        scanf("%c",&s);
        if(s=='Y'){
            puts("Four");
            return 0;
        }
    }
    puts("Three");
            

    return 0;

}

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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

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

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

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

	cout << (x-a)%b << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>

using namespace std;

void solve()
{
	int n, h;
	while(cin >> n >> h, n || h)
	{
		set<int> Set;
		string str;
		int a, b;
		for(int i = 0; i < h; ++i)
		{
			cin >> str >> a >> b;
			--a;
			--b;
			int temp;
			if(str == "xy")
			{
				temp = a + n * b;
				for(int i = 0; i < n; ++i)
				{
					Set.insert(temp);
					temp += n * n;
				}
			}
			else if(str == "xz")
			{
				temp = a + n * n * b;
				for(int i = 0; i < n; ++i)
				{
					Set.insert(temp);
					temp += n;
				}
			}
			else if(str == "yz")
			{
				temp = a * n + n * n * b;
				for(int i = 0; i < n; ++i)
				{
					Set.insert(temp);
					temp += 1;
				}
			}
		}
		cout << n * n * n - Set.size() << endl;
	}
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdio>
#include <cstdint>
#include <climits>
#include <vector>
#include <cmath>
#include <cstring>
#include <set>

using namespace std;

int main(void)
{

    string S;
    getline(cin, S);

    int64_t Q;
    cin >> Q;

    bool rev = false;
    char cfront[200001], cback[200001];
    int64_t lfront=0, lback=0;
    for(int64_t i=0; i<Q; i++){
        int64_t T;
        cin >> T;
        if(T == 1){
            rev = !rev;
            continue;
        }
        int64_t F;
        char C;
        cin >> F;
        cin >> C;
        if(F == 1 && !rev){
            cfront[lfront] = C;
            lfront += 1;
        }else if(F == 1){
            cback[lback] = C;
            lback += 1;
        }else if(F==2 && !rev){
            cback[lback] = C;
            lback += 1;
        }else{
            cfront[lfront] = C;
            lfront += 1;
        }
    }

    if(!rev){
        for(int64_t i=lfront - 1; i>=0; i--){
            printf("%c", cfront[i]);
        }
        cout << S;
        for(int64_t i=0; i<lback; i++){
            printf("%c", cback[i]);
        }
    }else{
        for(int64_t i=lback - 1; i>=0; i--){
            printf("%c", cback[i]);
        }
        size_t slen = S.size();
        const char *sc = S.c_str();
        for(int64_t i=slen - 1; i>=0; i--){
            printf("%c", *(sc + i));
        }
        for(int64_t i=0; i<lfront; i++){
            printf("%c", cfront[i]);
        }
    }

    cout << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include <algorithm>
using namespace std;
int main()
{
    int r, g, b;
    cin >> r >> g >> b;

    int v = 0;
    v += r*100;
    v += g*10;
    v += b;

    if(v%4 == 0){
      cout << "YES";
    }else{
      cout << "NO";
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(v) v.begin(), v.end()
typedef long long ll;



int main() {
    int a, b, h ,m;
    cin >> a >> b >> h >> m;
    int m_sum = h*60 + m;
    
    double a_deg = M_PI*m_sum/360;
    double b_deg = M_PI*m/30;
    double diff_deg = abs(a_deg-b_deg);
    
    double ans = sqrt(a*a + b*b - 2*a*b*cos(diff_deg));
    
    cout << fixed << setprecision(10);
    
    dunk(ans);
    
    return 0;
}



Measured memory_bytes: 4192
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ll long long
#define pb push_back
#define pf push_front
deque<char> deq;

int main(void){
    string S;
    char C;
    ll Q;
    ll T,F;
    bool on=false;
    cin >> S >> Q;
    for(auto tmp:S){
        deq.pb(tmp);
    }
    while(Q--){
        cin >> T;
        if(T==1) on^=true;
        else{
            cin >> F >> C;
            if(on ^ (F==1)) deq.pf(C);
            else deq.pb(C);
        }
    }
    string ans;
    for(auto tmp:deq) ans.pb(tmp); 
    if(on) reverse(ans.begin(), ans.end());
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1412
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,zantei,Alice,Bob;
  cin >> N;
  
  vector<int> card(101);
  cin >> card.at(0);
  
  for(int i=1;i<N;i++) {
    cin >> zantei;
    
    for(int j=i-1;j >= 0;j--) {
      if(zantei >= card.at(j)) {
        card.at(j+1) = card.at(j);
        
        if(j==0) {
          card.at(0) = zantei;
        }
        
      }
      else {
        card.at(j+1) = zantei;
        break;
      }
    }
  }
  
  for(int i=0;i<N;i += 2) {
    Alice += card.at(i);
  }
  
  for(int i=1;i<N;i += 2) {
    Bob += card.at(i);
  }
  
  cout << Alice - Bob << endl;
}
  
  

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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define chmax(s, t) s=max(s,t);
#define chmin(s, t) s=min(s,t); 

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

/*最小公倍数*/
ll lcm(ll a, ll b){
    return a*b/__gcd(a,b);
}

/*最大公約数*/
ll gcd(ll a, ll b){
    return __gcd(a,b);
}

/*組み合わせ(Combination)*/
const ll CMAX = 1010000;
const ll CMOD = 1e9+7;
ll fac[CMAX], finv[CMAX], inv[CMAX];
// テーブルを作る前処理
void combinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < CMAX; i++) {
		fac[i] = fac[i - 1] * i % CMOD;
		inv[i] = CMOD - inv[CMOD%i] * (CMOD / i) % CMOD;
		finv[i] = finv[i - 1] * inv[i] % CMOD;
	}
}
// 二項係数計算
ll comb(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % CMOD) % CMOD;
}

/*階乗*/
ll factorial(ll n){
    const ll FMOD = 1e9+7;
    ll ret = n;
    for(ll i=n-1;i>0;i--){
        ret*=i;
        ret%=FMOD;
    }
    return (ret?ret:1);
}


int main(){

    ll n; cin >> n;
    string s; cin >> s;

    ll ans = 0;
    auto l = s.begin();
    auto r = s.end()-1;
    while(l<r){
        if(*l=='R') l++;
        if(*r=='W') r--;
        if(*l=='W' && *r=='R'){
            *l = 'R';
            *r = 'W';
            l++;
            r--;
            ans++;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3712
#include<stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	char s[n + 1];
	scanf("%s",s);
	int i;
	int c = 0;
	for(i = 0; i < n; i++){
		if(s[i] == 'A' && i < n-2 && s[i + 1] == 'B' && s[i + 2] == 'C'){
			c++;
		}
	}

	printf("%d\n",c);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;
//inline void modAdd(LL &l, LL &r) {l = (l + r) % MOD;}

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n,a,b;
    cin >> n >> a >> b;

    cout << min(a,b) << " " << max(0, a + b - n) << endl;
}

int main() {
    solve();
    
    return 0;
}

Measured memory_bytes: 256