akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) std::cout << x << '\n'
#define all(a) a.begin(), a.end()
#define pb push_back
#define sz(x) ((int)(x).size())
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;
const int MAX_N = 100010;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(10);
	/*------------------------------*/

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

	bool f = false;
	for (int i = a; i <= b; i++) {
		if (i % k == 0) {
			f = true;
			break;
		}
	}

	if (f) {
		out("OK");
	}
	else {
		out("NG");
	}

	return 0;
}

Measured memory_bytes: 3612
#pragma GCC optimize("O2")
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<bitset>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
#include<set>
#include<map>
#include<limits.h>
#include<ctime>
#define N 100001
typedef long long ll;
const int inf=0x3fffffff;
const int maxn=2017;
const int mod=1000000007;
using namespace std;
inline int read()
{
    int f=1,x=0;char ch=getchar();
    while(ch>'9'||ch<'0')
    {
        if(ch=='-')
        f=-1;
        ch=getchar();
    }
    while(ch<='9'&&ch>='0')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return f*x;
}
int sum[N];
char s[N],t[N];
int ans=0;
int cnt,flag;
int main()
{
    scanf("%s",s+1);
    int n=strlen(s+1);
    for(int i=1;i<=n;i++)
    {
        if(s[i]=='x'){sum[cnt]++;continue;}
        t[++cnt]=s[i];
    }
    for(int i=1;i<=cnt;i++)
    {
        if(t[i]!=t[cnt-i+1])flag++;
        if(flag>=2)
        {
            puts("-1");
            return 0;
        }
    }
    for(int i=0;i<=cnt;i++)
    {
        ans+=abs(sum[i]-sum[cnt-i]);
        sum[i]=sum[cnt-i];
    }
    cout<<ans<<endl;
    //cout<<endl<<"Runtime is "<<clock()<<endl;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define ll long long
#define be(v) v.begin(), v.end()

int main() {
	int h,m,hh,mm,k;
	cin >> h >> m >> hh >> mm >> k;
	m += 60*h;
	mm += 60*hh;
	mm -= m;
	cout << mm - k << endl;
}

Measured memory_bytes: 3620
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(int x, int y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(int x, int y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    int s; cin >> s;
    if (s == 4 || s == 2 || s == 1) {
        cout << 4 << endl;
        return 0;
    }
    rep(i, 1000000) {
        if (s % 2 == 1)s = s * 3 + 1;
        else s /= 2;
        if (s == 4) {
            cout << i+5 << endl;
            return 0;
        }
    }
}

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

class Program
{
    static void Main()
    {
        var line = Console.ReadLine().Split(' ').Select(x => Int32.Parse(x)).ToArray();
        var R = line[0];
        var G = line[1];
        var B = line[2];
        var N = line[3];
        var ans = 0L;
        for (int i=0;i<=N;i++)
        {
            var count = N - (i * R);
            for (int j=0;j<=count;j++)
            {
                var last = N - (i * R) - (j * G);
                if (last < 0) break;
                if (last % B == 0) ans++;
            }
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 13268
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long q = sc.nextLong();
		long h = sc.nextLong();
		long s = sc.nextLong();
		long d = sc.nextLong();
		long n = sc.nextLong();
		
		h = Math.min(2 * q, h);
		s = Math.min(2 * h, s);
		d = Math.min(2 * s, d);
		
		long ans = (n / 2) * d + (n % 2) * s;
		System.out.println(ans);
		
		sc.close();
	}
	
}



Measured memory_bytes: 27104
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 998244353
#define seg_size 262144
#define REP(i,n) for(long long i = 0;i < n;++i)
long long value[100] = {};
long long geko = 0;
long long dfs(long long n_l, long long n_r, long long l_rate, long long r_rate) {
	if (n_l >= n_r) return 0;
	long long ans = geko;
	for (int q = n_l; q < n_r; ++q) {
		long long next_value = (l_rate + r_rate) * value[q];
		if (geko > next_value) {
			long long gogo = dfs(n_l, q, l_rate, (l_rate + r_rate)) + dfs(q + 1, n_r, (l_rate + r_rate), r_rate);
			ans = min(ans, next_value + gogo);
		}
	}
	return ans;
}
unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x^(x << 11));
	x = y; y = z; z = w;
	return (w = (w^(w >> 19))^(t^(t >> 8)));
}
int main() {
	while (true) {
		int n = 0;
		cin >> n;
		long long final_ans = 0;
		cin >> final_ans;
		REP(i, n - 2) {
			cin >> value[i];
		}
		long long tmp = 0;
		cin >> tmp;
		final_ans += tmp;
		n -= 2;
		for (long long q = 0; q < n; ++q) {
			geko += value[q] * (q + 2LL);
		}
		cout << dfs(0, n, 1, 1) + final_ans << endl;
		return 0;
	}
}

Measured memory_bytes: 888
n = int(input())
a = list(map(int,input().split()))
can = []
ans = 0
now = 0
for i in range(n):
  now += a[i]
  if i % 2 == 0:
    if now <= 0:
      ans += 1 - now
      now = 1
  else:
    if now >= 0:
      ans += 1 + now
      now = -1
can.append(ans)
ans = 0
now = 0
for i in range(n):
  now += a[i]
  if i % 2 == 1:
    if now <= 0:
      ans += 1 - now
      now = 1
  else:
    if now >= 0:
      ans += 1 + now
      now = -1
can.append(ans)
print(min(can))

Measured memory_bytes: 14468
import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
       Scanner stdIn= new Scanner(System.in);

        int x = stdIn.nextInt();
        int y = stdIn.nextInt();
        if(x<=y){
            System.out.println("unsafe");
        }else{
            System.out.println("safe");
        }
    }
}


