akhauriyash/Code-Regression huggingface dataset:
// G++ MACRO.CPP -STD=C++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) if(1){for(auto tt=x.begin();tt!=x.end();tt++){if(tt!=x.begin())cout<<" ";cout<<(*tt);}cout<<endl;}
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define EN(x) if(1){cout<<#x<<endl;return 0;}
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
template <class T = ll>
T IN(){T x;cin>>x;return (x);}
 
template <class Head>
void VT(Head head){}
template <class Head,class Seco,class... Tail>
void VT(Head&& head,Seco&& seco,Tail&&... tail){
    seco.resize(head);
    VT(head,move(tail)...);
}
void VT2(){}
template <class Head,class... Tail>
void VT2(Head&& head,Tail&&... tail){
  VECCIN(head);
  VT2(move(tail)...);
}
 
template <class Head>
void VT3(Head&& head){}
template <class Head,class Seco,class... Tail>
void VT3(Head&& head,Seco&& seco,Tail&&... tail){
  seco[head]=IN();
  VT3(head,move(tail)...);
}
 
#define VC1(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);VT2(__VA_ARGS__); //aaabbbccc
#define VC2(n,...) V __VA_ARGS__;VT(n,__VA_ARGS__);REP(i,n)VT3(i,__VA_ARGS__); //abcabcabc
 
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision; // cpp_int
 
#define P pair<ll,ll>
#define V vector<ll>
#define M map<ll,ll>
#define S set<ll>
 
#define pb(a) push_back(a)
#define mp make_pair


int main(){
  SCIN(s,t);
  int n = s.size();

  ll base1 = 1007;

  V has(n+1,0);
  V po(n+1,1);
  REP(i,n){
    has[i+1]=(has[i]+s[i])*base1%MOD;
    po[i+1]=po[i]*base1%MOD;
  }
  ll thas = 0;
  ll tpo = 1;
  REP(i,n)
    thas=(thas+t[i])*base1%MOD;

  REP(i,n)
    if( (
    (((has[n] - (has[i] * po[n-i]) % MOD)+ MOD) % MOD) * po[i]
     + has[i]
    ) % MOD == thas)
      EN(Yes);

  Yes(0);
  

  return 0;
}


Measured memory_bytes: 256
x,y = map(int,input().split())
g = [[1,3,5,7,8,10,12],[4,6,9,11],[2]]

flag = True
for i in range(3):
    if x in g[i] and y in g[i]:
        print("Yes")
        flag=False
        break
if flag:
    print("No")

Measured memory_bytes: 3060
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<queue>
#define ll long long
using namespace std;
int pos(int n)
{
    if(n<0)
        return 0;
    else
        return n;
}
bool pali(ll n)
{
    char a[10000]= {0};
    int num=0,tn=n;
    for(int i=0; i<tn; i++)
    {
        a[i]=n%10;
        n/=10;
        num=i;
        if(n<=0)
            break;

    }
    for(int i=0; i<num/2; i++)
    {
        if(a[i]!=a[num-i])
        {
            return false;
        }
    }
    return true;
}
int main()
{
    int n,d,x,a[10002];
    cin>>n>>d>>x;
    int num=0;
    for(int i=0;i<n;i++){
        int tp;
        cin>>tp;
        num+=((d-1)/tp+1);
    }
    cout<<num+x;
}


Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>
#include <queue>
#include <vector>
#include <map>
#include <stack>
using namespace std;
int main(void){
   int X;
   cin>>X;
   if(X==3||X==5||X==7) {cout<<"YES";}
   else {cout<<"NO";}
   return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
H = list(map(int, input().split()))
# AB = [list(map(int, input().split())) for _ in range(m)]

edges = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    edges[a - 1].append(b - 1)
    edges[b - 1].append(a - 1)

ans = 0
for idx, e_list in enumerate(edges):
    bl = True
    if len(e_list) != 0:
        for e in e_list:
            if H[idx] <= H[e]:
                bl = False
    if bl:
        ans += 1

print(ans)


Measured memory_bytes: 92572
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, P = MAP()
A = LIST()

dp = [[0]*2 for _ in range(N+1)]
dp[0][0] = 1

for i, a in enumerate(A):
	if a%2 == 0:
		dp[i+1][0] = dp[i][0]*2
		dp[i+1][1] = dp[i][1]*2
	else:
		dp[i+1][0] = dp[i][1]+dp[i][0]
		dp[i+1][1] = dp[i][0]+dp[i][1]

print(dp[N][P])


Measured memory_bytes: 5400
//JSD
#include<iostream>
#include<vector>
#include<cmath>
#include<set>
#include<algorithm>
#define ll long long 
using namespace std;
int main(){
	ll n;
	string s;
	cin>>s;
	bool res=1;
	for(int i=1;i<s.length();i++){
		if(s[i]==s[i-1]){
			res=0;
		}
	}
	if(res) cout<<"Good\n";
	else cout<<"Bad\n";
	return  0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int n,k,c,m;
   cin>>n>>k;
   c=1;
   for(int i=1;i<=n;i++)
   {
       if(c+k<c*2) c+=k;
       else c=c*2;
   }
   cout<<c<<endl;
   return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
  int k, s;
  int x, y, z;
  int ans = 0;

  scanf("%d %d", &k, &s);

  for (x = 0; x <= k; x++){
    for (y = 0; y <= k; y++){
      if (k >= s - x - y && s - x - y >= 0){
        ans++;
      }
    }
  }

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


Measured memory_bytes: 128
//#include "pch.h"
#include <iostream>
#include <string>

using namespace std;



int main() {

	int n, m;
	int t[100];
	int p[100];
	int x[100];

	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> t[i];
	}
	cin >> m;
	for (int i = 0; i < m; i++) {
		cin >> p[i] >> x[i];
	}
	

	int sum = 0;
	for (int i = 0; i < n; i++) {
		sum += t[i];
	}

	int wsum;
	for (int i = 0; i < m; i++) {
		wsum = sum + x[i] - t[p[i]-1];
		cout << wsum << endl;
	}





	//system("pause");
	return 0;
}

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

using namespace std;

void debug_out() { cerr << '\n'; }
template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}
#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(_VA_ARGS_)
#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int =0;_<n;++)cerr<<x[_]<<" ";cerr<<'\n';}while(0)
#define dbg_ok cerr<<"OK!\n"

typedef pair<int,int> pii;
typedef long long int ll;
typedef long double ld;

const int DMAX = 1e5+10;

inline int two(int n) { return 1 << n; }
inline int test(int n, int pos) { return (bool) (n & two(pos)); }
inline void set_bit(int &n, int b) { n |= two(b); }
inline void unset_bit(int &n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }

vector <int> V[DMAX];

bool uz[10];

char s[DMAX];
char t[DMAX];

int n;

inline int cmmdc(int x,int y){
    int r=0;
    while(y){
        r=x%y;
        x=y;
        y=r;
    }
    return x;
}

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

    int x,y;

    cin>>x>>y;
    cout<<1LL*x*y/cmmdc(x,y)<<'\n';

    return 0;
}

