akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();
		if(a*b >= c*d) {
			System.out.println(a*b);
		}else {
			System.out.println(c*d);
		}
	}

}

Measured memory_bytes: 21844
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)
 
int main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
  if(c<=a-b){
    printf("0");
    return 0;
  }

  printf("%d",c-(a-b));
  return 0;
}

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

typedef long long LL;

int main(void){
    string s;
    cin >> s;
    int n = s.size();
    char a = 'A',c = 'C',g = 'G',t = 'T';
    int max = 0,flag = 0,cnt = 0;
    for(int i = 0;i < n;i++){
        if(s[i] == a || s[i] == c || s[i] == g || s[i] == t){
            flag = 1;
            cnt++;
        }else{
            if(flag = 1){
                if(max < cnt)swap(max, cnt);
            }
            flag = 0;
            cnt = 0;
        }
    }
    if(max < cnt)swap(max, cnt);
    cout << max << endl;
}

Measured memory_bytes: 256
package main

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

/*
 <url:http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_1_B&lang=jp>
 */

func init() {

}

func main() {
	x, _ := IntStdin()
	fmt.Println(int(math.Pow(float64(x),3)))
}

// ????????????1?????????
func StrStdin() (stringReturned string) {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	stringInput := scanner.Text()

	stringReturned = strings.TrimSpace(stringInput)
	return
}

// ??´??°???1?????????
func IntStdin() (int, error) {
	stringInput := StrStdin()
	return strconv.Atoi(strings.TrimSpace(stringInput))
}

// ?????????????????????????????????????????????Split()
func SplitWithoutEmpty(stringTargeted string, delim string) (stringReturned []string) {
	stringSplited := strings.Split(stringTargeted, delim)

	for _, str := range stringSplited {
		if str != "" {
			stringReturned = append(stringReturned, str)
		}
	}

	return
}

// ??????????????§??????????????????????????????????????????
func SplitStrStdin(delim string) (stringReturned []string) {
	// ???????????§1?????????
	stringInput := StrStdin()

	// ????????§??????
	// stringSplited := strings.Split(stringInput, delim)
	stringReturned = SplitWithoutEmpty(stringInput, delim)

	return
}

// ??????????????§??????????????´??°????????????????????????
func SplitIntStdin(delim string) (intSlices []int, err error) {
	// ??????????????????????????????
	stringSplited := SplitStrStdin(" ")

	// ??´??°?????????????????????
	for i := range stringSplited {
		var iparam int
		iparam, err = strconv.Atoi(stringSplited[i])
		if err != nil {
			return
		}
		intSlices = append(intSlices, iparam)
	}
	return
}

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

auto main() -> int{
	int M, s, g;
	cin >> M;

	vector<int> a(6), N(M);
	for_each(a.begin(), a.end(), [](int &i){cin >> i; });
	cin >> s >> g;
	s--; g--;
	for (int &i : N){ cin >> i; }

	vector < vector <int> > memo(M, vector <int>(M + 1, -1));
	memo[s][0] = s;

	int movetime;

	auto move = [&a, &N, &M](int p, int dc, int dr) -> int {
		int t = p + dr * a[dc];
		if (t > -1 && t < M) t += N[t];
		else t = -1;
		return t;
	};

	for (movetime = 0; movetime < M; movetime++){
		for (int j = 0; j < M; j++){
			if (memo[j][movetime] < 0) continue;
			for (int k = 0; k < 6; k++){
				int m = move(j, k, 1);
				if (m >= 0){
					memo[m][movetime + 1] = j;
				}
				if (m == g) goto SEARCH_END;

				m = move(j, k, -1);
				if (m >= 0){
					memo[m][movetime + 1] = j;
				}
				if (m == g) goto SEARCH_END;
			}
		}
	}

SEARCH_END:

	movetime ++;
	vector<int> dice(M), direction(M);
	int p = g;

	for (int t = movetime; t > 0; t--){
		for (int k = 0; k < 6; k++){
			if (move(memo[p][t], k, 1) == p){
				dice[t-1] = k;
				direction[t-1] = 1;
				break;
			}
			if (move(memo[p][t], k, -1) == p){
				dice[t-1] = k;
				direction[t-1] = -1;
				break;
			}
		}
		p = memo[p][t];
	}

	for (int i = 0; i < movetime; i++){
		while (1){
			int tmp;
			cin >> tmp;
			if (tmp - 1 == dice[i]){
				cout << direction[i] << endl;
				break;
			}
			cout << 0 << endl;
		}
	}
	return 0;
}

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

using namespace std;

#define li long long int

const int N 	= 1e2 + 5;
const int M 	= 1e5 + 5;
const li mod 	= 1e12 + 7;

int n, w;
int we[N], va[N];
li dp[N][M];

li go(int idx, int val) {
	if (val < 0) return mod;
	if (idx > n) {
		if (val == 0) return 0;
		else return mod;
	}
	if (dp[idx][val] != -1) return dp[idx][val];
	li ans = min(go(idx + 1, val), we[idx] + go(idx + 1, val - va[idx]));
	return dp[idx][val] = ans;
}