Measured memory_bytes: 35560
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
using std::cin;
using std::max;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
const int INF=1e+9;
const ll INFLL=1e+17;
int N;
ll C;
ll x[100010],v[100010];
ll max1=0,max3=0,rmax1=0,rmax3=0;
ll max1a[100010],rmax1a[100010],max3a[100010],rmax3a[100010];
void make_max(){
  ll sum=0;
  rep(i,N){
    sum+=v[i];
    max1=max(max1,sum-x[i]);
    max1a[i]=max1;
    max3=max(max3,sum-2*x[i]);
    max3a[i]=max3;
  }
  sum=0;
  for(int i=N-1;i>=0;i--){
    sum+=v[i];
    rmax1=max(rmax1,sum-(C-x[i]));
    rmax1a[i]=rmax1;
    rmax3=max(rmax3,sum-2*(C-x[i]));
    rmax3a[i]=rmax3;
  }
}
ll solve(){
  make_max();
  ll res=max(max1,rmax1);
  rep(i,N-1){
    res=max(res,max1a[i]+rmax3a[i+1]);
  }
  for(int i=N-1;i>0;i--){
    res=max(res,rmax1a[i]+max3a[i-1]);
  }
  return res;
}
int main(){
  cin>>N>>C;
  rep(i,N) cin>>x[i]>>v[i];
  prin(solve());
  return 0;
}


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

int main(){
    double x1, y1, x2, y2, distance;
    scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);

    distance = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));

    printf("%lf\n", distance);
    return 0;
}


Measured memory_bytes: 1976
#include <bits/stdc++.h>
#include <map> // pair
using namespace std;
int main(){
  vector<int> A(3);
  for(int i=0;i<3;i++){
    cin>>A.at(i);
  }
  sort(A.begin(),A.end());
  int ans=A.at(0)+A.at(1);
  cout<<ans<<endl;
  }


Measured memory_bytes: 256
#include <iostream>

int main() {
    while( true ) {
        int h , w ;
        std::cin >> h >> w ;
        if( ! ( h | w ) ) {
            break ;
        } else {
            for( int i = 0 ; i < h ; i++ ) {
                for( int ii = 0 ; ii < w ; ii++ ) {
                    if( i % 2 == 0 ) {
                        if( ii % 2 == 0  ) {
                            std::cout << "#" ;
                        } else {
                            std::cout << "." ;
                        }
                    } else {
                        if( ii % 2 == 0 ) {
                            std::cout << "." ;
                        } else {
                            std::cout << "#" ;
                        }
                    }
                }
                std::cout << std::endl ;
            }
            std::cout << std::endl ;
        }
    }
}




Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
#define endl '\n'
#define fsp(x) cout << fixed << setprecision(x)
const ll inf = LLONG_MAX;
const long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

int main() {
  ll n, k;
  cin >> n >> k;
  n -= k;
  if (k == 1) cout << 0 << endl;
  else cout << n << endl;
}

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

using namespace std;

constexpr int INF = 1000000000;

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

  int maxA = 0;
  vector<int> A(N), B(N);
  for(int i = 0; i < N; i++){
    cin >> A[i] >> B[i];
    maxA = max(maxA, A[i]);
  }
  
  vector<int> dp(H+maxA+1, INF);
  for(int i = 1; i <= H+maxA; i++){
    for(int j = 0; j < N; j++){
      int index = i - A[j];
      int totalMP = (index > 0) ? dp[index] + B[j] : B[j];
      dp[i] = min(dp[i], totalMP);
    }
  }

  auto minElem = min_element(dp.begin()+H, dp.end());
  cout << *minElem;
  return 0;
}

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