Measured memory_bytes: 2560
<?php
  $dice_1 = explode(" ", trim(fgets(STDIN)));
  $dice_2 = explode(" ", trim(fgets(STDIN)));
  $upper_1 = $dice_1[0];
  $upper_2 = $dice_2[0];
  $side_1 = array($dice_1[2], $dice_1[1], $dice_1[3], $dice_1[4]);
  $side_2 = array($dice_2[2], $dice_2[1], $dice_2[3], $dice_2[4]);
  $bottom = $dice_1[5];
  $n = 0;
  while (true) {
    for($i=0;$i<4;$i++) {
      if (($upper_1 == $upper_2) && ($side_1[1] == $side_2[1]) && ($side_1[2] == $side_2[2]) && ($side_1[3] == $side_2[3]) && ($side_1[0] == $side_2[0])) {
        print "Yes\n";
        return;
      } else {
        $z = array_shift($side_1);
        array_push($side_1, $z);
      }
    }
    if ($n < 3) {
      $b = $bottom;
      $u = $upper_1;
      $upper_1 = $side_1[2];
      $bottom = $side_1[0];
      $side_1[2] = $b;
      $side_1[0] = $u;
    } else if ($n < 10 && $n > 2) {
      $b = $bottom;
      $u = $upper_1;
      $upper_1 = $side_1[1];
      $bottom = $side_1[3];
      $side_1[1] = $b;
      $side_1[3] = $u;
    } else if ($n > 10) {
      break;
    }
    $n++;
  }
  print "No";
?>

Measured memory_bytes: 6608
//#define ONLINE_JUDGE
#define rush()        \
    int MYTESTNUM;    \
    cin >> MYTESTNUM; \
    while (MYTESTNUM--)
#define FOR(i, s, t) for (int i = (s); i <= (t); ++i)
#define mem(a, b) memset(a, b, sizeof(a))
#define pi acos(-1)
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1 << 30;
const double eps = 1e-8;
const int maxn = 1e5 + 10;
struct node {
    int x, y, id;
    node() {}
    node(int X, int Y, int ID)
    {
        x = X, y = Y, id = ID;
    }
};
int n;
int fa[maxn];
int height[maxn]; //树高
vector<node> v, v2;
//初始化
void init(int n)
{
    for (int i = 0; i <= n; i++) {
        fa[i] = i;
        height[i] = 0;
    }
}
//查询根节点
int find_set(int x)
{
    if (x != fa[x]) {
        fa[x] = find_set(fa[x]); //路径压缩
    }
    return fa[x];
}
//合并
void union_set(int x, int y)
{
    x = find_set(x);
    y = find_set(y);
    if (height[x] == height[y]) {
        height[x] += 1;
        fa[y] = x;
    } else {
        if (height[x] < height[y]) {
            fa[x] = y;
        } else {
            fa[y] = x;
        }
    }
}
inline bool cmpx(node a, node b)
{
    return a.x < b.x;
}
inline bool cmpy(node a, node b)
{
    return a.y < b.y;
}
inline bool cmpd(node a, node b)
{
    return a.id < b.id;
}
int kruskal(int tot)
{
    int sum = 0;
    init(n);
    for (int i = 0; i < tot; i++) {
        node temp = v2[i];
        if (temp.id == 0) {
            union_set(temp.x, temp.y);
        }
        if (find_set(temp.x) != find_set(temp.y)) {
            union_set(temp.x, temp.y);
            sum += temp.id;
        }
    }
    return sum;
}
int main()
{
#ifndef ONLINE_JUDGE
//freopen("input.in", "r", stdin);
//freopen("output.out", "w", stdout);
#endif
    ios::sync_with_stdio(0), cin.tie(0);
    cin >> n;
    v.resize(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> v[i].x >> v[i].y;
        v[i].id = i;
    }
    int tot = 0;
    sort(v.begin() + 1, v.end(), cmpx);
    for (int i = 2; i <= n; i++) {
        v2.push_back(node(v[i].id, v[i - 1].id, v[i].x - v[i - 1].x));
        tot++;
    }
    sort(v.begin() + 1, v.end(), cmpy);
    for (int i = 2; i <= n; i++) {
        v2.push_back(node(v[i].id, v[i - 1].id, v[i].y - v[i - 1].y));
        tot++;
    }
    sort(v2.begin(), v2.end(), cmpd);
    cout << kruskal(tot) << endl;
    return 0;
}

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

//#define int long long

typedef pair<int,int>pint;
typedef vector<int>vint;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);i++)
template<class T,class U>void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>void chmax(T &t,U f){if(t<f)t=f;}

