akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int L[4];
    rep(i, 4) cin >> L[i];    
    int N; cin >> N;
    int L1 = INF;
    int L2 = INF;
    L1 = min({L[0] * 4, L[1] * 2, L[2]});
    L2 = min(L1 * 2, L[3]);
    //cout << L1 << " " << L2 << endl;
    cout << L2 * (N / 2) + L1 * (N % 2) << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include <cstdio>
#include<cstring>
#include <cstdlib>  
#include<cmath>   
#include <cctype>
#include<string>
#include<set>
#include <iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility>
#define LEN 100005
using namespace std;
using ll = long long;
double pi() { return 3.14; }
int sum(int a, int b) { return a + b; }
int mul(int a, int b) { return a * b; }
ll LGCD(ll x, ll y) {if (x % y == 0) return y;else return LGCD(y, x % y);}
ll LLCM(ll x, ll y) {return x * y / LGCD(x, y);}

int GCD(int x, int y) {if (x % y == 0) return y;else return GCD(y, x % y);}
int LCM(int x, int y) {return x * y / GCD(x, y);}
ll dp[10000][10000];
ll combination(ll n, ll r) {
         if (n == r){dp[n][n] = 1;}
	else if (r == 0) {return dp[n][0] = 1;}
	else if (r == 1) {return dp[n][1]=n;}
	else {dp[n][r]=dp[n - 1][r - 1] % 1000000007 + dp[n - 1][r] % 1000000007;
	return dp[n][r]=combination(n - 1, r - 1) % 1000000007 + combination(n - 1, r) % 1000000007;}
}
int main()
{
	int N;
	string S, T;
	int A, B;
	string U;
	cin >> S >> T >> A >> B >> U;
	if(S==U) cout << A-1<<" "<<B << endl;
	else cout << A << " " << B-1 << endl;
	return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long ll;
template<typename T> bool chmax(T &a, T b) {if(a <= b){a = b; return true;}return false;}
template<typename T> bool chmin(T &a, T b) {if(a >= b){a = b; return true;}return false;}


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

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

using namespace std;

int main(void) {
    int N;
    string S;
    cin >> N >> S;
    int ans = 0;
    for(int i=0; i<N-2; i++) {
        if(S.substr(i, 3) == "ABC") {
            ans++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    char a;
    cin>>a;
    if((int)a>=65 && (int)a<=90)
    cout<<"A"<<endl;
    else
    cout<<"a"<<endl;
	return 0;
}

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

int N;
int A[210];

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

  while (true) {
    bool exist_odd = false;
    for (int i = 0; i < N; ++i) {
      if (A[i] % 2 != 0) exist_odd = true; 
    }

    if (exist_odd) break;

    for (int i = 0; i < N; ++i) {
      A[i] /= 2;
    }
    ++res;
  }

  cout <<res << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <random>

using namespace std;
 
#define mod 1000000007
#define FOR(x,to) for(int x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define long long long
inline int rei(){int x;cin>>x;return x;}
inline long rel(){long x;cin>>x;return x;}
inline string res(){string x;cin>>x;return x;}
//------------------------------------------------------- 
int P[1<<18];
void Calc(){
	int N = rei();
	multiset<int> st;
	for(int i=0;i<1 << N;i++){
		st.insert(-rei());
	}
	multiset<int> fin;
	fin.insert(*st.begin());
	st.erase(*st.begin());
	for(int bi = 0;bi < N;bi++){
		set<int>::iterator itrst = st.begin();
		int p = 0;
		for(set<int>::iterator itrf = fin.begin();itrf != fin.end();itrf++){
			while(itrst != st.end() && *itrf >= *itrst){
				itrst++;
			}
			if(itrst == st.end()){
				cout << "No" << endl;
				return;
			}
			P[p++] = *itrst;
			itrst = st.erase(itrst);
		}
		for(int i=0;i<p;i++){
			fin.insert(P[i]);
		}
	}
	cout << "Yes" << endl;
}
int main(int argc,char** argv){
	ios::sync_with_stdio(false), cin.tie(0);
	cout.tie(0); Calc(); return 0;
}

Measured memory_bytes: 13056
N=int(input())
A=list(map(int,input().split()))
MOD=10**9+7
x=dict()
y=dict()
flag=True

if N%2==0:
    for i in range(1,N,2):
        x[i]=0
    for i in range(N):
        if A[i] in x:
            x[A[i]]+=1
        else:
            y[A[i]]=1
    for idx in x:
        if idx==0:
            if x[idx]<1:
                flag=False
            continue
        if x[idx]!=2:
            flag=False
    ans=1
    if flag:
        for idx in x:
            ans=ans*x[idx]
    else:
        print(0)
        exit()
    ans=ans%MOD
    print(ans)

else:
    for i in range(0,N,2):
        x[i]=0
    for i in range(N):
        if A[i] in x:
            x[A[i]]+=1
        else:
            y[A[i]]=1
    for idx in x:
        if idx ==0:
            if x[idx]<1:
                flag=False
            continue
        if x[idx]!=2:
            flag=False
    ans=1
    if flag:
        for idx in x:
            ans=ans*x[idx]
    else:
        print(0)
        exit()
    ans=ans%MOD
    print(ans)

Measured memory_bytes: 14816
#include<cstdio>
#include<vector>
using namespace std;
int main(){
    int n,sum=0;
    vector<int> v;
    scanf("%d",&n);
    if(n==3){
        printf("2 5 63\n");
        return 0;
    }
    else if(n==4){
        printf("2 5 20 63\n");
        return 0;
    }
    else if(n==5){
        printf("2 5 20 30 63\n");
        return 0;
    }
    for(int i=2;i<=30000&&n;i++){
        if(i%2==0||i%3==0){
            v.push_back(i);
            sum+=i;
            sum%=6;
            n--;
        }
    }
    if(sum==2){
        for(int i=v.back()+1;i<=30000;i++){
            if(i%6==0){
                v.push_back(i);
                break;
            }
        }
        for(int i=0;i<v.size();i++){
            if(v[i]!=8){
                printf("%d ",v[i]);
            }
        }
        printf("\n");
    }
    else if(sum==3){
        for(int i=v.back()+1;i<=30000;i++){
            if(i%6==0){
                v.push_back(i);
                break;
            }
        }
        for(int i=0;i<v.size();i++){
            if(v[i]!=9){
                printf("%d ",v[i]);
            }
        }
        printf("\n");
    }
    else if(sum==5){
        for(int i=v.back()+1;i<=30000;i++){
            if(i%6==4){
                v.push_back(i);
                break;
            }
        }
        for(int i=0;i<v.size();i++){
            if(v[i]!=9){
                printf("%d ",v[i]);
            }
        }
        printf("\n");
    }
    else{
        for(int i=0;i<v.size();i++){
            printf("%d ",v[i]);
        }
        printf("\n");
    }
}

Measured memory_bytes: 512
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
#define INF1  INT_MAX;
#define INF2  LLONG_MAX;
#define PI  3.14159265358979323846;
#define MOD 1000000007;
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;


int main(){
int N,H,W;
cin>>N>>H>>W;
cout<<(N-H+1)*(N-W+1)<<endl;


return 0;
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>

using namespace std;

#define sz(a) static_cast<int>((a).size())
#define f first
#define s second
#define els(v) for (auto &el : (v))


#ifdef KIRYA
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...)
#endif

template<typename T>
void _dbg(const char* _s, T _h) {
    cerr << _s << " = " << _h << "\n";
}

template<typename T, typename... Ts>
void _dbg(const char*_s, T _h, Ts... _t) {
    int _b = 0;
    
    while (((_b += *_s == '(') -= *_s == ')') != 0 || *_s != ',')
        cerr << *_s++;
    
    cerr << " = " << _h << ",";
    _dbg(_s + 1, _t...);
}

const int64_t INF = static_cast<int64_t>(1e9) + 7;
const int64_t LINF = INF * INF;
const int MAXN = static_cast<int>(1e6) + 17;

void solve() {
    string s, t;
    cin >> s >> t;
    int a, b;
    cin >> a >> b;
    string u;
    cin >> u;
    if (s == u) {
        --a;
    } else {
        --b;
    }
    cout << a << ' ' << b << '\n';
}

int main() {
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    
    int q = 1;

    for (int i = 0; i < q; ++i) {
        solve();
    }
}

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

// ?????¬???????????¬??????
#pragma region MACRO
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define PED cout << "\n"
#define rep(i,n) for(int i=0; i<(int)n; ++i)
#define REP(i,x,n) for(int i=x; i<(int)n; ++i)
#define repi(i,n) for(int i=0; i<=(int)n; ++i)
#define REPI(i,x,n) for(int i=x; i<=(int)n; ++i)
#define ILP while(true)
#define FOR(i,c) for(__typeof((c).begin())!=(c).begin(); i!=(c).end(); ++i)
#define ALL(c) (c).begin(), (c).end()
#define mp make_pair
#pragma endregion

// ???
#pragma region TYPE_DEF
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
typedef pair<string, int> psi;
typedef pair<int, string> pis;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long double> vld;
typedef vector<long> vl;
typedef vector<long long> vll;
typedef vector<string> vs;
#pragma endregion

// Effective std
#pragma region ESTD
template<typename C, typename T> int count(C& c, T t) { return count(ALL(c), t); }
template<typename C, typename F> int count_if(C& c, F f) { return count_if(ALL(c), f); }
template<typename C, typename T> void erase(C& c, T t) { remove(ALL(c), t), c.end(); }
template<typename C> void remove(vector<C>& c, unsigned int index) { c.erase(c.begin()+index); }
template<typename C, typename T, typename U> void replace(C& c, T t, U u) { replace(ALL(c), t, u); }
template<typename C, typename F, typename U> void replace_if(C& c, F f, U u) { (ALL(c), f, u); }
template<typename C> void reverse(C& c) { reverse(ALL(c)); }
template<typename C> void sort(C& c) { sort(ALL(c)); }
template<typename C, typename Pred> void sort(C& c, Pred p) { sort(ALL(c), p); }
#pragma endregion

// ?????°
#pragma region CONST_VAL
constexpr int PI = (2*acos(0.0));
constexpr int EPS = (1e-9);
constexpr int MOD = (int)(1e9+7);
constexpr int INF = 100000000;
#pragma endregion


int main()
{
    int n;
    while(cin>>n, n) {
        vi v(n);
        rep(i,n) cin >> v[i];
        sort(v);
        int ans = INF;
        rep(i,n-1) {
            ans = min(ans, v[i+1]-v[i]);
        }
        P(ans);
    }
    return 0;
}

Measured memory_bytes: 3048
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
int main()
{
    auto v = std::vector<int>();
    int n;
    std::cin >> n;
    for (int i = 0; i < n; i++)
    {
        int num;
        std::cin >> num;
        v.push_back(num);
    }

    auto v2 = v;
    std::sort(v2.begin(), v2.end());

    int count = 0;
    for (int i = 0; i < n; i++)
    {
        if (v[i] == v2[i])
        {
            count++;
        }
    }

    if (count == n - 2 || count == n)
    {
        std::cout << "YES";
    }
    else
    {
        std::cout << "NO";
    }
}

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

class UnionFind{
    public:
    //親の番号を格納する。親だった場合は-(その集合のサイズ)
    vector<int> parent;

    //-1で初期化。最初はすべてバラバラ
    UnionFind(int N){
        parent = vector<int>(N,-1);
    }

    //Aがどのグループに属しているか(Aの根)を調べる
    int root(int A){
        if(parent[A] < 0) return A;
        return parent[A]=root(parent[A]);
    }

    //自分のいるグループの頂点数を調べる
    int size(int A){
        return -parent[root(A)];
    }

    //AとBをくっつける
    bool unite(int A, int B) {
    //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        //既にくっついているからくっつけない
        if(A == B) return false; 

        //大きいほう(A)に小さいほう(B)をくっつける
        //大小が逆ならひっくり返す
        if(size(A) < size(B)) swap(A,B);

        //Aのサイズを更新する
        parent[A] += parent[B];
        //Bの親をAに変更する
        parent[B] = A;

        return true;
    }

    //AとBが同じグループならtrueを返す
    bool same(int A, int B){
        return root(A)==root(B);
    } 
};


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

    int n;
    while(cin>>n){
        if(n==0) break;
        vector<vector<int>> day(33);
        vector<vector<int>> hito(55);
        for(int i=0;i<n;i++){
            int m; cin>>m;
            for(int j=0;j<m;j++){
                int a; cin>>a;
                hito[i].push_back(a);
                day[a].push_back(i);
            }
        }
        int ans=1000;
        for(int i=0;i<n;i++){
            for(auto j:hito[i]){
                UnionFind uni(55);
                for(int k=j;k>=0;k--){
                    bool pos=false;
                    for(auto h:day[k]){
                        if(uni.same(i,h)) pos=true;
                    }
                    if(pos){
                        for(auto h:day[k]){
                            uni.unite(i,h);
                            //cerr<<i<<" "<<h<<endl;
                        }
                    }
                }
                if(uni.size(i)==n){
                    ans=min(ans,j);
                }
            }
        }
        if(ans<100){
            cout<<ans<<endl;
        }
        else cout<<-1<<endl;

    }

    

}


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

int main()
{
    int h;

    while( cin >> h )
    {
        if( !h )
            break;

        int m[h][5];
        for( int i = 0; i < h; i++ )
            for( int j = 0; j < 5; j++ )
                cin >> m[i][j];

        int sum = 0, cnt = 20;
        while( cnt-- )
        {
            for( int i = 0; i < h; i++ )
            {
                if( m[i][0] == m[i][1] && m[i][1] == m[i][2] && m[i][2] == m[i][3] && m[i][3] == m[i][4] )
                {
                    sum += m[i][0] * 5;
                    for( int j = 0; j < 5; j++ )
                        m[i][j] = 0;
                }
                else if(  m[i][0] == m[i][1] && m[i][2] == m[i][3] && m[i][0] == m[i][2] )
                {
                    sum += m[i][0] * 4;
                    for( int j = 0; j < 4; j++ )
                        m[i][j] = 0;
                }
                else if( m[i][1] == m[i][2] && m[i][3] == m[i][4] && m[i][1] == m[i][3] )
                {
                    sum += m[i][1] * 4;
                    for( int j = 1; j < 5; j++ )
                        m[i][j] = 0;
                }
                else if( m[i][1] == m[i][2] && m[i][3] == m[i][2] )
                {
                    sum += m[i][2] * 3;
                    for( int j = 1; j < 4; j++ )
                        m[i][j] = 0;
                }
                else if( m[i][0] == m[i][1] && m[i][0] == m[i][2] )
                {
                    sum += m[i][2] * 3;
                    for( int j = 0; j < 3; j++ )
                        m[i][j] = 0;
                }
                else if( m[i][2] == m[i][3] && m[i][3] == m[i][4] )
                {
                    sum += m[i][2] * 3;
                    for( int j = 2; j < 5; j++ )
                        m[i][j] = 0;
                }
                else;
            }

            for( int i = 1; i < h; i++ )
            {
                for( int j = 0; j < 5; j++ )
                {
                    int k = i;
                    while( k && !m[k][j] )
                    {
                        m[k][j] = m[k-1][j];
                        m[k-1][j] = 0;
                        k--;
                    }
                }
            }
        }
        cout << sum << endl;
    }
    return 0;
}


Measured memory_bytes: 3020
import java.io.*;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		FastScanner fs = new FastScanner();
		int x = fs.nextInt();
		long a = 0;
		long b = (long) Math.pow(x, 0.2) * -1;
		all: for (;;) {
			long b5 = b * b * b * b * b;
			for (;;) {
				long ab = a * a * a * a * a - b5;
				if (x == ab) {
					break all;
				} else if (x < ab) {
					b++;
					break;
				} else {
					a++;
				}
			}
		}
		System.out.println(a + " " + b);
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}

Measured memory_bytes: 36676
#include"bits/stdc++.h"
using namespace std;

int n;
long long int k;

void Main() {
  cin >> n >> k;
  vector<int> a(n);
  vector<int> f(n);

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

  sort(a.begin(), a.end());
  sort(f.rbegin(), f.rend());

  long long int l = -1, r = 1e12;
  while(l + 1 < r) {
    long long int mid = (l + r) / 2;
    bool ok = [&](){
      long long int s = 0;
      for (int i = 0; i < n; i++) {
        s += max(0ll, a[i] - mid / f[i]);
      }
      return s <= k;
    }();
    if (ok) {
      r = mid;
    } else {
      l = mid;
    }
  }
  cout << r << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

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

#define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'
#define all(x) x.begin(), x.end()

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
using vvll = vector< vector<ll> >;
using vll = vector<ll> ;
using vb = vector<bool> ;
using pll = pair<ll, ll> ;

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;


void pre(){



}


void solve(){

    int n;
    cin >> n;
    map<string,int> mp;
    int mx=0;
    for(int i=0;i<n;i++){
        string s;
        cin >> s;
        mp[s]++;
        mx = max(mx,mp[s]);
    }
    
    for(auto it : mp){
        if(it.ss == mx)
            cout << it.ff << endl; 
    }

}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();   
    }
    return 0;
}