void solve() {
	cin >> n >> w;
	for (int i = 1; i <= n; i++) {
		cin >> we[i] >> va[i];
	}
	memset(dp, -1, sizeof(dp));
	int ans = 0;
	for (int i = 100000; i >= 1; i--) {
		if (go(1, i) <= w and go(1, i) != -1) {
			ans = i;
			break;
		}
	}
	cout << ans;
}

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

Measured memory_bytes: 82304
import java.util.*

fun main() {
    val scanner = Scanner(System.`in`)
    val s = scanner.nextLine().toCharArray()
    val t = scanner.nextLine().toCharArray()

    var count = 0
    for (i in s.indices) {
        if (s[i] != t[i]) count++
    }

    println(count)
}

Measured memory_bytes: 43780
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <deque>
#include <iterator>
#include <map>
#include <queue>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
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 ll MOD = 1000000007;
const ll HIGHINF = (1<<20);

static const int MAX = 10000;

int n;
V<P<int, int> > adj[MAX];

void dijkstra() {
  priority_queue<P<int, int> > pq;
  int color[MAX];
  int d[MAX];
  for (int i=0; i<n; i++) {
    d[i] = HIGHINF;
    color[i] = 0;
  }

  d[0] = 0;
  pq.push(make_pair(0, 0));
  color[0] = 1;
  while(!pq.empty()) {
    P<int, int> f = pq.top(); pq.pop();
    int u = f.second;
    color[u] = 2;

    if (d[u] < f.first * (-1)) continue;

    for (int j=0; j<adj[u].size(); j++) {
      int v = adj[u][j].first;
      if (color[v] == 2) continue;
      if (d[v] > d[u] + adj[u][j].second) {
        d[v] = d[u] + adj[u][j].second;
        pq.push(make_pair(d[v]*(-1), v));
        color[v] = 1;
      }
    }
  }

  for (int i=0; i<n; i++) {
    cout << i << ' ' << (d[i] == HIGHINF ? -1: d[i]) << endl;
  }
}

int main() {
  int k, u, v, c;
  cin >> n;
  for (int i=0; i<n; i++) {
    cin >> u >> k;
    for (int j=0; j<k; j++) {
      cin >> v >> c;
      adj[u].push_back(make_pair(v, c));
    }
  }
  dijkstra();
  return 0;
}



Measured memory_bytes: 8068
#include<iostream>

int main()
{
    int N,X,T = 0;
    int i = 1;
    int hasu,josan =0;

    std::cin >> N >> X >> T;
    
    josan = N / X;

    if( 0 < N % X )
    {
        josan++;       
    }    

    std::cout << T*josan;

    return 0;
}

Measured memory_bytes: 3608
//There was and always be only one Chester
//RIP legend
#include<bits/stdc++.h>
#define Nilesh ios_base::sync_with_stdio(false)
using namespace std;
int main()
{
    Nilesh;
    string s;
    cin>>s;
    if(s.length()<4)
        cout<<"No";
    else if(s[0]=='Y' && s[1]=='A' && s[2]=='K' && s[3]=='I')
        cout<<"Yes";
    else
        cout<<"No";


}



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

typedef long long ll;

struct UnionFind{
    vector<int> Parent;
    vector<int> sizes;
    UnionFind(int n):Parent(n),sizes(n,1){ rep(i,n)Parent[i]=i; }
    //find the root of x
    int root(int x){
        if(x!=Parent[x]){
        Parent[x] = root(Parent[x]);
        }
        return Parent[x];
    }
    //merge x and y
    void unite(int x,int y){
        x = root(x);
        y = root(y);
        if(x == y) return;
        if(sizes[x] < sizes[y]) swap(x, y);
        Parent[y] = x;
        sizes[x] += sizes[y];
    }
    bool same(int x,int y){ return root(x) == root(y); }
    int size(int x){ return sizes[root(x)]; }
};

int main() {
	ll N,M;
	cin>>N>>M;
	vector<ll> A(M),B(M);
	rep(i,M){
		cin>>A[i]>>B[i];
		A[i]--;B[i]--;
	}
	vector<ll> ans(M);
	ans[M-1] = N*(N-1)/2;
	UnionFind uni(N);
	for (int i = M-1; i >=1; --i){
		if(uni.same(A[i],B[i])){
			ans[i-1] = ans[i]; 
		}
		else{
			ans[i-1] = ans[i]-uni.size(A[i])*uni.size(B[i]);
			uni.unite(A[i],B[i]);
		}
	}
	rep(i,M){
		cout<<ans[i]<<endl;
	}
}


Measured memory_bytes: 4480
PROGRAM ATCODER

implicit none
integer :: n, m, i, j, a, ans
integer,allocatable :: x(:), dx(:),dx1(:),bar(:)

read(*,*) n, m
allocate(x(m))
allocate(dx(m-1))
allocate(dx1(m-1))
allocate(bar(n-1))
read(*,*) (x(i), i=1,m)

if(n >= m) then
	ans = 0
	write(*,'(i0)') ans
    stop
end if

call qs(x,m) !昇順に並び替え

do i =1, m-1
	dx(i) = x(i+1) - x(i)
end do

call qs(dx,m-1)

ans = sum(dx)

if (n > 1) then
	ans = ans - sum(dx(m-n+1:m-1))
