akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
using namespace std;
#define MAX_N 1100000
int Rank[MAX_N], x[MAX_N];
int SA[MAX_N]; string S, T; int V;
bool Compare(int p, int q) {
	if (Rank[p] < Rank[q])return true;
	if (Rank[p] > Rank[q])return false;
	int D1 = -1, D2 = -1;
	if (p + V <= S.size())D1 = Rank[p + V];
	if (q + V <= S.size())D2 = Rank[q + V];
	if (D1 < D2)return true;
	return false;
}
void Build() {
	for (int i = 0; i < S.size(); i++) { SA[i] = i; Rank[i] = S[i]; }
	SA[S.size()] = S.size(); Rank[S.size()] = -1;
	for (V = 1; V <= S.size(); V *= 2) {
		sort(SA, SA + S.size() + 1, Compare);
		x[SA[0]] = 0;
		for (int i = 1; i <= S.size(); i++) {
			x[SA[i]] = x[SA[i - 1]] + Compare(SA[i - 1], SA[i]);
		}
		for (int i = 0; i <= S.size(); i++)Rank[i] = x[i];
	}
}
int hantei(int C, string &V2) {
	int H = min(S.size() - C, V2.size());
	for (int i = 0; i < H; i++) {
		if (S[i + C] < V2[i])return -1;
		if (S[i + C] > V2[i])return 1;
	}
	return 0;
}
int main() {
	cin >> S; S += '!'; int Q; cin >> Q; Build();
	for (int i = 0; i < Q; i++) {
		cin >> T; int L = 0, R = S.size() + 1, M;
		while (L + 1 < R) {
			M = (L + R) / 2;
			if (hantei(SA[M], T) <= 0)L = M;
			else { R = M; }
		}
		if (hantei(SA[L], T) == 0)cout << "1" << endl;
		else cout << "0" << endl;
	}
	return 0;
}

Measured memory_bytes: 14652
#include <stdio.h>
#include <string.h>
int main()
{
	char a[100];
	scanf("%s",&a);
	if (strcmp(a,"a")==0)
	{
		printf("vowel\n");
	}else if (strcmp(a,"i")==0)
	{
		printf("vowel\n");
	}else if (strcmp(a,"u")==0)
	{
		printf("vowel\n");
	}else if (strcmp(a,"e")==0)
	{
		printf("vowel\n");
	}else if (strcmp(a,"o")==0)
	{
		printf("vowel\n");
	}else{
		printf("consonant\n");
	}
	return 0;
}

Measured memory_bytes: 128
def MI():
    return map(int, input().split())

def LI():
    return list(map(int, input().split()))

X, N = MI()
P = LI()
ans = X

if len(P) == 0:
    print(ans)
    exit()

for i in range(101):
    if not X - i in P:
        ans = X - i
        break
        
    if not X + i in P:
        ans = X + i
        break

print(ans)

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

bool OK(int n, int A, int B) {
    //cout << n << endl;
    int tmp=0;
    tmp += (n / 10000);
    n %= 10000;
    tmp += (n / 1000);
    n %= 1000;
    tmp += (n / 100);
    n %= 100;
    tmp += (n / 10);
    n %= 10;
    tmp += n;
    if(A <= tmp && tmp <= B) {
        //cout << tmp << " ~~\n";
        return true;
    }
    else return false;
}

int main() {
    int n, A, B;
    cin >> n >> A >> B;
    int sum=0;
    for(int i=1; i<=n; i++) {
        if(OK(i, A, B)) sum += i;
    }
    cout << sum << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
  int  a, b, c, s;

  scanf("%d %d %d", &a, &b, &c);

  if(a < b){
    if(b < c){
      s = a + b;
    }else{
      s = a + c;
    }
  }else{
    if(a < c){
      s = a + b;
    }else{
      s = b + c;
    }
  }

  printf("%d\n", s);

  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int []A = new int[N];
		int i, j, k, t, min;
		int l = 0, count = 0;
		
		for(i = 0;i < N; i++) {
			A[i] = sc.nextInt();
		}
		
		for(j = 0;j < A.length; j++) {
			min = A[j];
			for(k = j; k < A.length-1; k++) {
				if(min > A[k+1]) {
					min = A[k+1];
					l = k+1;
				}
			}
			if(A[j] != min) {
				A[l] = A[j];
				A[j] = min;
				count++;
			}
		}
		
		for (l = 0;l < N - 1; l++) {
			System.out.print(A[l] + " ");
		}
		System.out.println(A[N-1]);
		System.out.println(count);
		
	}
}


Measured memory_bytes: 26336
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <cmath>

using namespace std;    
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

int main(){

    ll N, M;
    cin >> N >> M;

    vector<ll> v(N);
    for(int i = 0; i < N; i++){
        cin >> v[i];
    }
    sort(all(v));
    
    vector< pair<ll, ll> > change(M);
    for(int i = 0; i < M; i++){
        ll b ,c;
        cin >> b >> c;
        change[i] = make_pair(c, b);
    }
    sort(rall(change));
    
    for(int i = 0; i < M; i++){
        //cout << change[i].first << " " << change[i].second << endl;
    }

    ll c_index = 0;
    ll c_cnt = 0;
    for(int i = 0; i < N; i++){
        if( change[c_index].first > v[i] ){
            v[i] = change[c_index].first;
            c_cnt ++;
            if(c_cnt == change[c_index].second){
                c_index ++;
                c_cnt = 0;
            }
        }
        else{
            break;
        }

    }    

    cout << accumulate(all(v), 0ll) << endl; 
}

Measured memory_bytes: 2560
#include "bits/stdc++.h"

using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;


