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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
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; }
typedef long long ll;

const long long INF = 1LL << 60;

struct UnionFind {
    vector<int> par, rank;

    UnionFind(int N) : par(N), rank(N) {
        rep(i, N) par[i] = i, rank[i] = 0;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        if (rank[rx] < rank[ry]) {
            par[rx] = ry;
        }
        else {
            par[ry] = rx;
            if (rank[rx] == rank[ry]) rank[rx]++;
        }
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

struct edge {
    int u, v, cost;
};

struct grid {
    int p, x, y;
};

bool compX(const grid& g1, const grid& g2) {
    return g1.x < g2.x;
}

bool compY(const grid& g1, const grid& g2) {
    return g1.y < g2.y;
}

bool comp(const edge& g1, const edge& g2) {
    return g1.cost < g2.cost;
}

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

    vector<grid> G(N);
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        G[i] = {i, x, y};
    }

    vector<edge> es(2 * (N - 1));

    sort(G.begin(), G.end(), compX);
    rep(i, N - 1) {
        es[i] = {G[i].p, G[i + 1].p, abs(G[i].x - G[i + 1].x)};
    }

    sort(G.begin(), G.end(), compY);
    rep(i, N - 1) {
        es[N - 1 + i] = {G[i].p, G[i + 1].p, abs(G[i].y - G[i + 1].y)};
    }

    sort(es.begin(), es.end(), comp);
    UnionFind tree(2 * (N - 1));

    ll res = 0;
    rep(i, 2 * (N - 1)) {
        edge e = es[i];
        if (!tree.same(e.u, e.v)) {
            res += e.cost;
            tree.unite(e.u, e.v);
        }
    }

    cout << res << endl;
    return 0;
}

Measured memory_bytes: 5376
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=50+5,M=1e6+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a) memset(a,0,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first 
#define se second
int a[N];
ll dp[N][N][3000],pre[1005];
int main(){
	int n,k;
	cin>>n>>k;
	ll  ans=0,sum=0; 
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
		pre[i]=pre[i-1]+a[i];
	}
	for(int i=0;i<=n;i++) dp[i][0][0]=1;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=i;j++)
		for(int k=1;k<=pre[i];k++){
			if(k>=a[i])
			dp[i][j][k]+=dp[i-1][j-1][k-a[i]];
			dp[i][j][k]+=dp[i-1][j][k];
			//printf("dp[%d][%d][%d]=%d\n",i,j,k,dp[i][j][k]);
		}
	}
	for(int i=1;i<=n;i++)
			ans+=dp[n][i][i*k];
		printf("%lld\n",ans);
	return 0;
}

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

// ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
// ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll nc = b / c - (a-1) / c;
    ll nd = b / d - (a-1) / d;
    ll ncd = b / lcm(d,c) - (a-1) / lcm(d,c);
    ll ans = max((b-a+1)-(nc + nd - ncd),ll(0));
    cout << ans << endl;
}

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

#define fr(i,n) _back
#define pb	push_back
#define eb	emplace_back
#define mk	make_pair
#define fi	first
#define se	second
#define endl	'\n'

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<ii> vii;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
int dp[2][3];

int main() {
    ios_base::sync_with_stdio(false);
    int n; cin >> n;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j  < 3; j++) cin >> dp[1][j];
        dp[1][0] += max(dp[0][1],dp[0][2]);
        dp[1][1] += max(dp[0][0],dp[0][2]);
        dp[1][2] += max(dp[0][1],dp[0][0]);
        for(int j = 0; j < 3; j++) dp[0][j] = dp[1][j];
    }
    cout << max({dp[0][0],dp[0][1],dp[0][2]}) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <set>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    set<char> c;
    REP(i, 4) c.insert(S[i]);
    bool ans = true;
    if (c.size() != 2) ans = false;
    else if (S[0] == S[1] && S[1] == S[2]) ans = false;
    if (ans) cout << YES << '\n';
    else cout << NO << '\n';

}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <tuple>
#include <math.h>
#include <set>
#include <stack>
#include <bitset>
#include <map>
#include <queue>
#include <random>
#include <unordered_set>
#include <unordered_map>
#define DEBUG
#define fi first
#define se second
#define pqueue priority_queue
#define pb(x) push_back(x)
#define endl '\n'
#define all(x) x.begin(), x.end()
#define int long long
#define mk(a, b) make_pair(a, b)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ull> vull;
typedef vector<ll> vll;
// typedef tuple<int, int, int> tiii;
typedef pair<int, int> pii;
typedef vector<pair<int, int> > vpii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector< vector<int> > vvi;
typedef vector<char> vc;

const int INF = 1e9;
const ll INFLL = 1e16;
const int MOD = 1000000007;
const int MAXN = 3e5;
//const ld eps = 1e-6;
const ld eps2 = 1e-9;
const int MOD2 = 998244353;
const int dosz = 5e5;
const int SZ = (1<<18);
const ld PI = atan2l(0, -1);


void fast_io(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#ifdef DEBUG
        // freopen("a.in", "r",stdin);
#else
       // freopen("substrcmp.in", "r", stdin);
       // freopen("substrcmp.out", "w", stdout);
#endif
}

void solve(){
    int n;
    cin >> n;
    vi nums(n);
    for(int &i:nums)
        cin >> i;
    sort(all(nums));
    for(int i=0; i<n-1; i++){
        if(nums[i] == nums[i+1]){
            cout << "NO" << endl;
            return;
        }
    }
    cout << "YES" << endl;
}

