akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

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

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

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input! {
        n: usize, m: usize,
        xy: [(usize1, usize1); m],
    }
    let mut dp = vec![vec![true; n]; n];
    for &(x, y) in &xy {
        if dp[x][y] {
            let mut xv = vec![];
            let mut yv = vec![];
            for i in 0..n {
                if !dp[x][i] { xv.push(i); }
                if !dp[y][i] { yv.push(i); }
            }
            dp[x][y] = false;
            dp[y][x] = false;
            for v in xv {
                dp[y][v] = false;
                dp[v][y] = false;
            }
            for v in yv {
                dp[x][v] = false;
                dp[v][x] = false;
            }
            continue;
        }
        for i in 0..n {
            dp[x][i] = false;
            dp[i][x] = false;
            dp[y][i] = false;
            dp[i][y] = false;
        }
    }
    let mut tot = 0;
    for i in 0..n {
        tot += dp[i][i + 1..].iter().filter(|&&x| x).count();
    }
    puts!("{}\n", tot);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


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

//template
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(a);i>(b);i--)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
void tostr(ll x,string& res){while(x)res+=('0'+(x%10)),x/=10; reverse(ALL(res)); return;}
template<class T> inline bool chmax(T& a,T b){ if(a<b){a=b;return 1;}return 0; }
template<class T> inline bool chmin(T& a,T b){ if(a>b){a=b;return 1;}return 0; }
//template end

int dp[1010000][2];

int main(){
   string s; cin>>s;
   reverse(ALL(s)); s.push_back('0');
   memset(dp,0x3f,sizeof(dp)); dp[0][0]=0;
   rep(i,0,s.size())rep(j,0,2){
      rep(nxt,0,10){
         bool nj=0; int x=nxt-(s[i]-'0')-j;
         if(x<0){x+=10; nj=1;}
         chmin(dp[i+1][nj],dp[i][j]+nxt+x);
      }
   }
   printf("%d\n",dp[s.size()][0]);
   return 0;
}

Measured memory_bytes: 9220
"use strict"
function main(arg) {
    var src = arg.trim().split("\n")[0].split(' ').map(Number)
    var n = src[0]
    var m = src[1]
    var p = arg.trim().split("\n")
    p.shift()
    var maps = {}
    for (var i = 0; i < p.length; i++) {
        var row = p[i].split(" ")
        if (!maps[row[0]]) {
            maps[row[0]] = {
                'WA': 0,
                'AC': 0,
            }
        }
        // 間違い
        if (row[1] === 'WA' && maps[row[0]]['AC'] !== 1) {
            maps[row[0]]['WA'] += 1
        }
        // 正解
        if (row[1] === 'AC' && maps[row[0]]['AC'] === 0) {
            maps[row[0]]['AC'] = 1
        }
    }
    var WA = 0
    var AC = 0
    for (var obj in maps) {
        // console.log(JSON.stringify(maps[obj]))
        if (maps[obj]['AC'] === 1) {
            AC++
            WA += maps[obj]['WA']
        }
    }
    // console.log(JSON.stringify(maps,null,"\t"))
    console.log(AC + " " + WA)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 57908
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;

int ac, pena;
int N, M;
int c[100005];


int main(void) {
    scanf("%d %d", &N, &M);
    rep(i, 0, M) {
        int p;
        char s[5];
        scanf("%d %s", &p, s);
        if (s[0] == 'A' && c[p] != -1) {
            ac++;
            pena += c[p];
            c[p] = -1;
        } else if (s[0] == 'W' && c[p] != -1) {
            c[p]++;
        }

    }
   

  
    printf("%d %d\n", ac, pena);

	  return 0;
}


Measured memory_bytes: 640
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	a := nextInt(sc)
	b := nextInt(sc)
	c := nextInt(sc)
	fmt.Println(resolve(a, b, c))
}

func nextString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func nextInt(sc *bufio.Scanner) int64 {
	i, err := strconv.ParseInt(nextString(sc), 10, 64)
	if err != nil {
		panic(err)
	}
	return i
}

func resolve(a, b, c int64) string {
	if !(a < b) {
		return "No"
	}
	if !(b < c) {
		return "No"
	}
	return "Yes"
}



Measured memory_bytes: 1104
#include<stdio.h>
#include<string>
#include<iostream>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<list>
using namespace std;

int main() {
	int N, alice = 0, bob = 0;
	cin >> N;
	int *a = (int*)malloc(sizeof(int)*N);
	for (int i = 0;i < N;i++)cin >> a[i];
	sort(a, a + N);
	for (int i = 0;i < N;i++) {
		if (i % 2 == 0)alice += a[N-i-1];
		else bob += a[N-i-1];
	}
	cout << alice - bob << endl;

	return 0;
}

Measured memory_bytes: 256
N, K = list(map(int, input().strip().split()))
P = list(map(int, input().strip().split()))
start = 0
rec_sum = sum(P[0:K])
max_sum = rec_sum
for i in range(1, N - K + 1):
  rec_sum = rec_sum - P[i-1] + P[i+K-1]
  if rec_sum > max_sum:
    start = i
    max_sum = rec_sum
    
