akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7;

char a[22][22];
int vis[22][22], d[22][22];
int n, m;
int dir[][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};

int go(int i, int j) {
	memset(vis, 0, sizeof vis);
	memset(d, 0, sizeof d);
	vis[i][j] = 1;
	V<pi> v;
	v.EB(i, j);
	int mx = 0;
	for(int l=0;l<v.size();l++) {
		pi p = v[l];
		int i = p.F, j = p.S;
		// cout << i  << " " << j << endl;
		for(int k=0;k<4;k++) {
			int ii = i + dir[k][0];
			int jj = j + dir[k][1];
			if(ii < 0 || jj < 0 || ii >= n || jj >= m) continue;
			if(vis[ii][jj]) continue;
			if(a[ii][jj] == '#') continue;
			vis[ii][jj] = 1;
			d[ii][jj] = d[i][j] + 1;
			mx=max(d[ii][jj], mx);
			v.EB(ii, jj);
		}
	}
	return mx;
}

signed main()
{
	IO_OP;
	
	cin >> n >> m;
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			cin >> a[i][j];
	int ans = 0;
	for(int i=0;i<n;i++) {
		for(int j=0;j<m;j++) {
			if(a[i][j] == '.') {
				ans = max(ans, go(i, j));
			}
		}
	}
	cout << ans << endl;
	
}





Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (long long i = 0; i < (ll)(n); i++)
#define put(i) cout << fixed << i << endl
using namespace std;
using ll = long long;

vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end());
    return ret;
}

bool IsPrime(ll num) {
    if (num < 2)
        return false;
    else if (num == 2)
        return true;
    else if (num % 2 == 0)
        return false;

    long double sqrtNum = sqrtl(num);
    for (ll i = 3; i <= sqrtNum; i += 2) {
        if (num % i == 0) {
            // 素数ではない
            return false;
        }
    }

    // 素数である
    return true;
}

int main() {
    ll n;
    cin >> n;
    vector<ll> div;
    set<ll> sample;
    ll ans = 0;

    div = divisor(n);

    for (auto x : div) {
        ll y = x;
        if (!IsPrime(x)) continue;
        sample.insert(x);
        if (x == 1) continue;
        for (long long i = 2; y <= n / 2; i++) {
            y = powl(x, i);
            if (y >= n / 2 || y < 1) {
                break;
            } else {
                sample.insert(y);
            }
            #ifdef DEBUG
            cout << x << ":" << y << ":" << i << endl;
            #endif
        }
    }

#ifdef DEBUG
    for (auto x : sample) cout << x << " ";
    cout << endl;
#endif

    for (auto x : sample) {
        if(n % x != 0) continue;
        n = n / x;
        ans++;
        if (n == 1) {
            break;
        }
    }
    put(ans);
}

Measured memory_bytes: 3772
n, x = gets.split(" ").map(&:to_i)
l = gets.split(" ").map(&:to_i)

d = [0]
1.upto(n) do |i|
  d[i] = d[i - 1] + l[i - 1]
end
d.delete_if{ |i| i > x }

puts d.size

Measured memory_bytes: 1788
#include <iostream> 
using namespace std;
int main () {
  long int a, b, c;
  cin >> a >> b >> c;
  const int d = c;
  int* e = new int [d];
  const int g = a;
  for (int i = 0; i < d; i++) {
    cin >> e[i];
  }
  long int* f = new long int [g];
  for (int i = 0; i < g; i++ ) {
    f[i] = b - c; }
  if (b > c) {
    for (int i = 0; i < g; i++ ) {
      cout << "Yes" << endl; }
  } else { for (int i = 0; i < d; i++){
    f[e[i] - 1] += 1; }
          for (int i = 0; i < g; i++) {
         if (f[i] > 0 ) {
           cout << "Yes" << endl; }
           else{ cout << "No" << endl; }
          }
         }
  delete [] e;
    delete [] f;
}
    

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() { 
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  string s,ss;
  cin>>s;
  for(int i=0;i<s.size();i+=2) { 
    ss+=s[i];
    }
  cout<<ss<<endl;
  
  return 0;
}


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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;
const int mxn=2e5+5;
ii a[mxn];

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	int n; cin >> n;
	for(int i=0; i<n; i++){
		cin >> a[i].se >> a[i].fi;
	}
	sort(a,a+n);
	bool ok=1;
	ll now = 0;
	for(int i=0; i<n&&ok; i++){
		now += a[i].se;
		if(now>a[i].fi)ok=0;
	}
	if(ok)cout << "Yes" << '\n';
	else cout << "No" << '\n';
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 5180
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >>r;
    if (x-r>=0 && y-r >=0 && x+r<=W && y+r <=H){
        cout<< "Yes" <<endl;
    }else{
        cout<< "No" <<endl;
    }
    
}


Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
  int A, B, C;
  cin >> A >> B;
  C = 0;
  REP2(i, A, B+1) {
    int s, t, u, v;
    s = i / 10000;
    t = i % 10;
    u = i / 1000 % 10;
    v = i % 100 / 10;
    
    if (s == t && u == v) {
      C++;
    }
  }
  cout << C << endl;
  return 0;
}

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

