akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int n,A[2000];

int solve(int,int);

int main(){
  int i,q,m;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m);
    if(solve(0,m)){
      printf("yes\n");
    }else{
      printf("no\n");
    }
  }
}

int solve(int i,int m){
  int r,s;
  if(m==0){
    return 1;
  }
  if(i>=n || m<0){
    return 0;
  }
  r=solve(i+1,m);
  s=solve(i+1,m-A[i]);
  if(r==1){
    return r;
  }
  if(s==1){
    return s;
  }
}
    



Measured memory_bytes: 2108
#ifdef LOCAL_EXEC
#include "include.h"
#else
#include <bits/stdc++.h>
using namespace std;
#define trace(...)
#endif

using LL = long long;
using PII = pair<LL, LL>;
#define L first
#define R second

LL len(const PII& p) {
	return max(0ll, p.R - p.L + 1);
}
PII merge(const PII& a, const PII& b) {
	return make_pair(max(a.L, b.L), min(a.R, b.R));
}

const LL MAX = 1e9;
void brute(vector<PII> range, LL ans) {
	LL best = 0;
	int n = range.size();
	for (int mask = 1; mask < (1 << n) - 1; mask++) {
		PII lt(1, MAX), rt(1, MAX);
		for (int i = 0; i < n; i++) {
			if (mask & (1 << i)) {
				lt = merge(lt, range[i]);
			} else {
				rt = merge(rt, range[i]);
			}
		}
		best = max(best, len(lt) + len(rt));
	}
	if (best != ans) {
		trace(best, ans);
		assert(false);
	}
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int n; cin >> n;
	vector<PII> range;
	for (int i = 0; i < n; i++) {
		LL l, r; cin >> l >> r;
		range.emplace_back(l, r);
	}
	sort(range.begin(), range.end(), 
		[](const PII& a, const PII& b) { 
			return make_pair(a.R, a.L) < make_pair(b.R, b.L); 
		});

	LL best = 0; PII tot(1, MAX);
	for (auto& e: range) {
		best = max(best, len(e));
		tot = merge(tot, e);
	}
	LL ans = len(tot) + best;

	auto first = range[0];
	LL rmin = range[0].R;
	range.erase(range.begin());
	// sort(range.begin(), range.end());
	vector<PII> lt;
	PII rest(1, MAX);
	bool empty = true;
	for (auto& e: range) {
		if (e.L <= rmin) {
			lt.push_back(e);
		} else {
			rest = merge(rest, e);
			empty = false;
		}
	}
	sort(lt.rbegin(), lt.rend(),
		[&](const PII& a, const PII& b) {
			return make_pair(max(first.L, a.L), a.R) < make_pair(max(first.L, b.L), b.R); 
		});
	for (auto& e: lt) {
		if (!empty) ans = max(ans, len(rest) + len(merge(e, first)));
		rest = merge(rest, e);
		empty = false;
	}
	ans = max(ans, len(rest) + len(first));

	cout << ans << endl;

#ifdef LOCAL_EXEC
	range.push_back(first);
	brute(range, ans);
#endif

	return 0;
}


Measured memory_bytes: 4848
open Hashtbl
let n = Scanf.scanf " %d" (+) 0
let a_s = Array.init n @@ fun i -> Scanf.scanf " %d" @@ fun a -> min i @@ a - 1, max i @@ a - 1
let h = create n
let _ = Array.iteri (fun i a -> replace h a @@ try find h a + 1 with _ -> 1) a_s; fold (fun _ c s -> s + if c = 2 then 1 else 0) h 0 |> Printf.printf "%d\n"

Measured memory_bytes: 10112
from statistics import median
import math
N = int(input())
*A, = map(int, input().split())
B = [A[i]-i for i in range(N)]
b = median(B)
bm = math.floor(b)
K = [x - bm for x in B]
KZ = [abs(x) for x in K]
Z = sum(KZ)
for i in range(20):
    C = [abs(x-i+10) for x in K]
    Z = min([sum(C),Z])
print(int(Z))

Measured memory_bytes: 49520
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] a = new long[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
        }
        long ans = syakutori(a, n);
        System.out.println(ans);
    }
    public static long syakutori(long[] a, int n) {
        int right = 0;
        long res = 0;
        long sum = 0;
        for (int left = 0; left < n; left++) {
            while (right < n && (sum ^ a[right]) == sum + a[right]) {
                sum += a[right];
                right++;
            }
            res += Math.max(0, right - left);
            if (left >= right) {
                right++;
                break;
            }
            sum -= a[left];
        }
        return res;
    }
}


Measured memory_bytes: 86952
import sys
input = sys.stdin.readline

