akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <deque>
#include <queue>
#include <cctype>
#include <cstdio>
#include <math.h>
#include <set>
#include <stack>
#define INF 10000000000000
using namespace std;
using ll = long long;
const int maxn = 100010;
int main() {
	ll n, m;
	cin >> n >> m;
	vector <ll> g[maxn];
	vector <ll> indeg(maxn, 0);
	vector<ll> ans(100010);
	stack<ll> S;
	for (ll i = 0; i < n - 1 + m; i++) {
		ll x, y;
		cin >> x >> y;
		g[x].emplace_back(y);
		indeg[y]++;
	}
	for (ll i = 1; i <= n; i++) {
		if (indeg[i] == 0) {
			S.push(i);
		}
	}
	while (S.size() > 0) {
		ll u = S.top();
		S.pop();
		for (auto& j : g[u]) {
			indeg[j]--;
			if (indeg[j] == 0) {
				ans[j] = u;
				S.push(j);
			}
		}
	}
	for (ll i = 1; i <= n; i++) {
		cout << ans[i] << endl;
	}
}


Measured memory_bytes: 7808
#include <stack>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <array>
#include <iomanip>
using namespace std;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int mod = 1000000000 + 7;
long long minmax(int n, int k){
    long long ans = 0;
    int tmp1 = 0;
    int tmp2 = n;
    for(int i = 0; i < k; i++){
        ans += tmp2 - tmp1;
        ans %= mod;
        tmp1 ++;
        tmp2 --;
    }
    return ans;
}
int main(){
    //std::stack<int> stack;
    
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    string ans = "Yes";
    int killt = c/b;
    if(c%b != 0){
        killt ++;
    }
    int killa = a/d;
    if(a%d != 0){
        killa ++;
    }
    if(killa < killt){
        ans = "No";
    }
    cout << ans << endl;
    return 0;
}





Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,c=0,i;
    cin>>n;
    for(i=1;i<=n;i++)
    {
       int m=log10(i)+1;
        if(m%2!=0)
        {
            c++;
        }
    }
    cout<<c;
}


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

int main()
{
    int N;
    cin >> N;
    vector<int> A(N), B(N), C(N - 1);
    rep(i, N) { cin >> A.at(i); }
    rep(i, N) { cin >> B.at(i); }
    rep(i, N - 1) { cin >> C.at(i); }
    int sum = 0;

    rep(i, N)
    {
        sum += B.at(A.at(i) - 1);
        if (i < N - 1 && A.at(i + 1) == A.at(i) + 1) {
            sum += C.at(A.at(i) - 1);
        }
    }
    cout << sum << endl;
}


Measured memory_bytes: 256
from collections import deque
n = int(input())
d = [[] for i in range(n)]
for i in range(n-1):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    d[a].append([b,c])
    d[b].append([a,c])
q, k = map(int, input().split())
k -= 1

def bfs():
    d2 = [True] * n
    ans = [0] * n
    que = deque([k])
    d2[k] = False
    while len(que) != 0:
        val = que.popleft()

        for i in range(len(d[val])):
            if d2[d[val][i][0]] == True:
                que.append(d[val][i][0])
                ans[d[val][i][0]] += (ans[val] + d[val][i][1])
                d2[d[val][i][0]] = False
    return ans
ans = bfs()
for i in range(q):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    print(ans[x] + ans[y])


Measured memory_bytes: 49956
N,K = map(int,input().split())
S = list(input())
if S[K-1] == 'A':
    S[K-1] = 'a'
elif S[K-1] == 'B':
    S[K-1] = 'b'
else:
    S[K-1] = 'c'
