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

using ll = long long;
#define int long long
using P = pair<int, int>;

#define LOG(variable) cerr << #variable":\t" << (variable) << endl
#define LOGCON(i, container) for(int (i) = 0; (i) < (container).size(); ++(i)) cerr << (i) << ":\t" << (container)[(i)] << endl
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPS(i, r, n) for (int i = (r); i < (n); ++i)
#define REPR(i, n) for(int i = (n); i >= 0; --i) // from n to 0
#define REPRS(i, n, r) for(int i = (n); i >= (r); --i) // from n to r
#define REPOBJ(itr, obj) for(auto itr = (obj).begin(); itr != (obj).end() ; ++itr)
#define REPROBJ(itr, obj) for(auto itr = (obj).rbegin(), e = (obj).rend(); itr != e; ++itr)
#define COUTB(x) cout << (x) << "\n"
#define COUTS(x) cout << (x) << " "
#define PB push_back
#define SORT(obj) sort((obj).begin(), (obj).end())
#define SORTR(obj) sort((obj).begin(), (obj).end(), greater<>())
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define PI (acos(-1))
template<typename T = int>
T in() {T a; cin >> a; return a;}
/***** MAIN *****/
signed main() {
  int n; cin >> n;
  n /= 200;
  cout << 10 - n;
  cout << "\n";
  return 0;
}
/***** MAIN *****/


Measured memory_bytes: 3616
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort()
B=[]
total=0
for i in range(1,M):
    B.append(A[i]-A[i-1])
B.sort()

for i in range(M-N):
    total +=B[i]
print(total)

Measured memory_bytes: 13960
#!/usr/bin/env python3
#ABC110 C

s = list(input())
t = list(input())

if len(set(s)) != len(set(t)):
    print('No')
    quit()

dif = {}
for x,y in zip(s,t):
    if x not in dif:
        dif[x] = y
    elif dif[x] != y:
        print('No')
        quit()
print('Yes')


Measured memory_bytes: 70348
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

ll moP(ll x, ll n) {
  ll res=1;
  while(n>0) {
    if(n&1) moC(res, *, x);
    moC(x, *, x);
    n>>=1;
  }
  return res;
}

ll fa[MAX*2], rf[MAX*2];

int main(void) {
  ll N, a, b;
  cin >> N >> a >> b;
  ll i;
  
  fa[0]=rf[0]=1;
  for(ll i=1; i<=max(a, b); i++) {
    fa[i]=fa[i-1]*i%MOD;
    rf[i]=moP(fa[i], MOD-2);
  }
  
  ll A=1, B=1;
  for(i=0; i<a; i++) moC(A, *, N-i);
  moC(A, *, rf[a]);
  for(i=0; i<b; i++) moC(B, *, N-i);
  moC(B, *, rf[b]);
  
  ll ans=moP(2, N);
  moC(ans, -, 1);
  moC(ans, -, A);
  moC(ans, -, B);
  pt(ans);
}







Measured memory_bytes: 3328
n = int(input())
a = list(map(int,input().split()))
ans = []
tmp = []
flag = 0

for i in range(len(a)):
    if len(tmp) == 0:
        tmp.append(a[i])
    elif flag == 0:
        flag = 1 if tmp[-1] < a[i] else -1 if tmp[-1] > a[i] else 0
        tmp.append(a[i])
    elif (flag == 1 and tmp[-1] <= a[i]) or (flag == -1 and tmp[-1] >= a[i]):
        tmp.append(a[i])
    else:
        ans.append(tmp)
        tmp = [a[i]]
        flag = 0

print(len(ans) + 1)


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



//defines...
#define ll  long long
#define tata return;
#define pb push_back
#define mp make_pair
#define in insert
#define run ios_base::sync_with_stdio(false);cin.tie(NULL);
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define vec vector<ll>
#define setl set<ll>
#define mapl map<ll,ll>
#define shunno cout<<0<<endl;
#define pi 2*acos(0.0)1
#define hobena cout<<-1<<endl;




//typedefs...
typedef pair<ll,ll>pll;

//const..
//const ll fx[]={0,1,0,-1};
//const ll fy[]={1,0,-1,0};
const ll mod=1e9+7;


//......Algo.....

/*ll ncr(ll n, ll k)
{
    ll res = 1;


    if (k > n - k)
        k = n - k;

    for (int i = 0; i < k; ++i) {
        res *= (n - i);
        res /= (i + 1);
    }

    return res;
}
*/
//to remove suffix of a number from a set of string
/*
for(int k=1; k<j.size(); k++)
                if(temp.count(string(j.begin()+k,j.end())))
					temp.erase(string(j.begin()+k,j.end()));
 */
ll bigmod(ll base ,ll power,ll mod)
{
    if(power==0) return 1;
    else if(power%2)
    {
        ll p1=base%mod;
        ll p2=(bigmod(base,power-1,mod))%mod;
        return (p1*p2)%mod;
    }
    else
    {
        ll p=(bigmod(base,power/2,mod)%mod);
        return (p*p)%mod;
    }
}

void oka()
{
   ll i,n;
   cin>>n;
   ll cnt=0;
   ll a[n+1];
   for(i=1;i<=n;i++)
    cin>>a[i];
   for(i=1;i<=n;i++)
   {
       if(i&1)
       {
           if(a[i]&1)
            cnt++;
       }
   }
   cout<<cnt<<endl;

}
/*I'll paint it on the walls
     cause I'm the one at fault
    I'll never fight again and
         this is how it ends .*/






int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    run
    ll t;
   t=1;
  //cin>>t;
    while(t--){

    oka();
    }



}

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

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