n,m,k= map(int, input().split())
a= [list(map(int, input().split())) for i in range(m)]
c= [list(map(int, input().split())) for i in range(k)]

# ユニオンファインド
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

uf=UnionFind(n)
for i in range(m):
    uf.union(a[i][0]-1,a[i][1]-1)

ans=[uf.size(i)-1 for i in range(n)]
for i in range(m):
    ans[a[i][0]-1]-=1
    ans[a[i][1]-1]-=1

for i in range(k):
    if uf.same(c[i][0]-1,c[i][1]-1):
        ans[c[i][0]-1]-=1
        ans[c[i][1]-1]-=1

print(*ans)

Measured memory_bytes: 106972
S=list(input())
S.reverse()
N=len(S)
R=[0]*N
R10=[0]*N
m=2019
K=0

R10[0]=1
R[0]=int(S[0])%m
for i in range(1,N):
    R10[i]=(R10[i-1]*10)%m
    R[i]=(R[i-1]+int(S[i])*R10[i])%m
d={}
for i in range(2019):
    d[i]=0

for i in range(N):
    d[R[i]]+=1
ans=0
for i in range(2019):
    if i == 0:
        ans += d[i]
        ans +=d[i]*(d[i]-1)//2
    else:
        ans +=d[i]*(d[i]-1)//2
print(ans)

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

int n,t,m[1000],l[1000],k[1000];

bool check(int x){
  int c[1001]={},used[1000]={},cnt=n;
  for(int i=0;i<t&&cnt;i++){
    x+=c[i];
    for(int j=0;j<n&&x;j++){
      if(used[j])continue;
      if(i+m[j]>t)return 0;
      if(i%(l[j]+k[j])<=l[j])c[i+m[j]]++,cnt--,used[j]=1,x--;
    }
  }
  return !cnt;
}

int main(){
  while(scanf("%d%d",&n,&t),n){
    for(int i=0;i<n;i++)scanf("%d%d%d",&m[i],&l[i],&k[i]);
    int ans=0;
    for(int i=1;i<=n&&!ans;i++)if(check(i))ans=i;
    cout<<ans<<endl;
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define _abs(x)((x) < 0 ? (x) * -1 : (x))
#define _max(x, y)(max(0, max((x), (y))))
#define _min(x, y)(max(0, min((x), (y))))

int main()
{
    //freopen("in.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    //freopen("debug.txt", "w", stderr);

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

    string A, B;

    cin >> A;
    cin >> B;

    ll i, len = A.size();

    if (A.size() > B.size()) {
        cout << "GREATER" << endl;
        return 0;
    } else if (A.size() < B.size()) {
        cout << "LESS" << endl;
        return 0;
    }

    for (i = 0; i < len; i++) {
        if (A[i] > B[i]) {
            cout << "GREATER" << endl;
            return 0;
        } else if (A[i] < B[i]) {
            cout << "LESS" << endl;
            return 0;
        }
    }

    cout << "EQUAL" << endl;

    return 0;
}


Measured memory_bytes: 256
// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <set>
#include <queue>
#include <cstdio>
using namespace std;
#define rep(i, n) for(int i=0;i<n;i++)
#define irep(i, n) for(int i=n-1;i>=0;i--)
#define lrep(i, n) for(long long i=0;i<n;i++)
typedef long long ll;
typedef vector<long long> llv;
typedef vector<vector<long long> > llvv;
#define MAX 100000

struct Node{
    int key;
    Node *parent, *left, *right;
};

Node *root, *NIL;

void insert(int k){
    Node *y = NIL;
    Node *x = root;
    Node *z;

    z = (Node *)malloc(sizeof(Node));
    z->key = k;
    z->left = NIL;
    z->right = NIL;

    while(x != NIL){
        y = x;
        if(z->key < x->key){
            x = x->left;
        }else{
            x = x->right;
        }
    }
    z->parent = y;
    if(y == NIL) root = z;
    else{
        if(z->key < y->key){
            y->left = z;
        }else{
            y->right = z;
        }
    }
}

Node * find(Node *u, int k){
    while(u != NIL && k != u->key){
        if(k < u->key){
            u = u->left;
        }else{
            u = u->right;
        }
    }
    return u;
}

void inorder(Node *u){
    if(u == NIL) return;
    inorder(u->left);
    printf(" %d", u->key);
    inorder(u->right);
}

void preorder(Node *u){
    if(u == NIL) return;
    printf(" %d", u->key);
    preorder(u->left);
    preorder(u->right);
}

int main(){
    int n,i,x;
    string com;
    scanf("%d", &n);
    rep(i,n){
        cin >> com;
        if (com[0] == 'f'){
            scanf("%d", &x);
            Node *t = find(root, x);
            if(t!=NIL)printf("yes\n");
            else printf("no\n");
        }else if(com == "insert"){
            scanf("%d", &x);
            insert(x);
        }else if (com == "print"){
            inorder(root);
            printf("\n");
            preorder(root);
            printf("\n");
        }
    }
}


Measured memory_bytes: 22016
//BISMILLAH
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    int i=0,j,temp=5,a,num,paa,b,n,x,y,flag=0,even,odd;
    cin>>num>>paa;
    if(paa%2==0)
    {
        if(paa>=2*num && paa<=4*num) cout<< "Yes"<<endl;
        else cout<< "No"<<endl;
    }
    else cout<< "No"<<endl;


}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={1,0,-1,0,1,1,-1,-1,0};
const ll dx[9]={0,-1,0,1,1,-1,1,-1,0};
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;
}
int main(){
    ll k,n;cin >> n >>k;
    vl a(n),b(n);
    rep(i,n)cin >> a[i] >> b[i];
    ll res=0;
    rep(i,30){
        if((1<<i)&k){
            ll t=1<<i;
            t--;
            ll p=(k-(1<<i))|t;
            ll sum=0;
            rep(j,n){
                if(p==(p|a[j]))sum+=b[j];
            }
            chmax(res,sum);
        }
    }
    ll sum=0;
    rep(j,n){
        if(k==(k|a[j]))sum+=b[j];
    }
    chmax(res,sum);
    cout << res <<endl;
}   

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

