akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rngll(chrono::steady_clock::now().time_since_epoch().count());
template<typename T> T ctmax(T &x, const T &y){ return x = max(x, y); }
template<typename T> T ctmin(T &x, const T &y){ return x = min(x, y); }
template<typename T> using Tree = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



int main(){
	cin.tie(0)->sync_with_stdio(0);
	int n, r;
	cin >> n >> r;
	if(n >= 10){
		cout << r;
	}
	else{
		cout << r + 100 * (10 - n);
	}
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>

using namespace std;

typedef pair<long long int, long long int> P;

long long int INF = 1e18;
long long int MOD = 1e9 + 7;

int main(){
	
	int N, K;
	cin >> N >> K;
	
	long long int a[1100];
	
	for(int i = 0; i < N; i++){
		cin >> a[i];
	}
	
	vector<long long int> v;
	
	for(int i = 0; i < N; i++){
		long long int S = 0;
		for(int j = i; j < N; j++){
			S += a[j];
			v.push_back(S);
		}
	}
	
	sort(v.begin(), v.end());
	
	long long int thr = 0;
	for(int i = 40; i >= 0; i--){
		thr += (1LL << i);
		int cnt = 0;
		for(int j = 0; j < v.size(); j++){
			if((thr & v[j]) == thr){
				cnt += 1;
			}
		}
		if(cnt < K){
			thr -= (1LL << i);
		}
	}
	
	cout << thr << endl;
	
	return 0;
}


Measured memory_bytes: 6256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,d;
    cin>>n>>d;
    ll x,y;
    ll c=0;
    for(ll i=0;i<n;i++)
    {
        cin>>x>>y;
        ll p=(x*x+y*y);
        if(p<=d*d)
        {
            c++;
        }

    }
    cout<<c<<"\n";
}


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

int main() {
  int e,z,L;
  cin >> e >> z;
  if(e >= 10){
    cout << z <<endl;
    return 0;
  }
  else{
    cout << 100 * (10 - e) + z <<endl;
  }
}

Measured memory_bytes: 3568
module Main where

import Data.List
import qualified Data.Map.Strict as Map
import Control.Monad
import Data.Ord

main = do
    print =<< solve <$> readInts

readInts :: IO [Int]
readInts = ((map read) . words) <$> getLine


solve :: [Int] -> Int
solve [h, a] = div (h + a - 1) a



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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

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

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u; return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

void Main() {
	int H, W; cin >> H >> W;
	vector<string> A(H); cin >> A;
	queue<Pi> que;
	vvint mc(H, vint(W, -1));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (A[i][j] == '#') {
				que.emplace(i, j);
				mc[i][j] = 0;
			}
		}
	}
	int ans = 0;
	while (!que.empty()) {
		int y, x;
		tie(y, x) = que.front(); que.pop();
		for (int i = 0; i < 4; i++) {
			int ny = y + dy[i], nx = x + dx[i];
			if (!isin(ny, nx, H, W) || mc[ny][nx] != -1) continue;
			mc[ny][nx] = mc[y][x] + 1;
			chmax(ans, mc[ny][nx]);
			que.emplace(ny, nx);
		}
	}
	cout << ans << endl;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 13456
//
// Created by misclicked on 2020/3/14.
//

#include <bits/stdc++.h>

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

#define ONLINE_JUDGE
#ifdef ONLINE_JUDGE
#define cerr if (false) cerr
#endif

int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("debug.txt", "w", stderr);
#else
    ios_base::sync_with_stdio(false);
    cin.tie();
#endif
    ll a, b;
    cin >> a >> b;
    if (a == 1 || b == 1) {
        cout << 1 << endl;
    } else
        cout << (a * b + 1) / 2ll << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
typedef long long int ll;
typedef unsigned long long int ull;
const long long int m=pow(10,9)+7;

int main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    ll ans=0,c=0;
    cin>>s;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='W')
        {
            ans+=i-c;
            c++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3704
#include "bits/stdc++.h"
using namespace std;
const int MOD = 1e9 + 7;
typedef long long lint;
typedef pair<int,int> P;
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define rep(i, n) for (lint i = 0; i < (n); i++)
#define INF LLONG_MAX
#define all(x) (x).begin(),(x).end()
#define pb push_back
int main(){
    int n;
    cin>>n;
    vector<int> v;
    rep(i,n){
        int a;
        cin>>a;
        v.pb(a);
    }
    sort(v.rbegin(),v.rend());
    int count=0;
    lint ans=1;
    rep(i,n-1){
        if(count==2){
            break;
        }
        if(v[i]==v[i+1]){
            ans*=v[i];
            count++;
            i++;
        }
    }
    if(count<2){
        cout<<0<<endl;
    }else{
        cout<<ans<<endl;
    }
    return 0;
}


Measured memory_bytes: 892
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let (a,b) = get!(usize, usize);
    if a >= 13 {
        println!("{}", b);
    } else if a >= 6 {
        println!("{}", b/2);
    } else {
        println!("0");
    }
}


Measured memory_bytes: 8572
//incomplete......
#include<bits/stdc++.h>
using namespace std;
int main()
{
    double a,r;
    double are,cir,pi=3.1415926535897932384626433832795;
    while(cin >> r)
    {
        are=pi*r*r;
        cir=2*pi*r;     //circumstances...
        //cout<<are<<" "<<cir<<endl;
        printf("%.15lf %.15lf\n",are,cir);
    }
    return 0;
}