int main() {
	string s;
	cin>>s;
	int sum=0;
	for(int i=0;i<s.length();i++){
		sum+=(s[i]-'0');
	}
	if(sum%9==0) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
	
	
	return 0;
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

    if (a <= 9 && b <= 9) {
        cout << a * b << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}


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

int main()
{
    int a, b;
    cin >> a >> b;
    int k;
    cin >> k;
    for (int i = 1; i <= k; i++) {
        if (i%2) {
            b += a/2;
            a /= 2;
        }
        else {
            a += b/2;
            b /= 2;
        }
    }
    cout << a << " " << b << "\n";
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
template<typename tn> void read(tn &a){
	tn x=0,f=1; char c=' ';
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0';
	a=x*f;
}
const int N = 101000;
int n,m,D,fa[N],tot,p[N],ans;
ll val[N],W[N],f[N],w[N];
int main(){
	read(n);read(m);read(D);
	read(W[1]);val[1]=1;
	for(int i=2;i<=n;i++)
		read(w[i]),read(fa[i]);
	for(int i=n;i>1;i--){
		W[i]+=w[i];val[i]++;
		W[fa[i]]+=W[i];
		val[fa[i]]+=val[i];
	}
	for(int i=1;i<=n;i++) p[i]=i,tot+=val[i]*min(n,D);
	sort(p+1,p+n+1,[](int a,int b){
		return 1.l*val[a]/W[a]>1.l*val[b]/W[b];
	});
	memset(f,63,sizeof(f));
	f[0]=0;
	for(int i=1;i<=n;i++)
		for(int k=1;k<=min(n,D);k++)
			for(int j=tot;j>=val[p[i]];j--)
				f[j]=min(f[j],f[j-val[p[i]]]+W[p[i]]);
	for(int i=0;i<=tot;i++){
		if(f[i]>m) continue;
		int now=i,tmp=m-f[i];
		for(int j=1;j<=n;j++){
			int num=tmp/W[p[j]];
			if(p[j]!=1) num=min(num,D-min(n,D));
			now+=num*val[p[j]];
			tmp-=num*W[p[j]];
		}
		ans=max(ans,now);
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define SORT(a) sort(a.begin(), a.end())
#define RSORT(a) sort(a.rbegin(), a.rend())
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, start, end) for (int i = start; i < end; i++)
#define ALL(a) a.begin(), a.end()
#define MOD(a) a %= 1'000'000'007
using ll = long long;
using namespace std;
const int INF32       = 1'050'000'000;
const long long INF64 = 4'000'000'000'000'000'000;
const int MOD7        = 1'000'000'007;
const int MOD9        = 1'000'000'009;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
void vprint() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
template <class H, class... T> void vprint(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << '\n';
    vprint(std::forward<T>(args)...);
}
template <class T> void vprint(std::vector<T> &v) {
    for (auto &&i : v) {
        std::cout << i << '\n';
    }
}
template <class T> void mprint(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << "";
        }
    }
}
template <class T, class T2> long long modpower(long long radix, T x, T2 mod) {
    // 高速階乗計算 radix^x
    long long ans = 1;
    while (0 < x) {
        if (x & 1) {
            ans = ans * radix % mod;
        }
        radix = radix * radix % mod;
        x >>= 1;
    }
    return ans == 0 ? 1 : ans;
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int N, M;
    cin >> N >> M;
    auto time = modpower(2, M, MOD7);
    ll ans    = (ll)(1900 * M + 100 * (N - M)) * time;
    print(ans);

    return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <atcoder/all>
//using namespace atcoder;
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
// ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// cout << fixed << setprecision(10);
ios::sync_with_stdio(false);
cin.tie(nullptr);
    int n;
    cin>>n;
    int x;
    vector<queue<int>> b(n);
    rep(i,n)rep(j,n-1){
        cin>>x;
        x --;
        b[i].emplace(x);
    }
    set<int> seen;
    int ans=-1;
    bool f=1;
    while(f){
        f=0;
        rep(i,n){
            if(b[i].empty()) continue;
            int op=b[i].front();
            if(op<i) continue;
            if(seen.count(op) || seen.count(i)) continue;
            if(b[op].front() != i) continue;
            f=1;
            b[i].pop();
            b[op].pop();
            seen.emplace(op);
            seen.emplace(i);
        }
        ans ++;
        seen.clear();
    }
    rep(i,n){
        if(!b[i].empty()){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<ans<<endl;
}/*
./problem.exe
*/


Measured memory_bytes: 8024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    string s;
    cin >> s;
    int ans = 0;
    int cnt = 0;
    rep(i, 3) {
        if (s[i] == 'R')
            cnt++;
        else
            cnt = 0;
        ans = max(ans, cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

#define kuriage(x)  x+=10-x%10;
#define mod(cans) cans%10**9+7;
#define cin_pl(x,y) for(int i=0;i<x;i++){cin>>y[i];}
#define debug(x) cout << "Debug" << x << "\n"

typedef long long ll;


using namespace std;
int main()
{
    int n;
    cin>>n;
    int h[n],ans=1,r;
    cin_pl(n,h);
    r=h[0];
    for(int i=1;i<n;i++)
    {
        if(r<=h[i])
        {
            ans++;
            r=h[i];
        }
    }
    cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#ifdef ONLINE_JUDGE
#define LLD "%I64d"
#else
#define LLD "%lld"
#endif
#define fu(a,b,c) for(int a=b;a<=(int)c;++a)
#define fd(a,b,c) for(int a=b;a>=(int)c;--a)
#define cu(a,b,c) for(int a=b;a<(int)c;++a)
#define cd(a,b,c) for(int a=(b)-1;a>=(int)c;--a)
#define gcd(a,b) __gcd(a,b) 
#define pii pair<int,int>
#define pll pair<long long,long long>
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define pf push_front
#define MOD 1000000007 
#define MAXN 52
#define MAXH 20
#define MAXM 52
#define INF 100000000
#define ll long long
#define ull unsigned long long
#define RNG rng mt19937(time(NULL))
#define udist(a,b) uniform_int_distribution<uint32_t> distribution(a,b)
#define max3(a,b,c) max(a, max(b, c))
#define min3(a,b,c) min(a, min(b, c))
#define gmax(a,b) a = max(a, b)
#define gmin(a,b) a = min(a, b)
#define whatis(x) cerr << #x << " is " << x << endl;
#define fast_io() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define PI 3.1415926535897932384626433
using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main(){
	int n;
	cin >> n;
	cout << 180 * (n - 2) << '\n';
}


Measured memory_bytes: 256
def main():
    N, W =map(int, input().split())

    weights = []
    values = []
    for i in range(N):
        wi, vi =map(int, input().split())
        weights.append(wi)
        values.append(vi)

    sum_v = sum(values)

    INF = 10**9+7

    dp = [[INF]*(sum_v+1) for _ in range(N+1)]
    dp[0][0] = 0


    for i in range(N):
        wi = weights[i]
        vi = values[i]
        for j in range(sum_v+1):
            if j < vi:
                dp[i+1][j] = dp[i][j]
            else:
                dp[i+1][j] = min(dp[i][j], dp[i][j-vi]+ wi)

    for j in range(sum_v+1):
        if dp[N][j] <= W:
            ans = j

    print(ans)

if __name__ == "__main__":
    main()



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

using namespace std;

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

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

short maze[35][35];
int visit[35][35];
int main()
{
//	cut here before submit 
//	freopen ("testcase.Amazing_Mazes", "r", stdin );
	int w, h;
//	while (cin >> w >> h, w, h ){
	while (1 ){
		cin >> w >> h;
		if (w == 0 && h == 0 ) break;
		memset (maze, 0, sizeof (maze ) );
		rep (i, h ) rep (j, w ) maze[i][j] = (TOP|RIGHT|BOTTOM|LIFT);
		rep (i, h ){
			maze[i][0] &= ~LIFT;
			maze[i][w-1] &= ~RIGHT;
		} // end rep
		rep (j, w ){
			if (j != 0 ) maze[0][j] &= ~TOP;
			if (j != w - 1 ) maze[h-1][j] &= ~BOTTOM;
		} // end rep
		rep (i, 2*h-1 ){
			if (i % 2 == 0 ){
				rep (j, w-1 ){
					int in;
					cin >> in;
					if (in == 1 ){
						maze[i/2][j] &= ~RIGHT;
						maze[i/2][j+1] &= ~LIFT;
					} // end if
				} // end rep
			}else{
				rep (j, w ){
					int in;
					cin >> in;
					if (in == 1 ){
						maze[i/2][j] &= ~BOTTOM;
						maze[i/2+1][j] &= ~TOP;
					} // end if
				} // end rep
			} // end if
		} // end rep
//		memset (visit, -1, sizeof (visit ) );
		rep (i, h ) rep (j, w ) visit[i][j] = INF;

		priority_queue<iP, vector<iP>, greater<iP> > que;
		que.push (iP (1, P(0, 0 ) ) );
		visit[0][0] = 1;
		while (!que.empty() ){
			iP curr = que.top(); que.pop();
			int cc = curr.first;
			int cy = curr.second.first;
			int cx = curr.second.second;
			if (cy == h - 1 && cx == w - 1 ) break;
//			visit[cy][cx] = cc;
			rep (k, 4 ){
				int ny = cy + dy[k];
				int nx = cx + dx[k];
				if ((maze[cy][cx] & (1<<k ) ) == 0 ) continue;
				if (nx < 0 || nx >= w || ny < 0 || ny >= h ) continue;
//				if (visit[ny][nx] != -1 && visit[ny][nx] < cc ) continue;
//				visit[ny][nx] = cc + 1;
//				if (visit[ny][nx] == -1 || visit[ny][nx] > cc + 1 )
				if (cc+1 >= visit[ny][nx] ) continue;
				visit[ny][nx] = cc + 1;
				que.push (iP(cc + 1,  P (ny, nx ) ) );
			} // end rep
		} // end while
		
		if (visit[h-1][w-1] == INF ){
			cout << 0 << endl;
		}else{
			cout << visit[h-1][w-1] << endl;
		} // end if
/*
		rep (i, h ){
			rep (j, w ){
				cout << setw(2) << maze[i][j];
			} // end rep
			cout << endl;
		} // end rep
*/
	} // end loop

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

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

using namespace std;
const int N = 200005;

char str[N];
int s, t, l;

void init(){
	scanf("%s",str);
	l = strlen(str);
	for(int i = 0; i < l; i++){
		if(str[i] == 'S'){
			s++;
		}
		else{
			if(s){
				s--;
				t++;
			}
		}
	}
	printf("%d\n",l - 2 * t);
}

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

Measured memory_bytes: 384
import sys
import math

a,b,h,m = (int(i) for i in input().split())

long = ((m/60)*360)
short = ((h/12+m/720)*360)

deruta = abs(long -short)
#print((m/60)*720,(h/12)*360)
#print(deruta)

deruta = abs(math.radians(deruta))

#print(deruta)
c = math.sqrt(b**2+a**2-2*b*a*math.cos(deruta))

print(c)
#print(math.sqrt(13))

Measured memory_bytes: 9508
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define pb push_back
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using vst=vector<string>;
using P = pair<ll,ll>;
const int inf=1e9+7;
const ll INF=9e18;
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

ll find(int x){
  ll ans=0;
  while(ans*(ans+1)<2*x){
    ans++;
  }
 return ans; 
}

int main(){cout<<fixed<<setprecision(20);
		   ll n;
           cin>>n;
           vector<ll> ans(0);
           while(n>0){
            ll g=find(n);
             ans.pb(g);
             n-=g;
           }
           for(auto v:ans)cout<<v<<endl;
          // rep(i,1,9)cout<<i<<" "<<find(i)<<endl;
}

Measured memory_bytes: 3696
import math
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))
mod = 10**9 + 7 
sys.setrecursionlimit(1000010)

X,Y,A,B,C=nm()
p = sorted(nl(),reverse=True)
q = sorted(nl(),reverse=True)
r = nl()
u = sorted(p[0:X] + q[0:Y] + r,reverse=True)[0:X+Y]
# print(u)
print(sum(u))


Measured memory_bytes: 24040
import sys
from operator import itemgetter
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
 
def main():
    N, M = map(int, readline().split())
    ab = map(int, read().split())
    ab = sorted(zip(ab, ab), key=itemgetter(1))
 
    east_island = ab[0][1]
    answer = 1
 
    for i, j in ab:
        if i >= east_island:
            answer += 1
            east_island = j
 
    print(answer)
 
 
if __name__ == '__main__':
    main()

Measured memory_bytes: 29956
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
const int mod = 1e9 + 7;
const double pi = acos(-1.0);
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
int main(){
    ll n; cin >> n;
    vll c(n+1, 0);
    rep(i,n-1){
        int a; cin >> a;
        c[a]++;
    }
    REP(i,1,n+1)cout << c[i] << endl;

    return 0;
}  

Measured memory_bytes: 4848
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>

using namespace std;

int main() {
    int n;
    double ans = 0;
    cin >> n;

    for (int i=0; i<n; i++) {
        double x;
        string y;
        cin >> x >> y;
        if (y == "JPY") ans += x;
        else ans += 380000.0 * x;
    }

    cout << fixed << setprecision(7) << ans << endl;
}

Measured memory_bytes: 888
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader tec = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		for (String line; (line = tec.readLine()) != null;) {
			boolean[] arr = new boolean[4];
			line=line.toUpperCase();
			for (int i = 0; i < line.length(); i++) {
				switch (line.charAt(i)) {
				case 'S':
					arr[0] = true;
					break;
				case 'N':
					arr[1] = true;
					break;
				case 'W':
					arr[2] = true;
					break;
				case 'E':
					arr[3] = true;
					break;
				}
			}
			if(arr[0]==arr[1]&&arr[2]==arr[3]){
				out.println("Yes");
			}else{
				out.println("No");
			}

		}
		out.close();
	}

}


Measured memory_bytes: 23124
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
class Program
{
    public static void Main()
    {
        long N = long.Parse(Console.ReadLine());
        string[] input = Console.ReadLine().Split();
        long[] A = new long[N];
        BigInteger ans = 1;
        bool flag = true;
        for(long i=0; i < N; i++)
        {
            A[i] = long.Parse(input[i]);
            if (A[i] == 0) { flag = true; ans = 0; }
            if (flag==true)ans *= A[i];
            if (ans > 1000000000000000000) { flag = false; }         
        }
        if (flag) { Console.WriteLine(ans); }
        else { Console.WriteLine("-1"); }
    }
}

Measured memory_bytes: 45044
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

typedef long long ll;

map<ll,int>zipX,zipY,zipD;
ll unzipX[128],unzipY[128],unzipD[128];
int W,H,Z,N,K;
vector<int>X,Y,D;
int sea[128][128][128];

int compress(vector<int> crd, map<ll,int> &zip, ll unzip[128]){
  sort(crd.begin(), crd.end());
  crd.erase(unique(crd.begin(), crd.end()), crd.end());
  for(int i=0;i<crd.size();i++){
    zip[crd[i]] = i;
    unzip[i] = crd[i];
  }
  return crd.size();
}

int main(){
  scanf("%d%d",&N,&K);
  for(int i=0;i<N;i++){
    int x,y,d;
    scanf("%d%d%d", &x,&y,&d);
    X.push_back(x); Y.push_back(y); D.push_back(d);
    scanf("%d%d%d", &x,&y,&d);
    X.push_back(x); Y.push_back(y); D.push_back(d);
  }
  
  H = compress(Y, zipY, unzipY);
  W = compress(X, zipX, unzipX);
  Z = compress(D, zipD, unzipD);

  for(int i=0;i<2*N;i+=2){
    for(int y=zipY[Y[i]];y<zipY[Y[i+1]];y++)
      for(int x=zipX[X[i]];x<zipX[X[i+1]];x++)
	for(int d=zipD[D[i]];d<zipD[D[i+1]];d++)
	  sea[y][x][d]++;
  }
  ll res = 0;
  for(int y=0;y<128;y++) 
    for(int x=0;x<128;x++) 
      for(int d=0;d<128;d++)
	if(sea[y][x][d] >= K) 
	  res += abs(unzipY[y]-unzipY[y+1])*abs(unzipX[x]-unzipX[x+1])*abs(unzipD[d]-unzipD[d+1]);
  
  printf("%lld\n", res);
  return 0;
}

Measured memory_bytes: 8732
#include <iostream>
#include <cstdio>
#include <memory>

using namespace std;

struct Node {
  int key;
  Node* parent;
  Node* left;
  Node* right;
  
  Node(int key = -1) : key(key), parent(nullptr), left(nullptr), right(nullptr) {};
};

struct Tree {
  Node* root;  
  
  Tree() : root(nullptr) {};
};

static void insert(Tree& tree, int v) {
  Node* z = new Node(v);
  Node* x(tree.root);
  Node* y(nullptr);
  while (x != nullptr) {
    y = x;
    if (z->key < x->key) {
      x = x->left;
    } else {
      x = x->right;
    }
  }
  
  z->parent = y;
  if (y == nullptr) {
    tree.root = z;
  } else if (z->key < y->key) {
    y->left = z;
  } else {
    y->right = z;
  }
}

static Node* find(Node* node, int v) {
  while (node != nullptr && node->key != v) {
    if (node->key > v) {
      node = node->left;
    } else {
      node = node->right;
    }
  }
  return node;
}

static Node* getSuccessor(Node* x) {
  if (x->right) {
    x = x->right;
    while (x->left) {
      x = x->left;
    }
    return x;
  }
  
  Node* y = x->parent;
  while (y && x == y->right) {
    x = y;
    y = y->parent;
  }
  return y;
}

static void deleteNode(Node*& root, int v) {
  Node* z = find(root, v);
  Node* y;
  if (!z->left || !z->right) {
    y = z;
  } else {
    y = getSuccessor(z);  
  }

  Node* x;
  if (y->left) {
    x = y->left;
  } else {
    x = y->right;
  }
  
  if (x) {
    x->parent = y->parent;
  }
  
  if (!y->parent) {
    root = x;    
  } else if (y == y->parent->left) {
    y->parent->left = x;
  } else {
    y->parent->right = x;
  }
  
  if (y != z) {
    z->key = y->key;  
  }
  
  delete y;
}

void preorderWalk(const Node* node) {
  if (!node) {
    return;
  }
  cout << " " << node->key;
  if (node->left != nullptr) {
    preorderWalk(node->left);
  }
  if (node->right != nullptr) {
    preorderWalk(node->right); 
  }
}

void inorderWalk(const Node* node) {
  if (!node) {
    return;
  }
  if (node->left != nullptr) {
    inorderWalk(node->left);
  }
  cout << " " << node->key;

  if (node->right != nullptr) {
    inorderWalk(node->right); 
  }
}

static Tree TREE;

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

  string command;
  int v;
  for (int i = 0; i < n; i++) {
    cin >> command;
    if (command[0] == 'i') {
      scanf("%d", &v);
      insert(TREE, v);
    } else if (command[0] == 'f') {
      scanf("%d", &v);
      Node* found = find(TREE.root, v);
      cout << (found ? "yes" : "no") << endl;
    } else if (command[0] == 'd') {
      scanf("%d", &v);
      deleteNode(TREE.root, v);
    } else {
      inorderWalk(TREE.root);
      cout << endl;
      preorderWalk(TREE.root);
      cout << endl;
    }
  }

  return 0;
}



Measured memory_bytes: 21964
#include <algorithm>
#include <bits/stdc++.h>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <iostream>
#include <iterator>
#include <type_traits>
#include <vector>

// lib/monoid.hpp
#ifndef MONOID_HPP
#define MONOID_HPP


namespace tools {
  template <typename T>
  class monoid {
  private:
    ::std::function<T(T, T)> m_operation;
    T m_identity;

  public:
    monoid(const ::std::function<T(T, T)>& operation, const T& identity) :
      m_operation(operation),
      m_identity(identity) {
    }
    monoid(const ::tools::monoid<T>&) = default;
    monoid(::tools::monoid<T>&&) = default;
    ::tools::monoid<T>& operator=(const ::tools::monoid<T>&) = default;
    ::tools::monoid<T>& operator=(::tools::monoid<T>&&) = default;
    virtual ~monoid() = default;

    const ::std::function<T(T, T)>& operation() const {
      return this->m_operation;
    }
    const T& identity() const {
      return this->m_identity;
    }

    template <typename U = T, typename ::std::enable_if<::std::is_integral<U>::value, ::std::nullptr_t>::type = nullptr>
    static ::tools::monoid<U> multiplies() {
      return ::tools::monoid<U>(::std::multiplies<U>(), 1);
    }
  };
}

#endif

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// lib/pow.hpp
#ifndef POW_H
#define POW_H


/*
usage:

tools::pow(tools::monoid<int>::multiplies(), 2, 5) => 32
*/

namespace tools {
  template <typename T>
  T pow(const ::tools::monoid<T>& monoid, const T& base, const std::size_t exponent) {
    return exponent == 0
      ? monoid.identity()
      : exponent % 2 == 0
        ? [&monoid](const T& x) { return monoid.operation()(x, x); }(::tools::pow(monoid, base, exponent / 2))
        : monoid.operation()(::tools::pow(monoid, base, exponent - 1), base);
  }

  template <typename T>
  T pow(const T& base, const std::size_t exponent) {
    return ::tools::pow(::tools::monoid<T>::multiplies(), base, exponent);
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;

  if (N % 2 == 0) {
    i64 answer = 0;
    for (i64 divisor = 10; divisor <= 1000000000000000000; divisor *= 5) {
      answer += N / divisor;
    }
    std::cout << answer << std::endl;
  } else {
    std::cout << 0 << std::endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
int n,m,e[30][30],a,b,ans;
void dfs(int r,int c,int v)
{
	v+=1<<r;
	if(c==n)
	{
		ans++;
		return;
	}
	for(int i=1;i<=n;i++)
	{
		if(e[r][i]&&!(1<<i&v))dfs(i,c+1,v);
	}
}
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		cin>>a>>b;
		e[a][b]=1;
		e[b][a]=1;
	}
	dfs(1,1,0);
	cout<<ans<<endl;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n ; i++ )
#define For(i, a, b) for(int i = (a); i < (b) ; i++ )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()


const int MAX_N = 100000;
const int MAX_M = 100000;

int main(void){
    int i = 0;
    int N, M;
    scanf("%d %d", &N, &M);

    int A[N];
    vector<pair<int, int>> q;

    i = 0;
    rep(i, N){
        scanf("%d", &A[i]);
    }

    int b_max = 0;

    i = 0;
    rep(i, M){
        int b, c;
        scanf("%d %d", &b, &c);
        q.push_back(make_pair(c, b)); 
        b_max = min(b + b_max, N);
    }

    sort(rall(q));
    sort(A, A + N);

    int idx = 0;
    int subs[b_max];
    i = 0;

    while(idx < b_max){

        int end = min(q[i].second, b_max - idx);
        rep(j, end){
            subs[idx] = q[i].first;
            idx ++;
        }
        i ++;
    }

    long cnt = 0;
    i = 0;
    rep(i, N){
        if(i < b_max){
            cnt += max(subs[i], A[i]);
        }else{
            cnt += A[i];
        }
        
    }
    
    cout << cnt << endl;

    return 0;
}

Measured memory_bytes: 1908
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, W;
	cin >> N >> W;
	vector<int> w(N);
	vector<int> v(N);
	int res = 0;

	for (int i = 0; i < N; i++) {
		cin >> w[i] >> v[i];
	}
	int INF = (int)1 << 60;
	vector<int> dp(100001, INF);
	vector<int> ndp(100001, INF);
	dp[0] = 0;
	ndp[0] = 0;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j + v[i] < (int)dp.size(); j++) {
			ndp[j + v[i]] = min(ndp[j + v[i]], dp[j] + w[i]);
		}
		dp = ndp;
	}
	for (int i = 0; i < dp.size(); i++) {
		if (dp[i] <= W) {
			res = i;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 1792
use std::io::*;
use std::str::FromStr;
use utils::*;

pub fn main() {
    let i = stdin();
    let mut o = Vec::new();
    run(i.lock(), &mut o);
    stdout().write_all(&o).unwrap();
}

fn run<R: BufRead, W: Write>(i: R, o: &mut W) {
    let mut i = CpReader::new(i);
    let n = i.read::<usize>();
    let mut r = false;
    for _ in 0..n {
        if i.read::<usize>() % 2 != 0 {
            r = true;
            break;
        }
    }
    let r = if r { "first" } else { "second" };
    writeln!(o, "{}", r).unwrap();
}

mod utils {
    use super::*;

    pub struct CpReader<R: BufRead> {
        r: R,
        s: String,
    }

    macro_rules! fn_read {
        { $f:ident($($t:ident),*) } => {
            #[allow(dead_code)]
            pub fn $f<$($t: FromStr),*>(&mut self) -> ($($t),*) {
                let i = &mut self.read_line().split(' ');
                ($(read_next::<$t,_>(i)),*)
            }
        };
    }

    impl<R: BufRead> CpReader<R> {
        pub fn new(r: R) -> Self {
            CpReader {
                r: r,
                s: String::new(),
            }
        }
        pub fn read_line(&mut self) -> &str {
            self.s.clear();
            self.r.read_line(&mut self.s).unwrap();
            self.s.trim()
        }

        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_line().parse().ok().unwrap()
        }
        fn_read! { read2(T1, T2) }
        fn_read! { read3(T1, T2, T3) }
        fn_read! { read4(T1, T2, T3, T4) }
        fn_read! { read5(T1, T2, T3, T4, T5) }
    }
    fn read_next<'a, T: FromStr, I: Iterator<Item = &'a str>>(i: &mut I) -> T {
        i.next().unwrap().parse().ok().unwrap()
    }

}


Measured memory_bytes: 4352
import java.util.*;
import java.util.function.*;
import java.math.*;
public class Main {
    public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		int ABCD = s.nextInt();
		
		StringBuilder str = new StringBuilder();
		StringBuilder abcd = new StringBuilder(String.format("%04d", ABCD));
		for(int i = 0; i < (1<<3); i++) {
			int candidate = ABCD/1000;
			int tmp = ABCD;
			for(int j = 0; j < 3; j++) {
				if(((i>>j) & 1) == 1) {
					candidate += tmp%10;
					str.insert(0, "+");
				}else {
					candidate -= tmp%10;
					str.insert(0, "-");
				}
				tmp /= 10;
			}
			if(candidate == 7) {
				abcd.insert(1, str.charAt(0));
				abcd.insert(3, str.charAt(1));
				abcd.insert(5, str.charAt(2));
				abcd.append("=7");
				System.out.println(abcd.toString());
				return;
			}
			str = new StringBuilder();
		}
    }
}


Measured memory_bytes: 23764
#coding: utf-8
from itertools import permutations
N, M, R = map(int, input().split())
r = list(map(int, input().split()))
graph = [[float("inf") for _ in range(N)] for _ in range(N)]
for i in range(N):
    graph[i][i] = 0
for i in range(M):
    a, b, c = map(int, input().split())
    graph[a-1][b-1] = c
    graph[b-1][a-1] = c
for k in range(N):
    for i in range(N):
        for j in range(N):
            graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])
