akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int d[201][201];
bool used[201];
int color[201];

int main() {
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	string s;
	for (int i = 1; i <= n; i++) {
		cin>>s;
		for (int j = 0; j < n; j++)
			d[i][j + 1] = ((s[j] == '0') ? 0 : 1);
	}
	int res = 0;
	for (int currv = 1; currv <= n; currv++) {
		for (int i = 1; i <= n; i++)
			used[i] = color[i] = 0;
		color[currv] = 1;
		used[currv] = 1;
		vector < int > que;
		que.push_back(currv);
		int head = 0, tail = 0;
		int maxcolor = 1;
		while (head <= tail) {
			for (int i = 1; i <= n; i++) {
				//cout<<"Now is "<<i<<endl; 
				//cout<<d[que[head]][i]<<" "<<used[i]<<endl;
				if (d[que[head]][i] == 0) continue;
				if (used[i] == 1) continue;
				//cout<<"Pass "<<i<<endl;
				que.push_back(i);
				used[i] = 1;
				color[i] = color[que[head]] + 1;
				maxcolor = max(maxcolor, color[i]);
				tail++;
			}
			head++;
		}
		//cout<<color[1]<<" "<<color[2]<<endl;
		bool f = true;
		for (int i = 1; i <= n; i++)
		for (int j = i + 1; j <= n; j++)
			if (d[i][j] == 1 && abs(color[i] - color[j]) != 1) {
				f = false;
				break;
			}
		res = max(res, maxcolor * f);
	}
	if (res == 0) res--;
	cout<<res<<endl;
}

Measured memory_bytes: 512
#include <stdio.h>

int main()
{
  int H,W,A,B;
  scanf("%d %d %d %d",&H,&W,&A,&B);
  for (int i=0; i<H; i++) {
    for (int j=0; j<W; j++) {
      putchar('0'+((i<B)^(j<A)));
    }
    putchar('\n');
  }
  return 0;
}

Measured memory_bytes: 1152
#include <iostream>
#include <algorithm>
#include <vector>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <string>
#include <cstdlib>
using namespace std;

#define REP(i, n) for (int i = 0; i < n; i++)
#define RFPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()

typedef long long ll;

int main() {
    vector<int> a(3);
    vector<int> b(3);
    vector<int> cout {0, 0, 0, 0, 0};
    REP(i, 3) {
        cin >> a[i] >> b[i];
        cout[a[i]]++; cout[b[i]]++;
    }
    if (cout[4]==1 && cout[1]==1 && cout[2]==2 && cout[3]==2)
        printf("YES\n");
    else
        printf("NO\n");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int n,m;
int k[11];
int kn[11];
int sn[11][11];
int s[11][11];
int p[11];
int f(int x){
	int cnt = 0;
	if(x==n+1){
		for(int i=1;i<=m;i++){
			if(p[i]==1) return 0;
		}
		return 1;
	}
	for(int i=1;i<=kn[x];i++){
		p[sn[x][i]] = (p[sn[x][i]]+1)%2;
	}
	cnt += f(x+1);
	for(int i=1;i<=kn[x];i++){
		p[sn[x][i]] = (p[sn[x][i]]+1)%2;
	}
	cnt += f(x+1);
	return cnt;
}
int main(){
	scanf("%d %d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d",&k[i]);
		for(int j=1;j<=k[i];j++){
			scanf("%d",&s[i][j]);
			kn[s[i][j]]++;
			sn[s[i][j]][kn[s[i][j]]] = i;
		}
	}
	for(int i=1;i<=m;i++){
		scanf("%d",&p[i]);
	}
	printf("%d\n",f(1));
}

Measured memory_bytes: 1732
n = int(input())
a = list(map(int,input().split()))
if n==2:
    print(max(a[0],a[1]))
    exit()
def gcd(a,b):
    if b==0:
        return a
    else:
        return gcd(b,a%b)
gl = [0]*n
gl[0] = a[0]
gr = [0]*n
gr[-1] = a[-1]

for i in range(1,n):
    gl[i] = gcd(max(gl[i-1],a[i]),min(gl[i-1],a[i]))
for i in range(n-2,-1,-1):
    gr[i] = gcd(max(gr[i+1],a[i]),min(gr[i+1],a[i]))
ans = max(gr[1],gl[-2])
for i in range(1,n-1):
    g = gcd(max(gl[i-1],gr[i+1]),min(gl[i-1],gr[i+1]))
    ans = max(ans,g)
print(ans)

Measured memory_bytes: 14080
#include <iostream>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <functional>
#include <map>
#include <math.h>
#include <list>

using namespace std;

int main(void) {

	long long int n, m;
	cin >> n >> m;
	long long  int i;
	while (m--) {
		cin >> i;
		n = n - i;


	}

	if (n >= 0) cout << n << endl;
	else cout << -1 << endl;


	return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < (ll) b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= (ll) b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < (ll) b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= (ll) b ; i-= k)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nuintptr)
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 
const ll MAX= 2e5+6;
const ll inf =1e9;

ll fac[MAX],b[MAX],mod=998244353;

ll bp(ll a,ll e,ll m){
	if(e==0) return 1LL;
	if(e&1) return (a*bp(a,e-1,m))%m;
	ll x=bp(a,e>>1,m);
	return (x*x)%m;
}

ll inv(ll a,ll mod){
	return bp(a,mod-2,mod);
}

ll comb(ll n,ll k){
	ll ans=fac[n];
	ll divi = (fac[k]*(fac[n-k]))%mod;
	return (ans*inv(divi,mod))%mod;
}

