akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long y = sc.nextLong();
		long gcd = gcd(x, y);
		if(gcd == y) {
			System.out.println(-1); return;
		}
		for(int i=1; i<=1000000000; i++) {
			long z = i*x;
			if(z%y==0) {
				
			} else {
				System.out.println(z); return;
			}
		}
		System.out.println(-1);
	}
	
	static int binarySearch(int[] A, int x) {
		int l = 0;
		int r = A.length;
		while(l<r) {
			int mid = (l+r)/2;
			if(A[mid] == x) return mid;
			else if(x<A[mid]) r = mid;
			else l = mid+1;
		}
		return -1;
	}
	
	static long upper_bound(int[] A, int b) {
		// bよりおおきい値がはじめて出てくるindexを返す
		return lower_bound(A, b+1);
	}

	static long lower_bound(int[] A, int b) {
		// b以上の値がはじめて出てくるindexを返す
		int lb=0;
		int ub=A.length;
		while(ub>lb) {
			int mid = (lb+ub)/2;
			if(A[mid]>=b) ub = mid;
			else lb = mid+1;
		}
		return lb;
	}
	
	// union find lib
	// usage:
	// 最初にinitを呼ぶ
	// root: 直接は呼ばないで
	// unite: まとめる
	// same: グループ判定
	static void init(int par[], int N) {
		for(int i=0; i<N; i++) {
			par[i] = i;
		}
	}
	
	static int root(int x, int [] par) {
		if(par[x] == x) {
			return x;
		} else {
			return (par[x] = root(par[x], par));
		}
	}
	
	static boolean same(int x, int y, int[] par) {
		return root(x, par) == root(y, par);
	}
	
	static void unite(int x, int y, int[] par) {
		x = root(x, par);
		y = root(y, par);
		if(x == y) return;
		par[x] = y;
	}
	
	// end union find lib
	
	// number lib
	
	static int max(int...ls) {
		int ans = Integer.MIN_VALUE;
		for(int i=0; i<ls.length; i++) {
			ans = Math.max(ans, ls[i]);
		}
		return ans;
	}
	
	static int min(int...ls) {
		int ans = Integer.MAX_VALUE;
		for(int i=0; i<ls.length; i++) {
			ans = Math.min(ans, ls[i]);
		}
		return ans;
	}
	
	static long lcm(long a, long b) {
		return a*(b/gcd(a, b));
	}
	
	static long gcd(long a, long b) {
		long ta = Math.max(a, b);
		long tb = Math.min(a, b);
		long tmp;
		while((tmp = ta%tb) != 0) {
			ta = tb;
			tb = tmp;
		}
		return tb;
	}
	
	static long modcomb(long n, long k, long mod) {
		if(k==1) {
			return n;
		}
		
		long ans = 1;
		for(long i=n; i>=n-k+1; i--) {
			ans = (ans * i)%mod;
		}
		for(long i=k; 0<i; i--) {
			ans = (ans * modpow(i, mod-2, mod)) % mod;
		}
		return ans;
	}
	
	static long modpow(long a, long b, long mod) {
		if(b==0) return 1;
		if(b%2==0) {
			long d = modpow(a, b/2, mod);
			return (d*d)%mod;
		} else {
			return (a*modpow(a, b-1, mod))%mod;
		}
	}
	
	static int disit(long a, long d) {
		int count = 0;
		while(a!=0) {
			a = a/d;
			count++;
		}
		return count;
	}
	
	// end number lib
}

Measured memory_bytes: 21716
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ll  long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define vi vector<int>
#define br cout <<"\n";
#define all(x)  (x).begin(),(x).end()
#define tr(c,i) for(auto i : c)
#define pii pair< int,int >
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define pq priority_queue< pair<ll,pii> ,vector<pair<ll,pii>>,greater <pair<ll,pii>> >p;//container adapter makes ascending q
#define er(x) cout << x << " "
#define err(x,y) cout << x << " "<<y
using namespace std;

const ll MAX =  1000 * 1000 ;
const int dx[] = { 1, -1 , 0 , 0  };
const int dy [] = { 0 ,0 , 1 , -1  };
const int MOD = 1000 * 1000 * 1000 + 7 ;
const int N = 301 ;
const int INF = INT_MAX ;
const int M = 200005;
int main ( ){

ll  h , w  , n ; 
cin >> h >> w >> n ;
cout << min ( (n + h - 1 ) / h  , ( n + w - 1  ) / w  ) ; 






return 0 ;

}


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


int main()
{

  ios::sync_with_stdio(0);
  cin.tie(0);
  ll n,ans=LONG_LONG_MAX;
  cin>>n;
  for(ll i=1; i*i<=n; i++){
     if(n%i==0){
        ll ans1=n/i;
        ans1=n/i-1+i-1;
        ans=min(ans,ans1);
     }
  }
  cout<<ans;

  return 0;
}

Measured memory_bytes: 3644
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

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

const int dx[4] = {-1, 0, 0, 1};
const int dy[4] = {0, -1, 1, 0};

// Self settings
// clang-format off
#define MAX_N 100000
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1 << 31;
// clang-format on

int a, b;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> a >> b;

  cout << ceil((a + b) / 2.0) << endl;

  return 0;
}


Measured memory_bytes: 504
N = int(input())
H = list(map(int, input().split()))
h = [0 for _ in range(N)]
for i in range(1, N):
    if H[i - 1] >= H[i]:
        h[i] = h[i - 1] + 1
    else:
        h[i] = 0