end if

write(*,'(i0)') ans

END PROGRAM ATCODER


recursive subroutine qs(x,n)
   integer,intent(in) :: n
   integer,intent(inout) :: x(n)
   integer :: p,i,imin,imax,it,is
   if(n == 1) return    
   p = x(1)   
   imin = 1   
   imax = n   
   do while(imin < imax)
      do while(x(imin) < p .and. imin < imax)
         imin = imin + 1
      enddo
      do while(p <= x(imax) .and. imin < imax)
         imax = imax - 1
      enddo
      if(imin < imax)then
         it = x(imax)
         x(imax) = x(imin)
         x(imin) = it
      endif
   enddo
   is = imax - 1
   if(is == 0) is = 1
   call qs(x(1:is),is)
   call qs(x(is + 1:n),n - is)
end subroutine qs

Measured memory_bytes: 6016
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    
    int N = scanner.nextInt();
    int A = scanner.nextInt();
    int B = scanner.nextInt();
    long sum = 0;
    for (int i = 1; i <= N; i++) {
      int dsum = dsum(i);
      if (dsum >= A && dsum <= B) sum += i;
    }
    System.out.println(sum);
  }
  
  private static int dsum(int a) {
    int t = 0;
    while (a > 0) {
      t += a % 10;
      a /= 10;
    }
    return t;
  }
}

Measured memory_bytes: 23892
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        double x1 = sc.nextDouble();
        double y1 = sc.nextDouble();
        double x2 = sc.nextDouble();
        double y2 = sc.nextDouble();
        
        System.out.println(Math.sqrt(Math.pow(x1-x2, 2) + Math.pow(y1-y2, 2)));
    }
}

Measured memory_bytes: 28000
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb(x) push_back(x)
#define all(x) x.begin(), x.end()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = 1e9;
const ll INF = 1e18;
const ld EPS = 1e-10;

