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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

ll GCD(ll a, ll b) {
    if (a <= 0 || b <= 0) {
        return -1;
    }
    if (a > b) {
        if (a % b == 0) {
            return b;
        } else {
            GCD(b, a % b);
        }
    } else if (a < b) {
        if (b % a == 0) {
            return a;
        } else {
            GCD(a, b % a);
        }
    } else {
        return a;
    }
}

ll LCM(ll a, ll b) {
    return a / GCD(a, b) * b;
}

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll A, B;
    cin >> A >> B;

    cout << LCM(A, B) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
int main(int argc, char const *argv[]) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  string ans = "NO";
  if (n == 3 || n == 5 || n == 7) {
    ans = "YES";
  }

  cout << ans << "\n";
  return 0;
}

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

int main(int argc, char const *argv[])
{
    int N;
    cin >> N;

    int ans = 0;
    for (int i = 1; i <= N; i++)
    {
        for (int j = 1; j <= N; j++)
        {
            for (int k = 1; k <= N; k++)
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>
#include <climits>
#include <cassert>

using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair

// ?§£??¬??????????????????????£?
// ?????¬???p65??¨??????

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

    vector<int> A(N);
    REP(n, N) cin >> A[n];

    int INF = 1e9;
    vector<int> dp(N+1, INF);
    REP(i, N) {
        auto a = A[i];
        *lower_bound(ALL(dp), a) = a;
    }
    auto it2 = lower_bound(ALL(dp), INF);
    cout << (it2 - dp.begin()) << endl;
    return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, a, b) for(int i = a; i < b; i++)
typedef long long ll;
using namespace std;

int main(){
  int n;
  cin >> n;
  int ans;
  for(int i = 1; i * 1.08 < n + 1; i++){
    ans = i;
  }
  if(floor(ans * 1.08 >= n) && (floor(ans * 1.08) < n + 1)) cout << ans << endl;
  else cout << ":(" << endl;
}

Measured memory_bytes: 888
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position move_pattern[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++){ ans += to_string(*i) + " "; } ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
#define mod long(998244353)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(10)
#define highest(x) (63 - __builtin_clzl(x))

int main(){
    int N;
    long x;
    cin >> N >> x;
    long a[N];
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    sort(a, a + N);
    int ans = 0;
    for(int i = 0; i < N; i++){
        if(a[i] <= x){
            x -= a[i];
            ans++;
        }
    }
    if(x && ans == N){
        cout << N - 1 << endl;
    }else{
        cout << ans << endl;
    }
}


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

#define VARNAME(x) #x
#define show(x) cerr << #x << " = " << x << endl

using namespace std;
using ll = long long;

template <typename S, typename T>
ostream& operator<<(ostream& os, const pair<S, T>& p)
{
    os << "(" << p.first << "," << p.second
       << ")";
    return os;
}


constexpr ll MOD = (ll)1e9 + 7LL;

template <typename T>
constexpr T INF = numeric_limits<T>::max() / 100;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<ll> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    auto b = a;
    sort(b.begin(), b.end());
    if (a == b) {
        cout << 0 << endl;
        return 0;
    } else {
        using P = pair<int, int>;
        vector<P> op;
        const auto maxit = max_element(a.begin(), a.end());
        const auto minit = min_element(a.begin(), a.end());
        const int maxind = maxit - a.begin();
        const int minind = minit - a.begin();
        if (*maxit > -*minit) {
            for (int i = 0; i < N; i++) {
                if (a[i] <= 0) {
                    op.push_back(make_pair(maxind, i));
                    a[i] += *maxit;
                }
            }
            for (int i = 0; i < N - 1; i++) {
                if (a[i] > a[i + 1]) {
                    op.push_back(make_pair(i, i + 1));
                    a[i + 1] += a[i];
                }
            }
        } else {
            for (int i = 0; i < N; i++) {
                if (a[i] >= 0) {
                    op.push_back(make_pair(minind, i));
                    a[i] += *minit;
                }
            }
            for (int i = N - 1; i >= 1; i--) {
                if (a[i - 1] > a[i]) {
                    op.push_back(make_pair(i, i - 1));
                    a[i - 1] += a[i];
                }
            }
        }
        cout << op.size() << endl;
        for (const auto& o : op) {
            cout << o.first + 1 << " " << o.second + 1 << endl;
        }
    }

    return 0;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
ld EPS = 1e-12;
int INF = numeric_limits<int>::max() / 2;
int MOD = 1e9 + 7;
#define rep(i,n) for(int i = 0; i < n; i++)
#define all(obj) (obj).begin(), (obj).end()
#define debug(x) cerr << #x << ": " << x << '\n'

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

    int n;
    cin >> n;
    vi vec(n+1,0);
    for(int i = 2; i <= n; i++){
        int temp = i;
        int count = 2;
        while(temp != 1){
            if(temp % count == 0){
                vec[count]++;
                temp /= count;
            }else{
                count++;
            }
        }
    }

    int ans = 0;

    rep(i,n){
        rep(j,n){
            if(vec[i] >= 2 && vec[j] >= 4 && i != j){
                for(int k = j+1; k < n; k++){
                    if(vec[k] >= 4 && k != i) ans++;
                }
            }
            if(vec[i] >= 2 && vec[j] >= 24 && i != j) ans++;
            if(vec[i] >= 4 && vec[j] >= 14 && i != j) ans++;
        }
        if(vec[i] >= 74) ans++;
    }

    cout << ans << '\n';
    return 0;
}


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

int main(){
  int N;
  int ans = 0;
  int Nlist[21] = {0};
  int Clist[21] = {0};

  cin >>N;


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

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

  for(int i = 0; i<N;i++){
    if(Nlist[i]-Clist[i] > 0)ans+=Nlist[i]-Clist[i];
  }
  cout <<ans<<endl;

  return 0;
  }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int
#include<vector>
#define mp make_pair
#define endl "\n"
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define lb lower_bound
#define forn(i,n) for(ll i=0 ; i<n ; i++)
#define arr(a,n) for(ll i=0;i<n;i++){ cin>>a[i]; }
#define ub upper_bound
#define pb push_back
#define pi pair<int,int>
#define mod 1000000007
#define vectormax *max_element
#define vectormin *min_element
#define setbit _builtin_popcountll
using namespace std;

ll ipow(ll x, ll n)
{
    ll result = 1;
    while (n) {
        if (n & 1)
            result = result * x % mod;
        n = n / 2;
        x = x * x % mod;
    }
    return result;
}
int main(){
 int a,b,c,d,e;
 cin>>a>>b>>c>>d>>e;
 if(a==0)
    cout<<1<<endl;
    else if(b==0)
    cout<<2<<endl;
    else if(c==0)
    cout<<3<<endl;
    else if(d==0)
    cout<<4<<endl;
    else if(e==0)
    cout<<5<<endl;


return 0;
}


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

int main() {
int n;
cin >>n;
int ans;
vector<int> d(n);
for(int i=0; i<n; i++) {
cin>> d.at(i);
}
sort(d.begin(),d.end());

  ans = d.at(n/2)-d.at(n/2-1);


cout <<ans<<endl;

}

Measured memory_bytes: 640
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto xy = readln.split.to!(long[]);
    auto x = xy[0];
    auto y = xy[1];
 
    if (y > x) {
        if (x < 0 && y > 0) {
            writeln(min(y - x, abs(y + x) + 1));
        } else {
            writeln(y - x);
        }
    } else {
        if (x == 0) {
            writeln(-y + 1);
        } else if (y == 0) {
            writeln(x + 1);
        } else if (x > 0 && y > 0) {
            writeln(min(x - y + 2, x + y + 1));
        } else if (x > 0 && y < 0) {
            writeln(abs(x + y) + 1);
        } else {
            writeln(min(-y + x + 2, -x - y + 1));
        }
    }
}

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


