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

using namespace std;

#define LL long long
const int N = 1e5 + 100;

int n,a[N],maxx,ans;

int main() {
    scanf("%d",&n);
    for(int i = 1 ; i <= n ; i++) 
        scanf("%d",&a[i]);
    for(int i = 2 ; i <= n ; i++) {
        if(a[i] <= a[i - 1]) {
            maxx ++;
            ans = max(maxx,ans);
        } else maxx = 0;
    }
    printf("%d",ans);
    //system("pause");
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pb          emplace_back
#define ll          long long
#define fi          first
#define se          second
#define mp          make_pair
#define mt          make_tuple
#define int         int64_t

using namespace std;

typedef pair<int, int> pii;
typedef tuple<int, int, int, int> TEdge;
const int N = int(1e5) + 2;
const int logN = 17;

int p[N][logN + 1], d[N], h[N];
int u, v, x, y, n, Q;
int num[N], sum[N], ans[N];
vector<int> a[N];
vector<pii> q[N];
TEdge e[N];
pii qq[N];

void DFS(int u) {
    for(int i = 1; i <= logN; ++i) p[u][i] = p[p[u][i - 1]][i - 1];
    for(int id: a[u]) {
        int x = get<0>(e[id]), y = get<1>(e[id]);
        x = x ^ y ^ u;
        if(x == p[u][0]) continue;
        h[x] = h[u] + 1, p[x][0] = u;
        d[x] = d[u] + get<3>(e[id]);
        DFS(x);
    }
}

int LCA(int u, int v) {
    if(h[u] < h[v]) swap(u, v);
    for(int i = logN; i >= 0; --i)
        if(h[u] - (1 << i) >= h[v]) u = p[u][i];
    if(u == v) return u;
    for(int i = logN; i >= 0; --i)
        if(p[u][i] != p[v][i]) u = p[u][i], v = p[v][i];
    return p[u][0];
}

void GetAns(int u) {
    for(pii query: q[u]) {
        int id = query.fi, add = query.se;
        int cost = d[u] + num[qq[id].fi] * qq[id].se - sum[qq[id].fi];
        ans[id] += cost * add;
    }
    for(int id: a[u]) {
        int x = get<0>(e[id]), y = get<1>(e[id]);
        x = x ^ y ^ u;
        if(x == p[u][0]) continue;
        ++num[get<2>(e[id])];
        sum[get<2>(e[id])] += get<3>(e[id]);
        GetAns(x);
        --num[get<2>(e[id])];
        sum[get<2>(e[id])] -= get<3>(e[id]);
    }
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    #define Task        "test"
    if(fopen(Task".inp", "r")) {
        freopen(Task".inp", "r", stdin);
        freopen(Task".out", "w", stdout);
    }
    cin >> n >> Q;
    for(int i = 1; i < n; ++i) {
        cin >> u >> v >> x >> y;
        e[i] = mt(u, v, x, y);
        a[u].pb(i); a[v].pb(i);
    }
    p[1][0] = 1; DFS(1);
    for(int i = 1; i <= Q; ++i) {
        cin >> x >> y >> u >> v;
        qq[i] = mp(x, y);
        q[LCA(u, v)].pb(mp(i, -2));
        q[u].pb(i, 1); q[v].pb(i, 1);
    }
    GetAns(1);
    for(int i = 1; i <= Q; ++i) cout << ans[i] << '\n';
}


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

int main()
{
  int n;cin>>n;
  map<int,int>m;
  int t;
  for(int i=1;i<n;i++){cin>>t;m[t]++;}
  
  for(int i=1;i<=n;i++){cout<<m[i]<<endl;}
}


Measured memory_bytes: 12988
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int N,M;
  cin >> N >> M;
  if(abs(N-M)>1)
  {
    cout << 0 << endl;
    return 0;
  }
  ll ans = 1;
  if((N+M)%2==0)
  {
    for(int i=1;i<N+1;i++)
    {
      ans *= i;
      ans %= P;
      ans *= i;
      ans %= P;
    }
    ans *= 2;
    ans %= P;
    cout << ans << endl;
  }
  else
  {
    if(M<N)
    {
      swap(M,N);
    }
    for(int i=1;i<N+1;i++)
    {
      ans *= i;
      ans %= P;
      ans *= i;
      ans %= P;
    }
    ans *= M;
    ans %= P;
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 3608
#include<stdio.h>
#define MAX 100005
#define NIL -1

struct NODE{
  int parent,left,right;
};
struct NODE T[MAX];
int n,D[MAX],H[MAX];

void setDepth(int u, int d){
  if(u == NIL)return;
  D[u] = d;
  setDepth(T[u].left,d + 1);
  setDepth(T[u].right,d + 1);
}

int setHeight(int u){
  int h1 = 0,h2 = 0;
  if(T[u].left != NIL)h1 = setHeight(T[u].left) + 1;
  if(T[u].right != NIL)h2 = setHeight(T[u].right) + 1;
  return H[u] = (h1 > h2 ? h1 : h2);
}

int getSibling(int u){
  if(T[u].parent == NIL)return NIL;
  if(T[T[u].parent].left != u && T[T[u].parent].left != NIL)return T[T[u].parent].left;
  if(T[T[u].parent].right != u && T[T[u].parent].right != NIL)return T[T[u].parent].right;
  return NIL;
}

void print(int u){
  int deg = 0;
  printf("node %d: ",u);
  printf("parent = %d, ",T[u].parent);
  printf("sibling = %d, ",getSibling(u));
  if(T[u].left!= NIL)deg++;
  if(T[u].right!= NIL)deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[u]);
  printf("height = %d, ",H[u]);

  if(T[u].parent == NIL)printf("root\n");
  else if(T[u].left == NIL && T[u].right == NIL)printf("leaf\n");
  else printf("internal node\n");
}

int main(){
  int v,l,r,root = 0,i;
  scanf("%d",&n);
  for(i = 0 ; i < n ; i++){
    T[i].parent = NIL;
  }
  for(i = 0 ; i < n ; i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].left = l;
    T[v].right = r;
    if(l != NIL)T[l].parent = v;
    if(r != NIL)T[r].parent = v;
  }

  for(i = 0 ; i < n ; i++){
    if(T[i].parent == NIL)root = i;
  }

  setDepth(root,0);
  setHeight(root);
  for(i = 0 ; i < n ; i++){
    print(i);
  }

  return 0;
}