ans = max(h)
print(ans)

Measured memory_bytes: 64228
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+1;

int main(){
int n,k,arr[N],dp[N];
cin>>n>>k;

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

dp[0]=0;
for(int i=1;i<n;++i){
    int mn=1e9;
    for(int j=max(0,i-k);j<i;++j)
        mn=min(mn,abs(arr[i]-arr[j])+dp[j]);
    dp[i]=mn;
}
cout<<dp[n-1];

return 0;    
}

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

using namespace std;


long int equlid(long int a, long int b){
    long int c;
   
    while (a%b != 0) {
        c = a % b;
        a = b;
        b = c;
    }
    
    return b;
    
}


int main(){
    
    int N;
    cin >> N;
    long int A[N+1];
    
    long int dpF[N+1];
    
    long int dpB[N+1];
    
  
    for (int i = 1; i <= N; i++) {
        cin >> A[i];
        
    }
    
    
    dpF[0] = A[1];
    
    for (int i = 1; i <= N; i++) {
        dpF[i] = equlid(dpF[i-1], A[i]);

    }
    
    
    
    dpB[N+1] = A[N];
    for (int i = N; i >= 1; i--) {
        dpB[i] = equlid(dpB[i+1], A[i]);
        
    }
    
    
    dpF[0] = dpB[2];
    dpB[N+1] = dpF[N-1];
    
    long int ans = 0;
    
    for (int i = 1; i <= N ; i++) {
        long int ans1 = equlid(dpB[i+1], dpF[i-1]);
        
        if (ans < ans1) {
            ans = ans1;
        }
    }

    
    
    cout << ans << endl;
    
}




Measured memory_bytes: 2560
#include <iostream>

using namespace std;