int main(){
  int N;
  cin >> N;
  set<char> cset;
  for(int i=0; i<N; ++i){
    char c;
    cin >> c;
    cset.insert(c);
    // cout << c << endl;
  }
  // cout << cset.size() << endl;
  if(cset.size() == 3){
    cout << "Three" << endl;
  } else {
    cout << "Four" << endl;
  }

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ld = long double;
#define repd(i,a,b) for (int i=a;i<int(b);i++)
#define rep(i,n) repd(i,0,n)
#define VARNAME(v) #v
using P = pair<int,int>;


int main() {
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int BEAM = 850;
  int d;vector<int> c(26);cin>>d;rep(i,26)cin>>c[i];
  vector<array<int, 26>> s(d);
  rep(i,d)rep(j,26)cin>>s[i][j];
  vector<int> curs = {0};
  vector<array<int, 26>> curl(1);
  vector<vector<int>> cura(1);
  rep(i,d){
    int len = int(curs.size()) * 26, ind = 0;
    vector<P> nxs(len);
    vector<array<int, 26>> nxl(len);
    vector<vector<int>> nxa(len);
    rep(j, curs.size()){
      rep(t, 26){
        int score = curs[j];
        array<int, 26> last = curl[j];
        vector<int> ans = cura[j];
        score += s[i][t];
        last[t] = i+1;
        rep(k,26)score -= c[k]*(i+1 - last[k]);
        ans.emplace_back(t);
        nxs[ind] = P(score, ind);
        nxl[ind] = last;
        nxa[ind] = ans;
        ind++;
      }
    }
    sort(nxs.rbegin(), nxs.rend());
    len = min(len, BEAM);
    curs.resize(len);curl.resize(len);cura.resize(len);
    rep(j,len){
      curs[j] = nxs[j].first;
      curl[j] = nxl[nxs[j].second];
      cura[j] = nxa[nxs[j].second];
    }
    if(i % 73 == 0)BEAM -= 100;
  }
  int ans = 0;
  rep(i,min(int(curs.size()), BEAM)){
    if(curs[ans] < curs[i])ans = i;
  }

  for(auto x : cura[ans]){
    cout << x+1 << endl;
  }
}


Measured memory_bytes: 19740
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CTypicalStairs solver = new CTypicalStairs();
        solver.solve(1, in, out);
        out.close();
    }

    static class CTypicalStairs {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int mod = 1_000_000_007;
            int n = in.nextInt();
            int m = in.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < m; i++)
                arr[i] = in.nextInt();
            //dp[k] : nb of steps to get to get to the N-1th from the kth step
            //dp[k] = if arr[k]==0 => 0 else dp[k+1] + dp[k+2]
            //dp[n-1] = 1
            long[] dp = new long[n + 2];
            dp[n + 1] = 0;
            dp[n] = 1;
            int cur = m == 0 ? -1 : arr[m - 1];
            int indM = m - 1;
            for (int i = n - 1; i >= 0; i--) {
                if (i == cur) {
                    indM--;
                    if (indM >= 0)
                        cur = arr[indM];
                    dp[i] = 0;
                } else {
                    dp[i] = dp[i + 1] + dp[i + 2];
                    dp[i] %= mod;
                }
            }
            out.println(dp[0]);
        }

    }
}



Measured memory_bytes: 52880
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

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

    int d;
    cin >> d;
    d = 25 - d;

    cout << "Christmas";
    rep(i, d){
        cout << " Eve";
    }
    cout << endl;

    return 0;
}


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

typedef long long LL;

void solve(LL N, LL M, vector<LL> a_arr,vector<LL>b_arr, vector<vector<LL>> c_table) {
  LL max = 1 << N;
  vector<LL> dp(max);
  for (int i = 0; i < max; ++i) { dp[i] = 1e10; }
  for (int i = 0; i < M; ++i) {
    LL a = a_arr[i];
    LL b = b_arr[i];
    int index = 0;
    for (LL j = 0; j < b; ++j) {
      LL c = c_table[i][j];
      index |= (1<<(c-1));
    }
    dp[index] = min(dp[index], a);
  }
  for (int k = 0; k < N; ++k) {
    for (int i = 0; i < max; ++i) {
      for (int j = i+1; j < max; ++j) {
        dp[i|j] = min(dp[i|j], dp[i] + dp[j]);
      }
    }
  }
  LL value = dp[max-1];
  if (value >= 1e10) { value = -1; }
  cout << value << endl;
}

// Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
  // Failed to predict input format
  LL N, M;
  cin>>N>>M;
  vector<LL> a_arr;
  vector<LL> b_arr;
  vector<vector<LL>> c_table;
  for (int i = 0; i < M; ++i) {
    LL a,b,c;
    cin>> a>>b;
    a_arr.push_back(a);
    b_arr.push_back(b);
    vector<LL> c_arr;
    for (int j = 0; j < b; ++j) {
      cin>>c;
      c_arr.push_back(c);
    }
    c_table.push_back(c_arr);
  }

  solve(N,M,a_arr,b_arr,c_table);
  return 0;
}


Measured memory_bytes: 512
//#define _GLIBCXX_DEB // Iterator safety; out-of-bounds access for Containers, etc.
//#pragma GCC optimize "trapv" // abort() on (signed) integer overflow.
#include <bits/stdc++.h>

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

#define ll long long int
#define mod 1000000007
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define prec(n) fixed << setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int>>
#define PI 3.1415926535897932384626
#define INF 1000000000
#define bits(n) __builtin_popcount(n)