Measured memory_bytes: 3208
nums = list(map(int, input().split()))
mv = input()


class die:
    face = [0, 0, 0, 0, 0, 0]

    def __init__(self, nums):
        self.face = [nums[f] for f in [0, 3, 1, 2, 4, 5]]

    def roll(self, d):
        c_face = list(self.face)

        if d == 'S':
            self.face = [c_face[f] for f in [4, 1, 0, 3, 5, 2]]
        elif d == 'N':
            self.face = [c_face[f] for f in [2, 1, 5, 3, 0, 4]]
        elif d == 'W':
            self.face = [c_face[f] for f in [3, 0, 2, 5, 4, 1]]
        elif d == 'E':
            self.face = [c_face[f] for f in [1, 5, 2, 0, 4, 3]]


d = die(nums)
for m in mv:
    d.roll(m)
print(d.face[0])



Measured memory_bytes: 5604
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#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;
 
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
 
 
#define F first
#define S second
#define ll long long
#define pb push_back
#define db double
#define ld long double
#define ppb pop_back
#define pii pair<int, int>
#define pll pair<long long, long long>
#define piii pair<int, pii>
#define all(x) (x).begin(),(x).end()
#define __ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define watch(x) cout << (#x) << " is " << (x) << endl
#define rep(i, a, n) for (int i = a; i <= n; i++)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define int long long
 
const int N = 1e5 + 1, inf = 2e9 + 7, mod = 1e9 + 7;
const ll INF = 2e18 + 7, MOD = 1e15 + 7;

int a[101];
int dp[101][N], pref[101][N];

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

int sub(int a, int b) {
    return add(a, -b);
}

signed main() { __
//    freopen("lcm.in", "r", stdin);
//    freopen("lcm.out", "w", stdout);
    int n, k;
    cin >> n >> k;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i <= a[1]; i++) dp[1][i] = 1;
    for (int i = 0; i <= k; i++) {
        if(i) {
            pref[1][i] = add(pref[1][i - 1], dp[1][i]);
        }
        else pref[1][i] = dp[1][i];
    }
    for (int i = 2; i <= n; i++) {
        for (int j = 0; j <= k; j++) {
            if(j - a[i] - 1 < 0) {
                dp[i][j] = pref[i - 1][j];
            }
            else
                dp[i][j] = sub(pref[i - 1][j], pref[i - 1][j - a[i] - 1]);
        }
        for (int j = 0; j <= k; j++) {
            if(!j) pref[i][j] = dp[i][j];
            else pref[i][j] = add(pref[i][j - 1], dp[i][j]);
        }
    }
    cout<<dp[n][k];
    return 0;
}



Measured memory_bytes: 157312
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define ff first
#define ss second
#define debug(x) cerr<<#x<<" : "<<x<<endl;
#define dbg2(x, y) cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl;
#define dbg3(x, y, z) cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl;
#define debugv(v) cerr <<endl; for(int i = 0; i<(int)(v.size()); i++){ cerr<<#v<<"["<<i<<"] = "<<v[i]<<endl;} cerr<<endl;
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define MOD 1000000007
#define BIGMOD 32361122672259149LL

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//functions - find_by_order(index) - returns iterator, order_of_key(key) - number of values less than key
using namespace __gnu_pbds;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll md(ll a) {
	return ((a%MOD)+MOD)%MOD;
}

ll po(ll a, ll b) {
	if (b==0) return 1LL;
	ll x = po(a, b>>1);
	x = md(x*x);
	if (b&1) x = md(x*a);
	return x;
}

void solve() {
	ll a, b, c, k;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &k);
	if (a>=k) {
		cout << k << endl;
	} else if ((a+b)>=k) {
		cout << a << endl;
	} else {
		cout << a-(k-(a+b)) << endl;
	}

}	

int main() {
	#ifdef LOCAL
	freopen("i.txt", "r", stdin);
	freopen("o.txt", "w", stdout);
	#endif

	// ios_base::sync_with_stdio(0);
	// cin.tie(0);


	int num_tests = 1;
	// scanf("%d ", &num_tests);
	// cin>>num_tests;

	for (int tc=1; tc<=num_tests; tc++) {
		// printf("Case #%d: ", tc);
		// cout << "Case #" << tc << ": ";
		solve();
	}
	printclock
	return 0;
}

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

int main(){
    int n;
    cin >> n;
    int c = log2(n);
    int ans = pow(2,c);
    cout << ans << endl;
}


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

int get_begin(int n) {
    while (n / 10 != 0) {
        n = n / 10;
    }
    return n;
}

int main() {
    int N; cin >> N;
    vector<vector<int> > mat(10, vector<int>(10, 0));
    for (int i=1; i<=N; i++) {
        int begin = get_begin(i);
        int end = i % 10;
        mat[begin][end]++;
    }
    int ans = 0;
    for (int i=0; i<10; i++) {
        for (int j=0; j<10; j++) {
            ans += mat[i][j] * mat[j][i];
        }
    }
    cout << ans << endl;
}

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

int main() {
	int n, l;
	cin >> n >> l;
	vector<string> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a.at(i);
	}

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

	for (int i = 0; i < n; i++) {
		cout << a.at(i);
	}
	cout << endl;
	return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;
using D = double;
using uint = unsigned int;
template<typename T>
using pair2 = pair<T, T>;

#ifdef WIN32
    #define LLD "%I64d"
#else
    #define LLD "%lld"
#endif

#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second

const int maxn = 100005;

