akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
void solve3(vector<int> ARRAY,vector<int> OO1,vector<int> EE1,int n){
		sort(OO1.begin(),OO1.end());
		sort(EE1.begin(),EE1.end());
		if(OO1.size()==0){
			int i = 0, j = EE1.size()-1;
			int n = EE1.size();
			int k = 0;
			while(i<n/2){
				ARRAY[k++] = EE1[i++];
				ARRAY[k++] = EE1[j--];
			}
			if(n%2) ARRAY[k++] = EE1[i];
		}
		else if(EE1.size()==0){
			int i = 0, j = OO1.size()-1;
			int n = OO1.size();
			int k = 0;
			while(i<n/2){
				ARRAY[k++] = OO1[i++];
				ARRAY[k++] = OO1[j--];
			}
			if(n%2)
			ARRAY[k++] = OO1[i];
		}
		else{
			int k =0;
			int NUM1 = EE1.size();
			int NUM2 = OO1.size();
			if(OO1[0]-EE1[NUM1-1]==1){
				for(int i=0;i<NUM2;i++)
					ARRAY[k++] = OO1[i];
				for(int i=0;i<NUM1;i++) ARRAY[k++] =EE1[i];
			}
			else if(EE1[0]-OO1[NUM2-1]==1){
				for(int i=0;i<NUM1;i++) ARRAY[k++] =EE1[i];
				for(int i=0;i<NUM2;i++) ARRAY[k++] = OO1[i];
			}
			else{
					for(int i=0;i<NUM1;i++) ARRAY[k++] =EE1[i];
					for(int i=0;i<NUM2;i++) ARRAY[k++] = OO1[i];
			}
		}
		for(int i = 0;i<n;i++) cout<<ARRAY[i]<<" ";
		cout<<endl;
}
#define ll long long 

int main(){
      int n,m;
  cin >> n >> m;
  cout << n*(n-1)/2+m*(m-1)/2;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <bits/stdc++.h>

using namespace std;
using ll = long long ;
const int INF = 1001001001;


int main() {

    int n,m;
    cin >> n >> m ;
    int s[m],c[m];
    for(int i=0;i<m;++i){
        cin >> s[i] >> c[i] ;
    }

    int counter = 0 ;
    while(counter<=999){
        int nx = counter/10;
        vector<int> x ;
        x.push_back(counter%10);
        while(nx){
            x.push_back(nx%10);
            nx/=10;
        }
        reverse(x.begin(),x.end());
        if(x.size()!=n) {
            counter++ ;
        continue;
        }
        bool ok = true;
        for(int i=0;i<m;++i){
            if(x[s[i]-1]!=c[i]) ok = false;
        }
        if(ok){
            cout << counter << endl ;
            return 0 ;
        }
        counter++ ;
    }

    cout << -1 << endl;

    return 0 ;
}

Measured memory_bytes: 256
#include <iostream>

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

int main(){
    string s;
    cin >> s;
    ll ssum = 0;
    REP(i, s.size()){
        ssum += s.at(i) - '0';
    }
    cout << max(ssum, (ll)(9 * (s.size() - 1) + (s.at(0) - '0' - 1))) << endl;
    return 0;
}


Measured memory_bytes: 256
num = STDIN.gets

games = Array.new
num.to_i.times do
  games << ((STDIN.gets).split).map { |i| i.to_i }
end

games.each do |val|
  a1 = val[0] % val[1]
  if a1 == 0
    print "#{val[1]}\n"
  else
    print "#{a1}\n"
  end
end

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

typedef long long int ll;
typedef long double ld;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define MOD (ll)(1e9 + 7)
#define vi vector<int>
#define vii vector<vector<int> >
#define vl vector<ll>
#define vll vector<vector<ll> >
#define vc(T, nm) vector<T> nm
#define pb push_back
#define popb pop_back
#define si set<int>
#define sl set<ll>
#define F first
#define S second
#define pii pair<int, int>
#define mp make_pair
#define ins insert
#define ers erase
#define endl "\n"
#define mul(a, b) ((a % MOD) * (b % MOD)) % MOD
#define adr(a, b) ((a % MOD) + (b % MOD)) % MOD
#define FORA(x, s, e, inc) for(ll x = s; x != e; x += inc)
#define ROFA(x, s, e, inc) for(ll x = s; x != e; x -= inc)
#define FOR(x, s, e) FORA(x, s, e, 1)
#define ROF(x, s, e) ROFA(x, s, e, 1)
#define loop(x, n) FOR(x, 0, n)
#define rd1(t, a) 					t a; cin >> a;
#define rd2(t, a, b) 				rd1(t, a); rd1(t, b); 
#define rd3(t, a, b, c) 			rd2(t, a, b); rd1(t, c);
#define rd4(t, a, b, c, d) 			rd3(t, a, b, c); rd1(t, d);
#define rd5(t, a, b, c, d, e) 		rd4(t, a, b, c, d); rd1(t, e);
#define rd6(t, a, b, c, d, e, f) 	rd5(t, a, b, c, d, e); rd1(t, f);
#define rdA(t, nm, len)				t nm[len]; loop(i, len) {cin >> nm[i];}
#ifdef DEBUG
	#define deb(v) cout << endl << #v << ": " << v << endl
	#define db1(v) cout << endl << #v << ": " << "[ "; for(auto x: v) {cout << x << " ";}; cout << "]" << endl;
	#define db2(v) cout << endl << #v << ": " << endl; for(auto r: v) {cout << "[ "; for(auto x: r) {cout << x << " ";}; cout << "]" << endl;};
	#define dbl cout << "-------------------------------" << endl
#else
	#define deb(v)
	#define db1(v)
	#define db2(v)
	#define dbl
#endif

void solve() {
    rd1(ll, n);
    vl A(n);
    FOR(i, 0, n)
        cin >> A[i];
    
    vl P(n);
    P[n - 1] = 0;
    
    for(int i = n - 2; i >= 0; i--) {
        P[i] = (P[i + 1] % MOD + A[i + 1] % MOD) % MOD;
    }
    
    ll ans = 0;
    for(int i = 0; i < n; i++) {
        ans = (ans % MOD + (A[i] % MOD * P[i] % MOD) % MOD) % MOD;
    }
    
    cout << ans;   
}


int main() {
	
	fastio;
	
	ll t = 1;
    while(t--) {
        solve();
    }


	return 0;
}


Measured memory_bytes: 6364
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int A[2020];
vector<pair<int,int>> E[2020];
int vis[2020];

deque<int> dfs(int cur) {
	deque<int> R;
	vis[cur]=1;
	sort(ALL(E[cur]));
	FORR(r,E[cur]) if(vis[r.second]==0) {
		deque<int> R2=dfs(r.second), R3;
		while(R.size() || R2.size()) {
			if(R2.size() && (R.empty() || R.front()<=R2.front())) {
				R3.push_back(R2.front());
				R2.pop_front();
			}
			else {
				R3.push_back(R.front());
				R.pop_front();
			}
		}
		R=R3;
	}
	R.push_front(A[cur]);
	return R;
}


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) cin>>A[i];
	FOR(x,N) FOR(y,N) if(x!=y && __gcd(A[x],A[y])>1) E[x].push_back({A[y],y});
	
	FOR(i,N) E[N].push_back({A[i],i});
	auto ret=dfs(N);
	FOR(i,N) _P("%d%c",ret[i+1],(i==N-1)?'\n':' ');
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


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

