akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <iomanip>
#include <random>
#include <complex>
#include <functional>
#include <tuple>

//#include "All.h"

using namespace std;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,a,n) for(int i=a;i<n;i++)
#define rep(i, n) REP(i,0,n)

#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")

using ll = long long int;

int gcd(int a, int b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll beki(ll a, ll b) {
    ll tmp = 1;
    rep(i, b) tmp *= a;
    return tmp;
}

ll N, M, K;
ll A[200010], B[200010];
ll a[200010] = {}, b[200010] = {};
ll ans = 0;
ll ai = 0, bi = 0;

int main() {
    cin >> N >> M >> K;
    A[0] = 0;
    a[0] = 0;
    B[0] = 0;
    b[0] = 0;
    REP(i, 1, N + 1 + 1) {
        if (i != N + 1) {
            cin >> A[i];
            a[i] = a[i - 1] + A[i];
        }
        else a[i] = (ll)1e17;

        if (a[i] > K && a[i - 1] <= K) {
            ai = i - 1;
        }
    }
    REP(i, 1, M + 1 + 1) {
        if (i != M + 1) {
            cin >> B[i];
            b[i] = b[i - 1] + B[i];
        }
        else b[i] = (ll)1e17;

        if (b[i] > K && b[i - 1] <= K) {
            bi = i - 1;
        }
    }

    ans = ai;
    ll bii = 0;
    //int L = ai + 1;

    for (int i = 0; i <= ai; i++) {
        //どんどん引いてく
        while (K >= a[ai - i] + b[bii + 1]) {
            bii++;
        }
        int bookNum = ai - i + bii;
        if (bookNum > ans) {
            ans = bookNum;
        }
    }

    std::cout << ans << endl;

}

/*
5 4 1
1000000000 1000000000 1000000000 1000000000 1000000000
1 1000000000 1000000000 1000000000

5 4 1
1 1000000000 1000000000 1000000000 1000000000
1000000000 1000000000 1000000000 1000000000
*/


Measured memory_bytes: 9852
div = (10**9) + 7

n = int(input())
c = list(map(int, input().split()))

c = sorted(c, reverse=True)

ans = 0

exp4_div = [0]*n
exp4_div[0] = 1
for i in range(1,n):
    exp4_div[i] = (exp4_div[i-1]*4)%div

for i in range(n):
    ans = (ans*4 + c[i] * (i+2) * exp4_div[i] ) % div

print(ans)

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

int main(){
  int n;
  cin>>n;
  map<string,int> mp;
  rep(i,n){
    string s;
    cin>>s;
    mp[s]++;
  }
  cout<<"AC x "<<mp["AC"]<<endl;
  cout<<"WA x "<<mp["WA"]<<endl;
  cout<<"TLE x "<<mp["TLE"]<<endl;
  cout<<"RE x "<<mp["RE"]<<endl;
}

Measured memory_bytes: 3640
s=input()[::-1]
p=2019
ans=[0]*p

x10, S=1, 0
for i in s:
  S+=x10*int(i)
  S%=p
  x10*=10
  x10%=p
  ans[S]+=1

cnt=ans[0]
for a in ans:
  cnt+=(a*(a-1))//2
  
print(cnt)


Measured memory_bytes: 9276
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    LL h,w;
    cin >> h >> w;

    vector<vector<LL>> a(h+1,vector<LL>(w+1));

    for(int i = 1; i < h+1; i++){
        for(int j = 1; j < w+1; j++){
            cin >> a[i][j];
        }
    }

    vector<LL> x,y,xx,yy;
    LL c = 0;

    for(int i = h; i > 0; i--){
        for(int j = w; j > 1; j--){
            while(a[i][j]%2 != 0){
                a[i][j]--;
                a[i][j-1]++;
                c++;
                x.push_back(j);
                xx.push_back(j-1);
                y.push_back(i);
                yy.push_back(i);
            }
        }
        if(i != 1){
            if(a[i][1]%2 != 0){
                a[i][1]--;
                a[i-1][1]++;
                c++;
                x.push_back(1);
                xx.push_back(1);
                y.push_back(i);
                yy.push_back(i-1);
            }
        }
    }

    cout << c << endl;

    for(int i = 0; i < c; i++){
        cout << y[i] << " ";
        cout << x[i] << " ";
        cout << yy[i] << " ";
        cout << xx[i] << endl;
    }

    
    return 0;
}

Measured memory_bytes: 8152
#include<bits/stdc++.h>
#define lson(x) (x<<1)
#define rson(x) ((x<<1)|1)
using namespace std;

typedef long long ll;
typedef vector<int> vii;

const int maxn=200003;
const int inf=0x3f3f3f3f;

int n,k,b[maxn];
ll pre[maxn],a[maxn],res,sum[maxn<<2];

void update(int id,int l,int r,int pos){
	++sum[id];
	if(l==r) return ;
	int mid=(l+r)/2;
	if(mid>=pos) update(lson(id),l,mid,pos);
	else update(rson(id),mid+1,r,pos);
}

ll query(int id,int l,int r,int L,int R){
	if(l>=L&&r<=R) return sum[id];
	if(l>R||L>r) return 0;
	int mid=(l+r)/2;
	return query(lson(id),l,mid,L,R)
		  +query(rson(id),mid+1,r,L,R);
}

