akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
const int maxn = 200100;
int n, m;
int a[maxn];
bool can(int x)
{
	for(int i = 1; i <= x / 2; i ++)
		if(a[i] + a[x - i + 1] >= m)
			return 1;
	for(int i = x + 1, j = n; i < j; i ++, j --)
		if(a[i] + a[j] < m)
			return 0;
	return 1;
}
int main()
{
	std::ios::sync_with_stdio(false);
	cin >> n >> m;
	n *= 2;
	for(int i = 1; i <= n; i ++)
		cin >> a[i];
	sort(a + 1, a + n + 1);
	/*
	for(int i = 1; i <= n; i ++)
		cout << a[i] << " ";
	cout << endl;
	*/
	int l = 0, r = n;
	while(l < r)
	{
		int mid = (l + r) >> 1;
		if(mid & 1)
			mid --;
		//cout << l << " " << r << " " << mid << endl;
		if(can(mid))
			r = mid;
		else
			l = mid + 2;
	}
	//cout << l << endl;
	int mx = 0;
	for(int i = 1; i <= l / 2; i ++)
		mx = max(mx, a[i] + a[l - i + 1]);
	for(int i = l + 1, j = n; i < j; i ++, j --)
		mx = max(mx, (a[i] + a[j]) % m);
	cout << mx << endl;
	return 0;
}
/*
4 9
5 6 4 8 5 6 3 5 
*/

Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0

	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 3
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}

func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	s := getNextString(scanner)
	n := len(s)
	if n == 7 {
		if s == "keyence" {
			fmt.Fprintln(writer, "YES")
			return
		}
		fmt.Fprintln(writer, "NO")
		return
	}
	ans := make([]string, 2)
	for i := 0; i <= 7; i++ {
		ans[0] = s[0:i]
		ans[1] = s[n-(7-i) : n]
		if strings.Join(ans, "") == "keyence" {
			fmt.Fprintln(writer, "YES")
			return
		}
	}

	fmt.Fprintln(writer, "NO")
}


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