int main()
{
	int R, G, B, N;
	cin >> R >> G >> B >> N;
	int c = 0;
	for (int r = 0; r <= N; r++)
	{
		for (int g = 0; g <= N; g++)
		{
			if ((N - (r * R + g * G)) % B == 0 && (N-(r*R+g*G))>=0)
				c++;
		}
	}
	cout << c << endl;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < (n); i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb(x) push_back(x)
 
using namespace std;
 
typedef long long ll;
typedef double ld;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int MX = 100005;
int n, res;
ll m, v, p, a[MX], acu[MX];

bool valid (ll lim, ll n, ll v) {
	ll j = lower_bound(a, a + n, lim - m) - a;
	ll s = lim * (n - j) - (acu[n - 1] - (j ? acu[j - 1] : 0)) + j * m;

	return s >= m * v;
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	cin >> n >> m >> v >> p;
	forn (i, n) cin >> a[i];
	sort (a, a + n);

	forn (i, n) {
		acu[i] = a[i];
		if (i) acu[i] += acu[i - 1];
	}

	forn (i, n) {
		if (n - i <= p) {
			res++;
			continue;
		}

		ll lim = a[i] + m;
		int j = upper_bound(a, a + n, lim) - a;

		if (n - j >= p) continue;

		res += valid(lim, n - (p - 1), max(0ll, v - p + 1));
	}

	cout << res << endl;

	return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			int largeT = sc.nextInt();
			int result = Integer.MAX_VALUE;

			for (int i = 0; i < n; i++) {
				int c = sc.nextInt();
				int t = sc.nextInt();
				if (t <= largeT && c < result) {
					result = c;
				}
			}

			if (result == Integer.MAX_VALUE) {
				System.out.println("TLE");
			} else {
				System.out.println(result);
			}
		}
	}
}


Measured memory_bytes: 22228
#include <bits/stdc++.h>
using namespace std;
uint64_t MOD = 1e9 + 7;

int main()
{
  uint64_t N, ans = 0, e = 1;
  cin >> N;
  vector<uint64_t> A(N);
  for (uint64_t i = 0; i < N; i++)
    cin >> A.at(i);
  for (uint64_t i = 0; i <= 60; i++)
  {
    uint64_t one = 0;
    for (uint64_t j = 0; j < N; j++)
      if (A.at(j) & (1LL << i))
        one++;
    ans += ((one * (N - one)) % MOD) * e % MOD;
    e *= 2;
    e %= MOD;
  }
  cout << ans % MOD << endl;
}


Measured memory_bytes: 2560
// "include" {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <tuple>
// }}}

