akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);

		int n=in.nextInt();
		BT tree=new BT();
		PrintWriter out=new PrintWriter(System.out);

		for(int i=0;i<n;i++) {
			String odr=in.next();

			if(odr.equals("insert")) {
				int key=Integer.parseInt(in.next());
				tree.insert(key);
			}

			else if(odr.equals("find")) {
				int key=Integer.parseInt(in.next());
				if(tree.isExist(key))out.println("yes");
				else out.println("no");
				out.flush();
			}
			
			else if(odr.equals("delete")) {
				int key=Integer.parseInt(in.next());
				tree.delete(key);
			}

			else if(odr.equals("print")) {
				Queue<Integer> Q=new ArrayDeque<>(tree.walk('I'));
				while(!Q.isEmpty())out.print(" "+Q.remove());
				out.println();
				Q=tree.walk('F');
				while(!Q.isEmpty())out.print(" "+Q.remove());
				out.println();
				out.flush();
			}
		}
		
	}

}

class BTNode{
	int key;
	BTNode Parent,Left,Right;

	BTNode(int k){
		key=k;
	}
}

class BT{
	BTNode root,dummy;
	int NIL=-2000000001;
	int size=0;

	Queue<Integer> Q;

	BT(){
		root=new BTNode(NIL);
		dummy=new BTNode(NIL);
		root.Parent=dummy;
		root.Left=dummy;
		root.Right=dummy;
	}

	//insert
	void insert(int k) {
		if(size==0) {
			root.key=k;
			size++;
			return;
		}

		BTNode node=new BTNode(k),s=root,p=root;
		node.Left=dummy;node.Right=dummy;

		while(s!=dummy) {
			p=s;
			if(k<s.key)s=s.Left;
			else s=s.Right;
		}

		node.Parent=p;
		size++;

		if(k<p.key)p.Left=node;
		else p.Right=node;
	}

	//print
	Queue<Integer> walk(char odr) {
		Q=new ArrayDeque<>();
		if(odr=='F')preWalk(root);
		else if(odr=='I')inWalk(root);
		return Q;
	}

	void preWalk(BTNode node) {
		Q.add(node.key);
		if(node.Left!=dummy)preWalk(node.Left);
		if(node.Right!=dummy)preWalk(node.Right);
	}

	void inWalk(BTNode node) {
		if(node.Left!=dummy)inWalk(node.Left);
		Q.add(node.key);
		if(node.Right!=dummy)inWalk(node.Right);
	}

	//isExist
	boolean isExist(int key) {
		if(find(key,root)!=dummy)return true;
		else return false;
	}

	BTNode find(int key,BTNode node) {
		if(node==dummy)return dummy;
		if(node.key==key)return node;

		BTNode n;
		if(key<node.key)n=find(key,node.Left);
		else n=find(key,node.Right);

		return n;
	}

	//delete
	void delete(int key) {
		BTNode d=find(key,root);
		if(d.Left!=dummy && d.Right!=dummy)delDouble(d);
		else if(d.Left!=dummy || d.Right!=dummy)delSingle(d);
		else delLeaf(d);
	}
	
	void delLeaf(BTNode node) {
		if(node.Parent.Left==node)node.Parent.Left=dummy;
		else node.Parent.Right=dummy;
	}

	void delSingle(BTNode node) {
		BTNode c;
		if(node.Left==dummy)c=node.Right;
		else c=node.Left;

		c.Parent=node.Parent;
		if(node.Parent.Left==node) node.Parent.Left=c;
		else node.Parent.Right=c;
	}

	void delDouble(BTNode node) {
		BTNode y=node.Right;
		while(y.Left.key!=NIL)y=y.Left;
		
		node.key=y.key;
		if(y.Right!=dummy)delSingle(y);
		else delLeaf(y);
	}
}



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

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

const int N = 100010;

int n, m;
int p[N], ac;
bool is_ac[N];