Measured memory_bytes: 19276
#include <iostream>
#include <algorithm>
#include <iomanip>

using namespace std;

double dp[301][301][301];
int n;
bool rd[301][301][301];

double f(int i, int j, int k) {
  if(i + j + k == 0) return 0;
  if(rd[i][j][k]) return dp[i][j][k];
  rd[i][j][k] = true;
  double a = (i ? i * f(i - 1, j, k) / (i + j + k) : 0);
  double b = (j ? j * f(i + 1, j - 1, k) / (i + j + k) : 0);
  double c = (k ? k * f(i, j + 1, k - 1) / (i + j + k) : 0);
  return dp[i][j][k] = a + b + c + (double) n / (i + j + k);
}

int main() {
  cin >> n;
  int u;
  int A[3] = {};
  for(int i = 0; i < n; ++i) {
    cin >> u;
    ++A[u - 1];
  }
  
  cout << fixed << setprecision(15) << f(A[0], A[1], A[2]);
  return 0;
}

Measured memory_bytes: 239872
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <utility>
#include <algorithm>
#include <map>
#include <cassert>
using namespace std;
#define REPP(i,a,b) for(int i = (a); i < (b); ++i)
#define REP(i,a) for(int i = 0; i < (a); ++i)
#define PER(i,a) for(int i = (a) - 1; i >= 0; --i)
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define MP make_pair