int main(){
	fac[0]=1;
	f(i,1,MAX) fac[i]=(fac[i-1]*i)%mod;
	ll n,k,m;
	cin>>n>>m>>k;
	if(m==1){
		if(k==n-1) cout<<"1\n";
		else cout<<"0\n";
		return 0;
	}
	ll ans=0;
	f(i,0,k+1){
		ll x=n-i;
		ans+=(m*((bp(m-1,x-1,mod)*comb(n-1,x-1))%mod))%mod;
		ans%=mod;
	}
	cout<<ans<<endl;
}	

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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    ll prev = accumulate(A.begin(), A.begin() + K, 0LL);
    rep2(i, K, N) {
        ll current = prev + A[i] - A[i - K];
        if(current > prev) cout << "Yes";
        else cout << "No";
        cout << endl;
        prev = current;
    }
    return 0;
}


Measured memory_bytes: 4840
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    ll N, M, L;
    cin >> N >> M >> L;

    vll A, B, C;
    REP(i, M) {
        ll a, b, c;
        cin >> a >> b >> c;
        --a; --b;
        A.pb(a); B.pb(b); C.pb(c);
    }

    vector<vll> D(N, vll(N, INF));
    REP(i, N) D[i][i] = 0;
    vector<vll> F(N, vll(N, INF));
    REP(i, N) F[i][i] = 0;

    REP(i, M) {
        D[A[i]][B[i]] = min(D[A[i]][B[i]], C[i]);
        D[B[i]][A[i]] = min(D[A[i]][B[i]], C[i]);
    }

    REP(i, N) {
        REP(j, N) {
            REP(k, N) {
                D[j][k] = min(D[j][k], D[j][i] + D[i][k]);
            }
        }
    }

    REP(i, N) {
        REP(j, N) {
//            if (i == j) continue;
            if (D[i][j] <= L) F[i][j] = 1LL;
        }
    }

    REP(i, N) {
        REP(j, N) {
            REP(k, N) {
                F[j][k] = min(F[j][k], F[j][i] + F[i][k]);
            }
        }
    }

    int Q; cin >> Q;
    REP(i, Q) {
        int s, t;
        cin >> s >> t;
        --s; --t;

        print(F[s][t] != INF ? F[s][t] - 1 : -1);
    }
}


Measured memory_bytes: 5828
#include<bits/stdc++.h>
using namespace std;
typedef long long Ll;
int main()
{
    int n;
    Ll x1, x2, c1, c2, tmp;
    while(scanf("%d", &n) != EOF){
        scanf("%lld%lld", &c1, &c2);
        for(int i=1; i<n; i++){
            scanf("%lld%lld", &x1, &x2);
            tmp = max(c1/x1, c2/x2);
            if(x1*tmp<c1 || x2*tmp<c2) 
				tmp++;
            c1 = x1*tmp, c2 = x2*tmp;
        }
        printf("%lld", c1+c2);
        puts("");
    }
}

Measured memory_bytes: 256
import * as fs from 'fs'

export function Main(input: string) {
  const [K, S] = input.split("\n")
  
  if(S.length <= parseInt(K)) {
    console.log(S);
  }else {
    console.log(S.slice(0, parseInt(K)) + "...") 
  }
}

Main(fs.readFileSync("/dev/stdin", "utf-8"));

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



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

    ll n;
    cin >> n;
    vector<ll> d(n+1, 0);
    for(int i = 1; i <= n; ++i){
        for(int j = i; j <= n; j += i){
            ++d[j];
        }
    }
    d[1] = 1;
    d[2] = 2;

    ll res = 0;
    for(ll i = 1; i <= n; ++i){
        res += i * d[i];
    }

    cout << res << endl;

    return 0;
}

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