void solve()
{
    int k;
    cin >> k;
    for (int i = 0; i < k; i++)
    {
        cout << "ACL";
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input1.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output1.txt", "w", stdout);
#endif

    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <numeric>
#include <string>
#include <cmath>

#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;


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

	double vel;
	vel = (double)d / s;
	if (vel <= t) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000;
const int ZERO = 0;
const int MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<int,int> P;

int N;
vector<P> G[100010];
int colort[100010];
int color[100010];

void dfs(int s) {
    int cnt = 1;
    for(int i = 0;i < G[s].size();i++) {
        if(colort[s] == cnt) {
            cnt++;
            color[G[s].at(i).second] = cnt;
            colort[G[s].at(i).first] = cnt;
        }
        else {
            color[G[s].at(i).second] = cnt;
            colort[G[s].at(i).first] = cnt;
        }
        cnt++;
        dfs(G[s].at(i).first);
    }
    return;
}
signed main() {
    int N;
    cin >> N;
    for(int i = 0;i < N - 1;i++) {
        int A,B;
        cin >> A >> B;
        G[A - 1].push_back(P(B - 1,i));
    }
    colort[0] = 0;
    dfs(0);
    int ret = 0;
    for(int i = 0;i < N;i++) {
        ret = max(ret,color[i]);
    }
    cout << ret << endl;
    for(int i = 0;i < N - 1;i++) {
        cout << color[i] << endl;
    }
}

Measured memory_bytes: 8192
#include <iostream>
#include <queue>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 1; i < (int)(n); ++i)

int main(){
    ll k,now;
    cin >> k;
    queue <ll> que;
    rep(i,10){que.push(i);}
    while (k > 1){
        now = que.front();
        if(now%10 != 0){que.push(10*now+(now%10)-1);}
        que.push(10*now+(now%10));
        if(now%10 != 9){que.push(10*now+(now%10)+1);}
        que.pop();
        k--;
    }
    cout << que.front() << endl;
    return 0;
}

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

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

int calc_order(long long a, long long P, const vector<pair<long long, long long> > &pf) {
    int res = P - 1;
    for (auto pa : pf) {
        int p = pa.first;
        while (res % p == 0 && modpow(a, res/p, P) == 1) res /= p;
    }
    return res;
}

int GCD(int a, int b) {
    return b ? GCD(b, a % b) : a;
}

int main() {
    int P, T; scanf("%d %d", &P, &T);
    auto pf = prime_factorize(P-1);

    for (int CASE = 0; CASE < T; ++CASE) {
        int N; scanf("%d", &N);
        int gcd = P-1;
        for (int i = 0; i < N; ++i) {
            int G; scanf("%d", &G);
            gcd = GCD(gcd, (P-1)/calc_order(G, P, pf));
        }
        int A; scanf("%d", &A);
        int ga = (P-1)/calc_order(A, P, pf);
        if (ga % gcd == 0) cout << 1 << endl;
        else cout << 0 << endl;
    }
}



Measured memory_bytes: 3268
#include <bits/stdc++.h>
#define rep(i,l,r) for (int i=l,i##end=r;i<=i##end;++i)
#define per(i,r,l) for (int i=r,i##end=l;i>=i##end;--i)
#define sit set<int>::iterator
#define ll long long
using namespace std;
const int N=41,S=1e6+6,P=1e9+7;
int f[N][S];
int add(int x,int y){ x+=y; return x>=P?x-P:x; }
int main(){
    int n,x,y,z; cin>>n>>x>>y>>z;
    int ep=(1<<z-1)|(1<<z+y-1)|(1<<z+y+x-1),u=(1<<x+y+z)-1;
    f[0][0]=1;
    rep(i,1,n)
        rep(s,0,u)
            if (f[i-1][s])
                rep(j,1,10){
                    int t=(s<<j|(1<<j-1))&u;
                    if ((t&ep)!=ep) f[i][t]=add(f[i][t],f[i-1][s]);
                }
    int ans=1;
    rep(i,1,n) ans=(ll)ans*10%P;
    for (int s=0;s<=u;++s) ans=add(ans,P-f[n][s]);
    cout<<ans%P<<endl;
    return 0;
}


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

int main()
{
    int n = 0,ans = 0,j = 0,digit = 0;
    cin >> n;

    for(int i = 1; i <= n; ++i)
    {
        j = i;
        while (j != 0)
        {
            j /= 10;
            digit++;
        }
        if (digit % 2 == 1)
        {
            ans++;
        } 
        digit = 0; 
    }
    cout << ans << endl;
}   

Measured memory_bytes: 3604
h,w=map(int,input().split())
if h%3==0 or w%3==0:
  print(0)
else:
  ans=h*w
  v=w//2
  for i in range(1,h):
    a=i*w
    y=(h-i)//2
    z=h-i-y
    b=y*w
    c=z*w
    d=(h-i)*v
    e=(h-i)*(w-v)
    ans=min(ans,max(a,b,c)-min(a,b,c),max(a,d,e)-min(a,d,e))
  v=h//2
  for i in range(1,w):
    a=i*h
    y=(w-i)//2
    z=w-i-y
    b=y*h
    c=z*h
    d=(w-i)*v
    e=(w-i)*(h-v)
    ans=min(ans,max(a,b,c)-min(a,b,c),max(a,d,e)-min(a,d,e))
  print(ans)

Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std ; 
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fast ios_base:: sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long int 
#define pb push_back
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second


int main(){
    fast;
    int n,m; cin >> n >> m;
    int h[m+1]={};
    for(int i=0 ; i<n ; i++){
        int p; cin >> p;
        for(int i=0 ; i<p ; i++){
            int x; cin >> x;
            h[x]++;
        }
    }
    int c=0;
    for(int i=1 ; i<m+1 ; i++){
        if(h[i]>=n)
            c++;
    }
    cout << c << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (int i = j; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	string s; cin>>s;
	ll n=s.size();
	ll cnt=0;
	rep(i,0,n-1){
		if(s[i]!=s[i+1]) cnt++;
	}
	cout<<cnt;
	
	return 0;
}

Measured memory_bytes: 512
#include<cstdio>
#define MN 2000
#define MOD 1000000007
int f[MN+5][MN+5];
inline int mod(int x){return x<MOD?x:x-MOD;}
int main()
{
	int n,k,i,j;
	scanf("%d%d",&n,&k);
	for(i=0;i<n;++i)f[0][i]=1;
	for(i=1;i<k;++i)for(j=0;j<n;++j)
	{
		f[i][j]=mod((j?f[i][j-1]:0)+f[i-1][j]);
		if(i>=j)f[i][j]=mod(f[i][j]+MOD-(j?f[i-1][j-1]:0));
	}
	for(i=1;i<n-k;++i)f[k-1][n-1]=mod(f[k-1][n-1]<<1);
	printf("%d",f[k-1][n-1]);
}

Measured memory_bytes: 15872
while True:
    a, op, b = input().split()
    a = int(a)
    b = int(b)
    if op == '?':
        break
    elif op == '+':
        print(a + b)
    elif op == '-':
        print(a - b)
    elif op == '*':
        print(a * b)
    elif op == '/':
        print(a//b)

Measured memory_bytes: 7644
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd = readln.split.to!(int[]), a = rd[0], b = rd[1];
  auto pa = a == 1 ? 14 : a, pb = b == 1 ? 14 : b;
  if (pa == pb)     writeln("Draw");
  else if (pa > pb) writeln("Alice");
  else              writeln("Bob");
}


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

int main() {
  int N, K;
  cin >> N >> K;
  
  int i;
  int val = 1;
  for (i = 0; i < N; i++){
    if (val * 2 < val + K)
      val *= 2;
    else
      val += K;
  }
  cout << val << endl;
}


Measured memory_bytes: 256
x,y = list(map(int,input().split()))

ans = int(10e12)
tmp = abs(abs(x) - abs(y))
for b in range(-1,2,2):
  for bb in range(-1,2,2):
    cnt = tmp
    if b == -1:
      cnt += 1
    if bb == -1:
      cnt += 1
    if (x*b + tmp)*bb == y:
      ans = min(ans, cnt)
print(ans)

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

#define MAX_N 100000
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N, L;
	int a[MAX_N];
	stack<int> st;
	cin >> N >> L;
	for(int i=0; i<N; i++) cin >> a[i];
	for(int i=0; i<N-1; i++){
		if(a[i]+a[i+1]>=L){
			for(int j=i+1; j<=N-1; j++) st.push(j);
			for(int j=i; j>=1; j--) st.push(j);
			cout << "Possible" << endl;
			while(!st.empty()){
				cout << st.top() << endl;
				st.pop();
			}
			return 0;
		}
	}
	cout << "Impossible" << endl;
	return 0;
}


Measured memory_bytes: 1628
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
	int N, C;
	cin >> N >> C;
	vector<vector<int>> D(C, vector<int>(C)), c(N, vector<int>(N));
	for (int i = 0; i < C; i++) for (int j = 0; j < C; j++) cin >> D[i][j];
	for (int i = 0; i < N; i++) for (int j = 0; j < N; j++) cin >> c[i][j];

	int MIN = 500 * 500 * 1000;

	vector<vector<int>> Changes(3, vector<int>(C));
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j <= N; j++) {
			for (int Col = 0; Col < C; Col++) {
				Changes[(i + j) % 3][Col] += D[c[i - 1][j - 1] - 1][Col];
			}
		}
	}
	int Col[3];
	for (Col[0] = 0; Col[0] < C; Col[0]++) {
		for (Col[1] = 0; Col[1] < C; Col[1]++) {
			if (Col[0] == Col[1]) continue;
			for (Col[2] = 0; Col[2] < C; Col[2]++) {
				if (Col[0] == Col[2] || Col[1] == Col[2]) continue;
				MIN = min(MIN, Changes[0][Col[0]] + Changes[1][Col[1]] + Changes[2][Col[2]]);
			}

		}
	}
	cout << MIN << endl;
}