typedef long long ll;
typedef pair<int, int> pii;

int main() {
    int a, b;
    cin >> a >> b;
    int ans;
    if (a >= 13) ans = b;
    else if (a >= 6) ans = b / 2;
    else ans = 0;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		int[] a = new int[n+4];
		for(int i=0;i<n;i++) {
			a[i+2] = sc.nextInt();
		}
		PriorityQueue<Icicle> growing = new PriorityQueue<Icicle>();
		for(int i=2;i<n+2;i++) {
			if (a[i] >= a[i-1] && a[i] >= a[i+1]) {
				growing.add(new Icicle(i, l-a[i]));
			}
		}
		int ans = 0;
		while(!growing.isEmpty()) {
			Icicle icicle = growing.poll();
			int i = icicle.pos;
			int t = icicle.time;
			a[i] = 0;
			if (a[i-1] > a[i-2]) {
				growing.offer(new Icicle(i-1, t+l-a[i-1]));
			}
			if (a[i+1] > a[i+2]) {
				growing.offer(new Icicle(i+1, t+l-a[i+1]));
			}
			ans = t;
		}
		System.out.println(ans);
	}
}
class Icicle implements Comparable<Icicle>{
	int pos;
	int time;
	public Icicle(int pos,int time) {
		this.pos = pos;
		this.time = time;
	}
	public boolean equalsTo(Object o) {
		if (o instanceof Icicle) {
			return time == ((Icicle) o).time;
		}else{
			return false;
		}
	}
	@Override
	public int compareTo(Icicle o) {
		return time - o.time;
	}

}

