akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
using Graph = vector<vector<ll>>;
const double pi=3.141592653589793;

int main(){
  double a,b,h,m;cin>>a>>b>>h>>m;
  double hour = (h + m/60)/12;
  double minute = m/60;

  hour *= 2 * pi;
  minute *=  2 * pi;

  double dig = abs(hour - minute);

  double ans = (a*a) + (b*b) - 2*a*b*cos(dig);

  cout << fixed << setprecision(10) << pow(ans,0.5) << endl;


}

Measured memory_bytes: 4356
import sys
from collections import defaultdict
input = sys.stdin.readline
sys.setrecursionlimit(10**8)

class UnionFind():
    def __init__(self, n):
        self.par = [-1 for i in range(n)]

    def root(self, x):
        if self.par[x] < 0:
            return x
        else:
            self.par[x] = self.root(self.par[x]) # contraction
            return self.par[x]

    def unite(self, x, y):
        x, y = self.root(x), self.root(y)
        if x != y:
            if self.par[x] > self.par[y]: # merge technique
                x, y = y, x
            self.par[x] += self.par[y]
            self.par[y] = x

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def size(self, x):
        return -self.par[self.root(x)]

n, k, l = map(int, input().split())
uf_r = UnionFind(n)
for i in range(k):
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    uf_r.unite(p, q)
uf_t = UnionFind(n)
for i in range(l):
    r, s = map(int, input().split())
    r -= 1
    s -= 1
    uf_t.unite(r, s)

root_r = defaultdict(set)
root_t = defaultdict(set)
for i in range(n):
    root_r[uf_r.root(i)].add(i)
    root_t[uf_t.root(i)].add(i)

ans = []
memo = dict()
for i in range(n):
    if (uf_r.root(i), uf_t.root(i)) not in memo:
        memo[(uf_r.root(i), uf_t.root(i))] = len(root_r[uf_r.root(i)] & root_t[uf_t.root(i)])
    ans.append(memo[(uf_r.root(i), uf_t.root(i))])

print(*ans)


Measured memory_bytes: 161668
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  int n, k, x, y;
  cin >> n >> k >> x >> y;
  if(n<=k) cout << n * x << endl;
  else cout << (x * k) + ((n - k) * y) << endl;
  return 0;
}

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

typedef long long ll;
#define debug(x) cerr << #x <<" : "<< x << endl;
#define INF (1<<20)
const int MAX_N = (1 << 18);

int main() {
	string S;
	cin >> S;
	string t = { 'A', 'C', 'G', 'T' };

	int cnt=0, ans=0;
	for (int i = 0; i < S.length(); i++) {
		bool f=false;
		for (int j = 0; j < 4; j++) {
			if (S[i] == t[j]) {
				cnt++;
				f = true;
			}
		}
		if (!f) {
			ans = max(ans, cnt);
			cnt=0;
		}
	}
	ans = max(ans, cnt);
	cout << ans << endl;
}

Measured memory_bytes: 256
N, K = map(int, input().split())
A = [0]*(N+2)
for i in range(N+1):
    A[i+1] += A[i] + i
ans = 0
for i in range(K, N+2):
    minv = A[i]
    maxv = A[N+1]-A[N-i+1]
    ans += maxv-minv+1
    ans %= 10**9+7
print(ans)


Measured memory_bytes: 69348
#include <stdio.h>

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

while(1){
scanf("%d",&n);
if(n==0)break;
a=0;
b=0;
f=0;
t=0;
for(i=0;i<n;i++){
scanf("%d %d",&a,&b);
if(a==b){
f+=a;
t+=b;
}
else if(a>b){
f+=a+b;
}
else if(a<b){
t+=a+b;
}
}
printf("%d %d\n",f,t);
}

return 0;
}

Measured memory_bytes: 1024
S=input()
L=[]
R=[]
count=0
for i in range(len(S)):
    if i<=(len(S)+(2-1))//2-1:
        L.append(S[i])
        R.append(S[-i-1])
for i in range(len(L)):
    if L[i]==R[i]:
        count=count
    else:
        count+=1
print(count)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <string>
#include <algorithm>
#include <string.h>
using namespace std;
 
int main(){
    
    int N;
    cin >> N;

    if(N<=999){
        cout << "ABC" <<endl;
    }else{
        cout << "ABD" <<endl;
    }
    
    return 0;
}

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

template
<
    typename TYPE,
    std::size_t SIZE
>
std::size_t a_len(const TYPE (&array)[SIZE])
{
    return SIZE;
}

using namespace std;
using ll = long long int;

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



