akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stdlib.h>
#include <map>

using namespace std;

int main() {
    int n,k;
    cin >> n >> k;
    int a[n];
    vector<int> count(n+1);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
        count[a[i]]++;
    }
    int balls = 0;
    sort(count.begin(),count.end(),greater<int>());
    for(int i = 0; i < k; i++) {
        balls += count[i];
    }
    cout << n-balls;
    return 0;
}



Measured memory_bytes: 1792
#include<iostream>
#include<stdio.h>
#include<iomanip>
#include<algorithm>
using namespace std;

int main() {

  long long int n, a[100000], b[100000]={0}, ans=1;
  cin >> n;
  for(int i=0; i<n; i++){
    cin >> a[i];
    b[a[i]]++;
  }
  if(n%2==0){
    for(int i=1; i<n; i+=2){
      if(b[i]!=2){
        cout << 0 << endl;
        return 0;
      }
    }
  } else {
    for(int i=2; i<n; i+=2){
      if(b[i]!=2){
        cout << 0 << endl;
        return 0;
      }
    }    
  }
  for(int i=0; i<n/2; i++){
    ans*=2;
    ans%=(1000000007);
  }
  cout << ans << endl;

  return 0;
}

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

int main(){
    int k;
    string s;
    cin >> k >> s;
    if(s.size() <= k){
        cout << s << endl;
        return 0;
    }
    cout << s.substr(0, k) << "..." << endl;
    return 0;
}

Measured memory_bytes: 3632
n = int(input())
sp, sm = [], []
res = 0
for _ in range(n):
    s = input()
    m = len(s)

    l, tl = 0, 0
    for i in range(m):
        if s[i] == ')':
            tl -= 1
        else:
            tl += 1
        l = min(l, tl)

    r, tr = 0, 0
    for i in range(m):
        if s[m-1-i] == '(':
            tr -= 1
        else:
            tr += 1
        r = min(r, tr)

    res += tl
    if tl >= 0:
        sp.append((l, tl))
    else:
        sm.append((r, tr))

if res != 0:
    print('No')
    exit()

sp.sort(key=lambda x: -x[0])
sm.sort(key=lambda x: -x[0])


xp = len(sp)
cur = 0
for l, tl in sp:
    if cur + l < 0:
        print('No')
        exit()
    cur += tl

cur = 0
for r, tr in sm:
    if cur + r < 0:
        print('No')
        exit()
    cur += tr

print('Yes')



Measured memory_bytes: 174340
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  int N;
  while (cin >> N) {
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    multiset<int, greater<int>> S(A.begin(), A.end());
    int res = 0;
    while (!S.empty()) {
      auto xp = S.begin();
      int x = *xp;
      S.erase(xp);
      ll p2 = 1;
      while (p2 <= x) p2 *= 2;
      ll y = p2 - x;
      auto yp = S.find(y);
      if (yp != S.end()) {
        S.erase(yp);
        ++res;
      }
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 10368
N = int(input())
A = list(map(int, input().split(" "))) 

A_amari = [0]*N
cnt = 0

while(not(1 in A_amari)):
    for i in range(len(A)):
        A_amari[i] = A[i] % 2        
        A[i] = A[i] / 2
    if(not(1 in A_amari)):cnt += 1

print(cnt)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(long long i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "debug" << endl;
#define pb push_back
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    cin.tie(0);    
	ios::sync_with_stdio(false);
    int N;
    string S;
    cin >> N >> S;
    ll cnt = 2,ans = 1;
    sort ALL(S);
    REP(i,N){
        if(S[i] == S[i+1]){
            cnt++;
            if(i == N-1){
                ans *= cnt;
            }
        }
        else{
            ans *= cnt;
            ans %= 1000000007;
            cnt = 2;
        }
    }
    cout << ans - 1 << endl;
}

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

//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef complex<ld> cd;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<cd> vcd;

//template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
 ll L,R;
  cin>>L>>R;
    if ((L-1) / 2019 != R / 2019) {
        cout << 0 << endl; return 0;
    }

   int ans = 2018;
     L = L % 2019; R = R % 2019;
    FOR(i, L, R+1) {
        FOR(j, i+1, R+1) {
            ans = min(ans, (i*j)%2019);
        }
    }
    cout << ans << endl;

   }



Measured memory_bytes: 256
fun main(args: Array<String>) {

    val N = readLine()!!.toInt()
    val S = readLine()!!

    var ans = ""
    for(i in S.indices){
        ans += shift(S[i], N)
    }
    println(ans)
}

fun shift(char: Char, shift: Int): String{
    return ('A' + (char - 'A' + shift) % 26).toString()
}


Measured memory_bytes: 114040
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>

using namespace std;

typedef long long ll;
const int maxn = 1e5 *2* 10 + 10;
vector <ll> CONN[maxn];
ll a[maxn];
ll v[maxn],cv[maxn];

void dfs(ll i,vector<ll> &cg){
    v[i] = 1;
    cg.push_back(a[i]);
    for (ll j = 0;j < CONN[i].size();j++){
        if (v[CONN[i][j]]) continue;
        dfs(CONN[i][j],cg);
    }
}


struct cmp{
    bool operator()(ll a1,ll a2){
        return a1 > a2;
    }
};

int main() {
    ll N,M; cin >> N >> M;//
    if(M*2<N-2){cout<<"Impossible"; return 0;}
    if (N == 1 || M == N-1){
        cout << 0 << '\n';
        return 0;
    }

    for (ll i = 0;i < N;i++){//
        v[i] = 0;//
        cin >> a[i];///
    }//
    if (N == 2 && M == 0){
        cout << a[0] + a[1] << '\n';
        return 0;
    }
    if (M == 0) {
        cout << "Impossible" << endl;
        return 0;
    }
    for(ll i = 0;i < M;i++){//
        ll x,y; cin >> x >> y;//
        CONN[x].push_back(y);//
        CONN[y].push_back(x);//
    }//
    vector <vector<ll>> groups;//
//
    for (ll i = 0;i < N;i++){//
        if (v[i]) continue;//
        groups.push_back(vector<ll>());//
        dfs(i,groups[groups.size()-1]);//
    }//
    if (groups.size() == 1){//
        cout << 0 << '\n';//
        return 0;//
    }//
    priority_queue <ll,vector<ll>,cmp> values;//
    ll ans = 0;//
    ll total_deg = 0;//
    for (int i = 0;i < groups.size();i++){
        sort(groups[i].begin(),groups[i].end());
    }
    for (int i = 0;i < groups.size();i++){//
        ans += groups[i][0];//
        //cout << "Add " << *groups[i].begin() << '\n';
        groups[i].erase(groups[i].begin());//
        total_deg ++;//
    }//
    for (ll i = 0;i < groups.size();i++){//
        for (int j = 0;j < groups[i].size();j++){
            values.push(groups[i][j]);
        }
    }//

   // cout << "gsize = " << groups.size() << '\n';
    while (total_deg < 2*(groups.size()-1) ){//

        if (values.size() == 0) {//
            cout << "Impossible\n";//
            return 0;//
        }//
      //  cout << "add " << *values.begin() << '\n';
        ans += values.top(); values.pop();//
        total_deg ++;
    }
    cout << ans << '\n';
}

Measured memory_bytes: 61556
#include "bits/stdc++.h"
#define rep(i, j) for (int i = 0; i < j; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ull = unsigned long long;

ll gcd(ll x, ll y);
int fac(ll n, vector<int> num);

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

const int INF = 1001001001;

//mint�p�̒萔 (10��9��)
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) :x((x% mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream & is, const mint & a) { return is >> a.x; }
ostream& operator<<(ostream & os, const mint & a) { return os << a.x; }

int main() {
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];

    vector<int> dp(n + 1, INF);
    dp[0] = 0;

    for (int i = 1; i < n; i++) {
        if (i >= 2) chmin(dp[i], dp[i - 2] + abs(h[i] - h[i - 2]));
        chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
    }

    cout << dp[n - 1] << endl;
    return 0;
}