int main() {
	int n,x;
	cin >> n>>x;
	int arr[100];
	for(int i = 0; i < n; i++) {
		cin >> arr[i];
	}
	int ans = 1;
	int sm = 0;
	for(int i = 0; i < n; i++) {
		sm += arr[i];
		if(sm<=x) ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void){

  int	n;
  int	p[20] = {0};
  int	i;
  int	cnt=0;
  
  scanf("%d", &n);
  for(i=0; i<n; i++){ scanf("%d", &p[i]); }
  
  for(i=1; i<n-1; i++){
    if( ((p[i]<p[i-1]) && (p[i]>p[i+1])) || ((p[i]>p[i-1]) && (p[i]<p[i+1])) ){ cnt++; }
  }
  printf("%d",cnt);
  
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007; //998244353;

template<class _T> static void get(_T& a) {
	std::cin >> a;
}
template<class _T> static void get(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void get(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}
template <class _T> static _T tp_abs(_T a) {
	if (a < (_T)0) {
		a *= (_T)-1;
	}
	return a;
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}


static void exec()
{
	int x, a, b;
	get(x, a, b);
	if (tp_abs(a - x) < tp_abs(b - x)) {
		printf("A\n");
	}
	else {
		printf("B\n");
	}
}


Measured memory_bytes: 3656
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        if (b <= a) {
            System.out.println("delicious");
            return;
        }
        if (b-a <= x) {
            System.out.println("safe");
        } else {
            System.out.println("dangerous");
        }

    }
}


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

int main(){
	int a,b;
	cin >> a >> b;
	if(a==1){
		a=a+13;
	}
	if(b==1){
		b=b+13;
	}

	if(a>b){
		cout << "Alice" << endl;
	}else if(b>a){
		cout << "Bob" << endl;
	}else{
		cout << "Draw" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string.h>
#include <algorithm>
#define P pair<int,int>
#define INF (1<<30)
using namespace std;

vector<int> Ind(100010);		//Ind[n]  ??\???n???euler tour??¨??§???????????°?????????
vector<bool> f(100010, false);	//
vector<vector<int>> T(100010);	//??°??????
vector<P> ET;                   //????????¢?´¢??¨

void dfs(int n,int dep) {
	f[n] = true;
	ET.emplace_back(make_pair(dep,n));
	Ind[n] = ET.size() - 1;
	for (int next : T[n]) {
		if (f[next] == true) continue;
		dfs(next,dep + 1);
		ET.emplace_back(make_pair(dep,n));
	}
}

P RMQ(int a, int b, int k, int l, int r, vector<P>& node) {
	if (r <= a || b <= l) {return P(INF, INF); }
	if (a <= l && r <= b) return node[k];

	P vl = RMQ(a, b, 2 * k + 1, l, (l + r) / 2,node);
	P vr = RMQ(a, b, 2 * k + 2, (l + r) / 2, r, node);
	return min(vl, vr);
}

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	//Graph initialize
	int n_; cin >> n_;
	for (int i = 0; i < n_; i++) {
		int k; cin >> k;
		for (int j = 0; j < k; j++) {
			int c; cin >> c;
			T[i].emplace_back(c);
			T[c].emplace_back(i);
		}
	}
	//ET??¨?????????
	dfs(0,0);

	//RMQ initialize
	n_ = ET.size();

	int n = 1;
	while (n < n_) n *= 2;
	vector<P> node(2 * n - 1, P(INF, INF));

	for (int i = 0; i < n_;i++) { node[n - 1 + i] = ET[i]; }
	for (int i = n - 2; i >= 0; i--) { node[i] = min(node[2 * i + 1], node[2 * i + 2]); }

	//Answer
	int q; cin >> q;
	for (int i = 0; i < q; i++) {
		int u, v; cin >> u >> v;
		int a = Ind[u], b = Ind[v];
		if (a > b) { swap(a, b); }
		if (a == b) { cout << u << endl; continue; }
		cout << RMQ(a,b+1, 0, 0, n, node).second << endl;
	}
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

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

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

  int x;
  cin >> x;
  if (x < 1200) {
    cout << "ABC" << endl;
  } else {
    cout << "ARC" << endl;
  }

  return 0;
};


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

string s;

int compute(int i){

  int cnt = 1;

  if( i+1 >= s.size() )return cnt;
  if( s[i+1] == 'O'){
    cnt += compute(i+1); 
  }

  return cnt;
}


int main(void){

  while( cin >> s ){

    int lev = 0;
    int a = 0,c = 0,C = 0;
    int temp_O,temp_I;
    int ans = 0;
    for( int i = 0 ; i < s.size() ; i++ ){
      if( s[i] == 'O' ){
	a = compute(i);
	//	cout <<"---" << a << "---" << endl;
	temp_O = a;
	temp_I = a;
	c = C = a;

      }
      if( a > 0 ){
	int j = 1;
	while(temp_O--){
	  if( s[i-j] == 'J'){
	    if(i-j < 0){
	      i += a;
	      continue;
	    }
	    c--;
	    //cout << "J" ;
	    j++;
	  }
	}
	j = C;
	while(temp_I--){
	  if( s[i+j] == 'I'){
	    if(i+j >= s.size() ){
	      continue;
	      i += a;
	    }
	    C--;
	    j++;
	    //cout << "O";
	  }
	}
	if( c == 0 && C == c ){
	  // cout << "ok" << endl;
	  ans = max( ans , a );
	} 
      }
      i += a;
      a = 0;
    }
  cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 2052
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
using namespace std;
int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int ans = min(a,b);
  int ans1 = min(c,d);
  cout << ans+ans1 << endl;
  return 0;
}


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

int main(){
  string S,T;
  cin>>S>>T;
  for(int i=0;i<S.length();i++){
  rotate(S.begin(),S.begin()+1,S.end());
  if(S==T){
    cout<<"Yes"<<endl;
    return 0;
  }
  }
  cout<<"No"<<endl;
  

 
  return 0;
}
 



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
	int n,sum;
	while(scanf("%d",&n)!=EOF)
	{
//		for(int i=1;i<=n;i++)
//		{
//			sum+=i;
//		}	
		sum=n*(n+1)/2;
		cout<<sum<<endl;
	}
	return 0;
	
 } 

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <limits>
#include <numeric>
#include <algorithm>
#include <functional>

using namespace std;

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

	int A, B, T;
	cin >> A >> B >> T;

	cout << T / A * B;

	return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int D;
    cin >> D;
    if(D == 24) cout << "Christmas Eve" << endl;
    else if(D == 23) cout << "Christmas Eve Eve" << endl;
    else if(D == 22) cout << "Christmas Eve Eve Eve" << endl;
    else cout << "Christmas" << endl;
}


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

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

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

int main(){
    int N,ANS=0;
    cin>>N;
    vector<int> A(N);
    rep(i,N)cin>>A[i];
    map<int,int> O;
    map<int,int> E;
    for(int i=0;i<N;i++){
        if(i%2==0){
            E[A[i]]++;
        }else{
            O[A[i]]++;
        }
    }
    int numO=0,numE=0,CE=0,CO=0,Ose,Ese,CEse,COse;
    for(auto x:E){
        if(x.second>=CE){
            Ese=numE,CEse=CE;
            numE=x.first,CE=x.second;
        }
    }
    for(auto x:E){
        if(x.first!=numE&&CEse<x.second){
            Ese=x.first,CEse=x.second;
        }
    }
    for(auto x:O){
        if(x.second>=CO){
            Ose=numO,COse=CO;
            numO=x.first,CO=x.second;
        }
    }
    for(auto x:O){
        if(x.first!=numO&&COse<x.second){
            Ose=x.first,COse=x.second;
        }
    }
    N/=2;
    int a,b;
    if(numE==numO){
        a=N-CO+N-CEse;
        b=N-CE+N-COse;
        ANS=min(a,b);
    }else{
        ANS=N*2-(CO+CE);
    }
    cout<<ANS<<endl;
    return 0;
}

//a=97,z=122

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

int main(){
    int n;
    cin >> n;
    vector<int> ans(n);
    rep(i,n-1){
        int a;
        cin >> a;
        a--;
        ans[a]++;
    }
    rep(i,n) cout << ans[i] << endl;
    return 0;
    
}

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

int main() {
	int h,k;
	cin>>h>>k;
	int arr[h]={0};
	for(int i=0;i<h;++i)
	{
		cin>>arr[i];
	}
	sort(arr,arr+h);
	int p=k;
	for(int i=h-1;i>=0;--i)
	{
		if(p==0)
		break;
		arr[i]=0;
		--p;
	}
	long long int total=0;
	for(int i=0;i<h;++i)
	{
		total+=arr[i];
	}
	cout<<total<<"\n";
	return 0;
}

Measured memory_bytes: 1024
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

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

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)
const ll N = 100009;
struct data
{
    ll val,type;
    data()
    {
        ;
    }
    data(ll x,ll y)
    {
        val = x;
        type =  y;
    }
};
vector<data> v;
bool cmp(data x,data y)
{
    return x.val>y.val;
}
int main()
{
    ll i,n,t,k,j,x=0,y=0,m,p,q,r;
    cin>>x>>y>>p>>q>>r;
    for(i=1;i<=p;i++)
    {
        cin>>n;
        v.pb(data(n,1));

    }
    for(i=1;i<=q;i++)
    {
        cin>>n;
        v.pb(data(n,2));

    }
    for(i=1;i<=r;i++)
    {
        cin>>n;
        v.pb(data(n,0));

    }
    sort(v.begin(),v.end(),cmp);
    ll cnt = 0;
    ll ans = 0;
    for(i=0;i<v.size() && x+y>cnt;i++)
    {
        //cout<<v[i].val<<" "<<v[i].type<<endl;
        //cout<<x<<" "<<y<<" "<<cnt<<endl;
        if(v[i].type==0)
        {
            cnt++;
            ans+= v[i].val;
        }
        else if(v[i].type==1 && x>0)
        {
            ans+= v[i].val;
            x--;
        }
        else if(v[i].type==2 && y>0)
        {
            ans+= v[i].val;
            y--;
        }
    }
    cout<<ans<<endl;
    return 0;
}



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

