akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>

int main(void)
{
    int n;
    std::cin >> n;
    long long result = 0;
    for (int i = 0; i < n+1; i++)
    {
        result += i % 3 != 0 && i % 5 != 0 ? i : 0;
    }
    std::cout << result << std::endl;
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <queue>
#include <map>
#include <set>
#include <algorithm>

using namespace std;

typedef long long ll;
typedef __int128 lll;
constexpr ll mod = 1000000007;

pair<ll, ll> extgcd(ll a, ll b) {
    if (b == 0) return make_pair(a, 0);
    auto t = extgcd(b, a % b);
    return make_pair(t.second, t.first - t.second * (a / b));
}

ll inv_mod(ll n) {
    ll t = extgcd(n, -mod).first;
    return ((t % mod) + mod) % mod;
}

ll ifd[200001];

ll inv_fac(ll n) {
    if (n == 0) return 1;
    if (ifd[n] == 0) ifd[n] = (inv_fac(n - 1) * inv_mod(n)) % mod;
    return ifd[n];
}

ll fd[200001];

ll fac(ll n) {
    if (n == 0) return 1;
    if (fd[n] == 0) fd[n] = (fac(n - 1) * n) % mod;
    return fd[n];
}

ll cmb(ll n, ll k) {
    return (((fac(n) * inv_fac(k)) % mod) * inv_fac(n - k)) % mod;
}

int main() {
    ifd[0] = fd[0] = 1;
    for (int i = 1; i <= 200000; i++) {
        fd[i] = (fd[i - 1] * i) % mod;
        ifd[i] = (ifd[i - 1] * inv_mod(i)) % mod;
    }
    ll n, k;
    cin >> n >> k;
    ll r = 0;
    for (int i = max((ll) 1, n - k); i <= n; i++) {
        r += cmb(n - 1, i - 1) * cmb(n, i);
        r = r % mod;
    }
    cout << r << endl;
}

Measured memory_bytes: 3328
use std::io;
use std::cmp::min;

fn procon_read<T: std::str::FromStr>() ->  Vec<T> {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let iter = buf.split_whitespace();
	let mut v: Vec<T> = Vec::new();
	for i in iter {
		v.push(i.parse().ok().unwrap());
	}
	v
}

fn main() {
	let v:Vec<i32> = procon_read();
	let a = v[0];
	let b = v[1];
	let c = v[2];
	let mut cnt = min(b/a, c);
	println!("{}", cnt);
}

Measured memory_bytes: 4352
/*input
5
10 4 8 7 3
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
#pragma GCC optimize("unroll-loops,no-stack-protector")
//order_of_key #of elements less than x
// find_by_order kth element
typedef long long int ll;
#define ld long double
#define pii pair<int,int>
#define f first
#define s second
#define pb push_back
#define REP(i,n) for(int i=0;i<n;i++)
#define sz(_a) (ll)(_a.size())
#define FILL(n,x) memset(n,x,sizeof(n))
#define ALL(_a) _a.begin(),_a.end()
const ll maxn=200005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;

ll mypow(ll a,ll b){
    if(b<=0) return 1;
    ll res=1LL;
    while(b){
        if(b&1) res=res*a%MOD;
        a=a*a%MOD;
        b>>=1;
    }
    return res;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    int prev;
    cin>>prev;
    int ans=0,mx=0;
    REP(i,n-1){
        int x;
        cin>>x;
        if(x<=prev) ++ans;
        else{
            mx=max(mx,ans);
            ans=0;
        }
        prev=x;
    }
    mx=max(mx,ans);
    cout<<mx;
}

Measured memory_bytes: 256
n = gets.to_i
a = gets.split.map(&:to_i)

a.sort!.reverse!
s = a.clone
(n-1).times {|i|
  s[n-i-2] += s[n-i-1]
}

i = 1
while i < n
  if a[i-1] > s[i] * 2
    break
  end
  i += 1
end

puts i


Measured memory_bytes: 9336
#include <cstdlib>
#include <algorithm>
#include <iostream>
#include <string>
#include <unordered_map>


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

  std::string w;
  std::cin >> w;
  std::unordered_map<char, int> charCountMap;
  for (const auto& c : w) {
    charCountMap[c]++;
  }
  auto itr = std::find_if(
      charCountMap.begin(),
      charCountMap.end(),
      [](const decltype(charCountMap)::value_type& e) {
        return e.second % 2 == 1;
      });
  std::cout << (itr == charCountMap.end() ? "Yes" : "No") << std::endl;

  return EXIT_SUCCESS;
}


Measured memory_bytes: 256
w = input()
List = []
for k in range(len(w)):
  tmp = w[k]
  List.append(tmp)
num2alpha = lambda c: chr(c+96)
for i in range(1,27):
  tmp2 = List.count(num2alpha(i))
  if(tmp2 % 2 == 0):
    pass
  else:
    print("No")
    exit()
print("Yes")


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

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n, h, w;
	cin >> n >> h >> w;

	int hh = 0;
	for (int i = 0; i < n; i++) {
		if (i + (h - 1) < n) {
			hh++;
			continue;
		}

		break;
	}

	int ww = 0;
	for (int i = 0; i < n; i++) {
		if (i + (w - 1) < n) {
			ww++;
			continue;
		}

		break;
	}

	cout << hh * ww << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string.h>
typedef long long ll;

#define MAX(x, y)	(((x) > (y))? (x) : (y))
#define MIN(x, y)	(((x) < (y))? (x) : (y))
#define ABS(x)		(((x) < 0)? (-1*(x)) : (x))
#define REPI(x,y)	for (int i=(x);i<(y);i++)
#define REPJ(x,y)	for (int j=(x);j<(y);j++)
#define MEMCLR(X)	memset((X),0,sizeof((X)))

using namespace std;
typedef vector<vector<pair<int, int>>> G;
typedef pair<int, int> P;

int i,j,x,N,a;

int main() {
	cin >> N;
	
	a=N;
	
	do {
		x += a%10;
	} while ( a /= 10 );
		
	cout << ((!(N%x))? "Yes" : "No");
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,i,a=0,w=0,t=0,r=0;
    string s;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>s;
        if(s=="AC")
            a++;
        else if(s=="WA")
            w++;
        else if(s=="TLE")
            t++;
        else
            r++;
    }
    cout<<"AC x "<<a<<endl;
    cout<<"WA x "<<w<<endl;
    cout<<"TLE x "<<t<<endl;
    cout<<"RE x "<<r<<endl;
}



Measured memory_bytes: 3624
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<stack>
#include<string>

using namespace std;
const int INF = 1<<30;
typedef long long int ll;

int main(){
	int n;cin>>n;int pre=-1, count=0, ans=0;
	for(int i=0;i<n;i++){
		int a;cin>>a;
		if(a==pre)count++;
		else {ans+=count/2;count=1;pre=a;}
	}
	cout << ans + count/2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>

long long combination(int N, int R){
  int Numerator = 1;
  int Denominator = 1;
  for(int i = 0 ; i < R ; i++){
    Numerator *= (N - i);
    Denominator *= (i + 1);
  }
  return Numerator/Denominator;
}

int main(){
  std::vector<int> prime = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,91,97};
  int N ;
  std::cin>>N;
  std::vector<int> v(N);
  std::iota(v.begin(),v.end(),1);

  auto f = [](int Q, int a){
	     int count = 0;
	     int* p = &Q;
	     while(1){
	       if( (*p) % a == 0 && (*p) != 0){
		 count++;
		 *p = (*p) / a;
		 continue;
	       }else{
		 break;
	       }
	     }
	     return count;
	   };
  std::vector<int> power;
  for(int i = 0 ; i < (int)prime.size(); i++){
    int power_count = 0;
    for(int k = 0 ; k < (int)v.size() ; k++){
      power_count += f(v[k],prime[i]);
    }
    power.push_back(power_count);
  }

  int over2  = std::count_if(power.begin(),power.end(),[](int x){return x >= 2;});
  int over4  = std::count_if(power.begin(),power.end(),[](int x){return x >= 4;});
  int over14 = std::count_if(power.begin(),power.end(),[](int x){return x >= 14;});
  int over24 = std::count_if(power.begin(),power.end(),[](int x){return x >= 24;});
  int over74 = std::count_if(power.begin(),power.end(),[](int x){return x >= 74;});

  int count = 0;

  count += combination(over4,2) * (over2 - 2);
  count += over14 * (over4 - 1);
  count += over24 * (over2 - 1);
  count += over74;
  std::cout << count << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

#define PI 3.141592

int d, t;
double x, y, deg;

int main() {
	x = 0;
	y = 0;
	deg = 90;

	scanf("%d,%d", &d, &t);
	while (!(d == 0 && t == 0)) {
		x += d * sin((double)deg / 180 * PI);
		y += d * cos((double)deg / 180 * PI);
		deg -= t;
		scanf("%d,%d", &d, &t);
	}
	cout << (int)y << endl;
	cout << (int)x << endl;

	return 0;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@                       @*/
/*@ debug output erased ? @*/
/*@                       @*/
/*@@@@@@@@@@@@@@@@@@@@@@@@@*/

Measured memory_bytes: 1212
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#define print(n) std::cout << n << std::endl
#define FOR(i,n) for(int i = 0; i < n; i++)
using namespace std;

int main() {
    string a,b,c;
    cin >> a >> b >> c;
 
    if((a.substr(a.size() - 1,1) == b.substr(0,1)) && (b.substr(b.size() - 1,1) == c.substr(0,1)))print("YES");
    else print("NO");


}


Measured memory_bytes: 256
#![allow(unused_imports, unused_macros, dead_code)]

macro_rules! min {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| min!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = min!($($ys),*);
        if $x < t { $x } else { t }
    }}
}
macro_rules! max {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        it.next().map(|z| it.fold(z, |x, y| max!(x, y)))
    }};
    ($x:expr) => ($x);
    ($x:expr, $($ys:expr),*) => {{
        let t = max!($($ys),*);
        if $x > t { $x } else { t }
    }}
}
macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    (.. $x:expr) => {{
        let mut it = $x.iter();
        if let Some(x) = it.next() { print!("{}", x); }
        for x in it { print!(" {}", x); }
        println!("");
    }};
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 1_000_000_007;