/*���C�u�����ő����*/
//���[�O���b�h�̌ݏ��@
ll gcd(ll x, ll y) {
    ll num[3];
    num[0] = (x > y) ? x : y;
    num[1] = (x <= y) ? x : y;
    num[2] = num[0] % num[1];

    while (num[2]) {
        num[0] = num[1];
        num[1] = num[2];
        num[2] = num[0] % num[1];
    }

    return num[1];
}

/*�f��������*/
//���색�C�u����
int fac(ll n, vector<int> num) {
    ll kazu = n;
    for (int i = 2; i <= sqrt(n); i++) {
        while (1) {
            if (kazu % i != 0) break;

            kazu /= i;
            num[i]++;
        }
    }
    if (kazu == n && n != 1) return 1;
    int ans = 0;
    if (kazu != 1) ans++;
    for (int i = 2; i <= sqrt(n); i++) {
        for (int j = 1; j <= num[i]; j++) {
            num[i] -= j;
            ans++;
        }
    }
    return ans;
}

Measured memory_bytes: 3944
#include<iostream>
int main (){
	int a,b;
	scanf ("%d%d",&a,&b);
	if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0){
		printf ("Possible\n");
	}
	else {
		printf ("Impossible\n");
	}
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt,ans,a[3][ohara],b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n;
    rep(i,2){
        rep(j,n){
            cin>>a[i][j];
        }
    }
    rep(i,n){
        rep(j,i+1)cnt+=a[0][j];
        rrep(j,i,n)cnt+=a[1][j];
        ans=max(ans,cnt);
        cnt=0;
    }
    Cout(ans);
    return 0;
}


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