signed main() {
    fast_io();
    int q = 1;
    // cout << fixed << setprecision(6);
    // cin >> q;
    // cout << 1 << endl;
    while(q--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
using namespace std;
using llong = long long;

int main() {
    int a;

    scanf("%d", &a);

    if (islower(a)) cout << 2 << endl;
    else if (isupper(a)) cout << 1 << endl;
    else cout << 0 << endl;

    return 0;
}



Measured memory_bytes: 3136
import numpy as np
#np_ary=np.array([1,2,3,4,5])
o = input()
l=[]
for i in range(len(o)):
    l.append(o[i])

for i in range(len(l)):
    if l[i]=="?":
        l[i]="D"
for i in range(len(l)):
    if i==len(l)-1:
        print(l[i])
        exit()
    else:
        print(l[i],end="")


Measured memory_bytes: 28780
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

h,w=map(int,input().split())
a=[input() for i in range(h)]

lst=[0]*26
for i in range(h):
    for j in range(w):
        lst[ord(a[i][j])-ord("a")]-=1

# print(lst)

heapq.heapify(lst)
dic=defaultdict(int)
if h%2==0:
    if w%2==0:
        dic[4]=h*w//4
    else:
        dic[4]=(w-1)*h//4
        dic[2]=h//2
else:
    if w%2==0:
        dic[4]=(h-1)*w//4
        dic[2]=w//2
    else:
        dic[4]=(h-1)*(w-1)//4
        dic[2]=h//2+w//2
        dic[1]=1
# print(dic)
# print(lst)
for i in range(dic[4]):
    tmp=-heapq.heappop(lst)
    if tmp>=4:
        tmp-=4
        heapq.heappush(lst,-tmp)
    else:
        print("No")
        quit()

for i in range(dic[2]):
    tmp=-heapq.heappop(lst)
    if tmp>=2:
        tmp-=2
        heapq.heappush(lst,-tmp)
    else:
        print("No")
        quit()

for i in range(dic[1]):
    tmp=-heapq.heappop(lst)
    if tmp>=1:
        tmp-=1
        heapq.heappush(lst,-tmp)
    else:
        print("No")
        quit()
# print(lst)
print("Yes")

Measured memory_bytes: 75084
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <string>
#include <cmath>

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<vector<int> > d(n, vector<int> (2));
	for (int i = 0; i < 2; i++)
		cin >> d[i][0] >> d[i][1];
	for (int i = 2; i < n; i++){
		cin >> d[i][0] >> d[i][1];
		if (d[i][0] == d[i][1] && d[i - 1][0] == d[i - 1][1] && d[i - 2][1] == d[i - 2][0]){
			printf("Yes\n");
			return 0;
		}
	}
	printf("No\n");
	return 0;
}



Measured memory_bytes: 3632
#include <string.h>

#include <algorithm>
#include <cstdlib>  // abs() for integer
#include <iostream>

using namespace std;

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

  int hasuu = N % 1000;
  int otsuri;

  if (hasuu == 0)
    otsuri = 0;
  else
    otsuri = 1000 - hasuu;

  cout << otsuri << endl;
  return 0;
}


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

int main() {
	long x,n,m,i,j,k,ans,cur;
	cin >> k >> n;
	vector<long> a(n+1);
	for(i=0; i<n; i++){
		cin >> a[i];
	}
	a[n]=a[0]+k;
	
	cur=0;
	for(i=0; i<n; i++){
		cur=max(cur,a[i+1]-a[i]);
	}
	cout << k-cur << endl;
	return 0;
}

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

struct Card{
    char mark;
    int value;
};

void bubble(Card c[],int n){
     for(int i = 0; i < n ; i++){
        int j = n- 1;
        
        while(j >= i + 1 ){
            
            if(c[j].value < c[j - 1].value){
                Card y = c[j];
                c[j] = c[j - 1];
                c[j - 1] = y;
                
            }
            //A[j + 1] = A[j];
            j = j - 1;
            //continue;
        }
        //A[i] = A[j + 1];
        //A[j + 1] = y;
        
        
    }
    
}

void selection(Card c[], int n){
    for(int i = 0; i < n - 1; i++){
        int minj = i;
        for(int j = i; j < n; j++){
            
            if(c[j].value < c[minj].value){
                minj = j;
                
            
            } 
            
        }
        //cout << minj << endl;
        if(i != minj){
            Card y = c[i];
            c[i] = c[minj];
            c[minj] = y;
            
        }
        
    }
}

bool isStable(Card c1[], Card c2[], int n){
    for(int i = 0; i < n; i++){
        if(c1[i].mark != c2[i].mark){
            return false;
        }
    }
    return true;
}


int main(){
    int n;
    Card A1[40], A2[40];
    
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> A1[i].mark >> A1[i].value;
        //cout << A[i];
    }
    for(int i = 0; i < n; i++){
        A2[i] = A1[i];
        //cout << A[i];
    }
    
    bubble(A1, n);
    selection(A2, n);
    
    
    for(int i = 0; i < n; i++){
        //cin >> A[i];
        if(i != 0) cout << " ";
        cout << A1[i].mark << A1[i].value;
    }
    cout << endl;
    cout << "Stable" << endl;
    for(int i = 0; i < n; i++){
        //cin >> A[i];
        if(i != 0) cout << " ";
        cout << A2[i].mark << A2[i].value;
    }
    cout << endl;
    if(isStable(A1, A2, n)){
        cout << "Stable" << endl;
    }else {
        cout << "Not stable" << endl;
    }
    
    
    
    return 0;
}


Measured memory_bytes: 3104
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int A=scanner.nextInt();
		int B = scanner.nextInt();

		int add,sub,mul;
		add = A+B;
		sub = A-B;
		mul = A*B;

		int max = add;
		max = (sub>max)?sub:max;
		max= (mul>max)?mul:max;

		System.out.println(max);

	}

}


