akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define N 3005
int dp[N][N];
int path[N];
int main(){
	char a[N];
    char b[N];
    scanf("%s%s",a,b);
    int la=strlen(a);
    int lb=strlen(b);
    memset(dp,0,sizeof(dp));
    for(int i=1;i<=la;i++){
        for(int j=1;j<=lb;j++){
            if(a[i-1]==b[j-1]){
            	dp[i][j]=dp[i-1][j-1]+1;
			}
            else{
            	dp[i][j]=max(dp[i-1][j],dp[i][j-1]);
			}
        }
    }
      
	int k=0;
	int i=la,j=lb;
	while(dp[i][j]){
		if(dp[i][j]==dp[i-1][j]){
			i--;
		}else if(dp[i][j]==dp[i][j-1]){
			j--;
		}else{
			path[k++]=i-1;
			i--;j--;
		}
	}
	for(int i=k-1;i>=0;i--){
		printf("%c",a[path[i]]);
	}
	return 0;	
} 



Measured memory_bytes: 35584
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <string>
#include <set>

using namespace std;

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

	int nr = 0;
	int ng = 0;
	int nb = 0;

	for (char c: s) {
		switch (c) {
			case 'R': nr++; break;
			case 'G': ng++; break;
			case 'B': nb++; break;
			default: break;
		}
	}
	long long ans = 1LL * nr * ng * nb;
// printf("ans %lld\n", ans);
	for (int i = 0; i < n; i++) {
		for (int diff = 1; i + 2 * diff < n; diff++) {
			int j = i + diff;
			int k = j + diff;
			if (s[i] != s[j] && s[j] != s[k] && s[i] != s[k]) {
				ans--;
// printf("%d %d %d: %c%c%c\n", i, j, k, s[i], s[j], s[k]);
			}
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pll = pair<ll, ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define rrep(i, m, n) for(ll i = m; i > n; i--)
#define Rep(i, m, n) for(ll i = m; i < n; i++)
#define all(vec) vec.begin(), vec.end()
#define lmax(x, y) max<ll>(x, y)
#define lmin(x, y) min<ll>(x, y)
#define tmax(x, y, z) lmax((x), lmax((y), (z)))
#define tmin(x, y, z) lmin((x), lmin((y), (z)))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
const ll INF = 1LL << 60;
const ll MM = 1000000000; const ll MOD = MM + 7; const ll MMM=9223372036854775807;//2^63 -1
#define ADD(a,b) a = (a + ll(b)) % MOD
#define MUL(a,b) a = (a * ll(b)) % MOD
ll GCD(ll x, ll y){ if(y == 0) return x; else return GCD(y, x % y);}
ll LCM(ll x, ll y){ return x / GCD(x, y) * y;}
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;}
template<typename A, size_t N, typename T> void FILL(A (&array)[N], const T &val){ fill( (T*)array, (T*)(array+N), val );}
// struct edge{ ll from, to, cost; };
// struct edge{ ll to, cost; };
// using Graph = vector<vector<ll>>;  // 重み無し
// using Graph = vector<edge>;  // 辺
// using Graph = vector<vector<edge>>;  // 重み付き
ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
ll ddx[8] = {1, 1, 0, -1, -1, -1, 0, 1}, ddy[8] = {0, 1, 1, 1, 0, -1, -1, -1};


int main(){
    ll x; cin >> x;
    if(x == 0) cout << 1 << endl;
    else cout << 0 << endl;
}


Measured memory_bytes: 3612
/*
ЗАПУСКАЕМ
░ГУСЯ░▄▀▀▀▄░РАБОТЯГУ░░
▄███▀░◐░░░▌░░░░░░░
░░░░▌░░░░░▐░░░░░░░
░░░░▐░░░░░▐░░░░░░░
░░░░▌░░░░░▐▄▄░░░░░
░░░░▌░░░░▄▀▒▒▀▀▀▀▄
░░░▐░░░░▐▒▒▒▒▒▒▒▒▀▀▄
░░░▐░░░░▐▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░▀▄░░░░▀▄▒▒▒▒▒▒▒▒▒▒▀▄
░░░░░░▀▄▄▄▄▄█▄▄▄▄▄▄▄▄▄▄▄▀▄
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░░░▌▌░▌▌░░░░░
░░░░░░░░░▄▄▌▌▄▌▌░░░░░
 */
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
 
using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { x = (x > y ? y: x);}
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { x = (x < y ? y: x);}
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left224
#define right right224
#define next next224
#define rank rank224
#define prev prev224
#define y1 y1224
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define files(FILENAME) read(FILENAME), write(FILENAME)
#define pb push_back
#define mp make_pair
using ll = long long;
const string FILENAME = "input";


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   // read(FILENAME); 
    string s;
    cin >> s;
    string kukarek;
    string cur;
    int opa = 0;
    for (auto x: s) {
        cur += x;
        if (cur != kukarek) {
            kukarek = cur;
            opa++;
            cur.clear();
        }
    }
    cout << opa << endl;
    return 0; 
}




Measured memory_bytes: 720
N = int(input())
S1 = list(input())
S2 = list(input())

mod = 1000000007

if S1[0] == S2[0]:
    ans = 3
    c = 1
else:
    ans = 6
    c = 2
    
i = c
while i < N:
    if S1[i] == S2[i]:
        ans *= (3-c)
        ans %= mod
        c = 1
        i += 1
    elif c == 1:
        ans *= 2
        ans %= mod
        c = 2
        i += 2
    else:
        ans *= 3
        ans %= mod
        c = 2
        i += 2
        
print(ans)

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

using namespace std;

void solve(vector <int> &a, vector <int> &ind){
    vector <int> ans;
    int l=ind[0];
    for(int i=0;i<l;i++){
        ans.push_back(1);
        a.erase(a.begin());
        for(int j=0;j<ind.size();j++){
            ind[j]--;
        }
    }
    for(int i=0;a.size()-1>ind.back();i++){
        ans.push_back(a.size());
        a.pop_back();
    }
    for(int i=1;i<ind.size();i++){
        int st=ind[i-1];
        int l=ind[i]-ind[i-1], tl=l;
        while(l){
            ans.push_back(ind[i-1]+(l/2)+1);
            l-=2;
        }
        for(int j=i;j<ind.size();j++){
            ind[j]-=tl;
        }
    }
    cout << ans.size() << endl;
    for(int i=0;i<ans.size();i++){
        cout << ans[i] << endl;
    }
}