P = permutations(r)
ans = float("inf")
for p in P:
    tmp = 0
    for i in range(R-1):
        tmp += graph[p[i]-1][p[i+1]-1]
    ans = min(ans, tmp)
print(ans) 


Measured memory_bytes: 71860
#include <map>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

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

	int g = 0, p = 0;
	for(int i = 0; i < s.length(); i++){
		if(s[i] == 'g'){
			g++;
		}else{
			p++;
		}
	}

	cout << s.length() / 2 - p << endl;

	return 0;
}


Measured memory_bytes: 512
import java.util.*;
import java.lang.*;
 
public class Main {
    public static void main(String[] args) {

        Scanner sc  = new Scanner(System.in);

        int cnt = 0;
        String str = "";


        int W = Integer.parseInt(sc.next());
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        
        if(a-W<=0&&b-W<=0) System.out.print("0");
        else System.out.print(Math.min(Math.abs(a-b-W), Math.abs(b-a-W)));

        System.out.println();
    }

}

Measured memory_bytes: 22228
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if ((b - a) == (c - b)) {
     cout << "YES" << endl;
  } else {
     cout << "NO" << endl;
  }

/*
  const std::vector<int> v = {1, 2, 3};
  for (const int x : v) {
    std::cout << x << std::endl;
  }
  */

}

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

