akhauriyash/Code-Regression huggingface dataset:
fn read1<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn readn<T: std::str::FromStr>(delimiter: &str) -> Vec<T> {
    let s = read1::<String>();
    s.split(delimiter)
        .map(|e| e.parse().ok().unwrap())
        .collect::<Vec<T>>()
}

fn main() {
    let s = read1::<String>().to_string();

    match s.as_str() {
        "Sunny" => println!("Cloudy"),
        "Cloudy" => println!("Rainy"),
        "Rainy" => println!("Sunny"),
        _ => println!("not matched"),
    }
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define IO ios::sync_with_stdio(false), cin.tie(0)
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
double a[105];
int main()
{
	ll a,b;
	cin>>a>>b;
	ll ans=min(min(abs(a-b),abs((a%b)-b)),min(a,a%b));
	cout<<ans<<endl;
 	return 0;
}







Measured memory_bytes: 256
#include <vector>
#include <stdio.h>
#include <iostream>
using namespace std;
const int MAXN = 1e5 + 5;
vector<bool> is_prime(MAXN, true);
vector<int> primes;

void sieve() {
  is_prime[0] = false;
  is_prime[1] = false;
  for (int i = 2; i * i <= MAXN; ++i) {
    if (is_prime[i]) {
      for (int j = i * i; j <= MAXN; j += i) is_prime[j] = false;
    }
  }
  for (int i = 0; i <= MAXN; ++i) {
    if (is_prime[i]) primes.push_back(i);
  }
}

int main() {
  int q;
  scanf("%d", &q);
  sieve();

  vector<int> likes;
  for (int prime: primes) {
    if (prime % 2 == 1 && is_prime[(prime + 1) / 2]) {
      likes.push_back(prime);
    }
  }
  int ans[q];
  for (int ii = 0; ii < q; ++ii) {
    int l, r;
    scanf("%d %d", &l, &r);
    int l_idx = lower_bound(likes.begin(), likes.end(), l) - likes.begin();
    int r_idx = lower_bound(likes.begin(), likes.end(), r) - likes.begin();
    int a = likes[r_idx] == r? r_idx - l_idx + 1: r_idx - l_idx;
    ans[ii] = a;
  }

  for (int i = 0; i < q; ++i) printf("%d\n", ans[i]);
  return 0;
}


Measured memory_bytes: 1152
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <cmath>
#include <map>
#include <set>
#include <ctype.h>
#include <numeric>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1e9 + 7;
const int INF = 1e9;

int dx4[4] = { 0, -1, 1, 0 };
int dy4[4] = { -1, 0, 0, 1 };
int dx8[8] = { 0, -1, 1, 0, -1, 1, -1, 1 };
int dy8[8] = { -1, 0, 0, 1, -1, -1, 1, 1 };

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

  int res = n * n - a;
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
main :: IO ()
main = do
    -- {{{ 入力

    -- r <- readLn -- 入力が一行に一文字の場合
    as <- map read . words <$> getLine -- 一行に入力が複数ある場合
    bs <- map read . words <$> getLine -- 一行に入力が複数ある場合

    -- }}}

    -- {{{ Solver

    -- putStrLn $ show $ solve a b -- solveの返り値がString型の場合
    -- putStrLn $ solve a b

    -- }}}

    putStrLn $ show $ solve as bs -- showの返り値がString型の場合

solve :: [Int] -> [Int] -> Int
solve [h, w] [a, b] = h * w - ( h * b + w * a - a * b )


{-- その他 備忘録
    {{{ 型変換
       int 2 float: fromIntegral
       float 2 int: round 四捨五入
                    floor 床関数
                    ceiling 天井関数
       int 2 string: show
    }}}

    {{{ モジュール
        Data.List: sort
    }}}
--}


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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define all(a) (a).begin(),(a).end()
#define SORT(a) sort(all(a))
using ll = long long;
constexpr ll INF = 10000000000;
constexpr ll MOD = 1000000007;

using namespace std;

int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	
	int n; cin >> n;
	
	vector<vector<pair<int,int>>>g(n);

	for (int i = 0; i < n - 1; i++) {
		int u, v, w;
		cin >> u >> v >> w;
		u--, v--;

		g[u].push_back({ v,w });
		g[v].push_back({ u,w });
	}

	queue<int>q;
	vector<bool>a(n, false);

	vector<int>ans(n, -1);
	ans[0] = 0;
	q.push(0);
	a[0] = true;

	while (!q.empty()) {
		int m = q.front();
		q.pop();
		
		for (pair<int, int> i : g[m]) {
			int to, len;
			tie(to, len) = i;
			if (a[to])continue;
			a[to] = true;

			if (len % 2 == 0) {
				ans[to] = ans[m];
			}
			else {
				//if (ans[m] == 0)ans[to] = 1;
				//else if (ans[m] == 1)ans[to] = 0;
				ans[to] = ans[m] ^ 1;
			}
			q.push(to);
		}
	}

	rep(i, n)cout << ans[i] << (i == n - 1 ? "\n" : " ");
	
}


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

int main() {
  int a;
  cin >> a;
  int s1 = a / 100;
  int s2 = ( a - s1 * 100 ) / 10;
  int s3 = ( a - s1	* 100 - s2 *10);
  cout << s1 + s2 + s3 << endl;
}


Measured memory_bytes: 256
package main

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