fn main() {
    proconio::input! {
        s: String,
        t: String,
    };
    if s.len() + 1 == t.len() && s == t[0..t.len() - 1] {
        put!("Yes");
    } else {
        put!("No");
    }
}

use std::collections::VecDeque;
use std::io::{self, Write};
use std::str::FromStr;

struct Scanner {
    stdin: io::Stdin,
    buffer: VecDeque<String>,
}
impl Scanner {
    fn new() -> Self {
        Scanner {
            stdin: io::stdin(),
            buffer: VecDeque::new(),
        }
    }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.is_empty() {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.cin::<String>().chars().collect()
    }
    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.cin()).collect()
    }
}


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

int main(){
    vector<int>vec(3);
    for(int i=0;i<3;i++)cin>>vec.at(i);
    sort(vec.begin(),vec.end());
    vec.erase(unique(vec.begin(),vec.end()),vec.end());
    cout<<vec.size()<<endl;
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, K: int):
    print(min(N % K, abs(N % K - K)))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


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

int main()
{
    char week[7][4] = {
        {"SUN"},
        {"MON"},
        {"TUE"},
        {"WED"},
        {"THU"},
        {"FRI"},
        {"SAT"},
    };
    char S[4];
    int N;
    int i,j;
    int rtn;
    int next;

    if(scanf("%s", S) == 1);

    for (i=0; i<7; i++) {
        rtn = strcmp(S, week[i]);
        if(rtn == 0){
            break;
            // printf("%s",S);
            // return(0);
        }
    }
    
    next = 7 - i;
    printf("%d",next);
    
    return(0);
}