int main()
{
	long long A, B, K;
	cin >> A >> B >> K;

	vector<long long> ans;
	long long a = A;
	for( int i = 0; i < K; i++ ) {
		if( a > B ) break;
		ans.push_back( a );
		a++;
	}
	long long b = B;
	for( int i = 0; i < K; i++ ) {
		if( count( ans.begin(), ans.end(), b ) ) break;
		ans.push_back( b );
		b--;
	}
	sort( ans.begin(), ans.end() );

	for( int i = 0; i < ans.size(); i++ ) {
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 3608
//Code by Anshuman Das Gupta

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define MOD 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define loop(I,N) for(int i=I;i<N;i++)
#define sortvec(V) sort(V.begin(),V.end())
#define vec vector<int>
#define endl "\n"
using namespace std;
#define PI 3.14159265359
int fast_power(int base, int power) {
    int result = 1;
    while (power > 0) {

        if (power & 1) {
            result = (result * base) % MOD;
        }
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result % MOD;
}

bool isPrime(int x) {
    for (int i = 2; i <= sqrt(x); i++) {
        if (x % i == 0)
            return false;
    }
    if (x == 1)
        return false;
    return true;
}

int binsearch(int a[], int f, int r, int x) {
    while (f <= r) {
        int mid = (f + r) / 2;
        if (a[mid] == x)
            return mid;
        else if (a[mid] > x) {
            r = mid - 1;
        }
        else {
            f = mid + 1;
        }
    }
    return -1;
}
void sieve(int a[], int n) {
    a[0] = 0;
    a[1] = 0;
    for (int i = 2; i <= n; i++) {
        if (a[i] == 1) {
            for (int j = i + i; j <= n; j += i) {
                a[j] = 0;
            }
        }
    }
}
int32_t main() {
#ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt", "r", stdin);
    //for writing output to output.txt
    freopen("out.txt", "w", stdout);
#endif
    int t = 1;
    //cin >> t;
    while (t--) {
        int n = 5;
        int a[n];
        int ans = 0;
        loop(0, n) {
            cin >> a[i];
            if (a[i] == 0)
                ans = i + 1;
        }
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3620
#include <bits/stdc++.h>
#define inf 0x3f3f3f3f
#define m_k make_pair
#define int long long
using namespace std;
const int N=2*1e5+100;
int n,a[N],ans;
map <int,int> mp;
signed main()
{
	scanf("%lld",&n);
	for (int i=1;i<=n;i++) scanf("%lld",&a[i]);
	for (int i=1;i<=n;i++) mp[i-a[i]]++;
	for (int i=1;i<n;i++)
	{
		mp[i-a[i]]--;
		ans+=mp[a[i]+i];
	}
	printf("%lld\n",ans);
}

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

const int N = 200005, INF = 2000000000;
int n, Q, pre_tag[N], suf_tag[N], fa[N];
struct edge {
	int u, v, w;
};
bool operator<(const edge &a, const edge &b) {
	return a.w < b.w;
}

int find(int x) {
	return fa[x] == x ? x : fa[x] = find(fa[x]);
}

int main() {
	scanf("%d%d", &n, &Q);
	for (int i = 0; i < n; ++i)
		pre_tag[i] = suf_tag[i] = INF;
	vector<edge> e;
	for (int i = 1; i <= Q; ++i) {
		int a, b, c;
		scanf("%d%d%d", &a, &b, &c);
		suf_tag[a] = min(suf_tag[a], c - 2 * a + 1);
		pre_tag[a] = min(pre_tag[a], c + 2 * (n - a) + 1);
		suf_tag[b] = min(suf_tag[b], c - 2 * b + 2);
		pre_tag[b] = min(pre_tag[b], c + 2 * (n - b) + 2);
		e.push_back((edge){a, b, c});
	}
	for (int i = 1; i < n; ++i)
		suf_tag[i] = min(suf_tag[i], suf_tag[i - 1]);
	for (int i = n - 2; i >= 0; --i)
		pre_tag[i] = min(pre_tag[i], pre_tag[i + 1]);
	for (int i = 0; i < n; ++i)
		e.push_back({i, (i + 1) % n, min(suf_tag[i], pre_tag[i]) + 2 * i});
	sort(e.begin(), e.end());
	for (int i = 0; i < n; ++i)
		fa[i] = i;
	long long ans = 0;
	for (const auto &p : e) {
		int s = find(p.u), t = find(p.v);
		if (s != t)
			fa[s] = t, ans += p.w;
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 11628
#ABC154D 累積和
from itertools import accumulate
N, K = map(int, input().split())
p = list(map(int, input().split()))
p = list(map(lambda x:(x+1)/2, p))
P = list(accumulate([0]+p))
ans = 0
for i in range(N-K+1):
    if P[i+K]-P[i]>= ans:
        ans = P[i+K]-P[i]
print(ans)

Measured memory_bytes: 25152
//abc042_b.cpp
//Sun Oct 21 10:16:04 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

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

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

	sort(s,s+n);

	for (int i=0;i<n;i++){
		cout << s[i];
	}
	printf("\n");
}

Measured memory_bytes: 256
import scala.io.StdIn.readInt

object Main {
  def fib(a:Int, b:Int, c:Int, n:Int):Int = {
    n match {
      case 0 => a
      case n => fib(a+b, a, b, n-1)
    }
  }

  def main(args: Array[String]) = {
    val n = readInt()
    println(fib(1, 0, 0, n))
  }
}

Measured memory_bytes: 43584
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void print() { cout << "\n"; }
template <class T, class... Args>
void print(const T &x, const Args &... args) { cout << x << " "; print(args...);}
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

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) {
    assert(i < n);
    for (i++; i <= n; i += i&-i) { //LSB:i&(-i)
      d[i] += x;
    }
  }
  T sum(int i) {
    assert(i < n);
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) { //[l,r)
    assert(l < n);
    assert(r <= n);
    return sum(r-1) - sum(l-1);
  }
};

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n,q;
  string str;
  cin >> n >> str >> q;
  int num = 'z'-'a'+1;
  vector<BIT<int> > bits(num, n);
  rep(i,n) {
    bits[str[i]-'a'].add(i);
  }
  rep(k,q) {
    int com;
    cin >> com;
    if (com == 1) {
      int i;
      char c;
      cin >> i >> c;
      i--;
      bits[str[i]-'a'].add(i, -1);
      bits[c -'a'].add(i);
      str[i] = c;
    }
    else {
      int l,r;
      cin >> l >> r;
      l--; r--;
      int sum = 0;
      rep(i,num) {
        int res = bits[i].sum(l,r+1);
        chmin(res, 1); //1つでもあったら1でカウント
        sum += res;
      }
      cout << sum << "\n";
    }
  }
  return 0;
}

Measured memory_bytes: 53660
n = int(input())
dat = list(map(int, input().split()))
f = True
for i in range(n):
    c = dat[i]
    if c%2 == 0:
        if c%3 ==0 or c%5==0:
            pass
        else:
            f = False
print("APPROVED" if f else "DENIED")

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

int main(){
  int n,k;
  string s;
  cin>>n>>s>>k;

  char c=s[k-1];
  for(int i=0; i<n; i++){
    if(s[i]!=c)s[i]='*';
  }

  cout<<s<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

template <typename T, T N>
class UnionFind {
    T parent_[N];
    T rank_[N];
    T size_[N];

public:
    UnionFind();
    T Root(T idx);
    bool IsSame(T x, T y);
    void Unite(T x, T y);
    T GetSize(T idx);
};

template <typename T, T N>
UnionFind<T, N>::UnionFind()
{
    for (T i = 0; i < N; i++) {
        parent_[i] = i;
        rank_[i] = 0;
        size_[i] = 1;
    }
}

template <typename T, T N>
T UnionFind<T, N>::Root(T idx)
{
    return parent_[idx] == idx ? idx : parent_[idx] = Root(parent_[idx]);
}

template <typename T, T N>
bool UnionFind<T, N>::IsSame(T x, T y)
{
    return Root(x) == Root(y);
}

template <typename T, T N>
void UnionFind<T, N>::Unite(T x, T y)
{
    x = Root(x);
    y = Root(y);
    if (x == y) {
        return;
    }

    if (rank_[x] < rank_[y]) {
        parent_[x] = y;
        size_[y] += size_[x];
    } else {
        parent_[y] = x;
        size_[x] += size_[y];
        if (rank_[x] == rank_[y]) {
            rank_[x]++;
        }
    }
}

template <typename T, T N>
T UnionFind<T, N>::GetSize(T idx)
{
    return size_[Root(idx)];
}

long long pow_mod(long long n, long long p, long long m)
{
    if (p == 0) {
        return 1;
    }

    if (p % 2 == 0) {
        long long t = pow_mod(n, p / 2, m);
        return t * t % m;
    }
    return n * pow_mod(n, p - 1, m) % mod;
}

long long nCr_mod(long long n, long long r)
{
    long long x = 1;
    for (long long i = n - r + 1; i <= n; i++) {
        x *= i;
        x %= mod;
    }

    long long a = 1;
    for (long long i = 1; i <= r; i++) {
        a *= i;
        a %= mod;
    }

    long long y = pow_mod(a, mod - 2, mod) % mod;

    return x * y % mod;
}

bool is_prime(long long n)
{
    if (n == 1) {
        return false;
    }

    for (long long i = 2; i * i <= n; i++) {
        if (n % i == 0) {
            return false;
        }
    }

    return true;
}

int main()
{
    long long a, b;
    std::cin >> a >> b;

    if (a > b) {
        std::cout << std::string(a, b + '0') << std::endl;
    } else {
        std::cout << std::string(b, a + '0') << std::endl;
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {

		Scanner keyboard = new Scanner(System.in);

		int N = keyboard.nextInt();
		String[]S = new String[N];
		int[] Snum =  new int[N];
		S[0] = keyboard.next();	
		Snum[0] = 1;
		int blankcount = 0;
		for (int s=1; s<N; s++) {
			String Sin = keyboard.next();
			int flag = 0;
			for(int ss = 0; ss<=blankcount; ss++) {
				if(S[ss].contentEquals(Sin)) {
					Snum[ss]++;
					flag ++;
				}
			}
			if(flag == 0) {
					S[blankcount+1] = Sin;
					Snum[blankcount+1]++;
					blankcount++;
			}
		}
		
		int M = keyboard.nextInt();
		for (int t=0; t<M; t++) {
			String Tin = keyboard.next();	
			for(int n= 0; n<=blankcount; n++) {
				if(Tin.contentEquals(S[n])) {
					Snum[n]--;
					break;
				}
			}
		}
		
		int ans = 0;
		for (int a =0; a<N; a++) {
			if(ans<= Snum[a]) {
				ans = Snum[a];
			}
		}
		
		if(ans < 0) {
			ans = 0;
		}
				
		System.out.println(ans);
		keyboard.close();
	}
	
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;

bool ps1(const P &element1, const P &element2)
{ //first昇順
	return element1.first < element2.first;
}
bool ps2(const P &element1, const P &element2)
{ //first降順
	return element1.first > element2.first;
}
bool ps3(const P &element1, const P &element2)
{ //second昇順
	return element1.second < element2.second;
}
bool ps4(const P &element1, const P &element2)
{ //second降順
	return element1.second > element2.second;
}

template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}

int main()
{
	int x,y,z,k;
	cin>>x>>y>>z>>k;
	vector<ll>a(x),b(y),c(z);
	priority_queue<ll>xy,xyz;
	rep(i,x)cin>>a[i];
	rep(i,y)cin>>b[i];
	rep(i,z)cin>>c[i];

	rep(i,x){
		rep(j,y){
		   xy.push(a[i]+b[j]);	
		}
	}
	int n=xy.size();
	n=min(n,3000);
	rep(i,n){
		rep(j,z){
			xyz.push(xy.top()+c[j]);
		}
		xy.pop();
	}
	rep(i,k){
		cout<<xyz.top()<<endl;
		xyz.pop();
	}
}


Measured memory_bytes: 43240
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		String ans = "NO";
		for (int i = 1; i <= b; i++) {
			if (i * a % b == c) {
				ans = "YES";
				break;
			}
		}
		
		System.out.println(ans);
		sc.close();
	}
}




Measured memory_bytes: 26980
import java.util.*;
import java.util.stream.Stream;

public class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        
        long xMin = 1L<<30;
        long xMax = 0;
        long yMin = 1L<<30;
        long yMax = 0;
        
        long[][] bg = new long[n][2];
        
        for(int i=0; i<n; i++){
            int x = sc.nextInt();
            int y = sc.nextInt();
            if(x>y){
                int tmp = x;
                x = y;
                y = tmp;
            }
            
            bg[i][0] = x;
            bg[i][1] = y;
            
            xMin = Math.min(xMin, x);
            xMax = Math.max(xMax, x);
            yMin = Math.min(yMin, y);
            yMax = Math.max(yMax, y);
        }
        
        long ans = (xMax - xMin)*(yMax - yMin);
        
        
        Arrays.sort(bg, new Comparator<long[]>() {
            public int compare(long[] p1, long[] p2) {
                if(p1[0] < p2[0]) return -1;
                if(p1[0] > p2[0]) return 1;
                return 0;
            }
        });
        
        long yUsedMax = 0;
        long yUsedMin = 1L<<30;
        for(int i=0; i<n-1; i++){
            yUsedMin = Math.min(yUsedMin, bg[i][1]);
            yUsedMax = Math.max(yUsedMax, bg[i][1]);
            //bMinは Math.min(今まで使ったyの最小, 小さいもん順の次のx)
            long bMin = Math.min(yUsedMin, bg[i+1][0]);
            //bMaxは Math.max(今まで使ったyの最大, 小さいもん順の最後のx)
            long bMax = Math.max(yUsedMax, bg[n-1][0]);
            
            ans = Math.min(ans, (yMax-xMin)*(bMax-bMin));
        }
        
        System.out.println(ans);
        
    }
}


Measured memory_bytes: 121040
#include<stdio.h>
#include<string.h>
#include<ctype.h>
int main(void)
{
    int x,y,z;
    int i,j,k;
    char a[100],b[100];
    scanf("%s",a);
    x=strlen(a);
    for(i=0;i<=x;i++)
    {
        if(i==x)
        {
            b[i]=a[i];
        }
        else
        {
            b[x-1-i]=a[i];
        }
    }
    printf("%s\n",b);
    return 0;
}

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

#define N 1000
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
#define all(cont) cont.begin(), cont.end()
#define sortcmp(n, cmpfunc) sort(all(n), cmpfunc)
#define fastio ios::sync_with_stdio(false); cin.tie(0)

ll powm(ll a, ll b);
ll divm(ll a, ll b);
ll multm(ll a, ll b);
ll subm(ll a, ll b);
ll addm(ll a, ll b);

int main(){
	int a, b, c;
	fastio;
	// #ifndef ONLINE_JUDGE
 //    	freopen("input.in", "r", stdin);
 //    	freopen("output.out", "w", stdout);
	// #endif
    cin >> a >> b >> c;
    if(min(a, b) < c && max(a, b) > c) cout << "Yes\n";
    else cout << "No\n";
	return 0;
}

// template function
ll gcd(int a, int b) { 
	if (b == 0) return a; 
	return gcd(b, a % b);  
} 

ll lcm(ll a, ll b){
	return a*b/gcd(a, b);
}

ll powm(ll a, ll b){
	ll x=1, y=a; 
    while (b > 0) {
        if (b%2) x = (x*y) % mod;
        y = (y*y) % mod;
        b /= 2;
    }
    return x % mod;
}

ll multm(ll a, ll b){
	return ((a%mod) * (b%mod)) % mod;
}

ll divm(ll a, ll b){
	return (a * powm(b, mod - 2)); 
}

ll subm(ll a, ll b){
	a -= b;
  	if (a < 0) a += mod;
	return a;
}

ll addm(ll a, ll b){
	a += b;
  	if (a >= mod) a -= mod;
  	return a;
}

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

#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define fore(i, l, r) for (int i = (int)(l); i <= (int)(r); ++i)
#define ford(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define all(x) x.begin(), x.end()

using namespace std;

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

/* --- END OF TEMPLATE --- */

map<int,int> m;

int main() { 
	int n, x, y;
	cin >> n >> x >> y;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (i != j) {
				//cout << i << " " << j << endl;
				int a = abs(i-j); //cout << a << endl;
				int b = abs(i-x) + 1 + abs(j-y); //cout << b << endl;
				int c = abs(i-y) + 1 + abs(j-x); //cout << c << endl;
				int r = min({a, b, c});
				m[r]++; 
			}
		}
	}
	for (int k = 1; k <= n-1; k++) {
		cout << m[k]/2 << endl;
	}
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll int64_t
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
 