int main(){
  vector<int> Time(5);
  for(int i = 0; i < 5; i++) cin >> Time.at(i);
  vector<int> Mod(5);
  for(int i = 0; i < 5; i++) Mod.at(i) = Time.at(i) % 10;
  for(int i = 0; i < 5; i++){
    if(Mod.at(i) != 0) Mod.at(i) = 10 - Mod.at(i);
  }
  int Max;
  Max = max(max(max(max(Mod.at(0), Mod.at(1)), Mod.at(2)), Mod.at(3)), Mod.at(4));
  int Sum = 0;
  for(int i = 0; i < 5; i++){
    Sum += Time.at(i);
    Sum += Mod.at(i);
  }
  Sum -= Max;
  cout << Sum << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt(),r=sc.nextInt();

		if(n<10) {
			System.out.println(r+(100*(10-n)));
		}else {
			System.out.println(r);
		}
	}
}



Measured memory_bytes: 21844
#include <stdio.h>

int main()
{
    char s[52];
    int  v[52];
    int n, i, j, k;

    scanf("%d", &n);
    for (i = 0; i < n; i++){
        scanf("%s %d", &s[i], &v[i]);
    }

    for (j = 1; j < 14; j++){
        for (k = 0; k < n; k++){
            if (s[k] == 'S' && v[k] == j) break;
            if (k == n - 1) printf("S %d\n", j);
        } 
    }
    for (j = 1; j < 14; j++){
        for (k = 0; k < n; k++){
            if (s[k] == 'H' && v[k] == j) break;
            if (k == n - 1) printf("H %d\n", j);
        }
    }
    for (j = 1; j < 14; j++){
        for (k = 0; k < n; k++){
            if (s[k] == 'C' && v[k] == j) break;
            if (k == n - 1) printf("C %d\n", j);
        }
    }
    for (j = 1; j < 14; j++){
        for (k = 0; k < n; k++){
            if (s[k] == 'D' && v[k] == j) break;
            if (k == n - 1) printf("D %d\n", j);
        }
    }
    return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#include <algorithm>

int main(){
  vector<int> sides(3);
  cin >> sides[0] >> sides[1] >> sides[2];
  sort(sides.begin(), sides.end());
  cout << sides[0] * sides[1] / 2 << endl;
  
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static final long mod=1000000007;
    
    public  static void main(String[] args)   throws Exception, IOException{
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);
        // int n=sc.nextInt();
        // char c[][] = new char[h][w];
        // char c[]=sc.nextString().toCharArray();
        // for(int i=0; i<n; i++) {d[i]=sc.nextInt();}

        // int n=sc.nextInt();
        long x=sc.nextLong();
        long y=sc.nextLong();
        out.println(abs(x-y)<=1 ? "Brown":"Alice");
        out.flush();
    }


    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

class P implements Comparable<P>{
    int id, d;
    P(int  id, int d) {
        this.id=id;
        this.d=d;
    }
    public int compareTo(P p){
        return d-p.d; //des
    }
}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int A, B;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> A >> B;
	
	if (A <= 5) cout << 0 << endl;
	else if (A <= 12) cout << B / 2 << endl;
	else cout << B << endl;
}


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

