akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int a[200001];
int main(){
    int n, x;
    scanf("%d%d", &n, &x); 
    int m = 2*n-1;
    if(x == 1 || x == 2*n-1) printf("No\n");
    else{
        printf("Yes\n");
        a[n] = x;
        if(x <= n){
            int d = n-x, i = 1;
            for(int j=m;j>m-d;j--,i++) a[i] = j;
            for(int j=1;j<x;j++,i++) a[i] = j;
            i++;
            for(int j=m-d;j>x;j--,i++) a[i] = j;
        }
        else{
            int d = x-n, i = m;
            for(int j=1;j<=d;j++,i--) a[i] = j;
            for(int j=m;j>x;j--,i--) a[i] = j;
            i--;
            for(int j=d+1;j<x;j++,i--) a[i] = j;
        }
        for(int i=1;i<=m;i++) printf("%d ", a[i]);
    }
}

Measured memory_bytes: 2304
N = int(input())
ans = 0
for i in range(1, N + 1, 2):
    count = 0
    n = 1
    while n * n <= i:
        if not i % n:
            if n * n == i:
                count += 1
            else:
                count += 2
        n += 2
    if count == 8:
        ans += 1
print(ans)

Measured memory_bytes: 38384
N = 5
ARR = [24, 11, 8, 3, 16]

N = 4
ARR = [5, 5, 5, 5]

N = 10
ARR = [33, 18, 45, 28, 8, 19, 89, 86, 2, 4]

N = int(input())
ARR = list(map(int,input().split()))

def calculate(n, arr):
    krr = [0 for i in range(1, 1000007)]

    for i in range(n):
        start = arr[i]

        if krr[start] > 0:
            krr[start] = 2
            continue

        for j in range(start, 1000006, start):
            krr[j] += 1

    result = 0
    for i in range(n):
        if krr[arr[i]] == 1:
            result += 1

    print(result)


calculate(N, ARR)


Measured memory_bytes: 32384
#include <bits/stdc++.h>
using namespace std;
#define rep2(i,m,n) for (int i = (m); i < (n); ++i)
#define rep(i,n) rep2(i,0,n)
typedef long long int ll;
typedef long double ld;
typedef pair<int, int> P;
template<typename T> struct V : vector<T> { using vector<T>::vector; };
V() -> V<int>;
V(size_t) -> V<int>;
template<typename T> V(size_t, T) -> V<T>;
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
const int INF = 1<<30;
const ll LINF = 1LL<<61;

int main()
{
    int h, n;
    cin >> h >> n;
    V<P> a(n);
    rep(i,n) cin >> a[i].first >> a[i].second;
    V dp(h+1, INF);
    dp[0] = 0;
    rep(i,n) rep(j,h)
    {
        int ni = j + a[i].first;
        ni = min(h, ni);
        chmin(dp[ni], dp[j] + a[i].second);
    }
    cout << dp[h] << endl;
    // cout << dp << endl;

    return 0;
}

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

int main(){
  int n, ben;
  cin >> n;
  vector<int> v(n), c(n);
  for(int i = 0;n > i;i++){
    int y;
    cin >> y;
    v.at(i) = y;
  }
  for(int i = 0;n > i;i++){
    int y;
    cin >>y;
    c.at(i) = y;
  }
  
  for(int i = 0;n > i;i++){
    if (v.at(i) - c.at(i) > 0){
      ben += v.at(i) - c.at(i);
    }
  }
  
  cout <<ben<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main{
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long res=0;
		long mod = 1000000007;
		long k = sc.nextLong();
		for(long i=k;i<=n+1;i++) {
			long left = (((i-1)*i))/2;
			long right = (((n+1)*n)/2)-((n+1-i)*(n-i)/2);
			res=(res+right-left+1);
			res=res%mod;
			left=0;
			right=0;
		}
		System.out.println(res);
	}
}

Measured memory_bytes: 35768
from collections import Counter
s = input()
t = input()
for i in range(len(s)-1):
    if s[i] == s[i+1]:
        if t[i] != t[i+1]:
            print("No")
            exit()
s_count = Counter(list(s)).most_common()
t_count = Counter(list(t)).most_common()
for i in range(len(s_count)):
    if s_count[i][1] != t_count[i][1]:
        print("No")
        exit()
print("Yes")