int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;++i){
		scanf("%lld",&pre[i]);
		pre[i]-=k;
		pre[i]+=pre[i-1];
		a[i]=pre[i];
		if(a[i]>=0) ++res;
	}
	sort(a+1,a+n+1);
	int U=unique(a+1,a+n+1)-a-1;
	for(int i=1;i<=n;++i)
		b[i]=lower_bound(a+1,a+U+1,pre[i])-a;
	for(int i=1;i<=n;++i){
		res+=query(1,1,n,1,b[i]);
		update(1,1,n,b[i]);
	}
	printf("%lld\n",res);
	return 0;
}//

Measured memory_bytes: 10368
#include<iostream>
#include<cstring>
#include<vector>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
int main(){
int n,k;
cin>>n>>k;
int ans=0,a[101]={0};
int x,d;
for(int i=1;i<=k;i++){
       cin>>x;
    for(int j=1;j<=x;j++){
        cin>>d;
        a[d]++;
    }
}

for(int i=1;i<=n;i++)if(!a[i])ans++;
cout<<ans;
return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
//#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define MOD 998244353

#define SIZE 3005


ll N,S;
ll A[SIZE];
ll dp[SIZE][SIZE];


int main(){

	scanf("%lld %lld",&N,&S);

	for(ll i = 0; i < N; i++){

		scanf("%lld",&A[i]);
	}

	for(int i = 0; i < SIZE; i++){
		for(int k = 0; k < SIZE; k++){

			dp[i][k] = 0;
		}
	}

	//dp[何個見たか][和] = 場合の数
	dp[0][0] = 1;

	for(int i = 0; i < N; i++){

		//足さない
		for(int k = 0; k < SIZE; k++){

			dp[i+1][k] += 2*dp[i][k];
			dp[i+1][k] %= MOD;
		}
		//足す
		for(int k = 0; k+A[i] < SIZE; k++){

			dp[i+1][k+A[i]] += dp[i][k];
			dp[i+1][k+A[i]] %= MOD;
		}
	}

	printf("%lld\n",dp[N][S]);

	return 0;
}


Measured memory_bytes: 74340
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => (::std::cmp::min($x, min!($($z),*)));
}
#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => (::std::cmp::max($x, max!($($z),*)));
}

fn main() {
    input! {
        a: i64,
        b: i64,
        c: i64,
    }
    let ans = if a == b && b == c { "Yes" } else { "No" };
    println!("{}", ans);
}

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

int main() {
	int N;
	cin >> N;
	int a[N+1], b[N+1], c[N+1];
	int dp[N+1][4];
	for(int k = 1; k <= N; k++){
		cin >> a[k] >> b[k] >> c[k];
		dp[k][0] = 0;//margin
		dp[k][1] = 0;//a
		dp[k][2] = 0;//b
		dp[k][3] = 0;//c
	}
	a[0] = 0;
	b[0] = 0;
	c[0] = 0;
	dp[0][0] = 0;
	dp[0][1] = 0;
	dp[0][2] = 0;
	dp[0][3] = 0;
	for(int i = 1; i <= N; i++){
		if(dp[i-1][1] > dp[i-1][2]){
			dp[i][3] = dp[i-1][1] + c[i];
		}else{
			dp[i][3] = dp[i-1][2] + c[i];
		}

		if(dp[i-1][2] > dp[i-1][3]){
			dp[i][1] = dp[i-1][2] + a[i];
		}else{
			dp[i][1] = dp[i-1][3] + a[i];
		}

		if(dp[i-1][3] > dp[i-1][1]){
			dp[i][2] = dp[i-1][3] + b[i];
		}else{
			dp[i][2] = dp[i-1][1] + b[i];
		}
	}

	int ans = max({dp[N][1], dp[N][2], dp[N][3]});

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 6344
#include<stdio.h>

long long min(long long c,long long d){
  return ((c<d)?c:d);
}

int main(){
  long long n,sum=0,b[101],i;
  scanf("%lld",&n);
  for(i=1;i<=n-1;i++){
    scanf("%lld",&b[i]);
  }
  b[0]=100001;
  b[n]=100001;
  for(i=1;i<=n;i++){
    sum+=min(b[i-1],b[i]);
  }
  printf("%lld\n",sum);
  return 0;
}


Measured memory_bytes: 128
#include <cstdio>
#include <cmath>
#include <map>
#include <vector>

#define PB push_back

using namespace std;

typedef long long ll;

const int N = 1e5 + 500;

int prost[N], n;
ll A[N];
vector < ll > pr;
map < ll, int > kol;

void precompute(){
	for(int i = 2;i < N;i++){
		if(prost[i])
			continue;
		pr.PB(i);
		for(int j = 2 * i;j < N;j += i)
			prost[j] = 1;
	}
}

ll skrati(ll x){
	for(int i = 0;pr[i] * pr[i] * pr[i] <= x;i++){
		while(!(x % (pr[i] * pr[i] * pr[i])))
			x /= pr[i] * pr[i] * pr[i];
	}
	return x;
}

ll obrni(ll x){
	ll ret = 1;
	for(int i = 0;pr[i] * pr[i] * pr[i] <= x;i++){
		if(x % pr[i]) continue;
		ret *= pr[i]; x /= pr[i];
		if(x % pr[i])
			ret *= pr[i];
		else
			x /= pr[i];
	}
	ll kor = (ll)sqrtl(x);
	if(kor * kor == x)
		ret *= kor;
	else
		ret *= x * x;
	return ret;
}

int main(){
	precompute();
	scanf("%d", &n);
	for(int i = 0;i < n;i++){
		ll x; scanf("%lld", &x);
		x = skrati(x);
		A[i] = x;
		kol[x]++;
	}
	int sol = 0, jedn = 0;
	for(int i = 0;i < n;i++){
		if(A[i] == 1){
			jedn = 1; continue;
		}
		ll drugi = obrni(A[i]);
		if(kol[A[i]] > kol[drugi] || (kol[A[i]] == kol[drugi] && A[i] > drugi))
			sol++;
	}
	printf("%d\n", sol + jedn);
}





Measured memory_bytes: 13952
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m;	cin >> n >> m;
  vector<bool>	seikai(n+1,false);
  vector<int> p(n+1,0);
  for(int i=0;i<m;i++){
    int po;	string s;	cin >> po >> s;
    if(s=="AC")	seikai.at(po)=true;
    else if(s=="WA"&&seikai.at(po)==false)	p.at(po)+=1;
  }
  
  int ac=0,wc=0;
  for(int i=1;i<=n;i++){
    if(seikai.at(i)){
      ac++;
      wc+=p.at(i);
    }
  }
   cout << ac  << " " << wc;
}