Measured memory_bytes: 128
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<map>
#include<utility>
#include<string>
#include<unordered_map>

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

using namespace std;

#define min_3(a, b, c) min(a, min(b, c))
#define max_3(a, b, c) max(a, max(b, c))
typedef long long ll;

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

    int ans = 0;
    for(int i = 0; i < n; i++){
        ans += b[a[i]-1];
    }
    for(int i = 0; i < n-1; i++){
        if(a[i+1] == a[i]+1){
            ans += c[a[i]-1];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;

/**
 * Network Flow - Maximum Flow
 */
public class Main {

	static final int INF = 1 << 29;

	static List<List<Edge>> G;
	static boolean[] used;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		line = br.readLine();

		int V = Integer.parseInt(line.substring(0, line.indexOf(' ')));
		int E = Integer.parseInt(line.substring(line.indexOf(' ') + 1));

		G = new ArrayList<>();

		for (int i = 0; i < V; i++) {
			G.add(new ArrayList<>());
		}

		for (int i = 0; i < E; i++) {
			StringTokenizer st = new StringTokenizer(br.readLine());

			int u, v, c;
			u = parseInt(st.nextToken());
			v = parseInt(st.nextToken());
			c = parseInt(st.nextToken());

			G.get(u).add(new Edge(v, c, G.get(v).size()));
			G.get(v).add(new Edge(u, 0, G.get(u).size() - 1));
		}

		int ans = 0;

		while (true) {
			used = new boolean[V];
			int f = rec(0, V - 1, INF);
			if (f == 0) break;
			ans += f;
		}

		System.out.println(ans);
	}

	static int rec(int u, int v, int f) {

		if (u == v) return f;

		used[u] = true;

		for (Edge e : G.get(u)) {
			if (!used[e.to] && e.cap > 0) {
				int d = rec(e.to, v, Math.min(f, e.cap));
				if (d > 0) {
					e.cap -= d;
					G.get(e.to).get(e.rev).cap += d;
					return d;
				}
			}
		}

		return 0;
	}
}

class Edge {
	int to, cap, rev;

	public Edge(int to, int cap, int rev) {
		this.to = to;
		this.cap = cap;
		this.rev = rev;
	}
}

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

public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		while(true){
			int n = stdIn.nextInt();
			if(n==0){
				return;
			}
			boolean[] t = new boolean[2*n+1];
			boolean[] h = new boolean[2*n+1];
			Arrays.fill(h, true);
			h[0] = false;
			for(int i=0;i<n;i++){
				int tmp = stdIn.nextInt();
				t[tmp] = true;
				h[tmp] = false;
			}
			int tc = n;
			int hc = n;
			int f = 0;
			boolean turnT = true;
			boolean pay = false;
			while(true){
				pay = false;
				if(tc==0||hc==0){
					break;
				}
				if(turnT){
					for(int i=1;i<=2*n;i++){
						if(t[i]&&i>f){
							t[i] = false;
							tc--;
							pay = true;
							f = i;
							break;
						}
					}
					if(!pay){
						f = 0;
					}
					turnT = false;
				}
				else{
					for(int i=1;i<=2*n;i++){
						if(h[i]&&i>f){
							h[i] = false;
							hc--;
							pay = true;
							f = i;
							break;
						}
					}
					if(!pay){
						f = 0;
					}
					turnT = true;
				}			
			}
			int ts = 0;
			int hs = 0;
			for(int i=1;i<=2*n;i++){
				if(t[i]){
					ts++;
				}
				if(h[i]){
					hs++;
				}
			}
			System.out.println(hs);
			System.out.println(ts);
		}
	}
}

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

int main(){
  int d,n;
  cin >> d>>n;
  if(d==0){
    if(n==100){
      cout<< 101<<endl;
      return 0;
    }
    cout<< n<<endl;
  }else if(d==1){
    if(n==100){
      cout<<10100<<endl;
      return 0;
    }
    cout << n*100<<endl;
  }else if(d==2){
    if(n==100){
      cout<<1010000<<endl;
      return 0;
    }
    cout << n*10000<<endl;
  }
  return 0;
}

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

ll get_min_dist(ll start, ll goal, const vector<vector<ll>>& cs)
{
    vector<ll> dp(10, 1e9);
    vector<ll> dp_n(10, 1e9);

    dp[start] = 0;
    for (ll i = 0; i < 10; ++i) {
        for (ll j = 0; j < 10; ++j) {
            for (ll k = 0; k < 10; ++k) {
                dp_n[k] = min(dp_n[k], dp[j] + cs[j][k]);
            }
        }
        dp = move(dp_n);
        dp_n.assign(10, 1e9);
    }

    return dp[goal];
}