int main(){
    int H, W;
    cin >> H >> W;
    string s[H];
    rep(i, H) cin >> s[i];
    char r[H][W], b[H][W];
    fill(r[0], r[H], '#'), fill(b[0], b[H], '.');
    rep(i, H){
        if(i%2 == 0){
            r[i][W-1] = '.';
            b[i][W-1] = '#';
        }
        else{
            fill(r[i]+1, r[i]+W, '.');
            fill(b[i]+1, b[i]+W, '#');
        }
    }
    rep(i, H){
        rep(j, W){
            if(s[i][j] == '#'){
                r[i][j] = '#';
                b[i][j] = '#';
            }
        }
    }
    rep(i, H){
        rep(j, W){
            cout << r[i][j];
        }
        cout << endl;
    }
    cout << endl;
    rep(i, H){
        rep(j, W){
            cout << b[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 1536
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define INF 1e9
using ll = std::int64_t;

template <class T>bool chmax(T &a, const T &b);
template <class T>bool chmin(T &a, const T &b);
//最大公約数
std::int64_t gcd(std::int64_t a, std::int64_t b);
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb);
//ラングレス圧縮
std::vector<std::pair<char, std::int64_t>> rle(std::string str);
//素数判定
bool is_prime(std::int64_t n);
// 約数の列挙
std::vector<std::int64_t> divisor(std::int64_t n);
// 素因数分解
std::map<std::int64_t,std::int64_t> prime_factor(std::int64_t n);

//10^9 + 7
#define yojo 1000000007
#define MAX_NUM 200001

void Main()
{
  int p, q, r;
  cin >> p >> q >> r;

  priority_queue<int> que;
  que.push(q);
  que.push(p);
  que.push(r);

  que.pop();

  int ans = que.top();
  que.pop();
  ans += que.top();

  std::cout << ans << std::endl;

  return;
}

int main()
{
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}

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;
}

//最大公約数
std::int64_t gcd(std::int64_t a, std::int64_t b)
{
  // a >= b && b != 0
  std::int64_t c;
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}

//最大公約数安全版
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb)
{
  std::int64_t a = max(aa, bb);
  std::int64_t b = min(aa, bb);
  std::int64_t c;
  if (b == 0)
  {
    return -1;
  }
  do
  {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}

//ラングレス圧縮
std::vector<std::pair<char, std::int64_t>> rle(std::string str)
{
  std::vector<std::pair<char, std::int64_t>> data;
  char now = str[0];
  std::int64_t count = 0;
  for (std::int64_t i = 0; i < str.size() + 1; i++)
  {
    if (i == str.size())
    {
      data.push_back(make_pair(str[i - 1], count));
      break;
    }
    else if (now != str[i])
    {
      data.push_back(make_pair(now, count));
      now = str[i];
      count = 0;
    }
    count++;
  }

  return data;
}

//素数判定
bool is_prime(std::int64_t n)
{
  for (std::int64_t i = 0; i * i <= n; i++)
  {
    if (n % i == 0)
    {
      return false;
    }
  }
  
  return n != 1;
}

//約数の列挙
std::vector<std::int64_t> divisor(std::int64_t n)
{
  std::vector<std::int64_t> res;
  for (int i = 0; i < n; i++)
  {
    if(n % i == 0){
      res.push_back(i);
      if (i != n / i) res.push_back(n / i);
    }
  }
  return res;
}

// 素因数分解
std::map<std::int64_t, std::int64_t> prime_factor(std::int64_t n)
{
  std::map<std::int64_t, std::int64_t> res;
  for (int i = 2; i * i <= n; i++)
  {
    while (n % i == 0)
    {
      ++res[i];
      n /= i;
    }
  }

  if (n != 1)
  {
    res[n] = 1;
  }
  
  return res;
}

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

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

  int n,l;cin>>n>>l;
  int sum=0;
  for(int i=0;i<n;i++){
    sum += l+i;
  }
  int mn_abs=1000000;
  int ans=0;
  for(int i=0;i<n;i++){
    int t=sum;
    t -= (l+i);
    if(abs(sum-t)<mn_abs){
      mn_abs = abs(sum-t);
      ans=t;
    }
  }
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 3560
#include <stdio.h>
#include <stdlib.h>

int y[300001];
 
void merge_sort(int x[], int n)
{
	if (n == 1) return;
	merge_sort(&(x[0]), n/2);
	merge_sort(&(x[n/2]), (n+1)/2);
	
	int i, p, q;
	for (i = 0, p = 0, q = n/2; i < n; i++) {
		if (p >= n/2) y[i] = x[q++];
		else if (q >= n) y[i] = x[p++];
		else y[i] = (x[p] < x[q])? x[p++]: x[q++];
	}
	for (i = 0; i < n; i++) x[i] = y[i];
}

int main()
{
	int i, N, a[300001];
	scanf("%d", &N);
	for (i = 0; i < N * 3; i++) scanf("%d", &(a[i]));
	
	merge_sort(a, N * 3);
	
	long long sum = 0;
	for (i = 1; i <= N; i++) sum += a[N * 3 - i * 2];
	
	printf("%lld\n", sum);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
int main()
{
    chutiyaap;
    int n;cin>>n;
    while(n)
    {
    	int rem=n%10;
    	if(rem==7)
    	{
    		cout<<"Yes";
    		return 0;
    	}
    	n/=10;
    }
    cout<<"No";
    return 0;
}

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

bool is_kaibun(string s)
{
    bool a = true;
    for (int i = 0; i < s.size() / 2; i++)
    {
        if (s.at(i) != s.at(s.size() - 1 - i))
        {
            a = false;
        }
    }
    return a;
}

int main()
{
    string s;
    cin >> s;

    bool flag = true;

    string s1, s2;
    s1 = "";
    s2 = "";

    for (int i = 0; i < (s.size()-1) / 2; i++)
    {
        s1 += s.at(i);
    }
    for (int i = (s.size()+2) / 2; i < s.size(); i++)
    {
        s2 += s.at(i);
    }

    if (is_kaibun(s) && is_kaibun(s1) && is_kaibun(s2))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3612
#include<iostream>
#include<cstdio>
#include<cmath>

using namespace std;

const int MAXN=100010;
long long X[MAXN];
long long f[MAXN];

long long A,B,N;

long long min(long long a,long long b)
{
	return a<b?a:b;
}

int main()
{
	
	scanf("%ld %ld %ld",&N,&A,&B);
	f[1]=0;
	
	for(int i=1;i<=N;i++)
	scanf("%ld",&X[i]);
	
	for(int i=2;i<=N;i++)
	f[i]=f[i-1]+min(A*(X[i]-X[i-1]),B);
		
	printf("%ld",f[N]);
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int a, b, k, c;
int main() {
	for (int i = 1; i <= 6; ++i) {
		if (i == 1) scanf("%d", &a);
		else if (i == 5) scanf("%d", &b);
		else if (i == 6) scanf("%d", &k);
		else scanf("%d", &c);
	}
	if (b - a <= k) puts("Yay!");
	else puts(":(");
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k,b,a[200001],s;
int main()
{
cin>>n>>k;
for(int i=0;i<n;i++)
cin>>b,a[b]++;
sort(a,a+n);
for(int i=n-1;i>=n-k;i--)
s+=a[i];
cout<<n-s<<endl;
return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
#include <climits>
#include <cstring>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <numeric>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MAX_N = (ll)1e5 + 1;

void print(){ std::cout << std::endl; }
template <typename Head> void print(Head&& head) { std::cout << head << std::endl; }
template <typename Head, typename... Tail> void print(Head&& head, Tail&&... tail)
{
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...); // or print(tail...);
}
template <typename Iterator> void printVec(Iterator begin, Iterator end)
{
  for (Iterator it = begin; it != end; it++) {
    std::cout << "[" << std::distance(begin, it) << "] " << *it << " ";
    if (std::distance(begin, it) % 20 == 19) { std::cout << std::endl; }
  }
  std::cout << std::endl;
}

ll par[MAX_N];
ll rank[MAX_N];

void init(ll n) {
  for (ll i = 0; i < n; i++) {
    par[i] = i;
    rank[i] = 0;
  }
}

ll find (ll x) {
  if (par[x] == x) {
    return x;
  } else {
    return par[x] = find(par[x]);
  }
}

void unite(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) return;

  if (rank[x] < rank[y]) {
    par[x] = y;
  } else {
    par[y] = x;
    if (rank[x] == rank[y]) rank[x]++;
  }
}

bool same(int x, int y) {
  return find(x) == find(y);
}

int main(int argc, char* argv[])
{
  ll N, M;
  std::cin >> N >> M;
  std::vector< ll > vp(N, 0LL);
  for (ll i = 0; i < N; i++) {
    std::cin >> vp[i];
    vp[i]--;
  }

  init(N);

  int x, y;
  for (ll i = 0; i < M; i++) {
    std::cin >> x >> y;
    unite(x-1, y-1);
  }

  ll ans = 0;
  for(ll i = 0; i < N; i++) {
    if (find(i) == find(vp[i])){ ans++; }
  }

  print(ans);
  return 0;
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
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 ll INF=1e18;
const ll MOD=1e9+7;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);  
  
  int h,w;
  cin >> h >> w;
  ll d[10][10];
  rep(i,10){
    rep(j,10){
      cin >> d[i][j];
    }
  }
  rep(k,10){
    rep(i,10){
      rep(j,10){
        d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
      }
    }
  }
  ll ans=0;
  rep(i,h){
    rep(j,w){
      int a;
      cin >> a;
      if(a==-1 || a==1)continue;
      else ans+=d[a][1];
    }
  }
  cout << ans << endl;
  
}


Measured memory_bytes: 256
N = gets.chomp.to_i
as = gets.chomp.split(' ').map{|n| n.to_i}
count = 0
while true do
  odd = 0
  as = as.map do |num|
    if num % 2 == 0
      num /= 2
    else
      odd += 1
    end
  end
  break if odd > 0
  count += 1
end
print count

Measured memory_bytes: 1788
fun main(args: Array<String>) {
    var (N, T) = pairIntLong()
    val Ts = listOfLong()
    var ans = T
    repeat(N - 1) { n ->
        ans += Math.min(Ts[n + 1] - Ts[n], T)
    }
    println(ans)
}
fun pairIntLong() = listOfLong().let { Pair(it[0].toInt(), it[1]) }

fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfLong() = listOfString().map(String::toLong)


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

int main(){
   int a[5];
   int k;
   int c=0;
   for(int i=0; i<5; i++){
       cin >> a[i];
   }
   cin >> k;

   for(int i=0; i<5; i++){
        for(int j=0; j<5; j++){
            if(a[j]-a[i]<=k&&j!=i&&j>i){
                c++;
            }
        }
   }

   if(c==10){
        cout << "Yay!" << endl;
   }
   else{
        cout << ":(" << endl;
   }
   return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a;
    cin>>a;
    if(a>111&&a<223){cout<<222<<endl;}
    if(a>222&&a<334){cout<<333<<endl;}
    if(a>333&&a<445){cout<<444<<endl;}
    if(a>444&&a<556){cout<<555<<endl;}
    if(a>555&&a<667){cout<<666<<endl;}
    if(a>666&&a<778){cout<<777<<endl;}
    if(a>777&&a<889){cout<<888<<endl;}
    if(a>888){cout<<999<<endl;}
    if(a<=111){cout<<111<<endl;}

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * Built using CHelper plug-in Actual solution is at the top
 */

public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		Task solver = new Task();
		solver.solve(1, in, out);
		out.close();
	}

	static class Task {
		public void solve(int testNumber, InputReader in, PrintWriter out) {
			int A = in.nextInt();
			int B = in.nextInt();
			if(A == B) {
				out.println("Draw");
			} else if((A > B || A == 1) && B != 1){
				out.println("Alice");
			} else {
				out.println("Bob");
			}
		}
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream), 32768);
			tokenizer = null;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public char nextChar() {
			return next().charAt(0);
		}

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

		public double nextDouble() {
			return Double.parseDouble(next());
		}

	}
}


Measured memory_bytes: 21460
#include <bits/stdc++.h>
 
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n)  for(int i=0;i<(n);++i)
#define REPr(i, n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m, n) for(int i = (n);i >=(m);--i)
#define PB push_back
#define MP make_pair
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x, y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
/* (๑╹◡╹) */
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll MOD = 1000000007;
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;
}
/* (๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹)(๑╹◡╹) */
///////////////////////////////////////////////
const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 



