akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<map>
using namespace std;
map<string,int> m;
int main()
{
  int n;
  cin>>n;
  for(int i=0;i<n;i++)
  {
    string s;
    cin>>s;
    m[s]++;
  }
 int maxf=-1;
  for(auto x : m)
  {
    int f=x.second;
    maxf=max(f,maxf);
  }
  for(auto x : m)
  {
    if(x.second==maxf)
        cout<<x.first<<"\n";
  }
  return 0;
}

Measured memory_bytes: 25216
#define LOCAL

#undef _GLIBCXX_DEBUG

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

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define MOD 1000000007LL
#define LLINF 100000000000000005LL
#define INF (int)1e9+1

// Copied from Gennady-Korotkevich's template

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
	return '"' + s + '"';
}

string to_string(const char* s) {
	return to_string((string)s);
}

string to_string(bool b) {
	return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
	bool first = true;
	string res = "{";
	for (int i = 0; i < static_cast<int>(v.size()); i++) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(v[i]);
	}
	res += "}\n";
	return res;
}

template <size_t N>
string to_string(bitset<N> v) {
	string res = "";
	for (size_t i = 0; i < N; i++) {
		res += static_cast<char>('0' + v[i]);
	}
	return res;
}

template <typename A>
string to_string(A v) {
	bool first = true;
	string res = "{";
	for (const auto& x : v) {
		if (!first) {
			res += ", ";
		}
		first = false;
		res += to_string(x);
	}
	res += "}\n";
	return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
	return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

template <typename A, typename B, typename C, typename D, typename E>
string to_string(tuple<A, B, C, D, E> p) {
	return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + "," + to_string(get<4>(p)) + ")";
}

void debug_out() {
	cerr << endl;
}

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
	cerr << " " << to_string(H);
	debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "\n[" << #__VA_ARGS__ << "]:\n", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

// End of Gennady-Korotkevich's template 

using llong = long long;
using PII = pair<int, int>;

int main() {
	IOS;
	llong n; cin >> n;
	if (n % 2) {
		cout << 0;
		return 0;
	}
	llong ans = 0;
	llong den = 10;
	llong temp = n;
	while (n/den > 0) {
		ans += n / den;
		den *= 5;
	}
	cout << ans;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
int r[300005], c[300005];
typedef pair<int, int>pi;
map<pi, bool>mp;
queue<int>q;
vector<int>vec;
int main()
{
    int h, w, m, rmx= 0, cmx= 0;
    scanf("%d %d %d", &h, &w, &m);
    while(m--)
    {
        int x, y;
        scanf("%d %d", &x, &y);
        mp[{x, y}]= 1;
        r[x]++;c[y]++;
        rmx= max(rmx, r[x]);
        cmx= max(cmx, c[y]);
    }
    for(int i=1; i<=w; i++)
    if(c[i]==cmx)q.push(i);
    for(int i=1; i<=h; i++)
    if(r[i]==rmx)vec.push_back(i);
    int res= rmx+cmx-1;
    bool f= 1;
    for(int i=0; i<vec.size() && f; i++)
    {
        while(!q.empty())
        {
            if(mp[ { vec[i], q.front() } ])q.pop();
            else
            {
                res++;
                f= 0;
                break;
            }
        }
    }
    if(f)
    {
        vec.clear();
        while(!q.empty())q.pop();
        for(int i=1; i<=w; i++)
        if(c[i]==cmx)vec.push_back(i);
        for(int i=1; i<=h; i++)
        if(r[i]==rmx)q.push(i);
        f= 1;
        for(int i=0; i<vec.size() && f; i++)
        {
            while(!q.empty())
            {
                if(mp[ { q.front(), vec[i] } ])q.pop();
                else
                {
                    res++;
                    f= 0;
                    break;
                }
            }
        }
    }
    printf("%d\n", max(max(rmx, cmx), res));
    return 0;
}


Measured memory_bytes: 27616
io = STDIN
a,b,c,d,e,f=io.gets.split.map(&:to_i)
#水100あたり砂糖e
#水+砂糖 < f
#(100*a+100*b+c+d) <= f
#(c+d)/(100*a+100*b) <= e
def calc(a,b,c,d,e,f)
  ans=[0,a*100,0]  #濃度,砂糖水,砂糖
  (0..f/(100*a)).each do |aa|
    (0..f/(100*b)).each do |bb|
      next if aa==0 && bb==0
      water=100*(a*aa+b*bb)
      (0..(f-water)/c).each do |cc|
        (0..(f-water-c*cc)/d).each do |dd|
          suger=(c*cc+d*dd)
          ee=suger*100.0/water
          next if ee>e
          return [ee,water+suger,suger] if e==ee
          next if water+suger>f
          if ans[0]<ee
            ans=[ee,water+suger,suger]
          end
        end
      end
    end
  end
  return ans
end
ans= calc(a,b,c,d,e,f)
puts "#{ans[1]} #{ans[2]}"


Measured memory_bytes: 1788
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>
#include <iomanip>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9 + 7);

int main(void) {
	int n;
	ll a, b;
	cin >> n >> a >> b;
	
	vector<ll> x(n);
	for(int i = 0; i < n; ++i) {
		cin >> x[i];
	}
	
	ll ans = 0LL;
	for(int i = 0; i < n - 1; ++i) {
		ll dist = x[i + 1] - x[i];
		
		ans += min(a * dist, b);
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 4020
#include<iostream>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;
int main(){
	int n;
	cin>>n;
	int ans=1,now=1;
	while(now<=n){
		ans=now;
		now*=2;
	}
	cout<<ans;

return 0;
}

Measured memory_bytes: 256
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef long double ld;

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


int main() {
    ld N,T,A;
    cin >> N >> T >> A;
    vector<ld> H(N);
    rep(i,N){
        cin >> H[i];
    }


    ld ans=LLONG_MAX,resultNum=0;
    rep(i,N){
        ld result = T - H[i] * 0.006;
        result = abs(A-result);
        if(result < ans){
            ans = result;
            resultNum = i+1;
        }
    }

    cout << resultNum << endl;
}



Measured memory_bytes: 3780
#include <iostream>
#include <string>
#include <vector>
#include <queue>
using namespace std;

typedef pair<int,string> P;
struct S{ int t,a,b; };

int main(){
	int n;
	cin >> n;
	for(int i = 0;i < n;i++){
		int o = 0,x = 0,cnt = 1,os = -1,tmp = 0;
		string s;
		cin >> s;
		if(s.length() <= 2){
			cout << 0 << endl;
			continue;
		}
		queue<P> que;
		vector<S> vec;
		que.push(P(0,s));
		bool f = true;
		while(!que.empty()){
			if(tmp++ >= 200){
				cout << -1 << endl;
				f = false;
				break;
			}
			P p = que.front();que.pop();
			string t = p.second;
			int v = p.first;
			//cout << v << " " << t << endl;
			if(t == "ox" || t == "xo")continue;
			if(t == "o"){
				os = v;
				continue;
			}
			if(t == "oo"){
				vec.push_back({0,v,1});
				os = cnt;
				cnt += 2;
				continue;
			}
			if(t.substr(0,2) == "ox"){
				vec.push_back({0,v,2});
				cnt++;
				que.push(P(cnt++,t.substr(2,t.length() - 2)));
				continue;
			}
			int ao = 0,ax = 0;
			for(int j = 0;j < t.length();j++){
				if(t[j] == 'o') ao++;
				else ax++;
			}
			o = 0;x = 0;
			bool flag = false;
			for(int j = 0;j < t.length() - 1;j++){
				if(t[j] == 'o') o++;
				else x++;
				if(o >= x && ao - o >= ax - x){
					vec.push_back({0,v,j + 1});
					que.push(P(cnt++,t.substr(0,j + 1)));
					que.push(P(cnt++,t.substr(j + 1,t.length() - j - 1)));
					tmp = 0;
					flag = true;
					break;
				}
			}
			if(!flag){
				if(os == -1) que.push(P(v,t));
				else if(t[0] == 'x'){
					vec.push_back({1,os,v});
					que.push(P(cnt++,"o" + t));
					tmp = 0;
				}else{
					vec.push_back({1,v,os});
					que.push(P(cnt++,t + "o"));
					tmp = 0;
				}
				os = -1;
			}
		}
		if(!f) continue;
		cout << vec.size() << endl;
		for(S p: vec){
			if(!p.t) cout << "split ";
			else cout << "join ";
			cout << p.a << " " << p.b << endl;
		}
	}
	return 0;
}

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

int main(){
  long x = 0;
  long y = 0;
  long s = 0;
  long lx = 0;
  long ly = 0;
  scanf("%ld %ld",&x,&y);
  lx = labs(x);
  ly = labs(y);
  if(lx == ly){
    s = 1;
  }else if(lx < ly){
    if(x > 0){
      if(y > 0){
        s = ly - lx;//
      }else if(y < 0){
        s = ly -lx + 1;//
      }
    }else if(x < 0){
      if(y > 0){
        s = ly - lx + 1;//
      }else if(y < 0){
        s = ly - lx + 2;//
      }
    }else{
       if(y > 0){//
        s = ly;
      }else if(y < 0){//
        s = ly+1;
      }
    }
  }else{
    if(x > 0){
      if(y > 0){
        s = lx - ly + 2;//
      }else if(y < 0){
        s = lx - ly + 1;//
      }else{
        s = lx + 1;//
      }
    }else if(x < 0){
      if(y > 0){
        s = lx - ly + 1;//
      }else if(y < 0){
        s = lx - ly;//
      }else{
        s = lx;
      }
    }
  }
  
  printf("%ld",s);
  return 0;
}
        
      


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


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


Measured memory_bytes: 256
function heron(a,b,c){
   var s=(a+b+c)/2;
   var S=Math.sqrt(s*(s-a)*(s-b)*(s-c));
   return S;
}
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var xy1=(Arr.shift()).split(",").map(Number);
var xy2=(Arr.shift()).split(",").map(Number);
var x1=xy1[0];var y1=xy1[1];
var x2=xy2[0];var y2=xy2[1];
var sum=0;
for(var I=0;I<Arr.length;I++){
   var xy3=Arr[I].split(",").map(Number);
   var x3=xy3[0];var y3=xy3[1];
   var d12=Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2,2));
   var d13=Math.sqrt(Math.pow(x1-x3,2)+Math.pow(y1-y3,2));
   var d23=Math.sqrt(Math.pow(x2-x3,2)+Math.pow(y2-y3,2));
   sum+=heron(d12,d13,d23);
   x2=xy3[0];
   y2=xy3[1];
}
console.log(sum.toFixed(6));

Measured memory_bytes: 7632
#include<stdio.h>
#include<iostream>
using namespace std;

int main()
{
    long long int n=0;
    long long int b=0;
    long long int c=0;
    long long int d=100000;
    long long int a=0;
    long long int i=0;
    cin>>n;
    cin>>a;
    for(i=0;i<n;i++)
    {
        cin>>b;
        a=a-b;
        if(a>=0)
        {
            c=c+1;
        }
        if(b<d)
        {
            d=b;
        }
    }
    c=c+(a/d);
    cout<<c;
}

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

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

using namespace std;

int main() {
  vector<bool> isp(10001, true);
  for(int i=2;i*i<=10000;++i)
    if(isp[i])
      for(int j=i*i;j<=10000;j+=i)
        isp[j]=false;
  vector<int> pl;
  for(int i=2;i<=10000;++i)
    if(isp[i])
      pl.push_back(i);
  vector<int> ps(pl.size()+1);
  partial_sum(begin(pl),end(pl),begin(ps)+1);
  vector<int> cnt(10001);
  REP(i,ps.size())REP(j,i) {
    int sum = ps[i] - ps[j];
    if (sum <= 10000)
      ++cnt[sum];
  }
  while(1){
    int n;
    cin>>n;
    if(!n)break;
    cout << cnt[n] << endl;
  }
  return 0;
}

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

#define ALL(a)  (a).begin(),(a).end()
#define ALLR(a)  (a).rbegin(),(a).rend()
#define spa << " " <<
#define MP make_pair
#define test cout<<"test"<<endl;
#define fi first
#define se second
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const ll INF = 1e18;
const ll zero=0;
using P = pair<ll, ll>;
void chmin(ll &a,ll b){if(a>b)a=b;}
void chmax(ll &a,ll b){if(a<b)a=b;}
void pmod(ll &a,ll b){a=(a+b)%MOD;}
void pmod(ll &a,ll b,ll c){a=(b+c)%MOD;}
void qmod(ll &a,ll b){a=(a*b)%MOD;}
void qmod(ll &a,ll b,ll c){a=(b*c)%MOD;}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x,ll y,ll z){if(x)cout<<y<<endl;else cout<<z<<endl;}
void ans(bool x,string y,string z){if(x)cout<<y<<endl;else cout<<z<<endl;}   
ll gcd(ll x,ll y){ll r;while((r=x%y)!=0){x=y;y=r;}return y;}

int main(){
  ll i,j,o;
  ll res=0,res1=INF,res2=-INF,buf=0;
  bool judge = true;
  ll x,y;cin>>x>>y;
  if(x*y<0){
    res=abs(x+y)+1;
  }
  else if(x*y==0&&x>y)res=abs(x-y)+1;
  else if(x<y)res=abs(x-y);
  else res=abs(x-y)+2;
  cout<<res<<endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
template<class T> inline bool chmin(T& a, T b){ if(a > b){ a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b){ if(a < b){ a = b; return true; } return false; }





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	ll sum = 0;
	vector<int> a(n + 2);
	rep(i,n){
		cin >> a.at(i + 1);
		sum += abs(a.at(i) - a.at(i + 1));
	}
	sum += abs(a.at(n));
	rep(i,n){
		cout << sum - abs(a.at(i) - a.at(i + 1)) - abs(a.at(i + 1) - a.at(i + 2)) + abs(a.at(i) - a.at(i + 2)) << endl;
	}
}


Measured memory_bytes: 1664
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;
import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{
	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-12;

	int n, k, t, u, v, goal;
	int[] d;

	void run(){
		n=sc.nextInt();
		k=sc.nextInt();
		t=sc.nextInt();
		u=sc.nextInt();
		v=sc.nextInt();
		goal=sc.nextInt();
		d=new int[n+1];
		for(int i=0; i<n; i++){
			d[i]=sc.nextInt();
		}
		d[n]=goal;

		boolean boost=false;
		double boostTime=0;
		int carrot=0;
		double x=0;
		double time=0;

		for(int i=0; i<=n; i++){
			if(boost){
				for(; carrot>=0; carrot--){
					if(x+v*boostTime>d[i]+EPS){
						time+=(d[i]-x)/v;
						boostTime-=(d[i]-x)/v;
						x=d[i];
						break;
					}else{
						x+=v*boostTime;
						time+=boostTime;
						boostTime=t;
					}
				}
			}
			double s=(double)(d[i]-x)/u;
			time+=s;
			carrot++;
			if(!boost||carrot>k){
				boost=true;
				boostTime=t;
				carrot--;
			}
			x=d[i];
		}
		println(time+"");
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}

void solve()
{
	int a, b, h;
	cin >> a >> b >> h;
	cout << h / 2 * (a + b);
}


 // a b c a b c a b c a b c
 
int main()
{
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
    Red;
  	int T = 1;
  //	cin >> T;
  	for(int i = 1; i <= T; ++i){
  		solve();
  	}
  	return 0;

}

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

#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define INF (1 << 29)

using namespace std;

int main(){
	int n; cin >> n;
	int ac = 0, wa = 0, tle = 0, re = 0;

	for(int i = 0; i < n; i++){
		string str;
		cin >> str;

		if(str == "AC") ac++;
		else if(str == "WA") wa++;
		else if(str == "TLE") tle++;
		else re++;
	}

	cout << "AC x " << ac << endl;
	cout << "WA x " << wa << endl;
	cout << "TLE x " << tle << endl;
	cout << "RE x " << re << endl;

	return 0;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll,ll> p;


int main()
{
  int n;
  cin >> n;
  vector<int> v(n, 0);
  for (int i = 0; i < n; i++)
  {
    cin >> v[i];
  }

  sort(v.begin(), v.end());
  vector<p> counts;
  int count = 0;

  for (int i = 1; i < n; i++)
  {
    if (v[i] != v[i-1])
    {
      counts.push_back({v[i-1], i - count});
      count = i;
    }
  }

  counts.push_back({v[n-1], n - count});

  sort(counts.rbegin(), counts.rend());

  // for(p i : counts){
  //   cout << i.first << endl;
  //   cout << i.second << endl;
  // }
  ll res = -1;
  
  for(p i : counts)
  {
    if (res == -1 && i.second >= 4)
    {
      res = i.first * i.first;
      cout << res << endl;
      return 0;
    }
    if (i.second >= 2 && res == -1)
    {
      res = i.first;
    }
    else if (i.second >= 2 && res != -1)
    {
      res *= i.first;
      cout << res << endl;
      return 0;
    }
  }
  cout << 0 << endl;
  // for(p i : counts){
  //   cout << i.first << endl;
  //   cout << i.second << endl;
  //   cout << "===============" << endl;
  // }


  return 0;
}


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

const int mod = 1e9 + 7;
const int MN = 1000010;

int exp(int x, int n) {
    int ret = 1;
    while(n) {
        if(n & 1) ret = 1LL * ret * x % mod;
        x = 1LL * x * x % mod;
        n >>= 1;
    }
    return ret;
}
int inv(int x) {
    return exp(x, mod - 2);
}
int fact[MN], invf[MN];
int comb(int n, int k) {
    if(k < 0 || n < k) return 0;
    else return 1LL * fact[n] * invf[k] % mod * invf[n - k] % mod;
}

int N, M, K;

int main() {
    fact[0] = 1;
    for(int i = 1; i < MN; i++) {
        fact[i] = 1LL * fact[i - 1] * i % mod;
    }
    for(int i = 0; i < MN; i++) {
        invf[i] = inv(fact[i]);
    }

    cin >> N >> M >> K;
    N--;

    int ans = 0;
    int sum = 1;
    int l = 0;
    int r = 0;
    ans += 1LL * exp(3, M + K) % mod * sum % mod;
    ans %= mod;

    for(int i = M + K - 1; i >= 0; i--) {
        sum *= 2;
        sum %= mod;
        sum += comb(M + K - i - 1, l - 1);
        sum %= mod;
        sum += mod - comb(M + K - i - 1, r);
        sum %= mod;

        int nl = M - min(i, M);
        int nr = M - max(0, i - K);

        if(l < nl) {
            sum += mod - comb(M + K - i, l);
            sum %= mod;
        }
        if(r < nr) {
            sum += comb(M + K - i, nr);
            sum %= mod;
        }

        ans += 1LL * comb(N + M + K - i, N) * exp(3, i) % mod * sum % mod;
        ans %= mod;

        l = nl;
        r = nr;
    }

    cout << ans;
}


Measured memory_bytes: 8064
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define int long long
#define endl "\n"
#define pii pair<int,int> 
#define ff first
#define ss second
#define mii map<int,int>
#define si set<int>
#define sti stack<int>
#define qi queue<int>
#define vi vector<int>
#define pq priority_queue<int>
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const int M=1e9+7;

int32_t main(){
    IOS;
    int x,y,z;
    cin>>x>>y>>z;
    swap(x,y);
    swap(x,z);
    cout<<x<<" "<<y<<" "<<z<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define st first
#define nd second
#define pii pair<int,int>

using namespace std;

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

    string s; cin>>s;
    int ans = 0;
    for(auto x : s)
    {
        ans += (x - '0');
    }
    if(ans % 9 == 0) cout<<"Yes";
    else cout<<"No";

    return 0;
}


Measured memory_bytes: 3748
#2019/10/16
N, *a = map(int, open(0).read().split())
#print(N, a)
i=0
cnt=0
button=[]
while(True):
    #print("i=",i, "a[i]=",a[i])
    #print("button=", button)
    if i==1:
        print(cnt)
        break
    if cnt >= N:
        print("-1")
        break
    cnt+=1
    i=a[i]-1

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repr(i, n) for(int i = (int)(n); i >= 0; i--)
#define repm(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define repmr(i, m, n) for(int i = (int)(n); i >= (int)(m); i--)
#define all(x) (x).begin(),(x).end()
#define inf 2e9

using namespace std;
typedef long long int lli;
typedef long long ll;

int n,q;
vector<vector<int>> tree(200000, vector<int>());

int main() {
    int a,b;
    cin >> a >> b;

    if(a+b > 9){
        cout << "error" << endl;
    }
    else{
        cout << a+b << endl;
    }
}


Measured memory_bytes: 4992
#include <stdio.h>

int main()
{
    int k,x,s,e;
    scanf("%d %d",&k,&x);
    s = x - k + 1;
    e = x + k - 1;
    if (s < -1000000)
    {
        s = -1000000;
    }
    if (e > 1000000)
    {
        e = 1000000;
    }
    
    for (int i = s; i <= e; i++)
    {
        printf("%d ",i);
    }
    
}


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

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

Measured memory_bytes: 4052
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
int a[100000+10], cnt = 0;
typedef long long ll;
using namespace std;
bool is_prime(int m)
{
	if(m == 1)
		return false;
	for(int i = 2; i <= sqrt(m); i++){
		if(m%i == 0){
			return false;
		}
	}
	return true;
}
bool panduan(int m)
{
	if(is_prime(m) && is_prime((m+1)/2)){
		return true;
	}
	return false;
}
int main()
{
	int n, l, r;
	for(int i = 1; i <= 100000; i=i+2){
		if(panduan(i)){
			cnt++;
		}
		a[i] = cnt;
	}
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		scanf("%d%d", &l, &r);
		int res = 0;
		res = a[r]-a[l];
		if(is_prime(l)&&is_prime((l+1)/2)){
			res++;
		}
		printf("%d\n", res);
	} 
	return 0;
} 

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main()
{

	int n;
	int i;
	
	cin>>n;	
	i=1;
	do {
		int x=i;
		if( 0 == x%3 ) {
			cout<<" "<<i;
		} else {
			do {
				if( 3== x%10 ) {
					cout<<" "<<i;
					break;
				}
				x /= 10;
			} while( 0 != x );
		}
	} while( ++i <= n );
	
	cout <<endl; 
	
    return 0;
}

Measured memory_bytes: 1164
n, m = [int(c) for c in input().split(' ')]
mx = [input() for _ in range(n)]

table = [[0] * m for _ in range(n)]
counter = 0
for i in range(n):
    for j in range(m):
        if table[i][j]:
            continue
        counter += 1
        # print("Set {} for ({},{}), ({},{}), ({},{}), ({},{}).".format(
        #     counter, i, j, n-i-1, j, i, m-j-1, n-i-1, m-j-1
        # ))
        table[i][j] = table[n-i-1][j] = table[i][m-j-1] = table[n-i-1][m-j-1] = counter
# print(table)

cnt_need = [0] * counter
cnt_had = [0] * 26
for i in range(n):
    for j in range(m):
        cnt_need[table[i][j]-1] += 1
        cnt_had[ord(mx[i][j]) - ord('a')] += 1

cnt_need.sort()
cnt1, cnt2, cnt4 = [0] * 3
for cnt in cnt_need:
    if cnt == 1:
        cnt1 += 1
    elif cnt == 2:
        cnt2 += 1
    elif cnt == 4:
        cnt4 += 1
    else:
        raise RuntimeError("Unexpected count: {}".format(cnt))
assert cnt1 in [0, 1], "Unexpected count of units: {}".format(cnt1)

possible = 1
for had in cnt_had:
    if had % 2:
        if cnt1 > 0:
            cnt1 -= 1
            had -= 1
        else:
            possible = 0
    if had % 4:
        if cnt2 > 0:
            cnt2 -= 1
            had -= 2
        else:
            possible = 0

print("Yes" if possible else 'No')


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
  ll a, b, k;
  cin >> a >> b >> k;
  if(k <= a)
  {
      cout << a-k << " " << b << endl;
  }
  else
  {
      k -= a;
      if(k <= b)
      {
          cout << 0 << " " << b-k << endl;
      }
      else
      {
          cout << "0 0" << endl;
      }
  }
}

Measured memory_bytes: 256
s = input()
flag = True
c, d = 0, 0
for i in range(len(s)):
    if i == 0 and s[i] != "A":
        flag = False
        break
    elif 2 <= i <= len(s) - 2 and s[i] == "C":
        c += 1

    if s[i].lower() == s[i]:
        d += 1

if c != 1:
    flag = False

if d != len(s) - 2:
    flag = False

if flag:
    print("AC")
else:
    print("WA")


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

int main(){
    int N, K, ans =0;
    cin >> N >> K;
    vector<int> x(N);

    for(int i=0; i<N; i++){
	cin >> x[i];
    }
    for(int i=0; i<N; i++){
	ans += 2*min(x[i], abs(K-x[i]));
    }

    cout <<ans<< endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2147483647
#define inf 1000000007
#define lol long long
#define in(n,s) insert(n,s)//ノート参照
#define SYOU(x) setprecision(x)
#define abs(x,y) (max(x,y)-min(x,y))
#define mp make_pair
#define fi first
#define se second
using namespace std;
int gcd(int x,int y){//最大公約数
  if(y>x) swap(x,y);
  int r=x%y;
  while(r!=0){
    x=y;
    y=r;
    r=x%y;
  }
  return y;
}
int Lcm(int x,int y){//最小公倍数
  int t=x*y;
  return t/gcd(x,y);
}
priority_queue<int> i[300000];
bool ii[111][111];
int a,b,c,d,g,h;
bool can(int n,int m){
  if(n<0) return false;
  if(m<0) return false;
  if(n>=a) return false;
  if(m>=b) return false;
  return true;
}
int dfs(int n,int m){
  if(n==g&&m==h) return true;
  //if(i[n][m]!=i[c][d]||!can(n,m)||ii[n][m]) return false;
  ii[n][m]=true;
  return dfs(n+1,m)+dfs(n,m+1)+dfs(n-1,m)+dfs(n,m-1);
}
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long e=0,f=0,j=1,u;
  string w,p;
  cin >>a;
  bool cu=false;
  for(int n=1;n<=9;n++){
    for(int m=1;m<=9;m++){
      if(n*m==a) cu=true;
    }
  }
  if(cu) cout <<"Yes\n";
  else cout <<"No\n";
  return (0);
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    int n;
    ll a[100050];
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    ll sum = 0;
    ll ans;
    ll now = 0;
    for(int i = 1; i <= n; i++) {
        sum += a[i];
        if(i % 2 == 1) {
            if(sum >= 0) {
                now += sum + 1;
                sum = -1;
            }
        }
        if(i % 2 == 0) {
            if(sum <= 0) {
                now += 1 - sum;
                sum = 1;
            }
        }
    }
    ans = now;
    now = 0;
    sum = 0;
    for(int i = 1; i <= n; i++) {
        sum += a[i];
        if(i % 2 == 0) {
            if(sum >= 0) {
                now += sum + 1;
                sum = -1;
            }
        }
        if(i % 2 == 1) {
            if(sum <= 0) {
                now += 1 - sum;
                sum = 1;
            }
        }
    }
    ans = min(ans, now);
    cout << ans << endl;
    return 0;
}


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

using namespace std;

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

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

const int MMAX = -1000000;
const int MAX = 1000000;

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

  int k, x;
  cin >> k >> x;

  int l = x - k + 1;
  int r = x + k - 1;

  if (l < MMAX) l = MMAX;
  if (r > MAX) r = MAX;
  for (int i = l; i <= r; ++i) {
    cout << i << " \n"[i==r];
  }

  return 0;
}

Measured memory_bytes: 256
S = int(input())

mod = 10 ** 9 + 7

DP = [0] * (S + 11)
DP[0], DP[1], DP[2], DP[3] = 1, 0, 0, 1

C = 2
for i in range(4, S + 1):
  DP[i] = (C - DP[i - 1] - DP[i - 2]) % mod
  C = (C + DP[i]) % mod
  
print(DP[S])

Measured memory_bytes: 9096
#include <stdio.h>


int main(void){
  long N;

  scanf("%ld",&N);

  if(N == 0){
    printf("0\n");
    return 0;
  }
  if(N == 1 || N == 2 || N == 3){
    printf("1\n");
    return 0;
  }

  long i = 0;

  for(i = N/2 ; i > 1; i--){
     if(i * i <= N){
       printf("%ld\n",i * i);
       break;
     }
  }


  return 0;
}

Measured memory_bytes: 128
object Main extends App {
  val Array(n, k) = Array(io.StdIn.readLine().toInt, io.StdIn.readLine().toInt)
  val arr = io.StdIn.readLine().split(" ").map(_.toInt)
  def abs(x: Int) = Math.abs(x)
  def min(x: Int, y: Int) = Math.min(x, y)
  val res = arr.map(x => min(abs(x), abs(x - k)) * 2).sum
  println(res)
}


Measured memory_bytes: 25508
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
#include <queue>
#include <set>

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

using namespace std;
typedef long long int ll;
const int INF = 1000000000;
const double PI = 3.1415926535;

struct ToGoal {
    int goal_point_idx;
    int distance;
};

ToGoal to_goal[100000];
int ans[100000] = { 0 };

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

    vector<int> r_to_l;
    vector<int> l_to_r;
    rep(i, s.size()-1) {
        if (s[i] == 'R' && s[i + 1] == 'L') {
            r_to_l.push_back(i);
        }
        else if (s[i] == 'L' && s[i + 1] == 'R') {
            l_to_r.push_back(i);
        }
    }

    int count = 0;
    rep(i, s.size()) {
        to_goal[i].goal_point_idx = count;
        to_goal[i].distance = abs(i - r_to_l[count]);
        if (count >= l_to_r.size()) continue;
        else if (i == l_to_r[count]) {
            count++;
        }
    }

    rep(i, s.size()) {
        if (to_goal[i].distance % 2 == 0) {
            ans[r_to_l[to_goal[i].goal_point_idx]]++;
        }
        else {
            ans[r_to_l[to_goal[i].goal_point_idx]+1]++;
        }
    }

    rep(i, s.size()) {
        if (i != s.size() - 1) {
            cout << ans[i] << " ";
        }
        else {
            cout << ans[i] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 2300
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]


def solve():
    s = set([x for x in input()])
    for i in range(26):
        e = chr(ord('a') + i)
        if e not in s:
            print(e)
            return
    print('None')
        
t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()



"""

1 4
7
RRRR
1 1 0 1
----
4

1 4
47
RCRR
1 1 0 1
----
-1

2 2
10
RR
RR
1 7
4 1
----
4

2 2
10
RR
RR
7 4
7 4
----
-1

3 3
8
RCR
RRC
RRR
1 1 1
1 1 1
1 3 1


3 3
1
RCR
RRC
RRR
1 1 1
1 1 1
1 3 1


"""





Measured memory_bytes: 4340
STR = input().split()
#STR = int(STR)

IN1 = STR[0]
IN2 = STR[1]
IN1a = int(IN1)
IN2a = int(IN2)
#IN1 = int(IN1)
#IN2 = int(IN2)

#print(IN1s)
length = IN2a - IN1a + 1
#IN1s[0] = 2
#print(IN1s)
#print(STR)
#print(IN1)
#print(length)
out = 0
for i in range(length):
    IN1s = [int(x) for x in list(str(IN1a))]
    IN2s = [int(x) for x in list(str(IN2a))]
    if IN1s[0] == IN1s[4] and IN1s[1] == IN1s[3]:
        IN1a += 1
        out += 1
    else:
        IN1a += 1
        i += 1

print(out)
            

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

int main(){
    int n, k;
    cin >> n >> k;
    vector<int> p(n);
    rep(i,n) cin >> p.at(i);
    
    sort(p.begin(), p.end());
    int ans = 0;
    rep(i,k) ans += p.at(i);
    
    cout << ans << endl;
  
}


Measured memory_bytes: 3632
#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;
const int INF = 0x3f3f3f3f;
struct node
{
    int to, w, c, next;
} edge[50005];
int head[10005], ip, cost[10005], dis[10005], n, m;
bool vis[10005];
void addedge(int u, int v, int d, int c)
{
    edge[ip].to = v;
    edge[ip].w = d;
    edge[ip].c = c;
    edge[ip].next = head[u];
    head[u] = ip++;
}
void spfa(int s)
{
    queue<int> q;
    for (int i = 1; i <= n; i++)
        cost[i] = dis[i] = INF;
    memset(vis, 0, sizeof(vis));
    dis[s] = 0;
    cost[s] = 0;
    vis[s] = 1;
    q.push(s);
    while (!q.empty())
    {
        int u = q.front();
        q.pop();
        vis[u] = 0;
        for(int i = head[u];i != -1;i = edge[i].next)
        {
            int to = edge[i].to;
            int w = edge[i].w;
            if(dis[to] > dis[u] + w||(dis[to] == dis[u]+w&&cost[to] > edge[i].c))
            {
                dis[to] = dis[u] + w;
                cost[to] = edge[i].c;
                if(!vis[to])
                {
                    q.push(to);
                    vis[to] = 1;
                }
            }
        }
    }
}
int main()
{
    while (scanf("%d %d", &n, &m) != EOF)
    {
        if (n == 0 && m == 0)
            break;
        memset(head, -1, sizeof(head));
        ip = 0;
        for (int i = 0; i < m; i++)
        {
            int u, v, d, c;
            scanf("%d %d %d %d", &u, &v, &d, &c);
            addedge(u, v, d, c);
            addedge(v, u, d, c);
        }
        spfa(1);
        int ans = 0;
        for (int i = 1; i <= n; i++)
            ans += cost[i];
        printf("%d\n", ans);
    }
    return 0;
}


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

using int64 = long long;
using uint64 = unsigned long long;

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

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

    if (A & B & 1) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;
typedef long long LL;
const int LEN = 1e2 + 10;
int A[LEN];

int main() {
    int N, K, pos = 1;
    cin >> N >> K;
    while (K--) {
        int D;
        cin >> D;
        while (D--) {
            int NO;
            cin >> NO;
            A[NO] += 1;
        }
    }
    int ans = 0;
    for (int i = 1; i <= N; i++) {
        if (A[i] == 0) {
            ans += 1;
        }
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
using namespace std;
mt19937_64 mrand(chrono::steady_clock::now().time_since_epoch().count());
//mt19937_64 mrand(42);
#define ii for(int i=1;i<=n;++i)
#define ji for(int j=1;j<=n;++j)
#define jj for(int j=1;j<=m;++j)
#define ij for(int i=1;i<=m;++i)
#define sz(x) ((ll)x.size())
#define all(x) x.begin(),x.end()
#define al(x) x+1,x+1+n
#define asd cout<<"ok"<<endl;
#define asdd cout<<"okok"<<endl;
#define pii pair<int,int>
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define pr(v) for(auto i:v) cout<<i<<" ";cout<<endl
#define prt(a, l, r) for(auto i=l;i<=r;++i) cout<<a[i]<<" ";cout<<endl;
#define pc(x) __builtin_popcount(x)
#define pb push_back

int main() {
    int x,y;
    cin>>x>>y;
    if((y-2*x)%2==0) {
        int b=(y-2*x)/2;
        int a=x-b;
        assert(2*a+4*b==y);
        if(a>=0 && b>=0) cout<<"Yes";
        else cout<<"No";
    } else cout<<"No";
}

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

long long n, k;
vector <int> v;

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

	v.clear();
	while (n) v.push_back(n%k), n /= k;

	cout << v.size() << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String line[] = sc.nextLine().split(" ");
		
		int d = Integer.parseInt(line[0]);
		int t = Integer.parseInt(line[1]);
		int s = Integer.parseInt(line[2]);

				
		if(t * s >=d) {
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
		
	}

}


Measured memory_bytes: 35656
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n-1); i >= 0; i--)
#define all(v) (v).begin(),(v).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
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; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
	int a, b, c, k;
	cin >> a >> b >> c >> k;
    int cnt = 0;
    while(a>=b) {
        b *= 2;
        cnt++;
    }
    while(b>=c) {
        c *= 2;
        cnt++;
    }
    if(cnt<=k) {
    	cout << "Yes" << "\n";
    } else {
    	cout << "No" << "\n";
    }
	return 0;
}


