akhauriyash/Code-Regression huggingface dataset:
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);

// ===

fn main() {
    let n: usize = read();
    let mut last_t = 0;
    let mut last_x = 0;
    let mut last_y = 0;

    let mut ok = true;
    for _i in 0..n {
        let (t, x, y): (i32, i32, i32) = read();
        let diff = (x-last_x).abs() + (y-last_y).abs();
        let time = t - last_t;
        if diff > time || (time-diff)%2 == 1 {
            ok = false;
        }
        last_t = t;
        last_x = x;
        last_y = y;
    }

    if ok {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

int main() {
    int n, h, w;
    cin >> n >> h >> w;
    int cnt = 0;
    int a[n], b[n];
    for(int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        if(a[i] >= h && b[i] >= w) {
            cnt++;
        }
    }
    cout << cnt << endl;
}


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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e16+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);


    string s;
    cin>>s;
    bool ok = true;

    if(s[0]!=*"A")ok=false;
    ll ccount = 0;
    ll ckomoji = 0;

    rep(i,s.length()){
        if(i>=2 && i <= s.length()-2){
            if(s[i]=='C'){
                ccount++;
            }
        }
        if(islower(s[i])){
            ckomoji++;
        }
    }

    if(ccount!=1)ok= false;
    if(ckomoji!=s.length()-2)ok= false;


    if(ok){
        cout<<"AC"<<endl;

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

    }
    return  0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
	int H, W;
	cin >> H >> W;
	vector<vector<string>> S(H, vector<string>(W));
	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			cin >> S[i][j];
		}
	}

	for (int i = 0; i < H; ++i) {
		for (int j = 0; j < W; ++j) {
			if (S[i][j] == "snuke") {
				int row = i + 1;
				char col = 'A' + j;
				cout << col << row << endl;
			}
		}
	}
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
int main(){
  long long int X,K,D;
  std::cin>>X>>K>>D;
  X=std::abs(X);
  if(X/D-K>=0){
    std::cout<<X-K*D<<std::endl;
    return 0;
  }
  K=K-X/D;
  if(K%2==1){
    std::cout<<std::abs(X%D-D)<<std::endl;
  }else {
    std::cout<<X%D<<std::endl;
  }
  return 0;
}



