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

#define M 1046527
#define L 14

char H[M][L];

int getChar(char ch)
{
    if( ch == 'A') return 1;
    else if(ch == 'C') return 2;
    else if(ch == 'G') return 3;
    else if(ch == 'T') return 4;
    else return 0;
}

long long getKey(char str[])
{
    long long sum = 0, p = 1;
    for (int i = 0; i < strlen(str); i++)
    {
        sum += p * (getChar(str[i]));
        p *= 5;
    }
    return sum;
}

int h1(int key)
{
    return key % M;
}

int h2(int key)
{
    return 1 + (key % ( M -1));
}

int insert(char str[])
{
    long long key, i, h;
    key = getKey(str);
    for (int i = 0; ; i++)
    {
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h], str) == 0) return 1;
        else if (strlen(H[h]) == 0)
        {
            strcpy(H[h], str);
            return 0;
        }
    }
    
    return 0;
}

int find(char str[])
{
    long long key, i, h;
    key = getKey(str);
    for ( i = 0; ; i++)
    {
        h = (h1(key) + i * h2(key)) % M;
        if (strcmp(H[h], str) == 0) return 1;
        else if (strlen(H[h]) == 0) return 0;
    }
    
    return 0;
}

int main()
{
    int n;
    char str[L], comm[9];

    for (int i = 0; i < M; i++)
    {
        H[i][0] = '\0';
    }

    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%s %s", comm, str);

        if(comm[0] == 'i')
        {
            insert(str);
        } else {
            if (find(str)) {
                printf("yes\n");
            } else {
                printf("no\n");
            }
        }
    }
    
    return 0;
}


Measured memory_bytes: 16024
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const ll LINF = 1LL << 50;
const int MAX = 1e+5;
const int NIL = -1;
/* global variables */
int N, M;
vector<vector<int>> G(MAX, vector<int>());
vector<int> indeg(MAX, 0);
vector<int> dist(MAX, NIL);
/* function */
void input() {
    for (int i = 0; i < M; i++) {
        int s, t;
        cin >> s >> t;
        s--, t--;
        G[s].push_back(t);
        indeg[t]++;
    }
}
void bfs(int st) {
    queue<int> q;
    q.push(st);
    dist[st] = 0;
    while (q.size()) {
        int from = q.front();
        q.pop();
        for (int to : G[from]) {
            indeg[to]--;
            dist[to] = max(dist[to], dist[from] + 1);
            if (indeg[to] == 0) {
                q.push(to);
            }
        }
    }
}
void topologicalSort() {
    for (int i = 0; i < N; i++)
        if (indeg[i] == 0 && dist[i] == NIL) bfs(i);
}
void printAns() {
    cout << *max_element(dist.begin(), dist.end()) << '\n';
}
/* main */
int main(){
    cin >> N >> M;
    input();
    topologicalSort();
    printAns();
}


Measured memory_bytes: 9496
#include<stdio.h>
int main(void)
{
	char s[10];
	int i;
	scanf("%s", s);
	if (s[0] == 'R') {
		if (s[1] == 'R') {
			if (s[2] == 'R') {
				i = 3;
			}
			else {
				i = 2;
			}
		}
		else {
			i = 1;
		}
	}
	else {
		if (s[1] == 'R') {
			if (s[2] == 'R') {
				i = 2;
			}
			else {
				i = 1;
			}
		}
		else {
			if (s[2] == 'R') {
				i = 1;
			}
			else {
				i = 0;
			}
		}
		}
	printf("%d",i);
	return 0;
}

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

signed main(){
    //cout << setprecision(12) ;
    ios::sync_with_stdio(false);
	cin.tie(0);
 
    int a,b;
    cin>>a>>b;
    int ans = a+b;
    ans = max(ans,max(a-b,a*b));
    cout<<ans<<endl;
}

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



const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



int main(){
    string s;
    cin>>s;
    
    int n;
    n=(int)s.size();
    
    ll dp[100010][4]={};
    dp[n][3]=1;
    for(int i=0;i<3;i++) dp[n][i]=0;
    for(int i=n-1;i>=0;i--){
        
        //char c=s[i];
        
        for(int j=3;j>=0;j--){
            /*if(i==n){
                dp[i][j] = (j == 3 ? 1 : 0);
                //if(j==3) dp[i][j]=1;
                //else dp[i][j]=0;
            }else{*/
                
                dp[i][j]=dp[i+1][j]*(s[i] =='?' ? 3 : 1);
                if(j < 3 && (s[i] == '?' || s[i] == "ABC"[j])){
                        dp[i][j] += dp[i+1][j+1];

                }
                dp[i][j]%=inf;
            
            }
        //}
        
        /*if(c=='?'){
            //j=3
            //何を書くかで三通り
            dp[i][3]=3LL*dp[i+1][3];
            
            //j=2
            //?にA,B,Cを入れて丸しない
            dp[i][2]=3LL*dp[i+1][2];
            //cを入れて丸
            dp[i][2]+=dp[i+1][3];
            
            //j=1
            //A,B,Cで丸しない
            dp[i][1]=3LL*dp[i+1][1];
            //Bで丸
            dp[i][1]+=dp[i+1][2];
            
            //j=0
            //丸しない
            dp[i][0]=3LL*dp[i+1][0];
            //Aで丸
            dp[i][0]+=dp[i+1][1];
        }else if(c=='C'){
            //j=3
            dp[i][3]=dp[i+1][3];
            //j=2
            //丸をするかしないか
            dp[i][2]=dp[i+1][2]+dp[i+1][3];
            //j=1
            dp[i][1]=dp[i+1][1];
            //j=0;
            dp[i][0]=dp[i+1][0];
        }else if(c=='B'){
            //j=3
            dp[i][3]=dp[i+1][3];
            //j=2
            dp[i][2]=dp[i+1][2];
            //j=1
            dp[i][1]=dp[i+1][1]+dp[i+1][2];
            
            dp[i][0]=dp[i][0];
            
        }else if(c=='A'){
            //j=3
            dp[i][3]=dp[i+1][3];
            //j=2
            dp[i][2]=dp[i+1][2];
            
            dp[i][1]=dp[i+1][1];
            
            dp[i][0]=dp[i+1][0]+dp[i+1][1];
        }*/
        
        /*for(int j=0;j<4;j++){
            dp[i][j]%=inf;
        }*/
    }
    
    cout<<dp[0][0]<<endl;
    
    
    return 0;
}


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