ans = 0.0
for _p in P[start:start+K]:
  ans += (1+_p) / 2
print(ans)
#print(P[start:start+K])

Measured memory_bytes: 24804
// author : Kartikey Tewari
// date: 2020-02-16   17:34:10
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define endl '\n'
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);

    int flag=0;
    int a,b,c;
    cin >> a >> b >> c;
    if ((a==b)&&(a!=c))
    {
        flag=1;
    }   
    else if ((a==c)&&(a!=b))
    {
        flag=1;
    }
    else if ((b==c)&&(b!=a))
    {
        flag=1;
    }

    if (flag==0)
    {
        cout << "No" << endl;
    }
    else
    {
        cout << "Yes" << endl;
    }

    return 0;    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define CST(x) cout<<fixed<<setprecision(x)
#define PI 3.14159265359
#define MOD 1000000007
using namespace std;
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;

int main(){

    ld a;
    cin >> a;
    ld x = a*a*PI;
    ld y = 2*a*PI;
    CST(8) << x sp y << endl;
    return 0;
}


Measured memory_bytes: 3272
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    a, b = map(int, readline().split())

    if a * b % 2 == 1:
        print('Odd')
    else:
        print('Even')

    return


if __name__ == '__main__':
    main()


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

typedef long long ll ;
const int N = 1e5+5 ; 
const int mod = 1e9+7 ; 
int a[102] ; 
ll sum[102][N] , dp[102][N] ; 
int main() {
	int n , k ; 
	scanf("%d %d" ,&n , &k) ; 
	for (int i = 1 ; i<=n ; ++i) {
		scanf("%d" , &a[i]) ; 
	}
	
    dp[0][0]= 1; 
	
	for (int i = 0 ; i<= k ; ++i)
		sum[0][i] = 1 ; 
	
	for (int i = 1 ; i<=n ; ++i){
		for (int j = 0 ; j <=  k ; ++j){
			if (j-a[i]-1 >=0)
				dp[i][j] = (sum[i-1][j]-sum[i-1][j-a[i]-1]+mod)%mod;
			else 
				dp[i][j] = sum[i-1][j];
			sum[i][j] = (sum[i][j-1]%mod+dp[i][j]%mod)%mod ;
		}
	}
	printf("%lld" , dp[n][k]%mod); 
	return 0;
}

Measured memory_bytes: 158080
N, K = [int(s) for s in input().split(' ')]
H = [int(s) for s in input().split(' ')]

# state: up to nth column, how many skipped, current height(dict)
# value: how many times it takes to cover
dp = [[] for _ in range(N)]

for n, h in enumerate(H):
  if n == 0:
    before = [{0: 0}] + [{} for _ in range(K)]
  else:
    before = dp[n-1]
  # skip (k -> k+1)
  dp[n] = [{}] + before[:-1]
  current = dp[n]
  # not skip (update h and count)
  for k in range(K+1):
    # before[k] = current[k+1]
    for h_before, count in before[k].items():
      candidate = current[k].get(h, float("inf"))
      if h_before >= h:
        current[k][h] = min(candidate, count)
      else:
        current[k][h] = min(candidate, count + h - h_before)
      #print(n, k, h, h_before, count, candidate, current[k][h])
  #print(current)

print(min([v for d in dp[-1] for v in d.values()]))


        
  
  

Measured memory_bytes: 49500
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String string = scanner.next();
		if(Integer.parseInt(string)%1000 == 0) {
			System.out.println(0);
		}else if(1000>=Integer.parseInt(string)) {
			System.out.println(1000 - Integer.parseInt(string));
		}else {
			System.out.println(1000 - Integer.parseInt(string.substring(string.length()-3)));
		}
		scanner.close();
	}
}

Measured memory_bytes: 26904
s=input()
dp=[0]*len(s)
dp[0]=int(s[0])
for i in range(1,len(s)):
    dp[i]=int(s[:i+1])+sum(dp[j-1]+int(s[j:i+1])*2**(j-1) for j in range(1,i+1))
print(dp[-1])

Measured memory_bytes: 3060
N, L = (int(i) for i in input().split())  

if L < 0:
  if N + L <= 0:
    print(int((2 * L + N - 2) * (N - 1) / 2))
  else:
    print(int(N * (2 * L + N - 1) / 2))
else:
  print(int((2 * L + N) * (N - 1) / 2))

Measured memory_bytes: 3060
#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main(){
  double q;
  while(cin >> q && q != -1){
    double x = q / 2;
    while(true){
      if(fabs(x * x * x - q) < 0.00001 * q) break;
      x -= (x * x * x - q)/(x * x * 3);
    }
    cout << fixed << setprecision(7) << x << endl;
  }
}

Measured memory_bytes: 1276
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