Measured memory_bytes: 2100
#include<bits/stdc++.h>
#define ll 	 long long
#define pb push_back
#define mp make_pair
using namespace std;

#define mmm    ios_base::sync_with_stdio(false);cin.tie(NULL);

int main() {

string s; cin>>s;

int n= s.size();

if(s[n-1]=='s') {
	for(int i=0; i<n; i++)
	cout<<s[i];
	cout<<"es\n";
}

else{
	for(int i=0; i<n; i++)
	cout<<s[i];
	cout<<"s\n";	
}
    return 0;
}


Measured memory_bytes: 3624
N, K = gets.split.map(&:to_i)
h = []
N.times do |i|
  h[i] = gets.to_i
end
h = h.sort

ans = 10**9
(N-K+1).times do |i|
  ans = [ h[i+K-1] - h[i], ans].min
end

puts ans

Measured memory_bytes: 4676
#include<bits/stdc++.h>
using namespace std;
int mat[3001][3001];
bool rico[3001][3001];
int main(){
	#ifdef EVAL
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	string a,b;
	cin>>a>>b;
	if(a.size()>b.size())swap(a,b);
	for(int i=1;i<b.length()+1;i++){
		for(int j=1;j<a.length()+1;j++){
			if(b[i-1]==a[j-1]){
				mat[i][j]=mat[i-1][j-1]+1;
				rico[i][j]=1;
			}
			else
			{
				mat[i][j]=max(mat[i-1][j],mat[i][j-1]);
				rico[i][j]=0;
			}
		}
	}
	if(mat[b.length()][a.length()]==0)cout<<" ";
	else{
		stack<char>rico2;
		int x=0;
		for(int i=b.length();i>=1;i--){
			for(int j=a.length()-x;j>=1;j--){
				if(rico[i][j]==1){
					rico2.push(a[j-1]);
					x=a.length()-j+1;
					break;
				}else{
					if(mat[i][j-1]<mat[i][j])break;
				}
			}
		}
		while(!rico2.empty()){
			cout<<rico2.top();
			rico2.pop();
		}
	}
}

Measured memory_bytes: 44288
//#define _GLIBCXX_DEBUG//実行時、何も出なかったらこれを使う
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<numeric>
#include<climits>
#include<limits>//
#include <stdio.h>//
#include<cmath>
#include<iomanip>

using namespace std;

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

typedef long long ll;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

int dy[] = {1,0,-1,0}; //次に行くところ
int dx[] = {0,1,0,-1}; //s上に同じ

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  vector<int> a(n);

  for (int i = 0; i < n; i++){
    cin >> a[i];
    if (a[i] % 2 == 0 &&a[i] % 3 != 0 && a[i] % 5 != 0){
      cout << "DENIED\n";
      return 0;
    }
  }
  
  cout << "APPROVED\n";
  
  return 0;
}

Measured memory_bytes: 3684
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n,ans{};
    cin>>n;
    vector<int> a(n);
    for(auto&i:a) cin>>i;
    for(int i{};i<n;i+=2) if(a[i]%2==1) ++ans;
    cout<<ans<<'\n';
}

Measured memory_bytes: 3624
#include<iostream>
using namespace std;
int n,q,l,r,p,cnt[100005];
string s;
main(){
    cin>>n>>q>>s;
    for(int i=1;i<n;i++){
        if(s[i-1]=='A' && s[i]=='C')p++;
        cnt[i]=p;
    }
    for(int i=0;i<q;i++){
        cin>>l>>r;
        cout<<cnt[r-1]-cnt[l-1]<<endl;
    }
}

Measured memory_bytes: 1408
#include<stdio.h>

int main(void){
	int x;
	int i = 0;
	
	while(i<10000){
		scanf("%d", &x);
		if(x == 0){
			break;
		}
		printf("Case %d: %d\n", i+1, x);
		i++;
	}
	
	return 0;

}