int main() {

    ll N, C; cin >> N >> C;

    //入力
    vector<pi > input;

    for(ll i = 0; i < N; i++){
        ll x, v; cin >> x >> v;
        input.push_back(make_pair(x, v));
    } 

    //時計回り累積和と最大値
    //コストの累積ワと距離を記憶
    vector<pi > sum(N + 1);
    vector<ll > mx(N + 1, 0);

    ll tmp = -INF;
    //現在地
    sum[0].first = 0; sum[0].second = 0;
    mx[0] = 0; 
    for(ll i = 1; i <= N; i++){
        ll x = input[i - 1].first;
        ll v = input[i - 1].second;
        if(i == 1){
            sum[i].first = v - x;
            sum[i].second = x;
        }else{
            //進んだ距離(x - sum[i-1].second)
            sum[i].first = sum[i-1].first + (v - (x - sum[i-1].second));
            sum[i].second = x;
        }
        
        ll m = max(sum[i].first, tmp);
        mx[i] = m;
        tmp = m;

    }

    //反時計回り累積和と最大値
    vector<pi > r_sum(N+1);
    vector<ll > r_mx(N+1, 0);

    ll idx = 1;
    tmp = -INF;
    //現在地
    r_sum[0].first = 0; r_sum[0].second = 0;
    r_mx[0] = 0; 
    for(ll i = N - 1; i >= 0; i--){
        ll x = C - input[i].first;
        ll v = input[i].second;
        if(i == N - 1){
            r_sum[idx].first = v - x;
            r_sum[idx].second = x;
        }else{
            //(x-r_sum[idx-1].second)進んだ距離
            r_sum[idx].first = r_sum[idx-1].first + (v - (x-r_sum[idx-1].second));
            r_sum[idx].second = x;
        }
        
        ll m = max(r_sum[idx].first, tmp);
        r_mx[idx] = m;
        tmp = m;
        idx++;
    }

    //確認
    
    /*
    for(ll i = 0; i <= N; i++){
        cout << sum[i].first << " " << sum[i].second << " " << mx[i] << endl;
    } 
    */ 
    /*
    for(ll i = 0; i <= N; i++){
        cout << r_sum[i].first << " " << r_sum[i].second << " " << r_mx[i] << endl;
    }
    */
    

    //時計回りで全探査
    //あるところで折り返して反対時計回りに寿司をとっていった時どこが最大か
    //折り返さなくて最大のときもある

    ll ans = -INF;

    for(ll i = 0; i <= N; i++){
        //寿司を時計回りに食べるだけ食べて折り返さずに退店するとき
        ll not_turn = sum[i].first;

        //cout << not_turn << endl;

        //折り返して反対側へ寿司を食べに行く時
        //コスト-折返し距離
        ll turn = sum[i].first - sum[i].second;
        ll idx = N - i;
        //cout << r_mx[idx] << endl;
        turn += r_mx[idx];
        
        ans = max(ans, turn);
        ans = max(ans, not_turn);
    }

    //反時計回りで全探査
    for(ll i = 0; i <= N; i++){
        //寿司を反時計回りに食べるだけ食べて折り返さずに退店するとき
        ll not_turn = r_sum[i].first;

        //cout << not_turn << endl;

        //折り返して反対側へ寿司を食べに行く時
        //コスト-折返し距離
        ll turn = r_sum[i].first - r_sum[i].second;
        ll idx = N - i;
        //cout << mx[idx] << endl;
        turn += mx[idx];
        
        ans = max(ans, turn);
        ans = max(ans, not_turn);
    }

    cout << ans << endl;

}

Measured memory_bytes: 6512
n, k = map(int, input().split())

sunuke = {i + 1 for i in range(n)}
hav = set()

for _ in range(k):
    d = int(input())
    a_l = list(map(int, input().split()))
    for a in a_l:
        hav.add(a)

print(len(sunuke - hav))


Measured memory_bytes: 67968
//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
ll dp[105][100005]={0};
ll p[105][100005]={0};
int main(){
	ll n,k;cin>>n>>k;
	ll a[n+1];
	for(ll i=1;i<=n;i++)cin>>a[i];
	dp[1][0]=1;p[1][0]=1;
	for(ll i=1;i<=a[1];i++){
		dp[1][i]=1;
		p[1][i]=dp[1][i]+p[1][i-1];
	}
	for(ll i=a[1]+1;i<=k;i++){
		p[1][i]=(p[1][i-1]+dp[1][i])%hell;
	}
	for(ll i=2;i<=n;i++){
		for(ll j=0;j<=k;j++){
			if(j-a[i]-1>=0)
			dp[i][j]=(p[i-1][j]-p[i-1][j-a[i]-1]+hell)%hell;
			else
			dp[i][j]=p[i-1][j]%hell;
			p[i][j]=(dp[i][j]+p[i][j-1])%hell;
		}
	}
	
	cout<<dp[n][k]<<endl;
}

Measured memory_bytes: 159232
#include"bits/stdc++.h"
	using namespace std;
	#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
	const int N = 1 << 20;
	const int MOD = 1e9 + 7;
	typedef long long int ll;
	priority_queue< pair< int, int > > pq;
	vector< pair<int,int> >vp;
	#define f(a, n) for(int i = a; i  < n ; i++) 
	//#define endl "\n" 
	//#define sort(v) sort(v.begin() , v.end())
	#define print(v) for(int i = 0 ; i < v.size() ; i++) cout << v[i] << ' '  
	map< int, int > mp, mpp;
	vector< int>v;
	int visit[N] ;
	//push_back
	//insert 
	#define TRACE
	#ifdef TRACE
	#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1){
	  cerr << name << " : " << arg1 << std::endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args){
	  const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " : " << arg1<<"  ";__f(comma+1, args...);
	}
	#else
	#define trace(...)
	#endif
	int main () 
	{ 
	  ll n ; 
	  cin >> n ;
	  string ans = "" ;
	  while(n > 0){

	  	if(n % 26 == 0) {
	  		ans += 'z' ; 
	  		n -= 1 ; 
	  		n /= 26 ; 
	  	}
	  	else {
	  		ll yo = n % 26 ; 
	  		ans += 'a' + (yo - 1) ; 
	  		n /= 26 ;
	  	}
	  }
	  reverse(ans.begin() , ans.end()) ; 
	  cout << ans ; 
	}
	/*






	*/


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

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

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

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const LL INF = 1e9;
const LL MOD = 1e9+7;