int main(){
  int N,a;
  int maxi = 0;
  cin >> N;
  priority_queue<int> A;
  for(int i=0;i<N;i++){
    cin >> a;
    A.push(a);
    if(i>0&&a>=A.top()){
      maxi = i;
    }
  }
  for(int j=0;j<N;j++){
    if(j==maxi){
      int tmp = A.top();
      A.pop();
      cout << A.top() << endl;
      A.push(tmp);
    }
    else{
      cout << A.top() << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 2548
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define re(i,a,b) for(int i=(a);i<(b);i++)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define run(a) for(int k=head[a];k;k=e[k].ne)
#define v e[k].t
#define clr(a) memset(a,0,sizeof(a));
#define il inline
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define mp make_pair
#define pb push_back 
#define w1 first
#define w2 second
#define adm(a,b,c) {a=a+b;if(a>=c)a-=c;else if(a<0)a+=c;}
typedef double db;
typedef long long ll;typedef long double ld;typedef unsigned long long ull;
typedef pair<ll,ll> pa;
const int N=5e5+5,M=5e3+5,INF=1e9,mod=1e9+7;
const ll linf=1e18;const double eps=1e-8,pi=acos(-1);
il int gmin(int &a,int b){if(a>b)a=b;}il ll gmin(ll &a,ll b){if(a>b)a=b;}il int gmax(int &a,int b){if(a<b)a=b;}il ll gmax(ll &a,ll b){if(a<b)a=b;}
il void read(ll&x){ll f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il ll read(ll&x,ll&y){read(x);read(y);}
il void read(int&x){int f=1,t=0;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){t=t*10+ch-'0';ch=getchar();}x=t*f;}il int read(int&x,int&y){read(x);read(y);}
il void read(int&a,int&b,int&c){read(a);read(b);read(c);}il void read(ll&a,ll&b,ll&c){read(a);read(b);read(c);}
il int read(){int x;read(x);return x;}
il ll qpow(ll a,ll b,ll p){ll ret=1;for(;b;b>>=1,a=a*a%p)if(b&1)ret=ret*a%p;return ret;}il ll qpow(ll a,ll b){ll ret=1;for(;b;b>>=1,a=a*a%mod)if(b&1)ret=ret*a%mod;return ret;}
il ll qmul(ll a,ll b,ll p){ll ret=0;for(;b;b>>=1,a=(a<<1)%p)if(b&1)adm(ret,a,p);return ret;}il ll qmul(ll a,ll b){ll ret=0;for(;b;b>>=1,a=(a<<1)%mod)if(b&1)adm(ret,a,mod);return ret;}
il void judge(){
	freopen("data.in","r",stdin);
	freopen("data.out","w",stdout);}
il void gen(){freopen("data.in","w",stdout);}
int a[N],b[N],c[N],n,o=1;
bool cmp(int i,int j){return a[i]<a[j];}
void godie(){puts("No");exit(0);}
int main(){
	read(n);rep(i,1,n){
		read(a[i]);
		b[i]=i;c[a[i]]=i;
	}sort(b+1,b+1+n,cmp);
	o=1;rep(i,1,n){
		re(j,1,b[i]){while(c[o])o++;c[o]=b[i];}
		if(o>a[b[i]])godie();
	}o=n*n;
	repd(i,n,1){
		rep(j,b[i]+1,n){while(c[o])o--;c[o]=b[i];}
		if(o<a[b[i]])godie();
	}
	puts("Yes");rep(i,1,n*n)printf("%d ",c[i]);
}

Measured memory_bytes: 4224
import java.util.Scanner;

public class Main{
    public static void main(String args[] ) {

        Scanner sc = new Scanner(System.in);
        
        String str = sc.nextLine();

        
        int count1 = 0;
        int count2 = 0;

        for (int i = 0; i < str.length(); i++) {

            if(str.charAt(i)=='A')
                count1++;
            if(str.charAt(i)=='B')
                count2++;

            // System.out.println(str.charAt(i));
        }
        if(count1>=1 && count2>=1)
            System.out.println("Yes");
        else
            System.out.println("No");

        sc.close();
    }
}


Measured memory_bytes: 23252
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::vec::Vec;
use std::{vec, cmp, num};


struct Scanner<'a> {
    cin: StdinLock<'a>,
}

impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner {cin: cin}
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

// create Vec<char> from String
#[allow(dead_code)]
fn to_chars(s: String) -> vec::Vec<char> {
    let mut cs = s.chars();
    let mut res = vec::Vec::new();
    while let Some(c) = cs.next() {
        res.push(c);
    }
    res
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let n: i32 = sc.read();
    let m: i32 = sc.read();
    println!("{}", (n - 1) * (m - 1));
}

Measured memory_bytes: 4352
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using LL = long long;

LL calc(vector<LL>& A, LL b, LL N) {
	LL l = 0, r = N - 1;
	if (A[l] > b) {
		return 0;
	}
	else if (A[r] <= b) {
		return N;
	}


	while (true) {
		LL mid = (l + r) / 2;
		if (r - l <= 1) {
			return l + 1;
		}
		if (A[mid] < b) {
			l = mid;
		}
		else {
			r = mid;
		}
	}
	return 0;
}


int main() {
	LL N;
	cin >> N;
	vector<LL> A(N), B(N), C(N);
	for (LL i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (LL i = 0; i < N; i++) {
		cin >> B[i];
	}
	for (LL i = 0; i < N; i++) {
		cin >> C[i];
	}
	sort(A.begin(), A.end());
	sort(B.begin(), B.end());
	sort(C.begin(), C.end());



	vector<LL> sumB(N, 0);
	for (LL i = 0; i < N; i++) {
		auto itr = lower_bound(A.begin(), A.end(), B[i]);
		LL num = itr - A.begin();	// B[i]より小さいの数字の個数
		sumB[i] = num;
		if (i > 0) {
			sumB[i] += sumB[i - 1];
		}
	}

	LL ans = 0;
	for (LL i = 0; i < N; i++) {

		LL num = lower_bound(B.begin(), B.end(), C[i]) - B.begin(); // C[i] より小さい数字の個数
		if (num > 0) {
			ans += sumB[num - 1];

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


Measured memory_bytes: 6432
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

int main(){
	int a;
	cin >> a;
	cout << 48 - a << endl;
}


Measured memory_bytes: 256
#include "stdio.h"

int main()
{
    int a, b, c, d, interim1, interim2, total;

    scanf("%d", &a);
    scanf("%d", &b);
    scanf("%d", &c);
    scanf("%d", &d);

    if (a < b) 
        interim1 = a;
    else
        interim1 = b;

    if (c < d) 
        interim2 = c;
    else
        interim2 = d;
            
    total = interim1 + interim2;

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

    return 0;
}

Measured memory_bytes: 128
S = input()
n = len(S)


def dfs(i, f):
    if i == n-1:
        return sum(list(map(int, f.split('+'))))

    return dfs(i+1, f+S[i+1]) + dfs(i+1, f+'+'+S[i+1])

print(dfs(0, S[0]))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin >> s;
	if(s.at(0)=='7'){
	    cout << "Yes" << endl;
	}
	else{
	    if(s.at(1)=='7'){
	        cout << "Yes" << endl;
	    }
	    else{
	        if(s.at(2)=='7'){
	            cout <<"Yes" <<endl;
	        }
	        else{
	            cout << "No" << endl;
	        }
	    }
	}
	
}


Measured memory_bytes: 3596
N = int(input())
H = list(map(int, input().split()))

ans = 0
cnt = 0

# O(N)
for i in range(N-1):
    if H[i] >= H[i+1]:
        cnt += 1
    else:
        if ans < cnt:
            ans = cnt
        cnt = 0    
if ans < cnt:
    ans = cnt
print(ans) 

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

#define all(a) a.begin(), a.end()
#define ff first
#define ss second
#define pb push_back

using ll = long long;
using pii = pair<int, int>;

template<typename T> using V = vector<T>;

const ll MOD = 1e9 + 7;
const int N = 1e5 + 5;
vector<int> adj[N];
int root;
ll ans;

void dfs(int cur, int par, int k) {
	ll left = k - 2 + (cur == root);
	for(int nxt : adj[cur]) {
		if(nxt == par)
			continue;
		if(left == 0) {
			ans = 0;
			return;
		}
		ans *= left;
		ans %= MOD;
		--left;
		dfs(nxt, cur, k);
	}
}

int main() {
	ios::sync_with_stdio(false);cin.tie(nullptr);
	int n, k; cin >> n >> k;
	for(int i = 0; i < n - 1; ++i) {
		int a, b; cin >> a >> b;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	root = 1;
	ans = k;
	dfs(1, 0, k);
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 10368
#include <bits/stdc++.h>
#include <unistd.h>
#define ll long long
#define inf 1000000007
#define inf16 0x3f3f3f3f
#define INF 1000000000000000007LL
#define VI vector<int>
#define VPII vector<pair<int, int> >
#define VLL vector<ll>
#define PII pair<int, int>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define endl '\n'
#define ALL(c) (c).begin(), (c).end()
using namespace std;

#define int ll

int h, w, n, k, ans;

int pot[50*50];

int query(int y1, int y2, int x1, int x2)
{
	cout << "? " << y1 << " " << x1 << " " << y2 << " " << x2 << endl;
	int ans;
	cin >> ans;
	return ans;
}

void solve(int y1, int y2, int x1, int x2, int cnt = -1)
{
	if(cnt==-1)
		cnt = query(y1, y2, x1, x2);

	if(cnt==0)
		return;

	if(cnt==(y2-y1+1)*(x2-x1+1))
	{
		for(int i = y1; i <= y2; ++i)
		{
			for(int j = x1; j <= x2; ++j)
			{
				ans += pot[i*w+j];
				ans %= k;
			}
		}

		return;
	}

	if(y1!=y2)
	{
		int m = (y1+y2)/2;
		int h = query(y1, m, x1, x2);
		solve(y1, m, x1, x2, h);
		solve(m+1, y2, x1, x2, cnt-h);
	}
	else
	{
		int m = (x1+x2)/2;
		int h = query(y1, y2, x1, m);
		solve(y1, y2, x1, m, h);
		solve(y1, y2, m+1, x2, cnt-h);
	}
}

int32_t main()
{
	cin >> h >> w >> n >> k;

	pot[0] = 1;

	for(int i = 1; i < 50*50; ++i)
	{
		pot[i] = pot[i-1]*2%k;
	}

	solve(0, w-1, 0, 31);
	solve(0, w-1, 32, 47);
	solve(0, w-1, 48, 49);

	/*for(int i = 0; i < h; i += 5)
	{
		for(int j = 0; j < w; j += 5)
		{
			solve(i, i+4, j, j+4, query(i, i+4, j, j+4), 1);
		}
	}*/

	//solve(0, h-1, 0, w-1, n, 1);

	cout << "! " << ans << endl;
}

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

int main() {
  int H, W, N; cin >> H >> W >> N;

  if (H < W) H = W;

  cout << (N + H - 1) / H << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <regex>
#include <vector>

#define fix(n)          cout<<fixed<<setprecision(n)
#define rep(i,n)        for (int i = 0; i < (n); ++i)
#define all(a)          (a).begin(), (a).end()
#define sort(a)         sort(all(a))
#define uniq(a)         sort(a);(a).erase(unique(all(a), (a).end())
#define reverse(a)      reverse(all(a))
#define ctos(c)         string(1, (c))
#define out(d)          cout << (d)
#define outl(d)         std::cout<<(d)<<"\n"
#define YES()           cout << "YES" << endl
#define NO()            cout << "NO" << endl
#define Yes()           cout << "Yes" << endl
#define No()            cout << "No" << endl
#define ceil(x, y)      ((x + y - 1) / (y))
#define debug(x)        cerr << #x << ": " << (x) << '\n'
#define debug2(x, y)    cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v)          for (size_t _ = 0; _ < v.size(); ++_){ cerr << #v << "[" << _ << "] : " << v[_] << '\n'; }
#define pb              push_back
#define fst             first
#define int             long long
#define INF             __LONG_LONG_MAX__

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

const ll MOD = 1000000007; // 10^9 + 7
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

template<class T>
void outvo(vector<T> v) {
  if (v.size() == 0) return;
  cout << v[0];
  for (int i = 1; i < v.size(); i++)
    cout << " " << v[i];
  cout << endl;
}

void solve() {
  ll n; cin >> n;
  vector<ll> a(n), b(n, 0); rep(i, n) cin >> a[i];

  rep(i, n) {
    if (i % 2 == 0) b[0] += a[i];
    else b[0] -= a[i];
  }
  for (int i = 1; i < n; i++)
    b[i] = 2*a[i-1] - b[i-1];

  outvo(b);
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));
  fix(12);

  solve();
}


Measured memory_bytes: 3712
#include <iostream>
using namespace std;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

int main(void){
    // Your code here!
    int K;
    cin >> K;
    int sum = 0;
    for(int i=1;i<=K;i++)
    {
        for(int j=1;j<=K;j++)
        {
            for(int k=1;k<=K;k++)
            {
                int a = gcd(i,j);
                sum = sum + gcd(a,k);
            }
        }
    }
    cout << sum <<endl;
}

Measured memory_bytes: 3636
N = int(input())
S = input()
alpha = [0]*123
mod = 10**9+7

for n in S:
    num = ord(n)
    alpha[num] += 1
    
ans = 1
for i in range(97,123):
    ans *= (alpha[i]+1)%mod

ans -= 1
ans %= mod
print(ans)



Measured memory_bytes: 3188
n,a,b,c,d=map(int,input().split())
s=input()

if c<d:
    for i in range(b,d):
        if s[i:i+2]=='##':
            print('No')
            exit()
    for i in range(a,c):
        if s[i:i+2]=='##':
            print('No')
            exit()
    print('Yes')
else:
    for i in range(b,d):
        if s[i:i+2]=='##':
            print('No')
            exit()
    for i in range(a,c):
        if s[i:i+2]=='##':
            print('No')
            exit()
    for i in range(b-2,d-1):
        if s[i:i+3]=='...':
            print('Yes')
            exit()
    print('No')


Measured memory_bytes: 9336
#include<iostream>
#include<string>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int const MAXN = 3e5;
int const MAXA = 6.4e5;
int N, m[MAXN], d[MAXN+1];

int main() {
  std::cin >> N;
  std::fill_n(m, N, 0);
  for(int i = 0; i < N; ++i) { int A; std::cin >> A; ++m[A-1]; }
  std::fill_n(d, N+1, 0);
  for(int i = 0; i < N; ++i) ++d[m[i]];

  std::string ans_s;
  ans_s.reserve(MAXA);
  int sum_D = 0, sum_iD = N, k = 1;
  for(int ans = N; ans >= 1; --ans) {
    sum_D += d[ans];
    sum_iD -= d[ans]*ans;
    int next_k = sum_iD/ans + sum_D + 1;
    for(int i = k; i < next_k; ++i) ans_s += std::to_string(ans) + "\n";
    k = next_k;
  }
  while(k <= N) { ans_s += "0\n"; ++k; }
  fin(ans_s);
  return 0;
}


Measured memory_bytes: 3840
import java.util.*;
public class Main{
    public static void main(String[]args){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        int b = scan.nextInt();
        int c = scan.nextInt();
        int[] list = {a,b,c};
        Arrays.sort(list);
        
        for(int i = 0; i < list.length; i++){
            if(i == list.length-1){
            System.out.print(list[i]);
            }else{
             System.out.print(list[i]);
             System.out.print(" ");             
            }

        }        
    System.out.println();
    }
}


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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,d;
	bool f=true;
	cin>>a>>b>>c>>d;
	while(f){
		c-=b;
		if(c<=0){
			cout<<"Yes"<<endl;
			return 0;
		}
		a-=d;
		if(a<=0){
			cout<<"No"<<endl;
			return 0;
		}
	}
}


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

#define pi 3.1415926535
#define endl "\n"
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ll long long
#define llu unsigned long long
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define tc int test_case; cin >> test_case; while(test_case--)
#define f(i,a,n) for(int i = a ; i < n ; i++)
#define rf(i,n,a) for(int i = n-1 ; i >= a ; i--)
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
#define get(a,n) f(i,0,n) cin >> a[i];
#define show(a,n) f(i,0,n) cout << a[i] << " "; cout << endl;
#define fast ios:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define trace(x) cerr << '>' << #x << ':' << (x) << "\n"
#define trace2(x,y) cerr<< '>' << #x << ':' << (x) << " | " << #y << ':' << (y) << "\n"
#define trace3(a,b,c) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<pii,int> ppi;
typedef vector<pii> vpi;
typedef map<int,int> mii;
typedef map<ll,ll> mll;

const int inf = 1e9;
const ll inf64 = 1e18;
const int mod = inf + 7;
const int N = 2e5 + 10;

int main()
{
    fast;
    int n;
    cin >> n;
    vi a(n);
    get(a,n);
    int ans = 0;

//    sort(all(a));
    f(i,0,n)
    {
        f(j,i+1,n)
        {
            f(k,j+1,n)
            {
                if(a[i] + a[j] > a[k] and a[j] + a[k] > a[i] and a[i] + a[k] > a[j] and a[i] != a[j] and a[i] != a[k] and a[j] != a[k])
                    ans++;
            }
        }
    }
    cout << ans;
}


Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;

int Har(long long n) {
  long long dig;
  long long sum=0;
  while(n){
    dig = n%10;
    sum+=dig;
    n/=10;
  }
  return sum;
}

int main() {
  long long n;
  cin>>n;
  if(n%Har(n)==0) {
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }
}

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

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

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

Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
lint a[200100];
int main()
{
	int n;lint t,out=0;
	cin>>n>>t;
	rep(i,n) cin>>a[i];
	rep(i,n){
		if(i<1 || a[i]>a[i-1]+t) out+=t;
		else out+=a[i]-a[i-1];
	}
	cout<<out<<endl;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int N, K, Q; std::cin >> N >> K >> Q;
  std::vector<int> scores(N, 0);
  for (int q = 0; q < Q; ++q) {
    int a; std::cin >> a; --a;
    ++scores[a];
  }

  for (int score : scores) {
    if (K-Q+score > 0) std::cout << "Yes" << std::endl;
    else               std::cout << "No" << std::endl;
  }
}


Measured memory_bytes: 1024
#include <iostream>
#include<algorithm>
int main(){
	int p[3],j[2], pasta, juice;
	std::cin >> p[0] >> p[1] >> p[2] >> j[0] >> j[1];
	pasta = std::min(p[0], std::min(p[1], p[2]));
	juice = std::min(j[0],j[1]);
	std::cout << pasta + juice-50 << std::endl;
}

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
int main()
{
    int a,b;
    cin >> a >> b;
    if(a % 2 == 0 && b % 2 == 0)
    {
        cout << (a + b) / 2;
    }
    else if(a % 2 == 1 && b % 2 == 1)
    {
        cout << (a + b) / 2;
    }
    else
    {
        cout << "IMPOSSIBLE";
    }
}

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

#define FOR(i,a,b) for (int i = a; i < b; ++i)
#define REP(i,n) FOR(i,0,n)

int N;
char S[101];
int C[101];

int main() {
  scanf("%d", &N);
  scanf("%s", S);
  REP(i,N) C[i] = 1 << (S[i] - 'a');
  
  int s1 = 0x0, s2;
  int maxval = 0;
  FOR(i,1,N) {
    s1 |= C[i-1];
    s2 = 0x0;
    FOR(j,i,N) s2 |= C[j];
    int check = s1 & s2;

    int val = 0;
    REP(j,26) val += (check >> j) & 1;
    //FOR(j,0,i) printf("%c", S[j]);
    //printf("|");
    //FOR(j,i,N) printf("%c", S[j]);
    //printf(": %d\n", val);
    if (val > maxval) maxval = val;
  }

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define pii pair<ll, ll> 
#define pb push_back
#define mod (1e9+7)
#define debug(x) cerr<< #x << " is " <<x<<endl;
#define debug2(x) cerr<<#x<< " is\n"; for (auto &i:x) {cout<<i<<' '; } cout<<endl;
#define f first
#define s second
using namespace std;

const int inf = 1e9+5;

int dp[100005][3];

int main(){
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin>>n;
    for (int i=0; i<n; i++){
    	for (int j=0; j<3; j++){
    		int in; cin>>in;
    		dp[i][j]+=in;
    		for (int k=0; k<3; k++) {
    			if (k!=j) dp[i+1][k]=max(dp[i+1][k],dp[i][j]);
    		}
    	}
    }
    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]})<<endl;
}

Measured memory_bytes: 1408
#include <stdio.h>

typedef unsigned long ulong;

ulong diff(ulong a, ulong b){
    return __builtin_ctzl(a^b);
}

ulong hd(ulong a, ulong b){
    return __builtin_popcountl(a^b);
}

ulong bit_remove(ulong a, ulong n){
    ulong low  = a & ((1<<n)-1);
    ulong high = (a >> (n+1)) << n;
    return high | low;
}

ulong bit_insert(ulong a, ulong n, ulong b){
    ulong low  = a & ((1<<n)-1);
    ulong high = (a >> n) << (n+1);
    return high | (b<<n) | low;
}
#define N 17
long data[1<<N];

void solve(const long n, const long a, const long b, const size_t sp, const size_t ep){
    if(n==1){
        data[sp+0] = a;
        data[sp+1] = b;
        return;
    }
    ulong d = diff(a, b);
    ulong aa = bit_remove(a, d);
    ulong ab = bit_remove(a, d) ^ 1;
    ulong bb = bit_remove(b, d);
    const size_t mp = (sp+ep)/2;
    solve(n-1, aa, ab, sp, mp);
    solve(n-1, ab, bb, mp, ep);
    for(size_t i=sp; i<mp; i++){
        data[i] = bit_insert(data[i], d, (a&(1<<d)) >> d);
    }
    for(size_t i=mp; i<ep; i++){
        data[i] = bit_insert(data[i], d, (b&(1<<d)) >> d);
    }
}

int main(void){
    long n, a, b;
    scanf("%ld %ld %ld", &n, &a, &b);
    if(__builtin_popcountl(a)%2 == __builtin_popcountl(b)%2){
        printf("NO\n");
        return 0;
    }
    solve(n, a, b, 0, 1<<n);
    const size_t m = 1<<n;
    printf("YES\n");
    for(size_t i=0; i<m-1; i++){
        printf("%ld ", data[i]);
    }
    printf("%ld\n", data[m-1]);
    return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
 
int X, a, b;
 
int main (){
	cin >> X >> a >> b;
	
	if(a+X<b) cout << b-(a+X) << endl;
	else if(b+X<a) cout << a-(b+X) << endl;
	else cout << 0 << endl;
	
	return 0;
}

Measured memory_bytes: 256
n, y = map(int, input().split())

if y%1000 != 0:
    print("-1 -1 -1")
else:
    for i in range(n+1):
        for j in range(n-i+1):
            if 10000*i + 5000*j + 1000*(n - i - j) == y:
                print(str(i) + " " + str(j) + " " + str(n - i - j))
                exit()
    print("-1 -1 -1")

Measured memory_bytes: 40792
#include<cstdio>
#include<cmath>
#include<iostream>
#include<cstring>
#define ll long long int 
#define SIZE 100010
#define MOD 1000000007
using namespace std;

int  a[SIZE];
ll s[SIZE],x[SIZE],x2[SIZE];
void make()
{
	s[0]=s[1]=1;
	x[0]=x[1]=1;
	x2[0]=x2[1]=1;
	for(int i=2;i<SIZE;i++)
	{
		x2[i]=MOD-MOD/i*x2[MOD%i]%MOD;
		s[i]=s[i-1]*(ll)i%MOD;
		x[i]=x[i-1]*x2[i]%MOD;
	}
	
}

ll C(int a,int b)
{
	if (a<b)
		return 0;
	return s[a]*(x[b]*x[a-b]%MOD)%MOD;	
}
int main()
{
	int n,l,r;
	make();
	scanf("%d",&n);
	memset(a,-1,sizeof(a));
	for(int i=0;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		x--;
		if (a[x]==-1)
			a[x]=i;
		else
		{
			l=a[x];
			r=i;	
		}	
	}
	for(int i=1;i<=n+1;i++ )
	{
		ll s=C(n+1,i);
		s-=C(n-r+l,i-1);
		if (s<0)
			s+=MOD;
		printf("%lld\n",s);
	}
	return 0;
		

} 

Measured memory_bytes: 3968
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char A,B;
  cin >> A >> B;
  if(A == 'H'){
  	if(B == 'H'){
    	cout << "H" << endl;
    }else{
    	cout << "D" << endl;
    }
  }else{
  	if(B == 'H'){
    	cout << "D" << endl;
    }else{
    	cout << "H" << endl;
    }
  }
}

Measured memory_bytes: 256
#include<algorithm>
#include<bitset>
#include<cmath>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<string>
#include<unordered_map>
#include<utility>
#include<vector>

constexpr int IINF = (1 << 30) - 1;
constexpr long long LLINF = 1LL << 61;

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

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

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

    std::reverse(s.begin(), s.end());

    const int n = (int)s.size();

    bool flg = true;
    for(int i = 0 ; i < n ; ){
        if(s.substr(i, 7) == "remaerd"){
            i += 7;
        }else if(s.substr(i, 6) == "resare"){
            i += 6;
        }else if(s.substr(i, 5) == "maerd" || s.substr(i, 5) == "esare"){
            i += 5;
        }else{
            flg = false;
            break;
        }
    }

    if(flg){
        std::cout << "YES" << std::endl;
    }else{
        std::cout << "NO" << std::endl;
    }
}

Measured memory_bytes: 3732
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
int main(){
  ll n,m;
  cin>>n>>m;
  if(abs(n-m)<=1)cout<<"Brown"<<"\n";
  else cout<<"Alice"<<"\n";
}


Measured memory_bytes: 3576
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int imap[11][11];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int maxv, sum;

void color(const int &x, const int &y, const int &t) {
    int nx = x, ny = y;
    if (t == 1) {
        imap[x][y]++;
        for (int i = 0; i < 4; i++) {
            nx=x+dx[i], ny=y+dy[i];
            if (nx >= 0 && nx < 10 && ny >= 0 && ny < 10) imap[nx][ny]++;
        }
        return;
    }
    if (t == 2 || t == 3) {
        imap[x][y]++;
        for (int i = -1; i <= 1; i++) {
            for (int j = -1; j <= 1; j++) {
                if (i == 0 && j == 0) continue;
                nx=x+i, ny=y+j;
                if (nx >= 0 && nx < 10 && ny >= 0 && ny < 10) imap[nx][ny]++;
            }
        }
        if (t == 2) return;
    }
    if (t == 3) {
        for (int i = 0; i < 4; i++) {
            nx=x+dx[i]*2, ny=y+dy[i]*2;
            if (nx >= 0 && nx < 10 && ny >= 0 && ny < 10) imap[nx][ny]++;
        }
        return;
    }
}

void calc() {
    maxv = sum = 0;
    for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) {
            if (imap[i][j] == 0) sum++;
            else maxv = max(imap[i][j], maxv);
        }
    }
}