void main_()
{
    ll H, W;
    cin >> H >> W;
    vector<vector<ll>> cs(10, vector<ll>(10));
    for (auto&& c : cs) {
        copy_n(istream_iterator<ll>(cin), 10, begin(c));
    }
    vector<vector<ll>> As(H);
    for (ll i = 0; i < H; i++) {
        copy_n(istream_iterator<ll>(cin), W, back_inserter(As[i]));
    }

    vector<ll> min_dists_to_1(10);
    for (ll i = 0; i < 10; i++) {
        min_dists_to_1[i] = get_min_dist(i, 1, cs);
    }

    ll ans = 0;
    for (ll i = 0; i < H; i++) {
        ans += accumulate(
            begin(As[i]), end(As[i]),
            0LL, [&min_dists_to_1](auto acc, auto n) {
                return acc + ((n < 0) ? 0 : min_dists_to_1[n]);
            });
    }

    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <locale>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include <map>

using namespace std;

int N;
string S[100];
 
int main(void) {
  cin >> N;
  for(int i = 0;i < N;i ++) cin >> S[i];
 
  int cnt = 0;
  for(int i = 0; i < N ; i++) {
    if(S[i] == "A") cnt++;
    if(S[i] == "Un") {
      cnt--;
      if(cnt < 0) break;
    }
  }
  cout << (cnt == 0 ? "YES" : "NO") << endl;
 
  return 0;
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for (int i = 1; i < (int)(n); i++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define vout(x) rep(i,x.size()) cout << x[i] << " "
template<class T> bool chmin(T &a, T b) {if(a>b) {a=b;return 1;}return 0;}
template<class T> bool chmax(T &a, T b) {if(a<b) {a=b;return 1;}return 0;}
using namespace std;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<int,int>;
const int inf = 1e9;
const ll inf_l = 1e18;
const int MAX = 1e5;

struct data{int s, t, c;};

int main() {
    int n, C; cin >> n >> C;
    vector<data> sec;
    vector<map<int,int>> ct(C);
    rep(i,n) {
        int s, t, c; cin >> s >> t >> c;
        c--;
        ct[c][s]++; ct[c][t]++;
    }
    vint c(MAX+5);
    rep(i,C) {
        int flag = 1;
        for (P x : ct[i]) {
            if (x.second == 2) continue;
            if (flag == 1) c[x.first-1]++;
            else c[x.first]--;
            flag *= -1;
        }
    }
    vint cover(MAX+5);
    cover[0] = c[0];
    REP(i,MAX+5) cover[i] += cover[i-1]+c[i];
    int ans = 0;
    rep(i,MAX+5) ans = max(ans,cover[i]);
    cout << ans << endl;
}

Measured memory_bytes: 10368
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).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; }

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n,t;cin>>n>>t;
  vector<int>a(n),ma(n+1);
  rep(i,n){
    cin>>a[i];
  }

  rep(i,n){
    int ti=n-i;
    ma[ti-1]=max(a[ti-1],ma[ti]);
  }
  int li=0;
  rep(i,n){
    chmax(li,ma[i+1]-a[i]);
  }
//  cout<<li<<endl;
  int res=0;
  rep(i,n)
  {
    if(ma[i+1]-a[i]==li)res++;
  }
  cout<<res<<endl;



  return 0;

}


Measured memory_bytes: 1024
/*The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.*/

//PRABHJOT SINGH A.K.A. PRABHI
//~~~~~conquizztador~~~~~


#include<bits/stdc++.h>
using namespace std;
using lli = long long int;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
const int MOD = 1000000007;
const int MOD1 = 998244353;
const int maxn = 100010;
const int lim = (int)1e9;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n = 0, a = 0, b = 0;
	cin >> n >> a >> b;
	cout << (abs(a - b) & 1 ? "Borys" : "Alice") << endl;
}

Measured memory_bytes: 3552
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;
#define MAX 150
int main(){
    int n=0;
    int x[MAX];
    int y[MAX];
    double man =0.0;
    double you =0.0;
    double tye =0.0;
    double tri =0.0;
    double value =0.0;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&x[i]);
    }
    for(int i=0;i<n;i++){
        scanf("%d",&y[i]);
    }  
    for(int i=0;i<n;i++){
        if(x[i] - y[i] <0){
            man -= (double)(x[i] - y[i]);
        }else
        {
            man += (double)(x[i] - y[i]);
        }
    }
    
    for(int i=0;i<n;i++){
        you += (double) ((x[i]-y[i])*(x[i]-y[i]));
        }
        you = sqrt(you);
    for(int i=0;i<n;i++){
        if(tye < (x[i] - y[i])){
            tye =  (double)x[i] - y[i];
        }else if(tye <(double)(y[i] - x[i])){
            tye = (double)y[i] - x[i];
        }
    }
    for(int i=0;i<n;i++){
        if(x[i]-y[i] > 0){
            value =(double) (x[i]-y[i]);
            tri += value*value*value;
            value = 0.0;
        }else
        {
            value =(double) (y[i] - x[i]);
            tri += value*value*value;
            value = 0.0;
        }
        
    }
    tri = pow(tri,1.0/3.0);

    printf("%.5f\n",man);
    printf("%.5f\n",you);
    printf("%.5f\n",tri);
    printf("%.5f\n",tye);

    return 0;
}