namespace C
{
  class Program
  {
    static void Main(string[] args)
    {
      string[] inputs = ReadLine().Split();
      int N = int.Parse(inputs[0]);
      int M = int.Parse(inputs[1]);
      inputs = ReadLine().Split();
      int[] X = new int[M];
      for(int i = 0; i<M; i++)
        X[i] = int.Parse(inputs[i]);

      var sortedX = X.OrderBy(x => x).ToArray();

      int[] len = new int[M-1];
      for(int i=0; i<M-1; i++)
        len[i] = sortedX[i+1]-sortedX[i];

      int min = 0;
      int[] sortedLen = len.OrderBy(x => x).ToArray();
      for(int i = 0; i<M-N; i++)
        min += sortedLen[i];
      WriteLine(min);
    }
  }
}


Measured memory_bytes: 25056
#include <bits/stdc++.h>
using namespace std;
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int main(int argc, char *argv[])
{
  char s[51];
  char t[51];
  scanf("%s",&s);
  scanf("%s",&t);
  int slen = strlen(s);
  int tlen = strlen(t);
  int f = 0;

  for (int i = slen-tlen; i >= 0; i--) {
    for (int j = 0; j < tlen; j++) {
	if(s[i+j]=='?'||s[i+j]==t[j]){
	f=1;
      }else{
	f=0;
	break;
      }
    }
    
    if(f==1){
      for (int j = 0; j < tlen; j++) {
	s[i+j]=t[j];
      }
      break;
    }
  }
  if(f==1){
    for (int i = 0; i < slen; i++) {
      if(s[i]=='?') s[i]='a';
    }
    printf("%s\n",s);
    return 0;
  }else{
    puts("UNRESTORABLE");
    return 0;
  }
}


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

using namespace std;
using ll = long long;

int main() {
    int n;
    int k;
    cin>>n>>k;
    vector<bool> ans(n,false);
    for(int i = 0;i < k;++i) {
        int d;
        
        cin>>d;
        for(int j = 0;j < d;++j) {
            int a;
            cin>>a;
            --a;
            ans[a]=true;
        }
    }
    int a=0;
    for(int i = 0;i < n;++i) {
        if(!ans[i])++a;
    }
    cout<<a<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
int main (void)
{
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
    
    while(1){
    
    if(c-b>0)
        c=c-b;
    
    else{
        printf("Yes\n");
        break;
    }
    
    if(a-d>0)
        a=a-d;
    
    else{
        printf("No\n");
        break;
    }
    }
    
  return 0;
}

Measured memory_bytes: 1596
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#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; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
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; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;cin >> s >> t;
    int n=s.size(),m=t.size();
    int ans=inf;
    REP(i,n-m+1){
        string u=s.substr(i,m);
        int res=0;
        REP(j,m){
            if(u[j]!=t[j]) res++;
        }
        chmin(ans,res);
    }
    cout << ans << endl;
}

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

int main(){
    ll n; cin >> n;
    vector<ll> p(n); rep(i,n) cin >> p[i];

    ll ans = 0;
    vector<ll> cnt(n+1,0);
    for(long long i = 0; i < n; i++){
        if(p[i] == i+1) cnt[i]++;
    }
    for(long long i = 0; i < n; i++){
        if(cnt[i] and cnt[i+1]){
            ans++;
            i++;
        }else if(cnt[i]){
            ans++;
        }
    }
    put(ans);
}

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

//macro
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPR(i, n) for(int i = n; i >= 0; --i)
#define FOR(i, n, m) for(int i = m; i < n; ++i)
#define LL long long

using namespace std;

typedef pair<int, int> P;
typedef pair<LL, LL> LP;
typedef pair<int, P> PP;
typedef pair<LL, LP> LPP;

int main(){
    int n;
    string s;

    cin >> n >> s;

    int ans = 0;
    int max = 0;
    REP(i, n){
        if(s[i] == 'I'){
            ++ans;
        }else{
            --ans;
        }
        
        if(max < ans){
            max = ans;
        }
    }

    cout << max << endl;
}

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