int main()
{
    int a,b;
    cin >> a >> b;
    int ans = a;
    if(b<a){
        ans--;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
#include <chrono>
#include <fstream>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

using ll = long long;
using P = pair<int, int>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    int n, k;
    cin >> n >> k;
    cout << (k <= (n + 1) / 2 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 3636
N, M = [int(_) for _ in input().split()]
AB = sorted([[int(_) for _ in input().split()] for _ in range(M)])
l = 0
r = N + 1
ans = 1
for i in range(M):
    if AB[i][0] < r:

        r = min(r, AB[i][1])
    else:
        ans += 1
        r = AB[i][1]
    l = AB[i][0]
print(ans)

Measured memory_bytes: 24176
/*
Author: Babin Dutta
*/
 
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define ll long long int
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define f(i,n) for(int i=0;i<n;i++)
#define ff(i,a,b) for(int i=a;i<=b;i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define inf 1e18
#define mm 998244353
 
ll power(ll x, ll y, ll p)
{
    ll res = 1;  
    x = x % p;  
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1; 
        x = (x*x) % p;  
    }
    return res;
}
ll modInverse(ll A,ll M)
{
    return power(A,M-2,M);
}

void solve(){
	char c; cin>>c;
	if(c >= 'a' && c <= 'z') cout<<"a"<<endl;
	else cout<<"A"<<endl;
}
 
int main(){
	#ifdef JUDGE
    freopen("input.txt", "rt", stdin);
    freopen("output.txt", "wt", stdout);
    #endif
	boost;
	int t=1; //cin>>t;
	for(int i=1;i<=t;i++) solve();
	return 0;
}

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

const int N = 4010;
int n;
ll dp[N][10];
ll cod[300];
ll ans;
/*
 * 1 - R
 * 2 - G
 * 3 - B
 * 4 - RG
 * 5 - RB
 * 6 - RGB
 */
string s;

int main(){
    cin >> n >> s;
    string aux = "BGR";
    do{
        //cout << aux << '\n';
        cod['R'] = cod['G'] = cod['B'] = 0;
        for (int i=0; i<n; i++){
            if (s[i] == aux[0]) cod[(int)aux[0]]++;
            else if (s[i] == aux[1]) cod[(int)s[i]] += cod[(int)aux[0]];
            else ans += cod[(int)aux[1]];
        }
    } while(next_permutation(aux.begin(), aux.end()));
    
    for (int l=1; l<=n; l++){
        for (int i=l; i+l < n; i++){
            if (s[i] != s[i-l] && s[i] != s[i+l] && s[i-l] != s[i+l]) ans--;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3648
#[allow(unused_imports)]
use std::io::{stdin, Read, StdinLock};
#[allow(unused_imports)]
use std::cmp::{max, min, Ordering};
#[allow(unused_imports)]
use std::str::FromStr;
#[allow(unused_imports)]
use std::collections::{HashSet, HashMap, BinaryHeap, VecDeque};
#[allow(unused_imports)]
use std::vec::Vec;

#[allow(dead_code)]
const INF: i32 = 1000_000_000;
#[allow(dead_code)]
const INFLL: i64 = 1000_000_000_000_000_000;
#[allow(dead_code)]
const EPS: f64 = 1.0e-10;
#[allow(dead_code)]
const MOD: i32 = 1000_000_007;
#[allow(dead_code)]
const MODLL: i64 = 1000_000_007;

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner {cin: cin}
    }
    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
                    .skip_while(|c| c.is_whitespace())
                    .take_while(|c| !c.is_whitespace())
                    .collect::<String>();
        token.parse::<T>().ok()
    }
    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let m: i64 = sc.read();
    'outer: for h in 1..3501i64 {
        for w in 1..3501i64 {
            if 4 * h * w - m * (h + w) == 0 {
                continue;
            }
            let n = m * h * w / (4 * h * w - m * (h + w));
            if n * (4 * w * h - m * (h + w)) == m * h * w && n > 0 {
                println!("{} {} {}", h, n, w);
                break 'outer;
            }
        }
    }
}

Measured memory_bytes: 4476
#include<bits/stdc++.h>
using namespace std;
long long int mod = 1e9+7;
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};
//////////////////////////////////