func main() {
	scn := bufio.NewScanner(os.Stdin)
	scn.Split(bufio.ScanWords)
	nextInt := func() int { scn.Scan(); r, _ := strconv.Atoi(scn.Text()); return r }

	w := bufio.NewWriter(os.Stdout)

	n := nextInt()

	parents := make([]int, n)
	for i := range parents {
		parents[i] = -1
	}
	children := make([][2]int, n)
	siblings := make([]int, n)
	for i := range siblings {
		siblings[i] = -1
	}

	for i := 0; i < n; i++ {
		id, left, right := nextInt(), nextInt(), nextInt()
		children[id] = [2]int{left, right}
		if left != -1 {
			parents[left] = id
			siblings[left] = right
		}
		if right != -1 {
			parents[right] = id
			siblings[right] = left
		}
	}

	root := -1
	for id, parent := range parents {
		if parent == -1 {
			root = id
		}
	}

	depths := make([]int, n)
	heights := make([]int, n)
	markDepthAndHeight(depths, heights, 1, children, root)

	for id := 0; id < n; id++ {
		typ := "internal node"
		if countChild(children[id]) == 0 {
			typ = "leaf"
		}
		if depths[id] == 0 {
			typ = "root"
		}
		fmt.Fprintf(w, "node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, %s\n", id, parents[id], siblings[id], countChild(children[id]), depths[id], heights[id], typ)
	}
	w.Flush()
}

func markDepthAndHeight(depths, heights []int, depth int, children [][2]int, root int) int {
	maxHeight := 0
	for _, c := range children[root] {
		if c == -1 {
			continue
		}
		depths[c] = depth
		height := markDepthAndHeight(depths, heights, depth+1, children, c)
		if height > maxHeight {
			maxHeight = height
		}
	}
	heights[root] = maxHeight
	return maxHeight + 1
}

func countChild(children [2]int) (count int) {
	for _, c := range children {
		if c != -1 {
			count++
		}
	}
	return
}



Measured memory_bytes: 1132
#include<stdio.h>
int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a!=b && a!=c){
        printf("%d\n",a);
    }
    else if(b!=a && b!=c){
        printf("%d\n",b);
    }
    else{
        printf("%d\n",c);
    }
    return 0;
}


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

int main()
{
  string s;
  cin >> s;
  REP(i,s.size()){
    cout << 'x' ;
  }
  cout  << "\n";
  return 0;
}


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

#define int long long
#define rep(i, a, n) for (int i = a; i < n; i++)
#define pb push_back
#define eb emplace_back
#define dump(x) cout << #x << " = " << (x) << endl
#define chk() cout << "now" << endl;
#define ALL(x) (x).begin(), (x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTG(c) sort(ALL(c), greater<int>());
#define fi first
#define se second
int INF = 1e9 + 7;

typedef pair<int, int> P;
typedef vector<int> vi;

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

int n, d;

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

  cin >> n >> d;

  int a = d * 2 + 1;
  int b = n / a;
  if (n % a != 0) {
    cout << b + 1 << endl;
  } else {
    cout << b << endl;
  }
  return 0;
}


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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Int64.Parse(Console.ReadLine());

            var A = Console.ReadLine()
               .Split(' ')
               .Select(x => Int64.Parse(x))
               .ToArray();

            var minusCount = 0;
            for(var i = 0; i < n; i++)
            {
                if (A[i] < 0)
                {
                    minusCount++;
                    A[i] = Math.Abs(A[i]);
                }
            }
            if(minusCount % 2 == 0)
            {
                Console.WriteLine(A.Sum());
            }
            else
            {
                Console.WriteLine(A.Sum()-2*A.Min());
            }
        }
    }
}

Measured memory_bytes: 29276
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii  = pair<int,int>;
#define rep(i,n) for(int i=0; i<(n); i++)
#define rep2(i,x,n) for(int i=x; i<(n); i++)
#define MOD 1000000007
#define EPS 10e-8
int gcd(int a,int b){return b?gcd(b,a%b):a;}    //最大公約数
int lcm(int a, int b) {return a * b / gcd(a, b);}   //最小公倍数