int main(){
    memset(imap, 0, sizeof (imap));
    int x, y, t;
    while(scanf("%d,%d,%d", &y, &x, &t) != EOF) {
        color(x, y, t);
    }
    calc();

    /*for (int i = 0; i < 10; i++) {
        for (int j = 0; j < 10; j++) printf("%d ", imap[i][j]);
        printf("\n");
    }*/
    printf("%d\n%d\n", sum, maxv);
    return 0;
}



Measured memory_bytes: 2676
program echo
    implicit none
    integer(4):: n, i
    character(:), allocatable:: s

    read*, n
    allocate(character(n):: s)
    read*, s

    if (mod(n,2) /= 0) then
        print*, "No"
        stop
    end if

    if(s(1:n/2) == s(n/2+1:n))then
        print*, "Yes"
    else
        print*, "No"
    end if
end program echo

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

int n,t,a,b;

int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d%d",&t,&a,&b);
        if(a+b>t)
        {
            printf("No\n");
            return 0;
        }
        if((a+b)%2==0&&t%2==1)
        {
            printf("No\n");
            return 0;
        }
        if((a+b)%2==1&&t%2==0)
        {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int MAXN = 3e3 + 5;
int dp[MAXN][MAXN][2];
int arr[MAXN];
int32_t main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> arr[i];
    for(int i = 0; i < n; i++){
        dp[i][1][0] = arr[i];
        dp[i][1][1] = -arr[i];
    }
    for(int l = 2; l <= n; l++){
        for(int i = 0; i <= n - l; i++){
            dp[i][l][0] = max(dp[i + 1][l - 1][1] + arr[i], dp[i][l - 1][1] + arr[i + l - 1]);
            dp[i][l][1] = min(dp[i + 1][l - 1][0] - arr[i], dp[i][l - 1][0] - arr[i + l - 1]);
        }
    }
    cout << dp[0][n][0] << '\n';
}