#include <string>
int main(){
    string str; cin >> str;
    int ans = 0;
    if(str.at(1)=='R'){
        ans++;
        if(str.at(2)=='R')ans++;
        if(str.at(0)=='R')ans++;
    } else {
        if(str.at(0)=='R' || str.at(2)=='R') ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3620
#include <iostream>
#include <string>


int main(int argc,char* argv[]){
		std::string ans[7] ={"1100000011","1000000010000000100000001","1111","1000000110000001","11000000011","100000001100000001","110000011"};
		std::string alpha[7]={"A","B","C","D","E","F","G"};
		std::string prob[8];
		std::string problem;

		while(std::cin >> prob[0]){
						for(int a=1; a < 8; a++){
										std::cin >> prob[a];
						}
						for(int b=0; b < 8; b++){
										problem = problem + prob[b];
						}
						for(int c=0; c < 7; c++){
										std::string::size_type index = problem.find(ans[c]);
										if(index != std::string::npos){
														std::cout << alpha[c] << std::endl;
										}
						}
						problem ="";
		}
}

Measured memory_bytes: 1196
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define mod 1000000007
#define deb(x) cout << #x << " " << x << "\n";
#define fo(i, n) for(ll i = 0; i < n; i++)
#define Fo(i, k, n) for(ll i = k; i < n; i++)
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
using namespace std;
using namespace __gnu_pbds;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	ll l, r, d;
	cin >> l >> r >> d;
	ll count = 0;
	
	while(l <= r) {
		if(l%d == 0)
			count += 1;
		l += 1;
	}
	
	cout << count;
	
	
	
	return 0;
}



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

#define X first
#define Y second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define rep(i, a, b) for (unsigned i = (a); i <= (b); ++i)
#define per(i, a, b) for (unsigned i = (a); i >= (b); --i)

using namespace std;

using I = int;
using L = long;
using F = float;
using S = string;
using C = char;
using LL = long long;
using VI = vector<int>;
using VL = vector<long>;
using VF = vector<float>;
using VS = vector<string>;
using PLL = pair<long, long>;
using PLF = pair<long, float>;
using PLS = pair<long, string>;
using PSL = pair<string, long>;
using PSF = pair<string, float>;
using PSS = pair<string, string>;
using MLL = map<long, long>;
using MLF = map<long, float>;
using MLS = map<long, string>;
using MSL = map<string, long>;
using MSF = map<string, float>;
using MSS = map<string, string>;

using SS = stringstream;

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;

int main(int argc, char const *argv[]) {
  // FILE *fp = fopen("/Users/yong-zu/Downloads/0501_input.txt", "r");
  while (1) {
    L n, m;
    L ans1 = 0;
    L ans2 = 0;
    cin >> n;
    if (n == 0) { break; }

    map<C, C> mp;
    for (unsigned i = 0; i < n; i++) {
      C a, b;
      cin >> a >> b;
      mp.emplace(a, b);
    }
    cin >> m;
    for (unsigned i = 0; i < m; i++) {
      C c;
      cin >> c;
      if (mp.find(c) == mp.end()) {
        cout << c;
      } else {
        cout << mp[c];
      }
    }
    cout << "\n";
  }

  return 0;
}

Measured memory_bytes: 3036
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>

#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"
#define pi 3.1415926535897932384626433832795028841971693993751058
#define maxn 100005

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define pq priority_queue
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
#define ceil(a,b) (a+b-1)/b
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

void solve()
{
    int n,k;
    cin>>n>>k;
    string s;
    cin>>s;
    int c = 0;
    char ch = s[0];
    rep(i,0,s.length()){
        int j = i;
        char x = s[i];
        while( s[j] == x ){
            if (c&1 && (k>0)){
                s[j] = ch;
            }
            j++;
        }
        if (c&1){
            k--;
        }
        c++;
        i = j-1;
    }   
    // out1(s);
    int ans = 0;
    rep(i,0,s.length()-1){
        if ( s[i] == s[i+1] ){
            ans++;
        }
    }
    cout<<ans<<endl;
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



Measured memory_bytes: 512
require 'bigdecimal'
input = STDIN.read.split("\n")
Array.new(input.shift.to_i) do
  x1, y1, x2, y2, x3, y3, x4, y4 = input.shift.chomp.split.map { |e| BigDecimal.new(e) }
  ab = (y2 - y1) / (x2 - x1)
  cd = (y4 - y3) / (x4 - x3)
  if y1 == y2 && y3 == y4
    puts 'YES'
  elsif ab == cd
    puts 'YES'
  else
    puts 'NO'
  end
end

Measured memory_bytes: 8852
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        Integer n = Integer.parseInt(sc.next());
        Integer.parseInt(sc.next()); // 未使用となる変数l
        String[] s = new String[n];
        for (int i = 0; i < n; i++) {
            s[i] = sc.next();
        }

        // 主処理
        Arrays.sort(s);
        String result = String.join("", s);

        // 出力
        System.out.println(result);
        sc.close();
    }
}


Measured memory_bytes: 21716
#include <iostream>
using namespace std;
int main(){
    
    int hiro,ken,i,j,hiroa,kena,hirob,kenb,iwa,yama,iwa10,yama20,ans1,ans2,ans3,ans4,warua,warub,waru2a,waru2b;
    cin>>hiroa>>hirob>>kena>>kenb>>iwa>>yama>>iwa10>>yama20;
    warua=hiroa/10;
    warub=hirob/20;
    ans1=(hiroa*iwa)+(warua*iwa10);
    ans2=(hirob*yama)+(warub*yama20);
    hiro=ans1+ans2;
    
    waru2a=kena/10;
    waru2b=kenb/20;
    ans3=(kena*iwa)+(waru2a*iwa10);
    ans4=(kenb*yama)+(waru2b*yama20);
    ken=ans3+ans4;
    
    
    if(ken<hiro){
        
        cout<<"hiroshi"<<endl;
    }
    else if(hiro<ken){
        cout<<"kenjiro"<<endl;
    }
    else if(ken==hiro){
        cout<<"even"<<endl;
    }
    
return 0;
    
}



Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int x,y;
	cin>>x>>y;
	swap(x,y);
	for(int i=x-y+1;i<=x+y-1;i++)
	{
		if(i>1000000||i<-1000000)
		{
			continue;
		}
		
		cout<<i<<endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y);