Measured memory_bytes: 5680
#include <stdio.h>
int main(){
int n,w,h,a,b,ans=0,i;
scanf("%d %d %d",&n,&h,&w);
for(i=0;i<n;i++){
scanf("%d %d",&a,&b);
if((h<=a)&&(w<=b)) ans++;
}
printf("%d\n",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int N = 305;
int dp[2][N][N];
char s[N];
int dfs(int l, int r, int dp[N][N]) {
	int &res = dp[l][r];
	if (dp[l][r] != -1) return dp[l][r];
	if (l > r) return res = 0;
	res = 0;
	if (s[l] == s[r]) res = dfs(l + 1, r - 1, dp) + (l == r ? 1 : 2);
	res = max(res, dfs(l + 1, r, dp));
	res = max(res, dfs(l, r - 1, dp));
	return res;
}
int dfs2(int l, int r, int dp[N][N], int fr[N][N]) {
	int &res = dp[l][r];
	if (dp[l][r] != -1) return dp[l][r];
	if (l > r) return res = 0;
	res = 0;
	if (s[l] == s[r]) res = dfs2(l + 1, r - 1, dp, fr) + (l == r ? 1 : 2);
	res = max(res, fr[l + 1][r - 1] + (l == r ? 1 : 2));
	res = max(res, dfs2(l + 1, r, dp, fr));
	res = max(res, dfs2(l, r - 1, dp, fr));
	return res;
}
int main() {
	scanf("%s", s + 1);
	int n = strlen(s + 1), k;
	scanf("%d", &k);
	memset(dp, -1, sizeof(dp));
	for (int i = 1; i <= n; ++ i) {
		for (int j = i; j <= n; ++ j) {
			dfs(i, j, dp[0]);
		}
	}
	int cur = 0;
	int ans = dp[cur][1][n];
	for (int i = 1; i <= k; ++ i) {
		cur ^= 1;
		memset(dp[cur], -1, sizeof(dp[cur]));
		for (int i = 1; i <= n; ++ i) {
			for (int j = i + 1; j <= n; ++ j) {
				dfs2(i, j, dp[cur], dp[cur ^ 1]);
			}
		}
		ans = max(ans, dp[cur][1][n]);
	}
	printf("%d\n", ans);
}



Measured memory_bytes: 1152
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b){
  ll r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


ll LCM(ll a,ll b){
  ll c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
    return p;
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
  return p;
}


ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}







/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;
  cin>>n;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  sort(ALL(v));
  ll ans=1,tmp=v[0];
  rep(i,n-1){
    if(tmp*2>=v[i+1]){
      tmp+=v[i+1];
      ans++;
    }else{
      tmp+=v[i+1];
      ans=1;
    }
  }
  cout<<ans<<endl;
  
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(){
  int A,B,total;
  cin >> A >> B;
  total = 0;
  for(int i = 0;i < 2;i++){
      if(A >= B){
          total += A;
          A--;
      }else{
          total += B;
          B--;
      }
  }
  cout << total << endl;
}


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

using namespace std;

typedef long long LL;

LL n, x, ans;

// a => short, b => long
void cal(LL a, LL b) {
    if (b % a == 0) {
        ans += (b - a) / a * 2 * a + a;
        return; 
    } else {
        ans += b / a * 2 * a;
        cal(b % a, a);
    }
}

int main() {
    scanf("%lld%lld", &n, &x);
    ans += n;
    cal(min(x, n - x), max(x, n - x));
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <unordered_map>
#include <random>
#include <queue>
#include <iomanip>

#define BIG 1000000007
#define LLMAX 9223372036854775807
#define LLMIN (-9223372036854775808)
#define long long long

using namespace std;

int main(){
    int n;
    cin >> n;
    vector<int> w(n,0);
    long a = 0;
    long b = 0;
    for(int i = 0;i < n;++i){
        cin >> w[i];
        b += w[i];
    }
    for(int i = 0;i < n;++i){
        long k1 = abs(a - b);
        a += w[i];
        b -= w[i];
        long k2 = abs(a - b);
        if(k1 < k2){
            cout << k1 << endl;
            return 0;
        }
    }
    cout << a << endl;

}




Measured memory_bytes: 888
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    int n;cin>>n;
    ll a,b;cin>>a>>b;
    vector<ll> x(n);
    rep(i,n)cin>>x[i];
    ll res=0;
    rep(i,n-1){
        ll buf=x[i+1]-x[i];
        if(buf*a>b)res+=b;
        else res+=a*buf;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 4056
k=2019
s=map(int,list(input()))
ans=0

inv10=202
inv=10
total=0
S=[0]*k
S[0]=1
for i,p in enumerate(s):
    inv*=inv10
    inv%=k
    total+=p*inv
    total%=k
    ans+=S[total]
    S[total]+=1
"""
for i,s in enumerate(S):
    if s>0:
        print(i,s)
"""
print(ans)


Measured memory_bytes: 79392
#include<stdio.h>
int main(void){
    long long int N,i,count=0;
    scanf("%lld",&N);
    for(i=1;i<=N;i++){
        if(i>0&&i<10)
            count++;
        if(i>99&&i<1000)
            count++;
        if(i>9999&&i<100000)
            count++;
        if(i==1000000)
            count++;
    }
    printf("%lld\n",count);
    return 0;
}


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

int main(){
	int K, S; cin >> K >> S;
  
  	int ans = 0;
  for(int i=0; i<=K; i++){
  	for(int j=0; j<=K; j++){
    	int z = S - i - j;
      	if(z >= 0 && z<= K) ans++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
// C.

#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(int argc, char *argv[])
{
	int n, ans = 0;
	cin >> n;
	vector<int> h(n);
	for (int i = 0; i < n; ++i) {
		cin >> h[i];
	}
	while (true) {
		int s, e;
		for (s = 0; s < n; ++s) {
			if (h[s]) {
				break;
			}
		}
		if (s >= n) {
			break;
		}
		++ans;
		for (int i = s; i < n; ++i) {
			if (!h[i]) {
				break;
			}
			--h[i];
		}
	}
	cout << ans << endl;
	return 0;
}


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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll X; cin >> X;
  ll t = 0;
  ll cur = 100;
  while (true) {
    t += 1;
    cur += cur / 100;
    if (cur >= X) {
      cout << t << endl;
      return 0;
    }
  }

  return 0;
}



Measured memory_bytes: 3648
#include<cstdio>
int main(){
  int a[100000];int ans=0;
  int n; scanf("%d", &n);
  for(int i = 0;i<n;i++){
    scanf("%d",&a[i]);
  	int x=0;
    while(true){
      if(a[i]%2!=0) break;
      else{
        x++;a[i]/=2;
      }
    }
    ans+=x;
  }
  printf("%d\n", ans);
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)

#define FOR(i,m,n) for(int i=(m);i<(n);i++)
#define int long long
#define ALL(x) (x).begin(),(x).end()
typedef pair<int, int> pii;

bool gaiseki(const pii &p1, const pii &p2) {
	return p1.first*p2.second - p1.second*p2.first>0;
}

void solve() {
	int N; cin >> N;
	if (N == 0) {
		exit(0);
	}
	N++;
	vector<vector<int>>ls(2*N+1);
	vector<vector<bool>>dirs(2 * N + 1);
	REP(_, N) {
		int M; cin >> M;
		vector<int>X(M), Y(M);
		REP(i, M)cin >> X[i] >> Y[i];
		REP(i, M - 1) {
			int l = max(abs(X[i + 1] - X[i]), abs(Y[i + 1] - Y[i]));
			ls[2 * _].push_back(l);
		}
		ls[2 * _ + 1] = ls[2 * _];
		reverse(ALL(ls[2 * _ + 1]));

		vector<bool>dir;
		FOR(i, 1, M - 1) {
			pii p1 = { X[i] - X[i - 1],Y[i] - Y[i - 1] };
			pii p2 = { X[i + 1] - X[i], Y[i + 1] - Y[i] };
			dir.push_back(gaiseki(p1, p2));
		}
		dirs[2 * _] = dir;
		dirs[2 * _ + 1] = dir;
		reverse(ALL(dirs[2 * _ + 1]));
		REP(i, dirs[2 * _ + 1].size()) {
			dirs[2 * _ + 1][i] = !dirs[2 * _ + 1][i];
		}
	}
	for (int i = 2; i < 2 * N; i += 2) {
		if (dirs[i] == dirs[0] && ls[i] == ls[0])cout << i / 2 << endl;
		else if (dirs[i] == dirs[1] && ls[i] == ls[1])cout << i / 2 << endl;
	}
	cout << "+++++" << endl;
}

signed main() {
	while(true)solve();
}



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




int main(){ 
      string s;
      cin >> s;
      int w=0;
      int k=s.size();
      for(int i=0;i<k;i++){
            if(s[i]=='o'){
                  w ++;
            }
      
      }
      if(w + 15-k >7){
            cout << "YES";

      }else{
            cout << "NO";
      }
      cout << endl;
}

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

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t,n,m,i,j,k,sum=0;
    int a,b,c;
    cin>>a>>b>>c;
    cout<<max(0LL,c-a+b)<<'\n';



    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(ll i = a;i < n;i++)
#define repr(i,a,n) for(ll i = n-1;i >= a;i--)
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
	
}

signed main(){
	ll a,b;
	cin >> a >> b;
	
	if((a+b) % 2) cout << "IMPOSSIBLE";
	else cout << (a+b)/2 << endl;
    return 0;
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val list = readLine().split(" ").toList.map(_.toInt)
    if (list.drop(1).sum == list.head || list.reverse.drop(1).sum == list.reverse.head || list.drop(1).reverse.drop(1).head == list.head + list.reverse.head) println("Yes")
    else println("No")

  }
}


Measured memory_bytes: 25396
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        String s = cin.next();
        int a = 0;
        int z = 0;
        for (a = 0; a < s.length(); a++) {
            if (s.charAt(a) == 'A') break;
        }
        for (z = s.length() - 1; z >= 0; z--) {
            if (s.charAt(z) == 'Z') break;
        }
        System.out.println(z - a + 1);
    }
}

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

bool is_prime(int n){
    if(n == 1) return false;
    for(int k = 2; k < int(sqrt(n))+1; k++){
        if(n % k == 0) return false;
    }
    return true;
}

int main(){
    int x;
    cin >> x;
    while(1){
        bool check = is_prime(x);
        if(check) break;
        x++;
    }
    cout << x << endl;
}

Measured memory_bytes: 256
class Fisherman
  attr_accessor :id, :num;
  def initialize(id, num)
    @id = id
    @num = num
  end
  def >(other)
    if self.num == other.num && self.id > other.id
        return true
    elsif self.num > other.num
      return true
    end
    return false
  end
  def <(other)
    if self.num == other.num && self.id < other.id
        return true
    elsif self.num < other.num
      return true
    end
    return false
  end
end

q = gets.split.map(&:to_i)[1]

h = [] # heap
id = {} #
pos = {}

q.times{|i|
  a, v = gets.split.map(&:to_i)
  if id[a]
    pp = pos[a]
    id[a] += v
    h[pp].num += v
    if v > 0
      cc = pp
      pp = (cc+1)/2-1
      b = h[pp].id
      while cc > 0 && h[pp] < h[cc]
        h[pp], h[cc] = h[cc], h[pp]
        pos[a], pos[b] = pos[b], pos[a]
        cc = pp
        pp = (cc+1)/2-1
        b = h[pp].id
      end
    else
      loop do
        maxid = pp
        l = 2*pp+1
        maxid = l if h[l] && h[l] > h[maxid]
        r = 2*pp+2
        maxid = r if h[r] && h[r] > h[maxid]
        break if maxid == pp
        c = h[pp].id
        b = h[maxid].id
        h[maxid], h[pp] = h[pp], h[maxid]
        pos[c], pos[b] = pos[b], pos[c]
        pp = maxid
      end
    end
  else
    h << Fisherman.new(a, v)
    cc = h.size - 1
    pos[a] = cc
    pp = (cc+1)/2-1
    b = h[pp].id
    while cc > 0 && h[pp] < h[cc]
      h[pp], h[cc] = h[cc], h[pp]
      pos[a], pos[b] = pos[b], pos[a]
      cc = pp
      pp = (cc+1)/2-1
      b = h[pp].id
    end
    id[a] = v
  end
  mval = h[0].num
  mid = h[0].id

  queue = [0]
  pp = 0
  while queue.size > 0
    pp = queue.shift
    mid = h[pp].id if mid > h[pp].id
    l = 2*pp+1
    queue << l if h[l] && h[l].num == mval
    r = 2*pp+2
    queue << r if h[r] && h[r].num == mval
  end
  puts [mid, mval].join(" ")
}

Measured memory_bytes: 29076
#include <iostream>
#include <stdio.h>
#include <queue>
#include <algorithm>
using namespace std;

typedef long long LL;
priority_queue<int> qu;

int main()
{
	int n,m; scanf("%d%d",&n,&m);
	int ai;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&ai);
		qu.push(ai);
	}
	while(m--)
	{
		ai=qu.top(); qu.pop();
		qu.push(ai/2);
	}
	LL ans=0;
	while(!qu.empty())
	{
		ai=qu.top(); qu.pop();
		ans+=ai;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 892
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0,i##_max=(N);i<i##_max;++i)
#define repp(i,l,r) for(int i=(l),i##_max=(r);i<i##_max;++i)
#define per(i,N) for(int i=(N)-1;i>=0;--i)
#define perr(i,l,r) for(int i=r-1,i##_min(l);i>=i##_min;--i)
#define all(arr) (arr).begin(), (arr).end()
#define SP << " " <<
#define SPF << " "
#define SPEEDUP cin.tie(0);ios::sync_with_stdio(false);
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL; 
  typedef pair<ll,char> PLC; 
  typedef pair<char,ll> PCL; 

inline void YesNo(bool b){ cout << (b?"Yes" : "No") << endl;}
inline void YESNO(bool b){ cout << (b?"YES" : "NO") << endl;}
inline void Yay(bool b){ cout << (b?"Yay!" : ":(") << endl;}

const int N_2 = 29;
const int MAX_N = 2e5+5;
int a[MAX_N],b[MAX_N],c[MAX_N],d[MAX_N];


int main(void){
  SPEEDUP
  cout << setprecision(15);
  int N;cin >> N;
  ++N;

  //入力
  //c[j],d[j];a[j],b[j]のi桁以下の数字
  repp(j,1,N) cin >> a[j];
  repp(j,1,N) cin >> b[j];

  int ans = 0;
  rep(i,N_2){
    //i桁目の1の個数
    int na_digit=0,nb_digit=0;
    //i桁目の和のXOR
    int digit_sum=0;
    rep(j,N){
      na_digit^=(a[j]>>i)&1;
      nb_digit^=(b[j]>>i)&1;
    }
    //桁上げを考慮しないi桁目のXOR
    digit_sum = (na_digit+nb_digit)*(N-1)&1;
    if(i==0){
      ans+=digit_sum;
      continue;
    }

    rep(j,N){
      c[j] = a[j]&((1<<i)-1);
      d[j] = b[j]&((1<<i)-1);
    }
    sort(c,c+N);
    sort(d,d+N);

    int r = N-1;
    repp(j,1,N){
      while(d[r]+c[j] >= (1<<i))r--;
      digit_sum ^= (N-1-r)&1;
    }
    ans += digit_sum<<i;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3328
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a,b;
  cin >> a >> b;
  int x = stoi(a+b);
  for (int i = 0; i < 1000; i++){
    if(i*i == x){
      cout << "Yes";
      return 0;
    }
  }
  cout << "No";
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<unordered_map>
#include<queue>
#include<iomanip>
#include<math.h>
#include<bitset>
#include<cassert>
#include<random>
#include<time.h>
#include<functional>
using namespace std;
using ll=long long;
using ld=long double;
using P=pair<ll,ll>;
#define MOD 1000000007LL
#define INF 1000000000LL
#define EPS 1e-10
#define FOR(i,n,m) for(ll i=n;i<(ll)m;i++)
#define REP(i,n) FOR(i,0,n)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ALL(v) v.begin(),v.end()
#define UNIQUE(v)  sort(ALL(v));v.erase(unique(ALL(v)),v.end());
#define pb push_back

/* --------------------------------------- */

constexpr ll MAX_N = 505050;
class BIT {
public:
	BIT(ll N) : N(N) { }
	void add(ll a, ll w) {
		a++;
		for (ll x = a; x <= N; x += x & -x) bit[x] += w;
	}

	ll get(ll a) {
		return sum(a, a + 1);
	}

	ll sum(ll a) {
		a++;
		ll ret = 0;
		for (ll x = a; x > 0; x -= x & -x) ret += bit[x];
		return ret;
	}

	// [a, b) の和を返す
	ll sum(ll a, ll b) {
		if(b == 0 || b - a <= 0) return 0;
		ll ret = sum(b - 1);
		if(a != 0) ret -= sum(a - 1);
		return ret;
	}

	void clear() {
		for(ll i = 0; i < N; i++) bit[i] = 0;
	}
private:
	const ll N;
	ll bit[MAX_N];
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n, q;
	cin >> n >> q;
	BIT bit(n);
	REP(i, q) {
		ll c, x, y;
		cin >> c >> x >> y;
		if(c == 0) {
			x--;
			bit.add(x, y);
		} else {
			x--;
			cout << bit.sum(x, y) << endl;
		}
	}
	return 0;
}

/* --------------------------------------- */




Measured memory_bytes: 3908
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
  int n, min_count, tmp;
  min_count=100;
  cin >> n;
  for(int i=0;i<n;i++){
    int count=0;
    cin >> tmp;
	while(tmp%2==0){
      tmp/=2;
      count++;
    }
    min_count=min(min_count,count);
  }
  cout << min_count << endl;  
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
struct BIT{
    vector<long long> num;
    int N;
    BIT(int n){
        N = n;
        num.resize(N + 1, 0);
    }
    long long sum(int t){
        long long res = 0;
        while(t > 0){
            res += num[t];
            t -= t & -t;
        }
        return res;
    }
    void add(int ind, long long t){
        while(ind <= N){
            num[ind] += t;
            ind += ind & -ind;
        }
    }
};

int main(){
    int N, Q;
    cin >> N >> Q;
    BIT bit(N);
    for(int i = 0; i < N; i++){
        long long a;
        cin >> a;
        bit.add(i + 1, a);
    }
    for(int i = 0; i < Q; i++){
        int t, l, r;
        cin >> t >> l >> r;
        if(t == 0) bit.add(l + 1, r);
        else cout << bit.sum(r) - bit.sum(l) << endl;
    }
}

Measured memory_bytes: 8224
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	int n;
	scanf("%d", &n);
	if (n % 2 == 0) {
		printf("%d\n", n * (n - 2) / 2);
		for (int i = 1; i < n; i++)
			for (int j = i + 1; j <= n; j++) {
				if (i + j != n + 1)
					printf("%d %d\n", i, j);
			}
	} else {
		printf("%d\n", n * (n - 2) / 2 + 1);
		for (int i = 1; i < n; i++)
			for (int j = i + 1; j <= n; j++) {
				if (i + j != n)
					printf("%d %d\n", i, j);
			}

	}

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  map<int,int> m;
  for(int i = 0; i < N; ++i){
    cin >> A[i];
    ++m[A[i]];
  }
  int t = 0;
  for(auto itr = m.begin(); itr != m.end(); ++itr){
    if(itr->second > 1){

      t += itr->second-1;
    }
  }
  cout << N - (t+1)/2*2 << endl;
  return 0;
}


Measured memory_bytes: 5376
n, m, x = map(int, input().split())
books = [list(map(int, input().split())) for _ in range(n)]

ans = 1e18

for i in range(1 << n):
    skills = [0] * m
    cost = 0
    for j in range(n):
        if i & (1 << j):
            cost += books[j][0]
            for k in range(m):
                skills[k] += books[j][k + 1]
    for j in range(m):
        if skills[j] < x:
            cost = 1e18
    ans = min(ans, cost)

print(-1 if ans == 1e18 else ans)

Measured memory_bytes: 9224
#include<cstdio>
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;
const int mod = 998244353;
const int maxn = 10000 + 10;
int inv[maxn] , fac[maxn] , pow[maxn];

int mul(int a,int b){
	return (ll)a * b % mod;
}
int add(int a,int b){
	return (a + b) % mod;
}

void prep(){
	fac[0] = fac[1] = inv[0] = inv[1] = 1;
	pow[0] = 1;
	for(int i = 1;i < maxn;i++) pow[i] = mul(pow[i - 1],2); 
	for(int i = 2 ;i < maxn;i++){
		inv[i] = mod - mul(inv[mod % i],mod / i);
		fac[i] = i;
	}
	for(int i = 2;i < maxn;i++){
		inv[i] = mul(inv[i],inv[i - 1]);
		fac[i] = mul(fac[i],fac[i - 1]);
	} 
	
}


int C(int n,int k){
	if(k > n || n < 0) return 0;
	return mul(mul(fac[n],inv[n - k]),inv[k]); 
}

int G(int n,int a,int b){
	int ans = 0;
	for(int i = 0;i <= b;i++){
		int d = 0;
		d = add(d,mul(C(b,i),mul(pow[i],C(n + a - 1,i + a - 1))));
		ans = add(ans,d);
	}
	return ans;
}

int F(int n,int k,int i){
	int a = k - i + 1,b = (i - 1) / 2,ans = 0,d = (i - 1) % 2;
	ans = add(ans,G(n,a,b));
	if(d){
		n--;
		ans = add(ans,G(n,a,b));
	}
	return ans;
}

int main(){
	prep();
	int n,k;
	scanf("%d%d",&k,&n);
	for(int i = 2;i <= k + 1;i++){
		printf("%d\n",F(n,k,i));
	} 
	for(int i = k;i >= 2;i--){
		printf("%d\n",F(n,k,i));
	}
	return 0;
}

Measured memory_bytes: 384
/*
      author  : nishi5451
      created : 14.08.2020 14:30:28
*/

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


int main(){
    int a,b,c,d;
    cin >> a >> b >> c >> d;
    if(b < c || d < a) cout << 0 << endl;
    else{
        if(a < c){
            cout << min(b,d) - c << endl;
        }
        else if(c <= a){
            cout << min(b,d) - a << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define R register
#define mp make_pair
#define ll long long
#define pii pair<int, int>
using namespace std;
const int N = 210000;

int n, a[N], p[N];

template <class T>
inline void read(T &x) {
	x = 0;
	char ch = getchar(), w = 0;
	while (!isdigit(ch)) w = (ch == '-'), ch = getchar();
	while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
	x = w ? -x : x;
	return;
}

int main() {
	read(n);
	for (R int i = 1; i <= n; ++i) read(a[i]), p[a[i]] = i;
	int ans = 0, now = 1;
	for (R int i = 1; i <= n; ++i) {
		if (!--now) {
			int lst = 0;
			while (i + now <= n && p[i + now] > lst) lst = p[i + now], ++now;
			ans = max(ans, now);
		}
	}
	cout << n - ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#ifdef MY_LOCAL
#define MY_NAMESPACE(ns) namespace ns {
#define MY_NAMESPACE_    }
#define MY_DEBUG(s)      s
#else
#define MY_NAMESPACE(ns) 
#define MY_NAMESPACE_    
#define MY_DEBUG(s)      
#endif

#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define EPS (1e-7)


MY_NAMESPACE(testbed)
int main()
{
	const int modval = 998244353;

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

	vector<vector<ll>> dp(n + 1, vector<ll>(s + 1));
	dp[0][0] = 1;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j <= s; j++)
		{
			dp[i + 1][j] = dp[i][j] * 2 % modval;
			if (j - a[i] >= 0)
			{
				dp[i + 1][j] += dp[i][j - a[i]];
				dp[i + 1][j] %= modval;
			}
		}
	}
	cout << dp[n][s] << "\n";
	return 0;
}
MY_NAMESPACE_

Measured memory_bytes: 73740
#include <iostream>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const long long INF = 1LL<<60;

const int MAX_N = 110;
const int MAX_V = 100100;

// 入力
int N;
long long W, weight[MAX_N], value[MAX_N]; // 品物の個数は 100 個なので少し余裕持たせてサイズ 110 に

// DPテーブル
long long dp[MAX_N][MAX_V];

int main() {
    cin >> N >> W;
    for (int i = 0; i < N; ++i) cin >> weight[i] >> value[i];

    // 初期化
    for (int i = 0; i < MAX_N; ++i) for (int j = 0; j < MAX_V; ++j) dp[i][j] = INF;

    // 初期条件
    dp[0][0] = 0;

    // DPループ
    for (int i = 0; i < N; ++i) {
        for (int sum_v = 0; sum_v < MAX_V; ++sum_v) {

            // i 番目の品物を選ぶ場合
            if (sum_v - value[i] >= 0) chmin(dp[i+1][sum_v], dp[i][sum_v - value[i]] + weight[i]);

            // i 番目の品物を選ばない場合
            chmin(dp[i+1][sum_v], dp[i][sum_v]);
        }
    }

    // 最適値の出力
    long long res = 0;
    for (int sum_v = 0; sum_v < MAX_V; ++sum_v) {
        if (dp[N][sum_v] <= W) res = sum_v;
    }
    cout << res << endl;
}

Measured memory_bytes: 86524
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val h = readLine()!!.split(" ").map { it.toInt() }

    val goal = (1..100).map{ y ->
        (0..n-1).map { if( y<=h[it] ) '1' else '0'}.joinToString("")
    }

    val ans = goal.map{
        it.split("0").filter { it.length>0 }.size
    }.sum()

    println(ans)
}

Measured memory_bytes: 40536
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define watch(x) cout << (#x) << " is " << (x) << endl

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

const int MOD = 1e9 + 7;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int m1, d1, m2, d2; cin >> m1 >> d1 >> m2 >> d2;
    cout << !(m1 == m2);

    return 0;
}


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

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

int n,m;
char s[102][102];
int main() {    
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++) scanf("%s",s[i]+1);
    bool ok = 1;
    for(int i=1;i<=n;i++) {
        for(int j=1;j<=m;j++) {
            if(s[i][j]=='#') {
                bool can = 0;
                for(int k=0;k<4;k++) {
                    if(s[i+dx[k]][j+dy[k]] == '#') {
                        can = 1;
                    }
                }
                if (can == 0) ok = 0; 
            }
        }
    }
    printf("%s\n", ok?"Yes":"No");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fio ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
int main(){
	fio;
	int n,m;
	cin>>n>>m;
	int a[n+1],s[n+1],ans=1;
	for(int i=1;i<=n;i++)cin>>a[i];
	s[0]=0;
	for(int i=1;i<=n;i++){
		s[i]=s[i-1]+a[i];
		if(s[i]<=m)ans++;
	}
	cout<<ans;
}

Measured memory_bytes: 256
s = input()

flag = 0

if s.count('C')*s.count('F')==0:
	print('No')
	exit()
	
for i in range(len(s)):
	if s[i]=='C':
		flag = 1
	if flag == 1 and s[i]=='F':
		print('Yes')
		exit()

print('No')


Measured memory_bytes: 38256
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <set>
#include <unordered_set>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <numeric>

using namespace std;

typedef long long ll;

#define forn(i, n) for(int i = 0; i < (int)(n);++i)
#define fore(i, a, b) for(int i = (int)(a); i <= (int)(b); ++i)
#define fi first
#define se second
#define pb push_back
#define pll pair<ll,ll>
#define vi vector<int>
#define vb vector<bool>
#define vvi vector<vi>
#define vpll vector<pll>
#define vll vector<ll>
#define vvll vector<vll>
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()


void fastik() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

//ifstream &cin
void solve(){

}

int main() {
    fastik();
    ll l,r;
    cin >> l >> r;
    ll ans = 2e9+55;
    ll x = 0;
    set<ll> gut;
    ll found = -1;
    ll cnt = 0;
    fore(i,l,r){
        fore(j,i+1,r){
            x = ((i%2019) * (j%2019)) % 2019;
            cnt++;
            if(gut.find(x) == gut.end()){
                gut.insert(x);
            }else if(cnt == 1000000){
                found = 1;
                break;
            }

        }
        if(found == 1){
            break;
        }
    }
    for(auto i: gut){
        ans = min(ans,i);
    }
    cout << ans;
}

Measured memory_bytes: 384
#include<iostream>
using namespace std;
int main(){
	double x,y;
	while(cin>>x>>y){
		if(35.50>x&&71.00>y)
		cout<<"AAA"<<endl;
		else if(37.50>x&&77.00>y)
		cout<<"AA"<<endl;
		else if(40.00>x&&83.00>y)
		cout<<"A"<<endl;
		else if(43.00>x&&89.00>y)
		cout<<"B"<<endl;
		else if(50.00>x&&105.00>y)
		cout<<"C"<<endl;
		else if(55.00>x&&116.00>y)
		cout<<"D"<<endl;
		else if(70.00>x&&148.00>y)
		cout<<"E"<<endl;
		else cout<<"NA"<<endl;
		
	}
	return 0;
}

Measured memory_bytes: 0
#include<stdio.h>
int main()
{
	int a,b,k=0,t=0;

	scanf("%d%d",&a,&b);
	if(b<=1){
		printf("0");
		return 0;
	}
	while(k<=b){
		t++;
		k+=a;
		if(k>=b)
			break;
		k--;
	}
	printf("%d",t);
	return 0;
}

Measured memory_bytes: 128
import sys
def input(): return sys.stdin.readline().rstrip()

def calc(n):
    if n % 2 == 0:
        return n // 2
    else:
        return 3 * n + 1

def main():
    s = int(input())

    val = s
    ls = set([val])
    for m in range(2, 1000001):
        val = calc(val)
        if val in ls:
            print(m)
            exit()
        else:
            ls.add(val)
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <cassert>
#include <stack>
#include <bitset>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

typedef bitset<128> Bit;

int n, m;
string input[128];
map<vector<int>, int> memo;
// qS[i] = j : iツ氾板姪堋づ個篠ソツ姪「ツづーyes/noツづ猟伉用

int dfs(Bit manS, vector<int> qS) {
  if (memo.count(qS)) return memo[qS];
  if (manS.count() <= 1) {
    return memo[qS] = 0;
  }
    
  int res = INF;
  REP(i, m) {
    if (qS[i]) continue;
    Bit nextS1, nextS2;
    REP(j, n) {
      if (manS.test(j)) {
        if (input[j][i] == '1') nextS1.set(j);
        else nextS2.set(j);
      }
    }
    vector<int> nextqS1 = qS, nextqS2 = qS;
    nextqS1[i] = 1;
    nextqS2[i] = 2;
    res = min(res, max(dfs(nextS1, nextqS1), dfs(nextS2, nextqS2)) + 1);
  }
  // cout << manS << " ";
  // REP(i, m) cout << qS[i];
  // cout << " " << res << endl;
  return memo[qS] = res;
}

int main() {
  while(cin>>m>>n,n||m) {
    REP(i, n) cin >> input[i];
    Bit tmp;
    REP(i, n) tmp.set(i);
    memo.clear();
    cout << dfs(tmp, vector<int>(m)) << endl;
  }
}

Measured memory_bytes: 12000
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

K = I()

i,j = divmod(K,50)
a = [100+i-j]*j + [49+i-j]*(50-j)
print(50)
print(*a)

Measured memory_bytes: 38384
#include<stdio.h>
int main(void){
	int N,i,j,c,count=0;
	int flag=1;
	scanf("%d",&N);
	int A[N];
	for(i=0;i<N;i++){
		scanf("%d",A+i);
	}
	while(flag){
		flag = 0;
		for(j=N-1;j>0;j--){
			if(A[j]<A[j-1]){
				count++;
				c = A[j];
				A[j] = A[j-1];
				A[j-1] = c;
				flag = 1;
			}
		}
	}
	for(i=0;i<N-1;i++){
			printf("%d ",A[i]);
		}
		printf("%d",A[N-1]);
		printf("\n");
		printf("%d\n",count);
	return 0;
}


Measured memory_bytes: 1992
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    map <int,bool> flag;
    int n,m,ans=0; cin>>n>>m;
    int a[m],dis[m-1];
    for (int i=0;i<m;i++) cin>>a[i];
    sort(a,a+m); 
    for (int i=1;i<m;i++) 
        dis[i-1] = (a[i]-a[i-1]); 
    ans = a[m-1]-a[0];
    sort(dis,dis+(m-1),greater<int> ());
    for (int i=0;i<min(n-1,m-1);i++) ans-=dis[i];
    cout << ans << endl;
}

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


Measured memory_bytes: 5200
//organize , stay in moment and work -- Abhinav IIIT-A
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ar array
#define f(i,x,n) for(int i=x;i<n;++i)
#define sz(s) s.size()
#define pb push_back
void solve(){
    int a[3];
    f(i,0,3)
    cin>>a[i];
    sort(a,a+3);
    if((a[0]==a[1] || a[1] == a[2] )&& a[0]!=a[2] )
        cout<<"YES\n";
    else
        cout<<"NO\n";
}
void tp(){
    int n; cin>>n;
    bool tp=1;
    while(n--){
        int cp;
        cin>>cp;
        if(cp%2==0){
            if(!(cp%3==0 || cp%5==0))
                tp=0;
        }
    }
    tp ? cout<<"APPROVED" : cout<<"DENIED";
}
void q3(){
    int n;
    cin>>n;
    int mx=0;
    map<string ,int> mp;
    while(n--){
        string cp;
        cin>>cp;
        int xp=++mp[cp];
        mx=max(mx,xp);
    }
    for(auto ip : mp){
        if(ip.second==mx)
            cout<<ip.first<<"\n";
    }
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;t=1;
    //cin>>t
    while(t--)
    q3();
    return 0;
}


Measured memory_bytes: 23808
#include <iostream>
#define rep(i,n) for(int i=0; i<(int)(n); i++)

using namespace std;
typedef long long LL;

int main(){
	int N;
	cin >> N;
	string S;
	cin >> S;
	int R[4010]={0}, G[4010]={0}, B[4010]={0};
	int r=0, g=0, b=0;
	rep(i,N){
		if(S[i]=='R') r++;
		if(S[i]=='G') g++;
		if(S[i]=='B') b++;
		R[i]=r, G[i]=g, B[i]=b;
	}
	LL ans=0;
	rep(i,N){
		if(S[i]=='R'){
			for(int j=i+1; j<N; j++){
				if(S[j]=='G'){
					ans+=b-B[j];
					if(j*2-i<N&&S[j*2-i]=='B') ans--;
				}
				if(S[j]=='B'){
					ans+=g-G[j];
					if(j*2-i<N&&S[j*2-i]=='G') ans--;
				}
			}
		}
		if(S[i]=='G'){
			for(int j=i+1; j<N; j++){
				if(S[j]=='R'){
					ans+=b-B[j];
					if(j*2-i<N&&S[j*2-i]=='B') ans--;
				}
				if(S[j]=='B'){
					ans+=r-R[j];
					if(j*2-i<N&&S[j*2-i]=='R') ans--;
				}
			}
		}
		if(S[i]=='B'){
			for(int j=i+1; j<N; j++){
				if(S[j]=='G'){
					ans+=r-R[j];
					if(j*2-i<N&&S[j*2-i]=='R') ans--;
				}
				if(S[j]=='R'){
					ans+=g-G[j];
					if(j*2-i<N&&S[j*2-i]=='G') ans--;
				}
			}
		}
	}
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3676
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define DEBUG true
#ifdef ONLINE_JUDGE
#undef DEBUG
#define DEBUG false
#endif 

using namespace std;

#define MAXN ((int)2e5+5)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9 + 9)
#define ll long long
#define _ << " " <<
#define CLEAR(a, b) memset(a, b, sizeof(a))
#define TRACE(x) if(DEBUG) cerr << #x << " = " << x << endl;
#define TRACE2(x,y) if(DEBUG) cerr << #x << " = " << x << " | " << #y << " = " << y << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define endl "\n"
#define pii pair<int,int>
#define mid ((l+r)/2)

ll n;
ll d[MAXN];
ll place[MAXN];

ll ans = 0;

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

	for (int i = 1; i <= n; ++i)
	{
		cin >> d[i];
		place[d[i]] = i;
	}

	multiset <ll> st = {0,0,n+1,n+1};

	for (int i = n; i > 0; --i)
	{
		auto it = st.insert(place[i]);

		ll k = place[i];

		ll l1 = *(--it);
		ll l2 = *(--it); 

		ll r1 = *++(++(++(it)));
		ll r2 = *(++it);

		ans += ((k-l1) * (r2 - r1) + (l1 - l2) * (r1-k)) * i; 
	}
	
	cout << ans << endl;
}

Measured memory_bytes: 6528
#include <queue>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
#define MKP make_pair

const int N=2e5+5;
ll ans;
int n,fa[N],pre[N],val[N],num[N];
int find(int x) {return fa[x]==x?fa[x]:fa[x]=find(fa[x]);}

template <typename _Tp> inline void IN(_Tp&x) {
	char ch;bool flag=0;x=0;
	while(ch=getchar(),!isdigit(ch)) if(ch=='-') flag=1;
	while(isdigit(ch)) x=x*10+ch-'0',ch=getchar();
	if(flag) x=-x;
}

struct Node {
	ll sum[2];int id;
	Node operator + (const Node&b) const {return (Node){sum[0]+b.sum[0],sum[1]+b.sum[1],id};}
	bool operator == (const Node&b) const {return sum[0]==b.sum[0]&&sum[1]==b.sum[1]&&id==b.id;}
	bool operator < (const Node&b) const {
		if(sum[0]*b.sum[1]==sum[1]*b.sum[0])
			return (sum[0]==b.sum[0])?((sum[1]==b.sum[1])?id<b.id:sum[1]<b.sum[1]):sum[0]<b.sum[0];
		return sum[0]*b.sum[1]<sum[1]*b.sum[0];
	}
}P[N];
struct Queue {
    priority_queue <Node> q1,q2;
    inline void add(Node t) {q1.push(t);}
    inline void del(Node t) {q2.push(t);}
    Node top() {
        while(!q1.empty()&&!q2.empty()&&q1.top()==q2.top()) q1.pop(),q2.pop();
        return q1.top();
    }
}Q;

int main() {
	IN(n);
	for(int i=2;i<=n;++i) IN(pre[i]);
	for(int i=1;i<=n;++i) IN(val[i]),fa[i]=i;
	for(int i=1;i<=n;++i) P[i].sum[0]=!val[i],P[i].sum[1]=val[i],P[i].id=i;
	for(int i=2;i<=n;++i) Q.add(P[i]);
	for(int i=2;i<=n;++i) {
		Node now=Q.top();Q.del(now);
		int u=now.id,f=find(pre[u]);
		if(f!=1) Q.del(P[f]);
		ans+=P[f].sum[1]*P[u].sum[0],P[f]=P[f]+P[u],fa[u]=f;
		if(f!=1) Q.add(P[f]);
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 27756
/*
 * Since g++10 is released, some characters is not valid inside #if 0 :(
 * So, why not using clang++? :D

 * Date:
  2020.06.04

 * Solution:
  记一个联通块的编号最小和最大的点为关键点对 l, r ，如果该联通块的大小恰为 r - l + 1 ，就
称这个联通块是极小的。
  设 f[l][r] 表示 l, r 在同一个联通块，并且 [l, r] 区间内的点的连边都在 [l, r] 范围内的方
案数。如果求出了 f ，统计答案只需要单独考虑联通块的贡献，设该联通块的关键点对为 l, r ，虽
然该联通块单独出现的次数不好求，但是把关键点对相同的联通块放在一起，可以发现这些联通块的
出现次数之和就是 f[l][r] * g ，其中 g 是 [l, r] 区间外的点任意匹配的方案数。
  求 f 只需要容斥，任意匹配的方案数是很好算的，但是会算重，去重只需要枚举 l 所在联通块的
实际右端点即可。

 * CopyRight:
          ▁▃▄▄▄▃▃▃▃▄▶
        ▗▇▀▔    ▔▔▔▔
       ▄▛   ▃▅━━■▄▂
      ▟▊   ▐▘     ▀▙
     ▟▜▌   ▐▖   ▋  ▐▍
    ▟▘ ▜   ▝▀▇▆●▘  ▐▌
  ▗▟▘   ▜▃       ▁▅▛
  ▔▀▼▅▄▃▃██▅▄▄▄▅■▀▔
        ▔▔▔▔▔▔
 */

#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
} read;

const int maxn = 603, mod = 1000000007;
ll f[maxn];
ll g[maxn];
int h[maxn];
int match[maxn];

int main () {
	ll M = 1ll * mod * mod;
	int n = read, m = read;
	int N = n << 1;

	g[0] = 1;
	for (int i = 0; i < n; i ++)
		g[(i + 1) << 1] = g[i << 1] * (i << 1 | 1) % mod;

	while (m --) {
		int x = read, y = read;
		match[x] = y;
		match[y] = x;
	}

	for (int i = 1; i <= N; i ++)
		h[i] = h[i - 1] + (match[i] == 0);

	ll ans = 0;
	for (int l = 1; l <= N; l ++) {
		std::fill(f, f + N + 1, 0);
		int max = 0;
		for (int r = l; r <= N; r ++) {
			if (match[r] and match[r] < l) break;
			max = std::max(match[r], max);
			if (r >= max) {
				f[r] = g[h[r] - h[l - 1]];
				for (int x = l; x < r; x ++)
					if ((f[r] += (mod - f[x]) * g[h[r] - h[x]]) >= M)
						f[r] -= M;
				f[r] %= mod;
				(ans += f[r] * g[h[N] - h[r] + h[l - 1]]) %= mod;
			}
		}
	}

	printf("%lld\n", ans);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define int long long int
#define ld long double
#define getFaster ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define rep(i,init,n) for(int i=init;i<n;i++)
#define rev(i,n,init) for(int i=n;i>=init;i--)
#define MAXN 200005
#define MOD2 998244353
#define MOD1 1e9+7
#define f first
#define s second
#define endl '\n'
#define pii pair<int,int>
#define piii pair<pii,int>
#define precise(i) cout<<fixed<<setprecision(i)
#define codejam cout<<"Case #"<<ii+1<<": ";
#define impossible cout<<"IMPOSSIBLE"<<endl;
#define error(s) throw runtime_error(s)
using namespace std;
const long double PI = atan(1.0)*4;
const int64_t INF=8e18;
const int32_t LOG=21;
const int MOD=MOD1;

int pow10[200005];
void init()
{
    pow10[0]=1;
    rep(i,1,200003)
    pow10[i]=(pow10[i-1]*10)%2019;
}
int32_t main()
{ 
      getFaster;
      int tests=1;
      //cin>>tests;
      rep(ii,0,tests)
      {
           init();
           map<int,int> m;
           int ans=0;
           int cur=0;
          string s;
          cin>>s;
          int n=s.length();
          rep(i,0,s.length())
          {
              cur*=10;
              cur+=(s[i]-'0');
              cur%=2019;
              ans+=m[(cur*pow10[n-i])%2019];
              if(cur==0)ans++;  
              m[(cur*pow10[n-i])%2019]++;
          }
          cout<<ans<<endl;
      }     
      return 0;                         
}

/*
 TIPS:
 1.) Check for corner cases (like 0 is exception case)
 2.) Check for global memory sizes,memory refreshments and its complexity 
 3.) Check for sorting criteria (if used 1-based indexing)
 4.) Check for numbers overflow (while multiplying and doing MOD)
 5.) Check for typecasting issues like int to float( while dividing numbers)
*/

Measured memory_bytes: 5348