int main() {
  ll n;
  cin >> n;
  int ans = to_string(n).size();
  // i * i <= n と条件をすると O(n) から O(√n) に変わる
  for (ll i = 1; i*i <= n; i++) {
    if (n % i != 0) continue;
    string a = to_string(i);
    string b = to_string(n/i);
    ans = min(int(max(a.size(), b.size())), ans);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
class Problem
  attr_accessor :a, :b, :n, :m, :h, :w

  def initialize
    @a = gets.chomp
  end

  def solve
    a.include?("7")
  end

  def show(ans)
    puts ans ? "Yes" : "No"
  end
end

Problem.new.instance_eval do
  show(solve)
end


Measured memory_bytes: 14288
def cal_algae(r, d, x, i):
    if i < 2010:
        x = r * x - d
        print(x)
        cal_algae(r, d, x, i + 1)


r, d, x = list(map(int, input().split()))

i = 2000

cal_algae(r, d, x, i)


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

namespace abc109_a
{
	class Program
	{
		static void Main(string[] args)
		{
			int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
			Console.WriteLine(x[0]*x[1]%2==1?"Yes":"No");
		}
	}
}


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

int n;
int mx = 40;

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        int j;
        for (j = 0; j < mx; j++) {
            if (x % 2 == 0) {
                x /= 2;
            } else break;
        }
        mx = min(mx, j);
    }
    cout << mx << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)


#define all(v) v.begin(),v.end()
#define INF 1<<30
#define mp make_pair
#define pb push_back

#define fi first
#define se second

#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

