akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int n,k,q; cin >> n >> k >> q;
    vector<int> p(n,k);
    rep(i,q) {
        int a; cin >> a;
        p[--a]++;
    }
    rep(i,n) {
        if (p[i]-q > 0) {
            cout << "Yes\n";
        } else {
            cout << "No\n";
        }
    }
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(void){
    
    char a, b;
    cin >> a >> b;
    
    if(a == 'H'){
        if(b == 'H')  cout << "H" << endl;
        else cout << "D" << endl;
    }
    else{
        if(b == 'H')  cout << "D" << endl;
        else cout << "H" << endl;
    }
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
const ll inf = 1e10;
int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    if((a < c && c < b) || (b < c && c < a))cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        s: String,
    }

    let mut sum = 0i64;
    for d in s.chars() {
        let d: i64 = d.to_digit(10).unwrap() as i64;
        sum += d;
    }

    let ans = if sum % 9 == 0 { "Yes" } else { "No" };
    println!("{}", ans);
}


Measured memory_bytes: 2344
#include<stdio.h>
#include<stdlib.h>


#define MAX 100001
typedef struct node{
  int parent;
  int left;
  int right;
} Tree;

int main(){
  int n,i,j,id,k,child,right=0,parent,d;
  Tree T[MAX];

  scanf("%d",&n);

  for(i=0;i<n;i++){
    T[i].parent=-1;
    T[i].left=-1;
    T[i].right=-1;
  }

  for(i=0;i<n;i++){
    scanf("%d%d",&id,&k);

    for(j=0;j<k;j++){
      scanf("%d",&child);
      T[child].parent=id;

      if(j==0){
    T[id].left=child;
      }else{
    T[right].right=child;
      }

      right=child;
    }
  }

  for(i=0;i<n;i++){
    d=0;
    parent=T[i].parent;

    while(parent!=-1){
      parent=T[parent].parent;
      d++;
    }

    if(d==0){
      printf("node %d: parent = -1, depth = 0, root, [",i);
    }else if(T[i].left==-1){
      printf("node %d: parent = %d, depth = %d, leaf, [",i,T[i].parent,d);
    }else{
      printf("node %d: parent = %d, depth = %d, internal node, [",i,T[i].parent,d);
    }

    parent=T[i].left;

    if(parent!=-1){
      printf("%d",parent);
    }

    while(parent!=-1){
      parent=T[parent].right;

      if(parent!=-1){
    printf(", %d",parent);
      }
    }

    printf("]\n");
  }

  return 0;
}

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

int main(){
  int a, b;
  char op;

  while(1){
    cin>>a>>op>>b;
    if(op=='?') break;

    if(op=='+') cout<<a+b<<endl;
    else if(op=='-') cout<<a-b<<endl;
    else if(op=='*') cout <<a*b<<endl;
    else cout<<a/b<<endl;
  }

  return 0;
}

Measured memory_bytes: 3028
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000100

int main(){
	
	int N;
	cin>>N;
	
	int ans = 0;
	
	for(int i=1;i<=N;i++){
		if(i<(N-i)){
			ans++;
		}
	}
	
	cout<<ans<<endl;
	
    return 0;
}


Measured memory_bytes: 256
a, b, c = map(int, input() .split())
A = abs(b - a) + abs(c - b)
B = abs(a - b) + abs(b - c)
C = abs(a - b) + abs(c - a)
D = abs(c - b) + abs(a - c)
E = abs(a - c) + abs(b - a)
F = abs(b - c) + abs(a - b)
print(min(A, B, C, D, E, F))


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

#define int long long
#define pb push_back
#define ff first
#define ss second
#define all(a) a.begin(), a.end()

const int mod = 1e9+7;
const int inf = 2e18;
vector<int> v[100005];

int getfive(int x)
{
	return (x*x*x*x*x);
}
int32_t main()
{	
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);

	int x;
	cin>>x;	

	vector<int> v;

	for(int i=-1000;i<=1000;i++)
	{
		for(int j=-1000;j<=1000;j++)
		{
			int temp = getfive(i)-getfive(j);
			if(temp==x)
			{
				//cout<<max(i,j)<<" "<<min(i,j)<<'\n';
				cout<<i<<" "<<j<<'\n';
				return 0;			
			}
		}
	}

	return 0;	
}	

Measured memory_bytes: 5944
#include <iostream>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;

int main()
{
	long L,R,i,j,ans=2019,temp;
	cin>>L>>R;
	if(R-L>=2018){
		cout<<0;
	}else{
		long Ld,Rd;
		Ld=L%2019;
		Rd=R%2019;
		if(Ld<Rd){
			for(i=Ld;i<Rd;i++){
				for(j=i+1;j<=Rd;j++){
					temp=(i*j)%2019;
					if(temp<ans){
						ans=temp;
					}
				}
			}
			cout<<ans;
		}else{
			cout<<0;
		}
	}
}


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

using namespace std;