Measured memory_bytes: 1280
N, M, *_LR = map(int, open(0).read().split())
LR = list(zip(*[map(int, iter(_LR))]*2))

L_max = 1
R_min = N

for L,R in LR:
    L_max = max(L, L_max)
    R_min = min(R, R_min)

card_num = R_min - L_max + 1

if card_num < 0:
    print(0)
else:
    print(card_num)

Measured memory_bytes: 25076
#include "bits/stdc++.h"
using namespace std;
using ll     = long long;
using pii    = pair<int, int>;
using pll    = pair<ll, ll>;
using vi     = vector<int>;
using vl     = vector<ll>;
using vvi    = vector<vi>;
using vvl    = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

template <typename T>
vector<T> dijkstra(int s, vector<vector<pair<int, T>>> &G) {
    const T INF = numeric_limits<T>::max();
    using P     = pair<T, int>;
    int n       = G.size();
    vector<T> d(n, INF);
    vector<int> b(n, -1);
    priority_queue<P, vector<P>, greater<P>> q;
    d[s] = 0;
    q.emplace(d[s], s);
    while (!q.empty()) {
        P p = q.top();
        q.pop();
        int v = p.second;
        if (d[v] < p.first)
            continue;
        for (auto &e : G[v]) {
            int u = e.first;
            T c   = e.second;
            if (d[u] > d[v] + c) {
                d[u] = d[v] + c;
                b[u] = v;
                q.emplace(d[u], u);
            }
        }
    }
    return d;
}