Measured memory_bytes: 22740
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

int main() {
  int n, ans, t;
  int dp[2][1000];
  char cbuf[1080];

  while (1) {
    scanf("%d\n", &n);
    if (!n) break;
    ans = 0;
    memset(&dp[0][0], 0, sizeof(int)*n);
    memset(&dp[1][0], 0, sizeof(int)*n);
    for (int i=0; i<n; i++) {
      fgets(cbuf, sizeof(cbuf), stdin);
      dp[i&1][0] = (cbuf[0]=='.') ? 1 : 0;
      for (int j=1; j<n; j++) {
        if (cbuf[j] == '.') {
          t = min(dp[i&1][j-1], min(dp[(i+1)&1][j-1], dp[(i+1)&1][j]))+1;
          dp[i&1][j] = t;
          if (ans < t) ans = t;
        } else {
          dp[i&1][j] = 0;
        }
      }
    }
    printf("%d\n", ans);
  }
  
  return 0;
}

Measured memory_bytes: 1056
#include<cstdio>
#include<queue>
#include<algorithm>
#define ld long double
#define MN 21000000
using namespace std;

int read_p,read_ca;
inline int read(){
    read_p=0;read_ca=getchar();
    while(read_ca<'0'||read_ca>'9') read_ca=getchar();
    while(read_ca>='0'&&read_ca<='9') read_p=read_p*10+read_ca-48,read_ca=getchar();
    return read_p;
}
long long n,a,b,c,d,w;
int main(){
	scanf("%lld%lld%lld%lld%lld",&n,&a,&b,&c,&d);
	b-=a;n--;
	for (int i=0;i<=n;i++){
		w=-d*i+c*(n-i);
		if (b-w<=(d-c)*n&&b>=w) return /*printf("%d %lld %lld %lld\n",i,w,n,b-w),*/puts("YES"),0;
	}
	puts("NO");
}

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

#define int long long

int count (bool b, vector<int> a) {
    int n = a.size();
    int sum = 0;
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        int nsum = a[i] + sum;
        // 偶数が正
        if ((i % 2 == 1) ^ b) {
            if (nsum >= 0) {
                cnt += nsum + 1;
                nsum = -1;
            }
        } else if (nsum <= 0 ) {
            cnt += - nsum + 1;
            nsum = 1;
        }
        sum = nsum;
    }
    return cnt;
}