using namespace std;

int main() {
    int a = 0;
    int b = 0;
    int c = 0;
    int d = 0;
    cin >> a >> b >> c;

    d = a;
    a = c;
    c = b;
    b = d;
    
    cout << a << " " << b << " " << c << endl;
    return 0;
}

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

const ll logx=30;
const ll N=4e5+5;
const ll M=3e5+5;
const ll mod=1e9+7;
const ll INF=1e18+5;
const double PI = 3.14159265358979323846;

#define ints(n) scanf("%d",&n)
#define intp(n) printf("%d\n",n)
#define longs(n) scanf("%intd",&n)
#define longp(n) printf("%intd\n",n)

inline ll mul(ll a, ll b){ return (a * 1ll * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }

#define f first
#define s second
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define mp(x,y) make_pair(x,y)
#define GCD(a,b) __gcd((a),(b))
#define all(v) v.begin(),v.end()
#define bits(x) __builtin_popcount(x)
#define LCM(a,b) ((a)*(b))/GCD((a),(b))
#define ms(dp,val) memset(dp,val,sizeof(dp))
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
template<typename T> T power(T x,T y,ll m){T ans=1;while(y>0){if(y&1LL) ans=(ans*x)%m;y>>=1ll;x=(x*x)%m;}return ans%m;}

#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

ll vis[20],in[20];

int main()
{
  ll n,k;
  cin>>n>>k;
  while(k--)
  {
    ll x;
    cin>>x;
    vis[x]=1;
  }
  for(ll i=n;i<=N;i++)
  {
    ll ff=0;
    ll cur=i;
    while(cur)
    {
      ll las=cur%10;
      if(vis[las]){ff=2;break;}
      cur/=10;
    }
    if(ff){continue;}
    cout<<i<<endl;exit(0);
  }
}


Measured memory_bytes: 256
S = list(map(int, input()))
L = 10 * S[0] + S[1]
R = 10 * S[2] + S[3]
if L == 0 or R == 0:
    if 1 <= L <= 12:
        print('MMYY')
    elif 1 <= R <= 12:
        print('YYMM')
    else:
        print('NA')
elif L <= 12 and R <= 12:
    print('AMBIGUOUS')
elif L > 12 and R > 12:
    print('NA')
else:
    if L <= 12:
        print('MMYY')
    else:
        print('YYMM')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  double ans=0.0,a;
  cin>>n;
  for(int i=1;i<=n;i++){
    cin>>a;
    ans+=1.0/a;
  }
  ans=1.0/ans;
  cout<<setprecision(16)<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#define inf 1000000000
 
using namespace std;
 
struct edge{
    int to, cap, cost, rev;
    edge(int a, int b, int c, int d){
        to = a, cap = b, cost = c, rev = d;
    }
};
 
int V, E, F;
vector<edge> G[1005];
int dist[1005], prev[1005], prev_e[1005];
 
void BellmanFord()
{
    int v;
    bool update = true;
     
    while(update){
        update = false;
        for(int i = 0; i < V; i++){
            for(int j = 0; j < G[i].size(); j++){
                v = G[i][j].to;
                if(G[i][j].cap == 0) continue;
                if(dist[v] > dist[i] + G[i][j].cost){
                    update = true;
                    dist[v] = dist[i] + G[i][j].cost;
                    prev[v] = i;
                    prev_e[v] = j;
                }
            }
        }
         
         
    }
}
 
int main(void)
{
    cin >> V >> E >> F;
     
    int u, v, c, d;
    for(int i = 0; i < E; i++){
        cin >> u >> v >> c >> d;
        G[u].push_back(edge(v, c, d, G[v].size()));
        G[v].push_back(edge(u, 0, -d, G[u].size()-1));
    }
     
    int p;
    int ans = 0;
     
    while(F > 0){
         
        for(int i = 0; i < V; i++) dist[i] = inf;
        prev[0] = -1, dist[0] = 0;
        BellmanFord();
         
        if(dist[V-1] >= inf) break;
         
        p = V-1;
        int minf = F;
        while(prev[p] != -1){
            minf = min(minf, G[prev[p]][prev_e[p]].cap);
            p = prev[p];
        }
         
        p = V-1;
        while(prev[p] != -1){
            G[prev[p]][prev_e[p]].cap -= minf;
            G[p][G[prev[p]][prev_e[p]].rev].cap += minf;
            p = prev[p];
        }
         
        F -= minf;
        ans += dist[V-1] * minf;
    }
     
    if(F > 0) ans = -1;
    cout << ans << endl;
    return 0;
}


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

using namespace std;
typedef long long ll;
int main()
{
   ll n,k;
   cin>>n>>k;
   ll i;ll a[n];
   for(i=0;i<n;i++)
   cin>>a[i];
   
  sort(a,a+n);
  ll s=0;
  for(i=0;i<k;i++)
  s+=a[i];
  cout<<s;
}

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

#define ll long long
#define ii pair<int, int>
#define dd pair<double, double>
#define pb(i) push_back(i)
const double PI = 3.14159265359;
const int inf = 1e9+77;
const ll mod = 1e9+7;
const double eps = 1e-7;
//int dir1[8] = {0, 0, 1, -1, 1, -1, 1, -1};
//int dir2[8] = {1, -1, 0, 0, 1, 1, -1, -1};
int dir1[4] = {0, 0, 1, -1};
int dir2[4] = {1, -1, 0, 0};

const int N = 1e6;

int main()
{
	int i, j, k;

	bool isprime[N];
	memset(isprime, 0, sizeof(isprime));
	isprime[0] = isprime[1] = true;
	for(i = 2; i < N; i++)
		if(!isprime[i])
			for(j = i+i; j < N; j += i)
				isprime[j] = true;
	
	vector<int> prime;
	for(i = 2; i < N; i++)
		if(!isprime[i])
			prime.pb(i);

	int x; cin >> x;
	cout << (*(lower_bound(prime.begin(), prime.end(), x))) << '\n';
}


Measured memory_bytes: 4736
#include <bits/stdc++.h>
#define pb push_back
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
#define x first
#define y second
#define debug(...) cout << "[" << #__VA_ARGS__ << ": " << __VA_ARGS__ << "]\n"
#define rd() abs((int)rng())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const int maxn = 2e3 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int n;
bitset<maxn>dpl[maxn], dpr[maxn], wins[maxn];
int main()
{
	ios_base::sync_with_stdio(false), cin.tie(0);
	cin >> n;
	for(int i = 2; i <= n; i++)
	{
		string s;
		cin >> s;
		for(int j = 1; j <= sz(s); j++)
		{
			if(s[j - 1] == '0')
			{
				wins[i][j] = 0;
				wins[j][i] = 1;
			}
			else
			{
				wins[i][j] = 1;
				wins[j][i] = 0;
			}
		}
	}
	for(int i = 1; i <= n; i++)
		dpl[i][i] = dpr[i][i] = 1;
	for(int len = 2; len <= n; len++)
	{
		for(int i = len; i <= n; i++)
		{
			if((dpr[i - 1] & dpl[i - len + 1] & wins[i]).any())
				dpl[i - len + 1][i] = 1;
		}
		for(int i = n - len + 1; i >= 1; i--)
		{
			if((dpl[i + 1] & dpr[i + len - 1] & wins[i]).any())
				dpr[i + len - 1][i] = 1;
		}
	}
	cout << (dpl[1] & dpr[n]).count() << "\n";
	return 0;
}

Measured memory_bytes: 1792
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input()) # n=1
def inpm(): return map(int,input().split()) # x=1,y=2
def inpl(): return list(map(int, input().split())) # a=[1,2,3,4,5,...,n]
def inpls(): return list(input().split())  # a=['1','2','3',...,'n']
def inplm(n): return list(int(input()) for _ in range(n)) # x=[] 複数行
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)] # [[2,2,2,2],[1,1,1,1],[3,3,3,3]] 
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)]) # [[1,1,1,1],[2,2,2,2],[3,3,3,3]] 
def graph():
    n=inp()
    g=[[] for _ in range(n)]
    for i in range(n):
        a = inp()
        a -= 1
        g[i].append(a)
        g[a].append(i)
    return n,g