int main() {
//	COMinit();
	double ans = 0;
	int N; cin >> N;
	for (int i = 0; i < N; i++)
	{
		double a; cin >> a;
		ans += 1/a;
	}
	ans = 1/ans;

	cout << setprecision(15) << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <math.h>
#include <iomanip>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i, n) for(int i = 2; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
    int a, b; cin >> a >> b;
    cout << (a + b + 1) / 2 << endl;
    return 0;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,k,n)       for(i=k;k<=n?i<=n:i>=n;k<=n?i++:i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
const int inf =         1e18;
const int mod =         1e9+7;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p,int m = inf) {int ans=1;x%=m;while(p>0){if(p&1)ans=(ans*x)%m;p=p>>1;x=(x*x)%m;}return ans;}
int inv(int x,int m=mod){return po(x,m-2,m)%m;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e6+6;
int n,m,k,x,y,z,a,b,c,d,i,j,l,r,f;








void sol()
{   
    cin>>a>>b;
    x=-1;
    fo1(i,3000)
    {   l=i*0.08;
        r=i*0.1;
        if(l==a && r==b){x=i;break;}
    }
    
    
    
    cout<< x <<endl;
}





int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //sp(10);
    // w(t)
    sol();
    return 0;
}

Measured memory_bytes: 3676
n, m = map(int,input().split())
l_lis = []
r_lis = []
for _ in range(m):
    tmp = list(map(int,input().split()))
    l_lis.append(tmp[0])
    r_lis.append(tmp[1])