int main(){
    string s; cin >> s;
    sort(s.begin(), s.end());
    if(s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) {
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

// EOF


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


using namespace std;

int fact(int n){
	if (n == 0)
		return 1;
	else
		return n * fact(n - 1);
}

int main()
{
	int len[13];
	int * np[150];
	char alphabet[150];
	int n;
	int num[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };

	//入力
	while (cin >> n, n){
		int found = 0;

		//STRINGの入力
		int counter = 0;
		for (int i = 0; i < n; i++){
			string s;
			cin >> s;
			len[i] = s.size();
			for (int j = 0; j < s.size(); j++){
				alphabet[counter++] = s[j];
			}
		}


		//同じ文字の処理
		int numcounter = 0, variation = 0;
		for (int i = 0; i < counter; i++){
			bool flag = true;
			for (int j = 0; j < i; j++){
				if (alphabet[i] == alphabet[j]){
					np[i] = np[j];
					flag = false;
				}
			}
			if (flag){
				np[i] = num + numcounter++;
				variation++;
			}
		}

		int docounter = 0;
		int t = fact(10 - variation);

		int lketa[8];
		int rketa[8];
		do{

			//重複の場合はスキップ
			docounter++;
			if (docounter % t != 0)
				continue;


			//下一桁で判定
			numcounter = -1;
			int lhito = 0, rhito;
			for (int i = 0; i < n - 1; i++){
				numcounter = numcounter + len[i];
				lhito += *np[numcounter];
			}
			rhito = *np[numcounter + len[n - 1]];
			if (lhito % 10 != rhito)
				continue;


			//全桁の計算
			fill_n(lketa, 8, 0);
			fill_n(rketa, 8, 0);
			numcounter = 0;
			bool flag = false;
			for (int i = 0; i < n; i++){
				for (int j = 0; j < len[i]; j++){
					if (j == 0 && *np[numcounter] == 0 && len[i] > 1){
						flag = true;
						break;
					}
					if (i < n - 1)
						lketa[len[i] - j - 1] += *np[numcounter++];
					else
						rketa[len[i] - j - 1] = *np[numcounter++];
				}
				if (flag)
					break;
			}
			if (flag)
				continue;

			//繰り上がりと判定
			bool judge = true;
			for (int i = 0; i < 7; i++){
				lketa[i + 1] += lketa[i] / 10;
				lketa[i] = lketa[i] % 10;
				if (lketa[i] != rketa[i]){
					judge = false;
					break;
				}
			}
			if (lketa[7] != rketa[7])
				judge = false;

			if (judge){
				found++;
			}

		} while (next_permutation(num, num + 10));
		cout << found << endl;
	}
	return 0;
}

Measured memory_bytes: 1208
parseInt(x) = parse(Int, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
	n = readline() |> parseInt
	a = readline() |> split |> parseMap
	d = Dict{Int,Int}()
	for i in 1:n
		if haskey(d,a[i])
			d[a[i]] += 1
		else
			d[a[i]] = 1
		end
	end
	s = 0
	for k in keys(d)
		s += d[k]*(d[k]-1)>>1
	end
	for i in 1:n
		println(s-d[a[i]]*(d[a[i]]-1)>>1+max((d[a[i]]-1)*(d[a[i]]-2)>>1,0))
	end
end

main()

Measured memory_bytes: 154224
#include<cstdio>
#include<algorithm>
int main(void){
  int n, m, k, t[20100];
  for( ; ; ){
    scanf("%d %d", &n, &m);
    if(!(n + m)) break;
    for(int i = 0;i < n + m; i++) scanf("%d", t + i);
    std::sort(t, t + n + m);
    k = t[0];
    for(int i = 0;i < n + m - 1; i++)
      k = std::max(t[i + 1] - t[i], k);
    printf("%d\n", k);
  }
}


Measured memory_bytes: 1120
#include <bits/stdc++.h>
#define pb push_back
#define sz(a) int(a.size())
#define re return
#define all(a) a.begin(),a.end()
using namespace std;
int main()
{
	int n,m;
	cin>>n>>m;
	if (n==m)  cout<<"Yes";
	else  cout<<"No";
	re 0;
}

Measured memory_bytes: 256
#![allow(unused)]

//input
//use std::io::Read;

//collections
//use std::collections::BTreeMap;
//use std::collections::BTreeSet;
//use std::collections::HashMap;
//use std::collections::HashSet;

//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
//入力マクロここまで

fn main() {
    input! {
        n: usize,
        a: [u64;n],
    }

    let mut now = 0;

    for i in 0..n {
        if a[i] == now + 1 {
            now += 1;
        }
    }

    if now != 0 {
        println!("{}", n as u64 - now);
    } else {
        println!("-1");
    }

}

Measured memory_bytes: 6396
import math

num_of_even, num_of_odd = map(int, input().split())

def combinations_count(n, r):
    if n < 2:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

if num_of_even == 1 and num_of_odd == 1:
    print('0')
else:
    print(combinations_count(num_of_odd, 2) + combinations_count(num_of_even, 2))


Measured memory_bytes: 2940
<?php
  
while ($line = fgets(STDIN)) {
   $stdin[] = trim($line);
}
#$v2 = str_split($stdin[0]);
#$v2 = explode(" ", $stdin[0]);

$tabeta = explode(" ", $stdin[1]);
$score = explode(" ", $stdin[2]);
$omake = explode(" ", $stdin[3]);



$base = 0;
foreach($score as $v){
  $base = $base + $v;
}

for($i = 0 ; $i < $stdin[0]; $i++){
  
  if($i == 0){
    continue;
  }

  if($tabeta[$i] - $tabeta[$i-1] == 1){
    $temp = $tabeta[$i-1];
    $base = $base + $omake[$temp-1];
  }
  
}

echo $base . PHP_EOL;

Measured memory_bytes: 3956
lines = readlines.map(&:strip)
S = lines[0].split('')

left = S[0..1].join.to_i
right = S[2..3].join.to_i

#0,1-12,13-99
left_m = (left >= 1) && (left <= 12)
right_m = (right >= 1) && (right <= 12)

result = nil
if(left_m && right_m)
  result = 'AMBIGUOUS'
elsif(left_m && !right_m)
  result = 'MMYY'
elsif(!left_m && right_m)
  result = 'YYMM'
elsif(!left_m && !right_m)
  result = 'NA'
end


puts result


Measured memory_bytes: 1788
x, y = gets.chomp.split.map(&:to_i)
gx = (x == 2) ? 2 : (([4, 6, 9, 11].include? x) ? 1 : 0)
gy = (y == 2) ? 2 : (([4, 6, 9, 11].include? y) ? 1 : 0)
puts (gx == gy) ? "Yes" : "No"

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

using namespace std;

using int64 = long long;

int main() {
  string S, T;
  cin >> S >> T;
  S += S;
  if(S.find(T) != string::npos) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
  }
}

Measured memory_bytes: 256
import std.stdio, std.conv, std.string, std.algorithm,
       std.math, std.array, std.container, std.typecons;

long mod = 1000000007;

long modinv(long a) {
  long b=mod, u=1, v=0;
  while(b>0) {
    long t=a/b;
    a -= t*b; swap(a,b);
    u -= t*v; swap(u,v);
  }
  u %= mod;
  if(u<0) u+=mod;
  return u;
}

long[] a, b, c, d;
long n, m, q;

long solve(long[] arr, long pos) {
  if(arr.length==pos) {
    long sum=0;
    for(long i=0; i<q; i++) {
      auto aai = arr[a[i]-1];
      auto abi = arr[b[i]-1];
      if(abi - aai == c[i]) sum += d[i];
    }
    return sum;
  }
  else {
    long maxi = 0;
    for(long i=arr[pos-1]; i<=m; i++) {
      auto a2 = arr.dup;
      a2[pos] = i;
      maxi = max(maxi, solve(a2, pos+1));
    }
    return maxi;
  }
}

void main() {
  readf("%d %d %d\n", &n, &m, &q);
  long[] arr = new long[n];
  a = new long[q];
  b = new long[q];
  c = new long[q];
  d = new long[q];
  for(long i=0; i<q; i++) {
    readf("%d %d %d %d\n", &a[i], &b[i], &c[i], &d[i]);
  }
  long maxi = 0;
  for(long i=1; i<=m; i++) {
    arr[0] = i;
    maxi = max(maxi, solve(arr, 1));
  }
  writeln(maxi);
}


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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll Q, H, S, D;
  cin >> Q >> H >> S >> D;
  ll N;
  cin >> N;
  ll SQ = 4 * Q, SH = 2 * H;
  ll minS = min(SQ, min(SH, S));
  cerr << minS << endl;
  ll ans;
  if (minS * 2 > D)
  {
    cerr << "a" << endl;
    ans = (N / 2) * D + (N % 2) * minS;
  }
  else
  {
    cerr << "b" << endl;
    ans = N * minS;
  }
  cout << ans << endl;
  return 0;
}

//　全探索は無理


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

int n,k;
vector<string>cards;
set<string>result;

void rec(int used,int depth)
{
  if(depth==k){
    vector<int>v;
    for(int i=0;i<cards.size();i++)if(used&(1<<i))v.push_back(i);
    do{
      string s="";
      for(int i=0;i<k;i++)s+=cards[v[i]];
      result.insert(s);
    }while(next_permutation(v.begin(),v.end()));
    return;
  }

  for(int i=0;i<cards.size();i++){
    if(used&(1<<i))continue;
    rec(used^(1<<i),depth+1);
  }

  return;
}

int main()
{
  while(cin>>n>>k,n|k){
    cards.resize(n);
    result.clear();
    for(int i=0;i<n;i++)cin>>cards[i];
    rec(0,0);
    cout<<result.size()<<endl;
  }
}

Measured memory_bytes: 1068
N,K=map(int,input().split())
A=[0 for i in range(N)]

for i in range(K):
  d=int(input())
  B=list(map(int,input().split()))
  for j in range(d):
    A[B[j]-1]+=1

ans=0
for i in range(N):
  if A[i]==0:
    ans+=1

print(str(ans))

Measured memory_bytes: 9144
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int r = sc.nextInt();
		int D = sc.nextInt();
		int[] x = new int[11];
		x[0] = sc.nextInt();
		for(int i=1; i<=10; i++) {
			x[i] = x[i-1]*r - D;
		}
		sc.close();
		for(int i=1; i<=10; i++) {
			System.out.println(x[i]);
		}

	}

}