int main(){
    int n , a , b; cin>>n>>a>>b;
    string s; cin>>s;
    vector<string>ans(n , "No");
    int cura = 0 , curb = 0;
    for(int i = 0 ; i < n ; ++i){
        if(s[i] == 'a'){
            if(cura < (a + b))ans[i] = "Yes";
            cura++;

        }
        else if(s[i] == 'b'){
            curb++;
            if(cura < (a + b) && curb <= b ){
                ans[i] = "Yes";
                cura++;
            }
        }
    }
    for(string& ss : ans)cout<<ss<<"\n";
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
int main()
{
	int A,B,K;
	cin >> K >> A >> B; 
	int judge = 0;

	for(int i = A; i<=B; i++){
		if(i%K == 0){
			judge++;
			break;
		}
	}

	if(judge == 0)
		cout << "NG";
	else
		cout << "OK";

	cin >> A;
	
	return 0;	
}

Measured memory_bytes: 3636
#include <iostream>
using namespace std;
int main(void){
    int x, ng = 0, ok = 1e9;
    cin >> x;
    while(ng + 1 < ok){
        long long mid = (ng + ok) / 2;
        if(mid*(mid+1)/2 >= x)ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}


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

using namespace std;

int main(){
    string in;
    int ansj=0,ansi = 0,n=0;
    while(cin>>in){
        ansj=ansi=0;
        if(cin.eof())break;
        for(int i=0;i<in.size()-2;i++){
            if(in[i]=='J' && in[i+1]=='O' && in[i+2]=='I')ansj++;
            if(in[i]=='I' && in[i+1]=='O' && in[i+2]=='I')ansi++;
        }
        cout <<ansj<<"\n"<<ansi<<endl;
    }
    return 0;
}

Measured memory_bytes: 1196
N = int(input())
moji_lst = [input() for _ in range(N)]

dic = {}
cnt = 0

for moji in moji_lst:
    x = ''.join(sorted(moji))

    if x in dic:
        dic[x] += 1
        cnt += dic[x]
    else:
        dic[x] = 0


print(cnt)

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
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;}
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  int n,taka,aoki;
  cin>>n>>taka>>aoki;
  taka--;aoki--;
  vector<vector<ll>> adj(n);
  vector<ll> deg(n);
  rep(i,n-1){
    int u,v;
    cin>>u>>v;
    u--;v--;
    adj[u].emplace_back(v);
    adj[v].emplace_back(u);
    deg[u]++;deg[v]++;
  }

  auto calcdist = [&](ll s){
    queue<pll> que;
    que.emplace(s,0);
    vector<ll> dist(n,INF);
    while(!que.empty()){
      ll v,c;
      tie(v,c) = que.front();
      que.pop();
      if(chmin(dist[v],c)){
        for(auto nv:adj[v]){
          que.emplace(nv,c+1);
        }
      }
    }
    return dist;
  };

  auto dist1 = calcdist(aoki);
  auto dist2 = calcdist(taka);

  ll ans = -1;
  rep(i,n){
    if(dist1[i]>dist2[i]){
      chmax(ans,dist1[i]-1);
    }
  }
  cout<<(ans)<<endl;


}

Measured memory_bytes: 9148
#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 k;
    cin >> k;
    int x = 7%k;
    set<int> s;
    int ans = 1;

    while( s.count(x) == 0 ){
        if (x == 0) {
            cout << ans << endl;
            return 0;
        }
        s.insert(x);
        x = (x*10+7)%k;
        ++ans;
    }
    cout << -1 << endl;
    return 0;
}

Measured memory_bytes: 50460
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;

int parse(string a) {
	int b = 0;
	for (char c : a)b = b * 10 + c - 48;
	return b;
}
int main() {
	int a, b;
	while (cin >> a >> b, a | b) {
		bool c[1000]{};
		int sum = 0;
		int T = a;
		string p[10000]; getline(cin, p[0]);
		for (int i = 0; i < b; i++)getline(cin, p[i]);
		for (int d = 1; d <= b; d++,sum++) {
			while (c[sum%a])sum++;
			string k = p[d - 1];
			bool B = false;
			if (d % 3==0) {
				if (d % 5 == 0) {
					if (k != "FizzBuzz")B = true;
				 }
				else {
					if (k != "Fizz") B = true;
				}
			}
			else if (d % 5==0) {
				if (k != "Buzz")B = true;
			}
			else {
				if (parse(k) != d) B = true;
			}
			if (B) {
				T--;
				c[sum%a] = true;
			}
			if (T == 1)break;
		}
		int w = 0;
		for (int i = 0; i < a; i++) {
			if (!c[i]) {
				if (w)cout << " ";
				w++;
				cout << i + 1;
			}
		}
		cout << endl;
	}
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

	void Solve() {
		UL N; cin >> N;
		UL C[256]; rep(i, 256) C[i] = 1;
		rep(i, N) {
			char c; cin >> c;
			C[c]++;
		}
		ULL ans = 1;
		rep(i, 256) ans = ans * C[i] % 1000000007;
		cout << (ans - 1) << endl;
	}


	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}

Measured memory_bytes: 256
/* 実行時間1s制限の場合10^6 1,000,000 : 余裕をもって間に合う10^7
  10,000,000 : おそらく間に合う10^8 100,000,000 : 非常にシンプルな処理
  でないと厳しい
 */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#include <bits/stdc++.h>
#define M_PI 3.14159265358979323846
using namespace std;

typedef long long ll; // long longはデータモデル(LLP64, LP64, ...)によらず64bit.
ll gcd(ll a, ll b) {return b ? gcd(b, a%b) : a;}  // Greatest Common Divisor ユークリッドの互除法（aが長辺）
vector<pair<ll,int>> factorize(ll n) {            // a,bの公約数 = GCD(a, b)の約数
    vector<pair<ll,int>> res;
    for (ll i = 2; i*i <= n; i++) { // √nまで探せばよい
        if (n%i) continue;
        res.emplace_back(i, 0);     // 割り切れたら
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n, 1); // この時点で1でなかったら、残りは素数.
    return res;
}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}         // Least Commont Multiple オーバーフローしないように先に割る
ll ceil(ll a, ll b) {return (a+b-1)/b;}