signed main() {
    int n;
    cin >>n;
    vector<int> a(n);
    for (int i = 0; i < n; i ++) {
        cin >> a[i];
    }
    cout << min(count(true,a), count(false, a) ) << endl;
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,x;
	cin>>a>>b>>c>>x;
	int ans=0;
	for(int i=0;i<=a;i++) for(int j=0;j<=b;j++) for(int k=0;k<=c;k++) if(i*500+j*100+k*50==x) ans++;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<utility>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<signed(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define ALL(a) (a).begin(),(a).end()
//#define EVEL 1

#ifdef EVEL
#define DEB(X) cout << #X << ":" <<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {}
#define TF(f) {}
#define END {}
#endif
const int MOD = 1000000007;
const ll INF = 20000000000;
typedef std::pair<int,int> P;


	ll ans=INF;
	ll N,K,G,A[500010],B[500010];
	ll sum;
	string S;
ll gcd(ll a,ll b){
    if(b==0)return a;
    return gcd(b,a%b);
}
bool F[100];
int main(){
	ios_base::sync_with_stdio(false);
	cin>>N;
	if(N==0){
		cout<<0;
		return 0;
	}
	DEB(N/-2)END;
	while(N!=0){
		if(N%-2<0){
			int a=N%-2;
			N--;N/=-2;
			S+=to_string(abs(a));
		}else{
			int a=N%-2;
			N/=-2;
			S+=to_string(abs(a));
		}
	}
	reverse(ALL(S));
	cout<<S<<endl;
}

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

int main()
{
    int n;
    cin >> n;
    int ans = 0;
    int a, b, c;
    a = n / 100;
    b = n / 10 - a * 10;
    c = n % 10;
    ans = (10 - a) * 100 + (10 - b) * 10 + (10 - c);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define inf (int)(1e9+7)
#define mod (ll)(1e9+7)
#define eb emplace_back
#define eps 1e-10
#define F first
#define S second

int main() {
    int w, h, x, y; cin >> w >> h >> x >> y;
    cout << fixed << setprecision(10) << (double)w * h / 2 << " ";
    cout << (2 * x == w && 2 * y == h) << endl;
}


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

using namespace std;

int main() {
  int n;
  while(1){
    cin >> n;
    if(!n)break;
    vector<vector<double>> dp(n,vector<double>(20));
    double sum = 0.0;
    sum += dp[0][1] = 1.0;
    for (int i = 1; i < n; ++i) {
      for (int j = 1; j < 20; ++j) {
        sum += dp[i][j] = dp[i-1][j-1] / (1 << (j-1));
        dp[i][0] += dp[i-1][j-1] * (1.0 - 1.0/(1<<(j-1)));
      }
    }
    printf("%.8lf\n", sum);
  }
  return 0;
}

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

void answer1() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int K, S;
  cin >> K >> S;
  int count = 0;
  for (int x = 0; x <= K; x++) {
    for (int y = 0; y <= K; y++) {
      int z = S - x - y;
      if (0 <= z && z <= K) {
        count++;
      }
    }
  }
  printf("%d\n", count);
}

int main() {
  answer1();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}


int main()
{
  ll x,y;
  cin >> x >> y;
  if(x<=7&&y<=7){
    if(x==y){printf("Brown");
           return 0;
          }
    if((x==0&&y==1)||(x==1&&y==2)||(x==2&&y==3)||(x==2&&y==6)||(x==2&&y==7)||(x==3&&y==7)||(x==6&&y==7)||(x==1&&y==0)||(x==2&&y==1)||(x==3&&y==2)||(x==6&&y==2)||(x==7&&y==2)||(x==7&&y==3))
    {printf("Brown");
     return 0;
    }
    printf("Alice");
     return 0;
  }
  if(x==y){printf("Brown");
           return 0;
          }
  if(abs(x-y)==1){printf("Brown");
                  return 0;
                 }
  printf("Alice");
  return 0;
}

Measured memory_bytes: 256
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort(reverse=True)
l = [list(map(int, input().split())) for i in range(m)]
l.sort(key=lambda x: x[1], reverse=True)

res = 0
pos_1 = 0
pos_2 = 0
for _ in range(n):
    if pos_2 == m or a[pos_1] > l[pos_2][1]:
        res += a[pos_1]
        pos_1 += 1
    else:
        res += l[pos_2][1]
        l[pos_2][0] -= 1
        if l[pos_2][0] == 0:
            pos_2 += 1
 
print(res)

# d = []
# while l and len(d) <= n:
#     bc = l.pop(0)
#     d.extend([bc[1]]*bc[0])
# ret = 0
# for i in range(n):
#     if d and d[0] > a[0]:
#         ret += d.pop(0)
#     else:
#         ret += a.pop(0)
# print(ret)

Measured memory_bytes: 99480
package main

import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}

func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

func Solve() {
  var N int
  NextInt(&N)
  T := make([][]int, N)
  G := make([][]int, N)
  for i := range G {
    T[i] = make([]int, 0)
    G[i] = make([]int, N)
    for j := range G[i] {
      G[i][j] = N
    }
    G[i][i] = 0
  }
  var a, b int
  for i := 1; i < N; i++ {
    NextInt(&a, &b)
    a, b = a - 1, b - 1
    T[a] = append(T[a], b)
    T[b] = append(T[b], a)
    G[a][b] = 1
    G[b][a] = 1
  }
  for k := range G {
    for i := range G {
      for j := range G {
        G[i][j] = MinInt(G[i][k] + G[k][j], G[i][j])
      }
    }
  }
  R := N
  for _, g := range G {
    R = MinInt(MaxInt(g...), R)
  }
  Calc := func(u, v int) int {
    D := make([]int, R + 1)
    for w, t := range T {
      r := MinInt(G[u][w], G[v][w])
      D[r] = MaxInt(len(t), D[r])
    }
    cnt := 2 * MaxInt(D[0] - 1, 1)
    if u == v { cnt = D[0] }
    for _, d := range D[1:] {
      if d < 2 { break }
      cnt *= d - 1
    }
    return cnt
  }
  C := make([]int, 0)
  for i := range G {
    if R == MaxInt(G[i]...) { C = append(C, i) }
  }
  if len(C) < 2 { C = append(C, C...) }
  ans := Calc(C[0], C[1])
  if C[0] == C[1] {
    R++
    for _, v := range T[C[0]] {
      ans = MinInt(Calc(C[0], v), ans)
    }
  }
  WriteIntVec([]int{R, ans})
}

func main() {
  Solve()
  Output()
}

Measured memory_bytes: 768
#include <iostream>
using namespace std;
int dp[111111],a[111111];
int main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	dp[2] = abs(a[1] - a[2]);
	for (int i = 3; i <= n; i++) {
		if (dp[i - 1]+abs(a[i] - a[i - 1]) > dp[i - 2]+abs(a[i] - a[i - 2])) {
			dp[i] = dp[i - 2] + abs(a[i] - a[i - 2]);
		}
		else {
			dp[i] = dp[i - 1] + abs(a[i] - a[i - 1]);
		}
	}
	cout << dp[n];
}

Measured memory_bytes: 4372
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define bg begin()
#define end end()
#define sz size()
#define vi vector<int>
#define vl vector<long long int>
int main(){
	fast;
	int a;
	cin>>a;
	cout<<a+a*a+a*a*a;
	return 0;
}



Measured memory_bytes: 3652
#include <stdio.h>
int main() {
	int c[3][3];
	for (int i = 0; i < 3; i++)
	{
		for (int j = 0; j < 3; j++)
		{
			scanf("%d", &c[i][j]);
		}
	}
	for (int i = 0; i < 2; i++)
	{
		for (int j = 0; j < 2; j++)
		{
			if (c[j][i] - c[j + 1][i] != c[j][i + 1] - c[j + 1][i + 1]) {
				printf("No");
				return 0;
			}
			if (c[i][j] - c[i][j + 1] != c[i + 1][j] - c[i + 1][j + 1]) {
				printf("No");
				return 0;
			}
		}
	}
	printf("Yes");
	return 0;
}

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

int main(){
  int N, Y;
  cin >> N >> Y;
  int res10000 = -1, res5000 = -1, res1000 = -1;
  for (int a = 0; a <= N; ++a){
    for (int b = 0; a + b <= N; ++b){
      int c = N - a - b;
      int total = 10000*a + 5000*b + 1000*c;
      if (total == Y){
        res10000 = a;
        res5000 = b;
        res1000 = c;
      }
    }
  }

  cout << res10000 << " " << res5000 << " " << res1000 << endl;
}


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

using namespace std;

struct node
{
	int x,y;
	bool operator <(const node &a)
	{
		return x<a.x;
	}
};

node a[100010];

int main()
{
	int n;
	scanf("%d",&n);
	for (int i=0;i<n;i++)
	{
		scanf("%d",&a[i].x);
		a[i].y=i+1;
	}
	sort(a,a+n);
	for (int i=0;i<n;i++)
		printf("%d ",a[i].y);
	
	return 0;
}