Measured memory_bytes: 139648
#include <iostream>

using namespace std;

int main() {
  int T[20][20] = {{0}};
  int H, W, h, w;
  cin >> H >> W;
  cin >> h >> w;

  for (int i = 0; i < h; ++i)
    for (int j = 0; j < W; ++j) T[i][j] = 1;

  for (int i = 0; i < H; ++i)
    for (int j = 0; j < w; ++j) T[i][j] = 1;

  int ans = 0;
  for (int i = 0; i < H; ++i)
    for (int j = 0; j < W; ++j)
      if (T[i][j] == 0) ++ans;

  cout << ans << endl;

  return 0;
}


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

string a;

inline bool ok(string s)
{
	if(s.size()%2) return 0;
	string s1=s.substr(0,s.size()/2),s2=s.substr(s.size()/2);
	return (s1==s2);
}

int main()
{
	cin>>a;
	do a.erase(a.end()-1); while(!ok(a));
	cout<<a.size();
	return 0;
}

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

int main()
{
  int n; cin >> n;
  bool flag = false;
  if (n%2)
  {
    flag = true;
  }
  
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++)
  {
    cin >> a[i] >> b[i];
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  if (flag)
  {
    long long a_mean = a[n/2];
    long long b_mean = b[n/2];
    cout <<(long long) (b_mean - a_mean + 1) << endl;
  }
  else
  {
    long double a_mean = (a[n/2]+a[n/2-1])/2.0;
    long double b_mean = (b[n/2]+b[n/2-1])/2.0;
    cout <<(long long ) (2 * (b_mean - a_mean) + 1) << endl;
  }
  
  
  
  
}