Measured memory_bytes: 35712
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int h, w;
	cin >> h >> w;

	vector<string> a;
	string header = "";
	REP(i, w + 2) header += "#";
	a.push_back(header);

	REP(i, h)
	{
		string s;
		cin >> s;
		a.push_back("#" + s + "#");
	}

	a.push_back(header);

	REP(i, SIZE(a))
	{
		print(a[i]);
	}

	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


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

using namespace std;

#define Mod 1000000007

int main(){
	
	ios :: sync_with_stdio(0);
	
	int H,W;
	
	cin>>H>>W;
	
	string grid[H];
	
	int dp[H][W];
	
	for(int i=0; i<H; i+=1){
		
		cin>>grid[i];
		
		for(int j=0; j<W; j+=1){
			
			dp[i][j] = 0;
		}
	}
	
	dp[0][0] = 1;
	
	for(int i=0; i<H; i+=1){
		
		for(int j=0; j<W; j+=1){
			
			if(grid[i][j] == '#'){
				
				continue;
			}
			
			int u = i-1;
			
			int b = j-1;
			
			if(u >= 0 && grid[u][j] != '#'){
				
				dp[i][j] = ((dp[i][j]%Mod)+(dp[u][j]%Mod))%Mod;
			}
			
			if(b >= 0 && grid[i][b] != '#'){
				
				dp[i][j] = ((dp[i][j]%Mod)+(dp[i][b]%Mod))%Mod;
			}
		}
	}
	
	cout<<dp[H-1][W-1];
}

Measured memory_bytes: 5248
from math import gcd

N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]