int main(){
    int n;
    cin >> n;
    vector <int> a(n);
    long long va=0,vb=0;
    int ma=INT_MIN,mb=INT_MIN, ima, imb;
    vector <int> ia,ib;
    for(int i=0;i<n;i++){
        cin >> a[i];
        if(i&1){
            if(a[i]>0){
                va+=a[i];
                ia.push_back(i);
            }
            if(ma<a[i]){
                ma=a[i];
                ima=i;
            }
        }
        else{
            if(a[i]>0){
                vb+=a[i];
                ib.push_back(i);
            }
            if(mb<a[i]){
                mb=a[i];
                imb=i;
            }
        }
    }
    if(va == 0 && vb == 0){
        va=ma;
        vb=mb;
        ia.push_back(ima);
        ib.push_back(imb);
    }
    cout << max(va,vb) << endl;
    if(va>vb){
        solve(a,ia);
    }
    else{
        solve(a,ib);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  unsigned int N, a, b, c, temp = 0;
  int count = 0;
  int A[200];
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  // N = 6;
  // A[0] = 382253568, A[1] = 723152896, A[2] = 37802240, A[3] = 379425024, A[4] = 404894720, A[5] = 471526144;

  while(count == 0){
    for(int i = 0; i < N; i++){
      if(A[i]%2) count++;
      // cout << A[i] << ' ';
    }
    // cout << endl;

    if(count == 0){
      for(int i = 0; i < N; i++){
        A[i] = A[i]/2;
      }
      temp++;
    }
  }
  cout << temp << endl;
  
  return 0;
}

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

int main() {
    ll n, m;
    cin >> n >> m;
    if (n >= 2 && m >= 2) cout << (n - 2) * (m - 2) << endl;
    else if (n == 1 && m == 1) cout << 1 << endl;
    else if (n == 1) cout << m - 2 << endl;
    else if (m == 1) cout << n - 2 << endl;
}


Measured memory_bytes: 256
def is_gu(S):
    A = S[(len(S)/2):]
    B = S[:-1*(len(S)/2)]
    if A == B:
        return True
    else:
        return False

S = raw_input()

while len(S) > 1:
    S = S[:-1]
    if len(S) % 2 == 0 and is_gu(S):
        ans = len(S)
        break

print str(ans)

Measured memory_bytes: 2568
size x y h = x + y + h

fee (x:y:h:w:_)
  | (size x y h) <=  60 && w <=  2 =  600
  | (size x y h) <=  80 && w <=  5 =  800
  | (size x y h) <= 100 && w <= 10 = 1000
  | (size x y h) <= 120 && w <= 15 = 1200
  | (size x y h) <= 140 && w <= 20 = 1400
  | (size x y h) <= 160 && w <= 25 = 1600
  | otherwise  = 0

ans' d = sum $ map fee d

ans ([0]:_) = []
ans ([n]:x) =
  let d = take n x
      r = drop n x
  in
    (ans' d):(ans r)

main = do
  c <- getContents
  let i = map (map read) $ map words $ lines c :: [[Int]]
      o = ans i
  mapM_ print o

Measured memory_bytes: 15392
#define DEBUG 0

/**
 * File    : E.cpp
 * Author  : Kazune Takahashi
 * Created : 2019-5-14 14:51:45
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(10101010));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

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

// const int C = 1e6+10;
const ll M = 1000000007;

int N;
int A[500010];
int X[500010];
typedef tuple<int, int> info;
vector<info> V[1 << 20];
int zero[1 << 20];
int cnt = 0;
typedef tuple<int, int> res;

void make_vector()
{
  fill(zero, zero + (1 << 20), 0);
  for (auto i = 1; i < N; i++)
  {
    if (X[i] == 0)
    {
      cnt++;
    }
    else
    {
      int K = X[i];
      int t = cnt - zero[K];
      if (t > 0)
      {
        V[K].push_back(info(0, t));
      }
      V[K].push_back(info(K, 1));
      zero[X[i]] = cnt;
    }
  }
  for (auto K = 1; K < (1 << 20); K++)
  {
    int t = cnt - zero[K];
    if (t > 0)
    {
      V[K].push_back(info(0, t));
    }
  }
}

res DP(int K)
{
  int S = V[K].size();
  vector<ll> DP0(S + 1, 0);
  vector<ll> DP1(S + 1, 0);
  DP0[0] = 1;
#if DEBUG == 1
  if (K < 4)
  {
    cerr << "DP(" << K << ")" << endl;
  }
#endif
  for (auto i = 0; i < S; i++)
  {
    int n = get<0>(V[K][i]);
    ll s = get<1>(V[K][i]);
    if (n == 0)
    {
      DP0[i + 1] = (DP0[i] + s * DP1[i]) % M;
      DP1[i + 1] = DP1[i];
    }
    else
    {
      DP0[i + 1] = DP0[i];
      DP1[i + 1] = (DP0[i] + DP1[i]) % M;
    }
#if DEBUG == 1
    if (K < 4)
    {
      cerr << "DP0[" << i + 1 << "] = " << DP0[i + 1]
           << ", DP1[" << i + 1 << "] = " << DP1[i + 1] << endl;
    }
#endif
  }
  return res(DP0[S], DP1[S]);
}

void solve0()
{
  ll ans = 1;
  for (auto i = 1; i < N; i++)
  {
    if (X[i] == 0)
    {
      ans *= 2;
      ans %= M;
    }
  }
  make_vector();
  for (auto K = 1; K < (1 << 20); K++)
  {
    ll temp = get<1>(DP(K));
    ans += temp;
    ans %= M;
  }
  cout << ans << endl;
}

void solve1()
{
  make_vector();
  cout << get<0>(DP(X[N])) << endl;
}

int main()
{
  cin >> N;
  for (auto i = 0; i < N; i++)
  {
    cin >> A[i];
  }
  X[0] = 0;
  for (auto i = 0; i < N; i++)
  {
    X[i + 1] = A[i] ^ X[i];
  }
  if (X[N] == 0)
  {
    solve0();
  }
  else
  {
    solve1();
  }
}

Measured memory_bytes: 76140
import sys
from heapq import heappop, heappush

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, M = lr()
# 3*N頂点あるとする
edges = [[] for _ in range(3*N + 4)] # 3-indexed
for _ in range(M):
    u, v = lr()
    u *= 3; v *= 3
    edges[u].append(v+1)
    edges[u+1].append(v+2)
    edges[u+2].append(v)

INF = 10 ** 18

def dijkstra(start):
    dist = [INF] * (3*N+4)
    dist[start] = 0
    que = [(0, start)]
    while que:
        d, v = heappop(que)
        if dist[v] < d:
            continue
        for next in edges[v]:
            d1 = d + 1
            if dist[next] > d1:
                dist[next] = d1
                heappush(que, (d1, next))
    return dist

S, T = lr()
dist = dijkstra(S*3)
if dist[T*3] == INF:
    print(-1)
else:
    print(dist[T*3] // 3)


Measured memory_bytes: 61512
#include <iostream>
#include <string>

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

    if(a > b) {
        for(int i = 0; i < a; i++) {
            std::cout << b;
        }
        std::cout << std::endl;
    } else {
        for(int i = 0; i < b; i++) {
            std::cout << a;
        }
        std::cout << std::endl;
    }
}


Measured memory_bytes: 256
def main(N, A):
    ans = 0
    for n in range(1, N+1, 2):
        if A[n-1] % 2 == 1:
            ans += 1
    print(ans)


if __name__ == '__main__':
    N = int(input())
    A = list(map(int, input().split()))
    main(N, A)

Measured memory_bytes: 9176
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

class UnionFind{
    public:
        vector<ll> uni;
        UnionFind(ll s) : uni(s, -1) { }

       //頂点aが所属するグループを調べる
        ll root(ll a)
        {
            if (uni[a] < 0) return a;
            return uni[a] = root(uni[a]);
        }

        //頂点aと頂点bを繋ぐ。もともと同じグループの時falseを返す
        bool connect(ll a, ll b)
        {
            a = root(a);
            b = root(b);
            if (a == b) return false;

            if (uni[a] > uni[b])
            {
                a ^= b;
                b ^= a;
                a ^= b;
            }

            uni[a] = uni[a] + uni[b];
            uni[b] = a;
            return true;
        }

        //頂点a,bが同じグループであるかを調べる
        bool isConnect(ll a, ll b)
        {
            return root(a) == root(b);
        }

        //頂点aを含むグループの頂点数を調べる
        ll size(ll a)
        {
            return -uni[root(a)];
        }
};

int main(int argc, char const *argv[])
{
    ll n, m;
    cin >> n >> m;

    UnionFind u(n);
    for (ll i = 0; i < m; i++)
    {
        ll a, b;
        cin >> a >> b;
        u.connect(a, b);
    }

    set<ll> s;

    for (ll i = 0; i < n; i++)
    {
        s.insert(u.root(i));
    }

    cout << s.size() - 1 << endl;
}

Measured memory_bytes: 7772
#include<stdio.h>
int main(){
    int n,a,b;
    const int mod=1000000007;
    scanf("%d%d%d",&n,&a,&b);
    long long all=1,nCa=1,nCb=1,pow=2;
    for(int i=n;i;i/=2){
        if(i%2){
            all*=pow;
            all%=mod;
        }
        pow*=pow;
        pow%=mod;
    }
    all--;
    long long A=1,B=1;//a!,b!の逆元
    for(int i=n;i>=n-a+1;i--){
        nCa*=i;
        nCa%=mod;
    }
    for(int i=1;i<=a;i++){
        A*=i;
        A%=mod;
    }
    pow=A;
    A=1;
    for(int i=mod-2;i;i/=2){
        if(i%2){
            A*=pow;
            A%=mod;
        }
        pow*=pow;
        pow%=mod;
    }
    nCa*=A;
    nCa%=mod;
    for(int i=n;i>=n-b+1;i--){
        nCb*=i;
        nCb%=mod;
    }
    for(int i=1;i<=b;i++){
        B*=i;
        B%=mod;
    }
    pow=B;
    B=1;
    for(int i=mod-2;i;i/=2){
        if(i%2){
            B*=pow;
            B%=mod;
        }
        pow*=pow;
        pow%=mod;
    }
    nCb*=B;
    nCb%=mod;
    int x=all-nCa-nCb;
    while(x<0)
        x+=mod;
    printf("%d\n",x);
    return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
	char c,c1,c2,c3,c4,c5;
	scanf("%c %c %c %c %c %c",&c,&c1,&c2,&c3,&c4,&c5);
	if(c==c5&&c1==c4&&c2==c3){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}

Measured memory_bytes: 1576
#include "bits/stdc++.h"

#define sp <<" "
#define el <<"\n"
#define S second
#define F first
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define obit __builtin_popcount
#define pof pop_front
#define pai pair<int,int> 
#define For(i,a,n) for(i=a;i<n;i++)
#define all(ar) ar.begin(),ar.end() 
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned short int us;
typedef short int ss;
typedef long double ld;
const ll mod = 1000000007;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    /*
#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
#endif
    //*/
    int n,k, ans = 0;
    cin>>k>>n;
    for(int a = 0;a<=k;a++){
        for(int b = 0;b<=k;b++){
            int s = n - ( a  + b);
            if(s >= 0 && s <= k) ans++;
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;


int binarysearch(int a[],int key,int n) {
	int left = 0,right = n;
	while(left<right){
		int mid = (left + right) / 2;
		if (a[mid] == key)return 1;
		else if (key < a[mid]) {
			right = mid;
		}
		else {
			left = mid + 1;
		}
	}
	return -1;
}
int main() {
	int n, q, S[100000],key,i;
	int sum = 0;
	cin >> n;
	for (i = 0;i < n;++i)cin >> S[i];
	cin >> q;
	for (i = 0;i < q;++i) {
		cin >> key;
		if (binarysearch(S, key,n) != -1)sum++;
	}
	cout << sum << endl;
	return 0;
}


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

vector<vector<int>> s;
vector<int> c, t;
vector<pair<int, int>> last;
vector<int64_t> b_score, c_score;

void calc_score(int start, bool update) {
    for (auto i = start; i < (int)t.size(); i++) {
        if(i != 0) {
            b_score[i] = b_score[i - 1];
            c_score[i] = c_score[i - 1];
        } else b_score[i] = c_score[i] = 0;
        b_score[i] += s[i][t[i]];
        if(update) last[t[i]] = {i + 1, last[t[i]].first};
        for (auto j = 0; j < 26; j++) {
            c_score[i] -= c[j] * (i + 1 - last[j].first);
        }
    }
}

void calc_score(pair<int, int>& q) {
    // 変更前のlast値
    last[t[q.first]].first = last[t[q.first]].second;
    last[t[q.first]].second = 0;
    // tの値を変更
    t[q.first] = q.second;
    // 変更後のlast値
    last[t[q.first]] = {q.first + 1, last[t[q.first]].first};
    calc_score(q.first, false);
}

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

    c.resize(26); last.assign(26, {0, 0});
    for (auto i = 0; i < 26; i++) cin >> c[i];

    s.assign(d, vector<int>(26));
    for (auto i = 0; i < d; i++) {
        for (auto j = 0; j < 26; j++) cin >> s[i][j];
    }

    t.resize(d); b_score.assign(d, 0); c_score.assign(d, 0);
    for (auto i = 0; i < d; i++) {
        cin >> t[i]; t[i]--;
    }
    calc_score(0, true);
//    for (auto i = 0; i < d; i++) cout << b_score[i] + c_score[i] << endl;
//    cout << endl;

    int m; cin >> m;
    for (auto i = 0; i < m; i++) {
        pair<int, int> q; cin >> q.first >> q.second;
        q.first--; q.second--;
        t[q.first] = q.second; last.assign(26, {0, 0});
        calc_score(0, true);
        cout << b_score.back() + c_score.back() << endl;
    }

    return 0;
}

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

const long double pi= 3.1415926535897932384626;
const long double eps = 1e-9;


signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int n;
    cin>>n;
    long double x[n],y[n];
    long double ans = 0;
    array<long double,3> d[n];
    for(int i=0;i<n;i++){
        cin>>x[i]>>y[i];
        d[i] = {atan2(y[i],x[i]),x[i],y[i]};
        ans = max(ans, x[i]*x[i] + y[i]*y[i]);
    }
    sort(d,d+n);
    for(int i=0;i<n;i++){
        long double dx = 0, dy = 0;
        for(int j=0;j<n;j++){
            dx += d[(i+j)%n][1], dy += d[(i+j)%n][2];
            ans = max(ans,dx*dx + dy*dy);
        }
    }
    
    ans = sqrt(ans);
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(),(x).end()
#define isz(x) (int)(x).size()
#define watch(x) std::cerr << #x << " = " << x
#define watchln(x) watch(x) << std::endl
#define watchsp(x) watch(x) << ' '
template<typename Iterator>
std::ostream& print_range(std::ostream& os, Iterator begin, Iterator end) {
    os << "{";
    for (auto it = begin; it != end; it++) {
        if (it != begin) os << ", ";
        os << *it;
    }
    return os <<"}";
}
template<typename T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
    return print_range(os, all(vec));
}
using vi = std::vector<int>;
using ll = long long;
using vvi = std::vector<vi>;
const int NMAX = 100100;
int nV, mod;
int dp[2][NMAX];
vi adj[NMAX];
vi answ;
void dfs(int u, int p) {
    for (int v : adj[u]) {
        if (v == p) continue;
        dfs(v, u);
    }
    dp[0][u] = dp[1][u] = 1;
    for (int v : adj[u]) {
        if (v == p) continue;
        //dp[0][u] = int(dp[0][u] * (dp[0][v] + 1LL) % mod);
        dp[1][u] = int(dp[1][u] * 1LL * (dp[0][v] + dp[1][v]) % mod);
    }
    //std::cout << "u = " << u << ", dp0 = " << dp[0][u] << ", dp1 = " << dp[1][u] << std::endl;
}
void solve(int u, int p) {
    answ[u] = dp[1][u];
    std::reverse(all(adj[u]));
    vi stack0 = {1};
    vi stack1 = {1};
    for (int v : adj[u]) {
        stack1.push_back(int(stack1.back() * 1LL * (dp[0][v] + dp[1][v]) % mod));
        stack0.push_back(int(stack0.back() * 1LL * (dp[0][v]) % mod));
    }
    std::reverse(all(adj[u]));
    int pref0 = 1, pref1 = 1;
    for (int v : adj[u]) {
        stack1.pop_back();
        stack0.pop_back();
        dp[0][u] = int(pref0 * 1LL * stack0.back() * 1LL % mod);
        dp[1][u] = int(pref1 * 1LL * stack1.back() * 1LL % mod);
        if (v != p) {
            int old0 = dp[0][v];
            int old1 = dp[1][v];
            dp[0][v] = int(1LL * dp[0][v] * (dp[0][u]) % mod);
            dp[1][v] = int(1LL * dp[1][v] * (dp[0][u] + dp[1][u]) % mod);
            solve(v, u);
            dp[0][v] = old0;
            dp[1][v] = old1;
        }
        pref1 = pref1 * 1LL * (dp[1][v] + dp[0][v]) % mod;
        pref0 = pref0 * 1LL * (dp[0][v]) % mod;
    }
}
int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);
    std::cin >> nV >> mod;
    answ.assign(1+nV, 1);
    for (int i = 1; i < nV; i++) {
        int x, y; std::cin >> x >> y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    dfs(1,0);
    solve(1,0);
    for (int i = 1; i <= nV; i++) {
        std::cout << answ[i] << ' ';
    }
    std::cout << std::endl;
    return 0;
}

Measured memory_bytes: 24832
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <vector>

using namespace std;
using ll = long long int;

const ll MOD = 1e9 + 7;

ll pow_fast(ll n, ll k) {
  if (k == 0) {
    return 1LL;
  }
  if (k == 1) {
    return n;
  }

  if (k % 2 == 0) {
    ll tmp = pow_fast(n, k / 2);
    return tmp * tmp % MOD;
  } else {
    ll tmp = pow_fast(n, (k - 1) / 2);
    tmp *= tmp;
    tmp %= MOD;
    return tmp * n % MOD;
  }
}

template <typename T>
class stack {
 private:
  vector<T> _vec;

 public:
  stack(){};

  void push(T n) {
    _vec.push_back(n);
    return;
  }

  void pop() {
    if (this->empty()) {
      return;
    }
    _vec.erase(_vec.end() - 1);
    _vec.shrink_to_fit();
    return;
  }

  size_t size() { return _vec.size(); }

  T top() { return _vec[this->size() - 1]; }
  bool empty() { return _vec.empty(); }
};

int main() {
  ll A, B, C;
  cin >> A >> B >> C;
  ll mod = A % B;

  if (mod == 0 && mod == C) {
    cout << "YES" << endl;
    return 0;
  }

  bool ok = false;
  for (ll i = 1; i <= 101; i++)
  {
    if (A * i % B == C) {
      ok = true;
    }
  }
  cout << (ok ? "YES" : "NO") << endl;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define deb(x) cerr << "\n" \
                    << #x << "=" << x << "\n";
#define deb2(x, y) cerr << "\n"                   \
                        << #x << "=" << x << "\n" \
                        << #y << "=" << y << "\n";
#define w(x) \
  int x;     \
  cin >> x;  \
  while (x--)

int32_t main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int k;
  cin >> k;
  string s;
  cin >> s;
  if (s.length() <= k)
    cout << s;
  else
  {
    for (int i = 0; i < k; i++)
      cout << s[i];
    cout << "...";
  }

  return 0;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h> 
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
typedef long long ll;
using namespace std;
inline int read(){
	int n=0,f=1;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if (c=='-') c=getchar(),f=-1;
	for(;c>='0'&&c<='9';c=getchar()) n=n*10+c-48;
	return n*f;
}
const int maxn=1e5+5;
int i,j,n,m,s[maxn],ans,t;
int k[maxn],g[maxn<<1],ne[maxn<<1],num,b;
int u,v,f[maxn],p[maxn];
int a[maxn],cnt;
bool bz[maxn],d[maxn];
void add(int x,int y){
	ne[++num]=k[x],k[x]=num,g[num]=y;
}
void dfs(int x,int y){
	int i;
	bz[x]=1,f[x]=y,d[x]=d[y]^1;
	s[x]=d[x]?1:-1;
	if (x==u||x==v) s[x]+=t;
	for(i=k[x];i;i=ne[i]){
		int go=g[i];
		if (go!=y){
			if (!bz[go]) dfs(go,x),s[x]+=s[go];else
			b=d[x]==d[go],u=x,v=go;
		}
	}
}
int main(){
	n=read(),m=read();
	fo(i,1,m){
		int  x=read(),y=read();
		add(x,y),add(y,x);
	}
	dfs(1,0);
	if ((s[1]&&!b)||(s[1]&1)) {
		puts("-1");return 0;
	}
	if (n==m-1){
		fo(i,1,n) ans+=abs(s[i]);
		printf("%d\n",ans);
		return 0;
	}
	memset(bz,0,sizeof(bz));
	if (b){
		t=-(s[1]/2);
		if (t){
			for(;u;u=f[u]) s[u]+=t;
			for(;v;v=f[v]) s[v]+=t;
		}
		ans=abs(t);
		fo(i,1,n) ans+=abs(s[i]);
		printf("%d\n",ans);
		return 0;
	}
	for(;u;u=f[u]) p[u]++;
	for(;v;v=f[v]) p[v]--;
	a[cnt=1]=0;
	fo(i,1,n) if (!p[i]) ans+=abs(s[i]);else
	a[++cnt]=(p[i]==1)?-s[i]:s[i];
	int mid=(cnt+1)/2;
	nth_element(a+1,a+mid,a+1+cnt);
	fo(i,1,cnt) ans+=abs(a[mid]-a[i]);
	printf("%d\n",ans);
}

Measured memory_bytes: 8576
//
#include <bits/stdc++.h>
using namespace std;
template<size_t SIZE, class T> inline size_t array_size(T (&arr)[SIZE]) {
    return SIZE;
}
int main() {
    int n;
    cin>>n;
    vector<int> htbl(n,0);
    for(auto &h:htbl){
        cin >> h;
    }
    int ans=0;
    int max = -1;
    for (int i=0;i<htbl.size();++i){
        if (htbl[i] >= max) {
            max = htbl[i];
            ++ans;
        }
    }
    // for(int i=htbl.size()-2;i>=0;--i){
    //     if(htbl[i+1] >= htbl[i]){
    //         ++ans;
    //     } else {
    //         break;
    //     }
    // }
    cout<<ans<<endl;
    return 0;
}

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

int main()
{
  long long N, T;
  cin >> N >> T;
  long long ans = 0, pt, nt;
  cin >> pt;
  for(long long i = 1; i < N; i++){
    cin >> nt;
    if(nt-pt <= T){
      ans += nt-pt;
    }else{
      ans += T;
    }
    pt = nt;
  }
  ans += T;
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <stdio.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <sstream>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort(ALL(x))
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	int n; cin>>n;
  VI d(n);
  rep(i,n){
    cin>>d[i];
    if(d[i]==0) return cout<<0<<endl, 0;
  }
  int cnt[12]; CLR(cnt);
  rep(i,n){
    if(d[i]==0) continue;
    cnt[d[i]%12]++;
  }
  VI clock;
  int flg = 1;
  clock.PB(12);
  reps(i,11){
    if(cnt[i]>2) return cout<<0<<endl, 0;
    else if(cnt[i]==2){
      clock.PB(12-i); clock.PB(12+i);
    }else if(cnt[i]==1){
      clock.PB(12+flg*i); flg *= -1;
    }
  }
  if(cnt[0]) clock.PB(0);
  sort(ALL(clock));
  int s = 24;
  int l = clock.size();
  if(l==1) return cout<<0<<endl, 0;
  rep(i,l-1){
    cerr << clock[i] << ' ';
    s = min(s,clock[i+1]-clock[i]);
  }
  cerr << clock[l-1] <<  endl;
  s = min(s,24+clock[0]-clock[l-1]);
  cout << s << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
   ll l;
   string s;
   cin>>s;
   l=s.size();
   if(s[l-1]=='s')
   {
       cout<<s<<"es";
   }
   else
   cout<<s<<"s";


}



Measured memory_bytes: 3592
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n int
	var s, t string
	fmt.Scan(&n, &s, &t)
	var newChars []string
	for i := 0; i < n; i++ {
		newChars = append(newChars, string(s[i]))
		newChars = append(newChars, string(t[i]))
	}
	fmt.Println(strings.Join(newChars, ""))
}

Measured memory_bytes: 640
n = input().rstrip()
n = int(n)

a_i_inputs = input().rstrip().split(' ')
a_i_list = [int(i) for i in a_i_inputs[:n]]

output_list = [0 for _ in range(n)]

for a_i in a_i_list:
  output_list[a_i-1] += 1
  
for output in output_list:
  print(output)


Measured memory_bytes: 33796
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

using T = tuple<int, int, int>;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> to(n);
  rep(i, n-1) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }
  vector<int> node(n);
  int odd = 0, even = 0;
  queue<T> que;
  que.emplace(0, -1, 0);
  while (!que.empty()) {
    int now, prev, col;
    tie(now, prev, col) = que.front();
    que.pop();
    node[now] = col;
    if (col)
      odd++;
    else
      even++;
    for (auto next : to[now]) {
      if (next == prev)
        continue;
      que.emplace(next, now, col^1);
    }
  }
  if (min(odd, even) <= n/3) {
    deque<int> deq;
    for (int i = 1; i <= n; i++) {
      if (i%3)
        deq.push_back(i);
      else
        deq.push_front(i);
    }
    if (odd < even) {
      rep(i, n) {
        if (node[i]) {
          node[i] = deq.front();
          deq.pop_front();
        } else {
          node[i] = deq.back();
          deq.pop_back();
        }
      }
    } else {
      rep(i, n) {
        if (!node[i]) {
          node[i] = deq.front();
          deq.pop_front();
        } else {
          node[i] = deq.back();
          deq.pop_back();
        }
      }
    }
  } else {
    queue<int> que1, que2, que3;
    for (int i = 1; i <= n; i++) {
      if (i%3 == 1)
        que1.push(i);
      else if (i%3 == 2)
        que2.push(i);
      else
        que3.push(i);
    }
    rep(i, n) {
      if (node[i] && !que1.empty()) {
        node[i] = que1.front();
        que1.pop();
      } else if (!node[i] && !que2.empty()) {
        node[i] = que2.front();
        que2.pop();
      } else {
        node[i] = que3.front();
        que3.pop();
      }
    }
  }
  rep(i, n) {
    if (i)
      cout << ' ';
    cout << node[i];
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 17544
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define MOD (ll)1000000007

char s[2020];

int main(void)
{
	scanf("%s", s + 1);
	int ss = strlen(s + 1) + 1;
	if (s[ss - 1] == 's')
		s[ss] = 'e', s[ss + 1] = 's', s[ss + 2] = 0;
	else
		s[ss] = 's', s[ss + 1] = 0;
	printf("%s", s + 1);
	return 0;
}

Measured memory_bytes: 1736
S = input()

count = [0 for i in range(len(S))]

atgc = ['A', 'T', 'G', 'C']

idx = 0
for i in S:
    if i in atgc:
        count[idx] = 1
    idx += 1

list_ct = []
ct = 0
for i in count:
    if i == 1:
        ct += 1
    else:
        if ct > 0:
            list_ct.append(ct)
            ct = 0

if ct:
    list_ct.append(ct)

if list_ct:
    print(max(list_ct))
else:
    print(0)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define vi vector<int>
#define ff first
#define ss second
#define file_se_input  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define pp long long int
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define pb push_back
#define mp make_pair
#define pi 3.141592653589793238
#define eb emplace_back
#define rep(i,a,b) for (int i = a; i <= b; i++)
#define zip(i,a,b) for(int i=a;i<b;i++)
#define rzip(i,a,b) for(int i=a;i>=b;i--)
#define ll unsigned long long int
#define test int t;cin>>t; while(t--)
#define um unordered_map
#define en '\n'
#define us unordered_set
typedef pair<int, int>     pii;
typedef pair<char, int>    pci;
typedef pair<char, char>   pcc;
typedef vector<pii>       vii;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define INF (1e18+5)
#define inf (1e9+5)
#define mod 1000000007


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

}