using namespace std;
typedef long long ll;
typedef pair<int, int> pair2;
typedef pair<int, pair<int, int> > pair3;
typedef pair<int, pair<int, pair<int, int> > > pair4;
#define MAXN 200013
#define INF 1000000000000000000LL
#define MOD 1000000007LL
#define IINF 1000000000
#define mp make_pair
#define pb push_back
#define remove pop
#define all(x) x.begin(), x.end()

int n, k, values[MAXN];

struct TreeMax {
	typedef int T;
	static constexpr T unit = -IINF;
	T f(T a, T b) { return max(a, b); } // (any associative fn)
	vector<T> s; int n;
	TreeMax(int n = 0, T def = unit) : s(2*n, def), n(n) {}
	void update(int pos, T val) {
		for (s[pos += n] = val; pos /= 2;)
			s[pos] = f(s[pos * 2], s[pos * 2 + 1]);
	}
	T query(int b, int e) { // query [b, e)
		T ra = unit, rb = unit;
		for (b += n, e += n; b < e; b /= 2, e /= 2) {
			if (b % 2) ra = f(ra, s[b++]);
			if (e % 2) rb = f(s[--e], rb);
		}
		return f(ra, rb);
	}
};

struct TreeMin {
	typedef int T;
	static constexpr T unit = IINF;
	T f(T a, T b) { return min(a, b); } // (any associative fn)
	vector<T> s; int n;
	TreeMin(int n = 0, T def = unit) : s(2*n, def), n(n) {}
	void update(int pos, T val) {
		for (s[pos += n] = val; pos /= 2;)
			s[pos] = f(s[pos * 2], s[pos * 2 + 1]);
	}
	T query(int b, int e) { // query [b, e)
		T ra = unit, rb = unit;
		for (b += n, e += n; b < e; b /= 2, e /= 2) {
			if (b % 2) ra = f(ra, s[b++]);
			if (e % 2) rb = f(s[--e], rb);
		}
		return f(ra, rb);
	}
};

int badCount[MAXN];


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

	cin >> n >> k;

	for (int i = 0; i < n; i++) {
		cin >> values[i];
	}
	
	for (int i = 0; i < n - 1; i++) {
		badCount[i + 1] = badCount[i];
		if (values[i] > values[i + 1]) {
			badCount[i + 1]++;
		}
	}

	int zeroCount = 0;
	if (badCount[k - 1] == 0) zeroCount++;

	int answer = 1;

	//Now transition. If any inversions, it does something new, answer++.
	TreeMax helperMax(n);
	TreeMin helperMin(n);

	for (int i = 0; i < n; i++) {
		helperMax.update(i, values[i]);
	}
	for (int i = 0; i < n; i++) {
		helperMin.update(i, values[i]);
	}

	for (int i = k; i < n; i++) {
		//i is the new left point
		//i - k is removed from consideration

		bool changedLeft = helperMin.query(i - k, i) < values[i - k];
		bool changedRight = helperMax.query(i - k + 1, i + 1) > values[i];

		//cout << "from " << i - k + 1 << " to " << i << " is " << changedLeft << ' ' << changedRight << endl;
		answer += (changedLeft || changedRight);

		bool isZero = ((badCount[i] - badCount[i - k + 1]) == 0);
		//cout << "zero status is " << isZero << endl;
		//if (isZero) zeroCount++;
		if (isZero && (changedLeft || changedRight)) zeroCount++;
	}
	if (zeroCount >= 1) answer -= zeroCount - 1;
	cout << answer << endl;
}