Measured memory_bytes: 1536
// garnab27
#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define ll int64_t
#define F first
#define S second
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define fr(i,a,b) for(int i=a;i>=b;i--)
#define MAXN 
using namespace std;
ll modex(ll a,ll b,ll p){ll res=1;a%=p;while(b>0){if(b&1)res=(res*a)%p;a=(a*a)%p;b>>=1;}return res;}
const int MD = (int)1e9+7;
int dx[]={1,0,-1,0,1,-1,-1,1};
int dy[]={0,1,0,-1,1,1,-1,-1};
 
 
int main(){
	ios::sync_with_stdio(0);
	cin.tie(NULL);cout.tie(NULL);	

	int a,b,c,d;

	cin>>a>>b>>c>>d;

	//cout<<ceil(1.0*c/b)<<" "<<ceil(1.0*a/d);
	if(ceil(1.0*c/b) > ceil(1.0*a/d))
		cout<<"No\n";
	else cout<<"Yes\n";
 
 
 
	return 0;
}

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

int main (int argc, char** argv)
{
    int N;
    std::cin >> N;
    std::vector<int> L;
    L.resize(N);
    for (auto& it : L) {std::cin >> it;}

    int max = *std::max_element(L.begin(), L.end());
    int sum = 0;
    int count = 0;
    for (auto it : L)
    {
        if (it != max) {sum += it;}
        else
        {
            if (count == 0) {++count;}
            else {sum += it;}
        }
        
    }
    if (2 < count) 
    {
        std::cout << "No" << std::endl;
        
    }

    if (max < sum) {std::cout << "Yes" << std::endl;}
    else {std::cout << "No" << std::endl;}

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void){
    int i, j, k, H, W;
    for(k=0; k<300; k++){
        scanf("%d %d", &H, &W);
        if(H == 0 && W == 0){
            break ;
        }
        for(i=0; i<H; i++){
            for(j=0; j<W; j++){
                if(i==0 || i==H-1 || j==0 || j==W-1){
                    printf("#");
                }else{
                    printf(".");
                }
            }printf("\n");
        }printf("\n");
    }
    return 0;
}



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

#define ll long long
#define rep(i,N) for(ll i=0; i<N; i++)
const int mx = 2e5;

int main(void){
  ll H1,M1,H2,M2,K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  
  ll oki, ne;
  oki = H1*60+M1;
  ne = H2*60+M2;
  
  if(ne<oki) ne+=1440;
  
  cout << ne-oki-K;

  return 0;
}

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

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		String string;
		int n, m, a = 0, b = 0, c = 0;
		
		while(!(string = reader.readLine()).equals("0")){
			n = Integer.valueOf(string);
			m = Integer.valueOf(reader.readLine());
			
			int map[][] = new int[n][n];
			boolean visit[] = new boolean[n];
			for(int i = 0;i < n; i++) Arrays.fill(map[i], 1 << 29);
			for(int i = 0; i < m; i++){
				string = reader.readLine();
				a = Integer.valueOf(string.split(",")[0]);
				b = Integer.valueOf(string.split(",")[1]);
				c = (Integer.valueOf(string.split(",")[2]) - 100) / 100;
				map[a][b] = map[b][a] = c;
			}
			c = 0;
			visit[0] = true;
			for(int x = 0; x < n - 1; x++){
				m = 1 << 29;
				for(int i = 0; i < n; i++){
					if(map[0][i] < m && !visit[i]){
						m = map[0][i];
						b = i;
					}
				}
				visit[b] = true;
				c += map[0][b];
				for(int i = 0; i < n; i++){
					map[0][i] = Math.min(map[0][i], map[b][i]);
				};
			}
			System.out.println(c);
		}
		reader.close();
	}
}

Measured memory_bytes: 33048
#include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

int N,c[20];

int f(int *c,int l){
	if(!l)return 0;
	int res=l;
	//cout<<l<<": ";rep(i,20)cout<<c[i]<<(i<19?" ":"\n");
	rep(i,l){
		//cout<<"i"<<i<<" ";
		if(c[i]==-1)break;
		if(i%4<3&&c[i]==c[i+1]){
			if(l==2)return 0;
			int d[20];
			rep(j,20)d[j]=c[j];
			for(int j=i;j<l-2;j++)d[j]=d[j+2];
			d[l-2]=-1;d[l-1]=-1;
			res=min(res,f(d,l-2));
		}
		if(i/4<4&&c[i]==c[i+4]){
			if(l==2)return 0;
			int d[20];
			rep(j,20)d[j]=c[j];
			for(int j=i;j<=i+2;j++)d[j]=d[j+1];
			for(int j=i+3;j<l-2;j++)d[j]=d[j+2];
			d[l-2]=-1;d[l-1]=-1;
			res=min(res,f(d,l-2));
		}
		if(i%4<3&&i/4<4&&c[i]==c[i+5]){
			if(l==2)return 0;
			int d[20];
			rep(j,20)d[j]=c[j];
			for(int j=i;j<=i+3;j++)d[j]=d[j+1];
			for(int j=i+4;j<l-2;j++)d[j]=d[j+2];
			d[l-2]=-1;d[l-1]=-1;
			res=min(res,f(d,l-2));
		}
		if(i%4>0&&i/4<4&&c[i]==c[i+3]){
			if(l==2)return 0;
			int d[20];
			rep(j,20)d[j]=c[j];
			for(int j=i;j<=i+1;j++)d[j]=d[j+1];
			for(int j=i+2;j<l-2;j++)d[j]=d[j+2];
			d[l-2]=-1;d[l-1]=-1;
			res=min(res,f(d,l-2));
		}
		if(!res)return 0;
	}
	//cout<<l<<"return "<<res<<endl;
	return res;
}

