akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
int main(){
	int A,B,K;
	cin>>A>>B>>K;
	set<int> tes;
	for(int i=A;i<A+K && i<=B;i++)
		tes.insert(i);
	for(int i=B;i>B-K && i>=A;i--)
		tes.insert(i);
	for(int i:tes){
			cout<<i<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; i++)
#define PI 3.14159265359
#define INF 1000100100
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
 
 
int main(){
    string s; cin >> s;
    int l=s.length();
    string fo=""; string la="";
    rep(i,(l-1)/2) fo+=s[i];
    for(int i=((l+3)/2)-1; i<l; i++) la+=s[i];
    string fo2,la2;
    fo2=fo; la2=la;
    reverse(all(fo2)); reverse(all(la2));
    string ss; ss=s;
    reverse(all(ss));
    if(fo==fo2 && la==la2 && ss==s) cout << "Yes" << endl;
    else cout << "No" << endl;
    
return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i,l,r) for(int (i)=(l);(i)<(r);(i)++)
#define erep(i,l,r) for(int (i)=(l);(i)<=(r);(i)++)
#define MOD 1000000007
using namespace std;
#define ll long long
ll inv(ll a){
  ll t=1;
  while (a>1){
    t=t*(MOD-MOD/a)%MOD;
    a=MOD%a;
  }
  return t;
}
ll comb(ll n,ll k){
  if (k>n-k) k=n-k;
  ll nu=1,de=1;
  rep(i,1,k+1){
    nu=nu*(n+1-i)%MOD;
    de=de*i%MOD;
  }
  return nu*inv(de)%MOD;
}
ll nHr(ll n, ll r){
    return comb(n+r-1,r);
}
int main()
{
	int x,y;
	int mod = 1000000007;
	cin >> x >> y;
	int n = max(x,y) - min(x,y);
	if((x + y) % 3 != 0 || max(x,y) > 2 * min(x,y)){
		cout << 0 << endl;
	}else{
		int hh = (x + y) / 3;
		int sb = (hh - n) / 2;
		int xx = sb;
		int yy = sb + n;
//		cout << xx << " " << yy << endl;
		long long ans = 1;
		cout << comb(hh,sb)<< endl;
	}
	
	return 0;
}

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

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

using namespace std;

int N;
int x[101], y[101], h[101];


int main()
{
    scanf(" %d ", &N);
    REP(i, N)
        scanf(" %d %d %d ", &x[i], &y[i], &h[i]);

    REP(cx, 101) {
        REP(cy, 101) {
            bool flag = true;
            int H;
            REP(i, N) {
                if(h[i]>0) {
                    H = abs(x[i]-cx)+abs(y[i]-cy)+h[i];
                    break;
                }
            }

            REP(i, N) {
                int tmpH = max(H-abs(x[i]-cx)-abs(y[i]-cy), 0);
                if(tmpH!=h[i]) {
                    flag = false;
                    break;
                }
            }

            if(flag) {
                printf("%d %d %d\n", cx, cy, H);
                break;
            }
        }
    }

    return 0;
}


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

typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define int ll

const ll MOD = 1000000007;
const ll INF_LL = (ll)1000000007 * 1000000007;
const int INF_INT = (int)1000000007;
const double PI = 3.14159265358979323846;

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define irep(itr, st) for (auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for (auto itr = (st).rbegin(); itr != (st).rend(); ++itr)

#define m0(x) memset((x), 0, sizeof((x)))
#define m1(x) memset((x), -1, sizeof((x)))

// xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end()  // sortなどの引数を省略したい
#define RALL(x) (x).rbegin(), (x).rend()  // sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())     // sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x))  //最大値を求める
#define MIN(x) *min_element(ALL(x))  //最小値を求める
#define all(x) (x).begin(), (x).end()

//略記
#define pb emplace_back  // vectorヘの挿入
#define mp make_pair     // pairのコンストラクタ
#define F first          // pairの一つ目の要素
#define S second         // pairの二つ目の要素

#define BITCOUNT __builtin_popcount
#define BITCOUNT_LL(x) __builtin_popcountll(x)

#define perm(c)             \
  sort(all(c));             \
  for (bool c##p = 1; c##p; \
       c##p = next_permutation(all(c)))  //順列 123 132 213 231 312 321

#define BIT(n) (1LL << (n))

#ifdef DEBUG
#define PRINT(A) std::cout << (#A) << ": " << (A) << std::endl;
#else
#define PRINT(A)
#endif

//入力高速化
struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

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

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

signed main() {
  int N,D; cin >> N >> D;

  int ans = 0;

  rep(i, N) {
    int X, Y; cin >> X >> Y;
    if(X*X + Y*Y <= D*D) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3652
N = input()

A = N[0]
B = N[1]
C = N[2]
D = N[3]

OP = ['+', '-']

for i in range(0, 2):
    for j in range(0, 2):
        for k in range(0, 2):
            textlist =A+OP[i]+B+OP[j]+C+OP[k]+D
            if eval(textlist) == 7:
                print (textlist,'=7',sep='')
                exit()                


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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

vector<pair<int64, int>> Factorize(int64 x) {
  vector<pair<int64, int>> r;
  for (int64 d = 2; d * d <= x; d++) {
    int c = 0;
    while (x % d == 0) {
      x /= d;
      c++;
    }
    if (c > 0) {
      r.push_back({d, c});
    }
  }
  if (x > 1) r.push_back({x, 1});
  return r;
}

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

  int64 n;
  cin >> n;
  auto pfs = Factorize(n);
  int count = 0;
  for (auto[p, f] : pfs) {
    // cout << "p: " << p << " f: " << f << endl;
    for (int i = 1; i <= f; i++) {
      // cout << i << " " << f << endl;
      f -= i;
      count++;
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 3680
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long ll;

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i = 0; i < N; i++){
        cin >> A[i];
    }
    
    sort(A.begin(), A.end());
    
    // option1 <= option2になるように走査
    int option1 = 0, option2 = 0;
    int now = 0;
    int now_ele = A[0];
    int cnt;        // 調べている要素のA中にある要素数
    
    while(now < A.size()){
        // nowの更新を済ませておく
        now = upper_bound(A.begin(), A.end(), now_ele) - A.begin();
        cnt = upper_bound(A.begin(), A.end(), now_ele) - lower_bound(A.begin(), A.end(), now_ele);
        
        if(cnt < 2){
            now_ele = A[now];
            continue;
        }
        
        if(cnt < 4){        // option1 <= option2
            if(now_ele <= option1){     // Aがソートされているのでないはずだが
                break;
            }
            else if(now_ele <= option2){     // now_ele > option1
                option1 = now_ele;
            }
            else{                           // now_ele > option2
                swap(option1, option2);
                option2 = now_ele;
            }
            if(option1 > option2){
                swap(option1, option2);
            }
        }
        
        else{          // cnt >= 4
            if(now_ele <= option1){
                break;
            }
            else if(now_ele <= option2){
                option1 = now_ele;
            }
            else{       // now_ele > option2
                option1 = now_ele;
                option2 = now_ele;
            }
            if(option1 > option2){
                swap(option1, option2);
            }
        }
        
        // now_eleの更新
        now_ele = A[now];
    }
    
    if(!option1 || !option2){
        cout << 0 << endl;
    }
    else{
        cout << (ll)option1 * option2 << endl;
    }
}

Measured memory_bytes: 640
#pragma GCC optimize("O3")
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
template<class T> using V=vector<T>; 
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
const ll inf=(1e18);
//const ll mod=998244353;
const ll mod=1000000007;
ll GCD(ll a,ll b) {return b ? GCD(b,a%b):a;}
ll LCM(ll c,ll d){return c/GCD(c,d)*d;}
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
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 (a>b) { a=b; return 1; } return 0; }
int main(){
ll n;
cin>>n;
ll ans=0;
for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
        for(int k=1;k<=n;k++){
            ans+=GCD(i,GCD(j,k));
        }
    }
}
cout<<ans<<"\n";
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL<<60;
#define all(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0; i<(n);++i)
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int main(){
    int N, M; cin >> N >> M;
    priority_queue<pair<int,int>> task;
    REP(i,N) {
        int a, b;
        cin >> a >> b;
        task.push(make_pair(M-a,b));
    }
    int ans = 0;
    priority_queue<int> possible; 
    for (int i=M-1;i>=0;i--){
        while(!task.empty() && task.top().first>=i){
            possible.push(task.top().second); task.pop();
        }
        if (!possible.empty()){
            ans += possible.top(); possible.pop();
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 2036
#include <iostream> // cout, endl, cin
#include <iomanip>
#include <string>        // string, to_string, stoi
#include <vector>        // vector
#include <algorithm>     // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility>       // pair, make_pair
#include <tuple>         // tuple, make_tuple
#include <cstdint>       // int64_t, int*_t
#include <cstdio>        // printf
#include <map>           // map
#include <queue>         // queue, priority_queue
#include <set>           // set
#include <stack>         // stack
#include <deque>         // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset>        // bitset
#include <cctype>        // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <numeric>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
const int INF = 1001001001;

int main()
{
    int N, Y;
    cin >> N >> Y;
    int x = 0, y = 0, z = 0;

    int right = (Y/1000) - N;

    rep(i, N+1)
    {
        rep(j, N+1)
        {
            int left = (9*i) + (4*j);
            if(left == right)
            {
                if(i + j <= N)
                {
                    x = i; y = j; z = N - (i + j);
                    cout << x << " " << y << " " << z << endl;
                    return 0;
                }
                break;
            }
            if(left - right > 0)
            {
                break;
            }
        }
    }
    cout << "-1 -1 -1" << endl;
}


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

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>

using namespace std;

#define pt(s)      cerr << s << endl
#define pt(a, b)      cerr << a << " "  << b << endl
#define MEM(a,b)    memset(a, b, sizeof(a))
#define UN(a)       sort(all(a)), a.erase(unique(all(a)), a.end())
#define REV(a)      reverse(all(a))
#define MP(a, b)    make_pair(a, b)
#define PAIR(a, b)  pair<int, int>(a, b)

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

const int MOD = 1e9 + 7;
const int maxn = 1;
const double EPS = 1e-8;

class AAtCoderBeginnerContest999 {
public:
	void solve(std::istream& in, std::ostream& out) {
		string s;
		in >> s;
		for (int i = 0; i < s.size(); ++i) {
			if(s[i] == '9')s[i] = '1';
			else if(s[i] == '1')s[i] = '9';
		}
		out << s;
	}
};


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	AAtCoderBeginnerContest999 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 764
def main():
    n = int(input())
    ps = list(map(int, input().split()))
    ps_sort = sorted(ps)

    Count = 0
    for i, j in zip(ps, ps_sort):
        if i != j:
            Count += 1

    if Count == 2 or Count == 0:
        print('YES')
    else:
        print('NO')


if __name__ == "__main__":
    main()


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl "\n"
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}


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

  int n;
  cin >> n;
  vl a(n+1), b(n);
  rep(i,n+1) cin >> a[i];
  rep(i,n) cin >> b[i];
  ll ans = 0;
  rep(i,n) {
    if(a[i] <= b[i]) {
      ans += a[i];
      b[i] -= a[i];
    }
    else {
      ans += b[i];
      b[i] = 0;
    }
    if(a[i+1] <= b[i]) {
      ans += a[i+1];
      a[i+1] = 0;
    }
    else {
      ans += b[i];
      a[i+1] -= b[i];
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  i64 r = 0;
  int p = 0, a;
  F0R(i, N) {
    cin >> a;
    if (p > a) {
      r += p - a;
      a = p;
    }
    else p = a;
  }
  cout << r;
}
#endif


Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>
#include <numeric>
#include <string>
#include <cassert>

using namespace std;
typedef long long ll;

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A;
  vector<vector<int> > vv;
  for (int k = 0; k < M; ++k) {
    int a, b;
    cin >> a >> b;
    A.push_back(a);
    vector<int> v;
    for (int i = 0; i < b; ++i) {
      int c;
      cin >> c;
      v.push_back(c - 1);
    }
    vv.push_back(v);
  }

  const int kINF = 1000000000;
  
  vector<vector<int> > dp(N + 1, vector<int>(1<<N, kINF));
  dp[0][0] = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < (1<<N); ++j) {
      if (dp[i][j] == kINF) continue;
      dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
      for (int k = 0; k < M; ++k) {
	int nj = j;
	for (auto x : vv[k]) {
	  nj |= 1<<x;
	}
	dp[i + 1][nj] = min(dp[i + 1][nj], dp[i][j] + A[k]);
      }
    }
  }
  if (dp[N][(1<<N) - 1] != kINF) {
    cout << dp[N][(1<<N) - 1] << endl;
  } else {
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 512
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getInts(N int) []int {
	ret := make([]int, N)
	for i := 0; i < N; i++ {
		ret[i] = getInt()
	}
	return ret
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func lowerBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] >= x
	})
	return idx
}

func upperBound(a []int, x int) int {
	idx := sort.Search(len(a), func(i int) bool {
		return a[i] > x
	})
	return idx
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	a := getInts(N)
	c := 1
	cnt := 0
	for i := 0; i < N; i++ {
		if a[i] != c {
			cnt++
		} else {
			c++
		}
		// out(a[i], c, cnt)
	}
	if cnt == N {
		out(-1)
		return
	}
	out(cnt)
}


Measured memory_bytes: 4996
// #include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
#include <stack>
#include <numeric>
// #include <windows.h>
using namespace std;
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = V<VV<T>>;
template<class T1, class T2> using P = pair<T1, T2>;
using I = int;
using D = double;
using B = bool;
using C = char;
using S = string;
using LL = long long;
using LD = long double;
using ULL = unsigned long long;
using PII = P<I, I>;
using VPII = V<PII>;
using PLL = P<LL, LL>;
using VPLL = V<PLL>;
using VI = V<I>;
using VVI = VV<I>;
using VLL = V<LL>;
using VVLL = VV<LL>;
using VC = V<C>;
using VVC = VV<C>;
using VS = V<S>;
using VVS = VV<S>;
using VB = V<B>;
using VVB = VV<B>;
#define REP(type, i, n) for (type i = 0; i < (type)(n); ++i)
#define REP2(type, i, m, n) for (type i = (m); i < (type)(n); ++i)
#define REPR(type, i, n) for (type i = (n)-1; i >= 0; --i)
#define REPR2(type, i, m, n) for (type i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a, type) sort(ALL(a), greater<type>())
#define SORTF(a, comp) sort(ALL(a), comp)
#define REVERSE(a) reverse(ALL(a))
#define SIZE(a, type) ((type)(a).size())
#define bit_search(bit, n) REP(LL, bit, 1LL<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REPx(&x, a) cin >> x;
#define INPUT2(a) REPx(&x, a) INPUT(x);
#define INPUTP(a) REPx(&x, a) cin >> x.first >> x.second;
#define ENDL cout << endl;

const int INF = 2e9;
// const LL INF = 9e18;
const LL MOD = 1e9+7;

template<class T> using PRIORITY_QUEUE = priority_queue< T, V<T>, greater<T> >;
template<class T> inline bool chmin(T &a, T b){if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T &a, T b){if (a < b) {a = b; return true;} return false;}
template<class T> inline void debug1(V<T> A){REP(int, i, SIZE(A, int)){if (A[i] == INF) cout << "I ";else cout << A[i] << " ";}ENDL}
template<class T> inline void debug2(VV<T> A){REP(int, i, SIZE(A, int)){REP(int, j, SIZE(A[i], int)){if (A[i][j] == INF) cout << "I "; else cout << A[i][j] << " ";}ENDL}}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, ans = 0;
  cin >> n;
  VI a(n);
  INPUT(a);
  REP(int, i, n) if (i % 2 == 0 && a[i] % 2) ans++;
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace std;
#define ll long long int
#define ld long long double
#define vi vector<int>
#define vl vector<ll>
#define pi pair<int, int>
#define pl pair<ll, ll>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define nl '\n'
#define mp make_pair
#define debug1(x) cout <<#x<<" "<<x<<'\n';
#define debug2(x,y) cout <<#x<<" "<<x <<" "<<#y<<" "<<y <<'\n';
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<'\n';
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
const int mod = (int)1e9 + 7;
pair<ll, ll>s4[4] = {{ -1, 0}, {1, 0}, {0, -1}, {0, 1}};
pair<ll, ll>s8[8] = {{ -1, -1}, { -1, 0}, { -1, 1}, {0, -1}, {0, 1}, {1, 1}, {1, 0}, {1, -1}};

void judge() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

void solve() {
    ll n;
    cin >> n;
    ll x = 1000;
    n = n % x;
    if (n == 0) {
        cout << 0 << nl;
    }
    else
        cout << 1000 - n << nl;

}

signed main() {
    judge();
    boost;
    solve();
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int>pii;
#define sf(x) scanf("%d",&x)
#define sfl(x) scanf("%lld",&x)
#define lli long long int
#define ll64 int64_t
#define pb push_back
#define fio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define frr(i,a) for(int i=0;i<a;i++)
#define frl(i,a) for(lli i=0;i<a;i++)

int main()
{
    int n;
    cin>>n;
    if(n==0)
    {
        cout<<1<<endl;
    }
    else
    {
        cout<<0<<endl;
    }
}


Measured memory_bytes: 3588
import re
while True:
    n,t=input().split()
    
    if t=='X':
        break
    
    if '_'in t:
        ans=s.split('_')
    else :
        ans=re.findall(r'[a-z]+|[A-Z][a-z]*',n)
        
    if t=='D':
        ans='_'.join(map(str.lower,ans))
    else :
        ans=''.join(map(str.capitalize,ans))
        if t=='L':
            ans=ans[0].lower()+ans[1:]
    
    print(ans)


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

int l[2005][2005], r[2005][2005], u[2005][2005], d[2005][2005];

int main()
{
    int h, w; cin >> h >> w;
    vector<string> s(h);
    for (int i = 0; i < h; i++) cin >> s[i];
    for (int i = 0; i < h; i++) {
        l[i][0] = s[i][0] == '.';
        r[i][w-1] = s[i][w-1] == '.';
        for (int j = 1; j < w; j++) {
            l[i][j] = (s[i][j] == '#' ? 0 : l[i][j-1] + 1);
            r[i][w-j-1] = (s[i][w-j-1] == '#' ? 0 : r[i][w-j] + 1);
        }
    }
    for (int j = 0; j < w; j++) {
        u[0][j] = s[0][j] == '.';
        d[h-1][j] = s[h-1][j] == '.';
        for (int i = 1; i < h; i++) {
            u[i][j] = (s[i][j] == '#' ? 0 : u[i-1][j] + 1);
            d[h-i-1][j] = (s[h-i-1][j] == '#' ? 0 : d[h-i][j] + 1);
        }
    }

    int ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            ans = max(ans, l[i][j]+r[i][j]+u[i][j]+d[i][j] - 3);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 67072
n, m = map(int, input().split())
route = [[] for _ in range(n+1)]
ans = [0]*n

for _ in range(m):
    a, b = map(int, input().split())
    route[a].append(b)
    route[b].append(a)

q = [1]
l = set()

while True:
    if len(q) == 0:
        break
    p = q.pop(0)
    for i in route[p]:
        if i not in l:
            l.add(i)
            ans[i-1] = p
            q.append(i)

if ans.count(0) > 1:
    print("No")
else:
    print("Yes")
    for i in range(1, n):
        print(ans[i])

Measured memory_bytes: 40020
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define pback push_back
#define mpair make_pair
#define MODN 1000000007

using namespace std;


int main(){


    int a,b;
    cin >> a >> b;

    cout << max(a + b, max(a - b, a * b)) << endl;

    return 0;

}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */

public class Main {
    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                new Main().solve();
            }
        }, "1", 1 << 26).start();
    }

    void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(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, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int k = in.scanInt();
            int ans = 0;
            for (int i = 0; i < n; i++) {
                if (in.scanInt() >= k) ans++;
            }
            out.println(ans);
        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}



Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(int i=(a),i##Len_=(b);i<i##Len_;i++)
const char* LF = "\n";
namespace{struct _{_(){
    cin.tie(0);
    ios::sync_with_stdio(false);
}}a;}

int ft[26][26];

signed main() {
    string S, T;
    cin >> S >> T;

    REP(i, S.size()) {
        ft[S[i] - 'a'][T[i] - 'a']++;
    }

    REP(i, 26) {
        int x = 0, x2 = 0;
        REP(j, 26) {
            if (ft[i][j]) x++;
            if (ft[j][i]) x2++;
        }
        if (x >= 2 || x2 >= 2) {
            cout << "No" << LF;
            return 0;
        }
    }
    cout << "Yes" << LF;

    return 0;
}


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

const int INF = 1000000;

struct Edge {
    int u, v, w;

    Edge(int u, int v, int w) : u(u), v(v), w(w) {}

    // order edges by weight
    bool operator <(const Edge& x) const {
        return w < x.w;
    }
};

int edmonds(vector<Edge>& edgeList, int V, int R) {
    
    // determine min cost of edge entering each vertex
    vector<Edge> minInEdge(V, Edge(-1, -1, INF));
    for (Edge e : edgeList) {
        minInEdge[e.v] = min(minInEdge[e.v], e);
    } minInEdge[R] = Edge(-1, R, 0);

    // assign vertices to their cyclic group
    vector<int> group(V, 0);
    vector<bool> visited(V, false), isCycleGroup(V, false); int cnt = 0;
    for (int i = 0; i < V; i++) {
        if (visited[i])
            continue;

        int node = i; vector<int> path;
        while (node != -1 && !visited[node]) {
            visited[node] = true;
            path.push_back(node);
            node = minInEdge[node].u;
        }

        bool isCycle = false;
        for (int v : path) {
            group[v] = cnt;
            if (v == node)
                isCycleGroup[cnt] = isCycle = true;
            if (!isCycle)
                cnt++;
        }

        if (isCycle)
            cnt++;
    }

    // when there are no cycles
    if (cnt == V) {
        int result = 0;
        for (Edge e : minInEdge)
            result += e.w;
        return result;
    }

    int result = 0;
    for (Edge e : minInEdge)
        if (isCycleGroup[group[e.v]])
            result += e.w;

    // form new graph with groups
    vector<Edge> n_edgeList;
    for (Edge e : edgeList) {
        int u = group[e.u], v = group[e.v], w = e.w;
        if (u == v)
            continue;
        else
            n_edgeList.push_back(Edge(u, v, w - (isCycleGroup[v] ? minInEdge[e.v].w : 0)));
    }

    return result + edmonds(n_edgeList, cnt, group[R]);
}

int main() {

    int V, E, R; vector<Edge> edgeList;
    scanf("%d%d%d", &V, &E, &R);
    for (int i = 0, u, v, w; i < E; i++) {
        scanf("%d%d%d", &u, &v, &w);

        edgeList.push_back(Edge(u, v, w));
    }

    int result = edmonds(edgeList, V, R);

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

    return 0;
}

Measured memory_bytes: 3376
#include <stdio.h>
#include <string.h>

#define UF_MAX 26

int uf_table[UF_MAX];

void uf_init(void) {
	int i;
	for(i=0;i<UF_MAX;i++)uf_table[i]=0;
}

void uf_merge(int a,int b) {
	int next;
	while(uf_table[a]>0) {
		next=uf_table[a]-1;
		if(uf_table[next]>0)uf_table[a]=uf_table[next];
		a=next;
	}
	while(uf_table[b]>0) {
		next=uf_table[b]-1;
		if(uf_table[next]>0)uf_table[b]=uf_table[next];
		b=next;
	}
	if(a!=b)uf_table[a]=b+1;
}

int uf_issame(int a,int b) {
	int next;
	while(uf_table[a]>0) {
		next=uf_table[a]-1;
		if(uf_table[next]>0)uf_table[a]=uf_table[next];
		a=next;
	}
	while(uf_table[b]>0) {
		next=uf_table[b]-1;
		if(uf_table[next]>0)uf_table[b]=uf_table[next];
		b=next;
	}
	return a==b;
}

int main(void) {
	int n,i;
	int count_first[26];
	int count_last[26];
	int have_connection[26];
	char now_word[36];
	int now_first,now_last;
	int first_exist;
	while(1) {
		scanf("%d",&n);
		if(n==0)break;
		uf_init();
		memset(count_first,0,sizeof(count_first));
		memset(count_last,0,sizeof(count_last));
		memset(have_connection,0,sizeof(have_connection));
		for(i=0;i<n;i++) {
			scanf("%s",now_word);
			now_first=now_word[0]-'a';
			now_last=now_word[strlen(now_word)-1]-'a';
			count_first[now_first]++;
			count_last[now_last]++;
			if(now_first!=now_last)uf_merge(now_first,now_last);
		}
		first_exist=-1;
		for(i=0;i<26;i++) {
			if(count_first[i]>0 || count_last[i]>0) {
				if(first_exist<0)first_exist=i;
				if(!uf_issame(first_exist,i))break;
			}
			if(count_first[i]!=count_last[i])break;
		}
		puts(i<26?"NG":"OK");
	}
	return 0;
}

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

using namespace std;

typedef long long ll;

double getTime() { 
  return clock() / (double) CLOCKS_PER_SEC;
}

void read() {};

template<typename T, typename... Args>
void read(T& a, Args&... args) {
  cin >> a;
  read(args...);
}

void print() {};

template <typename T, typename... Args>
void print(T a, Args... args) {
  cout << a << " \n"[sizeof...(args) == 0];
  print(args...);
}

bool compare(pair <ll, ll> x, pair <ll, ll> y) {
  return x.second < y.second;
}

int main() {
  int n; read(n);
  vector <pair <int, int>> v(n);
  vector <pair <ll, ll>> inter(n);
  for(int i = 0; i < n; i++) {
    read(v[i].first, v[i].second);
    inter[i].first = (ll)v[i].first - v[i].second;
    inter[i].second = (ll)v[i].first + v[i].second - 1;
  }
  sort(inter.begin(), inter.end(), compare);
  int ans = 1;
  ll r = inter[0].second;
  for(int i = 1; i < n; i++) {
    if(inter[i].first > r) {
      r = inter[i].second;
      ans++;
    }
  }
  print(ans);
}

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

#define ll long long

int main(){

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

    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif

    int n;
    string s;
    cin>>n>>s;
    int r=0,w=0;
    for(char c:s){
        if(c=='R') r++;
        else w++;
    }
    int p = r;
    for(int i=0;i<p;i++){
        if(s[i]=='R') r--;
    }
    cout<<r;
}

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


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

    int i = 0;
    int ma = 0;
    int count = 0;
    while(i < n - 1) {
        if (h[i] < h[i + 1]) {
            i++;
            ma = max(ma, count);
            count = 0;
        }
        else{
            i++;
            count++;
        }
    }

    ma = max(ma, count);

    cout << ma;
}


Measured memory_bytes: 640
/**
 *      purpose : 
 *      author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *      created : 
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <functional>
#include <iomanip>
#include <random>
#include <utility>

using namespace std;

using int64 = long long;
#define debug(_) cerr << #_ << ": " << (_) << '\n'
template<typename T> inline void chmin(T &a, T b) { if (a > b) a = b; return; }
template<typename T> inline void chmax(T &a, T b) { if (a < b) a = b; return; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& vec) {
  os << '{'; for (size_t i = 0; i < vec.size(); ++i) { os << vec[i]; if (i != vec.size() - 1) os << ','; } os << '}';
  return os;
}
template<typename T, typename U> ostream& operator<<(ostream& os, const pair<T, U>& p) {
  return os << '{' << p.first << " " << p.second << '}';
}
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int64 INF64 = numeric_limits<int64>::max() / 2;
constexpr int MOD = 1000000007;
const double PI = acos(-1);

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

  int n, l; cin >> n >> l;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];

  int pos = -1;
  for (int i = 0; i < n - 1; ++i) {
    if (a[i] + a[i + 1] >= l) {
      pos = i;
    }
  }

  if (pos == -1) {
    cout << "Impossible" << '\n';
    return 0;
  }

  cout << "Possible" << '\n';

  for (int i = 0; i < pos; ++i) {
    cout << i + 1 << '\n';
  }
  for (int i = n - 2; i >= pos + 1; --i) {
    cout << i + 1 << '\n';
  }

  cout << pos + 1 << '\n';

  return 0;
}

Measured memory_bytes: 1280
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
#include<deque>
#include<iomanip>
#include<utility>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
#define S 21 
llfor;
const ll mod=1000000007;
/*pi*/const double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll ans=1;rep(i,0,n){ans*=x;}return ans;}
/*階乗*/ll fact(ll x){ll ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)*fact(n-r)/fact(r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=1,tmp=n;while(tmp/10>0){tmp/=10;d++;}return d;}
/*行列のコピー*/void matcpy(ll a[S][S],ll b[S][S]){ll t=i;rep(i,0,S)rep(j,0,S)b[i][j]=a[i][j];/*(aをbに)*/i=t;}
/*行列のリセット*/void matrst(ll a[S][S]){ll t=i;rep(i,0,S)rep(j,0,S)a[i][j]=0;i=t;}
/*行列の2乗*/void matpow(ll a[S][S]){ll ans[S][S];matrst(ans);ll t=i,k;rep(i,0,S)rep(j,0,S)rep(k,0,S)ans[i][j]+=a[i][k]*a[k][j];matcpy(ans,a);i=t;}
/*行列の乗算*/void matmul(ll a[S][S],ll b[S][S], ll as[S][S]){ll t=i,k;matrst(as);rep(i,0,S)rep(j,0,S)rep(k,0,S)as[i][j]+=a[i][k]*b[k][j];i=t;}
//ll ans=0;
////////////////////////////////////////////////////////////
int main(){
// ll a,b;cin>>a>>b;
 ll n;sc(n);
 ll tmp=0;
 ll k=0;
 ll cnt=1;
 while(k<=100000000){
  tmp+=cnt*7;
  tmp%=n;
  cnt*=10;
  cnt%=n;
  k++;
 // cout<<tmp<<" "<<k<<endl;
  if(tmp==0){
   pr(k);
   return 0;
  }
 }
 pr(-1);
return 0;}
// (10^x -1)*7/9=n*k
// (10^x -1)*7=n*k*9
// nが7の倍数じゃないときは、kは7の倍数

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
int main() {
    int A = 0;
    int B = 0;
    int C = 0;
    int X = 0;
    int Y = 0;
    cin >> A >> B >> C >> X >> Y;

    int result = INT_MAX;
    for (int ab = 0; ab <= int(2e5) ; ab += 2) {
        result = min(result, ab * C + max(0, X - ab/2) * A + max(0, Y - ab/2) * B);
    }
    cout << result;
    return 0;
}

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