//other
//-------------------------------------------
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define FI first
#define SE second

//memo
// setprecision()


LL Gcd(LL a, LL b) {
  if (a < b) {
    return Gcd(b,a);
  }
  if (b == 0) {
    return a;
  }
  else {
    return Gcd(b,a%b);
  }
}

LL Lcm(LL a, LL b) {
  LL abd = Gcd(a,b);
  LL x = a / abd, y = b / abd;
  
  return x*y*abd;
}

LL solve(LL n) {
  if(n%2){
    return 0;
  }
  n /= 2;
  LL ans=0;
  
  while(n > 0){
    ans += n/5;
    n /= 5;
  }
  return ans;
}

int main() {
  LL n;
  cin >> n;
  
  cout << solve(n) << endl;
  
  return 0;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
using namespace std;
typedef pair<int, int> P;

int main() {
  int N, C; cin >> N >> C;
  vector<priority_queue<P, vector<P>, greater<P>>> p(C);
  for (int i = 0; i < N; i++) {
    int s, t, c; cin >> s >> t >> c;
    p[c-1].push(P(s, t));
  }

  auto comp = [](P a, P b) { return a.first > b.first;};
  priority_queue<P, vector<P>, decltype(comp)> que(comp);
  for (int i = 0; i < C; i++) {
    if (p[i].empty()) continue;
    P time = p[i].top(); p[i].pop();
    while (!p[i].empty()) {
      if (time.second == p[i].top().first) {
        time.second = p[i].top().second; p[i].pop();
      }
      else {
        que.push(time);
        time = p[i].top(); p[i].pop();
      }
    }
    que.push(time);
  }

  priority_queue<int, vector<int>, greater<int>> rec;
  rec.push(que.top().second); que.pop();
  while (!que.empty()) {
    if (rec.top() < que.top().first) rec.pop();
    rec.push(que.top().second); que.pop();
  }
  cout << rec.size() << endl;
}

Measured memory_bytes: 2552
def pre_c(n, mod):
    f = [0] * (n + 1)
    #g = [0] * (n + 1)
    for i in range(n + 1):
        if i == 0:
            f[i] = 1
            #g[i] = 1
        else:
            f[i] = (f[i - 1] * i) % mod
            #g[i] = pow(f[i], mod - 2, mod)

    return f
mod = 10 ** 9 + 7
n, m = map(int,input().split())
big = max(n, m)
small = n + m - big
if big - small >= 2:
    print(0)
    exit()
flag = 1 if small != big else 2
F = pre_c(big + 1, mod)
rec = F[big] * F[small] * flag
print(rec % mod)

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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
ll gcd(ll a,ll b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));
}

// 最小公倍数
ll lcm(ll a, ll b){
    return a*b/gcd(a, b);
}

int main()
{
    cout << fixed << setprecision(15);
    ll N;
    cin >> N;

    vector<ll> A(N);

    REP(i, N){
        cin >> A[i];
    }

    sort(A.rbegin(), A.rend());

    ll L1 = 0;
    ll L2 = 0;
    ll count = 0;
    ll flag = true;
    for(ll i=1; i<N; i++){
        if(flag){
            if(A[i] == A[i-1]){
                if(count == 0) L1 = A[i];
                if(count == 1) L2 = A[i];
                count++;
                flag = false;
            }
        }
        else{
            flag = true;
        }
        if(count == 2) break;
    }
    cout << L1 * L2 << endl;
    return 0;
}

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

jouken1 = 4 * x - y
jouken2 = y - 2 * x
if ((jouken1 % 2 == 0) and (jouken1 >= 0) and (jouken2 >= 0) and (jouken2 % 2 == 0)):
    print("Yes")
else:
    print("No")
# a+b = X, 2a+ 4b = Y
# a = (4X - Y) /2, b = (Y - 2X)/2

Measured memory_bytes: 9172
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string.h>
#include<functional>
#include<queue>
#include<stack>
#include<math.h>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