typedef long long ll;
int ih[1000*1500+1500];
int iw[1000*1500+1500];
int main(){
	
	while(1){
		rep(i,1000*1500+1500){
			ih[i] = 0;
			iw[i] = 0;
		}
		int ans=0;
		int n,m;
		int h[1520];
		int w[1010];
		int maxh = 0;
		int maxw = 0;
		cin >> n >> m;
		if(n==0) break;
		rep(i,n){
			cin >> h[i];
			maxh += h[i];
		}
		rep(i,m){
			cin >> w[i];
			maxw += w[i];
		}
		int maxs = min(maxh,maxw);

		rep(s,n){
			int tsh = 0;
 			for(int e=s;e<n&&tsh<=maxs;e++){
				// cout << "s : "  << s << "e : "<<e<< endl;
				tsh += h[e];
				ih[tsh] += 1;
			}
		}
		rep(s,m){
			int tsw = 0;

 			for(int e=s;e<m&&tsw<=maxs;e++){
				
				tsw += w[e];
				iw[tsw] += 1;
			}
		}
		// rep(i,6) cout << "ih : "<<ih[i] << endl;
		// rep(i,6) cout << "iw : "<<iw[i] << endl;



		REP(i,1,maxs+1){
			ans += ih[i]*iw[i];
			// cout << i <<  "ih[i]" << ih[i] << "iw[i]" << iw[i] <<endl;
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 14792
n = int(input())
l = []
for i in range(n):
    t,x,y = map(int,input().split())
    l.append([t,x,y])
for i in range(n):
    t,x,y = l[i][0],l[i][1],l[i][2]
    if x+y > t or (t-(x+y))%2 != 0:
          print('No')
          exit()
l.sort()
for i in range(n-1):
    t,x,y = l[i][0],l[i][1],l[i][2]
    t_,x_,y_ = l[i+1][0],l[i+1][1],l[i+1][2]
    if t_ - t < (abs(x-x_)+abs(y-y_)):
        print('No')
        exit()
print('Yes')

Measured memory_bytes: 88640
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cstring>
#include<utility>
#include<cmath>
#include<assert.h>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<complex>
#include<bitset>

#define int long long
using namespace std;
#define rep(i, n) for(int i=0;i<(n);++i)
typedef pair<int, int> pii;
const int INF = 1l << 60;
#define u_b upper_bound
#define l_b lower_bound


signed main() {
    int N;
    string S;
    cin >> N >> S;
    int r = 0, b = 0;
    rep(i, N) {
        if (S[i] == 'R')r++;
        else b++;
    }
    if (r > b)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


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

void print(const std::vector<int>& v)
{
    for(int i = 0; i < v.size(); i++) {
        if(i) cout << " ";
        cout << v[i];
    }
    cout << endl;
}
int main(void){
    // Your code here!
    int n;
    cin >> n;
    vector<int> A(n);
    for(int i = 0; i < n; i++){
        cin >> A[i];
    }
    auto prev = A;
    if (prev_permutation(prev.begin(), prev.end())) {
        print(prev);
    }
    
    print(A);
    
    auto next = A;
    if (next_permutation(next.begin(), next.end())) {
        print(next);
    }
    return 0;
    
    
}



Measured memory_bytes: 3164
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x) (x).begin(), (x).end()
#define rep(i, s, n) for (i64 i = (s), i##_limit = (n); i < i##_limit; ++i)
#define repr(i, s, t) for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#define var(type, ...) \
    type __VA_ARGS__;  \
    read(__VA_ARGS__);
#ifndef DBG
#define dump(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U>
inline bool chmax(T &a, const U &b) {
    return b > a && (a = b, true);
}
template <class T, class U>
inline bool chmin(T &a, const U &b) {
    return b < a && (a = b, true);
}
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> makeV(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto makeV(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(makeV<T>(initValue, args...))>(
        sz, makeV<T>(initValue, args...));
}

template <class T>
inline istream &operator>>(istream &is, vector<T> &vec) {
    for (auto &e : vec) is >> e;
    return is;
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail &... tail) {
    cin >> head;
    read(tail...);
}

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail &&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream &operator<<(ostream &os, const vector<T> &vec) {
    static constexpr const char *delim[] = {" ", ""};
    for (const auto &e : vec) os << e << delim[&e == &vec.back()];
    return os;
}

template <class Container>
struct Rev {
    Container &x_;
    inline Rev(Container &x) : x_(x) {}
    inline auto begin() { return rbegin(x_); }
    inline auto end() { return rend(x_); }
};
// }}} End Header

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    var(int, N);
    vector<pair<int, int>> a(N);
    rep(i, 0, N) {
        var(int, x);
        a[i] = {x, i};
    }

    sort(all(a));
    vector<int> ans(N);
    rep(i, 0, N) { ans[i] = (a[i].second + 1); }
    print(ans);

    return 0;
}


Measured memory_bytes: 2048
#include<iostream>
using namespace std;
int main()
{
 int n;
 for(;cin>>n,n;)
   {
     int sum=0;
     for(;n>0;n=n-4)
       {
	 int tmp;
	 cin>>tmp;
	 sum+=tmp;
       }
     cout<<sum<<endl;
   }
}

Measured memory_bytes: 1160
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>

#define endl '\n'
#define fi first
#define se second
#define pb push_back
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
const int MOD = 1e9 + 7;
const int maxn = 1e6 + 5;
const int inf = 0x3f3f3f3f;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-8;

int main() {
    int r; cin >> r;
    cout << pow(r, 2) << endl;
	return 0;
}


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

using namespace std;

#define SZ(v) ((int)(v).size())
#define ALL(v) (v).begin(),(v).end()
#define one first
#define two second
typedef long long ll;
typedef pair<int, int> pi;
const int INF = 0x3f2f1f0f;
const ll LINF = 1ll * INF * INF;

const int MAX_N = 1e5 + 100;

int N; ll Dy[3][MAX_N];
int main() {
	int a = 2, b = 2;
	cin >> N;
	
	Dy[1][0] = Dy[2][0] = -LINF;
	for(int i=1; i<=N; i++) {
		char S[9]; if(i > 1) scanf("%s", S);
		int op = (i == 1 ? 1 : (S[0] == '+' ? 1 : -1) );
		int nr; scanf("%d", &nr);

		for(int k=0; k<=2; k++) Dy[k][i] = Dy[k][i-1] + (k%2 == 0 ? nr * op : nr * op * -1);
		for(int k=1; k<=2; k++) Dy[k-1][i] = max(Dy[k-1][i], Dy[k][i-1] + (k%2 == 0 ? nr * op : nr * op * -1));
		if(op == -1) for(int k=0; k<=1; k++) Dy[k+1][i] = max(Dy[k+1][i], Dy[k][i-1] + (k%2 == 0 ? nr * op : nr * op * -1));
	}
	printf("%lld\n", Dy[0][N]);
	return 0;
}


Measured memory_bytes: 2560
N,W = map(int,input().split())
wv = [list(map(int,input().split())) for _ in range(N)]
dp = [[0]*(W+1) for _ in range(N+1)]
 
for i in range(N):
  for j in range(W+1):
    if j - wv[i][0] >= 0:
      dp[i+1][j] = max(dp[i+1][j], dp[i][j-wv[i][0]] + wv[i][1])
    dp[i+1][j] = max(dp[i+1][j], dp[i][j])
 
ans = 0

print(dp[N][W])

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

int main() {
    using namespace std;
    string N;
    cin >> N;
    unsigned long K;
    cin >> K;
    const auto& score_1 = [](auto begin, auto end) -> unsigned long {
        string N{begin, end};
        if(N.size() < 1)return 0;
        return 9 * (N.size() - 1) + N[0] - 48;
    };
    const auto& score_2 = [&score_1](auto begin, auto end) -> unsigned long {
        string N{begin, end};
        if(N.size() < 2)return 0;
        return 81 * (N.size() - 1) * (N.size() - 2) / 2 + (N[0] - 49) * 9 * (N.size() - 1) + score_1(find_if_not(N.begin() + 1, N.end(), [](auto t){return t == '0';}), N.end());
    };
    const auto& score_3 = [&score_2](auto begin, auto end) -> unsigned long {
        string N{begin, end};
        if(N.size() < 3)return 0;
        return 729 * (N.size() - 1) * (N.size() - 2) * (N.size() - 3) / 6 + (N[0] - 49) * 81 * (N.size() - 1) * (N.size() - 2) / 2 + score_2(find_if_not(N.begin() + 1, N.end(), [](auto t){return t == '0';}), N.end());
    };
    if(K == 1) cout << score_1(N.begin(), N.end()) << endl;
    else if(K == 2) cout << score_2(N.begin(), N.end()) << endl;
    else cout << score_3(N.begin(), N.end()) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
bool vis[107];
struct edge {
	int u, v, w;
	edge(int u, int v, int w) :u(u), v(v), w(w) {}
	bool operator < (const edge &rhs) const {
		return w < rhs.w;
	}
};
vector<edge> e;
int main() {
    int n, ans = 0;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
    	for (int j = 0; j < n; j++) {
    		int tmp;
    		scanf("%d", &tmp);
    		if (tmp >= 0 && i >= j) e.push_back(edge(i, j, tmp));
		}
	}
	sort(e.begin(), e.end());
	vis[e[0].u] = true;
	bool flag = true;
	int cnt = e.size();
	while (flag) {
		flag = false;
		for (int i = 0; i < cnt; i++) {
			if (vis[e[i].u] != vis[e[i].v]) {
				vis[e[i].u] = true;
				vis[e[i].v] = true;
				ans += e[i].w;
				flag = true;
				break;
			}
		}
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 2744
// 2014/09/08 Tazoe

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

int main()
{
	int F[14][14];
	for(int y=0; y<14; y++){
		for(int x=0; x<14; x++){
			F[y][x] = 0;
		}
	}

	while(true){
		string S;
		cin >> S;

		if(cin.eof())
			break;

		for(int i=0; i<2; i++){
			int loc = S.find(",");
			S.replace(loc, 1, " ");
		}

		istringstream is(S);
		int x, y, s;
		is >> x >> y >> s;

//		cout << x << ' ' << y << ' ' << s << endl;

		x = x+2;
		y = y+2;

		if(s==1){
			F[y][x]++;
			F[y-1][x]++;
			F[y+1][x]++;
			F[y][x-1]++;
			F[y][x+1]++;
		}
		else if(s==2){
			F[y][x]++;
			F[y-1][x]++;
			F[y+1][x]++;
			F[y][x-1]++;
			F[y][x+1]++;
			F[y-1][x-1]++;
			F[y-1][x+1]++;
			F[y+1][x-1]++;
			F[y+1][x+1]++;
		}
		else if(s==3){
			F[y][x]++;
			F[y-1][x]++;
			F[y+1][x]++;
			F[y][x-1]++;
			F[y][x+1]++;
			F[y-1][x-1]++;
			F[y-1][x+1]++;
			F[y+1][x-1]++;
			F[y+1][x+1]++;
			F[y-2][x]++;
			F[y+2][x]++;
			F[y][x-2]++;
			F[y][x+2]++;
		}
	}

	int cnt = 0;
	int F_max = -1;

	for(int y=0; y<10; y++){
		for(int x=0; x<10; x++){
			if(F[y+2][x+2]==0){
				cnt++;
			}

			if(F[y+2][x+2]>F_max){
				F_max = F[y+2][x+2];
			}
		}
	}

	cout << cnt << endl;
	cout << F_max << endl;

	return 0;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
const int N=505;
vector<int>v[N];
int n,m,q;
int main()
{
	std::ios::sync_with_stdio(false);
	cin>>n>>m>>q;
	for(int i=0;i<m;i++)
	{
		int x,y;
		cin>>x>>y;
		x--,y--;
		v[x].push_back(y);
	}
	for(int i=0;i<n;i++)sort(v[i].begin(),v[i].end());
	for(int i=0;i<q;i++)
	{
		int x,y;
		cin>>x>>y;
		x--,y--;
		int ans=0;
		for(int j=x;j<=y;j++)
			ans+=upper_bound(v[j].begin(),v[j].end(),y)-v[j].begin();
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 2176
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<string>
#include<string.h>

using namespace std;
struct AREA {
	long long int x, y, d;
};
struct ANS {
	int X, Y, D, X1, Y1, D1;
};
int N, K;
long long int tmp;
AREA box[101], del;
ANS Box[51];
int main() {
	del.x = 0;
	del.y = 0;
	del.d = 0;
	cin >> N >> K;
	for (int i = 0; i < 2 * N; i++) {
		cin >> box[i].x >> box[i].y >> box[i].d;
		if (i % 2 == 0){
			Box[i / 2].X = box[i].x;
			Box[i / 2].Y = box[i].y;
			Box[i / 2].D = box[i].d;
		}
		else {
			Box[i / 2].X1 = box[i].x;
			Box[i / 2].Y1 = box[i].y;
			Box[i / 2].D1 = box[i].d;
		}
	}
	for (int i = 0; i < 2*N; i++) {
		for (int j = 2*N - 1; j > i; j--) {
			if (box[j - 1].x > box[j].x) {
				tmp = box[j - 1].x;
				box[j - 1].x = box[j].x;
				box[j].x = tmp;
			}
			if (box[j - 1].x == box[j].x&&box[j - 1].x != 1000000000) {
				box[j].x = 1000000000;
				del.x++;
			}
			if (box[j - 1].y > box[j].y) {
				tmp = box[j - 1].y;
				box[j - 1].y = box[j].y;
				box[j].y = tmp;
			}
			if (box[j - 1].y == box[j].y&&box[j - 1].x != 1000000000) {
				box[j].y = 1000000000;
				del.y++;
			}
			if (box[j - 1].d > box[j].d){
				tmp = box[j - 1].d;
				box[j - 1].d = box[j].d;
				box[j].d = tmp;
				}
			if (box[j - 1].d == box[j].d&&box[j - 1].d != 1000000000) {
				box[j].d = 1000000000;
				del.d++;
			}
		}
	}
	int CNT=0;
	long long int ANS=0;
	for (int i = 0; i < 2 * N - del.x - 1; i++) {
		for (int j = 0; j < 2 * N - del.y - 1; j++) {
			for (int k = 0; k < 2 * N - del.d - 1; k++) {
				for (int l = 0; l < N; l++) {
					if (Box[l].X <= box[i].x&&box[i + 1].x <= Box[l].X1&&Box[l].Y <= box[j].y&&box[j + 1].y <= Box[l].Y1&&Box[l].D <= box[k].d&&box[k + 1].d <= Box[l].D1)
						CNT++;
				}
				if (CNT >= K)
					ANS += (box[i + 1].x - box[i].x)*(box[j + 1].y - box[j].y)*(box[k + 1].d - box[k].d);
				CNT = 0;
			}
		}
	}
	cout << ANS << endl;
	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <algorithm>
using namespace std;
int main(){
  int n, m, xx, yy, i;
  cin >> n >> m >> xx >> yy;
  int x[n], y[m];
  for(i=0; i<n; i++)
    cin >> x[i];
  for(i=0; i<m; i++)
    cin >> y[i];
  sort(x, x+n);
  sort(y, y+m);
  if(max(xx, x[n-1])<min(yy,y[0])) cout << "No War";
  else cout << "War";
  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 int ll;


int main(void){
    int x,y;
    cin >> x >> y;
    int ans = x+y/2;
    cout << ans <<endl;
    
    return 0;
}














































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

#define rep(i,k,n) for(int (i)=(k);(i)<(n);(i)++)
#define max(a,b) (a)>(b)?(a):(b)
#define min(a,b) (a)<(b)?(a):(b)
#define abs(a) (a)>0 ?(a):-(a)
#define llong long long

int main(){
	int S,W; scanf("%d %d",&S,&W);
	if( S<=W ) printf("unsafe");
	else printf("safe");
	return 0;
}


Measured memory_bytes: 1724
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin>>a;
  vector<int>b(a);
  for(int i=0;i<a;i++){
    cin>>b.at(i);
  }
  int c=1;
  int d=b.at(0);
  for(int i=1;i<a;i++){
    if(b.at(i)>=d){
      c++;
      d=b.at(i);
    }
  }
  cout<<c;
}

Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> v(100000 + 2 + 1, 0);
    for (int i = 0; i < n; ++i) {
        int a;
        int b;
        cin >> a >> b;
        // ?????????????¬?????????§1?????????
        v[b + 1] -= 1;
        // ???????????§1????¢???????
        v[a] += 1;
    }

    // Scan ????????¨???????????°???????????????
    for (int i = 1; i < v.size() - 1; ++i) {
        v[i] = v[i - 1] + v[i];
    }
    int max_{0};
    for (int i = 0; i < v.size(); ++i) {
        // ????????????????????¨????????????, ????????????????????°???????????????????????£?????????
        if (0 < v[i] && (i - 1) <= v[i]) {
            max_ = i;
        }
    }
    if (max_ != 0) {
        cout << (max_ - 1) << endl;
    }
    else {
        cout << max_ << endl;
    }
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<int,int>;
const ll INF=1LL<<30;
const ll LINF=1LL<<61;
const double eps=1e-5;
const ll MOD=1e9+7;
int main(){
    string s;cin>>s;
    int n=s.length();
    vector<ll> a(n+1),c(n+1),h1(n+1),h2(n+1),ss(n+1);
    ss[0]=1;
    for(int i=1;i<=n;i++){
        ss[i]=ss[i-1]*3LL%MOD;
    }
    for(int i=0;i<n;i++){
        if(s[i]=='A'){
            a[i]++;
        }else if(s[i]=='?'){
            h1[i]++;
        }
        a[i+1]+=a[i];
        h1[i+1]+=h1[i];
    }
    for(int i=n-1;i>=0;i--){
        c[i]+=c[i+1];
        h2[i]+=h2[i+1];
        if(s[i]=='C'){
            c[i]++;
        }else if(s[i]=='?'){
            h2[i]++;
        }
    }
    ll ans=0;
    for(int i=1;i<n-1;i++){
        if(s[i]=='B'){
            ans+=a[i-1]*c[i+1]%MOD*ss[h1[i-1]+h2[i+1]]%MOD;
            if(h1[i-1])ans+=h1[i-1]*ss[h1[i-1]+h2[i+1]-1]*c[i+1]%MOD;
            if(h2[i+1])ans+=h2[i+1]*a[i-1]*ss[h1[i-1]+h2[i+1]-1]%MOD;
            if(h1[i-1]&&h2[i+1])ans+=ss[h1[i-1]+h2[i+1]-2]*h1[i-1]%MOD*h2[i+1]%MOD;
            ans%=MOD;
        }else if(s[i]=='?'){
            ans+=a[i-1]*c[i+1]%MOD*ss[h1[i-1]+h2[i+1]]%MOD;
            if(h1[i-1])ans+=h1[i-1]*ss[h1[i-1]+h2[i+1]-1]*c[i+1]%MOD;
            if(h2[i+1])ans+=h2[i+1]*a[i-1]*ss[h1[i-1]+h2[i+1]-1]%MOD;
            if(h1[i-1]&&h2[i+1])ans+=ss[h1[i-1]+h2[i+1]-2]*h1[i-1]%MOD*h2[i+1]%MOD;
            ans%=MOD;
        }
    }
    cout<<ans<<endl;
}   


Measured memory_bytes: 4352
n=gets.chomp.to_i;
p=gets.chomp.split(" ").map(&:to_i);

b = []
b[0] = p[0]
mi = p[0]
for i in 1..n-1
  if p[i] < mi
    mi = p[i]
    b[i] = mi
  else
    b[i] = mi
  end
end

count = 1

for i in 1..n-1
  if p[i] <= b[i]
    count = count+1
  end
end

puts count

Measured memory_bytes: 18256
N, x = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

a.sort()
ans = 0
for i in range(N):
    if x < a[i]:
        x = 0
        break
    x -= a[i]
    ans += 1
if x > 0:
    ans -= 1

print(ans)

Measured memory_bytes: 3064
using System;

class Program
{
    // nの桁和
    static int GetDigitSum(int n)
    {
        int sum = 0;
        for (; n != 0; n /= 10)
        {
            sum += n % 10;
        }
        return sum;
    }

    // 桁和がnとなる最小の数
    static int MinDigitSum(int n)
    {
        int min = 0;
        if (n <= 9)
        {
            min = n;
        }
        else if (n <= 18)
        {
            min = (n - 9) * 10 + 9;
        }
        else if (n <= 27)
        {
            min = (n - 18) * 100 + 99;
        }
        else
        {
            min = (n - 27) * 1000 + 999;
        }
        return min;
    }

    // max以下で桁和がnとなる数の合計
    static int SumDigitSum(int n, int max)
    {
        int sum = 0;
        for (int i = MinDigitSum(n); i <= max; i += 9)
        {
            if (GetDigitSum(i) == n)
            {
                sum += i;
            }
        }
        return sum;
    }

    static void Main(string[] args)
    {
        string[] NAB = Console.ReadLine().Split(' ');
        int N = int.Parse(NAB[0]);
        int A = int.Parse(NAB[1]);
        int B = int.Parse(NAB[2]);

        int sum = 0;
        for (int i = A; i <= B; i++)
        {
            sum += SumDigitSum(i, N);
        }
        Console.WriteLine(sum);
    }
}


Measured memory_bytes: 13140
from collections import Counter
N=int(input())
D=list(map(int,input().split()))
c=Counter(D)
  
S=[]
D=[]
for i in c:
  if c[i]==1:
    S.append(i)
  elif c[i]==2:
    D.append(i)
    D.append(24-i)
  else:
    print(0)
    exit()

n=len(S)
ans=-1
for i in range(2**n):
  L=[d for d in D]
  for j in range(n):
    if (i>>j)&1==0:
      L.append(S[j])
    else:
      L.append(24-S[j])
    
  L.append(0)
  L.sort()
  m=25
  for i in range(N+1):
    d=abs(L[i]-L[i-1])
    m=min(d,24-d,m)
  ans=max(ans,m)
  
print(ans)

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

#define all(v) v.begin(), v.end()
#define mp make_pair
#define EPS (int)1e-9
#define PI acos(-1)
#define endl '\n'
#define pb push_back
#define fi first
#define se second

using namespace std;
using ld = long double;
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;

const int mod = 1e9+7;

vector<ll> p;
vector<ll> smp;

void createSieve(ll n)
{
	smp = vector<ll>(n+1);

	for(ll i = 2; i <= n; i++)
	{
		if(smp[i] == 0)
		{
			smp[i] = i;
			p.pb(i);
		}

		for(ll j = 0; j < p.size() and p[j] <= smp[i] and i*p[j] <= n; j++)
			smp[i*p[j]] = p[j];
	}
}

map<ll, ll> getFactors(ll n)
{
	map<ll, ll> ans;
	while(n > 1)
	{
		int aux = smp[n];
		ans[aux]++;
		n /= aux;
	}

	return ans;
}

void update(map<ll, ll> &c, map<ll, ll> &o)
{
	for(pair<ll, ll> x: o)
		c[x.fi] += x.se;

	return;
}

int main()
{
	//ios_base::sync_with_stdio(0); cin.tie(0);
	int n;
	cin >> n;

	createSieve(1e3+1);

	map<ll, ll> factors;
	map<ll, ll> aux;


	for(ll i = 2; i <= n; i++)
	{
		aux = getFactors(i);
		update(factors, aux);
	}

	ll ans = 1;
	cerr << mod << endl;
	for(pair<ll,ll> x : factors)
	{
		ans *= x.se+1;
		ans %= mod;
		cerr << ans << endl;
	}

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

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
N=int(input()) #N==100
H=list(map(int,input().split()))#O(N)

cnt=0
for i in range(max(H)):#O(N)
    flg=0
    for j in range(N):#O(N^2)
        if flg==0:
            if H[j]!=0:
                H[j]-=1
                cnt+=1
                flg=1
            #else:  なくてもいい
             #   flg=0
        else:
            if H[j]!=0:
                H[j]-=1
            else:
                flg=0
print(cnt)
#O(N^2),N==100で余裕

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

int main(){
    int a, b;
    cin >> a >> b;
    if (a > 0)
    {
        cout << "Positive" << endl;
    }
    else if (a <= 0 && b >= 0)
    {
        cout << "Zero" << endl;
    }
    else
    {
        if ((b - a - 1) % 2 == 0)
        {
            cout << "Positive" << endl;
        }
        else
        {
            cout << "Negative" << endl;
        }
    }
}

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

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


Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> v;
    for (int i = 0; i < n; ++i) {
        string s;
        cin >> s;
        v.push_back(s);
    }
    sort(v.begin(), v.end());
    string result = "";
    for (int i = 0; i < n; ++i) {
        result += v[i];
    }
    cout << result << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>

using namespace std;

int main() {
    int N, Q;
    scanf("%d%d", &N, &Q);

    string S;
    cin >> S;

    int a[N];
    a[0] = 0;
    for (int i = 1; i < N; i++) {
        if (S[i-1] == 'A' && S[i] == 'C') {
            a[i] = a[i-1] + 1;
        } else {
            a[i] = a[i-1];
        }
    }
    int l, r;
    for (int i = 0; i < Q; i++) {
        scanf("%d%d", &l, &r);
        printf("%d\n", a[r-1]-a[l-1]);
    }
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
char s[200007];
int ans[200007];
int main(){
    int n,k;
    int i=0,j=0,l=0;
    scanf("%d%d",&n,&k);
    scanf("%s",s+1);
    for(i=1;i<=n;i++)
        if(s[i]=='A')
            ans[i]=1;
    int tmp=0;
    for(i=1,j=1;i<=k&&j<=n;i++){
        if(ans[j]^tmp){//如果这一位经历异或之后变为了1需要再变一次把它变成0，因为这一位终将变成相当于这一步的开头第一位
            ans[j]^=1;//将它变成0
            continue;
        }
        tmp^=1;//变化异或标记
        j++;//进入下一位
    }
    if(i>=k+1){//k太小以至于前面还有剩余没有变为最终形态
        for(l=j;l<=n;l++)
            if(ans[l]^tmp)
                printf("A");
            else
                printf("B");
        for(l=n+1;l<=n+j-1;l++)
            if((n+j-l)&1)
                printf("A");
            else
                printf("B");
    }
    else{
        if(n&1){
            if((k-i+2)&1)
                printf("A");
            else
                printf("B");
            for(l=2;l<=n;l++)
                if(l&1)
                    printf("A");
                else
                    printf("B");
        }
        else
            for(l=1;l<=n;l++)
                if((l+1)&1)
                    printf("A");
                else
                    printf("B");
    }
    return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;
  string ans = "";
 
  for(int i = 0; i < s.size(); i++) {
    if(s[i] == '0') {
      ans.push_back('0');
    }
    else if(s[i] == '1') {
      ans.push_back('1');
    }
    else if (s[i] == 'B' && ans.size() > 0) {
      ans.pop_back();
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3624
#include <cstring>
#include <map>
#include <unordered_map>
#include <string>
#include <list>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <iostream>
#include <set>
#include <unordered_set>
using namespace std;

#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int, int> pii;

int gi() {
    int a;
    scanf("%d", &a);
    return a;
}

ll gli() {
    ll a;
    scanf("%lld", &a);
    return a;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n = gi();
    int a = gi();
    int b = gi();
    printf((b-a)%2 ? "Borys\n" : "Alice\n");

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>

int n, x;

int main() {
	scanf("%d%d", &n, &x);
	
	int cur = 0;
	for(int i=0;i<n;i++) {
		int gap;
		scanf("%d", &gap);
		
		cur += gap;
		if (cur > x) {
			printf("%d\n", i+1);
			return 0;
		}
	}
	printf("%d\n", n+1);
	
	return 0;
}

Measured memory_bytes: 128
N = input()
S = input()
dic={i:str(i) for i in range(0,10)}
lenS=len(S)
cnt=0
for i in range(0, 1000):
    index=S.find(dic[i // 100])
    if index == -1:
        continue
    elif index + 2 <= lenS:
        index=S.find(dic[(i-(i//100)*100) // 10],index+1)
        if index == -1:
            continue
        elif index+1<=lenS:
            index=S.find(dic[i-(i//10)*10],index+1)
            if index != -1 and index < lenS:
                #print("{}".format(i))
                cnt+=1
print(cnt)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define N 100005
#define ll long long
#define ull unsigned long long
#define loop1(i, j, k, step) for (int i = j; i < k; i += step)
#define loop(i, j, k) for (int i = j; i < k; i++)
#define rloop1(i, j, k, step) for (int i = j; i >= k; i -= step)
#define rloop(i, j, k) for (int i = j; i >= k; i--)
#define rep(i, k) for (int i = (0); i < (k); i++)
#define rrep(i, k) for (int i = k - 1; i >= 0; i--)

#define forall(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define mp make_pair
#define pb push_back
#define pop pop_back
#define F first
#define S second
#define sz(x) (int)(x).size()
#define endl "\n"
#define Max (int)INT_MAX
#define Min (int)INT_MIN
#define MEM(a, b) memset(a, (b), sizeof(a))
#define fast_io ios_base::sync_with_stdio(0), cin.tie(NULL)
#define lin puts("");
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<ll> vl;
typedef pair<ll, ll> pll;
char ch[101][101];
char c;
int arr[105];
void solve()
{
    ll a, b, c, k, sum = 0;
    cin >> a >> b >> c >> k;

    if (a > k)
    {
        sum += k;
    }
    else if (a == k)
    {
        sum = a;
    }
    else if (a + b > k)
    {
        sum = a;
    }
    else if (a + b == k)
    {
        sum = a;
    }
    else if (a + b + c > k)
    {
        sum = a - (k - (a + b));
    }
    else if (a + b + c == k)
    {
        sum = a - c;
    }

    cout << sum << endl;
}
int main()
{
    auto start = clock();
    fast_io;
    //freopen("test.txt", "r", stdin);
    int t = 1;
    while (t--)
    {
        solve();
    }
    auto stop = clock();
    cerr << "time taken:" << double(stop - start) / double(CLOCKS_PER_SEC) << " s" << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  vector<int64_t> L(N+1);
  L.at(0) = 2;
  L.at(1) = 1;
  
  for(int i = 2; i <= N; i++) {
    L.at(i) = L.at(i - 2) + L.at(i - 1);
  }
  
  //出力する
  cout << L.at(N) << endl;
}


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

ll n;
vector<ll> a;

int main() {
  cin >> n;
  a.resize(n);
  for (ll i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll sum = 0;
  for (ll i = 0; i < n; i++) {
    sum += (a[i] - 1);
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int min = 0;
        int max = n;
        for(int i=0; i<m; i++) {
            int l = in.nextInt();
            int r = in.nextInt();
            min = Math.max(min, l);
            max = Math.min(max, r);
        }
        System.out.println(max-min>=0 ? max-min+1 : 0);
    }
}


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

#define rep(i,begin,end) for(int i=begin; i<end; i++)
#define revrep(i,begin,end) for(int i=begin; i>end; i--)
#define lld long long int

typedef struct node{
    int cnt;
    lld r;
    lld l;
}node;

int cmpAsc(const void* a, const void* b){
    lld x = ((node*)a)->l, y = ((node*)b)->l;
    lld p = ((node*)a)->r, q = ((node*)b)->r;
    if(x > y){
        return 1;
    }
    if(x < y){
        return -1;
    }
    if(p > q){
        return 1;
    }
    if(p < q){
        return -1;
    }
    return 0;
}

int main(){
    int n;
    scanf("%d", &n);
    node a[n];
    rep(i, 0, n){
        lld x, l;
        scanf("%lld %lld", &x, &l);
        a[i].l = x - l;
        a[i].r = x + l;
        a[i].cnt = 1;
    }
    qsort(a, n, sizeof(node), cmpAsc);
    int max[n];
    rep(i, 0, n){
        max[i] = 1;
    }
    revrep(i, n-1, -1){
        int l=i, r = n-1;
        int p = (l+r)/2;
        while(l < r){
            p = (l+r)/2;
            if(a[p].l < a[i].r){
                l = p+1;
            }else{
                r = p;
            }
        }
        p = (l+r)/2;
        if(a[i].r <= a[p].l){
            a[i].cnt += max[p];
        }
        /*if(max[i+1] < a[i].cnt){
            max[i] = a[i].cnt;
        }else{
            if(i < n-1){
                max[i] = max[i+1];
            }
        }*/
        if(i < n-1){
            if(max[i+1] < a[i].cnt){
                max[i] = a[i].cnt;
            }else{
                max[i] = max[i+1];
            }
        }else{
            max[i] = a[i].cnt;
        }
    }
    int ans = 0;
    rep(i, 0, n){
        //printf("%d ", a[i].cnt);
        if(ans < a[i].cnt){
            ans = a[i].cnt;
        }
    }
    printf("%d", ans);

    return 0;
}

Measured memory_bytes: 4860
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pill pair<ll,ll>
#define f first
#define s second
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
const ll N = 3e3 + 1;
ll n,k;
string a,b;
ll dp[N][N];
pill vos[N][N];
int main() {
	speed;
	cin >> a >> b;
	n = a.size() , k = b.size();
	for(int i = 1 ; i <= n ; i++){
		for(int j = 1 ; j <= k ; j++){
			if(a[i - 1] == b[j - 1])
				dp[i][j] = dp[i - 1][j - 1] + 1,vos[i][j] = {i - 1,j - 1};
			else
				if(dp[i - 1][j] > dp[i][j - 1])
					dp[i][j] = dp[i - 1][j],vos[i][j] = {i - 1,j};
				else
					dp[i][j] = dp[i][j - 1],vos[i][j] = {i , j - 1};
		}
	}
	string ans;
	pill x = {n,k}, s = {0,0};
	while(x != s){
		pill y = vos[x.f][x.s];
		if(dp[x.f][x.s] != dp[y.f][y.s])
			ans += a[x.f - 1];
		x = y;
	}
	reverse(ans.begin(),ans.end());
	cout << ans;
}
/*
Timus : 288471KD
Atcoder : Zhabka
Codeforces : Zhabka
mail : dzhon.snoudin@mail.ru
*/



Measured memory_bytes: 211328
/*#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#pragma GCC target("avx2")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <cassert>
#include <random>
#include <deque>
#include <bitset>
#include <string>
#include <queue>
#include <complex>

//#define int long long

#define mp(a, b) make_pair(a, b)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

#define endl '\n'


using namespace std;
typedef long long ll;
typedef long double ld;

mt19937 mrand(random_device{}());

const double PI = acos((double)-1);
const double eps = 1e-7;
const ll inf0 = 1023 * 1024 * 1024;
const ll inf = inf0 * inf0;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;

void solve();
void scan();

signed main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#endif
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	cout << fixed; cout.precision(15);
	solve();
	return 0;
}

void solve() {
	string s; cin >> s;
	if (s == "ABC") cout << "ARC\n";
	else cout << "ABC\n";
	return;
}

Measured memory_bytes: 3648
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef double ld;
const long long INF=(1LL<<62);
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
const ll MOD = 4000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
}
ll gcd(ll a,ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

long long lcm(long long a,long long b){
	return a/gcd(a,b)*b;
}

int main(){
	init();
	ll N,M;cin>>N>>M;
	vector<ll>A(N);
	ll num=1;
	for(int i=0;i<N;i++){
		cin>>A[i];
		A[i]/=2;
		num=lcm(num,A[i]);
		if(num>M){
			cout<<0<<endl;
			return 0;
		}
	}
	bool isOK=true;
	for(int i=0;i<N;i++){
		ll x=num/A[i];
		if(x%2==0)isOK=false;
	}
	if(!isOK)cout<<0<<endl;
	else cout<<(M/num+1)/2<<endl;
}


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

int main () {
  string s;
  cin >> s;
  
  int a = -1;
  int z = -1;
 
  for (int i = 0;i<s.size();i++) {
    if (s.at(i)=='A') {
      a = i;
      break;
    }
  }
  for (int i = s.size() -1;i>a;i--) {
    if (s.at(i)=='Z') {
      z = i;
      break;
    }
  }
  
  cout << z-a+1 << endl;
  
}

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

int main(){
	double a,b,c,d,e,f,x,y;
	while(cin>>a>>b>>c>>d>>e>>f){
		x = (c*e-b*f)/(a*e-b*d);
		y = (d*c-a*f)/(b*d-a*e);

		if(x == 0){x = 0;}
		if(y == 0){y = 0;}

		printf("%.3lf %.3lf\n",x,y );
	}
}

Measured memory_bytes: 1236
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>

using namespace std;

typedef long long ll;

const int num[19]={1,2,3,4,5,6,7,8,9,10,9,8,7,6,5,4,3,2,1};

map <ll,ll> mp;
int mx1,mx2;
ll mulv[20],powd[20];

void dfs1(int d,ll s1,ll s2) {
  if (d>mx1) {
  	mp[s1]+=s2;
  	return;
  }
  for(int i=-9;i<=9;i++) {
  	int t=num[i+9]-(d==1);
  	dfs1(d+1,s1+i*mulv[d],s2*t);
  }
}

ll sum,n;

void dfs2(int d,ll s1,ll s2) {
  if (d>mx2) {
  	if (mp.count(n-s1)) sum+=s2*mp[n-s1];
  	return;
  }
  for(int i=-9;i<=9;i++) {
  	int t=num[i+9]-(d==1);
  	dfs2(d+1,s1+i*mulv[d],s2*t);
  }
}

int main() {
  scanf("%lld",&n);
  int cnt=0;
  for(ll i=n;i;i/=10) cnt++;
  powd[0]=1;
  for(int i=1;i<=2*cnt;i++) powd[i]=powd[i-1]*10;
  ll ans=0;
  for(int i=cnt;i<=2*cnt;i++) {
  	mp.clear();
  	sum=0;
  	mx2=(i>>1);mx1=(mx2>>1);
  	for(int j=1;j<=mx2;j++) mulv[j]=powd[i-j]-powd[j-1];
  	dfs1(1,0,1);
  	dfs2(mx1+1,0,1);
  	if (i&1) sum*=10;
  	ans+=sum;
  }
  printf("%lld\n",ans);
  return 0;
}

Measured memory_bytes: 8448
#include<cstdio>
#include<algorithm>

int main(void)
{
	int n, m;

	while(scanf("%d%d", &n, &m)==2)
	{
		int h=1, t=n;
		for(int i=0;i<m;i++)
		{
			int l, r;

			scanf("%d%d", &l, &r);

			h=std::max(h, l);
			t=std::min(t, r);
		}
		int ans=std::max(t-h+1, 0);

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


Measured memory_bytes: 128
import java.io.*;
import java.util.*;

class Main {
    static Scanner scanner = new Scanner();
    static long mod = 1000000007;

    public static void main(String[]$) throws IOException {
        int n = scanner.nextInt();
        char[] s = scanner.next().toCharArray();
        int m = 2 * n;

        boolean[] b = new boolean[m];
        long c = 0, d = 0;
        for (int i = 0; i < m; i++) {
            if ((s[i] == 'B') == (c % 2 == 0)) {
                b[i] = true;
                c++;
                d++;
            } else {
                c--;
            }
        }
        if (d != n) {
            System.out.println(0);
            return;
        }
        c = 0;
        long ans = 1;
        for (int i = m - 1; i >= 0; i--) {
            if (b[i]) {
                ans = ans * c % mod;
                c--;
            } else {
                c++;
            }
        }
        long fac = 1;
        for (int i = 2; i <= n; i++) {
            fac = fac * i % mod;
        }
        System.out.println(ans * fac % mod);
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }
}

Measured memory_bytes: 27220
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using Graph = vector<vector<int>>;
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
const int inf = 1e8;

int main() {
    int n;
    cin >> n;
    Graph g(n);
    rep(i,n) {
        int id,k;
        cin >> id >> k;
        id--;
        rep(j,k) {
            int v;
            cin >> v;
            v--;
            g[id].push_back(v);
        }
    }
    vector<int> d(n);
    rep(i,n) d[i] = inf;
    d[0] = 0;
    queue<int> q;
    q.push(0);
    while (!q.empty()) {
        int v = q.front(); q.pop();
        for (int n_v: g[v]) if (chmin(d[n_v],d[v]+1)) q.push(n_v);       
    };
    rep(i,n) if (d[i] == inf) d[i] = -1;
    rep(i,n) cout << i+1 << " " << d[i] << endl;
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
using ll = long long;


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

    int ans = 0;
    for(int i = 0; i < 1000; i++){
        string pass;
        if(i < 10) pass = "00" + to_string(i);
        else if(i < 100) pass = "0" + to_string(i);
        else pass = to_string(i);
        int cnt = 0;
        for(int j = 0; j < n; j++){
            if(pass[cnt] == s[j]) cnt++;
            if(cnt == 3) break;
        }
        if(cnt == 3) ans++;
    }
    cout << ans << endl;

    return 0;
}


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

int c[5001];
bool dp[5001];
signed main() {
	int a, b; scanf("%d%d", &a, &b);
	int sum = 0;//個数
	for (int d = 0; d < a; d++) {
		int e; scanf("%d", &e);
		if (e<b) {
			c[sum] = e;
			sum++;
		}
	}
	sort(c, c + sum);
	c[sum] = 1 << 29;
	sum++;
	int s = -1, g = sum-1;//[s,g) ぎりぎり必要なカード
	while (g - s > 1) {
		int d = (s + g) / 2;
		memset(dp, false, sizeof(dp));
		dp[0] = true;
		for (int e = 0; e < sum; e++) {
			if (d == e)continue;
			for (int f = b; f >= c[e]; f--) {
				if (dp[f - c[e]])dp[f] = true;
			}
		}
		bool K = false;
		for (int i = b - c[d]; i < b; i++) {
			if (dp[i])K = true;
		}
		if (!K) {//不必要
			s = d;
		}
		else {
			g = d;
		}
	}
	cout << g << endl;
}

Measured memory_bytes: 256