#define 	pi 				3.1415926536
#define 	mod 			1000000007
#define 	ll  			long long int
#define 	rep(i, a, b) 	for(int i = a ; i < b ; i++)
#define     repn(i, a, b)   for(int i = a ; i > b ; i--)
#define 	mod1 			1000003
#define     mod2            998244353
#define 	hi   			"hello"
#define 	nl 				"\n"
#define 	ws 				" "
#define     sz              size()
#define     len             length()
#define 	F 				first
#define 	S 				second
#define 	PB 				push_back
#define 	MP				make_pair
#define 	B 				begin()
#define     RB              rbegin()
#define 	E 				end()
#define     UB              upper_bound
#define     LB              lower_bound
#define     present(k, m)   (m.find(k)!=m.end())?1:0
#define 	all(v) 			v.begin(), v.end()
#define 	reset(a, val) 	memset(a, val, sizeof(a))
#define 	vi 				vector<int>
#define     pii              pair<int, int>
#define     pll             pair<long long int, long long int>
#define     vll             vector<long long int>
#define 	vs 				vector<string>
#define     vc              vector<char>
#define 	print1(a) 		for(auto i : a)cout<<i<<" ";cout<<"\n"
#define 	print2(a) 		for(auto i : a)cout<<i;cout<<"\n"
#define 	boost 			ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