Measured memory_bytes: 4992
#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 P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

template<class T> inline bool chmin(T &a, T b){
	if(a>b){a=b;return true;}
	return false;
}
template<class T> inline bool chmax(T &a, T b){
	if(a<b){a=b;return true;}
	return false;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N;
int ans[505][505];
bool used[505][505];
signed main(){
	cin>>N;
	REP(i,N+1)REP(j,N+1){
		ans[i][j]=inf;used[i][j]=true;
	}
	queue<P>que;
	REP(i,N+1){
		ans[1][i]=ans[N][i]=0;
		ans[i][1]=ans[i][N]=0;
		que.push({1,i});que.push({N,i});
		que.push({i,1});que.push({i,N});
	}
	int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
	while(!que.empty()){
		P p=que.front();que.pop();
		rep(i,4){
			int nx=p.first+dx[i],ny=p.second+dy[i];
			if(nx<=0||ny<=0||nx>N||ny>N)continue;
			if(ans[nx][ny]==inf){
				ans[nx][ny]=ans[p.first][p.second]+1;
				que.push({nx,ny});
			}
		}
	}
	int res=0;
	rep(i,N*N){
		int a;cin>>a;
		int x=(a-1)/N+1,y=(a-1)%N+1;
		res+=ans[x][y];
		used[x][y]=false;
		queue<P>que;que.push({x,y});
		rep(j,4){
			int nx=x+dx[j],ny=y+dy[j];
			chmin(ans[x][y],ans[nx][ny]+used[nx][ny]);
		}
		while(!que.empty()){
			P p=que.front();que.pop();
			rep(j,4){
				int nx=p.first+dx[j],ny=p.second+dy[j];
				int nc=ans[p.first][p.second]+used[p.first][p.second];
				if(ans[nx][ny]>nc){
					ans[nx][ny]=nc;
					que.push({nx,ny});
				}
			}
		}
	}
	cout<<res<<endl;
}


Measured memory_bytes: 5864
#!/usr/bin/ruby
#encoding: utf-8

n = gets.to_i
a = gets.split.map(&:to_i)
b = gets.split.map(&:to_i)

ans = 0

(0..n-1).each do |i|
  if a[i] >= b[i] 
    ans += b[i]
  else
    ans += a[i]
    b[i] -= a[i]
    if a[i+1] >= b[i]
      ans += b[i]
      a[i+1] -= b[i]
    else
      ans += a[i+1]
      a[i+1] = 0
    end
  end
end

puts ans


Measured memory_bytes: 15396
# -*- coding: utf-8 -*-
import math
a,b,h,m = map(int,input().split())

time = h * 60 + m
theta_a = (360 / 720 * time) % 360
theta_b = (360 / 60 * time) % 360
theta = max(theta_a, theta_b) - min(theta_a, theta_b)
theta = math.radians(theta)
tmp = a ** 2 + b ** 2 - 2 * a * b * math.cos(theta)
print(pow(tmp, 0.5))


Measured memory_bytes: 9512
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    string str1, str2, str3;
    cin >> str1 >> str2 >> str3;
    if(str1.at(str1.size()-1) == str2.at(0) && str2.at(str2.size()-1) == str3.at(0)){
        cout << "YES" << endl;
    }
    
    else{
        cout << "NO" << endl;
    }
    
}


Measured memory_bytes: 256
package main

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

var (
	sc     scanner
	reader *bufio.Reader
	writer *bufio.Writer
)

func solve() {
	_, t := sc.nextInt(), sc.nextInt()
	a := sc.nextInts()

	x := t
	for i := 0; i < len(a)-1; i++ {
		x += _min(t, a[i+1]-a[i])
	}

	ans := strconv.Itoa(x)
	writer.WriteString(ans + "\n")
}

/* template functions */

func main() {
	solve()
	writer.Flush()
}

func init() {
	sc = scanner{
		buf: make([]string, 0, 64),
		cur: 0,
	}
	reader = bufio.NewReader(os.Stdin)
	writer = bufio.NewWriter(os.Stdout)
}

type scanner struct {
	buf []string
	cur int
}

func (s *scanner) readln() {
	line, err := reader.ReadString('\n')
	if err != nil {
		panic(err)
	}

	drop := 1
	if len(line) > 1 && line[len(line)-2] == '\r' {
		drop = 2
	}
	line = line[:len(line)-drop]

	s.cur = 0
	s.buf = strings.Split(line, " ")
}

func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}

func (s *scanner) resetCur() {
	s.cur = 0
}

func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}

func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}

func (s *scanner) nextByte() byte {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur][0]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}

func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}

func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i, _ := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}

func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur], 64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}

func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i, _ := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i], 64)
	}
	s.resetCur()
	return res
}

func _max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}

func _min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}

func _abs(x int) int {
	return int(math.Abs(float64(x)))
}

// Searchable
// idx := lower_bound([]int{-199, -1, 0, 2, 4, 67, 100, 8435}, 60)
// => idx = 5
//
// No present
// idx := lower_bound([]int{-199, -1, 0, 2, 4, 67, 100, 8435}, 10000)
// => idx = 8
func lower_bound(a []int, x int) int {
	return sort.SearchInts(a, x)
}

func dump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}

func yes() {
	writer.WriteString("Yes\n")
}