int main() {
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)cin>>a[i];
    int idx;
    sort(a,a+n);
    long long sum=0;
    for(int i=0;i<n;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            idx = lower_bound(a,a+n,a[i]+a[j])-a;
            sum+= idx-j-1;
        }
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
import collections

n, k = map(int, input().split())
a = list(map(int, input().split()))

c = collections.Counter(a)
b = list(sorted(c.values(), reverse=True))
sum = 0

if len(c) <= k:
    print("0")
    exit(0)

for i in range(0, k):
    sum = sum + b[i]

print(max(len(a)-sum, 0))

Measured memory_bytes: 32560
var input = '';
var readable = process.stdin;
readable.resume();
readable.setEncoding( 'utf-8' );
readable.on( 'data', function( chunk ) {
  input += chunk;
});

readable.on( 'end', function() {
  var data = input.trim().split( "\n" );
  var rc = data[0].split( " " ).map( Number );
  var r = rc[0];
  var c = rc[1]; 
  var t = Array( c+1 );
  for( var i=0; i<c+1; i++ ) { t[i] = 0; }
  var output = [];

  for( var index=1; index<data.length; index++ ) {
    var nums = data[index].split( ' ' ).map( Number );
    var sum = 0;
    for( var j=0; j<c; j++ ) {
      sum += nums[j];
      t[j] += nums[j];
    }
    t[c] += sum;
    nums.push( sum );
    output.push( nums.join( " " ) );
  }
  output.push( t.join( " " ) );
  console.log( output.join( "\n" ) );
});

Measured memory_bytes: 10316
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Mll = M<ll, ll>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin(),ie=(c).rend();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int a, b, c;

int main() {
    cin >> a >> b >> c;
  
    if (a + b >= c) cout << "Yes" << '\n';
    else cout << "No" << '\n';

    return 0;
}


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

using namespace std;
typedef pair<int,int> PII;
typedef long long ll;

int main(){
	long long n;
	int num[8] = {0,1,2,3,5,7,8,9};
  while(true){
		cin>>n;
		if(!n)break;
		int newnum[20];
		for(int i=0;i<20;i++)
			newnum[i] = 0;

		int i=0;
		while(n>0){
			newnum[i] = n%8;
			n /= 8;
			i++;
		}

		long long ans = 0;
		for(i=19;i>=0;i--){
			ans *= 10;
			ans += num[newnum[i]];
		}
		cout<<ans<<endl;
	}
  return 0;
}

Measured memory_bytes: 864
#include <stdio.h>
#include <math.h>

#define rowmax 25
#define colmax 25

int abs(int x){
    if(x<0){
        x = -x;
    }
    return x;
}

int min2(int x,int y){
    if(y<x){
        x=y;
    }
    return x;
}