Measured memory_bytes: 3620
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <bitset>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <utility>
#include <set>
#include <map>
#include <tuple> 
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <list>
using namespace  std;
using ll = long long;
using P = pair<ll, ll>;
#define REP(i, n) for(long long (i)=0, i_bound = (long long)(n); (i)<i_bound; ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
const long long MOD = static_cast<long long>(1e9) + 7LL;
const long long INF = 1234567891234567890LL;
int main(){
    cin.tie(0);
    cout.sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    map<int, int> m;
    bool res = true;
    REP(i, M){
        int s, c;
        cin >> s >> c;
        if(m.count(s)){
            if(m[s] != c) {
                res = false;
            }
        }
        else{
            m[s] = c;
        }
    }
    if(N==1 and m.count(1) and m[1]==0) {
        cout << 0 << endl;
        return 0;
    }
    if(m.count(1) and m[1]==0) res = false;
    string ans = "";
        if(N==1 and M==0) {
        cout << 0 << endl;
        return 0;
    }
    if(res){
        for(int i=1; i<=N; i++){
            if(m.count(i)){
                ans = ans + to_string(m[i]);            
            }
            else {
                if(i==1) ans = ans + to_string(1);
                else ans = ans + to_string(0);
            }
        }
        cout << ans << endl;
    }else {
        cout << -1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Numerics;

namespace abc170
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
            solve_abc170A();
            Console.Out.Flush();
        }

        public static void solve_abc170B()
        {
        }

        public static void solve_abc170A()
        {
            int[] x = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
            for (int i = 0; i < x.Length; i++)
            {
                if (x[i] == 0)
                {
                    Console.WriteLine(i + 1);
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 28340
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int n = scan.nextInt();
    int k = scan.nextInt();
    int[] a = new int[n];
    for (int i=0;i<n;i++){
      a[i] = scan.nextInt();
    }

    Arrays.sort(a);

    int l = 1;
    int r = a[n-1];
    long s = 0;

    while (r > l){
      int mid = (int) (l+r)/2;
      s = find(a,mid);
      if (s > k){
        l = mid + 1;
      }
      else{
        r = mid;
      }
    }

    System.out.println(l);
  }

  static long find(int[] a, int target){
    long sum = 0;
    for (int b : a){
      int g = (int) b/target;
      if (target*g != b){
        g += 1;
      }
      g -= 1;
      sum += g;
    }
    return sum;
  }

}


Measured memory_bytes: 61012
#include<bits/stdc++.h>
using namespace std;
#define ll  long long int
int main()
{
    ll a,b,n,m;
    cin>>n>>m;
    a=(n*(n-1))/2;
    b=(m*(m-1))/2;
    cout<<a+b<<endl;
    return 0;
}


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

int main() {
    int64_t W, H, x ,y;
    std::cin >> W >> H >> x >> y;
    
    int flag = 0; 
    if (x * 2 == W && y * 2 == H) {
        flag = 1;
    }

    std::printf("%.10lf %d\n", W * H / 2.0, flag);

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int K,tmp,sum;
  	scanf("%d", &K);
	if(0<K && K<201){
	    for(int ak = 1; ak < K+1; ak++){
	        for(int bk = 1; bk < K+1; bk++){
	            for(int ck = 1; ck < K+1; ck++){
	                int a = ak;
	                int b = bk;
	                int c = ck;
	                  if(a<b){
	                      tmp = a;
	                      a = b;
	                      b = tmp;
	                  }
	                  int ab = a % b;
	                  while(ab!=0){
	                      a = b;
	                      b = ab;
	                      ab = a % b;
	                  }
	                  if(b<c){
	                      tmp = b;
	                      b = c;
	                      c = tmp;
	                  }
	                  int abc = b % c;
	                  while(abc!=0){
	                      ab = c;
	                      c = abc;
	                      abc = ab % c;
	                  }
	                  sum = sum + c;
	            }
	        }
	    }
	    printf("%d", sum);
	}
}

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

#define ll long long
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) 
#define repi(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vin(v) rep(i,v.size()) {cin >> v[i];}
//最終奥義
#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//(lambda (x y) (< x y)) => [](int x, int y) -> int { return x<y; }

signed main(void){
  int n;cin >> n;
  vint h(n);vin(h);
  set<int> s;
  s.insert(h[0]);int k=0;
  repi(i,1,n){
    int m=*s.rbegin();
    chmax(k,m);
    if(k-h[i]>1){
      cout << "No" << endl;
      return 0;
    }
    if(m<h[i])s.insert(h[i]);
    else if(m-h[i]>2){
      cout << "No" << endl;
      return 0;
    }
    else if(m==h[i])continue;
    else{
      s.erase(s.find(h[i]+1));
      s.insert(h[i]);
    }
  }
  cout << "Yes" << endl;

}


Measured memory_bytes: 5760
#-*- coding:utf-8 -*-

if __name__ == "__main__":
    A, B, K = list(map(int, input().split()))
    end = A + K
    if end >= B+1:
        end = B + 1
    for i in range(A, end):
        print(i)
    if end == B + 1:
        exit()

    start = B - K + 1
    if start <= i:
        start = i + 1
    for j in range(start, B+1):
        print(j)


Measured memory_bytes: 3060
x = int(input())
if 11 < x:
    if x % 11 == 0:
        print((x // 11) * 2)
    elif 7 <= x % 11:
        print((x // 11) * 2 + 2)
    else:
        print((x // 11)*2 +1)

elif 6 < x < 12:
    print("2")
else:
    print("1")


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

int main() {
  int a, b; cin >> a >> b;
  if (a >= 13)
  {
    cout << b << endl;
  } else if (a >= 6 && 12 >= a)
  {
    cout << b / 2 << endl;
  } else {
    cout << 0 << endl;
  }
  
  
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<utility>
#include<cmath>
#include<vector>
#include<climits>
#define ll long long int
using namespace std;
int main(void) {
  int x, y;
  cin>>x>>y;
  cout<<x+y/2<<endl;
  return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n = II()
    a = LI()
    dp = [True] * (10 ** 6 + 1)
    a.sort()
    ans = 0
    d = defaultdict(int)
    for i in a:
        if d[i]:
            d[i] = 0
            ans -= 1
        if dp[i]:
            d[i] = 1
            ans += 1
            dp[i] = False

            for j in range(i * 2, 10 ** 6 + 1, i):
                dp[j] = False
    print(ans)
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 132076
package main

import (
	"fmt"
)


func main() {
	var n int
	fmt.Scan(&n)

	for i := 0; i  <= 25; i++ {
		for e :=0; e <= 15; e++ {
			sum := 4 * i + e * 7
			if sum == n {
				fmt.Println("Yes")
				return
			}
		}
	}
	fmt.Println("No")


}

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

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

using namespace std;
using ll = long long;
int mod = 1000000007;

struct UnionFind {
    vector<int> par;
    
    UnionFind(int n) : par(n, -1) { }
    void init(int n) { par.assign(n, -1); }
    
    int root(int x) {
        if (par[x] < 0) return x;
        else return par[x] = root(par[x]);
    }
    
    bool issame(int x, int y) {
        return root(x) == root(y);
    }
    
    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (par[x] > par[y]) swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }
    
    int size(int x) {
        return -par[root(x)];
    }
};

int main(void){
    int N; cin >> N;
    vector<pair<ll, int>> xi(N);
    vector<pair<ll, int>> yi(N);
    vector<pair<ll, pair<int, int>>> edge(N*2-2);
    rep(i, N){
        cin >> xi[i].first >> yi[i].first;
        xi[i].second = i; yi[i].second = i;
    }
    sort(xi.begin(), xi.end());
    sort(yi.begin(), yi.end());
    rep(i, N-1){
        edge[i] = make_pair(xi[i+1].first - xi[i].first, make_pair(xi[i].second, xi[i+1].second));
    }
    rep(i, N-1){
        //edge[i+(N-1)]
        edge[i+(N-1)] = make_pair(yi[i+1].first - yi[i].first, make_pair(yi[i].second, yi[i+1].second));
    }
    sort(edge.begin(), edge.end());

    ll ans = 0;
    UnionFind uf(N);
    rep(i, edge.size()){
        ll c = edge[i].first;
        int from = edge[i].second.first;
        int to = edge[i].second.second;
        if(!uf.issame(from, to)){
            uf.merge(from, to);
            ans += c;
        }
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 6912
#include <cstdio>

using namespace std;

int main(){
	int n;
	scanf("%d", &n);
	while(n--){
		unsigned int c[9];
		for(int i = 0; i < 9; ++i){ scanf("%x", c + i); }
		unsigned int k = 0;
		for(int i = 0; i < 32; ++i){
			const unsigned int m = (1u << i);
			unsigned int sum = 0;
			for(int j = 0; j < 8; ++j){ sum += c[j] ^ k; }
			if((sum & m) != (c[8] & m)){ k |= m; }
		}
		printf("%x\n", k);
	}
	return 0;
}

Measured memory_bytes: 1032
#include<cstdio>
#include<algorithm>
using namespace std;

typedef long long ll;
const ll MOD = 1000000007;
const int MAXN = 100010;
int n, m;
ll fac[MAXN];

int main() {
	int i;
	scanf("%d%d", &n, &m);
	if(n < m) swap(n, m);
	if(n-m > 1) {
		printf("0\n");
		return 0;
	}
	fac[0] = 1;
	for(i = 1; i <= n; i++) fac[i] = fac[i-1]*i%MOD;
	if(n == m) 
		printf("%lld\n", fac[n]*fac[n]%MOD*2%MOD);
	else printf("%lld\n", fac[n]*fac[m]%MOD);
	return 0;
}


Measured memory_bytes: 896
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const double EPS = 1E-10;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}



 
 
int main(){
    int N, L; std::cin >> N >> L;
    std::vector<std::string> S(N);
    for(int i(0); i < N; ++i) std::cin >> S[i];
    std::sort(S.begin(), S.end());
    for(int i(0); i < N; ++i) std::cout << S[i];
    std::cout << std::endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
//#define int long long
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef long double ld;
typedef complex<ld> com;
constexpr int inf = 1000000000;
constexpr ll INF = 1000000000000000000;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

ll dp[200010][3][2];

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n;
	cin >> n;
	vector<ll> a(n);
	rep(i, n) cin >> a[i];
	rep(i, n + 1) rep(j, 3) rep(k, 2) dp[i][j][k] = -INF;
	dp[0][0][0] = a[0];
	dp[0][1][1] = 0;
	rep(i, n) {
		rep(j, 3) {
			chmax(dp[i + 1][j][1], dp[i][j][0]);
		}
		rep(j, 2) {
			chmax(dp[i + 1][j + 1][1], dp[i][j][1]);
		}
		rep(j, 3) {
			if (i != n - 1) chmax(dp[i + 1][j][0], dp[i][j][1] + a[i + 1]);
		}
	}
	ll ans = -INF;
	if (!(n & 1)) rep(j, 2) rep(k, 2) chmax(ans, dp[n][j][k]);
	if (n & 1) rep(j, 2) rep(k, 2) chmax(ans, dp[n][j + 1][k]);
	cout << ans << '\n';
} 

Measured memory_bytes: 14256
N, M = map(int, input().split())
check = [0] * M
for i in range(N):
    a = [int(i) - 1 for i in input().split()]
    a = a[1:]
    for j in a:
        check[j] += 1


ans = 0
for i in check:
    if i == N:
        ans += 1
print(ans)

Measured memory_bytes: 3060
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;

using ll = long long;
using ld = long double;
const int INF = 1e9;
const double EPS = 1e-9;
const ll MOD = 1e9 + 7;

int main()
{
  long long N;
  scanf("%lld", &N);
  long long M;
  scanf("%lld", &M);
  std::vector<long long> H(N);
  for (int i = 0; i < N; i++)
  {
    scanf("%lld", &H[i]);
  }
  std::vector<long long> A(M);
  std::vector<long long> B(M);
  int arr[100010] = {};
  for (int i = 0; i < M; i++)
  {
    scanf("%lld", &A[i]);
    scanf("%lld", &B[i]);
    A[i]--;
    B[i]--;
    if (H[A[i]] > H[B[i]])
    {
      arr[A[i]]++;
      arr[B[i]] = -INF;
    }
    else if (H[B[i]] > H[A[i]])
    {
      arr[B[i]]++;
      arr[A[i]] = -INF;
    }
    else
    {
      arr[A[i]] = arr[B[i]] = -INF;
    }
  }
  int cnt = 0;
  for (int i = 0; i < N; ++i)
  {
    if (arr[i] >= 0)
      cnt++;
  }
  cout << cnt << endl;

  return 0;
}


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

using namespace std;

#define ll             long long int
#define endl           '\n'
#define pii            pair <int, int>

static const int maxn = 2e5 + 5;

int arr[maxn];

signed main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(nullptr);
      cout.tie(nullptr);


      int n, d;
      cin >> n >> d;
      if (n <= d)
      {
            cout << 1 << endl;
            return 0;
      }
      int mot = d + d + 1;
      int ans = n / mot + (n % mot > 0);
      cout << ans << endl;
}


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

bool check(int n) {
    if (n % 3 == 0) return true;
    while (n > 0) {
        if (n % 10 == 3) return true;
        n /= 10;
    }
    return false;
}

int main() {
    int n;
    cin >> n;
    for (int i = 3; i <= n; i++) {
        if (check(i)) {
            cout << " " << i;
        }
    }
    cout << endl;
}


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

int main(){
    int X, K;
    cin >> X >> K;
    vector<int> R(K+2);
    for(int i=1; i<=K; i++) cin >> R[i];
    R[K+1] = 1e9;
    int Q;
    cin >> Q;
    vector<int> T(Q), A(Q);
    for(int i=0; i<Q; i++) cin >> T[i] >> A[i];

    int q = 0;
    int mni = 0, mn = 0, mxi = X, mx = X;
    bool rev = false;
    for(int i=0; i<=K; i++){
        //cerr << mni << " " << mn << " " << mxi << " " << mx << endl;
        while(q < Q && T[q] <= R[i+1]){
            int a = (rev ? X-A[q] : A[q]), t = T[q] - R[i];
            int ans = max(min(mx, max(mn, mn+a-mni)) - t, 0);
            if(rev) ans = X-ans;
            cout << ans << endl;
            q++;
        }
        mn -= R[i+1] - R[i];
        mx -= R[i+1] - R[i];
        if(mx <= 0){
            mni = mxi = mn = mx = 0;
        }else if(mn <= 0){
            mni -= mn;
            mn = 0;
        }
        mni = X-mni;
        mxi = X-mxi;
        mn  = X-mn;
        mx  = X-mx;
        swap(mni, mxi);
        swap(mn, mx);
        rev = !rev;
    }
}

Measured memory_bytes: 2432
import * as fs from 'fs';

const input = fs.readFileSync('/dev/stdin', 'utf8');
const [x, y] = input.split(' ');


const t2 = ( 4 * x - y );
if (t2 < 0) {
  console.log('No')
} else if (t2 / 2 > x) {
  console.log('No')  
} else {
	console.log( t2 % 2 === 0 ? 'Yes' : 'No' );
}




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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

struct area
{
    ll x1,y1,z1,x2,y2,z2;

    bool inside(ll a1, ll a2, ll b1, ll b2, ll c1, ll c2)
    {
        return (x1<=a1 && a2<=x2 && y1<=b1 && b2<=y2 && z1<=c1 && c2<=z2);
    }
};

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

    vector<area> f(n);
    vector<ll> X,Y,Z;
    rep(i,n)
    {
        scanf(" %lld %lld %lld %lld %lld %lld", &f[i].x1, &f[i].y1, &f[i].z1, &f[i].x2, &f[i].y2, &f[i].z2);

        X.pb(f[i].x1);
        X.pb(f[i].x2);
        Y.pb(f[i].y1);
        Y.pb(f[i].y2);
        Z.pb(f[i].z1);
        Z.pb(f[i].z2);
    }

    sort(all(X));
    X.erase(unique(all(X)),X.end());
    sort(all(Y));
    Y.erase(unique(all(Y)),Y.end());
    sort(all(Z));
    Z.erase(unique(all(Z)),Z.end());

    ll ans=0;

    rep(i,X.size()-1)rep(j,Y.size()-1)rep(k,Z.size()-1)
    {
        int ct=0;
        rep(l,n) if(f[l].inside(X[i],X[i+1],Y[j],Y[j+1],Z[k],Z[k+1])) ++ct;
        if(ct>=m) ans+=(X[i+1]-X[i])*(Y[j+1]-Y[j])*(Z[k+1]-Z[k]);
    }

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

Measured memory_bytes: 3244
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<typename T>
using pque = priority_queue<T, vector<T>, greater<T>>;
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(a) (a).begin(), (a).end()
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	int n; scanf("%d", &n);
	ll ans = 0;
	FOR(i, 1, n){
		for(int j = 1; j * j <= i; j++){
			if(i % j) continue;
			ans++;
			if(j*j < i) ans++;
		}
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 3824
import java.util.Scanner;
public class Main
{
	public static void main(String arg[])
	{
		Scanner in=new Scanner(System.in);
		double x=0;
		double y=0;
		double angle=0;
		while(in.hasNext())
		{
			String str[]=in.next().split(",");
			int  go=Integer.parseInt(str[0]);
			int  an=Integer.parseInt(str[1]);
			if((go|an)==0)
				break;
			x+=go*Math.sin(angle*Math.PI/180);
			y+=go*Math.cos(angle*Math.PI/180);
			angle+=an;
		}
		System.out.println((int)x);
		System.out.println((int)y);
	}

}

Measured memory_bytes: 11000
#include <stdio.h>

int main(){
  int a,b,c;
  scanf("%d %d",&a,&b);
  if(b<10) c = 10*a + b;
  else if(b<100) c = 100*a + b;
  else c = 1000*a + b;

  int d = sqrt(c);
  if(d*d == c) printf("Yes");
  else printf("No");

  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
LL increase[543210], decrease[543210], ans;

int main(){
    
    // 1. 入力情報.
    char c[543210];
    scanf("%s", c);
    int l = strlen(c);
    
    // 2. 数列の増加時, 減少時を分けて集計.
    // 2-1. 増加時(※ i が 大きくなる方向で確認).
    for(int i = 0; i < l; i++) if(c[i] == '<') increase[i + 1] = increase[i] + 1;
    
    // 2-2. 減少時(※ i が 小さくなる方向で確認).
    for(int i = l - 1; i >= 0; i--) if(c[i] == '>') decrease[i] = decrease[i + 1] + 1;
    
    // 3. 良い非負整数列の要素の総和の最小値を計算.
    for(int i = 0; i <= l; i++) ans += max(increase[i], decrease[i]);
    
    // 4. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

Measured memory_bytes: 8960
#include <iostream>
#include <array>
#include <map>
#include <algorithm>
#include <cmath>
#include <vector>
#include <fstream>
#include <string>
#include <random>
#include <queue>
#include <iomanip>
#include <functional>
#include <climits>

using namespace std;

using ll = long long int;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vll = std::vector<ll>;
using vpll = std::vector<pll>;
using vpii = std::vector<pii>;
using vi = std::vector<int>;
using vvi = std::vector<vi>;

const ll mod197 = 1000000007LL;
const ll INF = 200LL * 200 * 100000 + 10;

const double PI11 = 3.14159265359;


int main() {

	int n, m;
	cin >> n >> m;

	int time = (n - m) * 100 + m * 1900;

	double answer = 0;

	for (int i = 1; i <= 10000; i++) {
		//cout << answer << endl;
		answer += (i) * ( pow(1/2.0,m) * pow((pow(2,m)-1)/(pow(2,m)),i-1) );
	}

	cout << time * answer << endl;

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a==1)a=14;
	if(b==1)b=14;
	if(a<b)cout<<"Bob"<<endl;
	else if(a>b)cout<<"Alice"<<endl;
	else cout<<"Draw"<<endl;
    return 0;
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define repll(i,n) for(ll i = 0; i < n; i++)
#define REPll(i,n) for(ll i = 1; i < n; i++)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n") 
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


signed main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  string a, b, c;
  cin >> a >> b >> c;
  char A, B, C;
  A = a[0] - 'a' + 'A';
  B = b[0] - 'a' + 'A';
  C = c[0] - 'a' + 'A';
  cout << A << B << C << endl; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
#define MP make_pair
#define PB push_back
typedef long long ll;

int N, c[30], m[30];
string s;

int main () {
        cin >> N;
        fo(j, 0, 30) m[j] = 2e9;
        fo(i, 0, N) {
                cin >> s;
                fo(j, 0, 30) c[j] = 0;
                for (char j : s) c[int(j) - 'a']++;
                fo(j, 0, 30) m[j] = min(m[j], c[j]);
        }
        fo(i, 0, 30) fo(j, 0, m[i]) printf("%c", char(i + 'a'));
        puts("");
        return 0;
}


Measured memory_bytes: 256
from collections import deque

n, q = map(int, input().split())
box = [deque()for i in range(n)]
for _ in range(q):
    a, b, *c = map(int, input().split())
    if a == 0:
        box[b].append(c[0])
    elif a == 1:
        if len(box[b]):
            print(box[b][-1])
    else:
        if box[b]:box[b].pop()



Measured memory_bytes: 14540
// #define _GLIBCXX_DEBUG
// #pragma GCC optimize("Ofast")
#pragma GCC diagnostic ignored "-Wsign-compare"
#include <bits/stdc++.h>
// #include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define reps(i, s, n) for (int i = s; i < (int)(n); ++i)
using namespace std;
using ll = long long;
template <class T> using V = vector<T>;
template <class T> using VV = V<V<T>>;
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;
}
constexpr int INF = 1e9 + 7;
constexpr ll LINF = 1LL << 60;

/*
前処理O(nloglogn)で
素因数分解，素数判定が
O(logn)，O(1)でできるようになる
res はn以下の素数のvector
*/
constexpr int MAX_LEN = 15001000;  // 2e8くらいまでならOK
bool is_prime[MAX_LEN];
int minFact[MAX_LEN];
V<int> make_minFact(int n) {
    V<int> res;
    rep(i, n + 1) {
        is_prime[i] = true;
        minFact[i] = -1;
    }
    is_prime[0] = false;
    is_prime[1] = false;
    minFact[0] = 0;
    minFact[1] = 1;
    reps(i, 2, n + 1) {
        if (!is_prime[i]) continue;
        minFact[i] = i;
        res.push_back(i);
        for (int j = 2 * i; j <= n; j += i) {
            is_prime[j] = false;
            if (minFact[j] == -1) minFact[j] = i;
        }
    }
    return res;
}

V<pair<int, int>> prime_factor(int n) {
    V<pair<int, int>> res;
    while (n != 1) {
        int prime = minFact[n];
        int exp = 0;
        while (minFact[n] == prime) {
            ++exp;
            n /= prime;
        }
        res.push_back({prime, exp});
    }
    return res;
}

void solve() {
    int n;
    cin >> n;
    V<int> _ = make_minFact(n);
    int ans = 0;
    reps(i, 1, n + 1) {
        if (i % 2 == 0) continue;
        V<pair<int, int>> divs = prime_factor(i);
        int cnt = 1;
        for (auto&& e : divs) {
            cnt *= (e.second + 1);
        }
        if (cnt == 8) ans++;
    }
    cout << ans << "\n";
}
int main() {
    cin.tie(nullptr);
    // ios_base::sync_with_stdio(false);
    // cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 3568
#include <algorithm>
#include <cmath>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  ll n;
  cin >> n;
  vector<ll> a;
  for (int i = 0; i < n; i++) {
    ll num;
    cin >> num;
    a.push_back(num);
  }

  ll sumPlus = 0, sumMinus = 0;
  ll ansPlus = 0, ansMinus = 0;

  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      if (sumPlus + a[i] <= 0) {
        ansPlus += abs(sumPlus + a[i]) + 1;
        sumPlus = 1;
      } else
        sumPlus += a[i];
      if (sumMinus + a[i] >= 0) {
        ansMinus += abs(sumMinus + a[i]) + 1;
        sumMinus = -1;
      } else
        sumMinus += a[i];
    } else {
      if (sumPlus + a[i] >= 0) {
        ansPlus += abs(sumPlus + a[i]) + 1;
        sumPlus = -1;
      } else
        sumPlus += a[i];
      if (sumMinus + a[i] <= 0) {
        ansMinus += abs(sumMinus + a[i]) + 1;
        sumMinus = 1;
      } else
        sumMinus += a[i];
    }
  }

  cout << min(ansPlus, ansMinus) << endl;
  return 0;
}

Measured memory_bytes: 1400
def dfs(inParam, digits, lunlunCount, lunlun):
    if len(inParam) != digits:
        if int(inParam[len(inParam)-1]) == 0:
            nextNumList = [0, 1]
        elif int(inParam[len(inParam)-1]) == 9:
            nextNumList = [8, 9]
        else:
            nextNum = int(inParam[len(inParam)-1])
            nextNumList = [nextNum-1, nextNum, nextNum+1]
        
        for item in nextNumList:
            myTupp = dfs(inParam+str(item), digits, lunlunCount, lunlun)
            lunlunCount = myTupp[0]
            if myTupp[2] == 'e':
                return myTupp
        
        return myTupp
    
    else:
        lunlunCount += 1
        state = 'c'

        if lunlunCount == lunlun:
            state = 'e'
            print(inParam)

        return (lunlunCount, inParam, state)

K = int(input())

mylunlun = 0
mydigits = 1
while mylunlun != K:
    for indx in range(1, 10):
        mylunlun, lunlunNumber, _ = dfs(str(indx), mydigits, mylunlun, K)
        if mylunlun == K:
            break
    
    if mylunlun == K:
        break

    mydigits += 1


Measured memory_bytes: 3064
ACGT = ["A", "C" ,"G", "T"]
s = input()
ans = 0
temp = 0
for i in s:
  ok = False
  for j in ACGT:
    if i == j:
      ok = True
      temp += 1
  if ok == False:
    ans = max(ans, temp)
    temp = 0
ans = max(ans, temp)
print(ans)

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

#include <atcoder/all>

// #LIB#

using namespace std;
using namespace atcoder;
using ll = long long;
#define double long double
#define rep(i, n) for (long long i = 0; i < (n); ++i)
#define repr(i, a, b) for (auto i = (a); i < (b); ++i)
#define itr(x, c) for (auto&& x : (c))
#define updatemax(t, v) ((t) = std::max((t), (v)))
#define updatemin(t, v) ((t) = std::min((t), (v)))
#ifdef ONLINE_JUDGE
#define endl _endl
const char _endl = (cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout.precision(16), '\n');
#endif

const string Yes = "Yes";
const string No = "No";
int main() {
  ll n, d;
  cin >> n >> d;
  vector<ll> x(n), y(n);
  rep(i, n) cin >> x[i] >> y[i];
  two_sat ts(2 * n);
  rep(i, n) {
    ts.add_clause(i, false, i + n, false);
    ts.add_clause(i, true, i + n, true);
  }
  rep(i, n) repr(j, i + 1, n) {
    if (abs(x[i] - x[j]) < d) ts.add_clause(i, false, j, false);
    if (abs(x[i] - y[j]) < d) ts.add_clause(i, false, j + n, false);
    if (abs(y[i] - x[j]) < d) ts.add_clause(i + n, false, j, false);
    if (abs(y[i] - y[j]) < d) ts.add_clause(i + n, false, j + n, false);
  }
  auto sat = ts.satisfiable();
  if (sat) {
    cout << Yes << endl;
    auto ans = ts.answer();
    rep(i, n) cout << (ans[i] ? x : y)[i] << endl;
  } else {
    cout << No << endl;
  }
}


Measured memory_bytes: 3836
n = int(input())
l = list(map(int,input().split(" ")))
c = 0

for i in range(n):
    for j in range(i,n,1):
        if l[i] == l[j]:
            continue
        for k in range(j,n,1):
            if l[i] == l[k] or l[j] == l[k]:
                continue
            elif l[i]>=l[j]+l[k] or l[j]>=l[i]+l[k] or l[k]>=l[i]+l[j]:
                continue
            c += 1

print(c)

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

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

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

    sort(A.begin(), A.end());

    int d = A[n / 2] - A[n / 2 - 1];
    cout << max(d, 0) << endl;

    return 0;
}

Measured memory_bytes: 768
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();

		int r[]=new int[a];


		int eat=999999999;
		for(int i=0;i<=a-1;i++){

	r[i]=i+b;
if(Math.abs(eat)>Math.abs(r[i])){
	eat=r[i];
}
}


System.out.println(sum(r)-eat);




	}
	static int sum(int a[]){
		int n=a.length;
		int ans=0;
		for(int i=0;i<=n-1;i++){
			ans+=a[i];
		}
	return ans;
		}

}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
#define loop(i, a, b) for(lli i = a;i <= b; ++i)
#define fast ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define lli long long int 
#define p (lli)(1e9 + 7)
using namespace std;

vector<bool> visited;
vector< vector<lli> > adj;
lli dp[100001][2];

void dfs(lli v){
    visited[v] = true;
    lli black = 1, white = 1;
    for(lli child:adj[v]){
        if(!visited[child]){
            dfs(child);
            black *= (dp[child][1]);black%=p;
            white *= (dp[child][0]+dp[child][1]);white%=p;
        }
    }
    dp[v][1] = white;dp[v][0] = black;
    return ;
}   
 
signed main(){
    fast;
    
    lli n;cin>>n;
    visited.resize(n+1);
    adj.resize(n+1);
    visited.assign(n+1,false);
    loop(i,1,n-1){
        lli x,y;cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }
    dfs(1);
    cout<<(dp[1][0]+dp[1][1])%p<<endl;

    return 0;
        
}

Measured memory_bytes: 14208
#include <iostream>
using namespace std;
int main()
{
    long int A,B,C,K;
    cin >> A >> B >> C >> K;
    long int max_sum=0,a1,a2,a3,a4;
    if(A>=K)
    {
        max_sum=K;
    }
    else if(A<K)
    {
        if(B>=K-A)
        {
            max_sum=(A*1)+ (0*(K-A));
        }
        else if(B<(K-A))
        {
            //if(C>=(K-A-B))
            //{
                max_sum=(A*1) + (0*(K-A)) + ((-1)*(K-A-B));
            //}
        }
    }
    cout << max_sum;
    return 0;
    }

Measured memory_bytes: 3636
from sys import stdin
#from collections import deque
#from math import sqrt, floor, ceil, log, log2, log10, pi, gcd, sin, cos, asin, tan


def ii(): return int(stdin.readline())


def fi(): return float(stdin.readline())


def mi(): return map(int, stdin.readline().split())


def fmi(): return map(float, stdin.readline().split())


def li(): return list(mi())


def lsi():
    x=list(stdin.readline())
    x.pop()
    return x


def si(): return stdin.readline()


def sieve(x):
    a=[True]*(x+1)
    sq=floor(sqrt(x))
    for i in range(3, sq+1, 2):
        if a[i]:
            for j in range(i*i, x+1, i):
                a[j]=False
    if x>1:
        p=[2]
    else:
        p=[]
    for i in range(3, x+1, 2):
        if a[i]:
            p.append(i)
    return p
def prime_factor(x):
    c=1
    i=0
    while p[i]*p[i]<=x:
        if not x%p[i]:
            c+=1
            while not x%p[i]:
                x//=p[i]
        i+=1
    if x>1:
        c+=1
    return c
res=['APPROVED', 'DENIED']
#vowel={'a', 'e', 'i', 'o', 'u', 'y', 'A', 'E', 'I', 'O', 'U', 'Y'}
#pow=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576, 2097152, 4194304, 8388608, 16777216, 33554432, 67108864, 134217728, 268435456, 536870912, 1073741824, 2147483648, 4294967296, 8589934592, 17179869184, 34359738368, 68719476736, 137438953472, 274877906944, 549755813888, 1099511627776, 2199023255552, 4398046511104, 8796093022208, 17592186044416, 35184372088832, 70368744177664, 140737488355328, 281474976710656, 562949953421312, 1125899906842624, 2251799813685248, 4503599627370496, 9007199254740992, 18014398509481984, 36028797018963968, 72057594037927936, 144115188075855872, 288230376151711744, 576460752303423488, 1152921504606846976, 2305843009213693952, 4611686018427387904, 9223372036854775808]
############# CODE STARTS HERE #############
d={}
mx=1
a=[]
for i in range(ii()):
    s=si()
    if s in d:
        d[s]+=1
        mx=max(mx, d[s])
    else:
        d[s]=1
for i in d:
    if d[i]==mx:
        a.append(i)
a.sort()
for i in a:
    print(i[:-1])

Measured memory_bytes: 32348
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {
	static long MOD = 1000000007;
	
	static long inv(long a) {
		return eleva(a, (int)MOD - 2);
	}
	
	static long eleva(long b, int e) {
		if (e == 0) return 1;
		long ret = eleva(b, e / 2);
		ret *= ret;
		ret %= MOD;
		if (e % 2 == 1) {
			ret *= b;
			ret %= MOD;
		}
		return ret;
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
		int N = sc.nextInt();
		long[] fact = new long[N], invFact = new long[N];
		for (int i = 2; i < N; i++) if (invFact[i] == 0) {
			for (int j = i; j < N; j+=i) {
				invFact[j] = i;
			}
		}
		fact[0] = invFact[0] = fact[1] = invFact[1] = 1;
		for (int i = 2; i < N; i++) {
			fact[i] = (fact[i-1] * i) % MOD;
			int p = (int)invFact[i];
			if (p == i) {
				invFact[i] = inv(i);
			} else {
				invFact[i] = (invFact[p] * invFact[i/p]) % MOD;
			}
		}
		for (int i = 2; i < N; i++) {
			invFact[i] = (invFact[i] * invFact[i-1]) % MOD;
		}
		long ans = fact[N-1] * (N-1) % MOD;
		
		for (int k = (N + 1)/2; k < N - 1; k++) {
			long tmp = (fact[k-1] * fact[k]) % MOD;
			tmp = (tmp * invFact[2*k - N]) % MOD;
			ans -= tmp;
		}
		ans %= MOD; ans += MOD; ans %= MOD;
		System.out.println(ans);
	}
}


Measured memory_bytes: 40476
C(int*a,int*b){return*a-*b;}
dp[11111];
n,m,a[9];
i,j,M;
c[]={0,2,5,5,4,5,6,3,7,6};
main(){
	scanf("%d%d",&n,&m);
	for(;~scanf("%d",a+i++););
	qsort(a,m,4,C);
	for(i=0;i++<n;){
		M=-9;
		for(j=m;j--;)M=fmax(M,c[a[j]]>i?M:dp[i-c[a[j]]]+1);
		dp[i]=M;
	}
	for(i=n;dp[i];){
		for(j=m;j--&&(i<c[a[j]]||dp[i-c[a[j]]]+1-dp[i]););
		putchar(a[j]+48);
		i-=c[a[j]];
	}
}

Measured memory_bytes: 256
N,M,K = map(int, input().split())
As = [int(n) for n in input().split()]
Bs = [int(n) for n in input().split()]

a_sum = [0]
b_sum = [0]

for i in range(len(As)):
    a_sum.append(a_sum[-1] + As[i])

for j in range(len(Bs)):
    b_sum.append(b_sum[-1] + Bs[j])

 
max_book_num = 0
j = M
for i in range(N+1):
    if a_sum[i] > K:
        continue

    while b_sum[j] + a_sum[i] > K:
        j -= 1
    
    max_book_num = max(max_book_num, i + j)

        
print(max_book_num)    



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

int main(){
  int N; cin>>N;
  vector<int> v(N);
  rep(i,N) cin>>v[i];
  sort(v.begin(),v.end());
  if(v[0]==v[N-1]){
    if(v[0]==N-1||v[0]<=N/2) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }else if(v[N-1]-v[0]==1){
    int cnt=1;
    for(int i=1;i<N;i++){
      if(v[i]==v[i-1]) cnt++;
      else break;
    }
    // x+1<=r+q/2 && x+1>r (r：一匹，q：グループ)
    if(v[N-1]<=cnt+(N-cnt)/2&&v[N-1]>cnt) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define INF 2e9
#define MOD 1000000007
#define MOD9 998244353
#define intMAX 51000;
#define PI 3.14159265359
using namespace std;
typedef long long llong;
// typedef long double ldouble;

using Graph = vector<vector<int>>;

// int ctoi(const char c){
//   if('0' <= c && c <= '9') return (c-'0');
//   return -1;
// }

// int gcd(int a, int b){
//   int ma = max(a,b);
//   int mi = min(a,b);
//   if(mi == 0) return ma;

//   return gcd(mi, ma%mi);
// }

// llong POW(llong a, llong b){
//   if(b == 0) return 1;
//   else{
//     if(b%2 == 0) return POW(a * a % MOD, b / 2) % MOD;
//     else return a * POW(a * a % MOD, b / 2) % MOD;
//   }
// }

int main(){
  vector<int> A(3);
  cin >> A[0] >> A[1] >> A[2];
  int seven = 0;
  int five = 0;
  for(int i=0; i<3; ++i){
    if(A[i] == 5) ++five;
    else if(A[i] == 7) ++seven;
  }
  if(five == 2 && seven == 1) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 384
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<deque>
#include<functional>
#include<iomanip>
#include<iostream>
#include<iterator>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<string>
#include<unordered_map>
#include<unordered_set>
#include<utility>
#include<vector>

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define D()
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define INITA(a,i,j,v) for(ll k=i;k<=j;k++){a[k]=v;}

int main() {
    string s, t; cin >> s >> t;
    map<char, ll> sm;
    map<char, ll> tm;
    ll cur_s = 1;
    ll cur_t = 1;

    vector<int> sv;
    vector<int> tv;
    REP(i, s.size()) {
        char c = s[i];
        if (sm[c] == 0) {
            sm[c] = cur_s;
            cur_s++;
        }
        sv.push_back(sm[c]);
    }

    REP(i, t.size()) {
        char c = t[i];
        if (tm[c] == 0) {
            tm[c] = cur_t;
            cur_t++;
        }
        tv.push_back(tm[c]);
    }

    // REP(i, sv.size()) {
    //     cout << sv[i];
    // }
    // cout << endl;

    // REP(i, tv.size()) {
    //     cout << tv[i];
    // }

    if (sv == tv) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 6012
<?php
$ans = 0;

fscanf(STDIN, "%d %d", $N, $M);
for ($i = 0; $i < $M; $i++) {
    $x[$i] = array_map('intval', explode(' ', trim(fgets(STDIN))));
    array_shift($x[$i]);
}
$p = array_map('intval', explode(' ', trim(fgets(STDIN))));
for ($i = 0; $i < pow(2, $N); $i++) {
    $t = str_split(str_pad(base_convert($i, 10, 2), $N, "0", STR_PAD_LEFT));
    $bool = true;
    for ($j = 0; $j < $M; $j++) {
        $score = 0;
        foreach ($x[$j] as $k => $v) {
            $score += $t[$v - 1];
        }
        if ($score % 2 !== $p[$j]) {
            $bool = false;
        }
    }
    if ($bool === true) {
        $ans++;
    }
}
printf("%d", $ans);


Measured memory_bytes: 4728