char s[maxn];
int t[maxn];
int cnt[3], have[3];


int main()
{
    scanf("%s", s);
    int len = strlen(s);
    for (int i = 0; i < len; i++) cnt[s[i] - 'a']++;
    if (len == 1)
    {
        cout << "YES" << endl;
        return 0;
    }
    for (t[0] = 0; t[0] < 3; t[0]++)
    {
        for (t[1] = 0; t[1] < 3; t[1]++) if (t[0] != t[1])
        {
            for (int i = 2; i < len; i++) t[i] = 3 - t[i - 1] - t[i - 2];
            for (int i = 0; i < 3; i++) have[i] = cnt[i];
            for (int i = 0; i < len; i++) have[t[i]]--;
            if (*min_element(have, have + 3) == 0)
            {
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
    return 0;
}

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

const int N = 1e5+7;
int a[N];

bool exist(int x, int y) {
    return y < a[x];
}

bool solve(int x, int y) {
    bool down = exist(x+1, y);
    bool right = exist(x, y+1);
    bool corner = exist(x+1, y+1);

    if (!down && !right)         return false;
    else if (!down)              return (a[x]-y)%2 == 0;
    else if (!right)             return !solve(x+1, y);
    else if (corner)             return solve(x+1, y+1);
    else                         return !solve(x, y+1)  || !solve(x+1, y);
}

int main() {
    int n;
    cin>>n;

    for (int i=0; i<n; i++) cin>>a[i];
    sort(a, a+n);
    reverse(a, a+n);
    bool b = solve(0, 0);

    if (b)  cout<<"First\n";
    else    cout<<"Second\n";
}



Measured memory_bytes: 7100
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
string s,s1;
ll ar[250007],cr[200098],a,b, test, sum,t,x=0,p,q,y,i,j,k=0,l,cnteven=0,w=0,cnt,br[200008];
int main()
{
    ll test;

cin>>a;
if(a==22)
      cout<<"Christmas Eve Eve Eve"<<endl;
      if(a==23)
      cout<<"Christmas Eve Eve"<<endl;
      if(a==24)
      cout<<"Christmas Eve"<<endl;
      if(a==25)
      cout<<"Christmas"<<endl;
//    else
//        cout<<"1";






//cout<<"Yes"<<endl;
//cout<<"No"<<endl;

}





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

int main(){

	int N, M;
	std::cin >> N >> M;

	std::vector<std::set<int>>
		graph_( N, std::set<int>{} );

	//for( auto& e : graph_ )
	//	e.reserve( N );

	for( int i{}; i < M; ++i )
	{
		int a_, b_;
		std::cin >> a_ >> b_;
		--a_; --b_;

		graph_[a_].emplace( b_ );
		graph_[b_].emplace( a_ );

	}



	std::vector<int> visit_(N,-1);

	auto dfs_ = [&]( int i_, auto f_ )->int
	{
		const auto& cir_ = graph_[i_];

		visit_[i_] = 1;

		int ret_{1};
		for( auto e : cir_ )
			if( visit_[e] < 0 )
				ret_ += f_( e, f_ );

		return ret_ ;
	};


	int ans_{};
	for( int i{}; i < N; ++i )
		if( *std::next(visit_.begin(), i) < 0 )
		{
			const auto t_ = dfs_( i, dfs_ );
			ans_ = std::max( ans_, (int)t_ );
		}
	

	std::cout << ans_ << "\n";

	return 0;
}

Measured memory_bytes: 42588
#include <iostream>
#include <string>
#include <map>
#include <cmath>
using namespace std;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
typedef long long ll;
typedef long double ld;
#define MOD1 1000000007
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int main(){
  ll n,m,k,i,j,result=0;
  string s;
  ll yaku[1010]={0};
  cin >> n;
  for(i=2;i<=n;i++){
    //iの素因数分解
    ll tmp=i;
    for(j=2;j<=sqrt(i) && tmp>=2;j++){
      while(tmp%j==0){
        yaku[j]++;
        tmp /= j;
      }
    }
    if(tmp>=2){
      yaku[tmp]++;
      tmp=1;
    }
  }
  result=1;
  for(i=2;i<=n;i++){
    result *= yaku[i]+1;
    result %= MOD1;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  string s, t;
  cin >> s;
  cin >> t;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  reverse(t.begin(), t.end());
  if (s < t){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  int n,a,b,c,f,i;
  scanf("%d",&n);
  while(n--){
    b=0;c=0;f=1;
    for(i=0;i<10;i++){
      scanf("%d",&a);
      if(a>b) b=a;
      else if(a>c) c=a;
      else f=0;
    }
      if(f) puts("YES");
      else puts("NO");
  }
  return 0;
}

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

signed main(){
	int A,B,C,D; cin>>A>>B>>C>>D;
	if(A>C){swap(A,C); swap(B,D);}
	cout<<max(0LL,min((B-C), min(D-C , B-A)))<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
        #include <bitset>
        #include <cassert>
        #include <chrono>
        #include <cmath>
        #include <complex>
        #include <cstdio>
        #include <cstdlib>
        #include <cstring>
        #include <ctime>
        #include <deque>
        #include <functional>
        #include <iomanip>
        #include <iostream>
        #include <iterator>
        #include <limits>
        #include <climits>
        #include <list>
        #include <map>
        #include <numeric>
        #include <queue>
        #include <random>
        #include <ratio>
        #include <set>
        #include <sstream>
        #include <stack>
        #include <string>
        #include <unordered_map>
        #include <unordered_set>
        #include <utility>
        #include <vector>
        using namespace std;
         
        typedef long long ll;
        typedef long double LD;
        #define int ll
        #define double LD
        #define pb push_back
        #define mp make_pair
        #define REP(i,n) for (int i = 0; i < n; i++)
        #define loop(i,n) for (int i = 0; i < n; i++)
        #define FOR(i,a,b) for (int i = a; i < b; i++)
        #define REPD(i,n) for (int i = n-1; i >= 0; i--)
        #define FORD(i,a,b) for (int i = a; i >= b; i--)
        #define remax(a,b) a = max(a,b)
        #define remin(a,b) a = min(a,b)
        #define mem(a, b) memset(a, b, sizeof a)
        #define append push_back
        #define all(v) v.begin(),v.end()
        #define F first
        #define S second
        #define print(x) cout << (x) << endl
        #define PRECISION(x) cout << fixed << setprecision(x)
        #define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
        #define Test(){int t;cin >> t;for(int i=1;i<=t;i++){cout << "Case #" << i << ": ";solve();}}
        #define test(){int t; cin>>t; for(int i=1;i<=t;i++){solve();}}
        #define vi vector<int>
        #define vii vector<pair<int,int> > 
        #define vci vector<pair<char,int> >
        #define vic vector<pair<int,char> > 
        #define N 200005
        #define pb push_back
        const double PI=acos(-1);
        const int MOD = 1000000007;
        const int FMOD = 998244353;
        
        
        int n,k,a[N];
bool isSafe(int mid){
	int ans = 0;
	loop(i,n){
		if(a[i] <= mid)
			continue;
		ans+=a[i]/mid;
	}
	return ans<= k;
}
void solve(){
	cin >> n >> k;
	loop(i,n){
		cin >> a[i];
	}
	int beg = 1,end = *max_element(a,a+n),ans = -1;
	while(beg<=end){
		int mid = (beg+end)/2;
		if(isSafe(mid)){
			ans = mid;
			end = mid-1;
		}
		else
			beg = mid+1;
	}
	cout << ans;
}
        signed main()
        {
        	solve();
		}

Measured memory_bytes: 5196
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
using namespace std;
//---------------------------------------------------
//????????????????????????????????????
#define int long long
#define str string
typedef long long ll;
typedef long double ld;
const ll inf = 999999999999999999;
struct P {
	ll pos, cost;
};
bool operator<(P a, P b) { return a.cost < b.cost; }
bool operator>(P a, P b) { return a.cost > b.cost; }
struct B {
	ll to, cost;
};
ll gcm(ll i, ll j) {//?????§??¬?´???°
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcm(j%i, i);
}
//---------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++
int n, dp[5][4001];
signed main() {
	dp[0][0] = 1;
	for (int i = 0; i < 4; i++) {
		for (int j = 0; j <= 4000; j++) {
			for (int z = 0; z <= 1000; z++) {
				if (j + z > 4000)
					break;
				dp[i + 1][j + z] += dp[i][j];
			}
		}
	}
	while (cin >> n) {
		cout << dp[4][n] << endl;
	}
	getchar(); getchar();
}

Measured memory_bytes: 3228
#include<iostream>
#include<cstdio>
#include<cstring>
#include<map>
#include<cstdlib>
#include<stack>
#include<queue>
#include<algorithm>
#include<set>
#include<vector>
#include<cmath>
#include<string>
#include<deque>
#define lmid l,mid,rt<<1
#define rmid mid+1,r,rt<<1|1
using namespace std;
int main()
{
     long long a=2,b=1;
     int n;
     scanf("%d",&n);
     if(n==1) {printf("%lld\n",b);return 0;}
     for(int i=2;i<=n;i++)
     {
          b=a+b+b;a=(b-a)/2;
          b-=a;
     }
     printf("%lld\n",b);
     return 0;
}


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

class Node{
public:
	Node *child[26] = {};
	Node *head = NULL;
	int cnt[26] = {};
	Node *next(char s){
		Node *&ret = child[s-'a'];
		if(ret == NULL){
			ret = new Node();
			ret->head = this;
		}
		return ret;
	}
} *rt = new Node();

char *s = new char[1234567];
vector<char*> t;
bool u[26];

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

	REP(i, n){
		scanf("%s", s);
		int k = strlen(s);
		reverse(s, s+k);

		Node *cur = rt;
		REP(j, k)
			cur = cur->next(s[j]);

		fill(u, u+26, false);
		for(int j = k-1; j >= 0; j--){
			cur = cur->head;
			u[s[j] - 'a'] = true;
			REP(h, 26) cur->cnt[h] += u[h];
		}

		t.EB(s);
		s += k + 1;
	}
	
	ll ans = 0;
	for(char *s : t){
		int k = strlen(s);
		Node *cur = rt;
		REP(j, k-1)
			cur = cur->next(s[j]);
		ans += cur->cnt[s[k-1]-'a'] - 1;
	}
	printf("%lld\n", ans);
}





Measured memory_bytes: 332428
import sys


def main():
    input = sys.stdin.buffer.readline
    x = int(input())
    ans = 0
    if x <= 599:
        ans = 8
    elif x <= 799:
        ans = 7
    elif x <= 999:
        ans = 6
    elif x <= 1199:
        ans = 5
    elif x <= 1399:
        ans = 4
    elif x <= 1599:
        ans = 3
    elif x <= 1799:
        ans = 2
    elif x <= 1999:
        ans = 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9232
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
import java.util.Set;

public class Main {

	public static void main(String[] args) {
		execute7_4();
	}
	
	private static void execute7_4() {
		try (Scanner sc = new Scanner(System.in)) {
			String A = sc.next();
			String B = sc.next();
			int a = sc.nextInt();
			int b = sc.nextInt();
			
			String U = sc.next();
			
			if(U.equals(A)) {
				System.out.println((a-1)+" "+b);
			}else {
				System.out.println(a+" "+(b-1));
			}
		}
	}
}

Measured memory_bytes: 23636
#include <bits/stdc++.h>
  
using namespace std;
  
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
  
#define pb push_back
#define mp make_pair
#define cotu cout
#define itn int
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
  
#define ordered_set tree<int , null_type,less<int >, rb_tree_tag,tree_order_statistics_node_update> 
  
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
  
const int inf = int(1e9);
const int mod = inf + 7;
const int N = 1e6 + 555; // TL MB
const double PI = acos(-1.0);
 
void mul(ll &x, ll y){
	x *= y;
	if(x >= mod) x %= mod;
}
 
void add(ll &x, ll y){
	x += y;
	if(x >= mod) x -= mod;
	if(x < 0) x += mod;
}
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) mul(r, a);
		mul(a, a);
		n >>= 1;
	}
	return r;
}

ll get(ll x, ll y, ll z){
	return abs(x - y) + abs(y - z);
}
ll s[N], t[N], x[N];
void solve()
{
	int a, b, q;
	cin >> a >> b >> q;
	rep(i, a + a) s[i] = 1e18;
	rep(i, b + b) t[i] = 1e18;
	rep(i, a) cin >> s[i];
	rep(i, b) cin >> t[i];
	sort(s, s + a);
	sort(t, t + b);
	rep(i, q)
	{
		ll res = 1e12;
		cin >> x[i];
		int p1 = lower_bound(s, s + a, x[i]) - s;
		if(p1 != a){
			int p2 = lower_bound(t, t + b, s[p1]) - t;
			if(p2 != b){
				res = min(res, get(x[i], s[p1], t[p2]));
			}
			if(p2 != 0){
				res = min(res, get(x[i], s[p1], t[p2 - 1]));
			}
		}
		if(p1 != 0){
			int p2 = lower_bound(t, t + b, s[p1 - 1]) - t;
			if(p2 != b){
				res = min(res, get(x[i], s[p1 - 1], t[p2]));
			}
			if(p2 != 0){
				res = min(res, get(x[i], s[p1 - 1], t[p2 - 1]));
			}	
		}
		p1 = lower_bound(t, t + b, x[i]) - t;
		if(p1 != b){
			int p2 = lower_bound(s, s + a, t[p1]) - s;
			if(p2 != a){
				res = min(res, get(x[i], t[p1], s[p2]));
			}
			if(p2 != 0){
				res = min(res, get(x[i], t[p1], s[p2 - 1]));
			}
		}
		if(p1 != 0){
			int p2 = lower_bound(s, s + a, t[p1 - 1]) - s;
			if(p2 != a){
				res = min(res, get(x[i], t[p1 - 1], s[p2]));
			}
			if(p2 != 0){
				res = min(res, get(x[i], t[p1 - 1], s[p2 - 1]));
			}	
		}
		
		cout << res << '\n';
		
		
		
	}
}


 
 
int main()
{
    Red;
  	// int T; cin >> T; while(T--)
    solve();
    return 0;
}

Measured memory_bytes: 10368
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

#define MAX_LEN 13
#define OP_LEN 7
#define INIT ""
#define NIL (-1)
#define HASH_SIZE 1046527

typedef char* string;

typedef struct {
  string dict[HASH_SIZE];
} hash_map;

long get_key(const string target);
int h1(long key);
int h2(long key);
int find(const string target, const hash_map* map);
int insert(const string target, hash_map* map);

long get_key(const string target){
  int i;
  long result = 0;
  int length = (int)strlen(target);
  if(length > MAX_LEN) return -1;
  for(i = 0; i < length; i++){
    char c = target[i];
    result = result << 3;
    if(c == 'A'){
      result += 1;
    }else if(c == 'C'){
      result += 2;
    }else if(c == 'G'){
      result += 3;
    }else if(c == 'T'){
      result += 4;
    }
  }
  return result;
}

int h1(long key){
  return key % HASH_SIZE;
}

int h2(long key){
  return 1 + (key % (HASH_SIZE -1));
}

int insert(const string target, hash_map* map){
  long key = get_key(target);
  if(key == -1) return 0;
  int point, i = 0;
  while(1){
    point = ((h1(key) + i * h2(key))) % HASH_SIZE;
    string tmp = map -> dict[point]; 
    if(!strcmp(tmp, target)) return 0; //already exist
    if(!strcmp(tmp, INIT)){
      //insert target
      strcpy((map -> dict[point]), target);
      return 1;
    }
    if((++i) > HASH_SIZE) return 0; //hash map is full
  }
}

int find(const string target, const hash_map* map){
  long key = get_key(target);
  if(key == -1) return 0;
  int point, i = 0;
  while(1){
    point = ((h1(key) + i * h2(key))) % HASH_SIZE;
    string tmp = map -> dict[point]; 
    if(!strcmp(tmp, target)) return 1;
    if((!strcmp(tmp, INIT)) || ((++i) > HASH_SIZE)) return 0;
  }
}

int main(){
  int op_num, i;
  char op[OP_LEN];
  char str[MAX_LEN];
  hash_map map;
  //map????????????
  for(i = 0; i < HASH_SIZE; i++){
    map.dict[i] = (string) malloc(sizeof(char) * MAX_LEN);
    strcpy(map.dict[i], INIT);
  }

  scanf("%d", &op_num);

  for(i = 0; i < op_num; i++){
    scanf("%s %s", op, str);
    if(op[0] == 'i'){
      insert(str, &map);
      //if(!insert(str, &map)) printf("fail insert %s \n", str);
    }else{
      if(find(str, &map)){
	printf("yes\n");
      }else{
	printf("no\n");
      }
    }
  }
  
  return 0;
}

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

int main(void){
    int n = 0, x = 0;
    int m[101]; 
    int sum = 0;
    int min = 1000;
    int ans = 0;

    scanf("%d%d", &n, &x);

    for(int i = 0; i < n; i++){
        scanf("%d", &m[i]);
        sum += m[i];
        if(min > m[i]){
            min = m[i];
        }
    }

    // １個ずつ作った後の残りを求めておく
    x -= sum;
    ans += n;

    // 一番粉の使用量が少ないドーナツをできるだけ作る
    ans += x/min;

    printf("%d\n", ans);

    return 0;

} 


Measured memory_bytes: 256
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int i,n,cnt;
	char s[100001];
	scanf("%d",&n);
	scanf("%s",s);
	cnt=1;
	for(i=1;i<n;i++)	{
		if(s[i]!=s[i-1])	cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
using namespace std;

int N;

int main() {
  	cin >> N;
    map<int, bool> mp;
    int a;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        cin >> a;
        mp[a] = !mp[a];
        cnt += mp[a]? 1: -1;
    }
    cout << cnt << endl;
}





Measured memory_bytes: 4992
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp1 {
    public class Class {
        static void Main(string[] args) {
            var N = RL<string>();
            long A = long.Parse(N[0]);
            decimal B = decimal.Parse(N[1]);
            long ans = (long)((A * (B * 100)) / 100); 

            Console.Write(ans);
        }

        static T[] RL<T>() where T : IComparable {
            if (typeof(T) == typeof(int)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(int.Parse).ToArray();
            }
            if (typeof(T) == typeof(long)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(long.Parse).ToArray();
            }
            if (typeof(T) == typeof(double)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(double.Parse).ToArray();
            }
            if (typeof(T) == typeof(decimal)) {
                return (T[])(object)Console.ReadLine().Trim().Split().Select(decimal.Parse).ToArray();
            }
            return (T[])(object)Console.ReadLine().Trim().Split().ToArray();
        }
    }
}

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

int main(){
 int a, b, k;
 cin>>a>>b>>k;
 if(k*2>=b-a+1)for(int i=a; i<=b; i++)cout<<i<<"\n";
 else {
  for(int i=0; i<k; i++)cout<<a+i<<"\n";
  for(int i=k-1; i>=0; i--)cout<<b-i<<"\n";
 }
}


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

typedef long long ll;
const int maxn = 10000005, mod = 998244353;

inline int gi()
{
	char c = getchar();
	while (c < '0' || c > '9') c = getchar();
	int sum = 0;
	while ('0' <= c && c <= '9') sum = sum * 10 + c - 48, c = getchar();
	return sum;
}

inline int fpow(int x, int k)
{
	int res = 1;
	while (k) {
		if (k & 1) res = (ll)res * x % mod;
		k >>= 1; x = (ll)x * x % mod;
	}
	return res;
}

int n, fac[maxn], ifac[maxn], Pow[maxn];

inline int C(int m, int n)
{
	return (ll)fac[m] * ifac[n] % mod * ifac[m - n] % mod;
}

int main()
{
	n = gi();
	fac[0] = 1; Pow[0] = 1;
	for (int i = 1; i <= n; ++i) fac[i] = (ll)fac[i - 1] * i % mod;
	ifac[n] = fpow(fac[n], mod - 2);
	for (int i = n - 1; ~i; --i) ifac[i] = (ll)ifac[i + 1] * (i + 1) % mod;
	for (int i = 1; i <= n / 2 + 1; ++i) Pow[i] = Pow[i - 1] + Pow[i - 1], Pow[i] = Pow[i] >= mod ? Pow[i] - mod : Pow[i];
	
	int ans = fpow(3, n);
	for (int i = n / 2 + 1; i <= n; ++i)
		ans = (ans + (ll)(mod - C(n, i)) * Pow[n - i + 1]) % mod;
	printf("%d\n", ans);
	
	return 0;
}


Measured memory_bytes: 98944
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    ll ans = 0;
    for(int i = 0; i < n; i++)
    {
        ans += a[i] / 2;
        if(i > 0 && a[i-1] == 1)
        {
            if(a[i] % 2 == 1)
            {
                ans++;
                a[i] = 0;
            }
            else if(a[i] > 0)
            {
                a[i] = 1;
            }
        }
        else
        {
            a[i] %= 2;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 3784
#include <vector>
#include <string>
#include <iostream>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <functional>
#include <map>
#include <array>
#include <cmath>
#include <set>
#include <numeric>

using namespace std;

template <typename T>
using TABLE = vector<vector<T>>;

using LONG = long long;
using LVEC = vector<long long>;


#define FOR(i, s, e) for(i = s; i < e; ++i)
#define FOR_INV(i, s, e) for(i = e - 1; i >= s; --i)

long long PRIME = 1e9 + 7;
long long PRIME2 = 998244353;



int main(){
    LONG N;
    cin >> N;

    vector<vector<int>> edges(N);
    int a, b;
    LONG i;

    FOR(i, 0, N-1){
        cin >> a >> b;
        edges[a-1].push_back(b-1);
        edges[b-1].push_back(a-1);
    }

    vector<int> c(N);
    LONG sum = 0;
    FOR(i, 0, N){
        cin >> c[i];
        sum += c[i];
    }

    sort(c.begin(), c.end(), greater<int>());
    sum -= c[0];

    vector<int> d(N);
    int cur_pos = 0;

    queue<int> q;
    q.push(0);

    vector<bool> passed(N, false);
    passed[0] = true;

    while(q.size() > 0){
        int e = q.front();
        q.pop();

        d[e] = c[cur_pos++];
        passed[e] = true;

        for(int& ne : edges[e]){
            if(!passed[ne]){
                q.push(ne);
            }
        }
    }

    cout << sum << endl;
    FOR(i, 0, N){
        cout << d[i] << " ";
    }
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;

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

    int T;
    cin >> T;
    bool ok = false;
    while (T) {
        int cur = T % 10;
        if (cur == 7) {ok = true; break;}
        T /= 10;
    }
    cout << ((ok) ? "Yes" : "No") << '\n';

    return 0;
}


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

using namespace std;

#define ll long long

int main(){
    int a, b;
    cin >> a >> b;

    if(a == b){
        cout << "Draw" << endl;
    }
    else if(a == 1 ||(b!=1 && a > b)){
        cout << "Alice" << endl;
    }
    else{
        cout << "Bob" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
import Control.Monad
 
import Data.Ord
import Data.List
import Data.Function
import Data.Maybe
 
import qualified Data.ByteString.Char8 as BS
 
import Debug.Trace
 
tuplify2 :: [a] -> (a, a)
tuplify2 (x:y:_) = (x, y)
tuplify2 _ = undefined
 
readInt = read :: String -> Integer
readIntTuple = tuplify2 . map readInt . words
readIntList = map readInt . words
 
getInt = readInt <$> getLine
getIntList = readIntList <$> getLine
getIntMatrix = map readIntList . lines <$> getContents
getIntTuple = readIntTuple <$> getLine
getIntTuples = map readIntTuple . lines <$> getContents
 
main = do
  [n] <- getIntList
  ws <- getIntList
  let total = sum ws
  let subTotal1 = scanl (+) 0 ws
  let subTotal2 = map (total -) subTotal1
  print $ minimum . map abs $ zipWith (-) subTotal1 subTotal2


Measured memory_bytes: 892
import sys 

readline = sys.stdin.buffer.readline

def main():
    N = int(readline())
    A = list(map(int, readline().split()))

    cnt = 0
    i = 1
    for a in A:
        if a == i:
            i += 1
        else:
            cnt += 1

    print(cnt if cnt != N else -1)


main()


Measured memory_bytes: 20384
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ull unsigned long long
#define d1(x) cout<<#x<<" "<<x<<endl;
#define d2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<endl;
#define d2i(x,y,i) cout<<#x<<i<<" "<<x<<" "<<#y<<i<<" "<<y<<endl;
#define all(v) v.begin(),v.end()
#define fr(i,l,r) for(ll i=l;i<r;i++)
#define mems(a,x) memset(a,x,sizeof(a))
#define mod 1000000007
#define ff first
#define ss second
#define pb(x) push_back(x)
#define vll vector<ll>
#define pbp(x,y) push_back(make_pair(x,y))
#define  mat vector<vector<ll>>
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void solve(){
ll n,k,d;
cin>>n>>k;
//ll c=0;
vll v[n+1];
for(int i=0;i<k;i++){
 ll d;
 cin>>d;
 while(d--){
   ll kk;
   cin>>kk;
   v[kk].pb(i);
 }
}
ll c=0;
fr(i,1,n+1)
if(v[i].size()==0)
c++;
cout<<c;

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

Measured memory_bytes: 3636
#define _DEBUG 1
#define _GLIBCXX_DEBUG

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#ifdef _DEBUG
#define dump(x) cerr << #x << "=" << x << endl
#define dump2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define dump3(x, y, z)                                                         \
  cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z     \
       << endl
#define check(s) cerr << s << endl
#else
#define dump(x)
#define dump2(x, y)
#define dump3(x, y, z)
#define check(s)
#endif

#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, m, n) for (int i = m; i < n; i++)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define unique(v) v.erase(unique(v.begin(), v.end()), v.end());

const ll LINF = 2e18;
const int INF = 1e9;

void solve(ll n, ll m) { cout << (n - 1) * (m - 1) << endl; }

int main() {
  ll n;
  scanf("%lld", &n);
  ll m;
  scanf("%lld", &m);
  solve(n, m);
  return 0;
}


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

typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int answer = 0;
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			for (int k = j + 1; k < n; k++) {
				vector<int> b{a[i], a[j], a[k]};
				sort(b.begin(), b.end());
				if (b[0] == b[1] || b[1] == b[2]) continue;
				if (b[0] + b[1] > b[2]) answer++;
			}
		}
	}
	cout << answer << endl;
}


Measured memory_bytes: 3652
m[101][101];main(i,j,x,y){for(;scanf("%d%d",&y,&x),x;){
	for(getchar(),j=0;j<y;getchar(),j++)for(i=0;i<x;i++)m[i][j]=getchar();
	for(x=y=i=0;i<10000;i++)if(m[x][y]=='>')x++;else if(m[x][y]=='<')x--;else if(m[x][y]=='v')y++;else if(m[x][y]=='^')y--;else break;
	if(i==10000)puts("LOOP");else printf("%d %d\n",x,y);
}exit(0);}

Measured memory_bytes: 0
#include<stdio.h>
#include<stdlib.h>
#pragma warning(disable:4996)
int main()
{
	int n = 0, k = 0;
	scanf("%d %d", &n, &k);
	
	int arr[1001] = { 0 };
	for (int i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}
	for (int i = n - 1; i >= 0; i--)
	{
		for (int j = 0; j < i; j++)
		{
			if (arr[j] > arr[j + 1])
			{
				int temp = arr[j];
				arr[j] = arr[j + 1];
				arr[j + 1] = temp;
			}
		}
	}
	int sum = 0;
	for (int i = 0; i < k; i++)
	{
		sum += arr[i];
	}
	printf("%d\n", sum);
	


	//system("pause");
	return 0;

}

Measured memory_bytes: 1732
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x){
    //topを加算してからその位置へ挿入
    S[++top] = x;
}

int pop(){
    top--;
    //topがさしていた要素を返す
    return S[top+1];
}

int main(){
    int a, b;
    top = 0;
    char s[1];

    while(scanf("%s", s) != EOF){ //標準入力でEOFを返すには、Ctrl+Dを入力する必要がある
        if(s[0] == '+'){
            a = pop();
            b = pop();
            push(a+b);
        }else if(s[0] == '-'){
            b = pop();
            a = pop();
            push(a-b);
        }else if(s[0] == '*'){
            a = pop();
            b = pop();
            push(a * b);
        }else{
            push(atoi(s));
        }
    }

    printf("%d\n", pop());

    return 0;
}


Measured memory_bytes: 2716
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
  string s, t;
  cin >> s >> t;
  vector<int> from(26, -1);
  vector<int> to(26, -1);
  rep(i, (int)s.size()) {
    int start = s[i] - 'a';
    int end = t[i] - 'a';
    
    if (to[end] != -1 && to[end] != start) {
      cout << "No" << endl;
      return 0;
    }
    if (from[start] != -1 && from[start] != end) {
      cout << "No" << endl;
      return 0;      
    }
    from[s[i] - 'a'] = t[i] - 'a';
    to[t[i] - 'a'] = s[i] - 'a';
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 3908
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <cstdio>

using namespace std;

const long long INF = 100000000;
const long long MOD = 1000000007;

std::vector<bool> IsPrime;

void sieve(size_t max)
{
  if (max + 1 > IsPrime.size())
  {                                // resizeで要素数が減らないように
    IsPrime.resize(max + 1, true); // IsPrimeに必要な要素数を確保
  }
  IsPrime[0] = false; // 0は素数ではない
  IsPrime[1] = false; // 1は素数ではない

  for (size_t i = 2; i * i <= max; ++i)     // 0からsqrt(max)まで調べる
    if (IsPrime[i])                         // iが素数ならば
      for (size_t j = 2; i * j <= max; ++j) // (max以下の)iの倍数は
        IsPrime[i * j] = false;             // 素数ではない
}

class Pointer{
public:
  long long p;
  long long w;
};

int main()
{
  long long N, K;
  cin >> N >> K;
  long long ans = 0;
  for (int i = 0; i < N;i++){
    long long x;
    cin >> x;
    ans += 2*min(abs(x), abs(K - x));
  }
  cout << ans << endl;
}


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

using point = complex<double>;

constexpr double INF = 1e18;
constexpr double pi = acos(-1);

int main() {
    int n;
    double r, theta;
    cin >> n >> r >> theta;
    theta = theta / 180 * pi;
    vector<point> v(n);
    vector<vector<double>> d(n, vector<double>(n));
    vector<vector<vector<double>>> angle(n, vector<vector<double>>(n, vector<double>(n)));
    for(int i=0; i<n; ++i) {
        double x, y;
        cin >> x >> y;
        v[i] = point(x, y);
    }
    for(int i=0; i<n; ++i) {
        for(int j=0; j<n; ++j) {
            d[i][j] = abs(v[i] - v[j]);
        }
    }
    for(int i=0; i<n; ++i) {
        for(int j=0; j<n; ++j) {
            for(int k=0; k<n; ++k) {
                if(i == j || j == k) {
                    continue;
                }
                angle[i][j][k] = abs(arg((v[j] - v[i]) / (v[k] - v[j])));
            }
        }
    }
    vector<vector<vector<double>>> dp(10001, vector<vector<double>>(n, vector<double>(n, INF)));
    int res = 0;
    for(int i=1; i<n; ++i) {
        dp[1][0][i] = d[0][i];
        res |= dp[1][0][i] <= r;
    }
    for(int i=1; i<10000; ++i) {
        for(int j=0; j<n; ++j) {
            for(int k=0; k<n; ++k) {
                for(int l=0; l<n; ++l) {
                    if(k == l || dp[i][j][k] == INF) {
                        continue;
                    }
                    if(angle[j][k][l] <= theta && dp[i][j][k] + d[l][k] <= r) {
                        dp[i+1][k][l] = min(dp[i+1][k][l], dp[i][j][k] + d[l][k]);
                        res = i+1;
                    }
                }
            }
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 42856