Measured memory_bytes: 3632
#include <iostream>

using namespace std;

const int MAX_N = 10001;

int s[MAX_N];
int r[MAX_N];

void init() {
	for (int i = 0; i < MAX_N; i++) {
		s[i] = i;
		r[i] = 0;
	}
}

int find(int i) {
	if (s[i]==i) {
		return i;
	}

	return s[i] = find(s[i]);
}


void unite(int x,int y) {
	x = find(x);
	y = find(y);
	if (x == y) {
		return;
	}

	if (r[x] > r[y]) {
		s[y] = x; 
	} else {
		s[x] = y;
		if (r[x] == r[y]) {
			r[y] ++;
		}
	}
}

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

	init();

	for (int i = 0; i < q; i++) {
		int com,x,y;
		cin >> com >> x >> y;
		if (com == 0) {
			unite(x,y);
		} else {
			if (find(x) == find(y)) {
				cout << "1" << endl;
			} else {
				cout << "0"  << endl;				
			}

		}

	}

	return 0;


}

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

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

    std::set<std::string> seti;
    std::string str;
    for (int i = 0; i < n; ++i) std::cin >> str, seti.insert(str);

    std::cout << seti.size();
}


Measured memory_bytes: 19136
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let s: String = scan(tokens);
    let t: String = scan(tokens);
    let mut s = s.into_bytes();
    let t = t.into_bytes();
    let ls = s.len();
    let lt = t.len();
    {
        let mut i = 0;
        while s.len() < ls + lt - 1 {
            let b = s[i];
            s.push(b);
            i += 1;
        }
    }
    let z: Vec<usize> = {
        let mut z = vec![0; lt + 1];
        let mut i = 0;
        let mut j = 1;
        while j < lt {
            if t[i] == t[j] {
                i += 1;
                j += 1;
                z[j] = i;
            } else if i == 0 {
                j += 1;
            } else {
                i = z[i];
            }
        }
        z
    };
    let mut f = vec![false; ls];
    let mut i = 0;
    let mut j = 0;
    while i < s.len() {
        if s[i] == t[j] {
            i += 1;
            j += 1;
            if j == t.len() {
                f[i - t.len()] = true;
                j = z[j];
            }
        } else if j == 0 {
            i += 1;
        } else {
            j = z[j];
        }
    }
    let mut visiting = vec![false; ls];
    let mut dp = vec![None; s.len()];
    fn dfs(
        i: usize,
        ls: usize,
        lt: usize,
        f: &[bool],
        dp: &mut [Option<usize>],
        visiting: &mut [bool],
    ) -> bool {
        if visiting[i] {
            return true;
        }
        if dp[i].is_some() {
            return false;
        }
        if f[i] {
            visiting[i] = true;
            if dfs((i + lt) % ls, ls, lt, f, dp, visiting) {
                return true;
            }
            visiting[i] = false;
            dp[i] = Some(dp[(i + lt) % ls].unwrap() + 1);
            return false;
        } else {
            dp[i] = Some(0);
            return false;
        }
    }
    let mut ans = 0;
    for i in 0..ls {
        if dfs(i, ls, lt, &f, &mut dp, &mut visiting) {
            println!("-1");
            return;
        }
        ans = std::cmp::max(ans, dp[i].unwrap());
    }
    println!("{}", ans);
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;

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

    string s; cin >> s;
    ll n = s.size();
    vector<ll> v(26);
    rep(i, n) {
        int x = s[i] - 'a';
        v[x]++;
    }
    ll ans = n * (n - 1) / 2 + 1;
    rep(i, 26) {
        ans -= v[i] * (v[i] - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 720
#include <bits/stdc++.h>
#define rep(i,n) for (i = 1; i <= (n); i++)
using namespace std;
using ll = long long;
#define sc scanf
#define pf printf
#define r0 return 0
// BIT
template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
    }
};
// GCD & LCM
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;}
// Main
int main()
{
	string s;
	cin >> s;
	ll len = s.size();
	ll i,j;
	string str = "";
	for(i = 0;i<len;i++)
    {
        str += "hi";
        if(str == s)
        {
            cout << "Yes" << endl;
            r0;
        }
    }
    cout << "No" << endl;
    r0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        int a = int.Parse(Console.ReadLine());
        Console.WriteLine(a + a * a + a * a * a );
    }
}