int main()
{
	stack<int> s;
	char b[1050];
	scanf("%[^\n]", b);

	int I = 0;
	while(I<strlen(b)){
		if (b[I] == '+'||b[I]=='-'||b[I]=='*') {
			int j = s.top(); s.pop();
			int i = s.top(); s.pop();
			int k;
			if (b[I] == '+')k = i + j;
			if (b[I] == '-')k = i - j;
			if (b[I] == '*')k = i * j;

			s.push(k);
			I += 2;
		}
		else if(b[I]!=' '){
			int j = 1;
			int num = b[I] - '0';
			I++;
			while (b[I] != ' ') {
				num *= 10;
				num += (int)(b[I]-'0');
				I++;
			}
			s.push(num);
		}
		else I++;
	}
	int ans = s.top(); s.pop();
	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 3212
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//#define int long long

void solve() {
	string s; cin >> s;
    if(s.substr(0, 4) == "YAKI") {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

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

const ll N = 5000000 + 5;
ll info[N], n, val[N], tot, cnt[N];

int main () {
	#ifdef wll
//	freopen ("testdata.in", "r", stdin);
	#endif
	while (scanf ("%lld", &n) == 1) {
		memset (cnt, 0, sizeof (cnt));
		for (ll i = 1; i <= n; ++i) {
			scanf ("%lld", &info[i]);
		}
		sort (info + 1, info + n + 1);
		val[1] = info[1];
		tot = 1;
		cnt[1] = 1;
		for (ll i = 2; i <= n; ++i) {
			if (info[i] != info[i - 1]) {
				tot++;
				cnt[tot] = 1;
				val[tot] = info[i];
			}
			else {
				cnt[tot] ++;
			}
		}
		if (n % 3) {
			if (tot == 1 && val[1] == 0) {
				printf ("Yes\n");
			}
			else {
				printf ("No\n");
			}
			continue;
		}
		if (tot > 3) {
			printf ("No\n");
			continue;
		}
		else if (tot == 2) {
			if ((val[1] == 0 && cnt[1] * 2 == cnt[2]) || (val[2] == 0 && cnt[2] * 2 == cnt[1])) {
				printf ("Yes\n");
			}
			else {
				printf ("No\n");
			}
			continue;
		}
		else if (tot == 1) {
			if (val[1] == 0) {
				printf ("Yes\n");
			}
			else {
				printf ("No\n");
			}
			continue;
		}
		if ((val[1] ^ val[2]) == val[3] && cnt[1] == cnt[2] && cnt[2] == cnt[3]) {
			printf ("Yes\n");
		}
		else {
			printf ("No\n");
		}
	}
	return 0;
}






















Measured memory_bytes: 43264
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>

using namespace std;

// BEGIN NO SAD
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef vector<int> vi;
// END NO SAD

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<vector<ll>> matrix;

void solve() {
  int n;
  cin >> n;
  map<string, int> dp;
  while(n--) {
    string s;
    cin >> s;
    dp[s]++;
  }
  int val = 0;
  for(auto out: dp) val = max(val, out.second);
  for(auto out: dp) if(out.second == val) cout << out.first << "\n";
}

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


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

int main(){
  while(true){
    int h,w;
    cin>>h>>w;

    if(h==0&&w==0)
      break;

    int d=h*h+w*w;

    int H=150;
    int W=150;
    int D=150*150+150*150;

    for(int y=1;y<=150;y++){
      for(int x=y+1;x<=150;x++){
        int z=y*y+x*x;

        if(z<=d){
          continue;
        }
        else{
          if(z<D){
            H=y;
            W=x;
            D=z;
          }
          break;
        }
      }
    }

    for(int y=h+1;y<150;y++){
      bool flg =false;

      for(int x=y+1;x<=150;x++){
        int z=y*y+x*x;

        if(z==d){
          H=y;
          W=x;
          D=z;

          flg=true;
        }
        if(z>=d)
          break;
        }
      if(flg)
        break;
    }
    cout<<H<<' '<<W<<endl;
  }
  return 0;
}



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

#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
#define mp make_pair

typedef long long ll;
typedef unsigned long long int ull;
typedef long double ld;

typedef pair<int, int> pii;

typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<int> vi;

typedef map<string, int> msi;
typedef map<int, int> mii;
typedef map<int, ll> mill;
typedef map<int, vi> mivi;

const int MOD = 1e9 + 7;
const int MAXN = 1e3;

vi pf[MAXN + 1];
mii cnt;

int n, ans = 1;

void fast_io() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
}

void sieve() {
	for(int i = 2; i <= MAXN; i++) {
		if(pf[i].empty())
			for(int j = i; j <= MAXN; j += i)
				pf[j].pb(i);
	}
}

int main() {
	fast_io();
//	freopen("input/ARC067C.txt", "r", stdin);
	
	sieve();
	
	cin >> n;
	
	for(int i = 2; i <= n; i++) {
		int curr = i;
		for(auto p : pf[i])
			while(curr % p == 0)
				curr /= p, cnt[p]++;
	}

	for(auto x : cnt) {
		ans = (1LL * ans * (x.se + 1)) % MOD;
	}
	
	cout << ans << '\n';
	
	return 0;
}

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

void dfs(vector<bool>& used, int& ans, int node, int d, int R, int cost, vector<vector<int> >& G){

    if(R - 1 == d){
        ans = min(ans, cost);
        return;
    }else{

        for(int i = 0; i < R; i++){
            if(used[i] == false){
                used[i] = true;
                dfs(used, ans, i, d + 1, R, cost + G[node][i], G);
                used[i] = false;
            }
        }
    }

    return;
}

vector<int> dijk(int s, int v, vector<vector<pair<int, int> > > adjlist){
    
    priority_queue <pair<int, int> > wait;
    vector<int> result(v, INF);

    //スタート地点を追加
    result[s] = 0;
    wait.push(make_pair(0, s));

    //ダイクストラ本体
    while(!wait.empty()){    //waitが空になるまで

        int nowpoint = wait.top().second;
        int nowcost = -wait.top().first;
        wait.pop();

        if(result[nowpoint] < nowcost) continue;


        //今いる頂点と隣接しているすべての頂点をなめる
        for(int i = 0; i < adjlist[nowpoint].size(); i++){

            int nextpoint = adjlist[nowpoint][i].second;
            int nextcost = nowcost + adjlist[nowpoint][i].first;
            //現時点より安く到達できそうであれば、結果を更新して優先度付きキューに格納
            if(result[nextpoint] > nextcost){
                result[nextpoint] = nextcost;
                wait.push(make_pair(-nextcost, nextpoint));
            }
        }
    }
    
    return result;         //結果列を返す
}

int main(){

    
    int N, M, R; cin >> N >> M >> R;
    vector<int> r(R);
    for(int i = 0; i < R; i++){
        cin >> r[i];
        r[i]--;
    }
    vector<vector<pair<int, int> > > adjlist(N);      //first := 行先　second := コスト

    //入力
    for(int i = 0; i < M; i++){
        int a, b, c; cin >> a >> b >> c;           // a → b に コスト c の辺がある
        a--;
        b--;
        adjlist[a].push_back(make_pair(c, b));     //もし無向グラフならもう一つやる
        adjlist[b].push_back(make_pair(c, a));        
    }

    

    vector<vector<int> > R_table(R, vector<int> (R));
    for(int i = 0; i < R; i++){
        vector<int> temp(N);
        temp = dijk(r[i], N, adjlist);
        /*for(int j = 0; j < temp.size(); j++){
            cout << temp[j] << " ";
        }
        cout << endl;*/
        for(int j = 0; j < R; j++){
            R_table[i][j] = temp[r[j]];
        }
    }

    

    int ans = INF;
    for(int i = 0; i < R; i++){
        vector<bool> used(R, false);
        used[i] = true;
        dfs(used, ans, i, 0, R, 0, R_table);
    }

    cout << ans << endl;

}

Measured memory_bytes: 1056
#include<bits/stdc++.h>
using namespace std;
typedef int ll;
typedef long long int li;
struct Node{
	ll x,y;
	inline bool operator <(const Node &rhs)const
	{
		return this->x>rhs.x;
	}
};
deque<Node>v;
ll n,m,x,y,z,p,sumx,sumy,sum;
li res;
inline ll read()
{
    register ll num=0,neg=1;
    register char ch=getchar();
    while(!isdigit(ch)&&ch!='-')
    {
        ch=getchar();
    }
    if(ch=='-')
    {
        neg=-1;
        ch=getchar();
    }
    while(isdigit(ch))
    {
        num=(num<<3)+(num<<1)+(ch-'0');
        ch=getchar();
    }
    return num*neg;
} 
int main()
{
	n=read(),m=read(),x=read(),y=read(),z=read();
	for(register int i=0;i<x;i++)
	{
		v.push_back((Node){read(),1});
	}
	for(register int i=0;i<y;i++)
	{
		v.push_back((Node){read(),2});
	}
	for(register int i=0;i<z;i++)
	{
		v.push_back((Node){read(),3});
	}
	sort(v.begin(),v.end());
	while(sum!=n+m)
	{
		if(v[0].y==1&&sumx!=n&&sum!=n+m)
		{
			res+=v[0].x,sumx++,sum++;
		}
		if(v[0].y==2&&sumy!=m&&sum!=n+m)
		{
			res+=v[0].x,sumy++,sum++; 
		}
		if(v[0].y==3)
		{
			res+=v[0].x,sum++; 
		}
		v.pop_front();
	}
	printf("%lld\n",res);
}

Measured memory_bytes: 2688
fun main(args: Array<String>) {

    val n = readLine()!!.toInt()

    val hs = readLine()!!.split(" ").map { it.toInt() }

    var ans = 0

    var i = 0

    // 最後から2番目までループを回す
    while (i < n - 1) {

        var count = 0
        // 右隣が今いる高さより低い場合は移動する
        while (i < n - 1 && hs[i] >= hs[i + 1]) {
            i++
            count++
        }

        // 移動した回数が過去最多であれば更新
        ans = if (ans < count) count else ans

        // 次のマスに進む
        i++
    }

    println(ans)
}

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

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-12;
static const double PI = acos(-1.0);

#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(), (a).end()
#define DEBUG(x) cout << #x << ": " << x << endl

int main() {
  ll h, w, k;
  cin >> h >> w >> k;
  vector<string> cw(h);
  REP(i, h) {
    cin >> cw[i];
  }
  ll ans = 0;
  REP(yb, 1 << h) {
    REP(xb, 1 << w) {
      ll count = 0;
      REP(y, h) {
        if ((1 << y) & yb) {
          REP(x, w) {
            if ((1 << x) & xb) {
              if (cw[y][x] == '#') {
                count++;
              }
            }
          }
        }
      }
      if (count == k) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
typedef long long ll;
#define mod 1000000007
ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch))f^=ch=='-',ch=getchar();
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return f?x:-x;
}
std::mt19937 rnd(time(NULL));
#define rand rnd
#define pr std::pair<int,int>
#define fi first
#define se second
template<class T>void cxk(T&a,T b){a=a>b?a:b;}
template<class T>void cnk(T&a,T b){a=a<b?a:b;}
#ifdef mod
int pow(int x,int y){
	int ret=1;
	while(y){
		if(y&1)ret=1ll*ret*x%mod;
		x=1ll*x*x%mod;y>>=1;
	}
	return ret;
}
template<class Ta,class Tb>void inc(Ta&a,Tb b){a=a+b>=mod?a+b-mod:a+b;}
template<class Ta,class Tb>void dec(Ta&a,Tb b){a=a>=b?a-b:a+mod-b;}
#endif
int A[610],B[610],f[2][310][310];
int main(){
#ifdef LOCAL
	freopen("in.in","r",stdin);
	//freopen("out.out","w",stdout);
#endif
	int n=gi();
	for(int i=1;i<=n*2;++i)A[std::max(0,B[i]=gi())]=i;
	for(int i=1;i<=n*2;i+=2)if(~B[i]&&~B[i+1])A[B[i]]=A[B[i+1]]=-2;
	int t=0;f[0][0][0]=1;
	for(int i=n*2;i;--i){
		if(A[i]==-2)continue;
		memset(f[!t],0,sizeof f[!t]);
		if(A[i]>0){
			for(int j=0;j<=n;++j)
				for(int k=0;k<=n;++k)
					if(f[t][j][k])inc(f[!t][j+1][k],f[t][j][k]);
			for(int j=0;j<=n;++j)
				for(int k=1;k<=n;++k)
					if(f[t][j][k])inc(f[!t][j][k-1],f[t][j][k]);
		}else{
			for(int j=0;j<=n;++j)
				for(int k=0;k<=n;++k)
					if(f[t][j][k])inc(f[!t][j][k+1],f[t][j][k]);
			for(int j=0;j<=n;++j)
				for(int k=0;k<=n;++k)
					if(f[t][j][k]){
						if(j)inc(f[!t][j-1][k],1ll*j*f[t][j][k]%mod);
						if(k)inc(f[!t][j][k-1],f[t][j][k]);
					}
		}
		t^=1;
	}
	int ans=f[t][0][0],s=0;
	for(int i=1;i<=n*2;i+=2)s+=(B[i]==-1&&B[i+1]==-1);
	for(int i=1;i<=s;++i)ans=1ll*ans*i%mod;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>


using namespace std;
int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	int t = b / a;
	if (t <= c)
		cout << t;
	else
		cout << c;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<cstring>
using namespace std;
int main(void){
    // Here your code !
    string s;
    cin>>s;
    if(s.size()>3&&s[0]=='Y'&&s[1]=='A'&&s[2]=='K'&&s[3]=='I'){
        cout<<"Yes";
    }
    else{
        cout<<"No";
    }
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# abc129/abc129_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    P, Q, R = i2nn()
    print(P + Q + R - max(P, Q, R))
    return

main()


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    double L;
    cin >> L;
    double side = L/3;
    double volume = side * side * side;
    cout << fixed <<  setprecision(12) << volume << endl;
    //printf("%12f", volume);
}


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

using namespace std;

#define mem(a,b) memset(a,b,sizeof(a))
#define FOR(i,j,k) for(int i=j;i<=k;i++)
#define read        freopen("in.txt", "r", stdin)
#define write       freopen("out.txt", "w", stdout)
#define pf          printf
#define sf(n)       scanf("%d", &n)
#define sff(a,b)    scanf("%d %d", &a, &b)
#define PB push_back
#define F first
#define S second
#define MP make_pair

typedef pair<int,int> pii;
typedef long long LL;

const int MAX = (2e5) + 5;
int n, k, v, can[MAX];

void solve()
{
    int prin = 0;

    cin >> n >> k;
    FOR(i,0,n-1) cin >> v, can[v]++;

    sort(can, can + n + 1);
    FOR(i,0,n-k) prin += can[i];

    cout << prin << endl;
}

int main()
{
    ios::sync_with_stdio(false);

    solve();
    return 0;
}



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

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k;
    cin>>n>>k;
    int a[n];
    int p[k+1];
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<k+1;i++)p[i]=-1;
    for(int i=0;i<k+1;i++){
        for(int j=0;j<n;j++){
            if(i+a[j]<=k)if(p[i+a[j]]!=1)p[i+a[j]]=-1*p[i];
        }
    }
    if(p[k]==1)cout<<"First"<<endl;
    else cout<<"Second"<<endl;
	return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		
		boolean[] 
				flagArray	= new boolean[52];		//全52種類のどのカードを所持しているかのフラグ
		int
				cardCount	= 0,					//所持カード枚数
				num		 	= 0;					//1~52のカードの何番目かを記録変数
		String[]
				input		= new String[2];		//入力(絵柄、数字)を格納する
				
		String 
				output		= "",					//出力する文字列
				mark[]		= {"S","H","C","D"};	//絵柄
				
		
		//所持カード枚数(入力レコード数)を記録
		cardCount = Integer.parseInt(sc.nextLine());
		
		for(int i=0;i<cardCount;i++){
			
			//所持カードの絵柄,数字の入力
			input = sc.nextLine().split("[\\s]+");
			
			//絵柄を1~52に対応させるための判定と番号計算
			for(int x = 0;x < mark.length;x++){
				
				if(input[0].equals(mark[x])){
					
					num = Integer.parseInt(input[1]) + (x * 13) - 1;
				}
			}
			//所持フラグの変更
			flagArray[num] = true;
			
		}
		
		//所持していなかったカードを表示させる
		for(int i=0;i<flagArray.length;i++){
			
			if(flagArray[i] == false){
				
				num = i % 13 + 1;
				output = mark[i / 13] + " " + String.valueOf(num);
				
				//出力
				System.out.println(output);
			}
		}
		
	}
}