const ll INF = LONG_MAX;
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 argc, char* argv[])
{
#ifdef LOCAL
    // 以降 cin の入力元が 'xxx.txt' になる
    // std::ifstream in(argv[1]);
    //std::cin.rdbuf(in.rdbuf());
    //std::ifstream in(string(argv[0]) + ".txt");
    std::ifstream in("in.txt");
    std::cin.rdbuf(in.rdbuf());
#endif

    int n;
    cin >> n;
    int tmp = sqrt(n);
//    cout << tmp << endl;
    ll ans = 0;
    for (int i = tmp; ; tmp++) {
        ll a = tmp * tmp;
        if (a > n) break;
        ans = a;
    }

    cout << ans;


    return 0;
}

/*
  - 1e9 : 10^9
  - container一般
    - 合計
      accumulate(a.begin(), a.end(), 0LL)  0LLはオーバーフロー用
  - vector
    vector<int> A(N, 0); // 0で初期化(省略可)
    vector<vector<int>> vec(n_rows, vector<int>(n_cols, value));  // 2次元配列初期化
    - loop
      for  (int i = 0; i < A.size(); i++) {}
      for  (int elem : A) {}
    - sort
      std::sort(v.begin(), v.end());  // 昇順
      std::sort(v.begin(), v.end(), std::greater<int>()); //降順
      - vector<vector<int>> cnt(h, vector<int>(w))
    - sort(struct)
        struct st_t {
            string name;
            int p;
            bool operator<(const st_t& another) const {
                if (name == another.name)
                {
                    return p > another.p;
                }
                return name < another.name;
            }
        };
        vector<st_t> st(n);
        sort(st.begin(), st.end());
  - pair
    - pairのソートの定義 : firstが優先的に比較。同じだったらsecond。
    - pair<pair<string,int>,int> p[110];
      std::sort(p,p+a);
        こうすると、first.first -> first.second -> secondの順にソートされる
    - sort
      - sort(a.begin(), cb.end(), greater<pair<int, int>>());
  - map
    - for (auto x : map) {}  // x.first:key  x.second:value.
  - priority_queue<int> q;
    - q.top()に最大値が入っている
  - string
    - loop
      for (char& c : s) {}
 */



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) {rep(i,x.size()) cout << x[i] << " "; cout << endl;}
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

int main() {
    int n; cin >> n;
    vint a(n);
    rep(i,n) cin >> a[i];
    sort(rall(a));
    ll ans = a[0];
    int x = (n-2)/2;
    REP(i,x+1) {
        ans += 2*a[i];
    }
    if (n&1) ans += a[x+1];
    cout << ans << endl;
}

Measured memory_bytes: 4048
h = int(input())
w = int(input())
n = int(input())
count1 = 0
count2 = 0

if h > w:
  while w > 0:
    count1 += h
    if count1 >= n:
      count2 += 1
      break
    else:
      count2 += 1
      w -= 1
else:
  while h > 0:
    count1 += w
    if count1 >= n:
      count2 += 1
      break
    else:
      count2 += 1
      h -= 1

print(count2)

Measured memory_bytes: 3064
#include <stdio.h>

void MST(int,int);

int n,v[100][100],d[100],u,k[100],c[100][100];

int main(){
  int i,j,u;
  
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&u);
    scanf("%d",&k[u]);
    for(j=0;j<k[u];j++){
      scanf("%d %d",&v[u][j],&c[u][j]);
    }
  }
  for(i=0;i<n;i++){
    d[i] = 1000000;
  }
  MST(0,0);
  for(i=0;i<n;i++){
    printf("%d %d\n",i,d[i]);
  }

  return 0;
}

void MST(int p,int x){
  int i;
  d[p] = x;
  for(i=0;i<k[p];i++){
    if(d[v[p][i]] > x+c[p][i]){
      MST(v[p][i],x+c[p][i]);
    }
  }
  return;
}

Measured memory_bytes: 680
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <iterator>

using namespace std;

#define dump(n) cout<<"# "<<#n<<'='<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define iter(c) __typeof__((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INFTY=1<<29;
const double EPS=1e-9;

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
	return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
	os<<'[';
	rep(i,a.size()) os<<(i?" ":"")<<a[i];
	return os<<']';
}