d = {}
for a, b in X:
    if a == b == 0:
        pass
    elif a == 0:
        if b > 0:
            b = 1
        else:
            b = -1
    elif b == 0:
        if a > 0:
            a = 1
        else:
            a = -1
    else:
        v = gcd(a, b)
        a //= v
        b //= v

    if a != 0 and a * b >= 0:
        pair = (abs(a), abs(b))
        if pair not in d:
            d[pair] = [0, 0]
        d[pair][0] += 1
    else:
        pair = (abs(b), abs(a))
        if pair not in d:
            d[pair] = [0, 0]
        d[pair][1] += 1

MOD = 10 ** 9 + 7
zero = 0
ans = 1
for p in d:
    if p == (0, 0):
        zero = d[p][1]
    else:
        a, b = d[p]
        ans *= pow(2, a, MOD) + pow(2, b, MOD) - 1
        ans %= MOD

print((ans + zero - 1) % MOD)


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

int main () {
    int n, m;
    cin >> n >> m;
    vector<int> a(n, 0);
    int sum = 0;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) sum += a[i];
    sort(a.begin(), a.end());
    int res = a[n - m] * 4 * m >= sum;
    cout << (res ? "Yes" : "No");
}



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

#define all(x) (x).begin(), (x).end()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}



const int mod = 1e9 + 7;
void _main() {
        string s; cin >> s;
        reverse(all(s));
        int n = s.size();
        vector<int> dp(13);
        dp[0] = 1;
        int p = 1;
        for (int i = 0; i < n; i++) {
                vector<int> new_dp(13);
                if (s[i] != '?') {
                        for (int rem = 0; rem < 13;rem++) {
                                (new_dp[(rem + (s[i] - '0') * p) % 13] += dp[rem]) %= mod;
                        }
                } else {
                        for (int dig = 0; dig < 10; dig++) {
                                for (int rem = 0; rem < 13; rem++) {
                                        (new_dp[(rem + dig * p) % 13] += dp[rem]) %= mod;
                                }
                        }
                }

                (p *= 10) %= 13;
                dp = new_dp;
        }

        cout << dp[5];
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

Measured memory_bytes: 3780
#[allow(unused_macros)]
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
#[allow(unused_macros)]
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
#[allow(unused_macros)]
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }

fn main() {
    input! {
        n: usize,
        s_: String,
    }
    let s: Vec<char> = s_.chars().collect();

    if n % 2 == 1 {
        println!("No");
    } else {
        let mut flag = true;
        for i in 0..n / 2 {
            if s[i] != s[i + n / 2] {
                flag = false;
                break;
            }
        }
        if flag {
            println!("Yes");
        } else {
            println!("No");
        }
    }
}


Measured memory_bytes: 2156
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>

using namespace std;

int main(){
//int W,H,x,y,r;
    int N;
    int M=0;
    char v;
    cin>>N;
    vector<char> X(N);

for(int i=0;i<N;i++){
    cin>>X.at(i);    
}

int c=0;
while(c<N-1){
  if(X.at(c)!=X.at(c+1)){
   M=M+1;
   c=c+2;
  
  }else{
    c=c+1;
    
}

}
cout<<M<<endl;

}


Measured memory_bytes: 3204
#include <bits/stdc++.h> 
using namespace std;
using ll = long long;
template<typename T> using v2 = vector<vector<T>>;
template<typename T> inline v2<T> fill(int r, int c, const T& t){ return v2<T>(r, vector<T>(c, t)); }
#define F first
#define S second

void solve(){
    ll x, k, d;
    cin >> x >> k >> d;

    x = abs(x);
    ll moves = x/d;
    if(moves >= k){
        cout << x - k*d << '\n';
    }
    else{
        ll left = k-moves;
        if(left%2==0) cout << x%d << '\n';
        else cout << -(x%d-d) << '\n';
    }
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
}

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

template<typename T, typename E>
struct SkewHeap{
  typedef function<T(T, E)> F;
  typedef function<E(E, E)> G;
  typedef function<bool(T,T)> C;
  F f;
  G g;
  C c;
  T INF;
  E e;
  SkewHeap(F f,G g,C c,T INF,E e):f(f),g(g),c(c),INF(INF),e(e){}
  
  struct Node{
    Node *l,*r;
    T val;
    E add;
    Node(T val,E add):val(val),add(add){l=r=nullptr;}
  };

  void eval(Node *a){
    if(a==nullptr) return;
    if(a->add==e) return;
    if(a->l) a->l->add=g(a->l->add,a->add);
    if(a->r) a->r->add=g(a->r->add,a->add);
    a->val=f(a->val,a->add);
    a->add=e;
  }
  
  T top(Node *a){
    return a!=nullptr?f(a->val,a->add):INF;
  }

  T snd(Node *a){
    eval(a);
    return a!=nullptr?min(top(a->l),top(a->r)):INF;
  }

  Node* add(Node *a,E d){
    if(a!=nullptr) a->add=g(a->add,d);
    return a;
  }
  
  Node* push(T v){
    return new Node(v,e);
  }
  
  Node* meld(Node *a,Node *b){
    if(a==nullptr) return b;
    if(b==nullptr) return a;
    if(c(top(a),top(b))) swap(a,b);
    eval(a);
    a->r=meld(a->r,b);
    swap(a->l,a->r);
    return a;
  }
  