int main() {
	int A, B;
	cin >> A >> B;
	string ans = "No";
	for (int i = 1; i<=3; i++){
		if (A*B*i%2 == 1) ans = "Yes";
	}
	cout << ans << endl;
	return 0;
}


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

int a[100005];
int box[100005];
int main()
{
    int n;
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
        box[a[i]]++;
    }
    int ans = 0;
    for(int i = 1;i <= 100000;i++)
    {
        int cnt = box[i - 1] + box[i] + box[i + 1];
        ans = max(ans , cnt);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 1024
import bisect
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
A=[0]
for i in range(n):
  A.append(a[i]+A[-1])
l=0;r=10**10+1
while r-l>1:
  x=(l+r)//2
  ct=0
  for i in range(n):
    ct+=n-bisect.bisect_left(a,x-a[i])
  if ct<m:
    r=x
  else:
    l=x
ans=0
ct2=0
for i in range(n):
  y=bisect.bisect_left(a,l-a[i])
  ans+=A[n]-A[y]
  ans+=a[i]*(n-y)
  ct2+=n-y
print(ans-l*(ct2-m))

Measured memory_bytes: 58724
#include <iostream>
#include <stdio.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#define rep(i,cc,n) for(int i=cc;i<=n;++i)
#define drep(i,cc,n) for(int i=cc;i>=n;--i)
typedef long long ll;
using namespace std;
const ll INF = 100000000000000000;

int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a==c&&a!=b) cout<<"Yes"<<endl;
    else if(a==b&&a!=c) cout<<"Yes"<<endl;
    else if(b==c&&b!=a) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define mp make_pair
#define fi first
#define sc second
ll n;
int main(){
	cin >> n;
	ll k = 1;
	while(k <= n) {
		k *= 2;
	}
	cout << k / 2 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <stdexcept>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define debug(a) cout << (a) << endl
namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
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 (a > b)
	{
		a = b;
		return 1;
	}
	return 0;
}

ll M = 1000000007;

void solve()
{
	int x,y;
	cin>>x>>y;
	rep(i,x+1){
		int tmp=i*2+(x-i)*4;
		if(tmp==y){
			cout<<"Yes"<<endl;
			return ;
		}
	}
	cout<<"No"<<endl;
}

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


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

class DSU {
private:
    int size;
    vector<int> parent;
    vector<int> rank;
public:
    DSU(int n) : size(n) {
        for (int i = 0; i <= n; i++) {
            parent.push_back(i);
            rank.push_back(1);
        }
    }

    int find(int a) {
        if (a != parent[a]) {
            parent[a] = find(parent[a]);
        }
        return parent[a];
    }

    bool merge(int a, int b) {
        int pa = find(a);
        int pb = find(b);
        if (pa == pb)
            return false;

        if (rank[pa] < rank[pb]) {
            parent[pa] = parent[pb];
            rank[pb] += rank[pa];
        } else {
            parent[pb] = parent[pa];
            rank[pa] += rank[pb];
        }
        return true;
    }

};

int main() {
    int n, m, u, v;
    unordered_set<int> comp;

    cin >> n >> m;
    DSU dsu(n);

    for (int i = 0; i < m; i++) {
        cin >> u >> v;
        dsu.merge(u, v);
    }

    for (int i = 1; i <= n; i++) {
        comp.emplace(dsu.find(i));
    }

    cout << comp.size()-1;
    return 0;
}