func no() {
	writer.WriteString("No\n")
}


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

int main() {
	int n, l;
	cin >> n >> l;
	string poof[n];
	for (int i = 0; i < n; i++) {
		cin >> poof[i];
	}
	sort(poof, poof+n);
	for (string s: poof) {
		cout << s;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3544
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import permutations,combinations
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

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

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

H,N = myinput()
AB = mylistinput(N)

# dp[i]: 敵の体力をiだけ減らすとしたときの，消耗魔力累計値の最小値
dp = [float("inf")]*(H+1)
dp[0] = 0

for i in range(1,H+1):
    for j in range(N):
        a = AB[j][0]
        b = AB[j][1]
        if i<a:
            dp[i] = min( dp[i], dp[0]+b )
        else:
            dp[i] = min( dp[i], dp[i-a]+b )
# print(dp)
ans = dp[H]
print(ans)

Measured memory_bytes: 43756
#include "bits/stdc++.h"
/* Properties of modulo:
	(a/b)%m ,where m is prime  = (a%m) * (b^(m-2))%m
*/
    /*ROLLING HASH
    Rabin-Karp algorithm for pattern matching in a string in O(n) time
    Calculating the number of different substrings of a string in O(n2logn)
    Calculating the number of palindromic substrings in a string.
    */
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
#define ll long long
#define pb push_back
#define gcd __gcd
#define nl cout<<"\n"
#define endl "\n"
#define all(c) (c).begin(),(c).end()
#define trav(a,x) for(auto a = x.begin() ; a != x.end() ; a++)
#define lb lower_bound
#define ub upper_bound
#define f first
#define s second
//template<typename T>
//#define o_set(T) tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
// o_set(ll) name ; -- defining ordered set
//member functions :
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set - returns iterator
bool compare(ll a, ll b){
    return a > b;
}
ll power(ll x, ll ex , ll md) {
    ll ans = 1ll;
    while (ex > 0) {
        if (ex & 1ll) ans = (ans * x) % md;
        ex >>= 1ll;
        x = (x * x) % md;
    }
    return ans;
}
void solve(){
    ll n , m;
    cin >> n >> m;
    ll h[n];
    set<ll> ans;
    bool vis[n] = {false};
    for(ll i = 0 ; i < n ; i++) cin >> h[i];
    for(ll i = 0 ; i < m ; i++){
        ll a , b;
        cin >> a >> b;
        if(h[a - 1] > h[b - 1]){
                vis[b - 1] = true;
        }
        else if (h[a - 1] < h[b - 1]){
            vis[a - 1] = true;
        }
        else{
            vis[a - 1] = true;
            vis[b - 1] = true;
        }
    }
    ll ct = 0;
    for(ll i = 0; i < n ; i++) if(!vis[i]) ct++;
        cout << ct << endl;
}
int main(){
    IOS;
    ll T=1;
    //cin>>T;
    ll t=0;
    while(t++<T){
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 4724
//Aaryan Jagetia
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define mp(x,y) make_pair(x,y)
#define mod 1000000007
#define sc(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test cin>>t;while(t--)
int main()
{    
    fast
ll a,b;
cin>>a>>b;
cout<<a*b;
return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
using namespace std;
typedef long long llong;
#define NMAX 100010
#define HMAX 1000000010

int main() {

	int N, K;
	vector<llong> H;

	llong iptlong;

	cin >> N >> K;

	for (int i = 0; i < N; i++) {
		cin >> iptlong;
		H.push_back(iptlong);
	}
	sort(H.begin(), H.end());

	llong mingap = HMAX;
	for (int i = 0; i <= N - K; i++) {
		if (mingap > H[i + K - 1] - H[i])mingap = H[i + K - 1] - H[i];
	}
	cout << mingap << endl;



	
	return 0;
}

Measured memory_bytes: 1400
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

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

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cout << i << "\n"

// const ll MOD = 998244353;
const ll MOD = 1000000007;

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  //問題文中の添え字が0-indexか1-indexか確認!

  ll x, y;
  std::cin >> x >> y;
  if (x < y) std::swap(x, y);
  if (x > y + 1) {
    std::cout << "Alice";
  } else {
    std::cout << "Brown";
  }
  return 0;
}

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

int main(){
  int N; cin >>N;
  int A[N+1], B[N];
  for(int i=0;i<=N;i++){
    cin >>A[i];
  }
  for(int i=0;i<N;i++){
    cin >>B[i];
  }

  long long int ans = 0; 
  for(int i=0;i<N;i++){
    if(A[i]>=B[i]){
      ans += B[i];
      A[i] -= B[i];
      B[i] = 0;
    } else {
      ans += A[i];
      B[i] -= A[i];
      A[i] = 0;
      if(A[i+1]>=B[i]){
        ans += B[i];
        A[i+1] -= B[i];
        B[i] = 0;
      } else {
        ans += A[i+1];
        B[i] -= A[i+1];
        A[i+1] = 0;
      }
    }
  }

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


Measured memory_bytes: 1024
using System;


namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int d = int.Parse(Console.ReadLine());
            int e = int.Parse(Console.ReadLine());

            int aa = (10 - (a % 10)) % 10;
            int bb = (10 - (b % 10)) % 10;
            int cc = (10 - (c % 10)) % 10;
            int dd = (10 - (d % 10)) % 10;
            int ee = (10 - (e % 10)) % 10;

            int max = 0;
       
            int[] num = new int[] { aa, bb, cc, dd, ee };
            for (int i = 0; i < num.Length; i++)
            {
                if(num[i] > max)
                {
                    max = num[i];
                }
            } 

            int answer = (a + b + c + d + e) + (aa + bb + cc + dd + ee) - max;
                  
            Console.WriteLine(answer);
            
         }
    }
}


Measured memory_bytes: 13140
def main():
    N, A, B = map(int, input().split())
    ans = []
    for i in range(1, N+1):
        tmp = list(str(i))
        tmplist = [int(x) for x in tmp]
        s = sum(tmplist)
        if A <= s <= B:
            ans.append(i)
    print(sum(ans))

if __name__ == "__main__":
    main()


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

static const int MAX = 200000;

vector<vector<int>> adj_list(MAX);
vector<int> visited(MAX, -1);
vector<int> init_visited(MAX, -1);

int group = 0;

void dfs(int node){
    // cout << "init node " << node << endl;
    visited.at(node) = group;
    
    for(int i = 0; ; i++){
        int next_node = adj_list.at(node).at(i);
        // cout << next_node << endl;

        if(next_node != -1 && visited.at(next_node) == -1){
            // cout << "called dfs with " << next_node << endl;
            dfs(next_node);
        }
        if(next_node == -1){
            break;
        }
    }
    // cout << "returned from " << node << endl;
}

int main(){
    int n, m; cin >> n >> m;
    int s, t;

    rep(i, m){
        cin >> s >> t;
        adj_list.at(s-1).push_back(t-1);
        adj_list.at(t-1).push_back(s-1);
    }
        // 番兵の挿入
    rep(i, n){
        adj_list.at(i).push_back(-1);
    }

    for(int i = 0; i < n; i++){
        if(visited.at(i) == -1){
            dfs(i);
            group++;
        }
    }

    vector<int> mem_group(group);

    for(int i = 0; i < n; i++){
        mem_group.at(visited.at(i))++;
    }

    int ans = 0;

    for(int i = 0; i < group; i++){
        if(ans < mem_group.at(i)){
            ans = mem_group.at(i);
        }
    }
    cout << ans << endl;






}

Measured memory_bytes: 25088
//仲良しうさぎ

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) int n;cin>>n;vector<int>a(n);rep(i,0,n)cin>>a[i]
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
template<class T>inline bool chmin(T& a,T b,bool f){
if(f==1){if(a>b){a=b;return true;}return false;}
else if(f==0){if(a<b){a=b;return true;}return false;}return false;}
typedef pair<int,string> p;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

int main (){
    nvarep(n,a);
    ll ans = 0;
    rep(i,0,n){
        if(a[a[i]-1]==i+1)ans++;
    }
    cout<<ans/2<<nnn;
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
int main(void){
    int w,h,x,y,r;

    scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);

    if(w>=0 && h>=0){
        if(0<x+r && x+r<=w && 0<y+r && y+r<=h){
            printf("Yes\n");
        }else {
            printf("No\n");
        }
    }else if(w<0 && h>0){
        if(-w<x+r && x+r<0 && 0<y+r && y+r<h){
                printf("Yes\n");
            }else{
                printf("No\n");
            }
    }else if(w<=0 && h<=0){
        if(-w<x+r && x+r<0 && -h<y+r && y+r<0){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }else if(w>0 && h<0){
        if(0<x+r && x+r<w && -h<y+r && y+r<0){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }
    
    
return 0;

}
   


Measured memory_bytes: 2100
import java.util.*;
import java.io.*;

public class Main {

  private static void solve() {
    int n = nextInt();
    int w = nextInt();

    int[] value = new int[n];
    int[] weight = new int[n];

    for (int i = 0; i < n; i++) {
      weight[i] = nextInt();
      value[i] = nextInt();
    }

    long[][] dp = new long[n][100010];

    for (int i = 0; i < n; i++) {
      Arrays.fill(dp[i], Long.MAX_VALUE);
    }

    dp[0][0] = 0;
    dp[0][value[0]] = weight[0];

    for (int i = 1; i < n; i++) {
      for (int j = 0; j <= 100000; j++) {
        dp[i][j] = dp[i - 1][j];
        if (j - value[i] >= 0 && dp[i - 1][j - value[i]] != Long.MAX_VALUE) {
          dp[i][j] = Math.min(dp[i][j], dp[i - 1][j - value[i]] + weight[i]);
        }
      }
    }

    long max = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j <= 100000; j++) {
        if (dp[i][j] <= w) {
          max = Math.max(max, j);
        }
      }
    }

    System.out.println(max);
  }

  private static void run() {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(System.out);

    solve();

    out.close();
  }

  private static StringTokenizer st;
  private static BufferedReader br;
  private static PrintWriter out;

  private static String next() {
    while (st == null || !st.hasMoreElements()) {
      String s;
      try {
        s = br.readLine();
      } catch (IOException e) {
        return null;
      }
      st = new StringTokenizer(s);
    }
    return st.nextToken();
  }

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

  private static long nextLong() {
    return Long.parseLong(next());
  }

  public static void main(String[] args) {
    run();
  }
}

Measured memory_bytes: 127188
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

int N, A[200001], tmp;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N;
    int *res = new int[N];
    for (int i = 1; i < N; i++) cin >> tmp, A[i] = tmp, res[tmp - 1]++;
    for (int i = 0; i < N; i++) cout << res[i] << " ";

    return 0;
}