int main(){
  int N;
  cin >> N;
  vector<ll> A(N);
  vector<ll> B;
  rep(i, N){
    ll a;
    cin >> a;
    A[i] = a;
    if (a % 10 != 0) B.push_back(a);
  }

  ll sum = accumulate(A.begin(), A.end(), 0);
  if (sum % 2 == 0){
    if (B.size() != 0) {
      ll min = *min_element(B.begin(), B.end());
      sum -= min;
    }
    else sum = 0;
  }
  
  cout << sum << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int N,K,Q;
   
    cin >> N >> K >> Q;
    vector<int> A(Q);
    vector<int> point(N);

    for(int i=0;i<Q;i++){
        cin >> A[i];
        A[i] -= 1;
        
    }
    for(int i=0;i<N;i++){
        point[i] = K - Q;
    }

   for(int i=0;i<Q;i++){
       point[A[i]] += 1; 
   }

   for(int i=0;i<N;i++){
       if(point[i] > 0){
           cout << "Yes" << endl;
       }else{
           cout << "No" << endl;
       }
   }

    return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
#define INF 1e9
#define MOD 1e9 + 7

using namespace std;
template<typename T> void cmin(T &a, T b) { a = min(a, b); }
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
int N, M, S, T;

using Graph = vector<vector<int>>;

signed main() {
  cin >> N >> M;
  Graph g(N);

  rep(i, M) {
    int s, t;
    cin >> s >> t;
    s--;
    t--;
    g[s].push_back(t);
  }
  cin >> S >> T;
  S--;
  T--;

  int dst[100005][3];
  rep(i, 100005) rep(j, 3) dst[i][j] = INF;
  queue<pair<int, int>> q;
  q.push(make_pair(S, 0));
  dst[S][0] = 0;
  while (!q.empty()) {
    int v = q.front().first;
    int d = q.front().second;
    q.pop();
    for (auto u : g[v]) {
      if (dst[u][(d + 1) % 3] != INF) continue;
      dst[u][(d + 1) % 3] = dst[v][d] + 1;
      q.push(make_pair(u, (d + 1) % 3));
    }
  }
  int ans = dst[T][0];

  cout << (ans == INF ? -1 : ans / 3) << endl;

  return 0;
}


Measured memory_bytes: 8064
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)