Measured memory_bytes: 26316
#include<stdio.h>
int main()
{
	char a;
	scanf("%c",&a);
	if(a=='A'||a=='B'||a=='C'||a=='D'||a=='E'||a=='F'||a=='G'||a=='H'||a=='I'||a=='J'||a=='K'||a=='L'||a=='N'||a=='M'||a=='O'||a=='P'||a=='Q'||a=='R'||a=='S'||a=='T'||a=='U'||a=='V'||a=='W'||a=='X'||a=='Y'||a=='Z'){
		printf("A\n");
	}
	else printf("a\n");
	return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    vector<int> s = a;
    sort(s.rbegin(), s.rend());
    rep(i,n){
        if(a[i]!=s[0]) cout <<  s[0] << endl;
        else cout << s[1] << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3200
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

macro_rules! input_inner {
  ($iter:expr) => {};
  ($iter:expr, ) => {};

  ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
    let $var = read_value!($iter, $t);
    input_inner!{$iter $($r)*}
  };
}

macro_rules! read_value {
  ($iter:expr, ( $($t:tt),* )) => {
    ( $(read_value!($iter, $t)),* )
  };

  ($iter:expr, [ $t:tt ; $len:expr ]) => {
    (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  };

  ($iter:expr, chars) => {
    read_value!($iter, String).chars().collect::<Vec<char>>()
  };

  ($iter:expr, usize1) => {
    read_value!($iter, usize) - 1
  };

  ($iter:expr, [ $t:tt ]) => {{
    let len = read_value!($iter, usize);
    (0..len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
  }};

  ($iter:expr, $t:ty) => {
    $iter.next().unwrap().parse::<$t>().expect("Parse error")
  };
}

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    a: [i32; 3],
  }
  let s: i32 = a.iter().sum();

  if s <= 21 {
    puts!("win\n");
  } else {
    puts!("bust\n");
  }
}


Measured memory_bytes: 4352
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
#include <list>
#include <cstring>
#include <stack>

using namespace std;

#define mod 1000000007

int main()
{
	string t, p;
	cin >> t >> p;
	int tl = t.length();
	int pl = p.length();
	for(int i = 0; i + pl <= tl; i++){
		if(t.substr(i, pl) == p) cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<string> vec;
map<string, int> mp;
int main() {
    int n; cin >> n;
    vec.resize(n);
    for (int i = 0; i < n; ++i) {
        cin >> vec[i];
        ++mp[vec[i]];
    }
    sort(vec.begin(), vec.end());
    vec.resize(unique(vec.begin(), vec.end()) - vec.begin());
    int maxi = 0;
    for (auto &s: vec)
        maxi = max(maxi, mp[s]);
    for (auto &s: vec)
        if (mp[s] == maxi) cout << s << '\n';
    return 0;
}

Measured memory_bytes: 26752
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        String u = sc.next();
        if (s.equals(u)) {
            System.out.println(a - 1 + " " + b);
        } else {
            System.out.println(a + " " + (b - 1));
        }
    }
}


Measured memory_bytes: 24788
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll mod= 1e9 + 7;



int main() {
  int a;
  cin >> a;
  if(a==0){cout << 1 << endl;}else{cout << 0 << endl;}
}

Measured memory_bytes: 3636
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  ll ans = 1;
  for(int i = 0; i < n; i++) {
    ll a;
    cin >> a;
    ans = lcm(ans, a);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3640
import sys
sys.setrecursionlimit(10000000)
x=int(input())
A=[]
B=[]
C=[]
dictA=[-1]*x
dictB=[-1]*x
dictC=[-1]*x
for i in range(x):
    a,b,c=list(map(int,input().split()))
    A.append(a)
    B.append(b)
    C.append(c)
def maxA(n):
    if dictA[n]!=-1:
        return dictA[n]
    if n==0:
        dictA[n]=A[0]
        return A[0]
    dictA[n]=A[n]+max(maxB(n-1),maxC(n-1))
    return dictA[n]
def maxB(n):
    if dictB[n]!=-1:
        return dictB[n]
    if n==0:
        dictB[n]=B[0]
        return B[0]
    dictB[n]=B[n]+max(maxA(n-1),maxC(n-1))
    return dictB[n]
def maxC(n):
    if dictC[n]!=-1:
        return dictC[n]
    if n==0:
        dictC[n]=C[0]
        return C[0]
    dictC[n]=C[n]+max(maxB(n-1),maxA(n-1))
    return dictC[n]
def Nmax(n):
    return max(maxA(n),maxB(n),maxC(n))
print(Nmax(x-1))

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

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String line = br.readLine();
        
        if(line.contains("a") && line.contains("b") && line.contains("c")){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23124
fn input_pair<T: std::str::FromStr + Copy> () -> (T, T) {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let arr: Vec<_> = s.trim().split_whitespace().flat_map(str::parse).collect();
    (arr[0], arr[1])
}

fn input_arr<T: std::str::FromStr> () -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().flat_map(str::parse).collect()
}

fn main() {
    let (n, k) = input_pair::<usize>();
    let mut h: Vec<usize> = input_arr();
    h.sort();
    println!("{}", h.into_iter().rev().skip(k).sum::<usize>());
}


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

using namespace std;

struct edge{
  int to,cap,org,rev;
};

vector<edge> G[1234];
bool used[1234];

void add_edge(int from,int to){
  G[from].push_back({to,1,1,(int)G[to].size()});
  G[to].push_back({from,0,0,(int)G[from].size()-1});
}

int dfs(int v,int t,int f){
  if(v==t)return f;
  used[v]=true;
  for(int i=0;i<G[v].size();i++){
    edge &e=G[v][i];
    if(!used[e.to]&&e.cap>0){
      int d=dfs(e.to,t,min(f,e.cap));
      if(d>0){
	e.cap-=d;
	G[e.to][e.rev].cap+=d;
	return d;
      }
    }
  }
  return 0;
}

int max_flow(int s,int t){
  int flow=0;
  for(;;){
    fill(begin(used),end(used),false);
    int f=dfs(s,t,1e9);
    if(f==0)return flow;
    flow+=f;
  }
}

bool u1[1234],u2[1234];

void dfsr(int v){
  if(u1[v]++)return;
  for(auto e:G[v]){
    if(e.cap){
      dfsr(e.to);
    }
  }
}

void rdfsr(int v){
  if(u2[v]++)return;
  for(auto e:G[v]){
    if(!e.cap){
      rdfsr(e.to);
    }
  }
}

int main(){
  for(int N,M,S,T;cin>>N>>M>>S>>T,N|M|S|T;){
    for(auto &e:G){
      e.clear();
    }
    fill(begin(u1),end(u1),false);
    fill(begin(u2),end(u2),false);
    for(int i=0;i<M;i++){
      int a,b;
      cin>>a>>b;
      add_edge(a,b);
    }
    int f=max_flow(S,T);
    dfsr(S);
    rdfsr(T);
    int c=0;
    for(int i=1;i<=N;i++){
      for(auto e:G[i]){
	if(e.cap&&e.org&&u1[e.to]&&u2[i]){
	  c++;
	}
      }
    }
    cout<<f+!!c<<' '<<c<<endl;
  }
}

    

Measured memory_bytes: 1784
import bisect
import cmath
import heapq
import itertools
import math
import operator
import os
import random
import re
import string
import sys
from collections import Counter, deque, defaultdict
from copy import deepcopy
from decimal import Decimal
from fractions import gcd
from functools import lru_cache, reduce
from operator import itemgetter, mul, add, xor

import numpy as np

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


S = sys.stdin.buffer.readline().decode().rstrip()
ok = len(Counter(list(S))) == 2
if ok:
    print('Yes')
else:
    print('No')


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

int main(void){
int n,k;
scanf("%d %d",&n,&k);
int ans=k;
for(int i=0;i<n-1;i++){
ans=ans*(k-1);
}
printf("%d\n",ans);
}


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

const int MAXN = 1e5;
const int INF = 1e9;
vector<int> dp(MAXN+5, INF);

int main(){
	int n,k;
	cin >> n >> k;
	vector<int> h(n);
	rep(i,n) cin >> h[i];
	
	dp[0] = 0;
	for(int i = 0; i < n; i++){
		for(int j = 1; j <= k; j++){
			if(i+j < n) dp[i+j] = min( dp[i+j], dp[i]+abs(h[i+j]-h[i]) );
		}
	}
	
	cout << dp[n-1] << endl;
	return 0;
}


Measured memory_bytes: 1024
package main

import (
	"bufio"
	"fmt"
	"os"
	"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 = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	a, b := intScanner(), intScanner()
	if a+b >= 10 {
		fmt.Println("error")
	} else {
		fmt.Println(a + b)
	}
}


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

int main()
{  
   int n,k;
   cin>>n>>k;
   int h[n];
   int ans=2e9;
   for(int i=0;i<n;i++) cin>>h[i];
   sort(h,h+n);
   for(int i=0;i<n-k+1;i++){
       ans=min(ans,h[k-1+i]-h[i]);
   }
   cout<<ans<<endl;
  
} 



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

long X, N;
vector<long> P(102, 0);

int main(void) {

    cin >> X >> N;
    for (long i = 0; i < N; i++) { 
        long tmp; cin >> tmp;
        P[tmp] = 1;
    }

    long ans = 0;
    for (long i = 0; i < 10000; i++) {
        if (i % 2 == 1) {
            ans = X - (i+1) / 2;
        }
        else {
            ans = X + i / 2;
        }
        if (P[ans] == 0) break;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3592
#include<bits/stdc++.h>
#define int long long
#define pb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(v) v.begin(),v.end()
#define rep(i,start,lim) for(long long (i)=(start);i<(lim);i++)
#define revrep(i,n) for(long long i=n-1;i>=0;i--)
#define boost ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define osit ostream_iterator<int> output (cout," ")
#define endl '\n'
#define f first
#define s second
#define PI 3.141592653589793
#define MOD 1000000007
#define set0(x) memset(x,0,sizeof(x))
#define set1(x) memset(x,1,sizeof(x))
using namespace std;
typedef vector<int> vi;
typedef list<int> li;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef tuple<int, int, int> iii;
template<typename T> T gcd(T a,T b){if(a==0) return b; return gcd(b%a,a);}
template<typename P> P dectobin(P a){if(a==0)return 0; else return(a%2 + 10*dectobin(a/2));}
template<typename Y> Y bintodec(Y a){int ans=0,b=1,t=a; while (t){int ld=t%10; t/=10;ans+=ld* b;b=b*2;} return ans; }
template<typename H> H modExp(H x, H n){ int r=1; while(n>0){if(n%2==1){r=(r*x)%MOD;}x=(x*x)%MOD;n/=2;}return r;}
template<typename T> T isPowerOfTwo(T x){return x && (!(x & (x - 1)));}	
template<typename T> T lcm(T a,T b) {return a*b/gcd(a,b);}
//template<typename T> T extendedEuclid(T A,T B){if(B==0){d=A; x=1;y=0;}else{ extendedEuclid(B,A%B);int temp=x; x=y; y=temp-(A
//B)*y;}}
int32_t main(){
	boost;osit;
	int n;
	cin>>n;
	int arr[n][3];
	rep(i,0,n){
		rep(j,0,3) cin>>arr[i][j];
	}
	int dp[n][3];
	rep(i,0,3) dp[0][i]=arr[0][i];
	rep(i,1,n){
		rep(j,0,3){
			dp[i][j]=arr[i][j];
			int maxx=0;
			rep(k,0,3){
				if(k!=j) maxx=max(maxx,dp[i-1][k]);
			}
			dp[i][j]+=maxx;
		}
	}
	int maxx=0;
	rep(i,0,3) maxx=max(maxx,dp[n-1][i]);
	cout<<maxx;
	return 0;
}

Measured memory_bytes: 4992
def main():
    S = input()
    odd = True
    even = True
    for i in range(len(S)):
        if (i + 1) % 2 == 0:
            if S[i] == "R":
                even = False
        else:
            if S[i] == "L":
                odd = False
    if even and odd:
        print("Yes")
    else:
        print("No")
main()

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define lli long long int
#define MOD 1000000007
#define KING 1000000002
#define queen 1000002
#define fi first
#define se second
#define se second
#define lsb(i) (i & -i)
#define nl cout<<'\n'
#define TEST cout<<"TEST",nl
#define pr pair<lli,lli>
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define vi vector<lli>
#define vpi vector<pr> 
#define P pair<lli,pr>
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define NA(i,s,n) for(lli i=s;i<n;i++)
using namespace std;

void solve(){
    lli n; cin>>n; 
    float d = (2*22*n)/7.0;
    cout<<d<<'\n';
    return;
}
int main(){
    fastIO;
    lli t = 1,p; 
    // cin>>t; p = t;
    NA(i,0,t) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3800
x, n = map(int,input().split())
p = list(map(int, input().split()))

for i in range(100):
    if p.count(x+i) == 0:
        a = x+i
        break

for i in range(100):
    if p.count(x-i) == 0:
        b = x-i
        break

if abs(a-x) < abs(b-x):
    print(a)
else:
    print(b)








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

using namespace std;

int main(void) {
    int n;
    cin >> n;
    map<int, int> cnt;
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        cnt[a]++;
    }
    int ans = 0;
    for (auto it = cnt.begin(); it != cnt.end(); ++it) {
        if (it->second % 2 != 0) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 4992