Measured memory_bytes: 5140
#include <cassert>
#include "limits.h"
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " <<"LINE:"<<__LINE__<<"  "<< #i <<":"<< i << std::endl

 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if ((a == 0)||(mod!=-1&&a%mod==0)) {
    return 0;
  }
 
  long long x = 1;
 
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}
 
// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

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

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

  ll n;
  std::cin>>n;

  std::string s;
  std::cin>>s;

  std::set<ll> occur;

  std::vector<std::set<ll>> occur2(10); 

  std::set<ll> ans;

  rep(i,0,n){
    rep(j,0,10){
      for(ll e:occur2[j]){
        ans.insert(e*100+j*10+s[i]-'0');
      }
    }

    for(ll e:occur){
      occur2[s[i]-'0'].insert(e);
    }

    occur.insert(s[i]-'0');
  }

  std::cout<<ans.size()<<"\n";

  return 0;
}

Measured memory_bytes: 384
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

K = sum(B) - sum(A)

cntA = 0
for i in range(N):
    a, b = A[i], B[i]
    d = b - a
    if d > 0:
        d = -(-d // 2)
        cntA += d
        A[i] += d * 2

cntB = 0
for i in range(N):
    a, b = A[i], B[i]
    d = a - b
    if d > 0:
        cntB += d
        B[i] += d

if max(cntA, cntB) > K:
    print('No')
    exit()

dA = K - cntA
dB = K - cntB

print('Yes' if dA * 2 == dB else 'No')

Measured memory_bytes: 4600
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);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int height = 0;
            for (int i = 1; i < b - a; i++) {
                height += i;
            }
            out.println(height - a);
        }

    }
}



