akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
#define debug(a) cout << #a ": " << a << endl
using namespace std;
typedef long long ll;

int main(void){
    IOS;
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int d = (h2-h1+24)%24*60-m1+m2;
    cout << max(0, d-k) << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

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

int N, Q;
vector<int> y;
vector<string> name;

int main() {
    cin >> N >> Q;
    y.resize(N+1);
    name.resize(N+1);
    y[0] = 0;
    name[0] = "kogakubu10gokan";
    for (int j = 1; j <= N; ++j) {
        cin >> y[j] >> name[j];
    }
    cout << name[upper_bound(begin(y), end(y), Q) - 1 - begin(y)] << endl;
    return 0;
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    string S;
    cin >> S;
    int cnt = 0;
    int N = S.size();
    rep(i,0,N/2){
        int j = N - i - 1;
        if(S[i] != S[j])cnt++;
    }
    cout << cnt << endl;
}

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

using namespace std;
using ll = long long;

#define INF (1LL << 60)

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    ll N, R;
    cin >> N >> R;

    if (N >= 10) {
        _PR(R);
    }
    else {
        R = R + 100 * (10 - N);
        _PR(R);
    }

    return 0;
}

/*



*/

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

using namespace std;

int f(int k) {
  if (k % 2 == 1)
    return 0;
  else
    return f(k/2) + 1;
  
}