Measured memory_bytes: 63924
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        var sc = new Scanner(System.in);
    
        var a = new BigDecimal(sc.next());
        var b = new BigDecimal(sc.next());
    
        BigDecimal ans = a.multiply(b);
        System.out.println(ans.setScale(0, RoundingMode.FLOOR));
    }
}

Measured memory_bytes: 35916
#!/usr/bin/env python
# coding: utf-8

# In[9]:


A,B,M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
mylist = []
for _ in range(M):
    mylist.append(list(map(int, input().split())))


# In[11]:


ans = min(a)+min(b)
for i in range(M):
    cost = a[mylist[i][0]-1] + b[mylist[i][1]-1] - mylist[i][2]
    if cost < ans:
        ans = cost
print(ans)


# In[ ]:






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

using namespace std;

int n;
int arr[110000];

int main() {
	scanf("%d", &n);
	
	for (int i = 0; i < n; ++i) {
		scanf("%d", arr + i);
	}
	
	long long mod = 1000000007;
	long long ans = 1;
	long long pos = 0;
	int ptr = 0;
	int holds = 0;
	
	for (int i = 0; i < n; ++i) {
		while (ptr < n) {
			long long npos = arr[ptr];
			if ((npos - 1) < holds * 2) {
				break;
			}
			pos = npos;
			++holds;
			++ptr;
		}
		if (ptr < n && arr[ptr] == arr[ptr - 1] + 1) {
			++pos;
			++ptr;
			++holds;
		}
		ans = (ans * holds) % mod;
		//printf("%d %d\n", i + 1, holds);
		--holds;
	}
	
	printf("%lld\n", ans);
	
    return 0;
}


Measured memory_bytes: 640
import java.util.*;

