akhauriyash/Code-Regression huggingface dataset:
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);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            // 入力
            int n = Integer.parseInt(in.next());
            int X = Integer.parseInt(in.next());
            int x[] = new int[n];
            for (int i = 0; i < n; i++) {
                x[i] = Integer.parseInt(in.next());
            }
            long ans = 0;

            for (int i = 0; i < n; i++) {
                ans = gcd(ans, Math.abs(X - x[i]));
            }

            // 出力
            out.println(ans);

        }

        public static long gcd(long num1, long num2) {
            if (num2 == 0) return num1;
            else return gcd(num2, num1 % num2);
        }

    }
}



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

typedef unsigned long long int llu;

unsigned long long int N,X;
unsigned long long int sort[101];
unsigned long long int buffer[100];

void mergeSort(llu n, llu x[]) {
	llu i, j, k, m;
	if(n <= 1) {
		return;
	}
	m = n / 2;

	mergeSort(m, x);
	mergeSort(n - m, x + m);

	for(i = 0; i < m; i++) {
		buffer[i] = x[i];
	}
	j = m;
	i = k = 0;
	while(i < m && j < n) {
		if(buffer[i] <= x[j]) {
			x[k++] = buffer[i++];
		}
		else {
			x[k++] = x[j++];
		}
	}
	while(i < m) {
		x[k++] = buffer[i++];
	}
}
llu ans = 0;
int main() {
	scanf("%llu %llu", &N, &X);
	for(unsigned long long i = 0; i < N; i++) {
		scanf("%llu", &sort[i]);
	}
	mergeSort(N, sort);
	llu sum = 0;
	// for (int i = 0; i < N; i++) {
	// 	printf("%llu\n", sort[i]);
	// }
	sort[N] = 1;
	for(int i = 0; i < N + 1; i++) {
		sum += sort[i];
		// printf("%d\n", sort[i]);
		if(X < sum) {
			printf("%d\n", i);
			return 0;
		}
	}
	printf("%d\n", N - 1);
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <ctype.h>
    
int par[100000];
    
void init(int);
int dep(int);
int inp(void);
   
char *p;
char in[1500000];
int tree[100000][15],idx[100000];
   
int main(){
  int n,i,j,id,k,c;
   
  fread(in,sizeof(in),1,stdin);  
  p = in;
   
  n = inp(); init(n);
  for(i = 0 ; i < n ; i++){
    id = inp();
    k = inp();
    for(j = 0 ; j < k ; j++){
      c = inp();
      par[c] = id;
      tree[id][idx[id]++] = c;
    }
  }
    
  for(i = 0 ; i < n ; i++){
    printf("node %d: parent = %d, depth = %d, "
           ,i,par[i],dep(i));
       
    if(par[i] == -1){
      printf("root, [");
    }else if(!idx[i]){
      printf("leaf, [");
    }else{
      printf("internal node, [");
    }
   
    for(j = 0 ; j < idx[i] ; j++){
      printf("%d",tree[i][j]);
      if(j < idx[i]-1) printf(", ");
    }
    puts("]");
  }
  return 0;
}
   
void init(int n){
  int i;
  for(i = 0 ; i < n ; i++){
    par[i] = -1;
  }
}
   
int dep(int x){
  if(par[x] == -1) return 0;
  return dep(par[x]) + 1;
}
   
int inp(){
  int v = 0;
  while(!isdigit(*p)) ++p;
  v = *p++&15;
  while(isdigit(*p)){
    v = (v<<3)+(v<<1)+(*p++&15);
  }
  return v;
}

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

char a [100][101] , b [102][102];
int main () {
int H,W; cin >> H >> W ;
for ( int i = 0; i < H ; i ++)
scanf ("%s" , a [ i ]);
for ( int i = 0; i < H + 2; i ++)
for ( int j = 0; j < W + 2; j ++)
b [ i ][ j ] = '#';
for ( int i = 0; i < H ; i ++)
for ( int j = 0; j < W ; j ++)
b [ i + 1][ j + 1] = a [ i ][ j ];
for ( int i = 0; i < H + 2; i ++) {
for ( int j = 0; j < W + 2; j ++)
cout << b [ i ][ j ];
cout << endl ;
}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <regex>
#include <set>
#include <cmath>
#include <sstream>
#include <numeric>
#include <set>
#include <unordered_map>

struct Data
{
    long long id;
    long long order;
};

int main()
{
    long long n;
    std::vector<Data> data;
    std::vector<long long> ans;

    std::cin >> n;
    for(long long i = 0; i < n; i++)
    {
        Data temp{i, 0};
        std::cin >> temp.order;
        data.push_back(temp);
    }

    std::sort(data.begin(), data.end(), [](auto lhs, auto rhs){return lhs.order < rhs.order;});

    for(auto elem : data)
    {
        std::cout << elem.id + 1<< " ";
    }

    return EXIT_SUCCESS;
}


Measured memory_bytes: 2544
HW = input().split()
H = int(HW[0])
W = int(HW[1])

while H != 0 or W != 0:
    for j in range(W):
        print("#", end = "")
    print("")
    if W>1:
        if H>1:
            for i in range(H-2):
                print("#", end = "")
                for j in range(W-2):
                    print(".", end = "")
                print("#", end = "")
                print("")
            for j in range(W):
                print("#", end = "")
            print("")  
    HW = input().split()
    H = int(HW[0])
    W = int(HW[1])
    print("")

Measured memory_bytes: 8976
#include <iostream>

using namespace std;

int main(){
    long Q, H, S, D;
    long N;
    long ans;
    cin >> Q >> H >> S >> D;
    cin >> N;
    if(D < 2*S && D < 4*H && D < 8*Q){
        ans = (N/2)*D;
        if(N%2 == 1){
            long tmp;
            tmp = min(4*Q, 2*H);
            tmp = min(tmp, S);
            ans += tmp;
            //cout << tmp << endl;
        }
    }else{
        ans = min(4*Q*N, 2*H*N);
        ans = min(ans, S*N);
    }
    cout << ans << endl;
}

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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ll long long
#define ALL(a) (a).begin(),(a).end()
#define SORT(v) sort(ALL(v))
//#define scanf scanf_s
typedef pair<int, int> P;

int n;
int w, h;
int tizu[300][300];
int main()
{
	while (cin >> n, n)
	{
		memset(tizu, 0, sizeof(tizu));
		cin >> w >> h;
		REP(i, n)
		{
			int x, y;
			cin >> x >> y;
			tizu[y-1][x-1] = 1;
		}
		int s, t;
		cin >> s >> t;
		int ans = 0;
		for (int i = 0; i < h; i++)
		{
			for (int j = 0; j < w; j++)
			{
				int cnt = 0;
				REP(k, t)REP(l, s)
				{
					cnt += tizu[k + i][l + j];
				}
				ans = max(cnt, ans);
			}
		}
		cout << ans << endl;

	}		
	return 0;
}

Measured memory_bytes: 1524
import sys
def put(x):
    #global n
    #n = x
    print('?', x)
def get():
    #global n, N
    #return (int(N)>=int(n) and str(N)>=str(n)) or (int(N)<int(n) and str(N)<str(n))
    return input() == 'Y'
for i in range(1, 12)[::-1]:
    put(10**(i-1))
    if get():
        m = i
        break
if m>=11:
    for i in range(1, m):
        put(10**i-1)
        if get():
            print('!', 10**(i-1))
            break
else:
    ng = 10**m
    ok = 10**(m-1)
    while(ng-ok>1):
        mid = (ok+ng)//2
        put(str(mid)+'0'*1)
        if not get():ok = mid
        else: ng = mid
    print('!', ok+1)



Measured memory_bytes: 38848
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		try (BufferedReader br = new BufferedReader(
				new InputStreamReader(System.in))) {

			String in = br.readLine();
			String chr[] = in.split(" ");
			int n = Integer.parseInt(chr[0]);
			int m = Integer.parseInt(chr[1]);
			System.out.println((n-1)*(m-1));

		}
	}
}