int main(){
	cin>>N;
	while(N--){
		rep(i,20)cin>>c[i];
		cout<<f(c,20)<<endl;
	}
}

Measured memory_bytes: 0
#include <cstdio>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <time.h>
#include <vector>
#include <iostream>
#include <string>
#include <algorithm>
#include <memory.h>
#include <cstdlib>
#include <queue>
#define P pair<int, int>
#define LL long long
#define LD long double
#define PLL pair<LL, LL>
#define mset(a, b) memset(a, b, sizeof(a))
#define PI acos(-1.0)
#define random(x) rand() % x
using namespace std;
const int inf = 0x3f3f3f3f;
const LL __64inf = 0x3f3f3f3f3f3f3f3f;
const int MAX = 1e5 + 5;
const int Mod = 1e9 + 7;

vector<P> A;

int main()
{
    int n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    s[k-1] -= 'A' - 'a';
    cout << s << endl;
    return 0;
}

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

int a[100000];

int main(){
  int N; cin >> N;
  for (int i=0; i<N; i++){
    cin >> a[i];
  }
  map<int, int> mp;
  for (int i=0; i<N; i++){
    mp[a[i]]++;
  }
  int ans = 0;
  for (auto itr = mp.begin(); itr != mp.end(); itr++){
    int x = itr->first;
    int n = itr->second;
    if (n<x) ans += n;
    else ans += n -x;
  }

  cout << ans << endl;
}

Measured memory_bytes: 5120
#include <cstdio>
#include <climits>
#include <iostream>
#define _for(i,n) for(int i = 0; i < n; i++)

using namespace std;