Measured memory_bytes: 6448
n, m, k = map(int, input().split())
from bisect import bisect_right

a = list(map(int, input().split()))
b = list(map(int, input().split()))
total_a = [0] * n
total_b = [0] * m

def set_data(data, a, x):
    data[0] = a[0]
    for i in range(1, x):
        data[i] = data[i - 1] + a[i]

set_data(total_a, a, n)
set_data(total_b, b, m)

def cnt(a, b, n, m):
    ans = 0
    for i in range(n - 1, -1, -1):
        if a[i] <= k:
            index = bisect_right(b, k - a[i], 0, m)
            ans = max(ans, i + index + 1)
    return ans

print(max(cnt(total_a, total_b, n, m), cnt(total_b, total_a, m, n)))



Measured memory_bytes: 47368
#include <stdio.h>
#include <stdlib.h>

int isSame(const int *A,const int *B)
{
	int p1, p2, t1, t2, f1, f2, e, h;

	h = 0;
	for (p1 = 0; p1 < 6; p1++)
	{
		if (A[0] == B[p1] && A[5] == B[5 - p1])
		{
			h = 1;
			break;
		}
	}
	if (!h) return 0;

	h = 0;
	for (p2 = 0; p2 < 6; p2++)
	{
		if (p2 == p1 || p2 == 5 - p1) continue;
		if (A[1] == B[p2] && A[4] == B[5 - p2])
		{
			h = 1;
			break;
		}
	}
	if (!h) return 0;

	t1 = p1 / 3;
	t2 = t1 > 0 ? 3 - (t1 + p1 % 3) : p1 % 3;
	f1 = p2 / 3;
	f2 = f1 > 0 ? 3 - (f1 + p2 % 3) : p2 % 3;

	e = t1 ^ f1;
	e = f2 - (t2 + 1) % 3 != 0 ? !e * 3 : e * 3;
	e += e > 0 ? (t2 + f2) - 1 : 3 - (t2 + f2);
		
	if (A[2] != B[e] || A[3] != B[5 - e]) return 0;

	return 1;	
}