int main(){

  int A, B, C;
  cin >> A >> B;
  int f = 0;
  for(int i = 1; i <= 3; i++){
    C = i;
    if(A * B * C % 2 == 1) f = 1;
  }
  if(f) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 256
let circle_in_rectangle w h x y r =
  let borders_of_circle = [(x - r, y); (x + r, y); (x, y - r); (x, y + r)] in
  let rec point_in_rectangle = function
      [] -> true
    | first :: rest -> (match first with
                          (a, b) -> (0 <= a && a <= w) && (0 <= b && b <= h) &&
                                     (point_in_rectangle rest))
  in
  if point_in_rectangle borders_of_circle then "Yes"
  else "No" ;;

let f s = Scanf.sscanf s "%d %d %d %d %d" circle_in_rectangle ;;
print_endline (f (read_line())) ;;


Measured memory_bytes: 2316
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;
int main(){
	int n,i,r,last,time,day;
	for(;cin>>n,n;){
		vector<pair<int,string> >program;
		set<string>fav;
		{
			string s;
			map<string,int>m;
			for(;n--;){
				cin>>s>>day>>time;
				program.push_back(make_pair(time=day*1440+time/100*60+time%100,s));
				m[s]=time;
			}
			vector<int>v;
			for(cin>>n;n--;v.push_back(m[s]),fav.insert(s))cin>>s;
			sort(v.begin(),v.end());
			for(i=0;i<v.size()-1;i++)if(v[i+1]-v[i]<30){puts("-1");goto next;}
		}
		sort(program.begin(),program.end());
		for(last=r=i=0;i<program.size();i++){
			if(program[i].first>=last){
				last=program[i].first+30;
				r++;
			}else if(fav.find(program[i].second)!=fav.end()){
				last=program[i].first+30;
			}
		}
		printf("%d\n",r);
		next:;
	}
}

Measured memory_bytes: 1336
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using Graph = vector<vector<ll>>;

// 深さ優先探索
vector<ll> h;
vector<bool> seen;
void dfs(const Graph& G, int v, int& cnt) {
	seen[v] = true; // v を訪問済にする

	bool good = true;

	// v から行ける各頂点 next_v について
	for (auto next_v : G[v]) {
		// if (seen[next_v]) continue; // next_v が探索済だったらスルー
		// dfs(G, next_v); // 再帰的に探索

		if (h[next_v] >= h[v]) {
			good = false;
		}
	}

	if (good) cnt++;
	return;
}

int main()
{
	ll n, m; cin >> n >> m;

	for (int i = 0; i < n; i++) {
		ll tmp_h; cin >> tmp_h;
		h.push_back(tmp_h);
	}

	// グラフ入力受取 (ここでは無向グラフを想定)
	Graph G(n);
	for (int i = 0; i < m; ++i) {
		ll a, b;
		cin >> a >> b;
		--a;
		--b;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {

		// 頂点 s をスタートとした探索
		seen.assign(n, false); // 全頂点を「未訪問」に初期化
		dfs(G, i, ans);

	}

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

Measured memory_bytes: 9856
nab=list(map(int,input().split()))
v=list(map(int,input().split()))
v.sort(reverse=True)
vmin=v[:nab[1]]
print(sum(vmin)/len(vmin))
mini=1
if nab[1]>1:
    for i in range(nab[1]-1):
        if vmin[-2-i]==vmin[-1]:
            mini+=1
        else:
            break
ex=0
for i in range(nab[0]-nab[1]):
    if v[nab[1]+i]==vmin[-1]:
        ex+=1
    else:
        break
def f(n):
    out=1
    for i in range(1,n+1):
        out*=i
    return out
ans=0
if vmin[0]!=vmin[-1]:
    ans=f(mini+ex)//(f(mini)*f(ex))
    print(ans)
else:
    m=min(nab[2]-nab[1],ex)
    for i in range(m+1):
        ans+=f(mini+ex)//(f(mini+i)*f(ex-i))
    print(ans)


Measured memory_bytes: 3188
// C++ program to print all possible
// substrings of a given string
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

using namespace std;

char str[100000000][6], ct[27];
int cr[27] = {0};


// Function to print all sub strings
int subString(string s, int n, int d)
{
    // Pick starting point in outer loop
    // and lengths of different strings for
    // a given starting point
    int c=0, k=0;
    string sr;
    char ar[5010];
    for (int i = 0; i < n; i++)
    {
        for (int len = 1; len <= d; len++)
        {


            sr = s.substr(i, len);
            strcpy(ar, sr.c_str());
            if(ar[0] == ct[0] || ar[0] == ct[1] || ar[0] == ct[2] || ar[0] == ct[3])
            {
                strcpy(str[c], ar);
                c++;
            }
         //   printf("%d   ", c);
            if (c == 100000000)
            {
           //     printf("  Here \n");
                break;
            }

        }
    }
    return c;
}

void sorting(int n)
{
    char min[5010];
    int a;

    for (int i = 0; i < n - 1; i++)
    {
        a = i;
        strcpy(min, str[i]);

        for (int j = i + 1; j < n; j++)
        {
            if( (strcmp(str[j], min)) < 0)
            {
                strcpy(min, str[j]);
                a = j;
            }
        }
        strcpy(str[a], str[i]);
        strcpy(str[i], min);
    }
}

// Driver program to test above function
int main()
{
    string s;
    cin >> s;
    int d, i, j, k=0, l, p;
    char sry[5010], ch;
    strcpy(sry, s.c_str());
    l = strlen(sry);
    for ( j=0; j<l; j++)
        cr[sry[j]-'a'+1]++;
    for (j=0; j<26; j++)
    {
        if(cr[j] >= 1)
        {
            ct[j] = j + 'a' - 1;
            k++;
        }
        else
            ct[j] = 'z' ;
    }
    int q, w;
    char temp;
    // statements to scan the number of items (n) and the string a[n].

    for (w = 1; w < 26; w++)
    {
        for (q = 0; q < 26 - w; q++)
        {
            if (ct[q] >= ct[q+1])
            {
                temp = ct[q];
                ct[q] = ct[q+1];
                ct[q+1] = temp;
            }
        }
    }

    scanf("%d", &d);
    i = subString(s,s.length(), d);

    sorting(i);

//   printf("Here1[]\n");
    k=0;

    for(j=0; ; j++)
    {
        if (strcmp(str[j], str[j+1]) != 0)
            k++;
        if(k==d)
            break;

    }
    //  printf("Here1\n");
    printf ("%s", str[j]);

    /*  for(p=0; p<i; p++)
          printf("%s\n", str[p]);
          */
    return 0;
}

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

vector< pair<long long,long long> >adj[100006];
long long ara[100006],vis[100006],ttl[100006];

int main()
{


        long long n,m,a,b,c,d,e,f,g,h,p,q,r,fr,sc,tr,sz=0,tz,i,j,k,mx=LLONG_MIN,mn=LLONG_MAX;
        long long x=0,y=0,cnt=0,res=0,ans=0,sum=0; long long flg=0,flag=1,na=0,as=1;
        vector<long long>u,v,w; vector< pair<long long,long long> >vct; vector<string>vst;
        set<long long>st,nt,tt; map<long long,long long>mp,nq,qr; string str,ttr,ntr;

        fr=10000000000; queue<long long>qu;

        scanf("%lld %lld",&n,&m);

        for(i=0;i<m;i++)
        {
            scanf("%lld %lld %lld",&a,&b,&d);

            ttl[a]++; if(ttl[a]==1){  v.push_back(a); sz++;  }
            ttl[b]++; if(ttl[b]==1){  v.push_back(b); sz++;   }

            adj[a].push_back(make_pair(b,d));
            r=d*(-1); adj[b].push_back(make_pair(a,r));

        }

        for(i=0;i<sz;i++)
        {
            a=v[i];

            if(vis[a]==0)
            {

            x++;

            qu.push(a); ara[a]=fr; vis[a]=x;

            if(ara[a]>mx)mx=ara[a];
            if(ara[a]<mn)mn=ara[a];

            while(!qu.empty())
            {
                c=qu.front(); qu.pop();

                f=adj[c].size();

                for(int lp=0;lp<f;lp++)
                {
                    p=adj[c][lp].first; q=adj[c][lp].second;

                    if(vis[p]==0)
                    {
                        ara[p]=ara[c]+q; qu.push(p); vis[p]=x;

                        if(ara[p]>mx)mx=ara[p];
                        if(ara[p]<mn)mn=ara[p];
                    }
                    else
                    {
                        h=ara[c]+q; if(h!=ara[p]){  flag=0;  break;   }
                    }

                }

                if(flag==0)break;

            }



            }


            if(flag==0)break;


        }


        if(mn<0){ flag=0;  }
        else
        {
            b=mx-mn;

            if(b>1000000000){  flag=0;  }
        }


        if(flag==1)printf("Yes\n");
        else{ printf("No\n");   }







    return 0;
}




Measured memory_bytes: 19276
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



int main() {
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i, n) {
        int a;
        cin >> a;
        mp[a]++;
    }
    int flg = 0;
    if (mp[0] == n) flg = 1;
    if (n % 3 == 0) {
        if (sz(mp) == 2) {
            if (mp[0] == n / 3) flg = 1;
        } else if (sz(mp) == 4) { // 0に上でアクセスした
            // 個数等しいか
            int cnt = 0;
            for (auto e : mp) {
                if (e.S == 0) continue;
                if (e.S == n / 3) cnt++;
            }
            if (cnt == 3) {
                int cal = 0;
                for (auto e : mp) {
                    cal ^= e.F;
                }
                if (cal == 0) flg = 1;
            }
        }
    }
    
    if (flg == 0) cout << "No" << endl;
    else cout << "Yes" << endl;
}


Measured memory_bytes: 3840
#include <stdio.h>
#include <string.h>

int main(){
    int n;
    char s[4];
    int ac=0;
    int wa=0;
    int tle=0;
    int re=0;

    scanf("%d", &n);
    for(auto i=0; i<n; ++i){
        scanf("%s", s);

        if(strcmp(s,"AC")==0){
            ac++;
        }else if(strcmp(s,"WA")==0){
            wa++;
        }else if(strcmp(s,"TLE")==0){
            tle++;
        }else{
            re++;
        }
    }

    printf("AC x %d\n", ac);
    printf("WA x %d\n", wa);
    printf("TLE x %d\n", tle);
    printf("RE x %d\n", re);
}

Measured memory_bytes: 1728
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        final int N = sc.nextInt();

        int ans = 0;
        for (int i = 1; i <= N; i *= 2) {
            ans = Math.max(ans, i);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 23124
import re
F = list(input().split())
S = []
while F != []:
    if re.match(r'[0-9]', F[0]):
        S.append(F.pop(0))
    elif F[0] == '+':
        F.pop(0)
        x = int(S.pop())
        y = int(S.pop())
        S.append(x+y)
    elif F[0] == '-':
        F.pop(0)
        x = int(S.pop())
        y = int(S.pop())
        S.append(y-x)
    elif F[0] == '*':
        F.pop(0)
        x = int(S.pop())
        y = int(S.pop())
        S.append(x*y)

print(S[0])


Measured memory_bytes: 6532
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scanner() string {
	sc.Scan()
	return sc.Text()
}

func intScanner() int {
	n, _ := strconv.Atoi(Scanner())
	return n
}

func floatScanner() float64 {
	n, _ := strconv.ParseFloat(Scanner(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func stringSliceScanner(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scanner()
	}
	return a
}
func intSliceScanner(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = intScanner()
	}
	return a
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}

var mod int
var t float64

func main() {
	mod = 1000000007
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := intScanner()
	m := intScanner()
	v := intScanner()
	p := intScanner()
	as := intSliceScanner(n)
	sort.Sort(sort.Reverse(sort.IntSlice(as)))
	bs := make([]int, n)
	bs[0] = as[0]
	for i := 1; i < n; i++ {
		bs[i] = bs[i-1] + as[i]
	}
	ans := 0
	for i := 0; i < n; i++ {
		if i < p {
			ans++
		} else {
			if as[i]+m >= as[p-1] {
				y := v - 1 - (p - 1) - (n - 1 - i)
				if y <= 0 {
					ans++
				} else {
					x := bs[i-1]
					if p-2 >= 0 {
						x -= bs[p-2]
					}
					if (i-p+1)*(as[i]+m)-x >= y*m {
						ans++
					}
				}
			}
		}
	}
	fmt.Println(ans)
}


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

using namespace std;

int main(void){
    string s;
    int b, r;

    cin >> s;

    b = 0;
    r = 0;
    for(int i = 0;i < s.length();i++){
        if(s[i] == '0')     r++;
        else                b++;
    }

    if(b > r)   cout << 2*r << endl;
    else        cout << 2*b << endl;

    return 0;
}

Measured memory_bytes: 512
#include <iostream>

using namespace std;

int N;
int A[200];
int times[200];

int search(int n) {
    int cnt = 0;
    while (n % 2 == 0) {
        n = n / 2;
        cnt++;
    }
    return cnt;
}
int min(){
    int min;
    min = times[0];
    for(int i = 1; i < N; i++){
        if (times[i] < min){
            min = times[i];
        }
    }
    return min;
}

int main() {
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    int ret = 0;
    for (int i = 0; i < N; i++) {
        times[i] = search(A[i]);
    }

    ret = min();
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A - Five Variables
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int N = 5;

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  for (int i = 1; i <= N; i++) {
    int xi;
    scanf("%d", &xi);
    if (xi == 0) printf("%d\n", i);
  }
  return 0;
}


Measured memory_bytes: 3192
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<set>
#include<map>
#include<queue>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);++i)
#define rrep(i,n) for(int (i)=(n)-1;(i)>=0;--i)
#define rep1(i,n) for(int (i)=1;(i)<=(n);++i)
#define rrep1(i,n) for(int (i)=(n);(i)>=1;--i)
#define pb push_back
#define fr first
#define sc second
typedef long long ll;
typedef pair<int,int> P;
typedef pair<long long,long long> LP;
typedef double db;
using namespace std;

priority_queue<LP> qr;
priority_queue<LP,vector<LP>,greater<LP> >  ql;
ll N;
ll L[100000],R[100000];
ll used[100000];
ll ans = 0;

ll calc(ll b){
  ll res = 0;
  ll pos = 0;
  rep(i,N) used[i]=0;
  while(!ql.empty()) ql.pop();
  while(!qr.empty()) qr.pop();
  rep(i,N){
    ql.push(LP(R[i],i));
    qr.push(LP(L[i],i));
  }
  rep(i,N){

    LP p;
    if(b==1){
        for(;;){
        //while(1){
          p = ql.top();
          ql.pop();
          if(!used[p.sc]){
            used[p.sc]=1;
            break;
          }
        }
        if(R[p.sc] < pos){
          res += abs(R[p.sc] - pos);
          pos = R[p.sc];
        }
        else if(pos <= L[p.sc]){
          res += abs(L[p.sc] - pos );
          pos = L[p.sc];
        }
        b = 0;
    }
    else{
      while(1){
        p = qr.top();
        qr.pop();
        if(!used[p.sc]){
          used[p.sc]=1;
          break;
        }
      }
      if(L[p.sc] > pos){
        res += abs(L[p.sc] - pos);
        pos = L[p.sc];
      }
      else if(pos >= R[p.sc]){
        res += abs(R[p.sc] - pos );
        pos = R[p.sc];
      }
      b = 1;
    }
  }
  return res + abs(pos);
}

int main()
{
  cin>>N;
  rep(i,N) cin>>L[i]>>R[i];
  cout<<max(calc(0),calc(1))<<endl;
}


Measured memory_bytes: 5988
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

using namespace std;
using ll = long long;

int main() {
  int K;
  cin >> K;
  int sum = 0;
  int m = 0;
  for (int a = 1; a <= K; a++) {
    for (int b = 1; b <= K; b++) {
      for (int c = 1; c <= K; c++) {
        m = min({a, b, c});
        int mm = 1;
        for (int k = m; 1 <= k; k--) {
          if (a % k == 0 && b % k == 0 && c % k == 0) {
            mm = k;
            break;
          }
        }
        sum += mm;
      }
    }
  }
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 3628
def solve():
    S = sorted(input())
    T = sorted(input(), reverse=True)
    lim = min(len(S), len(T))
    for i in range(lim):
        if (S[i]) > T[i]:
            print("No")
            break
        if S[i] == T[i]:
            continue
        else:
            print("Yes")
            break
    else:
        if len(S)<len(T):
            print("Yes")
        else:
            print("No")

if __name__ == '__main__':
    solve()

Measured memory_bytes: 3064
import sys,math

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	a,b,c = MI()
	if(4*a*b < (c-a-b)*(c-a-b) and 0 < c-a-b):
		print("Yes")
	else:
		print("No")

if __name__ == '__main__':
	main()

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
#include <utility>
#include <algorithm>
#include <stack>
#include <functional>
typedef long long ll;
using namespace std;

int main(void) {
  ll i, j, k, n, m, h, w, ans = 0;
  scanf("%lld", &n);
  char a[n + 10], b[n + 10], c[n + 10];
  scanf("%s%s%s", a, b, c);
  for(i = 0; i < n; ++i) {
    if(a[i] == b[i] && a[i] != c[i]) ++ans;
    else if(a[i] == c[i] && a[i] != b[i]) ++ans;
    else if(c[i] == b[i] && a[i] != c[i]) ++ans;
    else if(a[i] != b[i] && b[i] != c[i]) ans += 2;
  }
  printf("%lld", ans);
  return 0;
}

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


int main() {
    int n;
    cin >> n;
    vector<int> l(n,0);
    rep(i,n)cin >> l.at(i);
    sort(l.begin(),l.end());
    int sum = 0;
    int max = l[n-1];
    rep(i,n-1)sum += l.at(i);
    if(max < sum)cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

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

using namespace std;
typedef long long ll;
typedef long double ld;
const int inf = (int)1e9 + 7;
const ll linf = (ll)1e18 + 7;
const ll mod = (int)1e9 + 7;

const int N = (int)3e5 + 100;
int sum[N], xr[N], a[N];

int gets(int l, int r) {
    return sum[r] - sum[l - 1];
}

int getxr(int l, int r) {
    return xr[r] ^ xr[l - 1];
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
    }

    for (int i = 1; i <= n; ++i) {
        sum[i] = sum[i - 1] + a[i];
        xr[i] = xr[i - 1] ^ a[i];
    }

    ll res = 0;

    for (int i = 1; i <= n; ++i) {
        int l = 0, r = i;
        while (r - l > 1) {
            int m = (r + l) / 2;
            if (gets(i - m, i) != getxr(i - m, i)) {
                r = m;
            } else {
                l = m;
            }
        }
        res += l + 1;
    }

    cout << res;


    return 0;
}

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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef tuple<int, int, int> iii;
typedef vector<iii> viii;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef map<int, int> mii;
typedef map<int, string> mis;
typedef map<string, int> msi;
typedef set<int> si;
typedef set<ll> sl;
typedef map<ll, ll> mll;

#define pb push_back
#define mp make_pair
#define rep(i, n) for (int i = 0 ; i < n ; i++)

bool overlaps(ii a, ii b) {
    int x1 = a.first;
    int x2 = b.first;
    int w1 = a.second - a.first;
    int w2 = b.second - b.first;
    if (x2 < x1 + w1 && x1 < x2 + w2) {
        return true;
    }
    return false;
}

vi readList(int n) {
    vi a(n);
    for (int i = 0 ; i < n ; i++) {
        cin >> a[i];
    }
    return a;
}

void printList(vi a) {
    for (int i = 0 ; i < a.size() ; i++) {
        cout << a[i];
        if (i < a.size() - 1) {
            cout << " ";
        }
    }
    cout << endl;
}

bool comp(ll a, ll b) {
    if (a < b) {
        return false;
    }
    return true;
}

void solve() {
    
    int n, m;
    cin >> n >> m;
    vi a(n);
    rep(i, n) cin >> a[i];
    int sm = 0;
    for (int i = 0 ; i < n ; i++) {
        sm += a[i];
    }
    int ct = 0;
    for (int i = 0 ; i < n ; i++) {
        if (a[i] >= sm / (4.0 * m)) {
            ct++;
        }
    }
    if (ct >= m) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    
}

void querySolve() {
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}

int main() {
    //querySolve();
    solve();
}


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

long long solve(int n, long long *wt, long long *val, int w, long long **t) {
  if (n == 0 || w == 0) {
    return 0;
  }
  if (t[n][w] != -1) {
    return t[n][w];
  }
  if (wt[n - 1] > w) {
    return t[n][w] = solve(n - 1, wt, val, w, t);
  } else {
    return t[n][w] = max(solve(n - 1, wt, val, w, t),
                         val[n - 1] + solve(n - 1, wt, val, w - wt[n - 1], t));
  }
}

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

  long long *wt = new long long[n];
  long long *val = new long long[n];
  for (int i = 0; i < n; i++) {
    cin >> wt[i] >> val[i];
  }
  long long **t = new long long *[n + 1];
  for (int i = 0; i <= n; i++) {
    t[i] = new long long[w + 1];
    t[i][0] = 0;
    for (int j = 1; j < w + 1; j++) {
      t[i][j] = -1;
    }
  }
  for (int i = 0; i <= w; i++) {
    t[0][i] = 0;
  }

  cout << solve(n, wt, val, w, t);
}

Measured memory_bytes: 82716
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		String s = sc.nextLine();
		String t = sc.nextLine();
		int ans = 0;
		for(int i = 0; i < 3;i++) {
			if(s.charAt(i) == t.charAt(i)) {
				ans++;
			}
		}
		System.out.println(ans);

	}

}


Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b;
  a = 0;
  in(b);
  vector<ll> c(b), d(b);
  rep(i, b){
    in(c[i]);
    d[i] = c[i];
  }
  sort(all(c));
  rep(i, b){
    if(c[i] != d[i])
      a++;
  }
  if(a <= 2)
    out("YES");
  else
    out("NO");
  memi;
}

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

using namespace std;

#define int long long
#define FR first
#define SC second
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, f, n) for(int i = (int)(f); i < (int)(n); i++)
#define each(a, b) for(auto& a : b)