using namespace std;


/*############################# DSU ##############################*/
vi parent(1e5), Size(1e5), Rank(1e5);

void make_set(int v){
    parent[v]=v;
    Size[v] = 1;
    // Rank[v] = 0;
}
 
int find_set(int v){
	return (parent[v]==v) ?  v : parent[v] = find_set(parent[v]);
}
 
void union_sets(int a, int b){
	a = find_set(a);
	b = find_set(b);
	if(a != b){
        if(Size[a] < Size[b])
            swap(a, b);
        // if(Rank[a] < Rank[b])
        //     swap(a, b);
		parent[b] = a;
        Size[a] += Size[b];
        // if(Rank[a] == Rank[b])
        //     Rank[a]++;
    }
}
/*############################# DSU ##############################*/


bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }

bool compare(const pair<string, int>&a, const pair<string, int>&b){ return a.second<b.second; }

double logn(double n, double r) { return (n > r - 1) ? 1 + logn(n / r, r) : 0; }

ll pw2[32];
void cal(){ pw2[0] = 1; rep(i, 1, 32)pw2[i] = 2*pw2[i-1]; }

/* ################################################################ */

void solve()
{
    ll n, k; cin>>n>>k;
    ll d;
    map<int, int> mp;
    while(k--){
        cin>>d;
        ll tmp;
        rep(i, 0, d){
            cin>>tmp;
            mp[tmp]++;
        }
    }
    cout<<n-mp.sz<<nl;
}