int main() {
    ll n, u, v;
    cin >> n >> u >> v;
    u--, v--;
    vector<vector<pii>> edges(n);
    for (int i = 0; i < n - 1; ++i) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        edges[a].emplace_back(b, 1);
        edges[b].emplace_back(a, 1);
    }
    auto dist  = dijkstra(u, edges);
    auto dist2 = dijkstra(v, edges);
    // int dt     = 0;
    // int da     = 0;
    // int idxt   = -1;
    // int idxa   = -1;
    // for (int i = 0; i < n; ++i) {
    //     if (chmax(dt, dist[i]))
    //         idxt = i;
    //     if (chmax(da, dist2[i]))
    //         idxa = i;
    // }
    int atot = dist2[u];
    atot /= 2;

    vector<vector<pii>> edges2(n);
    for (int i = 0; i < n; ++i) {
        if (dist2[i] > atot) {
            for (auto &p : edges[i]) {
                if (dist2[i] > atot)
                    edges2[i].emplace_back(p.first, p.second);
            }
        }
    }
    auto dist3 = dijkstra(u, edges2);
    int ret    = 0;
    for (int i = 0; i < n; ++i) {
        if (dist3[i] < 1000000)
            chmax(ret, dist2[i]);
    }
    cout << ret - 1 << "\n";

    return 0;
}


Measured memory_bytes: 14232
use std::io;

fn main() {
    let (h, w) = {
        let i = read::<usize>();
        (i[0], i[1])
    };
    if h == 1 || w == 1 { println!("1"); }
    else {
        println!("{}", (h * w + 1) / 2);
    }
}

#[allow(unused)]
fn read<T>() -> Vec<T>
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}


#[allow(unused)]
fn read_one<T>() -> T
where
    T: std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

Measured memory_bytes: 2116
#include <stdio.h>

int stack[100];
int n = 0;

int pop(void);
void push(int);

int main(){
  int a, b, x, y;
   while ((a = getchar())!='\n'){

     if (isdigit(a)){
       ungetc(a, stdin);
       scanf("%d", &b);
       push(b);
     }
     else {
       switch(a) {

       case '+':
	 x = pop();
	 y = pop();
	 push(x + y);
	 break;

       case '-':
	 x = pop();
	 y = pop();
	 push(y - x);
	 break;

       case '*':
	 push(pop()*pop());
	 break;

       }
     }
   }

   printf("%d\n",stack[1]);
   
   return 0;
  
}

int pop(){
  int A = stack[n];
  n--;
  return A;
}

void push(int p){
  n++;
  stack[n] = p;
}


  


Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll ;
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
 const ll inf=1e9+7;
ll dp[50][3000];
int main()
{
    fast;
    
 char c;
 cin>>c;
 
 if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
 {
 	cout<<"vowel";
 	
	}
	else
	cout<<"consonant";   
    
}

		
	
	
	
	


Measured memory_bytes: 3592
#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#include <climits>
#include <map>
#include <stack>
using namespace std;
#define M_PI 3.141592
#define toRad 2.0*M_PI/360.0
#define inin(x) int x;cin>>x;
#define all(x) x.begin(),x.end()
#define debug(x) cout<<#x<<" "<<x<<endl;
#define rep(i,n) for(int i=0;i<(int)n;i++)
typedef pair<int, int> pii;

