akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
int n,m,q;
struct node{
	int a,b;
	int c,d;
}w[55];
bool cmp(node a,node b){
	if(a.a==b.a){
		return a.b<b.b;
	}
	return a.a<b.a;
}
int a[100010];
int vis[11];
int ans;
int cal(){
	int ans=0;
	rep(i,1,q+1){
		if(a[w[i].b]-a[w[i].a]==w[i].c)
		ans+=w[i].d; 
	}
	return ans;
}
void dfs(int pos,int cnt){
	if(pos==n+1){
		ans=max(cal(),ans);
		return ;
	}
	a[pos]=cnt;
	rep(i,0,m-cnt+1){
		dfs(pos+1,cnt+i);
	}
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>n>>m>>q;
    rep(i,1,q+1){
    	cin>>w[i].a>>w[i].b>>w[i].c>>w[i].d;
	}
	sort(w+1,w+1+q,cmp);
	dfs(1,1);
	cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3664
import bisect
import collections
import sys

sys.setrecursionlimit(1000000)
input = sys.stdin.readline
ACMOD = 1000000007
INF = 1 << 62


def lmi():
    return list(map(int, input().split()))


def llmi(n):
    return [lmi() for _ in range(n)]


N = int(input())
c_raw = lmi()
ab = llmi(N - 1)

adj = collections.defaultdict(list)
for a, b in ab:
    adj[a - 1].append(b - 1)
    adj[b - 1].append(a - 1)

total = N * (N + 1) // 2

visited = [False] * N

visited[0] = True
stacks = [[[0, 0]] for i in range(N)]
ans = [0] * N
curr = 1

# dfs = [0]
# while dfs:
#     node = dfs[-1]
#     prev, rem = stacks[c[node]][-1]
#     diff = curr - prev - rem
#     ans[c[node]] += (diff * (diff + 1)) // 2
#     stacks[c[node]][-1][1] += diff
#     if adj[node]:
#         next_node = adj[node].pop()
#         if not visited[next_node]:
#             visited[next_node] = True


color_stack = [[0, N] for _ in range(N)]
color_groups = [[] for _ in range(N)]


class Tree:
    def __init__(self, i, _c):
        self.i = i
        self.color = _c
        self.child_count = 0
        self.children = []

    def set_child_count(self, parent=-1):
        for node_index in adj[self.i]:
            if node_index == parent:
                continue
            self.children.append(node_index)
            trees[node_index].set_child_count(self.i)
            self.child_count += trees[node_index].child_count + 1

    def dfs(self):
        color_stack[self.color][-1] -= self.child_count + 1
        for node_index in self.children:
            color_stack[self.color].append(trees[node_index].child_count + 1)
            trees[node_index].dfs()
            color_groups[self.color].append(color_stack[self.color].pop())


trees = [Tree(i, c - 1) for i, c in enumerate(c_raw)]
trees[0].set_child_count()
trees[0].dfs()

for color in range(N):
    v = color_groups[color] + [color_stack[color][-1]]
    print(N + N * (N - 1) // 2 - sum(map(lambda x: x + x * (x - 1) // 2, v)))


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

int main(){
  long long n;
  cin >> n;
  long long ans = pow(10, 18);
  for(int i = 0; i < 5; ++i){
    long long a;
    cin >> a;
    ans = min(ans, a);
  }
  
  cout << (n + ans - 1) / ans + 4 << endl;  
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define dF(i,a,b) for(int i=a;i>=(b);--i)
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define pb push_back
#define maxnkp make_pair
#define fi first
#define se second
#define eps 1e-10
using namespace std;
typedef long long ll;
const int mods = 1e9+7;
const int maxn = 1e5+10;
const int N = 1e5+10;
const int E = 1e6+10; 
int n;
int a,b,c;
int main(){
	cin>>a>>b>>c;
	bool flg = 0;
	if(a==b&&a!=c){
		flg =1;	
	}	
	if(a==c&&a!=b){
		flg=1;
	}
	if(b==c&&b!=a){
		flg=1;
	}
	if(flg) printf("Yes\n");
	else printf("No\n");
}

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


template<typename T>
vector<T> fast_zeta_transform(const vector<T>& f) {
    int n = f.size();
    vector<T> g = f;
    for (int i = 0; (1 << i) < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (!(j >> i & 1)) {
                g[j] += g[j | (1<<i)];
            }
        }
    }
    return g;
}

struct Pair {
    int a, b;
    Pair& operator+=(const Pair &p) {
        vector<int> v{ a, b, p.a, p.b };
        sort(v.rbegin(), v.rend());
        a = v[0], b = v[1];
        return *this;
    }
};


int main()
{
    int n; cin >> n;
    vector<int> a(1<<n);
    for (int i = 0; i < 1<<n; ++i) {
        cin >> a[i];
    }

    vector<Pair> f(1<<n);
    for (int i = 0; i < 1<<n; ++i) {
        f[(1<<n)-1 ^ i] = { a[i], 0 };
    }

    vector<Pair> g = fast_zeta_transform(f);

    int ans = 0;
    for (int i = 1; i < 1<<n; ++i) {
        ans = max(ans, g[(1<<n)-1 ^ i].a + g[(1<<n)-1 ^ i].b);
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 10240
#include<stdio.h>
#include<string.h>
int b,i,j,r,k,t,q;
int g[6]={2,3,5,10,12,15},p[6]={380,550,850,1520,1870,2244},dp[52];
void f(int n)
{
	int i;
	for(i=g[n],dp[g[n]]=p[n];i<52;i++)
		dp[i]=i-g[n]>=2&&dp[i]>dp[i-g[n]]+p[n]?dp[i-g[n]]+p[n]:dp[i];
}
int main()
{
	memset(dp,0xf,52*4);
	for(i=0;i<6;i++)
		f(i);
	for(;scanf("%d",&b),b;printf("%d\n",dp[b/100]));
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;

int main(){
	int x, cnt = 0;
	while(true){
		cnt++;
		cin >> x;
		if(x == 0) break;
		cout << "Case " << cnt << ": " << x << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        String ans = (a <= c && c <= b)? "Yes" : "No";
        System.out.println(ans);
    }    
}

Measured memory_bytes: 21844
#include<cstdio>
#include<cstdlib>
#include<algorithm>
using namespace std;

int main(){
		int n;
		int x[100],y[100];
		long H;
		long h[100];

		scanf("%d",&n);
		for(int i=0 ; i<n ; ++i){
				scanf("%d %d %ld",&x[i],&y[i],&h[i]);
		}

		for(int i=0 ; i<=100 ; ++i){
				for(int j=0 ; j<=100 ; ++j){
						H = 0;
						for(int k=0 ; k<n ; ++k){
								if(h[k] != 0){
										H = h[k] + abs(x[k] - i) + abs(y[k] - j);
								}
						}
						for(int k=0 ; k<n ; ++k){
								if(h[k] != max(H - abs(x[k] - i) - abs(y[k] - j),0L)) break;
								if(k == n-1){
										printf("%d %d %ld\n",i,j,H);
										return 0;
								}
						}




				}
		}

}

Measured memory_bytes: 128
// Problem : A - Go to School
// Contest : Virtual Judge - woah
// URL : https://vjudge.net/contest/391014#problem/A
// Memory Limit : 1048 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

/*ヽ｀、ヽ｀｀、ヽ｀ヽ｀、、ヽ ｀ヽ 、ヽ｀🌙｀ヽヽ｀ヽ、ヽ｀
ヽ｀、ヽ｀｀、ヽ 、｀｀、 ｀、ヽ｀ 、｀ ヽ｀ヽ、ヽ ｀、ヽ｀｀、
ヽ、｀｀、｀、ヽ｀｀、 、ヽヽ｀、｀、、ヽヽ、｀｀、 、 ヽ｀、
ヽ｀｀、 ヽ｀ヽ｀、、ヽ ｀ヽ 、 🚶ヽ｀｀｀｀ヽヽヽ｀、、ヽ｀、、ヽ*/
#include <bits/stdc++.h> 
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
 
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
 
 
using namespace std;
using namespace __gnu_pbds;
 
typedef long long   ll;
typedef long double ld;
typedef complex< ld > cd;
 
typedef pair<int, int> pi;
typedef pair<ll, ll>   pl;
typedef pair<ld, ld>   pd;
 
typedef vector< int > vi;
typedef vector< ld >  vd;
typedef vector< ll >  vl;
typedef vector< pi >  vpi;
typedef vector< pl >  vpl;
typedef vector< cd >  vcd;
 
#define l00p(i, a, b) for (int i=a; i<(b); i++)
#define loop(i, a)    for (int i=0; i<(a); i++)
#define rep1(i, a, b) for (int i = (b)-1; i >= a; i--)
#define rep(i, a)     for (int i = (a)-1; i >= 0; i--)
#define trav(a, x)    for (auto& a : x)
#define uid(a, b)     uniform_int_distribution<int>(a, b)(rng)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f  first
#define s  second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
//#define MOD 998244353
 
template<class T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ld pii=3.14159265359; 
const int MOD = 1000000007;
const char nl = '\n';
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); 
	int n;
	cin>>n;
	vpi a(n);
	loop(i,n)
	{
		cin>>a[i].f;
		a[i].s=i+1;
	}
	sort(all(a));
	loop(i,n)
	cout<<a[i].s<<" ";
	
	return 0;
}
// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 4004
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())//vectorの降順ソート
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;
typedef tuple<ll, ll, ll> T;

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

vector<vector<int>> c(10,vector<int>(10,0));

int H,W,A,ans;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>H>>W;
    REP(i,10) REP(j,10) cin>>c[i][j];
    REP(k,10) REP(i,10) REP(j,10)
        if(c[i][j]>c[i][k]+c[k][j]) c[i][j]=c[i][k]+c[k][j];
    REP(i,H) REP(j,W){
        cin>>A;
        if(A>=0) ans+=c[A][1];
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int mod = 200003;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ll,int> pli;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define fr(s,n) for (int i=(int)(s);i<(int)(n);i++)
#define lc cout<<"\n"

int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int x,n;
    cin>>x>>n;
    vi p;
    fr(0,n){
        int x;
        cin>>x;
        p.pb(x);
    }
    sort(all(p));
    for(int i=0;;i++){
        int a=x-i,b=x+i;
        if(find(all(p),a)==p.end()){
            cout<<a;
            break;
        }
        else if(find(all(p),b)==p.end()){
            cout<<b;
            break;
        }
    }

}





Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define sz(v) ((int)((v).size()))
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define coord_comp(v) sort(all(v)), v.erase(unique(all(v)), v.end())
#define v_index(v, x) (lower_bound(all(v),x)-(v).begin())
typedef pair<int,int> pp;
typedef long long ll;
void read(int& x){ scanf("%d",&x); }
void read(ll& x){ cin>>x; }
template<typename T1,typename T2>
void read(pair<T1,T2>& p){ read(p.first); read(p.second); }
template<typename T,typename... Args>
void read(T&a,Args&...b){ read(a); read(b...); }

bool chk[100010];

int l[100010];
int r[100010];
int cnt[100010];

int main(){
	int n,m; read(n,m);
	l[1]=r[1]=1;
	for(int i=1; i<=n; ++i) cnt[i]=1;

	for(;m--;){
		int a,b; read(a,b);
		bool canred = r[a];
		bool must = false;
		if(cnt[a] == 1){
			if(l[a]) must=true;
			l[a]=r[a]=0;
		} else {
			if(l[a]) --l[a];
		}
		--cnt[a];
		if(must) ++l[b];
		if(canred) ++r[b];
		++cnt[b];
	}

	int ans=0;
	for(int i=1; i<=n; ++i) if(r[i]) ++ans;
	printf("%d\n", ans);

	return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define MAX(X,Y) (*max_element(X,Y))
#define MIN(X,Y) (*min_element(X,Y))
#define NP(X,Y) next_permutation(X,Y)
#define setp(X,Y) cout<<fixed<<setprecision(Y)<<X;
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int N,K;
int H[102010];
int dp[102000];

signed main(){
	cin>>N>>K;
	REP(i,N){
		cin>>H[i];
		dp[i]=INF;
	}
	dp[0]=0;
	for(int i=0;i<N;i++){
		for(int j=1;j<=K;j++){
			dp[i+j]=min(dp[i+j],dp[i]+abs(H[i]-H[i+j]));
		}
	}
	cout<<dp[N-1]<<endl;
	return 0;
}


Measured memory_bytes: 1920
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    X, Y = LI()

    ans = 'No'
    for i in range(X+1):
        if i*2 + (X-i)*4 == Y:
            ans = 'Yes'
            break

    print(ans)

if __name__ == '__main__':
    resolve()

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

void solve(int TestCase) {
    int n, m;
    cin >> n >> m;
    auto A = vector<int>(n);
    for(auto& x : A)
        cin >> x;
    
    sort(A.begin(), A.end());
    reverse(A.begin(), A.end());

    int s = 0;
    for(auto i = 0; i < n; ++i)
    {
        s += A[i];
    }

    int ret = 0;
    for(auto i = 0; i < n; ++i)
    {
        if(A[i] * 4 * m >= s)
            ret++;
    }

    if(ret >= m) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 
    int t = 1;
    //cin >> t;
    for(auto i = 1; i <= t; ++i) {
    //    cout << "Case #"<< i << ": ";
        solve(i);
    }
}

Measured memory_bytes: 256
N = int(input())
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

ls = factorization(N)

ans = 0
for p,e in ls:
    i = 1
    if p != 1:
        while e-i >= 0:
            e -= i
            i += 1
            ans += 1
print(ans)


Measured memory_bytes: 9480
#include <bits/stdc++.h>
using namespace std;
using P = pair<int, int>;

vector<bool> used;
vector<vector<P>> g;
vector<P> num;

void dfs(int s, int dep) {
    for (auto&& p : g[s]) {
        int v, c; tie(v, c) = p;
        if (used[v]) continue;
        used[v] = true;
        num[v] = {dep + 1, c};
        dfs(v, dep + 1);
    }
}

int main() {
    double p; cin >> p;
    int N; cin >> N;
    g = vector<vector<P>>(N);
    for (int i = 0; i < N-1; ++i) {
        int x, y, c; cin >> x >> y >> c; --x; --y;
        g[x].push_back({y, c});
        g[y].push_back({x, c});
    }
    used = vector<bool>(N, false);
    num = vector<P>(N, {0, 0});
    used[0] = true;
    dfs(0, 0);

    double t = 0;
    for (int i = 1; i < N; ++i) t += pow(p, num[i].first) * num[i].second;
    double d = 0;
    for (int i = 0; i < N; ++i) d += pow(p, num[i].first);

    cout << fixed << setprecision(7) << t + t * d << endl; 
}


Measured memory_bytes: 12364
#include<iostream>
using namespace std;
int main(){
  int n,k;
  cin>>n>>k;
  long a=n/k,b=n/(k/2)-a;
  long ans=a*a*a;
  if(k%2==0)ans+=b*b*b;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	long double a[n],v[n+1],prod=1,ans=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		prod=prod*a[i];
	}
	for(int i=0;i<n+1;i++)
		v[i]=0;
	v[0]=1;
	for(int i=0;i<n;i++)
	{
		for(int j=i;j>=0;j--)
		{
			v[j+1]+=v[j]*(1-a[i])/a[i];
		}
	}
	for(int i=0;i<=n/2;i++)
	{
		ans=ans+prod*v[i];
	}
	cout.precision(18);
	cout<<fixed<<ans<<endl;
	return 0;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li a[2001000];

inline li calc(li x, li y) {
    if (x == y)return x;
    return abs(x - y);
}

int main() {
    li n;
    cin >> n;
    rep(i, bit(n)) {
        cin >> a[i];
    }
    while (n-- > 0) {
        rep(i, bit(n)) {
            a[i] = calc(a[i * 2], a[i * 2 + 1]);
        }
    }
    cout << a[0] << endl;

    return 0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <utility>
using namespace std;
using ll = long long;
 
int main() {
	int n,x;
	cin >> n >> x;
	vector <int> l(n);
	vector <int> d(n);
	for (int i =0;i<n;i++) cin >> l[i];
	d[0] =0;
	for (int i =1; i< n+1;i++) {
		d[i] = d[i-1] + l[i-1];
	}
	int ans =0;
	for (int i =0; i< n+1;i++) {
		if (d[i] <= x) ans++;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var N = Sarray()[0];
            // k
            var div = divisors(N);
            var ans = 0L;
            // m=N/k-1
            foreach (var d in div)
            {
                var m = N / d - 1;
                if (m != 0 && N / m == N % m)
                    ans += m;
            }
            WriteLine(ans);
            //Out.Flush();
        }
        static HashSet<long> divisors(long n)
        {
            var div = new HashSet<long>();
            for (long i = 1; i * i <= n; ++i)
            {
                if (n % i == 0)
                {
                    div.Add(i);
                    if (i != n / i)
                        div.Add(n / i);
                }
            }
            return div;
        }
    }
}

Measured memory_bytes: 13792
import math
import queue
import bisect
import heapq
import time
import itertools

mod = int(1e9+7)

def swap(a,b):
    return (b,a)

def gcd(a,b): #最大公約数
    if (a<b):
        a,b = swap(a,b)
    if (b==0):
        return a
    else:
        return gcd(b,a%b)

def lcm(a,b): #最小公倍数
    return a/gcd(a,b)*b

def divisors(a): # 約数列挙
    divisors = []
    for i in range(1,int(a**0.5)+1):
        if a%i==0:
            divisors.append(i)
            if i!=a//i:
                divisors.append(a//i)
    return divisors

def is_prime(a): #素数判定
    if a<2:
        return False
    elif a==2:
        return True
    elif a%2==0:
        return False
    sqrt_num = int(a**0.5)
    for i in range(3,sqrt_num+1,2):
        if a%i==0:
            return False
    return True

def prime_num(a): #素数列挙
    pn = [2]
    for i in range(3,int(a**0.5),2):
        prime = True
        for j in pn:
            if i%j==0:
                prime = False
                break
        if prime:
            pn.append(i)
    return pn

def prime_fact(a): #素因数分解
    sqrt = math.sqrt(a)
    res = []
    i = 2
    if is_prime(a):
        res.append(a)
    else:
        while a!=1:
            while a%i==0:
                res.append(i)
                a //= i
            i += 1
    return res

def main():
    x,t = map(int,input().split())
    if x-t<=0:
        print(0)
    else:
        print(x-t)
    return

if __name__=='__main__':
    main()


Measured memory_bytes: 38892
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,x;
    int count=0;
    cin>>a>>b>>c>>x;
    for(int i=0;i<=a;i++){
        for(int j=0;j<=b;j++){
            for(int k=0;k<=c;k++){
                if (500*i+100*j+50*k==x) count++;
            }
        }
    }
    cout<<count<<endl;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    int a = s.nextInt();
    int b = s.nextInt();
    int c = s.nextInt();
    
    int sum = a + b + c;
    if(sum>=22)
      System.out.println("bust");
    else
      System.out.println("win");
  }
}

Measured memory_bytes: 25300
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int n;
  cin>>n;
  vi a(n);
  rep(i,n) cin>>a[i];
  sort(all(a));
  int ans=0;
  rep(i,n-1)if(a[i]!=a[i+1])ans++;
  cout<<ans+1<<endl;

}


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

using namespace std;

int main() {
	int n;
	cin >> n;
	double h, m;
	char c;
	double a, b, d;
	for (int i = 0; i < n; i++) {
		cin >> h >> c >> m;
		b = 360.0 * m / 60.0;
		a = (360.0 * h / 12.0) + (30.0 * m / 60.0);
		d = fabs(a-b);
		d = min(d, 360.0-d);
		if (d < 30.0) {
			cout << "alert" << endl;
		} else if (d >= 90.0) {
			cout << "safe" << endl;
		} else {
			cout << "warning" << endl;
		}
	}
	return 0;
}

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

using namespace std;

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

    string o,e;
    int oi=0,ei=0;
    cin>>o>>e;

    for(long int i=0;i<max(o.length(),e.length());i++){
        if(i<o.length())cout<<o[i];

        if(i<e.length())cout<<e[i];
    }


    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <utility>
#include <cmath>
#include <string>
#include <bitset>
#include <queue>
#include <cstdio>
#include <cstring>
#include <deque>
#include <unordered_map>
#include <climits>
#include <map>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <ctime>

#define ci(t) cin>>t
#define co(t) cout<<t
#define LL long long
#define fa(i,a,b) for(int i=a;i<b;++i)
#define fd(i,a,b) for(int i=a;i>b;--i)
#define setp pair<pair<int,int>,int>
#define setl pair<int,int>

using namespace std;

int gcd(int a, int b) { return a % b ? gcd(b, a % b) : b; }
pair <int, int> vu[4] = { {0,1}, {0,-1} , {1,0},{-1,0} }; // EWSN

const int max_v = 1e5 + 7;
const int INF = 1e7 + 7;

int n,l;

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ci(n >> l);
	int sum = ((n * (n - 1)) / 2) + ((l * (l - 1)) / 2);
	co(sum);
	return 0;
}

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