int main() {
  string s;
  cin >> s;
  if (s[0] == '9' || s[1] == '9') {
    printf("Yes");
    return 0;
  }
  printf("No");
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << '\n';}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
int main() {
	vec(int, a, 3);
	sort(rall(a));
	print(a[0] * 10 + a[1] + a[2]);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define call(var) cerr<<#var<<"="<<var<<endl;
#define dup(x,y) (((x)+(y)-1)/(y))
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using Graph = vector<vi>;
using P = pair<int,int>;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;
template<class t,class u> inline bool chmax(t&a,u b){if(a<b){a=b;return true;}return false;}
template<class t,class u> inline bool chmin(t&a,u b){if(b<a){a=b;return true;}return false;}

int main(){
    int n,m;cin >> n >> m;
    Graph G(n);
    rep(i,m){
        int a,b;cin >> a >> b;
        --a;--b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vb seen(n,0);
    queue<int> q;
    vi ans(n);
    q.push(0);
    seen[0] = true;

    while(q.size()){
        int v = q.front();
        q.pop();

        for(int nv : G[v]){
            if(seen[nv]) continue;
            ans[nv] = v;
            seen[nv] = true;
            q.push(nv);
        }
    }

    for(int i=0;i<n;++i){
        if(!seen[i]){
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";
    for(int i=1;i<n;++i){
        cout << ans[i]+1 << endl;
    }
}

Measured memory_bytes: 10184
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int P,Q,R;
  cin >> P >> Q >> R;
  int X,Y,Z,W;
  X = P + Q;
  Y = Q + R;
  Z = R + P;
  W = min(X,Y);
    if ( Z < W ) {
      cout << Z << endl;
}
  else {
   cout << W << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
	
int main(){
	int X, A, B;
	cin >> X >> A >> B;
	if(A >= B) cout << "delicious" << endl;
	else if(A < B){
		if(A + X >= B) cout << "safe" << endl;
		else cout << "dangerous" << endl;
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#define _USE_MATH_DEFINES
#include <math.h>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <stdlib.h>
#include <functional>
#include <string>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#include <nmmintrin.h>
#include <chrono>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#ifdef _MSC_VER
#define __builtin_popcount _mm_popcnt_u32
#define __builtin_popcountll _mm_popcnt_u64
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}


signed main() {
	int n;
	cin >> n;
	vector<ll> num(n);

	REP(i, n)
		scanf("%lld", &num[i]);



	ll cur = 0;
	ll ans = 0;
	bool cf = 1;
	REP(i, n){
		cur += num[i];
		if (!cf && cur > 0){
			ans += abs(cur)+1LL;
			cur = -1;
		}
		else if (cf && cur < 0){
			ans += abs(cur) + 1LL;
			cur = 1;
		}

		if (cur == 0){
			ans++;
			cur = cf*2-1;
		}

		cf = 1 - cf;
	}

	ll ans2 = 0;
	cur = 0, cf = 0;
	REP(i, n){
		cur += num[i];
		if (!cf && cur > 0){
			ans2 += abs(cur) + 1LL;
			cur = -1;
		}
		else if (cf && cur < 0){
			ans2 += abs(cur) + 1LL;
			cur = 1;
		}

		if (cur == 0){
			ans2++;
			cur = cf*2-1;
		}

		cf = 1 - cf;
	}

	printf("%lld\n", min(ans2,ans));




	return 0;
}

Measured memory_bytes: 1024
import heapq

n,m  = map(int,input().split())
a = list(map(int, input().split()))
bcs = []
for _ in range(m):
    bcs.append(list(map(int, input().split())))

heapq.heapify(a)
bcs.sort(key=lambda x: x[1],reverse=True)

for bc in bcs:
    b = bc[0]
    c = bc[1]
    while b > 0:
        ta = heapq.heappop(a)
        if ta < c:
            heapq.heappush(a,c)
        else:
            heapq.heappush(a,ta)
            break
        b -= 1

print(sum(a))

Measured memory_bytes: 32980
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

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

const int N = 2e5 + 5;

vector<int> g[N];
int add[N];
int ans[N];

void dfs(int v, int p = -1, int val = 0) {
    val += add[v];
    ans[v] = val;
    for (int u : g[v]) {
        if (u != p) {
            dfs(u, v, val);
        }
    }
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, q;
    cin >> n >> q;
    for (int i = 1; i < n; i++) {
        int a, b;
        cin >> a >> b;
        g[a].push_back(b);
        g[b].push_back(a);
    }
    for (int i = 0; i < q; i++) {
        int p, x;
        cin >> p >> x;
        add[p] += x;
    }
    dfs(1);
    for (int i = 1; i <= n; i++) {
        cout << ans[i] << ' ';
    }
    return 0;
}

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


int main ()
{
	int a=0,b=0,c=0,d=0,e=0;
	
	cin>>a>>b>>c>>d>>e;
	
	int A=9999,B=9999;
	
	if(a<A)A=a;
	if(b<A)A=b;
	if(c<A)A=c;
	if(d<B)B=d;
	if(e<B)B=e;
	
	cout<<A+B-50<<endl;
	
	
	
	
	
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define maxn 100001
using namespace std;
typedef long long ll;
ll f[maxn],ans;
int main(){
	ll n,V;
	cin>>n>>V;
	ll w,v;
	memset(f,0x3f3f3f3f,sizeof(f));
	f[0]=0;
	for(int i=1;i<=n;i++){
		cin>>w>>v;
		for(int j=1e5;j>=v;j--){ 
			f[j]=min(f[j],f[j-v]+w);
			if(f[j]<=V) ans=max(ans,ll(j));
		} 
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 1024
# Dynamic Programming implementation of LCS problem 

def lcs(X , Y): 
	# find the length of the strings 
	m = len(X) 
	n = len(Y) 

	# declaring the array for storing the dp values 
	L = [[None]*(n+1) for i in range(m+1)] 

	"""Following steps build L[m+1][n+1] in bottom up fashion 
	Note: L[i][j] contains length of LCS of X[0..i-1] 
	and Y[0..j-1]"""
	for i in range(m+1): 
		for j in range(n+1): 
			if i == 0 or j == 0 : 
				L[i][j] = 0
			elif X[i-1] == Y[j-1]: 
				L[i][j] = L[i-1][j-1]+1
			else: 
				L[i][j] = max(L[i-1][j] , L[i][j-1]) 

	# L[m][n] contains the length of LCS of X[0..n-1] & Y[0..m-1] 
	idx = L[m][n]
	ans = [''] * (idx+1)
	ans[idx] = ""

	i, j = m, n
	while i> 0 and j >0:
		if X[i-1] == Y[j-1]:
			ans[idx-1] = X[i-1]
			i-=1
			j-=1
			idx-=1
		elif L[i-1][j] > L[i][j-1]:
			i-=1
		else:
			j-=1
#end of function lcs 
	return "".join(ans)


# Driver program to test the above function 
X = input()
Y = input()

print (lcs(X, Y))


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

int main() {
  int H, W;
  cin >> H >> W;

  vector<string> data(H);

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

  for (int i = -1; i <= H; i++) {
    for (int j = -1; j <= W; j++) {
      if (i < 0 || H <= i) {
        cout << '#';
      }
      else {
        if (j < 0 || W <= j) {
          cout << '#';
        }
        else {
          cout << data.at(i).at(j);
        }
      }
    }
    cout << endl;
  }
}


Measured memory_bytes: 256
N, K = map(int, input().split())
s = input() #LRLRRL 群の数5 = 区切りの数4 + 1

cnt = s.count('RL') + s.count('LR')
change = min(cnt, K) # 挙げられる幸福度がK以上でないか

ans = N - (cnt + 1) + 2 * change # 幸福な人間+改善
print(min( N-1 , ans )) # 最高でもRRRRで端の人は不幸

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/21  Problem: ABC 058 B / Link: http://abc058.contest.atcoder.jp/tasks/abc058_b  ----- */


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

	string s, t; cin >> s >> t;
	FOR(i, 0, SZ(t)) {
		cout << s[i] << t[i];
	}
	if (SZ(s) != SZ(t)) {
		cout << s.back();
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 256
n = int(input())
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
C = [int(c) for c in input().split()]

point = 0
i = 0

while  i < n :
    point += B[A[i] - 1]
    if i > 0 and A[i-1] == A[i] - 1 :
        point += C[A[i-1]-1]
    i += 1

print(point)

Measured memory_bytes: 3064
s = gets.chomp.split(" ")
q = gets.chomp.to_i

flag = 0

q.times do
  t,f,c = gets.chomp.split(" ")
  if t == "1"
    flag = flag == 0 ? 1 : 0
  else
    if f == "1"
      s.unshift(c) if flag == 0
      s << c if flag ==1
    else
      s.unshift(c) if flag == 1
      s.push(c) if flag == 0
    end
  end
end

puts flag == 0 ? s.join() : s.join().reverse

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

int main() {
    int A, B;
    cin >> A >> B;
    if (A == 1) A += 13;
    if (B == 1) B += 13;
    if (A > B) cout << "Alice" << endl;
    else if (A == B) cout << "Draw" << endl;
    else cout << "Bob" << endl;
    return 0;
}

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

int main(void)
{
    int i, j;

    for (i = 1; i <= 9; i++) {
        for (j = 1; j <= 9; j++) {
            printf("%dx%d=%d\n", i, j, i*j);
        }
    }

    return 0;
}

Measured memory_bytes: 1096
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        int n = sc.nextInt();

        int ans;
        if (h >= w) {
            if (n % h != 0) ans = n / h + 1;
            else ans = n / h;
        } else {
            if (n % w != 0) ans = n / w + 1;
            else ans = n / w;
        }
        System.out.println(ans);
    }
}


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

typedef long long ll;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    ll sum=0;
    for(int i=1;i<=n;i++){
        if(i%5==0||i%3==0)continue;
        sum+=i;
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 3652
a,b,c,x = map(int, [input() for i in range(4)])
ans = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if i * 500 + j * 100 + k * 50 == x:
                ans += 1
print(ans)

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int n,key,A[100],j;

void print_table(){
  for(int i=0;i<n;i++){
    if(i)cout<<' ';
    cout<<A[i];
  }
  cout<<endl;
}

int main(){

  cin>>n;
  for(int i=0;i<n;i++)cin>>A[i];
  print_table();
  for(int i=1;i<n;i++){
    key=A[i];
    j=i-1;
    while(j>=0&&A[j]>key){
      A[j+1]=A[j];
      j--;
    }
    A[j+1]=key;
    print_table();
  }
  return 0;
}

Measured memory_bytes: 1160
using System;

namespace abc172
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();
            var count = 0;
            for (var i = 0; i < s.Length; ++i)
            {
                count += s[i].CompareTo(t[i]) != 0 ? 1 : 0;
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 27424
#include<bits/stdc++.h>
using namespace std;
#define ll         long long int
#define co         cout
#define ci         cin
#define sf1(n)     scanf("%lld",&n)
#define sf2(n,m)   scanf("%lld %lld",&n,&m);
#define sf3(n,m,p) scanf("%lld %lld %lld",&n,&m,&p);
#define pf1(n)     printf("%lld\n",n);
#define en         cout<<endl;
#define pb         push_back
#define fi         first
#define se         second
#define coy        cout<< "YES"<<endl;
#define con        cout<< "NO"<<endl;
#define f(a,b)     for(ll i=a;i<b;i++)
#define pi         pair<ll,ll>
#define br         break;
#define i64        long long

int main()
{
    ll t,n,c,res;
    ci>>n>>c;
    char ch;
    ci>>ch;
    ci>>t;
    c*=100;
    c+=t;
    n*=c;
    n/=100;
    co<<n;
}




Measured memory_bytes: 3632
using System;
using System.Dynamic;
using System.Linq;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            char[] inputNum = Console.ReadLine().Split(' ').Select(i => char.Parse(i)).ToArray();
            if ((int)inputNum[0] < (int)inputNum[1]) {
                Console.WriteLine(new string(inputNum[0], (int)inputNum[1] - '0'));
            }
            else
            {
                Console.WriteLine(new string(inputNum[1], (int)inputNum[0]-'0'));
            }
        }
    }
}


Measured memory_bytes: 26384
N = int(input())
H = []
ans = "a"
#for i in range(N):
#  a = list(map(int, input().split()))
#  H += [a]
H = list(map(int, input().split()))
I = H[0]
if len(H) == 0:
  ans = "Yes"
for i in range(1, len(H)):
  P = I
  I = H[i]
  if I > P:
    I = I - 1
  if I < P:
    ans = "No"
#  print(ans)
#  print("-----")
if ans not in "No":
  ans = "Yes"
print(ans)





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

class Main {

  private static long INF = -Long.MAX_VALUE / 4;

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int N = Integer.parseInt(scanner.next());
    int[][] p = new int[N][3];
    for (int i = 0; i < N; i++) {
      for (int j = 0; j < 3; j++) {
        p[i][j] = Integer.parseInt(scanner.next());
      }
    }
    long[][] dp = new long[N + 1][3];
    for (long[] ls : dp) {
      Arrays.fill(ls, INF);
    }
    Arrays.fill(dp[0], 0);
    for (int i = 1; i <= N; i++) {
      for (int j = 0; j < 3; j++) {
        for (int k = 0; k < 3; k++) {
          if (j != k) {
            dp[i][j] = Math.max(dp[i][j], dp[i - 1][k] + p[i - 1][j]);
          }
        }
      }
    }
    long ans = INF;
    for (long i : dp[N]) {
      ans = Math.max(ans, i);
    }
    System.out.println(ans);
  }

}


Measured memory_bytes: 66824
while True:
    n = int(input())
    if n == 0:
        break
    
    s = list(map(int,input().split()))
    m = sum(s) / n
    t = 0
    for si in s:
        t += (si - m) ** 2
    a = (t /n) **0.5
    print("{:.5f}".format(a))


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

int main ()
{
    long n, c, k;
    cin >> n >> c >> k;
    long t[n];
    rep(i, n) cin >> t[i];

    sort(t, t+n);

    long passenger_n = 1;
    long endure_t = t[0];
    long res = 1;
    for (int i = 1; i < n; i++) {
        passenger_n++;
        if (passenger_n <= c) {
            if (t[i] > endure_t + k) {
                res++;
                endure_t = t[i];
                passenger_n = 1;
            }
        }
        else if (passenger_n > c) {
            res++;
            endure_t = t[i];
            passenger_n = 1;
        }
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
const ll INF=1e18;
const int MOD=1e9+7;
const double pi=acos(-1);


int main(){
  int n,m;
  cin >> n >> m;
  int ans=0;
  if(n==0&&m==2)ans=1;
  else if(m==0&&n==2)ans=1;
  else if(m==1&&n==1)ans=0;
  else{
    if(n==1 || n==0)ans=m*(m-1)/2;
    else if(m==1|| m==0)ans=n*(n-1)/2;
    else{
      ans=m*(m-1)/2+n*(n-1)/2;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update

using namespace std;
using namespace __gnu_pbds;

//find_by_order gives kth-largest element
//order_of_key gives the number of items in the set that are strictly smaller!!

// OT.find_by_order(k-1)
// 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define db4(x, y, z, w) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << "," << #w << "=" << w << endl
#define ll long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define X first
#define Y second
#define sz(x) (int)((x).size())
#define pii pair<int,int>
#define MOD (ll)(1e9 + 7)
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
typedef vector<int> vi;
#define inf (ll)(1e18)
#define double long double
#define int long long

//////////////////////

int32_t main() {

    ios::sync_with_stdio(false);
    cin.tie(0); 
    cout.tie(0);

    int n,m;
    cin >> n >> m;

    vector<pii> rwd(n);

    rep(i,n)
        cin >> rwd[i].X >> rwd[i].Y;

    sort(all(rwd));
    priority_queue<pii> Q;

    int itr = 1, ptr = 0, tot = 0;
    while(itr <= m) {
        if(ptr != n) {
            for(int i = ptr; i < n && rwd[i].X <= itr; i ++) {
                Q.push({rwd[i].Y, rwd[i].X});
                ptr ++;
            }
        }
        
        if(!Q.empty()) {
            tot += Q.top().X;
            Q.pop();
        }
        itr ++;
    }

    cout << tot << '\n';
}

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

long long Q, H, S, D, N;

int main() {
    cin >> Q >> H >> S >> D >> N;
    cout << (N / 2) * min({8 * Q, 4 * H, 2 * S, D}) + (N % 2) * min({4 * Q, 2 * H, S}) << "\n";
}


Measured memory_bytes: 256
abc = [int(i) for i in input().split(' ')]
a = abc[0]
b = abc[1]
c = abc[2]
if c-a-b < 0:
    print('No')
else:
    if 4*a*b < (c-a-b)**2:
      print('Yes')
    else:
        print('No')

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int limit = 50;

int n,m;
int a[limit],b[limit];
bool graph[limit][limit];
bool visited[limit];

void dfs(int v){
    visited[v] = true;
    for(int v2 = 0;v2 < n; ++v2){
        if(graph[v][v2] == false) continue;
        if(visited[v2] == true) continue;
        dfs(v2);
    }
}

int main(void){
    cin >> n >> m;
    for(int i = 0;i<m;++i){
        cin >> a[i] >> b[i];
        a[i]--,b[i]--;
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
    }
    int ans = 0;
    
    for(int i = 0;i<m;++i){
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;
        for(int j = 0;j < n;++j) visited[j] = false;
        
        dfs(0);
        bool bridge = false;
        for(int j = 0;j<n;++j)if(visited[j] == false) bridge = true;
        if(bridge) ans += 1;
        
        graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
        
        
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
x1, y1, x2, y2 = list(map(int, input().split()))

x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)

x4 = x3 - (y3 - y2)
y4 = y3 + (x3 - x2)

print(x3, y3, x4, y4)


Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define LLMAX (1ll << 60) - 1
#define INTMAX (1 << 30) - 1
#define MOD 1000000007 
#define NMAX 1000*100+1

#define numberOfSetBits(S) __builtin_popcount(S) // __builtin_popcountl(S) __builtin_popcountll(S)
#define MSET(x,y) memset(x,y,sizeof(x))
#define gcd(a,b) __gcd(a,b)
#define all(x)  x.begin(),x.end()
#define isOn(S, j) (S & (1 << j))
#define endl '\n'
#define setBit(S, j) (S |= (1 << j))
#define clearBit(S, j) (S &= ~(1 << j))
#define toggleBit(S, j) (S ^= (1 << j))
#define print(x)    for(auto it:x) cout<<it<<' '; cout<<endl;
#define printii(x)  for(auto it:x) cout<<it.F<<' '<<it.S<<'\t';  cout<<endl;
#define in(x,n)   for(int e=0;e<n;e++){ll y;cin>>y;x.pb(y);}

#define vi vector<ll>
#define vvi vector<vi>
#define ii pair<ll,ll>
#define pll pair<ll,ll>
#define vii vector<ii>
#define vvii vector<vii>
#define viii vector<pair<ii,ll>>
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mc(a,b,c) mp(mp(a,b),c)


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,x,t,m,y,z = 40000;
    cin>>n;
    vi a(n),b(n),p;
    for(int i=0;i<n;i++){
        a[i] = 30000*(i+1);
        b[i] = 30000*(n-i);
    }
    in(p,n);
    for(int i=0;i<n;i++){
        b[p[i]-1]+=i;
    }
    print(a);
    print(b);
    


    return 0;
}

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

typedef long long ll;

const int MOD = 1e9 + 7;
const int N = 2e6 + 5;

int f[N], inv[N], finv[N];
// inv[]: inverse element

int powMod(int u, int v) {
    int res = 1;
    while (v) {
        if (v & 1) res = (ll)res * u % MOD;
        v >>= 1;
        u = (ll) u * u % MOD;
    }
    return res;
}

void initInv() {
    f[0] = 1;
    for (int i = 1; i < N; i++) {
        f[i] = (ll)f[i - 1] * i % MOD;
    }
    inv[0] = inv[1] = 1;
    for (int i = 2; i < N; i++) {
        inv[i] = (ll)(MOD - MOD / i) * inv[MOD % i] % MOD;
    }
    finv[0] = finv[1] = 1;
    for (int i = 2; i < N; i++) {
        finv[i] = ((ll)finv[i - 1] * inv[i]) % MOD;
    }
}

int C(int x, int y) {
    if (y < 0) return 0;
    return ((ll)f[x] * finv[y] % MOD) * finv[x - y] % MOD;
}

int Lucas(int u, int v) {
    if (v == 0) return 1;
    return (ll)C(u % MOD, v % MOD) * Lucas(u / MOD, v / MOD) % MOD;
}

int k, n, ans;
string s;

int main() {
    ios::sync_with_stdio(false);
    initInv();
    cin >> k >> s;
    n = s.length();
    for (int pref = 0; pref <= k; pref++) {
        ans = (ans + ((ll)powMod(26ll, pref) * powMod(25ll, k - pref) % MOD * Lucas(n + k - 1 - pref, n - 1) % MOD)) % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 27748
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
ll max(ll a, ll b)
{
    if(a>=b) return a; else return b;
}
ll min(ll a, ll b)
{
    if(a<=b) return a; else return b;
}
ll ans[100000];
ll f(ll a[],ll n, ll k)
{
    if(n==0) {ans[n]=0; return ans[n];}
    if(ans[n]!=-1) return ans[n];
    ll minn=INT_MAX;
    for(ll i=n-1;i>=max(0,n-k);i--)
    {
        //cout<<"yay"<<endl;
        minn=min(minn,f(a,i,k)+abs(a[n]-a[i]));
    }
    ans[n]=minn;
    return ans[n];
}
int main() {
    for(ll i=0;i<100000;i++)
    {
        
            ans[i]=-1;
        
    }
	ll n,k;
	cin>>n>>k;
	ll a[n];
	for(ll i=0;i<n;i++) cin>>a[i];
	
	cout<<f(a,n-1,k)<<endl;
	return 0;
}


Measured memory_bytes: 9600
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

N, K = map(int, input().split())
H = list(map(int, input().split()))

dp = [float('inf')] * N
dp[0] = 0
for i in range(N):
    for j in range(i+1, min(i+K+1, N)):
        dp[j] = min(dp[j], abs(H[j]-H[i])+dp[i])
#        print(dp)

print(dp[-1])


Measured memory_bytes: 55004
N = int(input())
lis = list(map(int, input().split()))
ans = 0
for i in range(1, N):
  if lis[i-1] > lis[i]:
    ans += lis[i-1]-lis[i]
    lis[i] += lis[i-1]-lis[i]
    
print(ans)

Measured memory_bytes: 32140
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int N,M;
int memo[1009][1009];
bool vis[1009][1009];
bool g[1009][1009];
ll mod=1e9+7;
int sol(int y,int x){
  if(x>=M || y>=N || g[y][x])return 0;
  if(x==M-1 && y==N-1)return 1;
  if(vis[y][x])return memo[y][x];
  vis[y][x]=1;
  return memo[y][x]=(sol(y+1,x)+sol(y,x+1))%mod;
}
int main(){
		ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
		//freopen("input.txt","r",stdin);
		//freopen("output.txt","w",stdout);
		cin>>N>>M;
		for(int i=0;i<N;i++){
      string a;
      cin>>a;
      for(int j=0;j<M;j++){
        g[i][j]=(a[j]=='#');
      }
		}
		cout<<sol(0,0);
    return 0;
}

Measured memory_bytes: 6272
#include <bits/stdc++.h>
#define int long long int
#define MOD(x) ((x % MOD_N) + MOD_N) % MOD_N
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define RFORE(i,a,b) for(int i=(b);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define RALL(c) (c).rbegin(),(c).rend()
#define SORT(c) sort(ALL(c))
#define RSORT(c) sort(RALL(c))
#define SZ(c) (int)((c).size())
#define EACH(i,v) for(auto i=v.begin();i!=v.end();++i)
#define REACH(i,v) for(auto i=v.rbegin();i!=v.rend();++i)
#define LB(c,x) distance((c).begin(),lower_bound(ALL(c),x))
#define UB(c,x) distance((c).begin(),upper_bound(ALL(c),x))
#define COUNT(c,x) (upper_bound(ALL(c),x)-lower_bound(ALL(c),x))
#define UNIQUE(c) SORT(c); (c).erase(unique(ALL(c)),(c).end());
#define COPY(c1,c2) copy(ALL(c1),(c2).begin())
#define EXIST(s,e) (bool)((s).find(e)!=(s).end())
#define PB push_back
#define MP make_pair
#define DUMP(x)  cerr<<#x<<" = "<<(x)<<endl;
#define NL cerr<<endl;
using namespace std;
template<typename T,typename U> using P=pair<T,U>;
template<typename T> using V=vector<T>;
template<typename T>bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<typename T>T sum(vector<T>&v){return accumulate(ALL(v),T());}
template<typename T>T sum(vector<T>&v,int a,int b){return accumulate(v.begin()+a,v.begin()+b,T());}
template<typename T>T max(vector<T>&v){return *max_element(ALL(v));}
template<typename T>T min(vector<T>&v){return *min_element(ALL(v));}
template<typename T>T max_index(vector<T>&v){return distance((v).begin(),max_element(ALL(v)));}
template<typename T>T min_index(vector<T>&v){return distance((v).begin(),min_element(ALL(v)));}

struct edge { int to, cost; };

template<typename T>auto&operator<<(ostream&s,const vector<T>&v){s<<"[";bool a=1;for(auto e:v){s<<(a?"":" ")<<e;a=0;}s<<"]";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const pair<T,U>&p){s<<"("<<p.first<<","<<p.second<<")";return s;}
template<typename T>auto&operator<<(ostream&s,const set<T>&st){s<<"{";bool a=1;for(auto e:st){s<<(a?"":" ")<<e;a=0;}s<<"}";return s;}
template<typename T,typename U>auto&operator<<(ostream&s,const map<T,U>&m){s<<"{";bool a=1;for(auto e:m){s<<(a?"":" ")<<e.first<<":"<<e.second;a=0;}s<<"}";return s;}

const int INF = 1e18;
const int MOD_N = 1e9+7;

signed main()
{
   int n; cin >> n;
   V<int> p(n); REP(i, n) cin >> p[i];

   V<int> len(n+1);
   REP(i, n) {
      len[p[i]] = len[p[i]-1] + 1;
   }
   cout << n - max(len) << endl;

   return 0;
}


Measured memory_bytes: 3328
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
typedef pair<int, int> PII;
typedef long long ll;
template<typename T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template<typename T> bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


ll h, tmp, ans;

int main() {

	cin >> h;

	ans = 1;
	tmp = 2;

	while (tmp <= h) {
		ans += tmp;
		tmp *= 2;
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner

import scala.util.control.Breaks

object Main extends App {
  val sc = new Scanner(System.in)
  var s = sc.nextLine()

  val b = new Breaks

  b.breakable {
    for (seq <- Seq("dreamer", "eraser", "dream", "erase").permutations) {
      s.replace(seq(0),"").replace(seq(1),"").
        replace(seq(2),"").replace(seq(3),"").
        length match {
        case 0 => {
          println("YES")
          b.break()
        }
        case _ =>
      }
    }
    println("NO")
  }

}


Measured memory_bytes: 61552
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define endl '\n'
const int inf = 1000000007;
const ll INF = 1e18;
// int mod = 998244353;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { if (b == 0) return a; return gcd(b, a % b); }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
ll pow(ll a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<typename T> inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T, class T2> inline void add(T &a, T2 b) { a += b; if (a >= mod) a -= mod; }


void solve();

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);

  int T;
  // cin >> T;
  T = 1;

  while (T--) {
    solve();
  }
}

void solve() {
  int n;
  cin >> n;
  map<string, int> mp;
  rep(i, n) {
    string s;
    cin >> s;
    mp[s]++;
  }
  cout << sz(mp) << endl;
}


Measured memory_bytes: 19236
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 2e5 + 5;
int n,u,v;
int a[MAXN],f[MAXN],p[MAXN],ans[MAXN];
bool vis[MAXN];
template<class T>
void read(T& x, int f = 1) {
	char ch = getchar();
	x = 0;
	while (ch < '0' || ch > '9') f = (ch == '-' ? -1 : 1), ch = getchar();
	while (ch >= '0' && ch <= '9') x = x * 10 + ch - 48, ch = getchar();
	x *= f;
}
struct Edge {
	int next,to;
} e[MAXN<<1];
void addEdge(int from,int to) {
	static int t;
	e[t].to=to,e[t].next=p[from],p[from]=t++;
}
void dfs(int now,int len) {
	vis[now]=1,ans[now]=len;
	for(int i=p[now]; ~i; i=e[i].next) {
		int to=e[i].to;
		if(!vis[to]) {
			int id = lower_bound(f+1,f+len+1,a[to]) - f -1;
			int tmp = f[id+1];
			f[id+1]=a[to];
			dfs(to,max(len,id+1));
			f[id+1]=tmp;
		}
	}
}
int main() {
	read(n);
	for(int i=1; i<=n; i++) read(a[i]);
	memset(p,-1,sizeof(p));
	for(int i=1; i<=n-1; i++) {
		read(u),read(v);
		addEdge(u,v),addEdge(v,u);
	}
	f[1]=a[1];
	dfs(1,1);
	for(int i=1; i<=n; i++)
		printf("%d\n",ans[i]);
	return 0;
}

Measured memory_bytes: 23556
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> PLL;
#define chmax(x, y) do { x = max(x, y); } while(0)
#define chmin(x, y) do { x = min(x, y); } while(0)
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (ll i = static_cast<ll>(a); i < static_cast<ll>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT
template<typename T>
using reversed_priority_queue = std::priority_queue<T, std::vector<T>, std::greater<T> >;

const ll INF = 1e17;
ll N, M;
vector<ll> dist(200000, INF);
vector<ll> nexts(200000, INF);
vector<ll> edges[200000];

signed main() {
  cin >> N >> M;
  rep(i, M) {
    ll a, b;
    cin >> a >> b;
    edges[a].push_back(b);
    edges[b].push_back(a);
  }
  using T = tuple<ll, ll, ll>;
  reversed_priority_queue<T> q; // {distance, next_node, node}
  q.emplace(0LL, 0LL, 1LL);
  while (!q.empty()) {
    auto [d, nn, n] = q.top();
    q.pop();
    if (dist[n] <= d) continue;
    dist[n] = d;
    nexts[n] = nn;
    for (auto e : edges[n]) {
      q.emplace(d+1LL, n, e);
    }
  }
  cout << "Yes" << endl;
  for (ll i = 2; i <= N; i++) {
    cout << nexts[i] << endl;
  }
  return 0;
}


Measured memory_bytes: 29712
#include <stdio.h>
#include <string.h>
#include <math.h>
int main(void){
    int N, K;
    scanf("%d", &N);
    char S[N], s;
    scanf("%s", S);
    scanf("%d", &K);
    s = S[K - 1];
    for (int i = 0; i < N; i++) {
        if (S[i] != s) {
            S[i] = '*';
        }
    }
    printf("%s", S);
    return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include <iomanip>
#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <tuple>
#include <climits>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<LL> VLL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef vector<vector<long long>> VVLL;
typedef vector<vector<bool>> VVB;
typedef vector<vector<double>> VVD;

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define all(a) (a).begin(),(a).end()

const int MOD = 1000000007;

template<class T>bool chmax(T &a, const T &b){
	if(a<b){
		a=b;
		return true;
	}
	return false;
}

template<class T>bool chmin(T &a, const T &b){
	if(a>b){
		a=b;
		return true;
	}
	return false;
}

void debug(VI &arr){
	int n=arr.size();
	rep(i,n){
		cout<<arr.at(i)<<endl;
	}
}

void debug(VVI &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout << board.at(i).at(j) << " ";
		}
		cout<<endl;
	}
}

void debug(VVLL &board){
	int h = board.size();
	int w = board.at(0).size();
	rep(i,h){
		rep(j,w){
			cout<<board.at(i).at(j)<<" ";
		}
		cout<<endl;
	}
}

void debug(VS &board){
	int h = board.size();
	rep(i,h){
		cout<<board.at(i)<<endl;
	}
	return;
}

LL gcd(LL a,LL b){
	return b==0?a:gcd(b,a%b);
}

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

int main(){
	//cout<<fixed;
	//cout<<setprecision(9)<<...
	int n,k;
	cin>>n>>k;
	int sunuke[110];
	VI d(k,0);
	int a[110][110];
	for(int i=0;i<k;i++){
		cin>>d[i];
		for(int j=0;j<d[i];j++){
			cin>>a[i][j];
			sunuke[a[i][j]]++;
		}
	}
	int ans=0;
	for(int i=1;i<=n;i++){
		if(sunuke[i]==0){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3680
S = input()
T = input()

max_count = 0
for i in range(len(S)-len(T)+1):
    temp = 0
    for j in range(len(T)):
        if S[i+j] == T[j]:
            temp+=1
    if temp > max_count:
        max_count = temp

print(len(T)-max_count)

Measured memory_bytes: 67504
#include<iostream>
#include<cmath>

using namespace std;

int main() {
        int a, b;
        while(cin>>a>>b) {
                int c=a+b;
                for(int i=1; i<=8; i++) {
                        int power = pow(10, i);
                        if(c/power==0) {
                                cout << i << endl;
                                break;
                        }
                }
        }
        return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

vector<int> G[10001];
vector<int> node(10001, -1);


int main(){

    int n;
    cin >> n;
    node.resize(n);

    map<int, int> deg;
    vector<int> c(n);
    rep(i, n-1){
        int a, b;
        cin >> a >> b;
        --a; --b;
        ++deg[a]; ++deg[b];
        G[a].push_back(b);
        G[b].push_back(a);
    }
    int m = 0;
    rep(i, n) cin >> c[i];
    sort(c.rbegin(), c.rend());
    rep(i, n-1) m += c[n-1-i];
    ppp(m);


    int maxdeg = 0;
    int maxdegnode = 0;
    for(auto x : deg){
        if(x.second > maxdeg) maxdeg = x.second, maxdegnode = x.first;
    }


    queue<int> q;
    q.push(maxdegnode);
    int idx = 0;
    while(!q.empty()){
        int i = q.front(); q.pop();
        node[i] = c[idx]; ++idx;
        for(int j : G[i]){
            if(node[j] < 0) q.push(j);
        }
    }

    rep(i, n){
        cout << node[i] << sp;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1536
#include<iostream>
#include<algorithm>
#include<climits>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define scan(arg) cin>>arg
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
using namespace std;
typedef long long ll;
const int NMAX=1<<17;
int n;
int main(){
  scan(n);
  if(n%10==9||(n/10)%10==9){
    prin("Yes");
  }
  else prin("No");

  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

int main(){
    string s1,s2;
    cin >> s1 >> s2;

    s2.pop_back();

    if(s1 == s2)cout << "Yes" << endl;
    else cout << "No" << endl;
     
    return 0;
}

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

class TreeNode {
public:
    TreeNode *left;
    TreeNode *right;
    int val;
    TreeNode(int val) : left(nullptr), right(nullptr), val(val) {}
};

TreeNode* insert(TreeNode* root, int val)
{
    if (!root) return new TreeNode(val);
    TreeNode* curr = root;
    TreeNode* prev = nullptr;
    while (curr) {
        prev = curr;
        if (val < curr->val) {
            curr = curr->left;
        } else {
            curr = curr->right;
        }
    }
    if (val < prev->val)
        prev->left = new TreeNode(val);
    else
        prev->right = new  TreeNode(val);
    return root;
}

bool find(TreeNode* root, int val)
{
    if (!root) return false;

    TreeNode* curr = root;
    while (curr) {
        if (val < curr->val) {
            curr = curr->left;
        } else if (val > curr->val) {
            curr = curr->right;
        } else {
            return true;
        }
    }
    return false;
}

void inorder(TreeNode* root)
{
    if (!root) return;
    inorder(root->left);
    cout << " " << root->val;
    inorder(root->right);
}

void preorder(TreeNode* root)
{
    if (!root) return;
    cout << " " << root->val;
    preorder(root->left);
    preorder(root->right);
}

int main()
{
    int n;
    cin >> n;
    string s;
    int val;
    TreeNode* tree = nullptr;
    for (int i = 0; i < n; i++) {
        cin >> s;
        if (s == "insert") {
            cin >> val;
            tree = insert(tree, val);
        } else if (s == "find") {
            cin >> val;
            if (find(tree, val)) {
                cout << "yes" << endl;
            } else {
                cout << "no" << endl;
            }
        } else if (s == "print") {
            inorder(tree);
            cout << endl;
            preorder(tree);
            cout << endl;
        }
    }
}


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

int main() {
	
	vector<int> seq = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

	int K;
	cin >> K;

	cout << seq[K-1] << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL (-1)
#define LL long long
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	string s = "No";

	if (abs(a - c) <= d) {
		s = "Yes";
	}
	else {
		if ((abs(a - b) <= d) && (abs(b - c) <= d)) s = "Yes";
	}

	cout << s << endl;
}

Measured memory_bytes: 3556
A,B,K = [int(i) for i in input().rstrip().split()]

if K <= (B-A+1)/2:
  print(*( list(range(A,A+K)) + list(range(B-K+1,B+1)) ),sep="\n")
else:
  print(*list(range(A,B+1)),sep="\n")


Measured memory_bytes: 3060
s = [0] *5
for i in range(5):
    s[i] = int(input())

k = int(input())

b = True
for i in range(4):
    for j in range(4-i):
        # print(str(s[i+j+1])+"-"+str(s[i])+":" + str(s[i+j+1]-s[i]))
        if s[i+j+1]-s[i] > k:
            b = False
            break

if b:
    print("Yay!")
else:
    print(":(")
    

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
 
int main(){
  int n,m,c;
  cin>>n>>m>>c;
  vector<int> b(m);
  int ans=0;
  int cnt=0;
  vector<vector<int>> a(n,vector<int>(m));
  rep(i,m) cin>>b[i];
  rep(i,n)rep(j,m) cin>>a[i][j];
  rep(i,n){
    cnt=0;
    rep(j,m){
      cnt+=a[i][j]*b[j];
    }
    cnt+=c;//cnt+c;
    if(cnt>0) ans++;//ans=ans+1;
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3600
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

vector<int> a;

long long calc(int k){
    long long res = 0, t = 0;
    for(int i = 0; i < a.size(); i++){
        t += a[i];
        if(t == 0 || ((t < 0) != (k < 0))){
            res += abs(t - k);
            t = k;
        }
        k = -k;
    }
    return res;
}

int main(){
	long long n, ans = 0, ans2 = 0;
	cin >> n;
    a = vector<int>(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    ans = calc(1);
    ans2 = calc(-1);
	cout << min(ans, ans2) << endl;
	return 0;
}


Measured memory_bytes: 640