int main()
{
	char y[4] = "ABC";
	int x[3] = { 1,0,0 };
	char a, b, t;
	while (cin >> a >> t >> b)
	{
		swap(x[a - 'A'], x[b - 'A']);
	}
	for (int i = 0; i < 3; i++)
	{
		if (x[i])
		{
			cout << y[i] << endl;
			return 0;
		}
	}
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    string s;
    t = 1;
    while(t--) {
     cin >> s;
     sort(s.begin( ), s.end( ));
     if(s[0] != s[1] && s[1] != s[2])
      cout << "Yes" << endl;
     else
      cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define ov(a) for(ll i=0;i<a.size();i++)cout<<a[i]<<" ";nl
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
int main()
{
	fastio();
	ll N,M;
	cin>>N>>M;
	ll ar[N][M];
	for(ll i=0;i<N;i++)
	{
		string s;
		cin>>s;
		for(ll j=0;j<M;j++)
		{
			if(s[j]=='.')
				ar[i][j]=0;
			else
				ar[i][j]=-1;
		}
	}
	ar[0][0]=1;
	for(ll i=1;i<N;i++)
	{
		if(ar[i][0]==-1)
			break;
		ar[i][0]=1;
	}
	for(ll i=1;i<M;i++)
	{
		if(ar[0][i]==-1)
			break;
		ar[0][i]=1;
	}
	for(ll i=1;i<N;i++)
	{
		for(ll j=1;j<M;j++)
		{
			if(ar[i][j]==-1)
				continue;
			if(ar[i-1][j]!=-1)
				ar[i][j]=(ar[i][j]+ar[i-1][j])%MOD;
			if(ar[i][j-1]!=-1)
				ar[i][j]=(ar[i][j]+ar[i][j-1])%MOD;	
		}
	}
	cout<<ar[N-1][M-1]%MOD<<endl;
}	


Measured memory_bytes: 8064
#include <iostream>

using namespace std;

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

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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    int N;
    cin >> N;
    cout << (N <= 999 ? "ABC" : "ABD") << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;

using namespace std;

int main(){
    int n,k;
    cin >> n >> k;
    vector<ll> v(n);
    for(int i=0;i<n;i++) cin >> v[i];

    ll ans = 0;
    for(int a=0;a<=min(n,k);a++){
        for(int b=0;a+b<=min(n,k);b++){
            vector<ll> w;
            ll have=0;
            for(int i=0;i<a;i++){
                w.push_back(v[i]);
                have += v[i];
            }
            for(int i=0;i<b;i++){
                w.push_back(v[n-i-1]);
                have += v[n-i-1];
            }
            sort(w.begin(), w.end());

            for(int i=0;i< min(k-a-b,(int)w.size());i++){
                if(w[i]<0){
                    have-=w[i];
                }
            }
            ans=max(ans,have);
        }
    }

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



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

int main() {
    int n, people[4][3][10] = {};
    cin >> n;
    for (int i = 0; i < n; i++) {
        int b, f, r, v;
        cin >> b >> f >> r >> v;
        people[b-1][f-1][r-1] += v;
    }

    for (int b = 0; b < 4; b++) {
        for (int f = 0; f < 3; f++) {
            for (int r = 0; r < 10; r++) {
                cout << " " << people[b][f][r];
            }
            cout << endl;
        }

        if (b < 3) printf("####################\n");
    }
}

Measured memory_bytes: 1160
#include <stdio.h>
#define SZ 100010
long long min(long long a,long long b){return (a<b)?a:b;}
void MRoy(){
    long long n,a[SZ],b[SZ];
    scanf("%lld",&n);
    for(long long i = 0;i<=n;i++){
        scanf("%lld",a+i);
    }
    for(long long i = 0;i<n;i++){
        scanf("%lld",b+i);
    }
    long long Ans = 0;
    for(long long i = 0;i<n;i++){
        long long t = min(a[i],b[i]);
        Ans += t;
        b[i]-=t;
        t = min(a[i+1],b[i]);
        Ans += t;
        a[i+1]-=t;
    }
    printf("%lld\n",Ans);
    return;
}
int main(){
    MRoy();
    return 0;
}

Measured memory_bytes: 1664
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int dataset = Integer.parseInt(br.readLine());
		String str;

		for(int i = 0; i < dataset; i++) {
			str = br.readLine();
			String strline[] = str.split(" ", 0);

			int line[] = new int[strline.length];
			for(int j = 0; j < 3; j++) {
				line[j] = Integer.parseInt(strline[j]);
			}
			Arrays.sort(line);

			if(Math.pow((double)line[2], 2) == Math.pow((double)line[0], 2) + Math.pow((double)line[1], 2)) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}
}

Measured memory_bytes: 26044
n=int(input())
s=[''.join(sorted(list(input()))) for _ in range(n)]
s.sort()
t=list(sorted(set(s)))

count=[1]*len(t)
j=0
for i in range(1,n):
  if t[j]==s[i]:
    count[j]+=1
  else:
    j+=1

ans=0
for i in range(len(t)):
  ans+=((count[i])*(count[i]-1))//2
  
print(ans)


Measured memory_bytes: 16360
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    int i;
    string S;
    cin>>N;
    map<string,int>mp;
    for(i=0;i<N;i++){
        cin>>S;
        mp[S]+=1;
    }
    int max;
    for(const auto& e : mp){
        int x = e.second;
        if(x>max)max=x;
    }
    for(auto it = mp.begin();it != mp.end();it++){
        if(it->second == max)cout << it->first <<endl;
    }
}

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

using ll = long long;
using P = pair<ll, ll>;

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

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

ll a, b;
char grid[110][110];

int main(int argc, char **argv)
{
	cin >> a >> b;
	ll k = 100;
	REP(h, 50)REP(w, 100) grid[h][w] = '#', grid[h+50][w] = '.';
	REP(i, a-1)
	{
		ll w = i*2;
		ll h = (w / 100) * 2;
		w %= 100;
		grid[h][w] = '.';
	}
	REP(i, b-1)
	{
		ll w = i*2;
		ll h = (w / 100) * 2;
		w %= 100;
		grid[h + 51][w] = '#';
	}

	std::cout << "100 100" << std::endl;
	REP(h, 100)
	{
		REP(w, 100) std::cout << grid[h][w];
		std::cout << std::endl;
	}
		
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
#include <set>
#include <sstream>
#include <bitset>
#include <string>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define all(x) (x).begin(),(x).end()
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)

int main() {
  int r, D, x; cin >> r >> D >> x;
  rep(i,10){
    x = r*x-D;
    cout << x << endl;
  }
  return 0;

}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#define REP(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 1
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif


//改造
typedef long long int ll;
using namespace std;


//ここから編集する


int main() {
    string s;
    cin >> s;
    if(s.length() < 3){
        cout << "No" << endl;
        return 0;
    }
    if(s[0] == 'Y' && s[1] == 'A' && s[2] == 'K' && s[3] == 'I'){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;

    return 0;
}


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

typedef long long ll;
const ll MOD = 1e9+7;

int p[105];
int n;
int c[3],a,b;

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

    cin>>n;
    cin>>a>>b;

    for(int i=1;i<=n;i++){
        cin>>p[i];
        if(p[i]<=a)c[0]++;
        else if(p[i]>a&&p[i]<=b)c[1]++;
        else c[2]++;
    }
    cout<<min(c[0],min(c[1],c[2]));
    return 0;
}


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

using namespace std;

int main() {
    int N; cin>>N;
    vector<double> v(N);

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

    sort(v.begin(), v.end());

    double n=0.0;
    for (int i=0;i<N-1;i++) {
        n = (v[i] + v[i+1])/2;
        v[i+1] = n;
    }
    
    cout << std::setprecision(10) << v[N-1] << endl;

    return 0;
}


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


int main() {
	
	string s;
	cin >> s;
	int t=s.size();
	int cnt=0;
	for(int i=0; i<t/2; i++){
		if(s.at(i)!=s.at(t-1-i)) cnt++;
	}
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(long long N, long long P, vector<long long> A){
	ll o = 0;
	rep(i, N) {
		if (A[i]%2 == 1) o++;
	}
	ll sum = 0, c = 1;
	repn(i, o) {
		c = c*(o+1-i)/i;
		if (i%2 == 1) {
			sum += c;
		}
	}
	if (P == 0) cout << (1LL<<N)-sum*(1LL<<(N-o)) << endl; else cout << sum*(1LL<<(N-o)) << endl;
}

int main(){	
	long long P;
	long long N;
	scanf("%lld",&N);
	vector<long long> A(N-1+1);
	scanf("%lld",&P);
	for(int i = 0 ; i <= N-1 ; i++){
		scanf("%lld",&A[i]);
	}
	solve(N, P, A);
	return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,a,b,c;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%d %d %d",&a,&b,&c);
        if((a*a==b*b+c*c)||(b*b==a*a+c*c)||(c*c==a*a+b*b))
            printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
const int N = 11111;
int n, n1, n2, ans, _a[N], _b[N], *a = _a + 5000, *b = _b + 5000;
char s1[N], s2[N];
int main(){
	scanf("%d%s%s", &n, s1 + 1, s2 + 1);
	if(s1[1] != s2[1]) a[++ n1] = 0;
	for(Rint i = 1;i < n;i ++){
		if(s1[i] != s1[i + 1]) a[++ n1] = i;
		if(s2[i] != s2[i + 1]) b[++ n2] = i;
	}
	for(Rint i = n1 + 1;i <= 5000;i ++) a[i] = n;
	for(Rint i = n2 + 1;i <= 5000;i ++) b[i] = n;
	ans = 1e9;
	for(Rint i = -n1;i <= n2;i ++) if(!(i & 1)){
		int tmp = 0;
		for(Rint j = -5000;j <= 5000;j ++)
			if(i + j >= -5000 && i + j <= 5000) tmp += abs(a[i + j] - b[j]);
			else {
				if(i + j < -5000) tmp += b[j];
				else tmp += n - b[j];
			}
		ans = min(ans, tmp);
	}
	printf("%d", ans);
}

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

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
int n=0;
int a;
int b;
cin>>n>>a>>b;
    int v=min(n*a,b);
    cout<<v;
    return 0;
}


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

int main(){
    int k, x;
    cin >> k >> x;
    for (int i = x-k+1; i < x+k; i++){
        cout << i << " ";
    }
    cout <<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  vector<int64_t>A(3*N);
  for(int i=0;i<3*N;i++)
    cin>>A.at(i);
  int64_t a=0;priority_queue<int64_t, vector<int64_t>, greater<int64_t> >que1;
  for(int i=0;i<N;i++){a+=A.at(i); que1.push(A.at(i));}
  vector<int64_t>B(3*N);vector<int64_t>C(3*N);
  B.at(N-1)=a;
  for(int i=N;i<2*N;i++){
  a+=A.at(i);que1.push(A.at(i));
    int64_t b=que1.top(); que1.pop();
    a-=b; B.at(i)=a;
  }int64_t c=0;priority_queue<int64_t, vector<int64_t>, greater<int64_t> > que2;
  for(int i=3*N-1;2*N<=i;i--){c-=A.at(i);que2.push(-A.at(i));}
  C.at(2*N)=c;
  for(int i=2*N-1;N<=i;i--){
  c-=A.at(i); que2.push(-A.at(i));
    int64_t b=que2.top();que2.pop();
    c-=b;C.at(i)=c;
  }int64_t ans=-1000000000000000;
  for(int i=N-1;i<2*N;i++)
    if(ans<B.at(i)+C.at(i+1))
      ans=B.at(i)+C.at(i+1);
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 12704