print(''.join(S))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <class T> T lcm(T a, T b) { return a/gcd(a,b)*b; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

int main() {
	int n;
	cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    deque<int> d;
    rep(i,n) {
        int p = lower_bound(d.begin(), d.end(), a[i]) - d.begin();
        if (p == 0) d.push_front(a[i]);
        else        d[p-1] = a[i];
    }
    int ans = d.size();
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;

ll f[100001] = {};
void fact(int n) {
	f[0] = 1;
	f[1] = 1;
	rep(i, 2, 100001) {
		f[i] = (f[i - 1] * i) % MOD;
	}
}

int main() {
	fact(100001);

	ll n, m; cin >> n >> m;

	ll ans = 0;
	if (abs(n - m) > 1) {
		cout << 0 << endl;
		return 0;
	}
	else {
		ans = f[n] * f[m] % MOD;
		if (m == n) {
			ans = ans * 2 % MOD;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define var auto
#define mod 1000000007
#define inf 2147483647
#define INF 1e17
#define nil -1
typedef long long ll;

using namespace std;

inline int input(){
    int a;
    cin >> a;
    return a;
}

template <typename T>
inline void output(T a, int p) {
    if(p){
        cout << fixed << setprecision(p)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

// end of template

int main() {
    cin.tie(0);
    // source code
    
    int V = input();
    int E = input();
    int r = input();
    
    vector<ll> dp(V, INF);
    dp[r] = 0;
    vector<vector<pair<int, int>>> edge(V);
    int v1, v2, d;
    rep(i, E){
        cin >> v1 >> v2 >> d;
        edge[v1].push_back(make_pair(v2, d));
    }
    
    priority_queue<pair<int, int>> q; // dist, vertex
    vector<int> vis(V, 0);
    q.push(make_pair(0, r));
    vis[r] = 1;
    
    while (!q.empty()) {
        var t = q.top();
        q.pop();
        int dist = t.first;
        int ver = t.second;
        vis[ver] = 2;
        
        if (dp[ver] < dist * (-1)) {
            continue;
        }
        
        rep(i, edge[ver].size()){
            int v = edge[ver][i].first;
            if (vis[v] == 2) {
                continue;
            }
            if (dp[v] > dp[ver] + edge[ver][i].second) {
                dp[v] = dp[ver] + edge[ver][i].second;
                q.push(make_pair(dp[v] * (-1), v));
                vis[v] = 1;
            }
        }
        
    }
    
    rep(i, V){
        if (dp[i] == INF) {
            output("INF", 0);
        }
        else{
            output(dp[i], 0);
        }
    }
    
    
    return 0;
}

Measured memory_bytes: 13692
#include<bits/stdc++.h>
#define int long long
#define rint register int
using namespace std;
// by piano
template<typename tp> inline void read(tp &x) {
  x = 0; char c = getchar(); int f = 0;
  for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
  for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
  if (f) x = -x;
}
#define db double
const int N = 3e5 + 233;
const db red = 4.2920367320510338076867830836025;
const db gr = 15.707963267948966192313216916398;
struct Point {
  int x, y;
}p[N];
unordered_map<int, set<int> > mpx, mpy;
int fx, fy, sx, sy, dist, k, n, m;
db ans = 0.0;
int x[N], y[N], yy[N], yy_cnt = 0;

inline bool cmp_xy(Point a, Point b) {
  return a.x < b.x || a.x == b.x && a.y < b.y;
}
namespace bit {
  int tr[N];
  inline void add(int x, int y) {
    for (; x <= yy_cnt; x += x & -x)
      tr[x] = max(tr[x], y);
  }
  inline int query(int x) {
    int ans = 0;
    for (; x; x -= x & -x)
      ans = max(ans, tr[x]);
    return ans;
  }      
}

inline db doit(void) {
  int ans = dist * 100;
  for (int i = 1; i <= n; i ++)
    if (fx <= x[i] && x[i] <= sx && 
        fy <= y[i] && y[i] <= sy) {
      p[++ m] = {x[i], y[i]};
      yy[++ yy_cnt] = y[i];
    }
  sort(p + 1, p + m + 1, cmp_xy);
  sort(yy + 1, yy + yy_cnt + 1);
  yy_cnt = unique(yy + 1, yy + yy_cnt + 1) - (yy + 1);
  for (int i = 1; i <= m; i ++) {
    int id = lower_bound(yy + 1, yy + yy_cnt + 1, p[i].y) - yy;
    bit::add(id, bit::query(id - 1) + 1);
  }
  int k = bit::query(yy_cnt);
  int p = 0;
  if(k == sx - fx + 1 || k == sy - fy + 1)
    p = 1;
  return ans - k * red + p * gr;
}

main(void) {
  read(fx); read(fy); read(sx); read(sy);
  dist = abs(fx - sx) + abs(fy - sy);
  if (fx > sx) swap(fx, sx), swap(fy, sy);
  if (fy > sy) fy = -fy, sy = -sy, k = 1;
  read(n);
  for (int i = 1; i <= n; i ++) {
    read(x[i]); read(y[i]);
    if (k) y[i] *= -1;
    mpx[x[i]].insert(y[i]);
    mpy[y[i]].insert(x[i]);
  }
  ans = doit();
  
  printf("%.20f\n", ans);
}


Measured memory_bytes: 66320
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		if (n <= 111) {
			System.out.println(111);
			return;
		}
		if (n <= 222) {
			System.out.println(222);
			return;
		}
		if (n <= 333) {
			System.out.println(333);
			return;
		}
		if (n <= 444) {
			System.out.println(444);
			return;
		}
		if (n <= 555) {
			System.out.println(555);
			return;
		}
		if (n <= 666) {
			System.out.println(666);
			return;
		}
		if (n <= 777) {
			System.out.println(777);
			return;
		}
		if (n <= 888) {
			System.out.println(888);
			return;
		}
		if (n <= 999) {
			System.out.println(999);
			return;
		}
	}
}


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

#define dump(x)  cout << #x << " = " << (x) << endl;

typedef long long ll;
typedef pair<int, int> ii;
const int mod = 1e9+7;
const ll INF = 1e18;
const int inf = 1e9;

void solve()
{
  vector<string> s(3);
  vector<int> l(3);
  for (int i=0; i<3; i++) {
    cin>>s[i];
    l[i] = (int)(s[i].length());
  }
  vector<int> x(3,-1);
  x[0]=0;
  int r=0;

  while (l[0]>x[0]&&l[1]>x[1]&&l[2]>x[2]) {
    r = s[r][x[r]]-'a';
    x[r]++;
  }
  cout << (char)(r+'A') << endl;
}

int main()
{
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>

#define fi first
#define se second

typedef std::pair<int, int> Pii;

int n, u;
Pii A[(1 << 18) + 5];

inline void Upd(Pii & a, const Pii & b) {
	if (b.fi > a.fi) {
		a.se = a.fi; a.fi = b.fi;
		if (b.se > a.se) a.se = b.se;
	} else if (b.fi > a.se) a.se = b.fi;
}

int main() {
	scanf("%d", &n);
	u = 1 << n;
	for (int i = 0; i < u; ++i) {
		scanf("%d", &A[i].fi);
		A[i].se = 0;
	}
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < u; ++j)
			if (j >> i & 1) Upd(A[j], A[j ^ 1 << i]);
	int ans = 0;
	for (int i = 1; i < u; ++i) {
		ans = std::max(ans, A[i].fi + A[i].se);
		printf("%d\n", ans);
	} return 0;
}


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

int main() {
string S;
 cin>>S;
if (S=="Sunny"){
 cout << "Cloudy" << endl;
}
if (S =="Cloudy"){
  cout <<"Rainy"<<endl;
  }
if (S=="Rainy"){
  cout <<"Sunny"<<endl;
  }
   
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
typedef vector<int>   vi;
typedef vector<long long> vll;
typedef vector<pair<int,int> > vii;
#define ll long long
#define pb push_back
#define mp  make_pair
#define ff first
#define ss second
#define pq priority_queue
#define sf(x) scanf("%d",&x)
int inf = (1e9) + 7;


int main(){


	ll n;
	int aux;
	cin >> n;
	vi v;
	ll total = 0;
	for (int i = 0; i < n; ++i)
	{
		sf(aux);
		v.pb(aux);
		total += aux;
	}

	ll ideal = total/2;
	ll min_dif = 2e18;

	ll total2 = 0;
	for (int i = 0; i < n-1; ++i)
	{
		total2 += v[i];
		total  -= v[i];
		min_dif = min(min_dif,abs(total - total2));
	}

	printf("%lld\n",min_dif);



}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,b,c,d;
  cin >> a >> b  >> c >> d;
  if( a+b > c+d ){
    cout << "Left";
  }else if(a+b < c+d){
    cout << "Right";
  }else{
    cout << "Balanced";
  }
}

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

int main()
{
 ios_base::sync_with_stdio(0);
 cin.tie(0);
 cout.tie(0);
 int t=1;
 //cin>>t;
 while(t--) {
     
    long long int a,b;
    cin>>a>>b;
    if(a==1||b==1){
    cout<<1;return 0;}
    if((a*b)%2==1)
      cout<<((a*b)/2)+1;
    else
    cout<<(a*b)/2;
  }
}

Measured memory_bytes: 256
use proconio::{input, fastout};
use proconio::marker::{Chars};
use proconio::marker::Usize1;
use std::cmp::*;

macro_rules! debug {
      ($($a:expr),*) => {
          eprintln!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

#[fastout]
fn main() {
    input!{
        a: Chars,
        b: Chars,
        c: Chars,
    }

    if a[a.len()-1]==b[0] && b[b.len()-1]==c[0] {
        println!("YES")
    } else {
        println!("NO");
    }

}   


Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
//素数ならtrueそうでないならfalseを返す 
bool prime_ornot (long long N){
  bool check = false;
  if(N == 2){
    return true;
  }
  if(N == 1){
    return false;
  }
  if(N >= 3)     {
    for(long long i = 2; i < floor(sqrt(N))+1;i++){
      if(N%i==0){
        check = true;
      }
    }
    if(check){
      return false;
    }
    else{
      return true;
    }
  }
}

int main() {
  long long X;
  cin >> X;
  while(true){
    if(prime_ornot(X)){
      cout << X;
      break;
    }
    X++;
  }
}

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

using namespace std;

int main() {
	int R;

	cin >> R;

	if (R < 1200)cout << "ABC" << endl;
	else if (R < 2800)cout << "ARC" << endl;
	else cout << "AGC" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

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

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);

int main() {
int a,b,c;
cin>>a>>b>>c;
cout<<min({a+b,b+c,c+a})<<endl;



    return 0;
}


Measured memory_bytes: 764
#include <stdio.h>

    int lday[26] = {-1, -1, -1,-1, -1, -1,-1, -1, -1,-1, -1, -1,-1, -1, -1,-1, -1, -1,-1, -1, -1,-1, -1, -1,-1, -1}, dp[366], day[26][366] = {}, dayc[26] = {};   //  day     コンテストが実施された日    dayc    dayのインデックス
    int c[26], s[365][26], ave = 0;

int calc(int con, int dd)
{
    int i, ans;
    ans = s[dd][con];
    
    for (i = 0; i < con; i++)
        ans -= c[i] * (dd - lday[i]);
    for (i = con + 1; i < 26; i++)
        ans -= c[i] * (dd - lday[i]);
    return (ans);
}

int main(void){
    int d, D, ans[366], score = 0, tmpscore;
    int i, ii, iii, iv, tmp, tmp2;
    scanf("%d", &D);
    for (i = 0; i < 26; i++)
        scanf("%d", c + i);
    for (ii = 0; ii < D; ii++)
        for (i = 0; i < 26; i++)
            scanf("%d", &s[ii][i]);
    
    for (i = 0; i < 26; i++)
        ave += c[i];
    ave /= 26;
    tmpscore = 0;
    for (d = 0;  d < D; d++)
    {
        tmp = -1000000;
        for (i = 0; i < 26; i++)
        {
            tmp2 = calc(i, d);
            if (tmp2 > tmp)
            {
                tmp = tmp2;
                ans[d] = i;
            }
        }
        tmpscore += tmp;
        day[ans[d]][dayc[ans[d]]++] = d;
        lday[ans[d]] = d;
    }
    
    for (iv = 0; iv < 2; iv++)
    {
        for(i = 0; i < 26; i++)
        {
            if (c[i] > ave * 1.3)
            {
                for (ii = 0; ii < dayc[i] - 1; ii++)
                {
                    if (day[i][ii + 1] - day[i][ii] > 100)
                    {
                        for (iii = dayc[i] + 1; iii > ii + 1; iii--)
                        {
                            day[i][iii] = day[i][iii - 1];
                        }
                        ans[(day[i][ii] + day[i][ii+1])/2] = i;
                        day[i][ii + 1] = (day[i][ii] + day[i][ii + 1]) / 2;
                        dayc[i]++;
                    }
                }
            }
            else if (c[i] > ave)
            {
                for (ii = 0; ii < dayc[i] - 1; ii++)
                {
                    if (day[i][ii + 1] - day[i][ii] > 150)
                    {
                        for (iii = dayc[i] + 1; iii > ii + 1; iii--)
                        {
                            day[i][iii] = day[i][iii - 1];
                        }
                        ans[day[i][ii] + 79] = i;
                        day[i][ii + 1] = day[i][ii] + 118;
                    }
                }
            }
        }
    }
    
    for (i = 0; i < D; i++)
        printf("%d\n", ans[i] + 1);
}

Measured memory_bytes: 1808
import math, string, itertools, fractions, heapq, collections, re,  array, bisect, sys, random, time, copy, functools


sys.setrecursionlimit(10**7)
inf = 10 ** 20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]


def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    N, K = LI()

    if N % 2 == 0:
        # 割り切れる
        return K <= N/2
    else:
        return K <= N//2 +1



if main():
    print('YES')
else:
    print('NO')


Measured memory_bytes: 7368
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
struct fast_ios { fast_ios(){cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20);} } fast_ios_;

int main()
{
    char C;
    cin >> C;

    cout << (char)(C+1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<climits>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<bitset>
#include<iomanip>
using namespace std;

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define rep2(i,j,n) for(int i=(j);i<=(n);i++)
#define all(i) i.begin(),i.end()
#define INF 1e9

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef pair<int, int> pi;
typedef long long i64;

int main() {
	int d, n;
	cin >> d >> n;
	if (n == 100) n += 1;
	int ans = pow(100, d)*n;
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N;
  cin >> N;

  long long ans = 0;
  
  for (int i = 1; i < N + 1 ; i++) {
  long long Y = N / i;
  ans += Y * (Y + 1) * i / 2;
  }

  cout << ans <<endl;
}


Measured memory_bytes: 3584
def m(suu):
  if suu>=1 and suu<=12:
    return True
  else:
    return False

s=input()
a=int(s[0])*10+int(s[1])
b=int(s[2])*10+int(s[3])

if m(a) and m(b):
  print("AMBIGUOUS")
elif  m(a):
  print("MMYY")
elif  m(b):
  print("YYMM")
else:
  print("NA")

Measured memory_bytes: 3064
import java.util.Scanner;

/**
 * Created by Taichi1 on 10/22/16.
 */
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), k = sc.nextInt();
		int i = 1;
		int count = k;
		while (i < n) {
			count *= (k - 1);
			i++;
		}
		System.out.println(count);
	}
}


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

int main(){
int d;
cin >> d ;
if ( d == 25 ){
cout << "Christmas" << endl;
}
else if ( d == 24 ){
cout << "Christmas Eve" << endl;
}
else if ( d == 23 ){
cout << "Christmas Eve Eve" << endl;
}
else{
cout << "Christmas Eve Eve Eve" << endl;
}
}

Measured memory_bytes: 256
import java.io.File;
import java.util.Scanner;

/**
 * Created by YuyaKita on 2015/05/18.
 */
public class Main {
    static final int MAX_W = 20, MAX_H = 20;
    static int W, H;
    static char[][] tiles = new char[MAX_H + 1][MAX_W + 1];
    static int count = 0;
    static int[] dx = {-1, 0, 1, 0};
    static int[] dy = {0, -1, 0, 1};

    public static void main(String args[]){

        Scanner sc = new Scanner(System.in);
        while (true) {
            W = sc.nextInt();
            H = sc.nextInt();
            if (W == 0 && H == 0){
                break;
            }
            sc.nextLine();
            for (int i = 0; i < H; i++) {
                tiles[i] = sc.nextLine().toCharArray();
            }

            System.out.println(solve(tiles));
        }
            sc.close();

    }

    static int solve(char[][] input) {
        count = 0;
        for (int i = 0; i < W; i++) {
            for (int j = 0; j < H; j++) {
                if (tiles[j][i] == '@') dfs(i, j);
            }
        }
        return count;
    }

    static void dfs(int x, int y) {
        count++;
        tiles[y][x] = '#';
        for (int i = 0; i < dx.length; i++) {
            int nx = x + dx[i];
            int ny = y + dy[i];

            if (nx >= 0 && nx < W && ny >= 0 && ny < H && tiles[ny][nx] == '.') {

                dfs(nx, ny);
            }
        }


    }

}

Measured memory_bytes: 37212
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <tuple>
 
using namespace std;
 
template<typename E>
using Matrix = std::vector<std::vector<E> >;
 
typedef long long LL;
typedef long double LD;
typedef std::pair<LL ,LL> LP;
 
#define INF		1e9
#define EPS		1e-9
#define gcd 	__gcd
#define make_matrix(rows, col, type, default) 			\
					std::vector< std::vector<type> >( 	\
						rows, 						  	\
						std::vector<type>(col, default) \
					);
 
#define repeat(n)	for(LL __x = 0; __x < n; __x++)
#define repeat2(x, n, y, m)	for(; x < n; x++) \
                                for(LL k = y, y = k; y < m; y++)

#define watch(x)	cout << (#x) << " is " << (x) << "\n";
#define DEG_TO_RAD(x) (x * PI / 180.0)
#define RAD_TO_DEG(x) (x * 180.0 / PI)
#define FILL_1(collection) for(LL __i = 0; std::cin>>collection[__i]; __i++);
#define FILL_2(collection, n) for(LL __i = 0; std::cin>>collection[__i/n][__i%n]; __i++);

auto lcs(std::string s, std::string t) -> std::string {
    LL i, j, m, n;
    
    i = j = 0;
    
    m = s.length();
    n = t.length();
    
    Matrix<LL> memo = make_matrix(m+1, n+1, LL, 0);
    repeat2(i, m+1, j, n+1) {
        if(i == 0 || j == 0)        memo[i][j] = 0;
        else if(s[i-1] == t[j-1])   memo[i][j] = memo[i-1][j-1] + 1;
        else                        memo[i][j] = max(memo[i-1][j], 
                                                     memo[i][j-1]);
    }

    LL inx = memo[m][n];
    
    i = m, 
    j = n;
       
    string ans;
    while (i > 0 && j > 0) { 
         if (s[i-1] == t[j-1]) { 
            ans += s[i-1]; 
            i--; 
            j--; 
            inx--;
        } 
        else if (memo[i-1][j] > memo[i][j-1]) i--; 
        else j--; 
    }
    
    std::reverse(begin(ans), end(ans));
    return ans;
}
auto main() -> int {
    std::string s, t;
    std::cin >> s >> t;
    cout << lcs(s, t);
}

Measured memory_bytes: 70784
#include <iostream>
#include <algorithm>
#include <deque>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
#include <string>
#include <iostream>
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    vector<int> vec(b);
    for (int i = 0; i < b; i++) {
        cin >> vec.at(i);
    }
    int ans = 0;
    for (int i = 0; i < b; i++) {
        ans += vec.at(i);
    }

    if (ans > a) { cout << -1 << endl; }
      
    else {
    int ans2;
    ans2 = a - ans;
    cout << ans2 << endl;
}

}

Measured memory_bytes: 3680
from sys import stdin
N,Y=list(map(int,stdin.readline().strip().split()))
a=0
b=0
c=0
i=0
for i in range(N+1):
    for j in range(N+1):
        z=N-i-j
        if i*1000+5000*j+z*10000==Y and z>=0:
            print("%d %d %d" %(z,j,i))
            exit()
print("-1 -1 -1")




Measured memory_bytes: 3060
def main():
    import fractions
    import math
    A, B = map(int, input().split())

    gcd = fractions.gcd(A, B)

    tmp = gcd
    ans = 1
    for i in range(2, int(-(-gcd**0.5//1))+1):
        if tmp % i == 0:
            ans += 1
            while(tmp % i == 0):
                tmp = tmp//i
    if tmp != 1:
        ans += 1
    print(ans)


main()


Measured memory_bytes: 5304
#include<bits/stdc++.h>
using namespace std;
int n;
int a[200010];
int b[200010];
int mod=1e9+7;
const int maxn=4e4+7;
long long fac[maxn],inv[maxn];
long long power_mod(long long p,long long q)//求逆元 
{
	long long ret=1;
	while(q)
	{
		if(q&1)ret=ret*p%mod;
		p=p*p%mod;
		q>>=1;
	}
	return ret;
}
void init()
{
	fac[0]=1;
	for(int i=1;i<=maxn-10;i++)
	fac[i]=fac[i-1]*i%mod;
	inv[maxn-10]=power_mod(fac[maxn-10], mod-2);
    for(int i=maxn-11;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
}
long long C(int x,int y)
{
	return fac[x]*inv[y]%mod*inv[x-y]%mod;
}
int dp[4007][4007];
int main()
{
	init();
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&a[i],&b[i]);
		dp[2001-a[i]][2001-b[i]]++;
	}
	for(int i=1;i<=4001;i++)
	{
		for(int j=1;j<=4001;j++)
		{
			dp[i][j]=(dp[i][j]+dp[i-1][j]+dp[i][j-1])%mod;
		}
	}
	long long ans=0;
	for(int i=1;i<=n;i++)
	{
		ans=(ans+dp[2001+a[i]][2001+b[i]])%mod;
	}
	for(int i=1;i<=n;i++)
	{
		ans=(ans-C(a[i]+a[i]+b[i]+b[i],a[i]+a[i])+mod)%mod;
	}
	printf("%lld\n",ans*power_mod(2,mod-2)%mod);
} 

Measured memory_bytes: 65152
#include <stdio.h>
#define M 121

long long p[M], t, tt;

int main()
{		
	int x, i, j;
	
	scanf("%d", &x);
	for(t = 0, i = 0; t < M; t++, i++){
		tt = t * t;
		p[i] = tt * tt * t;
	}
	for(i = 1; p[i] - p[i - 1] <= x; i++){
		for(j = i - 1; ; j--){
			if(j >= 0) t = p[i] - p[j];
			else t = p[i] + p[-j];
			if(t > x) break;
			if(t == x){
				printf("%d %d\n", i, j);
				return 0;
			}
		}
	}
			
	return 0;
}

Measured memory_bytes: 1732
import sys

input_methods=['clipboard','file','key']
using_method=1
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def is_ok(sd, st, t):
	if len(sd) < st+len(t):
		return False
	for i, c in enumerate(sd[st:st+len(t)]):
		if c != '?' and t[i] != c:
			return False
	return True
	
def to_aaa(a_str):
	rr=list(a_str)
	for i, c in enumerate(rr):
		rr[i] = 'a' if c == '?' else c
	ret = ''.join(rr)
	return ret

def mk_s(a_s_dash, i, t):
	front = to_aaa(a_s_dash[:i])
	back = to_aaa(a_s_dash[i+len(t):])
	ret = front+t+back
	#pa((i,t,front,t,back,ret))
	return ret
			
def main():
	s_dash = input()
	t=input()
	dd='UNRESTORABLE'
	qq='?'
	
	aa=[]
	for i, _ in enumerate(s_dash[:len(s_dash)+1]):
		#pa((s_dash,i,t))
		if is_ok(s_dash,i,t):
			aa.append(mk_s(s_dash, i, t))
			#pa(aa)
			
	if len(aa)>0:
		aa.sort()
		ret = aa[0]
		print(ret)
		return
		
	print(dd)
	return
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 39408
n = int(input())
A = [int(_) for _ in input().split()]
len_C = max(A) + 1
C = [0] * (len_C)
B = [0] * n
# 各値のカウント
for i in range(n):
    C[A[i]] += 1
# カウントの和をとる
for i in range(1, len_C):
    C[i] += C[i-1]
# print("C", C)

for i in range(n-1, -1, -1):
    # print(i, "A[i]", A[i], "C[A[i]]", C[A[i]])
    B[C[A[i]]-1] = A[i]
    C[A[i]] -= 1

for i in range(n-1):
    print(B[i], end=' ')
print(B[n-1])



Measured memory_bytes: 224572
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int solve_testcase() {
    int N, M; scanf("%d%d", &N, &M);
    if(N == 0 and M == 0) return 1;

    vector<int> H(N+1), W(M+1);
    for(int i=0; i<N; i++) scanf("%d", &H[i+1]), H[i+1] += H[i];
    for(int i=0; i<M; i++) scanf("%d", &W[i+1]), W[i+1] += W[i];

    const int P = 1500010;
    vector<int> CX(P), CY(P);
    for(int i=0; i<N; i++) {
        for(int j=i+1; j<=N; j++) {
            CX[ H[j] - H[i] ]++;
        }
    }
    for(int i=0; i<M; i++) {
        for(int j=i+1; j<=M; j++) {
            CY[ W[j] - W[i] ]++;
        }
    }

    ll ans = 0;
    for(int i=0; i<P; i++) ans += 1LL * CX[i] * CY[i];
    printf("%lld\n", ans);
    return 0;
}

int main() {
    while(!solve_testcase());
    return 0;
}



Measured memory_bytes: 14636
N = int(input())
s = [0]*N
for i in range(N):
    s[i] = int(input())

ans = sum(s)
if ans % 10 != 0:
    print(ans)
else:
    flag = True
    for e in sorted(s):
        if e % 10 != 0:
            ans -= e
            flag = False
            break
    if flag:
        print(0)
    else:
        print(ans)


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

int main(){
  int N;
  cin>>N;
  vector<int> A(N);
  bool ans=true;
  for(int i=0; i<N; i++){
    cin>>A.at(i);
    if(A.at(i)%2==0){
      if(A.at(i)%6!=0&&A.at(i)%10!=0){
        ans=false;
      }
    }
  }
  cout<<(ans?"APPROVED":"DENIED")<<endl;
}

Measured memory_bytes: 3640
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	h, w := iScan(), iScan()
	_ = iScan()
	s := SScan(h)
	ans := make([][]int, h)
	f := -1
	n := 0
	for i := 0; i < h; i++ {
		t := false
		ans[i] = make([]int, w)
		for _, v := range s[i] {
			if string(v) == "#" {
				t = true
			}
		}
		if f == -1 && !t {
			continue
		} else if !t {
			copy(ans[i], ans[i-1])
			continue
		}
		if f == -1 {
			f = i
		}
		u := false
		for j, v := range s[i] {
			if string(v) == "#" {
				u = true
				n++
			}
			if u {
				ans[i][j] = n
			} else {
				ans[i][j] = n + 1
			}
		}
	}
	for i := 0; i < f; i++ {
		copy(ans[i], ans[f])
	}
	for i := 0; i < h; i++ {
		fmt.Println(strings.Trim(fmt.Sprint(ans[i]), "[]"))
	}
}


Measured memory_bytes: 4192
n, m = map(int, input().split())

card = [0 for i in range(n+1)]
for i in range(m):
    l, r = map(int, input().split())
    card[l-1] += 1
    card[r] -= 1

for i in range(n):
    card[i+1] += card[i]

print(card.count(m))

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

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

    int amax = 0;
    int amin = 1001;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        amax = max(amax, a);
        amin = min(amin, a);
    }
    cout << amax - amin << endl;
    return 0;
}

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

using namespace std;

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

    int a,b;
    cin >> a >> b;

    int c1,c2,c3;
    c1 = c2 = c3 = 0;

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

        if(x <= a)
            c1++;
        else if(x <= b)
            c2++;
        else 
            c3++;
    }

    cout << min(c1,min(c2,c3)) << endl;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {

		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		List<Integer> A = new ArrayList<>();

		for(int i=0;i<N;i++) {
			A.add(sc.nextInt());
		}
		int max = Collections.max(A);
		int max_i = A.indexOf(max);
		List<Integer> temp = new ArrayList<>(A);
		temp.remove(max_i);
		int second_max = Collections.max(temp);

		for(int i=0;i<N;i++) {
			if(i == max_i) {
				System.out.println(second_max);
			}else {
				System.out.println(max);
			}
		}
	}
}