int BE(int x, int n, int m) //function to calculate x raise to power n modulo m
{
	int result = 1;
	while (n > 0)
	{
		if (n % 2 == 1)
			result = result * x % m;
		x = x * x % m;
		n = n / 2;
	}
	return result;
}

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);
#ifndef ONLINE_JUDGE
	if (fopen("input.txt", "r"))
	{
		freopen ("input.txt" , "r" , stdin);
		freopen ("output.txt" , "w" , stdout);
	}
#endif
	//_______________________________-code starts-_______________________________________________

	int n, p;
	cin >> n >> p;
	map<int, int>mt;
	int pp1 = sqrt(p);
	while (p % 2 == 0)
	{
		p = p / 2;
		mt[2]++;
	}

	for (int i = 3; i <= sqrt(p); i += 2)
	{
		int x = i;
		while (p % x == 0)
		{
			p = p / x;
			mt[x]++;
		}
	}
	if (p > 2)
	{
		mt[p]++;
	}
	int ans = 1;
	for (auto itr = mt.begin(); itr != mt.end(); itr++)
	{
		int x = itr->ss;
		int y = itr->ff;
		//cout << y << " " << x << en;
		int z = (x / n);
		ans *= pow(y, z);
	}
	cout << ans << en;


	return 0;
}



Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <iomanip>
using namespace std;
#define int long long

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


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

    string sa,sb,sc; cin >> sa >>sb  >> sc;
    reverse(sa.begin(),sa.end());
    reverse(sb.begin(),sb.end());
    reverse(sc.begin(),sc.end());

    char now = 'a';

    for(;;){
        if(now == 'a'){
            if(sa.size() == 0){
                cout << 'A' << endl;
                return 0;
            }
            now = sa.at(sa.size()-1);
            sa.pop_back();
        }else if(now == 'b'){
            if(sb.size() == 0){
                cout << 'B' << endl;
                return 0;
            }
            now = sb.at(sb.size()-1);
            sb.pop_back();            
        }else{
            if(sc.size() == 0){
                cout << 'C' << endl;
                return 0;
            }
            now = sc.at(sc.size()-1);
            sc.pop_back();
        }

    }
}