enum FACE { TOP, BOTTOM, FRONT, BACK, LEFT, RIGHT };
template <class T>
class dice {
public:
  dice() {
    id[TOP] = 0; id[FRONT] = 1; id[LEFT] = 2;
    id[RIGHT] = 3; id[BACK] = 4; id[BOTTOM] = 5;
  }
  T& operator[] (FACE f) { return var[id[f]]; }
  const T& operator[] (FACE f) const { return var[id[f]]; }
  bool operator==(const dice<T>& b) const {
    const dice<T> &a = *this;
    return a[TOP] == b[TOP] && a[BOTTOM] == b[BOTTOM] &&
           a[FRONT] == b[FRONT] && a[BACK] == b[BACK] &&
           a[LEFT] == b[LEFT] && a[RIGHT] == b[RIGHT];
  }
  void roll_x() { roll(TOP, BACK, BOTTOM, FRONT); }
  void roll_y() { roll(TOP, LEFT, BOTTOM, RIGHT); }
  void roll_z() { roll(FRONT, RIGHT, BACK, LEFT); }
  vector<dice> all_rolls() {
    vector<dice> ret;
    for (int k = 0; k < 6; (k&1?roll_y():roll_x()),++k)
      for (int i = 0; i < 4; roll_z(), ++i)
        ret.push_back(*this);
    return ret;
  }
  bool equivalent_to(const dice& di) {
    for (int k = 0; k < 6; (k&1?roll_y():roll_x()),++k)
      for (int i = 0; i < 4; roll_z(), ++i)
        if (*this == di) return true;
    return false;
  }
private:
  void roll(FACE a, FACE b, FACE c, FACE d) {
    int tmp = id[a];
    id[a] = id[b]; id[b] = id[c];
    id[c] = id[d]; id[d] = tmp;
  }
  T var[6];
  int id[6];
};


int main(){
    int N;
    while(scanf("%d",&N),N){
        vector<dice<string> >vec;
        int cnt=0;
        while(N--){
            dice<string> b;
            cin>>b[TOP];
            cin>>b[FRONT];
            cin>>b[RIGHT];
            cin>>b[LEFT];
            cin>>b[BACK];
            cin>>b[BOTTOM];
            bool ok=true;
            rep(i,vec.size())if(vec[i].equivalent_to(b))ok=false;
            if(ok)vec.pb(b);
            else cnt++;
        }
        cout<<cnt<<endl;
    }
    return 0;
}

Measured memory_bytes: 1256
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(),(x).end())
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < n; i++)
#define reps(i, m, n) for(int i = m; i < n; i++)
#define repr(i, m, n) for(int i = m; i >= n; i--)
#define db(x) cout<<#x<<"="<<x<<endl
#define deb(x) each(x.begin(),x.end(),(int& y){cout << y <<" ";})
template<class T>bool maxi(T &a,const T &b){if(a<b){ a=b; return 1;} return 0;}
template<class T>bool mini(T &a,const T &b){if(b<a){ a=b; return 1;} return 0;}
#define y0 y3487465 //j0
#define j1 j1347829 //j1
#define INF2 4000000000000000037
#define INF 1000000007
#define PI (acos(-1))
#define MOD 1000000007
using namespace std;
typedef long long ll;

void Main(){

  string L; cin>>L;

  ll ans1=1,ans2=0;

  rep(i,L.size()){
    if(L[i]=='1'){
      ans2=(ans1+3*ans2)%MOD;
      ans1=ans1*2%MOD;
    }
    else{
      ans2=ans2*3%MOD;
    }
  }

  cout<< (ans1+ans2)%MOD <<"\n";
}

//-----------------------------------
int main(){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  Main();
}
//-----------------------------------


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