Measured memory_bytes: 27316
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n, m;
  cin >> n >> m;
  vector<ll> h(n);
  rep(i,n) {
    cin >> h[i];
  }
  vector<vector<ll>> g(n);
  rep(i,m) {
    ll a, b;
    cin >> a >> b;
    --a; --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<ll> ans(n);
  rep(v,n) {
    if (g[v].size() == 0) {
      ans[v] = 1;
      continue;
    }
    bool high = true;
    for (ll u : g[v]) {
      if (h[u] >= h[v]) {
        high = false;
      }
    }
    if (high) {
      ans[v] = 1;
    }
  }

   ll cnt = 0;
   rep(i,n) { if (ans[i]) ++cnt; }
   cout << cnt << endl;
}


Measured memory_bytes: 10592
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <functional>

using namespace std;

#define rep(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define foreach(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)

int N,M,nx,ny;
int field[31][31];
const int dy[4] = {1,0,-1,0}, dx[4] = {0,1,0,-1}; // N E S W
map<char,int> mp; // <cmd, identifier>

int func(char cmd, int move){
  int ret = 0;

  mp['N'] = 0; mp['E'] = 1; mp['S'] = 2; mp['W'] = 3;

  while(move--){
    nx += dx[mp[cmd]];
    ny += dy[mp[cmd]];
    if(field[ny][nx] == 1){ ret++; field[ny][nx] = 0; }
  }

  return ret;
}

int main(){
  int i,j;

  while(1){
    rep(i,31) rep(j,31) field[i][j] = 0;

    cin >> N; if(N == 0) break;
    rep(i,N){
      int x,y;
      cin >> x >> y;
      field[y][x] = 1;
    }

    char cmd;
    int move, get = 0;
    cin >> M;
    nx = 10; ny = 10;
    while(M--){
      cin >> cmd >> move;
      get += func(cmd,move);
    }

    cout << ((N == get) ? "Yes" : "No") << endl;
  }

  return 0;
}

Measured memory_bytes: 0