int main() {
    int n, m;
    cin >> n >> m;
    priority_queue<ll> q;
    rep(i,n) {
        ll a;
        cin >> a;
        q.push(a);
    }
    rep(i,m) {
        ll a = q.top(); q.pop();
        a /= 2;
        q.push(a);
    }
    ll ans = 0;
    while (!q.empty()) {
        ans += q.top(); q.pop();
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4320
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i_7 (ll)(1E9+7)
#define i_5 (ll)(1E9+5)
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    else return c+i_7;
}
typedef pair<int,int> i_i;
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
long double EPS=1E-8;
///////////////////////////////////////
#define N 200004

ll kai[N];
ll kai2[N];
ll po(ll i,ll p){
    if(p==0)return 1;
    else if(p==1)return mod(i);
    else if(p%2==0)return po(mod(mod(i)*mod(i)),p/2);
    else  return mod(mod(i)*po(i,p-1));
}
void calc(){
    kai[0]=1;
    kai2[0]=1;
    rep(i,1,N-1){
        kai[i]=mod(kai[i-1]*i);
    }
    kai2[N-1]=po(kai[N-1],i_5);
    for(int i=N-2;i>=0;i--){
        kai2[i]=mod(kai2[i+1]*(i+1));
    }
}
ll comb(ll n,ll k){
    if(n<k)return 0;
    else if(n==0)return 1;
    else return mod(mod(kai[n]*kai2[n-k])*kai2[k]);
}
ll bunbo(ll n){
    return po(n,i_5);
}

int main(){
    calc();
    ll a[N];
    a[0]=0;
    ll n;cin>>n;
    rep(i,1,n+1){
        a[i]=mod(a[i-1]+bunbo(i)*kai[n]);
    }
    ll b[n+1];rep(i,1,n)cin>>b[i];
    ll ans=0;
    rep(i,1,n){
        ll s=mod(a[n-i+1]+a[i]-a[1]);
        s=mod(s*b[i]);
        Add(ans,s);
      //  cout<<s<<endl;
    }
    cout<<ans<<endl;
    
    return 0;
}



Measured memory_bytes: 4992
#include <iostream>

 

using namespace std;

 

int main()
{
    int i, x;
    for(i=1; i<=10000; i++)
    {
        cin >> x;
        if(x==0)
        break;
        
        cout << "Case " << i << ":"<<" "<< x << endl;
        

    }
}


Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
using namespace std;

int main() {
	double d1=0, d2=0, d3=0, di=0, temp;
	vector<double> v1, v2;
	int n;
	cin >> n;
	v1.resize(n);
	v2.resize(n);
	for(int i=0; i<n; ++i) {
		cin >> v1[i];
	}
	for(int i=0; i<n; ++i) {
		cin >> v2[i];
	}
	for(int i=0; i<n; ++i) {
		temp=abs(v1[i]-v2[i]);
		d1+=temp;
		d2+=temp*temp;
		d3+=temp*temp*temp;
		di=(di>temp?di:temp);
	}
	cout << fixed << setprecision(6);
	cout << d1 << endl;
	cout << pow(d2,1.0/2.0) << endl;
	cout << pow(d3,1.0/3.0) << endl;
	cout << di << endl;

	return 0;
}

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

int main()
{
    char *w[] = {"Sunny", "Cloudy", "Rainy"};
    char c;
    scanf("%c", &c);
    int i;
    for (i = 0; i < 3; i++)
    {
        if(c == w[i][0])
        {
            ++i;
            if (i == 3)
                i = 0;
            printf("%s", w[i]);
            break;
        }
    }
	return 0;
}



Measured memory_bytes: 128
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

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

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}


void solve(){
    ll a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a+3);
    ll ans = (a[2] - a[1])/2;
    ans += (a[2] - a[0])/2;
    rep(i, 3) a[i] %= 2; //cout << ans << " ";
    if(a[0] == a[1] && a[1] == a[2]) ANS(ans);
    if(a[0] == a[1]) ans++;
    else ans += 2;
    cout << ans;

}
main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
}


Measured memory_bytes: 256
// Compute C(N+K-1,K-1) (stars and bars)
#include <iostream>
using namespace std;
int C[2002][1002];
int M = 1e9 + 7;

int main() {
  int N, K;
  cin >> N >> K;
  for (int n = 0; n <= N; ++n)
    C[n][0] = 1;
  for (int k = 1; k <= K; ++k)
    for (int n = k; n <= N + K - 1; ++n)
      C[n][k] = (C[n - 1][k - 1] + C[n - 1][k]) % M;
  cout << C[N + K - 1][K - 1] << endl;
}



Measured memory_bytes: 10920
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}

using namespace std;

typedef long long ll;

typedef pair<int,int> P1;
typedef pair<int,P1> P2;
const ll inf=100000000000000;
struct edge{
	int to,cost;
};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};