Measured memory_bytes: 3396
import sys
# from collections import deque, defaultdict, Counter
# from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
# from itertools import permutations, combinations, product
# from operator import itemgetter, mul
# from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

H, W = MAP()
S = [input() for _ in range(H)]

L = [[0]*W for _ in range(H)]
R = [[0]*W for _ in range(H)]
D = [[0]*W for _ in range(H)]
U = [[0]*W for _ in range(H)]

for i in range(H):
	for j in range(W):
		if S[i][j] == '#':
			L[i][j] = 0
		elif j == 0:
			L[i][j] = 1
		else:
			L[i][j] = L[i][j-1] + 1

for i in range(H):
	for j in range(W-1, -1, -1):
		if S[i][j] == '#':
			R[i][j] = 0
		elif j == W-1:
			R[i][j] = 1
		else:
			R[i][j] = R[i][j+1] + 1

for i in range(H):
	for j in range(W):
		if S[i][j] == '#':
			U[i][j] = 0
		elif i == 0:
			U[i][j] = 1
		else:
			U[i][j] = U[i-1][j] + 1

for i in range(H-1, -1, -1):
	for j in range(W):
		if S[i][j] == '#':
			D[i][j] = 0
		elif i == H-1:
			D[i][j] = 1
		else:
			D[i][j] = D[i+1][j] + 1

ans = 0
for i in range(H):
	for j in range(W):
		ans = max(ans, L[i][j]+R[i][j]+U[i][j]+D[i][j]-3)

print(ans)


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16
#define mod 1000000007

int N;
vector<P> g[100010];
int dist[2][100010];
int s,t;
int mxl[100010],mxr[100010];
multiset<int> mxlst,mxrst;
vector<int> vs;
int dia,res;

void dfs(int v,int pre,int dep,int i){
  dist[i][v]=dep;
  for(P p : g[v]){
    if(p.fi==pre)continue;
    dfs(p.fi,v,dep+p.se,i);
  }
}

void dfs2(int v,int pre,int i){
  maxch(mxl[i],dist[0][v]);
  maxch(mxr[i],dist[1][v]);
  for(P p : g[v]){
    if(p.fi==pre){
      maxch(res,p.se+dia);
      continue;
    }
    dfs2(p.fi,v,i);
  }
}

int main(){
  cin>>N;
  rep(i,N-1){
    int p,w;
    cin>>p>>w;
    g[i+1].push_back(P(p,w));
    g[p].push_back(P(i+1,w));
  }
  dfs(0,-1,0,0);
  s=0;
  rep(i,N)if(dist[0][i]>dist[0][s])s=i;
  dfs(s,-1,0,0);
  t=0;
  rep(i,N)if(dist[0][i]>dist[0][t])t=i;
  dfs(t,-1,0,1);

  while(t!=s){
    for(P p : g[t]){
      if(dist[0][p.fi]<dist[0][t]){
        dia+=p.se;
        vs.push_back(t);
        t=p.fi;
      }
    }
  }
  vs.push_back(s);
  reverse(all(vs));
  int M=vs.size();

  rep(i,M){
    int v=vs[i];
    mxl[i]=dist[0][v];
    mxr[i]=dist[1][v];
    for(P p : g[v]){
      if(i>0&&vs[i-1]==p.fi)continue;
      if(i<M-1&&vs[i+1]==p.fi)continue;
      dfs2(p.fi,v,i);
    }
    mxrst.insert(mxr[i]);
  }

  rep(i,M-1){
    int u=vs[i],v=vs[i+1];
    mxlst.insert(mxl[i]);
    mxrst.erase(mxrst.find(mxr[i]));
    for(P p : g[u]){
      if(p.fi==v){
        if(mxrst.size())maxch(res,p.se+*mxrst.rbegin());
        if(mxlst.size())maxch(res,p.se+*mxlst.rbegin());
      }
    }
  }
  
  cout<<res<<endl;

  return 0;
}



Measured memory_bytes: 23296
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		sc.close();

		int ans1 = Math.min(A,B);
		int ans2 = 0;

		int num = Math.abs(A+B)-N;
		if(num>0)ans2=num;

		System.out.println(ans1+" "+ans2);

	}

}


Measured memory_bytes: 21716
//============================================================================
// Name        : Hello.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main() {


	int a;
	string s;

	cin>>a>>s;

	if(a>=3200){
		cout<<s<<endl;
	}else{
		cout<<"red"<<endl;
	}


	return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[]$) {
        int n = scanner.nextInt();
        int maxi = n, maxi2 = n;
        int[] a = new int[n + 1];
        for (int i = 0; i < n; i++) {
            a[i] = scanner.nextInt();
            if (a[i] >= a[maxi]) {
                maxi2 = maxi;
                maxi = i;
            } else if (a[i] >= a[maxi2]) {
                maxi2 = i;
            }
        }
        for (int i = 0; i < n; i++) {
            System.out.println(i == maxi ? a[maxi2] : a[maxi]);
        }
    }
}

Measured memory_bytes: 87316
#include <bits/stdc++.h>
#define ll long long
#define MOD 998244353LL

using namespace std;