Measured memory_bytes: 256
import java.util.*;

class Main {
	Scanner sc;
	int N, K;
	int[] A;
	static final int MOD = 1000_000_007;
	
	private void calc() {
		sc = new Scanner(System.in);
		N = sc.nextInt();
		K = sc.nextInt();
		A = new int[N+1];
		A[0] = Integer.MIN_VALUE;
		for (int i = 1; i <= N; i++) A[i] = sc.nextInt();
		Arrays.sort(A);
		
		long nCr = 1;
		long s = 0;
		
		long ans = 0;
		for (int l = K; l <= N; l++) {
			s = (s + nCr) % MOD;
			nCr = nCr * (l-1) % MOD * inv(l-K+1) % MOD;
			
			ans = (ans + A[l] * s % MOD) % MOD;
			ans = (ans - A[N-l+1] * s % MOD + MOD) % MOD;
		}
		
		System.out.println(ans);
	}
	
	private static long inv(long a) {
		long b = MOD;
		long aa = a, bb = b;
		long x0 = 1, x1 = 0;
		long y0 = 0, y1 = 1;
	
		while (b != 0) {
			long q = a / b;
			long r = a % b;
			long x2 = x0 - q * x1;
			long y2 = y0 - q * y1;
	
			a = b; b = r;
			x0 = x1; x1 = x2;
			y0 = y1; y1 = y2;
		}
		if (bb > 0 && x0 < 0) {
			long n = -x0/bb;
			if (-x0%bb != 0) n++;
			x0 += n*bb; y0 -= n*aa;
		}
	    return x0;
	}
	