public class Main{
	public static void main(String args[]){
		
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int X = sc.nextInt();

		if ( X >= A & X <= A + B & X - A <= B ){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 22484
S = input()

zero_start_diff = 0
one_start_diff = 0

for i in range(len(S)):
    if i%2 == 0:
        if int(S[i]) == 1:
            zero_start_diff +=1
        elif int(S[i]) == 0:
            one_start_diff +=1
    else:
        if int(S[i]) == 1:
            one_start_diff +=1
        elif int(S[i]) == 0:
            zero_start_diff +=1
print(min(zero_start_diff,one_start_diff))


Measured memory_bytes: 3188
#include <cstdio>
#include <cstring>
bool dp[1000001],prime[1000001];
int main() {
	for(int i=2;i*i<=1000000;i++) {
		if(!prime[i]) for(int j=i*2;j<=1000000;j+=i) prime[j]=true;
	}
	int n,x,cook[30];
	while(scanf("%d %d",&n,&x),n) {
		memset(dp,0,sizeof(dp));
		for(int i=0;i<n;i++) {
			scanf("%d",&cook[i]);
		}
		dp[0]=true;
		for(int i=0;i<n;i++) {
			for(int j=1;j<=x;j++) {
				if(j>=cook[i]) dp[j]|=dp[j-cook[i]];
			}
		}
		bool NA=true;
		for(int i=x;i>0;i--) {
			if(!prime[i]&&dp[i]) {
				NA=false;
				printf("%d\n",i);
				break;
			}
		}
		if(NA) printf("NA\n");
	}
}

Measured memory_bytes: 3000
// CODE © by 𝕌𝕥𝕜𝕒𝕣𝕤𝕙 𝔾𝕒𝕣𝕘
// Copying or sharing of this code without permission of the Author is strictly prohibited!!!
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Speed ios::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define endl "\n"
int power(int x, int n, int mod) {int res = 1; x %= mod; while (n) {if (n & 1)res = (res * x) % mod; x = (x * x) % mod; n >>= 1;} return res;}
signed main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
#endif
	int a = 0, b = 0, c = 0, d = 0, i = 0, j = 0, k = 0, t = 0, n = 0, q = 0;
	// cin >> t;
	// while (t--) {
	cin >> n;
	int arr[n], dp[n] = {0};
	for (i = 0; i < n; i++)cin >> arr[i];
	dp[1] = abs(arr[1] - arr[0]);
	for (int i = 2; i < n; i++) {
		dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]), dp[i - 2] + abs(arr[i] - arr[i - 2]));
	}
	cout << dp[n - 1] << endl;
	// }
}

Measured memory_bytes: 5088
#include<bits/stdc++.h>
#define int long long
#define rep(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
const int N=1e6+50;
int n,ans=0,a[N],q[N],id[N],head=0;
int l[N],r[N];
signed main(){
	scanf("%lld",&n);
	rep(i,1,n) scanf("%lld",&a[i]);
	q[++head]=a[1]; id[head]=1; l[1]=0;
	rep(i,2,n) { //递增 
		if(a[i]>q[head]){
			q[++head]=a[i];
			id[head]=i;
		}
		else {
			while(q[head]>=a[i]) r[id[head]]=i,head--;
			if(id[head]) l[i]=id[head];
			else l[i]=0;  
			q[++head]=a[i];
			id[head]=i;
		}
	}
	head=0;
	memset(q,0,sizeof(q)); memset(id,0,sizeof(id));
	q[++head]=a[n]; id[head]=n; r[n]=n+1;
	for(int i=n-1;i>=1;i--){
		if(a[i]>q[head]){
			q[++head]=a[i];
			id[head]=i;
		}
		else{
			while(q[head]>=a[i]) l[id[head]]=i,head--;
			if(id[head]) r[i]=id[head];
			else r[i]=n+1;
			q[++head]=a[i];
			id[head]=i;
		}
	}
	rep(i,1,n) ans+=a[i]*(i-l[i])*(r[i]-i);
	printf("%lld\n",ans); 
	return 0;
}


Measured memory_bytes: 26368
n,x,y=[int(j) for j in input().split()]
l=[[0]*n for i in range(n)]
ans=[0]*n
x-=1
y-=1
s=y-x-1
for i in range(n):
    for j in range(n):
        if i<j:
            ans[min(j-i,abs(i-x)+abs(j-y)+1,)]+=1

print('\n'.join(map(str,ans[1:])))





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