using namespace std;
int dp[1000][1000],h,w;
char arr[1000][1000];
long long m=1000000000+7;
int main()
{
	
ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>h>>w;
	
	for(int i=0;i<h;i++)
	{
		for(int j=0;j<w;j++)
		{
			cin>>arr[i][j];
		}
	}
	dp[0][0]=1;
	for(int i=1;i<h;i++)
	{
		if(arr[i][0]!='#')
		dp[i][0]=dp[i-1][0];
		else
		dp[i][0]=0;
	}
	for(int i=1;i<w;i++)
	{
		if(arr[0][i]!='#')
		dp[0][i]=dp[0][i-1];
		else
		dp[0][i]=0;
	}
	for(int i=1;i<h;i++)
	{
		for(int j=1;j<w;j++)
		{
			if(arr[i][j]=='#')
			{
				dp[i][j]=0;
			}
			else if(arr[i][j-1]!='#' && arr[i-1][j]!='#')
			{
				dp[i][j]=(dp[i-1][j]%m+dp[i][j-1]%m)%m;
			}
			else if(arr[i][j-1]!='#')
			{
				dp[i][j]=dp[i][j-1];
			}
			else if( arr[i-1][j]!='#')
			{
				dp[i][j]=dp[i-1][j];
			}
			else 
			{
				dp[i][j]=0;
			}
		}
	}
	cout<<dp[h-1][w-1];
	

}

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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define per(i,n) for(int i = (n)-1; i >= 0; --i)
#define rng(i,a,b) for(int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