typedef pair<int, int> P;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

char ptn[4][2][2] = {
  {
    {'.','#'},
    {'.','.'}
  },
  {
    {'#','.'},
    {'#','#'}
  },
  {
    {'.','.'},
    {'#','.'}
  },
  {
    {'#','#'},
    {'.','#'}
  }
};

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int H, W;
  cin >> H >> W;
  H += 2, W += 2;
  char f[666][666];
  rep(i, H) rep(j, W) f[i][j] = '.';
  reps(i, 1, H-1) reps(j, 1, W-1) cin >> f[H-1-i][j];

  vector< pair<double, int> > vec;
  rep(i, H-1) rep(j, W-1) {
    rep(k, 4) {
      bool flag = true;
      rep(y, 2) rep(x, 2) flag &= (f[i+y][j+x] == ptn[k][y][x]);
      if(flag) {
	vec.emplace_back(atan2(i, j), (k < 2 ? -1 : 1));
	break;
      }
    }
  }

  sort(all(vec));
  
  int ans = 2, div = 1;
  for(auto p : vec) {
    div += p.second;
    ans = max(ans, div);
  }
  cout << ans << endl;
  
  return 0;
}

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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  i64 n, k;
  cin >> n >> k;
  vi32 a(n); cin >> a;
  vi32 f(n); cin >> f;
  sort(all(a));
  sort(all(f)); reverse(all(f));
  i64 l = -1, r = 1e15;
  while (r - l > 1) {
    i64 m = (l + r) / 2;
    i64 cnt = 0;
    rep(i, n) {
      i64 c = m / f[i];
      if (a[i] > c) {
        cnt += a[i] - c;
      }
    }
    if (cnt <= k) r = m;
    else l = m;
  }
  cout << r << endl;
}