using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9+7;

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

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a[3],k;
	cin >> a[0] >> a[1] >> a[2] >> k;
	sort(a,a+3,greater<int>());
	rep(i,k){
		a[0] *= 2;
	}
	cout << a[0] + a[1] + a[2] << '\n';
	return 0;	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 1e9 + 7;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); if(a && b){ return gcd(b, a % b); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

int main(){
    int N;
    cin >> N;
    cout << N * N * N << endl;
}


Measured memory_bytes: 256
' Imports System.Collections.Generic
' Imports System.Globalization
' Imports System.IO
' Imports System.Linq
' Imports System.Text
' Imports System.Text.RegularExpressions

Class Main
    Public Shared Sub Main()
        Dim A, B As Integer
        Dim arr() As String
        arr = Split(Console.ReadLine())
        A = arr(0) : B = arr(1)
        Console.WriteLine(If((A + B) Mod 2 = 0, (A + B) / 2, "IMPOSSIBLE"))
        Return
    End Sub
End Class

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

#define ll long long 

int main() {
    ios::sync_with_stdio(0); 

    int n; cin >> n; 
    vector<int> p(n); 
    for (auto& x: p) cin >> x; 
    int menor_ate_entao = n+1; 
    int ans = 0; 
    for (auto& x : p) {
        if (menor_ate_entao > x) {
            ans++;
            menor_ate_entao = x; 
        }
    }

    cout << ans << "\n"; 


    return 0; 
}



Measured memory_bytes: 1024
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int a = Integer.parseInt(s.substring(0,2));
        int b = Integer.parseInt(s.substring(2,4));


            if(b>0 && b<13 && a>0 && a<13){
                System.out.println("AMBIGUOUS");
            }else if(b>0 && b<13){
                System.out.println("YYMM");
            }else if(a>0 && a<13){
                System.out.println("MMYY");
            }else{
                System.out.println("NA");
            }

        

    }
}


Measured memory_bytes: 21844
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

//#define int long long