Measured memory_bytes: 23380
/************************Code by Hardik Aggarwal!!!!***********************************/

#include<bits/stdc++.h>
using namespace std;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL); 

#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define endl '\n'
#define debug cout << "Hold right there sparky.....\n";
#define forn(low,high,i) for(i=low;i<high;i++)
#define forrev(high,low,i) for(i = high; i>= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef long long int ll;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
const ll mod =998244353;

bool comp(pll p1,pll p2)
{
    if(p1.ff==p2.ff)
        return p1.ss<p2.ss;

    return p1.ff<p2.ff;
}

int main()
{
    

    IOS
    ll n;
    cin>>n;
    ll ans=(n+1)/(2);
    cout<<double(double(ans)/n)<<endl;


    




    
    
}
    
 
    
    



Measured memory_bytes: 764
use std::cmp::min;

#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let (n, m) = scan!(usize, usize);

    let mut graph = vec![vec![1 << 30; n + 1]; n + 1];
    for i in 0..graph.len() {
        graph[i][i] = 0
    }

    let mut edges = vec![];
    for _ in 0..m {
        let (a, b, c) = scan!(usize, usize, usize);
        edges.push((a, b, c));
        graph[a][b] = c;
        graph[b][a] = c;
    }

    for k in 1..n + 1 {
        for i in 1..n + 1 {
            for j in 1..n + 1 {
                graph[i][j] = min(graph[i][j], graph[i][k] + graph[k][j])
            }
        }
    }

    let mut ans = 0;
    for e in edges.iter() {
        let mut found = false;
        for i in 1..graph.len() {
            for j in 1..graph[i].len() {
                if graph[i][e.0] + e.2 + graph[e.1][j] == graph[i][j] {
                    found = true;
                }
            }
        }
        if !found {
            ans += 1
        }
    }
    println!("{}", ans)
}


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

using namespace std;

typedef long long ll;

const ll LongINF=1e13+7;
const int INF=1e9+7;
const int dx[]={0,1,0,-1};
const int dy[]={1,0,-1,0};

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template <class T, class Y>T GCD(T a, Y b){if(a<b){int c=a;a=b;b=c;}if (a % b == 0){return b;}return GCD(b, a % b);}
void clear(queue<pair<int, int>> &q){queue<pair<int, int>> empty;swap(q, empty);} //queueの中身の型は適時変更を忘れない

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

int main(){
    int M,D,M1,D2;
    cin>>M>>D>>M1>>D2;
    if(M!=M1&&D!=D2)cout<<1<<endl;
    else cout<<0<<endl;

    return 0;
}

//a=97,z=122

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,M;
  cin >> N >> M;
  int a=M/N;
  for(int i=a;i>0;i--){
    if(M%i==0){
      cout << i << endl;
      return 0;}
  }
}

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


flag = True

x_max = max(x)
y_min = min(y)

for z in range(X+1,Y+1):
    if x_max < z and y_min >= z:
        flag = False
if flag:
    print('War')
else:
    print('No War')


Measured memory_bytes: 3060
#include <cstdio>
bool b[3][3];
int main(){
	int a[3][3], n, x;
	for (int i = 0; i < 3; i++){
		for (int j = 0; j < 3; j++){
			scanf("%d ", &a[i][j]);
		}
	}
	scanf("%d", &n);
	for (int i = 0; i < n; i++){
		scanf("%d", &x);
		for (int j = 0; j < 3; j++){
			for (int k = 0; k < 3; k++){
				if (a[j][k] == x) b[j][k] = true;
			}
		}
	}
	for (int i = 0; i < 3; i++){
		bool succ = true;
		for (int j = 0; j < 3; j++){
			succ = succ && b[i][j];
		}
		if (succ){
			printf("Yes\n");
			return 0;
		}
		succ = true;
		for (int j = 0; j < 3; j++){
			succ = succ && b[j][i];
		}
		if (succ){
			printf("Yes\n");
			return 0;
		}
	}
	if (b[0][0] && b[1][1] && b[2][2]){
		printf("Yes\n");
		return 0;
	}else if (b[0][2] && b[1][1] && b[2][0]){
		printf("Yes\n");
		return 0;
	}
	printf("No\n");
}

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