  Node* pop(Node* a){
    eval(a);
    auto res=meld(a->l,a->r);
    delete a;
    return res;
  }
  
};

template<typename T>
T optimalbinarytree(vector<T> s,T INF){
  using Heap=SkewHeap<T,T>;
  
  typename Heap::F f=[](T a,T b){return a+b;};
  typename Heap::G g=[](T a,T b){return a+b;};
  typename Heap::C c=[](T a,T b){return a>b;};
  Heap heap(f,g,c,INF,0);
  
  int n=s.size();
  vector<typename Heap::Node* > hs(n-1,nullptr);
  vector<int> ls(n),rs(n);
  vector<T> cs(n-1);
  
  using P = pair<T, int>;
  priority_queue<P,vector<P>,greater<P> > pq;
  for(int i=0;i<n-1;i++){
    ls[i]=i-1;
    rs[i]=i+1;
    cs[i]=s[i]+s[i+1];
    pq.emplace(cs[i],i);
  }
  
  T res=0;
  for(int k=0;k<n-1;k++){
    T c;
    int i;
    do{
      tie(c,i)=pq.top();pq.pop();
    }while(rs[i]<0||cs[i]!=c);

    bool ml=false,mr=false;
    if(s[i]+heap.top(hs[i])==c){
      hs[i]=heap.pop(hs[i]);
      ml=true;
    }else if(s[i]+s[rs[i]]==c){
      ml=mr=true;
    }else if(heap.top(hs[i])+heap.snd(hs[i])==c){
      hs[i]=heap.pop(heap.pop(hs[i]));
    }else{
      hs[i]=heap.pop(hs[i]);
      mr=true;
    }

    res+=c;
    hs[i]=heap.meld(hs[i],heap.push(c));

    if(ml) s[i]=INF;
    if(mr) s[rs[i]]=INF;

    if(ml&&i>0){
      int j=ls[i];
      hs[j]=heap.meld(hs[j],hs[i]);
      rs[j]=rs[i];
      rs[i]=-1;
      ls[rs[j]]=j;
      i=j;
    }

    if(mr&&rs[i]+1<n){
      int j=rs[i];
      hs[i]=heap.meld(hs[i],hs[j]);
      rs[i]=rs[j];
      rs[j]=-1;
      ls[rs[i]]=i;
    }

    cs[i]=min({s[i]+s[rs[i]],
	  min(s[i],s[rs[i]])+heap.top(hs[i]),
	  heap.top(hs[i])+heap.snd(hs[i])});

    pq.emplace(cs[i],i);
  }
  return res;
}


//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> s(n);
  for(Int i=0;i<n;i++) cin>>s[i];
  const Int INF = 1e16;
  cout<<optimalbinarytree(s,INF)<<endl;
  return 0;
}



Measured memory_bytes: 3484
from collections import defaultdict

n = int(input())
l = defaultdict(int)
m = 0
for _ in range(n):
    s = input()
    l[s] += 1
    m = max(m, l[s])

ans = []
for k, v in l.items():
    if v == m:
        ans.append(k)
ans.sort()
for s in ans:
    print(s)


Measured memory_bytes: 142516
import math

N=int(input())
ARR=[0]*(N+1)

for x in range(1,101):
    for y in range(1,101):
        for z in range(1,101):
            res=x**2+y**2+z**2+x*y+y*z+z*x
            if res<=N:
                ARR[res]+=1

for i in ARR[1:]:
    print(i)

Measured memory_bytes: 92596
N = int(input())
a = list(map(int,input().split()))
Devide_by_Four = 0
Even = 0
Odd = 0
for i in range(N):
    if a[i]%4 == 0:
        Devide_by_Four += 1
    elif a[i] %2 == 0:
        Even +=1
    else:
        Odd += 1

if Devide_by_Four >= len(a)//2:
    print("Yes")
elif Devide_by_Four >= Odd:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 14252
#include <stdio.h>
#include <math.h>

#define EPS 1e-9