int main() {
  int n, s;
  ll o = 0;
  scanf("%d %d", &n, &s);
  vector<vector<ll>> dp(2, vector<ll>(s + 1));
  vector<int> a(n);
  for(int i = 0; i < n; i++) scanf("%d", &a[i]);
  dp[0][0] = 1;
  for(int i = 0; i < n; i++) {
    dp[i + 1 & 1] = vector<ll>(s + 1);
    for(int j = 0; j <= s; j++) {
      dp[i + 1 & 1][j] += dp[i & 1][j];
      if(j - a[i] >= 0)
        dp[i + 1 & 1][j] = (dp[i + 1 & 1][j] + dp[i & 1][j - a[i]]) % MOD;
    }
    dp[i + 1 & 1][0]++;
    o = (o + dp[i + 1 & 1][s]) % MOD;
  }
  printf("%lld\n", o);
}

Measured memory_bytes: 384
#include "iostream"
#include "string"
#include "vector"
#include "algorithm"
#define INPUT_NUM 5

int main()
{
  std::vector<int> input;
  for (int i=0; i<INPUT_NUM; i++)
  {
    std::string inputStr = "";
    std::cin >> inputStr;
    int num = std::stoi(inputStr);
    input.push_back(num);
  }
  
  std::string inputStr = "";
  std::cin >> inputStr;
  int maxDist = std::stoi(inputStr);
  
  std::string result = "Yay!";
  std::sort(input.begin(), input.end());
  if ( ( input.back() - input.front() ) > maxDist )
  {
    result = ":(";
  }
  
  std::cout << result;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<utility>
#include<memory>
#include<cmath>
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define pb push_back
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
const int mod=1e9+7;
const int INF=1<<30;
const int MAX_N=100003;

ll a[MAX_N];

ll calc(ll a[],int N,int flag){
  ll S=0,ans=0;
  rep(i,N){
    S+=a[i];
    if(flag==1){//今回のSはプラス
      flag=-1;
      if(S>0) continue;
      else{
        ans+=1-S;
        //cout << ans << endl;
        S=1;
      }
    }else{//今回はマイナス
      flag=1;
      if(S<0) continue;
      else{
        ans+=S+1;
        //cout << ans << endl;
        S=-1;
      }
    }
  }
  return ans;
}

int main(){
  int N;
  cin >> N ;
  ll S=0;
  int flag=0;
  rep(i,N)  cin >> a[i] ;
  
  ll ans=min(calc(a,N,1),calc(a,N,-1));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1024
// #pragma GCC optimize("unroll-loops", "omit-frame-pointer", "inline")
// #pragma GCC option("arch=native", "tune=native", "no-zero-upper")
// #pragma GCC
// target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("tree-vectorize","openmp","predictive-commoning")
// #pragma GCC option("D_GLIBCXX_PARALLEL","openmp")

// #pragma GCC optimize("O3")
// #pragma GCC target("avx2")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
// #define int long long
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000               // 2e9
#define LLINF 2000000000000000000ll  // 2e18 (llmax:9e18)
#define fi first
#define sec second
#define all(x) (x).begin(), (x).end()
#define sq(x) ((x) * (x))
#define dmp(x) cerr << #x << ": " << x << endl;

template <class T>
void chmin(T &a, const T &b) {
  if (a > b) a = b;
}
template <class T>
void chmax(T &a, const T &b) {
  if (a < b) a = b;
}

template <class T>
using MaxHeap = priority_queue<T>;
template <class T>
using MinHeap = priority_queue<T, vector<T>, greater<T>>;
template <class T>
vector<T> vect(int len, T elem) {
  return vector<T>(len, elem);
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.fi << ',' << p.sec;
  return os;
}
template <class T, class U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.fi >> p.sec;
  return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) {
    os << vec[i];
    if (i + 1 < vec.size()) os << ' ';
  }
  return os;
}
template <class T>
istream &operator>>(istream &is, vector<T> &vec) {
  for (int i = 0; i < vec.size(); i++) is >> vec[i];
  return is;
}
void fastio() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  cout << fixed << setprecision(20);
}

#define endl "\n"

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  cin >> a;
  vector<int> l = a, r = a;
  for (int i = 1; i < n; i++) {
    l[i] = l[i] ^ l[i - 1];
    r[n - 1 - i] = r[n - 1 - i] ^ r[n - i];
  }
  for (int i = 0; i < n; i++) {
    int L = (i == 0) ? 0 : l[i - 1];
    int R = (i == n - 1) ? 0 : r[i + 1];
    cout << (L ^ R);
    if (i + 1 < n)
      cout << ' ';
    else
      cout << endl;
  }
  return;
}

signed main() {
  fastio();
  solve();
  // int t; cin >> t; while(t--)solve();

  // int t; cin >> t;
  // for(int i=1;i<=t;i++){
  //   cout << "Case #" << i << ": ";
  //   solve();
  // }
  return 0;
}


Measured memory_bytes: 5556
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int i,l,n,r;
    int c=0,c1=0,j;
    cin>>s;
    n=s.size();
    l=((n-1)/2)-1;
    r=((n+3)/2)-1;
    for(i=0,j=l;j>=0;i++,j--){
        if(s[i]!=s[j]){
            c=1;
            break;
        }
    }
    for(i=r,j=n-1;i<n;i++,j--){
        if(s[i]!=s[j]){
            c1=1;
            break;
        }
    }
    int c3=0;
    for(i=0,j=n-1;j>=0;i++,j--){
        if(s[i]!=s[j]){
            c3=1;
            break;
        }
    }
    if(c==0 && c1==0 && c3==0){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
/**
 *  author: abhiy13
 *  created: 07.07.2019 17:33:36
**/
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vector<vector<int>> ar(n, vector<int>(k));
  for(auto &x: ar) for (auto &y: x) cin >> y;
  auto can = [&](int i, int j) -> bool {
    double res = 0.00;
    for(int x = 0; x < k; ++x) {
      res += 1.0 * (ar[i][x] - ar[j][x]) * (ar[i][x] - ar[j][x]);
    }
    res = sqrt(res);
    int a = (int) floor(res);
    int b = (int) ceil(res);
    if(res < 0 || a != b) return false;
    return true;
  };
  int res = 0;
  for(int i = 0; i < n; ++i) {
    for(int j = i + 1; j < n; ++j) {
      res += int(can(i, j));
    }
  }
  cout << res << '\n';
  return 0;
}

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