#define MAX_N 100002
int dp[MAX_N]={};
bool d[MAX_N]={};
int pa[MAX_N];
vector<edge> G[MAX_N];
P1 cost[MAX_N]={};
vector<int> child[MAX_N];
vector<int> ra[MAX_N];
priority_queue<P2,vector<P2>,greater<P2>> que;
ll a[100005]={};
ll b[100005]={};
int reg(int k){
	if(dp[k]>=0)return dp[k];
	dp[k]=0;
	vector<int> v;
	for(auto it:child[k]){
		v.push_back(reg(it));
	}
	sort(v.begin(),v.end(),greater<int>());
	rep(i,v.size()){
		dp[k]=max(dp[k],v[i]+i+1);
	}
	return dp[k];
}
int main() {
	int n;
	cin>>n;
	pa[1]=1;
	rep(i,n-1){
		int a1;
		cin>>a1;
		pa[i+2]=a1;
		child[a1].push_back(i+2);
	}
	memset(dp,-1,sizeof(dp));
	cout<<reg(1)<<endl;
	return 0;
}





Measured memory_bytes: 23040
#include<cstdio>

int n, k;

long long f(int x) {
	return 1ll * x * x * x;
}

int main() {
	scanf("%d %d", &n, &k);
	if (k % 2 == 0) {
		printf("%lld\n", f(n/(k/2) / 2) + f((n/(k/2) + 1) / 2));
	} else {
		printf("%lld\n", f(n/k));
	}
}

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

#define INF 102030405060708090
#define inf 1020304050

int main() {

  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  long long x;
  cin >> n >> x;
  vector<int> a(n);
  vector<int> b(n*2);
  for (int i=0;i<n;i++) cin >> a[i];

  for (int i=0;i<n;i++) {
    b[i] = a[i];
    b[n+i] = a[i];
  }

  vector<int> mins(n,inf);
  long long ans = INF;
  for (int i=0;i<n;i++) {
    long long kans = x*i;
    for (int j=0;j<n;j++) {
      mins[j] = min(mins[j],b[n+j-i]);
      kans += mins[j];
    }
    ans = min(ans,kans);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define REP(i, d, n) for(int i=(d); i<(n); ++i)
#define all(v) v.begin(), v.end()
using ll = long long;
int main() {
  
int n; cin>>n;
  int ha=n%1000;
  if(ha==0){cout<<0<<endl;
           }
  else
  cout<<1000-ha<<endl;
  
  
  
}

Measured memory_bytes: 3632
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

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;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int main() {
	int n;
	cin >> n;
	vector<int> s;
	vector<int> ans;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		s.push_back(a);
		ans.push_back(a);
	}
	sort(s.begin(), s.end());
	int max = s[n / 2];
	int min = s[n / 2 - 1];
	for (int i = 0; i < n; i++) {
		if (ans[i] <= min) {
			cout << max << endl;
		}
		else {
			cout << min << endl;
		}
	}
}

Measured memory_bytes: 3948
import java.io.IOException;
import java.io.InputStream;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.NoSuchElementException;

	
public class Main{
	
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		FastScanner sc=new FastScanner();
		long N=sc.nextLong();
		int ans=0;
		for (long d=2;d*d<=N;++d) {
			if (N%d!=0) continue;
			int cnt=0;
			while (N%d==0) {
				N/=d;
				++cnt;
			}
			for (int i=1;i<=cnt;++i) {
				++ans;
				cnt-=i;
			}
		}
		if (N>1) ++ans;
		System.out.println(ans);
	}
	
	void tr(Object...objects) {System.out.println(Arrays.deepToString(objects));}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    
    public double nextDouble() { return Double.parseDouble(next());}
}


Measured memory_bytes: 32684
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int As = (A * 100 + 7) / 8;
		int Al = ((A+1) * 100 - 1) / 8;
		int Bs = B * 10;
		int Bl = ((B+1) * 100 - 1) / 10;
		if(Bs <= Al && As <= Bl) {
			int ans = As;
			while(true) {
				if(ans >= Bs)
					break;
				ans++;
			}
			System.out.println(ans);
		}
		else 
			System.out.println(-1);
	}

}

Measured memory_bytes: 23892
#D - Wall
H,W = [int(x) for x in input().split()]
C = [[0 for i in range(10)] for j in range(10)]
for i in range(10):
    C[i] = [int(x) for x in input().split()]
A = [[0 for i in range(W)] for j in range(H)]
for i in range(H):
    A[i] = [int(x) for x in input().split()]
#print(H,W) #
#print(C) #
#print(A) #
point = [C[i][1] for i in range(10)] #iを1に変換する魔力
way = [[i,1] for i in range(10)] #iを1に変換する方法
#print(point) #
#print(way) #

update = True
while update:
    update = False
    for i in range(10):
        for j in range(10):
            if i==j: continue
            #print(i,j,C[i][j],point[i]) #
            if  C[i][j]+point[j]<point[i]:
                #print(i,j, point, way) #
                point[i] = C[i][j] + point[j] 
                way[i].remove(way[i][-1])
                way[i] = [i]+way[j]
                update = True
                #print(i,j, point, way) #
    #print(point) #
    #print(way) #    
    #break
#print(point) #
#print(way) #
count = [0 for i in range(10)] #番号の数
for i in range(H):
    for j in range(W):
        if A[i][j]>=0: count[A[i][j]]+=1
#print(count) #
sum = 0
for i in range(10): sum += count[i]*point[i]
print(sum)