Measured memory_bytes: 93036
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#define ll long long
#define pi 3.14
using namespace std;
void put(int x){
	if(x<0) {
		putchar('-');
		x*=-1;
	}
	if(x==0) {
		putchar('0');
	}
	int num=0;
	char c[15];
	while(x) {
		c[++num]=(x%10)+48;
		x/=10;
	}
	while(num) {
		putchar(c[num--]);
	}
	putchar('\n');
}
inline void in(int &x){
	char ch=getchar();
	int flag=1;
	while(!(ch>='0'&&ch<='9')) {
		if(ch=='-')
			flag*=-1;
		ch=getchar();
	}
	x=ch-'0';
	ch=getchar();
	while(ch>='0'&&ch<='9') {
		x=((x<<3)+(x<<1))+ch-'0';
		ch=getchar();
	}
	x*=flag;
}
int a,ans=15;
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	for(int i=1;i<=5;i++){
		in(a);ans-=a;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>

void StartProgram()
{
    int tMonsterHP, tMonsterAP, aMonsterHP, aMonsterAP;
    //printf("Insert values of Takahashi and Aoki monsters: \n");
    
    scanf("%d %d %d %d",&tMonsterHP, &tMonsterAP, &aMonsterHP, &aMonsterAP);
    
    if(tMonsterHP > 100 || tMonsterAP > 100 || aMonsterHP > 100 || aMonsterAP > 100)
    {
        printf("Wrong input \n");
        printf("\n");
        StartProgram();
    }
    else if (tMonsterHP < 1 || tMonsterAP < 1 || aMonsterHP < 1 || aMonsterAP < 1)
    {
        printf("Wrong input \n");
        printf("\n");
        StartProgram();
    }
    
    while(1)
    {
        aMonsterHP = aMonsterHP - tMonsterAP;
        if(aMonsterHP <=0)
        {
            printf("Yes \n");
            break;
        }
        tMonsterHP = tMonsterHP - aMonsterAP;
        if(tMonsterHP <= 0)
        {
            printf("No \n");
            break;
        }
    }
        
    
    return ;
}

int main(int argc, const char * argv[])
{
    StartProgram();
    
    return 0;
}


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

const int mod = 1000000007;
//横棒の取り方をbitで管理 01なら縦棒2から縦棒3に横棒がつながっている

int main(){
    int H,W,K;
    cin >> H >> W >> K;
    vector<vector<int> > dp(H+1, vector<int>(W,0));
    //dp[i][j] : 縦棒を上から見ていった時jで終わるようなものの個数
    dp[0][0] = 1;
    rep(i,H){
        rep(j,W){
            rep(bit,1<<(W-1)){
                //横線同士がつながっていないか調べる。
                //隣り合っているbitがないか？
                bool flag = true;
                rep(l,W-2){
                    if(((bit>>l)&1) && ((bit>>(l+1))&1))flag = false;
                }
                if(flag){
                    if(j >= 1 && ((bit >> (j-1))&1)){
                        //左方向
                        dp[i+1][j-1] += dp[i][j];
                        dp[i+1][j-1] %= mod;
                    }
                    else if(j <= W-2 && ((bit >> j)&1)){
                        //右方向
                        dp[i+1][j+1] += dp[i][j];
                        dp[i+1][j+1] %= mod;
                    }
                    else{
                        //横線なし
                        dp[i+1][j] += dp[i][j];
                        dp[i+1][j] %= mod;
                    }
                }              
            }
        }
    }
    cout << dp[H][K-1] << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

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

#define MOD 1000000007
#define REP(i, N) for (int i = 0; i < N; ++i)
#define REP1(i, N) for (int i = 1; i <= N; ++i)
#define RREP(i, N) for (int i = N - 1; i >= 0; --i)
#define ALL(a) a.begin(), a.end()

int main() {
  int n;
  cin >> n;
  double a[n];
  REP(i, n) cin >> a[i];
  double ans = 0;
  REP(i, n) ans += (1.0 / a[i]);
  ans = 1.0 / ans;
  printf("%.10f\n", ans);
  return 0;
}

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

using namespace std;

typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000 //2e9
#define LLINF 2000000000000000000ll // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define dmp(x) cerr << #x << ": " << x << endl;

template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}

template<class T> using MaxHeap = priority_queue<T>;
template<class T> using MinHeap = priority_queue<T,vector<T>,greater<T>>;
template<class T> vector<T> vect(int len,T elem){ return vector<T>(len,elem); }

template<class T,class U>
ostream& operator << (ostream& os,const pair<T,U>& p){
  os << p.fi << ',' << p.sec; return os;
}
template<class T,class U>
istream& operator >> (istream& is,pair<T,U>& p){
  is >> p.fi >> p.sec; return is;
}
template<class T>
ostream& operator << (ostream &os,const vector<T> &vec){
  for(int i=0;i<vec.size();i++){
    os << vec[i];
    if(i+1<vec.size())os << ' ';
  }
  return os;
}
template<class T>
istream& operator >> (istream &is,vector<T>& vec){
  for(int i=0;i<vec.size();i++)is >> vec[i];
  return is;
}
void fastio(){
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout<<fixed<<setprecision(20);
}
namespace Util{
  template<class T>
  vector<pair<T,int>> runLength(vector<T> v){
    vector<pair<T,int>> res;
    for(int i=0;i<v.size();i++){
      if(res.empty()||res.back().first!=v[i])res.push_back(make_pair(v[i],1));
      else res.back().second++;
    }
    return res;
  }
  template<class T>
  void compress(vector<T> &v){
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
  }
}

void solve(){
  int N;
  cin >> N;
  vector<string> s(N);
  cin >> s;
  map<string,int> m;
  for(int i=0;i<N;i++)m[s[i]]++;
  int a = 0;
  for(int i=0;i<N;i++)chmax(a,m[s[i]]);
  vector<string> ans;
  for(auto t : m){
    if(t.second==a)ans.push_back(t.first);
  }
  sort(all(ans));
  for(int i=0;i<ans.size();i++){
    cout << ans[i] << endl;
  }
  return ;
}
 
signed main(){
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();
  return 0;
}


Measured memory_bytes: 27120
#include <bits/stdc++.h>
#define INF LLONG_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(int i=0; i<n; ++i)
#define MOD 1000000007
using namespace std;
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 a; string s;
  cin >> a >> s;
  if(a>=3200) cout << s << endl;
  else cout << "red" << endl;
}



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