int main(int argc, char const *argv[])
{
    char c[101];
    int n, k;
    string s;
    cin >> n >> k;
    cin >> c;
    
    c[k - 1] += 32;
    cout << c << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
//long long…2^64-1 = 9223372036854775807まで

void _main() {
	//0 <= A,B <= 10＾9 intで十分
	int A, B;
	cin >> A >> B;

	ll K;
	
	//Aの方が小さい場合→A<K<BでAが負、Bが正になるようにする
	//そのような数字→-(A-K)=B-K→2K=A+B→K=(A+B)/2
	//Bの方が小さい場合→-(B-K)=A-K→K=(A+B)/2

	//A<K<Bでない場合、Impossible

	K = (A + B) / 2;

	if (A % 2 != B % 2) cout << "IMPOSSIBLE" << endl;
	else if (A<B){
		if (K < A || B < K) cout << "IMPOSSIBLE" << endl;
		else cout << K << endl;
	}
	else {
		if (K < B || A < K) cout << "IMPOSSIBLE" << endl;
		else cout << K << endl;
	}
}

Measured memory_bytes: 256
def main():

    N, M, K = map(int, input().split())
    mod = 998244353

    g1 = [1, 1]
    g2 = [1, 1]
    inv = [0, 1]

    for i in range(2, N+1):
        g1.append((g1[-1] * i) % mod)
        inv.append( ( -inv[mod % i] * (mod//i)) % mod )
        g2.append((g2[-1] * inv[-1]) % mod)

    def combi(n, r):
      r = min(r, n-r)
      return g1[n]*g2[r]*g2[n-r]%mod

    v = 1
    base = [1, M]
    for i in range(N):
        base.append(base[-1] * (M-1) % mod)

    # print(base)

    ans = 0
    for j in range(K+1):
        v = base[N-j]
        u = combi(N-1, j)
        ans += (v * u) % mod
        ans %= mod
    return ans


if __name__ == '__main__':
    print(main())


Measured memory_bytes: 122952
//By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#define testcase(t) int t;cin>>t;while(t--)
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i=0;i<e;++i)
#define forsn(i,s,e) for(int i=s;i<e;++i)
#define rforn(i,s) for(int i=s;i>=0;--i)
#define rforsn(i,s,e) for(int i=s;i>=e;--i)
#define bitcount(a) __builtin_popcount(a) // set bits (add ll)
#define ln '\n'
#define getcurrtime() cerr<<"Time = "<<((double)clock()/CLOCKS_PER_SEC)<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define inputfile freopen("input.txt", "r", stdin)
#define outputfile freopen("output.txt", "w", stdout)
#define dbg(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) { cerr<<endl; }
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << "\t"; err(++it, args...);
}
template<typename T1,typename T2>
ostream& operator <<(ostream& c,pair<T1,T2> &v){
	c<<"("<<v.fi<<","<<v.se<<")"; return c;
}
template <template <class...> class TT, class ...T>
ostream& operator<<(ostream& out,TT<T...>& c){
    out<<"{ ";
    forstl(x,c) out<<x<<" ";
    out<<"}"; return out;
}
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll,ll> p64;
typedef pair<int,int> p32;
typedef pair<int,p32> p96;
typedef vector<ll> v64;
typedef vector<int> v32; 
typedef vector<v32> vv32;
typedef vector<v64> vv64;
typedef vector<p32> vp32;
typedef vector<p64> vp64;
typedef vector<vp32> vvp32;
typedef map<int,int> m32;
const int LIM=1e5+5,MOD=1e9+7;
const ld EPS = 1e-9;

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

int main(){
	fastio;

	ll n; cin>>n;
	
	ll ans = 0;
	ll ch = 0;
	forn(i,n){
		ch = (n-i);
		ans += ch*(ch+1)/2;
	}

	forn(i,n-1){
		ll a,b; cin>>a>>b;
		a--; b--;
		if(b<a) swap(a,b);
		ans -= (a+1)*(n-b);
	}

	cout<<ans<<ln;

	return 0;
}

Measured memory_bytes: 3664
#ifdef _DEBUG
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define LINF (LONG_MAX/2)
const int MGN = 8;
const int ARY_SZ_MAX = 10000000;
using namespace std;
using ll = long long; using ull = unsigned long long;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using vb = vector<bool>; using vvb = vector<vb>; using vvvb = vector<vvb>;
using vl = vector<ll>; using vvl = vector<vl>;
using vd = vector<double>; using vs = vector<string>;
using pii = pair<int, int>; using pll = pair<ll, ll>;
// functions
bool second_greater(const pii& left, const pii& right) {
    return left.second > right.second;
}
#endif


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

    int N;  cin >> N;
    vi A(N); REP(i, N) cin >> A[i];    

    map<int,int> mp;
    REP(i, N) mp[A[i]]++;

    int ans = 0;
    for (auto p : mp) {
        int k = p.first;
        int v = p.second;
        if (k < v) ans += v - k;
        else if (k > v) ans += v;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 5120
/*
"اله السماء يعطينا النجاح ونحن عبيده نقوم ونبني" 
"تكفيك نعمتي لان قوتي في الضعف تكمل"
created by shady rafet 
my face book : https://www.facebook.com/profile.php?id=100019579575853
never give up
one day i will do it ':(

*/
#include <bits/stdc++.h>
using namespace std;
#define io                        \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
typedef long long ll;
typedef long double ld;
typedef unsigned long long ul;
const ll oo = 1e18;
const ll N = 1e6;
const ll mod = 1e9 + 7;
#define point complex<double>
const double pi = acos(-1);
double dot(point a, point b)
{
    return (conj(a) * b).real();
}
double cross(point a, point b)
{
    return (conj(a) * b).imag();
}
ll inv[N],fact[N];
ll fb(ll x, ll y)
{
    if(y == 0)
    return 1;
   ll ans = fb(x,y/2);
   ans = (ans * ans)%mod;
   if(y % 2 !=0)
   {
       ans = (ans*(x%mod))%mod;
   }
   return ans ;
}
void pre(ll n)
{
    fact[0] = 1;
    inv[0] = 1;
    for ( int i = 1;i<=n;i++)
    {
        fact[i] = (i * fact[i-1])% mod;
        inv[i] = fb(fact[i], mod-2);
    }
}
ll ncr (ll n , ll r)
{
      return (((fact[n] * inv[n - r]) % mod) * inv[r]) % mod;
}
ll npr (ll n,ll r)
{
    return (fact[n] * inv[n - r]) % mod;
}
vector<int> adj[N];
bool visted[N];
int main()
{
   int n;
   cin>>n;
   int a = 0 ,b = 0 ,c = 0,d = 0;
   while(n--)
   {
       string s;
       cin>>s;
       if(s=="AC")
       a++;
       else if (s=="WA")
       b++;
       else if (s=="TLE")
       c++;
       else 
       d++;

   }
cout<<"AC x "<<a<<endl;
cout<<"WA x "<<b<<endl;
cout<<"TLE x "<<c<<endl;
cout<<"RE x "<<d<<endl;
    return 0;
}

Measured memory_bytes: 27072
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fast ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
int main(){
	fast;
	set<int>found;
	int n, k;
	cin>>n>>k;
	for(int i=0; i<k; i++){
		int cnt; cin>>cnt;
		for(int j=0; j<cnt; j++){
			int x; cin>>x;
			found.insert(x);
		}
	}
	cout<<n-found.size()<<endl;
}

Measured memory_bytes: 3652
N = int(input())
A_list = list(map(int, input().split()))
#myans_list =  [ [0 for n in range(N)] for nn in range(N) ]
#myans = 0
#for n in range(N):
#    for nn in range(N):
#        myans_list[n][nn] = A_list[n] * A_list[nn]
#for n in myans_list:
#    print(n)
mysum = sum(A_list)
myans = 0
for n in range(N-1):
    mysum -= A_list[n]
    myans +=  mysum*A_list[n]
print(myans%(1000000007))

Measured memory_bytes: 31720
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {


    public static void main(String args[] ) throws IOException {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        String[] origin = br.readLine().split("");
        String[] serch = br.readLine().split("");
        int plusi = PlusI(serch);

       // System.out.println( SameString(serch) );
        for(int i = 0; i < origin.length; ){
        	 //System.out.println(i);

           if( i + serch.length  <= origin.length && SearchWord(origin , serch, i)){
              System.out.println(i);
              //i++;

              if(SameString(serch)){
            	  i = i + plusi ;
              }else{
                i++;
              }
           }else{

        	   i++;

           }



        }


    }


    public static int PlusI(  String[] Serch ){


    	for(int j = 0; j < Serch.length; j++ ){

    	    if( Serch[j].equals(Serch[0]) && 0 < j){
    	    	return j;
    	    }

    	}


        return Serch.length;


    }


    public static boolean SearchWord(String[] Origin , String[] Serch , int i){


    	boolean SerchCheck = false;
    	for(int j = i , k = 0; k < Serch.length; j++ , k++){

    	    if( Serch[k].equals(Origin[j]) ){
    	    	SerchCheck = true;
    	    }
    	    else{
    	    	return false;
    	    }



    	}


    	return SerchCheck;

    }


    public static boolean SameString(String[] Serch ){


    	boolean SerchCheck = false;
    	for(int i = 0 ; i < Serch.length; i++){

    	    if( Serch[0].equals(Serch[i]) ){
    	    	SerchCheck = true;
    	    }
    	    else{
    	    	return false;
    	    }



    	}


    	return SerchCheck;

    }



}

Measured memory_bytes: 24756
#include <bits/stdc++.h>
#ifdef LOCAL
#include "print_utils.h"
#endif
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
#define x first
#define y second
#define pb push_back
#define mp make_pair
#define forn(i, n) for(auto (i) = 0; (i) < (int)(n); ++(i))
#define for1(i, n) for(auto (i) = 1; (i) <= (int)(n); ++(i))
#define ford(i, n) for(auto (i) = (int)(n) - 1; (i) >= 0; --(i))
#define forab(i, a, b) for(auto (i) = (int)(a); (i) < (int)(b); ++(i))

int nxt() {
    int x;
    scanf("%d", &x);
    return x;
}

template <class T>
T remin(T &x, T val) {
    if (x > val) {x = val;}
    return x;
}

template <class T>
T remax(T &x, T val) {
    if (x < val) {x = val;}
    return x;
}

const ll mod = 1000 * 1000 * 1000 + 7;

ll pw(ll a, ll n) {
    ll ret = 1;
    while (n) {
        if (n & 1) ret = ret * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}

ll gcd(ll a, ll b) {
    a = std::abs(a);
    b = std::abs(b);
    while (b > 0) {
        a %= b;
        swap(a, b);
    }
    return a;
}

struct Q {
    ll n, d;
    Q(): n(0), d(1) {}
    Q(ll nn, ll dd) {
        n = nn;
        d = dd;
        ll g = gcd(n, d);
        n /= g;
        d /= g;
        if (d < 0) {
            n *= -1;
            d *= -1;
        }
    }

    bool operator < (const Q &r) const {
        return n * r.d < r.n * d;
    }
    bool operator <= (const Q &r) const {
        return n * r.d <= r.n * d;
    }
    bool operator == (const Q &r) const {
        return n * r.d == r.n * d;
    }
};


void solve() {
    int n = nxt();
    vector<int> a(n);
    forn(i, n) {
        a[i] = nxt();
    }
    vector<ll> f(n);
    vector<ll> b(n);
    f[0] = std::abs(a[0]);
    for (int i = 1; i < n; ++i) {
        f[i] = f[i - 1] + std::abs(a[i - 1] - a[i]);
    }
    b[n - 1] = std::abs(a[n - 1]);
    for (int i = n - 2; i >= 0; --i) {
        b[i] = b[i + 1] + std::abs(a[i + 1] - a[i]);
    }
    vector<ll> ans(n);
    ans[0] = b[1] + std::abs(a[1]);
    ans[n - 1] = f[n - 2] + std::abs(a[n - 2]);
    for (int i = 1; i + 1 < n; ++i) {
        ans[i] = std::abs(a[i - 1] - a[i + 1]) + f[i - 1] + b[i + 1];
    }
    forn(i, n) {
        cout << ans[i] << "\n";
    }
}



int main(int argc, char **argv) {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif
    std::ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    double cl0 = clock();
    int t = 1;
//    cin >> t;
    for (int i = 0; i < t; ++i) {
        solve();
    }
    std::cerr << "time: " << (clock() - cl0) / CLOCKS_PER_SEC << std::endl;
    return 0;
}


Measured memory_bytes: 3968
import itertools

N=int(input())
l=[int(x) for x in range(1,N+1)]
P=[int(x) for x in input().rstrip().split()]
Q=[int(x) for x in input().rstrip().split()]

p=itertools.permutations(l,N)
full=[]
for v in p:
  v=list(v)
  full.append(v)

print(abs(full.index(P)-full.index(Q)))
# print(full)

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

int main(){
    int a, b;
    cin >> a >> b;
    char A = '0' + a, B = '0' + b;
    string C = string(b, A), D = string(a, B);
    if(C < D){
        cout << C << endl;
    }
    else if(D <= C){
        cout << D << endl;
    }
    return 0;
}

Measured memory_bytes: 256
n,d=map(int,input().split())
X=[list(map(int,input().split())) for _ in range(n)]
f=0
for i in range(n-1):
  for j in range(i+1,n):
    l=0
    for a in range(d):
      l+=(X[i][a]-X[j][a])**2
    if int(l**(1/2))==l**(1/2):
        f+=1
print(f)

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

using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, q;
	cin >> n >> q;
	int cur = 0;
	vector<bool> memo(n, false);
	memo[1] = true;
	for (int i = 0; i < q; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		swap(memo[a], memo[b]);
		if (cur == a) cur = b;
		else if (cur == b) cur = a;
		if (cur > 0) memo[cur - 1] = true;
		if (cur < n - 1) memo[cur + 1] = true;
	}
	memo[cur] = true;
	int ans = 0;
	for (int i = 0; i < n; i++) ans += memo[i];
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<set>
#include<string>
#include<stdio.h>
#include<cmath>
#include<map>
#include<bitset>

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define repn(i, n) for(int i = 1; i <= n; i++)
#define repr(i, n) for(int i = n-1; i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define lint long long

struct cake{ lint x, y, z; };

int main(){
    int n, m; cin >> n >> m;
    vector<cake> c;
    rep(i, n){
        lint x, y, z;
        cin >> x >> y >> z;
        c.push_back(cake{x, y, z});
    }

    lint ans = 0;
    rep(i, 8){
        bitset<3> bs(i);
        vector<lint> v;
        rep(j, n){
            v.push_back(c[j].x*(bs[0]*2-1) + c[j].y*(bs[1]*2-1) + c[j].z*(bs[2]*2-1));
        }
        sort(all(v), greater<lint>());
        lint sum = 0;
        rep(j, m){
            sum += v[j];
        }
        ans = max(ans, sum);
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

using namespace std;

int main(){
    long res[100];
    res[0] = 2;
    res[1] = 1;
    int N = 0;
    scanf("%d", &N);
    for(int i=2; i < 87; i++){
        res[i] = res[i-1] + res[i-2];
    }
    printf("%ld\n", res[N]);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <array>
#include <algorithm>

using namespace std;

using ll = long long int;

int main(){
    
    ll N;
    array<ll, 100000> A;
    
    cin >> N;
    for(ll i = 0; i < N; ++i){
        cin >> A[i];
    }
    
    sort(A.begin(), A.begin() + N);
    
    ll sum = 0;
    ll last = 0;
    for(ll i = 0; i < N; ++i){
        if(sum * 2 < A[i]){
            last = i;
        }
        sum += A[i];
    }
    
    cout << N - last << endl;
    
    return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<math.h>
#include<map>
#include<iomanip>

using namespace std;

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



int main() {
	
	string str1, str2;


	cin >> str1 >> str2;


	int sum = str1.size() + str2.size();


	int j = 0, k = 0;
	rep(i, 0, sum) {

		if (i % 2 == 0) {
			cout << str1[j];
			j++;
		}
		else {
			cout << str2[k];
			k++;
		}

	}

	cout << endl;

	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double PI = acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
  ll N; cin >> N;
  vector<ll> a(N+1);
  for (int i = 1; i <= N; i++) {
    if (i == 2) a[2]++;
    else if (i == 3) a[3]++;
    else {
      ll n = i;
      for (int j = 2; j*j <= i; j++) {
        if (n % j == 0) {
          while (n % j == 0) {
            n /= j;
            a[j]++;
          }
        }
      }
      if (n != 1) a[n]++;
    }
  }
  ll ans = 1;
  for (int i = 0; i < N+1; i++) {
    ans *= (a[i] + 1);
    ans %= MOD;
  }
  
  cout << ans << endl;
}

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

int main(){
  int x = 0;
  int n,sum;
  while(true){
    cin >> n >> sum;
    if(n == 0 && sum == 0) break;
    for(int i = 1; i <= n; i++){
      for(int j = 1; j <= n; j++){
        for(int k = 1; k <= n; k++){
          if(i + j + k == sum){
            if(i < j && j < k){
              x++;
            }
          }
        }
      }
    }
    cout << x << endl;
    x = 0;
  }
}



Measured memory_bytes: 3080
s = input()
x,y = map(int,input().split())
#%%
mx = []
my = []
mx2 = []
my2 = []


cnt = 0
it = 0
firstFlag = (s[0]=='F')
for t in s:
    if t == 'T':
        
        
        if cnt:
            if it%2==0:
                mx.append(cnt)
                mx2.append(cnt*2)
            else:
                my.append(cnt)
                my2.append(cnt*2)
        it += 1
        cnt = 0
    else:
        cnt += 1
    
if it%2==0:
    mx.append(cnt)
    mx2.append(cnt*2)
else:
    my.append(cnt)
    my2.append(cnt*2)

if firstFlag:
    x -= mx[0]
    mx[0] = 0
    mx2[0] = 0
        
dx = sum(mx)-x
dy = sum(my)-y


# dp[i+1][j] : i個目までの要素の和でjを作れるか？

MAX = max(sum(mx2),sum(my2)) + 10
dpx = [[False]*MAX for _ in range(len(mx2)+1)]
dpy = [[False]*MAX for _ in range(len(my2)+1)]

dpx[0][0] = True
dpy[0][0] = True

for i in range(len(mx2)):
    for j in range(MAX):
        if j<mx2[i]:
            dpx[i+1][j] = dpx[i][j]
        else:
            dpx[i+1][j] = dpx[i][j-mx2[i]] or dpx[i][j]

for i in range(len(my2)):
    for j in range(MAX):
        if j<my2[i]:
            dpy[i+1][j] = dpy[i][j]
        else:
            dpy[i+1][j] = dpy[i][j-my2[i]] or dpy[i][j]



if dx<0 or dy<0:
    print('No')

elif dx>sum(mx2) or dy>sum(my2):
    print('No')

else:
    if dpx[len(mx2)][dx] and dpy[len(my2)][dy]:
        print('Yes')
    else:
        print('No')
        









Measured memory_bytes: 166876
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <math.h>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#define ll long long
#define vi vector<ll>
#define vs vector<string>
#define fr(i, k, n) for (ll i = k; i < n; i++)
#define rep(i, n) fr(i, 0, n)
#define alll(v) v.begin(), v.end()
#define mp(a, b) make_pair(a, b)
#define rdd(a) ll a; cin >> a
#define rrd rdd(a); rep(i, a)
//min({a,b,c,d})などの記法
using namespace std;
template <class X> void pr(X x) { cout << x << endl; }
template <class X> void prr(X x) { for (auto it : x) { cout << it << endl; } }
 
int func(int x){
    return x*x+30;
}
int main() {
    string s;
    cin >>s;
    rep(i, 4)cout<<s[i];
    cout<<" ";
    rep(i, 8)cout<<s[i+4];
    cout<<endl;
    return 0;
}

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

int main() {
  int n, x, count;
  while (true) {
    count = 0;
    cin >> n >> x;
    if (n == 0 && x == 0) break;
    for (int i = 1; i <= n - 2; i++) {
      for (int j = i + 1; j <= n - 1; j++) {
        for (int k = j + 1; k <= n; k++) {
          if (i + j + k == x) count++;
        }
      }
    }
    cout << count << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;
using ull = unsigned long long;
using P = pair<int, int>;


ull E = 1000000007;


int f(int n) {
    if (n % 2 == 0) return n / 2;
    return 3 * n + 1;
}

int main() {
    int s;
    cin >> s;
    set<int> memo;
    int a = s;
    int m = 1;
    while (true) {
        if (memo.count(a)) break;
        ++m;
        memo.insert(a);
        a = f(a);
    }
    cout << m << endl;
}


Measured memory_bytes: 888
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner scanner = new Scanner(System.in);
        
        int N = scanner.nextInt();
        boolean hantei = false;
        
        Map<Integer,Integer> map = new HashMap<Integer,Integer>();
        
        for(int i=0; i<N; i++){
            
            int x = scanner.nextInt();
            if(map.containsKey(x)){
                hantei = true;
            }else{
                map.put(x,1);
            }
            
        }
        
        if(hantei){
            System.out.println("NO");
        }else{
            System.out.println("YES");
        }
        
    }
}


Measured memory_bytes: 100732
#include<bits/stdc++.h>
#include<string.h>
#define ll long long 
using namespace std;
 struct value
{
	ll x;
	ll y;
};
bool compare(value a, value b)
{
	//for descending order replace with a.roll >b.roll
	if(a.y < b.y)		
		return 1;
	else
		return 0;
}
int main()
{
	char a;
	cin>>a;
	if(isupper(a))
	   cout<<"A";
	else cout<<"a";
	return 0;	
}

Measured memory_bytes: 3620
# ABC172 C
import sys
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_CumulativeSum = [0]
B_CumulativeSum = [0]
for i in range(n):
    A_CumulativeSum.append(A[i] + A_CumulativeSum[i])
for i in range(m):
    B_CumulativeSum.append(B[i] + B_CumulativeSum[i])

if A_CumulativeSum[n-1] + B_CumulativeSum[m-1] <= k:
    print(n+m)
    sys.exit()

ans = 0
j = m
for i in range(n+1):
    time = A_CumulativeSum[i]
    if time > k:
        break
    time_b = k - time
    while time_b < B_CumulativeSum[j]:
        j -= 1

    count = i + j
    ans = max(count, ans)

print(ans)


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

using namespace std;

const int P = 998244353;
const int N = 200005;

long long ten[N];
long long pre[N];
long long sum[N * 4];
long long tag[N * 4];

void build(int l, int r, int x) {
	if(l == r) {
		sum[x] = 1;
		return;
	}
	int mid = l + r >> 1;
	build(l, mid, x << 1);
	build(mid + 1, r, x << 1 | 1);
	sum[x] = (sum[x << 1] * ten[r - mid] + sum[x << 1 | 1]) % P;
}

void pushdown(int x, int l, int r) {
	int mid = l + r >> 1;
	if(tag[x] != 0) {
		tag[x << 1] = tag[x];
		tag[x << 1 | 1] = tag[x];
		sum[x << 1] = pre[mid - l] * tag[x] % P;
		sum[x << 1 | 1] = pre[r - mid - 1] * tag[x] % P;
		tag[x] = 0;
	}
}

void update(int l, int r, int x, int a, int b, int d) {
	if(l > b || r < a) {
		return;
	}
	if(l >= a && r <= b) {
		tag[x] = d;
		sum[x] = pre[r - l] * d % P; 
		return;
	}
	pushdown(x, l, r);
	int mid = l + r >> 1;
	update(l, mid, x << 1, a, b, d);
	update(mid + 1, r, x << 1 | 1, a, b, d);
	sum[x] = (sum[x << 1] * ten[r - mid] + sum[x << 1 | 1]) % P;
}

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

	int n, q;
	cin >> n >> q;

	ten[0] = 1;
	for(int i = 0; i < n; ++i) {
		ten[i + 1] = ten[i] * 10 % P;
	}
	pre[0] = ten[0];
	for(int i = 0; i < n; ++i) {
		pre[i + 1] = (pre[i] + ten[i + 1]) % P; 
	}

	build(1, n, 1);

	while(q--) {
		int l, r, d;
		cin >> l >> r >> d;
		update(1, n, 1, l, r, d);
		cout << sum[1] << '\n';
	}

	return 0;
}


Measured memory_bytes: 14928
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        a = a == 1 ? 14 : a;
        b = b == 1 ? 14 : b;
        if(a - b > 0)System.out.println("Alice");
        else if(a - b < 0)System.out.println("Bob");
        else System.out.println("Draw");
    }


}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
#define all(cont) cont.begin(), cont.end()
#define pb push_back
#define fi first
#define se second
#define DEBUG(x) cerr << (#x) << ": " << (x) << '\n'

using namespace std;

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

template<class T> bool uin(T &a, T b) {return (a <= b ? false : (a = b, true));}
template<class T> bool uax(T &a, T b) {return (a >= b ? false : (a = b, true));}

//ifstream f(".in");
//ofstream g(".out");

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
#ifdef LOCAL_DEFINE
  freopen(".in", "r", stdin);
#endif

  string s, t;
  cin >> s >> t;
  int n = s.length();
  int m = t.length();
  s = " " + s;
  t = " " + t;
  vector<vector<int>> dp(n + 2, vector<int>(m + 2));
  vector<vector<pair<int, int>>> from(n + 2, vector<pair<int,int>>(m + 2, {0, 0}));

  auto setFrom = [&](int val, pair<int, int> curr, pair<int, int> old) {
    if (uax(dp[curr.first][curr.second], val)) {
      from[curr.first][curr.second] = old;
    }
  };

  int ans = 0;
  pair<int, int> p = {0, 0};
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (s[i] == t[j]) {
        setFrom(1 + dp[i - 1][j - 1], {i, j}, {i - 1, j - 1});
      }
      setFrom(dp[i - 1][j], {i, j}, {i - 1, j});
      setFrom(dp[i][j - 1], {i, j}, {i, j - 1});
      if (uax(ans, dp[i][j])) {
        p = {i, j};
      }
    }
  }

  if (ans == 0) {
    cout << "";
    return 0;
  }

  string lcs;
  while (p.first != 0 && p.second != 0) {
    if (s[p.first] == t[p.second]) {
      lcs += s[p.first];
    }
    p = from[p.first][p.second];
  }

  reverse(lcs.begin(), lcs.end());

  cout << lcs << '\n';

#ifdef LOCAL_DEFINE
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
  return 0;
}


Measured memory_bytes: 106112
import Data.List

main=do
  (a:b:_)<-map read.words<$>getLine::IO[Int]
  let k = 50
  putStrLn.unwords $ map show [k*2,k*2]
  putStr.unlines.sp (k*2)$solve k a b

solve k a b = mk k '#' '.' (k-2) (a-1) ++ replicate (k*2) '#' ++ replicate (k*2) '.' ++ (reverse $ mk k '.' '#' k (b-1))

sp n "" = []
sp n s = (take n s) : (sp n $ drop n s)

mk k _ _ 0 _ = ""
mk k u v l n
  | n >= k = (take (k*2) $ cycle [u,v]) ++ replicate (k*2) u ++ mk k u v (l-2) (n-k)
  | n == 0 = replicate (k*2*2) u ++ mk k u v (l-2) 0
  | True = take (k*2*2) ((take (n*2) $ cycle [u,v]) ++ replicate (k*2*2) u) ++ mk k u v (l-2) 0


Measured memory_bytes: 1148
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define range(i,a,n) for(int i=(a);i<(n);i++)

#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI 3.1415926535897932384

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

template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S acm(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
void YN(bool b){cout<<(b?"YES":"NO")<<"\n";}
void Yn(bool b){cout<<(b?"Yes":"No")<<"\n";}
void yn(bool b){cout<<(b?"yes":"no")<<"\n";}

ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1; for(auto s:t){os<<(a?"":" ")<<s;a=0;} return os;}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	char c;
	cin>>c;
	if(c=='A')cout<<'T'<<endl;
	if(c=='T')cout<<'A'<<endl;
	if(c=='C')cout<<'G'<<endl;
	if(c=='G')cout<<'C'<<endl;
}

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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define repr(i, N) for (ll i = N-1; i >= 0; i--)
#define repr1(i, N) for (ll i = N; i > 0; i--)

#define MOD 1000000007

using ll = long long;
using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<P> vpi;


int main() {
    ll N,M,num = 0,sum = 0;
    cin >> N >> M;
    vpi a(M);
    rep(i,M) cin >> a[i].first >> a[i].second;

    bool nflag = true;
    int cango[200005] = {0}; 
    
    rep(i,M){
        if(a[i].first == 1){
            cango[a[i].second]++;
        }
        if(a[i].second == N){
            cango[a[i].first]++;
        }
    }

    rep1(i,N)
        if(cango[i] == 2)
            nflag = false;

    string ans = (nflag ? "IMPOSSIBLE" : "POSSIBLE");
    cout << ans;
    //printf("%.15lf", ans);
    cout << "\n";
    return 0;
}


Measured memory_bytes: 2560
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <iomanip>
#include <random>
#include <queue>
#include <deque>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <numeric>
#include <bitset>
#include <cassert>
#include <sstream>
#include <bitset>
#include <list>

using namespace std;

#define all(x) x.begin(), x.end()
#define z(x) fixed << setprecision(x)
#define sqr(x) ((x)*(x))
#define nl '\n'
#define eb emplace_back
#define elif else if
#define dbg(a) cout << (#a) << " " << a << nl;
#define eb emplace_back
#define mineq(a, b) (a) = min(a, b)
#define maxeq(a, b) (a) = max(a, b)
#pragma comment(linker, "/STACK:216777216")

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned short int usht;
mt19937 rnd(22353128);

const ll LINF = numeric_limits<ll>::max();
const int INF = 1e9;
const int MAXN = 1e6;
const double EPS = 1e-9;

inline void IO() {
#ifdef _DIVAN
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cout.setf(ios::fixed);
	cout.precision(10);
}

#define int ll
#define double long double

void solve() {
	int n, m;
	cin >> n >> m;
	vector<int> h(n);
	for (int i = 0; i < n; i++) {
		cin >> h[i];
	}
	vector<int> ma(n, -1);
	while (m--) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		ma[a] = max(ma[a], h[b]);
		ma[b] = max(ma[b], h[a]);
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		ans += h[i] > ma[i];
	}
	cout << ans;
}