int main()
{
	int n, i, j, f;
	int **p;

	scanf("%d", &n);

	p = (int**)malloc(sizeof(int*) * n);
	for (i = 0; i < n; i++)
	{
		p[i] = (int*)malloc(sizeof(int) * 6);
		for (j = 0; j < 6; j++) scanf("%d", &p[i][j]);
	}

	f = 1;
	for (i = 0; i < n - 1; i++)
	{
		for (j = i + 1; j < n; j++)
		{
			if (isSame(p[i], p[j]))
			{
				f = 0;
				break;
			}
		}
		if (!f) break;
	}

	if (f) printf("Yes\n");
	else printf("No\n");
	
	for (i = 0; i < n; i++) free(p[i]);
	free(p);

	return 0;

}


Measured memory_bytes: 2132
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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; }
#define all(x) (x).begin(),(x).end()
#define pll pair<ll,ll>
#define pii pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
#define For(i,a,b) for(int i=a;i<b;i++)
#define sz(x) ((ll)(x).size())
#define pb push_back
#define mp make_pair
#define bit(n) (1LL<<(n))
#define F first
#define S second
#define debug(x) cerr << x << endl
#define Complex complex<double>
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const ll INF = 1LL<<60;
const ll mod = (int)1e9 + 7;

int main() {
    int n,m;
    cin >> n >> m;
    bool a[n]={};
    int b[n]={};
    int sum=0;
    int ans=0;
    rep(i,m){
        int x;
        string s;
        cin >> x >> s;
        x--;
        if(a[x])continue;
        if(s=="WA")b[x]++;
        else{
            a[x]=true;
            ans++;
        }
    }
    rep(i,n){
        if(a[i])sum+=b[i];
    }
    cout << ans << ' ' << sum;
    


}