#define ll long long int
#define pb push_back
#define f(i,x,y) for(i=x;i<y;i++)
#define vll vector<ll>
#define fast    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl

void solve()
{
    ll n;
    cin>>n;
    if(n==0)
        cout<<"1"<<endl;
    else
        cout<<"0"<<endl;
}

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

Measured memory_bytes: 3648
#include <stdio.h>
int main()
{
int n,i,j,k,a[10000],sum=0,temp;
scanf("%d",&n);
for(i=0;i<=n-1;i++)
scanf("%d",&a[i]);
for(i=0;i<=n-2;i++)
for(j=i+1;j<=n-1;j++)
if(a[i]<a[j])
{temp=a[j];
a[j]=a[i];
a[i]=temp;}
for(i=0;i<=n-3;i++)
 for(j=i+1;j<=n-2;j++)
  for(k=j+1;k<=n-1;k++)
  if(a[i]<a[j]+a[k])
  sum++;
  printf("%d",sum);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
   long long int a,b,x,flag=0;
   cin>>a>>b>>x;
   flag=b/x;
   flag-=(a/x);
   if(a%x==0)
       flag++;
   cout<<flag<<endl;
   return 0;
}


Measured memory_bytes: 3484
#include <bits/stdc++.h>
using namespace std;
#define watch(x) cerr <<"\e[91m"<<__func__<<": "<< #x << " = " << x <<"\e[39m"<< "\n"
typedef long long ll;