int main()
{
  string S, T, p[2];
  cin >> S >> T;
  p[0] = p[1] = "";
  for(int i = 0; i < S.size(); i += 2){
    p[0] += S[i];
    if(i+1 < S.size()) p[1] += S[i+1];
  }
  for(int i = 0; i < 2; i++){
    for(int j = 0, Sp = 0; j < T.size(); j++){
      if(p[i][Sp] == T[j]) Sp++;
      if(Sp == p[i].size()){
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Measured memory_bytes: 3212
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}

int main(){
    double a,b,x,y,n,m,p,h,k,max=-10000000,min=1000000000,ans=0,sum=0;
    string s,t;
    cin >> a >> b >> x;
    y = x/a;
    double rad;
    if(y>=a*b/2){
        h = (a*b-y)*2/a;
        rad = atan2(h,a);
    }
    else{
        k = y*2/b;
        rad =atan2(b,k);
    }
    double PI = acos(-1);
    double deg = rad/(2*PI)*360;

    cout << setprecision(10) << deg << endl;
}

Measured memory_bytes: 384
"""
https://atcoder.jp/contests/abc167/tasks/abc167_a
"""
# import numpy as np
# from numba import jit


def calc(S: str, T: str) -> bool:
    return T[:-1] == S


# def load_input_as_int_array() -> np.ndarray:
#     return np.array([int(v) for v in input().split(" ")])


def main() -> None:
    S = input()
    T = input()
    result = calc(S, T)
    print("Yes" if result else "No")


main()


Measured memory_bytes: 9044
import java.util.*;
import java.io.*;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		char[] arr  = in.next().toCharArray();

		int ans = 0;
		for(int i = 0; i < arr.length; ++i)
			ans += arr[i] - '0';

		System.out.println(ans);

	}
}


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


int main() {
  int n, m;
  cin >> n >> m;
  vector<int> s(m);
  vector<int> c(m);
  for(int i = 0; i < m; i++) cin >> s[i] >> c[i];
  
  vector<int> ans(n, 10);
  bool ok = true;
  for(int i = 0; i < m; i++){
    int k = ans[s[i]-1];
    if(k < 10 && k != c[i]) ok = false;
    else ans[s[i]-1] = c[i];
  }
  
  if(ok){
    if(ans[0] == 0 && n > 1) cout << -1 << endl;
    else{
      for(int i = 0; i < n; i++){
        if(i == 0 && ans[i] == 10 && n == 1) ans[i] = 0;
        else if(i == 0 && ans[i] == 10) ans[i] = 1;
        else if(ans[i] == 10) ans[i] = 0;
        cout << ans[i];
      }
      cout << endl;
    }
  }
  else cout << -1 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
int Max(int(a), int(b), int(c)) {
	return max(max(a, b), c);
}
int Min(int(a), int(b), int(c)) {
	return min(min(a, b), c);
}





int main() {
	int N,an=-1;
	cin >> N;
	rep(i, N+1) {
		if ((108 * i) / 100 == N) {
			an = i;
		}
	}
	if (an == -1) {
		cout << ":(" << endl;
	}
	else {
		cout << an << endl;
	}
	
}

Measured memory_bytes: 256
#!/usr/bin/env python
from __future__ import division, print_function
from sys import stdin
 
FORMAT = ('node {0.id}: parent = {0.parent}, depth = {0.depth},'
          ' {0.kind}, {0.childs}').format
 
 
class Node(object):
    def __init__(self, node):
        self.depth = 0
        self.parent = -1
        self.id = node[0]
        self.degree = node[1]
        self.kind = 'internal node' if node[1] else 'leaf'
        self.childs = node[2:]
 
    def __str__(self):
        return FORMAT(self)
 
 
def calc_depth(tree, i):
    for j in tree[i].childs:
        tree[j].depth += 1
        calc_depth(tree, j)
 
 
n = int(stdin.readline())
tree = [-1] * n
#assert 1 <= n <= 100000
for _ in xrange(n):
    node = Node([int(s) for s in stdin.readline().split()])
    i = node.id
    node.parent = tree[i]
    for j in node.childs:
        if isinstance(tree[j], int):
            tree[j] = i
        else:
            tree[j].parent = i
    tree[i] = node
 
for i in xrange(n):
    calc_depth(tree, i)
 
for i, node in enumerate(tree):
    if node.parent == -1:
        node.kind = 'root'
    print(node)

Measured memory_bytes: 137408
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var K = long.Parse(ReadLine());

        System.Numerics.BigInteger yen = 100L;

        var year = 0;

        while (yen < K)
        {
            yen = yen * 101L / 100L;

            year++;
        }

        WriteLine(year);
    }
}


Measured memory_bytes: 27976
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#include <fstream>
#include <chrono>
#include <random>
#include <bitset>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sz(x) ((int)(x).size())
#define pb push_back
using ll = long long;
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
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;}

int main(){
  ll X, Y, Z, K; cin >> X >> Y >> Z >> K;
  vector<ll> A(X); rep(i,X) cin >> A[i];
  vector<ll> B(Y); rep(i,Y) cin >> B[i];
  vector<ll> C(Z); rep(i,Z) cin >> C[i];
  sort(rall(A));
  sort(rall(B));
  sort(rall(C));
  vector<ll> rank;
  rep(x,X){
    rep(y,Y){
      rank.pb(A[x]+B[y]);
    }
  }
  sort(rall(rank));
  rank.resize(K);
  vector<ll> rank2;
  rep(k,K){
    rep(z,Z){
      rank2.pb(rank[k]+C[z]);
    }
  }
  sort(rall(rank2));
  rep(i,K) cout << rank2[i] << '\n';
  return 0;
}


Measured memory_bytes: 43368
use itertools::Itertools;
use proconio::input;

fn main() {
    input!(n: usize, a: [usize; n], b: [usize; n]);

    if let Some(ans) = solve(n, &a, &b) {
        println!("Yes");
        println!("{}", ans.iter().map(|&v| v.to_string()).join(" "))
    } else {
        println!("No")
    }
}

fn solve(n: usize, a: &[usize], b: &[usize]) -> Option<Vec<usize>> {
    let mut cnt = vec![0; n];
    for x in [a, b].concat() {
        cnt[x - 1] += 1;
    }
    if cnt.iter().any(|&c| c > n) {
        return None;
    }
    let mut d = 0;
    let b = [b; 2].concat();
    while (0..n).any(|i| a[i] == b[i + d]) {
        for i in 0..n {
            while a[i] == b[i + d] {
                d += 1;
            }
        }
    }
    Some((&b[d..d + n]).into())
}


Measured memory_bytes: 14048
#include <stdio.h>
#include <algorithm>

using namespace std;