using namespace std;
using ll = long long;
using ld = long double;
using vecll = vector<ll>;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabcout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headcout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabheadcout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divup(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

void Main()
{
	int N, M;
	cin >> N >> M;
	vector<bool> ACList(N);
	vector<int> WAList(N);
	rep(i, M)
	{
		int p;
		string s;
		cin >> p >> s;
		p--;
		if (s == "AC")
		{
			ACList[p] = true;
		}
		else if (!ACList[p])
		{
			WAList[p]++;
		}
	}

	int ac = 0, wc = 0;
	rep(i, N)
	{
		if (ACList[i])
		{
			ac++;
			wc += WAList[i];
		}
	}

	cout << ac << " " << wc;
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);


	/*
	while (true)
	{
		Main();
		cout << endl;
	}
	//*/


	Main();

	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair < ll, ll > PLL;
#define rep(i,n) for (int i = 0; i < (n); ++i)
ll MOD = 1e9+7;
int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> c(h, vector<char>(w));
    rep(i, h) rep(j, w) cin >> c[i][j];
    rep(i, 2*h) {
        rep(j, w) cout << c[i/2][j];
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<algorithm>
using namespace std;
int main (){
	int N,K,i,j=1,a[11]={1};
	while((scanf("%d",&N)!=EOF)&&(scanf("%d",&K)!=EOF)){
		for(i=0;i<N;i++){
			if(a[i]>K)
				a[i+1]=a[i]+K;
			else
				a[i+1]=2*a[i];
		}
		printf("%d\n",a[N]);
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ll long long
#define ld long double
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 100005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
using namespace std;

int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
ll gcd(ll a,ll b){ if(!a)return b;return gcd(b%a,a);}



    
void test_case() {

    
    int n;
    cin>>n;

    vec arr(n+1,0);

    rep(i,n-1) {
        int x;
        cin>>x;

        arr[x]++;
    }

    for(int i=1; i<=n; i++) {
        cout<<arr[i]<<endl;
    }
    




    

}


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

    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);


    int t = 1;
    // cin >> t;
    while (t--)
    {
        test_case();
    }
}

Measured memory_bytes: 3992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
char a[10];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin >> a;
	if(a[2]==a[3]&&a[4]==a[5]) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
n = int(input())
s = input()
s = list(s)
l = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
for i in range(0,len(s)):
  for j in range (0,26):
    if s[i] == l[j]:
      s[i] = l[(j+n)%26]
      break
s = ''.join(s)
print(s)


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

int main() {
    string w;
    int count[26] = {0};
    cin >> w;

    for (int i = 0; i < w.length(); i++) {
        switch (w[i]) {
            case 'a':
                count[0]++;
                break;
            case 'b':
                count[1]++;
                break;
            case 'c':
                count[2]++;
                break;
            case 'd':
                count[3]++;
                break;
            case 'e':
                count[4]++;
                break;
            case 'f':
                count[5]++;
                break;
            case 'g':
                count[6]++;
                break;
            case 'h':
                count[7]++;
                break;
            case 'i':
                count[8]++;
                break;
            case 'j':
                count[9]++;
                break;
            case 'k':
                count[10]++;
                break;

            case 'l':
                count[11]++;
                break;
            case 'm':
                count[12]++;
                break;
            case 'n':
                count[13]++;
                break;
            case 'o':
                count[14]++;
                break;
            case 'p':
                count[15]++;
                break;
            case 'q':
                count[16]++;
                break;
            case 'r':
                count[17]++;
                break;
            case 's':
                count[18]++;
                break;
            case 't':
                count[19]++;
                break;
            case 'u':
                count[20]++;
                break;

            case 'v':
                count[21]++;
                break;
            case 'w':
                count[22]++;
                break;
            case 'x':
                count[23]++;
                break;
            case 'y':
                count[24]++;
                break;
            case 'z':
                count[25]++;
                break;
        }
    }
    string ans{};
    for (int j = 0; j < 26; j++) {
        if (count[j] % 2 != 0) {
            ans = "No";
        }
    }
    if (ans == "No")
        cout << "No" << endl;
    else
        cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 3580
#include <stdio.h>
#include <math.h>
int main(int argc, const char * argv[])

{
   int a,b;
   scanf("%d %d",&a,&b);
  
   if(a>b){
      printf("a > b\n");
   }else if(a<b){
      printf("a < b\n");
   }else{
      printf("a == b\n");
   }
   return 0;

}

Measured memory_bytes: 580
#include <iostream>
#include <math.h>

using namespace std;

struct Point{
  double x;
  double y;
};

void koch(int n, Point a, Point b){
  if(n == 0) return;
  Point s, t, u;
  double th = M_PI * 60.0 / 180.0;

  s.x = (2.0 * a.x + 1.0 * b.x) / 3;
  s.y = (2.0 * a.y + 1.0 * b.y) / 3;
  t.x = (1.0 * a.x + 2.0 * b.x) / 3;
  t.y = (1.0 * a.y + 2.0 * b.y) / 3;
  u.x = (cos(th) * (t.x - s.x) - sin(th) * (t.y - s.y)) + s.x;
  u.y = (sin(th) * (t.x - s.x) + cos(th) * (t.y - s.y)) + s.y;

  koch(n-1, a, s);
  cout << s.x << " " << s.y << endl;
  koch(n-1, s, u);
  cout << u.x << " " << u.y << endl;
  koch(n-1, u, t);
  cout << t.x << " " << t.y << endl;
  koch(n-1, t, b);
}

int main(){
  Point a, b;
  int n;
  cin >> n;
  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;
  cout << a.x << " " << a.y << endl;
  koch(n, a, b);
  cout << b.x << " " << b.y << endl;
  return 0;
}



Measured memory_bytes: 3232
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int[] array=new int[N];
        for(int i=0;i<N;i++) {
            int x=sc.nextInt();
            array[i]=x;
        }
        for(int i=1;i<array.length;i++) {
            for(int x=0;x<array.length-1;x++) {
                if(array[x]>array[x+1]) {
                    int y=array[x];
                    array[x]=array[x+1];
                    array[x+1]=y;
                }
            }
        }
        
        int sum=0;
        int sum2=0;
        int x=array.length-1;
        int y=array.length-2;
        while(x>=0) {
            sum=sum+array[x];
            x-=2;
        }
        while(y>=0) {
            sum2=sum2+array[y];
            y-=2;
        }
        
       System.out.println(sum-sum2);
       
    }
        

}

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



int main(){
  int n,m;
  cin >>n>>m;
  int a[m];
  rep(i,m)cin >> a[i];
  sort(a,a+m);
  priority_queue<int> p;
  rep(i,m-1){
    p.push(a[i+1]-a[i]);
  }
  int ans=a[m-1]-a[0];
  for(int i=n;i>1;i--){
    if(p.empty()){cout << 0 << endl; return 0;}
    ans-=p.top();
    p.pop();
  }
  cout << ans << endl;
}

Measured memory_bytes: 1276
# -*- coding: utf-8 -*-

n, k = map(int, input().split())
A = list(map(int, input().split()))

B = {}
for a in A:
    if a not in B:
        B[a] = 1
    else:
        B[a] += 1

C = sorted(B.items(), key=lambda x: x[1])
if len(C) <= k:
    print(0)
else:
    ans = 0
    for i in range(len(C)-k):
        ans += C[i][1]
    print(ans)


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

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

    int n, total = 0;
    cin >> n;
    vector<int> A(n);
    REP(i, n){
        cin >> A[i];
        total += A[i];
    }

    int mid, ave1, ave2;
    if(n % 2) mid = A[n / 2];
    else mid = (A[n / 2] + A[n / 2 - 1]) / 2;
    ave1 = total / n;
    ave2 = (total + n - 1) / n;

    int cost1 = 0, cost2 = 0, cost3 = 0;
    REP(i, n){
        cost1 += (A[i] - mid) * (A[i] - mid);
        cost2 += (A[i] - ave1) * (A[i] - ave1);
        cost3 += (A[i] - ave2) * (A[i] - ave2);
    }

    cout << min(min(cost1, cost2), cost3) << endl;

    return 0;
}