ll = max(l_lis)
rr = min(r_lis)
count = rr - ll + 1
if count <= 0:
    print(0)
else:
    print(count)

Measured memory_bytes: 11056
#include<bits/stdc++.h>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
using namespace  std ;
typedef long l ;
typedef long long ll ;
typedef vector<int>vi ;
typedef vector<l>vl ;
typedef vector<ll>vll ;
typedef vector<vector<ll> >vvl ;
typedef pair<int,int> pii ;
typedef pair<ll,ll> pll ;
long long power(long long k , long long n , long long m=1e9+7)
{
    long long res = 1;
    while(n)
    {
        if(n%2!=0)
        {
            res = (res*k)%m ;
        }
        k = (k*k)%m ;
        n = n/2 ;
    }
    return(res) ;
}
ll nck(ll n , ll k ,ll m=1e9+7)
{
    ll i , j,b=1,c=1 ;
    if(n-k<k)
    {
        k = n-k ;
    }
    while(k)
    {
        b*=n ;
        c*=k ;
        ll g = __gcd(b,c) ;
        b/=g ;
        c/=g ;
        n--;
        k-- ;
    }
    return(b) ;
}
long long fact(long long n , long long m = 1e9+7)
{
    long long a = 1 ;
    if(n==0 || n==1)
    {
        return(1) ;
    }
    while(n>0)
    {
        a = (a%m * n%m)%m ;
        n-- ;
    }
    return(a) ;
}
void READ(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cin>>a ;
        v.pb(a) ;
    }
}
void PRINT(vll &v, ll n)
{
    ll a ;
    for(ll i=0 ; i<n ; i=i+1)
    {
        cout<<v[i]<<" " ;
    }
    cout<<"\n" ;
}
ll dp[3001][3001];
string str = "",str1 = "" ;
ll n,m ;
ll func(ll i , ll j)
{
    if(i<0 || j<0)
    {
    	return(0);
	}
	if(dp[i][j]!=-1)
	{
		return(dp[i][j]);
	}
	ll ans = -1e18;
	if(str1[j]==str[i])
	{
		ans = func(i-1,j-1)+1;
	}
	else
	{
		ans = max(func(i-1,j),func(i,j-1));
	}
	dp[i][j] = ans;
	return(ans);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    std::cout.unsetf ( std::ios::floatfield );//this and next line for floating precision upto 6
    std::cout.precision(10);
    ll a,b,c,d,e,x,i,j,t,k,y,w;
    double p,q,r,u,s ;
    char ch,chr ;
    ll a1=0,a2=0,b1=0,b2=0 ;
    cin>>str>>str1;
    n = str.size();
    m = str1.size();
    memset(dp,-1,sizeof(dp));
    a = func(n-1,m-1);
    i = n-1 ;
    j = m-1 ;
    //cout<<a<<"\n" ;
    string str2 = "" ;
    while(i>=0 && j>=0)
    {
    	if(str[i]==str1[j] )//&& dp[i][j]==dp[i-1][j-1]+1)
    	{
    		str2+=str1[j];
    		i--;
    		j-- ;
		}
		else if(dp[i][j]==dp[i][j-1])
		{
			j--;
		}
		else
		{
			i--;
		}
	}
	reverse(all(str2));
	cout<<str2;
}

Measured memory_bytes: 70784
#include <iostream>
#include <vector>
#include <array>
#include <algorithm>
#include <cstring>
#include <queue>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef vector<ll> Vec;
typedef vector<pair<ll, ll>> Pair;
#define rep(i, n) for(ll i=0;i<n;i++)
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

//static const ll MOD = 1000000007;
//static const ll INF = 100000000;
//#define PI 3.14159265359

ll ll_accumulate(vector<ll> V) {
    ll ans = 0;
    for (ll i:V) {
        ans += i;
    }
    return ans;
}