int main()
{
	for(int n;cin>>n,n;){
		vi me(n),you(n);
		rep(i,n) cin>>me[i];
		rep(i,n) cin>>you[i];
		
		sort(all(me),greater<int>());
		map<int,int> rest;
		rep(i,n) rest[you[i]]++;
	
		int win=0,res=-1;
		rep(i,n){
			auto j=rest.lower_bound(me[i]);
			if(j==rest.end())
				win++;
			else{
				j->second--;
				if(j->second==0)
					rest.erase(j);
			}
			if(win*2>(i+1)){
				res=i+1;
				break;
			}
		}
		
		if(res==-1 || res==n)
			cout<<"NA"<<endl;
		else
			cout<<res<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 3004
#include <stdio.h>

int main(int argc, char const *argv[]) {
  int n,i;
  const  unsigned long waru = 1000000007;
  unsigned long sum=1;

  scanf("%d",&n );

  for(i=1;i<=n;i++){
    if(sum > waru){
      sum = sum % waru;
    }
    sum *= i;
  }

  //printf("%ld\n",sum );
  printf("%ld\n",sum % waru );

  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N;
int ans[10101];
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N;
	rep(x, 1, 101) rep(y, 1, 101) rep(z, 1, 101) {
		int tot = x * x + y * y + z * z + x * y + y * z + z * x;
		if (tot <= N) ans[tot]++;
	}
	rep(i, 1, N + 1) printf("%d\n", ans[i]);
}







Measured memory_bytes: 3596
#include <cstdio>
#include <cstring>
#include <iostream>
#define debug(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
inline char nc() {
    return getchar();
    static char buf[100000], *l = buf, *r = buf;
    return l==r&&(r=(l=buf)+fread(buf,1,100000,stdin),l==r)?EOF:*l++;
}
template<class T> void read(T &x) {
    x = 0; int f = 1, ch = nc();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=nc();}
    while(ch>='0'&&ch<='9'){x=x*10-'0'+ch;ch=nc();}
    x *= f;
}
const int maxn = 15 + 5;
const int maxs = 1 << 15;
int n, m;
int bit[maxn];
int c[maxn][maxs];
int f[maxn][maxs];
int adj[maxn][maxn];
int cost(int s, int t) {
    int re = 0;
    for(int i = 1; i <= n; ++i) if(s & bit[i - 1]) {
        re += c[i][t];
    }
    return re;
}
void init() {
    bit[0] = 1;
    for(int i = 1; i <= n; ++i) bit[i] = bit[i - 1] << 1;
    for(int i = 1; i <= n; ++i) {
        for(int s = 0; s < bit[n]; ++s) {
            for(int j = 1; j <= n; ++j) if(s & bit[j - 1]) {
                if(adj[i][j] != -1) c[i][s] += adj[i][j];
            }
        }
    }
}
int solve() {
    init();
    memset(f, 0x3f, sizeof(f));
    f[1][1] = 0;
    for(int s = 1; s < bit[n]; ++s) {
        for(int i = 1; i <= n; ++i) if(s & bit[i - 1]) {
            for(int j = 1; j <= n; ++j) if(~s & bit[j - 1]) {
                if(adj[i][j] == -1) continue;
                f[j][s ^ bit[j - 1]] = min(f[j][s ^ bit[j - 1]], f[i][s] + c[j][s ^ bit[i - 1]]);
            }
            int ss = (bit[n] - 1) ^ s;
            for(int t = ss; ; t = (t - 1) & ss) {
                f[i][s ^ t] = min(f[i][s ^ t], f[i][s] + cost(s ^ bit[i - 1], t));
                if(t == 0) break;
            }
        }
    }
    return f[n][bit[n] - 1];
}
int main() {
    read(n), read(m);
    memset(adj, -1, sizeof(adj));
    for(int i = 1; i <= m; ++i) {
        int u, v, w; read(u), read(v), read(w);
        adj[u][v] = adj[v][u] = w;
    }
    printf("%d\n", solve());
    return 0;
}


Measured memory_bytes: 4864
/*author: hyperion_1724
  date: 
*/

//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

    READV(X);
    ll ans=(X==1)?300000:(X==2?200000:(X==3?100000:0));
    READV(Y);
    ans+=(Y==1)?300000:(Y==2?200000:(Y==3?100000:0));
    if (X==1 && Y==1)
    {
        ans+=400000;
    }
    cout<<ans<<endl;
    

    return 0;
}

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

#define ll long long
#define rep(i,N) for(ll i=0; i<N; i++)
const int mx = 2e5;

int main(void){

  string S,T;
  cin >> S;
  cin >> T;
  
  ll ans = 0;
  rep(i,S.size()){
    if(S[i]!=T[i]) ans++;
  }
  
  cout << ans;

  return 0;
}

Measured memory_bytes: 3916
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