Measured memory_bytes: 3736
import heapq

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

def getAdjListFromEdgePairs(list_EdgePairs, nodenum):
    #0番目の値→1番目の値という優先順位でソート
    list1 = sorted(list_EdgePairs)
    list_Adjlist = [[] for _ in range(nodenum)] 
    
    for list2 in list1:
        list_Adjlist[list2[0]-1].append(list2[1])
        list_Adjlist[list2[1]-1].append(list2[0])

    return list_Adjlist

adj = getAdjListFromEdgePairs(list_EdgePairs, n)


T = [0 for _ in range(n)]
D = [n for _ in range(n)]
D[0] =0
S = [(0, 1)]
heapq.heapify(S)
check = [False for _ in range(n)]


while len(S) > 0:
    u = heapq.heappop(S)
    if check[u[1]-1] == False:
        check[u[1]-1] == True
        for i in adj[u[1]-1]:
            if D[i-1] > D[u[1]-1] + 1:
                D[i-1] = D[u[1]-1] + 1
                T[i-1] = u[1]
                heapq.heappush(S, (D[i-1], i))

print("Yes")
for i in range(1,n):
    print(T[i])

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

int A[3][3];
int N;
int B[10];

void input(){
    for(int i=0; i < 3; i++){
        for(int j=0; j < 3; j++){
            cin >> A[i][j];
        }
    }
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> B[i];
    }
}

void solve(){
    bool ans[3][3];

    for(int i=0; i<3;i++){
        for(int j = 0; j < 3; j++){
            ans[i][j] = false;
            for(int n=0; n < N; n++){
                if(A[i][j] == B[n]) ans[i][j] = true;
            }
        }
    }

    string answer = "No";
    // 横
    for(int i = 0; i < 3; i++){
        if(ans[i][0] && ans[i][1] && ans[i][2]) answer = "Yes";
    }
    // 縦
    for(int j = 0; j < 3; j++){
        if(ans[0][j] && ans[1][j] && ans[2][j]) answer = "Yes";
    }
    // 斜め
    if(ans[0][0] && ans[1][1] && ans[2][2]) answer = "Yes";
    if(ans[0][2] && ans[1][1] && ans[2][0]) answer = "Yes";

    cout << answer << endl;
}


int main(){
    input();
    solve();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 1<<15;
const ll MOD = 1e9+7;
const double EPS = 1e-9;


int main(int argc, const char * argv[]) {
  int N;
  cin >> N;
  vector<int> C(N), V(N);
  for(int i=0; i<N; i++){
    cin >> V[i];
  }
  for(int i=0; i<N; i++){
    cin >> C[i];
  }
  
  int b, X, Y, ans;
  ans = 0;
  for (int i=0; i<(1<<N); i++) {
    b = i;
    X = 0;
    Y = 0;
    for (int j=0; j<N; j++){
      if (b%2 == 1){
        X += V[j];
        Y += C[j];
      }
      b /= 2;
    }
    ans = max(ans, X-Y);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long; using ull = unsigned long long;
#define int ll
using vb = vector<bool>; using vvb = vector<vb>;
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>;
#define FOR(i,a,b) for(ll i = (a); i < (ll)(b); ++i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(ll i = (ll)(n)-1;i >= 0;--i)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define eb(val) emplace_back(val)
const double PI = acos(-1);
const double EPS = 1e-10;
const ll MOD = 1e9+7;
void cioacc(){//accelerate cin/cout
  cin.tie(0);
  ios::sync_with_stdio(false);
}
signed main(){
  ll n;
  cin >> n;
  vl t(n);
  REP(i,n) cin >> t.at(i);
  cout << accumulate(ALL(t),1LL,[](ll left,ll right){
    return left/__gcd(left,right)*right;
  }) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


int main(){
  string s;
  cin>>s;
  rep(i,s.size()){
    if(s[i]=='9'){cout<<"Yes"<<endl;return 0;}
  }
  cout<<"No"<<endl;
  return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main{
	static IntStream REPS(int v){return IntStream.range(0,v);}
	static IntStream REPS(int l,int r){return IntStream.rangeClosed(l,r);}
	static IntStream INS(int n) {return REPS(n).map(i->getInt());}
	static Scanner s=new Scanner(System.in);
	static int getInt(){return Integer.parseInt(s.next());}

	public static void main(String[]$){
		int[]c=new int[114514];
		INS(getInt()).forEach(i->++c[i]);
		
		System.out.println(
				REPS(1,100000).map(i->c[i-1]+c[i]+c[i+1]).max().getAsInt()
				);
	}
}

Measured memory_bytes: 49536
#include <bits/stdc++.h>
const char nl = '\n';
using namespace std;
typedef long long ll;
typedef long double ld;
typedef complex<ld> pt;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int N = 1e4+10;

ll a[N], b[N];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n; cin >> n;
    ll as = 0, bs = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        as += a[i];
    }
    for (int i = 0; i < n; i++) {
        cin >> b[i];
        bs += b[i];
    }
    ll acnt = 0, bcnt = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] < b[i]) {
            acnt += (b[i] - a[i] + 1) / 2;
            bcnt += (b[i] - a[i]) % 2;
        } else {
            bcnt += a[i] - b[i];
        }
    }
    //cerr << acnt << " " << bcnt << nl;
    if (acnt < bcnt) {
        puts("No");
    } else if (acnt + (acnt - bcnt) <= bs - as) {
        puts("Yes");
    } else puts("No");
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int N;
  cin >> N;
  vector<int> A(N);
  rep(i, N)
  {
    cin >> A[i];
    A[i] -= (i + 1);
  }
  sort(A.begin(), A.end());

  long long a = A[N / 2];
  long long b = A[N / 2 - 1];
  long long sum1 = 0;
  long long sum2 = 0;
  rep(i, N)
  {
    sum1 += abs(A[i] - a);
    sum2 += abs(A[i] - b);
  }
  long long ans = min(sum1, sum2);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var s = ReadLine();

            var a = s.Replace("?", "D");
            //int cnt = 0;
            //bool f = false;
            //for (int i = 0; i < a.Length; i++)
            //{
            //    if (a[i] == 'D')
            //    {
            //        cnt++;
            //        if (f)
            //            cnt++;
            //        f = false;

            //    }
            //    else if (a[i] == 'P')
            //    {
            //        f = true;
            //    }
            //}
            WriteLine(a);
        }

        public class IO
        {
            #region Input
            public static int RInt => int.Parse(ReadLine());
            public static long RLong => long.Parse(ReadLine());
            public static double RDouble => double.Parse(ReadLine());

            public static string[] RSString => ReadLine().Split();
            public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
            public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
            public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
            #endregion

            #region Output
            public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
            public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
            public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
            #endregion
        }

        public class Mod
        {
            #region
            private readonly static long M = 1000000007;

            public static long Add(long a, long b) => (a * b) % M;
            public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
            public static long Multi(long a, long b) => (a * b) % M;
            #endregion
        }
    }
}