int main() {
    int n, m;
    cin >> n >> m;
    for (int i = n; i <= m/2+1; i++) {
        if (m%i==0) {
            cout << m/i << endl;
            return 0;
        }
    }
    cout << 1 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <stack>
#include <queue>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)
//input
int main(void)
{
    int N;
    cin >> N;
    string s;
    int ans = 1000000;
    int tmp = 0;
    for (int i = 1; i < N; i++)
    {
        s = to_string(i);
        for (int j = 0; j < s.length(); j++)
        {
            int k = s[j] - '0';
            tmp += k;
        }
        s = to_string(N - i);
        for (int j = 0; j < s.length(); j++)
        {
            int k = s[j] - '0';
            tmp += k;
        }
        ans = min(ans, tmp);
        tmp = 0;
    }
    cout << ans << endl;
    return 0;
}


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

int main(){
    int r, g, b;
    cin >> r >> g >> b;
    int judge = (r * 100) + (g * 10) + b;
    if(judge % 4 == 0) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <cstdlib>
#include <memory>
#include <queue>
#include <cassert>
#include <cmath>
#include <ctime>
#include <complex>
#include <bitset>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <numeric>

using namespace std;

#define ws ws_____________________
#define y1 y1_____________________
#define y0 y0_____________________
#define left left_________________
#define right right_______________
#define next next_________________
#define prev prev_________________
#define hash hash_________________

#define pb push_back
#define fst first
#define snd second
#define mp make_pair 
#define sz(C) ((int) (C).size())
#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define ford(i, n) for (int i = int(n) - 1; i >= 0; --i)
#define all(C) begin(C), end(C)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef long double ld;
typedef complex<double> cd;

#ifdef LOCAL
#define eprintf(args...) fprintf(stderr, args), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define FILE_NAME "a"

int n, a, b;

bool read() {
	if  (scanf("%d%d%d", &n, &a, &b) < 2) {
		return 0;
	}
	return 1;
}


void solve() {
	const int dist = b - a - 1;
	const int who = dist & 1;
	if  (who == 0) {
		puts("Borys");
	} else {
		puts("Alice");
	}
}

int main() {
#ifdef LOCAL
	freopen(FILE_NAME ".in", "r", stdin);
	// freopen(FILE_NAME ".out", "w", stdout);
#endif

	while (read()) {
		solve();
	}

#ifdef LOCAL
	eprintf("Time: %.10f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}


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

typedef long long int ll;
using namespace std;

const int MAX = 3e5 + 10;

int main()
{
	int n; cin>>n;
	int l[MAX]={0},r[MAX]={0};
	for(int i=1;i<=n;i++){
		char x; cin>>x;
		if(x=='E') r[i]++;
		else l[i]++;
	}

	for(int i=1;i<=n;i++) l[i] += l[i-1],r[i] += r[i-1];
	int ans = MAX;
	for(int i=1;i<=n;i++){
		int re = r[n] - r[i];
		int lw = l[i-1] - l[0];
		ans = min(ans,re+lw);
	}
	cout<<ans;	
}

Measured memory_bytes: 2560
//2018年  3月 24日 土曜日 03:23:51 JST
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;
int A[MAX_N];
vector<int> G[MAX_N];

int loop(int v, int p) {
	int cnt = 0, ccnt = 0;
	int mv = 0;
	rep(i, 0, sz(G[v])) {
		int n = G[v][i];
		if(n == p) continue;
		int tmp = loop(n, v);
		// debug(n, tmp);
		if(tmp == inf) return inf;
		cnt += tmp;
		MAX(mv, tmp);
		ccnt++;
	}
	if(ccnt == 0) return A[v];
	else if(ccnt == 1) {
		if(A[v] != cnt) return inf;
		else {
			if(v == 0) return 0;
			else return cnt;
		}
	}
	else {
		if(cnt - A[v] < 0 || 2 * A[v] - cnt < 0) return inf;
		else {
			if(cnt - A[v] > min(cnt - mv, cnt / 2)) return inf;
			return 2 * A[v] - cnt;
		}
	}
}

void solve() {
	cin >> N;
	rep(i, 0, N) cin >> A[i];
	rep(i, 0, N - 1) {
		int a, b; cin >> a >> b; a--; b--;
		G[a].pb(b);
		G[b].pb(a);
	}
	if(loop(0, -1) != 0) cout << "NO\n";
	else cout << "YES\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
	srand((unsigned int)time(NULL));
#ifdef LOCAL
	//freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



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

int main(){
    char c;
    cin >> c;
    if( c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
        cout << "vowel" << endl;
    }
    else{
        cout << "consonant"  << endl;
    }
    
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <climits>
#include <cmath>
#include <utility>
#include <cstring>

using namespace std;

// const int maxn = 

int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int a, b, c;
	cin >> a >> b >> c;
	int res = b + min(c, a+b+1);
	cout << res << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int N;
  cin >> N;
  long long p[5]{};
  string S;
  for (int i = 0; i != N; ++i) {
    cin >> S;
    if (auto j = "MARCH"s.find(S[0]); j != string::npos) ++p[j];
  }

  long long ans{};
  for (int i = 0; i != 3; ++i)
    for (int j = i + 1; j != 4; ++j)
      for (int k = j + 1; k != 5; ++k)
        ans += p[i] * p[j] * p[k];
  cout << ans << endl;
}


Measured memory_bytes: 3600
import math
n,p = map(int,input().split())
a = list(map(int,input().split()))
ze = 0
on = 0
for i in range(n):
  if a[i] %2 == 0:
    ze+=1
  else:
    on += 1
con = 0
if p == 0:
  for i in range(0,on+1,2):
    con += math.factorial(on)//math.factorial(on-i)//math.factorial(i)
else:
  for i in range(1,on+1,2):
    con += math.factorial(on)//math.factorial(on-i)//math.factorial(i)
ans = (2**ze)*con
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;


ll n, x, y;

int main(){
	cin >> n >> x >> y;
	x--;
	y--;
	vector<int> h(n);
	
	
	for ( int i = 0; i < n; i++ ){
		for ( int j = i+1; j < n; j++ ){
			int dix = abs(i-x);
			int djy = abs(j-y);
			int distance = min(j-i, dix+djy+1);
			h[distance]++;
		}
	}
	
	for ( int k = 1; k < n; k++ ){
		cout << h[k] << " ";
	}
	
	cout << endl;
	
	return 0;
}




Measured memory_bytes: 3636
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<ctime>
using namespace std;

typedef long long ll;

const int NIL = -1;
const int MAX = 2147483647;
const int N = 100001;
clock_t START, END;
bool debug = false;

ll sumv[500000], addv[500000];
ll ql, qr, p, v;
ll _sum;

/*void pushdown(int o)
{
	int lc = o * 2, rc = o * 2 + 1;
	if (addv[o] > 0) {
		addv[lc] = addv[rc] = addv[o];
		addv[o] = 0;
	}
}*/

void maintain(ll o, ll L, ll R)
{
	ll lc = o * 2, rc = 2 * o + 1;
	sumv[o] = 0;
	if (R > L) {
		sumv[o] = sumv[lc] + sumv[rc];
	}
	sumv[o] += addv[o] * (R - L + 1);
}

void query(ll o, ll L, ll R, ll add)
{
	ll M = L + (R - L) / 2;
	if (ql <= L && qr >= R) {
		_sum += sumv[o] + add * (R - L + 1);
	}
	else {
		if (ql <= M)
			query(o * 2, L, M, add + addv[o]);
		if (qr > M)
			query(o * 2 + 1, M + 1, R, add + addv[o]);
	}
}

void update(ll o, ll L, ll R)
{
	ll M = L + (R - L) / 2;
	ll lc = o * 2, rc = o * 2 + 1;
	if (ql <= L && qr >= R) {
		addv[o] += v;
	}
	else {
		if (ql <= M)
			update(lc, L, M);
		if (qr > M)
			update(rc, M + 1, R);
	}
	maintain(o, L, R);
}


int main(void)
{
	if (debug) {
		START = clock();
		freopen("in12.txt", "r", stdin);
		freopen("out.txt", "w", stdout);
	}
	int n, q, com;
	scanf("%d%d", &n, &q);
	for (int i = 0; i < q; i++) {
		scanf("%d", &com);
		if (com) {
			scanf("%lld%lld", &ql, &qr);
			//ql++;
			//qr++;
			_sum = 0;
			query(1, 1, n, 0);
			printf("%lld\n", _sum);
		}
		else {
			scanf("%lld%lld%lld", &ql, &qr, &v);
			//ql++;
			//qr++;
			update(1, 1, n);
		}
	}
	if (debug) {
		END = clock();
		double endtime = (double)(END - START) / 1000;
		printf("total time = %lf s", endtime);
	}
	return 0;
}


Measured memory_bytes: 7316
#include <stdio.h>

int main(void) {
  int N, M, n, m;
  int nVector[100][100];
  int mVector[100];

  /* 情報数読取り */
  scanf("%d %d\n", &N, &M);

  /* 情報格納 */
  for (n = 0; n < N; n++) {
    for (m = 0; m < M; m++)
      scanf("%d", &nVector[n][m]);
    scanf("\n");
  }
  for (m = 0; m < M; m++) {
    scanf("%d", &mVector[m]);
  }

  /* 情報表示 */
  for (n = 0; n < N; n++) {
    int sum = 0;
    for (m = 0; m < M; m++) {
      sum = sum + nVector[n][m] * mVector[m];
      //      printf("nVector[%d][%d](%d) x mVector[%d] = %d\n", n, m, nVector[\
n][m], m, sum);
    }
    printf("%d\n", sum);
  }
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n,S[14], K[14], D[14], H[14];
int main() {
	cin >> n;
	vector <char> a(n);
	vector <int> b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}
	for (int i = 0; i < n; i++) {
		if (a[i] == 'S') {
			S[b[i]] = 1;
		}
		else if (a[i] == 'C') {
			K[b[i]] = 1;
		}
		else if (a[i] == 'D') {
			D[b[i]] = 1;
		}
		else if (a[i] == 'H') {
			H[b[i]] = 1;
		}
	}
	for (int j = 1; j <= 13; j++) {
		if (S[j] == 0) {
			cout << 'S' << " " << j << endl;
		}
	}
	for (int j = 1; j <= 13; j++) {
		if (H[j] == 0) {
			cout << 'H' << " " << j << endl;
		}
	}
	for (int j = 1; j <= 13; j++) {
		if (K[j] == 0) {
			cout << 'C' << " " << j << endl;
		}
	}
	for (int j = 1; j <= 13; j++) {
		if (D[j] == 0) {
			cout << 'D' << " " << j << endl;
		}
	}
}

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

int main(){
    //input
    int N;
    cin >> N;
    int Z,W,a[N+1];
    cin >> Z >> W;
    int i;
    for(i=1; i<=N; i++){
        cin >> a[i];
    }

    //exception
    if(N==1){
        cout << abs(a[1]-W) << endl;
        system("pause");
        return 0;
    }

    //calc
    priority_queue<int, vector<int>, greater<int> > que_X;
    priority_queue<int, vector<int>, less<int> > que_Y;
    que_X.push(abs(a[N-1]-a[N]));
    que_Y.push(abs(a[N-1]-a[N]));
    int X,Y;
    for(i=N-2; i>=1; i--){
        X = max(que_Y.top(),abs(a[i]-a[N]));
        Y = min(que_X.top(),abs(a[i]-a[N]));
        que_X.push(X);
        que_Y.push(Y);
    }
    X = max(que_Y.top(),abs(W-a[N]));
    
    //answer
    cout << X << endl;
    system("pause");
    return 0;
}

Measured memory_bytes: 3724
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar(n) array<int,n>
#define mp make_pair
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	ll h,w,n;
	cin>>h>>w>>n;
	set<ar(2)> st;
	set<ar(2)> s;
	ll ans [10]={0};
	ans [0]= (h-2)*(w-2);
	for(int i = 0; i<n; i++)
	{
		int a,b;
		cin>>a>>b, --a,--b;
		st.insert({a,b});
		for(int j =0; j<3; j++)
			for(int k =0; k<3; k++)
			{
				int x = a-j;
				int y = b-k;
				if(x<0 || y<0 || x+3>h || y+3>w)continue;
				s.insert({x,y});
			}
	}
	for(auto it: s)
	{
		int cnt =0;
		for(int i =0; i<3; i++)
			for(int  j =0; j<3; j++)
			{
				int x = it[0]+i;
				int y = it[1]+j;
				if(st.count({x,y}))cnt++;
			}
		ans[0]--;
		ans[cnt]++;
	}
	for(int i =0; i<10; i++)
		cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 47104
#include <iostream>
#include <stack>
using namespace std;
 
int main(void){
    int n,q,x,y;
    cin>>n>>q;
    stack<int> s[n];
    while(q--){
        cin>>x;
        if(x==0){
            cin>>x>>y;
            s[x].push(y);
        }else if(x==1){
            cin>>x;
            if(s[x].size()!=0)cout<<s[x].top()<<endl;
        }else{
            cin>>x;
            if(s[x].size()!=0)s[x].pop();
        }
    }
    return 0;
}



Measured memory_bytes: 4364
#include <bits/stdc++.h>
    using namespace std;
    
    int group(int x)
    {
        int g;
        if (x==2)
            g=3;
        else if (x==4 || x==6 || x==9 || x==11)
            g=2;
        else
            g=1;
        return g;
    }
    int main()
    {
        int x{};
        int y{};
        cin >> x >> y;
        if (group(x)==group(y))
            cout << "Yes";
        else
            cout << "No";
        return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
              
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define ll long long
//#define int ll
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define VAR(v, i) __typeof( i) v=(i)
#define forit(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);

using namespace std;

const int maxn = (int) 2e5 + 100;
const int mod = (int)1e9 + 7;
const int P = (int) 1e6 + 7; 

#define inf mod

typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;   
typedef vector<ll> Vll;               
typedef vector<pair<int, int> > vpii;
typedef vector<pair<ll, ll> > vpll;                        


int n, a[maxn], k, dp[maxn];                                      
int main () {
  cin >> n >> k;
  forn(i, 1, n) cin >> a[i];
  forn(i, 2, n) dp[i] = inf;
  dp[1] = 0;
  forn(i, 1, n){
    forn(add, 1, k)
      dp[i + add] = min(dp[i + add], dp[i] + abs(a[i + add] - a[i]));
  }
  cout << dp[n];
}


Measured memory_bytes: 1024
import java.util.Scanner;
import java.io.*;

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

        Scanner scan = new Scanner(System.in);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        
		String[] str = scan.nextLine().split(" ");
		int[] x = new int[str.length];
		
        for(int i = 0; i < str.length; i++){
            x[i] = Integer.parseInt(str[i]);
        }
        
        out.println((x[0] * (x[0] - 1) / 2) + (x[1] * (x[1] - 1) / 2));
        
        out.close();
        
    }
}

Measured memory_bytes: 35876