signed main() {
	IO();
	int t;
	t = 1;
	while (t--)
		solve();
	return 0;
}

Measured memory_bytes: 4796
#include <bits/stdc++.h>
#define INF 1000000000000000001
#define ll long long
#define pll pair<ll, ll>
using namespace std;


int main()
{
  ll H, N;
  cin >> H >> N;
  vector<pll> hc(N);
  for (ll i = 0; i < N; ++i)
  {
    cin >> hc.at(i).first >> hc.at(i).second;
  }
  vector<ll> dp(H + 1, INF);
  dp.at(0) = 0;
  for (ll i = 0; i < H; ++i)
  {
    for (ll j = 0; j < N; ++j)
    {
      dp.at(min(H, i + hc.at(j).first)) = min(dp.at(min(H, i + hc.at(j).first)), dp.at(i) + hc.at(j).second);
    }
  }
  cout << dp.at(H) << endl;
}


Measured memory_bytes: 384
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int main(void){
	int b[100000];
	int c, d;
	int k;
	int n, m;
	int x;

	for (int i = 0; i < 10; i++)b[i] = 0;
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d", &x);
		x = x / 400;
		if (x > 7)b[8]++;
		else b[x] = 1;
			}
	c = 0;
	for (int i = 0; i < 8; i++)c = c + b[i];
	if (c == 0&&b[8]>0){
		c = 1;
		b[8]--;
	}
 printf("%d %d\n",c, c + b[8]);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>]
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int n,s;



int cha(int n){
	for (int i = 1000000000; i > 0;i = i / 10){
		s = (n / i )+ s;
		n = n - (n / i) * i;
	}
	return s;
}
int main(){
	cin >> n;
	
	if (n % cha(n) == 0){
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

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

#define ll long long

int main(void){
    vector<int>a(3);
    cin >> a[0] >> a[1] >> a[2];
    sort(a.rbegin(),a.rend());
    int k;
    cin >> k;
    a[0] = a[0] * pow(2,k);
    cout<< accumulate(a.begin(),a.end(),0)<<endl;;
    return 0;
}

Measured memory_bytes: 256