int main() {

  ll A,B,K;

  cin >> A >> B >> K ;

  int ans=0;

  if(K<=A){//食べる回数が高橋所有より少ない
    cout << A-K << ' ' << B << endl;
  }

  else if(K>=A+B){//食べる回数がクッキー合計より多い
    cout << 0 << ' ' << 0 << endl;
  }

  else{//食べる回数が高橋所有より多いが、青木で賄える
    cout << 0 << ' ' << A+B-K << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;
import java.util.Stack;

public class Main {
	
	int totalVertex;
	ArrayList<LinkedList<Integer>> adjList;
	
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		int totalEdges = in.nextInt();
		adjList = new ArrayList<>();
		
		for(int i = 0; i < totalVertex; i++) {
			adjList.add(new LinkedList<Integer>());
		}
		for(int i = 0; i < totalEdges; i++) {
			int source = in.nextInt();
			int edge = in.nextInt();
			adjList.get(source).add(edge);
		}
		in.close();
	}
	
	public void topoSort() {
		Stack<Integer> stack = new Stack<>();
		boolean[] visited = new boolean[totalVertex];
		for(int i = 0; i < totalVertex; i++) {
			if(!visited[i]) { //runs DFS on all nodes (even unconnected graphs)
				DFS(i, visited, stack);
			}
		}
		while(!stack.isEmpty()) {
			System.out.println(stack.pop());
		}
	}
	public void DFS(int node, boolean[] visited, Stack<Integer> stack) {
		visited[node] = true;
		LinkedList<Integer> neighbors = adjList.get(node);
		for(Integer n : neighbors){ //alwasy use enhanced for loop for LL bc otherwise running n squared
			if(!visited[n]) {
				DFS(n, visited, stack); //this callse dfs on all unvisited neighbors
			}
		}
		stack.push(node); //now we are allowed to put the original node on the stack bc we finished traversing the childresn
	}
	
	public static void main(String[] args) {
		Main Graph = new Main();
		Graph.loadAdjList();
		Graph.topoSort();
	}

}



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

using namespace std;

typedef long long LL;

const int N = 110;

int n;
int c[N], v[N];

int main()
{
    int res = 0;

    cin >> n;
    for(int i = 1; i <= n; i++) cin >> v[i];
    for(int i = 1; i <= n; i++) cin >> c[i];

    for(int i = 1; i <= n; i++)
        if(v[i] > c[i])
            res += v[i] - c[i];

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Thu Jan 10 22:45:19 2019
//
package main

import (
	"fmt"
)

type graph struct {
	routes  [][]int
	visited []bool
}

func (g graph) addRoute(from, to int) {
	g.routes[from] = append(g.routes[from], to)
	g.routes[to] = append(g.routes[to], from)
}

func (g graph) dfs(from int, dist int, dists []int) {
	dists[from] = dist
	g.visited[from] = true

	for i := range g.routes[from] {
		to := g.routes[from][i]
		if !g.visited[to] {
			g.dfs(to, dist+1, dists)
		}
	}
}

func (g graph) dists(from int) []int {
	dists := make([]int, len(g.routes))
	for i := range g.visited {
		g.visited[i] = false
	}

	g.dfs(from, 0, dists)
	return dists
}

func newGraph(n int) graph {
	g := graph{}
	g.routes = make([][]int, n)
	g.visited = make([]bool, n)

	return g
}

func main() {
	var N int
	fmt.Scan(&N)

	g := newGraph(N + 1)
	for i := 0; i < N-1; i++ {
		var a, b int
		fmt.Scan(&a, &b)
		g.addRoute(a, b)
	}
	dists1 := g.dists(1)
	distsN := g.dists(N)

	fennec, sunuke := 0, 0
	for i := 1; i <= N; i++ {
		if dists1[i] <= distsN[i] {
			fennec++
		} else {
			sunuke++
		}
	}

	if fennec > sunuke {
		fmt.Println("Fennec")
	} else {
		fmt.Println("Snuke")
	}
}


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

int main() {
    int N;
    cin >> N;
    string S;
    cin >> S;
    int count = 0;
    long long int A[1000] = {};
    for(int i = 0; i < 1000; i++) {
        int num[3] = {i/100, i / 10 % 10, i % 10};
        int k = 0;
        for(int j = 0; j < N; j++) {
            if(S[j] == (num[k] + '0')) {
                k++;
            }
            if(k == 3) {
                count++;
                break;
            }
        }
    }
    cout << count << endl;
    return 0;
}

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

using namespace std;
int main()
{
	int a;
	cin >> a;
	int b;
	cin >> b;
	int c;
	cin >> c;
	
	if(a <= c && c <= b)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <deque>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <functional>
#include <bitset>
#include <utility>
#include <sstream>
#include <fstream>
#include <stack>
#include <cstdlib>
#include <complex>
#include <set>

using namespace std;

#define INF 1070000000LL
#define pb push_back
#define irep(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) irep(i,0,n)

typedef long long lint;
typedef pair<int, int> pint;
struct Edge{
    int to,weight;
};
typedef vector<vector<Edge> > Graph;


int main(){
    int n;
    cin >> n;
    vector<lint> h(n);
    rep(i,n)cin >> h[i];
    vector<int> ans(n);
    ans[n-1] = 0;
    int temp = 0;
    rep(i,n-1){
	if(h[n-i-2] >= h[n-i-1]){
	    ++temp;
	}
	else{
	    temp = 0;
	}
	ans[n-i-2] = temp;
    }
    auto itr = max_element(ans.begin(),ans.end());
    cout << *itr << endl;
 }


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

int main(){
    int n;
    cin >> n;
    int p[n];
    int q[n+1];
    int m = 1;
    int l = 1;
    for(int i = 0; i < n; i++){
        cin >> p[i];
        q[p[i]] = i+1;
    }
    for(int i = 1; i < n; i++){
        if(q[i] < q[i+1]){
            l++;
        }
        else{
            m = max(m, l);
            l = 1;
        }
        if(i == n-1){
            m = max(m, l);
        }
    }
    cout << n-m << endl;
    return 0;
}

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

unsigned long factorial(unsigned long n){
    
    unsigned long ans = (n>1)? n*factorial(n-1):1;
    
    return  ans;
}


int main (int argc, char const* argv[]){
    unsigned long n, ans;
    
    cin >> n;
    
    ans = factorial(n);
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 1156
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
  
namespace ConsoleApplication32
{
    class Program
    {
        
        static void Main(string[] args){
        int a =int.Parse(Console.ReadLine());
        int[] b=new int[a];
        int[] co=new int[9];
        int mim=0;
        int max=0;
        b = Console.ReadLine().Split().Select(int.Parse).ToArray();
        for(int c =0;c<a;c++)
        {
        	if(b[c]<400)
			co[0]++;
			else if(b[c]<800)
			co[1]++;
			else if(b[c]<1200)
			co[2]++;
			else if(b[c]<1600)
			co[3]++;
			else if(b[c]<2000)
			co[4]++;
			else if(b[c]<2400)
			co[5]++;
			else if(b[c]<2800)
			co[6]++;
			else if(b[c]<3200)
			co[7]++;
			else if(3199<b[c])
			co[8]++;
        }
        for(int c=0;c<8;c++)
        if(co[c]>0)
        {
        mim+=1;
        max+=1;
        }
        if(mim==0)
        {mim+=1;
        max+=co[8];
        }
        else max+=co[8];
        Console.WriteLine("{0} {1}",mim,max);
        }
    }
}



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

int main(){
    string S;
    cin >> S;
    for(int i = 0;i < S.size();i++){
        S[i] = 'x';
    }
    cout << S << endl;
    return 0;
}    


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, x: "List[int]", y: "List[int]", h: "List[int]"):
    idx = 0
    for i in range(N):
        if h[i] > 0:
            idx = i
            break
    for cx in range(101):
        for cy in range(101):
            H = h[idx] + abs(cx - x[idx]) + abs(cy - y[idx])
            found = True
            for i in range(N):
                tmp_h = max(H - abs(cx - x[i]) - abs(cy - y[i]), 0)
                if tmp_h != h[i]:
                    found = False
                    break
            if H > 0 and found:
                print(cx, cy, H)
                return
    print('error')
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    x = [int()] * (N)  # type: "List[int]" 
    y = [int()] * (N)  # type: "List[int]" 
    h = [int()] * (N)  # type: "List[int]" 
    for i in range(N):
        x[i] = int(next(tokens))
        y[i] = int(next(tokens))
        h[i] = int(next(tokens))
    solve(N, x, y, h)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<string>
#include<algorithm>
#include<utility>
#include<math.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, int> P;
const int INF = pow(10, 8);
const ll LINF = ll(1e18);

int parent[10001];
int depth[10001]={};

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

void unite(int x, int y){
  x=find(x);y=find(y);
  if(x==y)return;
  if(depth[x]<depth[y]){
    parent[x]=y;
    return;
  }else if(depth[y]>depth[x]){
    parent[y]=x;
  }else{
    parent[y]=x;
    depth[x]++;
  }
}

bool same(int x, int y){
  return find(x)==find(y);
}

int main(){
  int n, q;cin>>n>>q;
  for(int i=0;i<n;i++){
    parent[i]=i;
  }
  for(int i=0;i<q;i++){
    int com, x, y;cin>>com>>x>>y;
    if(com==0){
      unite(x, y);
    }else{
      cout<<(same(x, y)?1:0)<<endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3164
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

#define PI 3.14159265358979323846264338327950L

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

	long double h_arg = 2 * PI * (double(h) / 12) + 2 * PI * (double(m) / 60 / 12);
	long double m_arg = 2 * PI * (double(m) / 60);
	
	long double center_arg = h_arg - m_arg;

	long double c_2 = a * a + b * b - 2 * a * b * cos(center_arg);
	cout << fixed << setprecision(16);
	cout << sqrt(c_2) << endl;
}

Measured memory_bytes: 3560
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

base = sum(B)
bonus = 0
for i, num in enumerate(A):
  if i + 1 >= len(A):
    break
  if A[i+1] == num + 1:
    bonus += C[num - 1]

print(base + bonus)

Measured memory_bytes: 3064
#define ENABLE_DEBUG 1
// Kana's kitchen {{{
#include<bits/stdc++.h>
#define ALL(v) std::begin(v),std::end(v)
#define LOOP(k) for(i64 ngtkana_is_a_genius=0; ngtkana_is_a_genius<(i64)k; ngtkana_is_a_genius++)

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

template <class T, class U> using pair = std::pair<U, T>;
template <class T> using diag_pair = std::pair<T, T>;
template <class... Args> using tuple = std::tuple<Args...>;
template <class T> using vec = std::vector<T>;
template <class T> using numr = std::numeric_limits<T>;

#ifdef NGTKANA
#include<debug.hpp>
#else
#define DEBUG(...)(void)0
#endif
/*}}}*/
auto cmx=[](auto&x,auto y){if(x<y){x=y;return true;}return false;};
int main(){
    std::cin.tie(nullptr);
    std::ios::sync_with_stdio(false);
    std::cout << std::setprecision(15) << std::fixed;

    usize n;
    std::cin >> n;
    std::map<std::string, i64> map;
    while (n--) {
        std::string s;
        std::cin >> s;
        map[s]++;
    }

    i64 max = 0;
    for (auto&& p: map) cmx(max, p.second);

    vec<std::string> ans;
    for (auto&& p: map) if (p.second==max) ans.push_back(p.first);
    std::sort(ALL(ans));

    for (auto&& p: ans) {
        std::cout << p << '\n';
    }
}


Measured memory_bytes: 25584
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#define endl '\n'
#define loop(i, m, n) for (lli i = m; i < n; i++)
#define loope(i, m, n) for (lli i = m; i <= n; i++)
#define epool(i, m, n) for (lli i = m; i >= n; i--)
#define pool(i,m,n) for(lli i=m; i>n; i++)
#define maxe *max_element
#define mine *min_element
#define plli pair<lli, lli>
#define mod 1000000007
#define mod2 998244353
#define vt vector<lli>
#define fi first
#define se second
#define pb push_back
#define umap unordered_map
#define mmap multimap
#define mp make_pair
#define inp1(a) cin >> a
#define inp2(a, b) cin >> a >> b
#define inp3(a, b, c) cin >> a >> b >> c
#define inp4(a, b, c, d) cin >> a >> b >> c >> d
#define inp5(a, b, c, d, e) cin >> a >> b >> c >> d >> e
#define inp6(a, b, c, d, e, f) cin >> a >> b >> c >> d >> e >> f
#define pr0() cout << " "
#define pr1(a) cout << a << " "
#define pr2(a, b) cout << a << " " << b << " "
#define pr3(a, b, c) cout << a << " " << b << " " << c << " "
#define pr4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << " "
#define emp emplace //used to push a pair etc..
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x, 0;
#define all(v) v.begin(),v.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
//especially for deque both sides dynamic
#define pf push_front
//list doubly linked lists can insert at mid. splice fn can be used
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;
 
lli gcd(lli a, lli b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
 
lli lcm(lli a, lli b){
    return (a * b) / gcd(a, b);
}
 
lli modi(lli n,lli m=mod){ 
    if(n==0) return 0;
    n%=m;
    n+=m;
    n%=m;
    return n;
}
 
lli mpow(lli base, lli exp){
    base %= mod;
    lli result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((lli)result * base) % mod;
        base = ((lli)base * base) % mod;
        exp >>= 1;
    }
    return result;
}
const lli INF=1e18;
const lli N=2e5+5;
lli a[N]={0},b[N]={0};

int32_t main(){
    fast_io
    lli i = 0,j=0;
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    
    vt v,v1,v2;
    lli a,b,c,d,e,f,n,k;

    string s;
    cin >> s;

    if(s=="AAA" || s=="BBB") cout << "No";
    else cout << "Yes";


}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<string.h>
#include<map>
#include<set>
#include<vector>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
using namespace std;
int main()
{
char a,b;
cin>>a>>b;
if(a=='H')
cout<<b;
else
{if(b=='H')
 cout<<"D";
 else
 cout<<"H";}
system("pause");
return 0;
}


Measured memory_bytes: 504
#include <iostream>

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

using namespace std;

typedef long long ll;


int main(){
    int N,K;
    scanf("%d %d",&N,&K);

    ll A[N],B[N];
    rep(i,N) scanf("%lld",A+i);
    rep(i,N) B[i]=0;

    int a,b,c;

    rep(ki,K){
        rep(i,N){
            a=i-A[i]>=0?i-A[i]:0;
            b=i+A[i]+1<=N?i+A[i]+1:N;
            B[a]+=1;
            if(b<N){B[b]-=1;}
        }
        /*rep(i,N)cout<<B[i]<<" ";
        cout<<endl;*/
        for(int i=0;i!=N-1;++i){
            B[i+1]=B[i]+B[i+1];
        }
       /* rep(i,N)cout<<B[i]<<" ";
        cout<<endl;*/
        bool flag=true;
        for(int i=0;i!=N;++i){
            if(A[i]!=B[i]){
                flag=false;
            }
            A[i]=B[i];
            B[i]=0;
            
        }
        if(flag){
            break;
        }
        
    }

    rep(i,N){
        cout<<A[i]<<" ";
    }
    cout<<endl;

}

Measured memory_bytes: 6788
#include <iostream>
#include <cctype>
#include <algorithm>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <string>
#include <functional>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <bitset>
#define pb push_back
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<10)
#define MOD 1000000007
#define pb push_back
#define YES cout<<"YES"<<endl
#define Yes cout<<"Yes"<<endl
#define NO cout<<"NO"<<endl
#define No cout<<"No"<<endl
#define INF (1<<10)
#define LLINF (1<<30)
#define MOD 1000000007
using ll = long long;
using namespace std;

int main(void){
  int n,m,q,train[505][505]={};
  cin>>n>>m>>q;
  for(int i=0;i<m;i++){
    int tl,tr;
    cin>>tl>>tr;
    train[tl][tr]++;
  }
  for(int i=1;i<=n;i++){
    for(int j=2;j<=n;j++){
      train[i][j]+=train[i][j-1];
    }
  }
  for(int i=2;i<=n;i++){
    for(int j=1;j<=n;j++){
      train[i][j]+=train[i-1][j];
    }
  }
  for(int i=0;i<q;i++){
    int tp,tq;
    cin>>tp>>tq;
    cout<<(train[tq][tq]-train[tp-1][tq]-train[tq][tp-1]+train[tp-1][tp-1])<<endl;
  }
  return 0;
}


Measured memory_bytes: 1920
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		sc.close();

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < s.length; i++) {
			if (s[i] == 'B') {
				if (sb.length() > 0) {
					sb.deleteCharAt(sb.length() - 1);
				}
			} else {
				sb.append(s[i]);
			}
		}
		System.out.println(sb.toString());
	}
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int mod = 1000000007;

struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
 
  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

mint solve(int n) {
  if (n == 1) return 2;
  mint res = solve(n / 2);
  res *= res;
  if (n % 2 == 1) {
    res *= 2;
  }
  return res;
}

mint choose(int n, int r) {
  mint x, y;
  x = y = 1;
  rep (i, r) {
    x *= (i + 1);
    y *= (n - i);
  }

  return y / x;
}

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  int n, a, b;
  cin >> n >> a >> b;

  mint ans = solve(n);
  ans -= 1;
  ans -= choose(n, a);
  ans -= choose(n, b);

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


Measured memory_bytes: 3648
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let x: u64 = read();
    let mut yokin = 100;
    let mut ans = 0;

    loop {
        yokin = yokin + (yokin as f64 * 0.01) as u64;
        ans += 1;
        if yokin >= x {
            break;
        }
    }

    println!("{}", ans);

}


Measured memory_bytes: 2124