int main(void) {
	int UW, UH, A, B, AB;
	double PI = 4.0 * atan(1);
	while (scanf("%d%d%d%d%d", &UW, &UH, &A, &B, &AB) == 5 && (UW | UH | A | B | AB) != 0) {
		double ra;
		double rb;
		double xa, ya;
		double xbs, ybs;
		double left = 0, right = 2;
		int i;
		int swapped = 0;
		if (A < B) {
			int t = A;
			A = B;
			B = t;
			swapped = 1;
		}
		ra = sqrt(A / PI);
		rb = sqrt(B / PI);
		xa = ra; ya = ra;
		xbs = UW - rb; ybs = UH - rb;
		if (ra + ra > UW + EPS || ra + ra > UH + EPS || rb + rb > UW + EPS || rb + rb > UH + EPS) {
			puts("impossible");
			continue;
		}
		for (i = 0; i < 100; i++) {
			double mid = (left + right) / 2.0;
			double xb = xa + (xbs - xa) * mid;
			double yb = ya + (ybs - ya) * mid;
			double dist = sqrt((xb - xa) * (xb - xa) + (yb - ya) * (yb - ya));
			double ab;
			if (dist >= ra + rb) {
				ab = 0;
			} else if (dist <= fabs(ra - rb)) {
				ab = A <= B ? A : B;
			} else {
				/* ra * ra - x * x == rb * rb - (dist - x) * (dist - x) */
				/* ra * ra - x * x == rb * rb - dist * dist + 2 * dist * x - x * x */
				/* 2 * dist * x == ra * ra - rb * rb + dist * dist */
				double x = (ra * ra - rb * rb + dist * dist) / (2.0 * dist);
				double y = sqrt(ra * ra - x * x);
				/* ougi gata no menseki = r * r * PI * (theta / (2 * PI)) = r * r * theta / 2 */
				ab = ra * ra * atan2(y, x) + rb * rb * atan2(y, dist - x) - dist * y;
			}
			if (ab > AB) {
				/* ookisugiru node kyori wo fuyasite menseki wo herasu */
				left = mid;
			} else {
				/* tiisasugiru node kyori wo herasite menseki wo fuyasu */
				right = mid;
			}
		}
		if (left > 1.0 + EPS) {
			puts("impossible");
		} else {
			if (swapped) {
				printf("%.15f %.15f %.15f %.15f %.15f %.15f\n",
					xa + (xbs - xa) * left, ya + (ybs - ya) * left, rb,
					xa, ya, ra);
			} else {
				printf("%.15f %.15f %.15f %.15f %.15f %.15f\n", xa, ya, ra,
					xa + (xbs - xa) * left, ya + (ybs - ya) * left, rb);
			}
		}
	}
	return 0;
}

Measured memory_bytes: 728
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF = 1e9, MOD = 1e9 + 7, ohara = 1e6 + 10;
const ll LINF = 1e18;
using namespace std;

#define rep(i, n) for (int(i) = 0; (i) < (int)(n); (i)++)
#define rrep(i, a, b) for (int i = (a); i < (b); i++)
#define rrrep(i, a, b) for (int i = (a); i >= (b); i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout << (x) << endl
#define Cerr(x) cerr << (x) << endl
#define fi first
#define se second