Measured memory_bytes: 1992
'use strict'
function Main(input) {
  input = input.split(" "); 
  let apple = parseInt(input[0], 10);
  let piece = parseInt(input[1], 10);
  let sum = Math.floor((apple*3 + piece)/2);
  console.log('%s',sum);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main()
{
    string s;
    cin >> s;
    int ans = 0;
    rep(i, s.length())
    {
        if (s[i] == '2')
            ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

int main() {
    int N;
    scanf("%d", &N);
    int a[N];
    
    for (int i = 0; i < N; i++)
    {
        scanf("%d", &a[i]);
    }

    int count = 0;
    int point = 1;

    for (int i = 0; i < N; i++) {
        if ( a[i] == point ) {
            point++;
        } else {
            count++;
        }
    }

    if ( point == 1 ) {
        printf("-1\n");
    } else {    
    printf("%d\n", count);
    }

    return 0;
}

Measured memory_bytes: 896
#include <stdio.h>
#include <stdlib.h>
int min(int x, int y){return x<y?x:y;}

int n,A,B,C,l[8];

int search(int cur,int a,int b,int c){
//何番目の棒を見たか,Aの現在,B,C
	if(cur == n){//全部見たら
		int cost = abs(a-A) + abs(b-B) + abs(c-C) - 30;
		//伸縮延長の計算
		if(a==0 || b==0 || c==0) return 1000000000;
		else return cost;
	}
	int cost1 = search(cur+1,a,b,c);
	//使わない
	int cost2 = search(cur+1,a+l[cur],b,c) + 10;
	//cur番目のをAの材料にして合成
	int cost3 = search(cur+1,a,b+l[cur],c) + 10;
	int cost4 = search(cur+1,a,b,c+l[cur]) + 10;
	return min(min(cost1,cost2),min(cost3,cost4));
	
}

int main(void){
	int i;
	scanf("%d %d %d %d",&n,&A,&B,&C);
	for(i=0;i<n;i++)scanf("%d",&l[i]);
	printf("%d",search(0,0,0,0));
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define ALL(x) begin(x), end(x)
using namespace std;

vector<pair<int, int> > solve(int n, int m, const vector<vector<int> > & g) {
    // tree expansion
    vector<int> unexpand;
    vector<int> parent;
    unordered_set<int64_t> used;
    vector<int> next(n);
    function<void (int)> expand = [&](int i) {
        int a = unexpand[i];
        while (next[a] < g[a].size()) {
            int b = g[a][next[a] ++];
            int64_t e = max<int64_t>(a, b) * n + min<int64_t>(a, b);
            if (not used.count(e)) {
                used.insert(e);
                int j = unexpand.size();
                unexpand.push_back(b);
                parent.push_back(i);
                expand(j);
            }
        }
    };
    constexpr int unexpand_root = 0;
    constexpr int root = 0;
    unexpand.push_back(unexpand_root);
    parent.push_back(-1);
    expand(root);
    assert (unexpand.size() == m + 1);
    assert (parent.size() == m + 1);

    // decide from leaves
    vector<pair<int, int> > edges;
    vector<int> outdegree(m + 1);
    REP3R (i, 1, m + 1) {
        if (outdegree[i] % 2 == 0) {
            ++ outdegree[parent[i]];
            edges.emplace_back(unexpand[parent[i]], unexpand[i]);
        } else {
            ++ outdegree[i];
            edges.emplace_back(unexpand[i], unexpand[parent[i]]);
        }
    }
    if (outdegree[root] % 2 == 1) {
        edges.clear();
    }
    assert (edges.empty() == (m % 2 == 1));
    return edges;
}

int main() {
    int n, m; cin >> n >> m;
    vector<vector<int> > g(n);
    REP (i, m) {
        int a, b; cin >> a >> b;
        -- a; -- b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    auto edges = solve(n, m, g);
    if (edges.empty()) {
        cout << -1 << endl;
    } else {
        for (auto e : edges) {
            cout << e.first + 1 << ' ' << e.second + 1 << endl;
        }
    }
    return 0;
}


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

using namespace std;


#define si(a) scanf("%d", &a)
#define sii(a, b) scanf("%d %d", &a, &b)
#define siii(a, b, c) scanf("%d %d %d", &a, &b, &c)

#define sl(a) scanf("%I64d", &a)
#define sll(a, b) scanf("%I64d %I64d", &a, &b)
#define slll(a, b, c) scanf("%I64d %I64d %I64d", &a, &b, &c)

#define outi(a) printf("%d\n", a)
#define outii(a, b) printf("%d %d\n", a, b)
#define outiii(a, b, c) printf("%d %d %d\n", a, b, c)

#define outl(a) printf("%I64d\n", a)
#define outll(a, b) printf("%I64d %I64d\n", a, b)
#define outlll(a, b, c) printf("%I64d %I64d %I64d\n", a, b, c)

#define cel(n, k) ((n-1)/k+1)
#define sets(a) memset(a, -1, sizeof(a))
#define clr(a) memset(a, 0, sizeof(a))


#define fr(i, n) for(ll i=0; i<n;i++)
#define fr1(i, n) for(ll i=1; i<=n;i++) 

#define readf(f) freopen(f, "r", stdin)
#define writef(f) freopen(f, "w", stdout)

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(v) v.begin(), v.end()

template< class T > T sq(T x) { return x * x; }
template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }

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


int main()
{
    // #ifndef LOCAL
    // readf("in.txt");
    // writef("out.txt");
    // #endif

    int h, a;
    cin>>h>>a;

    cout<<cel(h,a)<<"\n";


    
    


    return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
r,s,p=map(int,input().split())
#dp=[[0 for i in range(3)]for j in range(n+1)]
t=input()
ans=0
janken={"r":p,"s":r,"p":s}
aiko=[]
for i in range(n):
    if i<k:
        ans+=janken[t[i]]
        aiko.append(False)
    else:
        #print(t[i-k],t[i])
        if t[i-k]!=t[i] or (t[i-k]==t[i] and aiko[i-k]):
            ans+=janken[t[i]]
            aiko.append(False)
        else:
            aiko.append(True)
    #print(ans)
print(ans)

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

long long n,k,cc;
map<long long,map<long long,bool> > maap;

int main(){
	scanf("%lld%lld",&n,&k);
	if(k>(n-1)*(n-2)/2){
		printf("-1\n");
		return 0;
	}
	for(int i = 2;i<=n;i++){
		maap[1][i]=1;
	}
	cc = (n-1)*(n-2)/2 - k;
	for(int i =1;i<=n;i++){
		for(int j = i+1;j<=n;j++){
			if(maap[i][j]==0)cc--;
			maap[i][j] = 1;
			
			if(cc==0) break;
		}
		if(cc==0) break;
	}
	int ans =  0;
	for(auto m:maap){
		for(auto n:maap[m.first]){
			ans++;
		}
	}
	printf("%d\n",ans);
	for(auto m:maap){
		for(auto n:maap[m.first]){
			printf("%d %d\n",m.first,n.first);
		}
	}
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using lint = long long int;
using ulint = unsigned long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T, class U> void assign(V<T>& v, int n, const U& a) { v.assign(n, a); }
template<class T, class... Args> void assign(V<T>& v, int n, const Args&... args) { v.resize(n); for (auto&& e : v) assign(e, args...); }


int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  int n; cin >> n;
  lint res = 1;
  for (int i = 1; i <= n; ++i) res *= i;
  cout << res << '\n';
}


Measured memory_bytes: 3072
// #include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include <stack>
#include <random>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template<typename T>
void vdeb(std::vector<T> &da) {
    for (int i = 0;i < da.size();i++) {
        if (i == da.size() - 1) std::cout << da[i];
        else std::cout << da[i] << ' ';
    }
    std::cout << '\n';
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
    for (int i = 0;i < da.size();i++) {
        std::cout << i << ' ';
        vdeb(da[i]);
    }
    std::cout << '\n';
}

using namespace std;

struct Node{
    bitset<26> mm;
    ll co;
    char c;
    vector<Node> child;
    Node(char _c):c(_c){
        co = 0;
        mm = bitset<26>();
    }
    void gen(string &s, int now, char &x) {
        co += 1;
        if(now == s.size()) mm[x-'a'] = 1;
        else {
            rip(i, child.size(), 0) {
                if(child[i].c == s[now]) {
                    child[i].gen(s, now+1, x);
                    return;
                }
            }
            child.push_back(Node(s[now]));
            child.back().gen(s, now+1, x);
        }
    }
    ll dfs(vector<ll> cnt) {
        ll ret = 0;
        if(c != '$') {
            ret += cnt[c-'a']*co;
            cnt[c-'a'] = 0;
        }
        rip(i, 26, 0) if(mm[i]) ret += cnt[i];
        rip(i,26,0) cnt[i] += mm[i];
        // cout << c << " ";vdeb(cnt);
        rip(i, child.size(),0) ret += child[i].dfs(cnt);
        return ret;
    }
    void deb(int depth) const{
        rip(i,depth,0) printf("  ");
        cout << c MM mm << endl;
        rip(i, child.size(), 0) child[i].deb(depth+1);
    }
};

int main() {
    int n; cin >> n;
    vector<string> da(n);
    vector<pair<string, char>> li(n);
    rip(i,n,0) {
        cin >> da[i];
        da[i].push_back('$');
        reverse(all(da[i]));
        li[i] = {da[i].substr(0, da[i].size()-1), da[i].back()};
    }
    Node root('$');
    // rip(i,n,0) cout << li[i].first MM li[i].second << '\n';
    rip(i,n,0) {
        root.gen(li[i].first, 1, li[i].second);
    }
    // root.deb(0);
    cout << root.dfs(vector<ll>(26, 0)) << endl;
}

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

/*                          
---------------------------------------------------------------
Aditya Kumar mishra
---------------------------------------------------------------
*/

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define len(s) s.length()
#define forp(i, a, b) for (int i = a; i <= b; i++)
#define rep(i, n) for (int i = 0; i < n; i++)
#define ren(i, n) for (int i = n - 1; i >= 0; i--)
#define forn(i, a, b) for (int i = a; i >= b; i--)
#define on cout << endl
#define o2(a, b) cout << a << " " << b
#define os cout << " "
#define all(v) v.begin(), v.end()
#define mem(n, m) memset(n, m, sizeof(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define sii set<int>
#define us unordered_set<int>
#define um unordered_map<int, int>
#define sll set<long long>
#define vii vector<int>
#define vll vector<long long>
#define mll map<long long, long long>
#define lob lower_bound
#define upb upper_bound
#define ret return 0
#define present(s, x) (s.find(x) != s.end())
#define cpresent(s, x) (find(all(s), x) != s.end())
#define ford(container, it) for (__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define fors(container, it, a, b) for (__typeof(container.begin()) it = a; it != b; it++)

#define boost ios_base::sync_with_stdio(0)
#define MOD 1000000007
#define EPSILON 1e-9
#define PI 3.14159265358979323846
#define inf 999999999999999999
#define siz 100001
#define SIZ 1000001
#define SIZE 200001

typedef long long ll;
typedef long double ldo;
typedef double db;
using namespace std;
#define pqb priority_queue<int>
#define pqs priority_queue<int, vi, greater<int>>
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)

void c_p_c()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int main()
{
    c_p_c();
    string s;
    cin >> s;
    int ans = 0, cnt = 0;
    for (int i = 0; i < (int)len(s); i++)
    {
        if (s[i] == 'R')
        {
            cnt++;
        }
        else
        {
            ans = max(cnt, ans);
            cnt = 0;
        }
    }
    ans = max(cnt, ans);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>

int main()
{
   int x,y,temp,r;
   
   scanf("%d %d",&x,&y);
   
   if(x<y)
    {
	 temp = x;
	 x = y;
	 y = temp;
    }
   while(y>0)
    {
     r = x % y;
	 x = y;
	 y = r;
    }
	
	printf("%d\n",x);
	
	return(0);
}

Measured memory_bytes: 592
#include<iostream>
using namespace std;
int main()
{
  int S,h,m,s; 
  cin>>S;
  h=S/3600;
  s=S%3600;
  m=s/60;
  s=s%60;
  cout<<h<<":"<<m<<":"<<s<<endl;
 return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;
string s1,s2;

int main()
{
//	int a,b,c;cin>>a>>b>>c;
//	cout<<max(a,max(b,c))-min(a,min(b,c));

	cin>>s1>>s2;int l1=s1.size(),l2=s2.size();
	for(int i=0;i<l1;i++)
	{
		bool f=true;
		for(int j=0;j<l1;j++)
			if(s2[j]!=s1[(i+j)%l1]) f=false;
		if(f) return puts("Yes"),0;
	}
	puts("No");
	return 0;
}

Measured memory_bytes: 256
import math

N,K = list(map(int, input().split()))
S = input()

happiness = 0
unh = 0

for i in range(N-1):
    if S[i] == 'L' and S[i+1] == 'L':
        happiness +=1
    elif S[i] == 'R' and S[i+1] == 'R':
        happiness +=1
    else:
        unh +=1

if K < math.ceil(unh/2):
    happiness += 2*K
else:
    happiness = N-1

print(happiness)

Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define inf 1000000000000000007
#define eps 0.00000001
#define pi 3.141592653589793
#define pii pair<int,int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti multiset <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define stp setprecision(20)//use fixed before stp
#define endl '\n'
int main()
{  
    FAST
    ll n,k;
    cin>>n>>k;
    n-=k;
    if(k==1)
        cout<<0;
    else
    cout<<n;
}

Measured memory_bytes: 256
AB = [[int(i) for i in input().split()] for i in range(3)] 
A =[]
for i in range(3):
    A.append(AB[i][0])
    A.append(AB[i][1])
A.sort()
flag = 0
X = 0
tmp = 0
for i in A:
    if tmp == i:
        flag += 1
        if flag == 2:
            X = -1
    else:
        flag=0
    tmp = i

if X == -1:
    print("NO")
else:
    print("YES")

Measured memory_bytes: 3064
<?php
// Your code here!
$count=0;
$a=trim(fgets(STDIN));
$b=trim(fgets(STDIN));
$array = explode(" ",$b);
for($i=1;$i<=$a;$i++){
    if($i%2!==0){
        if($array[$i-1]%2!==0){
            $count++;
        }
    }
}
echo $count;
?>

Measured memory_bytes: 16248
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <queue>
#include <algorithm> // sort
#include <math.h>

#define DEBUG 0

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
                    //999999997000000003
                    //1000000000000000000

using namespace std;

int solve(){
    ll N,M,K;
    cin >> N >> M >> K;
    vector <ll> a(N);
    vector <ll> b(M);
    REP(i, N)cin >> a[i];
    REP(i, M)cin >> b[i];

    vector <ll> a_l_Sum(N+1,0);

    for(int i = 0; i < N; ++i)
    {
        a_l_Sum[i+1] = a[i] + a_l_Sum[i];
    }

    vector <ll> b_l_Sum(M+1,0);

    for(int i = 0; i < M; ++i)
    {
        b_l_Sum[i+1] = b[i] + b_l_Sum[i];
    }


    //なぜかdequeでつなげてたがそんなはずはなかった

    //a[0]～a[n-1] + 
    //b[0]～b[m-1]の最善をみつける

    //a[0]とb[0]は固定
    int res = 0;
    //Aの机の本を何冊読むか
    for(int i = 0; i <= N ; ++i)
    {
        //0冊のとき
        if(a_l_Sum[i] + b_l_Sum[0] <= K)
        {
                res = max(res, i);
        }
        int l = 0;
        int r = M+1;
        while (l+1 < r)
        {
            int mid = (l+r)/2;
            if(a_l_Sum[i] + b_l_Sum[mid] <= K)
            {
                l = mid; 
                res = max(res, i + mid);
            }
            else r = mid;
        }
    }

    cout << res << endl;

    return 0;
}

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


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

typedef long long ll;
ll n, k, d[55][2];
int main()
{
	ll i, a;
	cin >> n >> k;
	d[0][0] = 1;
	for (i = 1; i <= n; i++) {
		scanf ("%lld", &a);
		d[i][0] = d[i - 1][0];
		d[i][1] = d[i - 1][1];
		d[i][0] += d[i - 1][a % 2];
		d[i][1] += d[i - 1][1 - a % 2];
	}
	cout << d[n][k % 2];
    return 0;
}


Measured memory_bytes: 256
using namespace std;
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include<stack>

#define MOD1e9 1000000007
#define INT_MAX       2147483647
#define INT_MIN     (-2147483647 - 1)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define rep(c) for(int i = 0; i <(c); ++i)
#define rrep(n) for(int i = (n) ; i >=0 ; --i)
#define fora(i, s, c) for(int i = (s); i < (c); ++i)
#define forr(i, s, c) for(int i = (s); i > (c); --i)
#define endl "\n"
#define ret(n) return n
#define pb push_back
#define eb emplace_back
#define ff first;
#define ss second;
#define mp make_pair;
#define all(p) p.begin(),p.end()
#define mid(s,e) (s+(e-s)/2)
//Typedefs
typedef long long ll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
typedef priority_queue<int> pqint;
typedef priority_queue<ll> pqll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<long> vl;
typedef vector<vl> vvl;
typedef vector<bool> vb;
//Testcase start
#define tcs() int testcases; cin >> testcases; while(testcases--)
//Functions
inline int twop(int n) { return 1 << n; }
template<class T> T gcd(T a, T b) { if (b == 0)return a; return gcd(b, a % b); }
template<class T> T lcm(T a, T b) { return (a * b) / gcd(a, b); }
ll ctnum(char c) { if (c == '0') return 0; else if (c == '1') return 1; else if (c == '2') return 2; else if (c == '3') return 3; else if (c == '4') return 4; else if (c == '5') return 5; else if (c == '6') return 6; else if (c == '7') return 7; else if (c == '8') return 8; else if (c == '9') return 9; }
ll power(ll n, ll exp , ll MOD)
{
	if (exp == 0)
		return 1;
	ll temp = power(n, exp / 2 ,MOD);
	if (exp % 2 == 0)
		return ((temp % MOD) * (temp % MOD)) % MOD;
	else
		return ((n % MOD) * (temp % MOD) * (temp % MOD)) % MOD;
}
ll mod(int x, int m)
{
	return ((x % m + m) % m);
}

ll countways(int x, int y, vvi& arr, vvll& dp)
{
	if (x >= arr.size() || y >= arr[0].size() || arr[x][y] == 1)
		return 0; //cannot go further

	if (x == arr.size() - 1 && y == arr[0].size() - 1)
		return 1; //reached

	ll &ans = dp[x][y];
	if (ans != -1)
		return ans;
	ll moveright = countways(x, y + 1, arr, dp);
	ll movedown = countways(x + 1, y, arr, dp);
	ans = mod(moveright, MOD1e9) + mod(movedown, MOD1e9);
	ans = mod(ans, MOD1e9);
	return ans;
}
int main()
{
	int x, y;
	cin >> x >> y;
	vvi a(x, vi(y));
	fora(i, 0, x)
	{
		fora(j, 0, y)
		{
			char c;
			cin >> c;
			a[i][j] = (c == '.' ? 0 : 1);
		}
	}
	vvll dp(x, vll(y, -1));
	ll ans = countways(0, 0, a, dp);
	cout << ans;
	ret(0);
}


Measured memory_bytes: 12160
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 200005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

int cs[MAX], arr[MAX];
double prob[1005];

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

    int n, k;

    cin>>n>>k;

    for(int i = 1; i <= 1000; i++){
        double res = 0;
        for(int j = 1; j <= i; j++){
            res += (double) j * (1 / (double) i);
        }
        prob[i] = res;
    }

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

    int Max = 0, idx;
    for(int i = 0; i <= n - k; i++){
        int tx = cs[i+k] - cs[i];
        if(tx > Max){
            Max = tx;
            idx = i;
        }
    }

    double ans = 0;
    for(int i = idx; i < idx + k; i++){
        ans += prob[arr[i]];
    }

    cout<<fixed<<setprecision(10);
    cout<<ans<<endl;

    return 0;
}


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

using namespace std;

const int N = 9;
int memo[N][1 << N] , n;

int solve (int i , int msk) {
    if (i == n)
        return 1;

    int &ret = memo[i][msk];
    if (~ret)
         return ret;

    ret = 0;
    for (int j = 0 ;j < n ;j++)
        if (!(msk & (1 << j)))
            ret += solve(i + 1 , msk | (1 << j));

    return ret;
}

int get(vector<int> &a) {
    auto fact = [](int n) {
        int ret = 1;
        for (int i = 2 ;i <= n ;i++)
            ret *= i;
        return ret;
    };

    int less = 0 , msk = 0;
    for (int i = 0 ;i < n ;i++) {
        for (int j = 0 ;j < a[i] ;j++)
            if (!(msk & (1 << j)))
                less += solve(i + 1 , msk | (1 << j));
        msk |= 1 << a[i];
    }

    return less + 1;
}

int main() {
    cin >> n;

    vector<int> a(n) , b(n);
    for (int i = 0 ;i < n ;i++) {
        cin >> a[i];
        a[i]--;
    }

    for (int i = 0 ;i < n ;i++) {
        cin >> b[i];
        b[i]--;
    }

    memset(memo , -1 , sizeof memo);
    cout << abs(get(a) - get(b));
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int H, W;
    int i, j, k;

    while (1)
    {
        scanf("%d %d", &H, &W);
        if (H == 0 && W == 0)
            break;

        for (i = 0; i < H; i++)
        {
            for (j = 0; j < W; j++)
            {
                if (i == 0 || i == H - 1 || j == 0 || j == W - 1)
                {
                    printf("#");
                }
                else
                {
                    printf(".");
                }
            }
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}


Measured memory_bytes: 2684
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;


public class Main{
	
	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    }
	static long INF = (Long.MAX_VALUE/2);
	public static void main(String[] args) 
	{
		OutputStream outputStream = System.out;
        FastReader sc = new FastReader();
        PrintWriter out = new PrintWriter(outputStream);
        
        int n = sc.nextInt();
        int w = sc.nextInt();
        
        long dp[] = new long[n*1000+1];
        Arrays.fill(dp,INF);
        dp[0] = 0;
        for(int i = 0; i < n; i++)
        {	
        	long cw = sc.nextLong();
        	int v = sc.nextInt();
        	for(int val = n*1000-v; val >= 0; val--)
        	{
        		dp[val+v] = Math.min(dp[val+v],dp[val]+cw);
        	}
        }
        long ans = 0;
        for(int val = 0; val <= n*1000; val++)
        {
        	if(dp[val] <= w)
        	{
        		ans = Math.max(ans,val);
        	}
        }
        out.println(ans);
        out.close();
	}

}


Measured memory_bytes: 23764
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        // 入力
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();

        if (x < a) System.out.println(0);
        else System.out.println(10);
    }
}

Measured memory_bytes: 21844
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <sstream>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <deque>
#include <bitset>
using namespace std;

#define rep(i, n) for (int i=0; i<int(n); i++)
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
using ll = long long;


int main() {
	ll h, w;
	cin >> h >> w;

	ll s = h*w;
	ll res = h*w;
	for (ll i=1; i<=h; i++) {
		ll s1 = i * w;
		ll rh = h - i;
		ll s2;
		if (abs(w*(rh/2) - w*(rh-rh/2)) < abs((w/2)*rh - (w-w/2)*rh)) {
			s2 = w*(rh/2);
		}
		else s2 = (w/2)*rh;
		ll s3 = s - s1 - s2;
		res = min(res, max(max(s1, s2), s3) - min(min(s1, s2), s3));
	}

	for (ll i=1; i<=w; i++) {
		ll s1 = i * h;
		ll rw = w - i;
		ll s2;
		if (abs(h*(rw/2) - h*(rw-rw/2)) < abs((h/2)*rw - (h-h/2)*rw)) {
			s2 = h*(rw/2);
		}
		else s2 = (h/2)*rw;
		ll s3 = s - s1 - s2;
		res = min(res, max(max(s1, s2), s3) - min(min(s1, s2), s3));
	}
	cout << res << endl;
}

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

int main() {
  vector<int> v;
  int temp;
  
  while(cin>>temp) v.push_back(temp);
  int mx=0, cnt[101] = {};
  for(int i = 0; i < v.size(); i++) mx = max(mx, ++cnt[v[i]]);
  for(int i = 0; i < 101; i++) if(mx == cnt[i]) cout << i << endl;
  return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
const int64_t INF = (1 << 21);
const int64_t MAXN = 110;
int64_t DP[MAXN][MAXN];

int main()
{
  int64_t N;
  cin >> N;
  vector<int64_t> M(N + 1);
  for (int i = 1; i <= N; i++)
    cin >> M[i - 1] >> M[i];
  for (int i = 1; i <= N; i++)
    DP[i][i] = 0;
  for (int l = 2; l <= N; l++)
  {
    for (int i = 1; i <= N - l + 1; i++)
    {
      int j = i + l - 1;
      DP[i][j] = INF;
      for (int k = i; k <= j - 1; k++)
      {
        DP[i][j] = min(DP[i][j], DP[i][k] + DP[k + 1][j] + M.at(i - 1) * M.at(k) * M.at(j));
      }
    }
  }
  cout << DP[1][N] << endl;
}


Measured memory_bytes: 3184
#include <iostream>
#include<algorithm>
#include<string>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#pragma region Macros
#define int long long
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define LAST(x) x[x.size()-1]
#define ALL(x) (x).begin(),(x).end()
#define swap(a,b) (a += b,b = a - b,a -= b)
#define CEIL(a,b) ((a+b-1)/b)
int GCD(int a, int b) // assuming a,b >= 1
{
	if (a < b)
		swap(a, b);
	if (b == 0)
		return a;
	if (a % b == 0)
		return b;
	return GCD(b, a % b);
}
int LCM(int a, int b) // assuming a,b >= 1
{
	return  a * b / GCD(a, b);
}
double LOG(int a, int b) {
	return log(b) / log(a);
}
inline bool BETWEEN(int x, int min, int max) {
	if (min <= x && x <= max)
		return true;
	else
		return false;
}

using namespace std;
#pragma endregion
signed main() {
	int N;
	cin >> N;
	vector <int> A(N);
	rep(i, N)
		cin >> A[i];
	sort(ALL(A));
	cout << LAST(A) - A[0];
}

Measured memory_bytes: 384
#include<cstdio>
#define LL long long
using namespace std;
const LL mo=1e9+7;
inline void swap(LL *a,LL *b){int t=*a;*a=*b;*b=t;}
LL x,y;
inline void exgcd(LL a,LL b)
{
	if(b==0){x=1; y=0; return;}
	exgcd(b,a%b);
	LL tx=x;
	x=y;
	y=tx-a/b*y;
}
inline LL div(LL num,LL den)
{
	exgcd(den,mo);
	return x%mo*num%mo;
}
inline LL qpow(LL k)
{
	if(k==0)return 1;
	LL t=qpow(k/2);
	if(k&1)return t*t*2%mo;
	else return t*t%mo;
}
int main()
{
	LL n,a,b;
	LL numa,faca,numb,facb;
	scanf("%lld%lld%lld",&n,&a,&b);
	if(a<<1>n)a=n-a;
	if(b<<1>n)b=n-b;
	if(a>b)swap(&a,&b);
	numa=faca=numb=facb=1;
	for(LL i=1;i<=a;++i)
	{
		numa=numa*(n-i+1)%mo;
		faca=faca*i%mo;
		numb=numb*(n-i+1)%mo;
		facb=facb*i%mo;
	}
	for(LL i=a+1;i<=b;++i)
	{
		numb=numb*(n-i+1)%mo;
		facb=facb*i%mo;
	}
	printf("%lld\n",((qpow(n)-div(numa,faca)-div(numb,facb)-1)%mo+mo)%mo);
	return 0;
}

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

using namespace std;

typedef long long ll;

char f(int x,int y){
        return x<y;
    }

int main(){
    ll n,k;
    cin>>n>>k;
    ll arr[n];
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    sort(arr,arr+n,f);
    ll sum=0;
    for(int j=0;j<k;j++){
        sum=sum+arr[j];
    }
    cout<<sum;


    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>  
using namespace std;
#define forn(i, n) for (int i = 0; i < n; i++)
#define re return
#define fi first
#define mp make_pair
#define se second
#define sz(a) (int)a.size()
#define prev previ
#define tm tmmm
#define div divv
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
const ll mod = ll(1e9) + 7;
const int mak = 8, ma = 1024 * 128 * 2;
ll n, ans, we[101][101];
vector<ll> aa;

int main() {
	iostream::sync_with_stdio(0), cin.tie(0);
	//freopen("a.in", "r", stdin);
	/*for (int sm = 0; sm <= 100; sm++) {
		for (int x = 0; x <= sm; x++) {
			int y = sm - x;
			vector<int> cc;
			for (int k = 2; k <= x; k += 2)
				cc.push_back(we[x - k][y + k / 2]);
			for (int k = 2; k <= y; k += 2)
				cc.push_back(we[x + k / 2][y - k]);
			sort(cc.begin(), cc.end());
			we[x][y] = -1;
			int pr = 0;
			forn (i, sz(cc)) {
				if (cc[i] > pr) {
					we[x][y] = pr;
					break;
				}
				pr = cc[i] + 1;
			}
			if (we[x][y] == -1) we[x][y] = pr;
		}
	}
	forn (i, 51) {
		forn (j, 51) {
			cout << we[i][j] << " ";
		}
		cout << "\n";
	} */
	ll x, y;
	cin >> x >> y;
	if (abs(x - y) < 2)
		cout << "Brown";
	else
		cout << "Alice";
	re 0;
}



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

using namespace std;
#define sz(a) int(a.size())
#define ll  long long
#define mod int(1e9+7)
#define endl '\n'
#define ENGZ ios::sync_with_stdio(0);ios_base::sync_with_stdio(0);cin.tie(0) , cout.tie(0) ;
#define pi (acos(-1))
#define S second
#define F first
ll fp(ll n , ll p )
{
    if(p==0)
        return 1;
    if(p==1)
        return n ;
    ll res = fp(n,p/2) ;
    res=((res)*(res)) ;
    if(p%2)
        res=(res*n) ;
    return res ;
}

int main()
{
    ENGZ;
    ll n ;
    cin>> n ;
    ll ans = 0 ;
    vector<ll> v;
    for(ll i=1 ; i<=sqrt(n-1) ; i++)
    {
        if((n-1)%i == 0)
            ans++;
        if((n-1)%i == 0  && i != (n-1)/i)
            ans++;
    }
    ans-- ;
    cerr<<ans <<endl ;
    for(ll i=2 ; i<=sqrt(n) ; i++)
    {
        if(n%i == 0)
            v.push_back(i);

        if(n%i == 0  && i != n/i)
            v.push_back(n/i);
    }
    v.push_back(n);
    //for(auto i:v)cout<<i <<endl ;
    for(int i=0 ; i<sz(v) ; i++)
    {
        ll tmp = n ;
        while(tmp % v[i] == 0)
            tmp /= v[i];
        if(tmp % v[i] == 1)
            ans++ ;
       // cout<<ans <<" " <<v[i] <<endl ;
    }
    cout<<ans <<endl ;
    return 0;
}


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


void solve(long long N, std::vector<long long> A){
    long long Amax = *max_element(A.begin(), A.end());
    vector<int> dp(Amax+1, 0);
    long long cnt = 0;

    for (int x: A){
        if(dp[x] != 0){
            dp[x] = 2;
            continue;
        }
        for (int j=1;x*j<=Amax;j++){
            dp[x*j] += 1;
        }
    }
    for (int x: A){
        if (dp[x] == 1) cnt++;
    }

    cout << cnt << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


Measured memory_bytes: 8792
n=int(input())
a=list(map(int,input().split()))
c=n//2
s=1 if n%2==0 else 0
for i in range(c+1-s):
  print(a[n-i*2-1],end=" ")
for i in range(c):
  print(a[i*2-s+1],end=" ")

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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  string ans;
  if (a + b > c + d)
    ans = "Left";
  else if (a + b < c + d)
    ans = "Right";
  else
    ans = "Balanced";

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


Measured memory_bytes: 256
from fractions import gcd
from functools import reduce


def gcd_list(numbers):
    return reduce(gcd, numbers)


n, x = [int(_) for _ in input().split()]
x_list = [int(_) for _ in input().split()]

list = [abs(x_list[i] - x) for i in range(n)]

answer = gcd_list(list)
print(answer)


Measured memory_bytes: 16308
import sys

input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    V = list(map(int, input().split()))
    _V = V[::-1]

    ans = 0
    for k in range(K + 1):
        n_pop = min(k, N)
        n_push = K - n_pop
        for i in range(n_pop + 1):
            l, r = i, n_pop - i
            L = V[:l] + _V[:r]
            L.sort()
            for j in range(min(n_pop, n_push)):
                if L[j] < 0:
                    L[j] = 0
                else:
                    break
            v = sum(L)
            if v > ans:
                ans = v

    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 3064
A,B,C,D = map(int,input().split())

C_mod0 = B//C - (A-1)//C
D_mod0 = B//D - (A-1)//D
i = D
j = C % D
while j > 0:
    k = j
    j = i % j
    i = k

CD_mod0 = B*i // (C*D) - (A-1)*i // (C*D)
Total = B - A + 1
ans = Total - C_mod0 - D_mod0 + CD_mod0

print(ans)


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

    int d = 100 * r + 10 * g + b;

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

Measured memory_bytes: 256
import sys
from collections import Counter
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
ct = Counter(a_ls)
res = 0
for k, v in ct.items():
    res += v * (v-1) // 2
for a in a_ls:
    print(res - max(0, ct[a] - 1))

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

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

    bool ans = false;
    for (int i = 1; i <= 9; ++i) {
        a = N / i;
        b = N % i;
        if (a < 10 && b ==0 ) ans = true;
    }
    if (ans) {
        cout << "Yes" << "\n";
    }else {
        cout << "No" << "\n";
    }
}


Measured memory_bytes: 256
// Problem : B - Minor Change
// Contest : AtCoder - AtCoder Beginner Contest 172
// URL : https://atcoder.jp/contests/abc172/tasks/abc172_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;
 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for (auto& a : x)
 
#define bug(x) cout<<#x<<" "<<x<<endl; 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const int MX = 200001; //check the limits, dummy
 
int main() 
{
	// && has higher precedence than ||
	ios_base::sync_with_stdio(0); cin.tie(0);    
	
		string s1,s2;
		cin>>s1>>s2;
		int c=0;
		F0R(x,sz(s1))
		{
			if(s1[x]!=s2[x])c++;
		}
		cout<<c<<endl;
	
	return 0;
}
 
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 3840
import sys
def input(): return sys.stdin.readline().strip()


def main():
    A, B, C, X, Y = map(int, input().split())
    ans = 10**18
    for i in range(2 * max(X, Y) + 1):
        x, y = max(0, X - i // 2), max(0, Y - i // 2)
        #print(i, A*x + B*y + C*i)
        ans = min(ans, A*x + B*y + C*i)
    print(ans)
    

if __name__ == "__main__":
    main()


Measured memory_bytes: 69552
#include <bits/stdc++.h>
 
#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;
 
const int INF = 1e9 + 7;
 
using namespace std;

ll gcd(ll n, ll k)
{
    ll mod = n % k;

    if (mod == 0)
	return k;
    else
	return gcd(k, mod);
}

int main()
{
	cin.tie(0); ios::sync_with_stdio(false);
 
	ll N, X;
	cin >> N >> X;

	vector<ll> x(N);
	rep (i, 0, N)
	    cin >> x[i];

	x.push_back(X);
	sort(x.begin(), x.end());

	ll dist = abs(x[0] - x[1]);
	for (int i = 1; i < x.size() - 1; i++) {
	    dist = gcd(dist, abs(x[i] - x[i + 1]));
	}

	cout << dist << endl;
	return 0;
}


Measured memory_bytes: 1792
a, b, k = map(int, input().split())
for i in range(a, min((a + k), (b + 1))):
    print(i)

for i in range(max(0, (a + k - 1), (b - k + 1)), b + 1):
    if i != (a + k - 1):
        print(i)


Measured memory_bytes: 38384