Measured memory_bytes: 7444
#include<bits/stdc++.h>
using namespace std;
int a[3];
int sum5,sum7;
int main()
{
    for(int i=1;i<=3;i++){
        scanf("%d",&a[i]);
        if(a[i]==5)
            sum5++;
        else if(a[i]==7)
            sum7++;
    }
    if(sum5==2&&sum7==1)
        printf("YES");
    else
        printf("NO");
    return 0;
}

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

using namespace std;

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}


typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
//#define pll pair<ll,ll>
#define pll pair<unsigned long long, unsigned long long>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0, -1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
//#define mp make_pair


int main() {
  int n;
  cin >> n;
  vi a(n);
  int sum = 0;
  rep (i, n) {
    cin >> a[i];
    sum += a[i];
  }
  if (n == 1) {
    cout << sum << endl;
    return 0;
  }
  bitset<4000001> dp;
  dp[0] = true;
  rep (i, n) {
    auto temp = dp << a[i];
    dp |= temp;
  }
  if (sum % 2 == 0 && dp[sum / 2]) {
    cout << sum / 2 << endl;
  }
  else {
    for (int i = sum / 2 + 1; i <= 4000000; i++) {
      if (dp[i]) {
        cout << i << endl;
        return 0;
      }
    }
  }
  
}


Measured memory_bytes: 1664
N,K=map(int, input().split())
S=str(input())

LETTERS="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
letters="abcdefghijklmnopqrstuvwxyz"

ind = LETTERS.index(S[K-1])

if K==1:
  print(letters[ind]+S[1:N])
elif K==N:
  print(S[0:N-1]+letters[ind])
else:
  print(S[0:K-1]+letters[ind]+S[K:N])

Measured memory_bytes: 3064
package main

import (
	"fmt"
)