int main(){
    int row,col;
    int A[rowmax][colmax]={{}};
    int i,j,k,l;
    int mindist=rowmax*colmax*rowmax*colmax*rowmax*colmax;
    int distx, disty, dist;

    scanf("%d%d",&row,&col);

    for(i=0;i<row;i++){
        for(j=0;j<col;j++){
            scanf("%d",&A[i][j]);
        }
    }

    for(k=0;k<row;k++){
        for(l=0;l<col;l++){
            dist = 0;
            for(i=0;i<row;i++){
                for(j=0;j<col;j++){
                    distx = abs(i - k);
                    disty = abs(j - l);
                    dist += min2(distx,disty) * A[i][j];
                }
            }
            if(dist<mindist){
                        mindist = dist;
            }
        }
    }

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



Measured memory_bytes: 2104
#include <iostream>

using namespace std;

int main(){
    int n;
    int p[20];
    cin >> n;
    for(int i = 0; i < n; i++) cin >> p[i];
    int ans = 0;
    for(int i = 1; i < n-1; i++){
        if((p[i] > p[i-1]) && (p[i] < p[i+1])) ans++;
        if((p[i] < p[i-1]) && (p[i] > p[i+1])) ans++; 
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+1;
long long int tree[4*N]={0};
#define ff first
#define ss second
void update(long int node,long int l,long int r,long int ind,long long int val)
{
    if(l==r)
    {
        tree[node] = val;
    }
    else
    {
        long int mid = (l+r)/2;
        if(mid>=ind)
         update(2*node+1,l,mid,ind,val);
         else
         update(2*node+2,mid+1,r,ind,val);
         tree[node] = max(tree[2*node+1],tree[2*node+2]);
    }
}
long long int query(long int node,long int l,long int r,long int L,long int R)
{
    if(L>r || l>R)
    return 0;
    if(L<=l && R>=r)
    return tree[node];
    long int mid = (l+r)/2;
    return max(query(2*node+1,l,mid,L,R),query(2*node+2,mid+1,r,L,R));
}
long long int mod = 1e9+7;
bool compare(pair<long long int,long long int> a,pair<long long int,long long int> b)
{
    return a.ff>b.ff;
}
int main()
{
    long int t=1;
    // cin>>t;
    long int kk=0;
    while(t--)
    {
       string s,tt;
       cin>>s>>tt;
       long int ans=1e7;
       for(long int i=0;i<=s.length()-tt.length();i++)
       {
           long int temp=0;
           for(long int j=0;j<tt.length();j++)
           {
               if(s[i+j]!=tt[j])
               temp++;
           }
           ans=min(ans,temp);
       }
       cout<<ans<<endl;
    }
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include <boost/math/common_factor.hpp>
using namespace std;
using u64 = uint64_t;
using s64 = int64_t;

int main() {
	u64 N;
	cin >> N;

	vector<u64> A(N);
	u64 amax = 0;

	for(u64 i=0; i<N; i++) {
		cin >> A[i];
		amax = max(amax, A[i]);
	}

	vector<u64> Acnt(amax+1);

	u64 i_gcd = A[0]; 
	Acnt[A[0]]++;

	for(u64 i=1; i<N; i++) {
		i_gcd = boost::math::gcd(i_gcd, A[i]);
		Acnt[A[i]]++;
	}

	bool is_pairwise = true;

	for(u64 i=2; i<=amax && is_pairwise; i++) {
		u64 cnt = 0;
		for(u64 j=i; j<=amax && is_pairwise; j+=i) {
			cnt += Acnt[j];
			is_pairwise &= (cnt <= 1); 
		}
	}

	if(is_pairwise) {
		cout << "pairwise coprime" << endl;
	} else if(i_gcd == 1) {
		cout << "setwise coprime" << endl;
	} else {
		cout << "not coprime" << endl;
	}

	return 0;
}

Measured memory_bytes: 18820
#include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  int i,j;
  int a[101],m,n,q,d;
  int mx;
  while(cin>>n>>q&&n+q){
    memset(a,0,sizeof(a));
    for(i=0;i<n;i++){
      cin>>m;
      for(j=0;j<m;j++){
	cin>>d;
	a[d]++;
      }
    }
    mx=-1;
    for(i=0;i<101;i++){
      if(a[i]>=q&&(mx==-1||a[mx]<a[i]))
	mx=i;
    }
    if(mx==-1)
      cout<<0<<endl;
    else
      cout<<mx<<endl;
  }
  return 0;
}

Measured memory_bytes: 868
package main

import (
  "fmt"
  "bufio"
  "os"
)

func main() {
  sc := bufio.NewScanner(os.Stdin)

  sc.Scan()

  s := sc.Text()

  fmt.Printf("%c%d%c\n", s[0], len(s) - 2, s[len(s) - 1])
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#define N_MAX 1000100
using namespace std;
bool cb[N_MAX];
int prim[N_MAX];
vector<int> p;
typedef long long ll;
void criba(){
	memset(cb,0,sizeof cb);
	for(int i = 2; i < N_MAX; i++){
		if(!cb[i]){
			p.push_back(i);
			prim[i]=i;
			if((ll)i*i >= N_MAX)
				continue;
			for(int j = i*i; j < N_MAX; j+=i){
				cb[j]=true;
				prim[j] = i;
			}
		}
	}
}
int main(){
	p.reserve(100000);
	criba();
	vector<ll> multi;
	int n;
	scanf("%d",&n);
	vector<ll> cont(n+1);
	multi.clear();
	multi.reserve(30);
	cont[1] = 1;
	ll ans=1,auxi=1;
	for(int i = 2; i < n; i++){
		int t = 0,x=i,d;
		auxi=1;
		while(x>1){
			t = 0;
			d = prim[x];
			while(x%d == 0)
				t++,x/=d;
			auxi*=t+1;
		}
		ans += auxi;
		//printf("i:%d %lld\n",i,auxi );
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 16160
#include <algorithm>
#include <bitset>
#include <cmath>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(a) begin(a),end(a)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1e+9;
const ll mod=1000000007;
const double PI=3.14159265358979323846;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};
ll gcd(ll a, ll b){
  if (b==0) return a;
  else return gcd(b,a%b);
}
int cans(bool f){
  if(f) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}




vector<int> a;
vector<int> ans;
int main() {
  int N;
  cin >> N;
  vector<int> cnt(N+1);
  rep(i,N-1) {
    int id;cin >> id;
    cnt[id]++;
  }
  rep(i,N) {
    cout << cnt[i+1] << endl;
  }
  
  return 0;
}


Measured memory_bytes: 3576
import sys
H,W = map(int,input().split())
if H%3 ==0:
    print(0)
    sys.exit()
if W%3 ==0:
    print(0)
    sys.exit()
A=[H,W]
for h in range(H):
    w = W//2
    sa = h*W
    sb = (H-h)*w
    sc = (H-h)*(W-w)
    A.append(max(sa,sb,sc)-min(sa,sb,sc))
for h in range(W):
    w = H//2
    sa = h*H
    sb = (W-h)*w
    sc = (W-h)*(H-w)
    A.append(max(sa,sb,sc)-min(sa,sb,sc))
print(min(A))

Measured memory_bytes: 11052
package main

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

func main() {
	var n int
	fmt.Scan(&n)
	a, b, c := NextIntArray(), NextIntArray(), NextIntArray()

	sort.Ints(a)
	sort.Ints(b)
	sort.Ints(c)

	count := 0
	for _, v := range b {
		count += lesserCount(v, a) * largerCount(v, c)
	}
	fmt.Println(count)
}

func largerCount(compared int, list []int) int {
	count := 0
	lis := list
	for len(lis) > 0 {
		if len(lis) == 1 {
			if compared < lis[0] {
				count += 1
			}
			lis = []int{}
		} else {
			left, right := SplitAt(lis, len(lis)/2)
			if compared < right[0] {
				count += len(right)
				lis = left
			} else {
				lis = right
			}
		}
	}
	return count
}

func lesserCount(compared int, list []int) int {
	count := 0
	lis := list
	for len(lis) > 0 {
		if len(lis) == 1 {
			if compared > lis[0] {
				count += 1
			}
			lis = []int{}
		} else {
			left, right := SplitAt(lis, len(lis)/2)
			if left[len(left)-1] < compared {
				count += len(left)
				lis = right
			} else {
				lis = left
			}
		}
	}
	return count
}

func SplitAt(list []int, i int) ([]int, []int) {
	if len(list) <= 1 {
		return list, []int{}
	} else if len(list) <= 3 {
		return list[0:1], list[1:]
	} else {
		r1, r2 := list[0:i-1], list[i-1:]
		return r1, r2
	}
}

// reader

var size = 1000000
var rdr = bufio.NewReaderSize(os.Stdin, size)

func ReadLine() string {
	buf := make([]byte, 0, size)
	for {
		line, isPrefix, err := rdr.ReadLine()
		if err != nil {
			panic(err)
		}
		buf = append(buf, line...)
		if !isPrefix {
			break
		}
	}
	return string(buf)
}

func NextArray() []string {
	s := ReadLine()
	return strings.Split(s, " ")
}

func NextIntArray() []int {
	a := NextArray()
	na := make([]int, 0)

	for _, v := range a {
		if n, e := strconv.Atoi(v); e == nil {
			na = append(na, n)
		}
	}

	return na
}


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

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

    int n;
    cin >> n;
    vector<int> b(n - 1);
    REP(i, n - 1) cin >> b[i];

    int ans = 0;
    REP(i, n - 2) ans += min(b[i], b[i + 1]);

    ans += b[0];
    ans += b[n - 2];

    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void){
  int a,b;
  scanf("%d",&a);
  scanf("%d",&b);
  int i;
  int sum=0;
  for(i=0;i<2;i++){
    if(a>b){
      sum+=a;
      a--;
    }else{
      sum+=b;
      b--;
    }
  }
  printf("%d",sum);
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
 
int main() {
     int n,m,a;
    while(true){
        cin >> n >> m >> a;
        if(n==0&&m==0&&a==0){
                break;
        }
         
        int amida[101][1001]={{0}};
         
        for(int i=0;i<m;i++){
            int h=0,p=0,q=0;
            cin >> h >> p >> q;
            amida[p][h]=1;
        }
         
        for(int j=1000;j>0;j--){
            if(amida[a][j]==1) a++; //????????????
            else if(amida[a-1][j]==1) a--; //???
        }
         
        cout << a << endl;
    }
     
    return 0;
}

Measured memory_bytes: 1564
s = input()
s = s

st = 0
ed = 0
for i in range(len(s)):
  if s[i] == "A":
    st = i
    break
for i in range(len(s)):
  if s[-i + len(s) -1] == "Z":
    ed = -i + len(s) - 1
    break
print(ed-st+1)

Measured memory_bytes: 3516
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = 998244353;
const int MX = (int)2e5;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);

	int n, m, k;
	cin >> n >> m >> k;
	int x1, y1, x2, y2;
	cin >> x1 >> y1 >> x2 >> y2;
	x1--, y1--, x2--, y2--;

	vector<vector<char>> g(n, vector<char>(m));
	for(int i = 0; i < n; ++i){
		for(int j = 0; j < m; ++j){
			cin >> g[i][j];
		}
	}

	// up, down, left, right
	const int dx[] = {-1, 1, 0, 0};
	const int dy[] = {0, 0, -1, 1};

	vector<vector<bool>> vis(n, vector<bool>(m));

	vector<vector<int>> best(n, vector<int>(m, 1e9));
	best[x1][y1] = 0;

	queue<array<int, 2>> q;
	q.push({x1, y1});

	while(!q.empty()){
		auto cur = q.front();
		q.pop();
		int x = cur[0];
		int y = cur[1];

		if(vis[x][y]) continue;
		
		vis[x][y] = true;

		for(int dir = 0; dir < 4; ++dir){
			int cntr = k;
			while(cntr--){
				int nx = x + (k - cntr) * dx[dir];
				int ny = y + (k - cntr) * dy[dir];
				if(nx >= 0 && nx < n && ny >= 0 && ny < m && g[nx][ny] == '.'){
					if(best[x][y] + 1 <= best[nx][ny] && !vis[nx][ny]){
						best[nx][ny] = best[x][y] + 1;
						q.push({nx, ny});
					}
					else break;
				}
				else break;
			}
		}
	}

	int res = best[x2][y2];
	if(res == (int)1e9) res = -1;
	cout << res << endl;

	return 0;
}


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

int main(void) 
{
    int d,t,s;
    cin >> d >> t >> s;

    if(d <= t * s) cout << "Yes";
    else cout << "No";
    cout << endl;
}

Measured memory_bytes: 3600
use std::collections::BinaryHeap;
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 n: usize = read();
    let k: usize = read();
    let mut queue: Vec<i64> = vec![];
    for _ in 0..n {
        queue.push(read());
    }
    let mut ans = 0;
    for l in 0..(std::cmp::min(n, k) + 1) {
        for r in 0..(std::cmp::min(n, k) - l + 1) {
            let mut now = 0;
            let mut hands: BinaryHeap<i64> = BinaryHeap::new();
            for i in 0..l {
                now += queue[i];
                hands.push(-queue[i]);
            }
            for j in 0..r {
                now += queue[n - j - 1];
                hands.push(-queue[n - j - 1]);
            }
            for _ in 0..k - (r + l) {
                let minus_value = match hands.pop() {
                    Some(i) => i,
                    None => break,
                };
                if minus_value < 0 {
                    break;
                }
                // negate value
                now += minus_value;
            }
            ans = std::cmp::max(ans, now);
        }
        if l == std::cmp::min(n, k) - 1 {
            let mut now = 0;
            for i in 0..l {
                now += queue[i];
            }
            ans = std::cmp::max(ans, now);
        }
    }
    println!("{}", ans);
}


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

ll max(ll a, ll b){ 
	if(a >= b) return a;
	else if(a < b) return b;
}
ll min(ll a, ll b){ 
	if(a <= b) return a;
	else if(a > b) return b;
}
ll gcd(ll a, ll b){
	if(b == 0) return a;
	return gcd(b, a%b);
}
ll fact(ll n){
	ll res = 1;
	rep(i, n){
		res *= i + 1;
		res =  res%((ll)(1e9 + 7));
	}
	return res;
}
ll digit(const ll n){
	ll res = 0;
	ll i = 1;
	while(n % i != n){
		res += 1;
		i *= 10;
	}
	return res;
}

int main(){
	ll a, b, c;
	cin >> a >> b >> c;
	ll mod;
	bool flag = false;
	rep(i, b){
		mod = (a * (i+1)) % b;
		if(mod == c)flag = true;
	}
	if(flag)cout << "YES"<<endl;
	else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){

  int i,book;
    int n=0;
    int total=0;
  while(1){

  scanf("%d",&total);
  if(total == 0)break;

  for(i=0;i<9;i++){
    scanf("%d",&book);
   n =  total -= book;
  }
  printf("%d\n",n);
  }
  return 0;
}

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

using namespace std;

typedef long long ll;

string s;

int main(){
    cin >> s;
    if(s[0] == 'S'){
        cout << "Cloudy" << endl;
        return 0;
    }
    if(s[0] == 'C'){
        cout << "Rainy" << endl;
        return 0;
    }
    cout << "Sunny" << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;



class Program
{
    const int MOD = 1000000007;
    const int INF = 1 << 30;

    static void Main(string[] args)
    {
        Solve();
    }



    static void Solve()
    {
        Scaner sc = new Scaner();
        write wr = new write();

        int N = sc.Int1;
        var V = sc.IntArr;
        var C = sc.IntArr;

        var ans = Enumerable.Range(0, N).Select(i => V[i] - C[i]).Where(x => x > 0).ToArray();

        wr.wri(ans.Sum());





    }
}





class Scaner
{
    public string Str => Console.ReadLine();

    public string[] StrArr => Str.Split(' ');

    public long[] LongArr => StrArr.Select(long.Parse).ToArray();
    public int[] IntArr => StrArr.Select(int.Parse).ToArray();
    public char[] CharArr => Str.ToArray();
    public long Long1 => LongArr[0];
    public int Int1 => IntArr[0];
    
}



class write
{
    public  void wri<T>(T x)
    {
        Console.WriteLine(x);
    }
}


Measured memory_bytes: 13396
n = int(input())

sarr = []

for i in range(n):
    sarr.append(input())

m = int(input())

tarr = []

for i in range(m):
    tarr.append(input())

dic = {}

sset = list(set(sarr))
tset = list(set(tarr))

for i in range(len(sset)):
    dic[sset[i]] = sarr.count(sset[i]) - tarr.count((sset[i]))

ans = max(dic.values())

if ans < 0:
    ans = 0

print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(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()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll a, b;
    cin >> a >> b;
    vll vec{a + b, a * b, a - b};
    cout << *max_element(ALL(vec)) << endl;
    return 0;
}

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

using namespace std;
using ll = long long;

#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__  "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define RS(N) resize(N)
#define CINV(v, N) do {\
	v.RS(N);\
	rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
	v.RS(N);\
	rrep(i, N) cin >> v[i];\
} while (0);

#define MOD 1000000007

void init();
void solve();

signed main()
{
	init();
	solve();
}

int N;
vector<int> v;

void init()
{
	cin >> N;
	CINV(v, N);
	sort(all(v));
}



ll culc1()
{
	deque<int> ans;
	ans.PB(v[0]);
	int st = 1;
	int en = N-1;
	while (true) {
		if (st > en) break;
		ans.PB(v[en]);
		en--;
		if (st > en) break;
		ans.push_front(v[en]);
		en--;
		if (st > en) break;
		ans.PB(v[st]);
		st++;
		if (st > en) break;
		ans.push_front(v[st]);
		st++;
	}
	ll res = 0;
	for (int x : ans) cerr << x << " ";
	cerr << endl;
	reps(i, 1, N) {
		res += abs(ans[i] - ans[i-1]);
	}
	return res;
}

ll culc2()
{
	deque<int> ans;
	ans.PB(v[N-1]);
	int st = 0;
	int en = N-2;
	while (true) {
		if (st > en) break;
		ans.PB(v[st]);
		st++;
		if (st > en) break;
		ans.push_front(v[st]);
		st++;
		if (st > en) break;
		ans.PB(v[en]);
		en--;
		if (st > en) break;
		ans.push_front(v[en]);
		en--;
	}
	ll res = 0;
	for (int x : ans) cerr << x << " ";
	cerr << endl;
	reps(i, 1, N) {
		res += abs(ans[i] - ans[i-1]);
	}
	return res;
}

void solve()
{
	cout << max(culc1(), culc2()) << endl;
}





Measured memory_bytes: 1024
def ans(n,x):
    answer=0 
    f=[]
    for i in range(min(x),max(x)+1):
        s=0
        for j in x:
            s+=(j-i)**2 
        f.append(s)
    print(min(f))
            
n=int(input())
x=[int(x) for x in input().split()]
ans(n,x)

        

Measured memory_bytes: 3060
N = int(input())
A = list(map(int,input().split()))
dic = {}
for i in range(N):
    data = A[i]
    if data in dic:  dic[data] += 1
    else:  dic[data] = 1
temp1, temp2 = 0, 0
for i in sorted(dic.keys())[::-1]:
    if dic[i] >= 2:
        if temp1 == 0:  
            temp1 = i
            if dic[i] >= 4:
                temp2 = i
                break
        else:
            temp2 = i
            break
ans = temp1 * temp2
print(ans)

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

#[allow(dead_code)]
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 calc(
    depth: usize,
    prev: usize,
    rest: usize,
    hs: &Vec<i64>,
    memo: &mut Vec<Vec<Vec<Option<i64>>>>,
) -> i64 {
    let n = hs.len();
    if depth == n {
        return 0;
    }
    if let Some(ret) = memo[depth][prev][rest] {
        return ret;
    }
    let mut ret = 1 << 60;
    if rest != 0 {
        let nret = calc(depth + 1, prev, rest - 1, hs, memo);
        ret = std::cmp::min(ret, nret);
    }
    let d = std::cmp::max(0, hs[depth] - hs[prev]);
    let nret = d + calc(depth + 1, depth, rest, hs, memo);
    ret = std::cmp::min(ret, nret);
    memo[depth][prev][rest] = Some(ret);
    return ret;
}

fn main() {
    let n = read::<usize>();
    let k = read::<usize>();
    let mut hs = vec![0; n + 1];
    for i in 0..n {
        hs[i + 1] = read::<i64>();
    }
    let mut memo = vec![vec![vec![None; k + 1]; n + 1]; n + 1];
    let ans = calc(1, 0, k, &hs, &mut memo);
    println!("{}", ans)
}


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

int main() {
  int N;
  int long long K;
  cin>>N>>K;
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  vector<int> S;
  vector<int> P(N+1,-1);
  int c=1,L=0;
  {
    int V=1;
    while(P[V]==-1){
      P[V]=S.size();
      S.push_back(V);
      V=A[V-1];
    }
    c=S.size()-P[V];
    L=P[V];
  }
  if(K<L)cout<<S[K]<<endl;
  else {
    K-=L;
    K%=c;
    cout<<S[L+K]<<endl;
  }
}

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

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(obj) (obj).begin(), (obj).end()
#define bit(n) (1LL << (n))

using namespace std;

typedef long long ll;

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int d,n; cin>>d>>n;
  
  
  int res = pow(100, d) * n;
  if(n==100) {
    int a = res + pow(100,d);
    cout<<a;
  } else cout<<res;
  
  return 0;
}

Measured memory_bytes: 3840
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;
using MIte = multimap<long, long, greater<long> >::iterator;

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

	//
	int N;
	cin >> N;

	vector<string> vW(N);
	set<string> sW;
	rep(i, N) {
		string s;
		cin >> s;
		vW[i] = s;
		sW.insert(s);
	}

	if (sW.size() != N) {
		cout << "No" << endl;
		return 0;
	}

	for (int i = 0; i != N-1; ++i) {
		string s1 = vW[i];
		string s2 = vW[i + 1];
		if (s1[s1.length() - 1] != s2[0]) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<array>
#include<map>
#include<iomanip>
#include<assert.h>
#include<list>
#include<bitset>
#include<stack>
#include<memory>
#include<numeric>
using namespace std;
using namespace std::chrono;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define REP(i, n) for(int i = 0;i < (n);i++)
/*cout<<fixed<<setprecision(20);cin.tie(0);ios::sync_with_stdio(false);*/
const llint mod=1000000007;
const llint inf=2.19e15+1;
const long double pai=3.141592653589793238462643383279502884197;
const long double eps=1e-10;
template <class T,class U>bool chmin(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool chmax(T& a,U b){if(a<b){a=b;return true;}return false;}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){if(a==0){return b;}return a/gcd(a,b)*b;}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
template<class T>llint LBI(const vector<T>&ar,T in){return lower_bound(ar.begin(),ar.end(),in)-ar.begin();}
template<class T>llint UBI(const vector<T>&ar,T in){return upper_bound(ar.begin(),ar.end(),in)-ar.begin();}

int main(void){
	int n;cin>>n;
	llint A=1;
	for(int i=0;i<n;i++){
		llint B;cin>>B;
		if(B==0){cout<<"0"<<endl;return 0;}
		if(((double)A)*B>1.1e18){A=1.1e18;}
		else{A*=B;}
	}
	if(A>1000000000000000000LL){cout<<-1<<endl;}
	else{cout<<A<<endl;}
	return 0;
}


Measured memory_bytes: 3196
// This code wrote by chtholly_micromaker(MicroMaker)
#include <bits/stdc++.h>
#define reg register
using namespace std;
/*
template <class t> inline void read(t &s)
{
	s=0;
	reg int f=1;
	reg char c=getchar();
	while(!isdigit(c))
	{
		if(c=='-')
			f=-1;
		c=getchar();
	}
	while(isdigit(c))
		s=(s<<3)+(s<<1)+(c^48),c=getchar();
	s*=f;
	return;
}
*/
map<string,int> vis;
signed main(void)
{
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	string s;
	int n;cin>>n;
	for(int i=1;i<=n;++i)
		cin>>s,vis[s]+=1;
	vector<string> ans;
	reg int cnt=0;
	for(reg map<string,int>::iterator iter=vis.begin();iter!=vis.end();++iter)
	{
		if(iter->second>cnt)
		{
			cnt=iter->second;
			ans.clear();
			ans.push_back(iter->first);
		}
		else if(iter->second==cnt)
			ans.push_back(iter->first);
	}
	sort(ans.begin(),ans.end());
	for(int i=0;i<(int)ans.size();++i)
		cout<<ans[i]<<endl;
	return 0;
}



Measured memory_bytes: 25712
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O0")
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
const ll mod = 1e9+7;
const ll INF = 1e18;
#define All(a) (a).begin(),(a).end()
#define Pi acos(-1)

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << setprecision(15) << fixed;
  chrono::system_clock::time_point start,end;
  start = chrono::system_clock::now();

  ll d, t, s;
  cin >> d >> t >> s;
  if (s*t >= d) cout << "Yes\n";
  else cout << "No\n";

  end = chrono::system_clock::now();
  auto elapsed = chrono::duration_cast< chrono::milliseconds >(end - start).count();
  cerr << elapsed << "ms" << '\n';
}

Measured memory_bytes: 3652
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#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
#include <cmath>
#include <numeric>
#include <float.h>
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
typedef unsigned long long ll;

int my_gcd(int n , int m){
  if(n < m){
    int tmp = n;
    n = m;
    m = tmp;
  }
  int l  = n % m;
  while(l != 0){
    n = m;
    m = l;
    l = n % m;
}
return m;
}



int main(){
int K; cin >> K;
string S; cin >> S;
if(S.size() <= K){
  cout << S << endl;
}
else{
  cout << S.substr(0,K) << "..."<< endl;
}
}

Measured memory_bytes: 3632
def main():
    N, M = [int(x) for x in input().split()]
    expected_num_ary = [1] + [0] * (N - 1)

    if N == 1 and M == 0:
        print("0")
        return

    inputted_digit = []
    for _ in range(M):
        d, v = [int(x) for x in input().split()]
        if d > N:
            print("-1")
            return
        if d in inputted_digit and expected_num_ary[d - 1] != v:
            print("-1")
            return
        if d == 1 and v == 0 and N > 1:
            print("-1")
            return
        expected_num_ary[d - 1] = v
        inputted_digit.append(d)

    num_str = ""
    for num in expected_num_ary:
        num_str += str(num)
    print(num_str)



if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
from fractions import gcd
N = int(input())
a = list(map(int, input().split()))
l = [0] * N
r = [0] * N
m = [0] * N

for i in range(N):
  if i == 0:
    l[i] = 0
  else:
    l[i] = gcd(l[i-1], a[i-1])

for j in reversed(range(N)):
  if j == N - 1:
    r[j] = 0
  else:
    r[j] = gcd(r[j+1], a[j+1])
    
for k in range(N):
#  print(r[k], l[k])
  m[k] = gcd(r[k], l[k])
  
print(max(m))

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

namespace Algorithm
{
    class Program
    {
        const int Mod = 998244353;
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var d = Console.ReadLine().Split().Select(int.Parse).ToArray();

            var dict = new Dictionary<int, int>();
            for (var i = 0; i < n; i++)
            {
                if (dict.ContainsKey(d[i]))
                    dict[d[i]]++;
                else
                    dict[d[i]] = 1;
            }

            if (d[0] != 0 || dict[0] > 1)
            {
                Console.WriteLine(0);
                return;
            }

            var total = 1L;
            var before = 1;
            var count = 0;

            foreach (var data in dict.OrderBy(z => z.Key))
            {
                if (data.Key != count)
                {
                    Console.WriteLine(0);
                    return;
                }

                if (data.Key != 0 && data.Key != 1)
                {
                    total *= Multiple(before, data.Value);
                    total %= Mod;
                }

                before = data.Value;
                count++;
            }

            Console.WriteLine(total);
        }

        static long Multiple(long val, int multiple)
        {
            var ans = 1L;
            foreach (var i in Enumerable.Range(1, multiple))
            {
                ans *= val;
                ans %= Mod;
            }

            return ans % Mod;
        }
    }
}