	public static void main(String[] args) {
		new Main().calc();
	}
}


Measured memory_bytes: 50288
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::Read;
#[allow(dead_code)]
fn getline() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok().unwrap();
    ret
}
fn get_word() -> String {
    let mut stdin = std::io::stdin();
    let mut u8b: [u8; 1] = [0];
    loop {
        let mut buf: Vec<u8> = Vec::with_capacity(16);
        loop {
            let res = stdin.read(&mut u8b);
            if res.unwrap_or(0) == 0 || u8b[0] <= b' ' {
                break;
            } else {
                buf.push(u8b[0]);
            }
        }
        if buf.len() >= 1 {
            let ret = String::from_utf8(buf).unwrap();
            return ret;
        }
    }
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>() -> T { get_word().parse().ok().unwrap() }

fn solve() {
    let x: i64 = get();
    let y: i64 = get();
    let d = x - y;
    println!("{}", if d.abs() <= 1 { "Brown" } else { "Alice" });
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

void main() {
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];
    auto edges = new int[][](N);
    foreach (_; 0..M) {
        s = readln.split.map!(to!int);
        edges[s[0]-1] ~= s[1]-1;
        edges[s[1]-1] ~= s[0]-1;
    }
    auto used = new bool[][](N, 2);

    void dfs(int n, int x) {
        if (used[n][x]) return;
        used[n][x] = true;
        foreach (m; edges[n]) dfs(m, x^1);
    }

    dfs(0, 0);
    long a = used.map!(u => u[0]).sum;
    long b = used.map!(u => u[1]).sum;
    long c = used.map!(u => u[0] && u[1]).sum;
    writeln(a * b - M - c - c * (c - 1) / 2);
}


Measured memory_bytes: 14844
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N,a,b = inpl()
def calc(x):
    ret = 1
    for i in range(N-x+1,N+1):
        ret *= i
        ret %= mod

    for i in range(1, x+1):
        ret *= pow(i,mod-2,mod)
        ret %= mod

    return ret%mod

ans = pow(2,N,mod)-1 - calc(a) - calc(b)
print(ans%mod)


Measured memory_bytes: 41836
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>

using namespace std;

vector<long long> shortest(const vector<vector<pair<int, long long>>> &g, int s)
{
	const int N = g.size();
	const long long inf = 1LL << 59;
	vector<long long> ans(N, inf);

	vector<bool> visited(N, false);
	stack<int> waiting;
	auto visit = [&](int x, long long cost) {
		if (!visited[x]) {
			visited[x] = true;
			ans[x] = cost;
			waiting.push(x);
		}
	};
	visit(s, 0);
	while (!waiting.empty()) {
		auto x = waiting.top();
		waiting.pop();
		for (auto &e : g[x]) {
			visit(e.first, ans[x] + e.second);
		}
	}
	return ans;
}

int main()
{
	int N;
	cin >> N;
	vector<vector<pair<int, long long>>> g(N);
	for (int i = 0; i < N - 1; ++i) {
		int a, b, c;
		cin >> a >> b >> c;
		--a;
		--b;
		g[a].emplace_back(b, c);
		g[b].emplace_back(a, c);
	}

	int Q, K;
	cin >> Q >> K;
	auto s = shortest(g, K - 1);

	for (int i = 0; i < Q; ++i) {
		int x, y;
		cin >> x >> y;
		--x;
		--y;
		cout << s[x] + s[y] << endl;
	}
}


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

int N,K;

int main() {
    cin>>N>>K;
    int cnt=0;
    for (int i=0; i<N; i++) {
        int h;
        cin>>h;
        if (h>=K) cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(){
	char N[4];
	scanf("%s",N);
	if(N[0]=='7'){
		printf("Yes");
	}else if(N[1]=='7'){
		printf("Yes");
	}else if(N[2]=='7'){
		printf("Yes");
	}else{
		printf("No");
	}
	
	return 0;

}

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

char s[200005];

int main() {
  scanf("%s", &s[0]);
  long long tot = 0;
  for(int i = 0; s[i]; i++) {
    tot += s[i] - '0';
  }
  if(tot % 9 == 0) {
    puts("Yes");
  } else {
    puts("No");
  }
  return 0;
}

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

int main() {
  
    int q;
    cin >> q;
    bitset<64> b(0);
    while(q--){
        int x, y;
        cin >> x;
        if(x < 4){
            cin>>y;
        }
        if(x == 0){
            cout << b.test(y) << endl;
        }
        else if(x == 1){
            b.set(y);
        }
        else if(x == 2){
            b.reset(y);
        }
        else if(x == 3){
            b.flip(y);
        }
        else if(x == 4){
            cout << b.all() << endl;
        } 
        else if(x==5){
            cout << b.any() << endl;
        }
        else if(x == 6){
            cout << b.none() << endl;
        } 
        else if(x==7){
            cout << b.count() << endl;
        } 
        else if(x == 8){
            cout << b.to_ullong() << endl;
        } 
    }

    return 0;
}


Measured memory_bytes: 3088
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000007;

Int gcd(Int a, Int b)
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

int main() {

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

	Int N;
	cin >> N;

	vector<Int> a(N);
	for (Int i = 0; i < N; i++) {
		cin >> a[i];
	}

	vector<Int> G(N, 0);
	G[0] = a[0];

	for (Int i = 0; i < N-1; i++) {
		G[i + 1] = gcd(G[i],a[i+1]);
	}

	cout << G[N-1] << endl;
}

Measured memory_bytes: 1792
N = int(input())
a = list(map(int, input().split()))
d = {}
for i in a:
    if i not in d:
        d[i] = 1
    else:
        d[i] +=1
if len(d) == 1 and 0 in d:
    print('Yes')
elif len(d) == 2:
    for i in d:
        if i == 0 and d[i] * 3 != N or i != 0 and d[i] * 3 != 2 * N:
            print('No')
            exit()
    print('Yes')
elif len(d) == 3:
    s = 0
    for i in d:
        s ^= i
        if d[i] * 3 != N:
            print('No')
            exit()
    if s != 0:
        print('No')
    else:
        print('Yes')
else:
    print('No')


Measured memory_bytes: 93124
import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = 0;
		if(c-b > a) d = 1;
		else {
			for(int i = 0; i<(c-b)+1; i++) {
				if((b+i) % a == 0) d = 1;
			}
		}
		if(d == 0) System.out.println("NG");
		else System.out.println("OK");
	}
}

Measured memory_bytes: 35728
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <math.h>
#include <map>
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> a(4,0);
	for(int i=0;i<n;i++){
		string s;
		cin >> s;
		if(s=="AC"){
			a[0]++;
		}else if(s=="WA"){
			a[1]++;
		}else if(s=="TLE"){
			a[2]++;
		}else if(s=="RE"){
			a[3]++;
		}
	}
	cout << "AC x " << a[0] << endl;
	cout << "WA x " << a[1] << endl;
	cout << "TLE x " << a[2] << endl;
	cout << "RE x " << a[3] << endl;
			
	return 0;
}