Measured memory_bytes: 3444
s = gets.chomp
q = gets.chomp.to_i
count = 0
reverse_flag = true #trueなら通常、falseなら逆
while(true)
    qq = gets.chomp.split
    if qq[0] == '1'
        reverse_flag = !reverse_flag
    else
        if qq[1] == '1' && reverse_flag
            s.insert(0,qq[2])
        elsif qq[1] == '1' && !reverse_flag
            s.insert(s.size,qq[2])
        elsif qq[1] == '2' && !reverse_flag
            s.insert(0,qq[2])
        elsif qq[1] == '2' && reverse_flag
            s.insert(s.size,qq[2])
        end
    end
    count += 1
    if count == q 
        break
    end
end
if reverse_flag
    print s
else
    print s.reverse
end

Measured memory_bytes: 14680
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ldb;
typedef unsigned int ui;
typedef unsigned long ul;
 
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
 
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
 
typedef priority_queue<pi> pq;
typedef priority_queue<int,vector<int>,greater<int>> pqg;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
 
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound


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

ll n,d;
cin>>n>>d;

ll counter=0;
for(ll i=0; i<n; i++){
	ll x,y;
	cin>>x>>y;
	if((x*x)+(y*y)<=d*d) counter++;
}

cout<<counter;
return 0; 
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }


// dp[n][k]=先頭からn人でk個を分け合うパターン数
ll dp[110][100010];
ll mod_num = 1e9+7;
ll a[100010];

ll solve(int i, int j) {
    if(j == 0) return 1;
    if(j < 0) return 0;
    if(i == -1) return 0;
    if(dp[i][j] != -1) return dp[i][j];

    return dp[i][j] = ((solve(i-1,j)+ solve(i, j-1)) % mod_num) - ((solve(i-1, j-a[i-1]-1)) % mod_num);
}


int main() {
    int n,k;
    cin >> n >> k;
    for(int i = 0; i < n; ++i) cin >> a[i];
    for(int i = 0; i <= n; ++i) dp[i][0] = 1;

    for(int i = 1; i <= n; ++i){
        for(int j = 1; j <= k; ++j){
            dp[i][j] = (dp[i - 1][j] + dp[i][j - 1])%mod_num;
            if(j - a[i - 1] - 1 >= 0){
                dp[i][j] = (dp[i][j] + mod_num - dp[i - 1][j - a[i - 1] - 1])%mod_num;
            }
        }
    }
    cout << dp[n][k] << endl;
    return 0;
}


Measured memory_bytes: 78592
#include <iostream>
#include <map>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;
int N; string S; map<string, int> m;
priority_queue<string, vector<string>, greater<string>> q;
int main() {
  cin >> N;
  int mx = 0;
  for(int i = 0; i < N; ++i) {
    cin >> S;
    ++m[S];
    mx = max(mx, m[S]);
  }
  for (auto itr = m.begin(); itr != m.end(); ++itr) {
    if(itr->second == mx) q.push(itr->first);
  }
  while(q.size() > 0) { 
    cout << q.top() << endl;
    q.pop();
  }
}

Measured memory_bytes: 26868
w, h, n = map(int,input().split())
arr = [[0 for i in range(w)] for j in range(h)]
sums = 0
for i in range(n):
  x, y, a = map(int,input().split())
  if a == 1:
    for i in range(x):
      for j in range(h):
        arr[j][i] = 1
  elif a == 2:
    for i in range(x,w):
      for j in range(h):
        arr[j][i] = 1
  elif a == 3:
    for i in range(y):
      for j in range(w):
        arr[i][j] = 1
  else:
    for i in range(y,h):
      for j in range(w):
        arr[i][j] = 1
for i in arr:
  sums += i.count(0)
print(sums)

Measured memory_bytes: 3064
A, B, Q = map(long, raw_input().split())
S = [long(raw_input()) for _ in range(A)]
T = [long(raw_input()) for _ in range(B)]
X = [long(raw_input()) for _ in range(Q)]
INF = 10**11

def meguru_bs(array, x):
  left = -1
  right = len(array)
  while right - left>1:
    mid = (left+right) / 2
    if array[mid] >= x:
      right = mid
    else:
      left = mid
  return right

for x in X:
  s_right = meguru_bs(S, x)
  s_nearests = [s_right-1, s_right]
  t_right = meguru_bs(T, x)
  t_nearests = [t_right-1, t_right]
  ans = INF
  for s in s_nearests:
    if s < 0 or s >= A:
      continue
    for t in t_nearests:
      if t < 0 or t >= B:
        continue
      ans = min(ans, abs(S[s]-x)+abs(T[t]-S[s]),abs(T[t]-x)+abs(S[s]-T[t]))
  print ans


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

using namespace std;
using ll = long long;
using v1 = vector<int>;
using v2 = vector<vector<int>>;

int main(){
	int n, k;
	cin >> n >> k;
	ll c = k;
	rep(i, n-1){
		c *= k-1;
	}
	cout << c << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n<105) cout<<0;
	else if(n<135) cout<<1;
	else if(n<165) cout<<2;
	else if(n<189) cout<<3;
	else if(n<195) cout<<4;
	else cout<<5;
} 

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

#define var auto
#define long long long
using namespace std;