ll n, cnt, ans = LINF, a, b, c, grid[505][505], d[35][35], tmp, tmpp, m, h, w, x, y, sum, pos, cal[35][3000];
ld doua;
int dy[] = {1, 0, -1, 0};
int dx[] = {0, 1, 0, -1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"), s;
bool fl;
struct edge
{
    int to, cost;
};

//-------------------------↓↓↓↓↓↓------------------------

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

    cin >> n >> c;
    rep(i, c) rep(j, c) cin >> d[i][j];
    rep(i, n) rep(j, n) cin >> grid[i][j], grid[i][j]--;
    rep(i, n)
    {
        rep(j, n)
        {
            if ((i + 1 + j + 1) % 3 == 0)
                cal[grid[i][j]][0]++;
            else if ((i + 1 + j + 1) % 3 == 1)
                cal[grid[i][j]][1]++;
            else
                cal[grid[i][j]][2]++;
        }
    }
    rep(i, c)
    {
        rep(j, c)
        {
            rep(k, c)
            {
                if (i == j || i == k || j == k)
                    continue;
                rep(zz, c)
                {
                    cnt += d[zz][i] * cal[zz][0];
                    cnt += d[zz][j] * cal[zz][1];
                    cnt += d[zz][k] * cal[zz][2];
                }
                ans = min(ans, cnt);
                cnt = 0;
            }
        }
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 2304
#include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<algorithm>
#include<unordered_map>
using namespace std;

bool stringcompare (const string& str1, const string& str2){
    int min_len = min(str1.length(), str2.length());
    for(int i = 0; i < min_len; i++){
        if(str1[i] < str2[i])
            return true;
        else if(str1[i] > str2[i])
            return false;
    }
    if(str1.length() < min_len)
        return true;
    else
        return false;
}
int main(){
    int N, L;
    vector<string> s_vector;
    cin >> N >> L;
    s_vector.resize(N);
    for(int i = 0; i < N; i++){
        cin >> s_vector[i];
    }
    sort(s_vector.begin(), s_vector.end(), stringcompare);
    for(int i = 0; i < N; i++){
        cout << s_vector[i];
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
vector<ll> vc;
void findans(ll num,ll f){
	if(num>1e10) return ;
	if(f!=-1){
		//cout<<num<<endl;
		vc.ps(num);
	}
	if(f==-1){
		ll i,k;
		for(i=1;i<=9;i++){
			k=num*10+i;
			findans(k,i);
		}
	}
	else{
		ll i,k;
		for(i=0;i<=9;i++){
			if(abs(i-f)<=1){
				k=num*10+i;
				findans(k,i);
			}
		}
	}
}
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	findans(0,-1);
	// cout<<vc.size()<<endl;
	sort(all(vc));
	cin>>k;
	cout<<vc[k-1];
	return 0;
}

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

int main ()
{
	int x, cnt, amari;
  	cin >> x;
  	cnt = x / 100;
  	amari = x % 100;
  	if (amari <= cnt * 5)
    {
    	cout << 1 << endl;
    }
  	else
    {
    	cout << 0 << endl;
    }
}

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

#include<stdio.h>
#include<algorithm>
#include<iostream>
#include<string.h>
#include<string>
#include<math.h>
#include<vector>

using namespace std;

typedef long long ll;
typedef pair<int,int> pa;

#define fst first 
#define snd second

const int maxn=1500005,maxm=2100;
const double pi=acos(-1.0);
const ll mod=1000000007;

int n,x,l[maxn];

int main()
{
	ios_base::sync_with_stdio(false);
	int i,j,k;
	cin>>n>>x;
	for(i=0;i<n;i++) cin>>l[i];
	int ans=1,ct=0;
	for(i=0;i<n;i++)
	{
		ct+=l[i];
		ans+=(ct<=x);
	}
	cout<<ans<<"\n";
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BRollerCoaster solver = new BRollerCoaster();
        solver.solve(1, in, out);
        out.close();
    }

    static class BRollerCoaster {
        public void solve(int testNumber, FastReader s, PrintWriter out) {
            int n = s.nextInt();
            int k = s.nextInt();
            int[] arr = s.nextIntArray(n);
            int count = 0;
            for (int i = 0; i < n; i++) {
                if (arr[i] >= k) {
                    count++;
                }
            }

            out.println(count);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public int[] nextIntArray(int n) {
            int[] array = new int[n];
            for (int i = 0; i < n; ++i) array[i] = nextInt();
            return array;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}



Measured memory_bytes: 21840
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author yassin
 */

#include <fstream>

#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <cstdlib>
#include <tuple>
#include <queue>
#include <functional>
#include <stack>
#include <cassert>

using namespace std;

constexpr int MAX = 10*40;
constexpr int MXVAL = 1 << 29;

class atD {
public:
    void solve(istream &in, ostream &out) {
        int N, Ma, Mb;
        in >> N >> Ma >> Mb;
        
        vector<int> a(N), b(N), c(N);
        for (int i = 0; i < N; ++i) {
            in >> a[i] >> b[i] >> c[i];
        }
        
        vector<vector<int>> dp(MAX + 1, vector<int>(MAX + 1, MXVAL));
        dp[0][0] = 0;
        
        for (int m = 0; m < N; ++m) {
            vector<vector<int>> dpnew(dp);
    
            for (int i = 0; i <= MAX; ++i) {
                for (int j = 0; j <= MAX; ++j) {
                    if (i - a[m] >= 0 && j - b[m] >= 0) {
                        dpnew[i][j] = min(dpnew[i][j], dp[i - a[m]][j - b[m]] + c[m]);
                    }
                }
            }
            
            dp = dpnew;
        }
        
        /*for (int i = 0; i <= 20; ++i) {
            for (int j = 0; j <= 20; ++j) {
                cout << (dp[i][j] == MXVAL ? -1 : dp[i][j]) << " ";
            }
            cout << endl;
        }*/
        
        int res = MXVAL;
        /*for (int i = 0; i <= MAX; ++i) {
            for (int j = 0; j <= MAX; ++j) {
                if (i && i * Ma == j * Mb) {
                    res = min(res, dp[i][j]);
                }
            }
        }*/
        for (int i = 1; i * Ma <= MAX && i * Mb <= MAX; ++i) {
            res = min(res, dp[i * Ma][i * Mb]);
        }
        
        out << (res == MXVAL ? -1 : res) << endl;
    }
};


int main() {
	std::ios::sync_with_stdio(false);

	atD solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main() {

    int n;
    cin >> n;

    for (int i = 1; i <= 9; i++) {
        if ((n % i == 0) && (n / i <= 9)) {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;
    return 0;
}


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

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int, int> P;
typedef long long LL;
#define ALL(a) (a).begin(),(a).end()
#define PB push_back
#define MP make_pair
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define IFOR(v,it) for(VI::iterator it=(v).begin();it!=(v).end();++it)
#define IN(v) cin>>v
#define OUT(v) cout<<v<<endl


int main() {
  int N, K;
  cin >> N >> K;

  vector<LL> H;
  REP(i, N) {
    LL h;
    cin >> h;
    H.PB(h);
  }
  SORT(H);
  LL res = 1000000000;
  REP(i, N-K+1)
    res = min(H[i+K-1] - H[i], res);

  OUT(res);


  return 0;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
const int N = 2e5 + 10;
const ll inf = 1e15 + 42;
#define endl "\n"
const ll mod = 1000000007;
 
void testCase() {
    ll k;
    cin >> k;
    ll ans = 0;
    for (ll i=1; i<=k; i++) {
        for (ll j=1; j<=k; j++) {
            for (ll l=1; l<=k; l++) {
                ll gg = __gcd (i, j);
                gg = __gcd (gg, l);
                ans += gg;
            }
        }
    }
    cout << ans << endl;
}
 
int main() {
    ios_base :: sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    testCase();
    return 0;
}

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

int main(void){
  vector<int> vec(5);
  int mod_min;
  int sum = 0;
  for(int i = 0; i < 5; i++){
    cin >> vec[i];
    sum += int(vec[i] / 10) * 10;
    if(vec[i] % 10 != 0){
      sum += 10;
      mod_min = vec[i] % 10;
      
    }
  }
  for(int i = 0; i < 5; i++){
     if(vec[i] % 10 != 0 && vec[i] % 10 < mod_min){
      mod_min = vec[i] % 10;      
    }
  }
  if(mod_min!=0)  cout << sum - 10 + mod_min;
  else cout << sum;
 return 0;
}

Measured memory_bytes: 256