struct segtree {
    ll N;
    vector<ll> dat, sum;
    segtree(ll n) {
        N = 1;
        while(N < n) N <<= 1;
        dat.assign(2*N-1,0);
        sum.assign(2*N-1,0);
    }
    void add(ll a, ll b, ll x) { add(a,b,x,0,0,N); }
    ll add(ll a, ll b, ll x, ll k, ll l, ll r) {
        if(b <= l or r <= a) return dat[k];
        if(a <= l and r <= b) {
            sum[k] += x;
            return dat[k] += x;
        }
        ll m = (l+r)/2;
        return dat[k] = min(add(a,b,x,2*k+1,l,m),add(a,b,x,2*k+2,m,r))+sum[k];
    }
    ll getValue(ll index) { return minimum(index,index+1); }
    ll minimum(ll a, ll b) { return minimum(a,b,0,0,N); }
    ll minimum(ll a, ll b, ll k, ll l, ll r) {
        if(b <= l or r <= a) return 1e18;
        if(a <= l and r <= b) return dat[k];
        ll m = (l+r)/2;
        return min(minimum(a,b,2*k+1,l,m),minimum(a,b,2*k+2,m,r))+sum[k];
    }
};

int main() {
    ll n; cin >> n;
    vl a(n+1);
    rep(i,n+1) cin >> a[i];
    if (n == 0) {
        cout << (a[0] == 1 ? 1 : -1) << endl;
        return 0;
    }

    segtree rest(n+10);
    rest.add(0, 1, a[0] == 0);
    ll top_ind = 0, ans = 0;
    rng(i,1,n+1) {
        rest.add(i, i+1, 2*rest.getValue(i-1));
        if (a[i] > rest.getValue(i)) {
            cout << -1 << endl;
            return 0;
        }
        ll x = a[i];
        while (rest.getValue(top_ind) <= x) {
            ll val = rest.getValue(top_ind);
            ans += val * (i+1 - top_ind);
            rest.add(top_ind, i+1, -val);
            top_ind++;
            x -= val;
        }
        if (x != 0) {
            ll val = x;
            ans += val * (i+1 - top_ind);
            rest.add(top_ind, i+1, -val);
            x = 0;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8244
program main
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int64):: h,w,m,i,ymax,xmax,nmx,nmy,ansptn
    integer(int64), allocatable:: x(:), y(:), ysum(:), xsum(:)
    logical,allocatable:: is_maxy(:), is_maxx(:), kx(:),ky(:)

    read*, h,w,m
    allocate(x(m), y(m))
    allocate(ysum(h), xsum(w), source=0_8)
    allocate(is_maxy(h), is_maxx(w), source=.false.)
    allocate(kx(w), ky(h), source=.false.)

    do i=1,m
        read*, y(i), x(i)
        ysum(y(i))=ysum(y(i))+1
        xsum(x(i))=xsum(x(i))+1
    end do
    xmax = maxval(xsum(:))
    ymax = maxval(ysum(:))

    nmx=0; nmy=0
    do i=1,h
        if (ysum(i) == ymax) nmy=nmy+1
    end do
    do i=1,w
        if (xsum(i) == xmax) nmx=nmx+1
    end do

    ansptn = nmx*nmy
    do i=1,m
        if (xsum(x(i))==xmax .and. ysum(y(i))==ymax) ansptn=ansptn-1
    end do
    if (ansptn <= 0) xmax=xmax-1
    print'(i0)', ymax+xmax
end program main

Measured memory_bytes: 16960
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#define rep(i, n) for (int i = 0; i < n; i++)

using namespace std;

int main() {
	int N; cin >> N;
	vector<int> H(N);
	rep(i, N) cin >> H[i];

	int ans = 0;
	int tmp = 0;
	int before = 0;
	rep(i, N) {
		if (H[i] > before) {
			if (tmp > ans) ans = tmp;
			before = H[i];
			tmp = 0;
		}
		else {
			before = H[i];
			tmp++;
		}
	}
	if (tmp > ans) ans = tmp;
	cout << ans << endl;

}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

int n, x, sum;
string arr[1000005];
vector<pi> v; //num of close, open - close
priority_queue<pi> pq; //num of open, open - close

void fail() {
	cout << "No";
	exit(0);
}

int main() {
	fastio; cin >> n;
	FOR(i, 1, n) {
		cin >> arr[i]; string str = "";
		FOR(j, 0, arr[i].length()-1) {
			if (arr[i][j] == '(' or str.empty() or str.back() == ')') str += arr[i][j];
			else str.pop_back();
		}
		arr[i] = str; if (arr[i] == "") continue;
		
		int a = 0, b = 0;;
		FOR(j, 0, str.length()-1) {
			if (str[j] == '(') a++;
			else b++;
		}
		v.pb(pi(b, a-b));
	}
	sort(all(v), greater<pi>());
	n = v.size();
	FOR(i, 1, n) {
		while (!v.empty() and v.back().f <= sum) {
			pi t = v.back(); v.pop_back();
			pq.push(pi(t.f + t.s, t.s));
		}
		if (pq.empty()) fail();
		pi t = pq.top(); pq.pop();
		if (t.f - t.s > sum) fail();
		sum += t.s;
	}
	if (sum != 0) fail();
	cout << "Yes";
}


Measured memory_bytes: 54620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=5e18;

ll mpow(ll x, ll n) {
  ll ans=1;
  while(n>0) {
    if(n&1) {
      ans=ans*x%mod;
    }
    x=x*x%mod;
    n>>=1;
  }
  return ans;
}

ll pow(ll x, ll n) {
  ll ans=1;
  while(n>0) {
    if(n&1) {
      ans=ans*x;
    }
    x=x*x;
    n>>=1;
  }
  return ans;
}

//階乗,factで初期化
vector<ll> tfact(1e7+1);
void fact(ll n) {
  for(ll i=0;i<=n;i++) {
    if(i==0) {
      tfact[i]=1;
    }
    else {
      tfact[i]=tfact[i-1]*i%mod;
    }
  }
}

//nCk 繰り返し高速
ll comb(ll n, ll k) {
  return tfact.at(n)*mpow(tfact.at(k),mod-2)%mod*mpow(tfact.at(n-k),mod-2)%mod;
}

int main() {
  ll n,p;
  cin >> n >> p;
  vec a(n);
  ll en=0,on=0;
  for(ll i=0;i<n;i++) {
    ll a;
    cin >> a;
    if(a%2) on++;
    else en++;
  }
  fact(1e7);
  ll eans=pow(2,en);
  ll oans=0;
  for(ll i=p;i<=on;i+=2) {
    oans+=comb(on,i);
  }
  ll ans=eans*oans;
  cout << ans << endl;
}

Measured memory_bytes: 78592
#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;

typedef long long ll;

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

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

int main(void) {
    double L;
    cin >> L;

    double a = (L / 3.0);
    double ans = a * a * a;
    printf("%.7f\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(a,n) for (ll a = 0; a < (n); ++a)
using namespace std;
//using namespace atcoder;
using ll = long long;
typedef pair<ll,ll> P;
typedef pair<ll,P> PP;
typedef vector<vector<int> > Graph;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1e18;


#define debug(v) cout<<#v<<": ",prt(v);
template <typename A,typename B>
inline void prt(pair<A,B> p){cout<<"("<<p.first<<", "<<p.second<<")\n";}
template <typename A,typename B,typename C>
inline void prt(tuple<A,B,C> p){cout<<"("<<get<0>(p)<<", "<<get<1>(p)<<", "<<get<2>(p)<<")\n";}
inline void prt(bool p){if(p)cout<<"True"<<'\n';else cout<<"False"<<'\n';}
template <typename T> 
inline void prt(vector<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(deque<T> v){cout<<'{';for(ll i=0;i<v.size();i++){cout<<v[i];if(i<v.size()-1)cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename A,typename B>
inline void prt(unordered_map<A,B> v){cout<<'{';ll c=0;for(auto &p: v){cout<<p.first<<":"<<p.second;c++;if(c!=v.size())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(set<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}
template <typename T> 
inline void prt(multiset<T> v){cout<<'{';for(auto i=v.begin();i!=v.end();i++){cout<<*i;if(i!=--v.end())cout<<", ";}cout<<'}'<<'\n';}

string s;

ll dp[200020][2];

int main(){
    cin >> s;
    dp[0][0]=1;
    dp[1][1]=1;
    dp[0][1]=-INF;
    ll n = s.size();
    for(int i=1;i<n;i++){
        chmax(dp[i][0],dp[i-1][1]+1);
        if(s[i]!=s[i-1]){
            chmax(dp[i][0],dp[i-1][0]+1);
            chmax(dp[i][0],dp[i-1][1]+1);
        }
        if(i==1)continue;
        chmax(dp[i][1],dp[i-2][0]+1);
        if(i-3<0)continue;
        if(s.substr(i-3,2)!=s.substr(i-1,2)){
            chmax(dp[i][1],dp[i-2][0]+1);
            chmax(dp[i][1],dp[i-2][1]+1);
        }
    }
    cout << max(dp[n-1][1],dp[n-1][0]) << endl;
    return 0;
}



Measured memory_bytes: 6848
/*#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;*/
#include<algorithm>
#include <bits/stdc++.h>
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define S second
#define F first
#define f(i,n) for(ll i=0;i<n;i++)
#define f1(i,n) for(ll i=1;i<=n;i++)
#define fb(i,n) for(ll i=n-1;i>=0;i--)
#define fb1(i,n) for(ll i=n;i>0;i--)
#define endd cout<<'\n';
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define fr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define all(x) x.begin(), x.end()
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<ll>
#define pii pair<ll,ll>
#define CASES  ll t;cin>>t;while(t--)
typedef long long ll;
typedef unsigned long long ull;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
//*X.find_by_order()
//X.order_of_key()
int main()
{
fast;
    ll n;
    cin>>n;
    map<string,ll>m;
    f(i,n)
    {
        string s;
        cin>>s;
        m[s]++;
    }
    cout<<"AC x "<<m["AC"]<<endl;
    cout<<"WA x "<<m["WA"]<<endl;
    cout<<"TLE x "<<m["TLE"]<<endl;
    cout<<"RE x "<<m["RE"]<<endl;
}


Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll a,b;
    cin>>a>>b;
    if(a==1)
    {
        a+=13;
    }
    if(b==1)
    {
        b+=13;
    }
    if(a>b)
    {
        cout<<"Alice"<<endl;
    }
    else if(a<b)
    {
        cout<<"Bob"<<endl;
    }
    else
    {
        cout<<"Draw"<<endl;
    }
}


Measured memory_bytes: 3640
import re

s=input()
t=input()

count=0
ans=100000
for i in range(len(s)-len(t)+1):
    count=0
    for j in range(len(t)):
        if t[j]==s[j+i]:
            count+=1
    if (len(t)-count) < ans:
        ans=(len(t)-count)

print(ans)

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

int N;
vector<int> A;
bool approve = true;

int main(){
  cin >> N;

  int a;
  for(int i = 0; i < N; i++){
    cin >> a; A.push_back(a);
  }

  for(int i = 0; i < N; i++){
    if(A[i] & 1) continue;
    if(A[i] % 6 != 0 && A[i] % 10 != 0){ 
      approve = false; break;
    }
  }

  if(approve) cout << "APPROVED" << endl;
  else cout << "DENIED" << endl;
  return 0;
}

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

int main() {
	int n;
	while(scanf("%d",&n)!=EOF){
		int ans=0;
		for(int i=0;i<10;i++){
			for(int j=0;j<10;j++){
				for(int k=0;k<10;k++){
					int l=n-i-j-k;
					if(0<=l&&l<=9)ans++;
				}
				
			}
		}
	cout << ans << endl;
	}

	
	
    	// your code goes here
	return 0;
}

Measured memory_bytes: 3144
#include <iostream>

#define N 22

using namespace std;


int dx[4] = {0,1,0,-1};
int dy[4] = {-1,0,1,0};
/* ue migi shita hidari */

void dfs(int f[N][N], int x, int y, int *count);

int main(void)
{

	int w,h;

	int f[N][N];

	char c;
	int x,y;


	int count;

	int i1,i2;

	while(1) {

		/* syoki */
		for (i1=0;i1<N;i1++) {
			for (i2=0;i2<N;i2++) {
				f[i1][i2] = 0;
			}
		}

		/* nyuryoku */
		cin >> w;
		cin >> h;
		if (w == 0 && h == 0) break;

		for (i1=1;i1<=h;i1++) {
			for (i2=1;i2<=w;i2++) {

				cin >> c;

				if (c == '.') {
					f[i1][i2] = 1;
				}
				if ( c == '@') {
					f[i1][i2] = 1;
					x = i2;
					y = i1;
				}
			}

		}

		/* print */
		/*
		for (i1=0;i1<N;i1++) {
			for (i2=0;i2<N;i2++) {
				cout << f[i1][i2] << " ";
			}
			cout << endl;
		}

		cout << x << " " << y << endl;
		*/

		count = 1;
		dfs(f,x,y,&count);

		cout << count << endl;
	}

	return 0;
}


void dfs(int f[N][N], int x, int y, int *count)
{
	int i1;

	int xx,yy;

	f[y][x] = 0;

	for (i1=0;i1<4;i1++) {
		xx = x + dx[i1];
		yy = y + dy[i1];

		if ( f[yy][xx] == 1) {

			(*count)++;
			dfs(f,xx,yy,count);

		}
	}


}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
using ll = long long;
// using Graph = vector<vector<int>>;
const ll MOD = 1e9 + 7;
const ll INF = 1e9;
const ll LINF = 1LL << 60;

int main() {
  int n;
  cin >> n;
  vector<tuple<int, int, int>> p(n);
  rep(i, n) {
    int x, y, h;
    cin >> x >> y >> h;
    p[i] = make_tuple(x, y, h);
  }
  if (n == 1) {
    cout << get<0>(p[0]) << " " << get<1>(p[0]) << " " << get<2>(p[0]) << endl;
    return 0;
  }
  int f;
  rep(i, 101) rep(j, 101) {
    map<int, int> mp;
    int tmp, cnt = 0;
    rep(k, n) {
      if (get<2>(p[k]) == 0) {
        cnt++;
        continue;
      }
      tmp = abs(i - get<0>(p[k])) + abs(j - get<1>(p[k])) + get<2>(p[k]);
      f = k;
      mp[tmp]++;
    }
    if (mp[tmp] + cnt == n) {
      /* if (mp[tmp] == 1) {
        cout << get<2>(p[f]) << endl;
        return 0;
      } */
      rep(k, n) {
        if (get<2>(p[k]) == 0) {
          if (tmp - abs(i - get<0>(p[k])) - abs(j - get<1>(p[k])) >
              0)
            goto L;
        }
      }
      cout << i << " " << j << " " << tmp << endl;
      return 0;
    }
  L:;
  }
  return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

//const ll mod = 1e10;
typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

char max_char(string &s) {
    char c = *max_element(s.begin(), s.end());
    c++;
    return c;
}

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

    queue<string> q;
    q.push("a");
    while (!q.empty()) {
        string t = q.front();
        q.pop();
        if (t.size() == n) {
            cout << t << endl;
        } else {
            char c = max_char(t);
            for (char i = 'a'; i <= c; i++) {
                q.push(t + i);
            }
        }
    }
}


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

#define FOR(i, a, b) for(int i = a; i < b; ++i)
#define REP(i, n) FOR(i, 0, n)
#define _ << " " <<
#define sz(x) ((int) x.size())
#define pb(x) push_back(x)
#define TRACE(x) cerr << #x << " = " << x << endl

typedef long long ll;
typedef pair<int, int> point;

const int mod = 1e9 + 7;

int add(int x, int y) {x += y; if(x >= mod) return x - mod; return x;}
int sub(int x, int y) {x -= y; if(x < 0) return x + mod; return x;}
int mul(int x, int y) {return (ll) x * y % mod;}

const int MAXN = 5e5 + 5, ABC = 27, LOG = 19;

int q, nxt[MAXN][ABC], after[MAXN][LOG];
string s;

int main(){
  ios_base::sync_with_stdio(false); cin.tie(0);
  REP(i, MAXN) REP(j, ABC) nxt[i][j] = MAXN;

  cin >> s;
  REP(i, sz(s))
    nxt[i][ s[i] - 'a' ] = i;

  for(int i = sz(s) - 1; i >= 0; --i){
    FOR(j, s[i] - 'a' + 1, 27)
      if(nxt[i][j - 1] + 1 < MAXN)
        nxt[i][j] = nxt[ nxt[i][j - 1] + 1 ][j - 1];
    REP(j, s[i] - 'a')
      if(nxt[i][26] + 1 < MAXN)
        nxt[i][j] = nxt[ nxt[i][26] + 1 ][j];
  }

  REP(i, sz(s))
    after[i][0] = nxt[i][26] + 1;
  FOR(j, 1, LOG) REP(i, sz(s)){
    int x = after[i][j - 1];
    if(x >= sz(s))
      after[i][j] = MAXN;
    else
      after[i][j] = after[x][j - 1];
  }

  cin >> q;
  REP(z, q){
    int l, r; cin >> l >> r; l --;
    for(int j = LOG - 1; j >= 0; --j){
      if(after[l][j] <= r && l != r)
        l = after[l][j];
    }

    if(l == r)
      cout << "Yes\n";
    else
      cout << "No\n";
  }
}


Measured memory_bytes: 91164
MOD = 10 ** 9 + 7

S = input()

dp = [[0] * 13 for _ in range(len(S) + 1)]
dp[0][0] = 1

for i, s in enumerate(S):
	pattern = range(10) if s == "?" else [int(s)]
	for p in pattern:
		for j in range(13):
			mod = (j * 10 + p) % 13
			dp[i + 1][mod] += dp[i][j]
			dp[i + 1][mod] %= MOD
print(dp[-1][5])


Measured memory_bytes: 61916
#include <stdio.h>

int A[2000],M[2000];
int solve(int,int);
int n;

main(){
  
  int q;
  int i,ans;
  

  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[i]);

}



  for(i = 0 ; i < q; i++){
    ans = solve(0,M[i]);
    if(ans == 1) printf("yes\n");
    else printf("no\n");
  }

  return 0;

}



int solve(int p,int t){
  int a,b;
  if(t == 0) return 1;
  else if(p == n) return 0;

  a = solve(p + 1,t - A[p]);
  b = solve(p + 1,t);

  if(a !=0 || b != 0) return 1;
  else return 0;
}

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

enum inf3 = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;




void main() {
    int r;
    scan(r);
    auto ans = 3 * r * r;
    writeln(ans);
}




















int[][] readGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new int[][](n, 0);

    foreach (i; 0 .. m) {
        int u, v;
        scan(u, v);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= v;
        if (isUndirected) {
            adj[v] ~= u;
        }
    }

    return adj;
}

alias Edge = Tuple!(int, "to", int, "cost");

Edge[][] readWeightedGraph(int n, int m, bool isUndirected = true, bool is1indexed = true) {
    auto adj = new Edge[][](n, 0);

    foreach (i; 0 .. m) {
        int u, v, c;
        scan(u, v, c);
        if (is1indexed) {
            u--, v--;
        }
        adj[u] ~= Edge(v, c);
        if (isUndirected) {
            adj[v] ~= Edge(u, c);
        }
    }

    return adj;
}

void yes(bool b) {
    writeln(b ? "Yes" : "No");
}

void YES(bool b) {
    writeln(b ? "YES" : "NO");
}

T[] readArr(T)() {
    return readln.split.to!(T[]);
}

T[] readArrByLines(T)(int n) {
    return iota(n).map!(i => readln.chomp.to!T).array;
}

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(){
  int sum,i;
  char x[1000];

  while(1){
    scanf("%s",x);
    if(strlen(x)==1&&x[0]=='0') break;

    sum=0;
    for(i=0;i<strlen(x);i++){
      sum+=x[i]-'0';
    }
  printf("%d\n", sum);
  }

  return 0;
}

Measured memory_bytes: 536