int main() {
    // input
    ll N, M;
    cin >> N >> M;
    Vec k(M), p(M);
    vector<vector<ll>> s(M);
    rep(i, M) {
        cin >> k[i];
        rep(j, k[i]) {
            ll s_temp;
            cin >> s_temp;
            s[i].emplace_back(s_temp);
        }
    }
    rep(i, M) {
        cin >> p[i];
    }

    // process
    ll ans = 0;
    vector<ll> is_swtich(N, 0);
    rep(i, pow(2, N)) {
        bool is_flash = true;
        rep(j, M) {
            ll sum = 0;
            rep(l, k[j]) {
                sum += is_swtich[s[j][l] - 1];
            }
            if ((sum % 2) != p[j]) {
                is_flash = false;
                break;
            }
        }
        if (is_flash) {
            ans++;
        }
        is_swtich[0]++;
        rep(j, N - 1) {
            if (is_swtich[j] == 2) {
                is_swtich[j + 1]++;
                is_swtich[j] = 0;
            }
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 384
#include<cstdio>

const static int MAX = 100;
const static int WHITE = 0;
const static int GRAY = 1;
const static int BLACK = 2;
const static int INFTY = (1<<30);

int M[MAX][MAX];
int color[MAX];
int d[MAX];
int p[MAX];
int n;

void dijkstra()
{
	//初始化
	for(int i=0; i<n; i++)
	{
		color[i] = WHITE;
		d[i] = INFTY;
	}
	int u;
	int mincost;
	d[0] = 0;
	p[0] = -1;

	while(1)
	{
		//选出d[u]最小的点
		mincost = INFTY;
		for(int i=0; i<n; i++)
		{
			if(color[i] != BLACK && mincost > d[i])
			{
				mincost = d[i];
				u = i;
			}
		}
		color[u] = BLACK;

		if(mincost == INFTY) break;

		for(int i=0; i<n; i++)
		{
			if(color[i] != BLACK && M[u][i] < INFTY)
			{
				if(d[u] + M[u][i] < d[i])
				{
					d[i] = d[u] + M[u][i];
					p[i] = u;
					color[i] = GRAY;
				}
			}
		}
	}
}

int main()
{
	scanf("%d", &n);
	for(int i=0; i<n; i++)
	{
		for(int j=0; j<n; j++)
			M[i][j] = INFTY;
	}
	int u,k,v,c;
	for(int i=0; i<n; i++)
	{
		scanf("%d%d", &u, &k);
		for(int j=0; j<k; j++)
		{
			scanf("%d%d", &v, &c);
			M[u][v] = c;
		}
	}

	dijkstra();

	for(int i=0; i<n; i++)
	{
		printf("%d %d\n", i, d[i]);
	}

	return 0;
}


Measured memory_bytes: 2716
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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;
}

ll gcd(ll a, ll b)
{
    if (a % b == 0)
    {
        return (b);
    }
    else
    {
        return (gcd(b, a % b));
    }
}

ll lcm(ll a, ll b)
{
    return a / gcd(a, b) * b;
}

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

//----------------------------------------------------------------

int main(){
ll n;
cin>>n;
cout<<n*800-200*(n/15)<<endl;
}










Measured memory_bytes: 256
#include <iostream>

using namespace std;

static int CountDigits(int x, int b) {
  int n = 0;
  while (x) {
    x /= b;
    ++n;
  }
  return n;
}

int main() {
  int N, K;
  cin >> N >> K;
  cout << CountDigits(N, K) << endl;
  return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int lvl[8]={},god=0;
void judge(int s)
{
	if(s>=1&&s<=399) lvl[0]++;
	else if(s>=400&&s<=799) lvl[1]++;
	else if(s>=800&&s<=1199) lvl[2]++;
	else if(s>=1200&&s<=1599) lvl[3]++;
	else if(s>=1600&&s<=1999) lvl[4]++;
	else if(s>=2000&&s<=2399) lvl[5]++;
	else if(s>=2400&&s<=2799) lvl[6]++;
	else if(s>=2800&&s<=3199) lvl[7]++;
	else god++;
}
int main()
{
	int n,s,min=0;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&s);
		judge(s);
	}
	for(int i=0;i<8;i++)
		if(lvl[i]>0)
			min++;
	if(min==0) printf("1 %d\n",god);
	else printf("%d %d\n",min,min+god);
	return 0;
}

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

int main() {
    int N;
    cin >>N;
    vector<int> A(N, 0);
    for (int i=0; i<N; i++)
        cin >>A.at(i);
    int S=0;
    for (int i=0; i<N-1; i++)
        for (int j=N-1; j>i; j--)
            if (A.at(j)<A.at(j-1)) {
                S++;
                swap(A.at(j), A.at(j-1));
            }
    for (int i=0; i<N-1; i++)
        cout <<A.at(i) <<' ';
    cout <<A.back() <<endl;
    cout <<S <<endl;
    return 0;
}


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

#define all(x)  x.begin(), x.end()
#define mp      make_pair
#define pii     pair<int, int>
#define pll     pair<long long, long long>
#define ll      long long

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



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

using namespace std;

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

ll h, w;

ll dif(ll a, ll b, ll c)
{
	ll tmax = max(max(a, b), c);
	ll tmin = min(min(a, b), c);

	return tmax - tmin;
}

int main(){

	cin >> h >> w;
	if (h % 3 == 0 || w % 3 == 0) {
		cout << 0 << endl;
		return 0;
	}

	ll a, b;
	ll i, j, k;
	if (h % 3 == 1) {
		if (w % 2 == 0) {
			i = h / 3 * w; j = (h - h / 3)* (w / 2); k = (h - h / 3)* (w / 2);
		}
		else { i = h / 3 * w; j = (h - h / 3)* (w / 2); k = (h - h / 3)*(w / 2 + 1); }
	}
	else {
		if (w % 2 == 0) {
			i = (h / 3 + 1) * w; j = (h - h / 3 - 1)* (w / 2);
			k = (h - h / 3 - 1)* (w / 2);
		}
		else {
			i = (h / 3 + 1) * w; j = (h - h / 3 - 1)* (w / 2);
			k = (h - h / 3 - 1)*(w / 2 + 1);
		}
	}
	//cout << i << " " << j << "" << k << endl;
	a = dif(i, j, k);
	if (w % 3 == 1) {
		if (h % 2 == 0) {
			i = w / 3 * h; j = (w - w / 3)* (h / 2); k = (w - w / 3)* (h / 2);
		}
		else {
			i = w / 3 * h; j = (w - w / 3)* (h / 2);
			k = (w - w / 3)*(h / 2 + 1);
		}
	}
	else {
		if (h % 2 == 0) {
			i = (w / 3 + 1) * h; j = (w - w / 3 - 1)* (h / 2);
			k = (w - w / 3 - 1)* (h / 2);
		}
		else {
			i = (w / 3 + 1) * h; j = (w - w / 3 - 1)* (h / 2);
			k = (w - w / 3 - 1)*(h / 2 + 1);
		}
	}

	//cout << i << " " << j << " " << k << endl;
	b = dif(i, j, k);

	//cout << a << " " << b << endl;
	//cout << min(a, b) << endl;
	cout << min(min(a, b),min(h,w)) << endl;

	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayDeque;
import java.util.Deque;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        final Deque<String> numbers = new ArrayDeque<String>(1000000);

        final int n = Integer.parseInt(reader.readLine());

        String line;
        for (int i = 0; i < n; ++i) {
            line = reader.readLine();
            if ('i' == line.charAt(0)) {
                numbers.offerFirst(line.substring(7));

            }else if ('F' == line.charAt(6)) {
                numbers.remove();

            } else if ('L' == line.charAt(6)) {
                numbers.removeLast();

            } else {
                numbers.removeFirstOccurrence(line.substring(7));
            }
        }

        final StringBuilder answer = new StringBuilder();
        answer.append(numbers.poll());
        while (numbers.size() != 0) {
            answer.append(" ").append(numbers.poll());
        }

        System.out.println(answer.toString());
    }
}