func main() {
	var a, b int
	fmt.Scan(&a, &b)

	cnt := 0
	for n := a; n <= b; n++ {
		n1 := n % 10
		n2 := n / 10 % 10
		n4 := n / 1000 % 10
		n5 := n / 10000 % 10
		if n1 == n5 && n2 == n4 {
			cnt++
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 512
public class Main {
	public static void main(String[] args) {
		int inputSecond	= new java.util.Scanner(System.in).nextInt();
		
		int second	= inputSecond % 60;
		int minute	= inputSecond / 60;
		minute		= minute % 60;
		int hour	= inputSecond / (60*60);
		
		System.out.println( hour + ":" + minute + ":" + second );
	}
}

Measured memory_bytes: 17160
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 1000000007
  #define N 1000001
  




int32_t main()
{




  int a,b;
  cin >> b>> a;

  int x = a*10;

  bool ok = 0;
  int ans;
  while(x/10 == a)
  {
    if((8*x)/100 == b)
    {
      ok = 1;
      ans = x;
      break;
    }
    x++;
  }

  if(ok)
  {
    cout << ans;
  }
  else
  {
    cout << -1;
  }


    return 0;
}

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

int selectionSort(int, int[]);

int main(void){
	static int A[100];
	int N;
	cin >> N;

	for (int i = 0; i < N; i++){
		cin >> A[i];
	}

	int ans = selectionSort(N, A);
	for (int i = 0; i < N; i++){
		if (i){
			cout << " ";
		}
		cout << A[i];
	}
	cout << endl;

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

int selectionSort(int N, int A[]){
	int ans = 0;

	for (int i = 0; i < N; i++){
		int minj = i;
		for (int j = i; j < N; j++){
			if (A[minj]>A[j]){
				minj = j;
			}
		}
		if (minj != i){
			swap(A[minj], A[i]);
			ans++;
		}
	}
	return ans;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
double choiced[200001];
double add[200001];
using namespace std;
bool cmp(double a,double b)
{
	return a>b;
}
int main()
{
	int n,k,i,j;
	memset(add,0,sizeof(add));
	double p,x,count=0;
	scanf("%d %d",&n,&k);
	for(i=1;i<=n;i++)
	{
		scanf("%lf",&p);
		x=(1+p)/2.0;
		choiced[i]=x;
		if(i==k)
		{
			for(j=0;j<k;j++)
			{
				add[i]+=choiced[i-j];
			}
		}
		else if(i>k)
		add[i]=add[i-1]-choiced[i-k]+choiced[i];
	}
	double o=0;
	for(i=k;i<=n;i++)
	{
		if(add[i]>o)
		{
			o=add[i];
		}
	}
	printf("%.12lf",o);
}

Measured memory_bytes: 3328
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Security.Policy;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const char White = '.';
    const char Black = '#';
    const long Mod = 1000000007;

    static void Main(string[] args) {
        checked {
#if DEBUG
            MyDebugger.Test(process, "../TextFile1.txt");
            //TestCaseMaker.MakeTestCase1("../TextFile2.txt");
            //MyDebugger.Test(process, "../TextFile2.txt");
#else
            object ret = process(new StreamReader(Console.OpenStandardInput()));
            Console.WriteLine(ret);
#endif
        }
    }

    static object process(TextReader input) {
        var spl = input.ReadLine().Split(' ');
        var n = int.Parse(spl[0]);
        var m = int.Parse(spl[1]);
        var k = long.Parse(spl[2]);

        var aa = ToIntArray(input.ReadLine(), n);
        var bb = ToIntArray(input.ReadLine(), m);

        var aaa = new long[n];
        var bbb = new long[m];

        aaa[0] = aa[0];
        for(int i=1; i<n; i++) {
            aaa[i] = aaa[i - 1] + aa[i];
        }

        bbb[0] = bb[0];
        for (int i = 1; i < m; i++) {
            bbb[i] = bbb[i - 1] + bb[i];
        }

        int ai = n;
        int bi = 0;

        long max = 0;

        while (true) {
            var a = ai > 0 ? aaa[ai-1] : 0;
            //var b = bi > 0 ? bbb[bi-1] : 0;

            if(a > k){
                ai--;
                continue;
            }

            while(bi < m) {
                var b = bbb[bi+1-1];
                if(a + b > k) {
                    break;
                }
                bi++;
            }

            //Debug.WriteLine($"{ai}:{bi}");

            max = Math.Max(max, ai+bi);

            if(ai==0) break;
            else ai--;
        }

        return max;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        if(n == 0) return ret;
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 72336
#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second

inline int read()
{
    char ch=getchar();
    int x=0,f=1;
    while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
    return x*f;
}

int n,tree[26][500005];

int lowbit(int x)
{
	return x&(-x);
 } 
 
void add(int x,int k,int tr)
{
	while(x<=n)
	{
		tree[tr][x]+=k;
		x+=lowbit(x);
	}
}

int sum(int x,int tr)
{
	int ans=0;
	while(x>0)
	{
		ans+=tree[tr][x];
		x-=lowbit(x);
	}
	return ans;
}

signed main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin>>n;
	string s;
	cin>>s;
	for(int i=0;i<n;i++)
	{
		add(i+1,1,s[i]-'a');
	}
	int t;
	cin>>t;
	int x,y,z;
	char c;
	while(t--)
	{
		cin>>x;
		if(x==1)
		{
			cin>>y>>c;
			add(y,-1,s[y-1]-'a');
			add(y,1,c-'a');
			s[y-1]=c;
		}
		else if(x==2)
		{
			cin>>y>>z;
			int ans=0;
			for(int i=0;i<26;i++)
			{
				if(sum(z,i)>sum(y-1,i))
				{
					ans++;
				}
			}
			cout<<ans<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 51740
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>

typedef long long ll;
using namespace std;

int main(){
  int a,b,c,d,ans=0;
  cin >>a>>b;
  for(int i=a;i<=b;i++){
  	c=i-(i%10000);
  	d=i%10;
  	if(c/10000==d){
  		if((i-(i%1000)-c)/100==i%100-d){
  			ans++;
  		}
  	}
  }
  cout << ans << endl;
  return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()
#define X first
#define Y second

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


const double PI = 3.14159265358979;

void solve()
{
  ll n, a, b, c, d;
  cin >> n;
  vector<P> red(n);
  vector<P> blue(n);
  vector<bool> r_used(n, false);
  for(int i = 0; i < n; ++i)
  {
    cin >> a >> b;
    red[i] = P(a, b);
  }
  for(int i = 0; i < n; ++i)
  {
    cin >> c >> d;
    blue[i] = P(c, d);
  }

  sort(ALL(red));
  sort(ALL(blue));

  int ans = 0;  
  for(int i = 0; i < n; ++i)
  {
    int rj = -1;
    for(int j = 0; j < n; ++j)
    {
      if (r_used[j]) continue;
      if (red[j].X < blue[i].X && red[j].Y < blue[i].Y)
      {
        if ((rj == -1) || red[rj].Y < red[j].Y)
        {
          rj = j;
        }
      }
    }
    if (rj != -1)
    {
      r_used[rj] = true;
      ans++;
    }
  }
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3616
#include <cstdio>
 
int a[15000];
 
int main()
{
    int N, min = 99999999, max = -99999999;
    long long int sum = 0;
 
    scanf(" %d", &N);
 
    for (int i = 0; i < N; ++i)
    {
        scanf(" %d", &a[i]);
    }
 
    for (int i = 0; i < N; ++i)
    {
        sum += a[i];
        if (max < a[i]) {
            max = a[i];
        }
        if (min > a[i]) {
            min = a[i];
        }
    }
 
    printf("%d %d %lld\n", min, max, sum);
 
    return 0;
}

Measured memory_bytes: 2720
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int n, k; scanf("%d%d", &n, &k);
	std::vector<std::vector<i64>> dp(n + 1, std::vector<i64>(k + 1, 0));
	for(int i = 0; i < n; i++) {
		i64 a, b; scanf("%lld%lld", &a, &b);
		for(int j = 0; j <= k; j++) dp[i + 1][j] = dp[i][j];
		for(int j = 0; j < k; j++) {
			if(j + a > k) break;
			dp[i + 1][j + a] = std::max(dp[i + 1][j + a], dp[i][j] + b);
		}
	}
	
	i64 ans = 0;
	for(auto v : dp[n]) ans = std::max(ans, v);
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 80256
C = input()

# 数値(1〜26)→アルファベット(A〜Z)
num2alpha = lambda c: chr(c+64)

# アルファベット(A〜Z)→数値(1〜26)
alpha2num = lambda c: ord(c) -ord('A') + 1

i = alpha2num(C.upper()) + 1
ans = num2alpha(i)
print(ans.lower())


Measured memory_bytes: 3060
def main():
     n=int(input())
     p=list(map(int,input().split()))
     cnt=0
     for i in range(1,n-1):
          if p[i-1]<p[i] and p[i]<p[i+1]:
               cnt+=1
          elif p[i-1]>p[i] and p[i]>p[i+1]:
               cnt+=1
     print(cnt)
          
if __name__=='__main__':
     main()

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

/* define const */

/* finish defineing const */

string s;

int main()
{
    cin >> s;
    int a = 0;
    int b = s.length() - 1;

    while (s[a++] != 'A')
        ;
    a--;
    while (s[b--] != 'Z')
        ;
    b++;
    cout << b - a + 1 << endl;
}


Measured memory_bytes: 640
#include<stdio.h>

int main(void)
{
    int S;
    int h, m, s;

    scanf("%d", &S);
    s = S % 60;
    h = (S - s) / 3600;
    m = (S - s) / 60 - h * 60;

    printf("%d:%d:%d\n", h, m, s);

    return 0;
}

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

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
using Graph = vector<vector<int>>;
queue<int> quex,quey;

int main(){
    int a,b=0,c,d;    //cin >> a ;
    vector<int>v(a);
    vector<int>w(a);
    vector<int>x(a);


    string s,t; cin >> s >> t;
    cout << t+s << endl;

    
}

Measured memory_bytes: 256
//#define NDEBUG
#define _CRT_SECURE_NO_WARNINGS
#include <cstddef>
#include <cstdint>

template <class T> const T &as_const(const T &v) noexcept { return v; }
class rep {
	const ::std::size_t f, l;

public:
	using value_type = ::std::size_t;
	using reference = value_type;
	class repitr {
		friend rep;
		value_type i;
		repitr(value_type x) noexcept : i(x) {}

	public:
		void operator++() noexcept { ++i; }
		reference operator*() const noexcept { return i; }
		bool operator!=(const repitr x) const noexcept { return i != x.i; }
	};
	explicit rep(value_type first, value_type last) noexcept
		: f(first), l(last) {}
	repitr begin() const noexcept { return repitr(f); }
	repitr end() const noexcept { return repitr(l); }
};
template <class T> bool maxi(T &a, const T &b) {
	return a <= b ? (a = b, 1) : 0;
}
template <class T> bool mini(T &a, const T &b) {
	return b <= a ? (a = b, 1) : 0;
}
template <class T> bool smaxi(T &a, const T &b) {
	return b <= a ? 0 : (a = b, 1);
}
template <class T> bool smini(T &a, const T &b) {
	return a <= b ? 0 : (a = b, 1);
}

using i32 = ::std::int_least32_t;
using i64 = ::std::int_least64_t;
using u32 = ::std::uint_least32_t;
using u64 = ::std::uint_least64_t;

#include <algorithm>
#include <iostream>
#include <utility>
#include <vector>

template <class T> using vec_alias = ::std::vector<T>;

struct edge {
	u32 from, to, cost;
	edge(u32 a,u32 b,u32 c):from(a),to(b),cost(c){}
};

int main() {
	::std::vector<edge> e;
	u32 l, r = 0;

	::std::cin >> l;
	u32 n = 0;
	while ((1 << n) <= l)
		++n;
	--n;
	const auto n_ = n + 1;
	::std::cout << n + 1 << " ";
	for (const auto i : rep(0, n)) {
		e.emplace_back(i + 1,i + 2,0 );
		e.emplace_back(i + 1, i + 2, 1 << i);
	}
	r += 1 << n;
	l -= 1 << n;
	while (~n && 1 << n > l)
		--n;
	while (~n) {
		e.emplace_back(n + 1, n_, r);
		l -= 1 << n;
		r += 1 << n;
		while (~n && 1 << n > l)
			--n;
	}
	::std::cout << e.size() << "\n";
	for (const auto &v : e) {
		::std::cout << v.from << " " << v.to << " " << v.cost << "\n";
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s,t;
vector<vector<int>> dp;
string lcs(){
    string res = "";
    for(int i=1;i<=s.size();i++){
        for(int j=1;j<=t.size();j++){
            if(s[i-1]==t[j-1])
                dp[i][j] = dp[i-1][j-1]+1;
            else dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
        }
    }
    int i=s.size(),j=t.size();
    while(i>0&&j>0){
        if(s[i-1]==t[j-1]){
            res+=s[i-1];
            i--;j--;
        }else if(dp[i-1][j]>dp[i][j-1]){
            i--;
        }else{
            j--;
        }
    }
    reverse(res.begin(),res.end());
    return res;
}
int main(){
    cin>>s>>t;
    dp = vector<vector<int>>(s.size()+1,vector<int>(t.size()+1,0));
    cout<<lcs()<<"\n";
    return 0;
}

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

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

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

    // start
    int a, b;
    cin >> a >> b;
    if (a == 1)
        a = 14;
    if (b == 1)
        b = 14;
    cout << (a == b ? "Draw" : (a > b ? "Alice" : "Bob")) << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main () {
    int n;
    scanf("%d", &n);
    char str[n];
    scanf("%s", &str);
    
    if (n % 2 != 0) {
        printf("No");
        return 0;
    }
    
    for (int i = 0; i < n / 2;i++) {
        if (str[i] != str[n / 2 + i]) {
            printf("No");
            return 0;
        }
    }
    printf("Yes");
    return 0;
}

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

int main()
{
	string s,t,s1;
	int ans=-1000;
	cin>>s>>t;
	if (t.size()>s.size())
	{
		cout <<"UNRESTORABLE";
		return 0;
	}
	for(int j=0;j<s.size()-t.size()+1;j++)
	{
		int f=0;
		s1=s.substr(j,t.size());
		for(int i=0;i<t.size();i++)
		{
			if(s1[i]!=t[i])
			f=1;
		}
		if(f==0)
		{
			for(int i=0;i<s.size();i++)
			{
				if(s[i]=='?') s[i]='a';
			}
			cout<<s;
			return 0;
		}
	}
	for(int i=s.size()-t.size();i>=0;i--)
	{
		int F=1;
		if(t[0]==s[i]||s[i]=='?')
		{
			F=0;
			for(int j=i;j<i+t.size();j++)
			{
				if(!(s[j]==t[j-i]||s[j]=='?'))
				{
					F=1;
					break;
				}
			}
		}
		if(F==0)
		{
			ans=i;
			break;
		}
	}
	if(ans==-1000)
	{
		cout<<"UNRESTORABLE";
		return 0;
	}
	for(int i=ans;i<ans+t.size();i++)
	{
		s[i]=t[i-ans];
	}
	for(int i=0;i<s.size();i++)
	{
		if(s[i]=='?') s[i]='a';
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 3628
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;


int main(){
	int n,m,l;
	cin>>n>>m>>l;
	vector<vector<pair<ll,ll>>> d(n,vector<pair<ll,ll>>(n,{longinf,0}));
	rep(i,m){
		int x,y,z;
		cin>>x>>y>>z;
		--x;--y;
		if(z<=l){
			d[x][y]={0,z};
			d[y][x]={0,z};
		}
	}
	rep(i,n)d[i][i]={0,0};
	vector<vector<pair<ll,ll>>> dist(n,vector<pair<ll,ll>>(n,{longinf,inf}));
	rep(i,n)dist[i][i]={0,0};
	rep(i,n){
		using T = pair<pair<ll,ll>, int>;
		priority_queue<T,vector<T>,greater<T>> pq;
		pq.push({{0,0},i});
		while(pq.size()){
			auto t = pq.top();pq.pop();
			if(dist[i][t.second]!=t.first)continue;
			int c = t.second;
			pair<ll,ll> di=t.first;
			rep(j,n){
				if(d[c][j].first==longinf)continue;
				pair<ll,ll> nxt=di;
				if(di.second+d[c][j].second>l){
					nxt.first+=1;
					nxt.second=d[c][j].second;
				}
				else nxt.second+=d[c][j].second;
				if(dist[i][j]>nxt){
					dist[i][j]=nxt;
					pq.push({nxt,j});
				}
			}
		}
	}
	int q;
	cin>>q;
	while(q--){
		int x,y;
		cin>>x>>y;
		--x;--y;
		cout<<(dist[x][y].first>=longinf?-1:dist[x][y].first)<<endl;
	}
	return 0;
}


Measured memory_bytes: 4584
#include  <iostream>
#include  <vector>
#include  <string>
#include  <algorithm>

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

using namespace std;

int main()
{
	string s;
	cin >> s;

	vector <int> ans(s.size());
	rep(ri,2){
		{
			int cnt = 0;
			rep(i, s.size()) {
				if (s[i] == 'R')  cnt++;
				else {
					ans[i] += cnt / 2;
					ans[i - 1] += (cnt + 1) / 2;
					cnt = 0;
				}
			}
		}
		reverse(ans.begin(), ans.end());
		reverse(s.begin(), s.end());
		rep(i, s.size()) {
			if (s[i] == 'R')  s[i] = 'L';
			else  s[i] = 'R';
		}
	}

	rep(i, s.size()) {
		if (i)  cout << ' ';
		cout << ans[i];
	}
	cout << endl;
}

Measured memory_bytes: 1024
from sys import stdin


def spam(N):
    count = 0
    for i in range(1, N + 1):
        if N % i == 0:
            count += 1
    return count


def main():
    N = int(stdin.readline().rstrip())
    count = 0
    for i in range(1, N + 1, + 2):
        if spam(i) == 8:
            count += 1
    print(count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		int n = scanner.nextInt();
		long ans = 1 ;
		long[] a = new long[n];
		long max = (long)Math.pow(10, 18);

		for(int i=0 ; i<n ; i++) {
			 a[i] = scanner.nextLong();
		}

		for(int i=0 ; i<n ; i++) {
			if(a[i]==0) {
				ans = 0;
				break;
			}else if(a[i] > (max/ans)) {
				ans = -1;
			}else {
				ans *= a[i];
			}

		}

		System.out.println(ans);

		scanner.close();

	}

}


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

int main(void)
{
    int A, B;
    cin >> A >> B;
    if(A%3==0 or B%3==0 or (A+B)%3==0)
        cout << "Possible" << endl;
    else
        cout << "Impossible" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

static const long long MOD = 1000000007;
static const long long MAX = 100005;

int main(void) {
  string s;
  cin >> s;
  
  int l = 1, r = sz(s)+1;
  while (r-l>1) {
    int m = (r+l)/2;
    bool ok = true;
    for (int i=sz(s)-m; i<m-1; i++) if (s[i]!=s[i+1]) ok = false;
    if (ok) l = m;
    else r = m;
  }
    cout << l << endl;

    return 0;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){return o<<"("<<p.fs<<","<<p.sc<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
const int MN = 210000;
int b[MN];
int dp[MN];
map<int,int> mp;

int main(){
	string s;
	cin>>s;
	int N = s.size();
	rep(i,N) b[i+1] = b[i] ^ (1<<(s[i]-'a'));

	rep1(i,N){
		if(!mp.count(b[i-1])){
			mp[b[i-1]] = dp[i-1];
		}else{
			if(mp[b[i-1]]>dp[i-1]){
				mp[b[i-1]] = dp[i-1];
			}
		}
		int x = b[i];
		dp[i] = 1e9;
		rep(j,27){
			int y = (j<26 ? x ^ (1<<j) : x);
			if(mp.count(y)){
				chmin(dp[i],mp[y]+1);
			}
		}
	}
	cout<<dp[N]<<endl;
}


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

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

    int x=X/100,y=X%100;
    if(y>x*5){
        cout<<0<<endl;
        return 0;
    }else{
        for(int a=0;a<x;a++){
            for(int b=0;b<=x;b++){
                for(int c=0;c<=x;c++){
                    for(int d=0;d<=x;d++){
                        for(int e=0;e<=x;e++){
                            if(a+2*b+3*c+4*d+5*e==y){
                                cout<<1<<endl;
                                return 0;
                            }
                        }
                    }
                }
            }
        }
    }
}

Measured memory_bytes: 256
/*
	*#*#*#* Author GaryMr *#*#*#*
	二分？左闭右开？
	long long？
	逆向思维？
	dp？
	贪心？
	匹配括号 左减右>=0
	多组数据清空？
	dp优化用g？
	线段树：左闭右开！
	线段树：find： if(l>=b||r<=a) return 0x3f3f3f3f; if(r<=b&&l>=a) return tree[k];
	线段树：满二叉树 
	循环跳出条件 
	代数设出每个值寻找关系？
	优先队列：priority_queue<类型> q;   
	priority_queue<类,vector<类>, less<类> > pq1; 　　　 // 使用递减	
	priority_queue<类，vector<类>, greater<类> > pq2; 　　// 使用递增
*/
#include<bits/stdc++.h>
using namespace std;
const int MAX=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int n;
int dp[200001][2];
string s;
int main(){
	scanf("%d",&n);
	cin>>s;
	memset(dp,0x3f,sizeof(dp));
	if(s[0]=='.') {
	dp[0][0]=0;
	dp[0][1]=1;
	}
	else {
	dp[0][1]=0;
	dp[0][0]=1;	
	}
	for(int i=1;i<n;i++){
		if(s[i]=='.'){
			dp[i][0]=dp[i-1][0];
			dp[i][1]=min(dp[i-1][1],dp[i-1][0])+1;
		}
		else{
			dp[i][1]=min(dp[i-1][1],dp[i-1][0]);
			dp[i][0]=dp[i-1][0]+1; 
		}
	}
	printf("%d\n",min(dp[n-1][1],dp[n-1][0]));
	return 0;
}

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

#include <vector>
#include <algorithm> // sort
#include <map> // pair

int main(void){
    
    while(1){
        int N;
        long long M;
        cin >> N >> M;
        vector<pair<int,int> > DP(N);
        int result=0;
        if (N==0) break;
        for(int i=0; i<N; i++){
            cin >> DP[i].second >> DP[i].first;
        }
        sort(DP.begin(), DP.end());
        for(int i=N-1; i>=0; i--){
            if (M >= DP[i].second) {
                M -= DP[i].second;
            } else {
                result += (DP[i].second - M) * DP[i].first;
                M = 0;
            }
        }
        cout << result << endl;
    }
    
    
}

Measured memory_bytes: 1284
#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(a) (a).begin(),(a).end()
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
using ll = long long; constexpr int inf = INT_MAX / 2; constexpr 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; }

void _main() {
  string S;
  cin >> S;
  int n = S.size();
  int f = false;

  rep(i, 0, n) {
    rep(j, i, n) {
      string t = S.substr(0, i) + S.substr(j);
      if (t == "keyence") f = true;
    }
  }

  if (f) cout << "YES" << endl;
  else   cout << "NO" << endl;
}

Measured memory_bytes: 256