int main(){
  int N;
  cin >> N;
  vector<int> a(N);
  int count = 0;
  for(int i = 0; i < N; i++){
    cin >> a[i];
    bitset<32> bit(a[i]);
    for(int i = 0;; i++){
        if(bit[i] == 0) {
          count++;
        }
      	else if(bit[i] == 1) break;
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,x,y,a,b,i,k,c, flg;
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%d %d %d %d",&x,&y,&a,&b);
		if(a>4&&b>1){
			c=(double)x*8/10*a+y*8/10*b;
		}
		else{
			c=(double)x*a+y*b;
			if(a<5&&b>1&&c>x*8/10*5+y*8/10*b){
				c=x*8/10*5+y*8/10*b;
			}
			if(a>4&&b<2&&c>x*8/10*a+y*8/10*2){
				c=x*8/10*a+y*8/10*2;
			}
		}
		printf("%d\n",c);
	}
	return 0;
}


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

struct node{
  int key;
  struct node *next;
  struct node *prev;
};

typedef struct node * NodePointer;

void insert(int);
NodePointer listSearch(int);
NodePointer make1node();
void deleteNode(NodePointer);
void deleteFirst();
void deleteLast();
void delete(int);

void listPrint();

NodePointer nil;

int main(){
  int n, i, key;
  char order[15];

  nil=make1node(); //二分木だから必要

  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s %d", order, &key);
    if ( order[0] == 'i' ) {
      insert(key);
    }
    else if ( order[0] == 'd' ) {
      
      if (strlen(order) > 6 ){
	  
	if (order[6] == 'F' ) {
	  deleteFirst();
	}
	else if( order[6] == 'L' ) {
	  deleteLast();
	}
      }
      else{
	delete(key);
      }
    }
  }
  listPrint();

  return 0;
}

void insert(int key){
  
  NodePointer p;

  p=(NodePointer)malloc(sizeof(struct node));

  p->key=key;
  p->next=nil->next;
  nil->next->prev=p;
  nil->next=p;
  p->prev=nil;
}

NodePointer listSearch(int key){

  NodePointer n;

  for(n=nil->next; n!=nil; n=n->next){
    if(n->key == key) return n;
  }
  return NULL;
}

NodePointer make1node(){

  NodePointer p;

  p=(NodePointer)malloc(sizeof(struct node));

  p->next=p;
  p->prev=p;

  return p;
}
void deleteNode(NodePointer p){

  if(p!=nil){
    p->prev->next=p->next;
    p->next->prev=p->prev;
    free(p);
  }
}

void deleteFirst(){

  deleteNode(nil->next);
}

void deleteLast(){

  deleteNode(nil->prev);
}
  
void delete(int key){
  
  NodePointer p;

  p=listSearch(key);

  if(p != NULL) deleteNode(p);

}

void listPrint(){

  NodePointer cur;
  int isf=1;

  cur=nil->next;

  while(1){

    if(cur == nil) break;
    if(isf == 0) printf(" ");

    printf("%d", cur->key);

    cur=cur->next;
    isf=0;
  }
  printf("\n");
}



Measured memory_bytes: 32956
#include <bits/stdc++.h>
 
using namespace std;
#define FOR(i,a,b) for(int (i) = (a); (i) < (b); (i)++)
#define rep(i,n) for(int (i)=0; (i)<(n); (i)++)
 
int main(){
  int n;
  const int max_n = 2 * 1e5;
  cin >> n;
  string s[n];
  for(int i = 0; i < n; i++) cin >> s[i];
 
  map<string, int> mp;
  vector<string> ans;
 
  for(int i = 0; i < n; i++){
    mp[s[i]] = 0;
  }
  for(int i = 0; i < n; i++){
    mp[s[i]] += 1;
  }
  int max_count = 0;
  for(int i = 0; i < n; i++){
    max_count = max(max_count, mp[s[i]]);
  }
  // cout << max_count << endl;
 
  for(int i = 0; i < n; i++){
    if(mp[s[i]] == max_count) ans.push_back(s[i]);
  }
  sort(ans.begin(), ans.end());
  cout << ans[0] << endl;
  for(int i = 1; i < ans.size(); i++){
    if(ans[i] != ans[i-1]) cout << ans[i] << endl;
  }
 
 
 
  return 0;
}

Measured memory_bytes: 28404
#include<bits/stdc++.h>
using namespace std;
int a,b;

int scs(int n){
	int Count=0;
	while(n>0){
		n/=10;
		Count++;
	}
	return Count;
}