int main() {

	for (int t = 0; t < 3; t++) {
		int hs, ms, ss, he, me, se, h, m, s;
		scanf("%d %d %d %d %d %d", &hs, &ms, &ss, &he, &me, &se);
		s = se - ss;
		if (s < 0) {
			s += 60;
			me--;
		}
		m = me - ms;
		if (m < 0) {
			m += 60;
			he--;
		}
		h = he - hs;
		printf("%d %d %d\n", h, m, s);
	}

	return 0;
}

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

using namespace std;

#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi >
#define vb vector<bool>
#define vvb vector<vb >
#define vp vector< pii >
#define all(a) (a).begin(), (a).end()
#define Int(x) int x; cin >> x;
#define int2(x, y) Int(x); Int(y);
#define int3(x, y, z) Int(x); int2(y, z);
#define in(x, a, b) ((a) <= (x) && (x) < (b))
#define fir first
#define sec second
#define ffir first.first
#define fsec first.second
#define sfir second.first
#define ssec second.second
#define Decimal fixed << setprecision(10)

//int dxy[5] = {0, 1, 0, -1, 0};
// 01Trie BIT CHT DFT FFT avl cmd cusum dijkstra dinic geo2 gin graph kruskal lca lcm matrix ncm next_combination ppuf segtree st tmp topcoder uf vi 

struct RangeAddQuery {
	int n;
	vector<int> d;
	int time;
	RangeAddQuery(int m) {
		for (n = 1; n < m; n *= 2);
		d.assign(n * 2, INF);
	}
	//[l, r)
	void add(int l, int r, int x) {
		for (; l && l + (l&-l) <= r; l += l&-l)
			d[(n + l) / (l&-l)] = min(x, d[(n + l) / (l&-l)]);
		for (; l < r; r -= r&-r)
			d[(n + r) / (r&-r) - 1] = min(x, d[(n + r) / (r&-r) - 1]);
	}
	int get(int i) {
		int ret = d[n + i];
		for (int j = (n + i) / 2; j > 0; j >>= 1)
			ret = min(ret, d[j]);
		return ret;
	}
};

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

    int2(n, m);
    vector<pair<pii, int>> data(m);

    rep(i, data.size()) {
        cin >> data[i].ffir >> data[i].fsec >> data[i].sec;
    }

    sort(all(data));

    RangeAddQuery dp(n+1);
    dp.add(0, 1, 0);
    rep(i, data.size()) {
        dp.add(data[i].ffir-1, data[i].fsec, 
                dp.get(data[i].ffir-1) + data[i].sec);
    }

    /*
    rep(i, n) {
        cout << dp.get(i) << " ";
    }
    cout << endl;
    */
    cout << (dp.get(n-1) == INF ? -1 : dp.get(n-1)) << endl;


    return 0;
}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int INF=-2000000000;
int main() {
  int a,b;
  cin >> a >> b;
  string aa="",bb="";
  for(int i=0; i<b; i++){
    aa+=to_string(a);
  }
  for(int i=0; i<a; i++){
    bb+=to_string(b);
  }
  if(aa<bb) cout << aa << endl;
  else cout << bb << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <queue>
#include <stack>

using namespace std;

typedef long long int ll;
typedef pair<int, int> Pii;

const ll mod = 1000000007;

ll isqrt(ll x) {
  ll left = 0;
  ll right = min((1LL << 31) - 1, x + 1);
  while (left + 1 < right) {
    ll center = (left + right) / 2;
    if (center * center <= x) left = center;
    else right = center;
  }
  return left;
}

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

  int q;
  cin >> q;
  vector<ll> a(q), b(q);
  for (int i = 0; i < q; i++) cin >> a[i] >> b[i];

  vector<ll> ans(q);
  for (int i = 0; i < q; i++) {
    if (a[i] < b[i]) swap(a[i], b[i]); // WLOG a >= b
    ll t = isqrt(a[i] * b[i] - 1);
    ans[i] = t * 2 - 1;
    ll x = t, y = t;
    if (t * (t + 1) < a[i] * b[i]) {
      x++;
      ans[i]++;
    }
    if (a[i] == b[i]) ans[i]++; // corner
    while ((x + 1) * y >= a[i] * b[i]) {
      x++;
      y--;
    }
    ans[i]--;
    if (x > a[i]) ans[i]--;
  }

  for (auto &x: ans) cout << x << endl;

  return 0;
}


Measured memory_bytes: 256
// 2014/07/16 Tazoe

#include <iostream>
using namespace std;

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

	cout << a/b << ' ';
	cout << a%b << ' ';
	cout.precision(5);
	cout << fixed << (double)a/(double)b << endl;

	return 0;
}

Measured memory_bytes: 1244
#include <iostream>
#include <vector>
#include <functional>
using namespace std;
using ll = long long;
#define in(v) v; cin >> v;
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)

template<class T> struct SegTree {
  private:
    int size;
    vector<T> v;
    using F = function<T(T,T)>;
    F f; T default_value;
  public:
    SegTree(int n, T default_value, F f) : default_value(default_value), f(f) {
      size = 1;
      while (size < n) size *= 2;
      v.resize(2 * size - 1, default_value);
    }
    void update(int index, T val) {
      index = index + size - 1;
      v[index] = val;
      while (index > 0) {
        index = (index - 1) / 2;
        v[index] = f(v[2 * index + 1], v[2 * index + 2]);
      }
    }
    T query(int l, int r) { return query(l, r, 0, size, 0); }
    T query(int l, int r, int cur_l, int cur_r, int index) {
      if (cur_r <= l || r <= cur_l) return default_value;
      if (l <= cur_l && cur_r <= r) return v[index];

      int mid = (cur_l + cur_r) / 2;
      return f(query(l, r, cur_l, mid, 2 * index + 1), query(l, r, mid, cur_r, 2 * index + 2));
    }
};