Measured memory_bytes: 1792
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;

public class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader reader = new BufferedReader(isr);
		String string;
		
		int a, b, c, d, n = Integer.valueOf(reader.readLine());
		HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
		
		for(int i = 0; i < n; i++) map.put(i + 1, 0);
			
		for(int i = 0; i < n * (n - 1) / 2; i++){
			string = reader.readLine();
			a = Integer.valueOf(string.split(" ")[0]);
			b = Integer.valueOf(string.split(" ")[1]);
			c = Integer.valueOf(string.split(" ")[2]);
			d = Integer.valueOf(string.split(" ")[3]);
			
			if(c == d){
				map.put(a, map.get(a) + 1);
				map.put(b, map.get(b) + 1);
			}else if(c > d){
				map.put(a, map.get(a) + 3);
			}else{
				map.put(b, map.get(b) + 3);
			}
		}
		ArrayList<Map.Entry<Integer, Integer>> entries = new ArrayList<Map.Entry<Integer, Integer>>(map.entrySet());
		Collections.sort(entries, new Comparator<Map.Entry<Integer, Integer>>() {
	 
			@Override
			public int compare(
					Entry<Integer, Integer> entry1, Entry<Integer, Integer> entry2) {
				return ((Integer)entry2.getValue()).compareTo((Integer)entry1.getValue());
				}
			});
	    
		int res[] = new int[n];
		int hoge = 0, hogehoge = 0;
	    for(int i = 0; i < n; i++){
	    	if(hoge != entries.get(i).getValue()){
	    		hoge = entries.get(i).getValue();
	    		hogehoge = i + 1;
	    		res[entries.get(i).getKey() - 1] = hogehoge;
	    	}else{
	    		res[entries.get(i).getKey() - 1] = hogehoge;
	    	}
	    }
	    
	    for(int var : res) System.out.println(var);
	}
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define Abs(x)((x) < 0 ? (x) * -1 : (x))
#define rep(x, y) for ((x) = 0; (x) < (y); (x)++)
#define repin(x, y) for ((x) = 0; (x) <= (y); (x)++)
#define nep(x, y) for ((x) = (y) - 1; 0 <= (x); (x)--)
#define nepi(x, y, z) for ((x) = (y) - 1; (z) <= (x); (x)--)
#define repi(x, y, z) for ((x) = (z); (x) < (y); (x)++)
#define repiin(x, y, z) for ((x) = (z); (x) <= (y); (x)++)
#define reps(x, y, z) for ((x) = 0; (x) < (y); (x) += (z))
#define repit(x) for (__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define all(x) (x).begin(),(x).end()
#define Mem0(x) memset(x, 0, sizeof(x))
#define Mem1(x) memset(x, -1, sizeof(x))
#define _end '\n'
#define Out(x) cout<<(x)<<_end
template<typename T> inline bool Max(T &x, const T &y) { return x < y ? x = y, 1 : 0; }
template<typename T> inline bool Min(T &x, const T &y) { return x > y ? x = y, 1 : 0; }
template<typename T> using V = vector<T>;
template<typename T> using VV = V<V<T> >;