Measured memory_bytes: 169420
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb emplace_back
typedef pair<int,int> pi;

int n, m, k, par[100005], grpsize[100005];
set<int> bad[100005];

int find(int x) { return (par[x]==x)? x:find(par[x]); }
bool same(int a, int b) { return find(a) == find(b); }
void merge(int a, int b) {
    a = find(a), b = find(b);
    if (grpsize[a] < grpsize[b]) {
        par[a] = b;
        grpsize[b] += grpsize[a];
    }
    else {
        par[b] = a;
        grpsize[a] += grpsize[b];
    }
}

int main() {
	ios_base::sync_with_stdio(0); 
	cin.tie(0);
	cin >> n >> m >> k;
	for (int i = 0; i <= n; ++i) {
		par[i] = i;
		grpsize[i] = 1;
	}
	for (int i = 0; i < m; ++i) {
		int u, v;
		cin >> u >> v;
		bad[u].emplace(v);
		bad[v].emplace(u);
		if (!same(u, v)) merge(u, v);
	}
	for (int i = 0; i < k; ++i) {
		int u, v;
		cin >> u >> v;
		if (!same(u, v)) continue;
		bad[u].emplace(v);
		bad[v].emplace(u);
	}
	for (int i = 1; i <= n; ++i) {
		int connected = grpsize[find(i)];
		int x = bad[i].size();
		// cout << connected << ' ' << x << '\n';
		cout << connected - x - 1 << ' ';
	}
	return 0;
}


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

int main(){
	int n, m, sum = 0;
	scanf("%d", &n);
	m = n;
	while(m){
		sum += m%10;
		m /= 10;
	}
	if(n%sum == 0)printf("Yes\n");
	else printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#ifdef _MSC_VER
#pragma warning(disable : 4996)
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif

#include <limits.h>
#include <math.h>
#include <time.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <complex>
#include <cstdio>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

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 FORR(i, m, n) for (int i = m - 1; i >= n; --i)
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v, n) reverse(v, v + n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define print(x) cout << (x) << '\n'
#define pe(x) cout << (x) << " "
#define DEBUG(x) cout << #x << ": " << x << endl
#define lb(v, n) lower_bound(v.begin(), v.end(), (n))
#define ub(v, n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i, v.size()) cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template <typename T1, typename T2> inline void chmin(T1& a, T2 b) {
	if (a > b) a = b;
}
template <typename T1, typename T2> inline void chmax(T1& a, T2 b) {
	if (a < b) a = b;
}
typedef pair<int, int> pii;
typedef array<int, 3> arr3;
std::random_device rd;
std::mt19937 mt(rd());
constexpr ll MOD = 1e9 + 7;
constexpr int MAX = 200020;
const double pi = acos(-1);
constexpr double EPS = 1e-8;
constexpr ll INF = 1e18;

using Point = complex<double>;
void solve() {
	int W, H, x, y; cin >> W >> H >> x >> y;
	double ans = (double)W*H / 2.0;
	cout << setprecision(10) << ans << " ";
	if (x == (double)W/2&&y==(double)H/2)cout << 1 << endl;
	else cout << 0 << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	// int q; cin >> q;
	// while (q--)
	solve();
}


Measured memory_bytes: 256