int main() {
  int in(N);

  SegTree<ll> T(N+1, -1e9, [](ll a, ll b){return max(a, b);}); // 範囲max
  vector<int> h(N), a(N);
  rep(i, N) cin >> h[i];
  rep(i, N) cin >> a[i];

  T.update(0, 0);
  rep(i, N) {
    T.update(h[i], T.query(0, h[i]) + a[i]);
  }
  cout << T.query(0, N+1) << endl;

  return 0;
}


Measured memory_bytes: 5888
#include <bits/stdc++.h>
using namespace std;
int n,K;
#define M 100005
struct Edge{
	int to,nx;
}edge[M<<1];
int h[M],tt;
void link(int a,int b){
	edge[++tt].to=b;
	edge[tt].nx=h[a];
	h[a]=tt;
}
#define DEG(i,st) for(int i=h[st];i;i=edge[i].nx)
int ans;
const int P=1000000007;
void dfs(int F,int now,int d){
	if(!F)ans=K;
	int rk=min(d+1,2);
	DEG(i,now){
		int to=edge[i].to;
		if(to==F)continue;
		if(rk>=K)ans=0;
		else ans=1LL*ans*(K-rk)%P;
		rk++;
		dfs(now,to,d+1);
	}
}
int main(){
	cin>>n>>K;
	for(int i=1,a,b;i<n;i++){
		scanf("%d%d",&a,&b);
		link(a,b),link(b,a);
	}
	dfs(0,1,0);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 6912
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kishan Sairam Adapa
 */

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define ll long long int
#define MOD ((int)(1e9) + 7)

using namespace std;

class BFiveDishes {
public:
    void solve(istream& cin, ostream& cout) {
        vector<int> a;
        for(int i=0; i<5; i++) {
            int tp;
            cin >> tp;
            a.push_back(tp);
        }
        int min_id = -1;
        for(int i=0; i<5; i++) {
            if(a[i]%10 != 0 && min_id == -1) min_id = i;
            if(a[i]%10 != 0 && a[min_id] % 10 > a[i] % 10) min_id  = i;
        }
        for(int i=0; i<5; i++) {
            if(i == min_id) continue;
            if(a[i] % 10)
                a[i] = ((a[i]/10)+1)*10;
        }
        int sum =0;
        for(auto k: a) sum += k;
        cout << sum << '\n';
    }
};


int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    BFiveDishes solver;
    std::istream& in(std::cin);
    std::ostream& out(std::cout);
    solver.solve(in, out);
    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
#define ll  long long  

void solve(){
  ll a,b;
  scanf("%lld",&a);
  b=360;
  while(b%a != 0)
    b+=360;
  printf("%lld",b/a);

}
int main()
{
    
     int t=1; 
     // cin >> t;
     while (t--) solve();
 
     // cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);
 
     return 0;
}


Measured memory_bytes: 1736
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define ABS(x) ( (x)>0 ? x : -(x) )
#define MIN(x,y) ( (x) < (y) ? (x) : (y) )
#define MAX(x,y) ( (x) > (y) ? (x) : (y) )

#define MOD 1000000007

void swap(int* a, int* b)
{
	int tmp;
	tmp = *a;
	*a = *b;
	*b = tmp;
}

void print(int A[], int n)
{
	int i;
	for (i = 0; i < n; i++)
	{
		printf("%d", A[i]);
		if (i != n - 1)
			printf(" ");
	}
	printf("\n");
}

void insertionSort(int A[], int N)
{
	int i, j,tmp;

	for (i = 1; i < N; i++)
	{
		j = i;
		while (j > 0 && A[j - 1] > A[j])
		{
			tmp = A[j - 1];
			A[j - 1] = A[j];
			A[j] = tmp;

			j--;
		}
		print(A, N);
	}
}

void bubbleSort(int A[], int N,int *count)
{
	int flag = 0;
	int i, j,tmp;

	for (i = 0; i < N; i++)
	{
		for (j = N - 1; j > 0; j--)
		{
			if (A[j - 1] > A[j])
			{
				tmp = A[j - 1];
				A[j - 1] = A[j];
				A[j] = tmp;
				flag = 1;
				(*count)++;
			}
		}
		if (flag == 0)
			break;
		else
			flag = 0;
	}
}

void selectionSort(int A[], int N,int *count)
{
	int i, j;
	int key,tmp;

	for (i = 0; i < N; i++)
	{
		key = i;
		for (j = i; j < N; j++)
		{
			if (A[j] < A[key])
				key = j;
		}
		if (i != key)
		{
			tmp = A[i];
			A[i] = A[key];
			A[key] = tmp;
			(*count)++;
		}
	}
}


int binary_search(int A[], int N, int key)
{
	int left, right, middle;

	left = 0, right = N - 1;

	while (left <= right)
	{
		middle = (left + right) / 2;
		if (A[middle] == key)
			return 1;
		else if (A[middle] > key)
			right = middle - 1;
		else if (A[middle] < key)
			left = middle + 1;
	}
	return 0;
}

int main()
{
	int S[100000], T[100000];
	int n, q;
	int i, j;
	int count = 0;

	scanf("%d", &n);

	for (i = 0; i < n; i++)
		scanf("%d", &S[i]);

	scanf("%d", &q);

	for (i = 0; i < q; i++)
		scanf("%d", &T[i]);


	for (i = 0; i < q; i++)
	{
		if (binary_search(S, n, T[i]))
			count++;
	}

	printf("%d\n", count);

	return 0;
}


Measured memory_bytes: 2280