Measured memory_bytes: 256
/*author : Yashvardhan
Sunday, May 03, 2020
5:47 PM
*/

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define int ll
#define pb push_back
#define vi vector<int>
#define pi pair<int,int>
#define vpi vector<pi>
#define ff first
#define ss second
#define mp make_pair
#define endl '\n'
#define all(a) a.begin(), a.end()
#define initialise(a, x) memset(a, x, sizeof(a))
#define rev(Y) reverse(all(Y))

#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS

#ifdef __APPLE__
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){cerr << name << " : " << arg1 << endl;}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << "  ";
	__f(comma + 1, args...);}
#else
#define debug(...)
#endif

template <typename T> ostream& operator << (ostream& os,const vector<T>& v){for(int i=0;i<v.size();++i) os<<v[i]<<" ";return os;} 
template <typename T> ostream& operator << (ostream& os,const set<T>& v){for(auto it:v) os<<it<<" ";return os;} 
template <typename T, typename S> ostream& operator << (ostream& os, const pair<T,S>& v) {os<<v.ff<<" "<<v.ss;return os;}

const int mod = 1e9 + 7;
const int inf = 2e18;
const int ninf = -2e18;

int takemod(int a){return ((a%mod)+mod)%mod;}

int pow(int a, int b, int m)
{
	int ans = 1;
	while (b)
	{
		if (b & 1)
			ans = (ans * a);
		b /= 2;
		a = (a * a);
	}
	return ans;
}

int modinv(int a){return takemod( pow( takemod(a), mod-2,mod ) );}


signed main()
{

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

	#ifdef __APPLE__
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
		freopen("error.txt","w",stderr);
	#endif

	time_t t1, t2;
	t1 = clock();

	int x;
	cin >> x;
	
	vpi arr;
	for(int i = 0; i <= 1000; i++){
		int curr = pow(i,5,mod);
		arr.pb({curr,i});
		if(i) arr.pb({-curr,-i});
	}

	sort(all(arr));

	for(int i = 0; i < arr.size(); i++){
		for(int  j = 0; j < arr.size(); j++){
			int val = arr[i].ff - arr[j].ff;
			if(val == x){
				cout << arr[i].ss << " " << arr[j].ss << endl;
				return 0;
			}
		}
	}
	

	t2 = clock();
	cerr << endl << t2-t1 << endl;
	
	return 0;
}



Measured memory_bytes: 3740
#ifndef LOCAL
#pragma GCC optimize ("O3")
#endif
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define mor > muu & operator << (
#define R22(r) sim > typename \
  enable_if<1 r sizeof dud<c>(0), muu&>::type operator<<(c g) {
sim > struct rge { c b, e; };
sim > rge<c> range(c h, c n) { return {h, n}; }
sim > auto dud(c* r) -> decltype(cerr << *r);
sim > char dud(...);
struct muu {
#ifdef LOCAL
stringstream a;
~muu() { cerr << a.str() << endl; }
R22(<) a << boolalpha << g; ris; }
R22(==) ris << range(begin(g), end(g)); }
sim, class b mor pair < b, c > r) { ris << "(" << r.first << ", " << r.second << ")"; }
sim mor rge<c> u) {
  a << "[";
  for (c i = u.b; i != u.e; ++i)
    *this << ", " + 2 * (i == u.b) << *i;
  ris << "]";
}
#else
sim mor const c&) { ris; }
#endif
muu & operator()() { ris; }
};
#define imie(r...) "[" #r ": " << (r) << "] "
#define imask(r...) "[" #r ": " << bitset<8 * sizeof(r)>(r) << "] "
#define arr(a, i) "[" #a imie(i) ": " << a[i] << "] "
#define arr2(a, i, j) "[" #a imie(i) imie(j) ": " << a[i][j] << "] "
#define debug (muu() << __FUNCTION__ << "#" << __LINE__ << ": ")

int n, k;
const int mod = 1e9 + 7;
const int N = 1e5 + 7;
int dp[N];
int ndp[N];

int main() {
    scanf("%d %d", &n, &k);
    dp[0] = 1;
    
    for (int it = 1; it <= n; ++it) {
        int a;
        scanf("%d", &a);
        long long sum = 0;
        for (int i = 0; i <= k; ++i) {
            sum += dp[i];
            ndp[i] = sum % mod;
            if (i - a >= 0) sum -= dp[i - a];
        }
        for (int i = 0; i <= k; ++i) dp[i] = ndp[i];
    }
    
    printf("%d\n", dp[k]);
    return 0;
}