Measured memory_bytes: 28936
N = int(input())

dp = [100000]*(N+1)
dp[0] = 0

arr = [1,6,9]

for i in range(len(arr)):
    oriArrVal = arr[i]
    val = arr[i]
    while val <= N:
        index = val
        while index <= N:
            dp[index] = min(dp[index],dp[index - val]+1)
            index += 1
            # print(index)
        if oriArrVal == 1:
            val += index
        else : val *= oriArrVal

print(dp[N])

Measured memory_bytes: 6900
def gcd( x, y):
    if x>y:
        return gcd( x-y, y)
    elif x<y:
        return gcd( x, y-x)
    else:
        return x

def main():
    x,y = map(int,input().split())
    print(gcd(x,y))

if __name__=="__main__":
    main()


Measured memory_bytes: 5612
const main = input => {
  const [A, B] = input.trim().split(' ').map(x => parseInt(x))
  if (A % 2 === 0 || B % 2 === 0) {
    console.log('No')
  } else {
    console.log('Yes')
  }
}
// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29552
fn solve() {
    let s = std::io::stdin();
    let mut sc = Scanner { stdin: s.lock() };
    let n: u32 = sc.read();
    println!("{}", (n + 1) / 2);
}

fn main() {
    std::thread::Builder::new()
        .stack_size(64 * 1024 * 1024) // 64MB
        .spawn(|| solve())
        .unwrap()
        .join()
        .unwrap();
}
pub mod utils {
    const DYX: [(isize, isize); 8] = [
        (0, 1),   //right
        (1, 0),   //down
        (0, -1),  //left
        (-1, 0),  //top
        (1, 1),   //down right
        (-1, 1),  //top right
        (1, -1),  //down left
        (-1, -1), //top left
    ];

    pub fn try_adj(y: usize, x: usize, dir: usize, h: usize, w: usize) -> Option<(usize, usize)> {
        let ny = y as isize + DYX[dir].0;
        let nx = x as isize + DYX[dir].1;
        if ny >= 0 && nx >= 0 {
            let ny = ny as usize;
            let nx = nx as usize;
            if ny < h && nx < w {
                Some((ny, nx))
            } else {
                None
            }
        } else {
            None
        }
    }
}

//snippet from kenkoooo
pub struct Scanner<R> {
    stdin: R,
}