def main():
    s = list(input())
    if len(s)==2 and (s[0]==s[1]):
        print(1,2)
        return
    elif len(s)==2:
        print(-1,-1)
        return
    dic = defaultdict(int)
    dic[s[0]] += 1
    dic[s[1]] += 1
    dic[s[2]] += 1
    for e in dic:
        if dic[e] >= 2:
            print(1,3)
            return
    for i in range(len(s)-3):
        dic[s[i]] -= 1
        dic[s[i+3]] += 1
        for e in dic:
            if dic[e] >= 2:
                print(i+2,i+4)
                return
    print(-1,-1)            

if __name__ == "__main__":
    main()

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

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

using ll = long long;
using ld = long double;
ll INF = LLONG_MAX;

using vi = vector<int>;
using vll = vector<ll>;
using pii = pair<int, int>;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }
	
	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);
	
	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) { 
		pr(t); pr(ts...); 
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) { 
		pr("{",x.f,", ",x.s,"}"); 
	}
	template<class T> void pr(const T& x) { 
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0; 
		pr("}");
	}
	
	void print() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void print(const T& t, const Ts&... ts) { 
		pr(t); if (sizeof...(ts)) pr(" "); print(ts...); 
	}
}

using namespace output;

template<class T> struct Seg { 
	const T ID = 0; // comb(ID,b) must equal b
	T combine(T a, T b) { return a+b; } 
	int n; vector<T> seg;
	void init(int _n) { n = _n; seg.assign(2*n,ID);}

	void update(int p, T value) {	// set value at position p
		seg[p += n] = value;
		for (p /= 2; p; p /= 2) seg[p] = combine(seg[2*p], seg[2*p+1]);
	}
    
	T query(int l, int r) {	 // sum on interval [l, r]
		T ra = ID, rb = ID; 
		for (l += n, r += n+1; l < r; l /= 2, r /= 2) {
			if (l&1) ra = combine(ra,seg[l++]);
			if (r&1) rb = combine(seg[--r],rb);
		}
		return combine(ra,rb);
	}
};

int N;
vi arr;
Seg<ll> seg;

bool check(int x) {
	seg.init(2 * N + 10);
	int cumsum = 0;
	ll total = 0;
	seg.update(N, 1);
	F0R(i, N) {
		cumsum += (arr[i] > x) ? -1 : 1;
		total += seg.query(0, cumsum-1+N);
		seg.update(cumsum + N, seg.query(cumsum + N, cumsum + N) + 1);
	}
	return total > (1LL * N * (N-1) / 2 + N - total);
}
int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	cin >> N;
	arr.resize(N);
	F0R(i, N) cin >> arr[i];
	int lo = 1;
	int hi = 1e9+10;
	while (lo < hi) {
		int mid = lo + (hi - lo) / 2;
		if (check(mid)) {
			hi = mid;
		} else {
			lo = mid + 1;
		}
	}
	print(lo);
}