int main() {
	ll X, Y, Z; cin >> X >> Y >> Z;

	cout << (X - Z) / (Y + Z) << endl;
	return 0;
}

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

int main(){
  ll n;
  cin >> n;
  cout << ((n-1) * n) / 2 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int cnt[200010];
main(void){
  int n,k;cin >> n >> k;
  for(int i=0;i<n;i++){
    int a;cin >> a;
    cnt[a-1]++;
  }
  sort(cnt,cnt+n);
  int ans=0;
  for(int i=0;i<n-k;i++) ans+=cnt[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;
template<typename T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return 0;}
template<typename T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return 0;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll H;
    cin >> H;
    ll ans = 0;
    ll pow = 1;
    while (H > 0) {
        ans += pow;
        H /= 2;
        pow *= 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
  
int main(void){
  
int n,a,b,c,i;
  
long d=0;
  
b=-1000000;
  
c=1000000;
  
scanf("%d",&n);
  
for(a=0;a<n;a++){
  
scanf("%d",&i);
  
if(b<i){
  
b=i;
  
}
  
if(c>i){
  
c=i;
  
}
  
d+=i;
  
}
  
printf("%d %d %ld\n",c,b,d);
  
return 0;
  
}

Measured memory_bytes: 600
var chunk = require('fs').readFileSync('/dev/stdin', 'utf8');
var lines = chunk.split('\n');
// var n  =  Number(lines[0]);
var a = lines[1].split(' ').map(Number);

var sum = function (a, b) {return a + b; };

console.log(Math.min.apply(null, a), Math.max.apply(null, a), a.reduce(sum));

Measured memory_bytes: 17384