int main()
{
    string s;
    cin>>s;
    int red=0,blue=0;
    rep(i,s.size())
    {
        if(s[i]=='0')red++;else blue++;
    }
    cout<<min(red,blue)*2;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
pair<int,int> f(int a){
  int y=a%10;
  int x=0;
  if(a>=10){
    while(a>9){
      a/=10;
      x=a;
    }
  }
  else x=y;
  pair<int,int> p(x,y);
  return p;
}
int main(){
  int n; cin>>n;
  map<pair<int,int>,int> num;
  long long ans=0;
  for(int i=1;i<=n;i++) num[f(i)]++;
  for(int i=1;i<=n;i++){
    pair<int,int> p=f(i);
    pair<int,int> q(p.second,p.first);
    ans+=num[q];
  }
  cout<<ans;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
	int r,d,x;
	while(cin>>r>>d>>x){
		int a[11];
		a[0] = x;
		for(int i=1;i<11;i++){
			a[i] = r*a[i-1]-d;
		}
		for(int i=1;i<11;i++){
			cout<<a[i]<<endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int x, y;
    cin >> x >> y;
    x = !(x^2)*2 + (x%2)^(x/8);
    y = !(y^2)*2 + (y%2)^(y/8);
    
    if(x-y) cout << "No" << endl;
    else cout << "Yes" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAX 1000
#define NIL -2000000001

// 1オリジンの配列
vector<int> H(MAX, NIL);
int n;

void printParentKey(int i)
{
  int tmp = H.at(floor((double)i / 2.0));
  if (tmp != NIL)
  {
    printf("parent key = %d, ", tmp);
  }
}

void printLeftKey(int i)
{
  int tmp = H.at(i * 2);
  if (tmp != NIL)
  {
    printf("left key = %d, ", tmp);
  }
}

void printRightKey(int i)
{
  int tmp = H.at(i * 2 + 1);
  if (tmp != NIL)
  {
    printf("right key = %d, ", tmp);
  }
}

void print(int i)
{
  printf("node %d: key = %d, ", i, H.at(i));
  printParentKey(i);
  printLeftKey(i);
  printRightKey(i);
  printf("\n");
}

int main()
{
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
  {
    scanf("%d", &H.at(i));
  }

  for (int i = 1; i <= n; i++)
  {
    print(i);
  }
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
const int N=200;

 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,l[N],ans=0;
	cin >> n;
	FOR(j,0,2*n)cin >> l[j];
	sort(l,l+2*n);
	for(int i=0;i<2*n;i+=2){
		ans += l[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e17;
const int MAX = 100010;
int R, C, N;

bool used[MAX + MAX];
long long val[MAX + MAX];
vector< tuple<int, long long> > G[MAX + MAX];

long long minr, minc;
void dfsr(int, long long);

void dfsc(int c, long long a){
  used[c] = true;
  minc = min( minc, a );
  val[c] = a;
  for(int i = 0; i < G[c].size(); i++){
    int r;
    long long b;
    tie(r,b) = G[c][i];
    if( !used[r] )
      dfsr( r, b - a );
  }
}

void dfsr(int r, long long a){
  used[r] = true;
  minr = min( minr, a );
  val[r] = a;
  for(int i = 0; i < G[r].size(); i++){
    int c;
    long long b;
    tie(c,b) = G[r][i];
    if( !used[c] )
      dfsc( c, b - a );
  }
}

int r[MAX], c[MAX];
long long a[MAX];
int main(){
  cin >> R >> C >> N;
  for(int i = 0; i < N; i++){
    int h, w;
    long long v;
    cin >> h >> w >> v;
    G[ h ].emplace_back( MAX + w, v);
    G[ MAX + w ].emplace_back( h, v);
    r[i] = h;
    c[i] = MAX + w;
    a[i] = v;
  }

  bool ans = true;
  for(int i = 1; i <= R; i++){
    minr = inf;
    minc = inf;
    if( ! used[i] ){
      dfsr(i, 0);
    }
    if( minr + minc < 0 ) ans = false;
  }

  for(int i = 0; i < N; i++){
    if(a[i] != val[ r[i] ] + val[ c[i] ]) ans = false;
  }
  
  if( ans ) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 16640
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<ll> b(n);
    rep(i,n-1) cin>>b[i];
    b[n-1] = INF;
    ll ans = b[0];
    rep(i,n-1) {
        ans += min(b[i],b[i+1]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e,v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

void _main() {
    int N;
    cin >> N;
    vector<int> v;
    while (N) {
        v.push_back(N & 1);
        if (N < 0) N--;
        N /= -2;
    }
    if (v.empty())
        v.push_back(0);
    REV(v);
    REP(i, SZ(v)) {
        cout << v[i];
    }
    cout << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i'))
            freopen("input.txt", "r", stdin);
        if (strchr(argv[1], 'o'))
            freopen("output.txt", "w", stdout);
    }
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 764
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define ll long long
#define cst first
#define dur second
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
const int N = 5e2 + 5, M = 2 * N + 5;

int n, x[N], k, sum;
int a[N], b[N];

int main(){
    scanf("%d%d", &n, &k);
    for(int i = 0 ; i < n ; ++i)
        scanf("%d", x + i), sum += x[i];
    vector<int> div;
    for(ll i = 1 ; i * i <= sum ; ++i){
        if(sum % i)continue;
        div.emplace_back(i);
        div.emplace_back(sum / i);
    }
    sort(div.rbegin(), div.rend());
    for(auto num : div){
        // cout << "Num = " << num << endl;
        vector<int> v;
        for(int i = 0 ; i < n ; ++i)
            v.emplace_back(x[i] % num);
        sort(v.begin(), v.end());
        for(int i = 1 ; i <= n ; ++i)
            a[i] = a[i - 1] + v[i - 1];
        b[n + 1] = 0;
        for(int i = n ; i ; --i){
            int tmp = (num - v[i - 1]);
            if(tmp == num)tmp = 0;
            b[i] = b[i + 1] + tmp;
        }
        bool ok = false;
        for(int i = 1 ; i < n && !ok; ++i)
            if(a[i] == b[i + 1] && a[i] <= k)ok = true;
        if(ok){
            printf("%d\n", num);
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <cstdio> 
using namespace std; //This makes the code much more cleaner

int main()
{
	
/*
	int a, b, c, d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	int area = a*b;
	int areatwo = c*d;
		if (area>=areatwo)
		{
			printf("%d", area);
		}
		else
		{
			printf("%d",areatwo);
		}
		*/
	//--------------------------------------------

	/*
	int a,b;
	scanf("%d %d", &a, &b);
	if (a==1 and b!=1)
	{

		printf("Alice");

	}
	else if (b == 1 and a!=1)
	{

		printf("Bob");

	}
	else if (a>b)
	{

		printf("Alice");

	}
	else if (a == b)
	{

		printf("Draw");
	}
	else
	{

		printf("Bob");
	}

	*/


	//----------------------------------------------- IN CASE YOU WANT TO FIND THE LAST DIGIT OF A NUMBER, OR A MIDDLE DIGIT OF A NUMBER:

	/*
	
	x= 413

	then do x%10

	if you want to get the digit of 10,

	then do x/10 %10
	
	*/



	//--------------------------------------------------- LEAP YEAR PROBLEM SOLUTIONS

	/*
	int x;
	scanf("%d",&x);
	if (x%4!=0)
	{
		printf("no");

	}
	else
	{
		if (x % 100 != 0)
		{

			printf("yes");
		}
		else
		{
			if (x%400==0)
			{

				printf("yes");
			}
			else
			{
				printf("no");
			}
		
		}

	}
	

int x;
scanf("%d", &x);

	if ( (x%4==0 and x%100!=0) or(x%400==0) )
	{
		printf("yes");
	}
	else
	{
		printf("no");
	}

	*/


//--------------------------------------------------------------


int a;
scanf("%d",&a);
printf("ABC%d",a);









	return 0;

}

Measured memory_bytes: 128
n = int(input())
l = list(map(int,input().split()))
ans = 0
l.sort()
if n <= 2:
    print(0)
    exit()
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if l[i] + l[j] > l[k] and l[i] != l[j] and l[j] != l[k] and l[k] != l[i]: 
                ans += 1
print(ans)

Measured memory_bytes: 68092
#include <cstdio>
 #include <cstdlib>
 #include <iostream>
 #include <fstream>
 #include <sstream>
 #include <set>
 #include <map>
 #include <vector>
 #include <list>
 #include <algorithm>
 #include <cstring>
 #include <cmath>
 #include <string>
 #include <stack>
 #include <queue>
 #include <bitset>     //UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
 #include <cassert>
 #include <iomanip>        //do setprecision
 #include <ctime>
 #include <complex>
 using namespace std;

 #define FOR(i,b,e) for(int i=(b);i<(e);++i)
 #define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
 #define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
 #define REP(x, n) for(int x = 0; x < (n); ++x)

 #define ST first
 #define ND second
 #define PB push_back
 #define PF push_front
 #define MP make_pair
 #define LL long long
 #define ULL unsigned LL
 #define LD long double
 #define pii pair<int,int>
 #define pll pair<LL,LL>

 const double pi = 3.14159265358979323846264;
 const int mod=1000000007;

 int di[4]={-1,0,1,0};
 int dj[4]={0,1,0,-1};

int main(){
	int h,w;
	int b[444][444]={},used[444][444]={};
	cin>>h>>w;
	FOR(i,0,404)FOR(j,0,404)b[i][j]=2;
	FORQ(i,1,h){
		string s;
		cin>>s;
		FOR(j,0,w){
			if(s[j]=='#')b[i][j+1]=1;
			else b[i][j+1]=0;
		}
	}
	LL ans=0;
	FORQ(i,1,h){
		FORQ(j,1,w){
			if(used[i][j])continue;
			if(b[i][j]!=1)continue;
			int cnt[2]={};
			queue<pii> q;
			q.push(MP(i,j));
			used[i][j]=1;
			cnt[1]++;
			while(q.size()){
				pii pr=q.front();
				q.pop();
				int ii=pr.ST,jj=pr.ND;
				int nc=b[ii][jj];
				FOR(d,0,4){
					int ni=ii+di[d];
					int nj=jj+dj[d];
					if(used[ni][nj])continue;
					if(b[ni][nj]!=(nc^1))continue;
					q.push(MP(ni,nj));
					used[ni][nj]=1;
					cnt[nc^1]++;
				}
			}
			ans+=1LL*cnt[0]*cnt[1];
		}
	}
	cout<<ans<<endl;
    return 0;
}


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

using namespace std;
typedef long long LL;

#ifdef BTK
#define DEBUG if(1)
#else
#define CIN_ONLY if(1)
struct cww {cww() {CIN_ONLY{ios::sync_with_stdio(false); cin.tie(0);}}
}star;
#define DEBUG if(0)
#endif

#define ALL(v) (v).begin(),(v).end()
#define REC(ret, ...) std::function<ret (__VA_ARGS__)>
template <typename T>inline bool chmin(T &l, T r){bool a = l>r; if (a)l = r; return a;}
template <typename T>inline bool chmax(T &l, T r){bool a = l<r; if (a)l = r; return a;}
template <typename T>istream& operator>>(istream &is, vector<T> &v){for (auto &it : v)is >> it;return is;}

class range {private: struct I { int x; int operator*() { return x; }bool operator!=(I& lhs) { return x<lhs.x; }void operator++() { ++x; } }; I i, n;public:range(int n) :i({ 0 }), n({ n }) {}range(int i, int n) :i({ i }), n({ n }) {}I& begin() { return i; }I& end() { return n; }};

set<pair<LL, int>> pl, mi;
int N, Q;
LL sum = 0;
LL a[212345];
LL b[212345];
void ins(int i) {
	if (i == 0 || i == N - 1)return;
	LL x = b[i] - a[i];
	if (x >= 0) {
		pl.insert({ x,i });
		sum += x;
	}
	else mi.insert({ x,i });
}
void ers(int i){
	if (i == 0 || i == N - 1)return;
	LL x = b[i] - a[i];
	if (x >= 0) {
		pl.erase({ x,i });
		sum -= x;
	}
	else mi.erase({ x,i });
}

int main() {
	cin >> N >> Q;
	N *= 2;
	for (int i : range(N)) {
		cin >> a[i];
	}
	for (int i : range(N)) {
		cin >> b[i];
	}
	LL base = 0;
	for (int i : range(N)) {
		base += a[i];
	}
	for (int i : range(1,N-1)) {
		LL x = b[i] - a[i];
		ins(i);
	}
	for (int _ : range(Q)) {
		int p; LL x, y;
		cin >> p >> x >> y;
		p--;
		base -= a[p]; ers(p);
		a[p] = x;
		b[p] = y;
		base += a[p]; ins(p);
		if (pl.size() % 2 == 0) {
			cout << base + sum << endl;
		}
		else {
			cout << base + sum + max(mi.rbegin()->first, -pl.begin()->first)<<endl;
		}
	}

	return 0;
}


Measured memory_bytes: 17408
#include<stdio.h>
int main()
{
    int a,b;
    scanf("%d%d", &a, &b);
    if(a==b)
        printf("Draw\n");
    else if(a > b)
    {
        if(b==1)
            printf("Bob");
        else
            printf("Alice\n");

    }
    else if(b > a)
    {
        if(a==1)
            printf("Alice\n");
        else
            printf("Bob\n");

    }
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <bits/stdc++.h>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(X, S, E) for (int(X) = (S); (X) < (E); ++(X))
#define rrep(X, S, E) for (int(X) = (E)-1; (X) >= (S); --(X))
#define itrep(X, Y) for (auto(X) = (Y).begin(); (X) != (Y).end(); (X)++)
#define all(X) (X).begin(), (X).end()
#define pb push_back
#define mp make_pair
#define fi first
#define sc second
#define print(x) cout << x << endl

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef priority_queue<ll, vl> decendingQueue;              //降順
typedef priority_queue<ll, vl, greater<ll>> ascendingQueue; //昇順
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll INF = 9 * 1e18;
const ll MOD = 1e9 + 7;

ll solve1(ll H, ll W) {
  ll h1 = H / 3; // 3: 1, 1, 1,  4: 1, 1, 2, 5: 1, 2, 2;
  ll h2 = (H - h1) / 2;
  ll h3 = H - h1 - h2;

  ll hMax = max(h1, max(h2, h3));
  ll hMin = min(h1, min(h2, h3));

  return (hMax - hMin) * W;
}

ll solve2(ll H, ll W) {
  ll ans = INF;
  rep(h1, 1, H) {
    ll h2 = H - h1;
    ll w1 = W / 2;
    ll w2 = W - w1;

    ll s1 = h1 * w1;
    ll s2 = h1 * w2;
    ll s3 = h2 * W;

    ll sMax = max(s1, max(s2, s3));
    ll sMin = min(s1, min(s2, s3));
    ans = min(ans, sMax - sMin);
  }
  return ans;
}

void solve(long long H, long long W) {
  // 横2本
  ll s1 = solve1(H, W);

  // 縦2本
  ll s2 = solve1(W, H);

  // 横1本 縦1本
  ll s3 = solve2(H, W);

  // 縦1本 横1本
  ll s4 = solve2(W, H);

  print(min(min(s1, s2), min(s3, s4)));
}

int main() {
  long long H;
  scanf("%lld", &H);
  long long W;
  scanf("%lld", &W);
  solve(H, W);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<typeinfo>
#include<vector>
#include<algorithm>
#include<map>
#include<iomanip>
typedef long long int ll;
using namespace std;
int main()
{
	int X,A,B;
	cin >> X >> A >> B;

	if(B-A <= 0){
		cout << "delicious"<< endl;
	}else if(B-A > X ){
		cout << "dangerous" <<endl;
	}else{
		cout << "safe" << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
s = gets().chomp;
s = s.split("")
n = s.length;
nokori = 15 - n;
count = 0;
for i in 0..n-1
	if s[i] == 'o'
		count = count + 1;
	end
end
if count + nokori > 7
	puts('YES');
else
	puts('NO')
end

Measured memory_bytes: 1788
import java.io.*
import java.util.*

val pw = PrintWriter(System.out)

fun main(args: Array<String>) {
    val (n, q) = readLine()!!.split(" ").map{ it.toInt() }
    val query = Array(q){ readLine()!! }
    val uf = WeightedUnionFind(n)
    repeat(q){
        val ret = query[it].split(" ").map{ it.toInt() }
        if (ret[0] == 0){
            uf.unite(ret[1], ret[2], ret[3].toLong())
        }else{
            val (x, y) = ret[1] to ret[2]
            if (!uf.isSame(x, y)) pw.println("?")
            else pw.println(uf.getDiff(x, y))
        }
    }
    pw.flush()
}



class WeightedUnionFind(n: Int) {
    data class Node(var parent: Int, var size: Int, var weight: Long)

    private val nodes = Array(n) { Node(parent = it, size = 1, weight = 0) }
    fun findRoot(x: Int): Int {
        if (x == this.nodes[x].parent) return x
        val root = findRoot(nodes[x].parent)
        nodes[x].weight += nodes[nodes[x].parent].weight
        nodes[x].parent = root
        return root
    }

    fun unite(x: Int, y: Int, weight: Long): Boolean {
        // nodes[x].weight + weight = nodes[y].weightとなるようにする
        val xRoot = findRoot(x)
        val yRoot = findRoot(y)
        if (xRoot == yRoot) return false
        val (smaller, bigger, newWeight) = when (getSize(xRoot) >= getSize(yRoot)) {
            true -> Triple(yRoot, xRoot, nodes[x].weight - nodes[y].weight + weight)
            else -> Triple(xRoot, yRoot, nodes[y].weight - nodes[x].weight - weight)
        }
        nodes[smaller].parent = bigger
        nodes[bigger].size += nodes[smaller].size
        nodes[smaller].weight = newWeight
        return true
    }

    fun getWeight(x: Int): Long {
        findRoot(x)
        return nodes[x].weight
    }

    fun getDiff(x: Int, y: Int) = getWeight(y) - getWeight(x)
    fun getSize(x: Int) = nodes[findRoot(x)].size
    fun isSame(x: Int, y: Int) = findRoot(x) == findRoot(y)
}



Measured memory_bytes: 129112
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<queue>
#include<map>
#include<math.h>
#include<string>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for (int i = s; i < (int)(n); i++)
#define out(x) cout << x << endl
#define INF 1ll<<60;

using namespace std;
typedef pair<int, int> P;

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    if(a==b+c || b==a+c || c==a+b)out("Yes");
    else out("No");
}


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

int main() {
    int N;
    std::cin >> N;

    std::multiset<int> s;
    for (int i = 0; i < N; i++) {
        int a;
        std::cin >> a;

        
        auto it = s.lower_bound(a);
        if (it != s.begin())
            s.erase(--it);
        s.insert(a);
    }

    std::cout << s.size() << "\n";
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
const int N=5e5+10;
const int inf=1e9;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int n,k,a[N],du[N],b[N],ans[N];
vector<int> E[N];
int tr[N<<2];
#define ls (o<<1)
#define rs (o<<1|1)
void update(int o,int l,int r,int p,int v) {
    if(l==r) { tr[o]=min(tr[o],v);return; }
    int mid=(l+r)>>1;
    p<=mid?update(ls,l,mid,p,v):update(rs,mid+1,r,p,v);
    tr[o]=min(tr[ls],tr[rs]);
}
int query(int o,int l,int r,int L,int R) {
    if(L>R) return inf;
    if(L<=l&&r<=R) return tr[o];
    int mid=(l+r)>>1,ret=inf;
    if(L<=mid) ret=min(ret,query(ls,l,mid,L,R));
    if(R>mid) ret=min(ret,query(rs,mid+1,r,L,R));
    return ret;
}
int main() {
    cin>>n>>k;
    for(int i=1;i<=n;i++) a[gi()]=i;
    memset(tr,0x3f,sizeof(tr));
    for(int i=n;i;i--) {
        int p=query(1,1,n,a[i]+1,min(n,a[i]+k-1));
        if(p<=n) E[a[p]].pb(a[i]),du[a[i]]++;
        p=query(1,1,n,max(1,a[i]-k+1),a[i]-1);
        if(p<=n) E[a[p]].pb(a[i]),du[a[i]]++;
        update(1,1,n,a[i],i);
    }
    priority_queue<int> q;
    int now=n;
    for(int i=1;i<=n;i++) if(!du[i]) q.push(i);
    while(!q.empty()) {
        int u=q.top();q.pop();b[now--]=u;
        for(int v:E[u]) if(!--du[v]) q.push(v);
    }
    for(int i=1;i<=n;i++) ans[b[i]]=i;
    for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
    return 0;
}
//orzgzy
//鸡贼明年进队超稳


Measured memory_bytes: 47104
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int n,D,tmp,d[500000],Q,q,memo[500000],now=1,ans[500000];

main() {
    scanf("%d%d",&n,&D);
    tmp = D;
    rep(i,n) {
        scanf("%d",&d[i]);
        if (tmp*2 > d[i]) tmp = abs(tmp-d[i]);
        memo[i] = tmp;
    }
    scanf("%d",&Q);
    for(int i=n-1;i>0;--i) {
        if (memo[i-1] >= now) ans[i] = 1;
        if (2*now > d[i]) now += d[i];
    }
    if (D >= now) ans[0] = 1;
    rep(i,Q) {
        scanf("%d",&q);q--;
        if (ans[q]) printf("YES ");
        else printf("NO ");
    }
}



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


int main(int argc, char *argv[]) { ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
  int h,w,k;cin>>h>>w>>k;
  vector<string> s(h);
  for(int i=0;i<h;i++){
    cin>>s[i];
  }

  ll ans=0;
  for(int i=0;i<(1<<h);i++){
    for(int j=0;j<(1<<w);j++){
      int cnt=0;
      for(int k1=0;k1<h;k1++){
        if((1<<k1) & i) continue;
        for(int k2=0;k2<w;k2++){
          if((1<<k2) & j) continue;
          if(s[k1][k2]=='#')cnt++;
        }
      }
      if(cnt==k)ans++;
    }
  }

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


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll s;
ll Sqrt(ll x)
{
    ll l=sqrt(x),r=sqrt(x)+1;
    return r*r<=x?r:l;
}
int main()
{
    scanf("%lld",&s);
    ll t=Sqrt(s),x1,x2,x3,y1,y2,y3;
    if(t*t==s)
    {
        cout<<0<<' '<<0<<' '<<t<<' '<<0<<' '<<0<<' '<<t<<endl;
        return 0;
    }
    if(s>1e9)
    {
        ll p=1e9-1;
        t=s/p;
        x1=0;x2=t;x3=s-p*t;
        y1=0;y2=-1;y3=p;
        y1++;y2++;y3++;
        cout<<x1<<' '<<y1<<' '<<x2<<' '<<y2<<' '<<x3<<' '<<y3<<endl;
       //cout<<x1*y2+x2*y3+x3*y1-x2*y1-x3*y2-x1*y3<<endl;
        return 0;
    }
    x1=0;x2=t;x3=s-t*t;
    y1=0;y2=-1;y3=t;
    y1++;y2++;y3++;
    cout<<x1<<' '<<y1<<' '<<x2<<' '<<y2<<' '<<x3<<' '<<y3<<endl;
    //cout<<x1*y2+x2*y3+x3*y1-x2*y1-x3*y2-x1*y3<<endl;
}
//777777777777777777


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

int main(){
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> v{a, b, c};
    sort(v.begin(),v.end());

    for(int i = 0; i<v.size(); i++)
        cout << v[i] << ((i < v.size() - 1) ? " " : "\n"); 
}



Measured memory_bytes: 3132