Measured memory_bytes: 1024
//monk
#include<bits/stdc++.h>
using namespace std;
#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
typedef vector<pair<int,pii> >Vlll;
typedef priority_queue<int>PQL;
typedef map<int,int>M;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n
#define pl(n) cout<<n
const int mod=1e9+7;
const int sze=1e5+2;
const int inf= (int)(1e19+10LL);
bool ispalind(string str){
 int j=str.length()-1;
 int i=0;
 while(i<=j){
	 if(str[i]==str[j]){
		 i++;
		 j--;
	 }
	 else return false;
 }
 return true;
	
}

void solve()
{
  string str;
  sl(str);
  bool ulti=ispalind(str);
  int len=str.length();
  int lmt1=(len-1)/2;
  string temp="";
  for(int i=0;i<lmt1;i++)temp+=str[i];
  bool frst=ispalind(temp);
  temp="";
  int lmt2=(len+3)/2;
  lmt2--;
  for(int i=lmt2;i<len;i++)temp+=str[i];
  bool scnd=ispalind(temp);
 if(frst && scnd && ulti){
	 cout<<"Yes"<<endl;
	 return;
 }
 cout<<"No"<<endl;
 return;
}
 
signed main(){
	int test=1;
   //sl(test);
   while(test--){
	 solve();
   }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template

vector<vector<int>> G;
vector<int> vis, ret1, ret2;
void dfs(int cur = 0){
    for(int v: G[cur]){
        if(vis[v] == 0){
//            cout << v + 1 << "," << cur + 1 << endl;
            vis[v] = 1;
            ret1.pb(v + 1);
            dfs(v);
            break;
        }
    }
}

void dfs2(int cur = 0){
    for(int v: G[cur]){
        if(vis[v] == 0){
            vis[v] = 1;
            ret2.pb(v + 1);
            dfs2(v);
            break;
        }
    }
}

template <typename T> inline void voutput(T &v){
    rep(i, v.size()){
        if (i) cout << " " << v[i];
        else cout << v[i];
    }
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    
    int N, M;
    cin >> N >> M;
    G.resize(N);
    rep(i, M){
        int f, t;
        cin >> f >> t;
        f--, t--;
        G[f].pb(t), G[t].pb(f);
    }
    
    vis.assign(N, 0);
    vis[0] = 1;
    ret1.pb(1);
    dfs();
    dfs2();
    
    reverse(all(ret1));
    
    output(ret1.size() + ret2.size());
    
    voutput(ret1);
    cout << " ";
    voutput(ret2);
    cout << endl;
    
    
    
    return 0;
}

Measured memory_bytes: 10104
from collections import deque
n,q=map(int,input().split())
K=[set()for _ in range(n)]
P=[0]*n
V=[False]*n
for i in range(n-1):
      a,b=map(int,input().split())
      K[a-1].add(b-1)
      K[b-1].add(a-1)
for i in range(q):
      p,x=map(int,input().split())
      P[p-1]+=x
que=deque([0])
while que:
      s=que.popleft()
      V[s]=True
      for ni in K[s]:
            if V[ni]==False:
                  P[ni]+=P[s]
                  que.append(ni)
print(*P)

Measured memory_bytes: 123084
#include <iostream>
#include <algorithm>
int main()
{
  int n;
  std::cin >> n;
  int best = 0;
  int curr = 0;
  int a;
  std::cin >> a;
  for (int i=1;i<n;++i)
  {
    int b;
    std::cin >> b;
    if (a >= b) ++curr;
    else curr = 0;
    best = std::max(best, curr);
    a = b;
  }
  std::cout << best;
  return 0;
}

Measured memory_bytes: 256
/*
 ▓█████▄  ▄████▄  ▓██   ██▓ ██▓███   ██░ ██ ▓█████  ██▀███
▒██▀ ██▌▒██▀ ▀█   ▒██  ██▒▓██░  ██▒▓██░ ██▒▓█   ▀ ▓██ ▒ ██▒
 ░██   █▌▒▓█    ▄   ▒██ ██░▓██░ ██▓▒▒██▀▀██░▒███   ▓██ ░▄█ ▒
 ░▓█▄   ▌▒▓▓▄ ▄██▒  ░ ▐██▓░▒██▄█▓▒ ▒░▓█ ░██ ▒▓█  ▄ ▒██▀▀█▄
 ░▒████▓ ▒ ▓███▀ ░  ░ ██▒▓░▒██▒ ░  ░░▓█▒░██▓░▒████▒░██▓ ▒██▒
  ▒▒▓  ▒ ░ ░▒ ▒  ░   ██▒▒▒ ▒▓▒░ ░  ░ ▒ ░░▒░▒░░ ▒░ ░░ ▒▓ ░▒▓░
  ░ ▒  ▒   ░  ▒    ▓██ ░▒░ ░▒ ░      ▒ ░▒░ ░ ░ ░  ░  ░▒ ░ ▒░
  ░ ░  ░ ░         ▒ ▒ ░░  ░░        ░  ░░ ░   ░     ░░   ░
    ░    ░ ░       ░ ░               ░  ░  ░   ░  ░   ░
  ░      ░         ░ ░
*/
//focus less on how much problem you should solve within a fixed time and focus more on getting the problem solved and
//learning something from it
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define per(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define pi pair<ll,ll>
#define vii vector <pair<ll,ll> >
#define sedes set <ll, greater <ll> >
#define seasc set <ll>
#define pb push_back
#define mkp make_pair
#define ff first
#define ss second
#define MOD 1000000007
#define prec(n) fixed<<setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int> >
#define umap unordered_map<ll, ll>
#define map map<ll, ll>
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define mems(a, i) memset(a, i, sizeof(a))
#define endl '\n'
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define deba(a) cout << #a << " " <<a << endl;
int main()
{
	fast;
#ifndef ONLINE_JUDGE
	freopen("D:\\input.txt", "r", stdin);
	freopen("D:\\output.txt", "w", stdout);
#endif
	int t = 1;
	// cin >> t;
	while (t--)
	{
		ll n, m;
		cin >> n >> m;
		if (n == 1)
			n = 14;
		if (m == 1)
			m = 14;
		if (n == m)
			cout << "Draw";
		else if (n > m)
			cout << "Alice";
		else if (m > n)
			cout << "Bob";
	}
	return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define MAXN 100005
using namespace std;
int n,white,black;
vector<int> g[MAXN];
stack<int> p;
vector<int> path;
bool found,f_first,ans;
bool dfs(int x,int y,int last);
int dfs2(int x,int y,int last);

int main()
{
   /* for(int i=0;i<=MAXN;++i)
            g[i].clear();
        while(!(p.empty()))
            p.pop();
        path.clear();
        found=false;
    */
    scanf("%d",&n);

        for(int i=0;i<n-1;++i)
        {
            int a,b;
            scanf("%d%d",&a,&b);
            g[a].push_back(b);
            g[b].push_back(a);
        }

        dfs(n,1,-1);

        while(!(p.empty()))
        {
            path.push_back(p.top());
            p.pop();
        }
        int s=path.size();
       // f_first=s%2==0? true:false;
        black=path[(s+1)/2-1];
        white=path[(s+1)/2];
        int b=dfs2(1,white,-1);
        int w=dfs2(n,black,-1);
        ans=b>w? true:false;
        printf("%s",ans? "Fennec":"Snuke");


}

bool dfs(int x,int y,int last)
{
    p.push(x);

    if(x==y)
        return true;
    int s=g[x].size();

    for(int i=0;i<s;++i)
    {
        if(g[x][i]==last)
            continue;
        if(dfs(g[x][i],y,x))
            return true;
    }
  //  s.pop();
    p.pop();
    return false;
}

int dfs2(int x,int y,int last)
{
    if(x==y)
        return 0;
    int s=g[x].size();
    int cnt=0;
    for(int i=0;i<s;++i)
    {
        if(g[x][i]==last)
            continue;
        cnt+=dfs2(g[x][i],y,x);
    }
    return cnt+1;
}


Measured memory_bytes: 14384
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
#define int long long
typedef long long ll;
const int INF = 1001001001001001001ll;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

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

struct mint {
  ll x;
  mint(ll x = 0) : x((x % MOD + MOD) % MOD) {
  }
  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 {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }

  /* 変数名.pow(n) */
  mint pow(ll t) const {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // 以降はMODが素数のみ
  mint inv() const {
    return pow(MOD - 2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

ostream& operator<<(ostream& s, const mint a) {
  s << a.x;
  return s;
}

/* a^n (MOD) の計算 O(log n) */
ll modpow(ll a, ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1)
      res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}

// a^{-1} mod を計算する
ll modinv(ll a) {
  return modpow(a, MOD - 2);
}

int com(int n, int a) {
  mint res = 1;
  repp(i, n - a + 1, n) {
    res *= i;
  }
  repp(i, 1, a) {
    res /= i;
  }

  return res.x;
}

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

  mint ans = modpow(2, n) - 1;
  ans -= com(n, a);
  ans -= com(n, b);

  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <list>

using namespace std;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;

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

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

int main() {
    int n;
    int ans = 0;
    int x = 0;
    cin >> n;
    string s;
    cin >> s;
    rep(i, s.size()) {
        if(s[i] == 'I') x += 1;
        else x -= 1;
        ans = max(ans, x);
    }

    cout << max(0, ans) << endl;
}

Measured memory_bytes: 256