int main(){
  string s1, s2, endStr;
  int len;
  getline(cin, s1);
  getline(cin, s2);
  
  size_t strlen = s1.length();
  len = (int)(strlen);
  
  for(int i = 0; i < len; i = i + 1){
    s1 = s1[len-1] + s1;
    s1.pop_back();
  	
    if(s1 == s2){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


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

using namespace std;

#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define For(i, s, n) for(int i = s; i < (int)(n); ++i)

string read(int n) {
  switch (n % 10) {
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
    return "hon";
    case 0:
    case 1:
    case 6:
    case 8:
    return "pon";
    case 3:
    return "bon";
  }
}

int main() {
  int N;
  cin >> N;
  cout << read(N) << endl;
  return 0;
}


Measured memory_bytes: 3624
s = input()
s_len = len(s)
 
def judge(start=0, end=s_len):
  for i in range(start, end):
    if s[i] == s[end-1-i]:
      continue
    else:
      return 0
  return 1
 
if judge() and judge(end=(s_len-1)//2) and judge(start=(s_len+3)//2-1):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<utility>
#include<tuple>
#include<map>
#include<queue>
#include<set>
#include<stack>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define BIL ((ll)1e9)
#define MOD ((ll)1e9+7)
#define INF (1LL<<60)           //1LL<<63でオーバーフロー
#define inf (1<<29)             //1<<29でオーバーフロー

int main(int argc,char* argv[]){
    int n,d;
    cin >> n >> d;

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

    int count=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            int distsqr=0;
            auto y=x[i];
            auto z=x[j];
            for(int k=0;k<d;k++){
                distsqr+=(y[k]-z[k])*(y[k]-z[k]);
            }

            for(int l=1;l*l<=distsqr;l++){
                if(l*l==distsqr)count++;
            }
        }
    }

    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << "-1\n"; return;}

const int INF = 1e18;

vector <pi> d[4];

bool cmp_sec(pi p1, pi p2) {
    return p1.S < p2.S || (p1.S == p2.S && p1.F < p2.F);
}

bool cmp_main(pi p1, pi p2) {
    return (p1.F + p1.S < p2.F + p2.S) || (p1.F + p1.S == p2.F + p2.S && p1.F < p2.F);
}

bool cmp_rev(pi p1, pi p2) {
    return (p1.F - p1.S < p2.F - p2.S) || (p1.F - p1.S == p2.F - p2.S && p1.F < p2.F);
}

void solve() {
    int n, ans = INF; cin >> n;
    loop(i, n) {
        int x, y; char c;
        cin >> x >> y >> c;
        d[c == 'U' ? 0 : (c == 'R' ? 1 : (c == 'D' ? 2 : 3))].pb({ x, y });
    }
    sort(all(d[1]), cmp_sec);
    sort(all(d[3]), cmp_sec);
    for (pi p : d[1]) {
        auto it = lower_bound(all(d[3]), p, cmp_sec);
        if (it != d[3].end() && it->S == p.S)
            ans = min(ans, (it->F - p.F) * 5);
    }
    sort(all(d[0]));
    sort(all(d[2]));
    for (pi p : d[0]) {
        auto it = lower_bound(all(d[2]), p);
        if (it != d[2].end() && it->F == p.F)
            ans = min(ans, (it->S - p.S) * 5);
    }
    loop(i, 4)
        sort(all(d[i]), cmp_main);
    for (int i = 1; i < 3; ++i)
        for (pi p : d[i]) {
            auto it = lower_bound(all(d[i == 1 ? 0 : 3]), p, cmp_main);
            if (it != d[i == 1 ? 0 : 3].end() && it->F + it->S == p.S + p.F)
                ans = min(ans, (it->F - p.F) * 10);
        }
    loop(i, 4)
        sort(all(d[i]), cmp_rev);
    loop(i, 2)
        for (pi p : d[i]) {
            auto it = lower_bound(all(d[i ? 2 : 3]), p, cmp_rev);
            if (it != d[i ? 2 : 3].end() && it->F - it->S == p.F - p.S)
                ans = min(ans, (it->F - p.F) * 10);
        }
    if (ans == INF)
        cout << "SAFE";
    else
        cout << ans;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

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

using namespace std;
typedef long long ll;
#define tr(container, it) \
	for (auto it = container.begin(); it != container.end(); it++)
#define scontains(c,x) ((c).find(x) != (c).end())   //O(log n) 
#define contains(c,x) (find((c).begin(),(c).end(),x) != (c).end()) //O(n)
#define Ichar(_x) char _x;scanf("%c",&_x);
#define Iint(_x) int _x;scanf("%d",&_x); 
#define Ill(_x)  ll _x;scanf("%lld",&_x);
#define inc(a,b,x)(x)>a && (x)<b	
#define incE(a,b,x)(x)>=a && (x)<=b	
#define max(a,b) (a)>=(b)? (a) : (b) 
#define fileio freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
const double pi = 3.14159265358979323846;

int main()
{
	ll s = 0;
	Iint(a);
	Iint(b);
	Iint(c);
	for (int i = 0; i < pow(10, 10); ++i)
	{
		s += i;
	}
	if(c>=a && c<=a+b)std::cout << "YES";
	else { std::cout << "NO"; }


	
}






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

using namespace std;

int main(void)
{
    int N, i, j, k, al1[26], al2[26], ans=0, count;
    string S;

    cin >> N >> S;

    for(i=1; i<N; i++){ // 分割する位置
        count = 0;

        for(j=0; j<26; j++){
            al1[j] = 0;
            al2[j] = 0;
        }

        for(j=0; j<=i-1; j++){
            al1[S[j]-'a']++;
        }

        for(j=i; j<=N-1; j++){
            al2[S[j]-'a']++;
        }

        for(j=0; j<26; j++){
            if(al1[j]>0 && al2[j]>0){
                count++;
            }
        }

        if(count > ans){
            ans = count;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
  int N,M,A,B,ans=0;
  cin >> N >> M;
  int H[N]={0},Mx[N]={0};
  for(int i=0;i<N;i++){
    cin>>H[i];
  }
  
  for(int i=0;i<M;i++){
    cin >>A>>B;
    Mx[A-1]=max(Mx[A-1],H[B-1]);
    Mx[B-1]=max(Mx[B-1],H[A-1]);
  }
  
  for(int i=0;i<N;i++){
    ans+=H[i]>Mx[i]; 
  }
  
  cout << ans;
  }

Measured memory_bytes: 4344