int main() {
    while(true){
        int n, m;
        cin >> n >> m;
        if (n == 0) break;
        vector<int> a(n), b(m);
        for (int i = 0; i < n; ++i) cin >> a[i];
        for (int i = 0; i < m; ++i) cin >> b[i];
        var aSum = accumulate(a.begin(), a.end(), 0);
        var bSum = accumulate(b.begin(), b.end(), 0);
        var diff = aSum - bSum;
        int resA = INT32_MAX;
        int resB = INT32_MAX;
        for (int i = 0; i < n; ++i) {
            for (int j = 0; j < m; ++j) {
                if ((a[i] - b[j]) * 2 == diff && a[i] < resA){
                    resA = a[i];
                    resB = b[j];
                }
            }
        }
        if (resA == INT32_MAX){
            cout << -1 << endl;
            continue;
        }
        cout << resA << " " << resB << endl;
    }
}



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


int read_p,read_ca;
inline int read(){
    read_p=0;read_ca=getchar();
    while(read_ca<'0'||read_ca>'9') read_ca=getchar();
    while(read_ca>='0'&&read_ca<='9') read_p=read_p*10+read_ca-48,read_ca=getchar();
    return read_p;
}
int t[110000],n,a=0;
int main(){
	n=read();
	for (int i=1;i<=n;i++){
		t[i]=read();
	}
	for (int i=1;i<n;i++)
	if (t[i]==i) a++,swap(t[i],t[i+1]);
	if (t[n]==n) a++;
	printf("%d\n",a);
}

Measured memory_bytes: 512
import bisect
import collections
import functools
import heapq
import math
import sys
from collections import deque
from collections import defaultdict
MOD = 10**9+7

N = list(input())
if N[-1] == "3":
    print("bon")
elif N[-1] == "0" or N[-1] == "1" or N[-1] == "6" or N[-1] == "8":
    print("pon")
else:
    print("hon")

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

using namespace std;

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

int main() {
	string s;
	cin >> s;
	char c = s[0];
	rep(i, s.size()) if(s[0] < s[i]) { c++; break; }
	rep(i, s.size()) cout << c;
	cout << endl;
}


Measured memory_bytes: 256
h, w = map(int, input().split())
grid = [str(input()) for _ in range(h)]
dp = [[0 for _ in range(w)] for _ in range(h)]
mod = 10 ** 9 + 7
dp[0][0] = 1
for i in range(h):
    for j in range(w):
        if grid[i][j] == '#':
            continue
        if i >= 1:
            dp[i][j] += dp[i - 1][j]
        if j >= 1:
            dp[i][j] += dp[i][j - 1]
        dp[i][j] %= mod
print(dp[-1][-1])

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

int main() {
  
  int N,M;
  int H=0;
  
  cin >> N;
  M = N;
  
  for(int i=0; i<10; i++){
    
    H += N%10;
    
    N /= 10;
  }
  
  if(M%H==0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}

Measured memory_bytes: 256
import math
a, b, C = map(int, input().split())
R = math.radians(C)
c = math.sqrt(a**2 + b**2 - 2 * a * b * math.cos(R))
L = a + b + c
S = a * b * math.sin(R) / 2
h = S * 2 / a
print(S)
print(L)
print(h)

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

void func(ll a, ll b, ll cnt) {
	if (!b)cout << a << ' ' << cnt << endl;
	else func(b, a%b, cnt + 1);
}
int main() {
	ll a, b;
	while (cin >> a >> b, a | b) {
		if (a < b)swap(a, b);
		func(a, b, 0);
	}
}

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

int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n);
  for (int i = 0; i < m; i++) {
    int s, t;
    cin >> s >> t, s--, t--;
    g[s].push_back(t);
  }
  vector<double> dp(n, 0);
  for (int i = n - 2; i >= 0; i--) {
    double x = 0;
    for (auto v : g[i]) {
      x += dp[v];
    }
    x /= g[i].size();
    x += 1;
    dp[i] = x;
  }
  double ans = dp[0];
  for (int s = 0; s < n - 1; s++) {
    double t = -1;
    for (auto v : g[s]) {
      if (t == -1 || dp[v] > dp[t]) t = v;
    }
    double m = [&] {
      for (int i = n - 2; i >= 0; i--) {
        double x = 0;
        for (auto v : g[i]) {
          if (i == s && v == t) continue;
          x += dp[v];
        }
        x /= g[i].size() - (i == s);
        x += 1;
        dp[i] = x;
      }
      return dp[0];
    }();
    ans = min(ans, m);
  }
  cout << fixed << setprecision(10);
  cout << ans << endl;
}


Measured memory_bytes: 1408
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <string.h>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t int64;

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

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


class B {
	int n;
public:
	B()
	{
		cin >> n;
	}
	void solve()
	{
		int ans{ 0 };

		for (int i{ 1 }; i <= n; i+= 2)
		{
			int cnt{ 0 };
			REP(j, n)
			{
				if (!(i % (j + 1)))
					cnt++;
			}
			if (cnt == 8)
				ans++;
		}

		cout << ans << endl;
	}
};


int main()
{
	B solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256