int main()
{
    scanf("%d%d", &n, &m);
    while(m--)
    {
        int id;
        char s[4];
        scanf("%d%s", &id, s);

        if(!is_ac[id])
            if(!strcmp(s, "WA")) p[id]++;
            else is_ac[id] = true, ac++;
    }

    int wa = 0;
    for(int i = 1; i <= n; i++) 
        if(is_ac[i])
            wa += p[i];

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


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

using namespace std;

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

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 998244353;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

int k,n;

const int MX = 4252;
int comb[MX][MX];

int all(int n, int k){
  return comb[n+k-1][k-1];
}

int ans[1252];
bool done[1252];
// int dp[1252][1252];

int calc(int x){
  // REP(i,x+1)REP(j,x+1)dp[i][j] = 0;
  int ret = 0;
  REP(i,x+1){
    int nn = n - 2*i;
    int routes = comb[x][i];
    int sign = i%2==0 ? 1 : -1;
    if(nn<0)continue;
    int sum = (ll)all(nn,k)*routes%MOD;
    ret += (MOD + sign * sum) % MOD;
    ret %= MOD;
  }
  return ret;
}

int main(){
  REP(i,MX)REP(j,MX){
    if(j==0 || i==j){
      comb[i][j] = 1;
    }else if(i < j){
      comb[i][j] = 0;
    }else{
      comb[i][j] = comb[i-1][j] + comb[i-1][j-1];
      if(comb[i][j] >= MOD)comb[i][j] -= MOD;
    }
  }
  scanf("%d%d",&k,&n);
  FOR(i,2,2*k+1){
    int j = i;
    if(j>k+1){
      j = 2*k - (j-2);
    }
    int cst = j / 2;
    if(!done[cst]){
      ans[cst] = calc(cst);
      done[cst] = true;
    }
    printf("%d\n", ans[cst]);
  }
  return 0;
}


Measured memory_bytes: 70912
# https://atcoder.jp/contests/abc153/tasks/abc153_f
# 座標圧縮、貪欲法、imos法


import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


# まず、何回攻撃すればいいのかを計算する。これがとにかく必要だ(なくてもいいけど)。
#
# 素直な戦略として、左から倒せるギリギリの爆弾を投下して倒すのが最適
# だけどナイーブに実装すると、O(N^2)。だから体力を管理するのが重要。
# どこにどれだけダメージが蓄積したのかはimos法(デルタ関数をおいてから累積和)で管理できる。

from bisect import bisect_left
N, D, A = read_ints()
XH = read_tuple(N)
XH.sort()  # 座標でソート

n_atk = []  # 何回攻撃するのが必要か
X = []  # 座標アクセス用配列
for x, h in XH:
    n_atk.append((h - 1) // A + 1)
    X.append(x)

damege = [0] * (N + 10)  # ダメージ管理用、配列外アクセスがめんどくさいので長めに取る
ans = 0
# j = 0  # 次のxが、今のx+2d以下でもっとも大きなidx
for i, (x, n) in enumerate(zip(X, n_atk)):
    damege[i] += damege[i - 1]  # 積分して、現時点の蓄積回数を表示
    atk = max(0, n - damege[i])  # iには何回攻撃したか
    ans += atk
    # 攻撃下回数を記録
    damege[i] += atk
    # 効果が切れる点を予約 # 尺取ならO(1)で次に行けるけど二分探索でも間に合うか
    damege[bisect_left(X, x + 2 * D + 1, lo=i)] -= atk  # 効果切れを予約

print(ans)


Measured memory_bytes: 99164
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const ll MOD=1e9+7;
pair<int,int> a[3005];
ll f[3005];
ll fn[200005],ifn[200005];
int h,w,n;
ll Pow(ll a, ll n)
{
    if (n==0) return 1ll;
    ll p=Pow(a,n/2);
    p=((p%MOD)*(p%MOD))%MOD;
    if (n%2) p=(p*a)%MOD;
    return p;
}
ll Combin(int n, int k)
{
    return ((fn[n]*ifn[k])%MOD*ifn[n-k])%MOD;
    /*
    ll t=1,m=1;
    for(int i=n-k+1;i<=n;i++) t=(t*i)%MOD;
    for(int i=1;i<=k;i++) m=(m*i)%MOD;
    return (t*Pow(m,MOD-2)%MOD);
    */
}
int main()
{
    cin>>h>>w>>n;
    fn[0]=1;
    for(int i=1;i<=h+w;i++) {fn[i]=i*fn[i-1]%MOD;}
    //ifn[h+w]=Pow(fn[h+w],MOD-2);
    for(int i=h+w-1;i>=0;i--) ifn[i]=Pow(fn[i],MOD-2);//ifn[i]=ifn[i+1]*(i+1)%MOD;
    //for(int i=0;i<=h+w;i++) cout<<ifn[i]<<' ';
    for(int i=1;i<=n;i++) cin>>a[i].first>>a[i].second;
    sort(a+1,a+n+1);
    for(int i=1;i<=n;i++)
    {
        ll t=0;
        for(int j=1;j<i;j++)
            if (a[j].second<=a[i].second)
            {
                int row=a[i].first-a[j].first;
                int col=a[i].second-a[j].second;
                t=(t+(f[j]*Combin(row+col,col))%MOD)%MOD;
            }
        f[i]=(Combin(a[i].first+a[i].second-2,a[i].first-1)-t+MOD)%MOD;
    }
    ll res=Combin(h+w-2,h-1);
    //cout<<res<<'\n';
    for(int i=1;i<=n;i++)
    {
        //cout<<f[i]<<' ';
        int row=h-a[i].first;
        int col=w-a[i].second;
        res=(res-f[i]*Combin(row+col,col)%MOD+MOD)%MOD;
    }
    cout<<res;
    return 0;
}


Measured memory_bytes: 3456
N = int(input())
H = list(map(int,input().split()))
can = True

for i in reversed(range(1,N)):
    if H[i - 1] - 1 == H[i]:
        H[i - 1] -= 1
    elif H[i - 1] - 1 > H[i]:
        can = False
        break

print(['No', 'Yes'][can])

Measured memory_bytes: 20512
import java.util.*;

public class Main{

  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);

    int n = Integer.parseInt(sc.next());
    int k = Integer.parseInt(sc.next());
    int t=0;

    while(true){

      if (Math.pow(k,t)>n){
        System.out.println(t);
        break;
      }else
      t++;
    }
  }
}


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

#define M 1000000007
#define MM 998244353 
#define ll long long 
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define PI 3.1415926536
#define INF 2000000000000000000
#define endl "\n"
#define _time_ 1.0 * clock() / CLOCKS_PER_SEC
//RNG based on mersenne_twister 
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
ll power(ll b,ll e,ll m)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b%m,e/2,m)%m;
	return power(b*b%m,e/2,m);
}
ll power( ll b, ll e)
{
	if(e==0) return 1;
	if(e&1) return b*power(b*b,e/2);
	return power(b*b,e/2);
}
template<typename T, typename U> static inline void amin(T &x, U y){ if(y<x) x=y; }
template<typename T, typename U> static inline void amax(T &x, U y){ if(x<y) x=y; }


int _runtimeTerror_()
{
	ll n,m,i;
	cin>>n>>m;
	ll sum=0;
	while(m--)
	{
		ll num;
		cin>>num;
		sum+=num;
	}
	if(sum<=n)
		cout<<n-sum<<endl;
	else cout<<-1;
	return 0;
}

int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	#ifdef runSieve
		sieve();
	#endif
	#ifdef NCR
		initialize();
	#endif
	int TESTS=1;
	//cin>>TESTS;
	while(TESTS--)
		_runtimeTerror_();
	cerr<<"\n"<<_time_;
	return 0;
}


Measured memory_bytes: 3804
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static string InputPattern = "InputX";

    static List<string> GetInputList()
    {
        var WillReturn = new List<string>();

            string wkStr;
            while ((wkStr = Console.ReadLine()) != null) WillReturn.Add(wkStr);
        return WillReturn;
    }

    static void Main()
    {
        List<string> InputList = GetInputList();

        int[] wkArr = InputList[0].Split(' ').Select(X => int.Parse(X)).ToArray();
        
        int A=wkArr[0];
        int B=wkArr[1];
        int C=wkArr[2];
        int D=wkArr[3];
        
        Console.WriteLine(Math.Max(A*B,C*D));
    }
}


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