int main(){
    int n,y;
    cin >> n>>y;
    rep(i,n+1){
        rep(j,n+1){
            rep(k,n+1){
                if(i+k+j==n&&i*10000+j*5000+k*1000==y){
                    cout << i << endl;
                    cout << j << endl;
                    cout << k << endl;
                    return 0;
                }
                if(i+k+j>n){
                    break;
                }
            }
            if(i+j>n){
                break;
            }
        }
        if(i>n){
            break;
        }
    }
    cout << "-1 -1 -1" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<random>
#include<numeric>
#include<string>
#include<stack>
#include<cstring>
typedef long long ll;
typedef long double ld;
using namespace std;
ll dx[] = { 0,0,1,-1 };
ll dy[] = { 1,-1,0,0 };

ll gcd(ll a, ll b) {
	if (a<b) { return gcd(b, a); }
	else if (a%b) { return gcd(b, a%b); }
	else { return b; }
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b)*b;
}
int main() {
	ll N;
	cin >> N;
  	string ans = "";
	if (N == 0)ans += "0";
	while (N != 0) {
		if (N % 2 == 0) {
          ans+="0";
          N=-N/2;
		}
		else {
          	ans+="1";
			N--;
          	N=-N/2;
		}
    }
  	reverse(ans.begin(),ans.end());
		cout << ans << endl;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define fr(i,a,b) for(ll i=a; i<b; i++)
#define fr1(i,a,b) for(ll i=a; i>=b; i--)
#define ll long long int
#define ld long double
#define vi vector<ll>
#define vii vector <pair<ll,ll> >
#define pb push_back
#define md 1000000007
int main()
{
	fast;
	int d,m,sum=0;
	cin >>d>>m;
  	int a[m];
  	for(int i=0;i<m;i++)
    {
      cin>>a[i];
      sum+=a[i];
    }
  	if(sum>d)
      cout<<"-1";
  	else
      cout<<d-sum;
	return 0;
}

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

const int N = 100;

int n, a[N], b[N], c[N];

int main(){
    while(~scanf("%d", &n)){
        for(int i=1; i<=n; i++) scanf("%d", a+i);
        for(int i=1; i<=n; i++) scanf("%d", b+i);
        for(int i=1; i<n; i++) scanf("%d", c+i);
        int ans = 0;
        for(int i=1; i<=n; i++){
            ans += b[a[i]];
            if(i>1 && a[i] == a[i-1]+1){
                ans += c[a[i-1]];
            }
        }
        printf("%d\n", ans);
    }
    return 0;
}


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

int main(){
  int n;
  cin>>n;
  set<string> st;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    for(int i=0;i<s.size();i++){
      string x;
      x+=s[i];
      st.insert(x);
    }

    if(s.size()>1){
        for(int i=0;i<s.size()-1;i++){
        string x;
        x+=s[i];
        x+=s[i+1];
        st.insert(x);
      }
    }

    if(s.size()>2){
      for(int i=0;i<s.size()-2;i++){
        string x;
        x+=s[i];
        x+=s[i+1];
        x+=s[i+2];
        st.insert(x);
      }
    }

    if(s.size()>3){
      for(int i=0;i<s.size()-3;i++){
        string x;
        x+=s[i];
        x+=s[i+1];
        x+=s[i+2];
        x+=s[i+3];
        st.insert(x);
      }
    }
  }


  string al="abcdefghijklmnopqrstuvwxyz";

  for(int i=0;i<al.size();i++){
    string x;
    x+=al[i];
    if(!st.count(x)){
      cout<<x<<endl;
      return 0;
    }
  }

  for(int i=0;i<26;i++){
    for(int j=0;j<26;j++){
      string x;
      x+=al[i];
      x+=al[j];
      if(!st.count(x)){
        cout<<x<<endl;
        return 0;
      }
    }
  }

  for(int i=0;i<26;i++){
    for(int j=0;j<26;j++){
      for(int k=0;k<26;k++){
        string x;
        x+=al[i];
        x+=al[j];
        x+=al[k];
        if(!st.count(x)){
          cout<<x<<endl;
          return 0;
        }
      }
    }
  }

  for(int i=0;i<26;i++){
    for(int j=0;j<26;j++){
      for(int k=0;k<26;k++){
        for(int l=0;l<26;l++){
          string x;
          x+=al[i];
          x+=al[j];
          x+=al[k];
          x+=al[l];
          if(!st.count(x)){
            cout<<x<<endl;
            return 0;
          }
        }
      }
    }
  }
  return 0;
}



Measured memory_bytes: 42376
N = int(input())
A = [int(input()) for _ in range(N)]
A.append(0)

con = False
ans = 0