impl<R: std::io::Read> Scanner<R> {
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn read_line(&mut self) -> String {
        use std::io::Read;
        let buf = self
            .stdin
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b'\n' || b == b'\r')
            .take_while(|&b| b != b'\n' && b != b'\r')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 8572
#a, b, k = map(int, input().split( ))
n = int(input())
V = list(map(int, input().split( )))
C = list(map(int, input().split( )))
ans = 0
for i in range(n):
  if V[i] - C[i] >= 0:
    ans += (V[i] - C[i])

print(ans)

Measured memory_bytes: 9040
#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=a;i<b;i+=1)
#define vi vector<int>
using namespace std;

int helper(int n, int w, int *weights, int *values){
	
	int ans[2][w+1];
	rep(i, 0, w+1) ans[0][i] = 0;
	
	int res = 1;
	rep(i, 1, n+1)
	{
		rep(j, 0, w+1)
		{
			if(weights[i-1] <= j) ans[res][j] = max(values[i-1]+ans[res^1][j-weights[i-1]], ans[res^1][j]);
			else ans[res][j] = ans[res^1][j];
		}
		res = res^1;
	}
	return ans[res^1][w];
}

int32_t main(void){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
	
	int n, w;
	cin>>n>>w;
	int *weights = new int[n];
	int *values = new int[n];
	
	rep(i, 0, n) cin>>weights[i]>>values[i];
	cout<<helper(n, w, weights, values)<<endl;
	
	delete [] weights;
	delete [] values;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>//自分より左の数字より必ず小さい
using namespace std;
int main(){
  int n;
  cin>>n;
  int count=0;
  vector<int>vec(n);
  for(int i=0;i<n;i++){
    cin>>vec.at(i);
  }
  int m=vec.at(0);
  for(int i=0;i<n;i++){
    if(m>=vec.at(i)){
      m=vec.at(i);
      count++;
    }
  }
  cout<<count<<endl;
}

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

template<class T,class T2>
ostream &operator<<(ostream &os,const pair<T,T2> &p){ return os << "(" << p.first << "," << p.second << ")"; }

template<class T>
struct FordFulkerson{
	struct Edge{
		int to,rev;
		T cap;
		Edge(int to,T cap,int rev) : to(to),rev(rev),cap(cap){}
	};

	friend ostream &operator<<(ostream &os,const Edge *e){ return os << "(" << e->to << "," << e->cap << ")"; }

	vector<vector<Edge>> G;
	vector<bool> used;
	vector<map<int,int>> ind;

	FordFulkerson(int n) : G(n),used(n),ind(n){}

	void addEdge(int from,int to,T cap,bool isDirected = true,bool isRef = true){
		G[from].emplace_back(to,cap,G[to].size());
		G[to].emplace_back(from,isDirected ? 0 : cap,G[from].size() - 1);
		if(isRef){
			ind[from][to] = G[from].size() - 1;
			ind[to][from] = G[to].size() - 1;
		}
	}

	T dfs(int v,int t,T f){
		if(v == t) return f;
		used[v] = true;
		for(auto &e : G[v]){
			if(!used[e.to] && e.cap){
				T d = dfs(e.to,t,min(f,e.cap));
				if(d){
					e.cap -= d;
					G[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}

	T flow(int s,int t){
		T ret = 0;
		while(1){
			fill(used.begin(),used.end(),0);
			T f = dfs(s,t,numeric_limits<T>::max());
			if(!f) return ret;
			ret += f;
		}
	}
};

signed main(){
	int n,m,q;
	cin >> n >> m >> q;
	FordFulkerson<int> ff(n);
	for(int i = 0;i < m;i++){
		int u,v;
		cin >> u >> v; u--;v--;
		ff.addEdge(u,v,1,false);
	}
	ff.addEdge(0,n - 1,0,true,false);
	int tmpind = ff.G[0].size() - 1;
	int ans = ff.flow(0,n - 1);
	for(int i = 0;i < q;i++){
		int t,u,v;
		cin >> t >> u >> v; u--;v--;
		if(!ff.ind[u].count(v)) ff.addEdge(u,v,0,false);
		if(t == 1){
			ff.G[u][ff.ind[u][v]].cap = 1;
			ff.G[v][ff.ind[v][u]].cap = 1;
			ans += ff.flow(0,n - 1);
		}else{
			int f = ff.G[u][ff.ind[u][v]].cap;
			ff.G[u][ff.ind[u][v]].cap = 0;
			ff.G[v][ff.ind[v][u]].cap = 0;
			if(f != 1){
				if(f == 2) swap(u,v);
				ff.G[0][tmpind].cap = 1;
				fill(ff.used.begin(),ff.used.end(),0);
				ff.dfs(u,v,1);
				f = ff.G[n - 1][ff.G[0][tmpind].rev].cap;
				ff.G[0][tmpind].cap = 0;
				ff.G[n - 1][ff.G[0][tmpind].rev].cap = 0;
				ans += ff.flow(0,n - 1) - f;
			}
		}
		cout << ans << endl;
	}

}


Measured memory_bytes: 5596
#include <bits/stdc++.h>
       
using namespace std;
typedef long long ll;
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; }

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

  sort((A).begin(), (A).end());
  sort((C).begin(), (C).end());

  ll ans = 0;
  for (int i = 0; i < (int)(N); ++i) {
    ll a = distance(A.begin(), lower_bound((A).begin(), (A).end(), B[i]));
    ll c = distance(upper_bound((C).begin(), (C).end(), B[i]), C.end());
    ans += a * c;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1408
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if(a==b):
    print("YES")
    i=1

elif(a<b):
    io = (w*t) + (b-a)
    io = io - (v*t)
    if(io<=0):
        print("YES")

    else:
        print("NO")

elif(a>b):
    io = (w*t) + (a-b)
    io = io - (v*t)
    if( io<=0):
        print("YES")
        
    else:
        print("NO")

else:
    print("NO")


Measured memory_bytes: 9204
n,m = map(int,input().split())
p = []
s = []
for i in range(m):
    P,S = map(str,input().split())
    p.append(int(P))
    s.append(S)
Bool = [0 for i in range(n)]
count = [0 for i in range(n)]

for i in range(m):
    if not Bool[p[i]-1]:
        if s[i] == "WA":
            count[p[i]-1] += 1
        else:
            Bool[p[i]-1] = 1
ans = 0
for i in range(n):
    if Bool[i]:
        ans += count[i]

print(sum(Bool),ans)

Measured memory_bytes: 14972
#include <stdio.h>
#include <math.h>

int isPrime(int);

int main(){
  int n,j_num,r_num,p_num=0;
  int i;

  scanf("%d",&n); //????????\???????????????
  
  for(i=0;i<n;i++){ 
    scanf("%d",&j_num);
    r_num=isPrime(j_num);
    if(r_num==0) p_num++;
  }
  printf("%d\n",p_num);

  return 0;
}

int isPrime(int x){
  int i;
  if(x==2) return 0;
  if(x<2||x%2==0) return 1;
  i=3;
  while(i<=sqrt(x)){
    if(x%i==0) return 1;
    i+=2;
  }
  return 0;
}

Measured memory_bytes: 596
import java.util.*;
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();
		int x = sc.nextInt();
		int ans = 0;

		for(int i=0; i<=a; i++){
			for(int j=0; j<=b; j++){
				for(int k=0; k<=c; k++){
					if(i*500+j*100+k*50==x){
						ans++;
					}
				}
			}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
using namespace std;

int main() {
	IO
	string s;
	cin >> s;
	if (s == "Sunny")
		cout << "Cloudy";
	else if (s == "Cloudy")
		cout << "Rainy";
	else
		cout << "Sunny";
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void) {
    int i;
    int x;

    for(i = 1;;i++ ) {
        scanf("%d", &x);
        if(x == 0) {
            break;
        }

        printf("Case %d: %d\n",i, x);
    }

    return 0;
}

Measured memory_bytes: 1028
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<cstdio>
using namespace std;

static const int INF=100000;
static const int MOD=1000000007;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    int N;
    cin >> N;
    int h[N+1];
    for(int i=0;i<N;i++) cin >> h[i];
    int ma=0;
    for(int i=0;i<N;i++){
        ma=max(h[i],ma);
        if(h[i]>=ma-1){
            continue;
        }else{
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


Measured memory_bytes: 640
import Data.List (tails)

main :: IO()
main = do
    let
        diff :: String -> String -> Int
        diff s t = length . filter not $ zipWith (==) s t
    s <- getLine :: IO String
    let
        l = length s :: Int 
    t <- getLine :: IO String
    let
        m = length t :: Int 
    print . minimum . map (diff t) . take (l - m + 1) . tails $ s

Measured memory_bytes: 3972
N = int(input())
p = list(map(int, input().split()))
for i in range(N-1):
    for j in range(i+1, N):
        q = p[:]
        q[i] = p[j]
        q[j] = p[i]
        if q == list(range(1, N+1)):
            print("YES")
            exit()
if p == list(range(1,N+1)):
    print("YES")
    exit()
print("NO")

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <unordered_map>

using namespace std;
using LL = long long;

#define MOD 1000000007

class RollingHash {
private:
	LL mod(LL x) { return (x % MOD + MOD) % MOD; }
	LL h = 0, w = 0;
public:
	template <class I>
	RollingHash(I first, I last) {
		for (auto it = first; it != last; ++it)
			h = mod(h * 256 + *it), w = w ? mod(w * 256) : 1;
	}
	void roll(char L, char R) { h = mod((h - w * L) * 256 + R); }
	operator int() const { return h; }
};

class Solution {
private:
	template <class T, class F>
	T lowestTrue(T low, T high, F cond) {
		while (low < high) {
			const T mid = low + (high - low) / 2;
			if (cond(mid))
				high = mid;
			else
				low = mid + 1;
		}
		return low;
	}
public:
	/* time: O(n*log(n)), space: O(n) */
	int whoSaysAPun(const string& S) {
		const int n = S.size();
		auto cond = [&](int len) {
			unordered_map<int, int> h;
			/*
			 * Use Rabin-Karp algorithm to achieve O(n) expected time
			 * See LeetCode 28 - Implement strStr()
			 */
			RollingHash curr(S.begin(), S.begin() + len);
			for (int L = 0, R = len - 1; R < n; ++L, ++R) {
				const auto it = h.find(curr);
				if (it != h.end() && L - it->second >= len && !S.compare(it->second, len, S, L, len))
					return false; /* found */
				if (it == h.end())
					h[curr] = L;
				if (R != n - 1)
					curr.roll(S[L], S[R + 1]);
			}
			return true; /* not found */
		};
		return lowestTrue(1, n, cond) - 1;
	}
};

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

	string S;
	cin >> S;

	Solution sol;
	int ans = sol.whoSaysAPun(S);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 544
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))


n=int(input())
l=sorted(lmp())
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i]!=l[j] and l[j]!=l[k] and l[i]+l[j]>l[k]:
                ans+=1
print(ans)

Measured memory_bytes: 73100
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        if (n / 100 == 1) {
            ans += 900;
        } else {
            ans += 100;
        }

        if ((n / 10) % 10 == 1) {
            ans += 90;
        } else {
            ans += 10;
        }

        if (n % 10 == 1) {
            ans += 9;
        } else {
            ans += 1;
        }

        System.out.println(ans);

    }
}


Measured memory_bytes: 24276
n = int(input())
arr = [list(map(int, input().split(' '))) for _ in range(n)]
INF = 0 # int(1e9)
dp = [[INF, INF, INF] for _ in range(n)]
# init
dp[0] = [i for i in arr[0]]

for i in range(1, n):
    for j in range(3):
        for k in range(3):
            if j != k:
                tmp = dp[i-1][k] + arr[i][j]
                if dp[i][j] < tmp:
                    dp[i][j] = tmp

print(max(dp[n-1]))


Measured memory_bytes: 76248
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
li2 = [0,0]
li4 = [0]
for key,value in c.items():
    if value>=4:
        li4.append(key)
    elif value>=2:
        li2.append(key)
li2.sort()
li4.sort()
ans1 = li2[-1]*li2[-2]
ans2 = li4[-1]**2
ans3 = li4[-1]*li2[-1]
ans = max(ans1,ans2)
ans = max(ans,ans3)
print(ans)



Measured memory_bytes: 18600
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int N, Tall; cin >> N >> Tall;
    int res = 0;

    REP(i, N){
        int tmp; cin >> tmp;
        if(tmp >= Tall) res++;
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <algorithm>
#include <math.h>

using namespace std;

int main() {
	int k, s, count = 0;
	cin >> k >> s;
	for (int x = 0; x <= k; x++) {
		for (int y = 0; y <= k; y++) {
			if(s-x-y<=k&&s-x-y>=0){
				count++;
			}
		}
	}
	cout << count << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 100
int main(){
  int kosuu,i,j,A[N],flag=0,count = 0,a,b;
  


  
  scanf("%d",&kosuu);
  for(i = 0;i < kosuu ; i++){
    scanf("%d",&A[i]);
  }
  flag = 1;
  while(flag == 1)
    {
      flag = 0;
      for(j = kosuu-1 ; j >=  1 ; j--)
	{
	  if(A[j] < A[j-1])
	    {
	      a = A[j-1];
	      b = A[j];
	      A[j] = a;
	    
	      A[j-1]=b; 
	      flag = 1;
	      count++;
	    }
	}

    }


  for(i=0;i<kosuu-1;i++){
    printf("%d ",A[i]);
  }
  printf("%d\n%d\n",A[i],count);
	
  return 0;
}



Measured memory_bytes: 2108
#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;

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

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

#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()

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001;

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

    int A, B; cin >> A >> B;
    if (A >= 13) {
        cout << B << endl;
    } else if (A > 5) {
        cout << B/2 << endl;
    } else cout << 0 << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by bqi343

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int f[200005],l[25],p[25],qzh[200005];
signed main() {
	int n,k;
	cin>>n>>k;
	for(int i=1;i<=k;i++){
		cin>>l[i]>>p[i];
	}
	
	f[1]=qzh[1]=1;
	for(int i=2;i<=n;i++){
		for(int j=1;j<=k;j++){
			f[i]+=((qzh[max(i-l[j],0ll)]-qzh[max(i-p[j]-1,0ll)])%998244353+998244353)%998244353;
			f[i]%=998244353;
		}
		qzh[i]=qzh[i-1]+f[i];
		qzh[i]%=998244353;
	}
	cout<<f[n];
	return 0;
}


Measured memory_bytes: 6660
# import sys
# import math #sqrt,gcd,pi
# import decimal
# import queue # queue
# import bisect
# import heapq # priolity-queue
# import time
# from itertools import product,permutations,\
#     combinations,combinations_with_replacement
# 重複あり順列、順列、組み合わせ、重複あり組み合わせ
# import collections # deque
# from operator import itemgetter,mul
# from fractions import Fraction
# from functools import reduce

mod = int(1e9+7)
INF = 1<<29
lINF = 1<<35

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

def main():
    x = int(input())
    g = 100
    ans = 0
    while g<x:
        g = int(g * 1.01)
        ans += 1
    print(ans)
    return

if __name__=='__main__':
    main()

Measured memory_bytes: 9184
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int main()
{
long long int x,y;
cin>>x>>y;
if(x==1&&y==1){
    cout<<"Draw";
    return 0;
}
 else if(x==1){
    cout<<"Alice";
    return 0;}
    else if(y==1){
    cout<<"Bob";
    return 0;}


if(x>y)
    cout<<"Alice";
else if(x<y)
    cout<<"Bob";
else
    cout<<"Draw";


    return 0;
}


Measured memory_bytes: 3596
// AOJ0006
#include<stdio.h>

int main(){
	char in[20];

	int i;

	for(i=0; i<20; i++){
		in[i] = NULL;
	}

	scanf("%s", in);

	for(i=19; i>=0; i--){
		if(in[i] != NULL)
		printf("%c", in[i]);		
	}
	printf("\n");


	return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    
           int n,k;
           cin >>n>>k;

    vector<int> vec(n+1);
  vec[0]=0;
    for (int i = 1; i <= n; i++) {
        cin>> vec.at(i);
    }
for(int i=k;i<=n-1;i++){
if(vec[i-k+1] <vec[i+1])cout<<"Yes"<<endl;
  else cout << "No" <<endl;


}
  
}



Measured memory_bytes: 4048
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
#include<bits/stdc++.h>
#define rall(x) x.rbegin(), x.rend()
#define all(x) x.begin(), x.end()
#define pb push_back
#include <x86intrin.h>
#define pb push_back
using namespace std;
using ll = long long;
using pi = pair<int, int>;
using vi = vector<ll>;
using vpi = vector<pi>;
using ld = long double;
const int maxn = 1e5 + 55, mod = 1e9 + 7;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, t, st = 0, a = 0;
	cin >> n;
	int lst = -(1<<30);
	while(n--) {
		cin >> t;
		if(lst < t) st = -1;
		st++;
		a = max(a, st);
		lst = t;
	}
	cout << a;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e18;
const double PI = 2 * asin(1);
typedef long long ll;


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

  vector <pair<ll, ll> > AB(N);
  for (int i = 0; i < N; i++){
    cin >> AB[i].first >> AB[i].second;
  }
  sort(AB.begin(), AB.end());

  vector <ll> A(N), B(N);
  for (int i = 0; i < N; i++){
    A[i] = AB[i].first;
    B[i] = AB[i].second;
  }
  

  ll DP[N + 1][T + 1];
  for (int i = 0; i < N + 1; i++){
    for (int j = 0; j < T + 1; j++){
      DP[i][j] = 0;
    }
  }
  
  for (int i = 1; i < N + 1; i++){
    
    for (int j = 0; j < T + 1; j++){
      DP[i][j] = DP[i - 1][j];
    }

    if (A[i-1] < T){
      for (int j = A[i-1]; j < T; j++){
        DP[i][j] = max(DP[i][j], DP[i-1][j - A[i-1]] + B[i-1]);
      }
    }
    
    for (int j = 0; j < T; j++){
      if (A[i-1] + j >= T){
        DP[i][T] = max(DP[i][T], DP[i-1][j] + B[i - 1]);
      }
    }
    
    for (int j = 1; j < T + 1; j++){
      DP[i][j] = max(DP[i][j], DP[i][j - 1]);
    }
    
  }

  cout << DP[N][T] << endl;
  
  return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair 
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<=n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)

int main(){
	//input
	ll H,W; cin>>H>>W;
	map<char,ll> m;
	rep(i,H)rep(j,W){
		char x; cin>>x;
		m[x]++;
	}

	//solve
	ll n4=0,n2=0,n1=0;
	for(auto x:m){
		n4+=x.b/4;
		n2+=x.b/2;
		n1+=x.b;
	}

	ll x=(H/2)*(W/2);//n4
	if(x>n4){
		cout<<"No";
	}
	else{
		n2-=2*x;
		n1-=4*x;
		if(H%2==1 && W%2==1){
			ll y=(H/2)+(W/2);//n2
			if(y>n2){
				cout<<"No";
			}
			else{
				cout<<"Yes";
			}
		}
		else if(H%2==0 && W%2==0){
			if(n2==0 && n1==0) cout<<"Yes";
			else cout<<"No";
		}
		else{
			if(W%2==0) swap(H,W);
			//H even
			if(n2==H/2) cout<<"Yes";
			else cout<<"No";
		}
	}
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<pair<int, int>> E(N - 1);
  vector<vector<int>> G(N);
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
    E[i] = make_pair(a, b);
  }
  int cnt = 0;
  map<pair<int, int>, int> color;
  queue<pair<int, int>> que;
  que.push(make_pair(0, 0));
  vector<bool> used(N, false);
  used[0] = true;
  while (!que.empty()) {
    auto q = que.front();
    que.pop();

    int u = q.first, prev = q.second;
    int c = 1;
    for (int v : G[u]) {
      if (used[v]) continue;
      if (c == prev) c++;
      cnt = max(cnt, c);
      que.push(make_pair(v, c));
      used[v] = true;
      color[make_pair(u, v)] = color[make_pair(v, u)] = c++;
    }
  }
  cout << cnt << '\n';
  for (auto e : E) {
    cout << color[e] << '\n';
  }
  return 0;
}


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

using namespace std;

int main()
{
   long n;
   cin>>n;
   long a[n][3],m=INT_MIN,c=0,j=0;
   for(long i=0;i<n;i++){
       for(j=0;j<3;j++){
           cin>>a[i][j];
           
       }
   };
   long s,t;
   for(int i=1;i<n;i++){
       for(int j=0;j<3;j++){
           if(j==0){
               t=std::max(a[i-1][1],a[i-1][2]);
               a[i][j]+=t;
           }
           else if(j==1){
               t=std::max(a[i-1][0],a[i-1][2]);
               a[i][j]+=t;
           }
           else{
               t=std::max(a[i-1][1],a[i-1][0]);
               
               a[i][j]+=t;
           }
       }
   }
   s=std::max({a[n-1][1],a[n-1][2],a[n-1][0]});
   cout<<s;
   return 0;
}

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

int main() {
  int N, A, B;
  cin >> N >> A >> B;
  
  if (N * A < B) {
    cout << N * A << endl;
  }
  else if (N * A == B) {
    cout << N * A << endl;
  }
  else if (N * A > B) {
    cout << B << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string.h>
#include <math.h>
#include <queue>
#include <functional>
const int INF =1e5;
const int MOD = 1e9 + 7;
using namespace std;
typedef pair<int,int> P;
typedef long long lint;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fill(x,y) memset(x,y,sizeof(x))
#define all(x) (x).begin(),(x).end()
#define pb push_back

int main(){
    int n,m;
    cin>>n>>m;
    cout<<(n-1)*(m-1)<<endl;
    
    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m;
    cin>>n>>m;
    if(n>m)
        cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
    return 0;
}


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

using namespace std;

int main(int argc, const char *argv[]) {
  int n;
  cin >> n;

  map<int, int> cnts;
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    cnts[a]++;
  }

  int ans = cnts.size();
  int even_cnt = 0;
  for (auto &p : cnts) {
    bool even = p.second % 2 == 0;
    p.second = even ? 2 : 1;
    even_cnt += even;
  }

  if (even_cnt % 2 == 0) {
    cout << ans << '\n';
  } else {
    cout << ans - 1 << '\n';
  }

  return 0;
}

Measured memory_bytes: 8308
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
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; }
typedef long long ll;
const int INF = 1e9;
const ll mod = 1000000007;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b / gcd(a,b);}

int main() {
    int n,l;
    cin >> n;
    vector<int> vc;
    while(n--) {
        cin >> l;
        vc.push_back(l);
    }
    sort(vc.begin(), vc.end());
    if ( vc[vc.size()-1] < accumulate(vc.begin(), prev(vc.end()), 0)) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }
}


Measured memory_bytes: 256