int main() {
  int hit,size,ans=0;
  string str;
  while(cin >> str) {
    size = str.size();
    hit = 0;
    for(int i=0;i<(size-1.0)/2.0;i++) {
      if(str.substr(i,1) == str.substr(size-i-1,1))
        hit = 1;
      else {
        hit = 0;
        break;
      }
    }
    if(size == 1) {
      hit = 1;
    }
    ans += hit;
  }
   cout << ans << endl;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, C, D; cin >> A >> B >> C >> D;
  // A: Yes, B:No
  int ta = C / B;
  int ao = A / D;
  if (C % B > 0) ta++;
  if (A % D > 0) ao++;
  if (ta <= ao) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 3612
import sys
from collections import Counter

n, *s = sys.stdin.read().split()

def main():
    c = Counter(s)
    m = max(c.values())
    ans = [s for s, v in c.items() if v == m]
    print(*sorted(ans), sep='\n')
         
if __name__ ==  '__main__':
    main()

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

int main()
{
	int hour, min, sec;
	do {
		cin >> sec;
	} while ((sec < 0) || (86400 <= sec));

	hour = sec / 3600;
	min = (sec - hour * 3600) / 60;
	sec = sec - (hour * 3600 + min * 60);

	cout << hour << ':' << min << ':' << sec << endl;

    return 0;
}

Measured memory_bytes: 1160
#include<iostream>
using namespace std;
int main(){
	int A,B,C,X,w=0,n=0;
	scanf("%d%d%d%d", &A, &B, &C, &X);
	for(int i=0;i<A+1;i++){
		for(int j=0;j<B+1;j++){
			for(int k=0;k<C+1;k++){
				w=i*500+j*100+k*50;
						if(w==X){
							n=n+1;
							break;
						}
			}
		}

	}
	cout<<n<<endl;
	return 0;
}

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

using namespace std;

inline double dist(int x, int y)
{
    return x * x + y * y;
}

int main()
{
    int N;

    cin >> N;
    while (N--) {
        double max_d = 0.0, d = 0.0;
        int ans_x = 0, ans_y = 0;
        int x, y;
        int dx, dy;

        x = y = 0;
        while (cin >> dx >> dy, dx || dy) {
            x += dx;
            y += dy;
            d = dist(x, y);

            if (d > max_d || (d == max_d && x > ans_x)) {
                max_d = d;
                ans_x = x;
                ans_y = y;
            }
        }
        cout << ans_x << " " << ans_y << endl;
    }

    return 0;
}

Measured memory_bytes: 1160
n,m,c=gets.split.map(&:to_i)
b=gets.split.map(&:to_i)
a=Array.new(n).map{Array.new(m)}
n.times do |i|
    a[i]=gets.split.map(&:to_i)
end

sum=0
ans=0
n.times do |i|
    sum=0
    m.times do |j|
        sum+=a[i][j]*b[j]
    end
    if sum+c > 0
        ans+=1
    end
end
puts ans


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

int main() {
	// your code goes here
	int n,k;
	cin>>n>>k;
	set<int>s;
	while(k--){
		int d,g;
		cin>>d;
		while(d--){
			cin>>g;
			s.insert(g);
		}
	}
	cout<<n-s.size();
	return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define pi 3.1415926535897
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define mod1 998244353
#define inf 1000000000000000000
#define inf1 100000000000000
#define endl '\n'
int main()
{
	fastio;
	#ifdef gdb_18
		freopen("input.txt" , "rt" ,stdin);
		freopen("output.txt" , "wt" ,stdout);
	#endif
	ll x;
	cin>>x;
	if(x>=30)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;	
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<58;
const long double eps=1e-3;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    while(true){
        int n;
        cin >> n;
        if(n==0) break;
        vector<long double> xs(n),ys(n);
        rep(i,0,n) cin >> xs[i] >> ys[i];

        auto count=[&](const long double x,const long double y){
            int res=0;
            rep(i,0,n) if((xs[i]-x)*(xs[i]-x)+(ys[i]-y)*(ys[i]-y)<=1+eps) ++res;
            return res;
        };

        int ans=0;
        rep(i,0,3001){
            const long double y=10.*i/3000;
            rep(j,0,n){
                const long double tmp=1-(ys[j]-y)*(ys[j]-y);
                if(tmp<0) continue;
                const long double x1=xs[j]-sqrtl(tmp),x2=xs[j]+sqrt(tmp);
                ans=max({ans,count(x1,y),count(x2,y)});
            }
        }
        cout << ans << endl;
    }
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cout << fixed << setprecision(8);
    solve();
    return 0;
}

Measured memory_bytes: 3212
#include <iostream>
#include <vector>
#include <iomanip>
#include <stack>
#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iterator>
#include <string>
#include <cstring>
#include <fstream>
#include <random>
#include <time.h>
#include <complex>
#include <cmath>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n;i>0;i--)
#define arep(a,i,n) for(int i=(a);i<(n);i++)
#define SORT(v) sort((v).begin(),(v).end())
const ll INF = (1LL << 50);
typedef pair<int, int> P;

int main() {

	int n;
	cin >> n;

	vector<int>l(n);

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

	SORT(l);

	int ans = 0;
	for (int b = 0; b < n; b++) {
		for (int a = 0; a < b; a++) {
			int ab = l[a] + l[b];
			int r = lower_bound(l.begin(), l.end(), ab) - l.begin();
			int L = b + 1;	//c = [l,r)
			ans += r-L;

		}
	}

	cout << ans << endl;


	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <cstring>
#include <algorithm> // sort

#define REP(i, n) for (long long i = 0; i < (n); i++) 
typedef long long ll;
static const ll MOD = 1000000007;
static const ll INF = 1000000000000000000LL;
using namespace std;

ll N;
string S;

int main(){
    ll n,m;
    cin >> n >> m;

    vector <pair<int,int>> a(m);

    REP(i,m)
    {
        cin >> a[i].second >> a[i].first;
        --a[i].first;
        --a[i].second;
    }
    sort(a.begin(),a.end());

    bool kiru[n] = {};
    ll res = 0;

    REP(i,m)
    {
        bool flg = true;
        for(int j = a[i].second; j < a[i].first; ++j)
        {
            if(kiru[j] == true)
            {
                flg = false;
                break;
            }
        }
        if(flg)
        {
            kiru[a[i].first - 1] = true;
            ++res;
        }
    }

    cout << res << endl;

    return 0;
}



Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>

int main(){
    int N;
    std::cin >> N;
    int p[10000] = {0};
    for(int i=0;i<N;i++) std::cin >> p[i];
    int max = 0;
    int sum = 0;
    for(int i=0;i<N;i++){
        if(max<p[i]) max = p[i];
        sum += p[i];
    }
    std::cout << sum-max/2 << std::endl;
	return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
r = [-1] * (N + 1)

def root(x):
        if r[x] < 0:
                return x
        return root(r[x])

for i in range(M):
        x, y = map(int, input().split())
        x = root(x)
        y = root(y)
        if x == y:
                continue
        if r[x] > r[y]:
                x, y = y, x
        r[x] += r[y]
        r[y] = x 

print(-min(r))

Measured memory_bytes: 79544
"use strict";
// inputに入力データ全体が入る
const main = (input) => {
  const [a, b, c] = input.trim().split("");
  return a === c ? "Yes" : "No";
};

// ※この行以降は編集しない (標準入力から一度に読み込みMainを呼び出します)
console.log(main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 29620
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,abm,mmx,avx,avx2,popcnt,tune=native")
//#pragma GCC optimize("SEX_ON_THE_BEACH")	
//#pragma GCC optimize("fast-math")
//#pragma GCC optimize("unroll-loops")
//#pragma comment(linker, "/STACK:36777216")

#define _CRT_SECURE_NO_WARNINGS
#include <chrono>
#include <set>
#include <map>
#include <deque>
#include <cmath>
#include <queue>
#include <cassert>
#include <random>
#include <bitset>
#include <iomanip>
#include <numeric>
#include <time.h>//////////////
#include <ctime>
#include <string>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
#define endl '\n'
#define mp make_pair
#define pbc push_back
#define pob pop_back()
#define empb emplace_back
#define queuel queue<long long>
#define sqr(a) ((a) * (a))
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pin(p) cin >> p.first >> p.second;
#define uniq(a) sort(all(a));(a).resize(unique(all(a)) - a.begin());
#define rev(v) reverse(v.begin(), v.end());
#define sout(s, c) for (auto i : s) cout << i << c;
#define pout(p) cout << p.first << " " << p.second;
#define er(v, l, r) erase(v.begin() + l, v.begin() + r);
#define vin(v) for (ll i = 0; i < v.size(); ++i) cin >> v[i];
#define vout(v, c) for (int i = 0; i < v.size(); ++i) cout << v[i] << c;
#define pushi(v, a) for (int i = 0; i < a.size(); ++i) v.push_back(a[i]);
#define fastio() ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); srand(time(NULL))
#define sp system("pause")
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
using namespace std;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
//++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++--++
const ld EPS = 1e-5;
const ld PI = acos(-1);
int mod = (int)998244353;
const int MOD7 = 1000000007;
const int MOD9 = 1000000009;
const int a228 = 18;
const ll kekmod = 1791791791;
const ll bestmod = 1148822869;
vector<ll> mods = { kekmod,bestmod,mod,MOD9,1000000007 };
vector<ll> hashpows = { 29,31,37,43,47,53,179,229 };
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count() + 228 + 'i' + 'q' + 1337 + 1488);
ll MOD = mods[rnd() % mods.size()];
ll hashpow = hashpows[rand() % hashpows.size()];

signed main()
{
	fastio();
	ll n;
	cin >> n;
	ll mx = 0;
	for (ll i = 1; i *i <= n; ++i)
	{
		if (n % i == 0)
		{
			mx = max(mx, i);
		}
	}
	cout << mx - 1 + n / mx - 1;
	//sp;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pow2(x) (ll(1)<<x)
#define pb push_back
#define mp make_pair
#define w(t) int t;scanf("%d",&t);while(t--)
#define For(i,n) for(int i=0;i<n;i++)
#define scan(n) int n;scanf("%d", &n);
using namespace std;
const int sz = 3002;
int n,m;
string x,y;
int dp[sz][sz];
int solve(int i,int j,string temp)
{
    if(i==n || j==m)
        return 0;
    if(dp[i][j]!=-1)
        return dp[i][j];
    if(x[i]==y[j])
        return dp[i][j] = solve(i+1,j+1,temp + x[i]) + 1;
    return dp[i][j] = max(solve(i+1,j,temp),solve(i,j+1,temp));
}
void build(int i,int j,string temp)
{
    if(i==n || j==m)
        return ;
    if(dp[i][j]==solve(i+1,j+1,temp + x[i]) + 1 && x[i]==y[j])
    {
        cout<<x[i];
        build(i+1,j+1,temp + x[i]);
    }
    else if(dp[i][j]==solve(i+1,j,temp))
        build(i+1,j,temp);
    else
        build(i,j + 1,temp);
}
int main()
{
    cin>>x>>y;
    n = x.size(),m = y.size();
    memset(dp,-1,sizeof dp);
    solve(0,0,"");
    build(0,0,"");
}


Measured memory_bytes: 48204
n = gets.to_i
strings = []
n.times do
  strings << gets.chomp!.to_s
end
ary = strings.group_by(&:itself)
lists = ary.map{|k, v| [k, v.count]}.sort
max = ary.map{|k, v| v.count}.max
lists.each do |k, v|
  puts k if v == max
end


Measured memory_bytes: 66792
#include <bits/stdc++.h>
using namespace std;
int main(){
    char s[100];
    char s2[100]={};
    char s3[100]={};
    scanf("%s",s);
    string data=string(s);
    string reversed=string(s);
    int n=data.length()-1;
    for(int i=0;i<n/2;i++){
        s2[i]=s[i];
    }
    s2[n/2]='\0';
    string data2=string(s2);
    string reversed2=string(s2);
    for(int i=0;i<n-(n+3)/2;i++){
        s3[i]=s[i];
    }
    s3[n-(n+3)/2]='\0';
    string data3=string(s3);
    string reversed3=string(s3);
    reverse(reversed2.begin(),reversed2.end());
    reverse(reversed.begin(),reversed.end());
    if(data==reversed&&data2==reversed2&&data3==reversed3){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

int main() {
    string s; cin >> s;
    ll k; cin >> k;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] == '1') k--;
        else {
            cout << s[i] << endl;
            return 0;
        }
        if (k == 0) {
            cout << "1" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 3604
N, K, Q = map(int, input().split())
li = [K]*N
li = list(map(lambda x: x-Q, li))

for i in range(Q):
    a = int(input())
    li[a-1] += 1

for i in range(N):
    if li[i] <= 0:
        print("No")
    else:
        print("Yes")

Measured memory_bytes: 7972
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf')
ans = 0 ;count = 0 ;pro = 1

x=int(input())
b=(x-1)%11
a=math.ceil(x/11)
a*=2
if b<=5:
    # print(a,b)
    a-=1
print(a)

Measured memory_bytes: 38512
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP2(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(v) (v).begin(),(v).end()
#define INF 2e9
typedef long long ll;

int main()
{
  int n;
  cin>>n;
  vector<int> a(n);
  int sum=0;
  REP(i,n){
    cin>>a[i];
    sum+=a[i];
  }
  double mean=sum/double(n);
  vector<int> b=a;
  sort(ALL(b));
  int v,w;
  REP(i,n){
    if(mean<=b[i]){
      if(mean-b[i-1]<b[i]-mean) v=b[i-1];
      else if(mean-b[i-1]>b[i]-mean) v=b[i];
      else {v=b[i-1];w=b[i];}
      break;
    }
  }
  int ans;
  REP(i,n)
    if(a[i]==v || a[i]==w){
      ans=i;
      break;
    }
  cout<<ans<<endl;

  
	return 0;
}

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

typedef unsigned long long ull;
typedef long long ll;

const int MOD = 1000000007;

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

int main() {
    ll n, a, b;
    ll X, Y;
    cin >> n >> a >> b;

    ll ans = mod_pow(2, n, MOD);
    ans--;

    ll x = 1;
    ll y = 1;

    for (int i = n; i >= n-a+1; i--) {
        x = x*i%MOD;
        y = y*(n-i+1)%MOD;
    }
    X = x * mod_pow(y, MOD-2, MOD) % MOD;

    x = 1;
    y = 1;
    for (int i = n; i >= n-b+1; i--) {
        x = x*i%MOD;
        y = y*(n-i+1)%MOD;
    }

    Y = x * mod_pow(y, MOD-2, MOD) % MOD;

    ans -= X;
    if (ans < 0) ans += MOD;
    ans -= Y;
    if (ans < 0) ans += MOD;
    cout << ans << endl;
}


Measured memory_bytes: 256
if !ENV['RUBY_THREAD_VM_STACK_SIZE']
  exec({'RUBY_THREAD_VM_STACK_SIZE'=>'1000000000'}, '/usr/bin/ruby', $0)
end
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

D,G=get_i
$ans=INF
def dfs(pc,select,now,res,n)
    if now!=-1
        if ((G-res).to_f/((now+1)*100).to_f).ceil<=pc[now][0]
            $ans=min(n+((G-res).to_f/((now+1)*100).to_f).ceil,$ans)
        return
      elsif res+(now+1)*100*pc[now][0]+pc[now][1]>=G
        $ans=min(n+pc[now][0],$ans)
        return
      end
      n+=pc[now][0]
      res+=(now+1)*100*pc[now][0]+pc[now][1]
    end
    return if n>=$ans
    select.each_with_index do|f,i|
        next if f
        select[i]=true
        dfs(pc,select,i,res,n)
        select[i]=false
    end
end
pc=array(D)
D.times do|i|
  pc[i]=get_i
end
res=0
n=0
pc.each_with_index do|(p,c),i|
  res+=p*(i+1)*100+c
  n+=p
end
if res==G
    puts n
    exit
end
dfs(pc,Array.new(D){false},-1,0,0)
puts $ans

Measured memory_bytes: 14300
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <utility>

using namespace std;

constexpr int ms = 100100;

vector<int> g[ms];
deque<bool> explored(ms, false);
int node_xor[ms];

void explore( int root ) {
    explored[ root ] = true;
    int countKid = 0;
    for(const int& nei : g[root] ) {
        if( explored[nei] == false ) {
            countKid++;
            explore(nei);
            node_xor[root] ^= node_xor[nei];
        }
    }
    if( root != 0 ) node_xor[root]++;
}


int main()
{
    int n;
    ios::sync_with_stdio( false ); cin.tie(NULL);
    cin >> n;
    for(int i = 0; i < n - 1; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a].push_back( b );
        g[b].push_back( a );
    }

    explore(0);
    
    cout << ( node_xor[0] == 0 ? "Bob" : "Alice") << endl;
    return 0;
}


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



int main() {


    int n;
    cin>>n;

    int arr[n+1];
    arr[0] = 0;
    for(int i=1;i<=n;++i)
        cin>>arr[i];
    int i;
    int j;
    bool flag = false;

    for( i=1;i<=n;++i){

        if(arr[i]!=i){
           for( j=i+1;j<=n;++j){

            if(arr[j]==i){
               // cout<<arr[i]<<" "<<arr[j];
                swap(arr[i],arr[j]);
                flag = true;
                break;
            }
           }
        }
        if(flag)
            break;
    }

    for(int i=1;i<=n;++i){
        if(arr[i]!=i){
            cout<<"NO";
            return 0;
        }
    }
    cout<<"YES";


      return 0;
      }


Measured memory_bytes: 256
import numpy as np
from math import sqrt
ANS = []
N,M = map(int,input().split())
L = np.arange(1,int(sqrt(M))+1,dtype=int)
#L = sorted(L,reverse = True)
for i in L :
    if M % i == 0 :
        ANS.append(i)
        ANS.append(M//i)
ANS = sorted(ANS,reverse = True)
for j in ANS :
    if j * N <= M :
        print(j)
        break
        

Measured memory_bytes: 18952
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
#include <cstring>
#include <cctype>
#include <ctype.h>
#include <ios>
#include <iomanip>

#define INF 200000000
#define MOD 1000000007

using namespace std;

int main()
{
    string s[3];
    cin >> s[0] >> s[1] >> s[2];
    int last[3] = {0};
    int next = 0;
    for (;;)
    {
        if (last[next] == s[0].length() && next == 0)
        {
            cout << "A\n";
            return 0;
        }
        if (last[next] == s[1].length() && next == 1)
        {
            cout << "B\n";
            return 0;
        }
        if (last[next] == s[2].length() && next == 2)
        {
            cout << "C\n";
            return 0;
        }
        if (s[next][last[next]] == 'a')
        {
            last[next]++;
            next = 0;
        }
        else if (s[next][last[next]] == 'b')
        {

            last[next]++;
            next = 1;
        }
        else if (s[next][last[next]] == 'c')
        {

            last[next]++;
            next = 2;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

signed main(){
	int a,b;string s;cin>>a>>b>>s;
	rep(i,a){
		if(s[i]<'0'||s[i]>'9'){
			puts("No");return 0;
		}
	}
	if(s[a]!='-'){puts("No");return 0;}
	rep(i,b){
		if(s[a+i+1]<'0'||s[a+i+1]>'9'){
			puts("No");return 0;
		}
	}
	puts("Yes");
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>
using namespace std;

int main(void)
{
    bool judge = false;
    int n;
    char s;
    cin >> n;
    for(int i = 0;i < n;i++)
    {
        cin >> s;
        if(s == 'Y'){judge = true; break;}
    }
    if(judge){cout << "Four" << endl;}
    else{cout << "Three" << endl;}
    return 0;
}

Measured memory_bytes: 256
/*
[ ( ^ _ ^ ) ]
*/
// problem: atc/abc165_d
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1000000000


int main() {
    ll a, b, n;
    scanf("%lld %lld %lld", &a, &b, &n);
    ll x = b-1;
    x = min(x, n);
    ll rs = (a*x)/b;
    printf("%lld\n", rs);
}


Measured memory_bytes: 3828
import java.util.*;

public class Main {


    public static void main(String[] args) {
    	Scanner sc=new Scanner(System.in);

    	int X=sc.nextInt();
    	
    	boolean[] expX=new boolean[X+1];
    	
    	Arrays.fill(expX,false);
      
      	expX[1]=true;
    	
    	for(int b=2;b<=X;b++) {
    		
    		int v=b*b;
    		
    		while(v<=X) {
    			
    			expX[v]=true;
    			
    			v*=b;
    			
    		}
    	}
    	
    	for(int i=X;i>=0;i--) {
    		
    		if(expX[i]) {
    			System.out.println(i);
    			return ;
    		}
    		
    	}

    }


}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end());
#define VREV(v) reverse(v.begin(), v.end());
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
using vll = vector<ll>;
using vdouble = vector<double>;
using vstr = vector<string>;
typedef pair<int,int> P;
int dx[4] = {1, 0, -1, 0},dy[4] = {0, 1, 0, -1};
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}
template<class T> inline bool chmax(T& a, T b){if(a<b) {a=b; return 1;} return 0; }
template<class T> inline bool chmin(T& a, T b){if(a>b) {a=b; return 1;} return 0; }
const ll INF = 1LL << 60;
const ll mod = 1000000007;

ll H,N;
ll A[11000],B[11000];

ll dp[11000];

int main(){
	//乱数srand((unsigned)time(NULL));
	//入力
	cin>>H>>N;
	rep(i,N) cin>>A[i]>>B[i];
    rep(i,11000)dp[i]=INF;
    dp[0]=0;
	for(ll i=0; i<N; i++){
		for(ll j=0; j<=H; j++){
			chmin(dp[min(j+A[i],H)],dp[j]+B[i]);
		}
	}
  
	cout<<dp[H]<<endl;
}

Measured memory_bytes: 384
package main

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

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n := nextInt()
	l := nextInts(n)
	sort.Sort(sort.IntSlice(l))

	ans := 0
	for i := n - 1; i >= 2; i-- {
		for j := i - 1; j >= 1; j-- {
			a, b := l[i], l[j]
			lb := lowerBound(l, a-b+1)
			// puts(lb, j-lb)
			ans += max(0, j-lb)
		}
	}
	puts(ans)
}

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func nextInts(n int) []int {
	slice := make([]int, n)
	for i := 0; i < n; i++ {
		slice[i] = nextInt()
	}
	return slice
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func max(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v > ret {
			ret = v
		}
	}
	return ret
}

func lowerBound(a []int, key int) int {
	l, r := 0, len(a)-1
	for l <= r {
		mid := l + (r-l)/2
		if a[mid] < key {
			l = mid + 1
		} else {
			r = mid - 1
		}
	}
	return l
}


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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/04/03  Problem: ABC 047 A / Link: http://abc047.contest.atcoder.jp/tasks/abc047_a  ----- */


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

	LL a, b, c; cin >> a >> b >> c;
	LL ans = (a == b + c) || (a + b == c) || (a + c == b);
	auto print_yesno = [](LL yes, int mode = 0) {
		if (mode == 0) {
			cout << (yes ? "yes" : "no") << endl;
		}
		else if (mode == 1) {
			cout << (yes ? "Yes" : "No") << endl;
		}
		else if (mode == 2) {
			cout << (yes ? "YES" : "NO") << endl;
		}
		else assert(0);
	};
	print_yesno(ans,1);



	return 0;
}


Measured memory_bytes: 256
S = input()
T = input()
M = len(S)
N = len(T)

ans = N
diff = M - N

for i in range(diff + 1):
    U = '0' * i + T
    count = N
    for j in range(N + i):
        if U[j] == S[j]:
            count -= 1
    ans = min(ans, count)
print(ans)

Measured memory_bytes: 73416
#include <iostream>
using namespace std;
long long dp[200005][5];
long long a[200005];
int main(int argc, char** argv) {
	long long n;
	cin >> n;
	for(long long i=1;i<=n;i++)
		cin >> a[i];
	long long k=n%2+1;
	for(long long i=1;i<=n+4;i++)
	{
		for(long long j=0;j<=2;j++)
			dp[i][j]=-1e18;
	}
	for(long long i=1;i<=n;i++)
	{
		if(i<=k+1)
			dp[i][i-1]=max(dp[i][i-1],a[i]);
		for(long long j=0;j<=k;j++)
		{
			if(j>-1&&i>1)dp[i][j]=max(dp[i][j],dp[i-2][j]+a[i]);
			if(j>0&&i>2) dp[i][j]=max(dp[i][j],dp[i-3][j-1]+a[i]);
			if(j>1&&i>3) dp[i][j]=max(dp[i][j],dp[i-4][j-2]+a[i]);
		}
	}
	long long ans=max(dp[n][k],dp[n-1][k-1]);
	if(k==2) ans=max(ans,dp[n-2][k-2]);
	cout << ans; 
	return 0;
}

Measured memory_bytes: 12564
#include <iostream>
using namespace std;
int main(void){
    int n;
    cin>>n;
    for(int i=n; i<=999; i++){
        string s=to_string(i);
        if(s[0]==s[1]&&s[1]==s[2]){
            cout<<s<<endl;
            break;
        }
    }
}


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

int main(){
  int a;
  cin>>a;
  int b;
  cin>>b;
  int m;
  m=a*b/2;
  
  if(a*b-2*m==0){
    cout<<"Even"<<endl;
  }
  if(a*b-2*m==1){
    cout<<"Odd"<<endl;
  }
}

Measured memory_bytes: 256
import java.io.IOException;
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		boolean result = a == b + c || b == a + c || c == a + b;

		System.out.println(result ? "Yes" : "No");
	}
}


Measured memory_bytes: 9800
a,b = map(int,input().split())

li = [2,3,4,5,6,7,8,9,10,11,12,13,1]

a1 = li.index(a)
b1 = li.index(b)

if a1 > b1:
    print('Alice')
elif a1 == b1:
    print('Draw')
else:
    print('Bob')


Measured memory_bytes: 9088
N,M = input().split()
N = int(N); M = int(M)
F = []
for i in range(N):
    a = input()
    a = [int(x) for x in a.split()]
    del a[0]
    F.append(a)
res = []
for idx in range(1,M+1):
    cnt = 0
    for pep in F:
        if idx in pep:
            cnt += 1
    res.append(cnt)
print(res.count(N))

Measured memory_bytes: 3064
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <deque>

int main(){
  std::string X;
  std::cin >> X;
  std::stack<char> stack;
  for (int i=0; i<X.length(); i++){
    if (X[i]=='T' && stack.size()>0 && stack.top()=='S'){
      stack.pop();
    } else {
      stack.push(X[i]);
    }
  }
  std::cout << stack.size() << std::endl;
  return 0;
}


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


int main(){
    int n, k, q; cin >> n >> k >> q;

    int a[n]; rep(i,n) a[i] = 0;
    rep(i,q){
        int p; cin >> p;
        a[p-1]++; 
    } 
    rep(i,n){
        int ra = a[i];
        int score; score = k - q + ra;
        a[i] = score;
    }
    rep(i,n){
        cout << ((a[i] > 0)? "Yes" : "No") << endl;
    }
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007
using namespace std;

int main(void){
	int r;
	cin>>r;
	cout<<3*r*r<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,m;
  scanf("%d",&n);
  scanf("%d",&m);
  int q;
  int a[m],count[m];
  for(int i=0;i<m;i++){
    count[i]=0;
  }
  for(int i=0;i<n;i++){
    q=0;
    scanf("%d",&q);
    for(int j=0;j<q;j++){
      scanf("%d",&a[j]);
      for(int k=0;k<m;k++){
        if(a[j]==k+1){
          count[k]++;
        }
      }
    }
  }
  int ans;
  ans=0;
  for(int i=0;i<m;i++){
    if(count[i]==n)
      ans++;
  }
  printf("%d",ans);
}
          


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265
typedef long long int ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
#define fori(i,s,n) for(ll i=s;i<=n;i++)
#define ford(j,s,n) for(int i=n;i>=s;i--)
#define pb push_back
#define TEST int t; cin>>t; for(int T=1;T<=t;T++)
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    string a;
    cin>>n>>a;
    int l=0,h=n-1,cnt=0;
    while(l<h){
        while(l<h&&a[h]=='W') h--;
        while(l<h&&a[l]=='R') l++;
        if(a[l]=='W'&&a[h]=='R'){
            swap(a[l],a[h]);
            cnt++;
        }
    }
    cout<<cnt;
    return 0;
}


Measured memory_bytes: 3772
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n = 0;
  cin >> n;
  int sum = 0;
  for(int i = 0; i < n; i++){
    int l, r;
    cin >> l >> r;
    sum += r - l + 1;
  }
  cout << sum << endl;
}
    

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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  int sum=0;
 
  for (int i=0;i<N;i++){
    cin >> vec.at(i);
  }
  
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  
  for (int i=0;i<N;i++){
    if(i%2 == 0){
      sum += vec.at(i);
    }
    
    else if(i%2 == 1){
      sum -= vec.at(i);
    }
  }    
  cout << sum << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const double PI=acos(-1);

int main(){
    ll n, p;
    cin >> n >> p;
    vector<unsigned ll> even, odd;
    rep(i, n){
        ll a;
        cin >> a;
        if(a%2) odd.push_back(a);
        else even.push_back(a);
    }
    vector<vector<ll>> v(n+1, vector<ll>(n+1, 0));
    rep(i, v.size()) v[i][0] = v[i][i] = 1;
    rep(i, n){
        rep(j, i){
            v[i+1][j+1] = v[i][j] + v[i][j+1];
        }
    }
    ll even_sum = 0;
    rep(i, even.size()+1) even_sum += v[even.size()][i];
    ll odd_sum = 0;
    rep(i, odd.size()+1){
        if(i%2 == p) odd_sum += v[odd.size()][i];
    }
    cout << even_sum * odd_sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define ALL(v) v.begin(), v.end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1000000007;

int main()
{
	int n;
	cin >> n;
	double ans = 0;
	rep(i,n)
	{
		double x;
		string s;
		cin >> x >> s;
		if(s=="JPY")
		{
			ans += x;
		}
		else
		{
			ans += x*380000.0;
		}
		
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <limits.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <math.h>

#define P 1000000007

int comp(const void *a, const void *b){return *(int*)a-*(int*)b;}

int main(void){
	char a[4]={};
	int n, m, i;
	scanf("%d%d", &n, &m);
	for(i=0; i<m; i++){
		int s;
		char c;
		scanf("%d %c", &s, &c);
		if(n!=1 && s==1 && c=='0'){
			puts("-1");
			return 0;
		}else if(a[s]==0){
			a[s]=c;
		}else if(a[s]!=c){
			puts("-1");
			return 0;
		}
	}
	if(n==1) putchar(a[1]==0?'0':a[1]);
	else putchar(a[1]==0?'1':a[1]);
	for(i=2; i<=n; i++){
		putchar(a[i]==0?'0':a[i]);
	}
	putchar(10);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, m, ans;
int fa[maxn];
int getfa(int x) { return x == fa[x] ? x : fa[x] = getfa(fa[x]);} 
int main()
{
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= n; ++i) fa[i] = i;
	for(int i = 1; i <= m; ++i)
	{
		int x, y, z;
		scanf("%d%d%d", &x, &y, &z);
		x = getfa(x); y = getfa(y);
		if(x != y)
			fa[x] = y;
	}
	for(int i = 1; i <= n; ++i)
		if(fa[i] == i)
			++ans;
	cout << ans << endl;
	return 0;
}
		

Measured memory_bytes: 640
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
#define ip(arr, n) for(int i=0; i<n; i++) cin>>arr[i];
#define ip1(arr, n) for(int i=1; i<=n; i++) cin>>arr[i];
#define op(arr, n) for(int i=0; i<n; i++) cout<<arr[i]<<" ";
#define fstIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define debug(x) cout<<x<<"\n";
#define inf 1e9
#define INF 1e16
#define MOD 1000000007


int main(){

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    ll n;
    cin>>n;
    
    if(n%2 ==0 or n%5 == 0){
        cout<<"-1\n";
        return 0;
    }
    ll curr = 7%n;
    ll ans=1;

    while(curr != 0){
        curr = curr*10+7;
        curr %= n;
        ans++;
    }

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

Measured memory_bytes: 3604
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<cstring>
#include<bitset>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<numeric>
#include<set>
#include<math.h>
using namespace std;

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

#define rep(i,x) for(int i=0;i<x;i++)
#define re(i,x,y) for(int i=x;i<y;i++)

long long INF=1e9;
const long long mod=2019;
#define ll long long

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    ll n,k,q;
    cin>>n>>k>>q;
    vector<ll>point(n,k-q);
    vector<ll>a(q);
    rep(i,q){
        cin>>a[i];
        point[a[i]-1]++;
    }
    rep(i,n){
        if(point[i]>0){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    return 0;
}

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

class Dice{
  private:
    int* num;
  public:
    Dice(){
      num = new int[6];
    };
    ~Dice(){
      delete[] num;
    };
    void DiceSet(int index, int x){
      num[index] = x;
    };
    void DiceRoll(char x){
      switch(x){
        case 'E':
	  SwapFour(num[0],num[2],num[5],num[3]);
	  break;
	case 'S':
	  SwapFour(num[0],num[1],num[5],num[4]);
	  break;
	case 'W':
	  SwapFour(num[0],num[3],num[5],num[2]);
	  break;
	case 'N':
	  SwapFour(num[0],num[4],num[5],num[1]);
	  break;
      }
    };
    int DicePutTop(){
      return num[0];
    }
    int DicePutX(int x){
      return num[x];
    }
  private:
    // a->b->c->d->a
    void SwapFour(int &a, int &b, int &c, int &d){
      a ^= b; b ^= a; a ^= b;
      a ^= c; c ^= a; a ^= c;
      a ^= d; d ^= a; a ^= d;
    }
};

int main(){
  Dice dice;
  int arr[6];
  
  for(int i=0;i<6;i++){
    int x;
    cin >> x;
    dice.DiceSet(i, x);
  }
  for(int i=0;i<6;i++){
    cin >> arr[i];
  }

  if(dice.DicePutX(2) == arr[0]) dice.DiceRoll('W');
  if(dice.DicePutX(3) == arr[0]) dice.DiceRoll('E');
  for(int i=0;i<4;i++){
    dice.DiceRoll('N');
    if(dice.DicePutX(0) == arr[0]){
      for(int j=0;j<4;j++){
        dice.DiceRoll('E'); dice.DiceRoll('N'); dice.DiceRoll('W');
	if(dice.DicePutX(1) == arr[1]){
	  for(int k=0;k<6;k++){
	    if(dice.DicePutX(k) != arr[k]){
              cout << "No" << endl;
	      return 0;
	    }
	  }
	  cout << "Yes" << endl;
	  return 0;
	}
      }
    }
  }
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3136