int main()
{
#ifndef ONLINE_JUDGE
    freopen("../io/in.txt", "r", stdin);
    //freopen("../io/out.txt", "w", stdout);
#endif // ONLINE_JUDGE

    ll n, m, k;
    cin >> n >> m >> k;
    vector< ll > a(n), b(m), asum(n+1), bsum(m+1);
    for(int i=0; i<n; i++) cin >> a[i];
    for(int i=0; i<m; i++) cin >> b[i];

    asum[0] = bsum[0] = 0;
    for(int i=0; i<n; i++) asum[i+1] = asum[i]+ a[i];
    for(int i=0; i<m; i++) bsum[i+1] = bsum[i] + b[i];

    int ans = 0, took;
    ll rest;

    int left, right, mid;

    for(int i=0; i<=n; i++) {
        rest = k - asum[i];
        // watch(rest);
        if(rest < 0) continue;
        // took = i;

        int inb = lower_bound(bsum.begin(), bsum.end(), rest) - bsum.begin();

        if(inb > m || bsum[inb] > rest) inb--;
        // watch(i+inb);
        ans = max(ans, i+inb);
    }

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


Measured memory_bytes: 9576
N,K = map(int,input().split())
h = []
ans = 10**10
for i in range(N):
    tmp = int(input())
    h.append(tmp)
h = sorted(h)[::-1]
for i in range(N-K+1):
    ans = min(h[i]-h[i+K-1],ans)
print(str(ans))

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

#include <cstdlib>  // abs() for integer 絶対値求めやつ

#include <cmath>    // abs() for float, and fabs()

#include <algorithm>

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

#define ic(n) int (n); cin>>(n);

#define SORT(a) sort((a).begin(),(a).end());

#define che(a,string) cout<<string<<":"<<(a)<<endl;

#define ch(a,string) cout<<string<<":"<<(a)<<" ";

using namespace std;

typedef pair<int,int> P;

int main(){
//n以上で3桁が同じ値の整数を出力するとりあえず、１００の位をもらうか。
	ic(n);
	int a = n/100;
	//aに100の位の数字が入ったので、それを10の位と1の位に入れよう。
	int s=100*a+10*a+a;
	if(s>=n){
		cout<<s<<endl;
	  }
	  else {
		  cout<<s+111<<endl;
		}

  }

Measured memory_bytes: 256
/**
 *    author:  Mohamad Milhem
**/

#include <bits/stdc++.h>
#include <stdio.h>

using namespace std;
typedef long long ll;

#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define mp make_pair
#define pb push_back
#define lp(i,s,f) for(ll i = s; i < ll(f); i++)
#define inF freopen("input.in", "r", stdin);
#define outF freopen("output.in", "w", stdout);
#define MOD ll(1000000007)
#define debug(x) cout << '[' << #x << " is: " << x << "] " <<endl;
#define decimalpoint cout << std::fixed << setprecision(5)


void solve(){
	string s,t;
	cin >> s >> t;
	int maxx = 0;


	for (int i = 0 ; i < s.size() - t.size() + 1; i++){
		int cont = 0;
		for (int j = 0 ; j < t.size() ; j++){
			if (s[i+j] == t[j])cont++;
		}
		maxx = max(cont, maxx);
	}


	cout << t.size() - maxx << endl;



}



int main()
{
    FAST;
    int t;
    t = 1;

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


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

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

int main() {
    int n; cin >> n;
    double ans = 0;
    int a;
    rep(i, n){
        cin >> a;
        ans += 1.0/a;
    } 
    cout << 1.0/ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int a, b;
    scanf("%d%d",&a, &b);

    if (a == b) {
        printf("a == b\n");
    } else if (a < b) {
        printf("a < b\n");
    } else {
        printf("a > b\n");
    }

    return 0;
}



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

int main(){

	# ifdef FILEs
		freopen( "input.txt", "r", stdin );
		freopen( "output.txt", "w", stdout );
	# endif
	ios_base::sync_with_stdio( false );
	int a, b;
	cin >> a >> b;
	if(a > b ){
		for( int i = 1; i <= a; i ++ )cout << b;		
	}else{
		for( int i = 1; i <= b; i ++ ) cout << a;
	}
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iterator>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {

	int N;
	cin >> N;
	vector<string> W(N);
	for (int i = 0; i < N; i++) {
		cin >> W[i];
		if (i >= 1) {
			//前の単語の最後の文字と今の単語の最初の文字が同じではない
			if (W[i][0] != W[i - 1][W[i - 1].size() - 1]) {
				cout << "No";
				return 0;
			}
			//今までにあった単語である
			for (int j = 0; j < i; j++) {
				if (W[j] == W[i]) {
					cout << "No";
					return 0;
				}
			}
		}
	}
	cout << "Yes";

	//前の単語の最後の文字と今の単語の最初の文字が同じか
	//今までにない単語か
	return 0;
}

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

using namespace std;
typedef long long int ll;

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

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

ll count(ll x, ll y){
    ll big;
    ll small;
    ll _x = x;
    ll _y = y;
    while (x > 0 and y > 0){
        big = max(x,y);
        small = min(x,y);
        x = big % small;
        y = small;
    }
    return _x*_y / max(x, y);
}


int main(void){
    ll a; ll b; ll c; ll d; cin >> a >> b >> c >> d;
    ll le_b = b - b/c - b/d + b/count(c, d);
    ll lt_a = (a-1) - (a-1)/c - (a-1)/d + (a-1)/count(c, d);
    cout << le_b - lt_a << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main {

  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);

    double W = sc.nextInt();
    double H = sc.nextInt();
    double x = sc.nextInt();
    double y = sc.nextInt();
    double ans = W * H / 2;
    int b;
    if (W / 2 == x && H / 2 == y) b = 1;
    else b = 0;
    System.out.println(ans + " " + b);
  }
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);


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

    int n,k;
    cin >> n >> k;
    int sum=(n-1)*(n-2)/2;
    if (k>sum) {
        cout << -1 << endl;
    } else {
        cout << n-1+sum-k << endl;
        repr(i,2,n+1) cout << 1 << ' ' << i << endl;
        int cnt=0;
        bool flag=0;
        repr(i,2,n) {
            repr(j,i+1,n+1) {
                if (cnt>=sum-k) {
                    flag=1;
                    break;
                }
                cout << i << ' ' << j << endl;
                ++cnt;
            }
            if (flag) break;
        }
    }
        
    
    return 0;   
}

Measured memory_bytes: 3620
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int y = sc.nextInt();
        boolean check = false;
        String answer = "";
        for(int i = 0; i <= n ; i++) {
            for(int j = 0; j <= n - i; j++) {
                if((i*10000 + j*5000 + (n - i - j)*1000) == y) {
                    answer = i + " " + j + " " + (n - i - j);
                    check = true;
                }
            }
        }
        if(check) {
            System.out.println(answer);
        } else {
            System.out.println("-1 -1 -1");
        }
    }
}

Measured memory_bytes: 24020
// 2
//
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

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

using namespace std;

int main(){
  int N;
  cin >> N;
  int cnt = 0;
  while(true){
    if(N < 3) break;
    N -= 3;
    cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))

cnt = sum(i < 0 for i in a)
ans = sum(abs(i) for i in a)
if cnt % 2 == 0:
    print(ans)
elif cnt % 2 == 1:
    print(ans - 2 * min(abs(i) for i in a))


Measured memory_bytes: 85344
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))
D.sort()
T.sort()
from collections import deque
D = deque(D)
T = deque(T)
while T:
    t = T.popleft()
    flag = False
    while D:
        new = D.popleft()
        if new == t:
            flag = True
            break
    if not flag:
        print('NO')
        exit()
print('YES')


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

int main(){
    int a, b, t, n;
    double tt, i;

    cin >> a >> b >> t;

    tt = t + 0.5;
    n = 0;
    while(tt > i){
        n++;
        i = n*a; 
    }

    int ans = (n-1)*b;
    cout << ans <<"\n";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
ll modexpo(ll a,ll b)
{
     ll ans=1LL;
     while(b>0)
     {
          if(b&1)ans=(ans*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return ans;
}
 
 
 
 
 
 
 



int main()
{
     int n;
     cin>>n;
     vector<ll> a(n);
     for(int i=0;i<n;i++){cin>>a[i];}
     reverse(a.begin(),a.end());
     multiset<ll> st;
     st.insert(a[0]);
     for(int i=1;i<n;i++){
          auto itr=st.upper_bound(a[i]);
          if(itr==st.end())st.insert(a[i]);
          else {
               st.erase(itr);st.insert(a[i]);
          }
     }
     cout<<st.size();
     
}






























Measured memory_bytes: 8648