/*



 */




Measured memory_bytes: 768
using namespace std;
#include<bits/stdc++.h>
#define int long long
#define pb push_back 
#define IOS ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define ff first
#define ss second
#define all(x) x.begin(), x.end()
#define repa(i,a,b) for (int i=a; i<=b; i++)
#define repd(i,b,a) for (int i=b; i>=a; i--)
#define endl "\n"
//debugging
#define debug1(a) cout<<#a<<" = "<<(a)<<endl;
#define debug2(a,b) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<endl;
#define debug3(a,b,c) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<endl;
#define debug4(a,b,c,d) cout<<#a<<" = "<<(a)<<", "<<#b<<" = "<<(b)<<", "<<#c<<" = "<<(c)<<", "<<#d<<" = "<<(d)<<endl;

const int N = 1e+6+5;
int big = 1e+18+3;
int mod = 1e+9+7;

signed main()
{
    IOS;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
    
    string s;
    cin>>s;
    int cnt = 0;
    int ans = 0;
    for (int i=0; i<3; i++)
        if (s[i]=='R')
            cnt++, ans = max(ans,cnt);
        else
            cnt = 0;

    cout<< ans <<endl;
        
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define m 1001
int main()
{
    int n,k,a[m],sum = 0;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=0;i<k;i++)
    {
        sum = sum+a[i];
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3616