Measured memory_bytes: 3840
package main

import (
	"fmt"
	"sort"
)

func delete(s []int, i int) []int {
	s = append(s[:i],s[i+1:]...)
	t := make([]int,len(s))
	copy(t, s)
	return t
}

func main() {
	var n int
	fmt.Scan(&n)
	A := make([]int, n)
	B := make([]int, n)
	for i:=0;i<n;i++ {
		var m int
		fmt.Scan(&m)
		A[i] = m
	}
	copy(B,A)
	
	sort.Ints(B)
	
	ans := 0
	
	for _,v := range A{
		if v == B[n-1] {
			ans = B[n-2]
		} else {
			ans = B[n-1]
		}
		
		fmt.Println(ans)
		
	}
}


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long i = 0; i < n; i++)
#define erep(i, n) for(long i = 1; i <= n; i++)
const long MOD = 1000000007;

struct edge{long to, cost;};
typedef pair<long, long> P;
const long INF = 1e10;
long V;
vector<vector<edge>> G(100010);
long d[100010];

void dijkstra(long s){
  priority_queue<P, vector<P>, greater<P>> que;
  fill(d, d + V + 1, INF);
  d[s] = 0;
  que.push(P(0, s));

  while(!que.empty()){
      P p = que.top(); que.pop();
      int v = p.second;
      if(d[v] < p.first) continue;
      for(long i = 0; i < G[v].size(); i++){
          edge e = G[v][i];
          if(d[e.to] > d[v] + e.cost){
              d[e.to] = d[v] + e.cost;
              que.push(P(d[e.to], e.to));
          }
      }
  }
}