#define pb push_back
#define mp make_pair

static const ll MOD = 1e9 + 7;
static const double PI = 3.141592653589793;

#define LOCAL 0

int main()
{
#if LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#endif

    cin.tie(0);
    ios::sync_with_stdio(false);

    string s;
    char table[3];
    char ch;
    int ans = 0;

    Mem0(table);

    cin >> s;

    int i;

    rep(i, 3) {
        ch = s[i];

        if (ch == 'a' && table[0] == 0) {
            table[0] = 1;
            ans++;
        } else if (ch == 'b' && table[1] == 0) {
            table[1] = 1;
            ans++;
        } else if (ch == 'c' && table[2] == 0) {
            table[2] = 1;
            ans++;
        }
    }

    if (ans == 3) Out("Yes");
    else Out("No");

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define Hello ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define endl '\n'
int main()
{
    Hello
    vector<int> v;
    for(int i = 0; i <= 10; i++)
        v.push_back(100*(10 - i));
    int n, k;
    cin >> n >> k;
    if(n >= 10)
        cout << k;
    else
        cout << k + (100*(10 - n));
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
	int h,m,s,data;
	scanf("%d",&data);
	h=data/60/60;
	m=(data/60)%60;
	s=data%60;
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

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

#define TYPE(c)   remove_reference_t<decltype(c)>
#define REP(i, n) for(TYPE(n) i = 0; i < n; i++)
#define FOR(v, c) for(TYPE(c.begin()) v = c.begin(); v != c.end(); v++)
#define ALL(c)    c.begin(), c.end()
#define SORT(c)   sort(ALL(c))
#define RSORT(c)  sort(ALL(c), greater<TYPE(c)::value_type>())
#define UNIQUE(c) c.erase(unique(ALL(c)), c.end())

using namespace std;
using ll = long long;

constexpr int MOD  = (int)1e9 + 7;
constexpr int INF  = (int)1e9 + 1;
constexpr ll  LINF = (ll)1e18 + 1;
template<typename T> constexpr bool chmax(T& a, const T& b)
{ if(a < b) { a = b; return true; } else { return false; } }
template<typename T> constexpr bool chmin(T& a, const T& b)
{ if(b < a) { a = b; return true; } else { return false; } }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T>& p)
{ return os << "(" << p.first << "," << p.second << ")"; }
ostream& operator<<(ostream &os, const string& s)
{ FOR(v, s) os << *v; return os; }
template<typename T> auto operator<<(ostream& os, const T& t)
    -> typename conditional<true, ostream&, decltype(*t.begin())>::type
{ os << "["; FOR(v, t) { if(v != t.begin()) os << ","; os << *v; } os << "]"; return os; }

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

    int N;
    std::cin >> N;
    map<string, int> map;
    int m = 0;
    REP(i, N) {
        string S;
        std::cin >> S;
        chmax(m, ++map[S]);
    }
    for(const auto& v : map) {
        if(v.second == m) std::cout << v.first << "\n";
    }

    return 0;
}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author silviase
 */
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);
        DHandstand solver = new DHandstand();
        solver.solve(1, in, out);
        out.close();
    }

    static class DHandstand {
        public void solve(int testNumber, Scanner in, PrintWriter out) {

            int n = in.nextInt();
            int k = in.nextInt();
            String s = in.next();
            ArrayList<Integer> zero = new ArrayList<>();
            ArrayList<Integer> ichi = new ArrayList<>();
            int zc = 0;
            int zi = 0;
            int max = 0;
            if (s.charAt(0) == '0') {
                ichi.add(0);
            }
            for (int i = 0; i < s.length(); i++) {
                final boolean f = i > 0 && s.charAt(i) != s.charAt(i - 1);
                if (s.charAt(i) == '0') {
                    zc++;
                    if (f) {
                        ichi.add(zi);
                        zi = 0;
                    }
                } else {
                    zi++;
                    if (f) {
                        zero.add(zc);
                        zc = 0;
                    }
                }
            }
            if (zi != 0) {
                ichi.add(zi);
            } else {
                zero.add(zc);
            }

            if (s.charAt(s.length() - 1) == '0') {
                ichi.add(0);
            }

            if (zero.size() <= k) {
                out.println(n);
            } else {
                // out.println(zero.toString());
                // out.println(ichi.toString());
                int sum = 0;
                for (int i = 0; i < k; i++) {
                    sum += zero.get(i);
                    sum += ichi.get(i);
                }
                sum += ichi.get(k);
                max = sum;
                //out.println(sum);
                for (int i = k; i < zero.size(); i++) {
                    sum -= zero.get(i - k) + ichi.get(i - k);
                    sum += zero.get(i) + ichi.get(i + 1);
                    max = Math.max(max, sum);
                    //out.println(sum);
                }
                out.println(max);

            }

        }

    }
}