Measured memory_bytes: 32992
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int N=2e5+5;

int n;
LL a[90][40];
LL ans;

int main()
{
	cin>>n;
	while(n--)
	{
		string s;
		cin>>s;
		LL y=0;
		int u=s.size();
		for(int i=0;i<s.size();i++)
			if(s[i]=='.') u=i;
		if(u==s.size()) s+=".";
		for(int i=s.size()-u;i<=9;i++) s+="0";
		for(int i=0;i<s.size();i++)
			if(s[i]!='.') y=y*10+s[i]-'0';
		int z1=0,z2=0;
		while(y%2==0) y/=2,z1++;
		while(y%5==0) y/=5,z2++;
		a[z1+36][z2+11]++;
	}
	for(int i=0;i<90;i++)
	for(int j=0;j<40;j++)
	for(int k=90-i;k<90;k++)
	for(int l=40-j;l<40;l++)
		ans+=a[i][j]*a[k][l];
	for(int i=45;i<90;i++)
	for(int j=20;j<40;j++)
		ans-=a[i][j];
	cout<<ans/2<<'\n';
	
	return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
main()
{
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++)
	cin>>a[i];
	int dp[n];
	dp[0]=0;
	dp[1]=abs(a[1]-a[0]);
	for(int i=2;i<=n;i++)
	{
		dp[i]=min(dp[i-1]+abs(a[i-1]-a[i]),dp[i-2]+abs(a[i-2]-a[i]));
	}
	cout<<dp[n-1];
}