for i in range(N):
    if A[i] >=2:
        ans += A[i]//2
        A[i] -= (A[i]//2)*2
    
    mm = min(A[i+1],A[i])
    ans += mm
    A[i+1] -= mm
    A[i] -= mm
    #print(A)


print(ans)

Measured memory_bytes: 7072
def resolve():
	A, B, C = map(int, input().split())
	K = int(input())

	cnt = 0
	while A >= B:
		B = B*2
		cnt += 1
	while B >= C:
		C  = C*2
		cnt += 1
	if cnt <= K:
		print("Yes")
	else:
		print("No")
		
resolve()

Measured memory_bytes: 9176
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>

#define int long

const int INF = 1000000009;
const long LINF = 1123456789012345678;

int a, b;
signed main(){
	scanf("%ld %ld", &a, &b);
	if(a <= 0 && 0 <= b){
		printf("Zero\n");
	}else if(a > 0){
		printf("Positive\n");
	}else{
		if((b-a+1) % 2 == 0){
			printf("Positive\n");
		}else{
			printf("Negative\n");
		}
	}
	return 0;
}


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

using namespace std;

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

typedef long long ll;

int main(){
	ll a,b,c;
	cin>>a>>b>>c;
	ll t=0;
	while(1){
		if(c<(a+b)*t){
			c+=60;
		}
		else if(c<=(a+b)*t+a){
			cout<<c<<endl;
			return 0;
		}
		else{
			t++;
		}
		if(t>1000) break;
	}
	cout<<-1<<endl;
}

Measured memory_bytes: 3108
import sys
input = sys.stdin.readline
N = int(input())
i = 2
ps = []
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
ps = make_divisors(N)
ps2 = make_divisors(N - 1)
res = 0
for x in (ps + ps2):
  if x == 1: continue
  y = N + 0
  while y % x == 0: y //= x
  if y % x == 1: res += 1
print(res)

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

int main(){
  int n;
  cin >> n;
  vector<int>a(n);
  for(int i=0;i<n;i++)
    cin >> a.at(i);
  map<int,int>even;
  map<int,int>odd;
  for(int i=0;i<n;i+=2)
    even[a.at(i)]++;
  for(int i=1;i<n;i+=2)
    odd[a.at(i)]++;
  vector<pair<int,int>>eve(even.size()+1);
  vector<pair<int,int>>od(odd.size()+1);
  eve.at(0)=make_pair(0,0);
  od.at(0)=make_pair(0,0);
  int c=1;
  for(auto x:even){
    eve.at(c)=make_pair(x.second,x.first);
    c++;
  }
  c=1;
  for(auto x:odd){
    od.at(c)=make_pair(x.second,x.first);
    c++;
  }
  sort(od.begin(),od.end(),greater());
  sort(eve.begin(),eve.end(),greater());
  int ans=0;
  if(od.at(0).second==eve.at(0).second){
    if(od.at(0).first=eve.at(0).first){
      if(od.at(1).first>eve.at(1).first)
        ans=n-eve.at(0).first-od.at(1).first;
      else
        ans=n-od.at(0).first-eve.at(1).first;
    }else if(od.at(0).first>eve.at(0).first){
      ans=n-od.at(0).first-eve.at(1).first;
    }else{
      ans=n-eve.at(0).first-od.at(1).first;
    }
  }else{
    ans=n-eve.at(0).first-od.at(0).first;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 9004
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;

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

ll GCD(ll x, ll y) {
    if (y == 0) return x;
    else return GCD(y, x % y);
}
int main()
{
    int x, a, b;
    cin >> x >> a >> b;

    if (abs(x - a) < abs(x - b)) { cout << "A" << endl; }
    else { cout << "B" << endl; }

}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>

using namespace std;

int main(){

  string s, t;
  cin >> s;
  t = s[0];
  for (int i = 1;i < 3; i++){
    cin >> s;
    t = t + s[i];
  }
  cout << t << endl;


  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define llint long long

using namespace std;

llint p, q, s, t, y, m;

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> s >> t;
	cin >> p >> q >> m >> y;
	
	cout << (s^t^y) << endl;
	
	return 0;
}


Measured memory_bytes: 3212
#include<bits/stdc++.h>
using namespace std;
char s[100];
int a,b,c,d;
int M(int x,int y,int op){
	if(op==1)return x+y;
	else return x-y;
}
void print(int op1,int op2,int op3){
	char c1=(op1==1?'+':'-'),c2=(op2==1?'+':'-'),c3=(op3==1?'+':'-');
	printf("%d%c%d%c%d%c%d=7\n",a,c1,b,c2,c,c3,d);
}
int main(){
	scanf("%s",s+1);
	a=s[1]-'0',b=s[2]-'0',c=s[3]-'0',d=s[4]-'0';
	int sum;
	for(int i=1;i<=2;i++){
		sum=0;
		sum=M(a,b,i);
		for(int j=1;j<=2;j++){
			sum=M(sum,c,j);
			for(int k=1;k<=2;k++){
				sum=M(sum,d,k);
				if(sum==7){
					print(i,j,k);
					return 0;
				}
				sum=M(sum,d,k%2+1);
			}
			sum=M(sum,c,j%2+1);
		}
		sum=M(sum,b,i%2+1);
	}
	return 0;
}

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

int ans=0;
int n,m;
int k[11]={}, s[11][11]={{}},p[11]={};
int on[11]={};
void solve(int on[],int x){
    if(x<n){
        int on2[11];
        for(int i=0;i<n;i++) on2[i]=on[i];
        solve(on2,x+1);
        on2[x]++;
        solve(on2,x+1);
    }
    else{
        bool end=true;
        int a;
        for(int i=0;i<m;i++){
            a=0;
            for(int j=0;j<k[i];j++) a+= on[s[i][j]-1];
            if(a%2!=p[i]) end=false;
        }
        if(end) ans++;
    }
}

int main(){
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>k[i];
        for(int j=0;j<k[i];j++) cin>>s[i][j];
    }
    for(int i=0;i<m;i++) cin>>p[i];

    solve(on,0);
    cout<<ans<<endl;

    return 0;

}

Measured memory_bytes: 256
r, c = gets.split(" ").map(&:to_i)
a = Array.new(r+1).map{Array.new(c+1, 0)}

r.times { |i|
    a[i] = gets.split.map(&:to_i)
    a[i][c] = a[i].inject{ |sum, j| sum + j}
}

for k in 0..c
    for h in 0..r-1
        a[r][k] += a[h][k]
    end
end

(0..r).each { |l|
    puts a[l].join(" ")
}

Measured memory_bytes: 9020
from collections import Counter

N = int(input())

c = Counter(list(map(int, input().split())))
D = sorted(list(c.keys()))

x = 0
s = 0
a = 0
b = N
for k in D:
    a += c[k]
    b = N - a
    if a == b:
        x = k
    elif a > b and x > 0:
        s = k - x
        break

print(s)

Measured memory_bytes: 56300
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <cstring>
#include <map>
#include <unordered_map>
#include <tuple>
 
using namespace std;
 
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define umap unordered_map
#define uset unordered_set
#define cina(s, n, a) for(int i = s; i < n; i++) cin >> a[i]
#define couta(s, n, a) for(int i = s; i < n; i++) cout << a[i] << ' '
#define copy(s, n, a, b) for(int i = s; i < n; i++) b[i] = a[i]
#define yesno(ok) cout << (ok ? "YES\n" : "NO\n")
#define mod(a, b) (b + (a % b)) % b
#define MOD (int)1e9 + 7
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

void add_self (int& a, int b){ a += b; if (a >= MOD) a -= MOD; }
//-------------------------------------------------------------------------------------------------------//

void solve(){
    deque <int> a;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        int x;
        cin >> x;
        if(i % 2 == 0) a.push_back(x);
        else a.push_front(x);
    }
    if(n % 2 == 0){
        for(int i = 0; i < n; i++) cout << a[i] << ' ';
    }
    else{
        for(int i = n - 1; i >= 0; i--) cout << a[i] << ' ';
    }
}

int main(){
    ios::sync_with_stdio(false);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int q = 1;
    //cin >> q;
    for(int i = 1; i <= q; i++){
        solve();
    }
}


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


int main(){
    long H,W,N;
    cin >> H >> W >> N;

    long ans[10];
    for(int i=0; i<10; i++) ans[i] = 0;
    ans[0] = (H-2)*(W-2);
    map<pair<int,int>,int> m;

    for(int t=0; t<N; t++){
        long a, b;
        cin >> a >> b;
        for(int i = -1; i < 2; i++){
            for(int j=-1; j<2; j++){
                if (a+i < 2 || b+j < 2 || a+i > H-1 || b+j > W-1) continue;
                pair<int,int> s = make_pair(a+i,b+j);
                m[s] = m[s] + 1;
                ans[m[s]] += 1;
                ans[m[s]-1] -= 1;
            }
        }
    }


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

Measured memory_bytes: 42496
def binary_search_int(ok, ng, test):
    """
    :param ok: solve(x) = True を必ず満たす点
    :param ng: solve(x) = False を必ず満たす点
    """
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if test(mid):
            ok = mid
        else:
            ng = mid
    return ok

##############################################################

import sys
input = sys.stdin.readline

def test(x):
    cnt = 0
    for h in H:
        if h-x*B>0:
            cnt += ceil((h-x*B)/(A-B))
    return cnt <= x

from math import ceil
N, A, B = map(int, input().split())
H = []
for _ in range(N):
    H.append(int(input()))

res = binary_search_int(10**9,-1,test)
print(res)

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

void swap(int& x, int& y){
	int tmp = x;
	x=y;
	y=tmp;
}

int main(){
	int a, b, c;
	cin >> a >> b >> c;
	if(a>b) swap(a,b);
	if(b>c) swap(b,c);
	if(a>b) swap(a,b);
	
	cout << a << " " << b << " "  << c << endl;
}

Measured memory_bytes: 1164
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
typedef long long ll;
int gi() {
    int x=0,o=1;char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
    if(ch=='-') o=-1,ch=getchar();
    while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
    return x*o;
}
int n,a[N],pos[N],st[N],top=0;
int main() {
    cin>>n;
    for(int i=1;i<=n;i++) a[i]=gi(),st[++top]=a[i];
    sort(st+1,st+top+1);
    for(int i=1;i<=n;i++) a[i]=lower_bound(st+1,st+top+1,a[i])-st,pos[a[i]]=i;
    sort(a+1,a+n+1);int ans=0;
    for(int i=1;i<=n;i++) if((i&1)^(pos[a[i]]&1)) ans++;
    printf("%d\n",ans/2);
    return 0;
}
//orzgzy
//鸡贼明年进队超稳


Measured memory_bytes: 1408
#include <iostream>
#include <vector>
#include <deque>
#include <cmath>
#include <bits/stdc++.h>
#include <limits>
using namespace std;

vector<long long> divisor(long long n) {
  vector<long long> ret;
  for(long long i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(ret.begin(), ret.end());
  return (ret);
}

int main(void){
    // Your code here!
    long long n;
    long long min_value = LLONG_MAX;
    
    cin >> n;
    
    vector<long long> ret = divisor(n);
    
    for(auto r:ret)
        min_value = min(min_value, max((long long)log10(r), (long long)log10(n / r)));
        
    cout << min_value + 1 << endl;
    
    return 0;
}

Measured memory_bytes: 640
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().solve();
	}

	private void solve() throws IOException {
		try {
			solveA();
			//			 solveB();
			//			 solveC();
			//			 solveD();
			//			 solveE();
			//			 solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		long numX = nextLong();
		long numT = nextLong();

		out.println(numX - numT > 0 ? numX - numT : 0);
	}

	private void solveB() {
		int numN = nextInt();

		out.println("");
	}

	private void solveC() {
		int numN = nextInt();

		out.println("");
	}

	private void solveD() {
		int numN = nextInt();

		out.println("");
	}

	private void solveE() {
		int numN = nextInt();

		out.println("");
	}

	private void solveF() {
		int numN = nextInt();

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

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

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

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

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

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

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

Measured memory_bytes: 21332
#include <stdio.h>

int main(){
  long i,k,m,c,cf=0,cc=1,cg=0,ch=0;
  char n[105];
  scanf("%s",&n);
  scanf("%ld",&k);
  for(c=0;n[c]!=0;c++){
    n[c]-='0';
    if(c>0){
      if(cf==0){
        cf=n[c];
      }else{
        cc++;
        cf+=9;
        ch+=n[c];
        if(cg==0){
          cg=n[c];
        }else{
          cg+=9;
        }
      }
    }
  }
  if(k==1){
    m=(c-1)*9;
    m+=n[0];
  }else if(k==2){
    m=(c-1)*(c-2)/2*81;
    m+=cf+(n[0]-1)*(c-1)*9;
  }else if(k==3){
    m=(c-1)*(c-2)*(c-3)/2*243;
  //printf("%ld\n",m);
    m+=(n[0]-1)*(c-1)*(c-2)/2*81;
  //printf("%ld\n",m);
    m+=(cc-1)*(cc-2)/2*81;
  //printf("%ld\n",m);
    m+=cg*(ch>1);
  //printf("%ld\n",m);
    m+=(n[c-cc]-1)*(cc-1)*9;
  }
  printf("%ld",m);
  return 0;
}


Measured memory_bytes: 128
use std::io::stdin;

mod utils {

    use std::io::BufRead;
    use std::str::{self, FromStr};

    pub struct StdinReader<R: BufRead> {
        reader: R,
        buf: Vec<u8>,
    }

    impl<R: BufRead> StdinReader<R> {
        pub fn new(reader: R) -> StdinReader<R> {
            StdinReader {
                reader: reader,
                buf: Vec::new(),
            }
        }

        #[allow(unused)]
        #[inline]
        // 区切り文字：スペース
        pub fn reads<T: FromStr>(&mut self) -> T {
            self.read_until(b' ')
        }

        #[allow(unused)]
        #[inline]
        // 区切り文字：改行
        pub fn readl<T: FromStr>(&mut self) -> T {
            self.read_until(b'\n')
        }

        #[inline]
        pub fn read_until<T: FromStr>(&mut self, delim: u8) -> T {
            // self.bufに次のトークンをセットする
            loop {
                self.buf.clear();
                let len = self.reader
                    .read_until(delim, &mut self.buf)
                    .expect("failed reading bytes");
                match len {
                    0 => panic!("early eof"),
                    1 if self.buf[0] == delim => (), // 区切り文字だけなのでもう一度ループ
                    _ => {
                        // トークンが得られた
                        // 最後の文字が区切り文字なら削除
                        if self.buf[len - 1] == delim {
                            self.buf.truncate(len - 1);
                        }
                        break; // ループから脱出
                    }
                }
            }

            // 文字列をT型へパースする
            let elem = unsafe { str::from_utf8_unchecked(&self.buf) };
            elem.parse().unwrap_or_else(|_| panic!(format!("failed parsing: {}", elem)))
        }
    }

}

fn main(){
    let stdin = stdin();
    let mut r = utils::StdinReader::new(stdin.lock());
    let n:usize = r.readl();
    let s:String = r.readl();
    let mut ans = 0;
    let mut previous_color:char = 'D';
    for el in s.chars() {
        if previous_color != el{
            ans += 1;
            previous_color = el;
        }
    }
    println!("{}",ans);
}

Measured memory_bytes: 4352
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


int main(){
    
    ll N; cin >> N;
    vl A(N); REP(i, N) cin >> A[i];
    vl sum(N+1, 0); REP(i, N) sum[i+1] = sum[i] + A[i];
    
    ll ans = LINF;
    FOR(i, 2, N-1){
        ll lsum = sum[i], rsum = sum[N]-sum[i];
        
        auto lit = upper_bound(sum.begin(), sum.begin()+i, lsum/2);
        auto lpit = lit; lpit--;
        ll l1 = abs(*lit - (lsum-*lit)), l2 = abs(*lpit - (lsum - *lpit));
        vl lv;
        if(l1 < l2) lv = {*lit, lsum-*lit};
        else lv = {*lpit, lsum-*lpit};
        
        auto rit = upper_bound(sum.begin()+i, sum.end(), rsum/2+sum[i]);
        auto rpit = rit; rpit--;
        ll r1 = abs(*rit-sum[i] - (sum[N]-*rit)), r2 = abs(*rpit-sum[i] - (sum[N] - *rpit));
        vl rv;
        if(r1 < r2) rv = {*rit-sum[i], sum[N]-*rit};
        else rv = {*rpit-sum[i], sum[N]-*rpit};
        
        ll mn = min({lv[0], lv[1], rv[0], rv[1]});
        ll mx = max({lv[0], lv[1], rv[0], rv[1]});
        ans = min(ans, mx-mn);
    }
    cout << ans << endstr;
    return 0;
}


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

using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define MIN(a,b) ((a)>(b)? (b): (a))
#define MAX(a,b) ((a)<(b)? (b): (a))

const long long INF = 1LL << 60;

typedef unsigned long long ll;

const long long MOD = 1000000000 + 7;

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

int main(){
    int k,a,b;
    cin >> k;
    cin >> a >> b;
    int cnt = 0;
    while(true){
        cnt += k;
        if(cnt >= a && cnt <= b){
            cout << "OK" << endl;
            return 0;
        }
        if(cnt > b) break;
    }
    cout << "NG" << endl;
    return 0;
}


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

int main()
{
	set<int> s;
	int n,t;
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&t);
		s.insert(t); 
	}
	printf("%d\n",s.size());
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys
def input():
    return sys.stdin.readline()[:-1]

#引数nが素数かどうかを判定
def is_prime(n):
    for i in range(2, n + 1):
        if i * i > n:
            break
        if n % i == 0:
            return False
    return n != 1

def main():
    X = int(input())
    for i in range(X, 10**8):
        if is_prime(i):
            print(i)
            exit()

if __name__ == '__main__':
    main()


Measured memory_bytes: 62836
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
const int inf = 1000000000; // 10^9

int main(){
   int a,b;scanf("%d%d",&a,&b);
   int n;
   for(int i = b-a;i > 0;i--)n+=i;
   printf("%d",n-b);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int first=1,k,last=9;
ll a[100005];
int main()
{
	for(int i=1;i<=9;i++) a[i]=i;
    cin>>k;
	if(k<=9){cout<<a[k];return 0;}
	while(1)
	{
		ll t=a[first];
		for(int i=-1;i<=1;i++)
		{
			if(t%10==0&&i==-1)continue;
			if(t%10==9&&i==1)continue;
			ll nt=t*10+t%10+i;
			a[++last]=nt;
			if(last>=k)
			{
				cout<<a[k];return 0;
			}
		}
		first++;
	}
    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#include <chrono> 
using namespace std::chrono;
using namespace std;
typedef long long ll;
using namespace __gnu_pbds;   
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define ordered_mset tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> 
#define fr(i,a,b) for (ll i=(a); i<(b);++i)
#define frr(i,a,b) for(ll i=(a-1);i>=(b);--i)
#define vi vector<ll>
#define vl vector<ll>
#define pb push_back
#define ppb pop_back()
#define pf push_front
#define ppf pop_front()
#define F first
#define S second
#define pii pair<ll,ll> 
#define rev(a) reverse(a.begin(),a.end())
#define srt(a,k) sort(a,a+k,greater<ll>())
#define rsrt(a) sort(a.begin(),a.end(),greater<ll>())
#define sz(a) (ll)a.size()
//#define endl "\n"
#define po(a,b) (ll)(pow(a,b)+0.5)
#define double long double
#define print(a) for(auto x:a)cout<<x<<" ";cout<<endl;
#define setbits(a) __builtin_popcount(a)
const ll M=1e9+7;
const ll MX=1e6+1;

int n,k;
ll p[5001],c[5001];
bool vis[5001];vl fin1;
void dfs(int i)
{
    if(vis[i])return;
    vis[i]=true;
    fin1.pb(c[i]);
    dfs(p[i]);
}
int main()
{  
     
  int tt=1;
  //cin>>tt;
  while(tt--)
  {
    cin>>n>>k;
    
    fr(i,1,n+1)cin>>p[i];
    fr(i,1,n+1)cin>>c[i];
    fr(i,1,n+1)vis[i]=false;

    ll ans=-1e18;
    fr(i,1,n+1)
    {
        if(!vis[i])
        {
           fin1.clear();
           dfs(i);
          fr(i1,0,sz(fin1))
          {
           vi fin;
           fr(k1,i1,sz(fin1))fin.pb(fin1[k1]);
           fr(k1,0,i1)fin.pb(fin1[k1]);
           fr(j,1,sz(fin))
           {
              fin[j]+=fin[j-1];
           }         
              ll cur_ans;
            if(sz(fin)>=k)
            {
               cur_ans=fin[0];
               fr(i,1,k)cur_ans=max(cur_ans,fin[i]);
            }
            else
            {
               if(fin.back()>0)
               {
                  cur_ans=(k/sz(fin))*fin.back();
                  ll cnt=0;
                  fr(i,0,k%sz(fin))cnt=max(cnt,fin[i]);
                  cur_ans+=cnt;

                  ll another=((k/sz(fin))-1)*fin.back();
                   cnt=0;
                  fr(i,0,sz(fin))cnt=max(cnt,fin[i]);
                  another+=cnt;
                  cur_ans=max(cur_ans,another);
               }
               else
               {   cur_ans=fin[0];
                   fr(i,1,sz(fin))cur_ans=max(cur_ans,fin[i]);
               }
            }
           ans=max(ans,cur_ans);
        }
      }
    } 
    cout<<ans; 

  }
}



Measured memory_bytes: 3832
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

int64_t Diff(int64_t a, int64_t b) {
  // cerr << "\033[93m" << a << " " << b << "\033[m" << endl;
  return (a - b) * (a - b);
}

int64_t Solve(int64_t n, int64_t m) {
  std::vector<int> code(m);
  std::vector<int> input(n);
  for (int i = 0; i < m; i++) {
    cin >> code[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> input[i];
  }

  int64_t dp[20000][256];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 256; j++) {
      dp[i][j] = INT64_MAX;
    }
  }
  // init
  for (auto c : code) {
    int output = 128 + c;
    if (output < 0) {
      output = 0;
    } else if (255 < output) {
      output = 255;
    }

    dp[0][output] = Diff(input[0], output);
    // cerr << "\033[93m" << c << " " << dp[0][output] << "\033[m" << endl;
  }

  for (int t = 1; t < n; t++) {
    for (int prev_l = 0; prev_l < 256; prev_l++) {
      if (dp[t - 1][prev_l] == INT64_MAX) continue;
      for (auto c : code) {
        int curr_l = prev_l + c;
        if (curr_l < 0)
          curr_l = 0;
        else if (255 < curr_l)
          curr_l = 255;
        dp[t][curr_l] =
            std::min(dp[t][curr_l], dp[t - 1][prev_l] + Diff(input[t], curr_l));
      }
    }
  }

  int64_t result = INT64_MAX;
  for (int i = 0; i < 256; i++) {
    result = std::min(result, dp[n - 1][i]);
  }
  return result;
}

int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);

  while (1) {
    int n, m;
    cin >> n >> m;
    if (n == 0 && m == 0) {
      break;
    }
    cout << Solve(n, m) << endl;
  }

  return 0;
}



Measured memory_bytes: 43100
//Optional FAST

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

//Required Libraries

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

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

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

//Required typedefs

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

//Required Constants

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

//Required Functions

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

//Work

int main()
{
	#ifndef ONLINE_JUDGE
	if (fopen("INPUT.txt", "r"))
	{
		freopen ("INPUT.txt" , "r" , stdin);
		//freopen ("OUTPUT.txt" , "w" , stdout);
	}
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	clock_t clk;
	clk = clock();
//-----------------------------------------------------------------------------------------------------------//

	map<string,ll> Z;
	READV(T);
	while(T--)
	{
		string S;
		READ(S);
		Z[S]++;
	}
	set<string> ans;
	ll mx=0;
	for(auto p:Z)
	{
		if(p.se==mx)
		{
			ans.insert(p.fi);
		}
		else if(p.se>mx)
		{
			ans.clear();
			mx=p.se;
			ans.insert(p.fi);
		}
	}
	for(auto s:ans)
	{
		cout<<s<<endl;
	}

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


	clk = clock() - clk;
	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << endl;

	return 0;
}

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

#define FST first
#define SCD second
#define MODP 1000000007

typedef long long LL;
typedef pair<int, int> PA;

int cmp(PA x, PA y) {
    return x.SCD < y.SCD;
}

int main() {
#ifdef FDB
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    int n, m, k;
    cin>>n>>m;
    puts(n==m?"Yes":"No");
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>

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

int iin() {
    int i;
    scanf("%d", &i);
    return i;
}

long long llin() {
    long long i;
    scanf("%lld", &i);
    return i;
}

double din() {
    double i;
    scanf("%lf", &i);
    return i;
}

char cin() {
    char c;
    scanf("%c", &c);
    return c;
}

void stin(char *s) {
    scanf("%s", s);
}

void iout(int i) {
    printf("%d\n", i);
}

void llout(long long i) {
    printf("%lld\n", i);
}

void dout(double i) {
    printf("%lf\n", i);
}

void cout(char c) {
    printf("%c\n", c);
}

void stout(char *s) {
    printf("%s\n", s);
}

int dfs(int v, int n, int *visited, int table[n][n]) {
    int all_visited = 1, i;

    REP(i,n) {
        if (!visited[i]) {
            all_visited = 0;
            break;
        }
    }

    if (all_visited) {
        return 1;
    }

    int count = 0;

    REP(i,n) {
        if (!table[v][i]) continue;
        if (visited[i]) continue;

        visited[i] = 1;
        count += dfs(i, n, visited, table);
        visited[i] = 0;
    }

    return count;
}

long long llgcd(long long a, long long b) {
    long long r;

    if (a < b) {
        r = a;
        a = b;
        b = r;
    }

    r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }

    return b;
}

long long lllcm(long long a, long long b) {
    long long r = llgcd(a, b);
    a /= r;
    return a * b;
}

int main() {
    int n = iin(), i;
    long long a = llin(), b;
    REP(i,n-1) {
        b = llin();
        a = lllcm(a, b);
    }
    llout(a);
    return 0;
}


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

int main() {
  ll n; cin >> n;
  vector<ll> h(n);
  rep(i, n) {
    cin >> h[i];
  }
  ll ans = 0;
  ll count = 0;
  rep(i,n-1) {
    if (h[i] >= h[i+1]) count++;
    else {
      count = 0;
    }
    ans = max(ans, count);
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<utility>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

int main(){
	int n;
	cin >> n;
	map<int, bool> is;
	for(int i=0; i<n; i++){
		int a;
		cin >> a;
		is[a] ^= true;
	}
	int num=0;
	for(auto itr=is.begin(); itr!=is.end(); itr++){
		if(itr->second)
			num++;
	}
	cout << num << endl;
	return 0;
}

Measured memory_bytes: 4864
#include<bits/stdc++.h>
#define mp make_pair
#define ff first
#define ss second
#define pb push_back
#define w(x) scanf("%d",&x);while(x--)
#define ws(x) scanf("%d",&x);getchar();while(x--)
#define rep(i,b) for(i=0;i<=b;i++)
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pi 2*acos(0.0)
#define endl "\n"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<int> vi;

long long  mod=1e9+9;
const int N=1e6+2;
int t,j,cs=0,n,a,b,k,i;
string s;
int prime[N],cnt[N];
bool mark[N],check[N];
void seive(){
    int i,j;
    for(i=4;i<N;i+=2)
        mark[i]=1;

    for(i=3;i<N;i+=2){
        if(!mark[i]){
            for(j=i;j<N;j+=(2*i))
                mark[j]=1;
            mark[i]=0;
        }
    }
}
int main()
{
//    seive();
    cin>>n;
//    for()
    int mx=0;
    int ar[n];
    for(i=0;i<n;i++){
        cin>>ar[i];
        cnt[ar[i]]++;
        mx=max(mx,ar[i]);
        if(cnt[ar[i]]==1){
            //mark[ar[i]]=1;
            prime[k++]=ar[i];
        }
    }
    sort(prime,prime+k);
    for(i=0;i<k;i++){
        a=prime[i];
            for(j=2*a;j<=mx;j+=a){
                check[j]=1;
            }
    }
    vector<int>v;
    for(i=0;i<n;i++){
        if(cnt[ar[i]]==1 && check[ar[i]]==0)
            v.pb(ar[i]);
    }
    cout<<v.size()<<endl;

}



Measured memory_bytes: 10100
#include <bits/stdc++.h>
#include <ctime>
#include <unordered_map>
#include <stdlib.h>
using namespace std;
#define ll  long long int
#define mod 1000000007
#define modd 998244353
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// #include<boost/multiprecision/cpp_int.hpp>
// using boost ::multiprecision::cpp_int;
/*__builtin_clz();
__builtin_ctz();
__builtin_popcount();*/
ll n,k;
ll a[100002];
ll dp[1000000] ;
ll fun(ll idx)
{
    // cout<<idx<<" ";
    if(idx == n-1)
    {
        return 0;
    }
    ll ans = 10000000000000000;
    if(dp[idx] != -1)
    {
        return dp[idx];
    }
    for(ll i=1;i<=k;i++)
    {
        if(idx + i <n){
        ll k = fun(idx+i)  + abs(a[idx]-a[idx+i]);
        ans= min(ans , k);
        }

    }
    // cout<<ans/<<"\n";
    return dp[idx]  = ans;
}
int main()
{
    boost;
    cin>>n>>k;
    for(ll i=0;i<n;i++)
    cin>>a[i];
    memset(dp,-1,sizeof dp);
    cout<<fun(0)<<"\n";
    cerr << "\nTime elapsed: " << 1000 * clock()/CLOCKS_PER_SEC << "ms\n";
}
/* AnsHuman_7 || Anshuman Gaur */

Measured memory_bytes: 13568