Measured memory_bytes: 27448
#include<bits/stdc++.h>
#define int long long int
using namespace std;

signed main()
{ 
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    char c;
    cin>>c;
    if((int)c>=(int)'a' && (int)c<=(int)'z')
    cout<<"a";
    else
    cout<<"A";
    return 0;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
 
  // ここにプログラムを追記
  for(int i=0;i<N;i++){
    string color;
    cin>>color;
    
    if(color=="Y"){
      cout<<"Four"<<endl;
      break;
    }
    else if(i==N-1){
      cout<<"Three"<<endl;
    }
  }
  
}

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

int main() {

	string day;

	cin >> day;

	int ans = 0;

	if (day == "SUN") {
		ans = 7;
	}
	else if (day == "MON") {
		ans = 6;
	}
	else if (day == "TUE") {
		ans = 5;
	}
	else if (day == "WED") {
		ans = 4;
	}
	else if (day == "THU") {
		ans = 3;
	}
	else if (day == "FRI") {
		ans = 2;
	}
	else if (day == "SAT") {
		ans = 1;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <unordered_map>
#include <cmath>
#include <utility> // pair make_pair
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits> // LLONG_MAX, LLONG_MIN, INT_MIN, INT_MAX
#include <assert.h>

#define m0(x) memset(x,0,sizeof(x))
#define m1(x) memset(x,63,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define ll long long
//#define int ll
#define INF INT_MAX/10
#define MOD 1000000007

using namespace std;
using Pi = pair<int, int>;
using Graph = vector<vector<int> >;
using WeightGraph = vector<vector<Pi> >;

int Input[100100];
int diff[100100];

int main() {
  int N, M; cin >> N >> M;
  for (int i = 0; i < M; i++) {
    cin >> Input[i];
  }
  sort(Input, Input+M);
  for (int i = 0; i < M-1; i++) {
    diff[i] = Input[i+1] - Input[i];
    // cout << diff[i] << " ";
  }
  // cout << endl;

  sort(diff, diff+M-1);
  // for (int i = 0; i < M-1; i++) {
  //   cout << diff[i] << " ";
  // }
  // cout << endl;

  if (N >= M) {
    cout << 0 << endl;
  } else {
    int ans = accumulate(diff, diff+M-1-N+1, 0);
    cout << ans << endl;
  }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

const int MOD = 1000000007;

const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

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

Measured memory_bytes: 256
#include <algorithm>
#include<iostream>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<list>
#include<map>
#include<set>
#include<string>
#include <sstream>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
const int INF = 0x7fffffff;
using lll = long long;
using ull = unsigned long long;
using namespace std;


int main(){
  lll ii,jj,kk;
  vector<int> ret;
  string s;
  cin >> s;
  if(s == "ABC"){
    cout << "ARC" << endl;
  }
  else{
    cout << "ABC" << endl;
  }

  return 0;
}


Measured memory_bytes: 3592
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n int
	var m int64
	fmt.Scan(&n, &m)
	ar := make(drinks, n)
	for i := range ar {
		fmt.Scan(&ar[i].cost, &ar[i].count)
	}
	sort.Sort(ar)
	var ans int64
	for _, d := range ar {
		if d.count <= m {
			m -= d.count
			ans += d.cost * d.count
		} else {
			ans += d.cost * m
			break
		}
	}
	fmt.Println(ans)
}

type drink struct {
	cost  int64
	count int64
}
type drinks []drink

func (d drinks) Len() int {
	return len(d)
}

func (d drinks) Swap(i, j int) {
	d[i], d[j] = d[j], d[i]
}

func (d drinks) Less(i, j int) bool {
	return d[i].cost < d[j].cost
}


Measured memory_bytes: 5376
import sys, math
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]


def main():
    N = ii()
    c = list(input())
    r = c.count('R')
    if r == 0:
        print(0)
        return
    print(r-c[:r].count('R'))

if __name__ == '__main__':
    main()

Measured memory_bytes: 12484