Measured memory_bytes: 25336
#include <iostream>
#include <vector>
#include <queue>
#include <map>

using namespace std;

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

int main() {

	long long int n, k, l;
	cin >> n >> k >> l;

	vector< vector<long long int> > dmp(n);
	vector< vector<long long int> > tmp(n);

	long long int p, q, r, s;

	for (long long int i = 0; i < k; i++) {
		cin >> p >> q;
		p--;
		q--;
		dmp[p].push_back(q);
		dmp[q].push_back(p);
	}

	for (long long int i = 0; i < l; i++) {
		cin >> r >> s;
		r--;
		s--;
		tmp[r].push_back(s);
		tmp[s].push_back(r);
	}

	vector<long long int> dd(n, 0);
	vector<long long int> tt(n, 0);

	long long int dp, tp;

	dp = tp = 1;

	for (long long int i = 0; i < n; i++) {
		if (dd[i] == 0) {
			dd[i] = dp;
			queue<long long int> q;
			q.push(i);
			while (!q.empty()) {
				long long int qq = q.front();
				q.pop();
				for (long long int j = 0; j < dmp[qq].size(); j++) {
					if (dd[dmp[qq][j]] == 0) {
						dd[dmp[qq][j]] = dp;
						q.push(dmp[qq][j]);
					}
				}
			}
			dp++;
		}
		if (tt[i] == 0) {
			tt[i] = tp;
			queue<long long int> q;
			q.push(i);
			while (!q.empty()) {
				long long int qq = q.front();
				q.pop();
				for (long long int j = 0; j < tmp[qq].size(); j++) {
					if (tt[tmp[qq][j]] == 0) {
						tt[tmp[qq][j]] = tp;
						q.push(tmp[qq][j]);
					}
				}
			}
			tp++;
		}
	}

	map<P, long long int> mp;

	for (long long int i = 0; i < n; i++) {
		mp[P(dd[i], tt[i])]++;
	}

	for (long long int i = 0; i < n - 1; i++) {
		cout << mp[P(dd[i], tt[i])] << ' ';
	}
	cout << mp[P(dd[n - 1], tt[n - 1])] << endl;
	return 0;
}

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