int main() {long H, W;
cin >> H >> W;
rep(i, 10){
    rep(j, 10){
        long x;
        cin >> x;
        edge tmp = {i, x};
        G[j].push_back(tmp);
    }
}
V = 10; 
dijkstra(1);
long ans = 0;
rep(i, H){
    rep(j, W){
        long x;
        cin >> x;
        if(x != -1){
            ans += d[x];
        }
    }
}




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



Measured memory_bytes: 2560
#include<cstdio>
#include<iostream>
using namespace std;
int main() {
  long n, temp;
  int ans = 0;
  cin >> n;
  for (int i = 1; i <= n; i++){
      cin >> temp;
      while(1){
	if((temp/2)*2==temp){
	  temp /= 2;
	  ans++;
	}
	else break;
      }
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
n=int(input())
s=list(input())
t=list(input())
mod=10**9+7
ans=0
if s[0]==t[0]:
    ans=3
else:
    ans=6
for i in range(1,n):
    if s[i]!=s[i-1]:
        if s[i-1]==t[i-1]:
            ans=ans*2%mod
        else:
            if s[i]!=t[i]:
                ans=ans*3%mod
print(ans)    

Measured memory_bytes: 38256
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
ac=[0]*n
c=0
w=0
ps=[]
for _ in range(m):
    p,s=input().split()
    p=int(p)
    s=s.rstrip()
    ps.append((p,s))
    if s=='AC':
        if ac[p-1]==0:
            c+=1
            ac[p-1]=1
        else:
            pass
nac=[0]*n
for _ in range(m):
    p=ps[_][0]
    s=ps[_][1]
    if s=='AC':
        if nac[p-1]==0:
            nac[p-1]=1
        else:
            pass
    else:
        if nac[p-1]==0 and ac[p-1]==1:
            w+=1
print(c,w)


Measured memory_bytes: 56540
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;
typedef vector<vector<ll> > mat;

const int N=3e5+5;
ll bit[2][N],n,q;

void upd(int id,int i,ll val)
{
	while(i<N)
	{
		bit[id][i]=min(bit[id][i],val);
		i+=i&-i;
	}
}

ll get(int id,int i)
{
	ll r=n;
	while(i)
	{
		r=min(r,bit[id][i]);
		i-=i&-i;
	}
	return r;
}

int main()
{ios_base::sync_with_stdio(false);
cin>>n>>q;
rep(i,0,N-1)bit[0][i]=bit[1][i]=n;

ll ans=(n-2)*(n-2);

while(q--)
{
	int id,x;
	cin>>id>>x;
	id--;
	int y=n-x+1;
	int kk=get(id^1,y);
	ans-=(kk-2);
	kk--;
	upd(id,n-kk+1,x);
}
ol(ans);
return 0;
}



Measured memory_bytes: 8292
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define sz(x) int(x.size())
using ll = long long;
const ll LLINF = numeric_limits<long long>::max();
const int mod = 1000000007;
const int INF = 1001001001;

int main()
{
    int N,M;
    cin >> N >> M;
    int sum=0;
    vector<int> A(M);
    for(int i=0;i<M;i++){
        cin >> A[i];
        sum+=A[i];
    }

    cout << max(-1,N-sum);
    return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i = (a);i <= (b);i++)
#define pii pair<int,int>
#define pll pair<long long, long long>
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 5;
const int maxm = 1e6 + 5;
const double eps = 1e-8;
const double pi = acos(-1.0);
ll gcd(ll a,ll b){return !b?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a * b / gcd(a,b);}
ll poww(ll x,ll y,ll p){ll ans = 1;while(y){if(y & 1) ans = ans * x % p;x = x * x % p;y >>= 1;}return ans % p;}
bool isp(ll x){for(ll i = 2;i * i <= x;i++){if(x % i == 0) return 0;}return 1;}
string s;
bool check(string x){
	for(int i = 0,j = x.size()-1;i <= j;i++,j--){
		if(x[i] != x[j]) return 0;
	}
	return 1;
}
int main(){
 	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> s;
	int n = s.size();
//	cout << s.substr(0,(n-1)/2) << endl;
//	cout << s.substr((n+3)/2-1,n - (n+3)/2 + 1) << endl;
	if(check(s) && check(s.substr(0,(n-1)/2)) && check(s.substr((n+3)/2-1,n - (n+3)/2 + 1))) cout << "Yes" << endl;
	else cout << "No" << endl; 
	return 0;
}

Measured memory_bytes: 256
# include "iostream"
# include "cstdio"
# include "algorithm"

using namespace std;

const int maxm=1e5+10;

long long ans=1e9+10; 
long long N,K;
long long Stack1[maxm],Top1;
long long Stack2[maxm],Top2;
 
int main(){
	register int i;
	long long x; 
	scanf("%lld%lld",&N,&K); 
	for(i=1;i<=N;i++){
		scanf("%lld",&x);
		if(x<0){
			Stack1[++Top1]=-x; 
		}else{
			Stack2[++Top2]=x; 
		} 
	}
	sort(Stack1+1,Stack1+1+Top1);
	sort(Stack2+1,Stack2+1+Top2); 
	/*for(i=1;i<=Top1;i++){
		printf("%d ",Stack1[i]);
	}putchar('\n');
	for(i=1;i<=Top2;i++){
		printf("%d ",Stack2[i]);
	}*/ 
	for(i=0;i<=min(Top1,K);i++){
		if(K-i>Top2 || K-i<0) continue; 
		long long a=Stack1[i]+Stack2[K-i]*2,b=Stack1[i]*2+Stack2[K-i];
		ans=min(ans,min(a,b)); 
	}
	printf("%lld",ans); 
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
	int n, l;
	cin >> n >> l;
	string s[n];
	for (int i = 0; i < n; i++) {
		cin >> s[i];
	}
	sort(s, s + n);
	for (int i = 0; i < n; i++) {
		cout << s[i];
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
def solve():
    graph = [[False] * 4 for i in range(4)]
    for i in range(3):
        a, b = [int(n) for n in input().split()]
        a-=1
        b-=1
        graph[a][b] = graph[b][a] = True

    import itertools
    for a,b,c,d in itertools.permutations([0,1,2,3]):
        if graph[a][b] and graph[b][c] and graph[c][d]:
            return True
    return False


def main():
    ans = solve()
    if ans:
        print("YES")
    else:
        print("NO")


if __name__ == '__main__':
    main()

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


int main() 
{
	int A, B, C, D, X, K,N, M,i,j,k;
	cin >> A >> B >> K;
	if ((A + K - 1) < (B - K + 1)) {
		for (i = A; i <= A + K - 1; i++) {
			cout << i << endl;
		}
		for (i = B - K + 1; i <= B; i++) {
			cout << i << endl;
		}
	}
	else {
		for (i = A; i <= B; i++) {
			cout << i << endl;
		}
	}
    return 0;
}



Measured memory_bytes: 256
n,x=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
b=[0 for _ in range(n)]
t=0
ans=0
for i in range(n):
    if t+a[i]<=x and i<n-1:
        b[i]=a[i]
        t+=a[i]
    elif t+a[i]<=x and i==n-1:
        b[i]=x-t
    else:
        break
for i in range(n):
    if a[i]==b[i]:
        ans+=1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5+2;
int pre1[MAXN],pre2[MAXN];
int finds(int x,int *pre)
{
    return pre[x] == x? pre[x]:pre[x] = finds(pre[x],pre);
}
void join(int x,int y,int *pre)
{
    int px = finds(x,pre);
    int py = finds(y,pre);
    if( px!=py)
    {
        pre[px] = py;
    }
}
int main()
{
    int n,k,l;
    cin>>n>>k>>l;
    for(int i = 1;i<=n;i++)
        pre1[i] = i,pre2[i] = i;
    for(int i = 1;i<=k;i++)
    {
        int x,y;
        cin>>x>>y;
        join(x,y,pre1);
    }
    for(int i = 1;i<=l;i++)
    {
        int x,y;
        cin>>x>>y;
        join(x,y,pre2);
    }
    for(int i = 1;i<=n;i++)
    {
        finds(i,pre1);
        finds(i,pre2);
    }
    map<pair<int,int>,int> mp;
    for(int i = 1;i<=n;i++)
    {
        mp[make_pair(pre1[i],pre2[i])] ++;
    }
    for(int i = 1;i<=n;i++)
    {
        cout<<mp[make_pair(pre1[i],pre2[i])]<<" ";
    }
    cout<<endl;
}

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

int main(){
  int N,K;
  cin>>N>>K;
  int temp=1;
  
  for(int i=0;i<N;i++){
    if((temp+K)>=(temp*2)){
      temp=temp*2;
    }
    else temp=temp+K;
  }
  
  cout<<temp<<endl;
  return 0;
}

    
    

Measured memory_bytes: 256
// 解き直し.
// ei1333氏.
// https://atcoder.jp/contests/abc120/submissions/4446187
// 以下のライブラリを使ってみる.
// 素集合データ構造(Union-Find)
// https://ei1333.github.io/luzhiled/snippets/structure/union-find.html
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
LL ans[123321];
int a[123321];
int b[123321];

struct UnionFind{

    vector<int> data;
    UnionFind(int sz){ data.assign(sz, -1); }
    
    // 頂点 x, y の 結合.
    bool unite(int x, int y){
        x = find(x), y = find(y);
        if(x == y)            return false;
        if(data[x] > data[y]) swap(x, y);
        data[x] += data[y];
        data[y] = x;
        return true;
    }
    
    // 頂点 k を 探索.
    int find(int k){
        if(data[k] < 0) return k;
        return data[k] = find(data[k]);
    }
    
    // 頂点 k を含む集合 の 大きさ.
    int size(int k){ return (-data[find(k)]); }
};

int main(){

    // 1. 入力情報取得.
    int N, M;
    scanf("%d %d", &N, &M);
    for(int i = 0; i < M; i++){
        scanf("%d %d", a + i, b + i);
        a[i]--, b[i]--;
    }
    
    // 2. 解説通り計算.
    UnionFind uf(N);
    LL ret = 0;
    for(int i = M - 1; i >= 0; i--){
        ans[i] = 1LL * N * (N - 1) / 2 - ret;
        if(uf.find(a[i]) != uf.find(b[i])){
            ret += 1LL * uf.size(a[i]) * uf.size(b[i]);
            uf.unite(a[i], b[i]);
        }
    }
    
    // 3. 後処理.
    for(int i = 0; i < M; i++) printf("%lld\n", ans[i]);
    return 0;

}

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

int mod = 1e9+7;

void solve()
{
    int n; cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    ll ans = 0, suffixSum = 0;
    for (int i = n - 1; i >= 0; --i) {
        ans = (ans + (v[i] * suffixSum % mod)) % mod;
        suffixSum = (suffixSum + v[i]) % mod;
    }
    cout << ans << '\n';
}

/*void solve()
{
    int n; cin >> n;
    vector<int> v(n);
    vector<ll> suffix(n + 1);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    for (int i = n - 1; i >= 0; --i) {
        suffix[i] = (v[i] + suffix[i + 1]) % mod;
    }
    ll ans = 0;
    for (int i = 0; i < n; ++i) {
        ans = (ans + (v[i] * suffix[i + 1] % mod)) % mod;
    }
    cout << ans << '\n';
}*/

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}

Measured memory_bytes: 3984
fn main() {
	let mut s = String::new();
	use std::io::Read;
	std::io::stdin().read_to_string(&mut s).unwrap();
	let mut it = s.split_whitespace();
	let n: usize = it.next().unwrap().parse().unwrap();
	let q: usize = it.next().unwrap().parse().unwrap();
	let mut e = Vec::with_capacity(2 * n);
	for _ in 0..n {
		let s: i32 = it.next().unwrap().parse().unwrap();
		let t: i32 = it.next().unwrap().parse().unwrap();
		let x: i32 = it.next().unwrap().parse().unwrap();
		let l = s - x;
		let r = t - x;
		e.push((l, x));
		e.push((r, -x));
	}
	e.sort();

	use std::io::Write;
	let out = std::io::stdout();
	let mut out = out.lock();
	let mut set = std::collections::BTreeSet::new();
	let mut e = e.into_iter().peekable();
	for d in it.take(q).map(|a| a.parse::<i32>().unwrap()) {
		while match e.peek() {
			Some(e) if e.0 <= d => true,
			_ => false,
		} {
			let e = e.next().unwrap();
			if e.1 > 0 {
				set.insert(e.1);
			} else {
				set.remove(&(-e.1));
			}
		}
		writeln!(out, "{}", set.iter().next().unwrap_or(&-1)).unwrap();
	}
}


Measured memory_bytes: 14828
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
    static PrintWriter out;

    public static void main(String[] args) throws IOException {
        out = new PrintWriter(new OutputStreamWriter(System.out));
        CF_Reader in = new CF_Reader();

        int n = in.intNext();
        int r = in.intNext();

        if (n >= 10) out.println(r);
        else out.println(r + 100 * (10 - n));

        out.close();
    }

    static class CF_Reader {
        BufferedReader br;
        StringTokenizer st;

        public CF_Reader() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine().trim());
            return st.nextToken();
        }

        long longNext() throws IOException {
            return Long.parseLong(next());
        }

        int intNext() throws IOException {
            return Integer.parseInt(next());
        }

        double doubleNext() throws IOException {
            return Double.parseDouble(next());
        }

        char charNext() throws IOException {
            return next().charAt(0);
        }

        public int[] nextIntArray(final int n) throws IOException {
            final int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = intNext();
            return a;
        }

        public long[] nextLongArray(final int n) throws IOException {
            final long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = longNext();
            return a;
        }

        String line() throws IOException {
            return br.readLine().trim();
        }
    }
}


Measured memory_bytes: 22996
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <bitset>

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

using namespace std;

int l2(uint64_t bit) {
  int res = 0;
  res += (bit & UINT64_C(0xFFFFFFFF00000000)) ? 32 : 0;
  res += (bit & UINT64_C(0xFFFF0000FFFF0000)) ? 16 : 0;
  res += (bit & UINT64_C(0xFF00FF00FF00FF00)) ? 8 : 0;
  res += (bit & UINT64_C(0xF0F0F0F0F0F0F0F0)) ? 4 : 0;
  res += (bit & UINT64_C(0xCCCCCCCCCCCCCCCC)) ? 2 : 0;
  res += (bit & UINT64_C(0xAAAAAAAAAAAAAAAA)) ? 1 : 0;
  return res;
}

int s(uint64_t rem, int sum, int mx_sum, const vector<uint64_t>& g, const vector<int>& strngth, int n) {
  if (rem == 0) return sum;
  int mx_prob = sum;
  REP(i,n) {
    if (((rem >> i) & 1) == 0) continue;
    mx_prob += strngth[i];
    if ((rem & g[i]) == 0) {
      sum += strngth[i];
      rem ^= UINT64_C(1) << i;
    }
  }
  if (mx_sum >= mx_prob) return sum;
  mx_sum = max(mx_sum, sum);
  if (rem == 0) return sum;
  uint64_t next = rem & (-rem);
  int ni = l2(next);
  uint64_t used = (rem ^ next) & ~g[ni];
  int usum = s(used, sum + strngth[ni], mx_sum, g, strngth, n);
  mx_sum = max(mx_sum, usum);
  uint64_t unused = rem ^ next;
  int uusum = s(unused, sum, mx_sum, g, strngth, n);
  return max(usum, uusum);
}

int main() {
  while(1){
    int n;
    cin>>n;
    if(!n)break;
    vector<string> cntry;
    vector<int> strngth;
    vector<vector<string>> neigh(n);
    REP(i,n){
      string a;
      int b,c;
      cin>>a>>b>>c;
      cntry.push_back(a);
      strngth.push_back(b);
      REP(j,c){
        string ng;
        cin>>ng;
        neigh[i].push_back(ng);
      }
    }
    vector<uint64_t> g(n,0);
    REP(i,n){
      for(string& ng:neigh[i]){
        auto itr = find(begin(cntry),end(cntry),ng);
        uint64_t index = itr - begin(cntry);
        g[i] |= UINT64_C(1) << index;
      }
    }
    uint64_t rem = (UINT64_C(1)<<n)-1;
    rem ^= UINT64_C(1) | g[0];
    int res = s(rem, strngth[0], strngth[0], g, strngth, n);
    cout << res << endl;
  }
  return 0;
}

Measured memory_bytes: 1360
/**********************************************
 * author : deepak nayan
 * file   : e:/Solutions/atcoder/abc128_a.cpp
 * time   : Fri May  1 16:53:00 2020
 * quest  : A - Apple Pie
 *********************************************/
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int a, p;
  cin >> a >> p;
  cout << (a * 3 + p) / 2 << "\n";
  return 0;
}