int main()
{
    // boost;
    cal();
    int t = 1, k = 1;
    // cin>>t;
    while(t--){
        // cout<<"Case #"<<k<<": ";
        solve();
        k++;
    }
}

Measured memory_bytes: 4580
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, 1000000009)
	sc.Split(bufio.ScanWords)

	n, y := oneInt(), oneInt()

	for i := 0; i <= n; i++ {
		for j := 0; j <= n-i; j++ {
			if 10000*i+5000*j+1000*(n-i-j) == y {
				fmt.Println(i, j, n-i-j)
				return
			}
		}
	}

	fmt.Println(-1, -1, -1)
}

func oneInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func oneStr() string {
	sc.Scan()
	return sc.Text()
}

func scanNums(len int) (nums []int) {
	for i := 0; i < len; i++ {
		nums = append(nums, oneInt())
	}
	return nums
}

func scanStrings(len int) (strs []string) {
	for i := 0; i < len; i++ {
		strs = append(strs, oneStr())
	}
	return strs
}

func abs(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums []int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums []int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func sortAsc(a []int) []int {
	sort.Ints(a)
	return a
}

func sortDesc(a []int) []int {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
	return a
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	if a == 0 && b == 0 {
		return 0
	}
	return a * b / gcd(a, b)
}

func sum(nums []int) int {
	sum := 0
	for i := 0; i < len(nums); i++ {
		sum += nums[i]
	}
	return sum
}

func cumSum(nums []int) []int {
	sums := []int{0}

	for i := 0; i < len(nums); i++ {
		sums = append(sums, sums[i]+nums[i])
	}
	return sums
}

func sumOfEachDigit(num int) int {
	sum := 0
	for num > 0 {
		sum += num % 10
		num /= 10
	}
	return sum
}


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

int main(){
 int a, b,c,d;
 cin >> a>> b >> c>> d;
 int e = a;
 int f = c;
 while( e>0 && f>0 ){
    f -=  b;
  if(f<=0) {
   cout << "Yes" << endl;
  return 0;
  }
  e -= d;
  if(e<=0) {
   cout << "No" << endl;
  return 0;
  }
}
}

Measured memory_bytes: 3624
List = list(map(int,[input() for i in range(5)]))

a = lambda x:-(-x//10) * 10
b = lambda x:x % 10 if x % 10 !=0 else 10

aa = list(map(b, List))

a2 = aa.index(min(aa))
a3 = List.pop(a2)

print(sum(list(map(a,List)))+a3)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
const int N=1e5+7;
int n;
struct edge{
	int to,nx;
}e[N*2];
int f1[N],f2[N],e0[N],ep=2,deg[N],v[N],q[N],in[N],ql=0,qr=0;
void ae(int x,int y){
	++deg[x],++deg[y];
	e[ep]=(edge){y,e0[x]};e0[x]=ep++;
	e[ep]=(edge){x,e0[y]};e0[y]=ep++;
}
void dfs(int w){
	while(e0[w]){
		int i=e0[w];
		e0[w]=e[i].nx;
		int u=e[i].to;
		if(!u)continue;
		e[i^1].to=0;
		dfs(u);
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1,f;i<=n;++i){
		scanf("%d",&f);
		if(f<0)f=n+1;
		f1[i]=f;
		++in[f];
	}
	for(int i=1,f;i<=n;++i){
		scanf("%d",&f);
		if(f<0)f=n+1;
		f2[i]=f;
	}
	for(int i=1;i<=n;++i)ae(f1[i],f2[i]);
	for(int i=1;i<=n+1;++i)if(deg[i]&1)return puts("IMPOSSIBLE"),0;
	for(int i=1;i<=n;++i)dfs(i);
	for(int i=1;i<=n;++i)v[i]=e[i*2].to?1:-1;
	for(int i=1;i<=n;++i)if(!in[i])q[++qr]=i;
	while(ql!=qr){
		int w=q[++ql],f=f1[w];
		if(!--in[f])q[++qr]=f;
	}
	for(int t=qr;t;--t){
		int w=q[t];
		v[f1[w]]-=v[w];
	}
	puts("POSSIBLE");
	for(int i=1;i<=n;++i)printf("%d ",v[i]);
	return 0;
}

Measured memory_bytes: 6400
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)
#define bg begin()
#define ed end()
#define all(x) x.bg, x.ed
#define vi vector<int>
template <class t, class u>
bool chmax(t &a, u b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class t, class u>
bool chmin(t &a, u b)
{
    if (b < a)
    {
        a = b;
        return true;
    }
    return false;
}

//ll mod = 1000000007;
ll mod = 998244353;

int solve(vector<vector<int>> &vv, int i, int t)
{
    if (i == vv.size())
    {
        return t;
    }
    if (t == vv[i][1] || (t > vv[i][1] && (t - vv[i][1]) % vv[i][2] == 0))
    {
        return solve(vv, i + 1, t + vv[i][0]);
    }
    if (t < vv[i][1])
    {
        return solve(vv, i + 1, vv[i][1] + vv[i][0]);
    }
    return solve(vv, i + 1, (1 + (t - vv[i][1]) / vv[i][2]) * vv[i][2] + vv[i][1] + vv[i][0]);
}

signed main()
{
    int n;
    cin >> n;
    vector<vector<int>> vv(n - 1);
    rep(i, n - 1)
    {
        int c, s, f;
        cin >> c >> s >> f;
        vv[i].push_back(c);
        vv[i].push_back(s);
        vv[i].push_back(f);
    }
    rep(i, n - 1)
    {
        ll ans = solve(vv, i, 0);
        cout << ans << endl;
    }
    cout << 0 << endl;
    return 0;
}

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

int main() {
  int A, B;
  cin >> A >> B;

  if (B == 1) {
    cout << 0 << endl;
    return 0;
  }
  int ans = 1;
  for (int i = A; i < B; i += A - 1) ans++;
  cout << ans << endl;
}


Measured memory_bytes: 256
#!/usr/bin/perl

my ($K) = map { $_ - 0 } split(/\s+/,<STDIN>);

my @d = ();
$#d = 200;
for(my $i = 1; $i<=200;$i++){
  my @a = ();
  $#a = 200;
  for(my $j=1;$j<=200;$j++){
    $a[$j] = gcd($i,$j);
  }
  $d[$i] = \@a;
}

my $s = 0;
for(my $i=1;$i<=$K;$i++){
  for(my $j=$i;$j<=$K;$j++){
    for(my $k=$j;$k<=$K;$k++){
      my $g = $d[$d[$i]->[$j]]->[$k];
      if( $i == $j and $j == $k ){
        $s += $g;
      } elsif( $i==$j or $j==$k ){
        $s += 3 * $g;
      } else {
        $s += 6 * $g;
      }
    }
  }
}

print "$s\n";

exit(0);

sub gcd {
  my $aa = shift;
  my $bb = shift;
  if( $aa < $bb ) {
    my $tmp = $aa;
    $aa = $bb;
    $bb = $tmp;
  }
  my $r = $aa % $bb;
  while( $r != 0 ){
    $aa = $bb;
    $bb = $r;
    $r = $aa % $bb;
  }
  return $bb;
}



Measured memory_bytes: 6196