int main(){
	cin >> a >> b; 	
	if (scs(a)==1 && scs(b)==1) cout<<a*b;
	else cout<<-1;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>

typedef struct{
  int map[16];
  int sp;
  int md;
}Board;
//左側の数字が、右側の番地に存在したときのMD
int md[16][16];
//dfsの現在のBoardの記録
Board ndfs;
int mov[4]={4,1,-1,-4};

int dfs(int lim,int now,int before);
int idasearch(Board x);
int calcmd(Board x);

int main(void){
  int i,j,sum=0;
  char x,dummy;
  Board start;
  //MD対応表作成
  for(i=0;i<15;i++)for(j=0;j<16;j++)md[i+1][j]=abs(i/4-j/4)+abs(i%4-j%4);
  /*for(i=1;i<16;i++){
    for(j=0;j<16;j++)printf("%d ",md[i][j]);
    printf("\n");
    }*/
  //読み込み
  for(i=0;i<16;i++){
    /*if(i%4!=3)scanf("%c ",&x);
    else scanf("%c%c",&x,&dummy);
    if(x>='1'&&x<='9')start.map[i]=x-'0';
    else if(x>='a'&&x<='f')start.map[i]=10+x-'a';
    else {
      start.sp = i;
      start.map[i]=0;
      }*/
    scanf("%d",&start.map[i]);
    if(start.map[i]==0)start.sp=i;
  }
  //転倒数の計算
  sum=3-start.sp/4;
  for(i=0;i<15;i++)for(j=i+1;j<16;j++)if(start.map[i]>start.map[j]&&start.map[j]!=0)sum++;
  if(sum%2==1)printf("impossible\n");
  else{
    //IDA*
    start.md = calcmd(start);
    //printf("%d\n",start.md);
    printf("%d\n",idasearch(start));
  }
  //for(i=0;i<16;i++)printf("%d",start.map[i]);
  return 0;
}

int calcmd(Board x){
  int i,ans=0;
  for(i=0;i<16;i++)if(x.map[i]!=0)ans+=md[x.map[i]][i];
  x.md = ans;
  return ans;
}
int idasearch(Board x){
  int ans=-1,i;
  for(i=1;i<=80;i++){
    ndfs = x;
    ans = dfs(i,0,-10);
    if(ans!=-1)break;
  }
  return ans;
}
int dfs(int lim,int now,int before){
  //if(lim==19)printf("%d %d\n",now,ndfs.md);
  int i,ans=-1,tmp;
  Board dummy = ndfs;
  //答えになっているか判定
  if(dummy.md==0)return now;
  //探索うちきり
  if(ndfs.md+now>=lim)return -1;
  for(i=0;i<4;i++){
    if(dummy.sp%4==0&&i==2)continue;
    if(dummy.sp%4==3&&i==1)continue;
    ndfs = dummy;
    //-のマスの移動
    ndfs.sp+=mov[i];
    //範囲内かどうか、一手前に戻ってないかどうか
    if(ndfs.sp>=0&&ndfs.sp<16&&before+i!=3){
      //mdをずらす
      ndfs.md -= md[dummy.map[ndfs.sp]][ndfs.sp];
      ndfs.md += md[dummy.map[ndfs.sp]][dummy.sp];
      //swap
      ndfs.map[dummy.sp]=dummy.map[ndfs.sp];
      ndfs.map[ndfs.sp]=0;
      /*for(int j=0;j<16;j++)printf("%2d",dummy.map[j]);
      printf("\n");
      for(int j=0;j<16;j++)printf("%2d",ndfs.map[j]);
      printf("\n\n");*/
      ans = dfs(lim,now+1,i);
      if(ans!=-1)break;
    }
  }
  return ans;
}
/*参考文献
http://www.ic-net.or.jp/home/takaken/nt/slide/solve15.html
プログラミングコンテスト攻略のためのアルゴリズムとデータ構造(会津大学、渡部有隆　著.2015,1)*/



Measured memory_bytes: 2108
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
#if DEBUG
            ReadLine();
#endif
        }

        public void Solve(ConsoleInput cin)
        {
            String s = cin.Read;
            int diff = int.MaxValue;

            for (int i = 0; i < s.Length - 2; i++)
            {
                int num = int.Parse(s.Substring(i, 3));
                int nowDiff = Math.Abs(753 - num);

                if (diff > nowDiff)
                {
                    diff = nowDiff;
                }
            }

            Console.WriteLine(diff);
        }
    }

    class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;

        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 11220
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<ctime>
using namespace std;

const int N=370;
const int M=30;

int D,ans,T,d,q,start;
int s[N][M],lst[M],c[M],t[N],cnt[N][M];

bool time_out(){
	return clock()-start>1950;
}

int calc(){
	int sum=0;
	for (int i=1;i<=26;i++) lst[i]=0;
	for (int i=1;i<=D;i++){
		sum+=s[i][t[i]];
		lst[t[i]]=i;
		for (int j=1;j<=26;j++) sum-=c[j]*(i-lst[j]);
	}
	return sum;
}

int argmx(int d){
	int id=1;
	for (int i=2;i<=26;i++)
		if (s[d][i]>s[d][id]) id=i;
	return id;
}

int main(){
	scanf("%d",&D);
	for (int i=1;i<=26;i++) scanf("%d",&c[i]);
	for (int i=1;i<=D;i++)
		for (int j=1;j<=26;j++) scanf("%d",&s[i][j]);
	for (int i=1;i<=D;i++) t[i]=argmx(i);
	ans=calc();
	start=clock();
	while (!time_out()){
		int sum,tmp;
		d=rand()%D+1; q=rand()%26+1;
		tmp=t[d];
		t[d]=q; sum=calc();
		if (sum>ans) ans=sum;
		else t[d]=tmp;
	}
//	printf("%d\n",ans);
	for (int i=1;i<=D;i++) printf("%d\n",t[i]);
	return 0;
}

Measured memory_bytes: 3908