Measured memory_bytes: 256
N = gets.to_i
graph = Array.new(N) { [] }
(N - 1).times do
  a, b, c = gets.split.map(&:to_i)
  a -= 1
  b -= 1
  graph[a].push([b, c])
  graph[b].push([a, c])
end
Q, K = gets.split.map(&:to_i)
queries = Q.times.map do
  x, y = gets.split.map(&:to_i)
  [x - 1, y - 1]
end

def distance(graph, s)
  d = Array.new(N)
  queue = [[s, nil, 0]]
  while !queue.empty?
    u, parent, distance = queue.shift
    graph[u].each do |v, c|
      next if v == parent
      new_distance = distance + c
      d[v] = new_distance
      queue.push([v, u, new_distance])
    end
  end
  d
end

d = distance(graph, K - 1)
queries.each do |u, v|
  ans = d[u] + d[v]
  puts ans
end

Measured memory_bytes: 42004
#include <iostream>
#include <climits>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

char str[1010];
int cnt[1000];
int main()
{
    scanf("%s", str);
    memset(cnt, 0, sizeof(cnt));
    for(int i = 0;str[i];++i)
        ++cnt[ str[i] ];
    if(cnt['N'] && cnt['S'] && !cnt['W'] && !cnt['E'])
    {
        puts("Yes");
        return 0;
    }
    if(cnt['W'] && cnt['E'] && !cnt['N'] && !cnt['S'])
    {
        puts("Yes");
        return 0;
    }
    if(cnt['N'] && cnt['S'] && cnt['W'] && cnt['E'])
    {
        puts("Yes");
        return 0;
    }
    puts("No");
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel.Design;
using System.Globalization;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using System.Xml.Schema;
using static System.Console;

namespace ConsoleApp2
{
    class Program
    {
        static public int[] Sarray() { return ReadLine().Split().Select(int.Parse).ToArray(); }
        static public List<int> Slist() { return new List<int>(ReadLine().Split().Select(int.Parse)); }
        static void Main(string[] args)
        {
            var xn = Sarray();
            for(var i=0;i<5;i++)
            {
                if (xn[i] == 0) WriteLine(i+1);
            }
        }
    }
}


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

int main(){
    int A, B, Q;
    cin >> A >> B >> Q;
    vector <ll> s;
    vector <ll> t;
    
    ll tmp;
    s.emplace_back((ll)-1e18);
    t.emplace_back((ll)-1e18);

    rep(i, A){
        cin >> tmp;
        s.emplace_back(tmp);
    }
    rep(i, B){
        cin >> tmp;
        t.emplace_back(tmp);
    }
    s.emplace_back((ll)1e18);
    t.emplace_back((ll)1e18);

    rep(i, Q){
        ll x;
        cin >> x;
        auto si = lower_bound(s.begin(), s.end(), x);
        auto ti = lower_bound(t.begin(), t.end(), x);

        auto sid = si - s.begin();
        auto tid = ti - t.begin();
        
        ll MIN = (ll)1e18;

        ll ttt;
        rep(i, 2){
            rep(j, 2){
                ttt = abs(x-s[sid-i]) + abs(s[sid-i] - t[tid-j]);
                MIN = min(MIN, ttt);
                // printf("%lld\n", ttt);
            }
        }

        rep(i, 2){
            rep(j, 2){
                ttt = abs(x-t[tid-i])+ abs(t[tid-i] - s[sid-j]);
                MIN = min(MIN, ttt);
                // printf("%lld\n", ttt);
            }
        }
        printf("%lld\n", MIN);
    }
    return 0;
}

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

#define MP make_pair
#define PB push_back
#define f first
#define s second

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

//int dr1[] = {-1, 0, 1, 0};
//int dc1[] = {0, 1, 0, -1};
//int dr3[] = {0, 1, 2, 3, 2, 1, 0, -1, -2, -3, -2, -1, -1, 1, 0, 0};
//int dc3[] = {3, 2, 1, 0, -1, -2, -3, -2, -1, 0, 1, 2, 0, 0, -1, 1};
const int MOD = 1000000007;
const int INF = 1000000007;
const int MAXN = (int)3e5+1;

ll modx(ll a)
{
    return (a%MOD+MOD)%MOD;
}

ll times(ll a, ll b)
{
    return modx(modx(a)*modx(b));
}

ll add(ll a, ll b)
{
    return modx(modx(a)+modx(b));
}

ll sub(ll a, ll b)
{
    return modx(MOD+modx(a)-modx(b));
}


ll powMod(ll n, ll p, ll mod) {
	ll res = 1;
	while (p) {
		if (p & 1) (res *= n) %= mod;
		(n *= n) %= mod;
		p >>= 1;
	}
	return res;
}
ll invMod(ll n, ll mod) {
	return powMod(n, MOD - 2, MOD);
}

const signed FACT_MAX_N = 2000006;
signed fact[FACT_MAX_N];
signed factInv[FACT_MAX_N];
struct INIT_FACT {
	INIT_FACT() {
		fact[0] = 1;
		for (int i = 1; i < FACT_MAX_N; ++i) fact[i] = (long long)i * fact[i - 1] % MOD;
		factInv[FACT_MAX_N - 1] = powMod(fact[FACT_MAX_N - 1], MOD - 2, MOD);
		for (int i = FACT_MAX_N - 2; i >= 0; --i) factInv[i] = (long long)(i + 1) * factInv[i + 1] % MOD;
	}
} init_fact;

/* n,r<=10^6, query O(1)*/
ll Permutation(int n, int r) {
	if (r == 0) return 1;
	if (n < r) return 0;
	return (long long)fact[n] * factInv[n - r] % MOD;
}
ll choose(int n, int r) {
	if (r == 0) return 1;
	if (n < r) return 0;
	return (long long)fact[n] * factInv[n - r] % MOD * factInv[r] % MOD;
}
ll CombinationWithRepetition(ll n, ll r) {
	return choose(n + r - 1, r);
}


int main()
{
    //freopen("input.in","r",stdin);
    //freopen("output.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll r1, r2, c1, c2;
    cin >> r1 >> c1 >> r2 >> c2;
    cout << sub(add(choose(r2+c2+2, r2+1), choose(r1+c1, r1)), add(choose(r2+c1+1, r2+1), choose(r1+c2+1, r1)));
    /*
    (r1+c1)Cc1 + ... + r2+c1 C c1
    (r2+c1+1) C r2 - (r1+c1) C c1+1
    (r2+c1+2) C r2 - (r1+c1+1) C c1+2
    ...
    (r2+c2+1) C r2 - (r1+c2) C c2+1

    (r2+c2+2) C (r2+1) - (r2+c1+1) C (r2+1)
    - (r1+c2+1) C (c2+2) + (r1+c1) C (c1+2)
    */
    return 0;
}



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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int a, b; cin >> a >> b;
    if(a == 1) a = 14;
    if(b == 1) b = 14;
    if(a > b) cout << "Alice" << endl;
    else if(a == b) cout << "Draw" << endl;
    else cout << "Bob" << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7724
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    
    int w = scanner.nextInt();
    int h = scanner.nextInt();
    int n = scanner.nextInt();
    
    int[] x = new int[n];
    int[] y = new int[n];
    int[] a = new int[n];
    
    for(int i = 0; i < n; i++) {
      x[i] = scanner.nextInt();
      y[i] = scanner.nextInt();
      a[i] = scanner.nextInt();
    }
    
    boolean[][] map = new boolean[w][h];
    for(int i = 0; i < n; i++) {
      if(a[i] == 1) {
        for(int j = 0; j < x[i]; j++) {
          for(int k = 0; k < h; k++) {
          	map[j][k] = true;
          }
        }
      } else if(a[i] == 2) {
        for(int j = w - 1; j >= x[i]; j--) {
          for(int k = 0; k < h; k++) {
          	map[j][k] = true;
          }
        }
      } else if(a[i] == 3) {
        for(int j = 0; j < w; j++) {
          for(int k = 0; k < y[i]; k++) {
          	map[j][k] = true;
          }
        }
      } else {
        for(int j = 0; j < w; j++) {
          for(int k = h - 1; k >= y[i]; k--) {
          	map[j][k] = true;
          }
        }
      }
    }
    
    int count = 0;
    for(int i = 0; i < w; i++) {
      for(int j = 0; j < h; j++) {
        if(!map[i][j]) {
          count++;
        }
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 38368
#include <bits/stdc++.h>
using namespace std;
#define rep(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
using ll = long long;
const ll MOD = 1e9+7; ll LLINF = 1LL << 60; int INF = INT_MAX;

//

int main(){
    int n; cin>>n;
    map<int,int> even;
    map<int,int> odd;
    rep(i,0,n){
        int a;
        cin>>a;
        if(i%2==0){
            even[a]++;
        }
        else odd[a]++;
    }
    vector<pair<int,int>> oddpair;
    vector<pair<int,int>> evenpair;
    for(auto i:even){
        evenpair.push_back({i.second,i.first});
    }
    for(auto i:odd){
        oddpair.push_back({i.second,i.first});
    }
    sort(all(evenpair));
    sort(all(oddpair));
    reverse(all(evenpair));
    reverse(all(oddpair));
    if(evenpair[0].second!=oddpair[0].second){
        cout<<n-evenpair[0].first-oddpair[0].first<<endl;
        return 0;
    }
    else {
        if(evenpair[1].first<=oddpair[1].first){
            cout<<n-oddpair[1].first-evenpair[0].first<<endl;
        }else{
            cout<<n-evenpair[1].first-oddpair[0].first<<endl;
        }

    }

}

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

using namespace std;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
    ~debug() { cerr << endl; }
    eni(!=) cerr << boolalpha << i; ris; }
    eni(==) ris << range(begin(i), end(i)); }
    sim, class b dor(pair < b, c > d) {
    ris << "(" << d.first << ", " << d.second << ")";
    }
    sim dor(rge<c> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
    ris << "]";
    }
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

# define forn(i, n) for (ll i = 0; i < int(n); i++)
# define rfor(n, i) for (ll i = (n - 1); i >= 0; --i)
# define all(V) V.begin(), V.end()
# define rall(V) V.rbegin(), V.rend()
# define len(V) (int)V.size()
# define ll long long
# define ld long double
# define ff first
# define ss second
# define pb push_back
# define mp make_pair
# define endl '\n'
# define M_PI 3.14159265358979323846

void solve()
{
    string s, t; cin >> s >> t;
    cout << t << s; 
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
    solve();
}


Measured memory_bytes: 256