int main(){
  const int MOD = 1000000000+7;
  long res=1;
  long n;
  cin >> n;

  while(n>0){
    res = (n%MOD)*(res%MOD);
    --n;
  }

  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
n=int(input())
m=list(map(int,input().split()))
h=list(map(int,input().split()))
a=0
for i in range(n):
  if h[i]<m[i]:
    a+=h[i]
  else:
    a+=m[i]
    r=h[i]-m[i]
    s=min(m[i+1],r)
    a+=s
    m[i+1]-=s
print(a)

Measured memory_bytes: 82148
#include <algorithm>
#include <inttypes.h>
#include <iostream>
#include <climits>
#include <cstring>

using namespace std;

const int cap = 1e5 + 1;
int N, W, w, v;
int64_t dp[cap];

int main() {
    scanf("%d %d", &N, &W);
    fill(dp, dp + W + 1, 0);
    for (int i = 1; i <= N; ++i) {
        scanf(" %d %d", &w, &v);
        for (int j = W; j >= w; --j) {
            dp[j] = max(dp[j], dp[j - w] + v);
        }
    }
    printf("%" PRId64 "\n", dp[W]);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using lint = long long;

signed main(){
  lint N, A, B; cin >> N >> A >> B;
  vector<lint> x(N);
  for(lint i = 0; i < N; i++) cin >> x[i];
  lint ans = 0;
  for(lint i = 0; i < N - 1; i++){
    ans += min((x[i + 1] - x[i]) * A, B); 
  }
  cout << ans << endl;
}

Measured memory_bytes: 1024
/*   ꧁༒☬महाकाल☬༒꧂ ꧁༒ঔमहाकालঔ༒꧂
                   
                   ঔৣ۝महाकालᴳᵒᵈ۝ঔৣ            
 
 */ 
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops"
#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;
//template <typename T, typename cmp=less<T>> using oset =tree<T, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
#define ll long long 
#define mod 1000000007
#define MOD 998244353
#define inf 100000000000000000
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _it iterator
#define all(_x) _x.begin(),_x.end()
#define f first
#define s second
#define pb push_back
#define ar array
#define ld long double

void mahakal(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	freopen("error.txt","w",stderr);
	#endif
}
ll dx[4]={1,0,-1,0};
ll dy[4]={0,1,0,-1};
// char c[4]={'D' , 'R' , 'U' , 'L'};
const ll maxN=3e5+5;
ll n , k;
ar<ll,2> a[maxN];
void solve(){
  cin>> n ;
  ll ans=0;
  for(ll A=1;A<=n ; A++){
      for(ll B=1;B<=n ; B++){
          if(A*B>=n)break;
          ll ps = n - A*B;
          ans++;
      }
  }
  cout<<ans<<endl;
}

int main(){
// 	mahakal();
	fast;
	ll t =1 ;
// 	cin>> t ; 
	while(t--)solve();
// 	cerr << "\ntime taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl; 
	return 0;
}


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

int main() {
  int n;
  cin >> n;
  
  int a = n % 10;
  int b = (n % 100 - a) / 10;
  int c = (n % 1000 - a - b * 10) / 100;
  int d = (n - a - b * 10 - c * 100) / 1000;
  //n = dcba
  
  if (a - b == 0 && a - c == 0){
    cout << "Yes" << endl;
  } //abcが一緒、あるいはabcd
  else if (c - b == 0 && c - d == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//main code

int main(int argc, char const* argv[])
{
	int n;
	cin >> n;
	stack<LL> st;
	queue<LL> p;
	string ans = "";
	for (int i = 0; i < n; i++) {
		int k;
		cin >> k;
		p.push(k);
	}
	for (int i = 1; i <= n; i++) {
		ans += "(";
		st.push(i);
		while (st.size() != 0 and st.top() == p.front()) {
			ans += ")";
			st.pop();
			p.pop();
		}
	}
	if (p.size() == 0) {
		cout << ans << endl;
	}
	else {
		cout << ":(" << endl;
	}

	return 0;
}



Measured memory_bytes: 4532
n = gets.to_i
words = Array.new(n){ gets.chomp.unpack("C*").sort.pack("U*") }

h = Hash.new
ans = 0
words.each do |s|
  
  if h.has_key?(s)
    h[s] += 1
    ans += h[s]
    p 
  else
    h[s] = 0
  end
end

puts ans

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

int main(void){
    string S;
    cin >> S;
    int lenS=S.size();

    long long ans=0;
    for(int i=0; i<pow(2,lenS-1); i++){
        string str="";
        for(int j=0; j<lenS-1; j++){
            str += S[j];
            if(i&(1<<(lenS-2-j))) str += '+';
        }
        str += S[lenS-1]; //strは与えられた数値のなかに＋が混ざった式になっている
        //cout << str << endl;
        // 式strを評価してansに加える
        int k=0;
        string tmp[lenS];
        for(int l=0; l<str.size(); l++){
            if(str[l]!='+') tmp[k]+=str[l];
            else k++;
        }
        for(int m=0; m<=k; m++) ans+=stoll(tmp[m]);
    }

    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
def main():
    input()
    t = list(map(int, input().split()))
    ans = 0
    for i in range(len(t) - 1):
        for j in range(i + 1, len(t)):
            ans += t[i] * t[j]
    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main
{

  public static void main
  (
    String[] args
  )
  {
    BufferedReader in_stream;
    String         in_str;
    String[]       in_str_split;

    int in_N;
    int in_A;
    int in_B;

    int    cnt;
    String str;
    int    cnt_str;
    int    sum;
    int    ans;

    try
    {

      in_stream    = new BufferedReader(new InputStreamReader(System.in));
      in_str       = new String(in_stream.readLine());
      in_str_split = in_str.split(" ");


      in_N = Integer.parseInt(in_str_split[0]);
      in_A = Integer.parseInt(in_str_split[1]);
      in_B = Integer.parseInt(in_str_split[2]);

      ans = 0;
      for(cnt=1; cnt<=in_N; cnt++)
      {
        str = "" + cnt;

        sum = 0;
        for(cnt_str=0; cnt_str<str.length(); cnt_str++)
        {
          sum += Integer.parseInt(str.substring(cnt_str, cnt_str+1));
        }

        if((in_A <= sum) && (sum <= in_B))
        {
          ans += cnt;
        }
      }

      UtilLog.ans_ln("" + ans);
    }
    catch(Exception e)
    {
      e.printStackTrace();
    }
  }
}

class UtilLog
{
  private static boolean is_debug_mode = false;



  public static void ans_ln
  (
    String i_message
  )
  {
    System.out.println(i_message);
  }



  public static void ans_f
  (
    String i_message
  )
  {
    System.out.printf(i_message);
  }



  public static void inf_ln
  (
    String i_message
  )
  {
    StackTraceElement[] stack;


    if(is_debug_mode)
    {
    stack = new Throwable().getStackTrace();

    System.out.println
      (
        String.format
          (
            "[inf][%s:%s():%5d]",
            stack[1].getClassName(),
            stack[1].getMethodName(),
            stack[1].getLineNumber(),
            i_message
          )
      );
    }
  }
}


Measured memory_bytes: 24020
#include<bits/stdc++.h>
#define ll long long int
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
int main()
{
    FAST();
    ll n,i,j,k,a,b;
    cin>>a>>b;
    if(a+b>=10)
        cout<<"error"<<endl;
    else
        cout<<a+b<<endl;

    return 0;
}


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


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

    cout << A * B / 2 << endl;
}

Measured memory_bytes: 3588
#include <iostream>
#include <algorithm>
#define ll long long
#define endl "\n"
#define __ ios::sync_with_stdio(0), cin.tie(NULL);
using namespace std;

int n,a,b;

int main(){
	cin >> n >> a >> b;
	if((b-a)&1) cout << "Borys\n";
	else cout << "Alice\n";
}

Measured memory_bytes: 256
N,K = gets.split.map &:to_i
H = gets.split.map &:to_i
DP = [0]
 
1.upto(N-1) do |i|
  min = Float::INFINITY
  [0, i-K].max.upto(i-1) do |j|
    cost = (H[i] - H[j]).abs + DP[j]
    min = cost if min > cost
  end
  DP[i] = min
end
 
p DP[-1]

Measured memory_bytes: 21208
#include "atcoder/lazysegtree"
#include "atcoder/modint"
#include <cstdio>

using namespace std;
using namespace atcoder;

using mint = modint998244353;
const mint inv9 = mint(1) / 9;
struct S {
	mint x;
	mint w;
	S(mint x = 0, mint w = 1) :x(x), w(w) {}
};
using F = long long;
const F ID = 8e18;
//S =S * S;
S op(S a, S b) { return { a.x*b.w + b.x, a.w * b.w }; }
//Sの単位元
S e() { return S(); }
//S = f(x);
S mapping(F f, S a) {
	if (f != ID) a.x = (a.w - 1) *inv9 * f;
	return a;
}
//F = f * g;
F composition(F f, F g) { return (f == ID ? g : f); }
//Fの単位元
F id() { return ID; }

int main() {
	int N, Q;
	cin >> N >> Q;
	vector<S> a(N);
	mint p = 1;
	for (int i = N - 1; i >= 0; i--) {
		a[i] = S{ 1, p };
		p *= 10;
	}
	atcoder::lazy_segtree<S, op, e, F, mapping, composition, id> seg(N);
	for (int i = 0; i < N; ++i) {
		seg.set(i, S(1, 10));
	}
	for (int i = 0; i < Q; ++i) {
		int l, r, d;
		cin >> l >> r >> d;
		l--;
		r--;
		seg.apply(l, r + 1, d);
		cout << seg.all_prod().x.val() << endl;
	}
}


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

typedef long long ll;

// string r = "4";
// string g = "3";
// string b = "2";
string r, g, b;

int main() {
    cin >> r >> g >> b;

    string num = "";
    num += r;
    num += g;
    num += b;

    // cout << stoi(num) << endl;
    if (stoi(num) % 4 == 0) {
        printf("YES\n");
    } else {
        printf("NO\n");
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
  string S;
  cin >> S;
  int answer = 0;
  for(int i = 0; i < S.size(); i++){
    for(int j = 0; j < S.size(); j++){
      if(i != j && S.at(i) == S.at(j)){
        answer++;
      }
    }
  }
  if(answer == 0){
    cout << "yes" << endl;
  }
  else{
    cout << "no" << endl;
  }
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int buf;
	int top[3];
	int i;

	top[0] = 0;
	top[1] = 0;
	top[2] = 0;

	for (i = 0; i < 10; i++){
		scanf("%d", &buf);

		if (buf > top[2]){
			if (buf > top[1]){
				top[2] = top[1];
				if (buf > top[0]){
					top[1] = top[0];
					top[0] = buf;
				}
				else {
					top[1] = buf;
				}
			}
			else {
				top[2] = buf;
			}
		}
	}

	for (i = 0; i < 3; i++){
		printf("%d\n", top[i]);
	}

	return 0;
}


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

Measured memory_bytes: 4412
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int N = scan.nextInt();
    int M = scan.nextInt();
    int[] H = new int[N];
    boolean[] judge = new boolean[N];
    for(int i=0; i<N; i++) {
      H[i] = scan.nextInt();
      judge[i] = true;
    }
    for(int i=0; i<M; i++) {
      int A = scan.nextInt();
      int B = scan.nextInt();
      if(H[A-1] < H[B-1]) {
        judge[A-1] = false;
      }
      if(H[A-1] == H[B-1]) {
        judge[A-1] = false;
        judge[B-1] = false;
      }
      if(H[A-1] > H[B-1]) {
        judge[B-1] = false;
      }
    }
    scan.close();

    int count = 0;
    for(int i=0; i<N; i++) {
      if(judge[i]) {
        count++;
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 49720
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " \n"[i==n-1];};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A,B;
    cin >> A >> B;
    ll ans = (B - 1 + (A-2)) / (A-1);
    print(ans);
    
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * 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;
		FastScanner in = new FastScanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.close();
	}

	static class TaskB {
		int[] ans;
		boolean[] used;
		int p;

		public void solve(int testNumber, FastScanner in, PrintWriter out) {
			int n = in.nextInt();
			int x = in.nextInt();
			if (x == 1 || x == 2 * n - 1) {
				out.println("No");
				return;
			}
			if (n == 2) {
				if (x == 2) {
					out.println("Yes");
					out.println("1");
					out.println("2");
					out.println("3");
				} else {
					out.println("No");
				}
				return;
			}
			ans = new int[2 * n - 1];
			used = new boolean[2 * n];
			p = 1;
			put(n - 2, 2 * n - 1);
			put(n - 1, x);
			put(n, 1);
			for (int i = 2 * n - 1; i > 0; i--) {
				if (!used[i]) {
					put(n + 1, i);
					break;
				}
			}
			for (int i = 0; i < ans.length; i++) {
				if (ans[i] == 0) {
					putAnything(i);
				}
			}
			out.println("Yes");
			for (int u : ans) {
				out.println(u);
			}
			// show(ans);
		}

		private void put(int pos, int x) {
			ans[pos] = x;
			used[x] = true;
		}

		private void putAnything(int pos) {
			while (p < used.length && used[p]) {
				++p;
			}
			put(pos, p);
		}

	}

	static class FastScanner {
		private BufferedReader in;
		private StringTokenizer st;

		public FastScanner(InputStream stream) {
			in = new BufferedReader(new InputStreamReader(stream));
		}

		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(in.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}

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

	}
}



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

using namespace std;

void max_self(long long &a,long long b)
{
    a=max(a,b);
}
int main()
{
    int n;
    scanf("%d",&n);
    vector<int>h(n),a(n);
    for(int i=0;i<n;i++)
    {
        scanf("%d",&h[i]);
    }
    for(int i=0;i<n;i++)
    {
        scanf("%d",&a[i]);
    }
    int base=1;
    while(base<=n)
    {
        base*=2;
    }
    vector<long long>tree(2*base);
    vector<long long>dp(n+1);
    for(int flower=0;flower<n;flower++)
    {
        int x=h[flower]+base;
        long long best=0;
        while(x>1)
        {
            if(x%2==1)
            {
                max_self(best,tree[x-1]);
            }
            x/=2;
        }
        dp[h[flower]]=best+a[flower];
        for(int i=base+h[flower];i>=1;i/=2)
        {
            max_self(tree[i],dp[h[flower]]);
        }
    }   
    long long answer=0;
    for(int i=0;i<=n;i++)
    {
        max_self(answer,dp[i]);
    }
    printf("%lld\n",answer);
    return 0;
}

Measured memory_bytes: 7424
#include <cstdio>
#include <cmath>
#include <utility>
using namespace std;

struct Point { double x, y; };

void print(Point p) {
    printf("%f %f\n", p.x, p.y);
}

void koch(int d, Point p1, Point p2) {
    if (d == 0) { return; }

    Point s, t, u;
    double th = M_PI * 60.0 / 180.0;

    s.x = (2.0 * p1.x + 1.0 * p2.x) / 3.0;
    s.y = (2.0 * p1.y + 1.0 * p2.y) / 3.0;
    t.x = (1.0 * p1.x + 2.0 * p2.x) / 3.0;
    t.y = (1.0 * p1.y + 2.0 * p2.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;

    koch(d-1, p1, s);
    print(s);
    koch(d-1, s, u);
    print(u);
    koch(d-1, u, t);
    print(t);
    koch(d-1, t, p2);
}

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

    Point p1, p2;
    p1.x = 0;
    p1.y = 0;
    p2.x = 100;
    p2.y = 0;

    print(p1);
    koch(n, p1, p2);
    print(p2);

    return 0;
}


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

int main(){
    long long int n,r1,r2;
    long long int maxn=-1000000000;
    cin>>n>>r1;
    for(int i=0;i<n-1;i++){
        cin>>r2;
        maxn=max(maxn,r2-r1);
        if(r1>r2) r1=r2;
    }
    cout<<maxn<<endl;
    return 0;
}


Measured memory_bytes: 3100
#include<bits/stdc++.h>
#pragma optimize("Ofast")
using namespace std;

using ll = long long;
const int N = 1e5+5;

int main()
{
    ios_base::sync_with_stdio(0);

    int n;
    cin >> n;
    ll sum = 0;
    map<ll,ll> mp;
    for(int i = 0; i < n; ++i) {
        int x; cin >> x;
        mp[x]++;
        sum += x;
    }
    int q;
    cin >> q;
    while(q--) {
        int b,c;
        cin >> b >> c;
        sum -= mp[b]*b;
        sum += c*mp[b];
        mp[c] += mp[b];
        mp[b] = 0;
        cout << sum << "\n";
    }
    return 0;
}

Measured memory_bytes: 9508
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

int main() {
    int a, b; cin >> a >> b;
    for (int i = 1; i<=100000; ++i) {
        int c = i * 0.08;
        int d = i * 0.1;
        if (c == a && d == b) {
            cout << i << endl;
            return 0;
        }
    }
    cout << "-1" << endl;
    return 0;
}





















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

double x,y,a;
int main()
{
        double  mov,dir;
        while(scanf("%lf,%lf",&mov,&dir),mov||dir){
                x+=mov*sin(a*M_PI/180);
                y+=mov*cos(a*M_PI/180);
                a+=dir;
        }
        printf("%d\n%d\n",(int)x,(int)y);
        return 0;
}

Measured memory_bytes: 632
/*
 * じょえチャンネル
 * 高評価・チャンネル登録よろしくおねがいします！
 * https://www.youtube.com/channel/UCRXsI3FL_kvaVL9zoolBfbQ
 */
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define inf (int)(3e18)
#define P pair<int,int>
#define mod (int)(1e9+7)
template<class T> inline void chmin(T &a, T b) {
	a = min(a, b);
}
template<class T> inline void chmax(T &a, T b) {
	a = max(a, b);
}
int mod_pow(int x, int y, int m = mod) {
	int res = 1;
	x %= m;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int perm[1000005];
void init_perm(){
	perm[0]=1;
	REP(i,1000005)perm[i]=perm[i-1]*i%mod;
}
int nCk(int x,int y){
	if(x<y)return 0;
	return perm[x]*mod_pow(perm[x-y],mod-2)%mod*mod_pow(perm[y],mod-2)%mod;
}

int H,W,A,B;
signed main(){
	cin>>H>>W>>A>>B;
	int ans=0;
	init_perm();
	for(int i=B+1;i<=W;i++){
		int p=nCk(i-1+H-A-2,i-1);
		if(i==B+1)p+=nCk(i-2+H-A-1,i-2);
		p%=mod;
		int q=nCk(A+W-i,A);
		ans+=p*q%mod;
		ans%=mod;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 8064
n = input()
n = int(n)
myarray = []
for i in range(n):
        p = input()
        p = int(p)
        myarray.append(p)
darray = sorted(myarray, reverse=True)
sum = darray[0]/2
for k in range(n-1):
        sum = sum + darray[k+1]
print(int(sum))

Measured memory_bytes: 38256
import java.util.*;

public class Main {
    public static void run(List<Integer> As) {
        Collections.sort(As, Collections.reverseOrder());

        int as = 0, bs = 0;
        boolean isA = true;
        for (int a : As) {
            if (isA) {
                as += a;
            } else {
                bs += a;
            }
            isA = !isA;
        }

        System.out.println(as - bs);
    }

    public static void runInput() {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        List<Integer> As = new ArrayList<>(N);
        for (int i = 0; i < N; i++ ) {
            As.add(scanner.nextInt());
        }
        run(As);
    }

    public static void main(String args[]) {
        runInput();
        //run(Arrays.asList(2, 7, 4));
        //run(Arrays.asList(20, 18, 2, 18));
    }
}


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


int main()
{
 long long a;
 long long b;
 long long x;
 long long c;
 long long d;
 long long Ans;
 cin>>a>>b>>x;
 
 if(a!=0){c=(a-1)/x;
 }else{c=-1;} 
 d=b/x;
 
 Ans=d-c;
cout<<Ans<<endl;
 }


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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int t , n , x;
int a[MAXX];
string s;

int main()
{
    _FastIO;
    cin >> n >> x >> t;

    int k = n / x;
    if(n % x)
        k++;
    cout << k * t << endl;
    return 0;
}


Measured memory_bytes: 3656
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=53,MOD=1000000007;

long long C[MAXN][MAXN];
long long dp[MAXN][MAXN*2];//有i个数，和为1+j*V的方案数

int main()
{
	int n=0;
	scanf("%d",&n);
	C[0][0]=1;
	for(int i=1;i<=n;i++)
	{
		C[i][0]=1;
		for(int j=1;j<=n;j++)
			C[i][j]=(C[i-1][j-1]+C[i-1][j])%MOD;
	}
	int zero=n;
	dp[1][zero]=1;//2^0有一个
	dp[1][-1+zero]=1;//-2^0有一个
	for(int i=1;i<=n;i++)//有i个数
		for(int j=-i;j<=i;j++)//和为1+j*V（V不管是多少，反正为2的幂）
			if(dp[i][j+zero])
			{
				//printf("dp[%d][%d]=%lld\n",i,j,dp[i][j+zero]);
				for(int k=max(1,abs(j));k+i<=n;k++)//增加k个2*V
					for(int pos=0;pos<=k;pos++)//k个数中有pos个正数
					{
						int neg=k-pos;//neg个负数
						if((j+pos-neg)%2!=0)
							continue;
						int nsum=(j+pos-neg)/2;//新的和为1+nsum*2*V
						if(nsum<-n||nsum>n)
							continue;
						//i+k个中，选k个作为V值；k个中，选pos个正数
						(dp[i+k][nsum+zero]+=dp[i][j+zero]*C[i+k][k]%MOD*C[k][pos]%MOD)%=MOD;
					}
			}
	printf("%lld\n",dp[n][zero]);
			
	return 0;
}


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

using namespace std;

const int vx[]={0,1,0,-1};
const int vy[]={-1,0,1,0};

struct ct{
    int cost;
    int x;
    int y;
    ct(int c,int xi,int yi){
        cost=c;
        x=xi;
        y=yi;
    }
    friend bool operator<(const ct& l,const ct& r){
        if(l.cost<=r.cost)return false;
        else return true;
    }
};

int main(){
    int h,w;
    cin>>h>>w;
    vector<vector<char>> a(h+2,vector<char>(w+2,'#'));
    priority_queue<ct> q;
    for (int i = 0; i < h; ++i) {
        string t;
        cin>>t;
        for (int j = 0; j < w; ++j) {
            a[i+1][j+1]=t[j];
            if(a[i+1][j+1]=='#')q.push(ct(0,j+1,i+1));
        }
    }
    vector<vector<int>> m(h+2,vector<int>(w+2,5000));
    while(!q.empty()){
        auto t=q.top();
        q.pop();
        for (int i = 0; i < 4; ++i) {
            int nx=t.x+vx[i],ny=t.y+vy[i];
            if(a[ny][nx]=='.'&&m[ny][nx]>t.cost+1){
                q.push(ct(t.cost+1,nx,ny));
                m[ny][nx]=t.cost+1;
            }
        }
    }
    int ans=0;
    for (int i = 0; i < h+2; ++i) {
        for (int j = 0; j < w+2; ++j) {
            if(m[i][j]==5000)continue;
            else ans=max(ans,m[i][j]);
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 17000
s=list(input())
cnt=''
ans='NO'
for i in range(len(s)):
    for j in range(len(s)):
        if i<=j<=i+len(s)-8:
            continue
        else:
            cnt+=s[j]
    #print(cnt)
    if cnt=='keyence':
        ans='YES'
        break
    else:
        cnt=''
print(ans)

Measured memory_bytes: 3060
import math
n,m=[int(i) for i in input().split()]
a=[]
b=[]
for i in range(n):
  a0,b0=[int(i) for i in input().split()]
  a.append(a0)
  b.append(b0)
a.sort(reverse=True)
b.sort(reverse=True)
x=0
while m>0:
  if b==[]:
    x+=math.ceil(m/a[0])
    break
  else:
    if b[0]>a[0]:
      m-=b[0]
      del b[0] 
      x+=1
    else:
      x+=math.ceil(m/a[0])
      break
    
print(x)

Measured memory_bytes: 11264
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <iostream>
#include <numeric>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define all(a) (a).begin(), (a).end()

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

using namespace std;

struct UnionFind{
  int num;
  vector<int> rs,ps;
  UnionFind(){}
  UnionFind(int n):num(n),rs(n,1),ps(n,0){iota(ps.begin(),ps.end(),0);}
  int find(int x){
    return (x==ps[x]?x:ps[x]=find(ps[x]));
  }
  bool same(int x,int y){
    return find(x)==find(y);
  }
  void unite(int x,int y){
    x=find(x);y=find(y);
    if(x==y) return;
    if(rs[x]<rs[y]) swap(x,y);
    rs[x]+=rs[y];
    ps[y]=x;
    num--;
  }
  int size(int x){
    return rs[find(x)];
  }
  int count() const{
    return num;
  }
};

using ll = long long;
using P = std::pair<ll, int>;

ll N;
ll dp[20][20];
std::vector<P> pre[20][20];
std::set<std::string> ans;

void dfs( int i, int j, const std::string &s )
{
  if( !i )
  {
    std::string t = s;
    std::reverse(all(t));
    ans.insert( t ); 
  }

  //std::cout << i << " " << j << " " << s << std::endl;

  rep( idx, pre[i][j].size() )
  {
    char ch = 'a'+pre[i][j][idx].first;
    std::string t = s+ch;
    dfs( i-1, j-pre[i][j][idx].second, t );
  }
}

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

  dp[0][0] = 1;

  rep( i, N ) rep( j, i+1 )
  {
    dp[i+1][j] += dp[i][j]*j;

    if( dp[i][j] ) rep( k, j )
      pre[i+1][j].emplace_back( P( k, 0 ) );

    dp[i+1][j+1] += dp[i][j];

    if( dp[i][j] )
      pre[i+1][j+1].emplace_back( P( j, 1 ) );
  }

  rep( j, N+1 )
  {
    dfs( N, j, "" );
  }

  for( auto it = ans.begin(); it != ans.end(); ++it )
  {
    std::cout << *it << std::endl;
  }

  return 0;
}

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

#define all(x) x.begin(), x.end()
#define int long long
#define ll long long
#define ins insert
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ff first
#define ss second
#define ld long double
#define rsz resize
#define pii pair<int, int>

using namespace std;

mt19937 rnd(time(nullptr));

const long long INF = 1e18;
vector<vector<string> > kek = {{}, {}, {}, {"aa.", "..a", "..a"}, {"aacd", "bbcd", "cdaa", "cdbb"}, {"aabbc", "dcc.c", "d..bd", "c..bd", "cbbaa"}, {"abcc..", "ab..dd", "bacc..", "ba..dd", "cdaa..", "cd..bb"}, {".aabb.c", "..cc.ac", "dd...ad", "b....bd", "b....bc", "a...aac", "addcc.."}};

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n;
    cin >> n;
    char a[n][n];

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            a[i][j] = '.';
        }
    }
    if (n == 2) {
        cout << -1;
        return 0;
    }
    if (n == 3) {
        for (auto elem : kek[3]) {
            cout << elem  << "\n";
        }
        return 0;
    }
    int x = (n / 4) - 1, y = n - x * 4;
    for (int q = 0; q < x; q++) {
        for (int i = 4 * q; i < 4 + 4 * q; i++) {
            for (int j = 4 * q; j < 4 * (q + 1); j++) {
                a[i][j] = kek[4][i - 4 * q][j - q * 4];
            }
        }
    }
    for (int i = x * 4; i < n; i++) {
        for (int j = x * 4; j < n; j++) {
            a[i][j] = kek[y][i - x * 4][j - x * 4];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cout << a[i][j];
        }
        cout << "\n";
    }
    return 0;
}


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

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i=0;i<n;i++)
#define rep2(i, m, n) for(int i=m;i<n;i++)
#define rrep(i, n, m) for(int i=n;i>=m;i--)
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll MOD = 1000000007;
#ifdef __DEBUG
#include "cpp-pyprint/pyprint.h"
#endif

void Main() {
    int N;
    cin >> N;
    vector<int> A(N);
    for (auto& a : A ) {
        cin >> a;
    }

    deque<int> que;
    int ans = 0;
    for (int i = 0; i < N; ++i) {
        int a = A[i];
        if (i == 0) {
            que.push_back(a);
            ans ++;
        }else{
            int idx = upper_bound(que.begin(), que.end(), a-1) - que.begin();
            if (idx == 0) {
                que.push_front(a);
                ans ++;
            }else{
                que[idx-1] = a;
            }
        }
    }
    cout << ans << endl;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
map<string ,int>mp;
int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int n; 
	cin>>n; 
	int mx = 0;
	for(int i=0;i<n;i++){
		string s; 
		cin>>s; 
		mx = max(mx,++mp[s]);
	}
	for(auto p:mp){
		if(p.se==mx){
			cout<<p.first<<endl;
		}
	}
	return 0;
}


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

int main(int argc, char const *argv[]) {
  int n, k;
  cin >> n >> k;
  vector<int> l;
  for (int i = 0; i < n; i++) {
    int len;
    cin >> len;
    l.push_back(len);
  }

  sort(l.begin(), l.end());
  int total = 0;
  for (int i = 0; i < k; i++) {
    total = total + l[n - i - 1];
  }

  cout << total << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using pll = pair<long long, long long>;
pll sub(long long h, long long w) {
    if (h % 2 == 0 || w % 2 == 0) return {h*w/2, h*w/2};
    if (h > w) swap(h, w);
    return {h * (w+1)/2, h * (w-1)/2};
}

int main() {
    long long H, W;
    cin >> H >> W;
    long long res = H * W;

    for (long long h = 1; h < H; ++h) {
        vector<long long> a(3);
        a[0] = h * W;
        auto p = sub(H-h, W);
        a[1] = p.first, a[2] = p.second;
        sort(a.begin(), a.end());
        chmin(res, a.back() - a[0]);
    }
    for (long long w = 1; w < W; ++w) {
        vector<long long> a(3);
        a[0] = H * w;
        auto p = sub(H, W-w);
        a[1] = p.first, a[2] = p.second;
        sort(a.begin(), a.end());
        chmin(res, a.back() - a[0]);
    }
    cout << res << endl;
}

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

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10
#define MAX_N 100

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

//map<int, int>m;
vector<vector<int> >G(MAX_N);

int dfs(int now, int visits[], int c){
  int res = c;
  rep(i, G[now].size()){
    //    if(m.count(G[now][i])) continue;
    if(visits[G[now][i]]) continue;
    //    m[G[now][i]] = 1;
    visits[G[now][i]] = 1;
    res = max(res, dfs(G[now][i], visits, c+1));
    //    m.erase(G[now][i]);
    visits[G[now][i]] = 0;
  }
  return res;
}

int main(){
  int n;
  while(scanf("%d", &n) && n){
    rep(i, n) G[i].clear();
    int a, b;
    vi v;
    rep(i, n){
      scanf("%d%d", &a, &b); a--; b--;
      G[a].PB(b);
      G[b].PB(a);
      if(find(v.begin(), v.end(), a) == v.end()) v.PB(a);
      if(find(v.begin(), v.end(), b) == v.end()) v.PB(b);
    }
    int res = 0;
    int visits[MAX_N] = {};
    rep(i, v.size()){
      //      m.clear();
      //      m[v[i]] = 1;
      visits[v[i]] = 1;
      res = max(res, dfs(v[i], visits, 1));
      visits[v[i]] = 0;
    }
    printf("%d\n", res);
  }
  return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <functional>
#include <climits>
#include <cstring>

using namespace std;

#define int long long
#define rep(i, n) for (int i=0;i<(int)n;++i)
#define rep1(i, n) for (int i=1;i<=(int)n;++i)
#define unless(a) if(!(a))
#define all(a) begin(a),end(a)
#define fst first
#define scd second
#define PB emplace_back
#define PPB pop_back

using ll=long long;
using vi=vector<int>;
using pii=pair<int, int>;

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
bool chmin(int&a,int b){return a>b?(a=b,true):false;}
bool chmax(int&a,int b){return a<b?(a=b,true):false;}
ll read(){ll a;scanf("%lld",&a);return a;}

const int inf = 3 * TEN(18) + 10;
const int mod = 998244353;

struct SegTree { // 区間min,max
	int n;
	vector<int> Max;
	vector<int> Min;
	void init(int n_) {
		n = 1;
		while (n < n_) n *= 2;
		Max.resize(2 * n);
		Min.resize(2 * n);
		for (int i = 0; i < 2 * n - 1; ++i) {
			Max[i] = -inf;
			Min[i] = inf;
		}
	}
	void update(int idx, int val) {
		idx += n - 1;
		Min[idx] = val;
		Max[idx] = val;
		while (idx > 0) {
			idx = (idx - 1) / 2;
			Min[idx] = min(Min[idx * 2 + 1], Min[idx * 2 + 2]);
			Max[idx] = max(Max[idx * 2 + 1], Max[idx * 2 + 2]);
		}
	}
	int get_min(int a, int b, int k = 0, int l = 0, int r = -1) { // [a, b)のmin
		if (r == -1) r = n;
		if (r <= a || b <= l) return inf;
		if (a <= l && r <= b) return Min[k];
		int vl = get_min(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = get_min(a, b, k * 2 + 2, (l + r) / 2, r);
		return min(vl, vr);
	}
	int get_max(int a, int b, int k = 0, int l = 0, int r = -1) { // [a, b)のmax
		if (r == -1) r = n;
		if (r <= a || b <= l) return -inf;
		if (a <= l && r <= b) return Max[k];
		int vl = get_max(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = get_max(a, b, k * 2 + 2, (l + r) / 2, r);
		return max(vl, vr);
	}
};


int N;
vector<pii> robots;
int dp[200010];
SegTree st;

signed main()
{
	cin >> N;

	rep(i, N) {
		int x, d; cin >> x >> d;
		robots.PB(x, d);
	}

	robots.PB(inf, 0);
	sort(all(robots));

	st.init(N + 5);

	st.update(N - 1, N - 1);

	dp[N] = 1;
	for (int i = N - 1; i >= 0; --i) {
		dp[i] += dp[i + 1];
		dp[i] %= mod;

		pii r = robots[i];

		int distant_idx = lower_bound(all(robots), pii(r.fst + r.scd, 0)) - begin(robots) - 1;
		int nxt = max(st.get_max(i, distant_idx + 1), i) + 1;

		dp[i] += dp[nxt];
		dp[i] %= mod;

		st.update(i, max(distant_idx, st.get_max(i, distant_idx + 1)));
	}

	cout << dp[0] << endl;
}




Measured memory_bytes: 14188
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(long long int i=a; i<n; i++)
#define rloop(i,a,n) for(long long int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcount(a)
#define mod 1000000007
#define ll long long int
#define ull unsigned long long int 
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define stkll stack<ll>
#define qll queue<ll>
#define pqll priority_queue<ll>
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power)
{
    ll ans=1;
    while(power>0)
    {
        if(power%2==1)
        {
            ans=(ans*B)%mod;
        }
        B=(B*B)%mod;
        power/=2;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1)
    { 
        return false; 
    }
    if(n<=3)
    { 
        return true;
    } 
    if(n%2==0 || n%3==0) 
    {
        return false; 
    }
    for(ll i=5; i*i<=n; i+=6) 
    {
        if(n%i==0 || n%(i+2)==0) 
        {
            return false; 
        }
    }
    return true; 
}
using namespace std;
int main() 
{
    FAST
    FO
    FI
    int n;
    IN n;
    string s;
    IN s;
    if(n%2)
    {
        OUT "No";
    }
    else
    {
        bool flag=0;
        loop(i,0,n/2)
        {
            if(s[i]!=s[i+(n/2)])
            {
                flag=1;
                break;
            }
        }
        if(flag)
        {
            OUT "No";
        }
        else
        {
            OUT "Yes";
        }
    }
    return 0;
}

Measured memory_bytes: 256