Measured memory_bytes: 3628
#include <stdio.h>
#include <algorithm>
using namespace std;

int main(){
	int i,n,num[3];
	scanf("%d",&n);
	if(n == 2) {
		scanf("%d %d",&num[0],&num[1]);
		num[2] = num[1];
	}
	else scanf("%d %d %d",&num[0],&num[1],&num[2]);
	for(i = 1;i < max(max(num[0],num[1]),num[2]);i++){
		if(num[0] % i == 0 && num[1] % i == 0 && num[2] % i == 0) printf("%d\n",i);
	}
	return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = Integer.parseInt(sc.next(),16);
		int y = Integer.parseInt(sc.next(),16);
		sc.close();
	
	if (x < y) 
		System.out.println("<");
	 else if (x == y) 
		 System.out.println("=");
	 else 
		 System.out.println(">");
	
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>

using namespace std;

int main() {
    string S;
    cin >> S;
    if(S <= "2019/04/30") {
        cout << "Heisei" << endl;
    } else
    {
        cout << "TBD" << endl;
    }
    return 0;    
}

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

#define ll long long

int main() {
    std::ios::sync_with_stdio(false);
    using namespace std;
    int n;
    cin >> n;
    string S;
    cin >> S;

    const ll mod = 1'000'000'007;

    vector<int> pre(n + 2, 0), suf(n + 2, 0), A(n + 2);
    auto make_pre_suf = [n, &pre, &suf, &A](){
        pre[0] = 0;
        for(int i = 1; i <= n; i++)
            pre[i] = (pre[i - 1] + A[i]) % mod;
        pre[n + 1] = 0;
        suf[n + 1] = 0;
        for(int i = n; i > 0; i--)
            suf[i] = (suf[i + 1] + A[i]) % mod;
        suf[0] = 0;
    };

    A[1] = 1;
    make_pre_suf();
    for(int i = 0; i < S.size(); i++) {
        for(int j = 1; j < i + 3; j++)
            if(S[i] == '<')
                A[j] = pre[j - 1];
            else
                A[j] = suf[j];
        make_pre_suf();
    }

    ll result = 0;
    for(int i = 1; i <= n; i++)
        result = (result + A[i]) % mod;

    cout << result << "\n";

    return 0;
}


Measured memory_bytes: 256