Measured memory_bytes: 1024
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int longs[] = new int[n];
		int cnt=0;
		int flag=0;
		
		for(int i=0 ; i<n ; i++) {
			longs[i] = sc.nextInt();
		}
		//For debug
		//for(int i : longs) {
		//	System.out.print(i+" ");
		//}
		sort_small(longs);
		//System.out.println();
		//for(int i : longs) {
		//	System.out.print(i+" ");
		//}
		//System.out.println();
		for(int i=0 ; i<longs.length ; i++) {
			if(flag < longs[i]) {
				cnt++;
				flag = longs[i];
			}
		}
		System.out.println(cnt);
	}
	
	static void sort_big(int[] data) {// �~���ɕ��ёւ���֐�
		int work;
		for(int i=0 ; i<data.length-1 ; i++) {
			for(int k=i+1 ; k<data.length ; k++) {
				if(data[i] < data[k]) {
					work = data[i];
					data[i] = data[k];
					data[k] = work;
				}
			}
		}
	}
	static void sort_small(int[] data) {// �����ɕ��ёւ���֐�
		int work;
		for(int i=0 ; i<data.length-1 ; i++) {
			for(int k=i+1 ; k<data.length ; k++) {
				if(data[i] > data[k]) {
					work = data[i];
					data[i] = data[k];
					data[k] = work;
				}
			}
		}
	}
}


Measured memory_bytes: 21460